Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5c0b8773 authored by Sudheer Papothi's avatar Sudheer Papothi Committed by Meng Wang
Browse files

ASoC: Update the Max value of integer controls



When control value is queried, framework is returning the
min value as zero even if min is negative.
This change will make sure that frame work will update
the max value in cases where min is negative.

Change-Id: I4e5c70a659ded61c4094f1622611f82994df86b0
Signed-off-by: default avatarGopikrishnaiah Anandan <agopik@codeaurora.org>
Signed-off-by: default avatarBanajit Goswami <bgoswami@codeaurora.org>
Signed-off-by: default avatarSudheer Papothi <spapothi@codeaurora.org>
Signed-off-by: default avatarMeng Wang <mwang@codeaurora.org>
parent f9c0b494
Loading
Loading
Loading
Loading
+6 −7
Original line number Diff line number Diff line
@@ -196,7 +196,10 @@ int snd_soc_info_volsw(struct snd_kcontrol *kcontrol,

	uinfo->count = snd_soc_volsw_is_stereo(mc) ? 2 : 1;
	uinfo->value.integer.min = 0;
	if (uinfo->type == SNDRV_CTL_ELEM_TYPE_INTEGER)
		uinfo->value.integer.max = platform_max - mc->min;
	else
		uinfo->value.integer.max = platform_max;
	return 0;
}
EXPORT_SYMBOL_GPL(snd_soc_info_volsw);
@@ -216,15 +219,11 @@ EXPORT_SYMBOL_GPL(snd_soc_info_volsw);
int snd_soc_info_volsw_sx(struct snd_kcontrol *kcontrol,
			  struct snd_ctl_elem_info *uinfo)
{
	struct soc_mixer_control *mc =
		(struct soc_mixer_control *)kcontrol->private_value;

	snd_soc_info_volsw(kcontrol, uinfo);
	/* Max represents the number of levels in an SX control not the
	 * maximum value, so add the minimum value back on
	 * maximum value, uinfo->value.integer.max is set to number of levels
	 * in snd_soc_info_volsw. No further adjustment is necessary.
	 */
	uinfo->value.integer.max += mc->min;

	return 0;
}
EXPORT_SYMBOL_GPL(snd_soc_info_volsw_sx);