| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* | 
|  | 2 | *  The driver for the Cirrus Logic's Sound Fusion CS46XX based soundcards | 
| Jaroslav Kysela | c1017a4 | 2007-10-15 09:50:19 +0200 | [diff] [blame] | 3 | *  Copyright (c) by Jaroslav Kysela <perex@perex.cz> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4 | * | 
|  | 5 | * | 
|  | 6 | *   This program is free software; you can redistribute it and/or modify | 
|  | 7 | *   it under the terms of the GNU General Public License as published by | 
|  | 8 | *   the Free Software Foundation; either version 2 of the License, or | 
|  | 9 | *   (at your option) any later version. | 
|  | 10 | * | 
|  | 11 | *   This program is distributed in the hope that it will be useful, | 
|  | 12 | *   but WITHOUT ANY WARRANTY; without even the implied warranty of | 
|  | 13 | *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
|  | 14 | *   GNU General Public License for more details. | 
|  | 15 | * | 
|  | 16 | *   You should have received a copy of the GNU General Public License | 
|  | 17 | *   along with this program; if not, write to the Free Software | 
|  | 18 | *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA | 
|  | 19 | * | 
|  | 20 | */ | 
|  | 21 |  | 
|  | 22 | #ifndef __CS46XX_DSP_SPOS_H__ | 
|  | 23 | #define __CS46XX_DSP_SPOS_H__ | 
|  | 24 |  | 
|  | 25 | #include "cs46xx_dsp_scb_types.h" | 
|  | 26 | #include "cs46xx_dsp_task_types.h" | 
|  | 27 |  | 
|  | 28 | #define SYMBOL_CONSTANT  0x0 | 
|  | 29 | #define SYMBOL_SAMPLE    0x1 | 
|  | 30 | #define SYMBOL_PARAMETER 0x2 | 
|  | 31 | #define SYMBOL_CODE      0x3 | 
|  | 32 |  | 
|  | 33 | #define SEGTYPE_SP_PROGRAM              0x00000001 | 
|  | 34 | #define SEGTYPE_SP_PARAMETER            0x00000002 | 
|  | 35 | #define SEGTYPE_SP_SAMPLE               0x00000003 | 
|  | 36 | #define SEGTYPE_SP_COEFFICIENT          0x00000004 | 
|  | 37 |  | 
|  | 38 | #define DSP_SPOS_UU      0x0deadul     /* unused */ | 
|  | 39 | #define DSP_SPOS_DC      0x0badul      /* don't care */ | 
|  | 40 | #define DSP_SPOS_DC_DC   0x0bad0badul  /* don't care */ | 
|  | 41 | #define DSP_SPOS_UUUU    0xdeadc0edul  /* unused */ | 
|  | 42 | #define DSP_SPOS_UUHI    0xdeadul | 
|  | 43 | #define DSP_SPOS_UULO    0xc0edul | 
|  | 44 | #define DSP_SPOS_DCDC    0x0badf1d0ul  /* don't care */ | 
|  | 45 | #define DSP_SPOS_DCDCHI  0x0badul | 
|  | 46 | #define DSP_SPOS_DCDCLO  0xf1d0ul | 
|  | 47 |  | 
|  | 48 | #define DSP_MAX_TASK_NAME   60 | 
|  | 49 | #define DSP_MAX_SYMBOL_NAME 100 | 
|  | 50 | #define DSP_MAX_SCB_NAME    60 | 
|  | 51 | #define DSP_MAX_SCB_DESC    200 | 
|  | 52 | #define DSP_MAX_TASK_DESC   50 | 
|  | 53 |  | 
|  | 54 | #define DSP_MAX_PCM_CHANNELS 32 | 
|  | 55 | #define DSP_MAX_SRC_NR       14 | 
|  | 56 |  | 
|  | 57 | #define DSP_PCM_MAIN_CHANNEL        1 | 
|  | 58 | #define DSP_PCM_REAR_CHANNEL        2 | 
|  | 59 | #define DSP_PCM_CENTER_LFE_CHANNEL  3 | 
|  | 60 | #define DSP_PCM_S71_CHANNEL         4 /* surround 7.1 */ | 
|  | 61 | #define DSP_IEC958_CHANNEL          5 | 
|  | 62 |  | 
|  | 63 | #define DSP_SPDIF_STATUS_OUTPUT_ENABLED       1 | 
|  | 64 | #define DSP_SPDIF_STATUS_PLAYBACK_OPEN        2 | 
|  | 65 | #define DSP_SPDIF_STATUS_HW_ENABLED           4 | 
|  | 66 | #define DSP_SPDIF_STATUS_INPUT_CTRL_ENABLED   8 | 
|  | 67 |  | 
| Takashi Iwai | 3d19f80 | 2005-11-17 14:48:14 +0100 | [diff] [blame] | 68 | struct dsp_symbol_entry { | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 69 | u32 address; | 
|  | 70 | char symbol_name[DSP_MAX_SYMBOL_NAME]; | 
|  | 71 | int symbol_type; | 
|  | 72 |  | 
|  | 73 | /* initialized by driver */ | 
| Takashi Iwai | 3d19f80 | 2005-11-17 14:48:14 +0100 | [diff] [blame] | 74 | struct dsp_module_desc * module; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 75 | int deleted; | 
| Takashi Iwai | 3d19f80 | 2005-11-17 14:48:14 +0100 | [diff] [blame] | 76 | }; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 77 |  | 
| Takashi Iwai | 3d19f80 | 2005-11-17 14:48:14 +0100 | [diff] [blame] | 78 | struct dsp_symbol_desc { | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 79 | int nsymbols; | 
|  | 80 |  | 
| Takashi Iwai | 3d19f80 | 2005-11-17 14:48:14 +0100 | [diff] [blame] | 81 | struct dsp_symbol_entry *symbols; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 82 |  | 
|  | 83 | /* initialized by driver */ | 
|  | 84 | int highest_frag_index; | 
| Takashi Iwai | 3d19f80 | 2005-11-17 14:48:14 +0100 | [diff] [blame] | 85 | }; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 86 |  | 
| Takashi Iwai | 3d19f80 | 2005-11-17 14:48:14 +0100 | [diff] [blame] | 87 | struct dsp_segment_desc { | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 88 | int segment_type; | 
|  | 89 | u32 offset; | 
|  | 90 | u32 size; | 
|  | 91 | u32 * data; | 
| Takashi Iwai | 3d19f80 | 2005-11-17 14:48:14 +0100 | [diff] [blame] | 92 | }; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 93 |  | 
| Takashi Iwai | 3d19f80 | 2005-11-17 14:48:14 +0100 | [diff] [blame] | 94 | struct dsp_module_desc { | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 95 | char * module_name; | 
| Takashi Iwai | 3d19f80 | 2005-11-17 14:48:14 +0100 | [diff] [blame] | 96 | struct dsp_symbol_desc symbol_table; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 97 | int nsegments; | 
| Takashi Iwai | 3d19f80 | 2005-11-17 14:48:14 +0100 | [diff] [blame] | 98 | struct dsp_segment_desc * segments; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 99 |  | 
|  | 100 | /* initialized by driver */ | 
|  | 101 | u32 overlay_begin_address; | 
|  | 102 | u32 load_address; | 
|  | 103 | int nfixups; | 
| Takashi Iwai | 3d19f80 | 2005-11-17 14:48:14 +0100 | [diff] [blame] | 104 | }; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 105 |  | 
| Takashi Iwai | 3d19f80 | 2005-11-17 14:48:14 +0100 | [diff] [blame] | 106 | struct dsp_scb_descriptor { | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 107 | char scb_name[DSP_MAX_SCB_NAME]; | 
|  | 108 | u32 address; | 
|  | 109 | int index; | 
| Takashi Iwai | 89f157d | 2007-07-19 11:23:21 +0200 | [diff] [blame] | 110 | u32 *data; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 111 |  | 
| Takashi Iwai | 3d19f80 | 2005-11-17 14:48:14 +0100 | [diff] [blame] | 112 | struct dsp_scb_descriptor * sub_list_ptr; | 
|  | 113 | struct dsp_scb_descriptor * next_scb_ptr; | 
|  | 114 | struct dsp_scb_descriptor * parent_scb_ptr; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 115 |  | 
| Takashi Iwai | 3d19f80 | 2005-11-17 14:48:14 +0100 | [diff] [blame] | 116 | struct dsp_symbol_entry * task_entry; | 
|  | 117 | struct dsp_symbol_entry * scb_symbol; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 118 |  | 
| Takashi Iwai | 3d19f80 | 2005-11-17 14:48:14 +0100 | [diff] [blame] | 119 | struct snd_info_entry *proc_info; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 120 | int ref_count; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 121 |  | 
| Takashi Iwai | 41116e9 | 2009-12-22 09:00:14 +0100 | [diff] [blame] | 122 | u16 volume[2]; | 
|  | 123 | unsigned int deleted :1; | 
|  | 124 | unsigned int updated :1; | 
|  | 125 | unsigned int volume_set :1; | 
| Takashi Iwai | 3d19f80 | 2005-11-17 14:48:14 +0100 | [diff] [blame] | 126 | }; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 127 |  | 
| Takashi Iwai | 3d19f80 | 2005-11-17 14:48:14 +0100 | [diff] [blame] | 128 | struct dsp_task_descriptor { | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 129 | char task_name[DSP_MAX_TASK_NAME]; | 
|  | 130 | int size; | 
|  | 131 | u32 address; | 
|  | 132 | int index; | 
| Takashi Iwai | 89f157d | 2007-07-19 11:23:21 +0200 | [diff] [blame] | 133 | u32 *data; | 
| Takashi Iwai | 3d19f80 | 2005-11-17 14:48:14 +0100 | [diff] [blame] | 134 | }; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 135 |  | 
| Takashi Iwai | 3d19f80 | 2005-11-17 14:48:14 +0100 | [diff] [blame] | 136 | struct dsp_pcm_channel_descriptor { | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 137 | int active; | 
|  | 138 | int src_slot; | 
|  | 139 | int pcm_slot; | 
|  | 140 | u32 sample_rate; | 
|  | 141 | u32 unlinked; | 
| Takashi Iwai | 3d19f80 | 2005-11-17 14:48:14 +0100 | [diff] [blame] | 142 | struct dsp_scb_descriptor * pcm_reader_scb; | 
|  | 143 | struct dsp_scb_descriptor * src_scb; | 
|  | 144 | struct dsp_scb_descriptor * mixer_scb; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 145 |  | 
|  | 146 | void * private_data; | 
| Takashi Iwai | 3d19f80 | 2005-11-17 14:48:14 +0100 | [diff] [blame] | 147 | }; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 148 |  | 
| Takashi Iwai | 3d19f80 | 2005-11-17 14:48:14 +0100 | [diff] [blame] | 149 | struct dsp_spos_instance { | 
|  | 150 | struct dsp_symbol_desc symbol_table; /* currently availble loaded symbols in SP */ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 151 |  | 
|  | 152 | int nmodules; | 
| Takashi Iwai | 3d19f80 | 2005-11-17 14:48:14 +0100 | [diff] [blame] | 153 | struct dsp_module_desc * modules; /* modules loaded into SP */ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 154 |  | 
| Takashi Iwai | 3d19f80 | 2005-11-17 14:48:14 +0100 | [diff] [blame] | 155 | struct dsp_segment_desc code; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 156 |  | 
|  | 157 | /* Main PCM playback mixer */ | 
| Takashi Iwai | 3d19f80 | 2005-11-17 14:48:14 +0100 | [diff] [blame] | 158 | struct dsp_scb_descriptor * master_mix_scb; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 159 | u16 dac_volume_right; | 
|  | 160 | u16 dac_volume_left; | 
|  | 161 |  | 
|  | 162 | /* Rear/surround PCM playback mixer */ | 
| Takashi Iwai | 3d19f80 | 2005-11-17 14:48:14 +0100 | [diff] [blame] | 163 | struct dsp_scb_descriptor * rear_mix_scb; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 164 |  | 
|  | 165 | /* Center/LFE mixer */ | 
| Takashi Iwai | 3d19f80 | 2005-11-17 14:48:14 +0100 | [diff] [blame] | 166 | struct dsp_scb_descriptor * center_lfe_mix_scb; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 167 |  | 
|  | 168 | int npcm_channels; | 
|  | 169 | int nsrc_scb; | 
| Takashi Iwai | 3d19f80 | 2005-11-17 14:48:14 +0100 | [diff] [blame] | 170 | struct dsp_pcm_channel_descriptor pcm_channels[DSP_MAX_PCM_CHANNELS]; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 171 | int src_scb_slots[DSP_MAX_SRC_NR]; | 
|  | 172 |  | 
|  | 173 | /* cache this symbols */ | 
| Takashi Iwai | 3d19f80 | 2005-11-17 14:48:14 +0100 | [diff] [blame] | 174 | struct dsp_symbol_entry * null_algorithm; /* used by PCMreaderSCB's */ | 
|  | 175 | struct dsp_symbol_entry * s16_up;         /* used by SRCtaskSCB's */ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 176 |  | 
|  | 177 | /* proc fs */ | 
| Takashi Iwai | 3d19f80 | 2005-11-17 14:48:14 +0100 | [diff] [blame] | 178 | struct snd_card *snd_card; | 
|  | 179 | struct snd_info_entry * proc_dsp_dir; | 
|  | 180 | struct snd_info_entry * proc_sym_info_entry; | 
|  | 181 | struct snd_info_entry * proc_modules_info_entry; | 
|  | 182 | struct snd_info_entry * proc_parameter_dump_info_entry; | 
|  | 183 | struct snd_info_entry * proc_sample_dump_info_entry; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 184 |  | 
|  | 185 | /* SCB's descriptors */ | 
|  | 186 | int nscb; | 
|  | 187 | int scb_highest_frag_index; | 
| Takashi Iwai | 3d19f80 | 2005-11-17 14:48:14 +0100 | [diff] [blame] | 188 | struct dsp_scb_descriptor scbs[DSP_MAX_SCB_DESC]; | 
|  | 189 | struct snd_info_entry * proc_scb_info_entry; | 
|  | 190 | struct dsp_scb_descriptor * the_null_scb; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 191 |  | 
|  | 192 | /* Task's descriptors */ | 
|  | 193 | int ntask; | 
| Takashi Iwai | 3d19f80 | 2005-11-17 14:48:14 +0100 | [diff] [blame] | 194 | struct dsp_task_descriptor tasks[DSP_MAX_TASK_DESC]; | 
|  | 195 | struct snd_info_entry * proc_task_info_entry; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 196 |  | 
|  | 197 | /* SPDIF status */ | 
|  | 198 | int spdif_status_out; | 
|  | 199 | int spdif_status_in; | 
|  | 200 | u16 spdif_input_volume_right; | 
|  | 201 | u16 spdif_input_volume_left; | 
|  | 202 | /* spdif channel status, | 
|  | 203 | left right and user validity bits */ | 
|  | 204 | unsigned int spdif_csuv_default; | 
|  | 205 | unsigned int spdif_csuv_stream; | 
|  | 206 |  | 
|  | 207 | /* SPDIF input sample rate converter */ | 
| Takashi Iwai | 3d19f80 | 2005-11-17 14:48:14 +0100 | [diff] [blame] | 208 | struct dsp_scb_descriptor * spdif_in_src; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 209 | /* SPDIF input asynch. receiver */ | 
| Takashi Iwai | 3d19f80 | 2005-11-17 14:48:14 +0100 | [diff] [blame] | 210 | struct dsp_scb_descriptor * asynch_rx_scb; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 211 |  | 
|  | 212 | /* Capture record mixer SCB */ | 
| Takashi Iwai | 3d19f80 | 2005-11-17 14:48:14 +0100 | [diff] [blame] | 213 | struct dsp_scb_descriptor * record_mixer_scb; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 214 |  | 
|  | 215 | /* CODEC input SCB */ | 
| Takashi Iwai | 3d19f80 | 2005-11-17 14:48:14 +0100 | [diff] [blame] | 216 | struct dsp_scb_descriptor * codec_in_scb; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 217 |  | 
|  | 218 | /* reference snooper */ | 
| Takashi Iwai | 3d19f80 | 2005-11-17 14:48:14 +0100 | [diff] [blame] | 219 | struct dsp_scb_descriptor * ref_snoop_scb; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 220 |  | 
|  | 221 | /* SPDIF output  PCM reference  */ | 
| Takashi Iwai | 3d19f80 | 2005-11-17 14:48:14 +0100 | [diff] [blame] | 222 | struct dsp_scb_descriptor * spdif_pcm_input_scb; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 223 |  | 
|  | 224 | /* asynch TX task */ | 
| Takashi Iwai | 3d19f80 | 2005-11-17 14:48:14 +0100 | [diff] [blame] | 225 | struct dsp_scb_descriptor * asynch_tx_scb; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 226 |  | 
|  | 227 | /* record sources */ | 
| Takashi Iwai | 3d19f80 | 2005-11-17 14:48:14 +0100 | [diff] [blame] | 228 | struct dsp_scb_descriptor * pcm_input; | 
|  | 229 | struct dsp_scb_descriptor * adc_input; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 230 |  | 
|  | 231 | int spdif_in_sample_rate; | 
| Takashi Iwai | 3d19f80 | 2005-11-17 14:48:14 +0100 | [diff] [blame] | 232 | }; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 233 |  | 
|  | 234 | #endif /* __DSP_SPOS_H__ */ |