ASoC: twl6040: Remove PLL restrictions
cover ASoC: twl6040: Remove PLL restrictions
Hello,
twl6040 has no restrictions on the selected PLL, and sysclk. All input, and output paths can be used with any PLL configuration.
Regards,
Peter
---
Peter Ujfalusi (4):
ASoC: twl6040: Remove Capture restriction for 17.64MHz sysclk
ASoC: twl6040: Remove PLL usage restrictions
ASoC: twl6040: Change event ordering for Earphone driver
ASoC: twl6040: Rename the Earphone Driver event handler
sound/soc/codecs/twl6040.c | 53 ++++++++++---------------------------------- 1 files changed, 12 insertions(+), 41 deletions(-)
Signature · 1 line
1.7.7
PATCH 1/4 ASoC: twl6040: Remove Capture restriction for 17.64MHz sysclk
Capture is supported in all PLL configuration.
--- sound/soc/codecs/twl6040.c | 7 ------- 1 files changed, 0 insertions(+), 7 deletions(-)
sound/soc/codecs/twl6040.c +0 -7
@@ -1351,13 +1351,6 @@ static int twl6040_hw_params(struct snd_pcm_substream *substream, rate);return -EINVAL ; } -/* Capture is not supported with 17.64MHz sysclk */ -if (substream->stream ==SNDRV_PCM_STREAM_CAPTURE ) { -dev_err (codec->dev, -"capture mode is not supported at %dHz\n" , - rate); -return -EINVAL ; - } priv->sysclk =17640000 ;break ;case 8000 :
Signature · 1 line
1.7.7
PATCH 2/4 ASoC: twl6040: Remove PLL usage restrictions
In reply to Peter UjfalusiThere is no limitation dictated by outputs or inputs regarding to the selected PLL (LP/HP).
Remove the checks for this, and allow all path with any PLL configuration.
--- sound/soc/codecs/twl6040.c | 40 +++++++++------------------------------- 1 files changed, 9 insertions(+), 31 deletions(-)
sound/soc/codecs/twl6040.c +9 -31
@@ -87,7 +87,6 @@ struct twl6040_data {int plug_irq;int codec_powered;int pll; -int non_lp;int pll_power_mode;int hs_power_mode;int hs_power_mode_locked;
@@ -588,10 +587,6 @@ static int out_drv_event(struct snd_soc_dapm_widget *w, out->left_step = priv->hf_left_step; out->right_step = priv->hf_right_step; out->step_delay =5 ;/* 5 ms between volume ramp steps */ -if (SND_SOC_DAPM_EVENT_ON (event)) - priv->non_lp++; -else - priv->non_lp--;break ;default :return -1 ;
@@ -686,18 +681,12 @@ static int twl6040_power_mode_event(struct snd_soc_dapm_widget *w,int ret =0 ;if (SND_SOC_DAPM_EVENT_ON (event)) { - priv->non_lp++; -if (!strcmp (w->name,"Earphone Driver" )) { -/* Earphone doesn't support low power mode */ - priv->hs_power_mode_locked =1 ; - ret =headset_power_mode (codec,1 ); - } +/* Earphone doesn't support low power mode */ + priv->hs_power_mode_locked =1 ; + ret =headset_power_mode (codec,1 ); }else { - priv->non_lp--; -if (!strcmp (w->name,"Earphone Driver" )) { - priv->hs_power_mode_locked =0 ; - ret =headset_power_mode (codec, priv->hs_power_mode); - } + priv->hs_power_mode_locked =0 ; + ret =headset_power_mode (codec, priv->hs_power_mode); }msleep (1 );
@@ -1125,14 +1114,10 @@ static const struct snd_soc_dapm_widget twl6040_dapm_widgets[] = {/* DACs */ SND_SOC_DAPM_DAC ("HSDAC Left" ,"Headset Playback" ,SND_SOC_NOPM ,0 ,0 ),SND_SOC_DAPM_DAC ("HSDAC Right" ,"Headset Playback" ,SND_SOC_NOPM ,0 ,0 ), -SND_SOC_DAPM_DAC_E ("HFDAC Left" ,"Handsfree Playback" , -TWL6040_REG_HFLCTL ,0 ,0 , - twl6040_power_mode_event, -SND_SOC_DAPM_POST_PMU |SND_SOC_DAPM_POST_PMD ), -SND_SOC_DAPM_DAC_E ("HFDAC Right" ,"Handsfree Playback" , -TWL6040_REG_HFRCTL ,0 ,0 , - twl6040_power_mode_event, -SND_SOC_DAPM_POST_PMU |SND_SOC_DAPM_POST_PMD ), +SND_SOC_DAPM_DAC ("HFDAC Left" ,"Handsfree Playback" , +TWL6040_REG_HFLCTL ,0 ,0 ), +SND_SOC_DAPM_DAC ("HFDAC Right" ,"Handsfree Playback" , +TWL6040_REG_HFRCTL ,0 ,0 ),/* Virtual DAC for vibra path (DL4 channel) */ SND_SOC_DAPM_DAC ("VIBRA DAC" ,"Vibra Playback" , SND_SOC_NOPM, 0, 0),
@@ -1383,13 +1368,6 @@ static int twl6040_prepare(struct snd_pcm_substream *substream,return -EINVAL ; } -if ((priv->sysclk ==17640000 ) && priv->non_lp) { -dev_err (codec->dev, -"some enabled paths aren't supported at %dHz\n" , - priv->sysclk); -return -EPERM ; - } - ret =twl6040_set_pll (twl6040, priv->pll, priv->clk_in, priv->sysclk);if (ret) {dev_err (codec->dev,"Can not set PLL (%d)\n" , ret);
Signature · 1 line
1.7.7
PATCH 3/4 ASoC: twl6040: Change event ordering for Earphone driver
In reply to Peter UjfalusiIt is better to switch HS Power Mode (if it was in low power mode) before we enable the Earpiece driver. The switched off EP driver can filter out noise coming from the Low Power to High Performance transition on the HSL DAC.
--- sound/soc/codecs/twl6040.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
sound/soc/codecs/twl6040.c +1 -1
@@ -1164,7 +1164,7 @@ static const struct snd_soc_dapm_widget twl6040_dapm_widgets[] = {SND_SOC_DAPM_OUT_DRV_E ("Earphone Driver" ,TWL6040_REG_EARCTL ,0 ,0 ,NULL ,0 , twl6040_power_mode_event, -SND_SOC_DAPM_POST_PMU |SND_SOC_DAPM_POST_PMD ), +SND_SOC_DAPM_PRE_PMU |SND_SOC_DAPM_POST_PMD ),SND_SOC_DAPM_OUT_DRV ("Vibra Left Driver" ,TWL6040_REG_VIBCTLL ,0 ,0 ,NULL ,0 ), SND_SOC_DAPM_OUT_DRV("Vibra Right Driver",
Signature · 1 line
1.7.7
PATCH 4/4 ASoC: twl6040: Rename the Earphone Driver event handler
In reply to Peter UjfalusiSince the event handler is only used by the Earphone Driver, it is better to rename it from twl6040_power_mode_event to twl6040_ep_drv_event.
--- sound/soc/codecs/twl6040.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
sound/soc/codecs/twl6040.c +2 -2
@@ -673,7 +673,7 @@ static int twl6040_hs_dac_event(struct snd_soc_dapm_widget *w,return 0 ; } -static int twl6040_power_mode_event (struct snd_soc_dapm_widget *w, +static int twl6040_ep_drv_event (struct snd_soc_dapm_widget *w,struct snd_kcontrol *kcontrol,int event) {struct snd_soc_codec *codec = w->codec;
@@ -1163,7 +1163,7 @@ static const struct snd_soc_dapm_widget twl6040_dapm_widgets[] = { SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD),SND_SOC_DAPM_OUT_DRV_E ("Earphone Driver" ,TWL6040_REG_EARCTL ,0 ,0 ,NULL ,0 , - twl6040_power_mode_event, + twl6040_ep_drv_event,SND_SOC_DAPM_PRE_PMU |SND_SOC_DAPM_POST_PMD ),SND_SOC_DAPM_OUT_DRV ("Vibra Left Driver" , TWL6040_REG_VIBCTLL, 0, 0, NULL, 0),
Signature · 1 line
1.7.7
Mark Brown
AppliedQuoted 4 lines · Peter Ujfalusi
Hello,
twl6040 has no restrictions on the selected PLL, and sysclk. All input, and output paths can be used with any PLL configuration.
Applied, thanks.