drm/virtio: Don't return error if virtio-gpu PCI dev is not found
[drm/drm-misc.git] / sound / pci / cs46xx / cs46xx_dsp_spos.h
blob2fa9c7d6acc3c1c985c5a05f49935e7169cad67a
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3 * The driver for the Cirrus Logic's Sound Fusion CS46XX based soundcards
4 * Copyright (c) by Jaroslav Kysela <perex@perex.cz>
5 */
7 #ifndef __CS46XX_DSP_SPOS_H__
8 #define __CS46XX_DSP_SPOS_H__
10 #include "cs46xx_dsp_scb_types.h"
11 #include "cs46xx_dsp_task_types.h"
13 #define SYMBOL_CONSTANT 0x0
14 #define SYMBOL_SAMPLE 0x1
15 #define SYMBOL_PARAMETER 0x2
16 #define SYMBOL_CODE 0x3
18 #define SEGTYPE_SP_PROGRAM 0x00000001
19 #define SEGTYPE_SP_PARAMETER 0x00000002
20 #define SEGTYPE_SP_SAMPLE 0x00000003
21 #define SEGTYPE_SP_COEFFICIENT 0x00000004
23 #define DSP_SPOS_UU 0x0deadul /* unused */
24 #define DSP_SPOS_DC 0x0badul /* don't care */
25 #define DSP_SPOS_DC_DC 0x0bad0badul /* don't care */
26 #define DSP_SPOS_UUUU 0xdeadc0edul /* unused */
27 #define DSP_SPOS_UUHI 0xdeadul
28 #define DSP_SPOS_UULO 0xc0edul
29 #define DSP_SPOS_DCDC 0x0badf1d0ul /* don't care */
30 #define DSP_SPOS_DCDCHI 0x0badul
31 #define DSP_SPOS_DCDCLO 0xf1d0ul
33 #define DSP_MAX_TASK_NAME 60
34 #define DSP_MAX_SYMBOL_NAME 100
35 #define DSP_MAX_SCB_NAME 60
36 #define DSP_MAX_SCB_DESC 200
37 #define DSP_MAX_TASK_DESC 50
39 #define DSP_MAX_PCM_CHANNELS 32
40 #define DSP_MAX_SRC_NR 14
42 #define DSP_PCM_MAIN_CHANNEL 1
43 #define DSP_PCM_REAR_CHANNEL 2
44 #define DSP_PCM_CENTER_LFE_CHANNEL 3
45 #define DSP_PCM_S71_CHANNEL 4 /* surround 7.1 */
46 #define DSP_IEC958_CHANNEL 5
48 #define DSP_SPDIF_STATUS_OUTPUT_ENABLED 1
49 #define DSP_SPDIF_STATUS_PLAYBACK_OPEN 2
50 #define DSP_SPDIF_STATUS_HW_ENABLED 4
51 #define DSP_SPDIF_STATUS_INPUT_CTRL_ENABLED 8
53 struct dsp_symbol_entry {
54 u32 address;
55 char symbol_name[DSP_MAX_SYMBOL_NAME];
56 int symbol_type;
58 /* initialized by driver */
59 struct dsp_module_desc * module;
60 int deleted;
63 struct dsp_symbol_desc {
64 int nsymbols;
66 struct dsp_symbol_entry *symbols;
68 /* initialized by driver */
69 int highest_frag_index;
72 struct dsp_segment_desc {
73 int segment_type;
74 u32 offset;
75 u32 size;
76 u32 * data;
79 struct dsp_module_desc {
80 char * module_name;
81 struct dsp_symbol_desc symbol_table;
82 int nsegments;
83 struct dsp_segment_desc * segments;
85 /* initialized by driver */
86 u32 overlay_begin_address;
87 u32 load_address;
88 int nfixups;
91 struct dsp_scb_descriptor {
92 char scb_name[DSP_MAX_SCB_NAME];
93 u32 address;
94 int index;
95 u32 *data;
97 struct dsp_scb_descriptor * sub_list_ptr;
98 struct dsp_scb_descriptor * next_scb_ptr;
99 struct dsp_scb_descriptor * parent_scb_ptr;
101 struct dsp_symbol_entry * task_entry;
102 struct dsp_symbol_entry * scb_symbol;
104 struct snd_info_entry *proc_info;
105 int ref_count;
107 u16 volume[2];
108 unsigned int deleted :1;
109 unsigned int updated :1;
110 unsigned int volume_set :1;
113 struct dsp_task_descriptor {
114 char task_name[DSP_MAX_TASK_NAME];
115 int size;
116 u32 address;
117 int index;
118 u32 *data;
121 struct dsp_pcm_channel_descriptor {
122 int active;
123 int src_slot;
124 int pcm_slot;
125 u32 sample_rate;
126 u32 unlinked;
127 struct dsp_scb_descriptor * pcm_reader_scb;
128 struct dsp_scb_descriptor * src_scb;
129 struct dsp_scb_descriptor * mixer_scb;
131 void * private_data;
134 struct dsp_spos_instance {
135 struct dsp_symbol_desc symbol_table; /* currently available loaded symbols in SP */
137 int nmodules;
138 struct dsp_module_desc * modules; /* modules loaded into SP */
140 struct dsp_segment_desc code;
142 /* Main PCM playback mixer */
143 struct dsp_scb_descriptor * master_mix_scb;
144 u16 dac_volume_right;
145 u16 dac_volume_left;
147 /* Rear/surround PCM playback mixer */
148 struct dsp_scb_descriptor * rear_mix_scb;
150 /* Center/LFE mixer */
151 struct dsp_scb_descriptor * center_lfe_mix_scb;
153 int npcm_channels;
154 int nsrc_scb;
155 struct dsp_pcm_channel_descriptor pcm_channels[DSP_MAX_PCM_CHANNELS];
156 int src_scb_slots[DSP_MAX_SRC_NR];
158 /* cache this symbols */
159 struct dsp_symbol_entry * null_algorithm; /* used by PCMreaderSCB's */
160 struct dsp_symbol_entry * s16_up; /* used by SRCtaskSCB's */
162 /* proc fs */
163 struct snd_card *snd_card;
164 struct snd_info_entry * proc_dsp_dir;
166 /* SCB's descriptors */
167 int nscb;
168 int scb_highest_frag_index;
169 struct dsp_scb_descriptor scbs[DSP_MAX_SCB_DESC];
170 struct dsp_scb_descriptor * the_null_scb;
172 /* Task's descriptors */
173 int ntask;
174 struct dsp_task_descriptor tasks[DSP_MAX_TASK_DESC];
176 /* SPDIF status */
177 int spdif_status_out;
178 int spdif_status_in;
179 u16 spdif_input_volume_right;
180 u16 spdif_input_volume_left;
181 /* spdif channel status,
182 left right and user validity bits */
183 unsigned int spdif_csuv_default;
184 unsigned int spdif_csuv_stream;
186 /* SPDIF input sample rate converter */
187 struct dsp_scb_descriptor * spdif_in_src;
188 /* SPDIF input asynch. receiver */
189 struct dsp_scb_descriptor * asynch_rx_scb;
191 /* Capture record mixer SCB */
192 struct dsp_scb_descriptor * record_mixer_scb;
194 /* CODEC input SCB */
195 struct dsp_scb_descriptor * codec_in_scb;
197 /* reference snooper */
198 struct dsp_scb_descriptor * ref_snoop_scb;
200 /* SPDIF output PCM reference */
201 struct dsp_scb_descriptor * spdif_pcm_input_scb;
203 /* asynch TX task */
204 struct dsp_scb_descriptor * asynch_tx_scb;
206 /* record sources */
207 struct dsp_scb_descriptor * pcm_input;
208 struct dsp_scb_descriptor * adc_input;
210 int spdif_in_sample_rate;
213 #endif /* __DSP_SPOS_H__ */