aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJon Smirl <jonsmirl@gmail.com>2008-07-29 06:42:27 -0400
committerJaroslav Kysela <perex@perex.cz>2008-07-29 15:32:18 -0400
commitf8ba0b7bfd06a2a5b3c49ff8d71cad31f57b0d51 (patch)
tree0e3d5fde54f21465665e54276325336be73fc718
parent4eaa9819dc08d7bfd1065ce530e31b18a119dcaf (diff)
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>
-rw-r--r--include/sound/soc.h22
-rw-r--r--sound/soc/soc-core.c20
-rw-r--r--sound/soc/soc-dapm.c14
3 files changed, 28 insertions, 28 deletions
diff --git a/include/sound/soc.h b/include/sound/soc.h
index e647a34c8091..5ca231f080a0 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -88,25 +88,25 @@
88 .put = snd_soc_put_volsw_s8, \ 88 .put = snd_soc_put_volsw_s8, \
89 .private_value = (unsigned long)&(struct soc_mixer_control) \ 89 .private_value = (unsigned long)&(struct soc_mixer_control) \
90 {.reg = xreg, .min = xmin, .max = xmax} } 90 {.reg = xreg, .min = xmin, .max = xmax} }
91#define SOC_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xmask, xtexts) \ 91#define SOC_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xmax, xtexts) \
92{ .reg = xreg, .shift_l = xshift_l, .shift_r = xshift_r, \ 92{ .reg = xreg, .shift_l = xshift_l, .shift_r = xshift_r, \
93 .mask = xmask, .texts = xtexts } 93 .max = xmax, .texts = xtexts }
94#define SOC_ENUM_SINGLE(xreg, xshift, xmask, xtexts) \ 94#define SOC_ENUM_SINGLE(xreg, xshift, xmax, xtexts) \
95 SOC_ENUM_DOUBLE(xreg, xshift, xshift, xmask, xtexts) 95 SOC_ENUM_DOUBLE(xreg, xshift, xshift, xmax, xtexts)
96#define SOC_ENUM_SINGLE_EXT(xmask, xtexts) \ 96#define SOC_ENUM_SINGLE_EXT(xmax, xtexts) \
97{ .mask = xmask, .texts = xtexts } 97{ .max = xmax, .texts = xtexts }
98#define SOC_ENUM(xname, xenum) \ 98#define SOC_ENUM(xname, xenum) \
99{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname,\ 99{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname,\
100 .info = snd_soc_info_enum_double, \ 100 .info = snd_soc_info_enum_double, \
101 .get = snd_soc_get_enum_double, .put = snd_soc_put_enum_double, \ 101 .get = snd_soc_get_enum_double, .put = snd_soc_put_enum_double, \
102 .private_value = (unsigned long)&xenum } 102 .private_value = (unsigned long)&xenum }
103#define SOC_SINGLE_EXT(xname, xreg, xshift, xmask, xinvert,\ 103#define SOC_SINGLE_EXT(xname, xreg, xshift, xmax, xinvert,\
104 xhandler_get, xhandler_put) \ 104 xhandler_get, xhandler_put) \
105{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ 105{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
106 .info = snd_soc_info_volsw, \ 106 .info = snd_soc_info_volsw, \
107 .get = xhandler_get, .put = xhandler_put, \ 107 .get = xhandler_get, .put = xhandler_put, \
108 .private_value = SOC_SINGLE_VALUE(xreg, xshift, xmask, xinvert) } 108 .private_value = SOC_SINGLE_VALUE(xreg, xshift, xmax, xinvert) }
109#define SOC_SINGLE_EXT_TLV(xname, xreg, xshift, xmask, xinvert,\ 109#define SOC_SINGLE_EXT_TLV(xname, xreg, xshift, xmax, xinvert,\
110 xhandler_get, xhandler_put, tlv_array) \ 110 xhandler_get, xhandler_put, tlv_array) \
111{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ 111{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
112 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\ 112 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
@@ -114,7 +114,7 @@
114 .tlv.p = (tlv_array), \ 114 .tlv.p = (tlv_array), \
115 .info = snd_soc_info_volsw, \ 115 .info = snd_soc_info_volsw, \
116 .get = xhandler_get, .put = xhandler_put, \ 116 .get = xhandler_get, .put = xhandler_put, \
117 .private_value = SOC_SINGLE_VALUE(xreg, xshift, xmask, xinvert) } 117 .private_value = SOC_SINGLE_VALUE(xreg, xshift, xmax, xinvert) }
118#define SOC_SINGLE_BOOL_EXT(xname, xdata, xhandler_get, xhandler_put) \ 118#define SOC_SINGLE_BOOL_EXT(xname, xdata, xhandler_get, xhandler_put) \
119{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ 119{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
120 .info = snd_soc_info_bool_ext, \ 120 .info = snd_soc_info_bool_ext, \
@@ -536,7 +536,7 @@ struct soc_enum {
536 unsigned short reg2; 536 unsigned short reg2;
537 unsigned char shift_l; 537 unsigned char shift_l;
538 unsigned char shift_r; 538 unsigned char shift_r;
539 unsigned int mask; 539 unsigned int max;
540 const char **texts; 540 const char **texts;
541 void *dapm; 541 void *dapm;
542}; 542};
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 4b94f1f6ee27..11a881caba76 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1316,10 +1316,10 @@ int snd_soc_info_enum_double(struct snd_kcontrol *kcontrol,
1316 1316
1317 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; 1317 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
1318 uinfo->count = e->shift_l == e->shift_r ? 1 : 2; 1318 uinfo->count = e->shift_l == e->shift_r ? 1 : 2;
1319 uinfo->value.enumerated.items = e->mask; 1319 uinfo->value.enumerated.items = e->max;
1320 1320
1321 if (uinfo->value.enumerated.item > e->mask - 1) 1321 if (uinfo->value.enumerated.item > e->max - 1)
1322 uinfo->value.enumerated.item = e->mask - 1; 1322 uinfo->value.enumerated.item = e->max - 1;
1323 strcpy(uinfo->value.enumerated.name, 1323 strcpy(uinfo->value.enumerated.name,
1324 e->texts[uinfo->value.enumerated.item]); 1324 e->texts[uinfo->value.enumerated.item]);
1325 return 0; 1325 return 0;
@@ -1342,7 +1342,7 @@ int snd_soc_get_enum_double(struct snd_kcontrol *kcontrol,
1342 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; 1342 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
1343 unsigned short val, bitmask; 1343 unsigned short val, bitmask;
1344 1344
1345 for (bitmask = 1; bitmask < e->mask; bitmask <<= 1) 1345 for (bitmask = 1; bitmask < e->max; bitmask <<= 1)
1346 ; 1346 ;
1347 val = snd_soc_read(codec, e->reg); 1347 val = snd_soc_read(codec, e->reg);
1348 ucontrol->value.enumerated.item[0] 1348 ucontrol->value.enumerated.item[0]
@@ -1372,14 +1372,14 @@ int snd_soc_put_enum_double(struct snd_kcontrol *kcontrol,
1372 unsigned short val; 1372 unsigned short val;
1373 unsigned short mask, bitmask; 1373 unsigned short mask, bitmask;
1374 1374
1375 for (bitmask = 1; bitmask < e->mask; bitmask <<= 1) 1375 for (bitmask = 1; bitmask < e->max; bitmask <<= 1)
1376 ; 1376 ;
1377 if (ucontrol->value.enumerated.item[0] > e->mask - 1) 1377 if (ucontrol->value.enumerated.item[0] > e->max - 1)
1378 return -EINVAL; 1378 return -EINVAL;
1379 val = ucontrol->value.enumerated.item[0] << e->shift_l; 1379 val = ucontrol->value.enumerated.item[0] << e->shift_l;
1380 mask = (bitmask - 1) << e->shift_l; 1380 mask = (bitmask - 1) << e->shift_l;
1381 if (e->shift_l != e->shift_r) { 1381 if (e->shift_l != e->shift_r) {
1382 if (ucontrol->value.enumerated.item[1] > e->mask - 1) 1382 if (ucontrol->value.enumerated.item[1] > e->max - 1)
1383 return -EINVAL; 1383 return -EINVAL;
1384 val |= ucontrol->value.enumerated.item[1] << e->shift_r; 1384 val |= ucontrol->value.enumerated.item[1] << e->shift_r;
1385 mask |= (bitmask - 1) << e->shift_r; 1385 mask |= (bitmask - 1) << e->shift_r;
@@ -1406,10 +1406,10 @@ int snd_soc_info_enum_ext(struct snd_kcontrol *kcontrol,
1406 1406
1407 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; 1407 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
1408 uinfo->count = 1; 1408 uinfo->count = 1;
1409 uinfo->value.enumerated.items = e->mask; 1409 uinfo->value.enumerated.items = e->max;
1410 1410
1411 if (uinfo->value.enumerated.item > e->mask - 1) 1411 if (uinfo->value.enumerated.item > e->max - 1)
1412 uinfo->value.enumerated.item = e->mask - 1; 1412 uinfo->value.enumerated.item = e->max - 1;
1413 strcpy(uinfo->value.enumerated.name, 1413 strcpy(uinfo->value.enumerated.name,
1414 e->texts[uinfo->value.enumerated.item]); 1414 e->texts[uinfo->value.enumerated.item]);
1415 return 0; 1415 return 0;
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index bbdca0dacba6..f08be8a329e9 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -125,13 +125,13 @@ static void dapm_set_path_status(struct snd_soc_dapm_widget *w,
125 struct soc_enum *e = (struct soc_enum *)w->kcontrols[i].private_value; 125 struct soc_enum *e = (struct soc_enum *)w->kcontrols[i].private_value;
126 int val, item, bitmask; 126 int val, item, bitmask;
127 127
128 for (bitmask = 1; bitmask < e->mask; bitmask <<= 1) 128 for (bitmask = 1; bitmask < e->max; bitmask <<= 1)
129 ; 129 ;
130 val = snd_soc_read(w->codec, e->reg); 130 val = snd_soc_read(w->codec, e->reg);
131 item = (val >> e->shift_l) & (bitmask - 1); 131 item = (val >> e->shift_l) & (bitmask - 1);
132 132
133 p->connect = 0; 133 p->connect = 0;
134 for (i = 0; i < e->mask; i++) { 134 for (i = 0; i < e->max; i++) {
135 if (!(strcmp(p->name, e->texts[i])) && item == i) 135 if (!(strcmp(p->name, e->texts[i])) && item == i)
136 p->connect = 1; 136 p->connect = 1;
137 } 137 }
@@ -168,7 +168,7 @@ static int dapm_connect_mux(struct snd_soc_codec *codec,
168 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; 168 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
169 int i; 169 int i;
170 170
171 for (i = 0; i < e->mask; i++) { 171 for (i = 0; i < e->max; i++) {
172 if (!(strcmp(control_name, e->texts[i]))) { 172 if (!(strcmp(control_name, e->texts[i]))) {
173 list_add(&path->list, &codec->dapm_paths); 173 list_add(&path->list, &codec->dapm_paths);
174 list_add(&path->list_sink, &dest->sources); 174 list_add(&path->list_sink, &dest->sources);
@@ -1258,7 +1258,7 @@ int snd_soc_dapm_get_enum_double(struct snd_kcontrol *kcontrol,
1258 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; 1258 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
1259 unsigned short val, bitmask; 1259 unsigned short val, bitmask;
1260 1260
1261 for (bitmask = 1; bitmask < e->mask; bitmask <<= 1) 1261 for (bitmask = 1; bitmask < e->max; bitmask <<= 1)
1262 ; 1262 ;
1263 val = snd_soc_read(widget->codec, e->reg); 1263 val = snd_soc_read(widget->codec, e->reg);
1264 ucontrol->value.enumerated.item[0] = (val >> e->shift_l) & (bitmask - 1); 1264 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,
1288 unsigned short mask, bitmask; 1288 unsigned short mask, bitmask;
1289 int ret = 0; 1289 int ret = 0;
1290 1290
1291 for (bitmask = 1; bitmask < e->mask; bitmask <<= 1) 1291 for (bitmask = 1; bitmask < e->max; bitmask <<= 1)
1292 ; 1292 ;
1293 if (ucontrol->value.enumerated.item[0] > e->mask - 1) 1293 if (ucontrol->value.enumerated.item[0] > e->max - 1)
1294 return -EINVAL; 1294 return -EINVAL;
1295 mux = ucontrol->value.enumerated.item[0]; 1295 mux = ucontrol->value.enumerated.item[0];
1296 val = mux << e->shift_l; 1296 val = mux << e->shift_l;
1297 mask = (bitmask - 1) << e->shift_l; 1297 mask = (bitmask - 1) << e->shift_l;
1298 if (e->shift_l != e->shift_r) { 1298 if (e->shift_l != e->shift_r) {
1299 if (ucontrol->value.enumerated.item[1] > e->mask - 1) 1299 if (ucontrol->value.enumerated.item[1] > e->max - 1)
1300 return -EINVAL; 1300 return -EINVAL;
1301 val |= ucontrol->value.enumerated.item[1] << e->shift_r; 1301 val |= ucontrol->value.enumerated.item[1] << e->shift_r;
1302 mask |= (bitmask - 1) << e->shift_r; 1302 mask |= (bitmask - 1) << e->shift_r;