Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Lars-Peter Clausen <lars@metafoo.de>
To: Fabio Estevam <festevam@gmail.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>,
	alsa-devel@alsa-project.org, broonie@kernel.org,
	shawn.guo@freescale.com
Subject: Re: [PATCH v2] ASoC: sgtl5000: Fix the cache handling
Date: Fri, 23 May 2014 10:36:20 +0200	[thread overview]
Message-ID: <537F0884.3050605@metafoo.de> (raw)
In-Reply-To: <1400821880-20939-1-git-send-email-festevam@gmail.com>

[...]
> @@ -1075,7 +1079,6 @@ static int sgtl5000_suspend(struct snd_soc_codec *codec)
>    */
>   static int sgtl5000_restore_regs(struct snd_soc_codec *codec)
>   {
> -	u16 *cache = codec->reg_cache;
>   	u16 reg;
>
>   	/* restore regular registers */
> @@ -1089,12 +1092,12 @@ static int sgtl5000_restore_regs(struct snd_soc_codec *codec)
>   			reg == SGTL5000_CHIP_REF_CTRL)
>   			continue;
>
> -		snd_soc_write(codec, reg, cache[reg]);
> +		snd_soc_write(codec, reg, snd_soc_read(codec, reg));
>   	}
>
>   	/* restore dap registers */
>   	for (reg = SGTL5000_DAP_REG_OFFSET; reg < SGTL5000_MAX_REG_OFFSET; reg += 2)
> -		snd_soc_write(codec, reg, cache[reg]);
> +		snd_soc_write(codec, reg, snd_soc_read(codec, reg));
>
>   	/*
>   	 * restore these regs according to the power setting sequence in
> @@ -1110,29 +1113,32 @@ static int sgtl5000_restore_regs(struct snd_soc_codec *codec)
>   	 *    prefer to resotre it after SGTL5000_CHIP_ANA_POWER restored
>   	 */
>   	snd_soc_write(codec, SGTL5000_CHIP_LINREG_CTRL,
> -			cache[SGTL5000_CHIP_LINREG_CTRL]);
> +			snd_soc_read(codec, SGTL5000_CHIP_LINREG_CTRL));
>
>   	snd_soc_write(codec, SGTL5000_CHIP_ANA_POWER,
> -			cache[SGTL5000_CHIP_ANA_POWER]);
> +			snd_soc_read(codec, SGTL5000_CHIP_ANA_POWER));
>
>   	snd_soc_write(codec, SGTL5000_CHIP_CLK_CTRL,
> -			cache[SGTL5000_CHIP_CLK_CTRL]);
> +			snd_soc_read(codec, SGTL5000_CHIP_CLK_CTRL));
>
>   	snd_soc_write(codec, SGTL5000_CHIP_REF_CTRL,
> -			cache[SGTL5000_CHIP_REF_CTRL]);
> +			snd_soc_read(codec, SGTL5000_CHIP_REF_CTRL));
>
>   	snd_soc_write(codec, SGTL5000_CHIP_LINE_OUT_CTRL,
> -			cache[SGTL5000_CHIP_LINE_OUT_CTRL]);
> +			snd_soc_read(codec, SGTL5000_CHIP_LINE_OUT_CTRL));
>   	return 0;
>   }
>
>   static int sgtl5000_resume(struct snd_soc_codec *codec)
>   {
> +	struct sgtl5000_priv *sgtl5000 = snd_soc_codec_get_drvdata(codec);
>   	/* Bring the codec back up to standby to enable regulators */
>   	sgtl5000_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
>
>   	/* Restore registers by cached in memory */
>   	sgtl5000_restore_regs(codec);
> +
> +	regcache_cache_only(sgtl5000->regmap, false);

That doesn't make too much sense, if regmap is in cache only mode 
snd_soc_read() will read from the cache and snd_soc_write() will write to the 
cache and nothing else happens. So you read from the cache only to write the 
same value back.

  reply	other threads:[~2014-05-23  8:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-23  5:11 [PATCH v2] ASoC: sgtl5000: Fix the cache handling Fabio Estevam
2014-05-23  8:36 ` Lars-Peter Clausen [this message]
2014-05-23 12:39   ` Fabio Estevam

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=537F0884.3050605@metafoo.de \
    --to=lars@metafoo.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=fabio.estevam@freescale.com \
    --cc=festevam@gmail.com \
    --cc=shawn.guo@freescale.com \
    /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