Re: [PATCH 15/24] ASoC: codecs: cs42l43: Use guard() and PM runtime scope helpers
From: Charles Keepax
Date: Mon Jul 06 2026 - 05:23:51 EST
On Sat, Jun 27, 2026 at 04:50:31PM +0700, Bui Duc Phuc wrote:
> On Fri, Jun 26, 2026 at 7:57 PM Bui Duc Phuc <phucduc.bui@xxxxxxxxx> wrote:
> I'll factor the duplicated code into a helper and use it from both
> paths in v2, for example:
>
> static void cs42l43_apply_accdet_config(struct cs42l43_codec *priv,
> unsigned int autocontrol, unsigned int pdncntl)
> {
> struct cs42l43 *cs42l43 = priv->core;
>
> regmap_update_bits(cs42l43->regmap,
> CS42L43_HS_BIAS_SENSE_AND_CLAMP_AUTOCONTROL,
> CS42L43_JACKDET_MODE_MASK |
> CS42L43_S0_AUTO_ADCMUTE_DISABLE_MASK |
> CS42L43_HSBIAS_SENSE_TRIP_MASK, autocontrol);
> regmap_update_bits(cs42l43->regmap, CS42L43_PDNCNTL,
> CS42L43_RING_SENSE_EN_MASK, pdncntl);
>
> dev_dbg(priv->dev, "Successfully configured accessory detect\n");
> }
>
> Then both paths can simply call cs42l43_apply_accdet_config(),
> avoiding the duplicated code.
> Does that address your concern?
Yeah I guess that is probably the best way to go.
Thanks,
Charles