#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"
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];
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;
}
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];
}
}
if(changed) mixart_update_analog_audio_level(chip, is_capture);
- mutex_unlock(&chip->mgr->mixer_mutex);
+ up(&chip->mgr->mixer_mutex);
return changed;
}
{
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;
}
{
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];
}
}
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;
}
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 */
}
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;
}
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 */
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;
}
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;
}
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++) {
}
}
if(changed) mixart_update_playback_stream_level(chip, is_aes, idx);
- mutex_unlock(&chip->mgr->mixer_mutex);
+ up(&chip->mgr->mixer_mutex);
return changed;
}
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;
}
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];
changed = 1;
}
}
- mutex_unlock(&chip->mgr->mixer_mutex);
+ up(&chip->mgr->mixer_mutex);
return changed;
}
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;
}
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];
}
}
- mutex_unlock(&chip->mgr->mixer_mutex);
+ up(&chip->mgr->mixer_mutex);
return (changed != 0);
}
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;