diff options
author | Takashi Iwai <tiwai@suse.de> | 2010-07-21 15:01:07 +0200 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2010-07-21 15:01:07 +0200 |
commit | 49e704279953b652ec6adc7f5dec412ad118a938 (patch) | |
tree | 865cdc6736066e0caceb1dc199f30b19d69e8d28 /sound/soc | |
parent | ASoC: Unconditionally enable WM8994 AIF1ADC TDM mode (diff) | |
parent | ASoC: TWL4030: Add configurable delay after digimic enable (diff) | |
download | linux-49e704279953b652ec6adc7f5dec412ad118a938.tar.xz linux-49e704279953b652ec6adc7f5dec412ad118a938.zip |
Merge branch 'for-2.6.36' of git://git.kernel.org/pub/scm/linux/kernel/git/lrg/asoc-2.6 into topic/asoc
Diffstat (limited to 'sound/soc')
-rw-r--r-- | sound/soc/codecs/twl4030.c | 47 | ||||
-rw-r--r-- | sound/soc/codecs/twl4030.h | 1 | ||||
-rw-r--r-- | sound/soc/codecs/twl6040.c | 56 |
3 files changed, 63 insertions, 41 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 { u8 earpiece_enabled; u8 predrivel_enabled, predriver_enabled; u8 carkitl_enabled, carkitr_enabled; + + /* Delay needed after enabling the digimic interface */ + unsigned int digimic_delay; }; /* @@ -312,6 +315,8 @@ static void twl4030_init_chip(struct platform_device *pdev) if (!setup) return; + twl4030->digimic_delay = setup->digimic_delay; + /* Configuration for headset ramp delay from setup data */ if (setup->sysclk != twl4030->sysclk) dev_warn(codec->dev, @@ -540,10 +545,11 @@ static const struct snd_kcontrol_new twl4030_dapm_abypassl2_control = static const struct snd_kcontrol_new twl4030_dapm_abypassv_control = SOC_DAPM_SINGLE("Switch", TWL4030_REG_VDL_APGA_CTL, 2, 1, 0); -/* Digital bypass gain, 0 mutes the bypass */ +/* Digital bypass gain, mute instead of -30dB */ static const unsigned int twl4030_dapm_dbypass_tlv[] = { - TLV_DB_RANGE_HEAD(2), - 0, 3, TLV_DB_SCALE_ITEM(-2400, 0, 1), + TLV_DB_RANGE_HEAD(3), + 0, 1, TLV_DB_SCALE_ITEM(-3000, 600, 1), + 2, 3, TLV_DB_SCALE_ITEM(-2400, 0, 0), 4, 7, TLV_DB_SCALE_ITEM(-1800, 600, 0), }; @@ -854,6 +860,16 @@ static int headsetrpga_event(struct snd_soc_dapm_widget *w, return 0; } +static int digimic_event(struct snd_soc_dapm_widget *w, + struct snd_kcontrol *kcontrol, int event) +{ + struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(w->codec); + + if (twl4030->digimic_delay) + mdelay(twl4030->digimic_delay); + return 0; +} + /* * Some of the gain controls in TWL (mostly those which are associated with * the outputs) are implemented in an interesting way: @@ -1438,10 +1454,12 @@ static const struct snd_soc_dapm_widget twl4030_dapm_widgets[] = { SND_SOC_DAPM_PGA("ADC Physical Right", TWL4030_REG_AVADC_CTL, 1, 0, NULL, 0), - SND_SOC_DAPM_PGA("Digimic0 Enable", - TWL4030_REG_ADCMICSEL, 1, 0, NULL, 0), - SND_SOC_DAPM_PGA("Digimic1 Enable", - TWL4030_REG_ADCMICSEL, 3, 0, NULL, 0), + SND_SOC_DAPM_PGA_E("Digimic0 Enable", + TWL4030_REG_ADCMICSEL, 1, 0, NULL, 0, + digimic_event, SND_SOC_DAPM_POST_PMU), + SND_SOC_DAPM_PGA_E("Digimic1 Enable", + TWL4030_REG_ADCMICSEL, 3, 0, NULL, 0, + digimic_event, SND_SOC_DAPM_POST_PMU), SND_SOC_DAPM_MICBIAS("Mic Bias 1", TWL4030_REG_MICBIAS_CTL, 0, 0), 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[] = { /* Supply for the digital part (APLL) */ {"Digital Voice Playback Mixer", NULL, "APLL Enable"}, - {"Digital R1 Playback Mixer", NULL, "AIF Enable"}, - {"Digital L1 Playback Mixer", NULL, "AIF Enable"}, + {"DAC Left1", NULL, "AIF Enable"}, + {"DAC Right1", NULL, "AIF Enable"}, + {"DAC Left2", NULL, "AIF Enable"}, + {"DAC Right1", NULL, "AIF Enable"}, + {"Digital R2 Playback Mixer", NULL, "AIF Enable"}, {"Digital L2 Playback Mixer", NULL, "AIF Enable"}, @@ -1531,10 +1552,10 @@ static const struct snd_soc_dapm_route intercon[] = { /* outputs */ /* Must be always connected (for AIF and APLL) */ - {"Virtual HiFi OUT", NULL, "Digital L1 Playback Mixer"}, - {"Virtual HiFi OUT", NULL, "Digital R1 Playback Mixer"}, - {"Virtual HiFi OUT", NULL, "Digital L2 Playback Mixer"}, - {"Virtual HiFi OUT", NULL, "Digital R2 Playback Mixer"}, + {"Virtual HiFi OUT", NULL, "DAC Left1"}, + {"Virtual HiFi OUT", NULL, "DAC Right1"}, + {"Virtual HiFi OUT", NULL, "DAC Left2"}, + {"Virtual HiFi OUT", NULL, "DAC Right2"}, /* Must be always connected (for APLL) */ {"Virtual Voice OUT", NULL, "Digital Voice Playback Mixer"}, /* Physical outputs */ 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; struct twl4030_setup_data { unsigned int ramp_delay_value; + unsigned int digimic_delay; /* in ms */ unsigned int sysclk; unsigned int offset_cncl_path; unsigned int check_defaults:1; diff --git a/sound/soc/codecs/twl6040.c b/sound/soc/codecs/twl6040.c index 85dd4fb4c681..64a807f1a8a1 100644 --- a/sound/soc/codecs/twl6040.c +++ b/sound/soc/codecs/twl6040.c @@ -360,6 +360,13 @@ static int headset_power_mode(struct snd_soc_codec *codec, int high_perf) return 0; } +static int twl6040_hs_dac_event(struct snd_soc_dapm_widget *w, + struct snd_kcontrol *kcontrol, int event) +{ + msleep(1); + return 0; +} + static int twl6040_power_mode_event(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, int event) { @@ -371,6 +378,8 @@ static int twl6040_power_mode_event(struct snd_soc_dapm_widget *w, else priv->non_lp--; + msleep(1); + return 0; } @@ -471,20 +480,6 @@ static const struct snd_kcontrol_new hfdacl_switch_controls = static const struct snd_kcontrol_new hfdacr_switch_controls = SOC_DAPM_SINGLE("Switch", TWL6040_REG_HFRCTL, 2, 1, 0); -/* Headset driver switches */ -static const struct snd_kcontrol_new hsl_driver_switch_controls = - SOC_DAPM_SINGLE("Switch", TWL6040_REG_HSLCTL, 2, 1, 0); - -static const struct snd_kcontrol_new hsr_driver_switch_controls = - SOC_DAPM_SINGLE("Switch", TWL6040_REG_HSRCTL, 2, 1, 0); - -/* Handsfree driver switches */ -static const struct snd_kcontrol_new hfl_driver_switch_controls = - SOC_DAPM_SINGLE("Switch", TWL6040_REG_HFLCTL, 4, 1, 0); - -static const struct snd_kcontrol_new hfr_driver_switch_controls = - SOC_DAPM_SINGLE("Switch", TWL6040_REG_HFRCTL, 4, 1, 0); - static const struct snd_kcontrol_new ep_driver_switch_controls = SOC_DAPM_SINGLE("Switch", TWL6040_REG_EARCTL, 0, 1, 0); @@ -548,10 +543,14 @@ static const struct snd_soc_dapm_widget twl6040_dapm_widgets[] = { TWL6040_REG_DMICBCTL, 4, 0), /* DACs */ - SND_SOC_DAPM_DAC("HSDAC Left", "Headset Playback", - TWL6040_REG_HSLCTL, 0, 0), - SND_SOC_DAPM_DAC("HSDAC Right", "Headset Playback", - TWL6040_REG_HSRCTL, 0, 0), + SND_SOC_DAPM_DAC_E("HSDAC Left", "Headset Playback", + TWL6040_REG_HSLCTL, 0, 0, + twl6040_hs_dac_event, + SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD), + SND_SOC_DAPM_DAC_E("HSDAC Right", "Headset Playback", + TWL6040_REG_HSRCTL, 0, 0, + twl6040_hs_dac_event, + SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD), SND_SOC_DAPM_DAC_E("HFDAC Left", "Handsfree Playback", TWL6040_REG_HFLCTL, 0, 0, twl6040_power_mode_event, @@ -571,18 +570,19 @@ static const struct snd_soc_dapm_widget twl6040_dapm_widgets[] = { SND_SOC_DAPM_SWITCH("HFDAC Right Playback", SND_SOC_NOPM, 0, 0, &hfdacr_switch_controls), - SND_SOC_DAPM_SWITCH("Headset Left Driver", - SND_SOC_NOPM, 0, 0, &hsl_driver_switch_controls), - SND_SOC_DAPM_SWITCH("Headset Right Driver", - SND_SOC_NOPM, 0, 0, &hsr_driver_switch_controls), - SND_SOC_DAPM_SWITCH_E("Handsfree Left Driver", - SND_SOC_NOPM, 0, 0, &hfl_driver_switch_controls, + /* Analog playback drivers */ + SND_SOC_DAPM_PGA_E("Handsfree Left Driver", + TWL6040_REG_HFLCTL, 4, 0, NULL, 0, twl6040_power_mode_event, SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD), - SND_SOC_DAPM_SWITCH_E("Handsfree Right Driver", - SND_SOC_NOPM, 0, 0, &hfr_driver_switch_controls, + SND_SOC_DAPM_PGA_E("Handsfree Right Driver", + TWL6040_REG_HFRCTL, 4, 0, NULL, 0, twl6040_power_mode_event, SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD), + SND_SOC_DAPM_PGA("Headset Left Driver", + TWL6040_REG_HSLCTL, 2, 0, NULL, 0), + SND_SOC_DAPM_PGA("Headset Right Driver", + TWL6040_REG_HSRCTL, 2, 0, NULL, 0), SND_SOC_DAPM_SWITCH_E("Earphone Driver", SND_SOC_NOPM, 0, 0, &ep_driver_switch_controls, twl6040_power_mode_event, @@ -616,8 +616,8 @@ static const struct snd_soc_dapm_route intercon[] = { {"HSDAC Left Playback", "Switch", "HSDAC Left"}, {"HSDAC Right Playback", "Switch", "HSDAC Right"}, - {"Headset Left Driver", "Switch", "HSDAC Left Playback"}, - {"Headset Right Driver", "Switch", "HSDAC Right Playback"}, + {"Headset Left Driver", NULL, "HSDAC Left Playback"}, + {"Headset Right Driver", NULL, "HSDAC Right Playback"}, {"HSOL", NULL, "Headset Left Driver"}, {"HSOR", NULL, "Headset Right Driver"}, |