Linux Sound subsystem development
 help / color / mirror / Atom feed
* [PATCH 0/3] ASoC: cs35l41/cs35l45/cs4265: sort the reg_defaults tables
@ 2026-08-05  8:24 Peter Ujfalusi
  2026-08-05  8:24 ` [PATCH 1/3] ASoC: cs35l41: sort the register default table Peter Ujfalusi
                   ` (5 more replies)
  0 siblings, 6 replies; 29+ messages in thread
From: Peter Ujfalusi @ 2026-08-05  8:24 UTC (permalink / raw)
  To: Mark Brown, Liam Girdwood, David Rhodes, Richard Fitzgerald
  Cc: Charles Keepax, Vlad Karpovich, Paul Handrigan, patches,
	linux-sound, stable

Hi,

reg_defaults must be sorted by ascending register address as
regcache_lookup_reg() locates the entries in it with bsearch(), see commit
fd80df352ba1 ("regcache: Add support for sorting defaults arrays").

These three tables have entries which are out of order, so the binary search
does not find part of them.  For those registers regcache_reg_needs_sync()
cannot compare the cached value against the default and reports that a sync
is needed, so they are written to the device on every regcache_sync() even
when they were never touched.

The patches only reorder the existing entries, the text of every entry is
kept verbatim and no default value is changed.  Each table was verified by
evaluating the register addresses and replaying lib/bsearch.c on them.

Entries not reachable by the binary search, per table:

  cs35l41_reg           2 (of 47)
  cs35l45_defaults     36 (of 73)
  cs4265_reg_defaults   3 (of 16)

For cs35l45 this is nearly half of the table: the DSP1_RX*_RATE and
DSP1_TX*_RATE registers sit in the middle of it while their addresses are
far above everything else, which cuts the search off from the whole
0x4c40 - 0xf010 range.

Found by an audit of all reg_defaults tables under sound/, the SoundWire
codec drivers are fixed by a separate series.

Regards,
Peter

Peter Ujfalusi (3):
  ASoC: cs35l41: sort the register default table
  ASoC: cs35l45: sort the register default table
  ASoC: cs4265: sort the register default table

 sound/soc/codecs/cs35l41-lib.c    |  2 +-
 sound/soc/codecs/cs35l45-tables.c | 32 +++++++++++++++----------------
 sound/soc/codecs/cs4265.c         |  4 ++--
 3 files changed, 19 insertions(+), 19 deletions(-)


base-commit: 05eebef3c7b2e8595fdd1bd46912aac9c1de8587
-- 
2.55.0


^ permalink raw reply	[flat|nested] 29+ messages in thread

end of thread, other threads:[~2026-08-05 21:43 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-05  8:24 [PATCH 0/3] ASoC: cs35l41/cs35l45/cs4265: sort the reg_defaults tables Peter Ujfalusi
2026-08-05  8:24 ` [PATCH 1/3] ASoC: cs35l41: sort the register default table Peter Ujfalusi
2026-08-05  9:58   ` Richard Fitzgerald
2026-08-05  8:24 ` [PATCH 2/3] ASoC: cs35l45: " Peter Ujfalusi
2026-08-05 11:35   ` Richard Fitzgerald
2026-08-05  8:24 ` [PATCH 3/3] ASoC: cs4265: " Peter Ujfalusi
2026-08-05 11:31   ` Richard Fitzgerald
2026-08-05  8:40 ` [PATCH 0/3] ASoC: cs35l41/cs35l45/cs4265: sort the reg_defaults tables Pierre-Louis Bossart
2026-08-05  8:52   ` Péter Ujfalusi
2026-08-05  8:59     ` Pierre-Louis Bossart
2026-08-05  9:00   ` Richard Fitzgerald
2026-08-05  9:10     ` Péter Ujfalusi
2026-08-05  9:25       ` Charles Keepax
2026-08-05  9:38         ` Richard Fitzgerald
2026-08-05  9:52           ` Charles Keepax
2026-08-05  9:52           ` Péter Ujfalusi
2026-08-05  9:56             ` Richard Fitzgerald
2026-08-05  9:59               ` Péter Ujfalusi
2026-08-05 10:10                 ` Charles Keepax
2026-08-05 10:17                   ` Péter Ujfalusi
2026-08-05 10:36                     ` Richard Fitzgerald
2026-08-05 11:25                       ` Péter Ujfalusi
2026-08-05 11:31                         ` Charles Keepax
2026-08-05 11:38                           ` Richard Fitzgerald
2026-08-05 11:38                           ` Péter Ujfalusi
2026-08-05  9:25     ` Péter Ujfalusi
2026-08-05 10:38   ` Mark Brown
2026-08-05  8:59 ` Charles Keepax
2026-08-05 12:37 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox