linux 2.6.16.38 w/ vs2.0.3-rc1
[linux-2.6.git] / sound / pci / cs46xx / dsp_spos.c
index 5c9711c..81bcae0 100644 (file)
@@ -28,8 +28,6 @@
 #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>
@@ -293,7 +291,7 @@ void  cs46xx_dsp_spos_destroy (struct snd_cs46xx * chip)
 
        snd_assert(ins != NULL, return);
 
-       mutex_lock(&chip->spos_mutex);
+       down(&chip->spos_mutex);
        for (i = 0; i < ins->nscb; ++i) {
                if (ins->scbs[i].deleted) continue;
 
@@ -304,7 +302,7 @@ void  cs46xx_dsp_spos_destroy (struct snd_cs46xx * chip)
        vfree(ins->symbol_table.symbols);
        kfree(ins->modules);
        kfree(ins);
-       mutex_unlock(&chip->spos_mutex);
+       up(&chip->spos_mutex);
 }
 
 int cs46xx_dsp_load_module (struct snd_cs46xx * chip, struct dsp_module_desc * module)
@@ -503,7 +501,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;
 
-       mutex_lock(&chip->spos_mutex);
+       down(&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);
@@ -516,7 +514,7 @@ static void cs46xx_dsp_proc_modules_read (struct snd_info_entry *entry,
                                    desc->segment_type,desc->offset, desc->size);
                }
        }
