2 * Driver for Digigram miXart soundcards
6 * Copyright (c) 2003 by Digigram <alsa@digigram.com>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 #ifndef __SOUND_MIXART_H
24 #define __SOUND_MIXART_H
26 #include <linux/interrupt.h>
27 #include <linux/mutex.h>
28 #include <sound/pcm.h>
30 #define MIXART_DRIVER_VERSION 0x000100 /* 0.1.0 */
49 unsigned char connected
;
50 unsigned char phase_inv
;
55 /* firmware status codes */
56 #define MIXART_MOTHERBOARD_XLX_INDEX 0
57 #define MIXART_MOTHERBOARD_ELF_INDEX 1
58 #define MIXART_AESEBUBOARD_XLX_INDEX 2
59 #define MIXART_HARDW_FILES_MAX_INDEX 3 /* xilinx, elf, AESEBU xilinx */
61 #define MIXART_MAX_CARDS 4
62 #define MSG_FIFO_SIZE 16
64 #define MIXART_MAX_PHYS_CONNECTORS (MIXART_MAX_CARDS * 2 * 2) /* 4 * stereo * (analog+digital) */
67 unsigned int num_cards
;
68 struct snd_mixart
*chip
[MIXART_MAX_CARDS
];
75 struct mem_area mem
[2];
78 char shortname
[32]; /* short name of this soundcard */
79 char longname
[80]; /* name of this soundcard */
81 /* one and only blocking message or notification may be pending */
83 wait_queue_head_t msg_sleep
;
86 u32 msg_fifo
[MSG_FIFO_SIZE
];
88 int msg_fifo_writeptr
;
89 atomic_t msg_processed
; /* number of messages to be processed in takslet */
91 struct mutex lock
; /* interrupt lock */
92 struct mutex msg_lock
; /* mailbox lock */
94 struct mutex setup_mutex
; /* mutex used in hw_params, open and close */
96 /* hardware interface */
97 unsigned int dsp_loaded
; /* bit flags of loaded dsp indices */
98 unsigned int board_type
; /* read from embedded once elf file is loaded, 250 = miXart8, 251 = with AES, 252 = with Cobranet */
100 struct snd_dma_buffer flowinfo
;
101 struct snd_dma_buffer bufferinfo
;
103 struct mixart_uid uid_console_manager
;
107 struct mutex mixer_mutex
; /* mutex for mixer */
112 #define MIXART_STREAM_STATUS_FREE 0
113 #define MIXART_STREAM_STATUS_OPEN 1
114 #define MIXART_STREAM_STATUS_RUNNING 2
115 #define MIXART_STREAM_STATUS_DRAINING 3
116 #define MIXART_STREAM_STATUS_PAUSE 4
118 #define MIXART_PLAYBACK_STREAMS 4
119 #define MIXART_CAPTURE_STREAMS 1
121 #define MIXART_PCM_ANALOG 0
122 #define MIXART_PCM_DIGITAL 1
123 #define MIXART_PCM_TOTAL 2
125 #define MIXART_MAX_STREAM_PER_CARD (MIXART_PCM_TOTAL * (MIXART_PLAYBACK_STREAMS + MIXART_CAPTURE_STREAMS) )
128 #define MIXART_NOTIFY_CARD_MASK 0xF000
129 #define MIXART_NOTIFY_CARD_OFFSET 12
130 #define MIXART_NOTIFY_PCM_MASK 0x0F00
131 #define MIXART_NOTIFY_PCM_OFFSET 8
132 #define MIXART_NOTIFY_CAPT_MASK 0x0080
133 #define MIXART_NOTIFY_SUBS_MASK 0x007F
136 struct mixart_stream
{
137 struct snd_pcm_substream
*substream
;
138 struct mixart_pipe
*pipe
;
141 int status
; /* nothing, running, draining */
143 u64 abs_period_elapsed
; /* last absolute stream position where period_elapsed was called (multiple of runtime->period_size) */
144 u32 buf_periods
; /* periods counter in the buffer (< runtime->periods) */
145 u32 buf_period_frag
; /* defines with buf_period_pos the exact position in the buffer (< runtime->period_size) */
151 enum mixart_pipe_status
{
159 struct mixart_uid group_uid
; /* id of the pipe, as returned by embedded */
161 struct mixart_uid uid_left_connector
; /* UID's for the audio connectors */
162 struct mixart_uid uid_right_connector
;
163 enum mixart_pipe_status status
;
164 int references
; /* number of subs openned */
165 int monitoring
; /* pipe used for monitoring issue */
170 struct snd_card
*card
;
171 struct mixart_mgr
*mgr
;
172 int chip_idx
; /* zero based */
173 struct snd_hwdep
*hwdep
; /* DSP loader, only for the first card */
175 struct snd_pcm
*pcm
; /* PCM analog i/o */
176 struct snd_pcm
*pcm_dig
; /* PCM digital i/o */
178 /* allocate stereo pipe for instance */
179 struct mixart_pipe pipe_in_ana
;
180 struct mixart_pipe pipe_out_ana
;
182 /* if AES/EBU daughter board is available, additional pipes possible on pcm_dig */
183 struct mixart_pipe pipe_in_dig
;
184 struct mixart_pipe pipe_out_dig
;
186 struct mixart_stream playback_stream
[MIXART_PCM_TOTAL
][MIXART_PLAYBACK_STREAMS
]; /* 0 = pcm, 1 = pcm_dig */
187 struct mixart_stream capture_stream
[MIXART_PCM_TOTAL
]; /* 0 = pcm, 1 = pcm_dig */
189 /* UID's for the physical io's */
190 struct mixart_uid uid_out_analog_physio
;
191 struct mixart_uid uid_in_analog_physio
;
193 int analog_playback_active
[2]; /* Mixer : Master Playback active (!mute) */
194 int analog_playback_volume
[2]; /* Mixer : Master Playback Volume */
195 int analog_capture_volume
[2]; /* Mixer : Master Capture Volume */
196 int digital_playback_active
[2*MIXART_PLAYBACK_STREAMS
][2]; /* Mixer : Digital Playback Active [(analog+AES output)*streams][stereo]*/
197 int digital_playback_volume
[2*MIXART_PLAYBACK_STREAMS
][2]; /* Mixer : Digital Playback Volume [(analog+AES output)*streams][stereo]*/
198 int digital_capture_volume
[2][2]; /* Mixer : Digital Capture Volume [analog+AES output][stereo] */
199 int monitoring_active
[2]; /* Mixer : Monitoring Active */
200 int monitoring_volume
[2]; /* Mixer : Monitoring Volume */
203 struct mixart_bufferinfo
207 u32 available_length
;
211 struct mixart_flowinfo
213 u32 bufferinfo_array_phy_address
;
215 u32 bufferinfo_count
;
220 int snd_mixart_create_pcm(struct snd_mixart
* chip
);
221 struct mixart_pipe
*snd_mixart_add_ref_pipe(struct snd_mixart
*chip
, int pcm_number
, int capture
, int monitoring
);
222 int snd_mixart_kill_ref_pipe(struct mixart_mgr
*mgr
, struct mixart_pipe
*pipe
, int monitoring
);
224 #endif /* __SOUND_MIXART_H */