alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Lars-Peter Clausen <lars@metafoo.de>
To: Ricard Wanderlof <ricard.wanderlof@axis.com>
Cc: alsa-devel <alsa-devel@alsa-project.org>
Subject: Re: ADAU1761 default register value problem
Date: Mon, 16 May 2016 19:02:27 +0200	[thread overview]
Message-ID: <5739FD23.4060506@metafoo.de> (raw)
In-Reply-To: <alpine.DEB.2.02.1605161150530.31333@lnxricardw1.se.axis.com>

On 05/16/2016 01:07 PM, Ricard Wanderlof wrote:
> 
> On Fri, 13 May 2016, Lars-Peter Clausen wrote:
> 
>>> Having researched this further, it appears that commit
>>>
>>> 27d6e7d1c96c9f51379e0feb972fec26029098bc
>>>
>>> ASoC: adau17x1: Cache writes when core clock is disabled
>>
>> I think it is also related to commit 1c79771a7270 ("regmap: Use
>> regcache_mark_dirty() to indicate power loss or reset"). This changes the
>> regmap code to sync all registers under certain conditions.
> 
> Yes, that commit seems to be the key, although I must admit that I can't 
> get my head around the logic of that commit. The commit message says: "HW 
> was not reset (maybe it was just clock-gated), so if we cached any writes, 
> they should be sent to the hardware regardless of whether they match the 
> HW default.". But if the device was indeed gated off, rather than reset, 
> why should this make a difference when writing out the cache after gating 
> the chip on again? If it were gated off and then on, doesn't this imply 
> that the register settings won't change? Or is the idea that the chip 
> might loose all its state while gated off and hence essentially needs to 
> be reinitialized?

The register settings in the device will stay constant, but the cached
register settings might have changed. E.g. application changes the volume of
a control while the device is powered down. Since regmap does not (yet)
track which registers have changed it has to write out all of them.

> 
> Regardless of the commit message, the code indeed does cause all the 
> cached data to be written out when regcache_sync() is called in this case.
> 
>> We still have the issue though that the CODEC is in an undefined state until
>> the first OFF to STANDBY transitions happens. Usually this will happen early
>> on when the CODEC is bound to the sound card, but if it is not bound
>> immediately it might stay there for a bit longer. So depending on the setup
>> this may or may not be a problem.
> 
> So that means that in the probe function we should really write out the 
> default values, by enabling SYSCLK_EN in the ADAU clock control register, 
> and then calling regcache_sync() before disabling SYSCLK_EN again, and 
> going to regcache_cache_only(..,true) ?

Sounds reasonable.

  reply	other threads:[~2016-05-16 17:02 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-21 14:01 ADAU1761 default register value problem Ricard Wanderlof
2016-04-26  8:21 ` Lars-Peter Clausen
2016-05-03  8:16   ` Ricard Wanderlof
2016-05-11 15:16   ` Ricard Wanderlof
2016-05-13  8:20     ` Lars-Peter Clausen
2016-05-16 11:07       ` Ricard Wanderlof
2016-05-16 17:02         ` Lars-Peter Clausen [this message]
  -- strict thread matches above, loose matches on Subject: below --
2016-03-29 13:58 Ricard Wanderlof

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=5739FD23.4060506@metafoo.de \
    --to=lars@metafoo.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=ricard.wanderlof@axis.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).