Correct widget and PLL handling
cover Correct widget and PLL handling
Fix an issue when using 19.2 Mhz as clock input for TWL6040.
Also, Drivers in TWL6040 can be modeled after PGA components of DAPM. This allows for better power management and also ensures that the DACs are enabled before the Drivers, reducing this way a pop-noise heard when powering up components.
PATCH 1/2 ASoC: TWL6040: Fix playback with 19.2 Mhz MCLK
When using MCLK is configured for 19.2 Mhz, clock slicer should be enabled and HPPLL should be bypassed in clock path.
--- sound/soc/codecs/twl6040.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
sound/soc/codecs/twl6040.c +1 -1
@@ -928,7 +928,7 @@ static int twl6040_set_dai_sysclk(struct snd_soc_dai *codec_dai,case 19200000 :/* mclk input, pll disabled */ hppllctl |=TWL6040_MCLK_19200KHZ | -TWL6040_HPLLSQRBP | +TWL6040_HPLLSQRENA |TWL6040_HPLLBP ;break ;case 26000000 :
Signature · 1 line
1.6.3.3
PATCH 2/2 ASoC: TWL6040: Correct widget handling for drivers
In order to reduce pop-noise at powering up/down of the DACs and Drivers, these components have to be handled in a specific sequence. Headset, Handsfree, and Earphone drivers are now registered as PGA components to ensure DACs are enabled first.
Also, add a pop_time of 1 ms to leave time for DACs to settle before continuing power up/down sequence.
--- sound/soc/codecs/twl6040.c | 36 ++++++++++++------------------------ 1 files changed, 12 insertions(+), 24 deletions(-)
sound/soc/codecs/twl6040.c +12 -24
@@ -471,20 +471,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 );
@@ -571,18 +557,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 +603,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"},
@@ -1105,6 +1092,7 @@ static int __devinit twl6040_codec_probe(struct platform_device *pdev) priv->naudint = naudint; codec = &priv->codec; + codec->pop_time =1 ; codec->dev = &pdev->dev; twl6040_dai.dev = &pdev->dev;
Signature · 1 line
1.6.3.3
Re: [PATCH 2/2] ASoC: TWL6040: Correct widget handling for drivers
Quoted 2 lines · Jorge Eduardo Candelaria
Also, add a
pop_timeof 1 ms to leave time for DACs to settle before continuing power up/down sequence.
...
sound/soc/codecs/twl6040.c static int __devinit twl6040_codec_probe(struct platform_device *pdev) · line 1097
Quoted 7 lines
sound/soc/codecs/twl6040.c +1
-0@@ -1105,6 +1092,7 @@ static int __devinit twl6040_codec_probe(struct platform_device *pdev) priv->naudint = naudint; codec = &priv->codec; + codec->pop_time =1 ; codec->dev = &pdev->dev; twl6040_dai.dev = &pdev->dev;
That's not something you should be doing in your CODEC driver. pop_time is a debugging tool which can be enabled by users but should not be used in production. Besides, it'll also apply to all power changes in the CODEC, not just the ones that need it, and so make the general operation of the device much slower than it needs to be.
If you need to insert a delay after power up of the DAC widgets use the _E variant of the DAC widget and have a POST_PMU event handler which does the sleep.
Re: [PATCH 1/2] ASoC: TWL6040: Fix playback with 19.2 Mhz MCLK
In reply to Jorge Eduardo CandelariaQuoted 5 lines · Jorge Eduardo Candelaria
When using MCLK is configured for 19.2 Mhz, clock slicer should be enabled and HPPLL should be bypassed in clock path.
Signed-off-by Jorge Eduardo Candelaria <[email protected]>Signed-off-by Margarita Olaya Cabrera <[email protected]>
Liam Girdwood
AppliedRe: [PATCH 1/2] ASoC: TWL6040: Fix playback with 19.2 Mhz MCLK
In reply to Jorge Eduardo CandelariaQuoted 6 lines · Jorge Eduardo Candelaria
When using MCLK is configured for 19.2 Mhz, clock slicer should be enabled and HPPLL should be bypassed in clock path.
Signed-off-by Jorge Eduardo Candelaria <[email protected]>Signed-off-by Margarita Olaya Cabrera <[email protected]>---
Applied.
Thanks
Liam
Signature · 3 lines
Freelance Developer, SlimLogic Ltd ASoC and Voltage Regulator Maintainer. http://www.slimlogic.co.uk