ASoC: ops: Add control to register value helper
authorCharles Keepax <ckeepax@opensource.cirrus.com>
Tue, 18 Mar 2025 17:14:51 +0000 (17:14 +0000)
committerMark Brown <broonie@kernel.org>
Wed, 19 Mar 2025 12:48:03 +0000 (12:48 +0000)
commited336066202c02f0b0e47d0cf08fd8f40a42351f
treef18c6f3cedce9ec37c23506590921ce7a0b75388
parent1522aacd0114069b7f01f047b9e5b159399af295
ASoC: ops: Add control to register value helper

Add a helper function to convert from control values to register values
that can replace a lot of the duplicated code in the various put
handlers.

This also fixes a small issue in snd_soc_put_volsw where the value is
converted to a control value before doing the invert, but the invert
is done against the register max which will result in incorrect values
for inverted controls with a non-zero minimum.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://patch.msgid.link/20250318171459.3203730-8-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/soc-ops.c