aboutsummaryrefslogtreecommitdiffstats
path: root/sound/aoa/codecs
diff options
context:
space:
mode:
Diffstat (limited to 'sound/aoa/codecs')
-rw-r--r--sound/aoa/codecs/snd-aoa-codec-onyx.c12
-rw-r--r--sound/aoa/codecs/snd-aoa-codec-tas.c21
2 files changed, 32 insertions, 1 deletions
diff --git a/sound/aoa/codecs/snd-aoa-codec-onyx.c b/sound/aoa/codecs/snd-aoa-codec-onyx.c
index 71e3f9360658..6a3837d480e5 100644
--- a/sound/aoa/codecs/snd-aoa-codec-onyx.c
+++ b/sound/aoa/codecs/snd-aoa-codec-onyx.c
@@ -138,6 +138,13 @@ static int onyx_snd_vol_put(struct snd_kcontrol *kcontrol,
138 struct onyx *onyx = snd_kcontrol_chip(kcontrol); 138 struct onyx *onyx = snd_kcontrol_chip(kcontrol);
139 s8 l, r; 139 s8 l, r;
140 140
141 if (ucontrol->value.integer.value[0] < -128 + VOLUME_RANGE_SHIFT ||
142 ucontrol->value.integer.value[0] > -1 + VOLUME_RANGE_SHIFT)
143 return -EINVAL;
144 if (ucontrol->value.integer.value[1] < -128 + VOLUME_RANGE_SHIFT ||
145 ucontrol->value.integer.value[1] > -1 + VOLUME_RANGE_SHIFT)
146 return -EINVAL;
147
141 mutex_lock(&onyx->mutex); 148 mutex_lock(&onyx->mutex);
142 onyx_read_register(onyx, ONYX_REG_DAC_ATTEN_LEFT, &l); 149 onyx_read_register(onyx, ONYX_REG_DAC_ATTEN_LEFT, &l);
143 onyx_read_register(onyx, ONYX_REG_DAC_ATTEN_RIGHT, &r); 150 onyx_read_register(onyx, ONYX_REG_DAC_ATTEN_RIGHT, &r);
@@ -206,6 +213,9 @@ static int onyx_snd_inputgain_put(struct snd_kcontrol *kcontrol,
206 struct onyx *onyx = snd_kcontrol_chip(kcontrol); 213 struct onyx *onyx = snd_kcontrol_chip(kcontrol);
207 u8 v, n; 214 u8 v, n;
208 215
216 if (ucontrol->value.integer.value[0] < 3 + INPUTGAIN_RANGE_SHIFT ||
217 ucontrol->value.integer.value[0] > 28 + INPUTGAIN_RANGE_SHIFT)
218 return -EINVAL;
209 mutex_lock(&onyx->mutex); 219 mutex_lock(&onyx->mutex);
210 onyx_read_register(onyx, ONYX_REG_ADC_CONTROL, &v); 220 onyx_read_register(onyx, ONYX_REG_ADC_CONTROL, &v);
211 n = v; 221 n = v;
@@ -272,6 +282,8 @@ static void onyx_set_capture_source(struct onyx *onyx, int mic)
272static int onyx_snd_capture_source_put(struct snd_kcontrol *kcontrol, 282static int onyx_snd_capture_source_put(struct snd_kcontrol *kcontrol,
273 struct snd_ctl_elem_value *ucontrol) 283 struct snd_ctl_elem_value *ucontrol)
274{ 284{
285 if (ucontrol->value.enumerated.item[0] > 1)
286 return -EINVAL;
275 onyx_set_capture_source(snd_kcontrol_chip(kcontrol), 287 onyx_set_capture_source(snd_kcontrol_chip(kcontrol),
276 ucontrol->value.enumerated.item[0]); 288 ucontrol->value.enumerated.item[0]);
277 return 1; 289 return 1;
diff --git a/sound/aoa/codecs/snd-aoa-codec-tas.c b/sound/aoa/codecs/snd-aoa-codec-tas.c
index 70c341684794..7a16a3331f7e 100644
--- a/sound/aoa/codecs/snd-aoa-codec-tas.c
+++ b/sound/aoa/codecs/snd-aoa-codec-tas.c
@@ -248,6 +248,13 @@ static int tas_snd_vol_put(struct snd_kcontrol *kcontrol,
248{ 248{
249 struct tas *tas = snd_kcontrol_chip(kcontrol); 249 struct tas *tas = snd_kcontrol_chip(kcontrol);
250 250
251 if (ucontrol->value.integer.value[0] < 0 ||
252 ucontrol->value.integer.value[0] > 177)
253 return -EINVAL;
254 if (ucontrol->value.integer.value[1] < 0 ||
255 ucontrol->value.integer.value[1] > 177)
256 return -EINVAL;
257
251 mutex_lock(&tas->mtx); 258 mutex_lock(&tas->mtx);
252 if (tas->cached_volume_l == ucontrol->value.integer.value[0] 259 if (tas->cached_volume_l == ucontrol->value.integer.value[0]
253 && tas->cached_volume_r == ucontrol->value.integer.value[1]) { 260 && tas->cached_volume_r == ucontrol->value.integer.value[1]) {
@@ -401,6 +408,10 @@ static int tas_snd_drc_range_put(struct snd_kcontrol *kcontrol,
401{ 408{
402 struct tas *tas = snd_kcontrol_chip(kcontrol); 409 struct tas *tas = snd_kcontrol_chip(kcontrol);
403 410
411 if (ucontrol->value.integer.value[0] < 0 ||
412 ucontrol->value.integer.value[0] > TAS3004_DRC_MAX)
413 return -EINVAL;
414
404 mutex_lock(&tas->mtx); 415 mutex_lock(&tas->mtx);
405 if (tas->drc_range == ucontrol->value.integer.value[0]) { 416 if (tas->drc_range == ucontrol->value.integer.value[0]) {
406 mutex_unlock(&tas->mtx); 417 mutex_unlock(&tas->mtx);
@@ -447,7 +458,7 @@ static int tas_snd_drc_switch_put(struct snd_kcontrol *kcontrol,
447 return 0; 458 return 0;
448 } 459 }
449 460
450 tas->drc_enabled = ucontrol->value.integer.value[0]; 461 tas->drc_enabled = !!ucontrol->value.integer.value[0];
451 if (tas->hw_enabled) 462 if (tas->hw_enabled)
452 tas3004_set_drc(tas); 463 tas3004_set_drc(tas);
453 mutex_unlock(&tas->mtx); 464 mutex_unlock(&tas->mtx);
@@ -494,6 +505,8 @@ static int tas_snd_capture_source_put(struct snd_kcontrol *kcontrol,
494 struct tas *tas = snd_kcontrol_chip(kcontrol); 505 struct tas *tas = snd_kcontrol_chip(kcontrol);
495 int oldacr; 506 int oldacr;
496 507
508 if (ucontrol->value.enumerated.item[0] > 1)
509 return -EINVAL;
497 mutex_lock(&tas->mtx); 510 mutex_lock(&tas->mtx);
498 oldacr = tas->acr; 511 oldacr = tas->acr;
499 512
@@ -562,6 +575,9 @@ static int tas_snd_treble_put(struct snd_kcontrol *kcontrol,
562{ 575{
563 struct tas *tas = snd_kcontrol_chip(kcontrol); 576 struct tas *tas = snd_kcontrol_chip(kcontrol);
564 577
578 if (ucontrol->value.integer.value[0] < TAS3004_TREBLE_MIN ||
579 ucontrol->value.integer.value[0] > TAS3004_TREBLE_MAX)
580 return -EINVAL;
565 mutex_lock(&tas->mtx); 581 mutex_lock(&tas->mtx);
566 if (tas->treble == ucontrol->value.integer.value[0]) { 582 if (tas->treble == ucontrol->value.integer.value[0]) {
567 mutex_unlock(&tas->mtx); 583 mutex_unlock(&tas->mtx);
@@ -610,6 +626,9 @@ static int tas_snd_bass_put(struct snd_kcontrol *kcontrol,
610{ 626{
611 struct tas *tas = snd_kcontrol_chip(kcontrol); 627 struct tas *tas = snd_kcontrol_chip(kcontrol);
612 628
629 if (ucontrol->value.integer.value[0] < TAS3004_BASS_MIN ||
630 ucontrol->value.integer.value[0] > TAS3004_BASS_MAX)
631 return -EINVAL;
613 mutex_lock(&tas->mtx); 632 mutex_lock(&tas->mtx);
614 if (tas->bass == ucontrol->value.integer.value[0]) { 633 if (tas->bass == ucontrol->value.integer.value[0]) {
615 mutex_unlock(&tas->mtx); 634 mutex_unlock(&tas->mtx);