alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ASoC: wm8962: No need to call wm8962_configure_bclk() multiple times
@ 2013-07-19  5:58 Fabio Estevam
  2013-07-19  6:00 ` Nicolin Chen
  2013-07-19 10:07 ` Mark Brown
  0 siblings, 2 replies; 3+ messages in thread
From: Fabio Estevam @ 2013-07-19  5:58 UTC (permalink / raw)
  To: broonie; +Cc: Fabio Estevam, alsa-devel, b42378, shawn.guo

From: Fabio Estevam <fabio.estevam@freescale.com>

Currently after playing any audio file, we get the following error message:

$ aplay clarinet.wav 
Playing WAVE 'clarinet.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
$ wm8962 0-001a: Unsupported sysclk ratio 544

This error message appears about 5 seconds after the audio playback has 
finished.

There is no need to re-calculate the bit clock after the playback has finished,
so call wm8962_configure_bclk only once inside wm8962_hw_params(). 

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
 sound/soc/codecs/wm8962.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c
index 6a5066c..1bf79dc 100644
--- a/sound/soc/codecs/wm8962.c
+++ b/sound/soc/codecs/wm8962.c
@@ -2497,8 +2497,6 @@ static int wm8962_set_bias_level(struct snd_soc_codec *codec,
 		/* VMID 2*50k */
 		snd_soc_update_bits(codec, WM8962_PWR_MGMT_1,
 				    WM8962_VMID_SEL_MASK, 0x80);
-
-		wm8962_configure_bclk(codec);
 		break;
 
 	case SND_SOC_BIAS_STANDBY:
@@ -2621,8 +2619,6 @@ static int wm8962_set_dai_sysclk(struct snd_soc_dai *dai, int clk_id,
 
 	wm8962->sysclk_rate = freq;
 
-	wm8962_configure_bclk(codec);
-
 	return 0;
 }
 
-- 
1.8.1.2

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ASoC: wm8962: No need to call wm8962_configure_bclk() multiple times
  2013-07-19  5:58 [PATCH] ASoC: wm8962: No need to call wm8962_configure_bclk() multiple times Fabio Estevam
@ 2013-07-19  6:00 ` Nicolin Chen
  2013-07-19 10:07 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Nicolin Chen @ 2013-07-19  6:00 UTC (permalink / raw)
  To: Fabio Estevam; +Cc: Fabio Estevam, alsa-devel, broonie, shawn.guo

Hi Fabio,

On Fri, Jul 19, 2013 at 02:58:28AM -0300, Fabio Estevam wrote:
> -
> -		wm8962_configure_bclk(codec);
>  		break;
>  
>  	case SND_SOC_BIAS_STANDBY:
> @@ -2621,8 +2619,6 @@ static int wm8962_set_dai_sysclk(struct snd_soc_dai *dai, int clk_id,
>  
>  	wm8962->sysclk_rate = freq;
>  
> -	wm8962_configure_bclk(codec);
> -

Although I know this modification should be okay on i.MX SabreSD,
yet I'm not sure if won't break other usage on other platforms.

And the problem here is because wm8962->bclk and wm8962->lrclk
are updated in hw_params() but be remained after playback's done.
So there might be a least risky way to fix it just by adding this:

+static int wm8962_hw_free(struct snd_pcm_substream *substream,
+		struct snd_soc_dai *dai)
+{
+	struct snd_soc_codec *codec = dai->codec;
+	struct wm8962_priv *wm8962 = snd_soc_codec_get_drvdata(codec);
+
+	wm8962->lrclk = 0;
+	wm8962->bclk = 0;
+
+	return 0;
+}


Surely If Mark say okay to Fabio's patch, I'll be totally okay
with it too. I just want to this wm8962 driver can work perfectly
on all the platforms.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ASoC: wm8962: No need to call wm8962_configure_bclk() multiple times
  2013-07-19  5:58 [PATCH] ASoC: wm8962: No need to call wm8962_configure_bclk() multiple times Fabio Estevam
  2013-07-19  6:00 ` Nicolin Chen
@ 2013-07-19 10:07 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2013-07-19 10:07 UTC (permalink / raw)
  To: Fabio Estevam; +Cc: Fabio Estevam, alsa-devel, b42378, shawn.guo


[-- Attachment #1.1: Type: text/plain, Size: 820 bytes --]

On Fri, Jul 19, 2013 at 02:58:28AM -0300, Fabio Estevam wrote:
> From: Fabio Estevam <fabio.estevam@freescale.com>
> 
> Currently after playing any audio file, we get the following error message:
> 
> $ aplay clarinet.wav 
> Playing WAVE 'clarinet.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
> $ wm8962 0-001a: Unsupported sysclk ratio 544
> 
> This error message appears about 5 seconds after the audio playback has 
> finished.
> 
> There is no need to re-calculate the bit clock after the playback has finished,
> so call wm8962_configure_bclk only once inside wm8962_hw_params(). 

No, you do end up needing to call it in multiple places - there's other
configuration going on there that is needed by bypass paths which won't
use the audio interface and hence won't call hw_params().

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-07-19 10:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-19  5:58 [PATCH] ASoC: wm8962: No need to call wm8962_configure_bclk() multiple times Fabio Estevam
2013-07-19  6:00 ` Nicolin Chen
2013-07-19 10:07 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).