aboutsummaryrefslogtreecommitdiffstats
path: root/sound
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 /sound
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>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/soc-core.c20
-rw-r--r--sound/soc/soc-dapm.c14
2 files changed, 17 insertions, 17 deletions
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;