[EXTERNAL] Re: [PATCH] ASoC: max98373: Mark cache dirty before entering sleep

Pierre-Louis Bossart pierre-louis.bossart at linux.intel.com
Mon Sep 27 18:48:56 CEST 2021



On 9/27/21 11:06 AM, Mark Brown wrote:
> On Mon, Sep 27, 2021 at 04:01:25PM +0000, Ryan Lee wrote:
> 
>>>>       regcache_cache_only(max98373->regmap, true);
>>>> +     regcache_mark_dirty(max98373->regmap);
> 
>>> We already do the following sequence in max98373_io_init() when the
>>> amplifier re-attaches:
> 
>>>         if (max98373->first_hw_init) {
>>>                 regcache_cache_bypass(max98373->regmap, false);
>>>                 regcache_mark_dirty(max98373->regmap);
>>>         }
> 
>>> I don't see what marking the cache as dirty on suspend might do, we will do a
>>> sync only in the resume step.
> 
>>> IIRC this is a patch that we've seen before and removed since it wasn't
>>> aligned with any other codec driver.
> 
>> Yes, it does. There was an mute problem report due to amp register reset
>> during suspend/resume. and we confirmed that the modification 
>> is effective. (https://partnerissuetracker.corp.google.com/issues/194472331)
>> The added code helps to re-write valid values in cache to the amp hardware
>> when audio resume. Same code was there on i2c driver, but not on Soundwire
>> driver.

Ryan, we removed this in f184892613dd ('ASoC: codecs: max98373-sdw:
align regmap use with other codecs'), so even if this was needed you'd
need a mention that this is a revert and why this sequence is better.
You are suggesting a change based on an analogy with I2C which is
questionable: when a SoundWire device regains sync on the bus, it will
be re-initialized using a callback, and the resume waits for the
initialization to complete.

> More specifically what it does is make the invalidation of the register
> cache unconditional.  It doesn't really matter if the invalidation is
> done on suspend or resume, so long as it happens before we attempt to
> resync - this could also be done by deleting the first_hw_init check.

Mark, that's exactly my point: if the amp rejoins the bus, we will
*always* mark the cache as dirty, before the resync is done in the
resume sequence.

I am really trying to figure out if we have a major flaw in the resume
sequence and why things are different in the case of the Maxim amp.

Instead of changing the suspend sequence, can we please try to modify
the max98373_io_init() routine to unconditionally flag the cache as
dirty, maybe this points to a problem with the management of the
max98373->first_hw_init flag.


More information about the Alsa-devel mailing list