blob: 7c44667e79a6498bb1137d4dcc3e11a3a78a342c [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * The driver for the Cirrus Logic's Sound Fusion CS46XX based soundcards
Jaroslav Kyselac1017a42007-10-15 09:50:19 +02003 * Copyright (c) by Jaroslav Kysela <perex@perex.cz>
Linus Torvalds1da177e2005-04-16 15:20:36 -07004 *
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 Iwai3d19f802005-11-17 14:48:14 +010068struct dsp_symbol_entry {
Linus Torvalds1da177e2005-04-16 15:20:36 -070069 u32 address;
70 char symbol_name[DSP_MAX_SYMBOL_NAME];
71 int symbol_type;
72
73 /* initialized by driver */
Takashi Iwai3d19f802005-11-17 14:48:14 +010074 struct dsp_module_desc * module;
Linus Torvalds1da177e2005-04-16 15:20:36 -070075 int deleted;
Takashi Iwai3d19f802005-11-17 14:48:14 +010076};
Linus Torvalds1da177e2005-04-16 15:20:36 -070077
Takashi Iwai3d19f802005-11-17 14:48:14 +010078struct dsp_symbol_desc {
Linus Torvalds1da177e2005-04-16 15:20:36 -070079 int nsymbols;
80
Takashi Iwai3d19f802005-11-17 14:48:14 +010081 struct dsp_symbol_entry *symbols;
Linus Torvalds1da177e2005-04-16 15:20:36 -070082
83 /* initialized by driver */
84 int highest_frag_index;
Takashi Iwai3d19f802005-11-17 14:48:14 +010085};
Linus Torvalds1da177e2005-04-16 15:20:36 -070086
Takashi Iwai3d19f802005-11-17 14:48:14 +010087struct dsp_segment_desc {
Linus Torvalds1da177e2005-04-16 15:20:36 -070088 int segment_type;
89 u32 offset;
90 u32 size;
91 u32 * data;
Takashi Iwai3d19f802005-11-17 14:48:14 +010092};
Linus Torvalds1da177e2005-04-16 15:20:36 -070093
Takashi Iwai3d19f802005-11-17 14:48:14 +010094struct dsp_module_desc {
Linus Torvalds1da177e2005-04-16 15:20:36 -070095 char * module_name;
Takashi Iwai3d19f802005-11-17 14:48:14 +010096 struct dsp_symbol_desc symbol_table;
Linus Torvalds1da177e2005-04-16 15:20:36 -070097 int nsegments;
Takashi Iwai3d19f802005-11-17 14:48:14 +010098 struct dsp_segment_desc * segments;
Linus Torvalds1da177e2005-04-16 15:20:36 -070099
100 /* initialized by driver */
101 u32 overlay_begin_address;
102 u32 load_address;
103 int nfixups;
Takashi Iwai3d19f802005-11-17 14:48:14 +0100104};
Linus Torvalds1da177e2005-04-16 15:20:36 -0700105
Takashi Iwai3d19f802005-11-17 14:48:14 +0100106struct dsp_scb_descriptor {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700107 char scb_name[DSP_MAX_SCB_NAME];
108 u32 address;
109 int index;
Takashi Iwai89f157d2007-07-19 11:23:21 +0200110 u32 *data;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700111
Takashi Iwai3d19f802005-11-17 14:48:14 +0100112 struct dsp_scb_descriptor * sub_list_ptr;
113 struct dsp_scb_descriptor * next_scb_ptr;
114 struct dsp_scb_descriptor * parent_scb_ptr;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700115
Takashi Iwai3d19f802005-11-17 14:48:14 +0100116 struct dsp_symbol_entry * task_entry;
117 struct dsp_symbol_entry * scb_symbol;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700118
Takashi Iwai3d19f802005-11-17 14:48:14 +0100119 struct snd_info_entry *proc_info;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700120 int ref_count;
121 spinlock_t lock;
122
123 int deleted;
Takashi Iwai3d19f802005-11-17 14:48:14 +0100124};
Linus Torvalds1da177e2005-04-16 15:20:36 -0700125
Takashi Iwai3d19f802005-11-17 14:48:14 +0100126struct dsp_task_descriptor {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700127 char task_name[DSP_MAX_TASK_NAME];
128 int size;
129 u32 address;
130 int index;
Takashi Iwai89f157d2007-07-19 11:23:21 +0200131 u32 *data;
Takashi Iwai3d19f802005-11-17 14:48:14 +0100132};
Linus Torvalds1da177e2005-04-16 15:20:36 -0700133
Takashi Iwai3d19f802005-11-17 14:48:14 +0100134struct dsp_pcm_channel_descriptor {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700135 int active;
136 int src_slot;
137 int pcm_slot;
138 u32 sample_rate;
139 u32 unlinked;
Takashi Iwai3d19f802005-11-17 14:48:14 +0100140 struct dsp_scb_descriptor * pcm_reader_scb;
141 struct dsp_scb_descriptor * src_scb;
142 struct dsp_scb_descriptor * mixer_scb;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700143
144 void * private_data;
Takashi Iwai3d19f802005-11-17 14:48:14 +0100145};
Linus Torvalds1da177e2005-04-16 15:20:36 -0700146
Takashi Iwai3d19f802005-11-17 14:48:14 +0100147struct dsp_spos_instance {
148 struct dsp_symbol_desc symbol_table; /* currently availble loaded symbols in SP */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700149
150 int nmodules;
Takashi Iwai3d19f802005-11-17 14:48:14 +0100151 struct dsp_module_desc * modules; /* modules loaded into SP */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700152
Takashi Iwai3d19f802005-11-17 14:48:14 +0100153 struct dsp_segment_desc code;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700154
155 /* Main PCM playback mixer */
Takashi Iwai3d19f802005-11-17 14:48:14 +0100156 struct dsp_scb_descriptor * master_mix_scb;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700157 u16 dac_volume_right;
158 u16 dac_volume_left;
159
160 /* Rear/surround PCM playback mixer */
Takashi Iwai3d19f802005-11-17 14:48:14 +0100161 struct dsp_scb_descriptor * rear_mix_scb;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700162
163 /* Center/LFE mixer */
Takashi Iwai3d19f802005-11-17 14:48:14 +0100164 struct dsp_scb_descriptor * center_lfe_mix_scb;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700165
166 int npcm_channels;
167 int nsrc_scb;
Takashi Iwai3d19f802005-11-17 14:48:14 +0100168 struct dsp_pcm_channel_descriptor pcm_channels[DSP_MAX_PCM_CHANNELS];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700169 int src_scb_slots[DSP_MAX_SRC_NR];
170
171 /* cache this symbols */
Takashi Iwai3d19f802005-11-17 14:48:14 +0100172 struct dsp_symbol_entry * null_algorithm; /* used by PCMreaderSCB's */
173 struct dsp_symbol_entry * s16_up; /* used by SRCtaskSCB's */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700174
175 /* proc fs */
Takashi Iwai3d19f802005-11-17 14:48:14 +0100176 struct snd_card *snd_card;
177 struct snd_info_entry * proc_dsp_dir;
178 struct snd_info_entry * proc_sym_info_entry;
179 struct snd_info_entry * proc_modules_info_entry;
180 struct snd_info_entry * proc_parameter_dump_info_entry;
181 struct snd_info_entry * proc_sample_dump_info_entry;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700182
183 /* SCB's descriptors */
184 int nscb;
185 int scb_highest_frag_index;
Takashi Iwai3d19f802005-11-17 14:48:14 +0100186 struct dsp_scb_descriptor scbs[DSP_MAX_SCB_DESC];
187 struct snd_info_entry * proc_scb_info_entry;
188 struct dsp_scb_descriptor * the_null_scb;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700189
190 /* Task's descriptors */
191 int ntask;
Takashi Iwai3d19f802005-11-17 14:48:14 +0100192 struct dsp_task_descriptor tasks[DSP_MAX_TASK_DESC];
193 struct snd_info_entry * proc_task_info_entry;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700194
195 /* SPDIF status */
196 int spdif_status_out;
197 int spdif_status_in;
198 u16 spdif_input_volume_right;
199 u16 spdif_input_volume_left;
200 /* spdif channel status,
201 left right and user validity bits */
202 unsigned int spdif_csuv_default;
203 unsigned int spdif_csuv_stream;
204
205 /* SPDIF input sample rate converter */
Takashi Iwai3d19f802005-11-17 14:48:14 +0100206 struct dsp_scb_descriptor * spdif_in_src;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700207 /* SPDIF input asynch. receiver */
Takashi Iwai3d19f802005-11-17 14:48:14 +0100208 struct dsp_scb_descriptor * asynch_rx_scb;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700209
210 /* Capture record mixer SCB */
Takashi Iwai3d19f802005-11-17 14:48:14 +0100211 struct dsp_scb_descriptor * record_mixer_scb;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700212
213 /* CODEC input SCB */
Takashi Iwai3d19f802005-11-17 14:48:14 +0100214 struct dsp_scb_descriptor * codec_in_scb;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700215
216 /* reference snooper */
Takashi Iwai3d19f802005-11-17 14:48:14 +0100217 struct dsp_scb_descriptor * ref_snoop_scb;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700218
219 /* SPDIF output PCM reference */
Takashi Iwai3d19f802005-11-17 14:48:14 +0100220 struct dsp_scb_descriptor * spdif_pcm_input_scb;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700221
222 /* asynch TX task */
Takashi Iwai3d19f802005-11-17 14:48:14 +0100223 struct dsp_scb_descriptor * asynch_tx_scb;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700224
225 /* record sources */
Takashi Iwai3d19f802005-11-17 14:48:14 +0100226 struct dsp_scb_descriptor * pcm_input;
227 struct dsp_scb_descriptor * adc_input;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700228
229 int spdif_in_sample_rate;
Takashi Iwai3d19f802005-11-17 14:48:14 +0100230};
Linus Torvalds1da177e2005-04-16 15:20:36 -0700231
232#endif /* __DSP_SPOS_H__ */