[PATCH 0/6] ASoC: codecs: lpass-macros: switch regcache to REGCACHE_MAPLE

Srinivas Kandagatla posted 6 patches 2 weeks, 3 days ago
sound/soc/codecs/lpass-rx-macro.c  |  4 ++-
sound/soc/codecs/lpass-tx-macro.c  |  2 +-
sound/soc/codecs/lpass-va-macro.c  |  2 +-
sound/soc/codecs/lpass-wsa-macro.c | 46 ++++++++++++++++++------------
4 files changed, 33 insertions(+), 21 deletions(-)
[PATCH 0/6] ASoC: codecs: lpass-macros: switch regcache to REGCACHE_MAPLE
Posted by Srinivas Kandagatla 2 weeks, 3 days ago
Move all four LPASS codec macros (rx/tx/va/wsa) from REGCACHE_FLAT to
REGCACHE_MAPLE, and fix a latent v2.5 Compander1 addressing bug that
the flat cache had been absorbing.

REGCACHE_FLAT hides missing-default reads by returning the zero-
initialised cache slot instead of doing a bus read.  The caller can't
tell that value apart from a real hardware value, so any un-defaulted,
readable, non-volatile register that gets read silently returns wrong
data.  Since commit e062bdfdd6ad ("regmap: warn users about
uninitialized flat cache") regmap dev_warn_once()s the first such
miss, but any subsequent miss stays silent.

REGCACHE_MAPLE reports a cache miss as -ENOENT and the regmap core
falls back to a real bus read, so the caller always gets the true
hardware value.  All four macros are switched in the same series
for consistency.

The switch surfaced a latent bug in wsa_macro_set_spkr_mode() on
v2.5+ silicon: two Compander1 register addresses moved on that
generation and the driver was writing to the v2.1 addresses on all
versions, taking a silent bus error.  Patch 1/6 fixes that and is
tagged Cc: stable.

Series contents:
  1/6: wsa-macro: use v2.5 Compander1 addresses on v2.5+ silicon
       (fix, tagged for stable).
  2/6: rx-macro + wsa-macro: sort concatenated reg_defaults before
       regmap init so regmap does not sort a copy at runtime.
  3/6: wsa-macro: switch cache to REGCACHE_MAPLE.
  4/6, 5/6, 6/6: rx-macro / tx-macro / va-macro: cache switch,
       same rationale as 3/6.

Tested on Glymur (SC8480XP CRD, WCD9378 SDCA compute mode + WSA8845
speakers): HPH playback, mic capture and WSA speaker playback all
work with the full series applied; the "using zero-initialized flat
cache" and "Unsorted reg_defaults" warnings both disappear from the
boot log.

Srinivas Kandagatla (6):
  ASoC: codecs: lpass-wsa-macro: use v2.5 Compander1 addresses on v2.5+
  ASoC: codecs: lpass-{rx,wsa}-macro: sort reg_defaults before regmap
    init
  ASoC: codecs: lpass-wsa-macro: switch cache to REGCACHE_MAPLE
  ASoC: codecs: lpass-rx-macro: switch cache to REGCACHE_MAPLE
  ASoC: codecs: lpass-tx-macro: switch cache to REGCACHE_MAPLE
  ASoC: codecs: lpass-va-macro: switch cache to REGCACHE_MAPLE

 sound/soc/codecs/lpass-rx-macro.c  |  4 ++-
 sound/soc/codecs/lpass-tx-macro.c  |  2 +-
 sound/soc/codecs/lpass-va-macro.c  |  2 +-
 sound/soc/codecs/lpass-wsa-macro.c | 46 ++++++++++++++++++------------
 4 files changed, 33 insertions(+), 21 deletions(-)

-- 
2.53.0