aboutsummaryrefslogtreecommitdiffstats
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.c68
-rw-r--r--sound/pci/cs46xx/dsp_spos_scb_lib.c6
3 files changed, 68 insertions, 58 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 @@
53#include <linux/interrupt.h> 53#include <linux/interrupt.h>
54#include <linux/slab.h> 54#include <linux/slab.h>
55#include <linux/gameport.h> 55#include <linux/gameport.h>
56#include <linux/mutex.h>
57
56 58
57#include <sound/core.h> 59#include <sound/core.h>
58#include <sound/control.h> 60#include <sound/control.h>
@@ -909,22 +911,22 @@ static int snd_cs46xx_playback_hw_params(struct snd_pcm_substream *substream,
909#ifdef CONFIG_SND_CS46XX_NEW_DSP 911#ifdef CONFIG_SND_CS46XX_NEW_DSP
910 snd_assert (sample_rate != 0, return -ENXIO); 912 snd_assert (sample_rate != 0, return -ENXIO);
911 913
912 down (&chip->spos_mutex); 914 mutex_lock(&chip->spos_mutex);
913 915
914 if (_cs46xx_adjust_sample_rate (chip,cpcm,sample_rate)) { 916 if (_cs46xx_adjust_sample_rate (chip,cpcm,sample_rate)) {
915 up (&chip->spos_mutex); 917 mutex_unlock(&chip->spos_mutex);
916 return -ENXIO; 918 return -ENXIO;
917 } 919 }
918 920
919 snd_assert (cpcm->pcm_channel != NULL); 921 snd_assert (cpcm->pcm_channel != NULL);
920 if (!cpcm->pcm_channel) { 922 if (!cpcm->pcm_channel) {
921 up (&chip->spos_mutex); 923 mutex_unlock(&chip->spos_mutex);
922 return -ENXIO; 924 return -ENXIO;
923 } 925 }
924 926
925 927
926 if (cs46xx_dsp_pcm_channel_set_period (chip,cpcm->pcm_channel,period_size)) { 928 if (cs46xx_dsp_pcm_channel_set_period (chip,cpcm->pcm_channel,period_size)) {
927 up (&chip->spos_mutex); 929 mutex_unlock(&chip->spos_mutex);
928 return -EINVAL; 930 return -EINVAL;
929 } 931 }
930 932
@@ -965,7 +967,7 @@ static int snd_cs46xx_playback_hw_params(struct snd_pcm_substream *substream,
965 } 967 }
966 if ((err = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params))) < 0) { 968 if ((err = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params))) < 0) {
967#ifdef CONFIG_SND_CS46XX_NEW_DSP 969#ifdef CONFIG_SND_CS46XX_NEW_DSP
968 up (&chip->spos_mutex); 970 mutex_unlock(&chip->spos_mutex);
969#endif 971#endif
970 return err; 972 return err;
971 } 973 }
@@ -989,7 +991,7 @@ static int snd_cs46xx_playback_hw_params(struct snd_pcm_substream *substream,
989 } 991 }
990 992
991#ifdef CONFIG_SND_CS46XX_NEW_DSP 993#ifdef CONFIG_SND_CS46XX_NEW_DSP
992 up (&chip->spos_mutex); 994 mutex_unlock(&chip->spos_mutex);
993#endif 995#endif
994 996
995 return 0; 997 return 0;
@@ -1319,7 +1321,7 @@ static int _cs46xx_playback_open_channel (struct snd_pcm_substream *substream,in
1319 1321
1320 cpcm->substream = substream; 1322 cpcm->substream = substream;
1321#ifdef CONFIG_SND_CS46XX_NEW_DSP 1323#ifdef CONFIG_SND_CS46XX_NEW_DSP
1322 down (&chip->spos_mutex); 1324 mutex_lock(&chip->spos_mutex);
1323 cpcm->pcm_channel = NULL; 1325 cpcm->pcm_channel = NULL;
1324 cpcm->pcm_channel_id = pcm_channel_id; 1326 cpcm->pcm_channel_id = pcm_channel_id;
1325 1327
@@ -1328,7 +1330,7 @@ static int _cs46xx_playback_open_channel (struct snd_pcm_substream *substream,in
1328 SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 1330 SNDRV_PCM_HW_PARAM_PERIOD_BYTES,
1329 &hw_constraints_period_sizes); 1331 &hw_constraints_period_sizes);
1330 1332
1331 up (&chip->spos_mutex); 1333 mutex_unlock(&chip->spos_mutex);
1332#else 1334#else
1333 chip->playback_pcm = cpcm; /* HACK */ 1335 chip->playback_pcm = cpcm; /* HACK */
1334#endif 1336#endif
@@ -1367,9 +1369,9 @@ static int snd_cs46xx_playback_open_iec958(struct snd_pcm_substream *substream)
1367 1369
1368 snd_printdd("open raw iec958 channel\n"); 1370 snd_printdd("open raw iec958 channel\n");
1369 1371
1370 down (&chip->spos_mutex); 1372 mutex_lock(&chip->spos_mutex);
1371 cs46xx_iec958_pre_open (chip); 1373 cs46xx_iec958_pre_open (chip);
1372 up (&chip->spos_mutex); 1374 mutex_unlock(&chip->spos_mutex);
1373 1375
1374 return _cs46xx_playback_open_channel(substream,DSP_IEC958_CHANNEL); 1376 return _cs46xx_playback_open_channel(substream,DSP_IEC958_CHANNEL);
1375} 1377}
@@ -1385,9 +1387,9 @@ static int snd_cs46xx_playback_close_iec958(struct snd_pcm_substream *substream)
1385 1387
1386 err = snd_cs46xx_playback_close(substream); 1388 err = snd_cs46xx_playback_close(substream);
1387 1389
1388 down (&chip->spos_mutex); 1390 mutex_lock(&chip->spos_mutex);
1389 cs46xx_iec958_post_close (chip); 1391 cs46xx_iec958_post_close (chip);
1390 up (&chip->spos_mutex); 1392 mutex_unlock(&chip->spos_mutex);
1391 1393
1392 return err; 1394 return err;
1393} 1395}
@@ -1428,12 +1430,12 @@ static int snd_cs46xx_playback_close(struct snd_pcm_substream *substream)
1428 if (!cpcm) return -ENXIO; 1430 if (!cpcm) return -ENXIO;
1429 1431
1430#ifdef CONFIG_SND_CS46XX_NEW_DSP 1432#ifdef CONFIG_SND_CS46XX_NEW_DSP
1431 down (&chip->spos_mutex); 1433 mutex_lock(&chip->spos_mutex);
1432 if (cpcm->pcm_channel) { 1434 if (cpcm->pcm_channel) {
1433 cs46xx_dsp_destroy_pcm_channel(chip,cpcm->pcm_channel); 1435 cs46xx_dsp_destroy_pcm_channel(chip,cpcm->pcm_channel);
1434 cpcm->pcm_channel = NULL; 1436 cpcm->pcm_channel = NULL;
1435 } 1437 }
1436 up (&chip->spos_mutex); 1438 mutex_unlock(&chip->spos_mutex);
1437#else 1439#else
1438 chip->playback_pcm = NULL; 1440 chip->playback_pcm = NULL;
1439#endif 1441#endif
@@ -1848,7 +1850,7 @@ static int snd_cs46xx_iec958_put(struct snd_kcontrol *kcontrol,
1848 1850
1849 switch (kcontrol->private_value) { 1851 switch (kcontrol->private_value) {
1850 case CS46XX_MIXER_SPDIF_OUTPUT_ELEMENT: 1852 case CS46XX_MIXER_SPDIF_OUTPUT_ELEMENT:
1851 down (&chip->spos_mutex); 1853 mutex_lock(&chip->spos_mutex);
1852 change = (chip->dsp_spos_instance->spdif_status_out & DSP_SPDIF_STATUS_OUTPUT_ENABLED); 1854 change = (chip->dsp_spos_instance->spdif_status_out & DSP_SPDIF_STATUS_OUTPUT_ENABLED);
1853 if (ucontrol->value.integer.value[0] && !change) 1855 if (ucontrol->value.integer.value[0] && !change)
1854 cs46xx_dsp_enable_spdif_out(chip); 1856 cs46xx_dsp_enable_spdif_out(chip);
@@ -1856,7 +1858,7 @@ static int snd_cs46xx_iec958_put(struct snd_kcontrol *kcontrol,
1856 cs46xx_dsp_disable_spdif_out(chip); 1858 cs46xx_dsp_disable_spdif_out(chip);
1857 1859
1858 res = (change != (chip->dsp_spos_instance->spdif_status_out & DSP_SPDIF_STATUS_OUTPUT_ENABLED)); 1860 res = (change != (chip->dsp_spos_instance->spdif_status_out & DSP_SPDIF_STATUS_OUTPUT_ENABLED));
1859 up (&chip->spos_mutex); 1861 mutex_unlock(&chip->spos_mutex);
1860 break; 1862 break;
1861 case CS46XX_MIXER_SPDIF_INPUT_ELEMENT: 1863 case CS46XX_MIXER_SPDIF_INPUT_ELEMENT:
1862 change = chip->dsp_spos_instance->spdif_status_in; 1864 change = chip->dsp_spos_instance->spdif_status_in;
@@ -1997,12 +1999,12 @@ static int snd_cs46xx_spdif_default_get(struct snd_kcontrol *kcontrol,
1997 struct snd_cs46xx *chip = snd_kcontrol_chip(kcontrol); 1999 struct snd_cs46xx *chip = snd_kcontrol_chip(kcontrol);
1998 struct dsp_spos_instance * ins = chip->dsp_spos_instance; 2000 struct dsp_spos_instance * ins = chip->dsp_spos_instance;
1999 2001
2000 down (&chip->spos_mutex); 2002 mutex_lock(&chip->spos_mutex);
2001 ucontrol->value.iec958.status[0] = _wrap_all_bits((ins->spdif_csuv_default >> 24) & 0xff); 2003 ucontrol->value.iec958.status[0] = _wrap_all_bits((ins->spdif_csuv_default >> 24) & 0xff);
2002 ucontrol->value.iec958.status[1] = _wrap_all_bits((ins->spdif_csuv_default >> 16) & 0xff); 2004 ucontrol->value.iec958.status[1] = _wrap_all_bits((ins->spdif_csuv_default >> 16) & 0xff);
2003 ucontrol->value.iec958.status[2] = 0; 2005 ucontrol->value.iec958.status[2] = 0;
2004 ucontrol->value.iec958.status[3] = _wrap_all_bits((ins->spdif_csuv_default) & 0xff); 2006 ucontrol->value.iec958.status[3] = _wrap_all_bits((ins->spdif_csuv_default) & 0xff);
2005 up (&chip->spos_mutex); 2007 mutex_unlock(&chip->spos_mutex);
2006 2008
2007 return 0; 2009 return 0;
2008} 2010}
@@ -2015,7 +2017,7 @@ static int snd_cs46xx_spdif_default_put(struct snd_kcontrol *kcontrol,
2015 unsigned int val; 2017 unsigned int val;
2016 int change; 2018 int change;
2017 2019
2018 down (&chip->spos_mutex); 2020 mutex_lock(&chip->spos_mutex);
2019 val = ((unsigned int)_wrap_all_bits(ucontrol->value.iec958.status[0]) << 24) | 2021 val = ((unsigned int)_wrap_all_bits(ucontrol->value.iec958.status[0]) << 24) |
2020 ((unsigned int)_wrap_all_bits(ucontrol->value.iec958.status[2]) << 16) | 2022 ((unsigned int)_wrap_all_bits(ucontrol->value.iec958.status[2]) << 16) |
2021 ((unsigned int)_wrap_all_bits(ucontrol->value.iec958.status[3])) | 2023 ((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,
2029 if ( !(ins->spdif_status_out & DSP_SPDIF_STATUS_PLAYBACK_OPEN) ) 2031 if ( !(ins->spdif_status_out & DSP_SPDIF_STATUS_PLAYBACK_OPEN) )
2030 cs46xx_poke_via_dsp (chip,SP_SPDOUT_CSUV,val); 2032 cs46xx_poke_via_dsp (chip,SP_SPDOUT_CSUV,val);
2031 2033
2032 up (&chip->spos_mutex); 2034 mutex_unlock(&chip->spos_mutex);
2033 2035
2034 return change; 2036 return change;
2035} 2037}
@@ -2050,12 +2052,12 @@ static int snd_cs46xx_spdif_stream_get(struct snd_kcontrol *kcontrol,
2050 struct snd_cs46xx *chip = snd_kcontrol_chip(kcontrol); 2052 struct snd_cs46xx *chip = snd_kcontrol_chip(kcontrol);
2051 struct dsp_spos_instance * ins = chip->dsp_spos_instance; 2053 struct dsp_spos_instance * ins = chip->dsp_spos_instance;
2052 2054
2053 down (&chip->spos_mutex); 2055 mutex_lock(&chip->spos_mutex);
2054 ucontrol->value.iec958.status[0] = _wrap_all_bits((ins->spdif_csuv_stream >> 24) & 0xff); 2056 ucontrol->value.iec958.status[0] = _wrap_all_bits((ins->spdif_csuv_stream >> 24) & 0xff);
2055 ucontrol->value.iec958.status[1] = _wrap_all_bits((ins->spdif_csuv_stream >> 16) & 0xff); 2057 ucontrol->value.iec958.status[1] = _wrap_all_bits((ins->spdif_csuv_stream >> 16) & 0xff);
2056 ucontrol->value.iec958.status[2] = 0; 2058 ucontrol->value.iec958.status[2] = 0;
2057 ucontrol->value.iec958.status[3] = _wrap_all_bits((ins->spdif_csuv_stream) & 0xff); 2059 ucontrol->value.iec958.status[3] = _wrap_all_bits((ins->spdif_csuv_stream) & 0xff);
2058 up (&chip->spos_mutex); 2060 mutex_unlock(&chip->spos_mutex);
2059 2061
2060 return 0; 2062 return 0;
2061} 2063}
@@ -2068,7 +2070,7 @@ static int snd_cs46xx_spdif_stream_put(struct snd_kcontrol *kcontrol,
2068 unsigned int val; 2070 unsigned int val;
2069 int change; 2071 int change;
2070 2072
2071 down (&chip->spos_mutex); 2073 mutex_lock(&chip->spos_mutex);
2072 val = ((unsigned int)_wrap_all_bits(ucontrol->value.iec958.status[0]) << 24) | 2074 val = ((unsigned int)_wrap_all_bits(ucontrol->value.iec958.status[0]) << 24) |
2073 ((unsigned int)_wrap_all_bits(ucontrol->value.iec958.status[1]) << 16) | 2075 ((unsigned int)_wrap_all_bits(ucontrol->value.iec958.status[1]) << 16) |
2074 ((unsigned int)_wrap_all_bits(ucontrol->value.iec958.status[3])) | 2076 ((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,
2082 if ( ins->spdif_status_out & DSP_SPDIF_STATUS_PLAYBACK_OPEN ) 2084 if ( ins->spdif_status_out & DSP_SPDIF_STATUS_PLAYBACK_OPEN )
2083 cs46xx_poke_via_dsp (chip,SP_SPDOUT_CSUV,val); 2085 cs46xx_poke_via_dsp (chip,SP_SPDOUT_CSUV,val);
2084 2086
2085 up (&chip->spos_mutex); 2087 mutex_unlock(&chip->spos_mutex);
2086 2088
2087 return change; 2089 return change;
2088} 2090}
@@ -3755,7 +3757,7 @@ int __devinit snd_cs46xx_create(struct snd_card *card,
3755 } 3757 }
3756 spin_lock_init(&chip->reg_lock); 3758 spin_lock_init(&chip->reg_lock);
3757#ifdef CONFIG_SND_CS46XX_NEW_DSP 3759#ifdef CONFIG_SND_CS46XX_NEW_DSP
3758 init_MUTEX(&chip->spos_mutex); 3760 mutex_init(&chip->spos_mutex);
3759#endif 3761#endif
3760 chip->card = card; 3762 chip->card = card;
3761 chip->pci = pci; 3763 chip->pci = pci;
diff --git a/sound/pci/cs46xx/dsp_spos.c b/sound/pci/cs46xx/dsp_spos.c
index 445a448949e7..f407d2a5ce3b 100644
--- a/sound/pci/cs46xx/dsp_spos.c
+++ b/sound/pci/cs46xx/dsp_spos.c
@@ -28,6 +28,8 @@
28#include <linux/init.h> 28#include <linux/init.h>
29#include <linux/slab.h> 29#include <linux/slab.h>
30#include <linux/vmalloc.h> 30#include <linux/vmalloc.h>
31#include <linux/mutex.h>
32
31#include <sound/core.h> 33#include <sound/core.h>
32#include <sound/control.h> 34#include <sound/control.h>
33#include <sound/info.h> 35#include <sound/info.h>
@@ -235,7 +237,7 @@ struct dsp_spos_instance *cs46xx_dsp_spos_create (struct snd_cs46xx * chip)
235 237
236 if (ins->symbol_table.symbols == NULL) { 238 if (ins->symbol_table.symbols == NULL) {
237 cs46xx_dsp_spos_destroy(chip); 239 cs46xx_dsp_spos_destroy(chip);
238 return NULL; 240 goto error;
239 } 241 }
240 242
241 ins->code.offset = 0; 243 ins->code.offset = 0;
@@ -244,7 +246,7 @@ struct dsp_spos_instance *cs46xx_dsp_spos_create (struct snd_cs46xx * chip)
244 246
245 if (ins->code.data == NULL) { 247 if (ins->code.data == NULL) {
246 cs46xx_dsp_spos_destroy(chip); 248 cs46xx_dsp_spos_destroy(chip);
247 return NULL; 249 goto error;
248 } 250 }
249 251
250 ins->nscb = 0; 252 ins->nscb = 0;
@@ -255,7 +257,7 @@ struct dsp_spos_instance *cs46xx_dsp_spos_create (struct snd_cs46xx * chip)
255 257
256 if (ins->modules == NULL) { 258 if (ins->modules == NULL) {
257 cs46xx_dsp_spos_destroy(chip); 259 cs46xx_dsp_spos_destroy(chip);
258 return NULL; 260 goto error;
259 } 261 }
260 262
261 /* default SPDIF input sample rate 263 /* default SPDIF input sample rate
@@ -278,6 +280,10 @@ struct dsp_spos_instance *cs46xx_dsp_spos_create (struct snd_cs46xx * chip)
278 /* left and right validity bits */ (1 << 13) | (1 << 12); 280 /* left and right validity bits */ (1 << 13) | (1 << 12);
279 281
280 return ins; 282 return ins;
283
284error:
285 kfree(ins);
286 return NULL;
281} 287}
282 288
283void cs46xx_dsp_spos_destroy (struct snd_cs46xx * chip) 289void cs46xx_dsp_spos_destroy (struct snd_cs46xx * chip)
@@ -287,7 +293,7 @@ void cs46xx_dsp_spos_destroy (struct snd_cs46xx * chip)
287 293
288 snd_assert(ins != NULL, return); 294 snd_assert(ins != NULL, return);
289 295
290 down(&chip->spos_mutex); 296 mutex_lock(&chip->spos_mutex);
291 for (i = 0; i < ins->nscb; ++i) { 297 for (i = 0; i < ins->nscb; ++i) {
292 if (ins->scbs[i].deleted) continue; 298 if (ins->scbs[i].deleted) continue;
293 299
@@ -298,7 +304,7 @@ void cs46xx_dsp_spos_destroy (struct snd_cs46xx * chip)
298 vfree(ins->symbol_table.symbols); 304 vfree(ins->symbol_table.symbols);
299 kfree(ins->modules); 305 kfree(ins->modules);
300 kfree(ins); 306 kfree(ins);
301 up(&chip->spos_mutex); 307 mutex_unlock(&chip->spos_mutex);
302} 308}
303 309
304int cs46xx_dsp_load_module (struct snd_cs46xx * chip, struct dsp_module_desc * module) 310int cs46xx_dsp_load_module (struct snd_cs46xx * chip, struct dsp_module_desc * module)
@@ -497,7 +503,7 @@ static void cs46xx_dsp_proc_modules_read (struct snd_info_entry *entry,
497 struct dsp_spos_instance * ins = chip->dsp_spos_instance; 503 struct dsp_spos_instance * ins = chip->dsp_spos_instance;
498 int i,j; 504 int i,j;
499 505
500 down(&chip->spos_mutex); 506 mutex_lock(&chip->spos_mutex);
501 snd_iprintf(buffer, "MODULES:\n"); 507 snd_iprintf(buffer, "MODULES:\n");
502 for ( i = 0; i < ins->nmodules; ++i ) { 508 for ( i = 0; i < ins->nmodules; ++i ) {
503 snd_iprintf(buffer, "\n%s:\n", ins->modules[i].module_name); 509 snd_iprintf(buffer, "\n%s:\n", ins->modules[i].module_name);
@@ -510,7 +516,7 @@ static void cs46xx_dsp_proc_modules_read (struct snd_info_entry *entry,
510 desc->segment_type,desc->offset, desc->size); 516 desc->segment_type,desc->offset, desc->size);
511 } 517 }
512 } 518 }
513 up(&chip->spos_mutex); 519 mutex_unlock(&chip->spos_mutex);
514} 520}
515 521
516static void cs46xx_dsp_proc_task_tree_read (struct snd_info_entry *entry, 522static void cs46xx_dsp_proc_task_tree_read (struct snd_info_entry *entry,
@@ -521,7 +527,7 @@ static void cs46xx_dsp_proc_task_tree_read (struct snd_info_entry *entry,
521 int i, j, col; 527 int i, j, col;
522 void __iomem *dst = chip->region.idx[1].remap_addr + DSP_PARAMETER_BYTE_OFFSET; 528 void __iomem *dst = chip->region.idx[1].remap_addr + DSP_PARAMETER_BYTE_OFFSET;
523 529
524 down(&chip->spos_mutex); 530 mutex_lock(&chip->spos_mutex);
525 snd_iprintf(buffer, "TASK TREES:\n"); 531 snd_iprintf(buffer, "TASK TREES:\n");
526 for ( i = 0; i < ins->ntask; ++i) { 532 for ( i = 0; i < ins->ntask; ++i) {
527 snd_iprintf(buffer,"\n%04x %s:\n",ins->tasks[i].address,ins->tasks[i].task_name); 533 snd_iprintf(buffer,"\n%04x %s:\n",ins->tasks[i].address,ins->tasks[i].task_name);
@@ -538,7 +544,7 @@ static void cs46xx_dsp_proc_task_tree_read (struct snd_info_entry *entry,
538 } 544 }
539 545
540 snd_iprintf(buffer,"\n"); 546 snd_iprintf(buffer,"\n");
541 up(&chip->spos_mutex); 547 mutex_unlock(&chip->spos_mutex);
542} 548}
543 549
544static void cs46xx_dsp_proc_scb_read (struct snd_info_entry *entry, 550static void cs46xx_dsp_proc_scb_read (struct snd_info_entry *entry,
@@ -548,7 +554,7 @@ static void cs46xx_dsp_proc_scb_read (struct snd_info_entry *entry,
548 struct dsp_spos_instance * ins = chip->dsp_spos_instance; 554 struct dsp_spos_instance * ins = chip->dsp_spos_instance;
549 int i; 555 int i;
550 556
551 down(&chip->spos_mutex); 557 mutex_lock(&chip->spos_mutex);
552 snd_iprintf(buffer, "SCB's:\n"); 558 snd_iprintf(buffer, "SCB's:\n");
553 for ( i = 0; i < ins->nscb; ++i) { 559 for ( i = 0; i < ins->nscb; ++i) {
554 if (ins->scbs[i].deleted) 560 if (ins->scbs[i].deleted)
@@ -571,7 +577,7 @@ static void cs46xx_dsp_proc_scb_read (struct snd_info_entry *entry,
571 } 577 }
572 578
573 snd_iprintf(buffer,"\n"); 579 snd_iprintf(buffer,"\n");
574 up(&chip->spos_mutex); 580 mutex_unlock(&chip->spos_mutex);
575} 581}
576 582
577static void cs46xx_dsp_proc_parameter_dump_read (struct snd_info_entry *entry, 583static void cs46xx_dsp_proc_parameter_dump_read (struct snd_info_entry *entry,
@@ -852,14 +858,14 @@ int cs46xx_dsp_proc_init (struct snd_card *card, struct snd_cs46xx *chip)
852 } 858 }
853 ins->proc_scb_info_entry = entry; 859 ins->proc_scb_info_entry = entry;
854 860
855 down(&chip->spos_mutex); 861 mutex_lock(&chip->spos_mutex);
856 /* register/update SCB's entries on proc */ 862 /* register/update SCB's entries on proc */
857 for (i = 0; i < ins->nscb; ++i) { 863 for (i = 0; i < ins->nscb; ++i) {
858 if (ins->scbs[i].deleted) continue; 864 if (ins->scbs[i].deleted) continue;
859 865
860 cs46xx_dsp_proc_register_scb_desc (chip, (ins->scbs + i)); 866 cs46xx_dsp_proc_register_scb_desc (chip, (ins->scbs + i));
861 } 867 }
862 up(&chip->spos_mutex); 868 mutex_unlock(&chip->spos_mutex);
863 869
864 return 0; 870 return 0;
865} 871}
@@ -899,12 +905,12 @@ int cs46xx_dsp_proc_done (struct snd_cs46xx *chip)
899 ins->proc_task_info_entry = NULL; 905 ins->proc_task_info_entry = NULL;
900 } 906 }
901 907
902 down(&chip->spos_mutex); 908 mutex_lock(&chip->spos_mutex);
903 for (i = 0; i < ins->nscb; ++i) { 909 for (i = 0; i < ins->nscb; ++i) {
904 if (ins->scbs[i].deleted) continue; 910 if (ins->scbs[i].deleted) continue;
905 cs46xx_dsp_proc_free_scb_desc ( (ins->scbs + i) ); 911 cs46xx_dsp_proc_free_scb_desc ( (ins->scbs + i) );
906 } 912 }
907 up(&chip->spos_mutex); 913 mutex_unlock(&chip->spos_mutex);
908 914
909 if (ins->proc_dsp_dir) { 915 if (ins->proc_dsp_dir) {
910 snd_info_unregister (ins->proc_dsp_dir); 916 snd_info_unregister (ins->proc_dsp_dir);
@@ -1694,7 +1700,7 @@ int cs46xx_dsp_enable_spdif_in (struct snd_cs46xx *chip)
1694 snd_assert (ins->asynch_rx_scb == NULL,return -EINVAL); 1700 snd_assert (ins->asynch_rx_scb == NULL,return -EINVAL);
1695 snd_assert (ins->spdif_in_src != NULL,return -EINVAL); 1701 snd_assert (ins->spdif_in_src != NULL,return -EINVAL);
1696 1702
1697 down(&chip->spos_mutex); 1703 mutex_lock(&chip->spos_mutex);
1698 1704
1699 if ( ! (ins->spdif_status_out & DSP_SPDIF_STATUS_INPUT_CTRL_ENABLED) ) { 1705 if ( ! (ins->spdif_status_out & DSP_SPDIF_STATUS_INPUT_CTRL_ENABLED) ) {
1700 /* time countdown enable */ 1706 /* time countdown enable */
@@ -1738,7 +1744,7 @@ int cs46xx_dsp_enable_spdif_in (struct snd_cs46xx *chip)
1738 1744
1739 /* monitor state */ 1745 /* monitor state */
1740 ins->spdif_status_in = 1; 1746 ins->spdif_status_in = 1;
1741 up(&chip->spos_mutex); 1747 mutex_unlock(&chip->spos_mutex);
1742 1748
1743 return 0; 1749 return 0;
1744} 1750}
@@ -1750,7 +1756,7 @@ int cs46xx_dsp_disable_spdif_in (struct snd_cs46xx *chip)
1750 snd_assert (ins->asynch_rx_scb != NULL, return -EINVAL); 1756 snd_assert (ins->asynch_rx_scb != NULL, return -EINVAL);
1751 snd_assert (ins->spdif_in_src != NULL,return -EINVAL); 1757 snd_assert (ins->spdif_in_src != NULL,return -EINVAL);
1752 1758
1753 down(&chip->spos_mutex); 1759 mutex_lock(&chip->spos_mutex);
1754 1760
1755 /* Remove the asynchronous receiver SCB */ 1761 /* Remove the asynchronous receiver SCB */
1756 cs46xx_dsp_remove_scb (chip,ins->asynch_rx_scb); 1762 cs46xx_dsp_remove_scb (chip,ins->asynch_rx_scb);
@@ -1760,7 +1766,7 @@ int cs46xx_dsp_disable_spdif_in (struct snd_cs46xx *chip)
1760 1766
1761 /* monitor state */ 1767 /* monitor state */
1762 ins->spdif_status_in = 0; 1768 ins->spdif_status_in = 0;
1763 up(&chip->spos_mutex); 1769 mutex_unlock(&chip->spos_mutex);
1764 1770
1765 /* restore amplifier */ 1771 /* restore amplifier */
1766 chip->active_ctrl(chip, -1); 1772 chip->active_ctrl(chip, -1);
@@ -1776,10 +1782,10 @@ int cs46xx_dsp_enable_pcm_capture (struct snd_cs46xx *chip)
1776 snd_assert (ins->pcm_input == NULL,return -EINVAL); 1782 snd_assert (ins->pcm_input == NULL,return -EINVAL);
1777 snd_assert (ins->ref_snoop_scb != NULL,return -EINVAL); 1783 snd_assert (ins->ref_snoop_scb != NULL,return -EINVAL);
1778 1784
1779 down(&chip->spos_mutex); 1785 mutex_lock(&chip->spos_mutex);
1780 ins->pcm_input = cs46xx_add_record_source(chip,ins->ref_snoop_scb,PCMSERIALIN_PCM_SCB_ADDR, 1786 ins->pcm_input = cs46xx_add_record_source(chip,ins->ref_snoop_scb,PCMSERIALIN_PCM_SCB_ADDR,
1781 "PCMSerialInput_Wave"); 1787 "PCMSerialInput_Wave");
1782 up(&chip->spos_mutex); 1788 mutex_unlock(&chip->spos_mutex);
1783 1789
1784 return 0; 1790 return 0;
1785} 1791}
@@ -1790,10 +1796,10 @@ int cs46xx_dsp_disable_pcm_capture (struct snd_cs46xx *chip)
1790 1796
1791 snd_assert (ins->pcm_input != NULL,return -EINVAL); 1797 snd_assert (ins->pcm_input != NULL,return -EINVAL);
1792 1798
1793 down(&chip->spos_mutex); 1799 mutex_lock(&chip->spos_mutex);
1794 cs46xx_dsp_remove_scb (chip,ins->pcm_input); 1800 cs46xx_dsp_remove_scb (chip,ins->pcm_input);
1795 ins->pcm_input = NULL; 1801 ins->pcm_input = NULL;
1796 up(&chip->spos_mutex); 1802 mutex_unlock(&chip->spos_mutex);
1797 1803
1798 return 0; 1804 return 0;
1799} 1805}
@@ -1805,10 +1811,10 @@ int cs46xx_dsp_enable_adc_capture (struct snd_cs46xx *chip)
1805 snd_assert (ins->adc_input == NULL,return -EINVAL); 1811 snd_assert (ins->adc_input == NULL,return -EINVAL);
1806 snd_assert (ins->codec_in_scb != NULL,return -EINVAL); 1812 snd_assert (ins->codec_in_scb != NULL,return -EINVAL);
1807 1813
1808 down(&chip->spos_mutex); 1814 mutex_lock(&chip->spos_mutex);
1809 ins->adc_input = cs46xx_add_record_source(chip,ins->codec_in_scb,PCMSERIALIN_SCB_ADDR, 1815 ins->adc_input = cs46xx_add_record_source(chip,ins->codec_in_scb,PCMSERIALIN_SCB_ADDR,
1810 "PCMSerialInput_ADC"); 1816 "PCMSerialInput_ADC");
1811 up(&chip->spos_mutex); 1817 mutex_unlock(&chip->spos_mutex);
1812 1818
1813 return 0; 1819 return 0;
1814} 1820}
@@ -1819,10 +1825,10 @@ int cs46xx_dsp_disable_adc_capture (struct snd_cs46xx *chip)
1819 1825
1820 snd_assert (ins->adc_input != NULL,return -EINVAL); 1826 snd_assert (ins->adc_input != NULL,return -EINVAL);
1821 1827
1822 down(&chip->spos_mutex); 1828 mutex_lock(&chip->spos_mutex);
1823 cs46xx_dsp_remove_scb (chip,ins->adc_input); 1829 cs46xx_dsp_remove_scb (chip,ins->adc_input);
1824 ins->adc_input = NULL; 1830 ins->adc_input = NULL;
1825 up(&chip->spos_mutex); 1831 mutex_unlock(&chip->spos_mutex);
1826 1832
1827 return 0; 1833 return 0;
1828} 1834}
@@ -1869,7 +1875,7 @@ int cs46xx_dsp_set_dac_volume (struct snd_cs46xx * chip, u16 left, u16 right)
1869 struct dsp_spos_instance * ins = chip->dsp_spos_instance; 1875 struct dsp_spos_instance * ins = chip->dsp_spos_instance;
1870 struct dsp_scb_descriptor * scb; 1876 struct dsp_scb_descriptor * scb;
1871 1877
1872 down(&chip->spos_mutex); 1878 mutex_lock(&chip->spos_mutex);
1873 1879
1874 /* main output */ 1880 /* main output */
1875 scb = ins->master_mix_scb->sub_list_ptr; 1881 scb = ins->master_mix_scb->sub_list_ptr;
@@ -1888,7 +1894,7 @@ int cs46xx_dsp_set_dac_volume (struct snd_cs46xx * chip, u16 left, u16 right)
1888 ins->dac_volume_left = left; 1894 ins->dac_volume_left = left;
1889 ins->dac_volume_right = right; 1895 ins->dac_volume_right = right;
1890 1896
1891 up(&chip->spos_mutex); 1897 mutex_unlock(&chip->spos_mutex);
1892 1898
1893 return 0; 1899 return 0;
1894} 1900}
@@ -1897,7 +1903,7 @@ int cs46xx_dsp_set_iec958_volume (struct snd_cs46xx * chip, u16 left, u16 right)
1897{ 1903{
1898 struct dsp_spos_instance * ins = chip->dsp_spos_instance; 1904 struct dsp_spos_instance * ins = chip->dsp_spos_instance;
1899 1905
1900 down(&chip->spos_mutex); 1906 mutex_lock(&chip->spos_mutex);
1901 1907
1902 if (ins->asynch_rx_scb != NULL) 1908 if (ins->asynch_rx_scb != NULL)
1903 cs46xx_dsp_scb_set_volume (chip,ins->asynch_rx_scb, 1909 cs46xx_dsp_scb_set_volume (chip,ins->asynch_rx_scb,
@@ -1906,7 +1912,7 @@ int cs46xx_dsp_set_iec958_volume (struct snd_cs46xx * chip, u16 left, u16 right)
1906 ins->spdif_input_volume_left = left; 1912 ins->spdif_input_volume_left = left;
1907 ins->spdif_input_volume_right = right; 1913 ins->spdif_input_volume_right = right;
1908 1914
1909 up(&chip->spos_mutex); 1915 mutex_unlock(&chip->spos_mutex);
1910 1916
1911 return 0; 1917 return 0;
1912} 1918}
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 @@
28#include <linux/pm.h> 28#include <linux/pm.h>
29#include <linux/init.h> 29#include <linux/init.h>
30#include <linux/slab.h> 30#include <linux/slab.h>
31#include <linux/mutex.h>
32
31#include <sound/core.h> 33#include <sound/core.h>
32#include <sound/control.h> 34#include <sound/control.h>
33#include <sound/info.h> 35#include <sound/info.h>
@@ -77,7 +79,7 @@ static void cs46xx_dsp_proc_scb_info_read (struct snd_info_entry *entry,
77 79
78 ins = chip->dsp_spos_instance; 80 ins = chip->dsp_spos_instance;
79 81
80 down(&chip->spos_mutex); 82 mutex_lock(&chip->spos_mutex);
81 snd_iprintf(buffer,"%04x %s:\n",scb->address,scb->scb_name); 83 snd_iprintf(buffer,"%04x %s:\n",scb->address,scb->scb_name);
82 84
83 for (col = 0,j = 0;j < 0x10; j++,col++) { 85 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,
105 scb->task_entry->address); 107 scb->task_entry->address);
106 108
107 snd_iprintf(buffer,"index [%d] ref_count [%d]\n",scb->index,scb->ref_count); 109 snd_iprintf(buffer,"index [%d] ref_count [%d]\n",scb->index,scb->ref_count);
108 up(&chip->spos_mutex); 110 mutex_unlock(&chip->spos_mutex);
109} 111}
110#endif 112#endif
111 113