Re: [PATCH] ASoC: core: Warn about controls whose register fields overlap

From: Charles Keepax

Date: Mon Oct 19 2026 - 05:26:47 EST


On Mon, Oct 19, 2026 at 02:13:21PM +0900, HyeongJun An wrote:
> A control that writes part of another control's register field also
> changes that control. Usually the bits it was meant to own are then out
> of reach. 26 of these were fixed in codec drivers this cycle. Most
> dated back to the first version of the driver.
>
> So check each control as it is added. If it shares a register with a
> control of the same component, and the two fields overlap but are not
> the same, print a warning. Identical fields are not reported, as some
> drivers expose one field under two names.
>
> Only controls with the volsw, volsw_sx and enum_double put callbacks
> are checked. For other controls the bits written are not known.
>
> Add a KUnit test for the field calculation.
>
> Suggested-by: Mark Brown <broonie@xxxxxxxxxx>
> Link: https://lore.kernel.org/all/0fefbfe1-021b-46b2-8945-15956e75e37f@xxxxxxxxxxxxx/
> Assisted-by: Claude:claude-opus-5-5
> Signed-off-by: HyeongJun An <sammiee5311@xxxxxxxxx>
> ---
>
> Notes:
> On for-7.4 an allmodconfig build gives four warnings in three drivers:
>
> cs42l56: ADC Mute Switch with ADCA Invert and ADCB Invert

Looking at this one I think it makes sense to drop the control
here. As the control doesn't currently point to the right bits we
know no one is successfully using it, and really it is simplest
to have either automatic muting or manual muting not both.

I can do a patch to fix up if you like? Or happy for you to do so
if you prefer?

Thanks,
Charles