[PATCH] ASoC: use regmap_assign_bits() for conditional set/clear
Charles Keepax
ckeepax at opensource.cirrus.com
Thu Sep 24 02:47:02 PDT 2026
On Thu, Sep 24, 2026 at 04:34:12PM +0800, Peng Fan (OSS) wrote:
> From: Peng Fan <peng.fan at nxp.com>
>
> 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.
>
> Signed-off-by: Peng Fan <peng.fan at nxp.com>
> ---
> sound/soc/codecs/cs35l45.c | 6 ++----
> sound/soc/mediatek/mt8188/mt8188-dai-adda.c | 5 +----
> sound/soc/mediatek/mt8188/mt8188-dai-dmic.c | 10 ++--------
> 3 files changed, 5 insertions(+), 16 deletions(-)
>
> diff --git a/sound/soc/codecs/cs35l45.c b/sound/soc/codecs/cs35l45.c
> index 0ab76824f00f1..9eef7c8b1837e 100644
> --- a/sound/soc/codecs/cs35l45.c
> +++ b/sound/soc/codecs/cs35l45.c
> @@ -224,10 +224,8 @@ static int cs35l45_sync_en_put(struct snd_kcontrol *kcontrol,
> return 0;
> }
>
> - 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).
Also would be better to split this patch into two, one for the
mediatek stuff, one for the cirrus stuff.
Thanks,
Charles
More information about the linux-arm-kernel
mailing list