Commit 44b2ed54 authored by Brian Austin's avatar Brian Austin Committed by Mark Brown

ASoC: cs42l52: Make MICA/B mixer dependent on mic config

MICA/B Single-Ended input selection depends on mica/b config so lets
make the mixer controls for them only show for selected mic's
Signed-off-by: default avatarBrian Austin <brian.austin@cirrus.com>
Signed-off-by: default avatarMark Brown <broonie@linaro.org>
parent a3d36bc2
...@@ -16,11 +16,11 @@ struct cs42l52_platform_data { ...@@ -16,11 +16,11 @@ struct cs42l52_platform_data {
/* MICBIAS Level. Check datasheet Pg48 */ /* MICBIAS Level. Check datasheet Pg48 */
unsigned int micbias_lvl; unsigned int micbias_lvl;
/* MICA mode selection 0=Single 1=Differential */ /* MICA mode selection Differential or Single-ended */
unsigned int mica_cfg; bool mica_diff_cfg;
/* MICB mode selection 0=Single 1=Differential */ /* MICB mode selection Differential or Single-ended */
unsigned int micb_cfg; bool micb_diff_cfg;
/* Charge Pump Freq. Check datasheet Pg73 */ /* Charge Pump Freq. Check datasheet Pg73 */
unsigned int chgfreq; unsigned int chgfreq;
......
...@@ -419,9 +419,6 @@ static const struct snd_kcontrol_new cs42l52_snd_controls[] = { ...@@ -419,9 +419,6 @@ static const struct snd_kcontrol_new cs42l52_snd_controls[] = {
SOC_DOUBLE("Bypass Mute", CS42L52_MISC_CTL, 4, 5, 1, 0), SOC_DOUBLE("Bypass Mute", CS42L52_MISC_CTL, 4, 5, 1, 0),
SOC_ENUM("MICA Select", mica_enum),
SOC_ENUM("MICB Select", micb_enum),
SOC_DOUBLE_R_TLV("MIC Gain Volume", CS42L52_MICA_CTL, SOC_DOUBLE_R_TLV("MIC Gain Volume", CS42L52_MICA_CTL,
CS42L52_MICB_CTL, 0, 0x10, 0, mic_tlv), CS42L52_MICB_CTL, 0, 0x10, 0, mic_tlv),
...@@ -528,6 +525,30 @@ static const struct snd_kcontrol_new cs42l52_snd_controls[] = { ...@@ -528,6 +525,30 @@ static const struct snd_kcontrol_new cs42l52_snd_controls[] = {
}; };
static const struct snd_kcontrol_new cs42l52_mica_controls[] = {
SOC_ENUM("MICA Select", mica_enum),
};
static const struct snd_kcontrol_new cs42l52_micb_controls[] = {
SOC_ENUM("MICB Select", micb_enum),
};
static int cs42l52_add_mic_controls(struct snd_soc_codec *codec)
{
struct cs42l52_private *cs42l52 = snd_soc_codec_get_drvdata(codec);
struct cs42l52_platform_data *pdata = &cs42l52->pdata;
if (!pdata->mica_diff_cfg)
snd_soc_add_codec_controls(codec, cs42l52_mica_controls,
ARRAY_SIZE(cs42l52_mica_controls));
if (!pdata->micb_diff_cfg)
snd_soc_add_codec_controls(codec, cs42l52_micb_controls,
ARRAY_SIZE(cs42l52_micb_controls));
return 0;
}
static const struct snd_soc_dapm_widget cs42l52_dapm_widgets[] = { static const struct snd_soc_dapm_widget cs42l52_dapm_widgets[] = {
SND_SOC_DAPM_INPUT("AIN1L"), SND_SOC_DAPM_INPUT("AIN1L"),
...@@ -1104,6 +1125,8 @@ static int cs42l52_probe(struct snd_soc_codec *codec) ...@@ -1104,6 +1125,8 @@ static int cs42l52_probe(struct snd_soc_codec *codec)
} }
regcache_cache_only(cs42l52->regmap, true); regcache_cache_only(cs42l52->regmap, true);
cs42l52_add_mic_controls(codec);
cs42l52_init_beep(codec); cs42l52_init_beep(codec);
cs42l52_set_bias_level(codec, SND_SOC_BIAS_STANDBY); cs42l52_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
...@@ -1221,16 +1244,16 @@ static int cs42l52_i2c_probe(struct i2c_client *i2c_client, ...@@ -1221,16 +1244,16 @@ static int cs42l52_i2c_probe(struct i2c_client *i2c_client,
reg & 0xFF); reg & 0xFF);
/* Set Platform Data */ /* Set Platform Data */
if (cs42l52->pdata.mica_cfg) if (cs42l52->pdata.mica_diff_cfg)
regmap_update_bits(cs42l52->regmap, CS42L52_MICA_CTL, regmap_update_bits(cs42l52->regmap, CS42L52_MICA_CTL,
CS42L52_MIC_CTL_TYPE_MASK, CS42L52_MIC_CTL_TYPE_MASK,
cs42l52->pdata.mica_cfg << cs42l52->pdata.mica_diff_cfg <<
CS42L52_MIC_CTL_TYPE_SHIFT); CS42L52_MIC_CTL_TYPE_SHIFT);
if (cs42l52->pdata.micb_cfg) if (cs42l52->pdata.micb_diff_cfg)
regmap_update_bits(cs42l52->regmap, CS42L52_MICB_CTL, regmap_update_bits(cs42l52->regmap, CS42L52_MICB_CTL,
CS42L52_MIC_CTL_TYPE_MASK, CS42L52_MIC_CTL_TYPE_MASK,
cs42l52->pdata.micb_cfg << cs42l52->pdata.micb_diff_cfg <<
CS42L52_MIC_CTL_TYPE_SHIFT); CS42L52_MIC_CTL_TYPE_SHIFT);
if (cs42l52->pdata.chgfreq) if (cs42l52->pdata.chgfreq)
......
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