alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Lars-Peter Clausen <lars@metafoo.de>
To: Xavier Hsu <xavier.hsu@linaro.org>,
	alsa-devel@alsa-project.org, patches@opensource.wolfsonmicro.com,
	patches@linaro.org
Cc: Andy Green <andy.green@linaro.org>
Subject: Re: [PATCHv3 7/9] WM8971 improves the function of regmap
Date: Wed, 03 Sep 2014 21:19:22 +0200	[thread overview]
Message-ID: <540769BA.8010606@metafoo.de> (raw)
In-Reply-To: <1409628470-13059-7-git-send-email-xavier.hsu@linaro.org>

On 09/02/2014 05:27 AM, Xavier Hsu wrote:
> This patch improves WM8971.
> We modify the function of regmap.
>
> Any comments about improving the patch are welcome.
> Thanks.
>
> Signed-off-by: Xavier Hsu <xavier.hsu@linaro.org>
> Signed-off-by: Andy Green <andy.green@linaro.org>
> ---
>   sound/soc/codecs/wm8971.c |   26 +++++++++++++++++++++-----
>   1 file changed, 21 insertions(+), 5 deletions(-)
>
> diff --git a/sound/soc/codecs/wm8971.c b/sound/soc/codecs/wm8971.c
> index 68b4f52..95e7c39 100755
> --- a/sound/soc/codecs/wm8971.c
> +++ b/sound/soc/codecs/wm8971.c
> @@ -38,6 +38,7 @@
>
>   /* codec private data */
>   struct wm8971_priv {
> +	struct regmap *regmap;
>   	unsigned int sysclk;
>   	struct snd_pcm_hw_constraint_list *sysclk_constraints;
>   	int playback_fs;
> @@ -716,6 +717,7 @@ static int wm8971_mute(struct snd_soc_dai *dai, int mute)
>   static int wm8971_set_bias_level(struct snd_soc_codec *codec,
>   				 enum snd_soc_bias_level level)
>   {
> +	struct wm8971_priv *wm8971 = snd_soc_codec_get_drvdata(codec);
>   	u16 pwr_reg = snd_soc_read(codec, WM8971_PWR1) & 0xfe3e;
>
>   	switch (level) {
> @@ -727,7 +729,7 @@ static int wm8971_set_bias_level(struct snd_soc_codec *codec,
>   		break;
>   	case SND_SOC_BIAS_STANDBY:
>   		if (codec->dapm.bias_level == SND_SOC_BIAS_OFF)
> -			snd_soc_cache_sync(codec);
> +			regcache_sync(wm8971->regmap);

This is a bugfix and it should be noted in the commit message, what is 
broken, why it is broken and since when it has been broken.

>
>   		/* mute dac and set vmid to 500k, enable VREF */
>   		snd_soc_write(codec, WM8971_PWR1, pwr_reg | 0x0140);
> @@ -774,7 +776,11 @@ static struct snd_soc_dai_driver wm8971_dai = {
>
>   static int wm8971_suspend(struct snd_soc_codec *codec)
>   {
> +	struct wm8971_priv *wm8971 = snd_soc_codec_get_drvdata(codec);
> +
>   	wm8971_set_bias_level(codec, SND_SOC_BIAS_OFF);
> +	regcache_mark_dirty(wm8971->regmap);

The core already marks the regcache dirty after calling the suspend 
callback, no need to do this from hand.

> +
>   	return 0;
>   }
>
> @@ -797,9 +803,12 @@ static int wm8971_resume(struct snd_soc_codec *codec)
>
>   static int wm8971_probe(struct snd_soc_codec *codec)
>   {
> +	struct wm8971_priv *wm8971 = snd_soc_codec_get_drvdata(codec);
>   	int ret = 0;
>   	u16 reg;
>
> +	codec->control_data = wm8971->regmap;
> +
>   	wm8971_reset(codec);
>
>   	/* charge output caps - set vmid to 5k for quick power up */
> @@ -830,12 +839,20 @@ static int wm8971_remove(struct snd_soc_codec *codec)
>   	return 0;
>   }
>
> +struct regmap *wm8971_get_regmap(struct device *dev)
> +{
> +	struct wm8971_priv *priv = dev_get_drvdata(dev);
> +
> +	return priv->regmap;
> +}

This is unnecessary, since the regmap has been registered with the device of 
the CODEC the core is able to figure out the correct regmap itself.

[...]

  parent reply	other threads:[~2014-09-03 19:19 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-02  3:27 [PATCHv3 1/9] Clean WM8971 through checkpatch Xavier Hsu
2014-09-02  3:27 ` [PATCHv3 2/9] WM8971 uses SOC_ENUM_SINGLE_DECL to replace SOC_ENUM_SINGLE Xavier Hsu
2014-09-02  9:33   ` Charles Keepax
2014-09-02 14:56   ` Lars-Peter Clausen
2014-09-04  3:53     ` Xavier Hsu
2014-09-02  3:27 ` [PATCHv3 3/9] WM8971 uses TLV information Xavier Hsu
2014-09-02  9:47   ` Charles Keepax
2014-09-02  3:27 ` [PATCHv3 4/9] Improve wm8971_set_dai_fmt Xavier Hsu
2014-09-02  9:48   ` Charles Keepax
2014-09-02  3:27 ` [PATCHv3 5/9] Using the constraint based on wm8971_set_dai_sysclk Xavier Hsu
2014-09-02  9:28   ` Charles Keepax
2014-09-04  9:13     ` [alsa-devel] " Xavier Hsu
2014-09-02  3:27 ` [PATCHv3 6/9] WM8971 uses msleep to replace work queue Xavier Hsu
2014-09-02 10:00   ` Charles Keepax
2014-09-05  3:09     ` Xavier Hsu
2014-09-02  3:27 ` [PATCHv3 7/9] WM8971 improves the function of regmap Xavier Hsu
2014-09-02 11:03   ` Charles Keepax
2014-09-03 19:19   ` Lars-Peter Clausen [this message]
2014-09-11  3:21     ` Xavier Hsu
2014-09-11  7:06       ` Lars-Peter Clausen
2014-09-02  3:27 ` [PATCHv3 8/9] WM8971 adds kcontrol functions Xavier Hsu
2014-09-02 12:41   ` Charles Keepax
2014-09-11  3:35     ` Xavier Hsu
2014-09-02  3:27 ` [PATCHv3 9/9] ASOC add WM8973 support to WM8971 Xavier Hsu
2014-09-02 12:38   ` Charles Keepax
  -- strict thread matches above, loose matches on Subject: below --
2014-09-02  3:30 [PATCHv3 1/9] Clean WM8971 through checkpatch Xavier Hsu
2014-09-02  3:30 ` [PATCHv3 7/9] WM8971 improves the function of regmap 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=540769BA.8010606@metafoo.de \
    --to=lars@metafoo.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=andy.green@linaro.org \
    --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).