Linux Audio

Check our new training course

Loading...
v5.14.15
  1/* SPDX-License-Identifier: GPL-2.0-or-later */
  2/*
  3 * Driver for Digigram miXart soundcards
  4 *
  5 * low level interface with interrupt handling and mail box implementation
  6 *
  7 * Copyright (c) 2003 by Digigram <alsa@digigram.com>
  8 */
  9
 10#ifndef __SOUND_MIXART_CORE_H
 11#define __SOUND_MIXART_CORE_H
 12
 13
 14enum mixart_message_id {
 15	MSG_CONNECTOR_GET_AUDIO_INFO         = 0x050008,
 16	MSG_CONNECTOR_GET_OUT_AUDIO_LEVEL    = 0x050009,
 17	MSG_CONNECTOR_SET_OUT_AUDIO_LEVEL    = 0x05000A,
 18
 19	MSG_CONSOLE_MANAGER                  = 0x070000,
 20	MSG_CONSOLE_GET_CLOCK_UID            = 0x070003,
 21
 22	MSG_PHYSICALIO_SET_LEVEL             = 0x0F0008,
 23
 24	MSG_STREAM_ADD_INPUT_GROUP           = 0x130000,
 25	MSG_STREAM_ADD_OUTPUT_GROUP          = 0x130001,
 26	MSG_STREAM_DELETE_GROUP              = 0x130004,
 27	MSG_STREAM_START_STREAM_GRP_PACKET   = 0x130006,
 28	MSG_STREAM_START_INPUT_STAGE_PACKET  = 0x130007,
 29	MSG_STREAM_START_OUTPUT_STAGE_PACKET = 0x130008,
 30	MSG_STREAM_STOP_STREAM_GRP_PACKET    = 0x130009,
 31	MSG_STREAM_STOP_INPUT_STAGE_PACKET   = 0x13000A,
 32	MSG_STREAM_STOP_OUTPUT_STAGE_PACKET  = 0x13000B,
 33	MSG_STREAM_SET_INPUT_STAGE_PARAM     = 0x13000F,
 34	MSG_STREAM_SET_OUTPUT_STAGE_PARAM    = 0x130010,
 35	MSG_STREAM_SET_IN_AUDIO_LEVEL        = 0x130015,
 36	MSG_STREAM_SET_OUT_STREAM_LEVEL      = 0x130017,
 37
 38	MSG_SYSTEM_FIRST_ID                  = 0x160000,
 39	MSG_SYSTEM_ENUM_PHYSICAL_IO          = 0x16000E,
 40	MSG_SYSTEM_ENUM_PLAY_CONNECTOR       = 0x160017,
 41	MSG_SYSTEM_ENUM_RECORD_CONNECTOR     = 0x160018,
 42	MSG_SYSTEM_WAIT_SYNCHRO_CMD          = 0x16002C,
 43	MSG_SYSTEM_SEND_SYNCHRO_CMD          = 0x16002D,
 44
 45	MSG_SERVICES_TIMER_NOTIFY            = 0x1D0404,
 46	MSG_SERVICES_REPORT_TRACES           = 0x1D0700,
 47
 48	MSG_CLOCK_CHECK_PROPERTIES           = 0x200001,
 49	MSG_CLOCK_SET_PROPERTIES             = 0x200002,
 50};
 51
 
 52
 53struct mixart_msg
 54{
 55	u32          message_id;
 56	struct mixart_uid uid;
 57	void*        data;
 58	size_t       size;
 59};
 60
 61/* structs used to communicate with miXart */
 62
 63struct mixart_enum_connector_resp
 64{
 65	u32  error_code;
 66	u32  first_uid_offset;
 67	u32  uid_count;
 68	u32  current_uid_index;
 69	struct mixart_uid uid[MIXART_MAX_PHYS_CONNECTORS];
 70} __attribute__((packed));
 71
 72
 73/* used for following struct */
 74#define MIXART_FLOAT_P_22_0_TO_HEX      0x41b00000  /* 22.0f */
 75#define MIXART_FLOAT_M_20_0_TO_HEX      0xc1a00000  /* -20.0f */
 76#define MIXART_FLOAT____0_0_TO_HEX      0x00000000  /* 0.0f */
 77
 78struct mixart_audio_info_req
 79{
 80	u32 line_max_level;    /* float */
 81	u32 micro_max_level;   /* float */
 82	u32 cd_max_level;      /* float */
 83} __attribute__((packed));
 84
 85struct mixart_analog_hw_info
 86{
 87	u32 is_present;
 88	u32 hw_connection_type;
 89	u32 max_level;         /* float */
 90	u32 min_var_level;     /* float */
 91	u32 max_var_level;     /* float */
 92	u32 step_var_level;    /* float */
 93	u32 fix_gain;          /* float */
 94	u32 zero_var;          /* float */
 95} __attribute__((packed));
 96
 97struct mixart_digital_hw_info
 98{
 99	u32   hw_connection_type;
100	u32   presence;
101	u32   clock;
102	u32   reserved;
103} __attribute__((packed));
104
105struct mixart_analog_info
106{
107	u32                     type_mask;
108	struct mixart_analog_hw_info micro_info;
109	struct mixart_analog_hw_info line_info;
110	struct mixart_analog_hw_info cd_info;
111	u32                     analog_level_present;
112} __attribute__((packed));
113
114struct mixart_digital_info
115{
116	u32 type_mask;
117	struct mixart_digital_hw_info aes_info;
118	struct mixart_digital_hw_info adat_info;
119} __attribute__((packed));
120
121struct mixart_audio_info
122{
123	u32                   clock_type_mask;
124	struct mixart_analog_info  analog_info;
125	struct mixart_digital_info digital_info;
126} __attribute__((packed));
127
128struct mixart_audio_info_resp
129{
130	u32                 txx_status;
131	struct mixart_audio_info info;
132} __attribute__((packed));
133
134
135/* used for nb_bytes_max_per_sample */
136#define MIXART_FLOAT_P__4_0_TO_HEX      0x40800000  /* +4.0f */
137#define MIXART_FLOAT_P__8_0_TO_HEX      0x41000000  /* +8.0f */
138
139struct mixart_stream_info
140{
141	u32 size_max_byte_frame;
142	u32 size_max_sample_frame;
143	u32 nb_bytes_max_per_sample;  /* float */
144} __attribute__((packed));
145
146/*  MSG_STREAM_ADD_INPUT_GROUP */
147/*  MSG_STREAM_ADD_OUTPUT_GROUP */
148
149struct mixart_streaming_group_req
150{
151	u32 stream_count;
152	u32 channel_count;
153	u32 user_grp_number;
154	u32 first_phys_audio;
155	u32 latency;
156	struct mixart_stream_info stream_info[32];
157	struct mixart_uid connector;
158	u32 flow_entry[32];
159} __attribute__((packed));
160
161struct mixart_stream_desc
162{
163	struct mixart_uid stream_uid;
164	u32          stream_desc;
165} __attribute__((packed));
166
167struct mixart_streaming_group
168{
169	u32                  status;
170	struct mixart_uid    group;
171	u32                  pipe_desc;
172	u32                  stream_count;
173	struct mixart_stream_desc stream[32];
174} __attribute__((packed));
175
176/* MSG_STREAM_DELETE_GROUP */
177
178/* request : mixart_uid_t group */
179
180struct mixart_delete_group_resp
181{
182	u32  status;
183	u32  unused[2];
184} __attribute__((packed));
185
186
187/* 	MSG_STREAM_START_INPUT_STAGE_PACKET  = 0x130000 + 7,
188	MSG_STREAM_START_OUTPUT_STAGE_PACKET = 0x130000 + 8,
189	MSG_STREAM_STOP_INPUT_STAGE_PACKET   = 0x130000 + 10,
190	MSG_STREAM_STOP_OUTPUT_STAGE_PACKET  = 0x130000 + 11,
191 */
192
193struct mixart_fx_couple_uid
194{
195	struct mixart_uid uid_fx_code;
196	struct mixart_uid uid_fx_data;
197} __attribute__((packed));
198
199struct mixart_txx_stream_desc
200{
201	struct mixart_uid       uid_pipe;
202	u32                     stream_idx;
203	u32                     fx_number;
204	struct mixart_fx_couple_uid  uid_fx[4];
205} __attribute__((packed));
206
207struct mixart_flow_info
208{
209	struct mixart_txx_stream_desc  stream_desc;
210	u32                       flow_entry;
211	u32                       flow_phy_addr;
212} __attribute__((packed));
213
214struct mixart_stream_state_req
215{
216	u32                 delayed;
217	u64                 scheduler;
218	u32                 reserved4np[3];
219	u32                 stream_count;  /* set to 1 for instance */
220	struct mixart_flow_info  stream_info;   /* could be an array[stream_count] */
221} __attribute__((packed));
222
223/* 	MSG_STREAM_START_STREAM_GRP_PACKET   = 0x130000 + 6
224	MSG_STREAM_STOP_STREAM_GRP_PACKET    = 0x130000 + 9
225 */
226
227struct mixart_group_state_req
228{
229	u32           delayed;
230	u64           scheduler;
231	u32           reserved4np[2];
232	u32           pipe_count;    /* set to 1 for instance */
233	struct mixart_uid  pipe_uid[1];   /* could be an array[pipe_count] */
234} __attribute__((packed));
235
236struct mixart_group_state_resp
237{
238	u32           txx_status;
239	u64           scheduler;
240} __attribute__((packed));
241
242
243
244/* Structures used by the MSG_SERVICES_TIMER_NOTIFY command */
245
246struct mixart_sample_pos
247{
248	u32   buffer_id;
249	u32   validity;
250	u32   sample_pos_high_part;
251	u32   sample_pos_low_part;
252} __attribute__((packed));
253
 
 
 
 
 
 
 
