aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc
diff options
context:
space:
mode:
authorPeter Ujfalusi <peter.ujfalusi@nokia.com>2010-07-20 08:49:09 -0400
committerLiam Girdwood <lrg@slimlogic.co.uk>2010-07-21 06:57:58 -0400
commit01ea6ba2bce64112623dbf8c45ce487062b65446 (patch)
tree490a4af1657713c582895ffa7e4c4bae97f5519c /sound/soc
parent0fad4ed7b230f593539b2da9cadbb77cb3a3131a (diff)
ASoC: TWL4030: Add configurable delay after digimic enable
When digital microphones are connected to twl, delay is needed after enabling the digimic interface of the codec. Add new parameter for the setup data, which can be used to pass the apropriate delay in ms after the digimic interface has been enabled. Without certain delay (in certain HW configuration) the beggining of the recorded sample contains a glitch, which is generated by the digital microphones. Delaying the micbias1, 2 (which is the bias for the digimic0 or 1) does not help, since the glitch is coming after switching the digimic interface. Reversing the micbias and digimic enable order does not work either (in that case the wait need to be added after the micbias enabled). Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
Diffstat (limited to 'sound/soc')
-rw-r--r--sound/soc/codecs/twl4030.c25
-rw-r--r--sound/soc/codecs/twl4030.h1
2 files changed, 22 insertions, 4 deletions
diff --git a/sound/soc/codecs/twl4030.c b/sound/soc/codecs/twl4030.c
index 6fd6d0b10555..bd557c2bcb8c 100644
--- a/sound/soc/codecs/twl4030.c
+++ b/sound/soc/codecs/twl4030.c
@@ -143,6 +143,9 @@ struct twl4030_priv {
143 u8 earpiece_enabled; 143 u8 earpiece_enabled;
144 u8 predrivel_enabled, predriver_enabled; 144 u8 predrivel_enabled, predriver_enabled;
145 u8 carkitl_enabled, carkitr_enabled; 145 u8 carkitl_enabled, carkitr_enabled;
146
147 /* Delay needed after enabling the digimic interface */
148 unsigned int digimic_delay;
146}; 149};
147 150
148/* 151/*
@@ -312,6 +315,8 @@ static void twl4030_init_chip(struct platform_device *pdev)
312 if (!setup) 315 if (!setup)
313 return; 316 return;
314 317
318 twl4030->digimic_delay = setup->digimic_delay;
319
315 /* Configuration for headset ramp delay from setup data */ 320 /* Configuration for headset ramp delay from setup data */
316 if (setup->sysclk != twl4030->sysclk) 321 if (setup->sysclk != twl4030->sysclk)
317 dev_warn(codec->dev, 322 dev_warn(codec->dev,
@@ -855,6 +860,16 @@ static int headsetrpga_event(struct snd_soc_dapm_widget *w,
855 return 0; 860 return 0;
856} 861}
857 862
863static int digimic_event(struct snd_soc_dapm_widget *w,
864 struct snd_kcontrol *kcontrol, int event)
865{
866 struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(w->codec);
867
868 if (twl4030->digimic_delay)
869 mdelay(twl4030->digimic_delay);
870 return 0;
871}
872
858/* 873/*
859 * Some of the gain controls in TWL (mostly those which are associated with 874 * Some of the gain controls in TWL (mostly those which are associated with
860 * the outputs) are implemented in an interesting way: 875 * the outputs) are implemented in an interesting way:
@@ -1439,10 +1454,12 @@ static const struct snd_soc_dapm_widget twl4030_dapm_widgets[] = {
1439 SND_SOC_DAPM_PGA("ADC Physical Right", 1454 SND_SOC_DAPM_PGA("ADC Physical Right",
1440 TWL4030_REG_AVADC_CTL, 1, 0, NULL, 0), 1455 TWL4030_REG_AVADC_CTL, 1, 0, NULL, 0),
1441 1456
1442 SND_SOC_DAPM_PGA("Digimic0 Enable", 1457 SND_SOC_DAPM_PGA_E("Digimic0 Enable",
1443 TWL4030_REG_ADCMICSEL, 1, 0, NULL, 0), 1458 TWL4030_REG_ADCMICSEL, 1, 0, NULL, 0,
1444 SND_SOC_DAPM_PGA("Digimic1 Enable", 1459 digimic_event, SND_SOC_DAPM_POST_PMU),
1445 TWL4030_REG_ADCMICSEL, 3, 0, NULL, 0), 1460 SND_SOC_DAPM_PGA_E("Digimic1 Enable",
1461 TWL4030_REG_ADCMICSEL, 3, 0, NULL, 0,
1462 digimic_event, SND_SOC_DAPM_POST_PMU),
1446 1463
1447 SND_SOC_DAPM_MICBIAS("Mic Bias 1", TWL4030_REG_MICBIAS_CTL, 0, 0), 1464 SND_SOC_DAPM_MICBIAS("Mic Bias 1", TWL4030_REG_MICBIAS_CTL, 0, 0),
1448 SND_SOC_DAPM_MICBIAS("Mic Bias 2", TWL4030_REG_MICBIAS_CTL, 1, 0), 1465 SND_SOC_DAPM_MICBIAS("Mic Bias 2", TWL4030_REG_MICBIAS_CTL, 1, 0),
diff --git a/sound/soc/codecs/twl4030.h b/sound/soc/codecs/twl4030.h
index 788e3d125099..6c57430f6e24 100644
--- a/sound/soc/codecs/twl4030.h
+++ b/sound/soc/codecs/twl4030.h
@@ -41,6 +41,7 @@ extern struct snd_soc_codec_device soc_codec_dev_twl4030;
41 41
42struct twl4030_setup_data { 42struct twl4030_setup_data {
43 unsigned int ramp_delay_value; 43 unsigned int ramp_delay_value;
44 unsigned int digimic_delay; /* in ms */
44 unsigned int sysclk; 45 unsigned int sysclk;
45 unsigned int offset_cncl_path; 46 unsigned int offset_cncl_path;
46 unsigned int check_defaults:1; 47 unsigned int check_defaults:1;