]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - sound/pci/ice1712/aureon.c
[ALSA] Remove sound/driver.h
[linux-2.6-omap-h63xx.git] / sound / pci / ice1712 / aureon.c
index ec0699c89952f9c0d5b9ecc62163afd6483a39eb..337489187614887652aaf5d5d1c3b5ea413b8ad4 100644 (file)
@@ -47,7 +47,6 @@
  *
  */      
 
-#include <sound/driver.h>
 #include <asm/io.h>
 #include <linux/delay.h>
 #include <linux/interrupt.h>
@@ -205,7 +204,7 @@ static int aureon_universe_inmux_get(struct snd_kcontrol *kcontrol,
                                     struct snd_ctl_elem_value *ucontrol)
 {
        struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
-       ucontrol->value.integer.value[0] = ice->spec.aureon.pca9554_out;
+       ucontrol->value.enumerated.item[0] = ice->spec.aureon.pca9554_out;
        return 0;
 }
 
@@ -216,10 +215,11 @@ static int aureon_universe_inmux_put(struct snd_kcontrol *kcontrol,
        unsigned char oval, nval;
        int change;
 
+       nval = ucontrol->value.enumerated.item[0];
+       if (nval >= 3)
+               return -EINVAL;
        snd_ice1712_save_gpio_status(ice);
-       
        oval = ice->spec.aureon.pca9554_out;
-       nval = ucontrol->value.integer.value[0];
        if ((change = (oval != nval))) {
                aureon_pca9554_write(ice, PCA9554_OUT, nval);
                ice->spec.aureon.pca9554_out = nval;
@@ -757,10 +757,13 @@ static int wm_master_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_
 
        snd_ice1712_save_gpio_status(ice);
        for (ch = 0; ch < 2; ch++) {
-               if (ucontrol->value.integer.value[ch] != ice->spec.aureon.master[ch]) {
+               unsigned int vol = ucontrol->value.integer.value[ch];
+               if (vol > WM_VOL_MAX)
+                       continue;
+               vol |= ice->spec.aureon.master[ch] & WM_VOL_MUTE;
+               if (vol != ice->spec.aureon.master[ch]) {
                        int dac;
-                       ice->spec.aureon.master[ch] &= WM_VOL_MUTE;
-                       ice->spec.aureon.master[ch] |= ucontrol->value.integer.value[ch];
+                       ice->spec.aureon.master[ch] = vol;
                        for (dac = 0; dac < ice->num_total_dacs; dac += 2)
                                wm_set_vol(ice, WM_DAC_ATTEN + dac + ch,
                                           ice->spec.aureon.vol[dac + ch],
@@ -807,10 +810,13 @@ static int wm_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *
        ofs = kcontrol->private_value & 0xff;
        snd_ice1712_save_gpio_status(ice);
        for (i = 0; i < voices; i++) {
-               idx  = WM_DAC_ATTEN + ofs + i;
-               if (ucontrol->value.integer.value[i] != ice->spec.aureon.vol[ofs+i]) {
-                       ice->spec.aureon.vol[ofs+i] &= WM_VOL_MUTE;
-                       ice->spec.aureon.vol[ofs+i] |= ucontrol->value.integer.value[i];
+               unsigned int vol = ucontrol->value.integer.value[i];
+               if (vol > 0x7f)
+                       continue;
+               vol |= ice->spec.aureon.vol[ofs+i];
+               if (vol != ice->spec.aureon.vol[ofs+i]) {
+                       ice->spec.aureon.vol[ofs+i] = vol;
+                       idx  = WM_DAC_ATTEN + ofs + i;
                        wm_set_vol(ice, idx, ice->spec.aureon.vol[ofs+i],
                                   ice->spec.aureon.master[i]);
                        change = 1;
@@ -940,8 +946,10 @@ static int wm_pcm_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_val
        unsigned short ovol, nvol;
        int change = 0;
 
-       snd_ice1712_save_gpio_status(ice);
        nvol = ucontrol->value.integer.value[0];
+       if (nvol > PCM_RES)
+               return -EINVAL;
+       snd_ice1712_save_gpio_status(ice);
        nvol = (nvol ? (nvol + PCM_MIN) : 0) & 0xff;
        ovol = wm_get(ice, WM_DAC_DIG_MASTER_ATTEN) & 0xff;
        if (ovol != nvol) {
@@ -1031,7 +1039,7 @@ static int wm_adc_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_val
        snd_ice1712_save_gpio_status(ice);
        for (i = 0; i < 2; i++) {
                idx  = WM_ADC_GAIN + i;
-               nvol = ucontrol->value.integer.value[i];
+               nvol = ucontrol->value.integer.value[i] & 0x1f;
                ovol = wm_get(ice, idx);
                if ((ovol & 0x1f) != nvol) {
                        wm_put(ice, idx, nvol | (ovol & ~0x1f));