summaryrefslogtreecommitdiff
path: root/sound/pci/cs46xx
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/cs46xx')
-rw-r--r--sound/pci/cs46xx/cs46xx_lib.c52
-rw-r--r--sound/pci/cs46xx/dsp_spos.c58
-rw-r--r--sound/pci/cs46xx/dsp_spos_scb_lib.c6
3 files changed, 61 insertions, 55 deletions
diff --git a/sound/pci/cs46xx/cs46xx_lib.c b/sound/pci/cs46xx/cs46xx_lib.c
index 8fb275d6eb77..69dbf542a6de 100644
--- a/sound/pci/cs46xx/cs46xx_lib.c
+++ b/sound/pci/cs46xx/cs46xx_lib.c
@@ -53,6 +53,8 @@
#include <linux/interrupt.h>
#include <linux/slab.h>
#include <linux/gameport.h>
+#include <linux/mutex.h>
+
#include <sound/core.h>
#include <sound/control.h>
@@ -909,22 +911,22 @@ static int snd_cs46xx_playback_hw_params(struct snd_pcm_substream *substream,
#ifdef CONFIG_SND_CS46XX_NEW_DSP
snd_assert (sample_rate != 0, return -ENXIO);
- down (&chip->spos_mutex);
+ mutex_lock(&chip->spos_mutex);
if (_cs46xx_adjust_sample_rate (chip,cpcm,sample_rate)) {
- up (&chip->spos_mutex);
+ mutex_unlock(&chip->spos_mutex);
return -ENXIO;
}
snd_assert (cpcm->pcm_channel != NULL);
if (!cpcm->pcm_channel) {
- up (&chip->spos_mutex);
+ mutex_unlock(&chip->spos_mutex);
return -ENXIO;
}
if (cs46xx_dsp_pcm_channel_set_period (chip,cpcm->pcm_channel,period_size)) {
- up (&chip->spos_mutex);
+ mutex_unlock(&chip->spos_mutex);
return -EINVAL;
}
@@ -965,7 +967,7 @@ static int snd_cs46xx_playback_hw_params(struct snd_pcm_substream *substream,
}
if ((err = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params))) < 0) {
#ifdef CONFIG_SND_CS46XX_NEW_DSP
- up (&chip->spos_mutex);
+ mutex_unlock(&chip->spos_mutex);
#endif
return err;
}
@@ -989,7 +991,7 @@ static int snd_cs46xx_playback_hw_params(struct snd_pcm_substream *substream,
}
#ifdef CONFIG_SND_CS46XX_NEW_DSP
- up (&chip->spos_mutex);
+ mutex_unlock(&chip->spos_mutex);
#endif
return 0;
@@ -1319,7 +1321,7 @@ static int _cs46xx_playback_open_channel (struct snd_pcm_substream *substream,in
cpcm->substream = substream;
#ifdef CONFIG_SND_CS46XX_NEW_DSP
- down (&chip->spos_mutex);
+ mutex_lock(&chip->spos_mutex);
cpcm->pcm_channel = NULL;
cpcm->pcm_channel_id = pcm_channel_id;
@@ -1328,7 +1330,7 @@ static int _cs46xx_playback_open_channel (struct snd_pcm_substream *substream,in
SNDRV_PCM_HW_PARAM_PERIOD_BYTES,
&hw_constraints_period_sizes);
- up (&chip->spos_mutex);
+ mutex_unlock(&chip->spos_mutex);
#else
chip->playback_pcm = cpcm; /* HACK */
#endif
@@ -1367,9 +1369,9 @@ static int snd_cs46xx_playback_open_iec958(struct snd_pcm_substream *substream)
snd_printdd("open raw iec958 channel\n");
- down (&chip->spos_mutex);
+ mutex_lock(&chip->spos_mutex);
cs46xx_iec958_pre_open (chip);
- up (&chip->spos_mutex);
+ mutex_unlock(&chip->spos_mutex);
return _cs46xx_playback_open_channel(substream,DSP_IEC958_CHANNEL);
}
@@ -1385,9 +1387,9 @@ static int snd_cs46xx_playback_close_iec958(struct snd_pcm_substream *substream)
err = snd_cs46xx_playback_close(substream);
- down (&chip->spos_mutex);
+ mutex_lock(&chip->spos_mutex);
cs46xx_iec958_post_close (chip);
- up (&chip->spos_mutex);
+ mutex_unlock(&chip->spos_mutex);
return err;
}
@@ -1428,12 +1430,12 @@ static int snd_cs46xx_playback_close(struct snd_pcm_substream *substream)
if (!cpcm) return -ENXIO;
#ifdef CONFIG_SND_CS46XX_NEW_DSP
- down (&chip->spos_mutex);
+ mutex_lock(&chip->spos_mutex);
if (cpcm->pcm_channel) {
cs46xx_dsp_destroy_pcm_channel(chip,cpcm->pcm_channel);
cpcm->pcm_channel = NULL;
}
- up (&chip->spos_mutex);
+ mutex_unlock(&chip->spos_mutex);
#else
chip->playback_pcm = NULL;
#endif
@@ -1848,7 +1850,7 @@ static int snd_cs46xx_iec958_put(struct snd_kcontrol *kcontrol,
switch (kcontrol->private_value) {
case CS46XX_MIXER_SPDIF_OUTPUT_ELEMENT:
- down (&chip->spos_mutex);
+ mutex_lock(&chip->spos_mutex);
change = (chip->dsp_spos_instance->spdif_status_out & DSP_SPDIF_STATUS_OUTPUT_ENABLED);
if (ucontrol->value.integer.value[0] && !change)
cs46xx_dsp_enable_spdif_out(chip);
@@ -1856,7 +1858,7 @@ static int snd_cs46xx_iec958_put(struct snd_kcontrol *kcontrol,
cs46xx_dsp_disable_spdif_out(chip);
res = (change != (chip->dsp_spos_instance->spdif_status_out & DSP_SPDIF_STATUS_OUTPUT_ENABLED));
- up (&chip->spos_mutex);
+ mutex_unlock(&chip->spos_mutex);
break;
case CS46XX_MIXER_SPDIF_INPUT_ELEMENT:
change = chip->dsp_spos_instance->spdif_status_in;
@@ -1997,12 +1999,12 @@ static int snd_cs46xx_spdif_default_get(struct snd_kcontrol *kcontrol,
struct snd_cs46xx *chip = snd_kcontrol_chip(kcontrol);
struct dsp_spos_instance * ins = chip->dsp_spos_instance;
- down (&chip->spos_mutex);
+ mutex_lock(&chip->spos_mutex);
ucontrol->value.iec958.status[0] = _wrap_all_bits((ins->spdif_csuv_default >> 24) & 0xff);
ucontrol->value.iec958.status[1] = _wrap_all_bits((ins->spdif_csuv_default >> 16) & 0xff);
ucontrol->value.iec958.status[2] = 0;
ucontrol->value.iec958.status[3] = _wrap_all_bits((ins->spdif_csuv_default) & 0xff);
- up (&chip->spos_mutex);
+ mutex_unlock(&chip->spos_mutex);
return 0;
}
@@ -2015,7 +2017,7 @@ static int snd_cs46xx_spdif_default_put(struct snd_kcontrol *kcontrol,
unsigned int val;
int change;
- down (&chip->spos_mutex);
+ mutex_lock(&chip->spos_mutex);
val = ((unsigned int)_wrap_all_bits(ucontrol->value.iec958.status[0]) << 24) |
((unsigned int)_wrap_all_bits(ucontrol->value.iec958.status[2]) << 16) |
((unsigned int)_wrap_all_bits(ucontrol->value.iec958.status[3])) |
@@ -2029,7 +2031,7 @@ static int snd_cs46xx_spdif_default_put(struct snd_kcontrol *kcontrol,
if ( !(ins->spdif_status_out & DSP_SPDIF_STATUS_PLAYBACK_OPEN) )
cs46xx_poke_via_dsp (chip,SP_SPDOUT_CSUV,val);
- up (&chip->spos_mutex);
+ mutex_unlock(&chip->spos_mutex);
return change;
}
@@ -2050,12 +2052,12 @@ static int snd_cs46xx_spdif_stream_get(struct snd_kcontrol *kcontrol,
struct snd_cs46xx *chip = snd_kcontrol_chip(kcontrol);
struct dsp_spos_instance * ins = chip->dsp_spos_instance;
- down (&chip->spos_mutex);
+ mutex_lock(&chip->spos_mutex);
ucontrol->value.iec958.status[0] = _wrap_all_bits((ins->spdif_csuv_stream >> 24) & 0xff);
ucontrol->value.iec958.status[1] = _wrap_all_bits((ins->spdif_csuv_stream >> 16) & 0xff);
ucontrol->value.iec958.status[2] = 0;
ucontrol->value.iec958.status[3] = _wrap_all_bits((ins->spdif_csuv_stream) & 0xff);
- up (&chip->spos_mutex);
+ mutex_unlock(&chip->spos_mutex);
return 0;
}
@@ -2068,7 +2070,7 @@ static int snd_cs46xx_spdif_stream_put(struct snd_kcontrol *kcontrol,
unsigned int val;
int change;
- down (&chip->spos_mutex);
+ mutex_lock(&chip->spos_mutex);
val = ((unsigned int)_wrap_all_bits(ucontrol->value.iec958.status[0]) << 24) |
((unsigned int)_wrap_all_bits(ucontrol->value.iec958.status[1]) << 16) |
((unsigned int)_wrap_all_bits(ucontrol->value.iec958.status[3])) |
@@ -2082,7 +2084,7 @@ static int snd_cs46xx_spdif_stream_put(struct snd_kcontrol *kcontrol,
if ( ins->spdif_status_out & DSP_SPDIF_STATUS_PLAYBACK_OPEN )
cs46xx_poke_via_dsp (chip,SP_SPDOUT_CSUV,val);
- up (&chip->spos_mutex);
+ mutex_unlock(&chip->spos_mutex);
return change;
}
@@ -3755,7 +3757,7 @@ int __devinit snd_cs46xx_create(struct snd_card *card,
}
spin_lock_init(&chip->reg_lock);
#ifdef CONFIG_SND_CS46XX_NEW_DSP
- init_MUTEX(&chip->spos_mutex);
+ mutex_init(&chip->spos_mutex);
#endif
chip->card = card;
chip->pci = pci;
diff --git a/sound/pci/cs46xx/dsp_spos.c b/sound/pci/cs46xx/dsp_spos.c
index 445a448949e7..8726a68051e7 100644
--- a/sound/pci/cs46xx/dsp_spos.c
+++ b/sound/pci/cs46xx/dsp_spos.c
@@ -28,6 +28,8 @@
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/vmalloc.h>
+#include <linux/mutex.h>
+
#include <sound/core.h>
#include <sound/control.h>
#include <sound/info.h>
@@ -287,7 +289,7 @@ void cs46xx_dsp_spos_destroy (struct snd_cs46xx * chip)
snd_assert(ins != NULL, return);
- down(&chip->spos_mutex);
+ mutex_lock(&chip->spos_mutex);
for (i = 0; i < ins->nscb; ++i) {
if (ins->scbs[i].deleted) continue;
@@ -298,7 +300,7 @@ void cs46xx_dsp_spos_destroy (struct snd_cs46xx * chip)
vfree(ins->symbol_table.symbols);
kfree(ins->modules);
kfree(ins);
- up(&chip->spos_mutex);
+ mutex_unlock(&chip->spos_mutex);
}
int cs46xx_dsp_load_module (struct snd_cs46xx * chip, struct dsp_module_desc * module)
@@ -497,7 +499,7 @@ static void cs46xx_dsp_proc_modules_read (struct snd_info_entry *entry,
struct dsp_spos_instance * ins = chip->dsp_spos_instance;
int i,j;
- down(&chip->spos_mutex);
+ mutex_lock(&chip->spos_mutex);
snd_iprintf(buffer, "MODULES:\n");
for ( i = 0; i < ins->nmodules; ++i ) {
snd_iprintf(buffer, "\n%s:\n", ins->modules[i].module_name);
@@ -510,7 +512,7 @@ static void cs46xx_dsp_proc_modules_read (struct snd_info_entry *entry,
desc->segment_type,desc->offset, desc->size);
}
}
- up(&chip->spos_mutex);
+ mutex_unlock(&chip->spos_mutex);
}
static void cs46xx_dsp_proc_task_tree_read (struct snd_info_entry *entry,
@@ -521,7 +523,7 @@ static void cs46xx_dsp_proc_task_tree_read (struct snd_info_entry *entry,
int i, j, col;
void __iomem *dst = chip->region.idx[1].remap_addr + DSP_PARAMETER_BYTE_OFFSET;
- down(&chip->spos_mutex);
+ mutex_lock(&chip->spos_mutex);
snd_iprintf(buffer, "TASK TREES:\n");
for ( i = 0; i < ins->ntask; ++i) {
snd_iprintf(buffer,"\n%04x %s:\n",ins->tasks[i].address,ins->tasks[i].task_name);
@@ -538,7 +540,7 @@ static void cs46xx_dsp_proc_task_tree_read (struct snd_info_entry *entry,
}
snd_iprintf(buffer,"\n");
- up(&chip->spos_mutex);
+ mutex_unlock(&chip->spos_mutex);
}
static void cs46xx_dsp_proc_scb_read (struct snd_info_entry *entry,
@@ -548,7 +550,7 @@ static void cs46xx_dsp_proc_scb_read (struct snd_info_entry *entry,
struct dsp_spos_instance * ins = chip->dsp_spos_instance;
int i;
- down(&chip->spos_mutex);
+ mutex_lock(&chip->spos_mutex);
snd_iprintf(buffer, "SCB's:\n");
for ( i = 0; i < ins->nscb; ++i) {
if (ins->scbs[i].deleted)
@@ -571,7 +573,7 @@ static void cs46xx_dsp_proc_scb_read (struct snd_info_entry *entry,
}
snd_iprintf(buffer,"\n");
- up(&chip->spos_mutex);
+ mutex_unlock(&chip->spos_mutex);
}
static void cs46xx_dsp_proc_parameter_dump_read (struct snd_info_entry *entry,
@@ -852,14 +854,14 @@ int cs46xx_dsp_proc_init (struct snd_card *card, struct snd_cs46xx *chip)
}
ins->proc_scb_info_entry = entry;
- down(&chip->spos_mutex);
+ mutex_lock(&chip->spos_mutex);
/* register/update SCB's entries on proc */
for (i = 0; i < ins->nscb; ++i) {
if (ins->scbs[i].deleted) continue;
cs46xx_dsp_proc_register_scb_desc (chip, (ins->scbs + i));
}
- up(&chip->spos_mutex);
+ mutex_unlock(&chip->spos_mutex);
return 0;
}
@@ -899,12 +901,12 @@ int cs46xx_dsp_proc_done (struct snd_cs46xx *chip)
ins->proc_task_info_entry = NULL;
}
- down(&chip->spos_mutex);
+ mutex_lock(&chip->spos_mutex);
for (i = 0; i < ins->nscb; ++i) {
if (ins->scbs[i].deleted) continue;
cs46xx_dsp_proc_free_scb_desc ( (ins->scbs + i) );
}
- up(&chip->spos_mutex);
+ mutex_unlock(&chip->spos_mutex);
if (ins->proc_dsp_dir) {
snd_info_unregister (ins->proc_dsp_dir);
@@ -1694,7 +1696,7 @@ int cs46xx_dsp_enable_spdif_in (struct snd_cs46xx *chip)
snd_assert (ins->asynch_rx_scb == NULL,return -EINVAL);
snd_assert (ins->spdif_in_src != NULL,return -EINVAL);
- down(&chip->spos_mutex);
+ mutex_lock(&chip->spos_mutex);
if ( ! (ins->spdif_status_out & DSP_SPDIF_STATUS_INPUT_CTRL_ENABLED) ) {
/* time countdown enable */
@@ -1738,7 +1740,7 @@ int cs46xx_dsp_enable_spdif_in (struct snd_cs46xx *chip)
/* monitor state */
ins->spdif_status_in = 1;
- up(&chip->spos_mutex);
+ mutex_unlock(&chip->spos_mutex);
return 0;
}
@@ -1750,7 +1752,7 @@ int cs46xx_dsp_disable_spdif_in (struct snd_cs46xx *chip)
snd_assert (ins->asynch_rx_scb != NULL, return -EINVAL);
snd_assert (ins->spdif_in_src != NULL,return -EINVAL);
- down(&chip->spos_mutex);
+ mutex_lock(&chip->spos_mutex);
/* Remove the asynchronous receiver SCB */
cs46xx_dsp_remove_scb (chip,ins->asynch_rx_scb);
@@ -1760,7 +1762,7 @@ int cs46xx_dsp_disable_spdif_in (struct snd_cs46xx *chip)
/* monitor state */
ins->spdif_status_in = 0;
- up(&chip->spos_mutex);
+ mutex_unlock(&chip->spos_mutex);
/* restore amplifier */
chip->active_ctrl(chip, -1);
@@ -1776,10 +1778,10 @@ int cs46xx_dsp_enable_pcm_capture (struct snd_cs46xx *chip)
snd_assert (ins->pcm_input == NULL,return -EINVAL);
snd_assert (ins->ref_snoop_scb != NULL,return -EINVAL);
- down(&chip->spos_mutex);
+ mutex_lock(&chip->spos_mutex);
ins->pcm_input = cs46xx_add_record_source(chip,ins->ref_snoop_scb,PCMSERIALIN_PCM_SCB_ADDR,
"PCMSerialInput_Wave");
- up(&chip->spos_mutex);
+ mutex_unlock(&chip->spos_mutex);
return 0;
}
@@ -1790,10 +1792,10 @@ int cs46xx_dsp_disable_pcm_capture (struct snd_cs46xx *chip)
snd_assert (ins->pcm_input != NULL,return -EINVAL);
- down(&chip->spos_mutex);
+ mutex_lock(&chip->spos_mutex);
cs46xx_dsp_remove_scb (chip,ins->pcm_input);
ins->pcm_input = NULL;
- up(&chip->spos_mutex);
+ mutex_unlock(&chip->spos_mutex);
return 0;
}
@@ -1805,10 +1807,10 @@ int cs46xx_dsp_enable_adc_capture (struct snd_cs46xx *chip)
snd_assert (ins->adc_input == NULL,return -EINVAL);
snd_assert (ins->codec_in_scb != NULL,return -EINVAL);
- down(&chip->spos_mutex);
+ mutex_lock(&chip->spos_mutex);
ins->adc_input = cs46xx_add_record_source(chip,ins->codec_in_scb,PCMSERIALIN_SCB_ADDR,
"PCMSerialInput_ADC");
- up(&chip->spos_mutex);
+ mutex_unlock(&chip->spos_mutex);
return 0;
}
@@ -1819,10 +1821,10 @@ int cs46xx_dsp_disable_adc_capture (struct snd_cs46xx *chip)
snd_assert (ins->adc_input != NULL,return -EINVAL);
- down(&chip->spos_mutex);
+ mutex_lock(&chip->spos_mutex);
cs46xx_dsp_remove_scb (chip,ins->adc_input);
ins->adc_input = NULL;
- up(&chip->spos_mutex);
+ mutex_unlock(&chip->spos_mutex);
return 0;
}
@@ -1869,7 +1871,7 @@ int cs46xx_dsp_set_dac_volume (struct snd_cs46xx * chip, u16 left, u16 right)
struct dsp_spos_instance * ins = chip->dsp_spos_instance;
struct dsp_scb_descriptor * scb;
- down(&chip->spos_mutex);
+ mutex_lock(&chip->spos_mutex);
/* main output */
scb = ins->master_mix_scb->sub_list_ptr;
@@ -1888,7 +1890,7 @@ int cs46xx_dsp_set_dac_volume (struct snd_cs46xx * chip, u16 left, u16 right)
ins->dac_volume_left = left;
ins->dac_volume_right = right;
- up(&chip->spos_mutex);
+ mutex_unlock(&chip->spos_mutex);
return 0;
}
@@ -1897,7 +1899,7 @@ int cs46xx_dsp_set_iec958_volume (struct snd_cs46xx * chip, u16 left, u16 right)
{
struct dsp_spos_instance * ins = chip->dsp_spos_instance;
- down(&chip->spos_mutex);
+ mutex_lock(&chip->spos_mutex);
if (ins->asynch_rx_scb != NULL)
cs46xx_dsp_scb_set_volume (chip,ins->asynch_rx_scb,
@@ -1906,7 +1908,7 @@ int cs46xx_dsp_set_iec958_volume (struct snd_cs46xx * chip, u16 left, u16 right)
ins->spdif_input_volume_left = left;
ins->spdif_input_volume_right = right;
- up(&chip->spos_mutex);
+ mutex_unlock(&chip->spos_mutex);
return 0;
}
diff --git a/sound/pci/cs46xx/dsp_spos_scb_lib.c b/sound/pci/cs46xx/dsp_spos_scb_lib.c
index d4e0fb39bd06..2c4ee45fe10c 100644
--- a/sound/pci/cs46xx/dsp_spos_scb_lib.c
+++ b/sound/pci/cs46xx/dsp_spos_scb_lib.c
@@ -28,6 +28,8 @@
#include <linux/pm.h>
#include <linux/init.h>
#include <linux/slab.h>
+#include <linux/mutex.h>
+
#include <sound/core.h>
#include <sound/control.h>
#include <sound/info.h>
@@ -77,7 +79,7 @@ static void cs46xx_dsp_proc_scb_info_read (struct snd_info_entry *entry,
ins = chip->dsp_spos_instance;
- down(&chip->spos_mutex);
+ mutex_lock(&chip->spos_mutex);
snd_iprintf(buffer,"%04x %s:\n",scb->address,scb->scb_name);
for (col = 0,j = 0;j < 0x10; j++,col++) {
@@ -105,7 +107,7 @@ static void cs46xx_dsp_proc_scb_info_read (struct snd_info_entry *entry,
scb->task_entry->address);
snd_iprintf(buffer,"index [%d] ref_count [%d]\n",scb->index,scb->ref_count);
- up(&chip->spos_mutex);
+ mutex_unlock(&chip->spos_mutex);
}
#endif