alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
To: Xavier Hsu <xavier.hsu@linaro.org>
Cc: Andy Green <andy.green@linaro.org>,
	alsa-devel@alsa-project.org, patches@opensource.wolfsonmicro.com,
	lars@metafoo.de, patches@linaro.org
Subject: Re: [PATCHv4 7/9] WM8971 uses msleep to replace work queue
Date: Mon, 22 Sep 2014 13:16:58 +0100	[thread overview]
Message-ID: <20140922121658.GF29992@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <1410943275-4160-7-git-send-email-xavier.hsu@linaro.org>

On Wed, Sep 17, 2014 at 04:41:13PM +0800, Xavier Hsu wrote:
> This patch improves WM8971.
> We use msleep to replace work queue.
> "As suggested by Mark Brown"
> 
> Signed-off-by: Xavier Hsu <xavier.hsu@linaro.org>
> Signed-off-by: Andy Green <andy.green@linaro.org>
> ---
> Any comments about improving the patch are welcome.
> Thanks.
> 
>  sound/soc/codecs/wm8971.c |   27 ++++-----------------------
>  1 file changed, 4 insertions(+), 23 deletions(-)
> 
> diff --git a/sound/soc/codecs/wm8971.c b/sound/soc/codecs/wm8971.c
> index 5b38c7a..d081cae 100755
> --- a/sound/soc/codecs/wm8971.c
> +++ b/sound/soc/codecs/wm8971.c
> @@ -36,8 +36,6 @@
>  
>  #define	WM8971_REG_COUNT		43
>  
> -static struct workqueue_struct *wm8971_workq;
> -
>  /* codec private data */
>  struct wm8971_priv {
>  	/* MCLK */
> @@ -779,16 +777,6 @@ static struct snd_soc_dai_driver wm8971_dai = {
>  	.ops = &wm8971_dai_ops,
>  };
>  
> -static void wm8971_work(struct work_struct *work)
> -{
> -	struct snd_soc_dapm_context *dapm =
> -		container_of(work, struct snd_soc_dapm_context,
> -			     delayed_work.work);
> -	struct snd_soc_codec *codec = dapm->codec;
> -
> -	wm8971_set_bias_level(codec, codec->dapm.bias_level);
> -}
> -
>  static int wm8971_suspend(struct snd_soc_codec *codec)
>  {
>  	wm8971_set_bias_level(codec, SND_SOC_BIAS_OFF);
> @@ -806,8 +794,8 @@ static int wm8971_resume(struct snd_soc_codec *codec)
>  		reg = snd_soc_read(codec, WM8971_PWR1) & 0xfe3e;
>  		snd_soc_write(codec, WM8971_PWR1, reg | 0x01c0);
>  		codec->dapm.bias_level = SND_SOC_BIAS_ON;
> -		queue_delayed_work(wm8971_workq, &codec->dapm.delayed_work,
> -				   msecs_to_jiffies(1000));
> +		wm8971_set_bias_level(codec, codec->dapm.bias_level);
> +		msleep(1000);
>  	}
>  
>  	return 0;
> @@ -818,19 +806,14 @@ static int wm8971_probe(struct snd_soc_codec *codec)
>  	int ret = 0;
>  	u16 reg;
>  
> -	INIT_DELAYED_WORK(&codec->dapm.delayed_work, wm8971_work);
> -	wm8971_workq = create_workqueue("wm8971");
> -	if (wm8971_workq == NULL)
> -		return -ENOMEM;
> -
>  	wm8971_reset(codec);
>  
>  	/* charge output caps - set vmid to 5k for quick power up */
>  	reg = snd_soc_read(codec, WM8971_PWR1) & 0xfe3e;
>  	snd_soc_write(codec, WM8971_PWR1, reg | 0x01c0);
>  	codec->dapm.bias_level = SND_SOC_BIAS_STANDBY;
> -	queue_delayed_work(wm8971_workq, &codec->dapm.delayed_work,
> -			   msecs_to_jiffies(1000));
> +	wm8971_set_bias_level(codec, codec->dapm.bias_level);
> +	msleep(1000);

Before this patch the bias_level change is after the delay, after
this patch the change is before the delay? That doesn't seem
right?

>  
>  	/* set the update bits */
>  	snd_soc_update_bits(codec, WM8971_LDAC, 0x0100, 0x0100);
> @@ -850,8 +833,6 @@ static int wm8971_remove(struct snd_soc_codec *codec)
>  {
>  	wm8971_set_bias_level(codec, SND_SOC_BIAS_OFF);
>  
> -	if (wm8971_workq)
> -		destroy_workqueue(wm8971_workq);
>  	return 0;
>  }
>  
> -- 
> 1.7.9.5
> 

Thanks,
Charles

  reply	other threads:[~2014-09-22 12:16 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-17  8:41 [PATCHv4 1/9] Clean WM8971 through checkpatch Xavier Hsu
2014-09-17  8:41 ` [PATCHv4 2/9] WM8971 modifies the control of deemphasis Xavier Hsu
2014-09-17  8:41 ` [PATCHv4 3/9] WM8971 uses SOC_ENUM_SINGLE_DECL to replace SOC_ENUM_SINGLE Xavier Hsu
2014-09-17  8:41 ` [PATCHv4 4/9] WM8971 uses TLV information Xavier Hsu
2014-09-17  8:41 ` [PATCHv4 5/9] Improve wm8971_set_dai_fmt Xavier Hsu
2014-09-17  8:41 ` [PATCHv4 6/9] Using the constraint based on wm8971_set_dai_sysclk Xavier Hsu
2014-09-17  8:41 ` [PATCHv4 7/9] WM8971 uses msleep to replace work queue Xavier Hsu
2014-09-22 12:16   ` Charles Keepax [this message]
2014-09-24  7:37     ` Xavier Hsu
2014-09-17  8:41 ` [PATCHv4 8/9] WM8971 uses regcache_sync to replace snd_soc_cache_sync Xavier Hsu
2014-09-17  8:41 ` [PATCHv4 9/9] ASOC add WM8973 support to WM8971 Xavier Hsu
2014-09-22 12:34   ` Charles Keepax
2014-09-22 12:35 ` [PATCHv4 1/9] Clean WM8971 through checkpatch Charles Keepax
2014-09-23  6:54   ` Xavier Hsu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140922121658.GF29992@opensource.wolfsonmicro.com \
    --to=ckeepax@opensource.wolfsonmicro.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=andy.green@linaro.org \
    --cc=lars@metafoo.de \
    --cc=patches@linaro.org \
    --cc=patches@opensource.wolfsonmicro.com \
    --cc=xavier.hsu@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).