X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sound%2Fpci%2Fcs46xx%2Fdsp_spos.c;h=89c402770a1d148648cd59b305d1663317de279b;hb=refs%2Fheads%2Fvserver;hp=0bd4b33d0a19420f0d685c4c6d13e88f1f83ef80;hpb=c7b5ebbddf7bcd3651947760f423e3783bbe6573;p=linux-2.6.git diff --git a/sound/pci/cs46xx/dsp_spos.c b/sound/pci/cs46xx/dsp_spos.c index 0bd4b33d0..89c402770 100644 --- a/sound/pci/cs46xx/dsp_spos.c +++ b/sound/pci/cs46xx/dsp_spos.c @@ -28,6 +28,8 @@ #include #include #include +#include + #include #include #include @@ -37,7 +39,10 @@ #include "cs46xx_lib.h" #include "dsp_spos.h" -static wide_opcode_t wide_opcodes[] = { +static int cs46xx_dsp_async_init (struct snd_cs46xx *chip, + struct dsp_scb_descriptor * fg_entry); + +static enum wide_opcode wide_opcodes[] = { WIDE_FOR_BEGIN_LOOP, WIDE_FOR_BEGIN_LOOP2, WIDE_COND_GOTO_ADDR, @@ -52,12 +57,13 @@ static wide_opcode_t wide_opcodes[] = { WIDE_TBEQ_NCOND_CALL1_ADDR }; -static int shadow_and_reallocate_code (cs46xx_t * chip,u32 * data,u32 size, u32 overlay_begin_address) +static int shadow_and_reallocate_code (struct snd_cs46xx * chip, u32 * data, u32 size, + u32 overlay_begin_address) { unsigned int i = 0, j, nreallocated = 0; u32 hival,loval,address; u32 mop_operands,mop_type,wide_op; - dsp_spos_instance_t * ins = chip->dsp_spos_instance; + struct dsp_spos_instance * ins = chip->dsp_spos_instance; snd_assert( ((size % 2) == 0), return -EINVAL); @@ -112,7 +118,7 @@ static int shadow_and_reallocate_code (cs46xx_t * chip,u32 * data,u32 size, u32 return nreallocated; } -static segment_desc_t * get_segment_desc (dsp_module_desc_t * module, int seg_type) +static struct dsp_segment_desc * get_segment_desc (struct dsp_module_desc * module, int seg_type) { int i; for (i = 0;i < module->nsegments; ++i) { @@ -124,7 +130,7 @@ static segment_desc_t * get_segment_desc (dsp_module_desc_t * module, int seg_ty return NULL; }; -static int find_free_symbol_index (dsp_spos_instance_t * ins) +static int find_free_symbol_index (struct dsp_spos_instance * ins) { int index = ins->symbol_table.nsymbols,i; @@ -138,10 +144,10 @@ static int find_free_symbol_index (dsp_spos_instance_t * ins) return index; } -static int add_symbols (cs46xx_t * chip, dsp_module_desc_t * module) +static int add_symbols (struct snd_cs46xx * chip, struct dsp_module_desc * module) { int i; - dsp_spos_instance_t * ins = chip->dsp_spos_instance; + struct dsp_spos_instance * ins = chip->dsp_spos_instance; if (module->symbol_table.nsymbols > 0) { if (!strcmp(module->symbol_table.symbols[0].symbol_name, "OVERLAYBEGINADDRESS") && @@ -179,10 +185,11 @@ static int add_symbols (cs46xx_t * chip, dsp_module_desc_t * module) return 0; } -static symbol_entry_t * add_symbol (cs46xx_t * chip, char * symbol_name, u32 address, int type) +static struct dsp_symbol_entry * +add_symbol (struct snd_cs46xx * chip, char * symbol_name, u32 address, int type) { - dsp_spos_instance_t * ins = chip->dsp_spos_instance; - symbol_entry_t * symbol = NULL; + struct dsp_spos_instance * ins = chip->dsp_spos_instance; + struct dsp_symbol_entry * symbol = NULL; int index; if (ins->symbol_table.nsymbols == (DSP_MAX_SYMBOLS - 1)) { @@ -215,22 +222,22 @@ static symbol_entry_t * add_symbol (cs46xx_t * chip, char * symbol_name, u32 add return symbol; } -dsp_spos_instance_t * cs46xx_dsp_spos_create (cs46xx_t * chip) +struct dsp_spos_instance *cs46xx_dsp_spos_create (struct snd_cs46xx * chip) { - dsp_spos_instance_t * ins = kmalloc(sizeof(dsp_spos_instance_t), GFP_KERNEL); + struct dsp_spos_instance * ins = kzalloc(sizeof(struct dsp_spos_instance), GFP_KERNEL); if (ins == NULL) return NULL; - memset(ins, 0, sizeof(*ins)); /* better to use vmalloc for this big table */ ins->symbol_table.nsymbols = 0; - ins->symbol_table.symbols = vmalloc(sizeof(symbol_entry_t) * DSP_MAX_SYMBOLS); + ins->symbol_table.symbols = vmalloc(sizeof(struct dsp_symbol_entry) * + DSP_MAX_SYMBOLS); ins->symbol_table.highest_frag_index = 0; if (ins->symbol_table.symbols == NULL) { cs46xx_dsp_spos_destroy(chip); - return NULL; + goto error; } ins->code.offset = 0; @@ -239,18 +246,18 @@ dsp_spos_instance_t * cs46xx_dsp_spos_create (cs46xx_t * chip) if (ins->code.data == NULL) { cs46xx_dsp_spos_destroy(chip); - return NULL; + goto error; } ins->nscb = 0; ins->ntask = 0; ins->nmodules = 0; - ins->modules = kmalloc(sizeof(dsp_module_desc_t) * DSP_MAX_MODULES, GFP_KERNEL); + ins->modules = kmalloc(sizeof(struct dsp_module_desc) * DSP_MAX_MODULES, GFP_KERNEL); if (ins->modules == NULL) { cs46xx_dsp_spos_destroy(chip); - return NULL; + goto error; } /* default SPDIF input sample rate @@ -273,41 +280,39 @@ dsp_spos_instance_t * cs46xx_dsp_spos_create (cs46xx_t * chip) /* left and right validity bits */ (1 << 13) | (1 << 12); return ins; + +error: + kfree(ins); + return NULL; } -void cs46xx_dsp_spos_destroy (cs46xx_t * chip) +void cs46xx_dsp_spos_destroy (struct snd_cs46xx * chip) { int i; - dsp_spos_instance_t * ins = chip->dsp_spos_instance; + struct dsp_spos_instance * ins = chip->dsp_spos_instance; 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; cs46xx_dsp_proc_free_scb_desc ( (ins->scbs + i) ); } - if (ins->code.data) - kfree(ins->code.data); - - if (ins->symbol_table.symbols) - vfree(ins->symbol_table.symbols); - - if (ins->modules) - kfree(ins->modules); - + kfree(ins->code.data); + vfree(ins->symbol_table.symbols); + kfree(ins->modules); kfree(ins); - up(&chip->spos_mutex); + mutex_unlock(&chip->spos_mutex); } -int cs46xx_dsp_load_module (cs46xx_t * chip, dsp_module_desc_t * module) +int cs46xx_dsp_load_module (struct snd_cs46xx * chip, struct dsp_module_desc * module) { - dsp_spos_instance_t * ins = chip->dsp_spos_instance; - segment_desc_t * code = get_segment_desc (module,SEGTYPE_SP_PROGRAM); - segment_desc_t * parameter = get_segment_desc (module,SEGTYPE_SP_PARAMETER); - segment_desc_t * sample = get_segment_desc (module,SEGTYPE_SP_SAMPLE); + struct dsp_spos_instance * ins = chip->dsp_spos_instance; + struct dsp_segment_desc * code = get_segment_desc (module,SEGTYPE_SP_PROGRAM); + struct dsp_segment_desc * parameter = get_segment_desc (module,SEGTYPE_SP_PARAMETER); + struct dsp_segment_desc * sample = get_segment_desc (module,SEGTYPE_SP_SAMPLE); u32 doffset, dsize; if (ins->nmodules == DSP_MAX_MODULES - 1) { @@ -414,10 +419,11 @@ int cs46xx_dsp_load_module (cs46xx_t * chip, dsp_module_desc_t * module) return 0; } -symbol_entry_t * cs46xx_dsp_lookup_symbol (cs46xx_t * chip, char * symbol_name, int symbol_type) +struct dsp_symbol_entry * +cs46xx_dsp_lookup_symbol (struct snd_cs46xx * chip, char * symbol_name, int symbol_type) { int i; - dsp_spos_instance_t * ins = chip->dsp_spos_instance; + struct dsp_spos_instance * ins = chip->dsp_spos_instance; for ( i = 0; i < ins->symbol_table.nsymbols; ++i ) { @@ -439,10 +445,12 @@ symbol_entry_t * cs46xx_dsp_lookup_symbol (cs46xx_t * chip, char * symbol_name, } -symbol_entry_t * cs46xx_dsp_lookup_symbol_addr (cs46xx_t * chip, u32 address, int symbol_type) +#ifdef CONFIG_PROC_FS +static struct dsp_symbol_entry * +cs46xx_dsp_lookup_symbol_addr (struct snd_cs46xx * chip, u32 address, int symbol_type) { int i; - dsp_spos_instance_t * ins = chip->dsp_spos_instance; + struct dsp_spos_instance * ins = chip->dsp_spos_instance; for ( i = 0; i < ins->symbol_table.nsymbols; ++i ) { @@ -460,10 +468,11 @@ symbol_entry_t * cs46xx_dsp_lookup_symbol_addr (cs46xx_t * chip, u32 address, in } -static void cs46xx_dsp_proc_symbol_table_read (snd_info_entry_t *entry, snd_info_buffer_t * buffer) +static void cs46xx_dsp_proc_symbol_table_read (struct snd_info_entry *entry, + struct snd_info_buffer *buffer) { - cs46xx_t *chip = entry->private_data; - dsp_spos_instance_t * ins = chip->dsp_spos_instance; + struct snd_cs46xx *chip = entry->private_data; + struct dsp_spos_instance * ins = chip->dsp_spos_instance; int i; snd_iprintf(buffer, "SYMBOLS:\n"); @@ -487,13 +496,14 @@ static void cs46xx_dsp_proc_symbol_table_read (snd_info_entry_t *entry, snd_info } -static void cs46xx_dsp_proc_modules_read (snd_info_entry_t *entry, snd_info_buffer_t * buffer) +static void cs46xx_dsp_proc_modules_read (struct snd_info_entry *entry, + struct snd_info_buffer *buffer) { - cs46xx_t *chip = entry->private_data; - dsp_spos_instance_t * ins = chip->dsp_spos_instance; + struct snd_cs46xx *chip = entry->private_data; + 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); @@ -501,22 +511,23 @@ static void cs46xx_dsp_proc_modules_read (snd_info_entry_t *entry, snd_info_buff snd_iprintf(buffer, " %d fixups\n", ins->modules[i].nfixups); for (j = 0; j < ins->modules[i].nsegments; ++ j) { - segment_desc_t * desc = (ins->modules[i].segments + j); + struct dsp_segment_desc * desc = (ins->modules[i].segments + j); snd_iprintf(buffer, " segment %02x offset %08x size %08x\n", desc->segment_type,desc->offset, desc->size); } } - up(&chip->spos_mutex); + mutex_unlock(&chip->spos_mutex); } -static void cs46xx_dsp_proc_task_tree_read (snd_info_entry_t *entry, snd_info_buffer_t * buffer) +static void cs46xx_dsp_proc_task_tree_read (struct snd_info_entry *entry, + struct snd_info_buffer *buffer) { - cs46xx_t *chip = entry->private_data; - dsp_spos_instance_t * ins = chip->dsp_spos_instance; - int i,j,col; - unsigned long dst = chip->region.idx[1].remap_addr + DSP_PARAMETER_BYTE_OFFSET; + struct snd_cs46xx *chip = entry->private_data; + struct dsp_spos_instance * ins = chip->dsp_spos_instance; + 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); @@ -533,16 +544,17 @@ static void cs46xx_dsp_proc_task_tree_read (snd_info_entry_t *entry, snd_info_bu } snd_iprintf(buffer,"\n"); - up(&chip->spos_mutex); + mutex_unlock(&chip->spos_mutex); } -static void cs46xx_dsp_proc_scb_read (snd_info_entry_t *entry, snd_info_buffer_t * buffer) +static void cs46xx_dsp_proc_scb_read (struct snd_info_entry *entry, + struct snd_info_buffer *buffer) { - cs46xx_t *chip = entry->private_data; - dsp_spos_instance_t * ins = chip->dsp_spos_instance; + struct snd_cs46xx *chip = entry->private_data; + 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) @@ -565,16 +577,17 @@ static void cs46xx_dsp_proc_scb_read (snd_info_entry_t *entry, snd_info_buffer_t } snd_iprintf(buffer,"\n"); - up(&chip->spos_mutex); + mutex_unlock(&chip->spos_mutex); } -static void cs46xx_dsp_proc_parameter_dump_read (snd_info_entry_t *entry, snd_info_buffer_t * buffer) +static void cs46xx_dsp_proc_parameter_dump_read (struct snd_info_entry *entry, + struct snd_info_buffer *buffer) { - cs46xx_t *chip = entry->private_data; - /*dsp_spos_instance_t * ins = chip->dsp_spos_instance; */ - unsigned int i,col = 0; - unsigned long dst = chip->region.idx[1].remap_addr + DSP_PARAMETER_BYTE_OFFSET; - symbol_entry_t * symbol; + struct snd_cs46xx *chip = entry->private_data; + /*struct dsp_spos_instance * ins = chip->dsp_spos_instance; */ + unsigned int i, col = 0; + void __iomem *dst = chip->region.idx[1].remap_addr + DSP_PARAMETER_BYTE_OFFSET; + struct dsp_symbol_entry * symbol; for (i = 0;i < DSP_PARAMETER_BYTE_SIZE; i += sizeof(u32),col ++) { if (col == 4) { @@ -595,11 +608,12 @@ static void cs46xx_dsp_proc_parameter_dump_read (snd_info_entry_t *entry, snd_in } } -static void cs46xx_dsp_proc_sample_dump_read (snd_info_entry_t *entry, snd_info_buffer_t * buffer) +static void cs46xx_dsp_proc_sample_dump_read (struct snd_info_entry *entry, + struct snd_info_buffer *buffer) { - cs46xx_t *chip = entry->private_data; + struct snd_cs46xx *chip = entry->private_data; int i,col = 0; - unsigned long dst = chip->region.idx[2].remap_addr; + void __iomem *dst = chip->region.idx[2].remap_addr; snd_iprintf(buffer,"PCMREADER:\n"); for (i = PCM_READER_BUF1;i < PCM_READER_BUF1 + 0x30; i += sizeof(u32),col ++) { @@ -742,10 +756,10 @@ static void cs46xx_dsp_proc_sample_dump_read (snd_info_entry_t *entry, snd_info_ snd_iprintf(buffer,"\n"); } -int cs46xx_dsp_proc_init (snd_card_t * card, cs46xx_t *chip) +int cs46xx_dsp_proc_init (struct snd_card *card, struct snd_cs46xx *chip) { - snd_info_entry_t *entry; - dsp_spos_instance_t * ins = chip->dsp_spos_instance; + struct snd_info_entry *entry; + struct dsp_spos_instance * ins = chip->dsp_spos_instance; int i; ins->snd_card = card; @@ -753,7 +767,6 @@ int cs46xx_dsp_proc_init (snd_card_t * card, cs46xx_t *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); @@ -770,7 +783,6 @@ int cs46xx_dsp_proc_init (snd_card_t * card, cs46xx_t *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); @@ -783,7 +795,6 @@ int cs46xx_dsp_proc_init (snd_card_t * card, cs46xx_t *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); @@ -796,7 +807,6 @@ int cs46xx_dsp_proc_init (snd_card_t * card, cs46xx_t *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); @@ -809,7 +819,6 @@ int cs46xx_dsp_proc_init (snd_card_t * card, cs46xx_t *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); @@ -822,7 +831,6 @@ int cs46xx_dsp_proc_init (snd_card_t * card, cs46xx_t *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); @@ -835,7 +843,6 @@ int cs46xx_dsp_proc_init (snd_card_t * card, cs46xx_t *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); @@ -844,97 +851,85 @@ int cs46xx_dsp_proc_init (snd_card_t * card, cs46xx_t *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; } -int cs46xx_dsp_proc_done (cs46xx_t *chip) +int cs46xx_dsp_proc_done (struct snd_cs46xx *chip) { - dsp_spos_instance_t * ins = chip->dsp_spos_instance; + struct dsp_spos_instance * ins = chip->dsp_spos_instance; int i; - if (ins->proc_sym_info_entry) { - snd_info_unregister(ins->proc_sym_info_entry); - ins->proc_sym_info_entry = NULL; - } - - if (ins->proc_modules_info_entry) { - snd_info_unregister(ins->proc_modules_info_entry); - ins->proc_modules_info_entry = NULL; - } - - if (ins->proc_parameter_dump_info_entry) { - snd_info_unregister(ins->proc_parameter_dump_info_entry); - ins->proc_parameter_dump_info_entry = NULL; - } - - if (ins->proc_sample_dump_info_entry) { - snd_info_unregister(ins->proc_sample_dump_info_entry); - ins->proc_sample_dump_info_entry = NULL; - } - - if (ins->proc_scb_info_entry) { - snd_info_unregister(ins->proc_scb_info_entry); - ins->proc_scb_info_entry = NULL; - } - - if (ins->proc_task_info_entry) { - snd_info_unregister(ins->proc_task_info_entry); - ins->proc_task_info_entry = NULL; - } + snd_info_free_entry(ins->proc_sym_info_entry); + ins->proc_sym_info_entry = NULL; - down(&chip->spos_mutex); + snd_info_free_entry(ins->proc_modules_info_entry); + ins->proc_modules_info_entry = NULL; + + snd_info_free_entry(ins->proc_parameter_dump_info_entry); + ins->proc_parameter_dump_info_entry = NULL; + + snd_info_free_entry(ins->proc_sample_dump_info_entry); + ins->proc_sample_dump_info_entry = NULL; + + snd_info_free_entry(ins->proc_scb_info_entry); + ins->proc_scb_info_entry = NULL; + + snd_info_free_entry(ins->proc_task_info_entry); + ins->proc_task_info_entry = NULL; + + 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); - ins->proc_dsp_dir = NULL; - } + snd_info_free_entry(ins->proc_dsp_dir); + ins->proc_dsp_dir = NULL; return 0; } +#endif /* CONFIG_PROC_FS */ static int debug_tree; -static void _dsp_create_task_tree (cs46xx_t *chip,u32 * task_data, u32 dest, int size) +static void _dsp_create_task_tree (struct snd_cs46xx *chip, u32 * task_data, + u32 dest, int size) { - unsigned long spdst = chip->region.idx[1].remap_addr + + void __iomem *spdst = chip->region.idx[1].remap_addr + DSP_PARAMETER_BYTE_OFFSET + dest * sizeof(u32); int i; for (i = 0; i < size; ++i) { - if (debug_tree) printk ("addr %08x, val %08x\n",(int)spdst,task_data[i]); + if (debug_tree) printk ("addr %p, val %08x\n",spdst,task_data[i]); writel(task_data[i],spdst); spdst += sizeof(u32); } } static int debug_scb; -static void _dsp_create_scb (cs46xx_t *chip,u32 * scb_data, u32 dest) +static void _dsp_create_scb (struct snd_cs46xx *chip, u32 * scb_data, u32 dest) { - unsigned long spdst = chip->region.idx[1].remap_addr + + void __iomem *spdst = chip->region.idx[1].remap_addr + DSP_PARAMETER_BYTE_OFFSET + dest * sizeof(u32); int i; for (i = 0; i < 0x10; ++i) { - if (debug_scb) printk ("addr %08x, val %08x\n",(int)spdst,scb_data[i]); + if (debug_scb) printk ("addr %p, val %08x\n",spdst,scb_data[i]); writel(scb_data[i],spdst); spdst += sizeof(u32); } } -static int find_free_scb_index (dsp_spos_instance_t * ins) +static int find_free_scb_index (struct dsp_spos_instance * ins) { int index = ins->nscb, i; @@ -948,10 +943,10 @@ static int find_free_scb_index (dsp_spos_instance_t * ins) return index; } -static dsp_scb_descriptor_t * _map_scb (cs46xx_t *chip,char * name,u32 dest) +static struct dsp_scb_descriptor * _map_scb (struct snd_cs46xx *chip, char * name, u32 dest) { - dsp_spos_instance_t * ins = chip->dsp_spos_instance; - dsp_scb_descriptor_t * desc = NULL; + struct dsp_spos_instance * ins = chip->dsp_spos_instance; + struct dsp_scb_descriptor * desc = NULL; int index; if (ins->nscb == DSP_MAX_SCB_DESC - 1) { @@ -981,10 +976,11 @@ static dsp_scb_descriptor_t * _map_scb (cs46xx_t *chip,char * name,u32 dest) return desc; } -static dsp_task_descriptor_t * _map_task_tree (cs46xx_t *chip,char * name,u32 dest,u32 size) +static struct dsp_task_descriptor * +_map_task_tree (struct snd_cs46xx *chip, char * name, u32 dest, u32 size) { - dsp_spos_instance_t * ins = chip->dsp_spos_instance; - dsp_task_descriptor_t * desc = NULL; + struct dsp_spos_instance * ins = chip->dsp_spos_instance; + struct dsp_task_descriptor * desc = NULL; if (ins->ntask == DSP_MAX_TASK_DESC - 1) { snd_printk(KERN_ERR "dsp_spos: got no place for other TASK\n"); @@ -1004,9 +1000,10 @@ static dsp_task_descriptor_t * _map_task_tree (cs46xx_t *chip,char * name,u32 de return desc; } -dsp_scb_descriptor_t * cs46xx_dsp_create_scb (cs46xx_t *chip,char * name, u32 * scb_data,u32 dest) +struct dsp_scb_descriptor * +cs46xx_dsp_create_scb (struct snd_cs46xx *chip, char * name, u32 * scb_data, u32 dest) { - dsp_scb_descriptor_t * desc; + struct dsp_scb_descriptor * desc; desc = _map_scb (chip,name,dest); if (desc) { @@ -1019,9 +1016,11 @@ dsp_scb_descriptor_t * cs46xx_dsp_create_scb (cs46xx_t *chip,char * name, u32 * } -dsp_task_descriptor_t * cs46xx_dsp_create_task_tree (cs46xx_t *chip,char * name, u32 * task_data,u32 dest,int size) +static struct dsp_task_descriptor * +cs46xx_dsp_create_task_tree (struct snd_cs46xx *chip, char * name, u32 * task_data, + u32 dest, int size) { - dsp_task_descriptor_t * desc; + struct dsp_task_descriptor * desc; desc = _map_task_tree (chip,name,dest,size); if (desc) { @@ -1033,31 +1032,31 @@ dsp_task_descriptor_t * cs46xx_dsp_create_task_tree (cs46xx_t *chip,char * name return desc; } -int cs46xx_dsp_scb_and_task_init (cs46xx_t *chip) +int cs46xx_dsp_scb_and_task_init (struct snd_cs46xx *chip) { - dsp_spos_instance_t * ins = chip->dsp_spos_instance; - symbol_entry_t * fg_task_tree_header_code; - symbol_entry_t * task_tree_header_code; - symbol_entry_t * task_tree_thread; - symbol_entry_t * null_algorithm; - symbol_entry_t * magic_snoop_task; - - dsp_scb_descriptor_t * timing_master_scb; - dsp_scb_descriptor_t * codec_out_scb; - dsp_scb_descriptor_t * codec_in_scb; - dsp_scb_descriptor_t * src_task_scb; - dsp_scb_descriptor_t * master_mix_scb; - dsp_scb_descriptor_t * rear_mix_scb; - dsp_scb_descriptor_t * record_mix_scb; - dsp_scb_descriptor_t * write_back_scb; - dsp_scb_descriptor_t * vari_decimate_scb; - dsp_scb_descriptor_t * rear_codec_out_scb; - dsp_scb_descriptor_t * clfe_codec_out_scb; - dsp_scb_descriptor_t * magic_snoop_scb; + struct dsp_spos_instance * ins = chip->dsp_spos_instance; + struct dsp_symbol_entry * fg_task_tree_header_code; + struct dsp_symbol_entry * task_tree_header_code; + struct dsp_symbol_entry * task_tree_thread; + struct dsp_symbol_entry * null_algorithm; + struct dsp_symbol_entry * magic_snoop_task; + + struct dsp_scb_descriptor * timing_master_scb; + struct dsp_scb_descriptor * codec_out_scb; + struct dsp_scb_descriptor * codec_in_scb; + struct dsp_scb_descriptor * src_task_scb; + struct dsp_scb_descriptor * master_mix_scb; + struct dsp_scb_descriptor * rear_mix_scb; + struct dsp_scb_descriptor * record_mix_scb; + struct dsp_scb_descriptor * write_back_scb; + struct dsp_scb_descriptor * vari_decimate_scb; + struct dsp_scb_descriptor * rear_codec_out_scb; + struct dsp_scb_descriptor * clfe_codec_out_scb; + struct dsp_scb_descriptor * magic_snoop_scb; - int fifo_addr,fifo_span,valid_slots; + int fifo_addr, fifo_span, valid_slots; - static spos_control_block_t sposcb = { + static struct dsp_spos_control_block sposcb = { /* 0 */ HFG_TREE_SCB,HFG_STACK, /* 1 */ SPOSCB_ADDR,BG_TREE_SCB_ADDR, /* 2 */ DSP_SPOS_DC,0, @@ -1110,7 +1109,7 @@ int cs46xx_dsp_scb_and_task_init (cs46xx_t *chip) { /* create the null SCB */ - static generic_scb_t null_scb = { + static struct dsp_generic_scb null_scb = { { 0, 0, 0, 0 }, { 0, 0, 0, 0, 0 }, NULL_SCB_ADDR, NULL_SCB_ADDR, @@ -1132,7 +1131,7 @@ int cs46xx_dsp_scb_and_task_init (cs46xx_t *chip) { /* setup foreground task tree */ - static task_tree_control_block_t fg_task_tree_hdr = { + static struct dsp_task_tree_control_block fg_task_tree_hdr = { { FG_TASK_HEADER_ADDR | (DSP_SPOS_DC << 0x10), DSP_SPOS_DC_DC, DSP_SPOS_DC_DC, @@ -1208,7 +1207,7 @@ int cs46xx_dsp_scb_and_task_init (cs46xx_t *chip) { /* setup foreground task tree */ - static task_tree_control_block_t bg_task_tree_hdr = { + static struct dsp_task_tree_control_block bg_task_tree_hdr = { { DSP_SPOS_DC_DC, DSP_SPOS_DC_DC, DSP_SPOS_DC_DC, @@ -1317,7 +1316,7 @@ int cs46xx_dsp_scb_and_task_init (cs46xx_t *chip) if (!write_back_scb) goto _fail_end; { - static mix2_ostream_spb_t mix2_ostream_spb = { + static struct dsp_mix2_ostream_spb mix2_ostream_spb = { 0x00020000, 0x0000ffff }; @@ -1452,13 +1451,14 @@ int cs46xx_dsp_scb_and_task_init (cs46xx_t *chip) return -EINVAL; } -int cs46xx_dsp_async_init (cs46xx_t *chip, dsp_scb_descriptor_t * fg_entry) +static int cs46xx_dsp_async_init (struct snd_cs46xx *chip, + struct dsp_scb_descriptor * fg_entry) { - dsp_spos_instance_t * ins = chip->dsp_spos_instance; - symbol_entry_t * s16_async_codec_input_task; - symbol_entry_t * spdifo_task; - symbol_entry_t * spdifi_task; - dsp_scb_descriptor_t * spdifi_scb_desc,* spdifo_scb_desc,* async_codec_scb_desc; + struct dsp_spos_instance * ins = chip->dsp_spos_instance; + struct dsp_symbol_entry * s16_async_codec_input_task; + struct dsp_symbol_entry * spdifo_task; + struct dsp_symbol_entry * spdifi_task; + struct dsp_scb_descriptor * spdifi_scb_desc, * spdifo_scb_desc, * async_codec_scb_desc; s16_async_codec_input_task = cs46xx_dsp_lookup_symbol(chip, "S16_ASYNCCODECINPUTTASK", SYMBOL_CODE); if (s16_async_codec_input_task == NULL) { @@ -1479,7 +1479,7 @@ int cs46xx_dsp_async_init (cs46xx_t *chip, dsp_scb_descriptor_t * fg_entry) { /* 0xBC0 */ - spdifoscb_t spdifo_scb = { + struct dsp_spdifoscb spdifo_scb = { /* 0 */ DSP_SPOS_UUUU, { /* 1 */ 0xb0, @@ -1508,7 +1508,7 @@ int cs46xx_dsp_async_init (cs46xx_t *chip, dsp_scb_descriptor_t * fg_entry) }; /* 0xBB0 */ - spdifiscb_t spdifi_scb = { + struct dsp_spdifiscb spdifi_scb = { /* 0 */ DSP_SPOS_UULO,DSP_SPOS_UUHI, /* 1 */ 0, /* 2 */ 0, @@ -1533,7 +1533,7 @@ int cs46xx_dsp_async_init (cs46xx_t *chip, dsp_scb_descriptor_t * fg_entry) }; /* 0xBA0 */ - async_codec_input_scb_t async_codec_input_scb = { + struct dsp_async_codec_input_scb async_codec_input_scb = { /* 0 */ DSP_SPOS_UUUU, /* 1 */ 0, /* 2 */ 0, @@ -1624,9 +1624,9 @@ int cs46xx_dsp_async_init (cs46xx_t *chip, dsp_scb_descriptor_t * fg_entry) } -static void cs46xx_dsp_disable_spdif_hw (cs46xx_t *chip) +static void cs46xx_dsp_disable_spdif_hw (struct snd_cs46xx *chip) { - dsp_spos_instance_t * ins = chip->dsp_spos_instance; + struct dsp_spos_instance * ins = chip->dsp_spos_instance; /* set SPDIF output FIFO slot */ snd_cs46xx_pokeBA0(chip, BA0_ASER_FADDR, 0); @@ -1645,9 +1645,9 @@ static void cs46xx_dsp_disable_spdif_hw (cs46xx_t *chip) ins->spdif_status_out &= ~DSP_SPDIF_STATUS_HW_ENABLED; } -int cs46xx_dsp_enable_spdif_hw (cs46xx_t *chip) +int cs46xx_dsp_enable_spdif_hw (struct snd_cs46xx *chip) { - dsp_spos_instance_t * ins = chip->dsp_spos_instance; + struct dsp_spos_instance * ins = chip->dsp_spos_instance; /* if hw-ctrl already enabled, turn off to reset logic ... */ cs46xx_dsp_disable_spdif_hw (chip); @@ -1668,9 +1668,9 @@ int cs46xx_dsp_enable_spdif_hw (cs46xx_t *chip) return 0; } -int cs46xx_dsp_enable_spdif_in (cs46xx_t *chip) +int cs46xx_dsp_enable_spdif_in (struct snd_cs46xx *chip) { - dsp_spos_instance_t * ins = chip->dsp_spos_instance; + struct dsp_spos_instance * ins = chip->dsp_spos_instance; /* turn on amplifier */ chip->active_ctrl(chip, 1); @@ -1679,7 +1679,7 @@ int cs46xx_dsp_enable_spdif_in (cs46xx_t *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 */ @@ -1723,19 +1723,19 @@ int cs46xx_dsp_enable_spdif_in (cs46xx_t *chip) /* monitor state */ ins->spdif_status_in = 1; - up(&chip->spos_mutex); + mutex_unlock(&chip->spos_mutex); return 0; } -int cs46xx_dsp_disable_spdif_in (cs46xx_t *chip) +int cs46xx_dsp_disable_spdif_in (struct snd_cs46xx *chip) { - dsp_spos_instance_t * ins = chip->dsp_spos_instance; + struct dsp_spos_instance * ins = chip->dsp_spos_instance; 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); @@ -1745,7 +1745,7 @@ int cs46xx_dsp_disable_spdif_in (cs46xx_t *chip) /* monitor state */ ins->spdif_status_in = 0; - up(&chip->spos_mutex); + mutex_unlock(&chip->spos_mutex); /* restore amplifier */ chip->active_ctrl(chip, -1); @@ -1754,65 +1754,65 @@ int cs46xx_dsp_disable_spdif_in (cs46xx_t *chip) return 0; } -int cs46xx_dsp_enable_pcm_capture (cs46xx_t *chip) +int cs46xx_dsp_enable_pcm_capture (struct snd_cs46xx *chip) { - dsp_spos_instance_t * ins = chip->dsp_spos_instance; + struct dsp_spos_instance * ins = chip->dsp_spos_instance; 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; } -int cs46xx_dsp_disable_pcm_capture (cs46xx_t *chip) +int cs46xx_dsp_disable_pcm_capture (struct snd_cs46xx *chip) { - dsp_spos_instance_t * ins = chip->dsp_spos_instance; + struct dsp_spos_instance * ins = chip->dsp_spos_instance; 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; } -int cs46xx_dsp_enable_adc_capture (cs46xx_t *chip) +int cs46xx_dsp_enable_adc_capture (struct snd_cs46xx *chip) { - dsp_spos_instance_t * ins = chip->dsp_spos_instance; + struct dsp_spos_instance * ins = chip->dsp_spos_instance; 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; } -int cs46xx_dsp_disable_adc_capture (cs46xx_t *chip) +int cs46xx_dsp_disable_adc_capture (struct snd_cs46xx *chip) { - dsp_spos_instance_t * ins = chip->dsp_spos_instance; + struct dsp_spos_instance * ins = chip->dsp_spos_instance; 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; } -int cs46xx_poke_via_dsp (cs46xx_t *chip,u32 address,u32 data) +int cs46xx_poke_via_dsp (struct snd_cs46xx *chip, u32 address, u32 data) { u32 temp; int i; @@ -1849,12 +1849,12 @@ int cs46xx_poke_via_dsp (cs46xx_t *chip,u32 address,u32 data) return 0; } -int cs46xx_dsp_set_dac_volume (cs46xx_t * chip,u16 left,u16 right) +int cs46xx_dsp_set_dac_volume (struct snd_cs46xx * chip, u16 left, u16 right) { - dsp_spos_instance_t * ins = chip->dsp_spos_instance; - dsp_scb_descriptor_t * scb; + 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; @@ -1873,15 +1873,16 @@ int cs46xx_dsp_set_dac_volume (cs46xx_t * 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; } -int cs46xx_dsp_set_iec958_volume (cs46xx_t * chip,u16 left,u16 right) { - dsp_spos_instance_t * ins = chip->dsp_spos_instance; +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, @@ -1890,7 +1891,7 @@ int cs46xx_dsp_set_iec958_volume (cs46xx_t * 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; }