[PATCH] ASoC: use regmap_assign_bits() for conditional set/clear

Mark Brown broonie at kernel.org
Thu Sep 24 05:04:16 PDT 2026


On Thu, Sep 24, 2026 at 10:47:02AM +0100, Charles Keepax wrote:
> On Thu, Sep 24, 2026 at 04:34:12PM +0800, Peng Fan (OSS) wrote:

> > Replace if/else blocks using regmap_set_bits()/regmap_clear_bits() with
> > the simpler regmap_assign_bits() calls in the cs35l45 codec and the
> > mediatek mt8188 ADDA and DMIC DAI drivers.

> > -	if ((bool)ucontrol->value.integer.value[0])
> > -		regmap_set_bits(cs35l45->regmap, CS35L45_BLOCK_ENABLES2, CS35L45_SYNC_EN_MASK);
> > -	else
> > -		regmap_clear_bits(cs35l45->regmap, CS35L45_BLOCK_ENABLES2, CS35L45_SYNC_EN_MASK);

> > +	regmap_assign_bits(cs35l45->regmap, CS35L45_BLOCK_ENABLES2, CS35L45_SYNC_EN_MASK,
> > +			   (bool)ucontrol->value.integer.value[0]);

> This doesn't work value will be bit(0) but SYNC_EN is bit(8).

No, it's _assign_bits() not _update_bits() so it'll set the bits
specified in the third argument if the fourth argument is true.

> Also would be better to split this patch into two, one for the
> mediatek stuff, one for the cirrus stuff.

Yes.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20260924/89786912/attachment.sig>


More information about the linux-arm-kernel mailing list