diff options
author | Charles Keepax <ckeepax@opensource.cirrus.com> | 2025-03-18 17:14:53 +0000 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2025-03-19 12:48:04 +0000 |
commit | fd7442561cfe9516b37cdb1d229dc1f811dc86cc (patch) | |
tree | 177b6502fcd2645079905bba7dd72a33785d52cc /sound/soc/soc-ops.c | |
parent | 894a37c9de4b8a447ffa609d552e91ccb447c0a9 (diff) |
ASoC: ops: Remove snd_soc_get_volsw_range()
With the addition of the soc_mixer_reg_to_ctl() helper it is now very
clear that the only difference between snd_soc_get_volsw() and
snd_soc_get_volsw_range() is that the former supports double controls
with both values in the same register. As such we can combine both
functions.
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://patch.msgid.link/20250318171459.3203730-10-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/soc-ops.c')
-rw-r--r-- | sound/soc/soc-ops.c | 42 |
1 files changed, 3 insertions, 39 deletions
diff --git a/sound/soc/soc-ops.c b/sound/soc/soc-ops.c index 1b52ba12df8d..fbda8e21c5a6 100644 --- a/sound/soc/soc-ops.c +++ b/sound/soc/soc-ops.c @@ -248,12 +248,12 @@ int snd_soc_info_volsw_sx(struct snd_kcontrol *kcontrol, EXPORT_SYMBOL_GPL(snd_soc_info_volsw_sx); /** - * snd_soc_get_volsw - single mixer get callback + * snd_soc_get_volsw - single mixer get callback with range * @kcontrol: mixer control * @ucontrol: control element information * - * Callback to get the value of a single mixer control, or a double mixer - * control that spans 2 registers. + * Callback to get the value, within a range, of a single mixer control, or a + * double mixer control that spans 2 registers. * * Returns 0 for success. */ @@ -506,42 +506,6 @@ int snd_soc_put_volsw_range(struct snd_kcontrol *kcontrol, } EXPORT_SYMBOL_GPL(snd_soc_put_volsw_range); -/** - * snd_soc_get_volsw_range - single mixer get callback with range - * @kcontrol: mixer control - * @ucontrol: control element information - * - * Callback to get the value, within a range, of a single mixer control. - * - * Returns 0 for success. - */ -int snd_soc_get_volsw_range(struct snd_kcontrol *kcontrol, - struct snd_ctl_elem_value *ucontrol) -{ - struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); - struct soc_mixer_control *mc = - (struct soc_mixer_control *)kcontrol->private_value; - int max = mc->max - mc->min; - unsigned int mask = soc_mixer_mask(mc); - unsigned int reg_val; - int val; - - reg_val = snd_soc_component_read(component, mc->reg); - val = soc_mixer_reg_to_ctl(mc, reg_val, mask, mc->shift, max); - - ucontrol->value.integer.value[0] = val; - - if (snd_soc_volsw_is_stereo(mc)) { - reg_val = snd_soc_component_read(component, mc->rreg); - val = soc_mixer_reg_to_ctl(mc, reg_val, mask, mc->shift, max); - - ucontrol->value.integer.value[1] = val; - } - - return 0; -} -EXPORT_SYMBOL_GPL(snd_soc_get_volsw_range); - static int snd_soc_clip_to_platform_max(struct snd_kcontrol *kctl) { struct soc_mixer_control *mc = (struct soc_mixer_control *)kctl->private_value; |