ALSA: ASoC: Rename mask to max to reflect usage
Most of the ASoC controls refer to the maximum value that can be set for a control as mask but there is no actual requirement for all bits to be set at the highest possible value making the name mask misleading. Change the code to use max instead. Signed-off-by: Jon Smirl <jonsmirl@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
parent
4eaa9819dc
commit
f8ba0b7bfd
|
@ -88,25 +88,25 @@
|
|||
.put = snd_soc_put_volsw_s8, \
|
||||
.private_value = (unsigned long)&(struct soc_mixer_control) \
|
||||
{.reg = xreg, .min = xmin, .max = xmax} }
|
||||
#define SOC_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xmask, xtexts) \
|
||||
#define SOC_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xmax, xtexts) \
|
||||
{ .reg = xreg, .shift_l = xshift_l, .shift_r = xshift_r, \
|
||||
.mask = xmask, .texts = xtexts }
|
||||
#define SOC_ENUM_SINGLE(xreg, xshift, xmask, xtexts) \
|
||||
SOC_ENUM_DOUBLE(xreg, xshift, xshift, xmask, xtexts)
|
||||
#define SOC_ENUM_SINGLE_EXT(xmask, xtexts) \
|
||||
{ .mask = xmask, .texts = xtexts }
|
||||
.max = xmax, .texts = xtexts }
|
||||
#define SOC_ENUM_SINGLE(xreg, xshift, xmax, xtexts) \
|
||||
SOC_ENUM_DOUBLE(xreg, xshift, xshift, xmax, xtexts)
|
||||
#define SOC_ENUM_SINGLE_EXT(xmax, xtexts) \
|
||||
{ .max = xmax, .texts = xtexts }
|
||||
#define SOC_ENUM(xname, xenum) \
|
||||
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname,\
|
||||
.info = snd_soc_info_enum_double, \
|
||||
.get = snd_soc_get_enum_double, .put = snd_soc_put_enum_double, \
|
||||
.private_value = (unsigned long)&xenum }
|
||||
#define SOC_SINGLE_EXT(xname, xreg, xshift, xmask, xinvert,\
|
||||
#define SOC_SINGLE_EXT(xname, xreg, xshift, xmax, xinvert,\
|
||||
xhandler_get, xhandler_put) \
|
||||
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
|
||||
.info = snd_soc_info_volsw, \
|
||||
.get = xhandler_get, .put = xhandler_put, \
|
||||
.private_value = SOC_SINGLE_VALUE(xreg, xshift, xmask, xinvert) }
|
||||
#define SOC_SINGLE_EXT_TLV(xname, xreg, xshift, xmask, xinvert,\
|
||||
.private_value = SOC_SINGLE_VALUE(xreg, xshift, xmax, xinvert) }
|
||||
#define SOC_SINGLE_EXT_TLV(xname, xreg, xshift, xmax, xinvert,\
|
||||
xhandler_get, xhandler_put, tlv_array) \
|
||||
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
|
||||
.access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
|
||||
|
@ -114,7 +114,7 @@
|
|||
.tlv.p = (tlv_array), \
|
||||
.info = snd_soc_info_volsw, \
|
||||
.get = xhandler_get, .put = xhandler_put, \
|
||||
.private_value = SOC_SINGLE_VALUE(xreg, xshift, xmask, xinvert) }
|
||||
.private_value = SOC_SINGLE_VALUE(xreg, xshift, xmax, xinvert) }
|
||||
#define SOC_SINGLE_BOOL_EXT(xname, xdata, xhandler_get, xhandler_put) \
|
||||
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
|
||||
.info = snd_soc_info_bool_ext, \
|
||||
|
@ -536,7 +536,7 @@ struct soc_enum {
|
|||
unsigned short reg2;
|
||||
unsigned char shift_l;
|
||||
unsigned char shift_r;
|
||||
unsigned int mask;
|
||||
unsigned int max;
|
||||
const char **texts;
|
||||
void *dapm;
|
||||
};
|
||||
|
|
|
@ -1316,10 +1316,10 @@ int snd_soc_info_enum_double(struct snd_kcontrol *kcontrol,
|
|||
|
||||
uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
|
||||
uinfo->count = e->shift_l == e->shift_r ? 1 : 2;
|
||||
uinfo->value.enumerated.items = e->mask;
|
||||
uinfo->value.enumerated.items = e->max;
|
||||
|
||||
if (uinfo->value.enumerated.item > e->mask - 1)
|
||||
uinfo->value.enumerated.item = e->mask - 1;
|
||||
if (uinfo->value.enumerated.item > e->max - 1)
|
||||
uinfo->value.enumerated.item = e->max - 1;
|
||||
strcpy(uinfo->value.enumerated.name,
|
||||
e->texts[uinfo->value.enumerated.item]);
|
||||
return 0;
|
||||
|
@ -1342,7 +1342,7 @@ int snd_soc_get_enum_double(struct snd_kcontrol *kcontrol,
|
|||
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
|
||||
unsigned short val, bitmask;
|
||||
|
||||
for (bitmask = 1; bitmask < e->mask; bitmask <<= 1)
|
||||
for (bitmask = 1; bitmask < e->max; bitmask <<= 1)
|
||||
;
|
||||
val = snd_soc_read(codec, e->reg);
|
||||
ucontrol->value.enumerated.item[0]
|
||||
|
@ -1372,14 +1372,14 @@ int snd_soc_put_enum_double(struct snd_kcontrol *kcontrol,
|
|||
unsigned short val;
|
||||
unsigned short mask, bitmask;
|
||||
|
||||
for (bitmask = 1; bitmask < e->mask; bitmask <<= 1)
|
||||
for (bitmask = 1; bitmask < e->max; bitmask <<= 1)
|
||||
;
|
||||
if (ucontrol->value.enumerated.item[0] > e->mask - 1)
|
||||
if (ucontrol->value.enumerated.item[0] > e->max - 1)
|
||||
return -EINVAL;
|
||||
val = ucontrol->value.enumerated.item[0] << e->shift_l;
|
||||
mask = (bitmask - 1) << e->shift_l;
|
||||
if (e->shift_l != e->shift_r) {
|
||||
if (ucontrol->value.enumerated.item[1] > e->mask - 1)
|
||||
if (ucontrol->value.enumerated.item[1] > e->max - 1)
|
||||
return -EINVAL;
|
||||
val |= ucontrol->value.enumerated.item[1] << e->shift_r;
|
||||
mask |= (bitmask - 1) << e->shift_r;
|
||||
|
@ -1406,10 +1406,10 @@ int snd_soc_info_enum_ext(struct snd_kcontrol *kcontrol,
|
|||
|
||||
uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
|
||||
uinfo->count = 1;
|
||||
uinfo->value.enumerated.items = e->mask;
|
||||
uinfo->value.enumerated.items = e->max;
|
||||
|
||||
if (uinfo->value.enumerated.item > e->mask - 1)
|
||||
uinfo->value.enumerated.item = e->mask - 1;
|
||||
if (uinfo->value.enumerated.item > e->max - 1)
|
||||
uinfo->value.enumerated.item = e->max - 1;
|
||||
strcpy(uinfo->value.enumerated.name,
|
||||
e->texts[uinfo->value.enumerated.item]);
|
||||
return 0;
|
||||
|
|
|
@ -125,13 +125,13 @@ static void dapm_set_path_status(struct snd_soc_dapm_widget *w,
|
|||
struct soc_enum *e = (struct soc_enum *)w->kcontrols[i].private_value;
|
||||
int val, item, bitmask;
|
||||
|
||||
for (bitmask = 1; bitmask < e->mask; bitmask <<= 1)
|
||||
for (bitmask = 1; bitmask < e->max; bitmask <<= 1)
|
||||
;
|
||||
val = snd_soc_read(w->codec, e->reg);
|
||||
item = (val >> e->shift_l) & (bitmask - 1);
|
||||
|
||||
p->connect = 0;
|
||||
for (i = 0; i < e->mask; i++) {
|
||||
for (i = 0; i < e->max; i++) {
|
||||
if (!(strcmp(p->name, e->texts[i])) && item == i)
|
||||
p->connect = 1;
|
||||
}
|
||||
|
@ -168,7 +168,7 @@ static int dapm_connect_mux(struct snd_soc_codec *codec,
|
|||
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < e->mask; i++) {
|
||||
for (i = 0; i < e->max; i++) {
|
||||
if (!(strcmp(control_name, e->texts[i]))) {
|
||||
list_add(&path->list, &codec->dapm_paths);
|
||||
list_add(&path->list_sink, &dest->sources);
|
||||
|
@ -1258,7 +1258,7 @@ int snd_soc_dapm_get_enum_double(struct snd_kcontrol *kcontrol,
|
|||
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
|
||||
unsigned short val, bitmask;
|
||||
|
||||
for (bitmask = 1; bitmask < e->mask; bitmask <<= 1)
|
||||
for (bitmask = 1; bitmask < e->max; bitmask <<= 1)
|
||||
;
|
||||
val = snd_soc_read(widget->codec, e->reg);
|
||||
ucontrol->value.enumerated.item[0] = (val >> e->shift_l) & (bitmask - 1);
|
||||
|
@ -1288,15 +1288,15 @@ int snd_soc_dapm_put_enum_double(struct snd_kcontrol *kcontrol,
|
|||
unsigned short mask, bitmask;
|
||||
int ret = 0;
|
||||
|
||||
for (bitmask = 1; bitmask < e->mask; bitmask <<= 1)
|
||||
for (bitmask = 1; bitmask < e->max; bitmask <<= 1)
|
||||
;
|
||||
if (ucontrol->value.enumerated.item[0] > e->mask - 1)
|
||||
if (ucontrol->value.enumerated.item[0] > e->max - 1)
|
||||
return -EINVAL;
|
||||
mux = ucontrol->value.enumerated.item[0];
|
||||
val = mux << e->shift_l;
|
||||
mask = (bitmask - 1) << e->shift_l;
|
||||
if (e->shift_l != e->shift_r) {
|
||||
if (ucontrol->value.enumerated.item[1] > e->mask - 1)
|
||||
if (ucontrol->value.enumerated.item[1] > e->max - 1)
|
||||
return -EINVAL;
|
||||
val |= ucontrol->value.enumerated.item[1] << e->shift_r;
|
||||
mask |= (bitmask - 1) << e->shift_r;
|
||||
|
|
Loading…
Reference in New Issue