aboutsummaryrefslogtreecommitdiffstats
path: root/sound/drivers/vx
diff options
context:
space:
mode:
Diffstat (limited to 'sound/drivers/vx')
-rw-r--r--sound/drivers/vx/vx_cmd.c1
-rw-r--r--sound/drivers/vx/vx_core.c1
-rw-r--r--sound/drivers/vx/vx_hwdep.c1
-rw-r--r--sound/drivers/vx/vx_mixer.c68
-rw-r--r--sound/drivers/vx/vx_pcm.c1
-rw-r--r--sound/drivers/vx/vx_uer.c1
6 files changed, 48 insertions, 25 deletions
diff --git a/sound/drivers/vx/vx_cmd.c b/sound/drivers/vx/vx_cmd.c
index 7a221349f285..9529e3bf2866 100644
--- a/sound/drivers/vx/vx_cmd.c
+++ b/sound/drivers/vx/vx_cmd.c
@@ -20,7 +20,6 @@
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */ 21 */
22 22
23#include <sound/driver.h>
24#include <sound/core.h> 23#include <sound/core.h>
25#include <sound/pcm.h> 24#include <sound/pcm.h>
26#include <sound/vx_core.h> 25#include <sound/vx_core.h>
diff --git a/sound/drivers/vx/vx_core.c b/sound/drivers/vx/vx_core.c
index ed19bc17400b..99538862e342 100644
--- a/sound/drivers/vx/vx_core.c
+++ b/sound/drivers/vx/vx_core.c
@@ -20,7 +20,6 @@
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */ 21 */
22 22
23#include <sound/driver.h>
24#include <linux/delay.h> 23#include <linux/delay.h>
25#include <linux/slab.h> 24#include <linux/slab.h>
26#include <linux/interrupt.h> 25#include <linux/interrupt.h>
diff --git a/sound/drivers/vx/vx_hwdep.c b/sound/drivers/vx/vx_hwdep.c
index 9a8154c9416e..1dfe6948e6ff 100644
--- a/sound/drivers/vx/vx_hwdep.c
+++ b/sound/drivers/vx/vx_hwdep.c
@@ -20,7 +20,6 @@
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */ 21 */
22 22
23#include <sound/driver.h>
24#include <linux/device.h> 23#include <linux/device.h>
25#include <linux/firmware.h> 24#include <linux/firmware.h>
26#include <linux/vmalloc.h> 25#include <linux/vmalloc.h>
diff --git a/sound/drivers/vx/vx_mixer.c b/sound/drivers/vx/vx_mixer.c
index b8fcd79a7e11..5a347321f8c0 100644
--- a/sound/drivers/vx/vx_mixer.c
+++ b/sound/drivers/vx/vx_mixer.c
@@ -20,7 +20,6 @@
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */ 21 */
22 22
23#include <sound/driver.h>
24#include <sound/core.h> 23#include <sound/core.h>
25#include <sound/control.h> 24#include <sound/control.h>
26#include <sound/tlv.h> 25#include <sound/tlv.h>
@@ -439,14 +438,19 @@ static int vx_output_level_put(struct snd_kcontrol *kcontrol, struct snd_ctl_ele
439{ 438{
440 struct vx_core *chip = snd_kcontrol_chip(kcontrol); 439 struct vx_core *chip = snd_kcontrol_chip(kcontrol);
441 int codec = kcontrol->id.index; 440 int codec = kcontrol->id.index;
441 unsigned int val[2], vmax;
442
443 vmax = chip->hw->output_level_max;
444 val[0] = ucontrol->value.integer.value[0];
445 val[1] = ucontrol->value.integer.value[1];
446 if (val[0] > vmax || val[1] > vmax)
447 return -EINVAL;
442 mutex_lock(&chip->mixer_mutex); 448 mutex_lock(&chip->mixer_mutex);
443 if (ucontrol->value.integer.value[0] != chip->output_level[codec][0] || 449 if (val[0] != chip->output_level[codec][0] ||
444 ucontrol->value.integer.value[1] != chip->output_level[codec][1]) { 450 val[1] != chip->output_level[codec][1]) {
445 vx_set_analog_output_level(chip, codec, 451 vx_set_analog_output_level(chip, codec, val[0], val[1]);
446 ucontrol->value.integer.value[0], 452 chip->output_level[codec][0] = val[0];
447 ucontrol->value.integer.value[1]); 453 chip->output_level[codec][1] = val[1];
448 chip->output_level[codec][0] = ucontrol->value.integer.value[0];
449 chip->output_level[codec][1] = ucontrol->value.integer.value[1];
450 mutex_unlock(&chip->mixer_mutex); 454 mutex_unlock(&chip->mixer_mutex);
451 return 1; 455 return 1;
452 } 456 }
@@ -506,6 +510,14 @@ static int vx_audio_src_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_v
506static int vx_audio_src_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) 510static int vx_audio_src_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
507{ 511{
508 struct vx_core *chip = snd_kcontrol_chip(kcontrol); 512 struct vx_core *chip = snd_kcontrol_chip(kcontrol);
513
514 if (chip->type >= VX_TYPE_VXPOCKET) {
515 if (ucontrol->value.enumerated.item[0] > 2)
516 return -EINVAL;
517 } else {
518 if (ucontrol->value.enumerated.item[0] > 1)
519 return -EINVAL;
520 }
509 mutex_lock(&chip->mixer_mutex); 521 mutex_lock(&chip->mixer_mutex);
510 if (chip->audio_source_target != ucontrol->value.enumerated.item[0]) { 522 if (chip->audio_source_target != ucontrol->value.enumerated.item[0]) {
511 chip->audio_source_target = ucontrol->value.enumerated.item[0]; 523 chip->audio_source_target = ucontrol->value.enumerated.item[0];
@@ -554,6 +566,9 @@ static int vx_clock_mode_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_
554static int vx_clock_mode_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) 566static int vx_clock_mode_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
555{ 567{
556 struct vx_core *chip = snd_kcontrol_chip(kcontrol); 568 struct vx_core *chip = snd_kcontrol_chip(kcontrol);
569
570 if (ucontrol->value.enumerated.item[0] > 2)
571 return -EINVAL;
557 mutex_lock(&chip->mixer_mutex); 572 mutex_lock(&chip->mixer_mutex);
558 if (chip->clock_mode != ucontrol->value.enumerated.item[0]) { 573 if (chip->clock_mode != ucontrol->value.enumerated.item[0]) {
559 chip->clock_mode = ucontrol->value.enumerated.item[0]; 574 chip->clock_mode = ucontrol->value.enumerated.item[0];
@@ -603,12 +618,17 @@ static int vx_audio_gain_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_
603 struct vx_core *chip = snd_kcontrol_chip(kcontrol); 618 struct vx_core *chip = snd_kcontrol_chip(kcontrol);
604 int audio = kcontrol->private_value & 0xff; 619 int audio = kcontrol->private_value & 0xff;
605 int capture = (kcontrol->private_value >> 8) & 1; 620 int capture = (kcontrol->private_value >> 8) & 1;
621 unsigned int val[2];
606 622
623 val[0] = ucontrol->value.integer.value[0];
624 val[1] = ucontrol->value.integer.value[1];
625 if (val[0] > CVAL_MAX || val[1] > CVAL_MAX)
626 return -EINVAL;
607 mutex_lock(&chip->mixer_mutex); 627 mutex_lock(&chip->mixer_mutex);
608 if (ucontrol->value.integer.value[0] != chip->audio_gain[capture][audio] || 628 if (val[0] != chip->audio_gain[capture][audio] ||
609 ucontrol->value.integer.value[1] != chip->audio_gain[capture][audio+1]) { 629 val[1] != chip->audio_gain[capture][audio+1]) {
610 vx_set_audio_gain(chip, audio, capture, ucontrol->value.integer.value[0]); 630 vx_set_audio_gain(chip, audio, capture, val[0]);
611 vx_set_audio_gain(chip, audio+1, capture, ucontrol->value.integer.value[1]); 631 vx_set_audio_gain(chip, audio+1, capture, val[1]);
612 mutex_unlock(&chip->mixer_mutex); 632 mutex_unlock(&chip->mixer_mutex);
613 return 1; 633 return 1;
614 } 634 }
@@ -632,13 +652,19 @@ static int vx_audio_monitor_put(struct snd_kcontrol *kcontrol, struct snd_ctl_el
632{ 652{
633 struct vx_core *chip = snd_kcontrol_chip(kcontrol); 653 struct vx_core *chip = snd_kcontrol_chip(kcontrol);
634 int audio = kcontrol->private_value & 0xff; 654 int audio = kcontrol->private_value & 0xff;
655 unsigned int val[2];
656
657 val[0] = ucontrol->value.integer.value[0];
658 val[1] = ucontrol->value.integer.value[1];
659 if (val[0] > CVAL_MAX || val[1] > CVAL_MAX)
660 return -EINVAL;
635 661
636 mutex_lock(&chip->mixer_mutex); 662 mutex_lock(&chip->mixer_mutex);
637 if (ucontrol->value.integer.value[0] != chip->audio_monitor[audio] || 663 if (val[0] != chip->audio_monitor[audio] ||
638 ucontrol->value.integer.value[1] != chip->audio_monitor[audio+1]) { 664 val[1] != chip->audio_monitor[audio+1]) {
639 vx_set_monitor_level(chip, audio, ucontrol->value.integer.value[0], 665 vx_set_monitor_level(chip, audio, val[0],
640 chip->audio_monitor_active[audio]); 666 chip->audio_monitor_active[audio]);
641 vx_set_monitor_level(chip, audio+1, ucontrol->value.integer.value[1], 667 vx_set_monitor_level(chip, audio+1, val[1],
642 chip->audio_monitor_active[audio+1]); 668 chip->audio_monitor_active[audio+1]);
643 mutex_unlock(&chip->mixer_mutex); 669 mutex_unlock(&chip->mixer_mutex);
644 return 1; 670 return 1;
@@ -669,8 +695,10 @@ static int vx_audio_sw_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_va
669 mutex_lock(&chip->mixer_mutex); 695 mutex_lock(&chip->mixer_mutex);
670 if (ucontrol->value.integer.value[0] != chip->audio_active[audio] || 696 if (ucontrol->value.integer.value[0] != chip->audio_active[audio] ||
671 ucontrol->value.integer.value[1] != chip->audio_active[audio+1]) { 697 ucontrol->value.integer.value[1] != chip->audio_active[audio+1]) {
672 vx_set_audio_switch(chip, audio, ucontrol->value.integer.value[0]); 698 vx_set_audio_switch(chip, audio,
673 vx_set_audio_switch(chip, audio+1, ucontrol->value.integer.value[1]); 699 !!ucontrol->value.integer.value[0]);
700 vx_set_audio_switch(chip, audio+1,
701 !!ucontrol->value.integer.value[1]);
674 mutex_unlock(&chip->mixer_mutex); 702 mutex_unlock(&chip->mixer_mutex);
675 return 1; 703 return 1;
676 } 704 }
@@ -699,9 +727,9 @@ static int vx_monitor_sw_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_
699 if (ucontrol->value.integer.value[0] != chip->audio_monitor_active[audio] || 727 if (ucontrol->value.integer.value[0] != chip->audio_monitor_active[audio] ||
700 ucontrol->value.integer.value[1] != chip->audio_monitor_active[audio+1]) { 728 ucontrol->value.integer.value[1] != chip->audio_monitor_active[audio+1]) {
701 vx_set_monitor_level(chip, audio, chip->audio_monitor[audio], 729 vx_set_monitor_level(chip, audio, chip->audio_monitor[audio],
702 ucontrol->value.integer.value[0]); 730 !!ucontrol->value.integer.value[0]);
703 vx_set_monitor_level(chip, audio+1, chip->audio_monitor[audio+1], 731 vx_set_monitor_level(chip, audio+1, chip->audio_monitor[audio+1],
704 ucontrol->value.integer.value[1]); 732 !!ucontrol->value.integer.value[1]);
705 mutex_unlock(&chip->mixer_mutex); 733 mutex_unlock(&chip->mixer_mutex);
706 return 1; 734 return 1;
707 } 735 }
diff --git a/sound/drivers/vx/vx_pcm.c b/sound/drivers/vx/vx_pcm.c
index 7e65a103fbb2..fdbf86571b1f 100644
--- a/sound/drivers/vx/vx_pcm.c
+++ b/sound/drivers/vx/vx_pcm.c
@@ -45,7 +45,6 @@
45 * - scheduled action on the stream. 45 * - scheduled action on the stream.
46 */ 46 */
47 47
48#include <sound/driver.h>
49#include <linux/slab.h> 48#include <linux/slab.h>
50#include <linux/vmalloc.h> 49#include <linux/vmalloc.h>
51#include <linux/delay.h> 50#include <linux/delay.h>
diff --git a/sound/drivers/vx/vx_uer.c b/sound/drivers/vx/vx_uer.c
index 7400306b7f28..fb8932af888d 100644
--- a/sound/drivers/vx/vx_uer.c
+++ b/sound/drivers/vx/vx_uer.c
@@ -20,7 +20,6 @@
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */ 21 */
22 22
23#include <sound/driver.h>
24#include <linux/delay.h> 23#include <linux/delay.h>
25#include <sound/core.h> 24#include <sound/core.h>
26#include <sound/vx_core.h> 25#include <sound/vx_core.h>