0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef __SOUND_MIXART_H
0011 #define __SOUND_MIXART_H
0012
0013 #include <linux/interrupt.h>
0014 #include <linux/mutex.h>
0015 #include <sound/pcm.h>
0016
0017 #define MIXART_DRIVER_VERSION 0x000100
0018
0019
0020
0021
0022
0023 struct mixart_uid {
0024 u32 object_id;
0025 u32 desc;
0026 };
0027
0028 struct mem_area {
0029 unsigned long phys;
0030 void __iomem *virt;
0031 struct resource *res;
0032 };
0033
0034
0035 struct mixart_route {
0036 unsigned char connected;
0037 unsigned char phase_inv;
0038 int volume;
0039 };
0040
0041
0042
0043 #define MIXART_MOTHERBOARD_XLX_INDEX 0
0044 #define MIXART_MOTHERBOARD_ELF_INDEX 1
0045 #define MIXART_AESEBUBOARD_XLX_INDEX 2
0046 #define MIXART_HARDW_FILES_MAX_INDEX 3
0047
0048 #define MIXART_MAX_CARDS 4
0049 #define MSG_FIFO_SIZE 16
0050
0051 #define MIXART_MAX_PHYS_CONNECTORS (MIXART_MAX_CARDS * 2 * 2)
0052
0053 struct mixart_mgr {
0054 unsigned int num_cards;
0055 struct snd_mixart *chip[MIXART_MAX_CARDS];
0056
0057 struct pci_dev *pci;
0058
0059 int irq;
0060
0061
0062 struct mem_area mem[2];
0063
0064
0065 u32 pending_event;
0066 wait_queue_head_t msg_sleep;
0067
0068
0069 u32 msg_fifo[MSG_FIFO_SIZE];
0070 int msg_fifo_readptr;
0071 int msg_fifo_writeptr;
0072 atomic_t msg_processed;
0073
0074 struct mutex lock;
0075 struct mutex msg_lock;
0076
0077 struct mutex setup_mutex;
0078
0079
0080 unsigned int dsp_loaded;
0081 unsigned int board_type;
0082
0083 struct snd_dma_buffer flowinfo;
0084 struct snd_dma_buffer bufferinfo;
0085
0086 struct mixart_uid uid_console_manager;
0087 int sample_rate;
0088 int ref_count_rate;
0089
0090 struct mutex mixer_mutex;
0091
0092 };
0093
0094
0095 #define MIXART_STREAM_STATUS_FREE 0
0096 #define MIXART_STREAM_STATUS_OPEN 1
0097 #define MIXART_STREAM_STATUS_RUNNING 2
0098 #define MIXART_STREAM_STATUS_DRAINING 3
0099 #define MIXART_STREAM_STATUS_PAUSE 4
0100
0101 #define MIXART_PLAYBACK_STREAMS 4
0102 #define MIXART_CAPTURE_STREAMS 1
0103
0104 #define MIXART_PCM_ANALOG 0
0105 #define MIXART_PCM_DIGITAL 1
0106 #define MIXART_PCM_TOTAL 2
0107
0108 #define MIXART_MAX_STREAM_PER_CARD (MIXART_PCM_TOTAL * (MIXART_PLAYBACK_STREAMS + MIXART_CAPTURE_STREAMS) )
0109
0110
0111 #define MIXART_NOTIFY_CARD_MASK 0xF000
0112 #define MIXART_NOTIFY_CARD_OFFSET 12
0113 #define MIXART_NOTIFY_PCM_MASK 0x0F00
0114 #define MIXART_NOTIFY_PCM_OFFSET 8
0115 #define MIXART_NOTIFY_CAPT_MASK 0x0080
0116 #define MIXART_NOTIFY_SUBS_MASK 0x007F
0117
0118
0119 struct mixart_stream {
0120 struct snd_pcm_substream *substream;
0121 struct mixart_pipe *pipe;
0122 int pcm_number;
0123
0124 int status;
0125
0126 u64 abs_period_elapsed;
0127 u32 buf_periods;
0128 u32 buf_period_frag;
0129
0130 int channels;
0131 };
0132
0133
0134 enum mixart_pipe_status {
0135 PIPE_UNDEFINED,
0136 PIPE_STOPPED,
0137 PIPE_RUNNING,
0138 PIPE_CLOCK_SET
0139 };
0140
0141 struct mixart_pipe {
0142 struct mixart_uid group_uid;
0143 int stream_count;
0144 struct mixart_uid uid_left_connector;
0145 struct mixart_uid uid_right_connector;
0146 enum mixart_pipe_status status;
0147 int references;
0148 int monitoring;
0149 };
0150
0151
0152 struct snd_mixart {
0153 struct snd_card *card;
0154 struct mixart_mgr *mgr;
0155 int chip_idx;
0156 struct snd_hwdep *hwdep;
0157
0158 struct snd_pcm *pcm;
0159 struct snd_pcm *pcm_dig;
0160
0161
0162 struct mixart_pipe pipe_in_ana;
0163 struct mixart_pipe pipe_out_ana;
0164
0165
0166 struct mixart_pipe pipe_in_dig;
0167 struct mixart_pipe pipe_out_dig;
0168
0169 struct mixart_stream playback_stream[MIXART_PCM_TOTAL][MIXART_PLAYBACK_STREAMS];
0170 struct mixart_stream capture_stream[MIXART_PCM_TOTAL];
0171
0172
0173 struct mixart_uid uid_out_analog_physio;
0174 struct mixart_uid uid_in_analog_physio;
0175
0176 int analog_playback_active[2];
0177 int analog_playback_volume[2];
0178 int analog_capture_volume[2];
0179 int digital_playback_active[2*MIXART_PLAYBACK_STREAMS][2];
0180 int digital_playback_volume[2*MIXART_PLAYBACK_STREAMS][2];
0181 int digital_capture_volume[2][2];
0182 int monitoring_active[2];
0183 int monitoring_volume[2];
0184 };
0185
0186 struct mixart_bufferinfo
0187 {
0188 u32 buffer_address;
0189 u32 reserved[5];
0190 u32 available_length;
0191 u32 buffer_id;
0192 };
0193
0194 struct mixart_flowinfo
0195 {
0196 u32 bufferinfo_array_phy_address;
0197 u32 reserved[11];
0198 u32 bufferinfo_count;
0199 u32 capture;
0200 };
0201
0202
0203 int snd_mixart_create_pcm(struct snd_mixart * chip);
0204 struct mixart_pipe *snd_mixart_add_ref_pipe(struct snd_mixart *chip, int pcm_number, int capture, int monitoring);
0205 int snd_mixart_kill_ref_pipe(struct mixart_mgr *mgr, struct mixart_pipe *pipe, int monitoring);
0206
0207 #endif