diff options
Diffstat (limited to 'sound/aoa')
-rw-r--r-- | sound/aoa/aoa.h | 2 | ||||
-rw-r--r-- | sound/aoa/codecs/snd-aoa-codec-onyx.c | 12 | ||||
-rw-r--r-- | sound/aoa/codecs/snd-aoa-codec-tas.c | 21 | ||||
-rw-r--r-- | sound/aoa/fabrics/snd-aoa-fabric-layout.c | 2 | ||||
-rw-r--r-- | sound/aoa/soundbus/i2sbus/i2sbus-core.c | 1 | ||||
-rw-r--r-- | sound/aoa/soundbus/i2sbus/i2sbus-pcm.c | 10 |
6 files changed, 40 insertions, 8 deletions
diff --git a/sound/aoa/aoa.h b/sound/aoa/aoa.h index 541b908f3cdf..e08789484e30 100644 --- a/sound/aoa/aoa.h +++ b/sound/aoa/aoa.h | |||
@@ -10,8 +10,6 @@ | |||
10 | #define __AOA_H | 10 | #define __AOA_H |
11 | #include <asm/prom.h> | 11 | #include <asm/prom.h> |
12 | #include <linux/module.h> | 12 | #include <linux/module.h> |
13 | /* So apparently there's a reason for requiring driver.h to be included first! */ | ||
14 | #include <sound/driver.h> | ||
15 | #include <sound/core.h> | 13 | #include <sound/core.h> |
16 | #include <sound/asound.h> | 14 | #include <sound/asound.h> |
17 | #include <sound/control.h> | 15 | #include <sound/control.h> |
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) | |||
272 | static int onyx_snd_capture_source_put(struct snd_kcontrol *kcontrol, | 282 | static 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); |
diff --git a/sound/aoa/fabrics/snd-aoa-fabric-layout.c b/sound/aoa/fabrics/snd-aoa-fabric-layout.c index 8b2ba99d7f8a..dea7abb082cd 100644 --- a/sound/aoa/fabrics/snd-aoa-fabric-layout.c +++ b/sound/aoa/fabrics/snd-aoa-fabric-layout.c | |||
@@ -600,7 +600,7 @@ static int n##_control_put(struct snd_kcontrol *kcontrol, \ | |||
600 | struct gpio_runtime *gpio = snd_kcontrol_chip(kcontrol); \ | 600 | struct gpio_runtime *gpio = snd_kcontrol_chip(kcontrol); \ |
601 | if (gpio->methods && gpio->methods->get_##n) \ | 601 | if (gpio->methods && gpio->methods->get_##n) \ |
602 | gpio->methods->set_##n(gpio, \ | 602 | gpio->methods->set_##n(gpio, \ |
603 | ucontrol->value.integer.value[0]); \ | 603 | !!ucontrol->value.integer.value[0]); \ |
604 | return 1; \ | 604 | return 1; \ |
605 | } \ | 605 | } \ |
606 | static struct snd_kcontrol_new n##_ctl = { \ | 606 | static struct snd_kcontrol_new n##_ctl = { \ |
diff --git a/sound/aoa/soundbus/i2sbus/i2sbus-core.c b/sound/aoa/soundbus/i2sbus/i2sbus-core.c index efb9441b3acf..e6beb92c6933 100644 --- a/sound/aoa/soundbus/i2sbus/i2sbus-core.c +++ b/sound/aoa/soundbus/i2sbus/i2sbus-core.c | |||
@@ -11,7 +11,6 @@ | |||
11 | #include <linux/interrupt.h> | 11 | #include <linux/interrupt.h> |
12 | #include <linux/dma-mapping.h> | 12 | #include <linux/dma-mapping.h> |
13 | 13 | ||
14 | #include <sound/driver.h> | ||
15 | #include <sound/core.h> | 14 | #include <sound/core.h> |
16 | 15 | ||
17 | #include <asm/macio.h> | 16 | #include <asm/macio.h> |
diff --git a/sound/aoa/soundbus/i2sbus/i2sbus-pcm.c b/sound/aoa/soundbus/i2sbus/i2sbus-pcm.c index c6b42f9bdbc9..59bacd365733 100644 --- a/sound/aoa/soundbus/i2sbus/i2sbus-pcm.c +++ b/sound/aoa/soundbus/i2sbus/i2sbus-pcm.c | |||
@@ -8,9 +8,6 @@ | |||
8 | 8 | ||
9 | #include <asm/io.h> | 9 | #include <asm/io.h> |
10 | #include <linux/delay.h> | 10 | #include <linux/delay.h> |
11 | /* So apparently there's a reason for requiring driver.h | ||
12 | * to be included first, even if I don't know it... */ | ||
13 | #include <sound/driver.h> | ||
14 | #include <sound/core.h> | 11 | #include <sound/core.h> |
15 | #include <asm/macio.h> | 12 | #include <asm/macio.h> |
16 | #include <linux/pci.h> | 13 | #include <linux/pci.h> |
@@ -194,6 +191,12 @@ static int i2sbus_pcm_open(struct i2sbus_dev *i2sdev, int in) | |||
194 | hw->period_bytes_max = 16384; | 191 | hw->period_bytes_max = 16384; |
195 | hw->periods_min = 3; | 192 | hw->periods_min = 3; |
196 | hw->periods_max = MAX_DBDMA_COMMANDS; | 193 | hw->periods_max = MAX_DBDMA_COMMANDS; |
194 | err = snd_pcm_hw_constraint_integer(pi->substream->runtime, | ||
195 | SNDRV_PCM_HW_PARAM_PERIODS); | ||
196 | if (err < 0) { | ||
197 | result = err; | ||
198 | goto out_unlock; | ||
199 | } | ||
197 | list_for_each_entry(cii, &sdev->codec_list, list) { | 200 | list_for_each_entry(cii, &sdev->codec_list, list) { |
198 | if (cii->codec->open) { | 201 | if (cii->codec->open) { |
199 | err = cii->codec->open(cii, pi->substream); | 202 | err = cii->codec->open(cii, pi->substream); |
@@ -990,6 +993,7 @@ i2sbus_attach_codec(struct soundbus_dev *dev, struct snd_card *card, | |||
990 | if (dev->pcm->card != card) { | 993 | if (dev->pcm->card != card) { |
991 | printk(KERN_ERR | 994 | printk(KERN_ERR |
992 | "Can't attach same bus to different cards!\n"); | 995 | "Can't attach same bus to different cards!\n"); |
996 | err = -EINVAL; | ||
993 | goto out_put_ci_module; | 997 | goto out_put_ci_module; |
994 | } | 998 | } |
995 | err = snd_pcm_new_stream(dev->pcm, SNDRV_PCM_STREAM_CAPTURE, 1); | 999 | err = snd_pcm_new_stream(dev->pcm, SNDRV_PCM_STREAM_CAPTURE, 1); |