Skip to content

Commit 502a668

Browse files
charleskeepaxbroonie
authored andcommitted
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@opensource.cirrus.com> Link: https://patch.msgid.link/20250319175123.3835849-4-ckeepax@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 94dfe71 commit 502a668

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

sound/soc/soc-ops.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,6 @@ static int soc_info_volsw(struct snd_kcontrol *kcontrol,
172172
struct snd_ctl_elem_info *uinfo,
173173
struct soc_mixer_control *mc, int max)
174174
{
175-
if (mc->platform_max && mc->platform_max < max)
176-
max = mc->platform_max;
177-
178175
uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
179176

180177
if (max == 1) {
@@ -185,6 +182,9 @@ static int soc_info_volsw(struct snd_kcontrol *kcontrol,
185182
uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
186183
}
187184

185+
if (mc->platform_max && mc->platform_max < max)
186+
max = mc->platform_max;
187+
188188
uinfo->count = snd_soc_volsw_is_stereo(mc) ? 2 : 1;
189189
uinfo->value.integer.min = 0;
190190
uinfo->value.integer.max = max;

0 commit comments

Comments
 (0)