linux 2.6.16.38 w/ vs2.0.3-rc1
[linux-2.6.git] / sound / pci / mixart / mixart_mixer.c
index ed47b73..36a7e9d 100644 (file)
@@ -24,8 +24,6 @@
 #include <linux/time.h>
 #include <linux/interrupt.h>
 #include <linux/init.h>
-#include <linux/mutex.h>
-
 #include <sound/core.h>
 #include "mixart.h"
 #include "mixart_core.h"
@@ -355,7 +353,7 @@ static int mixart_analog_vol_info(struct snd_kcontrol *kcontrol, struct snd_ctl_
 static int mixart_analog_vol_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 {
        struct snd_mixart *chip = snd_kcontrol_chip(kcontrol);
-       mutex_lock(&chip->mgr->mixer_mutex);
+       down(&chip->mgr->mixer_mutex);
        if(kcontrol->private_value == 0) {      /* playback */
                ucontrol->value.integer.value[0] = chip->analog_playback_volume[0];
                ucontrol->value.integer.value[1] = chip->analog_playback_volume[1];
@@ -363,7 +361,7 @@ static int mixart_analog_vol_get(struct snd_kcontrol *kcontrol, struct snd_ctl_e
                ucontrol->value.integer.value[0] = chip->analog_capture_volume[0];
                ucontrol->value.integer.value[1] = chip->analog_capture_volume[1];
        }
-       mutex_unlock(&chip->mgr->mixer_mutex);
+       up(&chip->mgr->mixer_mutex);
        return 0;
 }
 
@@ -373,7 +371,7 @@ static int mixart_analog_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_e
        int changed = 0;
        int is_capture, i;
 
-       mutex_lock(&chip->mgr->mixer_mutex);
+       down(&chip->mgr->mixer_mutex);
        is_capture = (kcontrol->private_value != 0);
        for(i=0; i<2; i++) {
                int  new_volume = ucontrol->value.integer.value[i];
@@ -384,7 +382,7 @@ static int mixart_analog_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_e
                }
        }
        if(changed)     mixart_update_analog_audio_level(chip, is_capture);
-       mutex_unlock(&chip->mgr->mixer_mutex);
+       up(&chip->mgr->mixer_mutex);
        return changed;
 }
 
@@ -410,10 +408,10 @@ static int mixart_audio_sw_get(struct snd_kcontrol *kcontrol, struct snd_ctl_ele
 {
        struct snd_mixart *chip = snd_kcontrol_chip(kcontrol);
 
-       mutex_lock(&chip->mgr->mixer_mutex);
+       down(&chip->mgr->mixer_mutex);
        ucontrol->value.integer.value[0] = chip->analog_playback_active[0];
        ucontrol->value.integer.value[1] = chip->analog_playback_active[1];
-       mutex_unlock(&chip->mgr->mixer_mutex);
+       up(&chip->mgr->mixer_mutex);
        return 0;
 }
 
@@ -421,7 +419,7 @@ static int mixart_audio_sw_put(struct snd_kcontrol *kcontrol, struct snd_ctl_ele
 {
        struct snd_mixart *chip = snd_kcontrol_chip(kcontrol);
        int i, changed = 0;
-       mutex_lock(&chip->mgr->mixer_mutex);
+       down(&chip->mgr->mixer_mutex);
        for(i=0; i<2; i++) {
                if(chip->analog_playback_active[i] != ucontrol->value.integer.value[i]) {
                        chip->analog_playback_active[i] = ucontrol->value.integer.value[i];
@@ -429,7 +427,7 @@ static int mixart_audio_sw_put(struct snd_kcontrol *kcontrol, struct snd_ctl_ele
                }
        }
        if(changed)     mixart_update_analog_audio_level(chip, 0); /* update playback levels */
-       mutex_unlock(&chip->mgr->mixer_mutex);
+       up(&chip->mgr->mixer_mutex);
        return changed;
 }
 
@@ -819,7 +817,7 @@ static int mixart_pcm_vol_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem
        int *stored_volume;
        int is_capture = kcontrol->private_value & MIXART_VOL_REC_MASK;
        int is_aes = kcontrol->private_value & MIXART_VOL_AES_MASK;
-       mutex_lock(&chip->mgr->mixer_mutex);
+       down(&chip->mgr->mixer_mutex);
        if(is_capture) {
                if(is_aes)      stored_volume = chip->digital_capture_volume[1];        /* AES capture */
                else            stored_volume = chip->digital_capture_volume[0];        /* analog capture */
@@ -830,7 +828,7 @@ static int mixart_pcm_vol_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem
        }
        ucontrol->value.integer.value[0] = stored_volume[0];
        ucontrol->value.integer.value[1] = stored_volume[1];
-       mutex_unlock(&chip->mgr->mixer_mutex);
+       up(&chip->mgr->mixer_mutex);
        return 0;
 }
 
@@ -843,7 +841,7 @@ static int mixart_pcm_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem
        int is_aes = kcontrol->private_value & MIXART_VOL_AES_MASK;
        int* stored_volume;
        int i;
-       mutex_lock(&chip->mgr->mixer_mutex);
+       down(&chip->mgr->mixer_mutex);
        if(is_capture) {
                if(is_aes)      stored_volume = chip->digital_capture_volume[1];        /* AES capture */
                else            stored_volume = chip->digital_capture_volume[0];        /* analog capture */
@@ -862,7 +860,7 @@ static int mixart_pcm_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem
                if(is_capture)  mixart_update_capture_stream_level(chip, is_aes);
                else            mixart_update_playback_stream_level(chip, is_aes, idx);
        }
-       mutex_unlock(&chip->mgr->mixer_mutex);
+       up(&chip->mgr->mixer_mutex);
        return changed;
 }
 
@@ -882,12 +880,12 @@ static int mixart_pcm_sw_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_
        struct snd_mixart *chip = snd_kcontrol_chip(kcontrol);
        int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); /* index */
        snd_assert ( idx < MIXART_PLAYBACK_STREAMS ); 
