Re: [PATCH 3/4] ASoC: SOF: report volume changes in mixer steps

From: Mark Brown

Date: Tue Nov 17 2026 - 18:17:51 EST


> The IPC3 and IPC4 volume_put() ops decide whether the control changed by
> comparing the new linear gain from the volume table with the stored one.
> The stored gain does not always come from the table: topology loading
> initialises it to 0 dB (VOL_ZERO_DB or SOF_IPC4_VOL_ZERO_DB), and
> volume_get() reports that as the first table entry at or above it, which
> is usually not exactly 0 dB. Writing back the value that was just read
> then changes the stored gain, so put() returns true and user space gets
> a change notification although the control value is the same.

> @@ -180,10 +180,12 @@ static bool sof_ipc3_volume_put(struct snd_sof_control *scontrol,
>
> /* update each channel */
> for (i = 0; i < channels; i++) {
> + u32 old = ipc_to_mixer(cdata->chanv[i].value,
> + scontrol->volume_table, scontrol->max + 1);
> u32 value = mixer_to_ipc(ucontrol->value.integer.value[i],
> scontrol->volume_table, scontrol->max + 1);
>
> - change = change || (value != cdata->chanv[i].value);
> + change = change || (ucontrol->value.integer.value[i] != old);

You need to compare ipc_to_mixer(), there can be duplicated steps.

--
Mark Brown <broonie@xxxxxxxxxx>