Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1696688 > unrolled thread

[PATCH v1 3/6] ASoC: codecs: msm8916-wcd-analog: move codec reset to probe

Started bysrinivas.kandagatla@linaro.org
First post2017-07-26 02:40 +0200
Last post2017-07-28 16:10 +0200
Articles 3 — 3 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH v1 3/6] ASoC: codecs: msm8916-wcd-analog: move codec reset to probe srinivas.kandagatla@linaro.org - 2017-07-26 02:40 +0200
    Re: [PATCH v1 3/6] ASoC: codecs: msm8916-wcd-analog: move codec  reset to probe Mark Brown <broonie@kernel.org> - 2017-07-28 15:50 +0200
      Re: [PATCH v1 3/6] ASoC: codecs: msm8916-wcd-analog: move codec reset  to probe Srinivas Kandagatla <srinivas.kandagatla@linaro.org> - 2017-07-28 16:10 +0200

#1696688 — [PATCH v1 3/6] ASoC: codecs: msm8916-wcd-analog: move codec reset to probe

Fromsrinivas.kandagatla@linaro.org
Date2017-07-26 02:40 +0200
Subject[PATCH v1 3/6] ASoC: codecs: msm8916-wcd-analog: move codec reset to probe
Message-ID<u7iwN-1zY-13@gated-at.bofh.it>
From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>

This patch move the codec reset code from dai ops to codec probe, so
that the codec is not held in reset when headset detection block is
still active.

Without this patch the codec block will be in reset as long as its not
actively used, which means headset events will not be functional if the
codec dai is not actively used.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
 sound/soc/codecs/msm8916-wcd-analog.c | 30 ++++++------------------------
 1 file changed, 6 insertions(+), 24 deletions(-)

diff --git a/sound/soc/codecs/msm8916-wcd-analog.c b/sound/soc/codecs/msm8916-wcd-analog.c
index 5710fd4..6606954 100644
--- a/sound/soc/codecs/msm8916-wcd-analog.c
+++ b/sound/soc/codecs/msm8916-wcd-analog.c
@@ -536,6 +536,9 @@ static int pm8916_wcd_analog_probe(struct snd_soc_codec *codec)
 		snd_soc_write(codec, wcd_reg_defaults_2_0[reg].reg,
 			      wcd_reg_defaults_2_0[reg].def);
 
+	snd_soc_update_bits(codec, CDC_D_CDC_RST_CTL,
+			    RST_CTL_DIG_SW_RST_N_MASK,
+			    RST_CTL_DIG_SW_RST_N_REMOVE_RESET);
 	return 0;
 }
 
@@ -543,6 +546,9 @@ static int pm8916_wcd_analog_remove(struct snd_soc_codec *codec)
 {
 	struct pm8916_wcd_analog_priv *priv = dev_get_drvdata(codec->dev);
 
+	snd_soc_update_bits(codec, CDC_D_CDC_RST_CTL,
+			    RST_CTL_DIG_SW_RST_N_MASK, 0);
+
 	return regulator_bulk_disable(ARRAY_SIZE(priv->supplies),
 				      priv->supplies);
 }
@@ -736,28 +742,6 @@ static struct regmap *pm8916_get_regmap(struct device *dev)
 	return dev_get_regmap(dev->parent, NULL);
 }
 
-static int pm8916_wcd_analog_startup(struct snd_pcm_substream *substream,
-				      struct snd_soc_dai *dai)
-{
-	snd_soc_update_bits(dai->codec, CDC_D_CDC_RST_CTL,
-			    RST_CTL_DIG_SW_RST_N_MASK,
-			    RST_CTL_DIG_SW_RST_N_REMOVE_RESET);
-
-	return 0;
-}
-
-static void pm8916_wcd_analog_shutdown(struct snd_pcm_substream *substream,
-					 struct snd_soc_dai *dai)
-{
-	snd_soc_update_bits(dai->codec, CDC_D_CDC_RST_CTL,
-			    RST_CTL_DIG_SW_RST_N_MASK, 0);
-}
-
-static struct snd_soc_dai_ops pm8916_wcd_analog_dai_ops = {
-	.startup = pm8916_wcd_analog_startup,
-	.shutdown = pm8916_wcd_analog_shutdown,
-};
-
 static struct snd_soc_dai_driver pm8916_wcd_analog_dai[] = {
 	[0] = {
 	       .name = "pm8916_wcd_analog_pdm_rx",
@@ -769,7 +753,6 @@ static struct snd_soc_dai_driver pm8916_wcd_analog_dai[] = {
 			    .channels_min = 1,
 			    .channels_max = 3,
 			    },
-	       .ops = &pm8916_wcd_analog_dai_ops,
 	       },
 	[1] = {
 	       .name = "pm8916_wcd_analog_pdm_tx",
@@ -781,7 +764,6 @@ static struct snd_soc_dai_driver pm8916_wcd_analog_dai[] = {
 			   .channels_min = 1,
 			   .channels_max = 4,
 			   },
-	       .ops = &pm8916_wcd_analog_dai_ops,
 	       },
 };
 
-- 
2.9.3

[toc] | [next] | [standalone]


#1698798 — Re: [PATCH v1 3/6] ASoC: codecs: msm8916-wcd-analog: move codec reset to probe

FromMark Brown <broonie@kernel.org>
Date2017-07-28 15:50 +0200
SubjectRe: [PATCH v1 3/6] ASoC: codecs: msm8916-wcd-analog: move codec reset to probe
Message-ID<u8dOp-4ob-7@gated-at.bofh.it>
In reply to#1696688

[Multipart message — attachments visible in raw view] — view raw

On Wed, Jul 26, 2017 at 02:35:09AM +0200, srinivas.kandagatla@linaro.org wrote:
> From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
> 
> This patch move the codec reset code from dai ops to codec probe, so
> that the codec is not held in reset when headset detection block is
> still active.

This means that the CODEC will no longer be held in reset (which
presumably has a power benefit or something) even if jack detection
isn't in use.  What most devices do is have things like this be
controlled via the bias level or other power management functions and
then have jack detection hold the CODEC out of the lowest power states
when it's active.

[toc] | [prev] | [next] | [standalone]


#1698827 — Re: [PATCH v1 3/6] ASoC: codecs: msm8916-wcd-analog: move codec reset to probe

FromSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
Date2017-07-28 16:10 +0200
SubjectRe: [PATCH v1 3/6] ASoC: codecs: msm8916-wcd-analog: move codec reset to probe
Message-ID<u8e7O-4Ks-45@gated-at.bofh.it>
In reply to#1698798

On 28/07/17 14:40, Mark Brown wrote:
> On Wed, Jul 26, 2017 at 02:35:09AM +0200, srinivas.kandagatla@linaro.org wrote:
>> From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
>>
>> This patch move the codec reset code from dai ops to codec probe, so
>> that the codec is not held in reset when headset detection block is
>> still active.
> 
> This means that the CODEC will no longer be held in reset (which
> presumably has a power benefit or something) even if jack detection
> isn't in use.  What most devices do is have things like this be
> controlled via the bias level or other power management functions and
> then have jack detection hold the CODEC out of the lowest power states
> when it's active.

This chip has two power sources for MBHC logic, one from mic bias which 
is used when we have active audio usecase, and other from internal 
current source which is for low-power state when no audio use case is 
active.

By default with the existing code uses internal current source which 
puts chip in low power state.


> 

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web