[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250318171459.3203730-16-ckeepax@opensource.cirrus.com>
Date: Tue, 18 Mar 2025 17:14:59 +0000
From: Charles Keepax <ckeepax@...nsource.cirrus.com>
To: <broonie@...nel.org>
CC: <lgirdwood@...il.com>, <shenghao-ding@...com>, <kevin-lu@...com>,
<baojun.xu@...com>, <linux-sound@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <patches@...nsource.cirrus.com>
Subject: [PATCH 15/15] ASoC: ops: Apply platform_max after deciding control type
It doesn't really make sense for the type of a control to change based
on the platform_max field. platform_max allows a specific system to
limit values of a control for safety but it seems reasonable the
control type should remain the same between different systems, even
if it is restricted down to just two values. Move the application of
platform_max to after control type determination in soc_info_volsw().
Signed-off-by: Charles Keepax <ckeepax@...nsource.cirrus.com>
---
sound/soc/soc-ops.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/sound/soc/soc-ops.c b/sound/soc/soc-ops.c
index 3ac5b3a62c812..8d4dd11c9aef1 100644
--- a/sound/soc/soc-ops.c
+++ b/sound/soc/soc-ops.c
@@ -172,9 +172,6 @@ static int soc_info_volsw(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_info *uinfo,
struct soc_mixer_control *mc, int max)
{
- if (mc->platform_max && mc->platform_max < max)
- max = mc->platform_max;
-
uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
if (max == 1) {
@@ -185,6 +182,9 @@ static int soc_info_volsw(struct snd_kcontrol *kcontrol,
uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
}
+ if (mc->platform_max && mc->platform_max < max)
+ max = mc->platform_max;
+
uinfo->count = snd_soc_volsw_is_stereo(mc) ? 2 : 1;
uinfo->value.integer.min = 0;
uinfo->value.integer.max = max;
--
2.39.5
Powered by blists - more mailing lists