From: Arnav Kapoor <kapoorarnav43@gmail.com>
To: Mark Brown <broonie@kernel.org>,
Liam Girdwood <lgirdwood@gmail.com>,
Peter Ujfalusi <peter.ujfalusi@linux.intel.com>,
Bard Liao <yung-chuan.liao@linux.intel.com>,
Daniel Baluta <daniel.baluta@nxp.com>
Cc: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>,
Kai Vehmanen <kai.vehmanen@linux.intel.com>,
Pierre-Louis Bossart <pierre-louis.bossart@linux.dev>,
Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
sound-open-firmware@alsa-project.org,
linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org,
Arnav Kapoor <kapoorarnav43@gmail.com>
Subject: [PATCH 0/4] ASoC: SOF: control: fix volume, switch and enum value handling
Date: Tue, 17 Nov 2026 16:29:46 +0530 [thread overview]
Message-ID: <20261117105953.188645-1-kapoorarnav43@gmail.com> (raw)
The ALSA mixer-test selftest fails on the SOF controls of a Lenovo V14
G2 ITL (Tiger Lake, sof-hda-generic-2ch.tplg). The HDA codec controls on
the same card pass. These patches fix what it found, plus one case it
doesn't catch:
1: a negative volume sets the control to its maximum, because
mixer_to_ipc() takes an unsigned int and clamps.
2: a switch accepts and stores values other than 0 and 1.
3: writing back the volume that was just read generates a change
event, because put() compares linear gains while get() reports
table steps, and the 0 dB default is not a table entry.
4: an enum accepts item indexes past its last item (IPC4 topology
only has one, "Dmic0 Capture TDFB angle set enum").
Patches 1, 2 and 4 are in the IPC-independent control.c; patch 3
touches the IPC3 and IPC4 volume_put() ops.
Tested on that laptop (7.0.14 kernel, snd-sof rebuilt with these
patches) with mixer-test:
- IPC3 (sof-tgl.ri, sof-hda-generic-2ch.tplg):
287 pass / 8 fail before, 295 pass / 0 fail after
- IPC4 (sof-ipc4/tgl, sof-ipc4-tplg/sof-hda-generic-2ch.tplg):
287 pass / 12 fail before, 296 pass / 3 fail after
The three remaining IPC4 failures are control names in the topology
(boolean controls named "... switch" instead of "... Switch").
I also wrote out-of-range values to every control with plain alsa-lib
calls (amixer clamps them before they reach the kernel). Before the
series every SOF volume and switch accepted them with IPC3; after it
every SOF volume, switch and enum rejects them with -EINVAL, with both
IPC3 and IPC4. pcm-test results are the same with and without the
patches.
Arnav Kapoor (4):
ASoC: SOF: control: reject out-of-range volume values
ASoC: SOF: control: reject invalid switch values
ASoC: SOF: report volume changes in mixer steps
ASoC: SOF: control: reject out-of-range enum values
sound/soc/sof/control.c | 26 ++++++++++++++++++++++++++
sound/soc/sof/ipc3-control.c | 4 +++-
sound/soc/sof/ipc4-control.c | 4 +++-
3 files changed, 32 insertions(+), 2 deletions(-)
base-commit: 7cd6b1fd8f9c1fcb1da1b761d502649f50b9800f
--
2.53.0
next reply other threads:[~2026-11-17 11:00 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-17 10:59 Arnav Kapoor [this message]
2026-11-17 10:59 ` [PATCH 1/4] ASoC: SOF: control: reject out-of-range volume values Arnav Kapoor
2026-11-17 10:59 ` [PATCH 2/4] ASoC: SOF: control: reject invalid switch values Arnav Kapoor
2026-11-17 10:59 ` [PATCH 3/4] ASoC: SOF: report volume changes in mixer steps Arnav Kapoor
2026-11-17 10:59 ` [PATCH 4/4] ASoC: SOF: control: reject out-of-range enum values Arnav Kapoor
2026-11-17 12:24 ` [PATCH 0/4] ASoC: SOF: control: fix volume, switch and enum value handling HyeongJun An
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261117105953.188645-1-kapoorarnav43@gmail.com \
--to=kapoorarnav43@gmail.com \
--cc=broonie@kernel.org \
--cc=daniel.baluta@nxp.com \
--cc=kai.vehmanen@linux.intel.com \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=perex@perex.cz \
--cc=peter.ujfalusi@linux.intel.com \
--cc=pierre-louis.bossart@linux.dev \
--cc=ranjani.sridharan@linux.intel.com \
--cc=sound-open-firmware@alsa-project.org \
--cc=tiwai@suse.com \
--cc=yung-chuan.liao@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®