254struct mixart_timer_notify
255{
256	u32                  stream_count;
257	struct mixart_sample_pos  streams[MIXART_MAX_STREAM_PER_CARD * MIXART_MAX_CARDS];
258} __attribute__((packed));
259
260
261/*	MSG_CONSOLE_GET_CLOCK_UID            = 0x070003,
262 */
263
264/* request is a uid with desc = MSG_CONSOLE_MANAGER | cardindex */
265
266struct mixart_return_uid
267{
268	u32 error_code;
269	struct mixart_uid uid;
270} __attribute__((packed));
271
272/*	MSG_CLOCK_CHECK_PROPERTIES           = 0x200001,
273	MSG_CLOCK_SET_PROPERTIES             = 0x200002,
274*/
275
276enum mixart_clock_generic_type {
277	CGT_NO_CLOCK,
278	CGT_INTERNAL_CLOCK,
279	CGT_PROGRAMMABLE_CLOCK,
280	CGT_INTERNAL_ENSLAVED_CLOCK,
281	CGT_EXTERNAL_CLOCK,
282	CGT_CURRENT_CLOCK
283};
284
285enum mixart_clock_mode {
286	CM_UNDEFINED,
287	CM_MASTER,
288	CM_SLAVE,
289	CM_STANDALONE,
290	CM_NOT_CONCERNED
291};
292
293
294struct mixart_clock_properties
295{
296	u32 error_code;
297	u32 validation_mask;
298	u32 frequency;
299	u32 reference_frequency;
300	u32 clock_generic_type;
301	u32 clock_mode;
302	struct mixart_uid uid_clock_source;
303	struct mixart_uid uid_event_source;
304	u32 event_mode;
305	u32 synchro_signal_presence;
306	u32 format;
307	u32 board_mask;
308	u32 nb_callers; /* set to 1 (see below) */
309	struct mixart_uid uid_caller[1];
310} __attribute__((packed));
311
312struct mixart_clock_properties_resp
313{
314	u32 status;
315	u32 clock_mode;
316} __attribute__((packed));
317
318
319/*	MSG_STREAM_SET_INPUT_STAGE_PARAM     = 0x13000F */
320/*	MSG_STREAM_SET_OUTPUT_STAGE_PARAM    = 0x130010 */
321
322enum mixart_coding_type {
323	CT_NOT_DEFINED,
324	CT_LINEAR,
325	CT_MPEG_L1,
326	CT_MPEG_L2,
327	CT_MPEG_L3,
328	CT_MPEG_L3_LSF,
329	CT_GSM
330};
331enum mixart_sample_type {
332	ST_NOT_DEFINED,
333	ST_FLOATING_POINT_32BE,
334	ST_FLOATING_POINT_32LE,
335	ST_FLOATING_POINT_64BE,
336	ST_FLOATING_POINT_64LE,
337	ST_FIXED_POINT_8,
338	ST_FIXED_POINT_16BE,
339	ST_FIXED_POINT_16LE,
340	ST_FIXED_POINT_24BE,
341	ST_FIXED_POINT_24LE,
342	ST_FIXED_POINT_32BE,
343	ST_FIXED_POINT_32LE,
344	ST_INTEGER_8,
345	ST_INTEGER_16BE,
346	ST_INTEGER_16LE,
347	ST_INTEGER_24BE,
348	ST_INTEGER_24LE,
349	ST_INTEGER_32BE,
350	ST_INTEGER_32LE
351};
352
353struct mixart_stream_param_desc
354{
355	u32 coding_type;  /* use enum mixart_coding_type */
356	u32 sample_type;  /* use enum mixart_sample_type */
357
358	union {
359		struct {
360			u32 linear_endian_ness;
361			u32 linear_bits;
362			u32 is_signed;
363			u32 is_float;
364		} linear_format_info;
365
366		struct {
367			u32 mpeg_layer;
368			u32 mpeg_mode;
369			u32 mpeg_mode_extension;
370			u32 mpeg_pre_emphasis;
371			u32 mpeg_has_padding_bit;
372			u32 mpeg_has_crc;
373			u32 mpeg_has_extension;
374			u32 mpeg_is_original;
375			u32 mpeg_has_copyright;
376		} mpeg_format_info;
377	} format_info;
378
379	u32 delayed;
380	u64 scheduler;
381	u32 sample_size;
382	u32 has_header;
383	u32 has_suffix;
384	u32 has_bitrate;
385	u32 samples_per_frame;
386	u32 bytes_per_frame;
387	u32 bytes_per_sample;
388	u32 sampling_freq;
389	u32 number_of_channel;
390	u32 stream_number;
391	u32 buffer_size;
392	u32 differed_time;
393	u32 reserved4np[3];
394	u32 pipe_count;                           /* set to 1 (array size !) */
395	u32 stream_count;                         /* set to 1 (array size !) */
396	struct mixart_txx_stream_desc stream_desc[1];  /* only one stream per command, but this could be an array */
397
398} __attribute__((packed));
399
400
401/*	MSG_CONNECTOR_GET_OUT_AUDIO_LEVEL    = 0x050009,
402 */
403
404
405struct mixart_get_out_audio_level
406{
407	u32 txx_status;
408	u32 digital_level;   /* float */
409	u32 analog_level;    /* float */
410	u32 monitor_level;   /* float */
411	u32 mute;
412	u32 monitor_mute1;
413	u32 monitor_mute2;
414} __attribute__((packed));
415
416
417/*	MSG_CONNECTOR_SET_OUT_AUDIO_LEVEL    = 0x05000A,
418 */
419
420/* used for valid_mask below */
421#define MIXART_AUDIO_LEVEL_ANALOG_MASK	0x01
422#define MIXART_AUDIO_LEVEL_DIGITAL_MASK	0x02
423#define MIXART_AUDIO_LEVEL_MONITOR_MASK	0x04
424#define MIXART_AUDIO_LEVEL_MUTE_MASK	0x08
425#define MIXART_AUDIO_LEVEL_MUTE_M1_MASK	0x10
426#define MIXART_AUDIO_LEVEL_MUTE_M2_MASK	0x20
427
428struct mixart_set_out_audio_level
429{
430	u32 delayed;
431	u64 scheduler;
432	u32 valid_mask1;
433	u32 valid_mask2;
434	u32 digital_level;   /* float */
435	u32 analog_level;    /* float */
436	u32 monitor_level;   /* float */
437	u32 mute;
438	u32 monitor_mute1;
439	u32 monitor_mute2;
440	u32 reserved4np;
441} __attribute__((packed));
442
443
444/*	MSG_SYSTEM_ENUM_PHYSICAL_IO          = 0x16000E,
445 */
446
447#define MIXART_MAX_PHYS_IO  (MIXART_MAX_CARDS * 2 * 2) /* 4 * (analog+digital) * (playback+capture) */
448
449struct mixart_uid_enumeration
450{
451	u32 error_code;
452	u32 first_uid_offset;
453	u32 nb_uid;
454	u32 current_uid_index;
455	struct mixart_uid uid[MIXART_MAX_PHYS_IO];
456} __attribute__((packed));
457
458
459/*	MSG_PHYSICALIO_SET_LEVEL             = 0x0F0008,
460	MSG_PHYSICALIO_GET_LEVEL             = 0x0F000C,
461*/
462
463struct mixart_io_channel_level
464{
465	u32 analog_level;   /* float */
466	u32 unused[2];
467} __attribute__((packed));
468
469struct mixart_io_level
470{
471	s32 channel; /* 0=left, 1=right, -1=both, -2=both same */
472	struct mixart_io_channel_level level[2];
473} __attribute__((packed));
474
475
476/*	MSG_STREAM_SET_IN_AUDIO_LEVEL        = 0x130015,
477 */
478
479struct mixart_in_audio_level_info
480{
481	struct mixart_uid connector;
482	u32 valid_mask1;
483	u32 valid_mask2;
484	u32 digital_level;
485	u32 analog_level;
486} __attribute__((packed));
487
488struct mixart_set_in_audio_level_req
489{
490	u32 delayed;
491	u64 scheduler;
492	u32 audio_count;  /* set to <= 2 */
493	u32 reserved4np;
494	struct mixart_in_audio_level_info level[2];
495} __attribute__((packed));
496
497/* response is a 32 bit status */
498
499
500/*	MSG_STREAM_SET_OUT_STREAM_LEVEL      = 0x130017,
501 */
502
503/* defines used for valid_mask1 */
504#define MIXART_OUT_STREAM_SET_LEVEL_LEFT_AUDIO1		0x01
505#define MIXART_OUT_STREAM_SET_LEVEL_LEFT_AUDIO2		0x02
506#define MIXART_OUT_STREAM_SET_LEVEL_RIGHT_AUDIO1	0x04
507#define MIXART_OUT_STREAM_SET_LEVEL_RIGHT_AUDIO2	0x08
508#define MIXART_OUT_STREAM_SET_LEVEL_STREAM_1		0x10
509#define MIXART_OUT_STREAM_SET_LEVEL_STREAM_2		0x20
510#define MIXART_OUT_STREAM_SET_LEVEL_MUTE_1		0x40
511#define MIXART_OUT_STREAM_SET_LEVEL_MUTE_2		0x80
512
513struct mixart_out_stream_level_info
514{
515	u32 valid_mask1;
516	u32 valid_mask2;
517	u32 left_to_out1_level;
518	u32 left_to_out2_level;
519	u32 right_to_out1_level;
520	u32 right_to_out2_level;
521	u32 digital_level1;
522	u32 digital_level2;
523	u32 mute1;
524	u32 mute2;
525} __attribute__((packed));
526
527struct mixart_set_out_stream_level
528{
529	struct mixart_txx_stream_desc desc;
530	struct mixart_out_stream_level_info out_level;
531} __attribute__((packed));
532
533struct mixart_set_out_stream_level_req
534{
535	u32 delayed;
536	u64 scheduler;
537	u32 reserved4np[2];
538	u32 nb_of_stream;  /* set to 1 */
539	struct mixart_set_out_stream_level stream_level; /* could be an array */
540} __attribute__((packed));
541
542/* response to this request is a u32 status value */
543
544
545/* exported */
546void snd_mixart_init_mailbox(struct mixart_mgr *mgr);
547void snd_mixart_exit_mailbox(struct mixart_mgr *mgr);
548
549int  snd_mixart_send_msg(struct mixart_mgr *mgr, struct mixart_msg *request, int max_resp_size, void *resp_data);
550int  snd_mixart_send_msg_wait_notif(struct mixart_mgr *mgr, struct mixart_msg *request, u32 notif_event);
551int  snd_mixart_send_msg_nonblock(struct mixart_mgr *mgr, struct mixart_msg *request);
552
553irqreturn_t snd_mixart_interrupt(int irq, void *dev_id);
554irqreturn_t snd_mixart_threaded_irq(int irq, void *dev_id);
555
556void snd_mixart_reset_board(struct mixart_mgr *mgr);
557
558#endif /* __SOUND_MIXART_CORE_H */
v6.8
  1/* SPDX-License-Identifier: GPL-2.0-or-later */
  2/*
  3 * Driver for Digigram miXart soundcards
  4 *
  5 * low level interface with interrupt handling and mail box implementation
  6 *
  7 * Copyright (c) 2003 by Digigram <alsa@digigram.com>
  8 */
  9
 10#ifndef __SOUND_MIXART_CORE_H
 11#define __SOUND_MIXART_CORE_H
 12
 13
 14enum mixart_message_id {
 15	MSG_CONNECTOR_GET_AUDIO_INFO         = 0x050008,
 16	MSG_CONNECTOR_GET_OUT_AUDIO_LEVEL    = 0x050009,
 17	MSG_CONNECTOR_SET_OUT_AUDIO_LEVEL    = 0x05000A,
 18
 19	MSG_CONSOLE_MANAGER                  = 0x070000,
 20	MSG_CONSOLE_GET_CLOCK_UID            = 0x070003,
 21
 22	MSG_PHYSICALIO_SET_LEVEL             = 0x0F0008,
 23
 24	MSG_STREAM_ADD_INPUT_GROUP           = 0x130000,
 25	MSG_STREAM_ADD_OUTPUT_GROUP          = 0x130001,
 26	MSG_STREAM_DELETE_GROUP              = 0x130004,
 27	MSG_STREAM_START_STREAM_GRP_PACKET   = 0x130006,
 28	MSG_STREAM_START_INPUT_STAGE_PACKET  = 0x130007,
 29	MSG_STREAM_START_OUTPUT_STAGE_PACKET = 0x130008,
 30	MSG_STREAM_STOP_STREAM_GRP_PACKET    = 0x130009,
 31	MSG_STREAM_STOP_INPUT_STAGE_PACKET   = 0x13000A,
 32	MSG_STREAM_STOP_OUTPUT_STAGE_PACKET  = 0x13000B,
 33	MSG_STREAM_SET_INPUT_STAGE_PARAM     = 0x13000F,
 34	MSG_STREAM_SET_OUTPUT_STAGE_PARAM    = 0x130010,
 35	MSG_STREAM_SET_IN_AUDIO_LEVEL        = 0x130015,
 36	MSG_STREAM_SET_OUT_STREAM_LEVEL      = 0x130017,
 37
 38	MSG_SYSTEM_FIRST_ID                  = 0x160000,
 39	MSG_SYSTEM_ENUM_PHYSICAL_IO          = 0x16000E,
 40	MSG_SYSTEM_ENUM_PLAY_CONNECTOR       = 0x160017,
 41	MSG_SYSTEM_ENUM_RECORD_CONNECTOR     = 0x160018,
 42	MSG_SYSTEM_WAIT_SYNCHRO_CMD          = 0x16002C,
 43	MSG_SYSTEM_SEND_SYNCHRO_CMD          = 0x16002D,
 44
 45	MSG_SERVICES_TIMER_NOTIFY            = 0x1D0404,
 46	MSG_SERVICES_REPORT_TRACES           = 0x1D0700,
 47
 48	MSG_CLOCK_CHECK_PROPERTIES           = 0x200001,
 49	MSG_CLOCK_SET_PROPERTIES             = 0x200002,
 50};
 51
 52#define MSG_DEFAULT_SIZE            512
 53
 54struct mixart_msg
 55{
 56	u32          message_id;
 57	struct mixart_uid uid;
 58	void*        data;
 59	size_t       size;
 60};
 61
 62/* structs used to communicate with miXart */
 63
 64struct mixart_enum_connector_resp
 65{
 66	u32  error_code;
 67	u32  first_uid_offset;
 68	u32  uid_count;
 69	u32  current_uid_index;
 70	struct mixart_uid uid[MIXART_MAX_PHYS_CONNECTORS];
 71} __packed;
 72
 73
 74/* used for following struct */
 75#define MIXART_FLOAT_P_22_0_TO_HEX      0x41b00000  /* 22.0f */
 76#define MIXART_FLOAT_M_20_0_TO_HEX      0xc1a00000  /* -20.0f */
 77#define MIXART_FLOAT____0_0_TO_HEX      0x00000000  /* 0.0f */
 78
 79struct mixart_audio_info_req
 80{
 81	u32 line_max_level;    /* float */
 82	u32 micro_max_level;   /* float */
 83	u32 cd_max_level;      /* float */
 84} __packed;
 85
 86struct mixart_analog_hw_info
 87{
 88	u32 is_present;
 89	u32 hw_connection_type;
 90	u32 max_level;         /* float */
 91	u32 min_var_level;     /* float */
 92	u32 max_var_level;     /* float */
 93	u32 step_var_level;    /* float */
 94	u32 fix_gain;          /* float */
 95	u32 zero_var;          /* float */
 96} __packed;
 97
 98struct mixart_digital_hw_info
 99{
100	u32   hw_connection_type;
101	u32   presence;
102	u32   clock;
103	u32   reserved;
104} __packed;
105
106struct mixart_analog_info
107{
108	u32                     type_mask;
109	struct mixart_analog_hw_info micro_info;
110	struct mixart_analog_hw_info line_info;
111	struct mixart_analog_hw_info cd_info;
112	u32                     analog_level_present;
113} __packed;
114
115struct mixart_digital_info
116{
117	u32 type_mask;
118	struct mixart_digital_hw_info aes_info;
119	struct mixart_digital_hw_info adat_info;
120} __packed;
121
122struct mixart_audio_info
123{
124	u32                   clock_type_mask;
125	struct mixart_analog_info  analog_info;
126	struct mixart_digital_info digital_info;
127} __packed;
128
129struct mixart_audio_info_resp
130{
131	u32                 txx_status;
132	struct mixart_audio_info info;
133} __packed;
134
135
136/* used for nb_bytes_max_per_sample */
137#define MIXART_FLOAT_P__4_0_TO_HEX      0x40800000  /* +4.0f */
138#define MIXART_FLOAT_P__8_0_TO_HEX      0x41000000  /* +8.0f */
139
140struct mixart_stream_info
141{
142	u32 size_max_byte_frame;
143	u32 size_max_sample_frame;
144	u32 nb_bytes_max_per_sample;  /* float */
145} __packed;
146
147/*  MSG_STREAM_ADD_INPUT_GROUP */
148/*  MSG_STREAM_ADD_OUTPUT_GROUP */
149
150struct mixart_streaming_group_req
151{
152	u32 stream_count;
153	u32 channel_count;
154	u32 user_grp_number;
155	u32 first_phys_audio;
156	u32 latency;
157	struct mixart_stream_info stream_info[32];
158	struct mixart_uid connector;
159	u32 flow_entry[32];
160} __packed;
161
162struct mixart_stream_desc
163{
164	struct mixart_uid stream_uid;
165	u32          stream_desc;
166} __packed;
167
168struct mixart_streaming_group
169{
170	u32                  status;
171	struct mixart_uid    group;
172	u32                  pipe_desc;
173	u32                  stream_count;
174	struct mixart_stream_desc stream[32];
175} __packed;
176
177/* MSG_STREAM_DELETE_GROUP */
178
179/* request : mixart_uid_t group */
180
181struct mixart_delete_group_resp
182{
183	u32  status;
184	u32  unused[2];
185} __packed;
186
187
188/* 	MSG_STREAM_START_INPUT_STAGE_PACKET  = 0x130000 + 7,
189	MSG_STREAM_START_OUTPUT_STAGE_PACKET = 0x130000 + 8,
190	MSG_STREAM_STOP_INPUT_STAGE_PACKET   = 0x130000 + 10,
191	MSG_STREAM_STOP_OUTPUT_STAGE_PACKET  = 0x130000 + 11,
192 */
193
194struct mixart_fx_couple_uid
195{
196	struct mixart_uid uid_fx_code;
197	struct mixart_uid uid_fx_data;
198} __packed;
199
200struct mixart_txx_stream_desc
201{
202	struct mixart_uid       uid_pipe;
203	u32                     stream_idx;
204	u32                     fx_number;
205	struct mixart_fx_couple_uid  uid_fx[4];
206} __packed;
207
208struct mixart_flow_info
209{
210	struct mixart_txx_stream_desc  stream_desc;
211	u32                       flow_entry;
212	u32                       flow_phy_addr;
213} __packed;
214
215struct mixart_stream_state_req
216{
217	u32                 delayed;
218	u64                 scheduler;
219	u32                 reserved4np[3];
220	u32                 stream_count;  /* set to 1 for instance */
221	struct mixart_flow_info  stream_info;   /* could be an array[stream_count] */
222} __packed;
223
224/* 	MSG_STREAM_START_STREAM_GRP_PACKET   = 0x130000 + 6
225	MSG_STREAM_STOP_STREAM_GRP_PACKET    = 0x130000 + 9
226 */
227
228struct mixart_group_state_req
229{
230	u32           delayed;
231	u64           scheduler;
232	u32           reserved4np[2];
233	u32           pipe_count;    /* set to 1 for instance */
234	struct mixart_uid  pipe_uid; /* could be an array[pipe_count], in theory */
235} __packed;
236
237struct mixart_group_state_resp
238{
239	u32           txx_status;
240	u64           scheduler;
241} __packed;
242
243
244
245/* Structures used by the MSG_SERVICES_TIMER_NOTIFY command */
246
247struct mixart_sample_pos
248{
249	u32   buffer_id;
250	u32   validity;
251	u32   sample_pos_high_part;
252	u32   sample_pos_low_part;
253} __packed;
254
255/*
256 * This structure is limited by the size of MSG_DEFAULT_SIZE. Instead of
257 * having MIXART_MAX_STREAM_PER_CARD * MIXART_MAX_CARDS many streams,
258 * this is capped to have a total size below MSG_DEFAULT_SIZE.
259 */
260#define MIXART_MAX_TIMER_NOTIFY_STREAMS				\
261	((MSG_DEFAULT_SIZE - sizeof(u32)) / sizeof(struct mixart_sample_pos))
262struct mixart_timer_notify
263{
264	u32                  stream_count;
265	struct mixart_sample_pos  streams[MIXART_MAX_TIMER_NOTIFY_STREAMS];
266} __packed;
267
268
269/*	MSG_CONSOLE_GET_CLOCK_UID            = 0x070003,
270 */
271
272/* request is a uid with desc = MSG_CONSOLE_MANAGER | cardindex */
273
274struct mixart_return_uid
275{
276	u32 error_code;
277	struct mixart_uid uid;
278} __packed;
279
280/*	MSG_CLOCK_CHECK_PROPERTIES           = 0x200001,
281	MSG_CLOCK_SET_PROPERTIES             = 0x200002,
282*/
283
284enum mixart_clock_generic_type {
285	CGT_NO_CLOCK,
286	CGT_INTERNAL_CLOCK,
287	CGT_PROGRAMMABLE_CLOCK,
288	CGT_INTERNAL_ENSLAVED_CLOCK,
289	CGT_EXTERNAL_CLOCK,
290	CGT_CURRENT_CLOCK
291};
292
293enum mixart_clock_mode {
294	CM_UNDEFINED,
295	CM_MASTER,
296	CM_SLAVE,
297	CM_STANDALONE,
298	CM_NOT_CONCERNED
299};
300
301
302struct mixart_clock_properties
303{
304	u32 error_code;
305	u32 validation_mask;
306	u32 frequency;
307	u32 reference_frequency;
308	u32 clock_generic_type;
309	u32 clock_mode;
310	struct mixart_uid uid_clock_source;
311	struct mixart_uid uid_event_source;
312	u32 event_mode;
313	u32 synchro_signal_presence;
314	u32 format;
315	u32 board_mask;
316	u32 nb_callers; /* set to 1 (see below) */
317	struct mixart_uid uid_caller;
318} __packed;
319
320struct mixart_clock_properties_resp
321{
322	u32 status;
323	u32 clock_mode;
324} __packed;
325
326
327/*	MSG_STREAM_SET_INPUT_STAGE_PARAM     = 0x13000F */
328/*	MSG_STREAM_SET_OUTPUT_STAGE_PARAM    = 0x130010 */
329
330enum mixart_coding_type {
331	CT_NOT_DEFINED,
332	CT_LINEAR,
333	CT_MPEG_L1,
334	CT_MPEG_L2,
335	CT_MPEG_L3,
336	CT_MPEG_L3_LSF,
337	CT_GSM
338};
339enum mixart_sample_type {
340	ST_NOT_DEFINED,
341	ST_FLOATING_POINT_32BE,
342	ST_FLOATING_POINT_32LE,
343	ST_FLOATING_POINT_64BE,
344	ST_FLOATING_POINT_64LE,
345	ST_FIXED_POINT_8,
346	ST_FIXED_POINT_16BE,
347	ST_FIXED_POINT_16LE,
348	ST_FIXED_POINT_24BE,
349	ST_FIXED_POINT_24LE,
350	ST_FIXED_POINT_32BE,
351	ST_FIXED_POINT_32LE,
352	ST_INTEGER_8,
353	ST_INTEGER_16BE,
354	ST_INTEGER_16LE,
355	ST_INTEGER_24BE,
356	ST_INTEGER_24LE,
357	ST_INTEGER_32BE,
358	ST_INTEGER_32LE
359};
360
361struct mixart_stream_param_desc
362{
363	u32 coding_type;  /* use enum mixart_coding_type */
364	u32 sample_type;  /* use enum mixart_sample_type */
365
366	union {
367		struct {
368			u32 linear_endian_ness;
369			u32 linear_bits;
370			u32 is_signed;
371			u32 is_float;
372		} linear_format_info;
373
374		struct {
375			u32 mpeg_layer;
376			u32 mpeg_mode;
377			u32 mpeg_mode_extension;
378			u32 mpeg_pre_emphasis;
379			u32 mpeg_has_padding_bit;
380			u32 mpeg_has_crc;
381			u32 mpeg_has_extension;
382			u32 mpeg_is_original;
383			u32 mpeg_has_copyright;
384		} mpeg_format_info;
385	} format_info;
386
387	u32 delayed;
388	u64 scheduler;
389	u32 sample_size;
390	u32 has_header;
391	u32 has_suffix;
392	u32 has_bitrate;
393	u32 samples_per_frame;
394	u32 bytes_per_frame;
395	u32 bytes_per_sample;
396	u32 sampling_freq;
397	u32 number_of_channel;
398	u32 stream_number;
399	u32 buffer_size;
400	u32 differed_time;
401	u32 reserved4np[3];
402	u32 pipe_count;                           /* set to 1 (array size !) */
403	u32 stream_count;                         /* set to 1 (array size !) */
404	struct mixart_txx_stream_desc stream_desc; /* only one stream per command, but this could be an array, in theory */
405} __packed;
 