-       mutex_lock(&chip->mgr->mixer_mutex);
+       down(&chip->mgr->mixer_mutex);
        if(kcontrol->private_value & MIXART_VOL_AES_MASK)       /* AES playback */
                idx += MIXART_PLAYBACK_STREAMS;
        ucontrol->value.integer.value[0] = chip->digital_playback_active[idx][0];
        ucontrol->value.integer.value[1] = chip->digital_playback_active[idx][1];
-       mutex_unlock(&chip->mgr->mixer_mutex);
+       up(&chip->mgr->mixer_mutex);
        return 0;
 }
 
@@ -899,7 +897,7 @@ static int mixart_pcm_sw_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_
        int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); /* index */
        int i, j;
        snd_assert ( idx < MIXART_PLAYBACK_STREAMS ); 
-       mutex_lock(&chip->mgr->mixer_mutex);
+       down(&chip->mgr->mixer_mutex);
        j = idx;
        if(is_aes)      j += MIXART_PLAYBACK_STREAMS;
        for(i=0; i<2; i++) {
@@ -909,7 +907,7 @@ static int mixart_pcm_sw_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_
                }
        }
        if(changed)     mixart_update_playback_stream_level(chip, is_aes, idx);
-       mutex_unlock(&chip->mgr->mixer_mutex);
+       up(&chip->mgr->mixer_mutex);
        return changed;
 }
 
@@ -958,10 +956,10 @@ static int mixart_update_monitoring(struct snd_mixart* chip, int channel)
 static int mixart_monitor_vol_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 {
        struct snd_mixart *chip = snd_kcontrol_chip(kcontrol);
-       mutex_lock(&chip->mgr->mixer_mutex);
+       down(&chip->mgr->mixer_mutex);
        ucontrol->value.integer.value[0] = chip->monitoring_volume[0];
        ucontrol->value.integer.value[1] = chip->monitoring_volume[1];
-       mutex_unlock(&chip->mgr->mixer_mutex);
+       up(&chip->mgr->mixer_mutex);
        return 0;
 }
 
@@ -970,7 +968,7 @@ static int mixart_monitor_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_
        struct snd_mixart *chip = snd_kcontrol_chip(kcontrol);
        int changed = 0;
        int i;
-       mutex_lock(&chip->mgr->mixer_mutex);
+       down(&chip->mgr->mixer_mutex);
        for(i=0; i<2; i++) {
                if(chip->monitoring_volume[i] != ucontrol->value.integer.value[i]) {
                        chip->monitoring_volume[i] = ucontrol->value.integer.value[i];
@@ -978,7 +976,7 @@ static int mixart_monitor_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_
                        changed = 1;
                }
        }
-       mutex_unlock(&chip->mgr->mixer_mutex);
+       up(&chip->mgr->mixer_mutex);
        return changed;
 }
 
@@ -997,10 +995,10 @@ static struct snd_kcontrol_new mixart_control_monitor_vol = {
 static int mixart_monitor_sw_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 {
        struct snd_mixart *chip = snd_kcontrol_chip(kcontrol);
-       mutex_lock(&chip->mgr->mixer_mutex);
+       down(&chip->mgr->mixer_mutex);
        ucontrol->value.integer.value[0] = chip->monitoring_active[0];
        ucontrol->value.integer.value[1] = chip->monitoring_active[1];
-       mutex_unlock(&chip->mgr->mixer_mutex);
+       up(&chip->mgr->mixer_mutex);
        return 0;
 }
 
@@ -1009,7 +1007,7 @@ static int mixart_monitor_sw_put(struct snd_kcontrol *kcontrol, struct snd_ctl_e
        struct snd_mixart *chip = snd_kcontrol_chip(kcontrol);
        int changed = 0;
        int i;
-       mutex_lock(&chip->mgr->mixer_mutex);
+       down(&chip->mgr->mixer_mutex);
        for(i=0; i<2; i++) {
                if(chip->monitoring_active[i] != ucontrol->value.integer.value[i]) {
                        chip->monitoring_active[i] = ucontrol->value.integer.value[i];
@@ -1031,7 +1029,7 @@ static int mixart_monitor_sw_put(struct snd_kcontrol *kcontrol, struct snd_ctl_e
                }
        }
 
-       mutex_unlock(&chip->mgr->mixer_mutex);
+       up(&chip->mgr->mixer_mutex);
        return (changed != 0);
 }
 
@@ -1061,7 +1059,7 @@ int snd_mixart_create_mixer(struct mixart_mgr *mgr)
        struct snd_mixart *chip;
        int err, i;
 
-       mutex_init(&mgr->mixer_mutex); /* can be in another place */
+       init_MUTEX(&mgr->mixer_mutex); /* can be in another place */
 
        for(i=0; i<mgr->num_cards; i++) {
                struct snd_kcontrol_new temp;