Re: [RFC PATCH 8/8] ASoC: codecs: add Qualcomm Tambora (WCD9378) SDCA codec
From: Charles Keepax
Date: Wed Sep 02 2026 - 10:52:01 EST
On Wed, Sep 02, 2026 at 01:26:03PM +0100, Srinivas Kandagatla wrote:
> >> + /*
> >> + * Unmute FU42 CH1/CH2 and stage 0 dB volume via the _CN (NEXT) alias
> >> + * so all four staged writes activate together on the SCP_COMMIT
> >> + * below. Writes go to the vendor slave regmap because FU42
> >> + * addresses are outside the SDCA class regmap's routing.
> >> + */
> >> + ret = regmap_write(core->dev_regmap, WCD9378_FU42_MUTE_CH1_ADDR,
> >> + WCD9378_FU42_MUTE_UNMUTE);
> >> + if (ret)
> >> + dev_err(&slave->dev, "FU42 MUTE_CH1: %d\n", ret);
> >> +
> >> + ret = regmap_write(core->dev_regmap, WCD9378_FU42_MUTE_CH2_ADDR,
> >> + WCD9378_FU42_MUTE_UNMUTE);
> >> + if (ret)
> >> + dev_err(&slave->dev, "FU42 MUTE_CH2: %d\n", ret);
> >> +
> >> + ret = regmap_write(core->dev_regmap, WCD9378_FU42_CH_VOL_CH1_MSB_ADDR,
> >> + WCD9378_FU42_CH_VOL_UNITY_BYTE);
> >> + if (ret)
> >> + dev_err(&slave->dev, "FU42 CH1_MSB: %d\n", ret);
> >> + ret = regmap_write(core->dev_regmap, WCD9378_FU42_CH_VOL_CH1_LSB_ADDR,
> >> + WCD9378_FU42_CH_VOL_UNITY_BYTE);
> >> + if (ret)
> >> + dev_err(&slave->dev, "FU42 CH1_LSB: %d\n", ret);
> >> + ret = regmap_write(core->dev_regmap, WCD9378_FU42_CH_VOL_CH2_MSB_ADDR,
> >> + WCD9378_FU42_CH_VOL_UNITY_BYTE);
> >> + if (ret)
> >> + dev_err(&slave->dev, "FU42 CH2_MSB: %d\n", ret);
> >> + ret = regmap_write(core->dev_regmap, WCD9378_FU42_CH_VOL_CH2_LSB_ADDR,
> >> + WCD9378_FU42_CH_VOL_UNITY_BYTE);
> >> + if (ret)
> >> + dev_err(&slave->dev, "FU42 CH2_LSB: %d\n", ret);
> >
> > These should all really be part of the function regmap they are
> > function controls. Also would mean you have the MBQ so you don't
> > need to do two writes per register. I assume, with the commit
> > group stuff, these are writing the next value rather than the
> > current? But nothing here updates the functions regmap for the
> > new values, is it ok that those two get out of sync? Or do we
> > not define these controls at the function level?
>
> These are now part of the core in v2 which exposes them as proper mixer
> controls.
>
> These work fine as long as we apply the mixers after the PDE transition.
> Which is not what user is expecting.
>
> This behavior is because the codec seems to reset some registers to
> default when we transition from PS3->PS0 state, volume, mute and micbias
> are going back to default values, leaving the stream in mute.
>
> I can try to re-apply them in the codec callback hook, but in general
> how should we handle this in sdca core?
I think mostly how you are approaching it is fine, my concern
really was just the use of the device regmap rather than function
regmap here. The controls are clearly function level controls.
Thanks,
Charles