diff options
Diffstat (limited to 'sound/pci/mixart/mixart_mixer.c')
-rw-r--r-- | sound/pci/mixart/mixart_mixer.c | 52 |
1 files changed, 27 insertions, 25 deletions
diff --git a/sound/pci/mixart/mixart_mixer.c b/sound/pci/mixart/mixart_mixer.c index 36a7e9ddfb15..ed47b732c103 100644 --- a/sound/pci/mixart/mixart_mixer.c +++ b/sound/pci/mixart/mixart_mixer.c | |||
@@ -24,6 +24,8 @@ | |||
24 | #include <linux/time.h> | 24 | #include <linux/time.h> |
25 | #include <linux/interrupt.h> | 25 | #include <linux/interrupt.h> |
26 | #include <linux/init.h> | 26 | #include <linux/init.h> |
27 | #include <linux/mutex.h> | ||
28 | |||
27 | #include <sound/core.h> | 29 | #include <sound/core.h> |
28 | #include "mixart.h" | 30 | #include "mixart.h" |
29 | #include "mixart_core.h" | 31 | #include "mixart_core.h" |
@@ -353,7 +355,7 @@ static int mixart_analog_vol_info(struct snd_kcontrol *kcontrol, struct snd_ctl_ | |||
353 | static int mixart_analog_vol_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 355 | static int mixart_analog_vol_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
354 | { | 356 | { |
355 | struct snd_mixart *chip = snd_kcontrol_chip(kcontrol); | 357 | struct snd_mixart *chip = snd_kcontrol_chip(kcontrol); |
356 | down(&chip->mgr->mixer_mutex); | 358 | mutex_lock(&chip->mgr->mixer_mutex); |
357 | if(kcontrol->private_value == 0) { /* playback */ | 359 | if(kcontrol->private_value == 0) { /* playback */ |
358 | ucontrol->value.integer.value[0] = chip->analog_playback_volume[0]; | 360 | ucontrol->value.integer.value[0] = chip->analog_playback_volume[0]; |
359 | ucontrol->value.integer.value[1] = chip->analog_playback_volume[1]; | 361 | ucontrol->value.integer.value[1] = chip->analog_playback_volume[1]; |
@@ -361,7 +363,7 @@ static int mixart_analog_vol_get(struct snd_kcontrol *kcontrol, struct snd_ctl_e | |||
361 | ucontrol->value.integer.value[0] = chip->analog_capture_volume[0]; | 363 | ucontrol->value.integer.value[0] = chip->analog_capture_volume[0]; |
362 | ucontrol->value.integer.value[1] = chip->analog_capture_volume[1]; | 364 | ucontrol->value.integer.value[1] = chip->analog_capture_volume[1]; |
363 | } | 365 | } |
364 | up(&chip->mgr->mixer_mutex); | 366 | mutex_unlock(&chip->mgr->mixer_mutex); |
365 | return 0; | 367 | return 0; |
366 | } | 368 | } |
367 | 369 | ||
@@ -371,7 +373,7 @@ static int mixart_analog_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_e | |||
371 | int changed = 0; | 373 | int changed = 0; |
372 | int is_capture, i; | 374 | int is_capture, i; |
373 | 375 | ||
374 | down(&chip->mgr->mixer_mutex); | 376 | mutex_lock(&chip->mgr->mixer_mutex); |
375 | is_capture = (kcontrol->private_value != 0); | 377 | is_capture = (kcontrol->private_value != 0); |
376 | for(i=0; i<2; i++) { | 378 | for(i=0; i<2; i++) { |
377 | int new_volume = ucontrol->value.integer.value[i]; | 379 | int new_volume = ucontrol->value.integer.value[i]; |
@@ -382,7 +384,7 @@ static int mixart_analog_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_e | |||
382 | } | 384 | } |
383 | } | 385 | } |
384 | if(changed) mixart_update_analog_audio_level(chip, is_capture); | 386 | if(changed) mixart_update_analog_audio_level(chip, is_capture); |
385 | up(&chip->mgr->mixer_mutex); | 387 | mutex_unlock(&chip->mgr->mixer_mutex); |
386 | return changed; | 388 | return changed; |
387 | } | 389 | } |
388 | 390 | ||
@@ -408,10 +410,10 @@ static int mixart_audio_sw_get(struct snd_kcontrol *kcontrol, struct snd_ctl_ele | |||
408 | { | 410 | { |
409 | struct snd_mixart *chip = snd_kcontrol_chip(kcontrol); | 411 | struct snd_mixart *chip = snd_kcontrol_chip(kcontrol); |
410 | 412 | ||
411 | down(&chip->mgr->mixer_mutex); | 413 | mutex_lock(&chip->mgr->mixer_mutex); |
412 | ucontrol->value.integer.value[0] = chip->analog_playback_active[0]; | 414 | ucontrol->value.integer.value[0] = chip->analog_playback_active[0]; |
413 | ucontrol->value.integer.value[1] = chip->analog_playback_active[1]; | 415 | ucontrol->value.integer.value[1] = chip->analog_playback_active[1]; |
414 | up(&chip->mgr->mixer_mutex); | 416 | mutex_unlock(&chip->mgr->mixer_mutex); |
415 | return 0; | 417 | return 0; |
416 | } | 418 | } |
417 | 419 | ||
@@ -419,7 +421,7 @@ static int mixart_audio_sw_put(struct snd_kcontrol *kcontrol, struct snd_ctl_ele | |||
419 | { | 421 | { |
420 | struct snd_mixart *chip = snd_kcontrol_chip(kcontrol); | 422 | struct snd_mixart *chip = snd_kcontrol_chip(kcontrol); |
421 | int i, changed = 0; | 423 | int i, changed = 0; |
422 | down(&chip->mgr->mixer_mutex); | 424 | mutex_lock(&chip->mgr->mixer_mutex); |
423 | for(i=0; i<2; i++) { | 425 | for(i=0; i<2; i++) { |
424 | if(chip->analog_playback_active[i] != ucontrol->value.integer.value[i]) { | 426 | if(chip->analog_playback_active[i] != ucontrol->value.integer.value[i]) { |
425 | chip->analog_playback_active[i] = ucontrol->value.integer.value[i]; | 427 | chip->analog_playback_active[i] = ucontrol->value.integer.value[i]; |
@@ -427,7 +429,7 @@ static int mixart_audio_sw_put(struct snd_kcontrol *kcontrol, struct snd_ctl_ele | |||
427 | } | 429 | } |
428 | } | 430 | } |
429 | if(changed) mixart_update_analog_audio_level(chip, 0); /* update playback levels */ | 431 | if(changed) mixart_update_analog_audio_level(chip, 0); /* update playback levels */ |
430 | up(&chip->mgr->mixer_mutex); | 432 | mutex_unlock(&chip->mgr->mixer_mutex); |
431 | return changed; | 433 | return changed; |
432 | } | 434 | } |
433 | 435 | ||
@@ -817,7 +819,7 @@ static int mixart_pcm_vol_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem | |||
817 | int *stored_volume; | 819 | int *stored_volume; |
818 | int is_capture = kcontrol->private_value & MIXART_VOL_REC_MASK; | 820 | int is_capture = kcontrol->private_value & MIXART_VOL_REC_MASK; |
819 | int is_aes = kcontrol->private_value & MIXART_VOL_AES_MASK; | 821 | int is_aes = kcontrol->private_value & MIXART_VOL_AES_MASK; |
820 | down(&chip->mgr->mixer_mutex); | 822 | mutex_lock(&chip->mgr->mixer_mutex); |
821 | if(is_capture) { | 823 | if(is_capture) { |
822 | if(is_aes) stored_volume = chip->digital_capture_volume[1]; /* AES capture */ | 824 | if(is_aes) stored_volume = chip->digital_capture_volume[1]; /* AES capture */ |
823 | else stored_volume = chip->digital_capture_volume[0]; /* analog capture */ | 825 | else stored_volume = chip->digital_capture_volume[0]; /* analog capture */ |
@@ -828,7 +830,7 @@ static int mixart_pcm_vol_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem | |||
828 | } | 830 | } |
829 | ucontrol->value.integer.value[0] = stored_volume[0]; | 831 | ucontrol->value.integer.value[0] = stored_volume[0]; |
830 | ucontrol->value.integer.value[1] = stored_volume[1]; | 832 | ucontrol->value.integer.value[1] = stored_volume[1]; |
831 | up(&chip->mgr->mixer_mutex); | 833 | mutex_unlock(&chip->mgr->mixer_mutex); |
832 | return 0; | 834 | return 0; |
833 | } | 835 | } |
834 | 836 | ||
@@ -841,7 +843,7 @@ static int mixart_pcm_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem | |||
841 | int is_aes = kcontrol->private_value & MIXART_VOL_AES_MASK; | 843 | int is_aes = kcontrol->private_value & MIXART_VOL_AES_MASK; |
842 | int* stored_volume; | 844 | int* stored_volume; |
843 | int i; | 845 | int i; |
844 | down(&chip->mgr->mixer_mutex); | 846 | mutex_lock(&chip->mgr->mixer_mutex); |
845 | if(is_capture) { | 847 | if(is_capture) { |
846 | if(is_aes) stored_volume = chip->digital_capture_volume[1]; /* AES capture */ | 848 | if(is_aes) stored_volume = chip->digital_capture_volume[1]; /* AES capture */ |
847 | else stored_volume = chip->digital_capture_volume[0]; /* analog capture */ | 849 | else stored_volume = chip->digital_capture_volume[0]; /* analog capture */ |
@@ -860,7 +862,7 @@ static int mixart_pcm_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem | |||
860 | if(is_capture) mixart_update_capture_stream_level(chip, is_aes); | 862 | if(is_capture) mixart_update_capture_stream_level(chip, is_aes); |
861 | else mixart_update_playback_stream_level(chip, is_aes, idx); | 863 | else mixart_update_playback_stream_level(chip, is_aes, idx); |
862 | } | 864 | } |
863 | up(&chip->mgr->mixer_mutex); | 865 | mutex_unlock(&chip->mgr->mixer_mutex); |
864 | return changed; | 866 | return changed; |
865 | } | 867 | } |
866 | 868 | ||
@@ -880,12 +882,12 @@ static int mixart_pcm_sw_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_ | |||
880 | struct snd_mixart *chip = snd_kcontrol_chip(kcontrol); | 882 | struct snd_mixart *chip = snd_kcontrol_chip(kcontrol); |
881 | int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); /* index */ | 883 | int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); /* index */ |
882 | snd_assert ( idx < MIXART_PLAYBACK_STREAMS ); | 884 | snd_assert ( idx < MIXART_PLAYBACK_STREAMS ); |
883 | down(&chip->mgr->mixer_mutex); | 885 | mutex_lock(&chip->mgr->mixer_mutex); |
884 | if(kcontrol->private_value & MIXART_VOL_AES_MASK) /* AES playback */ | 886 | if(kcontrol->private_value & MIXART_VOL_AES_MASK) /* AES playback */ |
885 | idx += MIXART_PLAYBACK_STREAMS; | 887 | idx += MIXART_PLAYBACK_STREAMS; |
886 | ucontrol->value.integer.value[0] = chip->digital_playback_active[idx][0]; | 888 | ucontrol->value.integer.value[0] = chip->digital_playback_active[idx][0]; |
887 | ucontrol->value.integer.value[1] = chip->digital_playback_active[idx][1]; | 889 | ucontrol->value.integer.value[1] = chip->digital_playback_active[idx][1]; |
888 | up(&chip->mgr->mixer_mutex); | 890 | mutex_unlock(&chip->mgr->mixer_mutex); |
889 | return 0; | 891 | return 0; |
890 | } | 892 | } |
891 | 893 | ||
@@ -897,7 +899,7 @@ static int mixart_pcm_sw_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_ | |||
897 | int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); /* index */ | 899 | int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); /* index */ |
898 | int i, j; | 900 | int i, j; |
899 | snd_assert ( idx < MIXART_PLAYBACK_STREAMS ); | 901 | snd_assert ( idx < MIXART_PLAYBACK_STREAMS ); |
900 | down(&chip->mgr->mixer_mutex); | 902 | mutex_lock(&chip->mgr->mixer_mutex); |
901 | j = idx; | 903 | j = idx; |
902 | if(is_aes) j += MIXART_PLAYBACK_STREAMS; | 904 | if(is_aes) j += MIXART_PLAYBACK_STREAMS; |
903 | for(i=0; i<2; i++) { | 905 | for(i=0; i<2; i++) { |
@@ -907,7 +909,7 @@ static int mixart_pcm_sw_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_ | |||
907 | } | 909 | } |
908 | } | 910 | } |
909 | if(changed) mixart_update_playback_stream_level(chip, is_aes, idx); | 911 | if(changed) mixart_update_playback_stream_level(chip, is_aes, idx); |
910 | up(&chip->mgr->mixer_mutex); | 912 | mutex_unlock(&chip->mgr->mixer_mutex); |
911 | return changed; | 913 | return changed; |
912 | } | 914 | } |
913 | 915 | ||
@@ -956,10 +958,10 @@ static int mixart_update_monitoring(struct snd_mixart* chip, int channel) | |||
956 | static int mixart_monitor_vol_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 958 | static int mixart_monitor_vol_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
957 | { | 959 | { |
958 | struct snd_mixart *chip = snd_kcontrol_chip(kcontrol); | 960 | struct snd_mixart *chip = snd_kcontrol_chip(kcontrol); |
959 | down(&chip->mgr->mixer_mutex); | 961 | mutex_lock(&chip->mgr->mixer_mutex); |
960 | ucontrol->value.integer.value[0] = chip->monitoring_volume[0]; | 962 | ucontrol->value.integer.value[0] = chip->monitoring_volume[0]; |
961 | ucontrol->value.integer.value[1] = chip->monitoring_volume[1]; | 963 | ucontrol->value.integer.value[1] = chip->monitoring_volume[1]; |
962 | up(&chip->mgr->mixer_mutex); | 964 | mutex_unlock(&chip->mgr->mixer_mutex); |
963 | return 0; | 965 | return 0; |
964 | } | 966 | } |
965 | 967 | ||
@@ -968,7 +970,7 @@ static int mixart_monitor_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_ | |||
968 | struct snd_mixart *chip = snd_kcontrol_chip(kcontrol); | 970 | struct snd_mixart *chip = snd_kcontrol_chip(kcontrol); |
969 | int changed = 0; | 971 | int changed = 0; |
970 | int i; | 972 | int i; |
971 | down(&chip->mgr->mixer_mutex); | 973 | mutex_lock(&chip->mgr->mixer_mutex); |
972 | for(i=0; i<2; i++) { | 974 | for(i=0; i<2; i++) { |
973 | if(chip->monitoring_volume[i] != ucontrol->value.integer.value[i]) { | 975 | if(chip->monitoring_volume[i] != ucontrol->value.integer.value[i]) { |
974 | chip->monitoring_volume[i] = ucontrol->value.integer.value[i]; | 976 | chip->monitoring_volume[i] = ucontrol->value.integer.value[i]; |
@@ -976,7 +978,7 @@ static int mixart_monitor_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_ | |||
976 | changed = 1; | 978 | changed = 1; |
977 | } | 979 | } |
978 | } | 980 | } |
979 | up(&chip->mgr->mixer_mutex); | 981 | mutex_unlock(&chip->mgr->mixer_mutex); |
980 | return changed; | 982 | return changed; |
981 | } | 983 | } |
982 | 984 | ||
@@ -995,10 +997,10 @@ static struct snd_kcontrol_new mixart_control_monitor_vol = { | |||
995 | static int mixart_monitor_sw_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 997 | static int mixart_monitor_sw_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
996 | { | 998 | { |
997 | struct snd_mixart *chip = snd_kcontrol_chip(kcontrol); | 999 | struct snd_mixart *chip = snd_kcontrol_chip(kcontrol); |
998 | down(&chip->mgr->mixer_mutex); | 1000 | mutex_lock(&chip->mgr->mixer_mutex); |
999 | ucontrol->value.integer.value[0] = chip->monitoring_active[0]; | 1001 | ucontrol->value.integer.value[0] = chip->monitoring_active[0]; |
1000 | ucontrol->value.integer.value[1] = chip->monitoring_active[1]; | 1002 | ucontrol->value.integer.value[1] = chip->monitoring_active[1]; |
1001 | up(&chip->mgr->mixer_mutex); | 1003 | mutex_unlock(&chip->mgr->mixer_mutex); |
1002 | return 0; | 1004 | return 0; |
1003 | } | 1005 | } |
1004 | 1006 | ||
@@ -1007,7 +1009,7 @@ static int mixart_monitor_sw_put(struct snd_kcontrol *kcontrol, struct snd_ctl_e | |||
1007 | struct snd_mixart *chip = snd_kcontrol_chip(kcontrol); | 1009 | struct snd_mixart *chip = snd_kcontrol_chip(kcontrol); |
1008 | int changed = 0; | 1010 | int changed = 0; |
1009 | int i; | 1011 | int i; |
1010 | down(&chip->mgr->mixer_mutex); | 1012 | mutex_lock(&chip->mgr->mixer_mutex); |
1011 | for(i=0; i<2; i++) { | 1013 | for(i=0; i<2; i++) { |
1012 | if(chip->monitoring_active[i] != ucontrol->value.integer.value[i]) { | 1014 | if(chip->monitoring_active[i] != ucontrol->value.integer.value[i]) { |
1013 | chip->monitoring_active[i] = ucontrol->value.integer.value[i]; | 1015 | chip->monitoring_active[i] = ucontrol->value.integer.value[i]; |
@@ -1029,7 +1031,7 @@ static int mixart_monitor_sw_put(struct snd_kcontrol *kcontrol, struct snd_ctl_e | |||
1029 | } | 1031 | } |
1030 | } | 1032 | } |
1031 | 1033 | ||
1032 | up(&chip->mgr->mixer_mutex); | 1034 | mutex_unlock(&chip->mgr->mixer_mutex); |
1033 | return (changed != 0); | 1035 | return (changed != 0); |
1034 | } | 1036 | } |
1035 | 1037 | ||
@@ -1059,7 +1061,7 @@ int snd_mixart_create_mixer(struct mixart_mgr *mgr) | |||
1059 | struct snd_mixart *chip; | 1061 | struct snd_mixart *chip; |
1060 | int err, i; | 1062 | int err, i; |
1061 | 1063 | ||
1062 | init_MUTEX(&mgr->mixer_mutex); /* can be in another place */ | 1064 | mutex_init(&mgr->mixer_mutex); /* can be in another place */ |
1063 | 1065 | ||
1064 | for(i=0; i<mgr->num_cards; i++) { | 1066 | for(i=0; i<mgr->num_cards; i++) { |
1065 | struct snd_kcontrol_new temp; | 1067 | struct snd_kcontrol_new temp; |