406
407
408/*	MSG_CONNECTOR_GET_OUT_AUDIO_LEVEL    = 0x050009,
409 */
410
411
412struct mixart_get_out_audio_level
413{
414	u32 txx_status;
415	u32 digital_level;   /* float */
416	u32 analog_level;    /* float */
417	u32 monitor_level;   /* float */
418	u32 mute;
419	u32 monitor_mute1;
420	u32 monitor_mute2;
421} __packed;
422
423
424/*	MSG_CONNECTOR_SET_OUT_AUDIO_LEVEL    = 0x05000A,
425 */
426
427/* used for valid_mask below */
428#define MIXART_AUDIO_LEVEL_ANALOG_MASK	0x01
429#define MIXART_AUDIO_LEVEL_DIGITAL_MASK	0x02
430#define MIXART_AUDIO_LEVEL_MONITOR_MASK	0x04
431#define MIXART_AUDIO_LEVEL_MUTE_MASK	0x08
432#define MIXART_AUDIO_LEVEL_MUTE_M1_MASK	0x10
433#define MIXART_AUDIO_LEVEL_MUTE_M2_MASK	0x20
434
435struct mixart_set_out_audio_level
436{
437	u32 delayed;
438	u64 scheduler;
439	u32 valid_mask1;
440	u32 valid_mask2;
441	u32 digital_level;   /* float */
442	u32 analog_level;    /* float */
443	u32 monitor_level;   /* float */
444	u32 mute;
445	u32 monitor_mute1;
446	u32 monitor_mute2;
447	u32 reserved4np;
448} __packed;
449
450
451/*	MSG_SYSTEM_ENUM_PHYSICAL_IO          = 0x16000E,
452 */
453
454#define MIXART_MAX_PHYS_IO  (MIXART_MAX_CARDS * 2 * 2) /* 4 * (analog+digital) * (playback+capture) */
455
456struct mixart_uid_enumeration
457{
458	u32 error_code;
459	u32 first_uid_offset;
460	u32 nb_uid;
461	u32 current_uid_index;
462	struct mixart_uid uid[MIXART_MAX_PHYS_IO];
463} __packed;
464
465
466/*	MSG_PHYSICALIO_SET_LEVEL             = 0x0F0008,
467	MSG_PHYSICALIO_GET_LEVEL             = 0x0F000C,
468*/
469
470struct mixart_io_channel_level
471{
472	u32 analog_level;   /* float */
473	u32 unused[2];
474} __packed;
475
476struct mixart_io_level
477{
478	s32 channel; /* 0=left, 1=right, -1=both, -2=both same */
479	struct mixart_io_channel_level level[2];
480} __packed;
481
482
483/*	MSG_STREAM_SET_IN_AUDIO_LEVEL        = 0x130015,
484 */
485
486struct mixart_in_audio_level_info
487{
488	struct mixart_uid connector;
489	u32 valid_mask1;
490	u32 valid_mask2;
491	u32 digital_level;
492	u32 analog_level;
493} __packed;
494
495struct mixart_set_in_audio_level_req
496{
497	u32 delayed;
498	u64 scheduler;
499	u32 audio_count;  /* set to <= 2 */
500	u32 reserved4np;
501	struct mixart_in_audio_level_info level[2];
502} __packed;
503
504/* response is a 32 bit status */
505
506
507/*	MSG_STREAM_SET_OUT_STREAM_LEVEL      = 0x130017,
508 */
509
510/* defines used for valid_mask1 */
511#define MIXART_OUT_STREAM_SET_LEVEL_LEFT_AUDIO1		0x01
512#define MIXART_OUT_STREAM_SET_LEVEL_LEFT_AUDIO2		0x02
513#define MIXART_OUT_STREAM_SET_LEVEL_RIGHT_AUDIO1	0x04
514#define MIXART_OUT_STREAM_SET_LEVEL_RIGHT_AUDIO2	0x08
515#define MIXART_OUT_STREAM_SET_LEVEL_STREAM_1		0x10
516#define MIXART_OUT_STREAM_SET_LEVEL_STREAM_2		0x20
517#define MIXART_OUT_STREAM_SET_LEVEL_MUTE_1		0x40
518#define MIXART_OUT_STREAM_SET_LEVEL_MUTE_2		0x80
519
520struct mixart_out_stream_level_info
521{
522	u32 valid_mask1;
523	u32 valid_mask2;
524	u32 left_to_out1_level;
525	u32 left_to_out2_level;
526	u32 right_to_out1_level;
527	u32 right_to_out2_level;
528	u32 digital_level1;
529	u32 digital_level2;
530	u32 mute1;
531	u32 mute2;
532} __packed;
533
534struct mixart_set_out_stream_level
535{
536	struct mixart_txx_stream_desc desc;
537	struct mixart_out_stream_level_info out_level;
538} __packed;
539
540struct mixart_set_out_stream_level_req
541{
542	u32 delayed;
543	u64 scheduler;
544	u32 reserved4np[2];
545	u32 nb_of_stream;  /* set to 1 */
546	struct mixart_set_out_stream_level stream_level; /* could be an array */
547} __packed;
548
549/* response to this request is a u32 status value */
550
551
552/* exported */
553void snd_mixart_init_mailbox(struct mixart_mgr *mgr);
554void snd_mixart_exit_mailbox(struct mixart_mgr *mgr);
555
556int  snd_mixart_send_msg(struct mixart_mgr *mgr, struct mixart_msg *request, int max_resp_size, void *resp_data);
557int  snd_mixart_send_msg_wait_notif(struct mixart_mgr *mgr, struct mixart_msg *request, u32 notif_event);
558int  snd_mixart_send_msg_nonblock(struct mixart_mgr *mgr, struct mixart_msg *request);
559
560irqreturn_t snd_mixart_interrupt(int irq, void *dev_id);
561irqreturn_t snd_mixart_threaded_irq(int irq, void *dev_id);
562
563void snd_mixart_reset_board(struct mixart_mgr *mgr);
564
565#endif /* __SOUND_MIXART_CORE_H */