-       mutex_unlock(&chip->spos_mutex);
+       up(&chip->spos_mutex);
 }
 
 static void cs46xx_dsp_proc_task_tree_read (struct snd_info_entry *entry,
@@ -527,7 +525,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;
 
-       mutex_lock(&chip->spos_mutex);
+       down(&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);
@@ -544,7 +542,7 @@ static void cs46xx_dsp_proc_task_tree_read (struct snd_info_entry *entry,
        }
 
        snd_iprintf(buffer,"\n");  
-       mutex_unlock(&chip->spos_mutex);
+       up(&chip->spos_mutex);
 }
 
 static void cs46xx_dsp_proc_scb_read (struct snd_info_entry *entry,
@@ -554,7 +552,7 @@ static void cs46xx_dsp_proc_scb_read (struct snd_info_entry *entry,
        struct dsp_spos_instance * ins = chip->dsp_spos_instance;
        int i;
 
-       mutex_lock(&chip->spos_mutex);
+       down(&chip->spos_mutex);
        snd_iprintf(buffer, "SCB's:\n");
        for ( i = 0; i < ins->nscb; ++i) {
                if (ins->scbs[i].deleted)
@@ -577,7 +575,7 @@ static void cs46xx_dsp_proc_scb_read (struct snd_info_entry *entry,
        }
 
        snd_iprintf(buffer,"\n");
-       mutex_unlock(&chip->spos_mutex);
+       up(&chip->spos_mutex);
 }
 
 static void cs46xx_dsp_proc_parameter_dump_read (struct snd_info_entry *entry,
@@ -767,6 +765,7 @@ int cs46xx_dsp_proc_init (struct snd_card *card, struct snd_cs46xx *chip)
        if ((entry = snd_info_create_card_entry(card, "dsp", card->proc_root)) != NULL) {
                entry->content = SNDRV_INFO_CONTENT_TEXT;
                entry->mode = S_IFDIR | S_IRUGO | S_IXUGO;
+               entry->c.text.read_size = 512;
       
                if (snd_info_register(entry) < 0) {
                        snd_info_free_entry(entry);
@@ -783,6 +782,7 @@ int cs46xx_dsp_proc_init (struct snd_card *card, struct snd_cs46xx *chip)
                entry->content = SNDRV_INFO_CONTENT_TEXT;
                entry->private_data = chip;
                entry->mode = S_IFREG | S_IRUGO | S_IWUSR;
+               entry->c.text.read_size = 512;
                entry->c.text.read = cs46xx_dsp_proc_symbol_table_read;
                if (snd_info_register(entry) < 0) {
                        snd_info_free_entry(entry);
@@ -795,6 +795,7 @@ int cs46xx_dsp_proc_init (struct snd_card *card, struct snd_cs46xx *chip)
                entry->content = SNDRV_INFO_CONTENT_TEXT;
                entry->private_data = chip;
                entry->mode = S_IFREG | S_IRUGO | S_IWUSR;
+               entry->c.text.read_size = 512;
                entry->c.text.read = cs46xx_dsp_proc_modules_read;
                if (snd_info_register(entry) < 0) {
                        snd_info_free_entry(entry);
@@ -807,6 +808,7 @@ int cs46xx_dsp_proc_init (struct snd_card *card, struct snd_cs46xx *chip)
                entry->content = SNDRV_INFO_CONTENT_TEXT;
                entry->private_data = chip;
                entry->mode = S_IFREG | S_IRUGO | S_IWUSR;
+               entry->c.text.read_size = 512;
                entry->c.text.read = cs46xx_dsp_proc_parameter_dump_read;
                if (snd_info_register(entry) < 0) {
                        snd_info_free_entry(entry);
@@ -819,6 +821,7 @@ int cs46xx_dsp_proc_init (struct snd_card *card, struct snd_cs46xx *chip)
                entry->content = SNDRV_INFO_CONTENT_TEXT;
                entry->private_data = chip;
                entry->mode = S_IFREG | S_IRUGO | S_IWUSR;
+               entry->c.text.read_size = 512;
                entry->c.text.read = cs46xx_dsp_proc_sample_dump_read;
                if (snd_info_register(entry) < 0) {
                        snd_info_free_entry(entry);
@@ -831,6 +834,7 @@ int cs46xx_dsp_proc_init (struct snd_card *card, struct snd_cs46xx *chip)
                entry->content = SNDRV_INFO_CONTENT_TEXT;
                entry->private_data = chip;
                entry->mode = S_IFREG | S_IRUGO | S_IWUSR;
+               entry->c.text.read_size = 512;
                entry->c.text.read = cs46xx_dsp_proc_task_tree_read;
                if (snd_info_register(entry) < 0) {
                        snd_info_free_entry(entry);
@@ -843,6 +847,7 @@ int cs46xx_dsp_proc_init (struct snd_card *card, struct snd_cs46xx *chip)
                entry->content = SNDRV_INFO_CONTENT_TEXT;
                entry->private_data = chip;
                entry->mode = S_IFREG | S_IRUGO | S_IWUSR;
+               entry->c.text.read_size = 1024;
                entry->c.text.read = cs46xx_dsp_proc_scb_read;
                if (snd_info_register(entry) < 0) {
                        snd_info_free_entry(entry);
@@ -851,14 +856,14 @@ int cs46xx_dsp_proc_init (struct snd_card *card, struct snd_cs46xx *chip)
        }
        ins->proc_scb_info_entry = entry;
 
-       mutex_lock(&chip->spos_mutex);
+       down(&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));
        }
-       mutex_unlock(&chip->spos_mutex);
+       up(&chip->spos_mutex);
 
        return 0;
 }
@@ -898,12 +903,12 @@ int cs46xx_dsp_proc_done (struct snd_cs46xx *chip)
                ins->proc_task_info_entry = NULL;
        }
 
-       mutex_lock(&chip->spos_mutex);
+       down(&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) );
        }
-       mutex_unlock(&chip->spos_mutex);
+       up(&chip->spos_mutex);
 
        if (ins->proc_dsp_dir) {
                snd_info_unregister (ins->proc_dsp_dir);
@@ -1693,7 +1698,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);
 
-       mutex_lock(&chip->spos_mutex);
+       down(&chip->spos_mutex);
 
        if ( ! (ins->spdif_status_out & DSP_SPDIF_STATUS_INPUT_CTRL_ENABLED) ) {
                /* time countdown enable */
@@ -1737,7 +1742,7 @@ int cs46xx_dsp_enable_spdif_in (struct snd_cs46xx *chip)
 
        /* monitor state */
        ins->spdif_status_in = 1;
-       mutex_unlock(&chip->spos_mutex);
+       up(&chip->spos_mutex);
 
        return 0;
 }
@@ -1749,7 +1754,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);  
 
-       mutex_lock(&chip->spos_mutex);
+       down(&chip->spos_mutex);
 
        /* Remove the asynchronous receiver SCB */
        cs46xx_dsp_remove_scb (chip,ins->asynch_rx_scb);
@@ -1759,7 +1764,7 @@ int cs46xx_dsp_disable_spdif_in (struct snd_cs46xx *chip)
 
        /* monitor state */
        ins->spdif_status_in = 0;
-       mutex_unlock(&chip->spos_mutex);
+       up(&chip->spos_mutex);
 
        /* restore amplifier */
        chip->active_ctrl(chip, -1);
@@ -1775,10 +1780,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);
 
-       mutex_lock(&chip->spos_mutex);
+       down(&chip->spos_mutex);
        ins->pcm_input = cs46xx_add_record_source(chip,ins->ref_snoop_scb,PCMSERIALIN_PCM_SCB_ADDR,
                                                   "PCMSerialInput_Wave");
-       mutex_unlock(&chip->spos_mutex);
+       up(&chip->spos_mutex);
 
        return 0;
 }
@@ -1789,10 +1794,10 @@ int cs46xx_dsp_disable_pcm_capture (struct snd_cs46xx *chip)
 
        snd_assert (ins->pcm_input != NULL,return -EINVAL);
 
-       mutex_lock(&chip->spos_mutex);
+       down(&chip->spos_mutex);
        cs46xx_dsp_remove_scb (chip,ins->pcm_input);
        ins->pcm_input = NULL;
-       mutex_unlock(&chip->spos_mutex);
+       up(&chip->spos_mutex);
 
        return 0;
 }
