Re: [PATCH] ASoC: qcom: audioreach: apply volume changes to a running graph
From: Srinivas Kandagatla
Date: Sun Nov 15 2026 - 05:46:15 EST
On 11/11/26 1:49 PM, Marc Herrero via B4 Relay wrote:
> From: Marc Herrero <marcht@xxxxxxxxx>
>
> audioreach_put_vol_ctrl_audio_mixer() only stores the new gain in the
> module. The gain reaches the DSP from audioreach_pga_event() on
> SND_SOC_DAPM_POST_PMU, that is when a stream starts, so changing the
> "<stream> Playback Volume" control while playing has no effect until the
> next stream.
>
> On QCS6490 (Radxa Dragon Q6A) shairport-sync uses this control as its
> hardware volume: the volume set when an AirPlay session starts is
> applied, but every later change from the phone is ignored.
>
> Send the gain to the DSP right away when the widget is powered, and
> report no change when the value is the same.
>
> Fixes: 36ad9bf1d93d ("ASoC: qdsp6: audioreach: add topology support")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Marc Herrero <marcht@xxxxxxxxx>
> ---
> Found on the Radxa Dragon Q6A together with the two fixes in
> "[PATCH 0/2] ASoC: qcom: audioreach: fix S24_LE playback and route mixer
> disconnects", sent earlier today. This one is independent of them.
>
> Tested on 7.2.9: with the patch, moving the AirPlay volume while
> playing changes the output immediately; without it nothing changes
> until the next stream. Builds on asoc/for-next.
> ---
> sound/soc/qcom/qdsp6/topology.c | 13 ++++++++++++-
> 1 file changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/sound/soc/qcom/qdsp6/topology.c b/sound/soc/qcom/qdsp6/topology.c
> index 612d8f03e6e9..5b3378fd29fc 100644
> --- a/sound/soc/qcom/qdsp6/topology.c
> +++ b/sound/soc/qcom/qdsp6/topology.c
> @@ -1323,8 +1323,19 @@ static int audioreach_put_vol_ctrl_audio_mixer(struct snd_kcontrol *kcontrol,
> {
> struct snd_soc_dapm_widget *dw = snd_soc_dapm_kcontrol_to_widget(kcontrol);
> struct audioreach_module *mod = dw->dobj.private;
> + long gain = ucontrol->value.integer.value[0];
>
> - mod->gain = ucontrol->value.integer.value[0];
We should make sure that the graph is started before applying this, if
not you would get dsp errors.
--srini
> + if (mod->gain == gain)
> + return 0;
> +
> + mod->gain = gain;
> +
> + /* The PGA event only applies the gain when the widget powers up */
> + if (dw->power) {
> + struct snd_soc_component *c = snd_soc_dapm_to_component(dw->dapm);
> +
> + audioreach_gain_set_vol_ctrl(dev_get_drvdata(c->dev), mod, gain);
> + }
>
> return 1;
> }
>
> ---
> base-commit: cde5523c75f1320a55ac1d55a717ccbb566557f0
> change-id: 20261111-q6apm-vol-live-d6bb1dbec7c9
>
> Best regards,