diff options
Diffstat (limited to 'sound/pci/mixart')
-rw-r--r-- | sound/pci/mixart/mixart.c | 21 | ||||
-rw-r--r-- | sound/pci/mixart/mixart.h | 7 | ||||
-rw-r--r-- | sound/pci/mixart/mixart_core.c | 18 | ||||
-rw-r--r-- | sound/pci/mixart/mixart_mixer.c | 52 |
4 files changed, 52 insertions, 46 deletions
diff --git a/sound/pci/mixart/mixart.c b/sound/pci/mixart/mixart.c index b218e1d20c78..e79fb264532b 100644 --- a/sound/pci/mixart/mixart.c +++ b/sound/pci/mixart/mixart.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/interrupt.h> | 26 | #include <linux/interrupt.h> |
27 | #include <linux/pci.h> | 27 | #include <linux/pci.h> |
28 | #include <linux/moduleparam.h> | 28 | #include <linux/moduleparam.h> |
29 | #include <linux/mutex.h> | ||
29 | #include <sound/core.h> | 30 | #include <sound/core.h> |
30 | #include <sound/initval.h> | 31 | #include <sound/initval.h> |
31 | #include <sound/info.h> | 32 | #include <sound/info.h> |
@@ -589,7 +590,7 @@ static int snd_mixart_hw_params(struct snd_pcm_substream *subs, | |||
589 | /* set up format for the stream */ | 590 | /* set up format for the stream */ |
590 | format = params_format(hw); | 591 | format = params_format(hw); |
591 | 592 | ||
592 | down(&mgr->setup_mutex); | 593 | mutex_lock(&mgr->setup_mutex); |
593 | 594 | ||
594 | /* update the stream levels */ | 595 | /* update the stream levels */ |
595 | if( stream->pcm_number <= MIXART_PCM_DIGITAL ) { | 596 | if( stream->pcm_number <= MIXART_PCM_DIGITAL ) { |
@@ -628,7 +629,7 @@ static int snd_mixart_hw_params(struct snd_pcm_substream *subs, | |||
628 | bufferinfo[i].available_length, | 629 | bufferinfo[i].available_length, |
629 | subs->number); | 630 | subs->number); |
630 | } | 631 | } |
631 | up(&mgr->setup_mutex); | 632 | mutex_unlock(&mgr->setup_mutex); |
632 | 633 | ||
633 | return err; | 634 | return err; |
634 | } | 635 | } |
@@ -700,7 +701,7 @@ static int snd_mixart_playback_open(struct snd_pcm_substream *subs) | |||
700 | int err = 0; | 701 | int err = 0; |
701 | int pcm_number; | 702 | int pcm_number; |
702 | 703 | ||
703 | down(&mgr->setup_mutex); | 704 | mutex_lock(&mgr->setup_mutex); |
704 | 705 | ||
705 | if ( pcm == chip->pcm ) { | 706 | if ( pcm == chip->pcm ) { |
706 | pcm_number = MIXART_PCM_ANALOG; | 707 | pcm_number = MIXART_PCM_ANALOG; |
@@ -758,7 +759,7 @@ static int snd_mixart_playback_open(struct snd_pcm_substream *subs) | |||
758 | } | 759 | } |
759 | 760 | ||
760 | _exit_open: | 761 | _exit_open: |
761 | up(&mgr->setup_mutex); | 762 | mutex_unlock(&mgr->setup_mutex); |
762 | 763 | ||
763 | return err; | 764 | return err; |
764 | } | 765 | } |
@@ -775,7 +776,7 @@ static int snd_mixart_capture_open(struct snd_pcm_substream *subs) | |||
775 | int err = 0; | 776 | int err = 0; |
776 | int pcm_number; | 777 | int pcm_number; |
777 | 778 | ||
778 | down(&mgr->setup_mutex); | 779 | mutex_lock(&mgr->setup_mutex); |
779 | 780 | ||
780 | if ( pcm == chip->pcm ) { | 781 | if ( pcm == chip->pcm ) { |
781 | pcm_number = MIXART_PCM_ANALOG; | 782 | pcm_number = MIXART_PCM_ANALOG; |
@@ -836,7 +837,7 @@ static int snd_mixart_capture_open(struct snd_pcm_substream *subs) | |||
836 | } | 837 | } |
837 | 838 | ||
838 | _exit_open: | 839 | _exit_open: |
839 | up(&mgr->setup_mutex); | 840 | mutex_unlock(&mgr->setup_mutex); |
840 | 841 | ||
841 | return err; | 842 | return err; |
842 | } | 843 | } |
@@ -849,7 +850,7 @@ static int snd_mixart_close(struct snd_pcm_substream *subs) | |||
849 | struct mixart_mgr *mgr = chip->mgr; | 850 | struct mixart_mgr *mgr = chip->mgr; |
850 | struct mixart_stream *stream = subs->runtime->private_data; | 851 | struct mixart_stream *stream = subs->runtime->private_data; |
851 | 852 | ||
852 | down(&mgr->setup_mutex); | 853 | mutex_lock(&mgr->setup_mutex); |
853 | 854 | ||
854 | snd_printdd("snd_mixart_close C%d/P%d/Sub%d\n", chip->chip_idx, stream->pcm_number, subs->number); | 855 | snd_printdd("snd_mixart_close C%d/P%d/Sub%d\n", chip->chip_idx, stream->pcm_number, subs->number); |
855 | 856 | ||
@@ -868,7 +869,7 @@ static int snd_mixart_close(struct snd_pcm_substream *subs) | |||
868 | stream->status = MIXART_STREAM_STATUS_FREE; | 869 | stream->status = MIXART_STREAM_STATUS_FREE; |
869 | stream->substream = NULL; | 870 | stream->substream = NULL; |
870 | 871 | ||
871 | up(&mgr->setup_mutex); | 872 | mutex_unlock(&mgr->setup_mutex); |
872 | return 0; | 873 | return 0; |
873 | } | 874 | } |
874 | 875 | ||
@@ -1335,12 +1336,12 @@ static int __devinit snd_mixart_probe(struct pci_dev *pci, | |||
1335 | mgr->msg_fifo_writeptr = 0; | 1336 | mgr->msg_fifo_writeptr = 0; |
1336 | 1337 | ||
1337 | spin_lock_init(&mgr->msg_lock); | 1338 | spin_lock_init(&mgr->msg_lock); |
1338 | init_MUTEX(&mgr->msg_mutex); | 1339 | mutex_init(&mgr->msg_mutex); |
1339 | init_waitqueue_head(&mgr->msg_sleep); | 1340 | init_waitqueue_head(&mgr->msg_sleep); |
1340 | atomic_set(&mgr->msg_processed, 0); | 1341 | atomic_set(&mgr->msg_processed, 0); |
1341 | 1342 | ||
1342 | /* init setup mutex*/ | 1343 | /* init setup mutex*/ |
1343 | init_MUTEX(&mgr->setup_mutex); | 1344 | mutex_init(&mgr->setup_mutex); |
1344 | 1345 | ||
1345 | /* init message taslket */ | 1346 | /* init message taslket */ |
1346 | tasklet_init(&mgr->msg_taskq, snd_mixart_msg_tasklet, (unsigned long) mgr); | 1347 | tasklet_init(&mgr->msg_taskq, snd_mixart_msg_tasklet, (unsigned long) mgr); |
diff --git a/sound/pci/mixart/mixart.h b/sound/pci/mixart/mixart.h index 3e84863ca02c..561634d5c007 100644 --- a/sound/pci/mixart/mixart.h +++ b/sound/pci/mixart/mixart.h | |||
@@ -24,6 +24,7 @@ | |||
24 | #define __SOUND_MIXART_H | 24 | #define __SOUND_MIXART_H |
25 | 25 | ||
26 | #include <linux/interrupt.h> | 26 | #include <linux/interrupt.h> |
27 | #include <linux/mutex.h> | ||
27 | #include <sound/pcm.h> | 28 | #include <sound/pcm.h> |
28 | 29 | ||
29 | #define MIXART_DRIVER_VERSION 0x000100 /* 0.1.0 */ | 30 | #define MIXART_DRIVER_VERSION 0x000100 /* 0.1.0 */ |
@@ -92,9 +93,9 @@ struct mixart_mgr { | |||
92 | 93 | ||
93 | spinlock_t lock; /* interrupt spinlock */ | 94 | spinlock_t lock; /* interrupt spinlock */ |
94 | spinlock_t msg_lock; /* mailbox spinlock */ | 95 | spinlock_t msg_lock; /* mailbox spinlock */ |
95 | struct semaphore msg_mutex; /* mutex for blocking_requests */ | 96 | struct mutex msg_mutex; /* mutex for blocking_requests */ |
96 | 97 | ||
97 | struct semaphore setup_mutex; /* mutex used in hw_params, open and close */ | 98 | struct mutex setup_mutex; /* mutex used in hw_params, open and close */ |
98 | 99 | ||
99 | /* hardware interface */ | 100 | /* hardware interface */ |
100 | unsigned int dsp_loaded; /* bit flags of loaded dsp indices */ | 101 | unsigned int dsp_loaded; /* bit flags of loaded dsp indices */ |
@@ -107,7 +108,7 @@ struct mixart_mgr { | |||
107 | int sample_rate; | 108 | int sample_rate; |
108 | int ref_count_rate; | 109 | int ref_count_rate; |
109 | 110 | ||
110 | struct semaphore mixer_mutex; /* mutex for mixer */ | 111 | struct mutex mixer_mutex; /* mutex for mixer */ |
111 | 112 | ||
112 | }; | 113 | }; |
113 | 114 | ||
diff --git a/sound/pci/mixart/mixart_core.c b/sound/pci/mixart/mixart_core.c index 07c707d7ebbf..406ac3a9d42a 100644 --- a/sound/pci/mixart/mixart_core.c +++ b/sound/pci/mixart/mixart_core.c | |||
@@ -22,6 +22,8 @@ | |||
22 | 22 | ||
23 | #include <sound/driver.h> | 23 | #include <sound/driver.h> |
24 | #include <linux/interrupt.h> | 24 | #include <linux/interrupt.h> |
25 | #include <linux/mutex.h> | ||
26 | |||
25 | #include <asm/io.h> | 27 | #include <asm/io.h> |
26 | #include <sound/core.h> | 28 | #include <sound/core.h> |
27 | #include "mixart.h" | 29 | #include "mixart.h" |
@@ -239,7 +241,7 @@ int snd_mixart_send_msg(struct mixart_mgr *mgr, struct mixart_msg *request, int | |||
239 | wait_queue_t wait; | 241 | wait_queue_t wait; |
240 | long timeout; | 242 | long timeout; |
241 | 243 | ||
242 | down(&mgr->msg_mutex); | 244 | mutex_lock(&mgr->msg_mutex); |
243 | 245 | ||
244 | init_waitqueue_entry(&wait, current); | 246 | init_waitqueue_entry(&wait, current); |
245 | 247 | ||
@@ -248,7 +250,7 @@ int snd_mixart_send_msg(struct mixart_mgr *mgr, struct mixart_msg *request, int | |||
248 | err = send_msg(mgr, request, max_resp_size, 1, &msg_frame); /* send and mark the answer pending */ | 250 | err = send_msg(mgr, request, max_resp_size, 1, &msg_frame); /* send and mark the answer pending */ |
249 | if (err) { | 251 | if (err) { |
250 | spin_unlock_irq(&mgr->msg_lock); | 252 | spin_unlock_irq(&mgr->msg_lock); |
251 | up(&mgr->msg_mutex); | 253 | mutex_unlock(&mgr->msg_mutex); |
252 | return err; | 254 | return err; |
253 | } | 255 | } |
254 | 256 | ||
@@ -260,7 +262,7 @@ int snd_mixart_send_msg(struct mixart_mgr *mgr, struct mixart_msg *request, int | |||
260 | 262 | ||
261 | if (! timeout) { | 263 | if (! timeout) { |
262 | /* error - no ack */ | 264 | /* error - no ack */ |
263 | up(&mgr->msg_mutex); | 265 | mutex_unlock(&mgr->msg_mutex); |
264 | snd_printk(KERN_ERR "error: no reponse on msg %x\n", msg_frame); | 266 | snd_printk(KERN_ERR "error: no reponse on msg %x\n", msg_frame); |
265 | return -EIO; | 267 | return -EIO; |
266 | } | 268 | } |
@@ -276,7 +278,7 @@ int snd_mixart_send_msg(struct mixart_mgr *mgr, struct mixart_msg *request, int | |||
276 | if( request->message_id != resp.message_id ) | 278 | if( request->message_id != resp.message_id ) |
277 | snd_printk(KERN_ERR "REPONSE ERROR!\n"); | 279 | snd_printk(KERN_ERR "REPONSE ERROR!\n"); |
278 | 280 | ||
279 | up(&mgr->msg_mutex); | 281 | mutex_unlock(&mgr->msg_mutex); |
280 | return err; | 282 | return err; |
281 | } | 283 | } |
282 | 284 | ||
@@ -292,7 +294,7 @@ int snd_mixart_send_msg_wait_notif(struct mixart_mgr *mgr, | |||
292 | snd_assert((notif_event & MSG_TYPE_MASK) == MSG_TYPE_NOTIFY, return -EINVAL); | 294 | snd_assert((notif_event & MSG_TYPE_MASK) == MSG_TYPE_NOTIFY, return -EINVAL); |
293 | snd_assert((notif_event & MSG_CANCEL_NOTIFY_MASK) == 0, return -EINVAL); | 295 | snd_assert((notif_event & MSG_CANCEL_NOTIFY_MASK) == 0, return -EINVAL); |
294 | 296 | ||
295 | down(&mgr->msg_mutex); | 297 | mutex_lock(&mgr->msg_mutex); |
296 | 298 | ||
297 | init_waitqueue_entry(&wait, current); | 299 | init_waitqueue_entry(&wait, current); |
298 | 300 | ||
@@ -301,7 +303,7 @@ int snd_mixart_send_msg_wait_notif(struct mixart_mgr *mgr, | |||
301 | err = send_msg(mgr, request, MSG_DEFAULT_SIZE, 1, ¬if_event); /* send and mark the notification event pending */ | 303 | err = send_msg(mgr, request, MSG_DEFAULT_SIZE, 1, ¬if_event); /* send and mark the notification event pending */ |
302 | if(err) { | 304 | if(err) { |
303 | spin_unlock_irq(&mgr->msg_lock); | 305 | spin_unlock_irq(&mgr->msg_lock); |
304 | up(&mgr->msg_mutex); | 306 | mutex_unlock(&mgr->msg_mutex); |
305 | return err; | 307 | return err; |
306 | } | 308 | } |
307 | 309 | ||
@@ -313,12 +315,12 @@ int snd_mixart_send_msg_wait_notif(struct mixart_mgr *mgr, | |||
313 | 315 | ||
314 | if (! timeout) { | 316 | if (! timeout) { |
315 | /* error - no ack */ | 317 | /* error - no ack */ |
316 | up(&mgr->msg_mutex); | 318 | mutex_unlock(&mgr->msg_mutex); |
317 | snd_printk(KERN_ERR "error: notification %x not received\n", notif_event); | 319 | snd_printk(KERN_ERR "error: notification %x not received\n", notif_event); |
318 | return -EIO; | 320 | return -EIO; |
319 | } | 321 | } |
320 | 322 | ||
321 | up(&mgr->msg_mutex); | 323 | mutex_unlock(&mgr->msg_mutex); |
322 | return 0; | 324 | return 0; |
323 | } | 325 | } |
324 | 326 | ||
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; |