Commit d6c513e8 authored by Mark Brown's avatar Mark Brown

Merge remote-tracking branches 'asoc/topic/da7218' and 'asoc/topic/da7219' into asoc-next

...@@ -1954,17 +1954,44 @@ static int da7218_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) ...@@ -1954,17 +1954,44 @@ static int da7218_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)
return -EINVAL; return -EINVAL;
} }
switch (fmt & SND_SOC_DAIFMT_INV_MASK) { switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
case SND_SOC_DAIFMT_NB_NF: case SND_SOC_DAIFMT_I2S:
break; case SND_SOC_DAIFMT_LEFT_J:
case SND_SOC_DAIFMT_NB_IF: case SND_SOC_DAIFMT_RIGHT_J:
dai_clk_mode |= DA7218_DAI_WCLK_POL_INV; switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
break; case SND_SOC_DAIFMT_NB_NF:
case SND_SOC_DAIFMT_IB_NF: break;
dai_clk_mode |= DA7218_DAI_CLK_POL_INV; case SND_SOC_DAIFMT_NB_IF:
dai_clk_mode |= DA7218_DAI_WCLK_POL_INV;
break;
case SND_SOC_DAIFMT_IB_NF:
dai_clk_mode |= DA7218_DAI_CLK_POL_INV;
break;
case SND_SOC_DAIFMT_IB_IF:
dai_clk_mode |= DA7218_DAI_WCLK_POL_INV |
DA7218_DAI_CLK_POL_INV;
break;
default:
return -EINVAL;
}
break; break;
case SND_SOC_DAIFMT_IB_IF: case SND_SOC_DAIFMT_DSP_B:
dai_clk_mode |= DA7218_DAI_WCLK_POL_INV | DA7218_DAI_CLK_POL_INV; switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
case SND_SOC_DAIFMT_NB_NF:
dai_clk_mode |= DA7218_DAI_CLK_POL_INV;
break;
case SND_SOC_DAIFMT_NB_IF:
dai_clk_mode |= DA7218_DAI_WCLK_POL_INV |
DA7218_DAI_CLK_POL_INV;
break;
case SND_SOC_DAIFMT_IB_NF:
break;
case SND_SOC_DAIFMT_IB_IF:
dai_clk_mode |= DA7218_DAI_WCLK_POL_INV;
break;
default:
return -EINVAL;
}
break; break;
default: default:
return -EINVAL; return -EINVAL;
......
...@@ -1156,18 +1156,44 @@ static int da7219_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) ...@@ -1156,18 +1156,44 @@ static int da7219_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)
return -EINVAL; return -EINVAL;
} }
switch (fmt & SND_SOC_DAIFMT_INV_MASK) { switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
case SND_SOC_DAIFMT_NB_NF: case SND_SOC_DAIFMT_I2S:
break; case SND_SOC_DAIFMT_LEFT_J:
case SND_SOC_DAIFMT_NB_IF: case SND_SOC_DAIFMT_RIGHT_J:
dai_clk_mode |= DA7219_DAI_WCLK_POL_INV; switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
break; case SND_SOC_DAIFMT_NB_NF:
case SND_SOC_DAIFMT_IB_NF: break;
dai_clk_mode |= DA7219_DAI_CLK_POL_INV; case SND_SOC_DAIFMT_NB_IF:
dai_clk_mode |= DA7219_DAI_WCLK_POL_INV;
break;
case SND_SOC_DAIFMT_IB_NF:
dai_clk_mode |= DA7219_DAI_CLK_POL_INV;
break;
case SND_SOC_DAIFMT_IB_IF:
dai_clk_mode |= DA7219_DAI_WCLK_POL_INV |
DA7219_DAI_CLK_POL_INV;
break;
default:
return -EINVAL;
}
break; break;
case SND_SOC_DAIFMT_IB_IF: case SND_SOC_DAIFMT_DSP_B:
dai_clk_mode |= DA7219_DAI_WCLK_POL_INV | switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
DA7219_DAI_CLK_POL_INV; case SND_SOC_DAIFMT_NB_NF:
dai_clk_mode |= DA7219_DAI_CLK_POL_INV;
break;
case SND_SOC_DAIFMT_NB_IF:
dai_clk_mode |= DA7219_DAI_WCLK_POL_INV |
DA7219_DAI_CLK_POL_INV;
break;
case SND_SOC_DAIFMT_IB_NF:
break;
case SND_SOC_DAIFMT_IB_IF:
dai_clk_mode |= DA7219_DAI_WCLK_POL_INV;
break;
default:
return -EINVAL;
}
break; break;
default: default:
return -EINVAL; return -EINVAL;
...@@ -1592,9 +1618,14 @@ static void da7219_handle_pdata(struct snd_soc_codec *codec) ...@@ -1592,9 +1618,14 @@ static void da7219_handle_pdata(struct snd_soc_codec *codec)
} }
} }
static struct reg_sequence da7219_rev_aa_patch[] = {
{ DA7219_REFERENCES, 0x08 },
};
static int da7219_probe(struct snd_soc_codec *codec) static int da7219_probe(struct snd_soc_codec *codec)
{ {
struct da7219_priv *da7219 = snd_soc_codec_get_drvdata(codec); struct da7219_priv *da7219 = snd_soc_codec_get_drvdata(codec);
unsigned int rev;
int ret; int ret;
mutex_init(&da7219->lock); mutex_init(&da7219->lock);
...@@ -1604,6 +1635,26 @@ static int da7219_probe(struct snd_soc_codec *codec) ...@@ -1604,6 +1635,26 @@ static int da7219_probe(struct snd_soc_codec *codec)
if (ret) if (ret)
return ret; return ret;
ret = regmap_read(da7219->regmap, DA7219_CHIP_REVISION, &rev);
if (ret) {
dev_err(codec->dev, "Failed to read chip revision: %d\n", ret);
goto err_disable_reg;
}
switch (rev & DA7219_CHIP_MINOR_MASK) {
case 0:
ret = regmap_register_patch(da7219->regmap, da7219_rev_aa_patch,
ARRAY_SIZE(da7219_rev_aa_patch));
if (ret) {
dev_err(codec->dev, "Failed to register AA patch: %d\n",
ret);
goto err_disable_reg;
}
break;
default:
break;
}
/* Handle DT/Platform data */ /* Handle DT/Platform data */
if (codec->dev->of_node) if (codec->dev->of_node)
da7219->pdata = da7219_of_to_pdata(codec); da7219->pdata = da7219_of_to_pdata(codec);
...@@ -1774,7 +1825,6 @@ static struct reg_default da7219_reg_defaults[] = { ...@@ -1774,7 +1825,6 @@ static struct reg_default da7219_reg_defaults[] = {
{ DA7219_MIXOUT_R_CTRL, 0x10 }, { DA7219_MIXOUT_R_CTRL, 0x10 },
{ DA7219_CHIP_ID1, 0x23 }, { DA7219_CHIP_ID1, 0x23 },
{ DA7219_CHIP_ID2, 0x93 }, { DA7219_CHIP_ID2, 0x93 },
{ DA7219_CHIP_REVISION, 0x00 },
{ DA7219_IO_CTRL, 0x00 }, { DA7219_IO_CTRL, 0x00 },
{ DA7219_GAIN_RAMP_CTRL, 0x00 }, { DA7219_GAIN_RAMP_CTRL, 0x00 },
{ DA7219_PC_COUNT, 0x02 }, { DA7219_PC_COUNT, 0x02 },
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment