linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
To: Robert Jarzmik <robert.jarzmik@free.fr>
Cc: Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>, Jaroslav Kysela <perex@perex.cz>,
	Takashi Iwai <tiwai@suse.com>, <alsa-devel@alsa-project.org>,
	<linux-kernel@vger.kernel.org>,
	<patches@opensource.wolfsonmicro.com>
Subject: Re: [PATCH v2] ASoC: wm9713: convert to regmap
Date: Tue, 27 Oct 2015 09:10:09 +0000	[thread overview]
Message-ID: <20151027091009.GJ10520@ck-lbox> (raw)
In-Reply-To: <8737wxldns.fsf@belgarion.home>

On Mon, Oct 26, 2015 at 06:53:27PM +0100, Robert Jarzmik wrote:
> Charles Keepax <ckeepax@opensource.wolfsonmicro.com> writes:
> 
> > On Sat, Oct 24, 2015 at 11:37:07PM +0200, Robert Jarzmik wrote:
> >> Convert the Wolfson WM9713 to regmap API. This will leverage all the
> >> regmap functions (debug, registers update, etc ...).
> >> 
> >> As a bonus, this will pave the path to gpio chip introduction, and
> >> devicetree support.
> >> 
> >> Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
> >> ---
> > I am assuming we don't want to be doing a cache_sync just after we
> > have marked the regmap as cache only.
> Ah, this denotes my lack of understanding of regmap cache behavior.
> Basically what I want at this point is that :
>  1) All previous writes should hit the cache (cache coherency barrier)
>  2) All subsequent writes should not go into the cache (uncached writes)
>     => especially the next writes in wm9713_soc_suspend()

Cache only means that writes will only go into the cache. Cache
sync writes the current state of the cache out to the hardware.
Normally you would put the cache into cache only during suspend
this allows controls etc. to still function but the writes go to
the cache and thus the user doesn't need to worry if the codec is
active or not. Then on resume you would turn cache only off such
that writes will go to the hardware again and do a cache sync (you
will need a call to mark the cache as dirty at some point as well),
this will bring the hardware up to date with the writes that
happened whilst it was suspended.

Doing an update_bits that bypasses the cache can be difficult.
You can use regcache_cache_bypass to effectively turn the cache
off, but you need to synchronise it with everything else to
ensure that no writes you want to hit the cache happen whilst it
is disabled. Also you can use multi_write_bypassed to do a bunch
of writes atomically that don't hit the cache, but those are
whole writes rather than update_bits.

> > Also as you have already marked the regmap as cache only these
> > writes won't go to the hardware.
> Ah, exactly the opposite of what I wanted :(
> 
> Would you have an example driver I can inspire myself from. If not, I'll dig in
> more in the regmap cache API.

wm8962 for example shows fairly typical use of these APIs.

Thanks,
Charles

  reply	other threads:[~2015-10-27  9:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-24 21:37 [PATCH v2] ASoC: wm9713: convert to regmap Robert Jarzmik
2015-10-26 11:02 ` Charles Keepax
2015-10-26 17:53   ` Robert Jarzmik
2015-10-27  9:10     ` Charles Keepax [this message]
2015-10-26 11:27 ` [alsa-devel] " Lars-Peter Clausen
2015-10-26 18:02   ` Robert Jarzmik

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=20151027091009.GJ10520@ck-lbox \
    --to=ckeepax@opensource.wolfsonmicro.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=patches@opensource.wolfsonmicro.com \
    --cc=perex@perex.cz \
    --cc=robert.jarzmik@free.fr \
    --cc=tiwai@suse.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;
as well as URLs for NNTP newsgroup(s).