aboutsummaryrefslogtreecommitdiffstats
path: root/sound/aoa/codecs/snd-aoa-codec-onyx.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/aoa/codecs/snd-aoa-codec-onyx.c')
-rw-r--r--sound/aoa/codecs/snd-aoa-codec-onyx.c12
1 files changed, 12 insertions, 0 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;