@@ -1804,10 +1809,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);
 
-       mutex_lock(&chip->spos_mutex);
+       down(&chip->spos_mutex);
        ins->adc_input = cs46xx_add_record_source(chip,ins->codec_in_scb,PCMSERIALIN_SCB_ADDR,
                                                  "PCMSerialInput_ADC");
-       mutex_unlock(&chip->spos_mutex);
+       up(&chip->spos_mutex);
 
        return 0;
 }
@@ -1818,10 +1823,10 @@ int cs46xx_dsp_disable_adc_capture (struct snd_cs46xx *chip)
 
        snd_assert (ins->adc_input != NULL,return -EINVAL);
 
-       mutex_lock(&chip->spos_mutex);
+       down(&chip->spos_mutex);
        cs46xx_dsp_remove_scb (chip,ins->adc_input);
        ins->adc_input = NULL;
-       mutex_unlock(&chip->spos_mutex);
+       up(&chip->spos_mutex);
 
        return 0;
 }
@@ -1868,7 +1873,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; 
 
-       mutex_lock(&chip->spos_mutex);
+       down(&chip->spos_mutex);
        
        /* main output */
        scb = ins->master_mix_scb->sub_list_ptr;
@@ -1887,7 +1892,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;
 
-       mutex_unlock(&chip->spos_mutex);
+       up(&chip->spos_mutex);
 
        return 0;
 }
@@ -1896,7 +1901,7 @@ int cs46xx_dsp_set_iec958_volume (struct snd_cs46xx * chip, u16 left, u16 right)
 {
        struct dsp_spos_instance * ins = chip->dsp_spos_instance;
 
-       mutex_lock(&chip->spos_mutex);
+       down(&chip->spos_mutex);
 
        if (ins->asynch_rx_scb != NULL)
                cs46xx_dsp_scb_set_volume (chip,ins->asynch_rx_scb,
@@ -1905,7 +1910,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;
 
-       mutex_unlock(&chip->spos_mutex);
+       up(&chip->spos_mutex);
 
        return 0;
 }