diff options
Diffstat (limited to 'sound/pci/ice1712/aureon.c')
-rw-r--r-- | sound/pci/ice1712/aureon.c | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/sound/pci/ice1712/aureon.c b/sound/pci/ice1712/aureon.c index 2175f6721347..0f7f4d8263c0 100644 --- a/sound/pci/ice1712/aureon.c +++ b/sound/pci/ice1712/aureon.c | |||
@@ -53,6 +53,8 @@ | |||
53 | #include <linux/interrupt.h> | 53 | #include <linux/interrupt.h> |
54 | #include <linux/init.h> | 54 | #include <linux/init.h> |
55 | #include <linux/slab.h> | 55 | #include <linux/slab.h> |
56 | #include <linux/mutex.h> | ||
57 | |||
56 | #include <sound/core.h> | 58 | #include <sound/core.h> |
57 | 59 | ||
58 | #include "ice1712.h" | 60 | #include "ice1712.h" |
@@ -210,14 +212,14 @@ static int aureon_ac97_vol_get(struct snd_kcontrol *kcontrol, struct snd_ctl_ele | |||
210 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 212 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
211 | unsigned short vol; | 213 | unsigned short vol; |
212 | 214 | ||
213 | down(&ice->gpio_mutex); | 215 | mutex_lock(&ice->gpio_mutex); |
214 | 216 | ||
215 | vol = aureon_ac97_read(ice, kcontrol->private_value & 0x7F); | 217 | vol = aureon_ac97_read(ice, kcontrol->private_value & 0x7F); |
216 | ucontrol->value.integer.value[0] = 0x1F - (vol & 0x1F); | 218 | ucontrol->value.integer.value[0] = 0x1F - (vol & 0x1F); |
217 | if (kcontrol->private_value & AUREON_AC97_STEREO) | 219 | if (kcontrol->private_value & AUREON_AC97_STEREO) |
218 | ucontrol->value.integer.value[1] = 0x1F - ((vol >> 8) & 0x1F); | 220 | ucontrol->value.integer.value[1] = 0x1F - ((vol >> 8) & 0x1F); |
219 | 221 | ||
220 | up(&ice->gpio_mutex); | 222 | mutex_unlock(&ice->gpio_mutex); |
221 | return 0; | 223 | return 0; |
222 | } | 224 | } |
223 | 225 | ||
@@ -252,11 +254,11 @@ static int aureon_ac97_mute_get(struct snd_kcontrol *kcontrol, struct snd_ctl_el | |||
252 | { | 254 | { |
253 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 255 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
254 | 256 | ||
255 | down(&ice->gpio_mutex); | 257 | mutex_lock(&ice->gpio_mutex); |
256 | 258 | ||
257 | ucontrol->value.integer.value[0] = aureon_ac97_read(ice, kcontrol->private_value & 0x7F) & 0x8000 ? 0 : 1; | 259 | ucontrol->value.integer.value[0] = aureon_ac97_read(ice, kcontrol->private_value & 0x7F) & 0x8000 ? 0 : 1; |
258 | 260 | ||
259 | up(&ice->gpio_mutex); | 261 | mutex_unlock(&ice->gpio_mutex); |
260 | return 0; | 262 | return 0; |
261 | } | 263 | } |
262 | 264 | ||
@@ -288,11 +290,11 @@ static int aureon_ac97_micboost_get(struct snd_kcontrol *kcontrol, struct snd_ct | |||
288 | { | 290 | { |
289 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 291 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
290 | 292 | ||
291 | down(&ice->gpio_mutex); | 293 | mutex_lock(&ice->gpio_mutex); |
292 | 294 | ||
293 | ucontrol->value.integer.value[0] = aureon_ac97_read(ice, AC97_MIC) & 0x0020 ? 0 : 1; | 295 | ucontrol->value.integer.value[0] = aureon_ac97_read(ice, AC97_MIC) & 0x0020 ? 0 : 1; |
294 | 296 | ||
295 | up(&ice->gpio_mutex); | 297 | mutex_unlock(&ice->gpio_mutex); |
296 | return 0; | 298 | return 0; |
297 | } | 299 | } |
298 | 300 | ||
@@ -488,11 +490,11 @@ static int aureon_ac97_mmute_get(struct snd_kcontrol *kcontrol, struct snd_ctl_e | |||
488 | { | 490 | { |
489 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 491 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
490 | 492 | ||
491 | down(&ice->gpio_mutex); | 493 | mutex_lock(&ice->gpio_mutex); |
492 | 494 | ||
493 | ucontrol->value.integer.value[0] = (wm_get(ice, WM_OUT_MUX1) >> 1) & 0x01; | 495 | ucontrol->value.integer.value[0] = (wm_get(ice, WM_OUT_MUX1) >> 1) & 0x01; |
494 | 496 | ||
495 | up(&ice->gpio_mutex); | 497 | mutex_unlock(&ice->gpio_mutex); |
496 | return 0; | 498 | return 0; |
497 | } | 499 | } |
498 | 500 | ||
@@ -557,9 +559,9 @@ static int wm_pcm_mute_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_va | |||
557 | { | 559 | { |
558 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 560 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
559 | 561 | ||
560 | down(&ice->gpio_mutex); | 562 | mutex_lock(&ice->gpio_mutex); |
561 | ucontrol->value.integer.value[0] = (wm_get(ice, WM_MUTE) & 0x10) ? 0 : 1; | 563 | ucontrol->value.integer.value[0] = (wm_get(ice, WM_MUTE) & 0x10) ? 0 : 1; |
562 | up(&ice->gpio_mutex); | 564 | mutex_unlock(&ice->gpio_mutex); |
563 | return 0; | 565 | return 0; |
564 | } | 566 | } |
565 | 567 | ||
@@ -782,11 +784,11 @@ static int wm_pcm_vol_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_val | |||
782 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 784 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
783 | unsigned short val; | 785 | unsigned short val; |
784 | 786 | ||
785 | down(&ice->gpio_mutex); | 787 | mutex_lock(&ice->gpio_mutex); |
786 | val = wm_get(ice, WM_DAC_DIG_MASTER_ATTEN) & 0xff; | 788 | val = wm_get(ice, WM_DAC_DIG_MASTER_ATTEN) & 0xff; |
787 | val = val > PCM_MIN ? (val - PCM_MIN) : 0; | 789 | val = val > PCM_MIN ? (val - PCM_MIN) : 0; |
788 | ucontrol->value.integer.value[0] = val; | 790 | ucontrol->value.integer.value[0] = val; |
789 | up(&ice->gpio_mutex); | 791 | mutex_unlock(&ice->gpio_mutex); |
790 | return 0; | 792 | return 0; |
791 | } | 793 | } |
792 | 794 | ||
@@ -827,12 +829,12 @@ static int wm_adc_mute_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_va | |||
827 | unsigned short val; | 829 | unsigned short val; |
828 | int i; | 830 | int i; |
829 | 831 | ||
830 | down(&ice->gpio_mutex); | 832 | mutex_lock(&ice->gpio_mutex); |
831 | for (i = 0; i < 2; i++) { | 833 | for (i = 0; i < 2; i++) { |
832 | val = wm_get(ice, WM_ADC_GAIN + i); | 834 | val = wm_get(ice, WM_ADC_GAIN + i); |
833 | ucontrol->value.integer.value[i] = ~val>>5 & 0x1; | 835 | ucontrol->value.integer.value[i] = ~val>>5 & 0x1; |
834 | } | 836 | } |
835 | up(&ice->gpio_mutex); | 837 | mutex_unlock(&ice->gpio_mutex); |
836 | return 0; | 838 | return 0; |
837 | } | 839 | } |
838 | 840 | ||
@@ -874,13 +876,13 @@ static int wm_adc_vol_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_val | |||
874 | int i, idx; | 876 | int i, idx; |
875 | unsigned short vol; | 877 | unsigned short vol; |
876 | 878 | ||
877 | down(&ice->gpio_mutex); | 879 | mutex_lock(&ice->gpio_mutex); |
878 | for (i = 0; i < 2; i++) { | 880 | for (i = 0; i < 2; i++) { |
879 | idx = WM_ADC_GAIN + i; | 881 | idx = WM_ADC_GAIN + i; |
880 | vol = wm_get(ice, idx) & 0x1f; | 882 | vol = wm_get(ice, idx) & 0x1f; |
881 | ucontrol->value.integer.value[i] = vol; | 883 | ucontrol->value.integer.value[i] = vol; |
882 | } | 884 | } |
883 | up(&ice->gpio_mutex); | 885 | mutex_unlock(&ice->gpio_mutex); |
884 | return 0; | 886 | return 0; |
885 | } | 887 | } |
886 | 888 | ||
@@ -951,11 +953,11 @@ static int wm_adc_mux_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_val | |||
951 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 953 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
952 | unsigned short val; | 954 | unsigned short val; |
953 | 955 | ||
954 | down(&ice->gpio_mutex); | 956 | mutex_lock(&ice->gpio_mutex); |
955 | val = wm_get(ice, WM_ADC_MUX); | 957 | val = wm_get(ice, WM_ADC_MUX); |
956 | ucontrol->value.integer.value[0] = val & 7; | 958 | ucontrol->value.integer.value[0] = val & 7; |
957 | ucontrol->value.integer.value[1] = (val >> 4) & 7; | 959 | ucontrol->value.integer.value[1] = (val >> 4) & 7; |
958 | up(&ice->gpio_mutex); | 960 | mutex_unlock(&ice->gpio_mutex); |
959 | return 0; | 961 | return 0; |
960 | } | 962 | } |
961 | 963 | ||