diff options
Diffstat (limited to 'sound/soc/codecs/twl4030.c')
-rw-r--r-- | sound/soc/codecs/twl4030.c | 47 |
1 files changed, 34 insertions, 13 deletions
diff --git a/sound/soc/codecs/twl4030.c b/sound/soc/codecs/twl4030.c index 8d36bfa20552..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, |
@@ -540,10 +545,11 @@ static const struct snd_kcontrol_new twl4030_dapm_abypassl2_control = | |||
540 | static const struct snd_kcontrol_new twl4030_dapm_abypassv_control = | 545 | static const struct snd_kcontrol_new twl4030_dapm_abypassv_control = |
541 | SOC_DAPM_SINGLE("Switch", TWL4030_REG_VDL_APGA_CTL, 2, 1, 0); | 546 | SOC_DAPM_SINGLE("Switch", TWL4030_REG_VDL_APGA_CTL, 2, 1, 0); |
542 | 547 | ||
543 | /* Digital bypass gain, 0 mutes the bypass */ | 548 | /* Digital bypass gain, mute instead of -30dB */ |
544 | static const unsigned int twl4030_dapm_dbypass_tlv[] = { | 549 | static const unsigned int twl4030_dapm_dbypass_tlv[] = { |
545 | TLV_DB_RANGE_HEAD(2), | 550 | TLV_DB_RANGE_HEAD(3), |
546 | 0, 3, TLV_DB_SCALE_ITEM(-2400, 0, 1), | 551 | 0, 1, TLV_DB_SCALE_ITEM(-3000, 600, 1), |
552 | 2, 3, TLV_DB_SCALE_ITEM(-2400, 0, 0), | ||
547 | 4, 7, TLV_DB_SCALE_ITEM(-1800, 600, 0), | 553 | 4, 7, TLV_DB_SCALE_ITEM(-1800, 600, 0), |
548 | }; | 554 | }; |
549 | 555 | ||
@@ -854,6 +860,16 @@ static int headsetrpga_event(struct snd_soc_dapm_widget *w, | |||
854 | return 0; | 860 | return 0; |
855 | } | 861 | } |
856 | 862 | ||
863 | static 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 | |||
857 | /* | 873 | /* |
858 | * 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 |
859 | * the outputs) are implemented in an interesting way: | 875 | * the outputs) are implemented in an interesting way: |
@@ -1438,10 +1454,12 @@ static const struct snd_soc_dapm_widget twl4030_dapm_widgets[] = { | |||
1438 | SND_SOC_DAPM_PGA("ADC Physical Right", | 1454 | SND_SOC_DAPM_PGA("ADC Physical Right", |
1439 | TWL4030_REG_AVADC_CTL, 1, 0, NULL, 0), | 1455 | TWL4030_REG_AVADC_CTL, 1, 0, NULL, 0), |
1440 | 1456 | ||
1441 | SND_SOC_DAPM_PGA("Digimic0 Enable", | 1457 | SND_SOC_DAPM_PGA_E("Digimic0 Enable", |
1442 | TWL4030_REG_ADCMICSEL, 1, 0, NULL, 0), | 1458 | TWL4030_REG_ADCMICSEL, 1, 0, NULL, 0, |
1443 | SND_SOC_DAPM_PGA("Digimic1 Enable", | 1459 | digimic_event, SND_SOC_DAPM_POST_PMU), |
1444 | 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), | ||
1445 | 1463 | ||
1446 | 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), |
1447 | 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), |
@@ -1459,8 +1477,11 @@ static const struct snd_soc_dapm_route intercon[] = { | |||
1459 | /* Supply for the digital part (APLL) */ | 1477 | /* Supply for the digital part (APLL) */ |
1460 | {"Digital Voice Playback Mixer", NULL, "APLL Enable"}, | 1478 | {"Digital Voice Playback Mixer", NULL, "APLL Enable"}, |
1461 | 1479 | ||
1462 | {"Digital R1 Playback Mixer", NULL, "AIF Enable"}, | 1480 | {"DAC Left1", NULL, "AIF Enable"}, |
1463 | {"Digital L1 Playback Mixer", NULL, "AIF Enable"}, | 1481 | {"DAC Right1", NULL, "AIF Enable"}, |
1482 | {"DAC Left2", NULL, "AIF Enable"}, | ||
1483 | {"DAC Right1", NULL, "AIF Enable"}, | ||
1484 | |||
1464 | {"Digital R2 Playback Mixer", NULL, "AIF Enable"}, | 1485 | {"Digital R2 Playback Mixer", NULL, "AIF Enable"}, |
1465 | {"Digital L2 Playback Mixer", NULL, "AIF Enable"}, | 1486 | {"Digital L2 Playback Mixer", NULL, "AIF Enable"}, |
1466 | 1487 | ||
@@ -1531,10 +1552,10 @@ static const struct snd_soc_dapm_route intercon[] = { | |||
1531 | 1552 | ||
1532 | /* outputs */ | 1553 | /* outputs */ |
1533 | /* Must be always connected (for AIF and APLL) */ | 1554 | /* Must be always connected (for AIF and APLL) */ |
1534 | {"Virtual HiFi OUT", NULL, "Digital L1 Playback Mixer"}, | 1555 | {"Virtual HiFi OUT", NULL, "DAC Left1"}, |
1535 | {"Virtual HiFi OUT", NULL, "Digital R1 Playback Mixer"}, | 1556 | {"Virtual HiFi OUT", NULL, "DAC Right1"}, |
1536 | {"Virtual HiFi OUT", NULL, "Digital L2 Playback Mixer"}, | 1557 | {"Virtual HiFi OUT", NULL, "DAC Left2"}, |
1537 | {"Virtual HiFi OUT", NULL, "Digital R2 Playback Mixer"}, | 1558 | {"Virtual HiFi OUT", NULL, "DAC Right2"}, |
1538 | /* Must be always connected (for APLL) */ | 1559 | /* Must be always connected (for APLL) */ |
1539 | {"Virtual Voice OUT", NULL, "Digital Voice Playback Mixer"}, | 1560 | {"Virtual Voice OUT", NULL, "Digital Voice Playback Mixer"}, |
1540 | /* Physical outputs */ | 1561 | /* Physical outputs */ |