aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/cs46xx/dsp_spos.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/cs46xx/dsp_spos.c')
-rw-r--r--sound/pci/cs46xx/dsp_spos.c58
1 files changed, 30 insertions, 28 deletions
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 @@
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>
@@ -287,7 +289,7 @@ void cs46xx_dsp_spos_destroy (struct snd_cs46xx * chip)
287 289
288 snd_assert(ins != NULL, return); 290 snd_assert(ins != NULL, return);
289 291
290 down(&chip->spos_mutex); 292 mutex_lock(&chip->spos_mutex);
291 for (i = 0; i < ins->nscb; ++i) { 293 for (i = 0; i < ins->nscb; ++i) {
292 if (ins->scbs[i].deleted) continue; 294 if (ins->scbs[i].deleted) continue;
293 295
@@ -298,7 +300,7 @@ void cs46xx_dsp_spos_destroy (struct snd_cs46xx * chip)
298 vfree(ins->symbol_table.symbols); 300 vfree(ins->symbol_table.symbols);
299 kfree(ins->modules); 301 kfree(ins->modules);
300 kfree(ins); 302 kfree(ins);
301 up(&chip->spos_mutex); 303 mutex_unlock(&chip->spos_mutex);
302} 304}
303 305
304int cs46xx_dsp_load_module (struct snd_cs46xx * chip, struct dsp_module_desc * module) 306int 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,
497 struct dsp_spos_instance * ins = chip->dsp_spos_instance; 499 struct dsp_spos_instance * ins = chip->dsp_spos_instance;
498 int i,j; 500 int i,j;
499 501
500 down(&chip->spos_mutex); 502 mutex_lock(&chip->spos_mutex);
501 snd_iprintf(buffer, "MODULES:\n"); 503 snd_iprintf(buffer, "MODULES:\n");
502 for ( i = 0; i < ins->nmodules; ++i ) { 504 for ( i = 0; i < ins->nmodules; ++i ) {
503 snd_iprintf(buffer, "\n%s:\n", ins->modules[i].module_name); 505 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,
510 desc->segment_type,desc->offset, desc->size); 512 desc->segment_type,desc->offset, desc->size);
511 } 513 }
512 } 514 }
513 up(&chip->spos_mutex); 515 mutex_unlock(&chip->spos_mutex);
514} 516}
515 517
516static void cs46xx_dsp_proc_task_tree_read (struct snd_info_entry *entry, 518static 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,
521 int i, j, col; 523 int i, j, col;
522 void __iomem *dst = chip->region.idx[1].remap_addr + DSP_PARAMETER_BYTE_OFFSET; 524 void __iomem *dst = chip->region.idx[1].remap_addr + DSP_PARAMETER_BYTE_OFFSET;
523 525
524 down(&chip->spos_mutex); 526 mutex_lock(&chip->spos_mutex);
525 snd_iprintf(buffer, "TASK TREES:\n"); 527 snd_iprintf(buffer, "TASK TREES:\n");
526 for ( i = 0; i < ins->ntask; ++i) { 528 for ( i = 0; i < ins->ntask; ++i) {
527 snd_iprintf(buffer,"\n%04x %s:\n",ins->tasks[i].address,ins->tasks[i].task_name); 529 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,
538 } 540 }
539 541
540 snd_iprintf(buffer,"\n"); 542 snd_iprintf(buffer,"\n");
541 up(&chip->spos_mutex); 543 mutex_unlock(&chip->spos_mutex);
542} 544}
543 545
544static void cs46xx_dsp_proc_scb_read (struct snd_info_entry *entry, 546static 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,
548 struct dsp_spos_instance * ins = chip->dsp_spos_instance; 550 struct dsp_spos_instance * ins = chip->dsp_spos_instance;
549 int i; 551 int i;
550 552
551 down(&chip->spos_mutex); 553 mutex_lock(&chip->spos_mutex);
552 snd_iprintf(buffer, "SCB's:\n"); 554 snd_iprintf(buffer, "SCB's:\n");
553 for ( i = 0; i < ins->nscb; ++i) { 555 for ( i = 0; i < ins->nscb; ++i) {
554 if (ins->scbs[i].deleted) 556 if (ins->scbs[i].deleted)
@@ -571,7 +573,7 @@ static void cs46xx_dsp_proc_scb_read (struct snd_info_entry *entry,
571 } 573 }
572 574
573 snd_iprintf(buffer,"\n"); 575 snd_iprintf(buffer,"\n");
574 up(&chip->spos_mutex); 576 mutex_unlock(&chip->spos_mutex);
575} 577}
576 578
577static void cs46xx_dsp_proc_parameter_dump_read (struct snd_info_entry *entry, 579static 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)
852 } 854 }
853 ins->proc_scb_info_entry = entry; 855 ins->proc_scb_info_entry = entry;
854 856
855 down(&chip->spos_mutex); 857 mutex_lock(&chip->spos_mutex);
856 /* register/update SCB's entries on proc */ 858 /* register/update SCB's entries on proc */
857 for (i = 0; i < ins->nscb; ++i) { 859 for (i = 0; i < ins->nscb; ++i) {
858 if (ins->scbs[i].deleted) continue; 860 if (ins->scbs[i].deleted) continue;
859 861
860 cs46xx_dsp_proc_register_scb_desc (chip, (ins->scbs + i)); 862 cs46xx_dsp_proc_register_scb_desc (chip, (ins->scbs + i));
861 } 863 }
862 up(&chip->spos_mutex); 864 mutex_unlock(&chip->spos_mutex);
863 865
864 return 0; 866 return 0;
865} 867}
@@ -899,12 +901,12 @@ int cs46xx_dsp_proc_done (struct snd_cs46xx *chip)
899 ins->proc_task_info_entry = NULL; 901 ins->proc_task_info_entry = NULL;
900 } 902 }
901 903
902 down(&chip->spos_mutex); 904 mutex_lock(&chip->spos_mutex);
903 for (i = 0; i < ins->nscb; ++i) { 905 for (i = 0; i < ins->nscb; ++i) {
904 if (ins->scbs[i].deleted) continue; 906 if (ins->scbs[i].deleted) continue;
905 cs46xx_dsp_proc_free_scb_desc ( (ins->scbs + i) ); 907 cs46xx_dsp_proc_free_scb_desc ( (ins->scbs + i) );
906 } 908 }
907 up(&chip->spos_mutex); 909 mutex_unlock(&chip->spos_mutex);
908 910
909 if (ins->proc_dsp_dir) { 911 if (ins->proc_dsp_dir) {
910 snd_info_unregister (ins->proc_dsp_dir); 912 snd_info_unregister (ins->proc_dsp_dir);
@@ -1694,7 +1696,7 @@ int cs46xx_dsp_enable_spdif_in (struct snd_cs46xx *chip)
1694 snd_assert (ins->asynch_rx_scb == NULL,return -EINVAL); 1696 snd_assert (ins->asynch_rx_scb == NULL,return -EINVAL);
1695 snd_assert (ins->spdif_in_src != NULL,return -EINVAL); 1697 snd_assert (ins->spdif_in_src != NULL,return -EINVAL);
1696 1698
1697 down(&chip->spos_mutex); 1699 mutex_lock(&chip->spos_mutex);
1698 1700
1699 if ( ! (ins->spdif_status_out & DSP_SPDIF_STATUS_INPUT_CTRL_ENABLED) ) { 1701 if ( ! (ins->spdif_status_out & DSP_SPDIF_STATUS_INPUT_CTRL_ENABLED) ) {
1700 /* time countdown enable */ 1702 /* time countdown enable */
@@ -1738,7 +1740,7 @@ int cs46xx_dsp_enable_spdif_in (struct snd_cs46xx *chip)
1738 1740
1739 /* monitor state */ 1741 /* monitor state */
1740 ins->spdif_status_in = 1; 1742 ins->spdif_status_in = 1;
1741 up(&chip->spos_mutex); 1743 mutex_unlock(&chip->spos_mutex);
1742 1744
1743 return 0; 1745 return 0;
1744} 1746}
@@ -1750,7 +1752,7 @@ int cs46xx_dsp_disable_spdif_in (struct snd_cs46xx *chip)
1750 snd_assert (ins->asynch_rx_scb != NULL, return -EINVAL); 1752 snd_assert (ins->asynch_rx_scb != NULL, return -EINVAL);
1751 snd_assert (ins->spdif_in_src != NULL,return -EINVAL); 1753 snd_assert (ins->spdif_in_src != NULL,return -EINVAL);
1752 1754
1753 down(&chip->spos_mutex); 1755 mutex_lock(&chip->spos_mutex);
1754 1756
1755 /* Remove the asynchronous receiver SCB */ 1757 /* Remove the asynchronous receiver SCB */
1756 cs46xx_dsp_remove_scb (chip,ins->asynch_rx_scb); 1758 cs46xx_dsp_remove_scb (chip,ins->asynch_rx_scb);
@@ -1760,7 +1762,7 @@ int cs46xx_dsp_disable_spdif_in (struct snd_cs46xx *chip)
1760 1762
1761 /* monitor state */ 1763 /* monitor state */
1762 ins->spdif_status_in = 0; 1764 ins->spdif_status_in = 0;
1763 up(&chip->spos_mutex); 1765 mutex_unlock(&chip->spos_mutex);
1764 1766
1765 /* restore amplifier */ 1767 /* restore amplifier */
1766 chip->active_ctrl(chip, -1); 1768 chip->active_ctrl(chip, -1);
@@ -1776,10 +1778,10 @@ int cs46xx_dsp_enable_pcm_capture (struct snd_cs46xx *chip)
1776 snd_assert (ins->pcm_input == NULL,return -EINVAL); 1778 snd_assert (ins->pcm_input == NULL,return -EINVAL);
1777 snd_assert (ins->ref_snoop_scb != NULL,return -EINVAL); 1779 snd_assert (ins->ref_snoop_scb != NULL,return -EINVAL);
1778 1780
1779 down(&chip->spos_mutex); 1781 mutex_lock(&chip->spos_mutex);
1780 ins->pcm_input = cs46xx_add_record_source(chip,ins->ref_snoop_scb,PCMSERIALIN_PCM_SCB_ADDR, 1782 ins->pcm_input = cs46xx_add_record_source(chip,ins->ref_snoop_scb,PCMSERIALIN_PCM_SCB_ADDR,
1781 "PCMSerialInput_Wave"); 1783 "PCMSerialInput_Wave");
1782 up(&chip->spos_mutex); 1784 mutex_unlock(&chip->spos_mutex);
1783 1785
1784 return 0; 1786 return 0;
1785} 1787}
@@ -1790,10 +1792,10 @@ int cs46xx_dsp_disable_pcm_capture (struct snd_cs46xx *chip)
1790 1792
1791 snd_assert (ins->pcm_input != NULL,return -EINVAL); 1793 snd_assert (ins->pcm_input != NULL,return -EINVAL);
1792 1794
1793 down(&chip->spos_mutex); 1795 mutex_lock(&chip->spos_mutex);
1794 cs46xx_dsp_remove_scb (chip,ins->pcm_input); 1796 cs46xx_dsp_remove_scb (chip,ins->pcm_input);
1795 ins->pcm_input = NULL; 1797 ins->pcm_input = NULL;
1796 up(&chip->spos_mutex); 1798 mutex_unlock(&chip->spos_mutex);
1797 1799
1798 return 0; 1800 return 0;
1799} 1801}
@@ -1805,10 +1807,10 @@ int cs46xx_dsp_enable_adc_capture (struct snd_cs46xx *chip)
1805 snd_assert (ins->adc_input == NULL,return -EINVAL); 1807 snd_assert (ins->adc_input == NULL,return -EINVAL);
1806 snd_assert (ins->codec_in_scb != NULL,return -EINVAL); 1808 snd_assert (ins->codec_in_scb != NULL,return -EINVAL);
1807 1809
1808 down(&chip->spos_mutex); 1810 mutex_lock(&chip->spos_mutex);
1809 ins->adc_input = cs46xx_add_record_source(chip,ins->codec_in_scb,PCMSERIALIN_SCB_ADDR, 1811 ins->adc_input = cs46xx_add_record_source(chip,ins->codec_in_scb,PCMSERIALIN_SCB_ADDR,
1810 "PCMSerialInput_ADC"); 1812 "PCMSerialInput_ADC");
1811 up(&chip->spos_mutex); 1813 mutex_unlock(&chip->spos_mutex);
1812 1814
1813 return 0; 1815 return 0;
1814} 1816}
@@ -1819,10 +1821,10 @@ int cs46xx_dsp_disable_adc_capture (struct snd_cs46xx *chip)
1819 1821
1820 snd_assert (ins->adc_input != NULL,return -EINVAL); 1822 snd_assert (ins->adc_input != NULL,return -EINVAL);
1821 1823
1822 down(&chip->spos_mutex); 1824 mutex_lock(&chip->spos_mutex);
1823 cs46xx_dsp_remove_scb (chip,ins->adc_input); 1825 cs46xx_dsp_remove_scb (chip,ins->adc_input);
1824 ins->adc_input = NULL; 1826 ins->adc_input = NULL;
1825 up(&chip->spos_mutex); 1827 mutex_unlock(&chip->spos_mutex);
1826 1828
1827 return 0; 1829 return 0;
1828} 1830}
@@ -1869,7 +1871,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; 1871 struct dsp_spos_instance * ins = chip->dsp_spos_instance;
1870 struct dsp_scb_descriptor * scb; 1872 struct dsp_scb_descriptor * scb;
1871 1873
1872 down(&chip->spos_mutex); 1874 mutex_lock(&chip->spos_mutex);
1873 1875
1874 /* main output */ 1876 /* main output */
1875 scb = ins->master_mix_scb->sub_list_ptr; 1877 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)
1888 ins->dac_volume_left = left; 1890 ins->dac_volume_left = left;
1889 ins->dac_volume_right = right; 1891 ins->dac_volume_right = right;
1890 1892
1891 up(&chip->spos_mutex); 1893 mutex_unlock(&chip->spos_mutex);
1892 1894
1893 return 0; 1895 return 0;
1894} 1896}
@@ -1897,7 +1899,7 @@ int cs46xx_dsp_set_iec958_volume (struct snd_cs46xx * chip, u16 left, u16 right)
1897{ 1899{
1898 struct dsp_spos_instance * ins = chip->dsp_spos_instance; 1900 struct dsp_spos_instance * ins = chip->dsp_spos_instance;
1899 1901
1900 down(&chip->spos_mutex); 1902 mutex_lock(&chip->spos_mutex);
1901 1903
1902 if (ins->asynch_rx_scb != NULL) 1904 if (ins->asynch_rx_scb != NULL)
1903 cs46xx_dsp_scb_set_volume (chip,ins->asynch_rx_scb, 1905 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)
1906 ins->spdif_input_volume_left = left; 1908 ins->spdif_input_volume_left = left;
1907 ins->spdif_input_volume_right = right; 1909 ins->spdif_input_volume_right = right;
1908 1910
1909 up(&chip->spos_mutex); 1911 mutex_unlock(&chip->spos_mutex);
1910 1912
1911 return 0; 1913 return 0;
1912} 1914}