aboutsummaryrefslogtreecommitdiff
path: root/sound/pci/mixart
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/mixart')
-rw-r--r--sound/pci/mixart/mixart.c24
-rw-r--r--sound/pci/mixart/mixart.h7
-rw-r--r--sound/pci/mixart/mixart_core.c18
-rw-r--r--sound/pci/mixart/mixart_mixer.c52
4 files changed, 54 insertions, 47 deletions
diff --git a/sound/pci/mixart/mixart.c b/sound/pci/mixart/mixart.c
index b218e1d20c7..43ee3b2b948 100644
--- a/sound/pci/mixart/mixart.c
+++ b/sound/pci/mixart/mixart.c
@@ -25,7 +25,9 @@
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/pci.h>
+#include <linux/dma-mapping.h>
#include <linux/moduleparam.h>
+#include <linux/mutex.h>
#include <sound/core.h>
#include <sound/initval.h>
#include <sound/info.h>
@@ -589,7 +591,7 @@ static int snd_mixart_hw_params(struct snd_pcm_substream *subs,
/* set up format for the stream */
format = params_format(hw);
- down(&mgr->setup_mutex);
+ mutex_lock(&mgr->setup_mutex);
/* update the stream levels */
if( stream->pcm_number <= MIXART_PCM_DIGITAL ) {
@@ -628,7 +630,7 @@ static int snd_mixart_hw_params(struct snd_pcm_substream *subs,
bufferinfo[i].available_length,
subs->number);
}
- up(&mgr->setup_mutex);
+ mutex_unlock(&mgr->setup_mutex);
return err;
}
@@ -700,7 +702,7 @@ static int snd_mixart_playback_open(struct snd_pcm_substream *subs)
int err = 0;
int pcm_number;
- down(&mgr->setup_mutex);
+ mutex_lock(&mgr->setup_mutex);
if ( pcm == chip->pcm ) {
pcm_number = MIXART_PCM_ANALOG;
@@ -758,7 +760,7 @@ static int snd_mixart_playback_open(struct snd_pcm_substream *subs)
}
_exit_open:
- up(&mgr->setup_mutex);
+ mutex_unlock(&mgr->setup_mutex);
return err;
}
@@ -775,7 +777,7 @@ static int snd_mixart_capture_open(struct snd_pcm_substream *subs)
int err = 0;
int pcm_number;
- down(&mgr->setup_mutex);
+ mutex_lock(&mgr->setup_mutex);
if ( pcm == chip->pcm ) {
pcm_number = MIXART_PCM_ANALOG;
@@ -836,7 +838,7 @@ static int snd_mixart_capture_open(struct snd_pcm_substream *subs)
}
_exit_open:
- up(&mgr->setup_mutex);
+ mutex_unlock(&mgr->setup_mutex);
return err;
}
@@ -849,7 +851,7 @@ static int snd_mixart_close(struct snd_pcm_substream *subs)
struct mixart_mgr *mgr = chip->mgr;
struct mixart_stream *stream = subs->runtime->private_data;
- down(&mgr->setup_mutex);
+ mutex_lock(&mgr->setup_mutex);
snd_printdd("snd_mixart_close C%d/P%d/Sub%d\n", chip->chip_idx, stream->pcm_number, subs->number);
@@ -868,7 +870,7 @@ static int snd_mixart_close(struct snd_pcm_substream *subs)
stream->status = MIXART_STREAM_STATUS_FREE;
stream->substream = NULL;
- up(&mgr->setup_mutex);
+ mutex_unlock(&mgr->setup_mutex);
return 0;
}
@@ -1288,7 +1290,7 @@ static int __devinit snd_mixart_probe(struct pci_dev *pci,
pci_set_master(pci);
/* check if we can restrict PCI DMA transfers to 32 bits */
- if (pci_set_dma_mask(pci, 0xffffffff) < 0) {
+ if (pci_set_dma_mask(pci, DMA_32BIT_MASK) < 0) {
snd_printk(KERN_ERR "architecture does not support 32bit PCI busmaster DMA\n");
pci_disable_device(pci);
return -ENXIO;
@@ -1335,12 +1337,12 @@ static int __devinit snd_mixart_probe(struct pci_dev *pci,
mgr->msg_fifo_writeptr = 0;
spin_lock_init(&mgr->msg_lock);
- init_MUTEX(&mgr->msg_mutex);
+ mutex_init(&mgr->msg_mutex);
init_waitqueue_head(&mgr->msg_sleep);
atomic_set(&mgr->msg_processed, 0);
/* init setup mutex*/
- init_MUTEX(&mgr->setup_mutex);
+ mutex_init(&mgr->setup_mutex);
/* init message taslket */
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 3e84863ca02..561634d5c00 100644
--- a/sound/pci/mixart/mixart.h
+++ b/sound/pci/mixart/mixart.h
@@ -24,6 +24,7 @@
#define __SOUND_MIXART_H
#include <linux/interrupt.h>
+#include <linux/mutex.h>
#include <sound/pcm.h>
#define MIXART_DRIVER_VERSION 0x000100 /* 0.1.0 */
@@ -92,9 +93,9 @@ struct mixart_mgr {
spinlock_t lock; /* interrupt spinlock */
spinlock_t msg_lock; /* mailbox spinlock */
- struct semaphore msg_mutex; /* mutex for blocking_requests */
+ struct mutex msg_mutex; /* mutex for blocking_requests */
- struct semaphore setup_mutex; /* mutex used in hw_params, open and close */
+ struct mutex setup_mutex; /* mutex used in hw_params, open and close */
/* hardware interface */
unsigned int dsp_loaded; /* bit flags of loaded dsp indices */
@@ -107,7 +108,7 @@ struct mixart_mgr {
int sample_rate;
int ref_count_rate;
- struct semaphore mixer_mutex; /* mutex for mixer */
+ struct mutex mixer_mutex; /* mutex for mixer */
};
diff --git a/sound/pci/mixart/mixart_core.c b/sound/pci/mixart/mixart_core.c
index 07c707d7ebb..406ac3a9d42 100644
--- a/sound/pci/mixart/mixart_core.c
+++ b/sound/pci/mixart/mixart_core.c
@@ -22,6 +22,8 @@
#include <sound/driver.h>
#include <linux/interrupt.h>
+#include <linux/mutex.h>
+
#include <asm/io.h>
#include <sound/core.h>
#include "mixart.h"
@@ -239,7 +241,7 @@ int snd_mixart_send_msg(struct mixart_mgr *mgr, struct mixart_msg *request, int
wait_queue_t wait;
long timeout;
- down(&mgr->msg_mutex);
+ mutex_lock(&mgr->msg_mutex);
init_waitqueue_entry(&wait, current);
@@ -248,7 +250,7 @@ int snd_mixart_send_msg(struct mixart_mgr *mgr, struct mixart_msg *request, int
err = send_msg(mgr, request, max_resp_size, 1, &msg_frame); /* send and mark the answer pending */
if (err) {
spin_unlock_irq(&mgr->msg_lock);
- up(&mgr->msg_mutex);
+ mutex_unlock(&mgr->msg_mutex);
return err;
}
@@ -260,7 +262,7 @@ int snd_mixart_send_msg(struct mixart_mgr *mgr, struct mixart_msg *request, int
if (! timeout) {
/* error - no ack */
- up(&mgr->msg_mutex);
+ mutex_unlock(&mgr->msg_mutex);
snd_printk(KERN_ERR "error: no reponse on msg %x\n", msg_frame);
return -EIO;
}
@@ -276,7 +278,7 @@ int snd_mixart_send_msg(struct mixart_mgr *mgr, struct mixart_msg *request, int
if( request->message_id != resp.message_id )
snd_printk(KERN_ERR "REPONSE ERROR!\n");
- up(&mgr->msg_mutex);
+ mutex_unlock(&mgr->msg_mutex);
return err;
}
@@ -292,7 +294,7 @@ int snd_mixart_send_msg_wait_notif(struct mixart_mgr *mgr,
snd_assert((notif_event & MSG_TYPE_MASK) == MSG_TYPE_NOTIFY, return -EINVAL);
snd_assert((notif_event & MSG_CANCEL_NOTIFY_MASK) == 0, return -EINVAL);
- down(&mgr->msg_mutex);
+ mutex_lock(&mgr->msg_mutex);
init_waitqueue_entry(&wait, current);
@@ -301,7 +303,7 @@ int snd_mixart_send_msg_wait_notif(struct mixart_mgr *mgr,
err = send_msg(mgr, request, MSG_DEFAULT_SIZE, 1, &notif_event); /* send and mark the notification event pending */
if(err) {
spin_unlock_irq(&mgr->msg_lock);
- up(&mgr->msg_mutex);
+ mutex_unlock(&mgr->msg_mutex);
return err;
}
@@ -313,12 +315,12 @@ int snd_mixart_send_msg_wait_notif(struct mixart_mgr *mgr,
if (! timeout) {
/* error - no ack */
- up(&mgr->msg_mutex);
+ mutex_unlock(&mgr->msg_mutex);
snd_printk(KERN_ERR "error: notification %x not received\n", notif_event);
return -EIO;
}
- up(&mgr->msg_mutex);
+ mutex_unlock(&mgr->msg_mutex);
return 0;
}
diff --git a/sound/pci/mixart/mixart_mixer.c b/sound/pci/mixart/mixart_mixer.c
index 36a7e9ddfb1..ed47b732c10 100644
--- a/sound/pci/mixart/mixart_mixer.c
+++ b/sound/pci/mixart/mixart_mixer.c
@@ -24,6 +24,8 @@
#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"
@@ -353,7 +355,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);
- down(&chip->mgr->mixer_mutex);
+ mutex_lock(&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];
@@ -361,7 +363,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];
}
- up(&chip->mgr->mixer_mutex);
+ mutex_unlock(&chip->mgr->mixer_mutex);
return 0;
}
@@ -371,7 +373,7 @@ static int mixart_analog_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_e
int changed = 0;
int is_capture, i;
- down(&chip->mgr->mixer_mutex);
+ mutex_lock(&chip->mgr->mixer_mutex);
is_capture = (kcontrol->private_value != 0);
for(i=0; i<2; i++) {
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
}
}
if(changed) mixart_update_analog_audio_level(chip, is_capture);
- up(&chip->mgr->mixer_mutex);
+ mutex_unlock(&chip->mgr->mixer_mutex);
return changed;
}
@@ -408,10 +410,10 @@ static int mixart_audio_sw_get(struct snd_kcontrol *kcontrol, struct snd_ctl_ele
{
struct snd_mixart *chip = snd_kcontrol_chip(kcontrol);
- down(&chip->mgr->mixer_mutex);
+ mutex_lock(&chip->mgr->mixer_mutex);
ucontrol->value.integer.value[0] = chip->analog_playback_active[0];
ucontrol->value.integer.value[1] = chip->analog_playback_active[1];
- up(&chip->mgr->mixer_mutex);
+ mutex_unlock(&chip->mgr->mixer_mutex);
return 0;
}
@@ -419,7 +421,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;
- down(&chip->mgr->mixer_mutex);
+ mutex_lock(&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];
@@ -427,7 +429,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 */
- up(&chip->mgr->mixer_mutex);
+ mutex_unlock(&chip->mgr->mixer_mutex);
return changed;
}
@@ -817,7 +819,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;
- down(&chip->mgr->mixer_mutex);
+ mutex_lock(&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 */
@@ -828,7 +830,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];
- up(&chip->mgr->mixer_mutex);
+ mutex_unlock(&chip->mgr->mixer_mutex);
return 0;
}
@@ -841,7 +843,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;
- down(&chip->mgr->mixer_mutex);
+ mutex_lock(&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 */
@@ -860,7 +862,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);
}
- up(&chip->mgr->mixer_mutex);
+ mutex_unlock(&chip->mgr->mixer_mutex);
return changed;
}
@@ -880,12 +882,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 );
- down(&chip->mgr->mixer_mutex);
+ mutex_lock(&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];
- up(&chip->mgr->mixer_mutex);
+ mutex_unlock(&chip->mgr->mixer_mutex);
return 0;
}
@@ -897,7 +899,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 );
- down(&chip->mgr->mixer_mutex);
+ mutex_lock(&chip->mgr->mixer_mutex);
j = idx;
if(is_aes) j += MIXART_PLAYBACK_STREAMS;
for(i=0; i<2; i++) {
@@ -907,7 +909,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);
- up(&chip->mgr->mixer_mutex);
+ mutex_unlock(&chip->mgr->mixer_mutex);
return changed;
}
@@ -956,10 +958,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);
- down(&chip->mgr->mixer_mutex);
+ mutex_lock(&chip->mgr->mixer_mutex);
ucontrol->value.integer.value[0] = chip->monitoring_volume[0];
ucontrol->value.integer.value[1] = chip->monitoring_volume[1];
- up(&chip->mgr->mixer_mutex);
+ mutex_unlock(&chip->mgr->mixer_mutex);
return 0;
}
@@ -968,7 +970,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;
- down(&chip->mgr->mixer_mutex);
+ mutex_lock(&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];
@@ -976,7 +978,7 @@ static int mixart_monitor_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_
changed = 1;
}
}
- up(&chip->mgr->mixer_mutex);
+ mutex_unlock(&chip->mgr->mixer_mutex);
return changed;
}
@@ -995,10 +997,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);
- down(&chip->mgr->mixer_mutex);
+ mutex_lock(&chip->mgr->mixer_mutex);
ucontrol->value.integer.value[0] = chip->monitoring_active[0];
ucontrol->value.integer.value[1] = chip->monitoring_active[1];
- up(&chip->mgr->mixer_mutex);
+ mutex_unlock(&chip->mgr->mixer_mutex);
return 0;
}
@@ -1007,7 +1009,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;
- down(&chip->mgr->mixer_mutex);
+ mutex_lock(&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];
@@ -1029,7 +1031,7 @@ static int mixart_monitor_sw_put(struct snd_kcontrol *kcontrol, struct snd_ctl_e
}
}
- up(&chip->mgr->mixer_mutex);
+ mutex_unlock(&chip->mgr->mixer_mutex);
return (changed != 0);
}
@@ -1059,7 +1061,7 @@ int snd_mixart_create_mixer(struct mixart_mgr *mgr)
struct snd_mixart *chip;
int err, i;
- init_MUTEX(&mgr->mixer_mutex); /* can be in another place */
+ mutex_init(&mgr->mixer_mutex); /* can be in another place */
for(i=0; i<mgr->num_cards; i++) {
struct snd_kcontrol_new temp;