blob: 308a5c89b7f7b2e25d145f28168062a189e404ba [file] [log] [blame]
Rohit kumar4ea92b12019-02-01 18:05:33 +05301/* Copyright (c) 2012-2019, The Linux Foundation. All rights reserved.
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +05302 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 */
12
13
14#ifndef _APR_AUDIO_V2_H_
15#define _APR_AUDIO_V2_H_
16
Laxminath Kasam605b42f2017-08-01 22:02:15 +053017#include <ipc/apr.h>
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +053018#include <linux/msm_audio.h>
19
20/* size of header needed for passing data out of band */
21#define APR_CMD_OB_HDR_SZ 12
22
23/* size of header needed for getting data */
24#define APR_CMD_GET_HDR_SZ 16
25
26struct param_outband {
27 size_t size;
28 void *kvaddr;
29 phys_addr_t paddr;
30};
31
32#define ADSP_ADM_VERSION 0x00070000
33
34#define ADM_CMD_SHARED_MEM_MAP_REGIONS 0x00010322
35#define ADM_CMDRSP_SHARED_MEM_MAP_REGIONS 0x00010323
36#define ADM_CMD_SHARED_MEM_UNMAP_REGIONS 0x00010324
37
38#define ADM_CMD_MATRIX_MAP_ROUTINGS_V5 0x00010325
39#define ADM_CMD_STREAM_DEVICE_MAP_ROUTINGS_V5 0x0001033D
40/* Enumeration for an audio Rx matrix ID.*/
41#define ADM_MATRIX_ID_AUDIO_RX 0
42
43#define ADM_MATRIX_ID_AUDIO_TX 1
44
45#define ADM_MATRIX_ID_COMPRESSED_AUDIO_RX 2
46
47#define ADM_MATRIX_ID_COMPRESSED_AUDIO_TX 3
48
49#define ADM_MATRIX_ID_LISTEN_TX 4
50/* Enumeration for an audio Tx matrix ID.*/
51#define ADM_MATRIX_ID_AUDIOX 1
52
53#define ADM_MAX_COPPS 5
54
55/* make sure this matches with msm_audio_calibration */
56#define SP_V2_NUM_MAX_SPKR 2
57
58/* Session map node structure.
59 * Immediately following this structure are num_copps
60 * entries of COPP IDs. The COPP IDs are 16 bits, so
61 * there might be a padding 16-bit field if num_copps
62 * is odd.
63 */
64struct adm_session_map_node_v5 {
65 u16 session_id;
66 /* Handle of the ASM session to be routed. Supported values: 1
67 * to 8.
68 */
69
70
71 u16 num_copps;
72 /* Number of COPPs to which this session is to be routed.
73 * Supported values: 0 < num_copps <= ADM_MAX_COPPS.
74 */
75} __packed;
76
77/* Payload of the #ADM_CMD_MATRIX_MAP_ROUTINGS_V5 command.
78 * Immediately following this structure are num_sessions of the session map
79 * node payload (adm_session_map_node_v5).
80 */
81
82struct adm_cmd_matrix_map_routings_v5 {
83 struct apr_hdr hdr;
84
85 u32 matrix_id;
86 /* Specifies whether the matrix ID is Audio Rx (0) or Audio Tx
87 * (1). Use the ADM_MATRIX_ID_AUDIO_RX or ADM_MATRIX_ID_AUDIOX
88 * macros to set this field.
89 */
90 u32 num_sessions;
91 /* Number of sessions being updated by this command (optional). */
92} __packed;
93
94/* This command allows a client to open a COPP/Voice Proc. TX module
95 * and sets up the device session: Matrix -> COPP -> AFE on the RX
96 * and AFE -> COPP -> Matrix on the TX. This enables PCM data to
97 * be transferred to/from the endpoint (AFEPortID).
98 *
99 * @return
100 * #ADM_CMDRSP_DEVICE_OPEN_V5 with the resulting status and COPP ID.
101 */
102#define ADM_CMD_DEVICE_OPEN_V5 0x00010326
103
104/* This command allows a client to open a COPP/Voice Proc the
105 * way as ADM_CMD_DEVICE_OPEN_V5 but supports multiple endpoint2
106 * channels.
107 *
108 * @return
109 * #ADM_CMDRSP_DEVICE_OPEN_V6 with the resulting status and
110 * COPP ID.
111 */
112#define ADM_CMD_DEVICE_OPEN_V6 0x00010356
113
Dieter Lueckinga8b8e3b2018-09-28 14:29:17 +0200114/* This command allows a client to open a COPP/Voice Proc the
115* way as ADM_CMD_DEVICE_OPEN_V8 but supports any number channel
116* of configuration.
117*
118* @return
119* #ADM_CMDRSP_DEVICE_OPEN_V8 with the resulting status and
120* COPP ID.
121*/
122#define ADM_CMD_DEVICE_OPEN_V8 0x0001036A
123
124
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +0530125/* Definition for a low latency stream session. */
126#define ADM_LOW_LATENCY_DEVICE_SESSION 0x2000
127
128/* Definition for a ultra low latency stream session. */
129#define ADM_ULTRA_LOW_LATENCY_DEVICE_SESSION 0x4000
130
131/* Definition for a ultra low latency with Post Processing stream session. */
132#define ADM_ULL_POST_PROCESSING_DEVICE_SESSION 0x8000
133
134/* Definition for a legacy device session. */
135#define ADM_LEGACY_DEVICE_SESSION 0
136
137/* Indicates that endpoint_id_2 is to be ignored.*/
138#define ADM_CMD_COPP_OPEN_END_POINT_ID_2_IGNORE 0xFFFF
139
140#define ADM_CMD_COPP_OPEN_MODE_OF_OPERATION_RX_PATH_COPP 1
141
142#define ADM_CMD_COPP_OPEN_MODE_OF_OPERATIONX_PATH_LIVE_COPP 2
143
144#define ADM_CMD_COPP_OPEN_MODE_OF_OPERATIONX_PATH_NON_LIVE_COPP 3
145
146/* Indicates that an audio COPP is to send/receive a mono PCM
147 * stream to/from
148 * END_POINT_ID_1.
149 */
150#define ADM_CMD_COPP_OPEN_CHANNEL_CONFIG_MONO 1
151
152/* Indicates that an audio COPP is to send/receive a
153 * stereo PCM stream to/from END_POINT_ID_1.
154 */
155#define ADM_CMD_COPP_OPEN_CHANNEL_CONFIG_STEREO 2
156
157/* Sample rate is 8000 Hz.*/
158#define ADM_CMD_COPP_OPEN_SAMPLE_RATE_8K 8000
159
160/* Sample rate is 16000 Hz.*/
161#define ADM_CMD_COPP_OPEN_SAMPLE_RATE_16K 16000
162
163/* Sample rate is 48000 Hz.*/
164#define ADM_CMD_COPP_OPEN_SAMPLE_RATE_48K 48000
165
166/* Definition for a COPP live input flag bitmask.*/
167#define ADM_BIT_MASK_COPP_LIVE_INPUT_FLAG (0x0001U)
168
169/* Definition for a COPP live shift value bitmask.*/
170#define ADM_SHIFT_COPP_LIVE_INPUT_FLAG 0
171
172/* Definition for the COPP ID bitmask.*/
173#define ADM_BIT_MASK_COPP_ID (0x0000FFFFUL)
174
175/* Definition for the COPP ID shift value.*/
176#define ADM_SHIFT_COPP_ID 0
177
178/* Definition for the service ID bitmask.*/
179#define ADM_BIT_MASK_SERVICE_ID (0x00FF0000UL)
180
181/* Definition for the service ID shift value.*/
182#define ADM_SHIFT_SERVICE_ID 16
183
184/* Definition for the domain ID bitmask.*/
185#define ADM_BIT_MASK_DOMAIN_ID (0xFF000000UL)
186
187/* Definition for the domain ID shift value.*/
188#define ADM_SHIFT_DOMAIN_ID 24
189
190/* ADM device open command payload of the
191 * #ADM_CMD_DEVICE_OPEN_V5 command.
192 */
193struct adm_cmd_device_open_v5 {
194 struct apr_hdr hdr;
195 u16 flags;
196/* Reserved for future use. Clients must set this field
197 * to zero.
198 */
199
200 u16 mode_of_operation;
201/* Specifies whether the COPP must be opened on the Tx or Rx
202 * path. Use the ADM_CMD_COPP_OPEN_MODE_OF_OPERATION_* macros for
203 * supported values and interpretation.
204 * Supported values:
205 * - 0x1 -- Rx path COPP
206 * - 0x2 -- Tx path live COPP
207 * - 0x3 -- Tx path nonlive COPP
208 * Live connections cause sample discarding in the Tx device
209 * matrix if the destination output ports do not pull them
210 * fast enough. Nonlive connections queue the samples
211 * indefinitely.
212 */
213
214 u16 endpoint_id_1;
215/* Logical and physical endpoint ID of the audio path.
216 * If the ID is a voice processor Tx block, it receives near
217 * samples. Supported values: Any pseudoport, AFE Rx port,
218 * or AFE Tx port For a list of valid IDs, refer to
219 * @xhyperref{Q4,[Q4]}.
220 * Q4 = Hexagon Multimedia: AFE Interface Specification
221 */
222
223 u16 endpoint_id_2;
224/* Logical and physical endpoint ID 2 for a voice processor
225 * Tx block.
226 * This is not applicable to audio COPP.
227 * Supported values:
228 * - AFE Rx port
229 * - 0xFFFF -- Endpoint 2 is unavailable and the voice
230 * processor Tx
231 * block ignores this endpoint
232 * When the voice processor Tx block is created on the audio
233 * record path,
234 * it can receive far-end samples from an AFE Rx port if the
235 * voice call
236 * is active. The ID of the AFE port is provided in this
237 * field.
238 * For a list of valid IDs, refer @xhyperref{Q4,[Q4]}.
239 */
240
241 u32 topology_id;
242/* Audio COPP topology ID; 32-bit GUID. */
243
244 u16 dev_num_channel;
245/* Number of channels the audio COPP sends to/receives from
246 * the endpoint.
247 * Supported values: 1 to 8.
248 * The value is ignored for the voice processor Tx block,
249 * where channel
250 * configuration is derived from the topology ID.
251 */
252
253 u16 bit_width;
254/* Bit width (in bits) that the audio COPP sends to/receives
255 * from the
256 * endpoint. The value is ignored for the voice processing
257 * Tx block,
258 * where the PCM width is 16 bits.
259 */
260
261 u32 sample_rate;
262/* Sampling rate at which the audio COPP/voice processor
263 * Tx block
264 * interfaces with the endpoint.
265 * Supported values for voice processor Tx: 8000, 16000,
266 * 48000 Hz
267 * Supported values for audio COPP: >0 and <=192 kHz
268 */
269
270 u8 dev_channel_mapping[8];
271/* Array of channel mapping of buffers that the audio COPP
272 * sends to the endpoint. Channel[i] mapping describes channel
273 * I inside the buffer, where 0 < i < dev_num_channel.
274 * This value is relevant only for an audio Rx COPP.
275 * For the voice processor block and Tx audio block, this field
276 * is set to zero and is ignored.
277 */
278} __packed;
279
280/* ADM device open command payload of the
281 * #ADM_CMD_DEVICE_OPEN_V6 command.
282 */
283struct adm_cmd_device_open_v6 {
284 struct apr_hdr hdr;
285 u16 flags;
286/* Reserved for future use. Clients must set this field
287 * to zero.
288 */
289
290 u16 mode_of_operation;
291/* Specifies whether the COPP must be opened on the Tx or Rx
292 * path. Use the ADM_CMD_COPP_OPEN_MODE_OF_OPERATION_* macros for
293 * supported values and interpretation.
294 * Supported values:
295 * - 0x1 -- Rx path COPP
296 * - 0x2 -- Tx path live COPP
297 * - 0x3 -- Tx path nonlive COPP
298 * Live connections cause sample discarding in the Tx device
299 * matrix if the destination output ports do not pull them
300 * fast enough. Nonlive connections queue the samples
301 * indefinitely.
302 */
303
304 u16 endpoint_id_1;
305/* Logical and physical endpoint ID of the audio path.
306 * If the ID is a voice processor Tx block, it receives near
307 * samples. Supported values: Any pseudoport, AFE Rx port,
308 * or AFE Tx port For a list of valid IDs, refer to
309 * @xhyperref{Q4,[Q4]}.
310 * Q4 = Hexagon Multimedia: AFE Interface Specification
311 */
312
313 u16 endpoint_id_2;
314/* Logical and physical endpoint ID 2 for a voice processor
315 * Tx block.
316 * This is not applicable to audio COPP.
317 * Supported values:
318 * - AFE Rx port
319 * - 0xFFFF -- Endpoint 2 is unavailable and the voice
320 * processor Tx
321 * block ignores this endpoint
322 * When the voice processor Tx block is created on the audio
323 * record path,
324 * it can receive far-end samples from an AFE Rx port if the
325 * voice call
326 * is active. The ID of the AFE port is provided in this
327 * field.
328 * For a list of valid IDs, refer @xhyperref{Q4,[Q4]}.
329 */
330
331 u32 topology_id;
332/* Audio COPP topology ID; 32-bit GUID. */
333
334 u16 dev_num_channel;
335/* Number of channels the audio COPP sends to/receives from
336 * the endpoint.
337 * Supported values: 1 to 8.
338 * The value is ignored for the voice processor Tx block,
339 * where channel
340 * configuration is derived from the topology ID.
341 */
342
343 u16 bit_width;
344/* Bit width (in bits) that the audio COPP sends to/receives
345 * from the
346 * endpoint. The value is ignored for the voice processing
347 * Tx block,
348 * where the PCM width is 16 bits.
349 */
350
351 u32 sample_rate;
352/* Sampling rate at which the audio COPP/voice processor
353 * Tx block
354 * interfaces with the endpoint.
355 * Supported values for voice processor Tx: 8000, 16000,
356 * 48000 Hz
357 * Supported values for audio COPP: >0 and <=192 kHz
358 */
359
360 u8 dev_channel_mapping[8];
361/* Array of channel mapping of buffers that the audio COPP
362 * sends to the endpoint. Channel[i] mapping describes channel
363 * I inside the buffer, where 0 < i < dev_num_channel.
364 * This value is relevant only for an audio Rx COPP.
365 * For the voice processor block and Tx audio block, this field
366 * is set to zero and is ignored.
367 */
368
369 u16 dev_num_channel_eid2;
370/* Number of channels the voice processor block sends
371 * to/receives from the endpoint2.
372 * Supported values: 1 to 8.
373 * The value is ignored for audio COPP or if endpoint_id_2 is
374 * set to 0xFFFF.
375 */
376
377 u16 bit_width_eid2;
378/* Bit width (in bits) that the voice processor sends
379 * to/receives from the endpoint2.
380 * Supported values: 16 and 24.
381 * The value is ignored for audio COPP or if endpoint_id_2 is
382 * set to 0xFFFF.
383 */
384
385 u32 sample_rate_eid2;
386/* Sampling rate at which the voice processor Tx block
387 * interfaces with the endpoint2.
388 * Supported values for Tx voice processor: >0 and <=384 kHz
389 * The value is ignored for audio COPP or if endpoint_id_2 is
390 * set to 0xFFFF.
391 */
392
393 u8 dev_channel_mapping_eid2[8];
394/* Array of channel mapping of buffers that the voice processor
395 * sends to the endpoint. Channel[i] mapping describes channel
396 * I inside the buffer, where 0 < i < dev_num_channel.
397 * This value is relevant only for the Tx voice processor.
398 * The values are ignored for audio COPP or if endpoint_id_2 is
399 * set to 0xFFFF.
400 */
401} __packed;
402
Dieter Lueckinga8b8e3b2018-09-28 14:29:17 +0200403
404/* ADM device open endpoint payload the
405 * #ADM_CMD_DEVICE_OPEN_V8 command.
406 */
407struct adm_device_endpoint_payload {
408 u16 dev_num_channel;
409/* Number of channels the audio COPP sends to/receives from
410 * the endpoint.
411 * Supported values: 1 to 32.
412 * The value is ignored for the voice processor Tx block,
413 * where channel
414 * configuration is derived from the topology ID.
415 */
416
417 u16 bit_width;
418/* Bit width (in bits) that the audio COPP sends to/receives
419 * from the
420 * endpoint. The value is ignored for the voice processing
421 * Tx block,
422 * where the PCM width is 16 bits.
423 */
424
425 u32 sample_rate;
426/* Sampling rate at which the audio COPP/voice processor
427 * Tx block
428 * interfaces with the endpoint.
429 * Supported values for voice processor Tx: 8000, 16000,
430 * 48000 Hz
431 * Supported values for audio COPP: >0 and <=192 kHz
432 */
433
434 u8 dev_channel_mapping[32];
435} __packed;
436
437/* ADM device open command payload of the
438 * #ADM_CMD_DEVICE_OPEN_V8 command.
439 */
440struct adm_cmd_device_open_v8 {
441 struct apr_hdr hdr;
442 u16 flags;
443/* Bit width Native mode enabled : 11th bit of flag parameter
444* If 11th bit of flag is set then that means matrix mixer will be
445* running in native mode for bit width for this device session.
446*
447* Channel Native mode enabled : 12th bit of flag parameter
448* If 12th bit of flag is set then that means matrix mixer will be
449* running in native mode for channel configuration for this device session.
450* All other bits are reserved; clients must set them to 0.
451*/
452 u16 mode_of_operation;
453/* Specifies whether the COPP must be opened on the Tx or Rx
454 * path. Use the ADM_CMD_COPP_OPEN_MODE_OF_OPERATION_* macros for
455 * supported values and interpretation.
456 * Supported values:
457 * - 0x1 -- Rx path COPP
458 * - 0x2 -- Tx path live COPP
459 * - 0x3 -- Tx path nonlive COPP
460 * Live connections cause sample discarding in the Tx device
461 * matrix if the destination output ports do not pull them
462 * fast enough. Nonlive connections queue the samples
463 * indefinitely.
464 */
465 u32 topology_id;
466/* Audio COPP topology ID; 32-bit GUID. */
467
468
469 u16 endpoint_id_1;
470/* Logical and physical endpoint ID of the audio path.
471 * If the ID is a voice processor Tx block, it receives near
472 * samples.
473 * Supported values: Any pseudoport, AFE Rx port,
474 * or AFE Tx port For a list of valid IDs, refer to
475 * @xhyperref{Q4,[Q4]}.
476 * Q4 = Hexagon Multimedia: AFE Interface Specification
477 */
478
479 u16 endpoint_id_2;
480/* Logical and physical endpoint ID 2 for a voice processor
481 * Tx block.
482 * This is not applicable to audio COPP.
483 * Supported values:
484 * - AFE Rx port
485 * - 0xFFFF -- Endpoint 2 is unavailable and the voice
486 * processor Tx
487 * block ignores this endpoint
488 * When the voice processor Tx block is created on the audio
489 * record path,
490 * it can receive far-end samples from an AFE Rx port if the
491 * voice call
492 * is active. The ID of the AFE port is provided in this
493 * field.
494 * For a list of valid IDs, refer @xhyperref{Q4,[Q4]}.
495 */
496
497 u16 endpoint_id_3;
498/*
499 * Logical and physical endpoint ID of the audio path.
500 * This indicated afe rx port in ADM loopback use cases.
501 * In all other use cases this should be set to 0xffff
502 */
503
504 u16 reserved;
505} __packed;
506
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +0530507/*
508 * This command allows the client to close a COPP and disconnect
509 * the device session.
510 */
511#define ADM_CMD_DEVICE_CLOSE_V5 0x00010327
512
513/* Sets one or more parameters to a COPP. */
514#define ADM_CMD_SET_PP_PARAMS_V5 0x00010328
515
516/* Payload of the #ADM_CMD_SET_PP_PARAMS_V5 command.
517 * If the data_payload_addr_lsw and data_payload_addr_msw element
518 * are NULL, a series of adm_param_datastructures immediately
519 * follows, whose total size is data_payload_size bytes.
520 */
521struct adm_cmd_set_pp_params_v5 {
522 struct apr_hdr hdr;
523 u32 payload_addr_lsw;
524/* LSW of parameter data payload address. */
525 u32 payload_addr_msw;
526/* MSW of parameter data payload address. */
527
528 u32 mem_map_handle;
529/* Memory map handle returned by ADM_CMD_SHARED_MEM_MAP_REGIONS
530 * command
531 *
532 * If mem_map_handle is zero implies the message is in
533 * the payload
534 */
535
536 u32 payload_size;
537/* Size in bytes of the variable payload accompanying this
538 * message or
539 * in shared memory. This is used for parsing the parameter
540 * payload.
541 */
542} __packed;
543
544/* Payload format for COPP parameter data.
545 * Immediately following this structure are param_size bytes
546 * of parameter
547 * data.
548 */
549struct adm_param_data_v5 {
550 u32 module_id;
551 /* Unique ID of the module. */
552 u32 param_id;
553 /* Unique ID of the parameter. */
554 u16 param_size;
555 /* Data size of the param_id/module_id combination.
556 * This value is a
557 * multiple of 4 bytes.
558 */
559 u16 reserved;
560 /* Reserved for future enhancements.
561 * This field must be set to zero.
562 */
563} __packed;
564
565#define ASM_STREAM_CMD_REGISTER_PP_EVENTS 0x00013213
566#define ASM_STREAM_PP_EVENT 0x00013214
567#define ASM_STREAM_CMD_REGISTER_IEC_61937_FMT_UPDATE 0x13333
568#define ASM_IEC_61937_MEDIA_FMT_EVENT 0x13334
569
570#define DSP_STREAM_CMD "ADSP Stream Cmd"
571#define DSP_STREAM_CALLBACK "ADSP Stream Callback Event"
572#define DSP_STREAM_CALLBACK_QUEUE_SIZE 1024
573
574struct dsp_stream_callback_list {
575 struct list_head list;
576 struct msm_adsp_event_data event;
577};
578
579struct dsp_stream_callback_prtd {
580 uint16_t event_count;
581 struct list_head event_queue;
582 spinlock_t prtd_spin_lock;
583};
584
585/* set customized mixing on matrix mixer */
586#define ADM_CMD_SET_PSPD_MTMX_STRTR_PARAMS_V5 0x00010344
587struct adm_cmd_set_pspd_mtmx_strtr_params_v5 {
588 struct apr_hdr hdr;
589 /* LSW of parameter data payload address.*/
590 u32 payload_addr_lsw;
591 /* MSW of parameter data payload address.*/
592 u32 payload_addr_msw;
593 /* Memory map handle returned by ADM_CMD_SHARED_MEM_MAP_REGIONS */
594 /* command. If mem_map_handle is zero implies the message is in */
595 /* the payload */
596 u32 mem_map_handle;
597 /* Size in bytes of the variable payload accompanying this */
598 /* message or in shared memory. This is used for parsing the */
599 /* parameter payload. */
600 u32 payload_size;
601 u16 direction;
602 u16 sessionid;
603 u16 deviceid;
604 u16 reserved;
605} __packed;
606
607/* Defined specifically for in-band use, includes params */
608struct adm_cmd_set_pp_params_inband_v5 {
609 struct apr_hdr hdr;
610 /* LSW of parameter data payload address.*/
611 u32 payload_addr_lsw;
612 /* MSW of parameter data payload address.*/
613 u32 payload_addr_msw;
614 /* Memory map handle returned by ADM_CMD_SHARED_MEM_MAP_REGIONS */
615 /* command. If mem_map_handle is zero implies the message is in */
616 /* the payload */
617 u32 mem_map_handle;
618 /* Size in bytes of the variable payload accompanying this */
619 /* message or in shared memory. This is used for parsing the */
620 /* parameter payload. */
621 u32 payload_size;
622 /* Parameters passed for in band payload */
623 struct adm_param_data_v5 params;
624} __packed;
625
626/* Returns the status and COPP ID to an #ADM_CMD_DEVICE_OPEN_V5 command.
627 */
628#define ADM_CMDRSP_DEVICE_OPEN_V5 0x00010329
629
630/* Payload of the #ADM_CMDRSP_DEVICE_OPEN_V5 message,
631 * which returns the
632 * status and COPP ID to an #ADM_CMD_DEVICE_OPEN_V5 command.
633 */
634struct adm_cmd_rsp_device_open_v5 {
635 u32 status;
636 /* Status message (error code).*/
637
638 u16 copp_id;
639 /* COPP ID: Supported values: 0 <= copp_id < ADM_MAX_COPPS*/
640
641 u16 reserved;
642 /* Reserved. This field must be set to zero.*/
643} __packed;
644
645/* Returns the status and COPP ID to an #ADM_CMD_DEVICE_OPEN_V6 command. */
646#define ADM_CMDRSP_DEVICE_OPEN_V6 0x00010357
647
Dieter Lueckinga8b8e3b2018-09-28 14:29:17 +0200648/* Returns the status and COPP ID to an #ADM_CMD_DEVICE_OPEN_V8 command. */
649#define ADM_CMDRSP_DEVICE_OPEN_V8 0x0001036B
650
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +0530651/* Payload of the #ADM_CMDRSP_DEVICE_OPEN_V6 message,
652 * which returns the
653 * status and COPP ID to an #ADM_CMD_DEVICE_OPEN_V6 command
654 * is the exact same as ADM_CMDRSP_DEVICE_OPEN_V5.
655 */
656
657/* This command allows a query of one COPP parameter. */
658#define ADM_CMD_GET_PP_PARAMS_V5 0x0001032A
659
660/* Payload an #ADM_CMD_GET_PP_PARAMS_V5 command. */
661struct adm_cmd_get_pp_params_v5 {
662 struct apr_hdr hdr;
663 u32 data_payload_addr_lsw;
664 /* LSW of parameter data payload address.*/
665
666 u32 data_payload_addr_msw;
667 /* MSW of parameter data payload address.*/
668
669 /* If the mem_map_handle is non zero,
670 * on ACK, the ParamData payloads begin at
671 * the address specified (out-of-band).
672 */
673
674 u32 mem_map_handle;
675 /* Memory map handle returned
676 * by ADM_CMD_SHARED_MEM_MAP_REGIONS command.
677 * If the mem_map_handle is 0, it implies that
678 * the ACK's payload will contain the ParamData (in-band).
679 */
680
681 u32 module_id;
682 /* Unique ID of the module. */
683
684 u32 param_id;
685 /* Unique ID of the parameter. */
686
687 u16 param_max_size;
688 /* Maximum data size of the parameter
689 *ID/module ID combination. This
690 * field is a multiple of 4 bytes.
691 */
692 u16 reserved;
693 /* Reserved for future enhancements.
694 * This field must be set to zero.
695 */
696} __packed;
697
698/* Returns parameter values
699 * in response to an #ADM_CMD_GET_PP_PARAMS_V5 command.
700 */
701#define ADM_CMDRSP_GET_PP_PARAMS_V5 0x0001032B
702
703/* Payload of the #ADM_CMDRSP_GET_PP_PARAMS_V5 message,
704 * which returns parameter values in response
705 * to an #ADM_CMD_GET_PP_PARAMS_V5 command.
706 * Immediately following this
707 * structure is the adm_param_data_v5
708 * structure containing the pre/postprocessing
709 * parameter data. For an in-band
710 * scenario, the variable payload depends
711 * on the size of the parameter.
712 */
713struct adm_cmd_rsp_get_pp_params_v5 {
714 u32 status;
715 /* Status message (error code).*/
716} __packed;
717
718/* Structure for holding soft stepping volume parameters. */
719
720/*
721 * Payload of the #ASM_PARAM_ID_SOFT_VOL_STEPPING_PARAMETERS
722 * parameters used by the Volume Control module.
723 */
724
725struct audproc_softvolume_params {
726 u32 period;
727 u32 step;
728 u32 rampingcurve;
729} __packed;
730
731/*
732 * ID of the Media Format Converter (MFC) module.
733 * This module supports the following parameter IDs:
734 * #AUDPROC_PARAM_ID_MFC_OUTPUT_MEDIA_FORMAT
735 * #AUDPROC_CHMIXER_PARAM_ID_COEFF
736 */
737#define AUDPROC_MODULE_ID_MFC 0x00010912
738
739/* ID of the Output Media Format parameters used by AUDPROC_MODULE_ID_MFC.
740 *
741 */
742#define AUDPROC_PARAM_ID_MFC_OUTPUT_MEDIA_FORMAT 0x00010913
743
Aditya Bavanari245361d2017-09-07 12:11:30 +0530744/* Param ID of Channel Mixer used by AUDPROC_MODULE_ID_MFC */
745#define AUDPROC_CHMIXER_PARAM_ID_COEFF 0x00010342
746
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +0530747
748struct audproc_mfc_output_media_fmt {
749 struct adm_cmd_set_pp_params_v5 params;
750 struct adm_param_data_v5 data;
751 uint32_t sampling_rate;
752 uint16_t bits_per_sample;
753 uint16_t num_channels;
754 uint16_t channel_type[8];
755} __packed;
756
757struct audproc_volume_ctrl_master_gain {
758 struct adm_cmd_set_pp_params_v5 params;
759 struct adm_param_data_v5 data;
760 /* Linear gain in Q13 format. */
761 uint16_t master_gain;
762 /* Clients must set this field to zero. */
763 uint16_t reserved;
764} __packed;
765
766struct audproc_soft_step_volume_params {
767 struct adm_cmd_set_pp_params_v5 params;
768 struct adm_param_data_v5 data;
769/*
770 * Period in milliseconds.
771 * Supported values: 0 to 15000
772 */
773 uint32_t period;
774/*
775 * Step in microseconds.
776 * Supported values: 0 to 15000000
777 */
778 uint32_t step;
779/*
780 * Ramping curve type.
781 * Supported values:
782 * - #AUDPROC_PARAM_SVC_RAMPINGCURVE_LINEAR
783 * - #AUDPROC_PARAM_SVC_RAMPINGCURVE_EXP
784 * - #AUDPROC_PARAM_SVC_RAMPINGCURVE_LOG
785 */
786 uint32_t ramping_curve;
787} __packed;
788
789struct audproc_enable_param_t {
790 struct adm_cmd_set_pp_params_inband_v5 pp_params;
791 /*
792 * Specifies whether the Audio processing module is enabled.
793 * This parameter is generic/common parameter to configure or
794 * determine the state of any audio processing module.
795
796 * @values 0 : Disable 1: Enable
797 */
798 uint32_t enable;
799};
800
801/*
802 * Allows a client to control the gains on various session-to-COPP paths.
803 */
804#define ADM_CMD_MATRIX_RAMP_GAINS_V5 0x0001032C
805
806/* Indicates that the target gain in the
807 * current adm_session_copp_gain_v5
808 * structure is to be applied to all
809 * the session-to-COPP paths that exist for
810 * the specified session.
811 */
812#define ADM_CMD_MATRIX_RAMP_GAINS_COPP_ID_ALL_CONNECTED_COPPS 0xFFFF
813
814/* Indicates that the target gain is
815 * to be immediately applied to the
816 * specified session-to-COPP path,
817 * without a ramping fashion.
818 */
819#define ADM_CMD_MATRIX_RAMP_GAINS_RAMP_DURATION_IMMEDIATE 0x0000
820
821/* Enumeration for a linear ramping curve.*/
822#define ADM_CMD_MATRIX_RAMP_GAINS_RAMP_CURVE_LINEAR 0x0000
823
824/* Payload of the #ADM_CMD_MATRIX_RAMP_GAINS_V5 command.
825 * Immediately following this structure are num_gains of the
826 * adm_session_copp_gain_v5structure.
827 */
828struct adm_cmd_matrix_ramp_gains_v5 {
829 u32 matrix_id;
830/* Specifies whether the matrix ID is Audio Rx (0) or Audio Tx (1).
831 * Use the ADM_MATRIX_ID_AUDIO_RX or ADM_MATRIX_ID_AUDIOX
832 * macros to set this field.
833 */
834
835 u16 num_gains;
836 /* Number of gains being applied. */
837
838 u16 reserved_for_align;
839 /* Reserved. This field must be set to zero.*/
840} __packed;
841
842/* Session-to-COPP path gain structure, used by the
843 * #ADM_CMD_MATRIX_RAMP_GAINS_V5 command.
844 * This structure specifies the target
845 * gain (per channel) that must be applied
846 * to a particular session-to-COPP path in
847 * the audio matrix. The structure can
848 * also be used to apply the gain globally
849 * to all session-to-COPP paths that
850 * exist for the given session.
851 * The aDSP uses device channel mapping to
852 * determine which channel gains to
853 * use from this command. For example,
854 * if the device is configured as stereo,
855 * the aDSP uses only target_gain_ch_1 and
856 * target_gain_ch_2, and it ignores
857 * the others.
858 */
859struct adm_session_copp_gain_v5 {
860 u16 session_id;
861/* Handle of the ASM session.
862 * Supported values: 1 to 8.
863 */
864
865 u16 copp_id;
866/* Handle of the COPP. Gain will be applied on the Session ID
867 * COPP ID path.
868 */
869
870 u16 ramp_duration;
871/* Duration (in milliseconds) of the ramp over
872 * which target gains are
873 * to be applied. Use
874 * #ADM_CMD_MATRIX_RAMP_GAINS_RAMP_DURATION_IMMEDIATE
875 * to indicate that gain must be applied immediately.
876 */
877
878 u16 step_duration;
879/* Duration (in milliseconds) of each step in the ramp.
880 * This parameter is ignored if ramp_duration is equal to
881 * #ADM_CMD_MATRIX_RAMP_GAINS_RAMP_DURATION_IMMEDIATE.
882 * Supported value: 1
883 */
884
885 u16 ramp_curve;
886/* Type of ramping curve.
887 * Supported value: #ADM_CMD_MATRIX_RAMP_GAINS_RAMP_CURVE_LINEAR
888 */
889
890 u16 reserved_for_align;
891 /* Reserved. This field must be set to zero. */
892
893 u16 target_gain_ch_1;
894 /* Target linear gain for channel 1 in Q13 format; */
895
896 u16 target_gain_ch_2;
897 /* Target linear gain for channel 2 in Q13 format; */
898
899 u16 target_gain_ch_3;
900 /* Target linear gain for channel 3 in Q13 format; */
901
902 u16 target_gain_ch_4;
903 /* Target linear gain for channel 4 in Q13 format; */
904
905 u16 target_gain_ch_5;
906 /* Target linear gain for channel 5 in Q13 format; */
907
908 u16 target_gain_ch_6;
909 /* Target linear gain for channel 6 in Q13 format; */
910
911 u16 target_gain_ch_7;
912 /* Target linear gain for channel 7 in Q13 format; */
913
914 u16 target_gain_ch_8;
915 /* Target linear gain for channel 8 in Q13 format; */
916} __packed;
917
918/* Allows to set mute/unmute on various session-to-COPP paths.
919 * For every session-to-COPP path (stream-device interconnection),
920 * mute/unmute can be set individually on the output channels.
921 */
922#define ADM_CMD_MATRIX_MUTE_V5 0x0001032D
923
924/* Indicates that mute/unmute in the
925 * current adm_session_copp_mute_v5structure
926 * is to be applied to all the session-to-COPP
927 * paths that exist for the specified session.
928 */
929#define ADM_CMD_MATRIX_MUTE_COPP_ID_ALL_CONNECTED_COPPS 0xFFFF
930
931/* Payload of the #ADM_CMD_MATRIX_MUTE_V5 command*/
932struct adm_cmd_matrix_mute_v5 {
933 u32 matrix_id;
934/* Specifies whether the matrix ID is Audio Rx (0) or Audio Tx (1).
935 * Use the ADM_MATRIX_ID_AUDIO_RX or ADM_MATRIX_ID_AUDIOX
936 * macros to set this field.
937 */
938
939 u16 session_id;
940/* Handle of the ASM session.
941 * Supported values: 1 to 8.
942 */
943
944 u16 copp_id;
945/* Handle of the COPP.
946 * Use ADM_CMD_MATRIX_MUTE_COPP_ID_ALL_CONNECTED_COPPS
947 * to indicate that mute/unmute must be applied to
948 * all the COPPs connected to session_id.
949 * Supported values:
950 * - 0xFFFF -- Apply mute/unmute to all connected COPPs
951 * - Other values -- Valid COPP ID
952 */
953
954 u8 mute_flag_ch_1;
955 /* Mute flag for channel 1 is set to unmute (0) or mute (1). */
956
957 u8 mute_flag_ch_2;
958 /* Mute flag for channel 2 is set to unmute (0) or mute (1). */
959
960 u8 mute_flag_ch_3;
961 /* Mute flag for channel 3 is set to unmute (0) or mute (1). */
962
963 u8 mute_flag_ch_4;
964 /* Mute flag for channel 4 is set to unmute (0) or mute (1). */
965
966 u8 mute_flag_ch_5;
967 /* Mute flag for channel 5 is set to unmute (0) or mute (1). */
968
969 u8 mute_flag_ch_6;
970 /* Mute flag for channel 6 is set to unmute (0) or mute (1). */
971
972 u8 mute_flag_ch_7;
973 /* Mute flag for channel 7 is set to unmute (0) or mute (1). */
974
975 u8 mute_flag_ch_8;
976 /* Mute flag for channel 8 is set to unmute (0) or mute (1). */
977
978 u16 ramp_duration;
979/* Period (in milliseconds) over which the soft mute/unmute will be
980 * applied.
981 * Supported values: 0 (Default) to 0xFFFF
982 * The default of 0 means mute/unmute will be applied immediately.
983 */
984
985 u16 reserved_for_align;
986 /* Clients must set this field to zero.*/
987} __packed;
988
989#define ASM_PARAM_ID_AAC_STEREO_MIX_COEFF_SELECTION_FLAG_V2 (0x00010DD8)
990
991struct asm_aac_stereo_mix_coeff_selection_param_v2 {
992 struct apr_hdr hdr;
993 u32 param_id;
994 u32 param_size;
995 u32 aac_stereo_mix_coeff_flag;
996} __packed;
997
998/* Allows a client to connect the desired stream to
999 * the desired AFE port through the stream router
1000 *
1001 * This command allows the client to connect specified session to
1002 * specified AFE port. This is used for compressed streams only
1003 * opened using the #ASM_STREAM_CMD_OPEN_WRITE_COMPRESSED or
1004 * #ASM_STREAM_CMD_OPEN_READ_COMPRESSED command.
1005 *
1006 * @prerequisites
1007 * Session ID and AFE Port ID must be valid.
1008 * #ASM_STREAM_CMD_OPEN_WRITE_COMPRESSED or
1009 * #ASM_STREAM_CMD_OPEN_READ_COMPRESSED
1010 * must have been called on this session.
1011 */
1012
1013#define ADM_CMD_CONNECT_AFE_PORT_V5 0x0001032E
1014#define ADM_CMD_DISCONNECT_AFE_PORT_V5 0x0001032F
1015/* Enumeration for the Rx stream router ID.*/
1016#define ADM_STRTR_ID_RX 0
1017/* Enumeration for the Tx stream router ID.*/
1018#define ADM_STRTR_IDX 1
1019
1020/* Payload of the #ADM_CMD_CONNECT_AFE_PORT_V5 command.*/
1021struct adm_cmd_connect_afe_port_v5 {
1022 struct apr_hdr hdr;
1023 u8 mode;
1024/* ID of the stream router (RX/TX). Use the
1025 * ADM_STRTR_ID_RX or ADM_STRTR_IDX macros
1026 * to set this field.
1027 */
1028
1029 u8 session_id;
1030 /* Session ID of the stream to connect */
1031
1032 u16 afe_port_id;
1033 /* Port ID of the AFE port to connect to.*/
1034 u32 num_channels;
1035/* Number of device channels
1036 * Supported values: 2(Audio Sample Packet),
1037 * 8 (HBR Audio Stream Sample Packet)
1038 */
1039
1040 u32 sampling_rate;
1041/* Device sampling rate
1042 * Supported values: Any
1043 */
1044} __packed;
1045
1046
1047/* adsp_adm_api.h */
1048
1049
1050/* Port ID. Update afe_get_port_index
1051 * when a new port is added here.
1052 */
1053#define PRIMARY_I2S_RX 0
1054#define PRIMARY_I2S_TX 1
1055#define SECONDARY_I2S_RX 4
1056#define SECONDARY_I2S_TX 5
1057#define MI2S_RX 6
1058#define MI2S_TX 7
1059#define HDMI_RX 8
1060#define RSVD_2 9
1061#define RSVD_3 10
1062#define DIGI_MIC_TX 11
1063#define VOICE2_PLAYBACK_TX 0x8002
1064#define VOICE_RECORD_RX 0x8003
1065#define VOICE_RECORD_TX 0x8004
1066#define VOICE_PLAYBACK_TX 0x8005
1067
1068/* Slimbus Multi channel port id pool */
1069#define SLIMBUS_0_RX 0x4000
1070#define SLIMBUS_0_TX 0x4001
1071#define SLIMBUS_1_RX 0x4002
1072#define SLIMBUS_1_TX 0x4003
1073#define SLIMBUS_2_RX 0x4004
1074#define SLIMBUS_2_TX 0x4005
1075#define SLIMBUS_3_RX 0x4006
1076#define SLIMBUS_3_TX 0x4007
1077#define SLIMBUS_4_RX 0x4008
1078#define SLIMBUS_4_TX 0x4009
1079#define SLIMBUS_5_RX 0x400a
1080#define SLIMBUS_5_TX 0x400b
1081#define SLIMBUS_6_RX 0x400c
1082#define SLIMBUS_6_TX 0x400d
1083#define SLIMBUS_7_RX 0x400e
1084#define SLIMBUS_7_TX 0x400f
1085#define SLIMBUS_8_RX 0x4010
1086#define SLIMBUS_8_TX 0x4011
1087#define SLIMBUS_PORT_LAST SLIMBUS_8_TX
1088#define INT_BT_SCO_RX 0x3000
1089#define INT_BT_SCO_TX 0x3001
1090#define INT_BT_A2DP_RX 0x3002
1091#define INT_FM_RX 0x3004
1092#define INT_FM_TX 0x3005
1093#define RT_PROXY_PORT_001_RX 0x2000
1094#define RT_PROXY_PORT_001_TX 0x2001
Raja Mallik425e1d32018-05-20 19:21:10 +05301095#define AFE_LOOPBACK_TX 0x6001
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +05301096#define DISPLAY_PORT_RX 0x6020
1097
1098#define AFE_PORT_INVALID 0xFFFF
1099#define SLIMBUS_INVALID AFE_PORT_INVALID
1100
1101#define AFE_PORT_CMD_START 0x000100ca
1102
1103#define AFE_EVENT_RTPORT_START 0
1104#define AFE_EVENT_RTPORT_STOP 1
1105#define AFE_EVENT_RTPORT_LOW_WM 2
1106#define AFE_EVENT_RTPORT_HI_WM 3
1107
1108#define ADSP_AFE_VERSION 0x00200000
1109
1110/* Size of the range of port IDs for the audio interface. */
1111#define AFE_PORT_ID_AUDIO_IF_PORT_RANGE_SIZE 0xF
1112
1113/* Size of the range of port IDs for internal BT-FM ports. */
1114#define AFE_PORT_ID_INTERNAL_BT_FM_RANGE_SIZE 0x6
1115
1116/* Size of the range of port IDs for SLIMbus<sup>&reg;
1117 * </sup> multichannel
1118 * ports.
1119 */
1120#define AFE_PORT_ID_SLIMBUS_RANGE_SIZE 0xA
1121
1122/* Size of the range of port IDs for real-time proxy ports. */
1123#define AFE_PORT_ID_RT_PROXY_PORT_RANGE_SIZE 0x2
1124
1125/* Size of the range of port IDs for pseudoports. */
1126#define AFE_PORT_ID_PSEUDOPORT_RANGE_SIZE 0x5
1127
1128/* Start of the range of port IDs for the audio interface. */
1129#define AFE_PORT_ID_AUDIO_IF_PORT_RANGE_START 0x1000
1130
1131/* End of the range of port IDs for the audio interface. */
1132#define AFE_PORT_ID_AUDIO_IF_PORT_RANGE_END \
1133 (AFE_PORT_ID_AUDIO_IF_PORT_RANGE_START +\
1134 AFE_PORT_ID_AUDIO_IF_PORT_RANGE_SIZE - 1)
1135
1136/* Start of the range of port IDs for real-time proxy ports. */
1137#define AFE_PORT_ID_RT_PROXY_PORT_RANGE_START 0x2000
1138
1139/* End of the range of port IDs for real-time proxy ports. */
1140#define AFE_PORT_ID_RT_PROXY_PORT_RANGE_END \
1141 (AFE_PORT_ID_RT_PROXY_PORT_RANGE_START +\
1142 AFE_PORT_ID_RT_PROXY_PORT_RANGE_SIZE-1)
1143
1144/* Start of the range of port IDs for internal BT-FM devices. */
1145#define AFE_PORT_ID_INTERNAL_BT_FM_RANGE_START 0x3000
1146
1147/* End of the range of port IDs for internal BT-FM devices. */
1148#define AFE_PORT_ID_INTERNAL_BT_FM_RANGE_END \
1149 (AFE_PORT_ID_INTERNAL_BT_FM_RANGE_START +\
1150 AFE_PORT_ID_INTERNAL_BT_FM_RANGE_SIZE-1)
1151
1152/* Start of the range of port IDs for SLIMbus devices. */
1153#define AFE_PORT_ID_SLIMBUS_RANGE_START 0x4000
1154
1155/* End of the range of port IDs for SLIMbus devices. */
1156#define AFE_PORT_ID_SLIMBUS_RANGE_END \
1157 (AFE_PORT_ID_SLIMBUS_RANGE_START +\
1158 AFE_PORT_ID_SLIMBUS_RANGE_SIZE-1)
1159
1160/* Start of the range of port IDs for pseudoports. */
1161#define AFE_PORT_ID_PSEUDOPORT_RANGE_START 0x8001
1162
1163/* End of the range of port IDs for pseudoports. */
1164#define AFE_PORT_ID_PSEUDOPORT_RANGE_END \
1165 (AFE_PORT_ID_PSEUDOPORT_RANGE_START +\
1166 AFE_PORT_ID_PSEUDOPORT_RANGE_SIZE-1)
1167
1168/* Start of the range of port IDs for TDM devices. */
1169#define AFE_PORT_ID_TDM_PORT_RANGE_START 0x9000
1170
1171/* End of the range of port IDs for TDM devices. */
1172#define AFE_PORT_ID_TDM_PORT_RANGE_END \
Rohit Kumara5077932017-09-10 22:05:05 +05301173 (AFE_PORT_ID_TDM_PORT_RANGE_START+0x50-1)
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +05301174
1175/* Size of the range of port IDs for TDM ports. */
1176#define AFE_PORT_ID_TDM_PORT_RANGE_SIZE \
1177 (AFE_PORT_ID_TDM_PORT_RANGE_END - \
1178 AFE_PORT_ID_TDM_PORT_RANGE_START+1)
1179
1180#define AFE_PORT_ID_PRIMARY_MI2S_RX 0x1000
1181#define AFE_PORT_ID_PRIMARY_MI2S_TX 0x1001
1182#define AFE_PORT_ID_SECONDARY_MI2S_RX 0x1002
1183#define AFE_PORT_ID_SECONDARY_MI2S_TX 0x1003
1184#define AFE_PORT_ID_TERTIARY_MI2S_RX 0x1004
1185#define AFE_PORT_ID_TERTIARY_MI2S_TX 0x1005
1186#define AFE_PORT_ID_QUATERNARY_MI2S_RX 0x1006
1187#define AFE_PORT_ID_QUATERNARY_MI2S_TX 0x1007
1188#define AUDIO_PORT_ID_I2S_RX 0x1008
1189#define AFE_PORT_ID_DIGITAL_MIC_TX 0x1009
1190#define AFE_PORT_ID_PRIMARY_PCM_RX 0x100A
1191#define AFE_PORT_ID_PRIMARY_PCM_TX 0x100B
1192#define AFE_PORT_ID_SECONDARY_PCM_RX 0x100C
1193#define AFE_PORT_ID_SECONDARY_PCM_TX 0x100D
1194#define AFE_PORT_ID_MULTICHAN_HDMI_RX 0x100E
1195#define AFE_PORT_ID_SECONDARY_MI2S_RX_SD1 0x1010
1196#define AFE_PORT_ID_TERTIARY_PCM_RX 0x1012
1197#define AFE_PORT_ID_TERTIARY_PCM_TX 0x1013
1198#define AFE_PORT_ID_QUATERNARY_PCM_RX 0x1014
1199#define AFE_PORT_ID_QUATERNARY_PCM_TX 0x1015
1200#define AFE_PORT_ID_QUINARY_MI2S_RX 0x1016
1201#define AFE_PORT_ID_QUINARY_MI2S_TX 0x1017
1202/* ID of the senary MI2S Rx port. */
1203#define AFE_PORT_ID_SENARY_MI2S_RX 0x1018
1204/* ID of the senary MI2S Tx port. */
1205#define AFE_PORT_ID_SENARY_MI2S_TX 0x1019
Rohit Kumara5077932017-09-10 22:05:05 +05301206
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +05301207/* ID of the Internal 0 MI2S Rx port */
1208#define AFE_PORT_ID_INT0_MI2S_RX 0x102E
1209/* ID of the Internal 0 MI2S Tx port */
1210#define AFE_PORT_ID_INT0_MI2S_TX 0x102F
1211/* ID of the Internal 1 MI2S Rx port */
1212#define AFE_PORT_ID_INT1_MI2S_RX 0x1030
1213/* ID of the Internal 1 MI2S Tx port */
1214#define AFE_PORT_ID_INT1_MI2S_TX 0x1031
1215/* ID of the Internal 2 MI2S Rx port */
1216#define AFE_PORT_ID_INT2_MI2S_RX 0x1032
1217/* ID of the Internal 2 MI2S Tx port */
1218#define AFE_PORT_ID_INT2_MI2S_TX 0x1033
1219/* ID of the Internal 3 MI2S Rx port */
1220#define AFE_PORT_ID_INT3_MI2S_RX 0x1034
1221/* ID of the Internal 3 MI2S Tx port */
1222#define AFE_PORT_ID_INT3_MI2S_TX 0x1035
1223/* ID of the Internal 4 MI2S Rx port */
1224#define AFE_PORT_ID_INT4_MI2S_RX 0x1036
1225/* ID of the Internal 4 MI2S Tx port */
1226#define AFE_PORT_ID_INT4_MI2S_TX 0x1037
1227/* ID of the Internal 5 MI2S Rx port */
1228#define AFE_PORT_ID_INT5_MI2S_RX 0x1038
1229/* ID of the Internal 5 MI2S Tx port */
1230#define AFE_PORT_ID_INT5_MI2S_TX 0x1039
1231/* ID of the Internal 6 MI2S Rx port */
1232#define AFE_PORT_ID_INT6_MI2S_RX 0x103A
1233/* ID of the Internal 6 MI2S Tx port */
1234#define AFE_PORT_ID_INT6_MI2S_TX 0x103B
Rohit Kumara5077932017-09-10 22:05:05 +05301235
1236#define AFE_PORT_ID_QUINARY_PCM_RX 0x103C
1237#define AFE_PORT_ID_QUINARY_PCM_TX 0x103D
1238
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +05301239#define AFE_PORT_ID_SPDIF_RX 0x5000
1240#define AFE_PORT_ID_RT_PROXY_PORT_001_RX 0x2000
1241#define AFE_PORT_ID_RT_PROXY_PORT_001_TX 0x2001
1242#define AFE_PORT_ID_INTERNAL_BT_SCO_RX 0x3000
1243#define AFE_PORT_ID_INTERNAL_BT_SCO_TX 0x3001
1244#define AFE_PORT_ID_INTERNAL_BT_A2DP_RX 0x3002
1245#define AFE_PORT_ID_INTERNAL_FM_RX 0x3004
1246#define AFE_PORT_ID_INTERNAL_FM_TX 0x3005
1247/* SLIMbus Rx port on channel 0. */
1248#define AFE_PORT_ID_SLIMBUS_MULTI_CHAN_0_RX 0x4000
1249/* SLIMbus Tx port on channel 0. */
1250#define AFE_PORT_ID_SLIMBUS_MULTI_CHAN_0_TX 0x4001
1251/* SLIMbus Rx port on channel 1. */
1252#define AFE_PORT_ID_SLIMBUS_MULTI_CHAN_1_RX 0x4002
1253/* SLIMbus Tx port on channel 1. */
1254#define AFE_PORT_ID_SLIMBUS_MULTI_CHAN_1_TX 0x4003
1255/* SLIMbus Rx port on channel 2. */
1256#define AFE_PORT_ID_SLIMBUS_MULTI_CHAN_2_RX 0x4004
1257/* SLIMbus Tx port on channel 2. */
1258#define AFE_PORT_ID_SLIMBUS_MULTI_CHAN_2_TX 0x4005
1259/* SLIMbus Rx port on channel 3. */
1260#define AFE_PORT_ID_SLIMBUS_MULTI_CHAN_3_RX 0x4006
1261/* SLIMbus Tx port on channel 3. */
1262#define AFE_PORT_ID_SLIMBUS_MULTI_CHAN_3_TX 0x4007
1263/* SLIMbus Rx port on channel 4. */
1264#define AFE_PORT_ID_SLIMBUS_MULTI_CHAN_4_RX 0x4008
1265/* SLIMbus Tx port on channel 4. */
1266#define AFE_PORT_ID_SLIMBUS_MULTI_CHAN_4_TX 0x4009
1267/* SLIMbus Rx port on channel 5. */
1268#define AFE_PORT_ID_SLIMBUS_MULTI_CHAN_5_RX 0x400a
1269/* SLIMbus Tx port on channel 5. */
1270#define AFE_PORT_ID_SLIMBUS_MULTI_CHAN_5_TX 0x400b
1271/* SLIMbus Rx port on channel 6. */
1272#define AFE_PORT_ID_SLIMBUS_MULTI_CHAN_6_RX 0x400c
1273/* SLIMbus Tx port on channel 6. */
1274#define AFE_PORT_ID_SLIMBUS_MULTI_CHAN_6_TX 0x400d
1275/* SLIMbus Rx port on channel 7. */
1276#define AFE_PORT_ID_SLIMBUS_MULTI_CHAN_7_RX 0x400e
1277/* SLIMbus Tx port on channel 7. */
1278#define AFE_PORT_ID_SLIMBUS_MULTI_CHAN_7_TX 0x400f
1279/* SLIMbus Rx port on channel 8. */
1280#define AFE_PORT_ID_SLIMBUS_MULTI_CHAN_8_RX 0x4010
1281/* SLIMbus Tx port on channel 8. */
1282#define AFE_PORT_ID_SLIMBUS_MULTI_CHAN_8_TX 0x4011
1283/* AFE Rx port for audio over Display port */
1284#define AFE_PORT_ID_HDMI_OVER_DP_RX 0x6020
1285/*USB AFE port */
1286#define AFE_PORT_ID_USB_RX 0x7000
1287#define AFE_PORT_ID_USB_TX 0x7001
1288
1289/* Generic pseudoport 1. */
1290#define AFE_PORT_ID_PSEUDOPORT_01 0x8001
1291/* Generic pseudoport 2. */
1292#define AFE_PORT_ID_PSEUDOPORT_02 0x8002
1293
1294/* @xreflabel{hdr:AfePortIdPrimaryAuxPcmTx}
1295 * Primary Aux PCM Tx port ID.
1296 */
1297#define AFE_PORT_ID_PRIMARY_PCM_TX 0x100B
1298/* Pseudoport that corresponds to the voice Rx path.
1299 * For recording, the voice Rx path samples are written to this
1300 * port and consumed by the audio path.
1301 */
1302
1303#define AFE_PORT_ID_VOICE_RECORD_RX 0x8003
1304
1305/* Pseudoport that corresponds to the voice Tx path.
1306 * For recording, the voice Tx path samples are written to this
1307 * port and consumed by the audio path.
1308 */
1309
1310#define AFE_PORT_ID_VOICE_RECORD_TX 0x8004
1311/* Pseudoport that corresponds to in-call voice delivery samples.
1312 * During in-call audio delivery, the audio path delivers samples
1313 * to this port from where the voice path delivers them on the
1314 * Rx path.
1315 */
1316#define AFE_PORT_ID_VOICE2_PLAYBACK_TX 0x8002
1317#define AFE_PORT_ID_VOICE_PLAYBACK_TX 0x8005
1318
1319#define AFE_PORT_ID_PRIMARY_TDM_RX \
1320 (AFE_PORT_ID_TDM_PORT_RANGE_START + 0x00)
1321#define AFE_PORT_ID_PRIMARY_TDM_RX_1 \
1322 (AFE_PORT_ID_PRIMARY_TDM_RX + 0x02)
1323#define AFE_PORT_ID_PRIMARY_TDM_RX_2 \
1324 (AFE_PORT_ID_PRIMARY_TDM_RX + 0x04)
1325#define AFE_PORT_ID_PRIMARY_TDM_RX_3 \
1326 (AFE_PORT_ID_PRIMARY_TDM_RX + 0x06)
1327#define AFE_PORT_ID_PRIMARY_TDM_RX_4 \
1328 (AFE_PORT_ID_PRIMARY_TDM_RX + 0x08)
1329#define AFE_PORT_ID_PRIMARY_TDM_RX_5 \
1330 (AFE_PORT_ID_PRIMARY_TDM_RX + 0x0A)
1331#define AFE_PORT_ID_PRIMARY_TDM_RX_6 \
1332 (AFE_PORT_ID_PRIMARY_TDM_RX + 0x0C)
1333#define AFE_PORT_ID_PRIMARY_TDM_RX_7 \
1334 (AFE_PORT_ID_PRIMARY_TDM_RX + 0x0E)
1335
1336#define AFE_PORT_ID_PRIMARY_TDM_TX \
1337 (AFE_PORT_ID_TDM_PORT_RANGE_START + 0x01)
1338#define AFE_PORT_ID_PRIMARY_TDM_TX_1 \
1339 (AFE_PORT_ID_PRIMARY_TDM_TX + 0x02)
1340#define AFE_PORT_ID_PRIMARY_TDM_TX_2 \
1341 (AFE_PORT_ID_PRIMARY_TDM_TX + 0x04)
1342#define AFE_PORT_ID_PRIMARY_TDM_TX_3 \
1343 (AFE_PORT_ID_PRIMARY_TDM_TX + 0x06)
1344#define AFE_PORT_ID_PRIMARY_TDM_TX_4 \
1345 (AFE_PORT_ID_PRIMARY_TDM_TX + 0x08)
1346#define AFE_PORT_ID_PRIMARY_TDM_TX_5 \
1347 (AFE_PORT_ID_PRIMARY_TDM_TX + 0x0A)
1348#define AFE_PORT_ID_PRIMARY_TDM_TX_6 \
1349 (AFE_PORT_ID_PRIMARY_TDM_TX + 0x0C)
1350#define AFE_PORT_ID_PRIMARY_TDM_TX_7 \
1351 (AFE_PORT_ID_PRIMARY_TDM_TX + 0x0E)
1352
1353#define AFE_PORT_ID_SECONDARY_TDM_RX \
1354 (AFE_PORT_ID_TDM_PORT_RANGE_START + 0x10)
1355#define AFE_PORT_ID_SECONDARY_TDM_RX_1 \
1356 (AFE_PORT_ID_SECONDARY_TDM_RX + 0x02)
1357#define AFE_PORT_ID_SECONDARY_TDM_RX_2 \
1358 (AFE_PORT_ID_SECONDARY_TDM_RX + 0x04)
1359#define AFE_PORT_ID_SECONDARY_TDM_RX_3 \
1360 (AFE_PORT_ID_SECONDARY_TDM_RX + 0x06)
1361#define AFE_PORT_ID_SECONDARY_TDM_RX_4 \
1362 (AFE_PORT_ID_SECONDARY_TDM_RX + 0x08)
1363#define AFE_PORT_ID_SECONDARY_TDM_RX_5 \
1364 (AFE_PORT_ID_SECONDARY_TDM_RX + 0x0A)
1365#define AFE_PORT_ID_SECONDARY_TDM_RX_6 \
1366 (AFE_PORT_ID_SECONDARY_TDM_RX + 0x0C)
1367#define AFE_PORT_ID_SECONDARY_TDM_RX_7 \
1368 (AFE_PORT_ID_SECONDARY_TDM_RX + 0x0E)
1369
1370#define AFE_PORT_ID_SECONDARY_TDM_TX \
1371 (AFE_PORT_ID_TDM_PORT_RANGE_START + 0x11)
1372#define AFE_PORT_ID_SECONDARY_TDM_TX_1 \
1373 (AFE_PORT_ID_SECONDARY_TDM_TX + 0x02)
1374#define AFE_PORT_ID_SECONDARY_TDM_TX_2 \
1375 (AFE_PORT_ID_SECONDARY_TDM_TX + 0x04)
1376#define AFE_PORT_ID_SECONDARY_TDM_TX_3 \
1377 (AFE_PORT_ID_SECONDARY_TDM_TX + 0x06)
1378#define AFE_PORT_ID_SECONDARY_TDM_TX_4 \
1379 (AFE_PORT_ID_SECONDARY_TDM_TX + 0x08)
1380#define AFE_PORT_ID_SECONDARY_TDM_TX_5 \
1381 (AFE_PORT_ID_SECONDARY_TDM_TX + 0x0A)
1382#define AFE_PORT_ID_SECONDARY_TDM_TX_6 \
1383 (AFE_PORT_ID_SECONDARY_TDM_TX + 0x0C)
1384#define AFE_PORT_ID_SECONDARY_TDM_TX_7 \
1385 (AFE_PORT_ID_SECONDARY_TDM_TX + 0x0E)
1386
1387#define AFE_PORT_ID_TERTIARY_TDM_RX \
1388 (AFE_PORT_ID_TDM_PORT_RANGE_START + 0x20)
1389#define AFE_PORT_ID_TERTIARY_TDM_RX_1 \
1390 (AFE_PORT_ID_TERTIARY_TDM_RX + 0x02)
1391#define AFE_PORT_ID_TERTIARY_TDM_RX_2 \
1392 (AFE_PORT_ID_TERTIARY_TDM_RX + 0x04)
1393#define AFE_PORT_ID_TERTIARY_TDM_RX_3 \
1394 (AFE_PORT_ID_TERTIARY_TDM_RX + 0x06)
1395#define AFE_PORT_ID_TERTIARY_TDM_RX_4 \
1396 (AFE_PORT_ID_TERTIARY_TDM_RX + 0x08)
1397#define AFE_PORT_ID_TERTIARY_TDM_RX_5 \
1398 (AFE_PORT_ID_TERTIARY_TDM_RX + 0x0A)
1399#define AFE_PORT_ID_TERTIARY_TDM_RX_6 \
1400 (AFE_PORT_ID_TERTIARY_TDM_RX + 0x0C)
1401#define AFE_PORT_ID_TERTIARY_TDM_RX_7 \
1402 (AFE_PORT_ID_TERTIARY_TDM_RX + 0x0E)
1403
1404#define AFE_PORT_ID_TERTIARY_TDM_TX \
1405 (AFE_PORT_ID_TDM_PORT_RANGE_START + 0x21)
1406#define AFE_PORT_ID_TERTIARY_TDM_TX_1 \
1407 (AFE_PORT_ID_TERTIARY_TDM_TX + 0x02)
1408#define AFE_PORT_ID_TERTIARY_TDM_TX_2 \
1409 (AFE_PORT_ID_TERTIARY_TDM_TX + 0x04)
1410#define AFE_PORT_ID_TERTIARY_TDM_TX_3 \
1411 (AFE_PORT_ID_TERTIARY_TDM_TX + 0x06)
1412#define AFE_PORT_ID_TERTIARY_TDM_TX_4 \
1413 (AFE_PORT_ID_TERTIARY_TDM_TX + 0x08)
1414#define AFE_PORT_ID_TERTIARY_TDM_TX_5 \
1415 (AFE_PORT_ID_TERTIARY_TDM_TX + 0x0A)
1416#define AFE_PORT_ID_TERTIARY_TDM_TX_6 \
1417 (AFE_PORT_ID_TERTIARY_TDM_TX + 0x0C)
1418#define AFE_PORT_ID_TERTIARY_TDM_TX_7 \
1419 (AFE_PORT_ID_TERTIARY_TDM_TX + 0x0E)
1420
1421#define AFE_PORT_ID_QUATERNARY_TDM_RX \
1422 (AFE_PORT_ID_TDM_PORT_RANGE_START + 0x30)
1423#define AFE_PORT_ID_QUATERNARY_TDM_RX_1 \
1424 (AFE_PORT_ID_QUATERNARY_TDM_RX + 0x02)
1425#define AFE_PORT_ID_QUATERNARY_TDM_RX_2 \
1426 (AFE_PORT_ID_QUATERNARY_TDM_RX + 0x04)
1427#define AFE_PORT_ID_QUATERNARY_TDM_RX_3 \
1428 (AFE_PORT_ID_QUATERNARY_TDM_RX + 0x06)
1429#define AFE_PORT_ID_QUATERNARY_TDM_RX_4 \
1430 (AFE_PORT_ID_QUATERNARY_TDM_RX + 0x08)
1431#define AFE_PORT_ID_QUATERNARY_TDM_RX_5 \
1432 (AFE_PORT_ID_QUATERNARY_TDM_RX + 0x0A)
1433#define AFE_PORT_ID_QUATERNARY_TDM_RX_6 \
1434 (AFE_PORT_ID_QUATERNARY_TDM_RX + 0x0C)
1435#define AFE_PORT_ID_QUATERNARY_TDM_RX_7 \
1436 (AFE_PORT_ID_QUATERNARY_TDM_RX + 0x0E)
1437
1438#define AFE_PORT_ID_QUATERNARY_TDM_TX \
1439 (AFE_PORT_ID_TDM_PORT_RANGE_START + 0x31)
1440#define AFE_PORT_ID_QUATERNARY_TDM_TX_1 \
1441 (AFE_PORT_ID_QUATERNARY_TDM_TX + 0x02)
1442#define AFE_PORT_ID_QUATERNARY_TDM_TX_2 \
1443 (AFE_PORT_ID_QUATERNARY_TDM_TX + 0x04)
1444#define AFE_PORT_ID_QUATERNARY_TDM_TX_3 \
1445 (AFE_PORT_ID_QUATERNARY_TDM_TX + 0x06)
1446#define AFE_PORT_ID_QUATERNARY_TDM_TX_4 \
1447 (AFE_PORT_ID_QUATERNARY_TDM_TX + 0x08)
1448#define AFE_PORT_ID_QUATERNARY_TDM_TX_5 \
1449 (AFE_PORT_ID_QUATERNARY_TDM_TX + 0x0A)
1450#define AFE_PORT_ID_QUATERNARY_TDM_TX_6 \
1451 (AFE_PORT_ID_QUATERNARY_TDM_TX + 0x0C)
1452#define AFE_PORT_ID_QUATERNARY_TDM_TX_7 \
1453 (AFE_PORT_ID_QUATERNARY_TDM_TX + 0x0E)
1454
Rohit Kumara5077932017-09-10 22:05:05 +05301455#define AFE_PORT_ID_QUINARY_TDM_RX \
1456 (AFE_PORT_ID_TDM_PORT_RANGE_START + 0x40)
1457#define AFE_PORT_ID_QUINARY_TDM_RX_1 \
1458 (AFE_PORT_ID_QUINARY_TDM_RX + 0x02)
1459#define AFE_PORT_ID_QUINARY_TDM_RX_2 \
1460 (AFE_PORT_ID_QUINARY_TDM_RX + 0x04)
1461#define AFE_PORT_ID_QUINARY_TDM_RX_3 \
1462 (AFE_PORT_ID_QUINARY_TDM_RX + 0x06)
1463#define AFE_PORT_ID_QUINARY_TDM_RX_4 \
1464 (AFE_PORT_ID_QUINARY_TDM_RX + 0x08)
1465#define AFE_PORT_ID_QUINARY_TDM_RX_5 \
1466 (AFE_PORT_ID_QUINARY_TDM_RX + 0x0A)
1467#define AFE_PORT_ID_QUINARY_TDM_RX_6 \
1468 (AFE_PORT_ID_QUINARY_TDM_RX + 0x0C)
1469#define AFE_PORT_ID_QUINARY_TDM_RX_7 \
1470 (AFE_PORT_ID_QUINARY_TDM_RX + 0x0E)
1471
1472#define AFE_PORT_ID_QUINARY_TDM_TX \
1473 (AFE_PORT_ID_TDM_PORT_RANGE_START + 0x41)
1474#define AFE_PORT_ID_QUINARY_TDM_TX_1 \
1475 (AFE_PORT_ID_QUINARY_TDM_TX + 0x02)
1476#define AFE_PORT_ID_QUINARY_TDM_TX_2 \
1477 (AFE_PORT_ID_QUINARY_TDM_TX + 0x04)
1478#define AFE_PORT_ID_QUINARY_TDM_TX_3 \
1479 (AFE_PORT_ID_QUINARY_TDM_TX + 0x06)
1480#define AFE_PORT_ID_QUINARY_TDM_TX_4 \
1481 (AFE_PORT_ID_QUINARY_TDM_TX + 0x08)
1482#define AFE_PORT_ID_QUINARY_TDM_TX_5 \
1483 (AFE_PORT_ID_QUINARY_TDM_TX + 0x0A)
1484#define AFE_PORT_ID_QUINARY_TDM_TX_6 \
1485 (AFE_PORT_ID_QUINARY_TDM_TX + 0x0C)
1486#define AFE_PORT_ID_QUINARY_TDM_TX_7 \
1487 (AFE_PORT_ID_QUINARY_TDM_TX + 0x0E)
1488
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +05301489#define AFE_PORT_ID_INVALID 0xFFFF
1490
1491#define AAC_ENC_MODE_AAC_LC 0x02
1492#define AAC_ENC_MODE_AAC_P 0x05
1493#define AAC_ENC_MODE_EAAC_P 0x1D
1494
1495#define AFE_PSEUDOPORT_CMD_START 0x000100cf
1496struct afe_pseudoport_start_command {
1497 struct apr_hdr hdr;
1498 u16 port_id; /* Pseudo Port 1 = 0x8000 */
1499 /* Pseudo Port 2 = 0x8001 */
1500 /* Pseudo Port 3 = 0x8002 */
1501 u16 timing; /* FTRT = 0 , AVTimer = 1, */
1502} __packed;
1503
1504#define AFE_PSEUDOPORT_CMD_STOP 0x000100d0
1505struct afe_pseudoport_stop_command {
1506 struct apr_hdr hdr;
1507 u16 port_id; /* Pseudo Port 1 = 0x8000 */
1508 /* Pseudo Port 2 = 0x8001 */
1509 /* Pseudo Port 3 = 0x8002 */
1510 u16 reserved;
1511} __packed;
1512
1513
1514#define AFE_MODULE_SIDETONE_IIR_FILTER 0x00010202
1515#define AFE_PARAM_ID_ENABLE 0x00010203
1516
1517/* Payload of the #AFE_PARAM_ID_ENABLE
1518 * parameter, which enables or
1519 * disables any module.
1520 * The fixed size of this structure is four bytes.
1521 */
1522
1523struct afe_mod_enable_param {
1524 u16 enable;
1525 /* Enables (1) or disables (0) the module. */
1526
1527 u16 reserved;
1528 /* This field must be set to zero. */
1529} __packed;
1530
1531/* ID of the configuration parameter used by the
1532 * #AFE_MODULE_SIDETONE_IIR_FILTER module.
1533 */
1534#define AFE_PARAM_ID_SIDETONE_IIR_FILTER_CONFIG 0x00010204
1535#define MAX_SIDETONE_IIR_DATA_SIZE 224
1536#define MAX_NO_IIR_FILTER_STAGE 10
1537
1538struct afe_sidetone_iir_filter_config_params {
1539 u16 num_biquad_stages;
1540/* Number of stages.
1541 * Supported values: Minimum of 5 and maximum of 10
1542 */
1543
1544 u16 pregain;
1545/* Pregain for the compensating filter response.
1546 * Supported values: Any number in Q13 format
1547 */
1548 uint8_t iir_config[MAX_SIDETONE_IIR_DATA_SIZE];
1549} __packed;
1550
1551#define AFE_MODULE_LOOPBACK 0x00010205
1552#define AFE_PARAM_ID_LOOPBACK_GAIN_PER_PATH 0x00010206
1553
1554/* Payload of the #AFE_PARAM_ID_LOOPBACK_GAIN_PER_PATH parameter,
1555 * which gets/sets loopback gain of a port to an Rx port.
1556 * The Tx port ID of the loopback is part of the set_param command.
1557 */
1558
1559/* Payload of the #AFE_PORT_CMD_SET_PARAM_V2 command's
1560 * configuration/calibration settings for the AFE port.
1561 */
1562struct afe_port_cmd_set_param_v2 {
1563 u16 port_id;
1564/* Port interface and direction (Rx or Tx) to start. */
1565
1566 u16 payload_size;
1567/* Actual size of the payload in bytes.
1568 * This is used for parsing the parameter payload.
1569 * Supported values: > 0
1570 */
1571
1572u32 payload_address_lsw;
1573/* LSW of 64 bit Payload address.
1574 * Address should be 32-byte,
1575 * 4kbyte aligned and must be contiguous memory.
1576 */
1577
1578u32 payload_address_msw;
1579/* MSW of 64 bit Payload address.
1580 * In case of 32-bit shared memory address,
1581 * this field must be set to zero.
1582 * In case of 36-bit shared memory address,
1583 * bit-4 to bit-31 must be set to zero.
1584 * Address should be 32-byte, 4kbyte aligned
1585 * and must be contiguous memory.
1586 */
1587
1588u32 mem_map_handle;
1589/* Memory map handle returned by
1590 * AFE_SERVICE_CMD_SHARED_MEM_MAP_REGIONS commands.
1591 * Supported Values:
1592 * - NULL -- Message. The parameter data is in-band.
1593 * - Non-NULL -- The parameter data is Out-band.Pointer to
1594 * the physical address
1595 * in shared memory of the payload data.
1596 * An optional field is available if parameter
1597 * data is in-band:
1598 * afe_param_data_v2 param_data[...].
1599 * For detailed payload content, see the
1600 * afe_port_param_data_v2 structure.
1601 */
1602} __packed;
1603
1604#define AFE_PORT_CMD_SET_PARAM_V2 0x000100EF
1605
1606struct afe_port_param_data_v2 {
1607 u32 module_id;
1608/* ID of the module to be configured.
1609 * Supported values: Valid module ID
1610 */
1611
1612u32 param_id;
1613/* ID of the parameter corresponding to the supported parameters
1614 * for the module ID.
1615 * Supported values: Valid parameter ID
1616 */
1617
1618u16 param_size;
1619/* Actual size of the data for the
1620 * module_id/param_id pair. The size is a
1621 * multiple of four bytes.
1622 * Supported values: > 0
1623 */
1624
1625u16 reserved;
1626/* This field must be set to zero.
1627 */
1628} __packed;
1629
1630struct afe_loopback_gain_per_path_param {
1631 struct apr_hdr hdr;
1632 struct afe_port_cmd_set_param_v2 param;
1633 struct afe_port_param_data_v2 pdata;
1634 u16 rx_port_id;
1635/* Rx port of the loopback. */
1636
1637u16 gain;
1638/* Loopback gain per path of the port.
1639 * Supported values: Any number in Q13 format
1640 */
1641} __packed;
1642
1643/* Parameter ID used to configure and enable/disable the
1644 * loopback path. The difference with respect to the existing
1645 * API, AFE_PORT_CMD_LOOPBACK, is that it allows Rx port to be
1646 * configured as source port in loopback path. Port-id in
1647 * AFE_PORT_CMD_SET_PARAM cmd is the source port which can be
1648 * Tx or Rx port. In addition, we can configure the type of
1649 * routing mode to handle different use cases.
1650 */
1651#define AFE_PARAM_ID_LOOPBACK_CONFIG 0x0001020B
1652#define AFE_API_VERSION_LOOPBACK_CONFIG 0x1
1653
1654enum afe_loopback_routing_mode {
1655 LB_MODE_DEFAULT = 1,
1656 /* Regular loopback from source to destination port */
1657 LB_MODE_SIDETONE,
1658 /* Sidetone feed from Tx source to Rx destination port */
1659 LB_MODE_EC_REF_VOICE_AUDIO,
1660 /* Echo canceller reference, voice + audio + DTMF */
1661 LB_MODE_EC_REF_VOICE
1662 /* Echo canceller reference, voice alone */
1663} __packed;
1664
1665/* Payload of the #AFE_PARAM_ID_LOOPBACK_CONFIG ,
1666 * which enables/disables one AFE loopback.
1667 */
1668struct afe_loopback_cfg_v1 {
1669 struct apr_hdr hdr;
1670 struct afe_port_cmd_set_param_v2 param;
1671 struct afe_port_param_data_v2 pdata;
1672 u32 loopback_cfg_minor_version;
1673/* Minor version used for tracking the version of the RMC module
1674 * configuration interface.
1675 * Supported values: #AFE_API_VERSION_LOOPBACK_CONFIG
1676 */
1677 u16 dst_port_id;
1678 /* Destination Port Id. */
1679 u16 routing_mode;
1680/* Specifies data path type from src to dest port.
1681 * Supported values:
1682 * #LB_MODE_DEFAULT
1683 * #LB_MODE_SIDETONE
1684 * #LB_MODE_EC_REF_VOICE_AUDIO
1685 * #LB_MODE_EC_REF_VOICE_A
1686 * #LB_MODE_EC_REF_VOICE
1687 */
1688
1689 u16 enable;
1690/* Specifies whether to enable (1) or
1691 * disable (0) an AFE loopback.
1692 */
1693 u16 reserved;
1694/* Reserved for 32-bit alignment. This field must be set to 0.
1695 */
1696
1697} __packed;
1698
1699struct afe_loopback_sidetone_gain {
1700 u16 rx_port_id;
1701 u16 gain;
1702} __packed;
1703
1704struct loopback_cfg_data {
1705 u32 loopback_cfg_minor_version;
1706/* Minor version used for tracking the version of the RMC module
1707 * configuration interface.
1708 * Supported values: #AFE_API_VERSION_LOOPBACK_CONFIG
1709 */
1710 u16 dst_port_id;
1711 /* Destination Port Id. */
1712 u16 routing_mode;
1713/* Specifies data path type from src to dest port.
1714 * Supported values:
1715 * #LB_MODE_DEFAULT
1716 * #LB_MODE_SIDETONE
1717 * #LB_MODE_EC_REF_VOICE_AUDIO
1718 * #LB_MODE_EC_REF_VOICE_A
1719 * #LB_MODE_EC_REF_VOICE
1720 */
1721
1722 u16 enable;
1723/* Specifies whether to enable (1) or
1724 * disable (0) an AFE loopback.
1725 */
1726 u16 reserved;
1727/* Reserved for 32-bit alignment. This field must be set to 0.
1728 */
1729} __packed;
1730
1731struct afe_st_loopback_cfg_v1 {
1732 struct apr_hdr hdr;
1733 struct afe_port_cmd_set_param_v2 param;
1734 struct afe_port_param_data_v2 gain_pdata;
1735 struct afe_loopback_sidetone_gain gain_data;
1736 struct afe_port_param_data_v2 cfg_pdata;
1737 struct loopback_cfg_data cfg_data;
1738} __packed;
1739
1740struct afe_loopback_iir_cfg_v2 {
1741 struct apr_hdr hdr;
1742 struct afe_port_cmd_set_param_v2 param;
1743 struct afe_port_param_data_v2 st_iir_enable_pdata;
1744 struct afe_mod_enable_param st_iir_mode_enable_data;
1745 struct afe_port_param_data_v2 st_iir_filter_config_pdata;
1746 struct afe_sidetone_iir_filter_config_params st_iir_filter_config_data;
1747} __packed;
1748#define AFE_MODULE_SPEAKER_PROTECTION 0x00010209
1749#define AFE_PARAM_ID_SPKR_PROT_CONFIG 0x0001020a
1750#define AFE_API_VERSION_SPKR_PROT_CONFIG 0x1
1751#define AFE_SPKR_PROT_EXCURSIONF_LEN 512
1752struct afe_spkr_prot_cfg_param_v1 {
1753 u32 spkr_prot_minor_version;
1754/*
1755 * Minor version used for tracking the version of the
1756 * speaker protection module configuration interface.
1757 * Supported values: #AFE_API_VERSION_SPKR_PROT_CONFIG
1758 */
1759
1760int16_t win_size;
1761/* Analysis and synthesis window size (nWinSize).
1762 * Supported values: 1024, 512, 256 samples
1763 */
1764
1765int16_t margin;
1766/* Allowable margin for excursion prediction,
1767 * in L16Q15 format. This is a
1768 * control parameter to allow
1769 * for overestimation of peak excursion.
1770 */
1771
1772int16_t spkr_exc_limit;
1773/* Speaker excursion limit, in L16Q15 format.*/
1774
1775int16_t spkr_resonance_freq;
1776/* Resonance frequency of the speaker; used
1777 * to define a frequency range
1778 * for signal modification.
1779 *
1780 * Supported values: 0 to 2000 Hz
1781 */
1782
1783int16_t limhresh;
1784/* Threshold of the hard limiter; used to
1785 * prevent overshooting beyond a
1786 * signal level that was set by the limiter
1787 * prior to speaker protection.
1788 * Supported values: 0 to 32767
1789 */
1790
1791int16_t hpf_cut_off_freq;
1792/* High pass filter cutoff frequency.
1793 * Supported values: 100, 200, 300 Hz
1794 */
1795
1796int16_t hpf_enable;
1797/* Specifies whether the high pass filter
1798 * is enabled (0) or disabled (1).
1799 */
1800
1801int16_t reserved;
1802/* This field must be set to zero. */
1803
1804int32_t amp_gain;
1805/* Amplifier gain in L32Q15 format.
1806 * This is the RMS voltage at the
1807 * loudspeaker when a 0dBFS tone
1808 * is played in the digital domain.
1809 */
1810
1811int16_t excursionf[AFE_SPKR_PROT_EXCURSIONF_LEN];
1812/* Array of the excursion transfer function.
1813 * The peak excursion of the
1814 * loudspeaker diaphragm is
1815 * measured in millimeters for 1 Vrms Sine
1816 * tone at all FFT bin frequencies.
1817 * Supported values: Q15 format
1818 */
1819} __packed;
1820
1821
1822#define AFE_SERVICE_CMD_REGISTER_RT_PORT_DRIVER 0x000100E0
1823
1824/* Payload of the #AFE_SERVICE_CMD_REGISTER_RT_PORT_DRIVER
1825 * command, which registers a real-time port driver
1826 * with the AFE service.
1827 */
1828struct afe_service_cmd_register_rt_port_driver {
1829 struct apr_hdr hdr;
1830 u16 port_id;
1831/* Port ID with which the real-time driver exchanges data
1832 * (registers for events).
1833 * Supported values: #AFE_PORT_ID_RT_PROXY_PORT_RANGE_START to
1834 * #AFE_PORT_ID_RT_PROXY_PORT_RANGE_END
1835 */
1836
1837 u16 reserved;
1838 /* This field must be set to zero. */
1839} __packed;
1840
1841#define AFE_SERVICE_CMD_UNREGISTER_RT_PORT_DRIVER 0x000100E1
1842
1843/* Payload of the #AFE_SERVICE_CMD_UNREGISTER_RT_PORT_DRIVER
1844 * command, which unregisters a real-time port driver from
1845 * the AFE service.
1846 */
1847struct afe_service_cmd_unregister_rt_port_driver {
1848 struct apr_hdr hdr;
1849 u16 port_id;
1850/* Port ID from which the real-time
1851 * driver unregisters for events.
1852 * Supported values: #AFE_PORT_ID_RT_PROXY_PORT_RANGE_START to
1853 * #AFE_PORT_ID_RT_PROXY_PORT_RANGE_END
1854 */
1855
1856 u16 reserved;
1857 /* This field must be set to zero. */
1858} __packed;
1859
1860#define AFE_EVENT_RT_PROXY_PORT_STATUS 0x00010105
1861#define AFE_EVENTYPE_RT_PROXY_PORT_START 0
1862#define AFE_EVENTYPE_RT_PROXY_PORT_STOP 1
1863#define AFE_EVENTYPE_RT_PROXY_PORT_LOW_WATER_MARK 2
1864#define AFE_EVENTYPE_RT_PROXY_PORT_HIGH_WATER_MARK 3
1865#define AFE_EVENTYPE_RT_PROXY_PORT_INVALID 0xFFFF
1866
1867/* Payload of the #AFE_EVENT_RT_PROXY_PORT_STATUS
1868 * message, which sends an event from the AFE service
1869 * to a registered client.
1870 */
1871struct afe_event_rt_proxy_port_status {
1872 u16 port_id;
1873/* Port ID to which the event is sent.
1874 * Supported values: #AFE_PORT_ID_RT_PROXY_PORT_RANGE_START to
1875 * #AFE_PORT_ID_RT_PROXY_PORT_RANGE_END
1876 */
1877
1878 u16 eventype;
1879/* Type of event.
1880 * Supported values:
1881 * - #AFE_EVENTYPE_RT_PROXY_PORT_START
1882 * - #AFE_EVENTYPE_RT_PROXY_PORT_STOP
1883 * - #AFE_EVENTYPE_RT_PROXY_PORT_LOW_WATER_MARK
1884 * - #AFE_EVENTYPE_RT_PROXY_PORT_HIGH_WATER_MARK
1885 */
1886} __packed;
1887
1888#define AFE_PORT_DATA_CMD_RT_PROXY_PORT_WRITE_V2 0x000100ED
1889
1890struct afe_port_data_cmd_rt_proxy_port_write_v2 {
1891 struct apr_hdr hdr;
1892 u16 port_id;
1893/* Tx (mic) proxy port ID with which the real-time
1894 * driver exchanges data.
1895 * Supported values: #AFE_PORT_ID_RT_PROXY_PORT_RANGE_START to
1896 * #AFE_PORT_ID_RT_PROXY_PORT_RANGE_END
1897 */
1898
1899 u16 reserved;
1900 /* This field must be set to zero. */
1901
1902 u32 buffer_address_lsw;
1903/* LSW Address of the buffer containing the
1904 * data from the real-time source
1905 * device on a client.
1906 */
1907
1908 u32 buffer_address_msw;
1909/* MSW Address of the buffer containing the
1910 * data from the real-time source
1911 * device on a client.
1912 */
1913
1914 u32 mem_map_handle;
1915/* A memory map handle encapsulating shared memory
1916 * attributes is returned if
1917 * AFE_SERVICE_CMD_SHARED_MEM_MAP_REGIONS
1918 * command is successful.
1919 * Supported Values:
1920 * - Any 32 bit value
1921 */
1922
1923 u32 available_bytes;
1924/* Number of valid bytes available
1925 * in the buffer (including all
1926 * channels: number of bytes per
1927 * channel = availableBytesumChannels).
1928 * Supported values: > 0
1929 *
1930 * This field must be equal to the frame
1931 * size specified in the #AFE_PORT_AUDIO_IF_CONFIG
1932 * command that was sent to configure this
1933 * port.
1934 */
1935} __packed;
1936
1937#define AFE_PORT_DATA_CMD_RT_PROXY_PORT_READ_V2 0x000100EE
1938
1939/* Payload of the
1940 * #AFE_PORT_DATA_CMD_RT_PROXY_PORT_READ_V2 command, which
1941 * delivers an empty buffer to the AFE service. On
1942 * acknowledgment, data is filled in the buffer.
1943 */
1944struct afe_port_data_cmd_rt_proxy_port_read_v2 {
1945 struct apr_hdr hdr;
1946 u16 port_id;
1947/* Rx proxy port ID with which the real-time
1948 * driver exchanges data.
1949 * Supported values: #AFE_PORT_ID_RT_PROXY_PORT_RANGE_START to
1950 * #AFE_PORT_ID_RT_PROXY_PORT_RANGE_END
1951 * (This must be an Rx (speaker) port.)
1952 */
1953
1954 u16 reserved;
1955 /* This field must be set to zero. */
1956
1957 u32 buffer_address_lsw;
1958/* LSW Address of the buffer containing the data sent from the AFE
1959 * service to a real-time sink device on the client.
1960 */
1961
1962
1963 u32 buffer_address_msw;
1964/* MSW Address of the buffer containing the data sent from the AFE
1965 * service to a real-time sink device on the client.
1966 */
1967
1968 u32 mem_map_handle;
1969/* A memory map handle encapsulating shared memory attributes is
1970 * returned if AFE_SERVICE_CMD_SHARED_MEM_MAP_REGIONS command is
1971 * successful.
1972 * Supported Values:
1973 * - Any 32 bit value
1974 */
1975
1976 u32 available_bytes;
1977/* Number of valid bytes available in the buffer (including all
1978 * channels).
1979 * Supported values: > 0
1980 * This field must be equal to the frame size specified in the
1981 * #AFE_PORT_AUDIO_IF_CONFIG command that was sent to configure
1982 * this port.
1983 */
1984} __packed;
1985
1986/* This module ID is related to device configuring like I2S,PCM,
1987 * HDMI, SLIMBus etc. This module supports following parameter ids.
1988 * - #AFE_PARAM_ID_I2S_CONFIG
1989 * - #AFE_PARAM_ID_PCM_CONFIG
1990 * - #AFE_PARAM_ID_DIGI_MIC_CONFIG
1991 * - #AFE_PARAM_ID_HDMI_CONFIG
1992 * - #AFE_PARAM_ID_INTERNAL_BT_FM_CONFIG
1993 * - #AFE_PARAM_ID_SLIMBUS_CONFIG
1994 * - #AFE_PARAM_ID_RT_PROXY_CONFIG
1995 */
1996
1997#define AFE_MODULE_AUDIO_DEV_INTERFACE 0x0001020C
1998#define AFE_PORT_SAMPLE_RATE_8K 8000
1999#define AFE_PORT_SAMPLE_RATE_16K 16000
2000#define AFE_PORT_SAMPLE_RATE_48K 48000
2001#define AFE_PORT_SAMPLE_RATE_96K 96000
2002#define AFE_PORT_SAMPLE_RATE_176P4K 176400
2003#define AFE_PORT_SAMPLE_RATE_192K 192000
2004#define AFE_PORT_SAMPLE_RATE_352P8K 352800
2005#define AFE_LINEAR_PCM_DATA 0x0
2006#define AFE_NON_LINEAR_DATA 0x1
2007#define AFE_LINEAR_PCM_DATA_PACKED_60958 0x2
2008#define AFE_NON_LINEAR_DATA_PACKED_60958 0x3
2009#define AFE_GENERIC_COMPRESSED 0x8
2010
2011/* This param id is used to configure I2S interface */
2012#define AFE_PARAM_ID_I2S_CONFIG 0x0001020D
2013#define AFE_API_VERSION_I2S_CONFIG 0x1
2014/* Enumeration for setting the I2S configuration
2015 * channel_mode parameter to
2016 * serial data wire number 1-3 (SD3).
2017 */
2018#define AFE_PORT_I2S_SD0 0x1
2019#define AFE_PORT_I2S_SD1 0x2
2020#define AFE_PORT_I2S_SD2 0x3
2021#define AFE_PORT_I2S_SD3 0x4
2022#define AFE_PORT_I2S_QUAD01 0x5
2023#define AFE_PORT_I2S_QUAD23 0x6
2024#define AFE_PORT_I2S_6CHS 0x7
2025#define AFE_PORT_I2S_8CHS 0x8
2026#define AFE_PORT_I2S_MONO 0x0
2027#define AFE_PORT_I2S_STEREO 0x1
2028#define AFE_PORT_CONFIG_I2S_WS_SRC_EXTERNAL 0x0
2029#define AFE_PORT_CONFIG_I2S_WS_SRC_INTERNAL 0x1
2030
2031/* Payload of the #AFE_PARAM_ID_I2S_CONFIG
2032 * command's (I2S configuration
2033 * parameter).
2034 */
2035struct afe_param_id_i2s_cfg {
2036 u32 i2s_cfg_minor_version;
2037/* Minor version used for tracking the version of the I2S
2038 * configuration interface.
2039 * Supported values: #AFE_API_VERSION_I2S_CONFIG
2040 */
2041
2042 u16 bit_width;
2043/* Bit width of the sample.
2044 * Supported values: 16, 24
2045 */
2046
2047 u16 channel_mode;
2048/* I2S lines and multichannel operation.
2049 * Supported values:
2050 * - #AFE_PORT_I2S_SD0
2051 * - #AFE_PORT_I2S_SD1
2052 * - #AFE_PORT_I2S_SD2
2053 * - #AFE_PORT_I2S_SD3
2054 * - #AFE_PORT_I2S_QUAD01
2055 * - #AFE_PORT_I2S_QUAD23
2056 * - #AFE_PORT_I2S_6CHS
2057 * - #AFE_PORT_I2S_8CHS
2058 */
2059
2060 u16 mono_stereo;
2061/* Specifies mono or stereo. This applies only when
2062 * a single I2S line is used.
2063 * Supported values:
2064 * - #AFE_PORT_I2S_MONO
2065 * - #AFE_PORT_I2S_STEREO
2066 */
2067
2068 u16 ws_src;
2069/* Word select source: internal or external.
2070 * Supported values:
2071 * - #AFE_PORT_CONFIG_I2S_WS_SRC_EXTERNAL
2072 * - #AFE_PORT_CONFIG_I2S_WS_SRC_INTERNAL
2073 */
2074
2075 u32 sample_rate;
2076/* Sampling rate of the port.
2077 * Supported values:
2078 * - #AFE_PORT_SAMPLE_RATE_8K
2079 * - #AFE_PORT_SAMPLE_RATE_16K
2080 * - #AFE_PORT_SAMPLE_RATE_48K
2081 * - #AFE_PORT_SAMPLE_RATE_96K
2082 * - #AFE_PORT_SAMPLE_RATE_192K
2083 */
2084
2085 u16 data_format;
2086/* data format
2087 * Supported values:
2088 * - #LINEAR_PCM_DATA
2089 * - #NON_LINEAR_DATA
2090 * - #LINEAR_PCM_DATA_PACKED_IN_60958
2091 * - #NON_LINEAR_DATA_PACKED_IN_60958
2092 */
2093 u16 reserved;
2094 /* This field must be set to zero. */
2095} __packed;
2096
2097/*
2098 * This param id is used to configure PCM interface
2099 */
2100
2101#define AFE_API_VERSION_SPDIF_CONFIG 0x1
2102#define AFE_API_VERSION_SPDIF_CH_STATUS_CONFIG 0x1
2103#define AFE_API_VERSION_SPDIF_CLK_CONFIG 0x1
2104#define AFE_CH_STATUS_A 1
2105#define AFE_CH_STATUS_B 2
2106
2107#define AFE_PARAM_ID_SPDIF_CONFIG 0x00010244
2108#define AFE_PARAM_ID_CH_STATUS_CONFIG 0x00010245
2109#define AFE_PARAM_ID_SPDIF_CLK_CONFIG 0x00010246
2110
2111#define AFE_PORT_CLK_ROOT_LPAPLL 0x3
2112#define AFE_PORT_CLK_ROOT_LPAQ6PLL 0x4
2113
2114struct afe_param_id_spdif_cfg {
2115/* Minor version used for tracking the version of the SPDIF
2116 * configuration interface.
2117 * Supported values: #AFE_API_VERSION_SPDIF_CONFIG
2118 */
2119 u32 spdif_cfg_minor_version;
2120
2121/* Sampling rate of the port.
2122 * Supported values:
2123 * - #AFE_PORT_SAMPLE_RATE_22_05K
2124 * - #AFE_PORT_SAMPLE_RATE_32K
2125 * - #AFE_PORT_SAMPLE_RATE_44_1K
2126 * - #AFE_PORT_SAMPLE_RATE_48K
2127 * - #AFE_PORT_SAMPLE_RATE_96K
2128 * - #AFE_PORT_SAMPLE_RATE_176_4K
2129 * - #AFE_PORT_SAMPLE_RATE_192K
2130 */
2131 u32 sample_rate;
2132
2133/* data format
2134 * Supported values:
2135 * - #AFE_LINEAR_PCM_DATA
2136 * - #AFE_NON_LINEAR_DATA
2137 */
2138 u16 data_format;
2139/* Number of channels supported by the port
2140 * - PCM - 1, Compressed Case - 2
2141 */
2142 u16 num_channels;
2143/* Bit width of the sample.
2144 * Supported values: 16, 24
2145 */
2146 u16 bit_width;
2147/* This field must be set to zero. */
2148 u16 reserved;
2149} __packed;
2150
2151struct afe_param_id_spdif_ch_status_cfg {
2152 u32 ch_status_cfg_minor_version;
2153/* Minor version used for tracking the version of channel
2154 * status configuration. Current supported version is 1
2155 */
2156
2157 u32 status_type;
2158/* Indicate if the channel status is for channel A or B
2159 * Supported values:
2160 * - #AFE_CH_STATUS_A
2161 * - #AFE_CH_STATUS_B
2162 */
2163
2164 u8 status_bits[24];
2165/* Channel status - 192 bits for channel
2166 * Byte ordering as defined by IEC60958-3
2167 */
2168
2169 u8 status_mask[24];
2170/* Channel status with mask bits 1 will be applied.
2171 * Byte ordering as defined by IEC60958-3
2172 */
2173} __packed;
2174
2175struct afe_param_id_spdif_clk_cfg {
2176 u32 clk_cfg_minor_version;
2177/* Minor version used for tracking the version of SPDIF
2178 * interface clock configuration. Current supported version
2179 * is 1
2180 */
2181
2182 u32 clk_value;
2183/* Specifies the clock frequency in Hz to set
2184 * Supported values:
2185 * 0 - Disable the clock
2186 * 2 (byphase) * 32 (60958 subframe size) * sampling rate * 2
2187 * (channels A and B)
2188 */
2189
2190 u32 clk_root;
2191/* Specifies SPDIF root clk source
2192 * Supported Values:
2193 * - #AFE_PORT_CLK_ROOT_LPAPLL
2194 * - #AFE_PORT_CLK_ROOT_LPAQ6PLL
2195 */
2196} __packed;
2197
2198struct afe_spdif_clk_config_command {
2199 struct apr_hdr hdr;
2200 struct afe_port_cmd_set_param_v2 param;
2201 struct afe_port_param_data_v2 pdata;
2202 struct afe_param_id_spdif_clk_cfg clk_cfg;
2203} __packed;
2204
2205struct afe_spdif_chstatus_config_command {
2206 struct apr_hdr hdr;
2207 struct afe_port_cmd_set_param_v2 param;
2208 struct afe_port_param_data_v2 pdata;
2209 struct afe_param_id_spdif_ch_status_cfg ch_status;
2210} __packed;
2211
2212struct afe_spdif_port_config {
2213 struct afe_param_id_spdif_cfg cfg;
2214 struct afe_param_id_spdif_ch_status_cfg ch_status;
2215} __packed;
2216
2217#define AFE_PARAM_ID_PCM_CONFIG 0x0001020E
2218#define AFE_API_VERSION_PCM_CONFIG 0x1
2219/* Enumeration for the auxiliary PCM synchronization signal
2220 * provided by an external source.
2221 */
2222
2223#define AFE_PORT_PCM_SYNC_SRC_EXTERNAL 0x0
2224/* Enumeration for the auxiliary PCM synchronization signal
2225 * provided by an internal source.
2226 */
2227#define AFE_PORT_PCM_SYNC_SRC_INTERNAL 0x1
2228/* Enumeration for the PCM configuration aux_mode parameter,
2229 * which configures the auxiliary PCM interface to use
2230 * short synchronization.
2231 */
2232#define AFE_PORT_PCM_AUX_MODE_PCM 0x0
2233/*
2234 * Enumeration for the PCM configuration aux_mode parameter,
2235 * which configures the auxiliary PCM interface to use long
2236 * synchronization.
2237 */
2238#define AFE_PORT_PCM_AUX_MODE_AUX 0x1
2239/*
2240 * Enumeration for setting the PCM configuration frame to 8.
2241 */
2242#define AFE_PORT_PCM_BITS_PER_FRAME_8 0x0
2243/*
2244 * Enumeration for setting the PCM configuration frame to 16.
2245 */
2246#define AFE_PORT_PCM_BITS_PER_FRAME_16 0x1
2247
2248/* Enumeration for setting the PCM configuration frame to 32.*/
2249#define AFE_PORT_PCM_BITS_PER_FRAME_32 0x2
2250
2251/* Enumeration for setting the PCM configuration frame to 64.*/
2252#define AFE_PORT_PCM_BITS_PER_FRAME_64 0x3
2253
2254/* Enumeration for setting the PCM configuration frame to 128.*/
2255#define AFE_PORT_PCM_BITS_PER_FRAME_128 0x4
2256
2257/* Enumeration for setting the PCM configuration frame to 256.*/
2258#define AFE_PORT_PCM_BITS_PER_FRAME_256 0x5
2259
2260/* Enumeration for setting the PCM configuration
2261 * quantype parameter to A-law with no padding.
2262 */
2263#define AFE_PORT_PCM_ALAW_NOPADDING 0x0
2264
2265/* Enumeration for setting the PCM configuration quantype
2266 * parameter to mu-law with no padding.
2267 */
2268#define AFE_PORT_PCM_MULAW_NOPADDING 0x1
2269/* Enumeration for setting the PCM configuration quantype
2270 * parameter to linear with no padding.
2271 */
2272#define AFE_PORT_PCM_LINEAR_NOPADDING 0x2
2273/* Enumeration for setting the PCM configuration quantype
2274 * parameter to A-law with padding.
2275 */
2276#define AFE_PORT_PCM_ALAW_PADDING 0x3
2277/* Enumeration for setting the PCM configuration quantype
2278 * parameter to mu-law with padding.
2279 */
2280#define AFE_PORT_PCM_MULAW_PADDING 0x4
2281/* Enumeration for setting the PCM configuration quantype
2282 * parameter to linear with padding.
2283 */
2284#define AFE_PORT_PCM_LINEAR_PADDING 0x5
2285/* Enumeration for disabling the PCM configuration
2286 * ctrl_data_out_enable parameter.
2287 * The PCM block is the only master.
2288 */
2289#define AFE_PORT_PCM_CTRL_DATA_OE_DISABLE 0x0
2290/*
2291 * Enumeration for enabling the PCM configuration
2292 * ctrl_data_out_enable parameter. The PCM block shares
2293 * the signal with other masters.
2294 */
2295#define AFE_PORT_PCM_CTRL_DATA_OE_ENABLE 0x1
2296
2297/* Payload of the #AFE_PARAM_ID_PCM_CONFIG command's
2298 * (PCM configuration parameter).
2299 */
2300
2301struct afe_param_id_pcm_cfg {
2302 u32 pcm_cfg_minor_version;
2303/* Minor version used for tracking the version of the AUX PCM
2304 * configuration interface.
2305 * Supported values: #AFE_API_VERSION_PCM_CONFIG
2306 */
2307
2308 u16 aux_mode;
2309/* PCM synchronization setting.
2310 * Supported values:
2311 * - #AFE_PORT_PCM_AUX_MODE_PCM
2312 * - #AFE_PORT_PCM_AUX_MODE_AUX
2313 */
2314
2315 u16 sync_src;
2316/* Synchronization source.
2317 * Supported values:
2318 * - #AFE_PORT_PCM_SYNC_SRC_EXTERNAL
2319 * - #AFE_PORT_PCM_SYNC_SRC_INTERNAL
2320 */
2321
2322 u16 frame_setting;
2323/* Number of bits per frame.
2324 * Supported values:
2325 * - #AFE_PORT_PCM_BITS_PER_FRAME_8
2326 * - #AFE_PORT_PCM_BITS_PER_FRAME_16
2327 * - #AFE_PORT_PCM_BITS_PER_FRAME_32
2328 * - #AFE_PORT_PCM_BITS_PER_FRAME_64
2329 * - #AFE_PORT_PCM_BITS_PER_FRAME_128
2330 * - #AFE_PORT_PCM_BITS_PER_FRAME_256
2331 */
2332
2333 u16 quantype;
2334/* PCM quantization type.
2335 * Supported values:
2336 * - #AFE_PORT_PCM_ALAW_NOPADDING
2337 * - #AFE_PORT_PCM_MULAW_NOPADDING
2338 * - #AFE_PORT_PCM_LINEAR_NOPADDING
2339 * - #AFE_PORT_PCM_ALAW_PADDING
2340 * - #AFE_PORT_PCM_MULAW_PADDING
2341 * - #AFE_PORT_PCM_LINEAR_PADDING
2342 */
2343
2344 u16 ctrl_data_out_enable;
2345/* Specifies whether the PCM block shares the data-out
2346 * signal to the drive with other masters.
2347 * Supported values:
2348 * - #AFE_PORT_PCM_CTRL_DATA_OE_DISABLE
2349 * - #AFE_PORT_PCM_CTRL_DATA_OE_ENABLE
2350 */
2351 u16 reserved;
2352 /* This field must be set to zero. */
2353
2354 u32 sample_rate;
2355/* Sampling rate of the port.
2356 * Supported values:
2357 * - #AFE_PORT_SAMPLE_RATE_8K
2358 * - #AFE_PORT_SAMPLE_RATE_16K
2359 */
2360
2361 u16 bit_width;
2362/* Bit width of the sample.
2363 * Supported values: 16
2364 */
2365
2366 u16 num_channels;
2367/* Number of channels.
2368 * Supported values: 1 to 4
2369 */
2370
2371 u16 slot_number_mapping[4];
2372/* Specifies the slot number for the each channel in
2373 * multi channel scenario.
2374 * Supported values: 1 to 32
2375 */
2376} __packed;
2377
2378/*
2379 * This param id is used to configure DIGI MIC interface
2380 */
2381#define AFE_PARAM_ID_DIGI_MIC_CONFIG 0x0001020F
2382/* This version information is used to handle the new
2383 * additions to the config interface in future in backward
2384 * compatible manner.
2385 */
2386#define AFE_API_VERSION_DIGI_MIC_CONFIG 0x1
2387
2388/* Enumeration for setting the digital mic configuration
2389 * channel_mode parameter to left 0.
2390 */
2391
2392#define AFE_PORT_DIGI_MIC_MODE_LEFT0 0x1
2393
2394/*Enumeration for setting the digital mic configuration
2395 * channel_mode parameter to right 0.
2396 */
2397
2398
2399#define AFE_PORT_DIGI_MIC_MODE_RIGHT0 0x2
2400
2401/* Enumeration for setting the digital mic configuration
2402 * channel_mode parameter to left 1.
2403 */
2404
2405#define AFE_PORT_DIGI_MIC_MODE_LEFT1 0x3
2406
2407/* Enumeration for setting the digital mic configuration
2408 * channel_mode parameter to right 1.
2409 */
2410
2411#define AFE_PORT_DIGI_MIC_MODE_RIGHT1 0x4
2412
2413/* Enumeration for setting the digital mic configuration
2414 * channel_mode parameter to stereo 0.
2415 */
2416#define AFE_PORT_DIGI_MIC_MODE_STEREO0 0x5
2417
2418/* Enumeration for setting the digital mic configuration
2419 * channel_mode parameter to stereo 1.
2420 */
2421
2422
2423#define AFE_PORT_DIGI_MIC_MODE_STEREO1 0x6
2424
2425/* Enumeration for setting the digital mic configuration
2426 * channel_mode parameter to quad.
2427 */
2428
2429#define AFE_PORT_DIGI_MIC_MODE_QUAD 0x7
2430
2431/* Payload of the #AFE_PARAM_ID_DIGI_MIC_CONFIG command's
2432 * (DIGI MIC configuration
2433 * parameter).
2434 */
2435struct afe_param_id_digi_mic_cfg {
2436 u32 digi_mic_cfg_minor_version;
2437/* Minor version used for tracking the version of the DIGI Mic
2438 * configuration interface.
2439 * Supported values: #AFE_API_VERSION_DIGI_MIC_CONFIG
2440 */
2441
2442 u16 bit_width;
2443/* Bit width of the sample.
2444 * Supported values: 16
2445 */
2446
2447 u16 channel_mode;
2448/* Digital mic and multichannel operation.
2449 * Supported values:
2450 * - #AFE_PORT_DIGI_MIC_MODE_LEFT0
2451 * - #AFE_PORT_DIGI_MIC_MODE_RIGHT0
2452 * - #AFE_PORT_DIGI_MIC_MODE_LEFT1
2453 * - #AFE_PORT_DIGI_MIC_MODE_RIGHT1
2454 * - #AFE_PORT_DIGI_MIC_MODE_STEREO0
2455 * - #AFE_PORT_DIGI_MIC_MODE_STEREO1
2456 * - #AFE_PORT_DIGI_MIC_MODE_QUAD
2457 */
2458
2459 u32 sample_rate;
2460/* Sampling rate of the port.
2461 * Supported values:
2462 * - #AFE_PORT_SAMPLE_RATE_8K
2463 * - #AFE_PORT_SAMPLE_RATE_16K
2464 * - #AFE_PORT_SAMPLE_RATE_48K
2465 */
2466} __packed;
2467
2468/* This param id is used to configure HDMI interface */
2469#define AFE_PARAM_ID_HDMI_CONFIG 0x00010210
2470
2471/* This version information is used to handle the new
2472 * additions to the config interface in future in backward
2473 * compatible manner.
2474 */
2475#define AFE_API_VERSION_HDMI_CONFIG 0x1
2476
2477/* Payload of the #AFE_PARAM_ID_HDMI_CONFIG command,
2478 * which configures a multichannel HDMI audio interface.
2479 */
2480struct afe_param_id_hdmi_multi_chan_audio_cfg {
2481 u32 hdmi_cfg_minor_version;
2482/* Minor version used for tracking the version of the HDMI
2483 * configuration interface.
2484 * Supported values: #AFE_API_VERSION_HDMI_CONFIG
2485 */
2486
2487u16 datatype;
2488/* data type
2489 * Supported values:
2490 * - #LINEAR_PCM_DATA
2491 * - #NON_LINEAR_DATA
2492 * - #LINEAR_PCM_DATA_PACKED_IN_60958
2493 * - #NON_LINEAR_DATA_PACKED_IN_60958
2494 */
2495
2496u16 channel_allocation;
2497/* HDMI channel allocation information for programming an HDMI
2498 * frame. The default is 0 (Stereo).
2499 *
2500 * This information is defined in the HDMI standard, CEA 861-D
2501 * (refer to @xhyperref{S1,[S1]}). The number of channels is also
2502 * inferred from this parameter.
2503 */
2504
2505
2506u32 sample_rate;
2507/* Sampling rate of the port.
2508 * Supported values:
2509 * - #AFE_PORT_SAMPLE_RATE_8K
2510 * - #AFE_PORT_SAMPLE_RATE_16K
2511 * - #AFE_PORT_SAMPLE_RATE_48K
2512 * - #AFE_PORT_SAMPLE_RATE_96K
2513 * - 22050, 44100, 176400 for compressed streams
2514 */
2515
2516 u16 bit_width;
2517/* Bit width of the sample.
2518 * Supported values: 16, 24
2519 */
2520 u16 reserved;
2521 /* This field must be set to zero. */
2522} __packed;
2523
2524/* This param id is used to configure BT or FM(RIVA) interface */
2525#define AFE_PARAM_ID_INTERNAL_BT_FM_CONFIG 0x00010211
2526
2527/* This version information is used to handle the new
2528 * additions to the config interface in future in backward
2529 * compatible manner.
2530 */
2531#define AFE_API_VERSION_INTERNAL_BT_FM_CONFIG 0x1
2532
2533/* Payload of the #AFE_PARAM_ID_INTERNAL_BT_FM_CONFIG
2534 * command's BT voice/BT audio/FM configuration parameter.
2535 */
2536struct afe_param_id_internal_bt_fm_cfg {
2537 u32 bt_fm_cfg_minor_version;
2538/* Minor version used for tracking the version of the BT and FM
2539 * configuration interface.
2540 * Supported values: #AFE_API_VERSION_INTERNAL_BT_FM_CONFIG
2541 */
2542
2543 u16 num_channels;
2544/* Number of channels.
2545 * Supported values: 1 to 2
2546 */
2547
2548 u16 bit_width;
2549/* Bit width of the sample.
2550 * Supported values: 16
2551 */
2552
2553 u32 sample_rate;
2554/* Sampling rate of the port.
2555 * Supported values:
2556 * - #AFE_PORT_SAMPLE_RATE_8K (only for BTSCO)
2557 * - #AFE_PORT_SAMPLE_RATE_16K (only for BTSCO)
2558 * - #AFE_PORT_SAMPLE_RATE_48K (FM and A2DP)
2559 */
2560} __packed;
2561
2562/* This param id is used to configure SLIMBUS interface using
2563 * shared channel approach.
2564 */
2565
2566
2567#define AFE_PARAM_ID_SLIMBUS_CONFIG 0x00010212
2568
2569/* This version information is used to handle the new
2570 * additions to the config interface in future in backward
2571 * compatible manner.
2572 */
2573#define AFE_API_VERSION_SLIMBUS_CONFIG 0x1
2574
2575/* Enumeration for setting SLIMbus device ID 1. */
2576#define AFE_SLIMBUS_DEVICE_1 0x0
2577
2578/* Enumeration for setting SLIMbus device ID 2. */
2579#define AFE_SLIMBUS_DEVICE_2 0x1
2580
2581/* Enumeration for setting the SLIMbus data formats. */
2582#define AFE_SB_DATA_FORMAT_NOT_INDICATED 0x0
2583
2584/* Enumeration for setting the maximum number of streams per
2585 * device.
2586 */
2587
2588#define AFE_PORT_MAX_AUDIO_CHAN_CNT 0x8
2589
Cong Tang76c7e642019-02-26 15:08:55 +08002590#define AFE_PORT_MAX_AUDIO_CHAN_CNT_V2 0x20
2591
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +05302592/* Payload of the #AFE_PORT_CMD_SLIMBUS_CONFIG command's SLIMbus
2593 * port configuration parameter.
2594 */
2595
2596struct afe_param_id_slimbus_cfg {
2597 u32 sb_cfg_minor_version;
2598/* Minor version used for tracking the version of the SLIMBUS
2599 * configuration interface.
2600 * Supported values: #AFE_API_VERSION_SLIMBUS_CONFIG
2601 */
2602
2603 u16 slimbus_dev_id;
2604/* SLIMbus hardware device ID, which is required to handle
2605 * multiple SLIMbus hardware blocks.
2606 * Supported values: - #AFE_SLIMBUS_DEVICE_1 - #AFE_SLIMBUS_DEVICE_2
2607 */
2608
2609
2610 u16 bit_width;
2611/* Bit width of the sample.
2612 * Supported values: 16, 24
2613 */
2614
2615 u16 data_format;
2616/* Data format supported by the SLIMbus hardware. The default is
2617 * 0 (#AFE_SB_DATA_FORMAT_NOT_INDICATED), which indicates the
2618 * hardware does not perform any format conversions before the data
2619 * transfer.
2620 */
2621
2622
2623 u16 num_channels;
2624/* Number of channels.
2625 * Supported values: 1 to #AFE_PORT_MAX_AUDIO_CHAN_CNT
2626 */
2627
2628 u8 shared_ch_mapping[AFE_PORT_MAX_AUDIO_CHAN_CNT];
2629/* Mapping of shared channel IDs (128 to 255) to which the
2630 * master port is to be connected.
2631 * Shared_channel_mapping[i] represents the shared channel assigned
2632 * for audio channel i in multichannel audio data.
2633 */
2634
2635 u32 sample_rate;
2636/* Sampling rate of the port.
2637 * Supported values:
2638 * - #AFE_PORT_SAMPLE_RATE_8K
2639 * - #AFE_PORT_SAMPLE_RATE_16K
2640 * - #AFE_PORT_SAMPLE_RATE_48K
2641 * - #AFE_PORT_SAMPLE_RATE_96K
2642 * - #AFE_PORT_SAMPLE_RATE_192K
2643 */
2644} __packed;
2645
2646
2647/* ID of the parameter used by AFE_PARAM_ID_USB_AUDIO_DEV_PARAMS to configure
2648 * USB audio device parameter. It should be used with
2649 * AFE_MODULE_AUDIO_DEV_INTERFACE
2650 */
2651#define AFE_PARAM_ID_USB_AUDIO_DEV_PARAMS 0x000102A5
2652
2653
2654/* ID of the parameter used to set the endianness value for the
2655 * USB audio device. It should be used with
2656 * AFE_MODULE_AUDIO_DEV_INTERFACE
2657 */
2658#define AFE_PARAM_ID_USB_AUDIO_DEV_LPCM_FMT 0x000102AA
2659
2660/* Minor version used for tracking USB audio configuration */
2661#define AFE_API_MINIOR_VERSION_USB_AUDIO_CONFIG 0x1
2662
Haynes Mathew George7ed9b512018-02-28 18:18:09 -08002663/* ID of the parameter used to set the latency mode of the
2664 * USB audio device.
2665 */
2666#define AFE_PARAM_ID_PORT_LATENCY_MODE_CONFIG 0x000102B3
2667
2668/* Minor version used for tracking USB audio latency mode */
2669#define AFE_API_MINOR_VERSION_USB_AUDIO_LATENCY_MODE 0x1
2670
2671/* Supported AFE port latency modes */
2672#define AFE_PORT_DEFAULT_LATENCY_MODE 0x0
2673#define AFE_PORT_LOW_LATENCY_MODE 0x1
2674
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +05302675/* Payload of the AFE_PARAM_ID_USB_AUDIO_DEV_PARAMS parameter used by
2676 * AFE_MODULE_AUDIO_DEV_INTERFACE.
2677 */
2678struct afe_param_id_usb_audio_dev_params {
2679/* Minor version used for tracking USB audio device parameter.
2680 * Supported values: AFE_API_MINIOR_VERSION_USB_AUDIO_CONFIG
2681 */
2682 u32 cfg_minor_version;
2683/* Token of actual end USB aduio device */
2684 u32 dev_token;
2685} __packed;
2686
2687struct afe_param_id_usb_audio_dev_lpcm_fmt {
2688/* Minor version used for tracking USB audio device parameter.
2689 * Supported values: AFE_API_MINIOR_VERSION_USB_AUDIO_CONFIG
2690 */
2691 u32 cfg_minor_version;
2692/* Endianness of actual end USB audio device */
2693 u32 endian;
2694} __packed;
2695
Haynes Mathew George7ed9b512018-02-28 18:18:09 -08002696struct afe_param_id_usb_audio_dev_latency_mode {
2697/* Minor version used for tracking USB audio device parameter.
2698 * Supported values: AFE_API_MINOR_VERSION_USB_AUDIO_LATENCY_MODE
2699 */
2700 u32 minor_version;
2701/* latency mode for the USB audio device */
2702 u32 mode;
2703} __packed;
2704
2705
2706
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +05302707/* ID of the parameter used by AFE_PARAM_ID_USB_AUDIO_CONFIG to configure
2708 * USB audio interface. It should be used with AFE_MODULE_AUDIO_DEV_INTERFACE
2709 */
2710#define AFE_PARAM_ID_USB_AUDIO_CONFIG 0x000102A4
2711
2712/* Payload of the AFE_PARAM_ID_USB_AUDIO_CONFIG parameter used by
2713 * AFE_MODULE_AUDIO_DEV_INTERFACE.
2714 */
2715struct afe_param_id_usb_audio_cfg {
2716/* Minor version used for tracking USB audio device configuration.
2717 * Supported values: AFE_API_MINIOR_VERSION_USB_AUDIO_CONFIG
2718 */
2719 u32 cfg_minor_version;
2720/* Sampling rate of the port.
2721 * Supported values:
2722 * - AFE_PORT_SAMPLE_RATE_8K
2723 * - AFE_PORT_SAMPLE_RATE_11025
2724 * - AFE_PORT_SAMPLE_RATE_12K
2725 * - AFE_PORT_SAMPLE_RATE_16K
2726 * - AFE_PORT_SAMPLE_RATE_22050
2727 * - AFE_PORT_SAMPLE_RATE_24K
2728 * - AFE_PORT_SAMPLE_RATE_32K
2729 * - AFE_PORT_SAMPLE_RATE_44P1K
2730 * - AFE_PORT_SAMPLE_RATE_48K
2731 * - AFE_PORT_SAMPLE_RATE_96K
2732 * - AFE_PORT_SAMPLE_RATE_192K
2733 */
2734 u32 sample_rate;
2735/* Bit width of the sample.
2736 * Supported values: 16, 24
2737 */
2738 u16 bit_width;
2739/* Number of channels.
2740 * Supported values: 1 and 2
2741 */
2742 u16 num_channels;
2743/* Data format supported by the USB. The supported value is
2744 * 0 (#AFE_USB_AUDIO_DATA_FORMAT_LINEAR_PCM).
2745 */
2746 u16 data_format;
2747/* this field must be 0 */
2748 u16 reserved;
2749/* device token of actual end USB aduio device */
2750 u32 dev_token;
2751/* endianness of this interface */
Haynes Mathew George7ed9b512018-02-28 18:18:09 -08002752 u32 endian;
2753/* service interval */
2754 u32 service_interval;
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +05302755} __packed;
2756
2757struct afe_usb_audio_dev_param_command {
2758 struct apr_hdr hdr;
2759 struct afe_port_cmd_set_param_v2 param;
2760 struct afe_port_param_data_v2 pdata;
2761 union {
2762 struct afe_param_id_usb_audio_dev_params usb_dev;
2763 struct afe_param_id_usb_audio_dev_lpcm_fmt lpcm_fmt;
Haynes Mathew George7ed9b512018-02-28 18:18:09 -08002764 struct afe_param_id_usb_audio_dev_latency_mode latency_config;
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +05302765 };
2766} __packed;
2767
2768/* This param id is used to configure Real Time Proxy interface. */
2769#define AFE_PARAM_ID_RT_PROXY_CONFIG 0x00010213
2770
2771/* This version information is used to handle the new
2772 * additions to the config interface in future in backward
2773 * compatible manner.
2774 */
2775#define AFE_API_VERSION_RT_PROXY_CONFIG 0x1
2776
2777/* Payload of the #AFE_PARAM_ID_RT_PROXY_CONFIG
2778 * command (real-time proxy port configuration parameter).
2779 */
2780struct afe_param_id_rt_proxy_port_cfg {
2781 u32 rt_proxy_cfg_minor_version;
2782/* Minor version used for tracking the version of rt-proxy
2783 * config interface.
2784 */
2785
2786 u16 bit_width;
2787/* Bit width of the sample.
2788 * Supported values: 16
2789 */
2790
2791 u16 interleaved;
2792/* Specifies whether the data exchanged between the AFE
2793 * interface and real-time port is interleaved.
2794 * Supported values: - 0 -- Non-interleaved (samples from each
2795 * channel are contiguous in the buffer) - 1 -- Interleaved
2796 * (corresponding samples from each input channel are interleaved
2797 * within the buffer)
2798 */
2799
2800
2801 u16 frame_size;
2802/* Size of the frames that are used for PCM exchanges with this
2803 * port.
2804 * Supported values: > 0, in bytes
2805 * For example, 5 ms buffers of 16 bits and 16 kHz stereo samples
2806 * is 5 ms * 16 samples/ms * 2 bytes/sample * 2 channels = 320
2807 * bytes.
2808 */
2809 u16 jitter_allowance;
2810/* Configures the amount of jitter that the port will allow.
2811 * Supported values: > 0
2812 * For example, if +/-10 ms of jitter is anticipated in the timing
2813 * of sending frames to the port, and the configuration is 16 kHz
2814 * mono with 16-bit samples, this field is 10 ms * 16 samples/ms * 2
2815 * bytes/sample = 320.
2816 */
2817
2818 u16 low_water_mark;
2819/* Low watermark in bytes (including all channels).
2820 * Supported values:
2821 * - 0 -- Do not send any low watermark events
2822 * - > 0 -- Low watermark for triggering an event
2823 * If the number of bytes in an internal circular buffer is lower
2824 * than this low_water_mark parameter, a LOW_WATER_MARK event is
2825 * sent to applications (via the #AFE_EVENT_RT_PROXY_PORT_STATUS
2826 * event).
2827 * Use of watermark events is optional for debugging purposes.
2828 */
2829
2830 u16 high_water_mark;
2831/* High watermark in bytes (including all channels).
2832 * Supported values:
2833 * - 0 -- Do not send any high watermark events
2834 * - > 0 -- High watermark for triggering an event
2835 * If the number of bytes in an internal circular buffer exceeds
2836 * TOTAL_CIRC_BUF_SIZE minus high_water_mark, a high watermark event
2837 * is sent to applications (via the #AFE_EVENT_RT_PROXY_PORT_STATUS
2838 * event).
2839 * The use of watermark events is optional and for debugging
2840 * purposes.
2841 */
2842
2843
2844 u32 sample_rate;
2845/* Sampling rate of the port.
2846 * Supported values:
2847 * - #AFE_PORT_SAMPLE_RATE_8K
2848 * - #AFE_PORT_SAMPLE_RATE_16K
2849 * - #AFE_PORT_SAMPLE_RATE_48K
2850 */
2851
2852 u16 num_channels;
2853/* Number of channels.
2854 * Supported values: 1 to #AFE_PORT_MAX_AUDIO_CHAN_CNT
2855 */
2856
2857 u16 reserved;
2858 /* For 32 bit alignment. */
2859} __packed;
2860
2861
2862/* This param id is used to configure the Pseudoport interface */
2863
2864#define AFE_PARAM_ID_PSEUDO_PORT_CONFIG 0x00010219
2865
2866/* Version information used to handle future additions to the configuration
2867 * interface (for backward compatibility).
2868 */
2869#define AFE_API_VERSION_PSEUDO_PORT_CONFIG 0x1
2870
2871/* Enumeration for setting the timing_mode parameter to faster than real
2872 * time.
2873 */
2874#define AFE_PSEUDOPORT_TIMING_MODE_FTRT 0x0
2875
2876/* Enumeration for setting the timing_mode parameter to real time using
2877 * timers.
2878 */
2879#define AFE_PSEUDOPORT_TIMING_MODE_TIMER 0x1
2880
2881/* Payload of the AFE_PARAM_ID_PSEUDO_PORT_CONFIG parameter used by
2882 * AFE_MODULE_AUDIO_DEV_INTERFACE.
2883 */
2884struct afe_param_id_pseudo_port_cfg {
2885 u32 pseud_port_cfg_minor_version;
2886 /*
2887 * Minor version used for tracking the version of the pseudoport
2888 * configuration interface.
2889 */
2890
2891 u16 bit_width;
2892 /* Bit width of the sample at values 16, 24 */
2893
2894 u16 num_channels;
2895 /* Number of channels at values 1 to 8 */
2896
2897 u16 data_format;
2898 /* Non-linear data format supported by the pseudoport (for future use).
2899 * At values #AFE_LINEAR_PCM_DATA
2900 */
2901
2902 u16 timing_mode;
2903 /* Indicates whether the pseudoport synchronizes to the clock or
2904 * operates faster than real time.
2905 * at values
2906 * - #AFE_PSEUDOPORT_TIMING_MODE_FTRT
2907 * - #AFE_PSEUDOPORT_TIMING_MODE_TIMER @tablebulletend
2908 */
2909
2910 u32 sample_rate;
2911 /* Sample rate at which the pseudoport will run.
2912 * at values
2913 * - #AFE_PORT_SAMPLE_RATE_8K
2914 * - #AFE_PORT_SAMPLE_RATE_32K
2915 * - #AFE_PORT_SAMPLE_RATE_48K
2916 * - #AFE_PORT_SAMPLE_RATE_96K
2917 * - #AFE_PORT_SAMPLE_RATE_192K @tablebulletend
2918 */
2919} __packed;
2920
2921#define AFE_PARAM_ID_TDM_CONFIG 0x0001029D
2922
2923#define AFE_API_VERSION_TDM_CONFIG 1
2924
2925#define AFE_PORT_TDM_SHORT_SYNC_BIT_MODE 0
2926#define AFE_PORT_TDM_LONG_SYNC_MODE 1
2927#define AFE_PORT_TDM_SHORT_SYNC_SLOT_MODE 2
2928
2929#define AFE_PORT_TDM_SYNC_SRC_EXTERNAL 0
2930#define AFE_PORT_TDM_SYNC_SRC_INTERNAL 1
2931
2932#define AFE_PORT_TDM_CTRL_DATA_OE_DISABLE 0
2933#define AFE_PORT_TDM_CTRL_DATA_OE_ENABLE 1
2934
2935#define AFE_PORT_TDM_SYNC_NORMAL 0
2936#define AFE_PORT_TDM_SYNC_INVERT 1
2937
2938#define AFE_PORT_TDM_DATA_DELAY_0_BCLK_CYCLE 0
2939#define AFE_PORT_TDM_DATA_DELAY_1_BCLK_CYCLE 1
2940#define AFE_PORT_TDM_DATA_DELAY_2_BCLK_CYCLE 2
2941
2942/* Payload of the AFE_PARAM_ID_TDM_CONFIG parameter used by
2943 * AFE_MODULE_AUDIO_DEV_INTERFACE.
2944 */
2945struct afe_param_id_tdm_cfg {
2946 u32 tdm_cfg_minor_version;
2947 /* < Minor version used to track TDM configuration.
2948 * @values #AFE_API_VERSION_TDM_CONFIG
2949 */
2950
2951 u32 num_channels;
2952 /* < Number of enabled slots for TDM frame.
2953 * @values 1 to 8
2954 */
2955
2956 u32 sample_rate;
2957 /* < Sampling rate of the port.
2958 * @values
2959 * - #AFE_PORT_SAMPLE_RATE_8K
2960 * - #AFE_PORT_SAMPLE_RATE_16K
2961 * - #AFE_PORT_SAMPLE_RATE_24K
2962 * - #AFE_PORT_SAMPLE_RATE_32K
2963 * - #AFE_PORT_SAMPLE_RATE_48K
2964 * - #AFE_PORT_SAMPLE_RATE_176P4K
2965 * - #AFE_PORT_SAMPLE_RATE_352P8K @tablebulletend
2966 */
2967
2968 u32 bit_width;
2969 /* < Bit width of the sample.
2970 * @values 16, 24
2971 */
2972
2973 u16 data_format;
2974 /* < Data format: linear ,compressed, generic compresssed
2975 * @values
2976 * - #AFE_LINEAR_PCM_DATA
2977 * - #AFE_NON_LINEAR_DATA
2978 * - #AFE_GENERIC_COMPRESSED
2979 */
2980
2981 u16 sync_mode;
2982 /* < TDM synchronization setting.
2983 * @values (short, long, slot) sync mode
2984 * - #AFE_PORT_TDM_SHORT_SYNC_BIT_MODE
2985 * - #AFE_PORT_TDM_LONG_SYNC_MODE
2986 * - #AFE_PORT_TDM_SHORT_SYNC_SLOT_MODE @tablebulletend
2987 */
2988
2989 u16 sync_src;
2990 /* < Synchronization source.
2991 * @values
2992 * - #AFE_PORT_TDM_SYNC_SRC_EXTERNAL
2993 * - #AFE_PORT_TDM_SYNC_SRC_INTERNAL @tablebulletend
2994 */
2995
2996 u16 nslots_per_frame;
2997 /* < Number of slots per frame. Typical : 1, 2, 4, 8, 16, 32.
2998 * @values 1 - 32
2999 */
3000
3001 u16 ctrl_data_out_enable;
3002 /* < Specifies whether the TDM block shares the data-out signal to the
3003 * drive with other masters.
3004 * @values
3005 * - #AFE_PORT_TDM_CTRL_DATA_OE_DISABLE
3006 * - #AFE_PORT_TDM_CTRL_DATA_OE_ENABLE @tablebulletend
3007 */
3008
3009 u16 ctrl_invert_sync_pulse;
3010 /* < Specifies whether to invert the sync or not.
3011 * @values
3012 * - #AFE_PORT_TDM_SYNC_NORMAL
3013 * - #AFE_PORT_TDM_SYNC_INVERT @tablebulletend
3014 */
3015
3016 u16 ctrl_sync_data_delay;
3017 /* < Specifies the number of bit clock to delay data with respect to
3018 * sync edge.
3019 * @values
3020 * - #AFE_PORT_TDM_DATA_DELAY_0_BCLK_CYCLE
3021 * - #AFE_PORT_TDM_DATA_DELAY_1_BCLK_CYCLE
3022 * - #AFE_PORT_TDM_DATA_DELAY_2_BCLK_CYCLE @tablebulletend
3023 */
3024
3025 u16 slot_width;
3026 /* < Slot width of the slot in a TDM frame. (slot_width >= bit_width)
3027 * have to be satisfied.
3028 * @values 16, 24, 32
3029 */
3030
3031 u32 slot_mask;
3032 /* < Position of active slots. When that bit is set,
3033 * that paricular slot is active.
3034 * Number of active slots can be inferred by number of
3035 * bits set in the mask. Only 8 individual bits can be enabled.
3036 * Bits 0..31 corresponding to slot 0..31
3037 * @values 1 to 2^32 - 1
3038 */
3039} __packed;
3040
3041/* ID of Time Divsion Multiplexing (TDM) module,
3042 * which is used for configuring the AFE TDM.
3043 *
3044 * This module supports following parameter IDs:
3045 * - #AFE_PORT_TDM_SLOT_CONFIG
3046 *
3047 * To configure the TDM interface, the client must use the
3048 * #AFE_PORT_CMD_SET_PARAM command, and fill the module ID with the
3049 * respective parameter IDs as listed above.
3050 */
3051
3052#define AFE_MODULE_TDM 0x0001028A
3053
3054/* ID of the parameter used by #AFE_MODULE_TDM to configure
3055 * the TDM slot mapping. #AFE_PORT_CMD_SET_PARAM can use this parameter ID.
3056 */
3057#define AFE_PARAM_ID_PORT_SLOT_MAPPING_CONFIG 0x00010297
3058
3059/* Version information used to handle future additions to slot mapping
3060 * configuration (for backward compatibility).
3061 */
3062#define AFE_API_VERSION_SLOT_MAPPING_CONFIG 0x1
3063
Cong Tang76c7e642019-02-26 15:08:55 +08003064/** Version information used to handle future additions to slot mapping
3065* configuration support 32 channels.
3066*/
3067#define AFE_API_VERSION_SLOT_MAPPING_CONFIG_V2 0x2
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +05303068/* Data align type */
3069#define AFE_SLOT_MAPPING_DATA_ALIGN_MSB 0
3070#define AFE_SLOT_MAPPING_DATA_ALIGN_LSB 1
3071
3072#define AFE_SLOT_MAPPING_OFFSET_INVALID 0xFFFF
3073
3074/* Payload of the AFE_PARAM_ID_PORT_SLOT_MAPPING_CONFIG
3075 * command's TDM configuration parameter.
3076 */
3077struct afe_param_id_slot_mapping_cfg {
3078 u32 minor_version;
3079 /* < Minor version used for tracking TDM slot configuration.
3080 * @values #AFE_API_VERSION_TDM_SLOT_CONFIG
3081 */
3082
3083 u16 num_channel;
3084 /* < number of channel of the audio sample.
3085 * @values 1, 2, 4, 6, 8 @tablebulletend
3086 */
3087
3088 u16 bitwidth;
3089 /* < Slot bit width for each channel
3090 * @values 16, 24, 32
3091 */
3092
3093 u32 data_align_type;
3094 /* < indicate how data packed from slot_offset for 32 slot bit width
3095 * in case of sample bit width is 24.
3096 * @values
3097 * #AFE_SLOT_MAPPING_DATA_ALIGN_MSB
3098 * #AFE_SLOT_MAPPING_DATA_ALIGN_LSB
3099 */
3100
3101 u16 offset[AFE_PORT_MAX_AUDIO_CHAN_CNT];
3102 /* < Array of the slot mapping start offset in bytes for this frame.
3103 * The bytes is counted from 0. The 0 is mapped to the 1st byte
3104 * in or out of the digital serial data line this sub-frame belong to.
3105 * slot_offset[] setting is per-channel based.
3106 * The max num of channel supported is 8.
3107 * The valid offset value must always be continuly placed in from
3108 * index 0.
3109 * Set offset as AFE_SLOT_MAPPING_OFFSET_INVALID for not used arrays.
3110 * If "slot_bitwidth_per_channel" is 32 and "sample_bitwidth" is 24,
3111 * "data_align_type" is used to indicate how 24 bit sample data in
3112 * aligning with 32 bit slot width per-channel.
3113 * @values, in byte
3114 */
3115} __packed;
3116
Cong Tang76c7e642019-02-26 15:08:55 +08003117/* Payload of the AFE_PARAM_ID_PORT_SLOT_MAPPING_CONFIG_V2
3118* command's TDM configuration parameter.
3119*/
3120struct afe_param_id_slot_mapping_cfg_v2 {
3121 u32 minor_version;
3122 /**< Minor version used for tracking TDM slot configuration.
3123 * @values #AFE_API_VERSION_TDM_SLOT_CONFIG
3124 */
3125
3126 u16 num_channel;
3127 /**< number of channel of the audio sample.
3128 * @values 1, 2, 4, 6, 8, 16, 32 @tablebulletend
3129 */
3130
3131 u16 bitwidth;
3132 /**< Slot bit width for each channel
3133 * @values 16, 24, 32
3134 */
3135
3136 u32 data_align_type;
3137 /**< indicate how data packed from slot_offset for 32 slot bit width
3138 * in case of sample bit width is 24.
3139 * @values
3140 * #AFE_SLOT_MAPPING_DATA_ALIGN_MSB
3141 * #AFE_SLOT_MAPPING_DATA_ALIGN_LSB
3142 */
3143
3144 u16 offset[AFE_PORT_MAX_AUDIO_CHAN_CNT_V2];
3145 /**< Array of the slot mapping start offset in bytes for this frame.
3146 * The bytes is counted from 0. The 0 is mapped to the 1st byte
3147 * in or out of the digital serial data line this sub-frame belong to.
3148 * slot_offset[] setting is per-channel based.
3149 * The max num of channel supported is 8.
3150 * The valid offset value must always be continuly placed in
3151 * from index 0.
3152 * Set offset as AFE_SLOT_MAPPING_OFFSET_INVALID for not used arrays.
3153 * If "slot_bitwidth_per_channel" is 32 and "sample_bitwidth" is 24,
3154 * "data_align_type" is used to indicate how 24 bit sample data in
3155 * aligning with 32 bit slot width per-channel.
3156 * @values, in byte
3157 */
3158} __packed;
3159
3160/** ID of the parameter used by #AFE_MODULE_TDM to configure
3161 the customer TDM header. #AFE_PORT_CMD_SET_PARAM can use this parameter ID.
3162*/
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +05303163#define AFE_PARAM_ID_CUSTOM_TDM_HEADER_CONFIG 0x00010298
3164
3165/* Version information used to handle future additions to custom TDM header
3166 * configuration (for backward compatibility).
3167 */
3168#define AFE_API_VERSION_CUSTOM_TDM_HEADER_CONFIG 0x1
3169
3170#define AFE_CUSTOM_TDM_HEADER_TYPE_INVALID 0x0
3171#define AFE_CUSTOM_TDM_HEADER_TYPE_DEFAULT 0x1
3172#define AFE_CUSTOM_TDM_HEADER_TYPE_ENTERTAINMENT_MOST 0x2
3173
3174#define AFE_CUSTOM_TDM_HEADER_MAX_CNT 0x8
3175
3176/* Payload of the AFE_PARAM_ID_CUSTOM_TDM_HEADER_CONFIG parameter ID */
3177struct afe_param_id_custom_tdm_header_cfg {
3178 u32 minor_version;
3179 /* < Minor version used for tracking custom TDM header configuration.
3180 * @values #AFE_API_VERSION_CUSTOM_TDM_HEADER_CONFIG
3181 */
3182
3183 u16 start_offset;
3184 /* < the slot mapping start offset in bytes from this sub-frame
3185 * The bytes is counted from 0. The 0 is mapped to the 1st byte in or
3186 * out of the digital serial data line this sub-frame belong to.
3187 * @values, in byte,
3188 * supported values are 0, 4, 8
3189 */
3190
3191 u16 header_width;
3192 /* < the header width per-frame followed.
3193 * 2 bytes for MOST/TDM case
3194 * @values, in byte
3195 * supported value is 2
3196 */
3197
3198 u16 header_type;
3199 /* < Indicate what kind of custom TDM header it is.
3200 * @values #AFE_CUSTOM_TDM_HEADER_TYPE_INVALID = 0
3201 * #AFE_CUSTOM_TDM_HEADER_TYPE_DEFAULT = 1 (for AAN channel per MOST)
3202 * #AFE_CUSTOM_TDM_HEADER_TYPE_ENTERTAINMENT_MOST = 2
3203 * (for entertainment channel, which will overwrite
3204 * AFE_API_VERSION_TDM_SAD_HEADER_TYPE_DEFAULT per MOST)
3205 */
3206
3207 u16 num_frame_repeat;
3208 /* < num of header followed.
3209 * @values, supported value is 8
3210 */
3211 u16 header[AFE_CUSTOM_TDM_HEADER_MAX_CNT];
3212 /* < SAD header for MOST/TDM case is followed as payload as below.
3213 * The size of followed SAD header in bytes is num_of_frame_repeat *
3214 * header_width_per_frame, which is 2 * 8 = 16 bytes here.
3215 * the supported payload format is in uint16_t as below
3216 * uint16_t header0; SyncHi 0x3C Info[4] - CodecType -> 0x3C00
3217 * uint16_t header1; SyncLo 0xB2 Info[5] - SampleWidth -> 0xB218
3218 * uint16_t header2; DTCP Info Info[6] - unused -> 0x0
3219 * uint16_t header3; Extension Info[7] - ASAD-Value -> 0xC0
3220 * uint16_t header4; Reserved Info[0] - Num of bytes following -> 0x7
3221 * uint16_t header5; Reserved Info[1] - Media Type -> 0x0
3222 * uint16_t header6; Reserved Info[2] - Bitrate[kbps] - High Byte -> 0x0
3223 * uint16_t header7; Reserved Info[3] - Bitrate[kbps] - Low Byte -> 0x0
3224 */
3225} __packed;
3226
3227struct afe_slot_mapping_config_command {
3228 struct apr_hdr hdr;
3229 struct afe_port_cmd_set_param_v2 param;
3230 struct afe_port_param_data_v2 pdata;
3231 struct afe_param_id_slot_mapping_cfg slot_mapping;
3232} __packed;
3233
Cong Tang76c7e642019-02-26 15:08:55 +08003234struct afe_slot_mapping_config_command_v2 {
3235 struct apr_hdr hdr;
3236 struct afe_port_cmd_set_param_v2 param;
3237 struct afe_port_param_data_v2 pdata;
3238 struct afe_param_id_slot_mapping_cfg_v2 slot_mapping;
3239} __packed;
3240
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +05303241struct afe_custom_tdm_header_config_command {
3242 struct apr_hdr hdr;
3243 struct afe_port_cmd_set_param_v2 param;
3244 struct afe_port_param_data_v2 pdata;
3245 struct afe_param_id_custom_tdm_header_cfg custom_tdm_header;
3246} __packed;
3247
3248struct afe_tdm_port_config {
3249 struct afe_param_id_tdm_cfg tdm;
3250 struct afe_param_id_slot_mapping_cfg slot_mapping;
Cong Tang76c7e642019-02-26 15:08:55 +08003251 struct afe_param_id_slot_mapping_cfg_v2 slot_mapping_v2;
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +05303252 struct afe_param_id_custom_tdm_header_cfg custom_tdm_header;
3253} __packed;
3254
3255#define AFE_PARAM_ID_DEVICE_HW_DELAY 0x00010243
3256#define AFE_API_VERSION_DEVICE_HW_DELAY 0x1
3257
3258struct afe_param_id_device_hw_delay_cfg {
3259 uint32_t device_hw_delay_minor_version;
3260 uint32_t delay_in_us;
3261} __packed;
3262
3263#define AFE_PARAM_ID_SET_TOPOLOGY 0x0001025A
3264#define AFE_API_VERSION_TOPOLOGY_V1 0x1
3265
3266struct afe_param_id_set_topology_cfg {
3267 /*
3268 * Minor version used for tracking afe topology id configuration.
3269 * @values #AFE_API_VERSION_TOPOLOGY_V1
3270 */
3271 u32 minor_version;
3272 /*
3273 * Id of the topology for the afe session.
3274 * @values Any valid AFE topology ID
3275 */
3276 u32 topology_id;
3277} __packed;
3278
Aniket Kumar Lataf8664712018-02-22 14:46:09 -08003279#define MAX_ABR_LEVELS 5
3280
3281struct afe_bit_rate_level_map_t {
3282 /*
3283 * Key value pair for link quality level to bitrate
3284 * mapping in AFE
3285 */
3286 uint32_t link_quality_level;
3287 uint32_t bitrate;
3288} __packed;
3289
3290struct afe_quality_level_to_bitrate_info {
3291 /*
3292 * Number of quality levels being mapped.
3293 * This will be equal to the size of mapping table.
3294 */
3295 uint32_t num_levels;
3296 /*
3297 * Quality level to bitrate mapping table
3298 */
3299 struct afe_bit_rate_level_map_t bit_rate_level_map[MAX_ABR_LEVELS];
3300} __packed;
3301
3302struct afe_imc_dec_enc_info {
3303 /*
3304 * Decoder to encoder communication direction.
3305 * Transmit = 0 / Receive = 1
3306 */
3307 uint32_t direction;
3308 /*
3309 * Enable / disable IMC between decoder and encoder
3310 */
3311 uint32_t enable;
3312 /*
3313 * Purpose of IMC being set up between decoder and encoder.
3314 * Param ID defined for link quality feedback in LPASS will
3315 * be the default value sent as purpose.
3316 * Supported values:
3317 * AFE_ENCDEC_PURPOSE_ID_BT_INFO
3318 */
3319 uint32_t purpose;
3320 /*
3321 * Unique communication instance ID.
3322 * Data type a2dp_abr_instance used to set instance ID.
3323 * purpose and comm_instance together form the actual key
3324 * used in IMC registration, which must be the same for
3325 * encoder and decoder for which IMC is being set up.
3326 */
3327 uint32_t comm_instance;
3328} __packed;
3329
3330struct afe_abr_dec_cfg_t {
3331 struct afe_imc_dec_enc_info imc_info;
3332} __packed;
3333
3334struct afe_abr_enc_cfg_t {
3335 /*
3336 * Link quality level to bitrate mapping info sent to DSP.
3337 */
3338 struct afe_quality_level_to_bitrate_info mapping_info;
3339 /*
3340 * Information to set up IMC between decoder and encoder.
3341 */
3342 struct afe_imc_dec_enc_info imc_info;
3343} __packed;
3344
Preetam Singh Ranawat899b78b2017-09-07 12:36:06 -07003345#define AFE_PARAM_ID_APTX_SYNC_MODE 0x00013205
3346
3347struct afe_param_id_aptx_sync_mode {
3348 /*
3349 * sync mode: 0x0 = stereo sync mode (default)
3350 * 0x01 = dual mono sync mode
3351 * 0x02 = dual mono with no sync on either L or R
3352 */
3353 uint32_t sync_mode;
3354} __packed;
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +05303355
3356/*
3357 * Generic encoder module ID.
3358 * This module supports the following parameter IDs:
3359 * #AVS_ENCODER_PARAM_ID_ENC_FMT_ID (cannot be set run time)
3360 * #AVS_ENCODER_PARAM_ID_ENC_CFG_BLK (may be set run time)
3361 * #AVS_ENCODER_PARAM_ID_ENC_BITRATE (may be set run time)
3362 * #AVS_ENCODER_PARAM_ID_PACKETIZER_ID (cannot be set run time)
3363 * Opcode - AVS_MODULE_ID_ENCODER
3364 * AFE Command AFE_PORT_CMD_SET_PARAM_V2 supports this module ID.
3365 */
3366#define AFE_MODULE_ID_ENCODER 0x00013229
3367
3368/* Macro for defining the packetizer ID: COP. */
3369#define AFE_MODULE_ID_PACKETIZER_COP 0x0001322A
3370
3371/*
3372 * Packetizer type parameter for the #AVS_MODULE_ID_ENCODER module.
3373 * This parameter cannot be set runtime.
3374 */
3375#define AFE_ENCODER_PARAM_ID_PACKETIZER_ID 0x0001322E
3376
3377/*
3378 * Encoder config block parameter for the #AVS_MODULE_ID_ENCODER module.
3379 * This parameter may be set runtime.
3380 */
3381#define AFE_ENCODER_PARAM_ID_ENC_CFG_BLK 0x0001322C
3382
3383/*
3384 * Encoder format ID parameter for the #AVS_MODULE_ID_ENCODER module.
3385 * This parameter cannot be set runtime.
3386 */
3387#define AFE_ENCODER_PARAM_ID_ENC_FMT_ID 0x0001322B
3388
3389/*
Preetam Singh Ranawatf746a872017-10-20 18:13:14 +05303390 * Encoder scrambler parameter for the #AVS_MODULE_ID_ENCODER module.
3391 * This parameter cannot be set runtime.
3392 */
3393#define AFE_ENCODER_PARAM_ID_ENABLE_SCRAMBLING 0x0001323C
3394
3395/*
Aniket Kumar Lataf8664712018-02-22 14:46:09 -08003396 * Link quality level to bitrate mapping info sent to AFE Encoder.
3397 * This parameter may be set runtime.
3398 */
3399#define AFE_ENCODER_PARAM_ID_BIT_RATE_LEVEL_MAP 0x000132E1
3400
3401/*
3402 * Parameter to set up Inter Module Communication (IMC) between
3403 * AFE Decoder and Encoder.
3404 * This parameter may be set runtime.
3405 */
3406#define AFE_ENCDEC_PARAM_ID_DEC_TO_ENC_COMMUNICATION 0x0001323D
3407
3408/*
3409 * Purpose of IMC set up between encoder and decoder.
3410 * Communication instance and purpose together form the
3411 * actual key used for IMC registration.
3412 */
3413#define AFE_ENCDEC_PURPOSE_ID_BT_INFO 0x000132E2
3414
3415#define AFE_MODULE_ID_DECODER 0x00013231
3416
3417/*
3418 * Macro for defining the depacketizer ID: COP.
3419 */
3420#define AFE_MODULE_ID_DEPACKETIZER_COP 0x00013233
3421
3422/*
3423 * Depacketizer type parameter for the #AVS_MODULE_ID_DECODER module.
3424 * This parameter cannot be set runtime.
3425 */
3426#define AFE_DECODER_PARAM_ID_DEPACKETIZER_ID 0x00013235
3427
Manisha Agarwal472fc1e2018-11-04 15:46:02 +05303428#define CAPI_V2_PARAM_ID_APTX_ENC_SWITCH_TO_MONO 0x0001332A
3429
3430struct aptx_channel_mode_param_t {
3431 struct apr_hdr hdr;
3432 struct afe_port_cmd_set_param_v2 param;
3433 struct afe_port_param_data_v2 pdata;
3434 u32 channel_mode;
3435} __packed;
Aniket Kumar Lataf8664712018-02-22 14:46:09 -08003436/*
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +05303437 * Data format to send compressed data
3438 * is transmitted/received over Slimbus lines.
3439 */
3440#define AFE_SB_DATA_FORMAT_GENERIC_COMPRESSED 0x3
3441
3442/*
3443 * ID for AFE port module. This will be used to define port properties.
3444 * This module supports following parameter IDs:
3445 * #AFE_PARAM_ID_PORT_MEDIA_TYPE
3446 * To configure the port property, the client must use the
3447 * #AFE_PORT_CMD_SET_PARAM_V2 command,
3448 * and fill the module ID with the respective parameter IDs as listed above.
3449 * @apr_hdr_fields
3450 * Opcode -- AFE_MODULE_PORT
3451 */
3452#define AFE_MODULE_PORT 0x000102a6
3453
3454/*
3455 * ID of the parameter used by #AFE_MODULE_PORT to set the port media type.
3456 * parameter ID is currently supported using#AFE_PORT_CMD_SET_PARAM_V2 command.
3457 */
3458#define AFE_PARAM_ID_PORT_MEDIA_TYPE 0x000102a7
3459
3460/*
3461 * Macros for defining the "data_format" field in the
3462 * #AFE_PARAM_ID_PORT_MEDIA_TYPE
3463 */
3464#define AFE_PORT_DATA_FORMAT_PCM 0x0
3465#define AFE_PORT_DATA_FORMAT_GENERIC_COMPRESSED 0x1
3466
3467/*
3468 * Macro for defining the "minor_version" field in the
3469 * #AFE_PARAM_ID_PORT_MEDIA_TYPE
3470 */
3471#define AFE_API_VERSION_PORT_MEDIA_TYPE 0x1
3472
3473#define ASM_MEDIA_FMT_NONE 0x0
3474
3475/*
3476 * Media format ID for SBC encode configuration.
3477 * @par SBC encode configuration (asm_sbc_enc_cfg_t)
3478 * @table{weak__asm__sbc__enc__cfg__t}
3479 */
3480#define ASM_MEDIA_FMT_SBC 0x00010BF2
3481
3482/* SBC channel Mono mode.*/
3483#define ASM_MEDIA_FMT_SBC_CHANNEL_MODE_MONO 1
3484
3485/* SBC channel Stereo mode. */
3486#define ASM_MEDIA_FMT_SBC_CHANNEL_MODE_STEREO 2
3487
3488/* SBC channel Dual Mono mode. */
3489#define ASM_MEDIA_FMT_SBC_CHANNEL_MODE_DUAL_MONO 8
3490
3491/* SBC channel Joint Stereo mode. */
3492#define ASM_MEDIA_FMT_SBC_CHANNEL_MODE_JOINT_STEREO 9
3493
3494/* SBC bit allocation method = loudness. */
3495#define ASM_MEDIA_FMT_SBC_ALLOCATION_METHOD_LOUDNESS 0
3496
3497/* SBC bit allocation method = SNR. */
3498#define ASM_MEDIA_FMT_SBC_ALLOCATION_METHOD_SNR 1
3499
3500
3501/*
3502 * Payload of the SBC encoder configuration parameters in the
3503 * #ASM_MEDIA_FMT_SBC media format.
3504 */
3505struct asm_sbc_enc_cfg_t {
3506 /*
3507 * Number of subbands.
3508 * @values 4, 8
3509 */
3510 uint32_t num_subbands;
3511
3512 /*
3513 * Size of the encoded block in samples.
3514 * @values 4, 8, 12, 16
3515 */
3516 uint32_t blk_len;
3517
3518 /*
3519 * Mode used to allocate bits between channels.
3520 * @values
3521 * 0 (Native mode)
3522 * #ASM_MEDIA_FMT_SBC_CHANNEL_MODE_MONO
3523 * #ASM_MEDIA_FMT_SBC_CHANNEL_MODE_STEREO
3524 * #ASM_MEDIA_FMT_SBC_CHANNEL_MODE_DUAL_MONO
3525 * #ASM_MEDIA_FMT_SBC_CHANNEL_MODE_JOINT_STEREO
3526 * Native mode indicates that encoding must be performed with the number
3527 * of channels at the input.
3528 * If postprocessing outputs one-channel data, Mono mode is used. If
3529 * postprocessing outputs two-channel data, Stereo mode is used.
3530 * The number of channels must not change during encoding.
3531 */
3532 uint32_t channel_mode;
3533
3534 /*
3535 * Encoder bit allocation method.
3536 * @values
3537 * #ASM_MEDIA_FMT_SBC_ALLOCATION_METHOD_LOUDNESS
3538 * #ASM_MEDIA_FMT_SBC_ALLOCATION_METHOD_SNR @tablebulletend
3539 */
3540 uint32_t alloc_method;
3541
3542 /*
3543 * Number of encoded bits per second.
3544 * @values
3545 * Mono channel -- Maximum of 320 kbps
3546 * Stereo channel -- Maximum of 512 kbps @tablebulletend
3547 */
3548 uint32_t bit_rate;
3549
3550 /*
3551 * Number of samples per second.
3552 * @values 0 (Native mode), 16000, 32000, 44100, 48000&nbsp;Hz
3553 * Native mode indicates that encoding must be performed with the
3554 * sampling rate at the input.
3555 * The sampling rate must not change during encoding.
3556 */
3557 uint32_t sample_rate;
3558};
3559
3560#define ASM_MEDIA_FMT_AAC_AOT_LC 2
3561#define ASM_MEDIA_FMT_AAC_AOT_SBR 5
3562#define ASM_MEDIA_FMT_AAC_AOT_PS 29
3563#define ASM_MEDIA_FMT_AAC_FORMAT_FLAG_ADTS 0
3564#define ASM_MEDIA_FMT_AAC_FORMAT_FLAG_RAW 3
3565
3566struct asm_aac_enc_cfg_v2_t {
3567
3568 /* Encoding rate in bits per second.*/
3569 uint32_t bit_rate;
3570
3571 /*
3572 * Encoding mode.
3573 * Supported values:
3574 * #ASM_MEDIA_FMT_AAC_AOT_LC
3575 * #ASM_MEDIA_FMT_AAC_AOT_SBR
3576 * #ASM_MEDIA_FMT_AAC_AOT_PS
3577 */
3578 uint32_t enc_mode;
3579
3580 /*
3581 * AAC format flag.
3582 * Supported values:
3583 * #ASM_MEDIA_FMT_AAC_FORMAT_FLAG_ADTS
3584 * #ASM_MEDIA_FMT_AAC_FORMAT_FLAG_RAW
3585 */
3586 uint16_t aac_fmt_flag;
3587
3588 /*
3589 * Number of channels to encode.
3590 * Supported values:
3591 * 0 - Native mode
3592 * 1 - Mono
3593 * 2 - Stereo
3594 * Other values are not supported.
3595 * @note1hang The eAAC+ encoder mode supports only stereo.
3596 * Native mode indicates that encoding must be performed with the
3597 * number of channels at the input.
3598 * The number of channels must not change during encoding.
3599 */
3600 uint16_t channel_cfg;
3601
3602 /*
3603 * Number of samples per second.
3604 * Supported values: - 0 -- Native mode - For other values,
3605 * Native mode indicates that encoding must be performed with the
3606 * sampling rate at the input.
3607 * The sampling rate must not change during encoding.
3608 */
3609 uint32_t sample_rate;
3610} __packed;
3611
3612/* FMT ID for apt-X Classic */
3613#define ASM_MEDIA_FMT_APTX 0x000131ff
3614
3615/* FMT ID for apt-X HD */
3616#define ASM_MEDIA_FMT_APTX_HD 0x00013200
3617
3618#define PCM_CHANNEL_L 1
3619#define PCM_CHANNEL_R 2
3620#define PCM_CHANNEL_C 3
3621
Preetam Singh Ranawat54028492017-09-04 11:42:26 +05303622struct asm_custom_enc_cfg_t {
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +05303623 uint32_t sample_rate;
3624 /* Mono or stereo */
3625 uint16_t num_channels;
3626 uint16_t reserved;
3627 /* num_ch == 1, then PCM_CHANNEL_C,
3628 * num_ch == 2, then {PCM_CHANNEL_L, PCM_CHANNEL_R}
3629 */
3630 uint8_t channel_mapping[8];
3631 uint32_t custom_size;
3632} __packed;
Preetam Singh Ranawat899b78b2017-09-07 12:36:06 -07003633
3634struct asm_aptx_v2_enc_cfg_ext_t {
3635 /*
3636 * sync mode: 0x0 = stereo sync mode (default)
3637 * 0x01 = dual mono sync mode
3638 * 0x02 = dual mono with no sync on either L or R
3639 */
3640 uint32_t sync_mode;
3641} __packed;
3642
3643struct asm_aptx_enc_cfg_t {
3644 struct asm_custom_enc_cfg_t custom_cfg;
3645 struct asm_aptx_v2_enc_cfg_ext_t aptx_v2_cfg;
3646} __packed;
3647
Preetam Singh Ranawat54028492017-09-04 11:42:26 +05303648#define ASM_MEDIA_FMT_CELT 0x00013221
3649struct asm_celt_specific_enc_cfg_t {
3650 /*
3651 * Bit rate used for encoding.
3652 * This is used to calculate the upper threshold
3653 * for bytes per frame if vbr_flag is 1.
3654 * Or else, this will be used as a regular constant
3655 * bit rate for encoder output.
3656 * @Range : 32000 to 1536000
3657 * @Default: 128
3658 */
3659 uint32_t bit_rate;
3660 /*
3661 * Frame size used for encoding.
3662 * @Range : 64, 128, 256, 512
3663 * @Default: 256
3664 */
3665 uint16_t frame_size;
3666 /*
3667 * complexity of algorithm.
3668 * @Range : 0-10
3669 * @Default: 3
3670 */
3671 uint16_t complexity;
3672 /*
3673 * Switch variable for prediction feature.
3674 * Used to choose between the level of interframe
3675 * predictions allowed while encoding.
3676 * @Range:
3677 * 0: Independent Frames.
3678 * 1: Short Term interframe prediction allowed.
3679 * 2: Long term prediction allowed.
3680 * @Default: 2
3681 */
3682 uint16_t prediction_mode;
3683 /*
3684 * Variable Bit Rate flag.
3685 * @Default: 0
3686 */
3687 uint16_t vbr_flag;
3688} __packed;
3689
3690struct asm_celt_enc_cfg_t {
3691 struct asm_custom_enc_cfg_t custom_config;
3692 struct asm_celt_specific_enc_cfg_t celt_specific_config;
3693} __packed;
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +05303694
Preetam Singh Ranawat0a087af2017-10-25 15:02:28 +05303695#define ASM_MEDIA_FMT_LDAC 0x00013224
3696struct asm_ldac_specific_enc_cfg_t {
3697 /*
3698 * This is used to calculate the encoder output
3699 * bytes per frame (i.e. bytes per packet).
3700 * Bit rate also configures the EQMID.
3701 * The min bit rate 303000 bps is calculated for
3702 * 44.1 kHz and 88.2 KHz sampling frequencies with
3703 * Mobile use Quality.
3704 * The max bit rate of 990000 bps is calculated for
3705 * 96kHz and 48 KHz with High Quality
3706 * @Range(in bits per second)
3707 * 303000 for Mobile use Quality
3708 * 606000 for standard Quality
3709 * 909000 for High Quality
3710 */
3711 uint32_t bit_rate;
3712 /*
3713 * The channel setting information for LDAC specification
3714 * of Bluetooth A2DP which is determined by SRC and SNK
3715 * devices in Bluetooth transmission.
3716 * @Range:
3717 * 0 for native mode
3718 * 4 for mono
3719 * 2 for dual channel
3720 * 1 for stereo
3721 */
3722 uint16_t channel_mode;
3723 /*
3724 * Maximum Transmission Unit (MTU).
3725 * The minimum MTU that a L2CAP implementation for LDAC shall
3726 * support is 679 bytes, because LDAC is optimized with 2-DH5
3727 * packet as its target.
3728 * @Range : 679
3729 * @Default: 679 for LDACBT_MTU_2DH5
3730 */
3731 uint16_t mtu;
3732} __packed;
3733
3734struct asm_ldac_enc_cfg_t {
3735 struct asm_custom_enc_cfg_t custom_config;
3736 struct asm_ldac_specific_enc_cfg_t ldac_specific_config;
Aniket Kumar Lataf8664712018-02-22 14:46:09 -08003737 struct afe_abr_enc_cfg_t abr_config;
Preetam Singh Ranawat0a087af2017-10-25 15:02:28 +05303738} __packed;
3739
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +05303740struct afe_enc_fmt_id_param_t {
3741 /*
3742 * Supported values:
3743 * #ASM_MEDIA_FMT_SBC
3744 * #ASM_MEDIA_FMT_AAC_V2
3745 * Any OpenDSP supported values
3746 */
3747 uint32_t fmt_id;
3748} __packed;
3749
3750struct afe_port_media_type_t {
3751 /*
3752 * Minor version
3753 * @values #AFE_API_VERSION_PORT_MEDIA_TYPE.
3754 */
3755 uint32_t minor_version;
3756
3757 /*
3758 * Sampling rate of the port.
3759 * @values
3760 * #AFE_PORT_SAMPLE_RATE_8K
3761 * #AFE_PORT_SAMPLE_RATE_11_025K
3762 * #AFE_PORT_SAMPLE_RATE_12K
3763 * #AFE_PORT_SAMPLE_RATE_16K
3764 * #AFE_PORT_SAMPLE_RATE_22_05K
3765 * #AFE_PORT_SAMPLE_RATE_24K
3766 * #AFE_PORT_SAMPLE_RATE_32K
3767 * #AFE_PORT_SAMPLE_RATE_44_1K
3768 * #AFE_PORT_SAMPLE_RATE_48K
3769 * #AFE_PORT_SAMPLE_RATE_88_2K
3770 * #AFE_PORT_SAMPLE_RATE_96K
3771 * #AFE_PORT_SAMPLE_RATE_176_4K
3772 * #AFE_PORT_SAMPLE_RATE_192K
3773 * #AFE_PORT_SAMPLE_RATE_352_8K
3774 * #AFE_PORT_SAMPLE_RATE_384K
3775 */
3776 uint32_t sample_rate;
3777
3778 /*
3779 * Bit width of the sample.
3780 * @values 16, 24
3781 */
3782 uint16_t bit_width;
3783
3784 /*
3785 * Number of channels.
3786 * @values 1 to #AFE_PORT_MAX_AUDIO_CHAN_CNT
3787 */
3788 uint16_t num_channels;
3789
3790 /*
3791 * Data format supported by this port.
3792 * If the port media type and device media type are different,
3793 * it signifies a encoding/decoding use case
3794 * @values
3795 * #AFE_PORT_DATA_FORMAT_PCM
3796 * #AFE_PORT_DATA_FORMAT_GENERIC_COMPRESSED
3797 */
3798 uint16_t data_format;
3799
3800 /*This field must be set to zero.*/
3801 uint16_t reserved;
3802} __packed;
3803
3804union afe_enc_config_data {
3805 struct asm_sbc_enc_cfg_t sbc_config;
3806 struct asm_aac_enc_cfg_v2_t aac_config;
Preetam Singh Ranawat54028492017-09-04 11:42:26 +05303807 struct asm_custom_enc_cfg_t custom_config;
3808 struct asm_celt_enc_cfg_t celt_config;
Preetam Singh Ranawat899b78b2017-09-07 12:36:06 -07003809 struct asm_aptx_enc_cfg_t aptx_config;
Preetam Singh Ranawat0a087af2017-10-25 15:02:28 +05303810 struct asm_ldac_enc_cfg_t ldac_config;
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +05303811};
3812
3813struct afe_enc_config {
3814 u32 format;
Preetam Singh Ranawatf746a872017-10-20 18:13:14 +05303815 u32 scrambler_mode;
Manisha Agarwal472fc1e2018-11-04 15:46:02 +05303816 u32 mono_mode;
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +05303817 union afe_enc_config_data data;
3818};
3819
Aniket Kumar Lataf8664712018-02-22 14:46:09 -08003820struct afe_dec_config {
3821 u32 format;
3822 struct afe_abr_dec_cfg_t abr_dec_cfg;
3823};
3824
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +05303825struct afe_enc_cfg_blk_param_t {
3826 uint32_t enc_cfg_blk_size;
3827 /*
3828 *Size of the encoder configuration block that follows this member
3829 */
3830 union afe_enc_config_data enc_blk_config;
3831};
3832
3833/*
3834 * Payload of the AVS_ENCODER_PARAM_ID_PACKETIZER_ID parameter.
3835 */
3836struct avs_enc_packetizer_id_param_t {
3837 /*
3838 * Supported values:
3839 * #AVS_MODULE_ID_PACKETIZER_COP
3840 * Any OpenDSP supported values
3841 */
3842 uint32_t enc_packetizer_id;
3843};
3844
Preetam Singh Ranawatf746a872017-10-20 18:13:14 +05303845/*
3846 * Payload of the AVS_ENCODER_PARAM_ID_ENABLE_SCRAMBLING parameter.
3847 */
3848struct avs_enc_set_scrambler_param_t {
3849 /*
3850 * Supported values:
3851 * 1 : enable scrambler
3852 * 0 : disable scrambler
3853 */
3854 uint32_t enable_scrambler;
3855};
3856
Aniket Kumar Lataf8664712018-02-22 14:46:09 -08003857/*
Manisha Agarwal472fc1e2018-11-04 15:46:02 +05303858 * Payload of the CAPI_V2_PARAM_ID_APTX_ENC_SWITCH_TO_MONO parameter.
3859 */
3860struct afe_enc_set_channel_mode_param_t {
3861 /*
3862 * Supported values:
3863 * 1 : mono
3864 * 2 : dual_mono
3865 */
3866 u32 channel_mode;
3867};
3868
3869/*
Aniket Kumar Lataf8664712018-02-22 14:46:09 -08003870 * Payload of the AVS_ENCODER_PARAM_ID_BIT_RATE_LEVEL_MAP parameter.
3871 */
3872struct afe_enc_level_to_bitrate_map_param_t {
3873 /*
3874 * Parameter for mapping link quality level to bitrate.
3875 */
3876 struct afe_quality_level_to_bitrate_info mapping_table;
3877};
3878
3879/*
3880 * Payload of the AVS_ENCDEC_PARAM_ID_DEC_TO_ENC_COMMUNICATION parameter.
3881 */
3882struct afe_enc_dec_imc_info_param_t {
3883 /*
3884 * Parameter to set up Inter Module Communication (IMC) between
3885 * AFE Decoder and Encoder.
3886 */
3887 struct afe_imc_dec_enc_info imc_info;
3888};
3889
3890/*
3891 * Payload of the AVS_DECODER_PARAM_ID_DEPACKETIZER_ID parameter.
3892 */
3893struct avs_dec_depacketizer_id_param_t {
3894 /*
3895 * Supported values:
3896 * #AVS_MODULE_ID_DEPACKETIZER_COP
3897 * Any OpenDSP supported values
3898 */
3899 uint32_t dec_depacketizer_id;
3900};
3901
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +05303902union afe_port_config {
3903 struct afe_param_id_pcm_cfg pcm;
3904 struct afe_param_id_i2s_cfg i2s;
3905 struct afe_param_id_hdmi_multi_chan_audio_cfg hdmi_multi_ch;
3906 struct afe_param_id_slimbus_cfg slim_sch;
3907 struct afe_param_id_rt_proxy_port_cfg rtproxy;
3908 struct afe_param_id_internal_bt_fm_cfg int_bt_fm;
3909 struct afe_param_id_pseudo_port_cfg pseudo_port;
3910 struct afe_param_id_device_hw_delay_cfg hw_delay;
3911 struct afe_param_id_spdif_cfg spdif;
3912 struct afe_param_id_set_topology_cfg topology;
3913 struct afe_param_id_tdm_cfg tdm;
3914 struct afe_param_id_usb_audio_cfg usb_audio;
Preetam Singh Ranawat899b78b2017-09-07 12:36:06 -07003915 struct afe_param_id_aptx_sync_mode sync_mode_param;
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +05303916 struct afe_enc_fmt_id_param_t enc_fmt;
3917 struct afe_port_media_type_t media_type;
3918 struct afe_enc_cfg_blk_param_t enc_blk_param;
3919 struct avs_enc_packetizer_id_param_t enc_pkt_id_param;
Preetam Singh Ranawatf746a872017-10-20 18:13:14 +05303920 struct avs_enc_set_scrambler_param_t enc_set_scrambler_param;
Aniket Kumar Lataf8664712018-02-22 14:46:09 -08003921 struct avs_dec_depacketizer_id_param_t dec_depkt_id_param;
3922 struct afe_enc_level_to_bitrate_map_param_t map_param;
3923 struct afe_enc_dec_imc_info_param_t imc_info_param;
Manisha Agarwal472fc1e2018-11-04 15:46:02 +05303924 struct afe_enc_set_channel_mode_param_t channel_mode_param;
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +05303925} __packed;
3926
3927struct afe_audioif_config_command_no_payload {
3928 struct apr_hdr hdr;
3929 struct afe_port_cmd_set_param_v2 param;
3930} __packed;
3931
3932struct afe_audioif_config_command {
3933 struct apr_hdr hdr;
3934 struct afe_port_cmd_set_param_v2 param;
3935 struct afe_port_param_data_v2 pdata;
3936 union afe_port_config port;
3937} __packed;
3938
3939#define AFE_PORT_CMD_DEVICE_START 0x000100E5
3940
3941/* Payload of the #AFE_PORT_CMD_DEVICE_START.*/
3942struct afe_port_cmd_device_start {
3943 struct apr_hdr hdr;
3944 u16 port_id;
3945/* Port interface and direction (Rx or Tx) to start. An even
3946 * number represents the Rx direction, and an odd number represents
3947 * the Tx direction.
3948 */
3949
3950
3951 u16 reserved;
3952/* Reserved for 32-bit alignment. This field must be set to 0.*/
3953
3954} __packed;
3955
3956#define AFE_PORT_CMD_DEVICE_STOP 0x000100E6
3957
3958/* Payload of the #AFE_PORT_CMD_DEVICE_STOP. */
3959struct afe_port_cmd_device_stop {
3960 struct apr_hdr hdr;
3961 u16 port_id;
3962/* Port interface and direction (Rx or Tx) to start. An even
3963 * number represents the Rx direction, and an odd number represents
3964 * the Tx direction.
3965 */
3966
3967 u16 reserved;
3968/* Reserved for 32-bit alignment. This field must be set to 0.*/
3969} __packed;
3970
3971#define AFE_SERVICE_CMD_SHARED_MEM_MAP_REGIONS 0x000100EA
3972
3973/* Memory map regions command payload used by the
3974 * #AFE_SERVICE_CMD_SHARED_MEM_MAP_REGIONS .
3975 * This structure allows clients to map multiple shared memory
3976 * regions in a single command. Following this structure are
3977 * num_regions of afe_service_shared_map_region_payload.
3978 */
3979struct afe_service_cmd_shared_mem_map_regions {
3980 struct apr_hdr hdr;
3981u16 mem_pool_id;
3982/* Type of memory on which this memory region is mapped.
3983 * Supported values:
3984 * - #ADSP_MEMORY_MAP_EBI_POOL
3985 * - #ADSP_MEMORY_MAP_SMI_POOL
3986 * - #ADSP_MEMORY_MAP_SHMEM8_4K_POOL
3987 * - Other values are reserved
3988 *
3989 * The memory pool ID implicitly defines the characteristics of the
3990 * memory. Characteristics may include alignment type, permissions,
3991 * etc.
3992 *
3993 * ADSP_MEMORY_MAP_EBI_POOL is External Buffer Interface type memory
3994 * ADSP_MEMORY_MAP_SMI_POOL is Shared Memory Interface type memory
3995 * ADSP_MEMORY_MAP_SHMEM8_4K_POOL is shared memory, byte
3996 * addressable, and 4 KB aligned.
3997 */
3998
3999
4000 u16 num_regions;
4001/* Number of regions to map.
4002 * Supported values:
4003 * - Any value greater than zero
4004 */
4005
4006 u32 property_flag;
4007/* Configures one common property for all the regions in the
4008 * payload.
4009 *
4010 * Supported values: - 0x00000000 to 0x00000001
4011 *
4012 * b0 - bit 0 indicates physical or virtual mapping 0 Shared memory
4013 * address provided in afe_service_shared_map_region_payloadis a
4014 * physical address. The shared memory needs to be mapped( hardware
4015 * TLB entry) and a software entry needs to be added for internal
4016 * book keeping.
4017 *
4018 * 1 Shared memory address provided in
4019 * afe_service_shared_map_region_payloadis a virtual address. The
4020 * shared memory must not be mapped (since hardware TLB entry is
4021 * already available) but a software entry needs to be added for
4022 * internal book keeping. This can be useful if two services with in
4023 * ADSP is communicating via APR. They can now directly communicate
4024 * via the Virtual address instead of Physical address. The virtual
4025 * regions must be contiguous. num_regions must be 1 in this case.
4026 *
4027 * b31-b1 - reserved bits. must be set to zero
4028 */
4029
4030
4031} __packed;
4032/* Map region payload used by the
4033 * afe_service_shared_map_region_payloadstructure.
4034 */
4035struct afe_service_shared_map_region_payload {
4036 u32 shm_addr_lsw;
4037/* least significant word of starting address in the memory
4038 * region to map. It must be contiguous memory, and it must be 4 KB
4039 * aligned.
4040 * Supported values: - Any 32 bit value
4041 */
4042
4043
4044 u32 shm_addr_msw;
4045/* most significant word of startng address in the memory region
4046 * to map. For 32 bit shared memory address, this field must be set
4047 * to zero. For 36 bit shared memory address, bit31 to bit 4 must be
4048 * set to zero
4049 *
4050 * Supported values: - For 32 bit shared memory address, this field
4051 * must be set to zero. - For 36 bit shared memory address, bit31 to
4052 * bit 4 must be set to zero - For 64 bit shared memory address, any
4053 * 32 bit value
4054 */
4055
4056
4057 u32 mem_size_bytes;
4058/* Number of bytes in the region. The aDSP will always map the
4059 * regions as virtual contiguous memory, but the memory size must be
4060 * in multiples of 4 KB to avoid gaps in the virtually contiguous
4061 * mapped memory.
4062 *
4063 * Supported values: - multiples of 4KB
4064 */
4065
4066} __packed;
4067
4068#define AFE_SERVICE_CMDRSP_SHARED_MEM_MAP_REGIONS 0x000100EB
4069struct afe_service_cmdrsp_shared_mem_map_regions {
4070 u32 mem_map_handle;
4071/* A memory map handle encapsulating shared memory attributes is
4072 * returned iff AFE_SERVICE_CMD_SHARED_MEM_MAP_REGIONS command is
4073 * successful. In the case of failure , a generic APR error response
4074 * is returned to the client.
4075 *
4076 * Supported Values: - Any 32 bit value
4077 */
4078
4079} __packed;
4080#define AFE_SERVICE_CMD_SHARED_MEM_UNMAP_REGIONS 0x000100EC
4081/* Memory unmap regions command payload used by the
4082 * #AFE_SERVICE_CMD_SHARED_MEM_UNMAP_REGIONS
4083 *
4084 * This structure allows clients to unmap multiple shared memory
4085 * regions in a single command.
4086 */
4087
4088
4089struct afe_service_cmd_shared_mem_unmap_regions {
4090 struct apr_hdr hdr;
4091u32 mem_map_handle;
4092/* memory map handle returned by
4093 * AFE_SERVICE_CMD_SHARED_MEM_MAP_REGIONS commands
4094 *
4095 * Supported Values:
4096 * - Any 32 bit value
4097 */
4098} __packed;
4099
4100#define AFE_PORT_CMD_GET_PARAM_V2 0x000100F0
4101
4102/* Payload of the #AFE_PORT_CMD_GET_PARAM_V2 command,
4103 * which queries for one post/preprocessing parameter of a
4104 * stream.
4105 */
4106struct afe_port_cmd_get_param_v2 {
4107 u16 port_id;
4108/* Port interface and direction (Rx or Tx) to start. */
4109
4110 u16 payload_size;
4111/* Maximum data size of the parameter ID/module ID combination.
4112 * This is a multiple of four bytes
4113 * Supported values: > 0
4114 */
4115
4116 u32 payload_address_lsw;
4117/* LSW of 64 bit Payload address. Address should be 32-byte,
4118 * 4kbyte aligned and must be contig memory.
4119 */
4120
4121
4122 u32 payload_address_msw;
4123/* MSW of 64 bit Payload address. In case of 32-bit shared
4124 * memory address, this field must be set to zero. In case of 36-bit
4125 * shared memory address, bit-4 to bit-31 must be set to zero.
4126 * Address should be 32-byte, 4kbyte aligned and must be contiguous
4127 * memory.
4128 */
4129
4130 u32 mem_map_handle;
4131/* Memory map handle returned by
4132 * AFE_SERVICE_CMD_SHARED_MEM_MAP_REGIONS commands.
4133 * Supported Values: - NULL -- Message. The parameter data is
4134 * in-band. - Non-NULL -- The parameter data is Out-band.Pointer to
4135 * - the physical address in shared memory of the payload data.
4136 * For detailed payload content, see the afe_port_param_data_v2
4137 * structure
4138 */
4139
4140
4141 u32 module_id;
4142/* ID of the module to be queried.
4143 * Supported values: Valid module ID
4144 */
4145
4146 u32 param_id;
4147/* ID of the parameter to be queried.
4148 * Supported values: Valid parameter ID
4149 */
4150} __packed;
4151
4152#define AFE_PORT_CMDRSP_GET_PARAM_V2 0x00010106
4153
4154/* Payload of the #AFE_PORT_CMDRSP_GET_PARAM_V2 message, which
4155 * responds to an #AFE_PORT_CMD_GET_PARAM_V2 command.
4156 *
4157 * Immediately following this structure is the parameters structure
4158 * (afe_port_param_data) containing the response(acknowledgment)
4159 * parameter payload. This payload is included for an in-band
4160 * scenario. For an address/shared memory-based set parameter, this
4161 * payload is not needed.
4162 */
4163
4164
4165struct afe_port_cmdrsp_get_param_v2 {
4166 u32 status;
4167} __packed;
4168
4169#define AFE_PARAM_ID_LPASS_CORE_SHARED_CLOCK_CONFIG 0x0001028C
4170#define AFE_API_VERSION_LPASS_CORE_SHARED_CLK_CONFIG 0x1
4171
4172/* Payload of the AFE_PARAM_ID_LPASS_CORE_SHARED_CLOCK_CONFIG parameter used by
4173 * AFE_MODULE_AUDIO_DEV_INTERFACE.
4174 */
4175struct afe_param_id_lpass_core_shared_clk_cfg {
4176 u32 lpass_core_shared_clk_cfg_minor_version;
4177/*
4178 * Minor version used for lpass core shared clock configuration
4179 * Supported value: AFE_API_VERSION_LPASS_CORE_SHARED_CLK_CONFIG
4180 */
4181 u32 enable;
4182/*
4183 * Specifies whether the lpass core shared clock is
4184 * enabled (1) or disabled (0).
4185 */
4186} __packed;
4187
4188struct afe_lpass_core_shared_clk_config_command {
4189 struct apr_hdr hdr;
4190 struct afe_port_cmd_set_param_v2 param;
4191 struct afe_port_param_data_v2 pdata;
4192 struct afe_param_id_lpass_core_shared_clk_cfg clk_cfg;
4193} __packed;
4194
4195/* adsp_afe_service_commands.h */
4196
4197#define ADSP_MEMORY_MAP_EBI_POOL 0
4198
4199#define ADSP_MEMORY_MAP_SMI_POOL 1
4200#define ADSP_MEMORY_MAP_IMEM_POOL 2
4201#define ADSP_MEMORY_MAP_SHMEM8_4K_POOL 3
4202
4203/* Definition of virtual memory flag */
4204#define ADSP_MEMORY_MAP_VIRTUAL_MEMORY 1
4205
4206/* Definition of physical memory flag */
4207#define ADSP_MEMORY_MAP_PHYSICAL_MEMORY 0
4208
4209#define NULL_POPP_TOPOLOGY 0x00010C68
4210#define NULL_COPP_TOPOLOGY 0x00010312
4211#define DEFAULT_COPP_TOPOLOGY 0x00010314
4212#define DEFAULT_POPP_TOPOLOGY 0x00010BE4
4213#define COMPRESSED_PASSTHROUGH_DEFAULT_TOPOLOGY 0x0001076B
4214#define COMPRESSED_PASSTHROUGH_NONE_TOPOLOGY 0x00010774
Bala Kishore Pati798cbf82018-10-22 11:58:41 +05304215#define VPM_TX_SM_ECNS_COPP_TOPOLOGY 0x00010F71
Laxminath Kasam8f7ccc22017-08-28 17:35:04 +05304216#define VPM_TX_SM_ECNS_V2_COPP_TOPOLOGY 0x00010F89
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +05304217#define VPM_TX_DM_FLUENCE_COPP_TOPOLOGY 0x00010F72
4218#define VPM_TX_QMIC_FLUENCE_COPP_TOPOLOGY 0x00010F75
4219#define VPM_TX_DM_RFECNS_COPP_TOPOLOGY 0x00010F86
4220#define ADM_CMD_COPP_OPEN_TOPOLOGY_ID_DTS_HPX 0x10015002
4221#define ADM_CMD_COPP_OPEN_TOPOLOGY_ID_AUDIOSPHERE 0x10028000
4222
4223/* Memory map regions command payload used by the
4224 * #ASM_CMD_SHARED_MEM_MAP_REGIONS ,#ADM_CMD_SHARED_MEM_MAP_REGIONS
4225 * commands.
4226 *
4227 * This structure allows clients to map multiple shared memory
4228 * regions in a single command. Following this structure are
4229 * num_regions of avs_shared_map_region_payload.
4230 */
4231
4232
4233struct avs_cmd_shared_mem_map_regions {
4234 struct apr_hdr hdr;
4235 u16 mem_pool_id;
4236/* Type of memory on which this memory region is mapped.
4237 *
4238 * Supported values: - #ADSP_MEMORY_MAP_EBI_POOL -
4239 * #ADSP_MEMORY_MAP_SMI_POOL - #ADSP_MEMORY_MAP_IMEM_POOL
4240 * (unsupported) - #ADSP_MEMORY_MAP_SHMEM8_4K_POOL - Other values
4241 * are reserved
4242 *
4243 * The memory ID implicitly defines the characteristics of the
4244 * memory. Characteristics may include alignment type, permissions,
4245 * etc.
4246 *
4247 * SHMEM8_4K is shared memory, byte addressable, and 4 KB aligned.
4248 */
4249
4250
4251 u16 num_regions;
4252 /* Number of regions to map.*/
4253
4254 u32 property_flag;
4255/* Configures one common property for all the regions in the
4256 * payload. No two regions in the same memory map regions cmd can
4257 * have differnt property. Supported values: - 0x00000000 to
4258 * 0x00000001
4259 *
4260 * b0 - bit 0 indicates physical or virtual mapping 0 shared memory
4261 * address provided in avs_shared_map_regions_payload is physical
4262 * address. The shared memory needs to be mapped( hardware TLB
4263 * entry)
4264 *
4265 * and a software entry needs to be added for internal book keeping.
4266 *
4267 * 1 Shared memory address provided in MayPayload[usRegions] is
4268 * virtual address. The shared memory must not be mapped (since
4269 * hardware TLB entry is already available) but a software entry
4270 * needs to be added for internal book keeping. This can be useful
4271 * if two services with in ADSP is communicating via APR. They can
4272 * now directly communicate via the Virtual address instead of
4273 * Physical address. The virtual regions must be contiguous.
4274 *
4275 * b31-b1 - reserved bits. must be set to zero
4276 */
4277
4278} __packed;
4279
4280struct avs_shared_map_region_payload {
4281 u32 shm_addr_lsw;
4282/* least significant word of shared memory address of the memory
4283 * region to map. It must be contiguous memory, and it must be 4 KB
4284 * aligned.
4285 */
4286
4287 u32 shm_addr_msw;
4288/* most significant word of shared memory address of the memory
4289 * region to map. For 32 bit shared memory address, this field must
4290 * tbe set to zero. For 36 bit shared memory address, bit31 to bit 4
4291 * must be set to zero
4292 */
4293
4294 u32 mem_size_bytes;
4295/* Number of bytes in the region.
4296 *
4297 * The aDSP will always map the regions as virtual contiguous
4298 * memory, but the memory size must be in multiples of 4 KB to avoid
4299 * gaps in the virtually contiguous mapped memory.
4300 */
4301
4302} __packed;
4303
4304struct avs_cmd_shared_mem_unmap_regions {
4305 struct apr_hdr hdr;
4306 u32 mem_map_handle;
4307/* memory map handle returned by ASM_CMD_SHARED_MEM_MAP_REGIONS
4308 * , ADM_CMD_SHARED_MEM_MAP_REGIONS, commands
4309 */
4310
4311} __packed;
4312
4313/* Memory map command response payload used by the
4314 * #ASM_CMDRSP_SHARED_MEM_MAP_REGIONS
4315 * ,#ADM_CMDRSP_SHARED_MEM_MAP_REGIONS
4316 */
4317
4318
4319struct avs_cmdrsp_shared_mem_map_regions {
4320 u32 mem_map_handle;
4321/* A memory map handle encapsulating shared memory attributes is
4322 * returned
4323 */
4324
4325} __packed;
4326
4327/*adsp_audio_memmap_api.h*/
4328
4329/* ASM related data structures */
4330struct asm_wma_cfg {
4331 u16 format_tag;
4332 u16 ch_cfg;
4333 u32 sample_rate;
4334 u32 avg_bytes_per_sec;
4335 u16 block_align;
4336 u16 valid_bits_per_sample;
4337 u32 ch_mask;
4338 u16 encode_opt;
4339 u16 adv_encode_opt;
4340 u32 adv_encode_opt2;
4341 u32 drc_peak_ref;
4342 u32 drc_peak_target;
4343 u32 drc_ave_ref;
4344 u32 drc_ave_target;
4345} __packed;
4346
4347struct asm_wmapro_cfg {
4348 u16 format_tag;
4349 u16 ch_cfg;
4350 u32 sample_rate;
4351 u32 avg_bytes_per_sec;
4352 u16 block_align;
4353 u16 valid_bits_per_sample;
4354 u32 ch_mask;
4355 u16 encode_opt;
4356 u16 adv_encode_opt;
4357 u32 adv_encode_opt2;
4358 u32 drc_peak_ref;
4359 u32 drc_peak_target;
4360 u32 drc_ave_ref;
4361 u32 drc_ave_target;
4362} __packed;
4363
4364struct asm_aac_cfg {
4365 u16 format;
4366 u16 aot;
4367 u16 ep_config;
4368 u16 section_data_resilience;
4369 u16 scalefactor_data_resilience;
4370 u16 spectral_data_resilience;
4371 u16 ch_cfg;
4372 u16 reserved;
4373 u32 sample_rate;
4374} __packed;
4375
4376struct asm_amrwbplus_cfg {
4377 u32 size_bytes;
4378 u32 version;
4379 u32 num_channels;
4380 u32 amr_band_mode;
4381 u32 amr_dtx_mode;
4382 u32 amr_frame_fmt;
4383 u32 amr_lsf_idx;
4384} __packed;
4385
4386struct asm_flac_cfg {
4387 u32 sample_rate;
4388 u32 ext_sample_rate;
4389 u32 min_frame_size;
4390 u32 max_frame_size;
4391 u16 stream_info_present;
4392 u16 min_blk_size;
4393 u16 max_blk_size;
4394 u16 ch_cfg;
4395 u16 sample_size;
4396 u16 md5_sum;
4397};
4398
4399struct asm_alac_cfg {
4400 u32 frame_length;
4401 u8 compatible_version;
4402 u8 bit_depth;
4403 u8 pb;
4404 u8 mb;
4405 u8 kb;
4406 u8 num_channels;
4407 u16 max_run;
4408 u32 max_frame_bytes;
4409 u32 avg_bit_rate;
4410 u32 sample_rate;
4411 u32 channel_layout_tag;
4412};
4413
4414struct asm_g711_dec_cfg {
4415 u32 sample_rate;
4416};
4417
4418struct asm_vorbis_cfg {
4419 u32 bit_stream_fmt;
4420};
4421
4422struct asm_ape_cfg {
4423 u16 compatible_version;
4424 u16 compression_level;
4425 u32 format_flags;
4426 u32 blocks_per_frame;
4427 u32 final_frame_blocks;
4428 u32 total_frames;
4429 u16 bits_per_sample;
4430 u16 num_channels;
4431 u32 sample_rate;
4432 u32 seek_table_present;
4433};
4434
4435struct asm_dsd_cfg {
4436 u16 num_version;
4437 u16 is_bitwise_big_endian;
4438 u16 dsd_channel_block_size;
4439 u16 num_channels;
4440 u8 channel_mapping[8];
4441 u32 dsd_data_rate;
4442};
4443
4444struct asm_softpause_params {
4445 u32 enable;
4446 u32 period;
4447 u32 step;
4448 u32 rampingcurve;
4449} __packed;
4450
4451struct asm_softvolume_params {
4452 u32 period;
4453 u32 step;
4454 u32 rampingcurve;
4455} __packed;
4456
4457#define ASM_END_POINT_DEVICE_MATRIX 0
4458
4459#define PCM_CHANNEL_NULL 0
4460
4461/* Front left channel. */
4462#define PCM_CHANNEL_FL 1
4463
4464/* Front right channel. */
4465#define PCM_CHANNEL_FR 2
4466
4467/* Front center channel. */
4468#define PCM_CHANNEL_FC 3
4469
4470/* Left surround channel.*/
4471#define PCM_CHANNEL_LS 4
4472
4473/* Right surround channel.*/
4474#define PCM_CHANNEL_RS 5
4475
4476/* Low frequency effect channel. */
4477#define PCM_CHANNEL_LFE 6
4478
4479/* Center surround channel; Rear center channel. */
4480#define PCM_CHANNEL_CS 7
4481
4482/* Left back channel; Rear left channel. */
4483#define PCM_CHANNEL_LB 8
4484
4485/* Right back channel; Rear right channel. */
4486#define PCM_CHANNEL_RB 9
4487
4488/* Top surround channel. */
4489#define PCM_CHANNELS 10
4490
4491/* Center vertical height channel.*/
4492#define PCM_CHANNEL_CVH 11
4493
4494/* Mono surround channel.*/
4495#define PCM_CHANNEL_MS 12
4496
4497/* Front left of center. */
4498#define PCM_CHANNEL_FLC 13
4499
4500/* Front right of center. */
4501#define PCM_CHANNEL_FRC 14
4502
4503/* Rear left of center. */
4504#define PCM_CHANNEL_RLC 15
4505
Rohit kumar4ea92b12019-02-01 18:05:33 +05304506/* Rear right of center. Update PCM_MAX_CHMAP_ID when
4507 * this list is extended.
4508 */
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +05304509#define PCM_CHANNEL_RRC 16
4510
Dieter Lueckinga8b8e3b2018-09-28 14:29:17 +02004511/* Second low frequency channel. */
4512#define PCM_CHANNEL_LFE2 17
4513
4514/* Side left channel. */
4515#define PCM_CHANNEL_SL 18
4516
4517/* Side right channel. */
4518#define PCM_CHANNEL_SR 19
4519
4520/* Top front left channel. */
4521#define PCM_CHANNEL_TFL 20
4522
4523/* Left vertical height channel. */
4524#define PCM_CHANNEL_LVH 20
4525
4526/* Top front right channel. */
4527#define PCM_CHANNEL_TFR 21
4528
4529/* Right vertical height channel. */
4530#define PCM_CHANNEL_RVH 21
4531
4532/* Top center channel. */
4533#define PCM_CHANNEL_TC 22
4534
4535/* Top back left channel. */
4536#define PCM_CHANNEL_TBL 23
4537
4538/* Top back right channel. */
4539#define PCM_CHANNEL_TBR 24
4540
4541/* Top side left channel. */
4542#define PCM_CHANNEL_TSL 25
4543
4544/* Top side right channel. */
4545#define PCM_CHANNEL_TSR 26
4546
4547/* Top back center channel. */
4548#define PCM_CHANNEL_TBC 27
4549
4550/* Bottom front center channel. */
4551#define PCM_CHANNEL_BFC 28
4552
4553/* Bottom front left channel. */
4554#define PCM_CHANNEL_BFL 29
4555
4556/* Bottom front right channel. */
4557#define PCM_CHANNEL_BFR 30
4558
4559/* Left wide channel. */
4560#define PCM_CHANNEL_LW 31
4561
4562/* Right wide channel. */
4563#define PCM_CHANNEL_RW 32
4564
4565/* Left side direct channel. */
4566#define PCM_CHANNEL_LSD 33
4567
4568
4569/* Right side direct channel. */
4570#define PCM_CHANNEL_RSD 34
4571
Rohit kumar4ea92b12019-02-01 18:05:33 +05304572#define PCM_MAX_CHMAP_ID PCM_CHANNEL_RRC
4573
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +05304574#define PCM_FORMAT_MAX_NUM_CHANNEL 8
4575
Dieter Lueckinga8b8e3b2018-09-28 14:29:17 +02004576/* Used for ADM_CMD_DEVICE_OPEN_V8 */
4577#define PCM_FORMAT_MAX_NUM_CHANNEL_V8 32
4578
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +05304579#define ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V2 0x00010DA5
4580
4581#define ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V3 0x00010DDC
4582
4583#define ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V4 0x0001320C
4584
Dieter Lueckinga8b8e3b2018-09-28 14:29:17 +02004585#define ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V5 0x00013222
4586
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +05304587#define ASM_MEDIA_FMT_EVRCB_FS 0x00010BEF
4588
4589#define ASM_MEDIA_FMT_EVRCWB_FS 0x00010BF0
4590
4591#define ASM_MEDIA_FMT_GENERIC_COMPRESSED 0x00013212
4592
4593#define ASM_MAX_EQ_BANDS 12
4594
4595#define ASM_DATA_CMD_MEDIA_FMT_UPDATE_V2 0x00010D98
4596
4597struct asm_data_cmd_media_fmt_update_v2 {
4598u32 fmt_blk_size;
4599 /* Media format block size in bytes.*/
4600} __packed;
4601
4602struct asm_generic_compressed_fmt_blk_t {
4603 struct apr_hdr hdr;
4604 struct asm_data_cmd_media_fmt_update_v2 fmt_blk;
4605
4606 /*
4607 * Channel mapping array of bitstream output.
4608 * Channel[i] mapping describes channel i inside the buffer, where
4609 * i < num_channels. All valid used channels must be
4610 * present at the beginning of the array.
4611 */
4612 uint8_t channel_mapping[8];
4613
4614 /*
4615 * Number of channels of the incoming bitstream.
4616 * Supported values: 1,2,3,4,5,6,7,8
4617 */
4618 uint16_t num_channels;
4619
4620 /*
4621 * Nominal bits per sample value of the incoming bitstream.
4622 * Supported values: 16, 32
4623 */
4624 uint16_t bits_per_sample;
4625
4626 /*
4627 * Nominal sampling rate of the incoming bitstream.
4628 * Supported values: 8000, 11025, 16000, 22050, 24000, 32000,
4629 * 44100, 48000, 88200, 96000, 176400, 192000,
4630 * 352800, 384000
4631 */
4632 uint32_t sampling_rate;
4633
4634} __packed;
4635
4636
4637/* Command to send sample rate & channels for IEC61937 (compressed) or IEC60958
4638 * (pcm) streams. Both audio standards use the same format and are used for
4639 * HDMI or SPDIF.
4640 */
4641#define ASM_DATA_CMD_IEC_60958_MEDIA_FMT 0x0001321E
4642
4643struct asm_iec_compressed_fmt_blk_t {
4644 struct apr_hdr hdr;
4645
4646 /*
4647 * Nominal sampling rate of the incoming bitstream.
4648 * Supported values: 8000, 11025, 16000, 22050, 24000, 32000,
4649 * 44100, 48000, 88200, 96000, 176400, 192000,
4650 * 352800, 384000
4651 */
4652 uint32_t sampling_rate;
4653
4654 /*
4655 * Number of channels of the incoming bitstream.
4656 * Supported values: 1,2,3,4,5,6,7,8
4657 */
4658 uint32_t num_channels;
4659
4660} __packed;
4661
4662struct asm_multi_channel_pcm_fmt_blk_v2 {
4663 struct apr_hdr hdr;
4664 struct asm_data_cmd_media_fmt_update_v2 fmt_blk;
4665
4666 u16 num_channels;
4667 /* Number of channels. Supported values: 1 to 8 */
4668 u16 bits_per_sample;
4669/* Number of bits per sample per channel. * Supported values:
4670 * 16, 24 * When used for playback, the client must send 24-bit
4671 * samples packed in 32-bit words. The 24-bit samples must be placed
4672 * in the most significant 24 bits of the 32-bit word. When used for
4673 * recording, the aDSP sends 24-bit samples packed in 32-bit words.
4674 * The 24-bit samples are placed in the most significant 24 bits of
4675 * the 32-bit word.
4676 */
4677
4678
4679 u32 sample_rate;
4680/* Number of samples per second (in Hertz).
4681 * Supported values: 2000 to 48000
4682 */
4683
4684 u16 is_signed;
4685 /* Flag that indicates the samples are signed (1). */
4686
4687 u16 reserved;
4688 /* reserved field for 32 bit alignment. must be set to zero. */
4689
4690 u8 channel_mapping[8];
4691/* Channel array of size 8.
4692 * Supported values:
4693 * - #PCM_CHANNEL_L
4694 * - #PCM_CHANNEL_R
4695 * - #PCM_CHANNEL_C
4696 * - #PCM_CHANNEL_LS
4697 * - #PCM_CHANNEL_RS
4698 * - #PCM_CHANNEL_LFE
4699 * - #PCM_CHANNEL_CS
4700 * - #PCM_CHANNEL_LB
4701 * - #PCM_CHANNEL_RB
4702 * - #PCM_CHANNELS
4703 * - #PCM_CHANNEL_CVH
4704 * - #PCM_CHANNEL_MS
4705 * - #PCM_CHANNEL_FLC
4706 * - #PCM_CHANNEL_FRC
4707 * - #PCM_CHANNEL_RLC
4708 * - #PCM_CHANNEL_RRC
4709 *
4710 * Channel[i] mapping describes channel I. Each element i of the
4711 * array describes channel I inside the buffer where 0 @le I <
4712 * num_channels. An unused channel is set to zero.
4713 */
4714} __packed;
4715
4716struct asm_multi_channel_pcm_fmt_blk_v3 {
4717 uint16_t num_channels;
4718/*
4719 * Number of channels
4720 * Supported values: 1 to 8
4721 */
4722
4723 uint16_t bits_per_sample;
4724/*
4725 * Number of bits per sample per channel
4726 * Supported values: 16, 24
4727 */
4728
4729 uint32_t sample_rate;
4730/*
4731 * Number of samples per second
4732 * Supported values: 2000 to 48000, 96000,192000 Hz
4733 */
4734
4735 uint16_t is_signed;
4736/* Flag that indicates that PCM samples are signed (1) */
4737
4738 uint16_t sample_word_size;
4739/*
4740 * Size in bits of the word that holds a sample of a channel.
4741 * Supported values: 12,24,32
4742 */
4743
4744 uint8_t channel_mapping[8];
4745/*
4746 * Each element, i, in the array describes channel i inside the buffer where
4747 * 0 <= i < num_channels. Unused channels are set to 0.
4748 */
4749} __packed;
4750
4751struct asm_multi_channel_pcm_fmt_blk_v4 {
4752 uint16_t num_channels;
4753/*
4754 * Number of channels
4755 * Supported values: 1 to 8
4756 */
4757
4758 uint16_t bits_per_sample;
4759/*
4760 * Number of bits per sample per channel
4761 * Supported values: 16, 24, 32
4762 */
4763
4764 uint32_t sample_rate;
4765/*
4766 * Number of samples per second
4767 * Supported values: 2000 to 48000, 96000,192000 Hz
4768 */
4769
4770 uint16_t is_signed;
4771/* Flag that indicates that PCM samples are signed (1) */
4772
4773 uint16_t sample_word_size;
4774/*
4775 * Size in bits of the word that holds a sample of a channel.
4776 * Supported values: 12,24,32
4777 */
4778
4779 uint8_t channel_mapping[8];
4780/*
4781 * Each element, i, in the array describes channel i inside the buffer where
4782 * 0 <= i < num_channels. Unused channels are set to 0.
4783 */
4784 uint16_t endianness;
4785/*
4786 * Flag to indicate the endianness of the pcm sample
4787 * Supported values: 0 - Little endian (all other formats)
4788 * 1 - Big endian (AIFF)
4789 */
4790 uint16_t mode;
4791/*
4792 * Mode to provide additional info about the pcm input data.
4793 * Supported values: 0 - Default QFs (Q15 for 16b, Q23 for packed 24b,
4794 * Q31 for unpacked 24b or 32b)
4795 * 15 - for 16 bit
4796 * 23 - for 24b packed or 8.24 format
4797 * 31 - for 24b unpacked or 32bit
4798 */
4799} __packed;
4800
Dieter Lueckinga8b8e3b2018-09-28 14:29:17 +02004801
4802struct asm_multi_channel_pcm_fmt_blk_v5 {
4803 uint16_t num_channels;
4804/*
4805 * Number of channels
4806 * Supported values: 1 to 32
4807 */
4808
4809 uint16_t bits_per_sample;
4810/*
4811 * Number of bits per sample per channel
4812 * Supported values: 16, 24, 32
4813 */
4814
4815 uint32_t sample_rate;
4816/*
4817 * Number of samples per second
4818 * Supported values: 2000 to 48000, 96000,192000 Hz
4819 */
4820
4821 uint16_t is_signed;
4822/* Flag that indicates that PCM samples are signed (1) */
4823
4824 uint16_t sample_word_size;
4825/*
4826 * Size in bits of the word that holds a sample of a channel.
4827 * Supported values: 12,24,32
4828 */
4829 uint16_t endianness;
4830/*
4831 * Flag to indicate the endianness of the pcm sample
4832 * Supported values: 0 - Little endian (all other formats)
4833 * 1 - Big endian (AIFF)
4834 */
4835 uint16_t mode;
4836/*
4837 * Mode to provide additional info about the pcm input data.
4838 * Supported values: 0 - Default QFs (Q15 for 16b, Q23 for packed 24b,
4839 * Q31 for unpacked 24b or 32b)
4840 * 15 - for 16 bit
4841 * 23 - for 24b packed or 8.24 format
4842 * 31 - for 24b unpacked or 32bit
4843 */
4844
4845 uint8_t channel_mapping[32];
4846/*
4847 * Each element, i, in the array describes channel i inside the buffer where
4848 * 0 <= i < num_channels. Unused channels are set to 0.
4849 */
4850} __packed;
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +05304851/*
4852 * Payload of the multichannel PCM configuration parameters in
4853 * the ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V3 media format.
4854 */
4855struct asm_multi_channel_pcm_fmt_blk_param_v3 {
4856 struct apr_hdr hdr;
4857 struct asm_data_cmd_media_fmt_update_v2 fmt_blk;
4858 struct asm_multi_channel_pcm_fmt_blk_v3 param;
4859} __packed;
4860
4861/*
4862 * Payload of the multichannel PCM configuration parameters in
4863 * the ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V4 media format.
4864 */
4865struct asm_multi_channel_pcm_fmt_blk_param_v4 {
4866 struct apr_hdr hdr;
4867 struct asm_data_cmd_media_fmt_update_v2 fmt_blk;
4868 struct asm_multi_channel_pcm_fmt_blk_v4 param;
4869} __packed;
4870
Dieter Lueckinga8b8e3b2018-09-28 14:29:17 +02004871/*
4872 * Payload of the multichannel PCM configuration parameters in
4873 * the ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V5 media format.
4874 */
4875struct asm_multi_channel_pcm_fmt_blk_param_v5 {
4876 struct apr_hdr hdr;
4877 struct asm_data_cmd_media_fmt_update_v2 fmt_blk;
4878 struct asm_multi_channel_pcm_fmt_blk_v5 param;
4879} __packed;
4880
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +05304881struct asm_stream_cmd_set_encdec_param {
4882 u32 param_id;
4883 /* ID of the parameter. */
4884
4885 u32 param_size;
4886/* Data size of this parameter, in bytes. The size is a multiple
4887 * of 4 bytes.
4888 */
4889
4890} __packed;
4891
4892struct asm_enc_cfg_blk_param_v2 {
4893 u32 frames_per_buf;
4894/* Number of encoded frames to pack into each buffer.
4895 *
4896 * @note1hang This is only guidance information for the aDSP. The
4897 * number of encoded frames put into each buffer (specified by the
4898 * client) is less than or equal to this number.
4899 */
4900
4901 u32 enc_cfg_blk_size;
4902/* Size in bytes of the encoder configuration block that follows
4903 * this member.
4904 */
4905
4906} __packed;
4907
4908/* @brief Dolby Digital Plus end point configuration structure
4909 */
4910struct asm_dec_ddp_endp_param_v2 {
4911 struct apr_hdr hdr;
4912 struct asm_stream_cmd_set_encdec_param encdec;
4913 int endp_param_value;
4914} __packed;
4915
4916/*
4917 * Payload of the multichannel PCM encoder configuration parameters in
Dieter Lueckinga8b8e3b2018-09-28 14:29:17 +02004918 * the ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V5 media format.
4919 */
4920struct asm_multi_channel_pcm_enc_cfg_v5 {
4921 struct apr_hdr hdr;
4922 struct asm_stream_cmd_set_encdec_param encdec;
4923 struct asm_enc_cfg_blk_param_v2 encblk;
4924 uint16_t num_channels;
4925/*
4926 * Number of PCM channels.
4927 * @values
4928 * - 0 -- Native mode
4929 * - 1 -- 8 channels
4930 * Native mode indicates that encoding must be performed with the number
4931 * of channels at the input.
4932 */
4933 uint16_t bits_per_sample;
4934/*
4935 * Number of bits per sample per channel.
4936 * @values 16, 24
4937 */
4938 uint32_t sample_rate;
4939/*
4940 * Number of samples per second.
4941 * @values 0, 8000 to 48000 Hz
4942 * A value of 0 indicates the native sampling rate. Encoding is
4943 * performed at the input sampling rate.
4944 */
4945 uint16_t is_signed;
4946/*
4947 * Flag that indicates the PCM samples are signed (1). Currently, only
4948 * signed PCM samples are supported.
4949 */
4950 uint16_t sample_word_size;
4951/*
4952 * The size in bits of the word that holds a sample of a channel.
4953 * @values 16, 24, 32
4954 * 16-bit samples are always placed in 16-bit words:
4955 * sample_word_size = 1.
4956 * 24-bit samples can be placed in 32-bit words or in consecutive
4957 * 24-bit words.
4958 * - If sample_word_size = 32, 24-bit samples are placed in the
4959 * most significant 24 bits of a 32-bit word.
4960 * - If sample_word_size = 24, 24-bit samples are placed in
4961 * 24-bit words. @tablebulletend
4962 */
4963 uint16_t endianness;
4964/*
4965 * Flag to indicate the endianness of the pcm sample
4966 * Supported values: 0 - Little endian (all other formats)
4967 * 1 - Big endian (AIFF)
4968 */
4969 uint16_t mode;
4970/*
4971 * Mode to provide additional info about the pcm input data.
4972 * Supported values: 0 - Default QFs (Q15 for 16b, Q23 for packed 24b,
4973 * Q31 for unpacked 24b or 32b)
4974 * 15 - for 16 bit
4975 * 23 - for 24b packed or 8.24 format
4976 */
4977 uint8_t channel_mapping[PCM_FORMAT_MAX_NUM_CHANNEL_V8];
4978/*
4979 * Channel mapping array expected at the encoder output.
4980 * Channel[i] mapping describes channel i inside the buffer, where
4981 * 0 @le i < num_channels. All valid used channels must be present at
4982 * the beginning of the array.
4983 * If Native mode is set for the channels, this field is ignored.
4984 * @values See Section @xref{dox:PcmChannelDefs}
4985 */
4986} __packed;
4987
4988/*
4989 * Payload of the multichannel PCM encoder configuration parameters in
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +05304990 * the ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V4 media format.
4991 */
4992
4993struct asm_multi_channel_pcm_enc_cfg_v4 {
4994 struct apr_hdr hdr;
4995 struct asm_stream_cmd_set_encdec_param encdec;
4996 struct asm_enc_cfg_blk_param_v2 encblk;
4997 uint16_t num_channels;
4998 /*
4999 * Number of PCM channels.
5000 * @values
5001 * - 0 -- Native mode
5002 * - 1 -- 8 channels
5003 * Native mode indicates that encoding must be performed with the number
5004 * of channels at the input.
5005 */
5006 uint16_t bits_per_sample;
5007 /*
5008 * Number of bits per sample per channel.
5009 * @values 16, 24
5010 */
5011 uint32_t sample_rate;
5012 /*
5013 * Number of samples per second.
5014 * @values 0, 8000 to 48000 Hz
5015 * A value of 0 indicates the native sampling rate. Encoding is
5016 * performed at the input sampling rate.
5017 */
5018 uint16_t is_signed;
5019 /*
5020 * Flag that indicates the PCM samples are signed (1). Currently, only
5021 * signed PCM samples are supported.
5022 */
5023 uint16_t sample_word_size;
5024 /*
5025 * The size in bits of the word that holds a sample of a channel.
5026 * @values 16, 24, 32
5027 * 16-bit samples are always placed in 16-bit words:
5028 * sample_word_size = 1.
5029 * 24-bit samples can be placed in 32-bit words or in consecutive
5030 * 24-bit words.
5031 * - If sample_word_size = 32, 24-bit samples are placed in the
5032 * most significant 24 bits of a 32-bit word.
5033 * - If sample_word_size = 24, 24-bit samples are placed in
5034 * 24-bit words. @tablebulletend
5035 */
5036 uint8_t channel_mapping[8];
5037 /*
5038 * Channel mapping array expected at the encoder output.
5039 * Channel[i] mapping describes channel i inside the buffer, where
5040 * 0 @le i < num_channels. All valid used channels must be present at
5041 * the beginning of the array.
5042 * If Native mode is set for the channels, this field is ignored.
5043 * @values See Section @xref{dox:PcmChannelDefs}
5044 */
5045 uint16_t endianness;
5046 /*
5047 * Flag to indicate the endianness of the pcm sample
5048 * Supported values: 0 - Little endian (all other formats)
5049 * 1 - Big endian (AIFF)
5050 */
5051 uint16_t mode;
5052 /*
5053 * Mode to provide additional info about the pcm input data.
5054 * Supported values: 0 - Default QFs (Q15 for 16b, Q23 for packed 24b,
5055 * Q31 for unpacked 24b or 32b)
5056 * 15 - for 16 bit
5057 * 23 - for 24b packed or 8.24 format
5058 * 31 - for 24b unpacked or 32bit
5059 */
5060} __packed;
5061
5062/*
5063 * Payload of the multichannel PCM encoder configuration parameters in
5064 * the ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V3 media format.
5065 */
5066
5067struct asm_multi_channel_pcm_enc_cfg_v3 {
5068 struct apr_hdr hdr;
5069 struct asm_stream_cmd_set_encdec_param encdec;
5070 struct asm_enc_cfg_blk_param_v2 encblk;
5071 uint16_t num_channels;
5072 /*
5073 * Number of PCM channels.
5074 * @values
5075 * - 0 -- Native mode
5076 * - 1 -- 8 channels
5077 * Native mode indicates that encoding must be performed with the number
5078 * of channels at the input.
5079 */
5080 uint16_t bits_per_sample;
5081 /*
5082 * Number of bits per sample per channel.
5083 * @values 16, 24
5084 */
5085 uint32_t sample_rate;
5086 /*
5087 * Number of samples per second.
5088 * @values 0, 8000 to 48000 Hz
5089 * A value of 0 indicates the native sampling rate. Encoding is
5090 * performed at the input sampling rate.
5091 */
5092 uint16_t is_signed;
5093 /*
5094 * Flag that indicates the PCM samples are signed (1). Currently, only
5095 * signed PCM samples are supported.
5096 */
5097 uint16_t sample_word_size;
5098 /*
5099 * The size in bits of the word that holds a sample of a channel.
5100 * @values 16, 24, 32
5101 * 16-bit samples are always placed in 16-bit words:
5102 * sample_word_size = 1.
5103 * 24-bit samples can be placed in 32-bit words or in consecutive
5104 * 24-bit words.
5105 * - If sample_word_size = 32, 24-bit samples are placed in the
5106 * most significant 24 bits of a 32-bit word.
5107 * - If sample_word_size = 24, 24-bit samples are placed in
5108 * 24-bit words. @tablebulletend
5109 */
5110 uint8_t channel_mapping[8];
5111 /*
5112 * Channel mapping array expected at the encoder output.
5113 * Channel[i] mapping describes channel i inside the buffer, where
5114 * 0 @le i < num_channels. All valid used channels must be present at
5115 * the beginning of the array.
5116 * If Native mode is set for the channels, this field is ignored.
5117 * @values See Section @xref{dox:PcmChannelDefs}
5118 */
5119};
5120
5121/* @brief Multichannel PCM encoder configuration structure used
5122 * in the #ASM_PARAM_ID_ENCDEC_ENC_CFG_BLK_V2 command.
5123 */
5124
5125struct asm_multi_channel_pcm_enc_cfg_v2 {
5126 struct apr_hdr hdr;
5127 struct asm_stream_cmd_set_encdec_param encdec;
5128 struct asm_enc_cfg_blk_param_v2 encblk;
5129 uint16_t num_channels;
5130/*< Number of PCM channels.
5131 *
5132 * Supported values: - 0 -- Native mode - 1 -- 8 Native mode
5133 * indicates that encoding must be performed with the number of
5134 * channels at the input.
5135 */
5136
5137 uint16_t bits_per_sample;
5138/*< Number of bits per sample per channel.
5139 * Supported values: 16, 24
5140 */
5141
5142 uint32_t sample_rate;
5143/*< Number of samples per second (in Hertz).
5144 *
5145 * Supported values: 0, 8000 to 48000 A value of 0 indicates the
5146 * native sampling rate. Encoding is performed at the input sampling
5147 * rate.
5148 */
5149
5150 uint16_t is_signed;
5151/*< Specifies whether the samples are signed (1). Currently,
5152 * only signed samples are supported.
5153 */
5154
5155 uint16_t reserved;
5156/*< reserved field for 32 bit alignment. must be set to zero.*/
5157
5158
5159 uint8_t channel_mapping[8];
5160} __packed;
5161
5162#define ASM_MEDIA_FMT_MP3 0x00010BE9
5163#define ASM_MEDIA_FMT_AAC_V2 0x00010DA6
5164
5165/* @xreflabel
5166 * {hdr:AsmMediaFmtDolbyAac} Media format ID for the
5167 * Dolby AAC decoder. This format ID is be used if the client wants
5168 * to use the Dolby AAC decoder to decode MPEG2 and MPEG4 AAC
5169 * contents.
5170 */
5171
5172#define ASM_MEDIA_FMT_DOLBY_AAC 0x00010D86
5173
5174/* Enumeration for the audio data transport stream AAC format. */
5175#define ASM_MEDIA_FMT_AAC_FORMAT_FLAG_ADTS 0
5176
5177/* Enumeration for low overhead audio stream AAC format. */
5178#define ASM_MEDIA_FMT_AAC_FORMAT_FLAG_LOAS 1
5179
5180/* Enumeration for the audio data interchange format
5181 * AAC format.
5182 */
5183#define ASM_MEDIA_FMT_AAC_FORMAT_FLAG_ADIF 2
5184
5185/* Enumeration for the raw AAC format. */
5186#define ASM_MEDIA_FMT_AAC_FORMAT_FLAG_RAW 3
5187
5188/* Enumeration for the AAC LATM format. */
5189#define ASM_MEDIA_FMT_AAC_FORMAT_FLAG_LATM 4
5190
5191#define ASM_MEDIA_FMT_AAC_AOT_LC 2
5192#define ASM_MEDIA_FMT_AAC_AOT_SBR 5
5193#define ASM_MEDIA_FMT_AAC_AOT_PS 29
5194#define ASM_MEDIA_FMT_AAC_AOT_BSAC 22
5195
5196struct asm_aac_fmt_blk_v2 {
5197 struct apr_hdr hdr;
5198 struct asm_data_cmd_media_fmt_update_v2 fmt_blk;
5199
5200 u16 aac_fmt_flag;
5201/* Bitstream format option.
5202 * Supported values:
5203 * - #ASM_MEDIA_FMT_AAC_FORMAT_FLAG_ADTS
5204 * - #ASM_MEDIA_FMT_AAC_FORMAT_FLAG_LOAS
5205 * - #ASM_MEDIA_FMT_AAC_FORMAT_FLAG_ADIF
5206 * - #ASM_MEDIA_FMT_AAC_FORMAT_FLAG_RAW
5207 */
5208
5209 u16 audio_objype;
5210/* Audio Object Type (AOT) present in the AAC stream.
5211 * Supported values:
5212 * - #ASM_MEDIA_FMT_AAC_AOT_LC
5213 * - #ASM_MEDIA_FMT_AAC_AOT_SBR
5214 * - #ASM_MEDIA_FMT_AAC_AOT_BSAC
5215 * - #ASM_MEDIA_FMT_AAC_AOT_PS
5216 * - Otherwise -- Not supported
5217 */
5218
5219 u16 channel_config;
5220/* Number of channels present in the AAC stream.
5221 * Supported values:
5222 * - 1 -- Mono
5223 * - 2 -- Stereo
5224 * - 6 -- 5.1 content
5225 */
5226
5227 u16 total_size_of_PCE_bits;
5228/* greater or equal to zero. * -In case of RAW formats and
5229 * channel config = 0 (PCE), client can send * the bit stream
5230 * containing PCE immediately following this structure * (in-band).
5231 * -This number does not include bits included for 32 bit alignment.
5232 * -If zero, then the PCE info is assumed to be available in the
5233 * audio -bit stream & not in-band.
5234 */
5235
5236 u32 sample_rate;
5237/* Number of samples per second (in Hertz).
5238 *
5239 * Supported values: 8000, 11025, 12000, 16000, 22050, 24000, 32000,
5240 * 44100, 48000
5241 *
5242 * This field must be equal to the sample rate of the AAC-LC
5243 * decoder's output. - For MP4 or 3GP containers, this is indicated
5244 * by the samplingFrequencyIndex field in the AudioSpecificConfig
5245 * element. - For ADTS format, this is indicated by the
5246 * samplingFrequencyIndex in the ADTS fixed header. - For ADIF
5247 * format, this is indicated by the samplingFrequencyIndex in the
5248 * program_config_element present in the ADIF header.
5249 */
5250
5251} __packed;
5252
5253struct asm_aac_enc_cfg_v2 {
5254 struct apr_hdr hdr;
5255 struct asm_stream_cmd_set_encdec_param encdec;
5256 struct asm_enc_cfg_blk_param_v2 encblk;
5257
5258 u32 bit_rate;
5259 /* Encoding rate in bits per second. */
5260 u32 enc_mode;
5261/* Encoding mode.
5262 * Supported values:
5263 * - #ASM_MEDIA_FMT_AAC_AOT_LC
5264 * - #ASM_MEDIA_FMT_AAC_AOT_SBR
5265 * - #ASM_MEDIA_FMT_AAC_AOT_PS
5266 */
5267 u16 aac_fmt_flag;
5268/* AAC format flag.
5269 * Supported values:
5270 * - #ASM_MEDIA_FMT_AAC_FORMAT_FLAG_ADTS
5271 * - #ASM_MEDIA_FMT_AAC_FORMAT_FLAG_RAW
5272 */
5273 u16 channel_cfg;
5274/* Number of channels to encode.
5275 * Supported values:
5276 * - 0 -- Native mode
5277 * - 1 -- Mono
5278 * - 2 -- Stereo
5279 * - Other values are not supported.
5280 * @note1hang The eAAC+ encoder mode supports only stereo.
5281 * Native mode indicates that encoding must be performed with the
5282 * number of channels at the input.
5283 * The number of channels must not change during encoding.
5284 */
5285
5286 u32 sample_rate;
5287/* Number of samples per second.
5288 * Supported values: - 0 -- Native mode - For other values,
5289 * Native mode indicates that encoding must be performed with the
5290 * sampling rate at the input.
5291 * The sampling rate must not change during encoding.
5292 */
5293
5294} __packed;
5295
5296#define ASM_MEDIA_FMT_G711_ALAW_FS 0x00010BF7
5297#define ASM_MEDIA_FMT_G711_MLAW_FS 0x00010C2E
5298
5299struct asm_g711_enc_cfg_v2 {
5300 struct apr_hdr hdr;
5301 struct asm_stream_cmd_set_encdec_param encdec;
5302 struct asm_enc_cfg_blk_param_v2 encblk;
5303
5304 u32 sample_rate;
5305/*
5306 * Number of samples per second.
5307 * Supported values: 8000, 16000 Hz
5308 */
5309
5310} __packed;
5311
5312struct asm_vorbis_fmt_blk_v2 {
5313 struct apr_hdr hdr;
5314 struct asm_data_cmd_media_fmt_update_v2 fmtblk;
5315 u32 bit_stream_fmt;
5316/* Bit stream format.
5317 * Supported values:
5318 * - 0 -- Raw bitstream
5319 * - 1 -- Transcoded bitstream
5320 *
5321 * Transcoded bitstream containing the size of the frame as the first
5322 * word in each frame.
5323 */
5324
5325} __packed;
5326
5327struct asm_flac_fmt_blk_v2 {
5328 struct apr_hdr hdr;
5329 struct asm_data_cmd_media_fmt_update_v2 fmtblk;
5330
5331 u16 is_stream_info_present;
5332/* Specifies whether stream information is present in the FLAC format
5333 * block.
5334 *
5335 * Supported values:
5336 * - 0 -- Stream information is not present in this message
5337 * - 1 -- Stream information is present in this message
5338 *
5339 * When set to 1, the FLAC bitstream was successfully parsed by the
5340 * client, and other fields in the FLAC format block can be read by the
5341 * decoder to get metadata stream information.
5342 */
5343
5344 u16 num_channels;
5345/* Number of channels for decoding.
5346 * Supported values: 1 to 2
5347 */
5348
5349 u16 min_blk_size;
5350/* Minimum block size (in samples) used in the stream. It must be less
5351 * than or equal to max_blk_size.
5352 */
5353
5354 u16 max_blk_size;
5355/* Maximum block size (in samples) used in the stream. If the
5356 * minimum block size equals the maximum block size, a fixed block
5357 * size stream is implied.
5358 */
5359
5360 u16 md5_sum[8];
5361/* MD5 signature array of the unencoded audio data. This allows the
5362 * decoder to determine if an error exists in the audio data, even when
5363 * the error does not result in an invalid bitstream.
5364 */
5365
5366 u32 sample_rate;
5367/* Number of samples per second.
5368 * Supported values: 8000 to 48000 Hz
5369 */
5370
5371 u32 min_frame_size;
5372/* Minimum frame size used in the stream.
5373 * Supported values:
5374 * - > 0 bytes
5375 * - 0 -- The value is unknown
5376 */
5377
5378 u32 max_frame_size;
5379/* Maximum frame size used in the stream.
5380 * Supported values:
5381 * -- > 0 bytes
5382 * -- 0 . The value is unknown
5383 */
5384
5385 u16 sample_size;
5386/* Bits per sample.Supported values: 8, 16 */
5387
5388 u16 reserved;
5389/* Clients must set this field to zero
5390 */
5391
5392} __packed;
5393
5394struct asm_alac_fmt_blk_v2 {
5395 struct apr_hdr hdr;
5396 struct asm_data_cmd_media_fmt_update_v2 fmtblk;
5397
5398 u32 frame_length;
5399 u8 compatible_version;
5400 u8 bit_depth;
5401 u8 pb;
5402 u8 mb;
5403 u8 kb;
5404 u8 num_channels;
5405 u16 max_run;
5406 u32 max_frame_bytes;
5407 u32 avg_bit_rate;
5408 u32 sample_rate;
5409 u32 channel_layout_tag;
5410
5411} __packed;
5412
5413struct asm_g711_dec_fmt_blk_v2 {
5414 struct apr_hdr hdr;
5415 struct asm_data_cmd_media_fmt_update_v2 fmtblk;
5416 u32 sample_rate;
5417} __packed;
5418
5419struct asm_ape_fmt_blk_v2 {
5420 struct apr_hdr hdr;
5421 struct asm_data_cmd_media_fmt_update_v2 fmtblk;
5422
5423 u16 compatible_version;
5424 u16 compression_level;
5425 u32 format_flags;
5426 u32 blocks_per_frame;
5427 u32 final_frame_blocks;
5428 u32 total_frames;
5429 u16 bits_per_sample;
5430 u16 num_channels;
5431 u32 sample_rate;
5432 u32 seek_table_present;
5433
5434} __packed;
5435
5436struct asm_dsd_fmt_blk_v2 {
5437 struct apr_hdr hdr;
5438 struct asm_data_cmd_media_fmt_update_v2 fmtblk;
5439
5440 u16 num_version;
5441 u16 is_bitwise_big_endian;
5442 u16 dsd_channel_block_size;
5443 u16 num_channels;
5444 u8 channel_mapping[8];
5445 u32 dsd_data_rate;
5446
5447} __packed;
5448
5449#define ASM_MEDIA_FMT_AMRNB_FS 0x00010BEB
5450
5451/* Enumeration for 4.75 kbps AMR-NB Encoding mode. */
5452#define ASM_MEDIA_FMT_AMRNB_FS_ENCODE_MODE_MR475 0
5453
5454/* Enumeration for 5.15 kbps AMR-NB Encoding mode. */
5455#define ASM_MEDIA_FMT_AMRNB_FS_ENCODE_MODE_MR515 1
5456
5457/* Enumeration for 5.90 kbps AMR-NB Encoding mode. */
5458#define ASM_MEDIA_FMT_AMRNB_FS_ENCODE_MODE_MMR59 2
5459
5460/* Enumeration for 6.70 kbps AMR-NB Encoding mode. */
5461#define ASM_MEDIA_FMT_AMRNB_FS_ENCODE_MODE_MMR67 3
5462
5463/* Enumeration for 7.40 kbps AMR-NB Encoding mode. */
5464#define ASM_MEDIA_FMT_AMRNB_FS_ENCODE_MODE_MMR74 4
5465
5466/* Enumeration for 7.95 kbps AMR-NB Encoding mode. */
5467#define ASM_MEDIA_FMT_AMRNB_FS_ENCODE_MODE_MMR795 5
5468
5469/* Enumeration for 10.20 kbps AMR-NB Encoding mode. */
5470#define ASM_MEDIA_FMT_AMRNB_FS_ENCODE_MODE_MMR102 6
5471
5472/* Enumeration for 12.20 kbps AMR-NB Encoding mode. */
5473#define ASM_MEDIA_FMT_AMRNB_FS_ENCODE_MODE_MMR122 7
5474
5475/* Enumeration for AMR-NB Discontinuous Transmission mode off. */
5476#define ASM_MEDIA_FMT_AMRNB_FS_DTX_MODE_OFF 0
5477
5478/* Enumeration for AMR-NB DTX mode VAD1. */
5479#define ASM_MEDIA_FMT_AMRNB_FS_DTX_MODE_VAD1 1
5480
5481/* Enumeration for AMR-NB DTX mode VAD2. */
5482#define ASM_MEDIA_FMT_AMRNB_FS_DTX_MODE_VAD2 2
5483
5484/* Enumeration for AMR-NB DTX mode auto. */
5485#define ASM_MEDIA_FMT_AMRNB_FS_DTX_MODE_AUTO 3
5486
5487struct asm_amrnb_enc_cfg {
5488 struct apr_hdr hdr;
5489 struct asm_stream_cmd_set_encdec_param encdec;
5490 struct asm_enc_cfg_blk_param_v2 encblk;
5491
5492 u16 enc_mode;
5493/* AMR-NB encoding rate.
5494 * Supported values:
5495 * Use the ASM_MEDIA_FMT_AMRNB_FS_ENCODE_MODE_*
5496 * macros
5497 */
5498
5499 u16 dtx_mode;
5500/* Specifies whether DTX mode is disabled or enabled.
5501 * Supported values:
5502 * - #ASM_MEDIA_FMT_AMRNB_FS_DTX_MODE_OFF
5503 * - #ASM_MEDIA_FMT_AMRNB_FS_DTX_MODE_VAD1
5504 */
5505} __packed;
5506
5507#define ASM_MEDIA_FMT_AMRWB_FS 0x00010BEC
5508
5509/* Enumeration for 6.6 kbps AMR-WB Encoding mode. */
5510#define ASM_MEDIA_FMT_AMRWB_FS_ENCODE_MODE_MR66 0
5511
5512/* Enumeration for 8.85 kbps AMR-WB Encoding mode. */
5513#define ASM_MEDIA_FMT_AMRWB_FS_ENCODE_MODE_MR885 1
5514
5515/* Enumeration for 12.65 kbps AMR-WB Encoding mode. */
5516#define ASM_MEDIA_FMT_AMRWB_FS_ENCODE_MODE_MR1265 2
5517
5518/* Enumeration for 14.25 kbps AMR-WB Encoding mode. */
5519#define ASM_MEDIA_FMT_AMRWB_FS_ENCODE_MODE_MR1425 3
5520
5521/* Enumeration for 15.85 kbps AMR-WB Encoding mode. */
5522#define ASM_MEDIA_FMT_AMRWB_FS_ENCODE_MODE_MR1585 4
5523
5524/* Enumeration for 18.25 kbps AMR-WB Encoding mode. */
5525#define ASM_MEDIA_FMT_AMRWB_FS_ENCODE_MODE_MR1825 5
5526
5527/* Enumeration for 19.85 kbps AMR-WB Encoding mode. */
5528#define ASM_MEDIA_FMT_AMRWB_FS_ENCODE_MODE_MR1985 6
5529
5530/* Enumeration for 23.05 kbps AMR-WB Encoding mode. */
5531#define ASM_MEDIA_FMT_AMRWB_FS_ENCODE_MODE_MR2305 7
5532
5533/* Enumeration for 23.85 kbps AMR-WB Encoding mode. */
5534#define ASM_MEDIA_FMT_AMRWB_FS_ENCODE_MODE_MR2385 8
5535
5536struct asm_amrwb_enc_cfg {
5537 struct apr_hdr hdr;
5538 struct asm_stream_cmd_set_encdec_param encdec;
5539 struct asm_enc_cfg_blk_param_v2 encblk;
5540
5541 u16 enc_mode;
5542/* AMR-WB encoding rate.
5543 * Suupported values:
5544 * Use the ASM_MEDIA_FMT_AMRWB_FS_ENCODE_MODE_*
5545 * macros
5546 */
5547
5548 u16 dtx_mode;
5549/* Specifies whether DTX mode is disabled or enabled.
5550 * Supported values:
5551 * - #ASM_MEDIA_FMT_AMRNB_FS_DTX_MODE_OFF
5552 * - #ASM_MEDIA_FMT_AMRNB_FS_DTX_MODE_VAD1
5553 */
5554} __packed;
5555
5556#define ASM_MEDIA_FMT_V13K_FS 0x00010BED
5557
5558/* Enumeration for 14.4 kbps V13K Encoding mode. */
5559#define ASM_MEDIA_FMT_V13K_FS_ENCODE_MODE_MR1440 0
5560
5561/* Enumeration for 12.2 kbps V13K Encoding mode. */
5562#define ASM_MEDIA_FMT_V13K_FS_ENCODE_MODE_MR1220 1
5563
5564/* Enumeration for 11.2 kbps V13K Encoding mode. */
5565#define ASM_MEDIA_FMT_V13K_FS_ENCODE_MODE_MR1120 2
5566
5567/* Enumeration for 9.0 kbps V13K Encoding mode. */
5568#define ASM_MEDIA_FMT_V13K_FS_ENCODE_MODE_MR90 3
5569
5570/* Enumeration for 7.2 kbps V13K eEncoding mode. */
5571#define ASM_MEDIA_FMT_V13K_FS_ENCODE_MODE_MR720 4
5572
5573/* Enumeration for 1/8 vocoder rate.*/
5574#define ASM_MEDIA_FMT_VOC_ONE_EIGHTH_RATE 1
5575
5576/* Enumeration for 1/4 vocoder rate. */
5577#define ASM_MEDIA_FMT_VOC_ONE_FOURTH_RATE 2
5578
5579/* Enumeration for 1/2 vocoder rate. */
5580#define ASM_MEDIA_FMT_VOC_HALF_RATE 3
5581
5582/* Enumeration for full vocoder rate. */
5583#define ASM_MEDIA_FMT_VOC_FULL_RATE 4
5584
5585struct asm_v13k_enc_cfg {
5586 struct apr_hdr hdr;
5587 struct asm_stream_cmd_set_encdec_param encdec;
5588 struct asm_enc_cfg_blk_param_v2 encblk;
5589 u16 max_rate;
5590/* Maximum allowed encoder frame rate.
5591 * Supported values:
5592 * - #ASM_MEDIA_FMT_VOC_ONE_EIGHTH_RATE
5593 * - #ASM_MEDIA_FMT_VOC_ONE_FOURTH_RATE
5594 * - #ASM_MEDIA_FMT_VOC_HALF_RATE
5595 * - #ASM_MEDIA_FMT_VOC_FULL_RATE
5596 */
5597
5598 u16 min_rate;
5599/* Minimum allowed encoder frame rate.
5600 * Supported values:
5601 * - #ASM_MEDIA_FMT_VOC_ONE_EIGHTH_RATE
5602 * - #ASM_MEDIA_FMT_VOC_ONE_FOURTH_RATE
5603 * - #ASM_MEDIA_FMT_VOC_HALF_RATE
5604 * - #ASM_MEDIA_FMT_VOC_FULL_RATE
5605 */
5606
5607 u16 reduced_rate_cmd;
5608/* Reduced rate command, used to change
5609 * the average bitrate of the V13K
5610 * vocoder.
5611 * Supported values:
5612 * - #ASM_MEDIA_FMT_V13K_FS_ENCODE_MODE_MR1440 (Default)
5613 * - #ASM_MEDIA_FMT_V13K_FS_ENCODE_MODE_MR1220
5614 * - #ASM_MEDIA_FMT_V13K_FS_ENCODE_MODE_MR1120
5615 * - #ASM_MEDIA_FMT_V13K_FS_ENCODE_MODE_MR90
5616 * - #ASM_MEDIA_FMT_V13K_FS_ENCODE_MODE_MR720
5617 */
5618
5619 u16 rate_mod_cmd;
5620/* Rate modulation command. Default = 0.
5621 *- If bit 0=1, rate control is enabled.
5622 *- If bit 1=1, the maximum number of consecutive full rate
5623 * frames is limited with numbers supplied in
5624 * bits 2 to 10.
5625 *- If bit 1=0, the minimum number of non-full rate frames
5626 * in between two full rate frames is forced to
5627 * the number supplied in bits 2 to 10. In both cases, if necessary,
5628 * half rate is used to substitute full rate. - Bits 15 to 10 are
5629 * reserved and must all be set to zero.
5630 */
5631
5632} __packed;
5633
5634#define ASM_MEDIA_FMT_EVRC_FS 0x00010BEE
5635
5636/* EVRC encoder configuration structure used in the
5637 * #ASM_PARAM_ID_ENCDEC_ENC_CFG_BLK_V2 command.
5638 */
5639struct asm_evrc_enc_cfg {
5640 struct apr_hdr hdr;
5641 struct asm_stream_cmd_set_encdec_param encdec;
5642 struct asm_enc_cfg_blk_param_v2 encblk;
5643 u16 max_rate;
5644/* Maximum allowed encoder frame rate.
5645 * Supported values:
5646 * - #ASM_MEDIA_FMT_VOC_ONE_EIGHTH_RATE
5647 * - #ASM_MEDIA_FMT_VOC_ONE_FOURTH_RATE
5648 * - #ASM_MEDIA_FMT_VOC_HALF_RATE
5649 * - #ASM_MEDIA_FMT_VOC_FULL_RATE
5650 */
5651
5652 u16 min_rate;
5653/* Minimum allowed encoder frame rate.
5654 * Supported values:
5655 * - #ASM_MEDIA_FMT_VOC_ONE_EIGHTH_RATE
5656 * - #ASM_MEDIA_FMT_VOC_ONE_FOURTH_RATE
5657 * - #ASM_MEDIA_FMT_VOC_HALF_RATE
5658 * - #ASM_MEDIA_FMT_VOC_FULL_RATE
5659 */
5660
5661 u16 rate_mod_cmd;
5662/* Rate modulation command. Default: 0.
5663 * - If bit 0=1, rate control is enabled.
5664 * - If bit 1=1, the maximum number of consecutive full rate frames
5665 * is limited with numbers supplied in bits 2 to 10.
5666 *
5667 * - If bit 1=0, the minimum number of non-full rate frames in
5668 * between two full rate frames is forced to the number supplied in
5669 * bits 2 to 10. In both cases, if necessary, half rate is used to
5670 * substitute full rate.
5671 *
5672 * - Bits 15 to 10 are reserved and must all be set to zero.
5673 */
5674
5675 u16 reserved;
5676 /* Reserved. Clients must set this field to zero. */
5677} __packed;
5678
5679#define ASM_MEDIA_FMT_WMA_V10PRO_V2 0x00010DA7
5680
5681struct asm_wmaprov10_fmt_blk_v2 {
5682 struct apr_hdr hdr;
5683 struct asm_data_cmd_media_fmt_update_v2 fmtblk;
5684
5685 u16 fmtag;
5686/* WMA format type.
5687 * Supported values:
5688 * - 0x162 -- WMA 9 Pro
5689 * - 0x163 -- WMA 9 Pro Lossless
5690 * - 0x166 -- WMA 10 Pro
5691 * - 0x167 -- WMA 10 Pro Lossless
5692 */
5693
5694 u16 num_channels;
5695/* Number of channels encoded in the input stream.
5696 * Supported values: 1 to 8
5697 */
5698
5699 u32 sample_rate;
5700/* Number of samples per second (in Hertz).
5701 * Supported values: 11025, 16000, 22050, 32000, 44100, 48000,
5702 * 88200, 96000
5703 */
5704
5705 u32 avg_bytes_per_sec;
5706/* Bitrate expressed as the average bytes per second.
5707 * Supported values: 2000 to 96000
5708 */
5709
5710 u16 blk_align;
5711/* Size of the bitstream packet size in bytes. WMA Pro files
5712 * have a payload of one block per bitstream packet.
5713 * Supported values: @le 13376
5714 */
5715
5716 u16 bits_per_sample;
5717/* Number of bits per sample in the encoded WMA stream.
5718 * Supported values: 16, 24
5719 */
5720
5721 u32 channel_mask;
5722/* Bit-packed double word (32-bits) that indicates the
5723 * recommended speaker positions for each source channel.
5724 */
5725
5726 u16 enc_options;
5727/* Bit-packed word with values that indicate whether certain
5728 * features of the bitstream are used.
5729 * Supported values: - 0x0001 -- ENCOPT3_PURE_LOSSLESS - 0x0006 --
5730 * ENCOPT3_FRM_SIZE_MOD - 0x0038 -- ENCOPT3_SUBFRM_DIV - 0x0040 --
5731 * ENCOPT3_WRITE_FRAMESIZE_IN_HDR - 0x0080 --
5732 * ENCOPT3_GENERATE_DRC_PARAMS - 0x0100 -- ENCOPT3_RTMBITS
5733 */
5734
5735
5736 u16 usAdvancedEncodeOpt;
5737 /* Advanced encoding option. */
5738
5739 u32 advanced_enc_options2;
5740 /* Advanced encoding option 2. */
5741
5742} __packed;
5743
5744#define ASM_MEDIA_FMT_WMA_V9_V2 0x00010DA8
5745struct asm_wmastdv9_fmt_blk_v2 {
5746 struct apr_hdr hdr;
5747 struct asm_data_cmd_media_fmt_update_v2 fmtblk;
5748 u16 fmtag;
5749/* WMA format tag.
5750 * Supported values: 0x161 (WMA 9 standard)
5751 */
5752
5753 u16 num_channels;
5754/* Number of channels in the stream.
5755 * Supported values: 1, 2
5756 */
5757
5758 u32 sample_rate;
5759/* Number of samples per second (in Hertz).
5760 * Supported values: 48000
5761 */
5762
5763 u32 avg_bytes_per_sec;
5764 /* Bitrate expressed as the average bytes per second. */
5765
5766 u16 blk_align;
5767/* Block align. All WMA files with a maximum packet size of
5768 * 13376 are supported.
5769 */
5770
5771
5772 u16 bits_per_sample;
5773/* Number of bits per sample in the output.
5774 * Supported values: 16
5775 */
5776
5777 u32 channel_mask;
5778/* Channel mask.
5779 * Supported values:
5780 * - 3 -- Stereo (front left/front right)
5781 * - 4 -- Mono (center)
5782 */
5783
5784 u16 enc_options;
5785 /* Options used during encoding. */
5786
5787 u16 reserved;
5788
5789} __packed;
5790
5791#define ASM_MEDIA_FMT_WMA_V8 0x00010D91
5792
5793struct asm_wmastdv8_enc_cfg {
5794 struct apr_hdr hdr;
5795 struct asm_stream_cmd_set_encdec_param encdec;
5796 struct asm_enc_cfg_blk_param_v2 encblk;
5797 u32 bit_rate;
5798 /* Encoding rate in bits per second. */
5799
5800 u32 sample_rate;
5801/* Number of samples per second.
5802 *
5803 * Supported values:
5804 * - 0 -- Native mode
5805 * - Other Supported values are 22050, 32000, 44100, and 48000.
5806 *
5807 * Native mode indicates that encoding must be performed with the
5808 * sampling rate at the input.
5809 * The sampling rate must not change during encoding.
5810 */
5811
5812 u16 channel_cfg;
5813/* Number of channels to encode.
5814 * Supported values:
5815 * - 0 -- Native mode
5816 * - 1 -- Mono
5817 * - 2 -- Stereo
5818 * - Other values are not supported.
5819 *
5820 * Native mode indicates that encoding must be performed with the
5821 * number of channels at the input.
5822 * The number of channels must not change during encoding.
5823 */
5824
5825 u16 reserved;
5826 /* Reserved. Clients must set this field to zero.*/
5827 } __packed;
5828
5829#define ASM_MEDIA_FMT_AMR_WB_PLUS_V2 0x00010DA9
5830
5831struct asm_amrwbplus_fmt_blk_v2 {
5832 struct apr_hdr hdr;
5833 struct asm_data_cmd_media_fmt_update_v2 fmtblk;
5834 u32 amr_frame_fmt;
5835/* AMR frame format.
5836 * Supported values:
5837 * - 6 -- Transport Interface Format (TIF)
5838 * - Any other value -- File storage format (FSF)
5839 *
5840 * TIF stream contains 2-byte header for each frame within the
5841 * superframe. FSF stream contains one 2-byte header per superframe.
5842 */
5843
5844} __packed;
5845
5846#define ASM_MEDIA_FMT_AC3 0x00010DEE
5847#define ASM_MEDIA_FMT_EAC3 0x00010DEF
5848#define ASM_MEDIA_FMT_DTS 0x00010D88
5849#define ASM_MEDIA_FMT_MP2 0x00010DE9
5850#define ASM_MEDIA_FMT_FLAC 0x00010C16
5851#define ASM_MEDIA_FMT_ALAC 0x00012F31
5852#define ASM_MEDIA_FMT_VORBIS 0x00010C15
5853#define ASM_MEDIA_FMT_APE 0x00012F32
5854#define ASM_MEDIA_FMT_DSD 0x00012F3E
5855#define ASM_MEDIA_FMT_TRUEHD 0x00013215
5856/* 0x0 is used for fomat ID since ADSP dynamically determines the
5857 * format encapsulated in the IEC61937 (compressed) or IEC60958
5858 * (pcm) packets.
5859 */
5860#define ASM_MEDIA_FMT_IEC 0x00000000
5861
5862/* Media format ID for adaptive transform acoustic coding. This
5863 * ID is used by the #ASM_STREAM_CMD_OPEN_WRITE_COMPRESSED command
5864 * only.
5865 */
5866
5867#define ASM_MEDIA_FMT_ATRAC 0x00010D89
5868
5869/* Media format ID for metadata-enhanced audio transmission.
5870 * This ID is used by the #ASM_STREAM_CMD_OPEN_WRITE_COMPRESSED
5871 * command only.
5872 */
5873
5874#define ASM_MEDIA_FMT_MAT 0x00010D8A
5875
5876/* adsp_media_fmt.h */
5877
5878#define ASM_DATA_CMD_WRITE_V2 0x00010DAB
5879
5880struct asm_data_cmd_write_v2 {
5881 struct apr_hdr hdr;
5882 u32 buf_addr_lsw;
5883/* The 64 bit address msw-lsw should be a valid, mapped address.
5884 * 64 bit address should be a multiple of 32 bytes
5885 */
5886
5887 u32 buf_addr_msw;
5888/* The 64 bit address msw-lsw should be a valid, mapped address.
5889 * 64 bit address should be a multiple of 32 bytes.
5890 * -Address of the buffer containing the data to be decoded.
5891 * The buffer should be aligned to a 32 byte boundary.
5892 * -In the case of 32 bit Shared memory address, msw field must
5893 * -be set to zero.
5894 * -In the case of 36 bit shared memory address, bit 31 to bit 4
5895 * -of msw must be set to zero.
5896 */
5897 u32 mem_map_handle;
5898/* memory map handle returned by DSP through
5899 * ASM_CMD_SHARED_MEM_MAP_REGIONS command
5900 */
5901 u32 buf_size;
5902/* Number of valid bytes available in the buffer for decoding. The
5903 * first byte starts at buf_addr.
5904 */
5905
5906 u32 seq_id;
5907 /* Optional buffer sequence ID. */
5908
5909 u32 timestamp_lsw;
5910/* Lower 32 bits of the 64-bit session time in microseconds of the
5911 * first buffer sample.
5912 */
5913
5914 u32 timestamp_msw;
5915/* Upper 32 bits of the 64-bit session time in microseconds of the
5916 * first buffer sample.
5917 */
5918
5919 u32 flags;
5920/* Bitfield of flags.
5921 * Supported values for bit 31:
5922 * - 1 -- Valid timestamp.
5923 * - 0 -- Invalid timestamp.
5924 * - Use #ASM_BIT_MASKIMESTAMP_VALID_FLAG as the bitmask and
5925 * #ASM_SHIFTIMESTAMP_VALID_FLAG as the shift value to set this bit.
5926 * Supported values for bit 30:
5927 * - 1 -- Last buffer.
5928 * - 0 -- Not the last buffer.
5929 *
5930 * Supported values for bit 29:
5931 * - 1 -- Continue the timestamp from the previous buffer.
5932 * - 0 -- Timestamp of the current buffer is not related
5933 * to the timestamp of the previous buffer.
5934 * - Use #ASM_BIT_MASKS_CONTINUE_FLAG and #ASM_SHIFTS_CONTINUE_FLAG
5935 * to set this bit.
5936 *
5937 * Supported values for bit 4:
5938 * - 1 -- End of the frame.
5939 * - 0 -- Not the end of frame, or this information is not known.
5940 * - Use #ASM_BIT_MASK_EOF_FLAG as the bitmask and #ASM_SHIFT_EOF_FLAG
5941 * as the shift value to set this bit.
5942 *
5943 * All other bits are reserved and must be set to 0.
5944 *
5945 * If bit 31=0 and bit 29=1: The timestamp of the first sample in
5946 * this buffer continues from the timestamp of the last sample in
5947 * the previous buffer. If there is no previous buffer (i.e., this
5948 * is the first buffer sent after opening the stream or after a
5949 * flush operation), or if the previous buffer does not have a valid
5950 * timestamp, the samples in the current buffer also do not have a
5951 * valid timestamp. They are played out as soon as possible.
5952 *
5953 *
5954 * If bit 31=0 and bit 29=0: No timestamp is associated with the
5955 * first sample in this buffer. The samples are played out as soon
5956 * as possible.
5957 *
5958 *
5959 * If bit 31=1 and bit 29 is ignored: The timestamp specified in
5960 * this payload is honored.
5961 *
5962 *
5963 * If bit 30=0: Not the last buffer in the stream. This is useful
5964 * in removing trailing samples.
5965 *
5966 *
5967 * For bit 4: The client can set this flag for every buffer sent in
5968 * which the last byte is the end of a frame. If this flag is set,
5969 * the buffer can contain data from multiple frames, but it should
5970 * always end at a frame boundary. Restrictions allow the aDSP to
5971 * detect an end of frame without requiring additional processing.
5972 */
5973
5974} __packed;
5975
5976#define ASM_DATA_CMD_READ_V2 0x00010DAC
5977
5978struct asm_data_cmd_read_v2 {
5979 struct apr_hdr hdr;
5980 u32 buf_addr_lsw;
5981/* the 64 bit address msw-lsw should be a valid mapped address
5982 * and should be a multiple of 32 bytes
5983 */
5984
5985
5986 u32 buf_addr_msw;
5987/* the 64 bit address msw-lsw should be a valid mapped address
5988 * and should be a multiple of 32 bytes.
5989 * - Address of the buffer where the DSP puts the encoded data,
5990 * potentially, at an offset specified by the uOffset field in
5991 * ASM_DATA_EVENT_READ_DONE structure. The buffer should be aligned
5992 * to a 32 byte boundary.
5993 * - In the case of 32 bit Shared memory address, msw field must
5994 * - be set to zero.
5995 * - In the case of 36 bit shared memory address, bit 31 to bit
5996 * - 4 of msw must be set to zero.
5997 */
5998 u32 mem_map_handle;
5999/* memory map handle returned by DSP through
6000 * ASM_CMD_SHARED_MEM_MAP_REGIONS command.
6001 */
6002
6003 u32 buf_size;
6004/* Number of bytes available for the aDSP to write. The aDSP
6005 * starts writing from buf_addr.
6006 */
6007
6008 u32 seq_id;
6009 /* Optional buffer sequence ID. */
6010} __packed;
6011
6012#define ASM_DATA_CMD_EOS 0x00010BDB
6013#define ASM_DATA_EVENT_RENDERED_EOS 0x00010C1C
6014#define ASM_DATA_EVENT_EOS 0x00010BDD
6015
6016#define ASM_DATA_EVENT_WRITE_DONE_V2 0x00010D99
6017struct asm_data_event_write_done_v2 {
6018 u32 buf_addr_lsw;
6019 /* lsw of the 64 bit address */
6020 u32 buf_addr_msw;
6021 /* msw of the 64 bit address. address given by the client in
6022 * ASM_DATA_CMD_WRITE_V2 command.
6023 */
6024 u32 mem_map_handle;
6025 /* memory map handle in the ASM_DATA_CMD_WRITE_V2 */
6026
6027 u32 status;
6028/* Status message (error code) that indicates whether the
6029 * referenced buffer has been successfully consumed.
6030 * Supported values: Refer to @xhyperref{Q3,[Q3]}
6031 */
6032} __packed;
6033
6034#define ASM_DATA_EVENT_READ_DONE_V2 0x00010D9A
6035
6036/* Definition of the frame metadata flag bitmask.*/
6037#define ASM_BIT_MASK_FRAME_METADATA_FLAG (0x40000000UL)
6038
6039/* Definition of the frame metadata flag shift value. */
6040#define ASM_SHIFT_FRAME_METADATA_FLAG 30
6041
6042struct asm_data_event_read_done_v2 {
6043 u32 status;
6044/* Status message (error code).
6045 * Supported values: Refer to @xhyperref{Q3,[Q3]}
6046 */
6047
6048u32 buf_addr_lsw;
6049/* 64 bit address msw-lsw is a valid, mapped address. 64 bit
6050 * address is a multiple of 32 bytes.
6051 */
6052
6053u32 buf_addr_msw;
6054/* 64 bit address msw-lsw is a valid, mapped address. 64 bit
6055 * address is a multiple of 32 bytes.
6056 *
6057 * -Same address provided by the client in ASM_DATA_CMD_READ_V2
6058 * -In the case of 32 bit Shared memory address, msw field is set to
6059 * zero.
6060 * -In the case of 36 bit shared memory address, bit 31 to bit 4
6061 * -of msw is set to zero.
6062 */
6063
6064u32 mem_map_handle;
6065/* memory map handle in the ASM_DATA_CMD_READ_V2 */
6066
6067u32 enc_framesotal_size;
6068/* Total size of the encoded frames in bytes.
6069 * Supported values: >0
6070 */
6071
6072u32 offset;
6073/* Offset (from buf_addr) to the first byte of the first encoded
6074 * frame. All encoded frames are consecutive, starting from this
6075 * offset.
6076 * Supported values: > 0
6077 */
6078
6079u32 timestamp_lsw;
6080/* Lower 32 bits of the 64-bit session time in microseconds of
6081 * the first sample in the buffer. If Bit 5 of mode_flags flag of
6082 * ASM_STREAM_CMD_OPEN_READ_V2 is 1 then the 64 bit timestamp is
6083 * absolute capture time otherwise it is relative session time. The
6084 * absolute timestamp doesn't reset unless the system is reset.
6085 */
6086
6087
6088u32 timestamp_msw;
6089/* Upper 32 bits of the 64-bit session time in microseconds of
6090 * the first sample in the buffer.
6091 */
6092
6093
6094u32 flags;
6095/* Bitfield of flags. Bit 30 indicates whether frame metadata is
6096 * present. If frame metadata is present, num_frames consecutive
6097 * instances of @xhyperref{hdr:FrameMetaData,Frame metadata} start
6098 * at the buffer address.
6099 * Supported values for bit 31:
6100 * - 1 -- Timestamp is valid.
6101 * - 0 -- Timestamp is invalid.
6102 * - Use #ASM_BIT_MASKIMESTAMP_VALID_FLAG and
6103 * #ASM_SHIFTIMESTAMP_VALID_FLAG to set this bit.
6104 *
6105 * Supported values for bit 30:
6106 * - 1 -- Frame metadata is present.
6107 * - 0 -- Frame metadata is absent.
6108 * - Use #ASM_BIT_MASK_FRAME_METADATA_FLAG and
6109 * #ASM_SHIFT_FRAME_METADATA_FLAG to set this bit.
6110 *
6111 * All other bits are reserved; the aDSP sets them to 0.
6112 */
6113
6114u32 num_frames;
6115/* Number of encoded frames in the buffer. */
6116
6117u32 seq_id;
6118/* Optional buffer sequence ID. */
6119} __packed;
6120
6121struct asm_data_read_buf_metadata_v2 {
6122 u32 offset;
6123/* Offset from buf_addr in #ASM_DATA_EVENT_READ_DONE_PAYLOAD to
6124 * the frame associated with this metadata.
6125 * Supported values: > 0
6126 */
6127
6128u32 frm_size;
6129/* Size of the encoded frame in bytes.
6130 * Supported values: > 0
6131 */
6132
6133u32 num_encoded_pcm_samples;
6134/* Number of encoded PCM samples (per channel) in the frame
6135 * associated with this metadata.
6136 * Supported values: > 0
6137 */
6138
6139u32 timestamp_lsw;
6140/* Lower 32 bits of the 64-bit session time in microseconds of the
6141 * first sample for this frame.
6142 * If Bit 5 of mode_flags flag of ASM_STREAM_CMD_OPEN_READ_V2 is 1
6143 * then the 64 bit timestamp is absolute capture time otherwise it
6144 * is relative session time. The absolute timestamp doesn't reset
6145 * unless the system is reset.
6146 */
6147
6148
6149u32 timestamp_msw;
6150/* Lower 32 bits of the 64-bit session time in microseconds of the
6151 * first sample for this frame.
6152 */
6153
6154u32 flags;
6155/* Frame flags.
6156 * Supported values for bit 31:
6157 * - 1 -- Time stamp is valid
6158 * - 0 -- Time stamp is not valid
6159 * - All other bits are reserved; the aDSP sets them to 0.
6160 */
6161} __packed;
6162
6163/* Notifies the client of a change in the data sampling rate or
6164 * Channel mode. This event is raised by the decoder service. The
6165 * event is enabled through the mode flags of
6166 * #ASM_STREAM_CMD_OPEN_WRITE_V2 or
6167 * #ASM_STREAM_CMD_OPEN_READWRITE_V2. - The decoder detects a change
6168 * in the output sampling frequency or the number/positioning of
6169 * output channels, or if it is the first frame decoded.The new
6170 * sampling frequency or the new channel configuration is
6171 * communicated back to the client asynchronously.
6172 */
6173
6174#define ASM_DATA_EVENT_SR_CM_CHANGE_NOTIFY 0x00010C65
6175
6176/* Payload of the #ASM_DATA_EVENT_SR_CM_CHANGE_NOTIFY event.
6177 * This event is raised when the following conditions are both true:
6178 * - The event is enabled through the mode_flags of
6179 * #ASM_STREAM_CMD_OPEN_WRITE_V2 or
6180 * #ASM_STREAM_CMD_OPEN_READWRITE_V2. - The decoder detects a change
6181 * in either the output sampling frequency or the number/positioning
6182 * of output channels, or if it is the first frame decoded.
6183 * This event is not raised (even if enabled) if the decoder is
6184 * MIDI, because
6185 */
6186
6187
6188struct asm_data_event_sr_cm_change_notify {
6189 u32 sample_rate;
6190/* New sampling rate (in Hertz) after detecting a change in the
6191 * bitstream.
6192 * Supported values: 2000 to 48000
6193 */
6194
6195 u16 num_channels;
6196/* New number of channels after detecting a change in the
6197 * bitstream.
6198 * Supported values: 1 to 8
6199 */
6200
6201
6202 u16 reserved;
6203 /* Reserved for future use. This field must be set to 0.*/
6204
6205 u8 channel_mapping[8];
6206
6207} __packed;
6208
6209/* Notifies the client of a data sampling rate or channel mode
6210 * change. This event is raised by the encoder service.
6211 * This event is raised when :
6212 * - Native mode encoding was requested in the encoder
6213 * configuration (i.e., the channel number was 0), the sample rate
6214 * was 0, or both were 0.
6215 *
6216 * - The input data frame at the encoder is the first one, or the
6217 * sampling rate/channel mode is different from the previous input
6218 * data frame.
6219 *
6220 */
6221#define ASM_DATA_EVENT_ENC_SR_CM_CHANGE_NOTIFY 0x00010BDE
6222
6223struct asm_data_event_enc_sr_cm_change_notify {
6224 u32 sample_rate;
6225/* New sampling rate (in Hertz) after detecting a change in the
6226 * input data.
6227 * Supported values: 2000 to 48000
6228 */
6229
6230
6231 u16 num_channels;
6232/* New number of channels after detecting a change in the input
6233 * data. Supported values: 1 to 8
6234 */
6235
6236
6237 u16 bits_per_sample;
6238/* New bits per sample after detecting a change in the input
6239 * data.
6240 * Supported values: 16, 24
6241 */
6242
6243
6244 u8 channel_mapping[8];
6245
6246} __packed;
6247#define ASM_DATA_CMD_IEC_60958_FRAME_RATE 0x00010D87
6248
6249
6250/* Payload of the #ASM_DATA_CMD_IEC_60958_FRAME_RATE command,
6251 * which is used to indicate the IEC 60958 frame rate of a given
6252 * packetized audio stream.
6253 */
6254
6255struct asm_data_cmd_iec_60958_frame_rate {
6256 u32 frame_rate;
6257/* IEC 60958 frame rate of the incoming IEC 61937 packetized stream.
6258 * Supported values: Any valid frame rate
6259 */
6260} __packed;
6261
6262/* adsp_asm_data_commands.h*/
6263/* Definition of the stream ID bitmask.*/
6264#define ASM_BIT_MASK_STREAM_ID (0x000000FFUL)
6265
6266/* Definition of the stream ID shift value.*/
6267#define ASM_SHIFT_STREAM_ID 0
6268
6269/* Definition of the session ID bitmask.*/
6270#define ASM_BIT_MASK_SESSION_ID (0x0000FF00UL)
6271
6272/* Definition of the session ID shift value.*/
6273#define ASM_SHIFT_SESSION_ID 8
6274
6275/* Definition of the service ID bitmask.*/
6276#define ASM_BIT_MASK_SERVICE_ID (0x00FF0000UL)
6277
6278/* Definition of the service ID shift value.*/
6279#define ASM_SHIFT_SERVICE_ID 16
6280
6281/* Definition of the domain ID bitmask.*/
6282#define ASM_BIT_MASK_DOMAIN_ID (0xFF000000UL)
6283
6284/* Definition of the domain ID shift value.*/
6285#define ASM_SHIFT_DOMAIN_ID 24
6286
6287#define ASM_CMD_SHARED_MEM_MAP_REGIONS 0x00010D92
6288#define ASM_CMDRSP_SHARED_MEM_MAP_REGIONS 0x00010D93
6289#define ASM_CMD_SHARED_MEM_UNMAP_REGIONS 0x00010D94
6290
6291/* adsp_asm_service_commands.h */
6292
6293#define ASM_MAX_SESSION_ID (15)
6294
6295/* Maximum number of sessions.*/
6296#define ASM_MAX_NUM_SESSIONS ASM_MAX_SESSION_ID
6297
6298/* Maximum number of streams per session.*/
6299#define ASM_MAX_STREAMS_PER_SESSION (8)
6300#define ASM_SESSION_CMD_RUN_V2 0x00010DAA
6301#define ASM_SESSION_CMD_RUN_STARTIME_RUN_IMMEDIATE 0
6302#define ASM_SESSION_CMD_RUN_STARTIME_RUN_AT_ABSOLUTEIME 1
6303#define ASM_SESSION_CMD_RUN_STARTIME_RUN_AT_RELATIVEIME 2
6304#define ASM_SESSION_CMD_RUN_STARTIME_RUN_WITH_DELAY 3
6305
6306#define ASM_BIT_MASK_RUN_STARTIME (0x00000003UL)
6307
6308/* Bit shift value used to specify the start time for the
6309 * ASM_SESSION_CMD_RUN_V2 command.
6310 */
6311#define ASM_SHIFT_RUN_STARTIME 0
6312struct asm_session_cmd_run_v2 {
6313 struct apr_hdr hdr;
6314 u32 flags;
6315/* Specifies whether to run immediately or at a specific
6316 * rendering time or with a specified delay. Run with delay is
6317 * useful for delaying in case of ASM loopback opened through
6318 * ASM_STREAM_CMD_OPEN_LOOPBACK_V2. Use #ASM_BIT_MASK_RUN_STARTIME
6319 * and #ASM_SHIFT_RUN_STARTIME to set this 2-bit flag.
6320 *
6321 *
6322 *Bits 0 and 1 can take one of four possible values:
6323 *
6324 *- #ASM_SESSION_CMD_RUN_STARTIME_RUN_IMMEDIATE
6325 *- #ASM_SESSION_CMD_RUN_STARTIME_RUN_AT_ABSOLUTEIME
6326 *- #ASM_SESSION_CMD_RUN_STARTIME_RUN_AT_RELATIVEIME
6327 *- #ASM_SESSION_CMD_RUN_STARTIME_RUN_WITH_DELAY
6328 *
6329 *All other bits are reserved; clients must set them to zero.
6330 */
6331
6332 u32 time_lsw;
6333/* Lower 32 bits of the time in microseconds used to align the
6334 * session origin time. When bits 0-1 of flags is
6335 * ASM_SESSION_CMD_RUN_START_RUN_WITH_DELAY, time lsw is the lsw of
6336 * the delay in us. For ASM_SESSION_CMD_RUN_START_RUN_WITH_DELAY,
6337 * maximum value of the 64 bit delay is 150 ms.
6338 */
6339
6340 u32 time_msw;
6341/* Upper 32 bits of the time in microseconds used to align the
6342 * session origin time. When bits 0-1 of flags is
6343 * ASM_SESSION_CMD_RUN_START_RUN_WITH_DELAY, time msw is the msw of
6344 * the delay in us. For ASM_SESSION_CMD_RUN_START_RUN_WITH_DELAY,
6345 * maximum value of the 64 bit delay is 150 ms.
6346 */
6347
6348} __packed;
6349
6350#define ASM_SESSION_CMD_PAUSE 0x00010BD3
6351#define ASM_SESSION_CMD_SUSPEND 0x00010DEC
6352#define ASM_SESSION_CMD_GET_SESSIONTIME_V3 0x00010D9D
6353#define ASM_SESSION_CMD_REGISTER_FOR_RX_UNDERFLOW_EVENTS 0x00010BD5
6354
6355struct asm_session_cmd_rgstr_rx_underflow {
6356 struct apr_hdr hdr;
6357 u16 enable_flag;
6358/* Specifies whether a client is to receive events when an Rx
6359 * session underflows.
6360 * Supported values:
6361 * - 0 -- Do not send underflow events
6362 * - 1 -- Send underflow events
6363 */
6364 u16 reserved;
6365 /* Reserved. This field must be set to zero.*/
6366} __packed;
6367
6368#define ASM_SESSION_CMD_REGISTER_FORX_OVERFLOW_EVENTS 0x00010BD6
6369
6370struct asm_session_cmd_regx_overflow {
6371 struct apr_hdr hdr;
6372 u16 enable_flag;
6373/* Specifies whether a client is to receive events when a Tx
6374 * session overflows.
6375 * Supported values:
6376 * - 0 -- Do not send overflow events
6377 * - 1 -- Send overflow events
6378 */
6379
6380 u16 reserved;
6381 /* Reserved. This field must be set to zero.*/
6382} __packed;
6383
6384#define ASM_SESSION_EVENT_RX_UNDERFLOW 0x00010C17
6385#define ASM_SESSION_EVENTX_OVERFLOW 0x00010C18
6386#define ASM_SESSION_CMDRSP_GET_SESSIONTIME_V3 0x00010D9E
6387
6388struct asm_session_cmdrsp_get_sessiontime_v3 {
6389 u32 status;
6390 /* Status message (error code).
6391 * Supported values: Refer to @xhyperref{Q3,[Q3]}
6392 */
6393
6394 u32 sessiontime_lsw;
6395 /* Lower 32 bits of the current session time in microseconds.*/
6396
6397 u32 sessiontime_msw;
6398 /* Upper 32 bits of the current session time in microseconds.*/
6399
6400 u32 absolutetime_lsw;
6401/* Lower 32 bits in micro seconds of the absolute time at which
6402 * the * sample corresponding to the above session time gets
6403 * rendered * to hardware. This absolute time may be slightly in the
6404 * future or past.
6405 */
6406
6407
6408 u32 absolutetime_msw;
6409/* Upper 32 bits in micro seconds of the absolute time at which
6410 * the * sample corresponding to the above session time gets
6411 * rendered to * hardware. This absolute time may be slightly in the
6412 * future or past.
6413 */
6414
6415} __packed;
6416
6417#define ASM_SESSION_CMD_ADJUST_SESSION_CLOCK_V2 0x00010D9F
6418
6419struct asm_session_cmd_adjust_session_clock_v2 {
6420 struct apr_hdr hdr;
6421u32 adjustime_lsw;
6422/* Lower 32 bits of the signed 64-bit quantity that specifies the
6423 * adjustment time in microseconds to the session clock.
6424 *
6425 * Positive values indicate advancement of the session clock.
6426 * Negative values indicate delay of the session clock.
6427 */
6428
6429
6430 u32 adjustime_msw;
6431/* Upper 32 bits of the signed 64-bit quantity that specifies
6432 * the adjustment time in microseconds to the session clock.
6433 * Positive values indicate advancement of the session clock.
6434 * Negative values indicate delay of the session clock.
6435 */
6436
6437} __packed;
6438
6439#define ASM_SESSION_CMDRSP_ADJUST_SESSION_CLOCK_V2 0x00010DA0
6440
6441struct asm_session_cmdrsp_adjust_session_clock_v2 {
6442 u32 status;
6443/* Status message (error code).
6444 * Supported values: Refer to @xhyperref{Q3,[Q3]}
6445 * An error means the session clock is not adjusted. In this case,
6446 * the next two fields are irrelevant.
6447 */
6448
6449
6450 u32 actual_adjustime_lsw;
6451/* Lower 32 bits of the signed 64-bit quantity that specifies
6452 * the actual adjustment in microseconds performed by the aDSP.
6453 * A positive value indicates advancement of the session clock. A
6454 * negative value indicates delay of the session clock.
6455 */
6456
6457
6458 u32 actual_adjustime_msw;
6459/* Upper 32 bits of the signed 64-bit quantity that specifies
6460 * the actual adjustment in microseconds performed by the aDSP.
6461 * A positive value indicates advancement of the session clock. A
6462 * negative value indicates delay of the session clock.
6463 */
6464
6465
6466 u32 cmd_latency_lsw;
6467/* Lower 32 bits of the unsigned 64-bit quantity that specifies
6468 * the amount of time in microseconds taken to perform the session
6469 * clock adjustment.
6470 */
6471
6472
6473 u32 cmd_latency_msw;
6474/* Upper 32 bits of the unsigned 64-bit quantity that specifies
6475 * the amount of time in microseconds taken to perform the session
6476 * clock adjustment.
6477 */
6478
6479} __packed;
6480
6481#define ASM_SESSION_CMD_GET_PATH_DELAY_V2 0x00010DAF
6482#define ASM_SESSION_CMDRSP_GET_PATH_DELAY_V2 0x00010DB0
6483
6484struct asm_session_cmdrsp_get_path_delay_v2 {
6485 u32 status;
6486/* Status message (error code). Whether this get delay operation
6487 * is successful or not. Delay value is valid only if status is
6488 * success.
6489 * Supported values: Refer to @xhyperref{Q5,[Q5]}
6490 */
6491
6492 u32 audio_delay_lsw;
6493 /* Upper 32 bits of the aDSP delay in microseconds. */
6494
6495 u32 audio_delay_msw;
6496 /* Lower 32 bits of the aDSP delay in microseconds. */
6497
6498} __packed;
6499
6500/* adsp_asm_session_command.h*/
6501#define ASM_STREAM_CMD_OPEN_WRITE_V3 0x00010DB3
6502
6503#define ASM_LOW_LATENCY_STREAM_SESSION 0x10000000
6504
6505#define ASM_ULTRA_LOW_LATENCY_STREAM_SESSION 0x20000000
6506
6507#define ASM_ULL_POST_PROCESSING_STREAM_SESSION 0x40000000
6508
6509#define ASM_LEGACY_STREAM_SESSION 0
6510
6511
6512struct asm_stream_cmd_open_write_v3 {
6513 struct apr_hdr hdr;
6514 uint32_t mode_flags;
6515/* Mode flags that configure the stream to notify the client
6516 * whenever it detects an SR/CM change at the input to its POPP.
6517 * Supported values for bits 0 to 1:
6518 * - Reserved; clients must set them to zero.
6519 * Supported values for bit 2:
6520 * - 0 -- SR/CM change notification event is disabled.
6521 * - 1 -- SR/CM change notification event is enabled.
6522 * - Use #ASM_BIT_MASK_SR_CM_CHANGE_NOTIFY_FLAG and
6523 * #ASM_SHIFT_SR_CM_CHANGE_NOTIFY_FLAG to set or get this bit.
6524 *
6525 * Supported values for bit 31:
6526 * - 0 -- Stream to be opened in on-Gapless mode.
6527 * - 1 -- Stream to be opened in Gapless mode. In Gapless mode,
6528 * successive streams must be opened with same session ID but
6529 * different stream IDs.
6530 *
6531 * - Use #ASM_BIT_MASK_GAPLESS_MODE_FLAG and
6532 * #ASM_SHIFT_GAPLESS_MODE_FLAG to set or get this bit.
6533 *
6534 *
6535 * @note1hang MIDI and DTMF streams cannot be opened in Gapless mode.
6536 */
6537
6538 uint16_t sink_endpointype;
6539/*< Sink point type.
6540 * Supported values:
6541 * - 0 -- Device matrix
6542 * - Other values are reserved.
6543 *
6544 * The device matrix is the gateway to the hardware ports.
6545 */
6546
6547 uint16_t bits_per_sample;
6548/*< Number of bits per sample processed by ASM modules.
6549 * Supported values: 16 and 24 bits per sample
6550 */
6551
6552 uint32_t postprocopo_id;
6553/*< Specifies the topology (order of processing) of
6554 * postprocessing algorithms. <i>None</i> means no postprocessing.
6555 * Supported values:
6556 * - #ASM_STREAM_POSTPROCOPO_ID_DEFAULT
6557 * - #ASM_STREAM_POSTPROCOPO_ID_MCH_PEAK_VOL
6558 * - #ASM_STREAM_POSTPROCOPO_ID_NONE
6559 *
6560 * This field can also be enabled through SetParams flags.
6561 */
6562
6563 uint32_t dec_fmt_id;
6564/*< Configuration ID of the decoder media format.
6565 *
6566 * Supported values:
6567 * - #ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V2
6568 * - #ASM_MEDIA_FMT_ADPCM
6569 * - #ASM_MEDIA_FMT_MP3
6570 * - #ASM_MEDIA_FMT_AAC_V2
6571 * - #ASM_MEDIA_FMT_DOLBY_AAC
6572 * - #ASM_MEDIA_FMT_AMRNB_FS
6573 * - #ASM_MEDIA_FMT_AMRWB_FS
6574 * - #ASM_MEDIA_FMT_AMR_WB_PLUS_V2
6575 * - #ASM_MEDIA_FMT_V13K_FS
6576 * - #ASM_MEDIA_FMT_EVRC_FS
6577 * - #ASM_MEDIA_FMT_EVRCB_FS
6578 * - #ASM_MEDIA_FMT_EVRCWB_FS
6579 * - #ASM_MEDIA_FMT_SBC
6580 * - #ASM_MEDIA_FMT_WMA_V10PRO_V2
6581 * - #ASM_MEDIA_FMT_WMA_V9_V2
6582 * - #ASM_MEDIA_FMT_AC3
6583 * - #ASM_MEDIA_FMT_EAC3
6584 * - #ASM_MEDIA_FMT_G711_ALAW_FS
6585 * - #ASM_MEDIA_FMT_G711_MLAW_FS
6586 * - #ASM_MEDIA_FMT_G729A_FS
6587 * - #ASM_MEDIA_FMT_FR_FS
6588 * - #ASM_MEDIA_FMT_VORBIS
6589 * - #ASM_MEDIA_FMT_FLAC
6590 * - #ASM_MEDIA_FMT_ALAC
6591 * - #ASM_MEDIA_FMT_APE
6592 * - #ASM_MEDIA_FMT_EXAMPLE
6593 */
6594} __packed;
6595
6596#define ASM_STREAM_CMD_OPEN_PULL_MODE_WRITE 0x00010DD9
6597
6598/* Bitmask for the stream_perf_mode subfield. */
6599#define ASM_BIT_MASK_STREAM_PERF_FLAG_PULL_MODE_WRITE 0xE0000000UL
6600
6601/* Bitmask for the stream_perf_mode subfield. */
6602#define ASM_SHIFT_STREAM_PERF_FLAG_PULL_MODE_WRITE 29
6603
6604#define ASM_STREAM_CMD_OPEN_PUSH_MODE_READ 0x00010DDA
6605
6606#define ASM_BIT_MASK_STREAM_PERF_FLAG_PUSH_MODE_READ 0xE0000000UL
6607
6608#define ASM_SHIFT_STREAM_PERF_FLAG_PUSH_MODE_READ 29
6609
6610#define ASM_DATA_EVENT_WATERMARK 0x00010DDB
6611
6612struct asm_shared_position_buffer {
6613 volatile uint32_t frame_counter;
6614/* Counter used to handle interprocessor synchronization issues.
6615 * When frame_counter is 0: read_index, wall_clock_us_lsw, and
6616 * wall_clock_us_msw are invalid.
6617 * Supported values: >= 0.
6618 */
6619
6620 volatile uint32_t index;
6621/* Index in bytes from where the aDSP is reading/writing.
6622 * Supported values: 0 to circular buffer size - 1
6623 */
6624
6625 volatile uint32_t wall_clock_us_lsw;
6626/* Lower 32 bits of the 64-bit wall clock time in microseconds when the
6627 * read index was updated.
6628 * Supported values: >= 0
6629 */
6630
6631 volatile uint32_t wall_clock_us_msw;
6632/* Upper 32 bits of the 64 bit wall clock time in microseconds when the
6633 * read index was updated
6634 * Supported values: >= 0
6635 */
6636} __packed;
6637
6638struct asm_shared_watermark_level {
6639 uint32_t watermark_level_bytes;
6640} __packed;
6641
6642struct asm_stream_cmd_open_shared_io {
6643 struct apr_hdr hdr;
6644 uint32_t mode_flags;
6645 uint16_t endpoint_type;
6646 uint16_t topo_bits_per_sample;
6647 uint32_t topo_id;
6648 uint32_t fmt_id;
6649 uint32_t shared_pos_buf_phy_addr_lsw;
6650 uint32_t shared_pos_buf_phy_addr_msw;
6651 uint16_t shared_pos_buf_mem_pool_id;
6652 uint16_t shared_pos_buf_num_regions;
6653 uint32_t shared_pos_buf_property_flag;
6654 uint32_t shared_circ_buf_start_phy_addr_lsw;
6655 uint32_t shared_circ_buf_start_phy_addr_msw;
6656 uint32_t shared_circ_buf_size;
6657 uint16_t shared_circ_buf_mem_pool_id;
6658 uint16_t shared_circ_buf_num_regions;
6659 uint32_t shared_circ_buf_property_flag;
6660 uint32_t num_watermark_levels;
6661 struct asm_multi_channel_pcm_fmt_blk_v3 fmt;
6662 struct avs_shared_map_region_payload map_region_pos_buf;
6663 struct avs_shared_map_region_payload map_region_circ_buf;
6664 struct asm_shared_watermark_level watermark[0];
6665} __packed;
6666
6667#define ASM_STREAM_CMD_OPEN_READ_V3 0x00010DB4
6668
6669/* Definition of the timestamp type flag bitmask */
6670#define ASM_BIT_MASKIMESTAMPYPE_FLAG (0x00000020UL)
6671
6672/* Definition of the timestamp type flag shift value. */
6673#define ASM_SHIFTIMESTAMPYPE_FLAG 5
6674
6675/* Relative timestamp is identified by this value.*/
6676#define ASM_RELATIVEIMESTAMP 0
6677
6678/* Absolute timestamp is identified by this value.*/
6679#define ASM_ABSOLUTEIMESTAMP 1
6680
6681/* Bit value for Low Latency Tx stream subfield */
6682#define ASM_LOW_LATENCY_TX_STREAM_SESSION 1
6683
6684/* Bit shift for the stream_perf_mode subfield. */
6685#define ASM_SHIFT_STREAM_PERF_MODE_FLAG_IN_OPEN_READ 29
6686
6687struct asm_stream_cmd_open_read_v3 {
6688 struct apr_hdr hdr;
6689 u32 mode_flags;
6690/* Mode flags that indicate whether meta information per encoded
6691 * frame is to be provided.
6692 * Supported values for bit 4:
6693 *
6694 * - 0 -- Return data buffer contains all encoded frames only; it
6695 * does not contain frame metadata.
6696 *
6697 * - 1 -- Return data buffer contains an array of metadata and
6698 * encoded frames.
6699 *
6700 * - Use #ASM_BIT_MASK_META_INFO_FLAG as the bitmask and
6701 * #ASM_SHIFT_META_INFO_FLAG as the shift value for this bit.
6702 *
6703 *
6704 * Supported values for bit 5:
6705 *
6706 * - ASM_RELATIVEIMESTAMP -- ASM_DATA_EVENT_READ_DONE_V2 will have
6707 * - relative time-stamp.
6708 * - ASM_ABSOLUTEIMESTAMP -- ASM_DATA_EVENT_READ_DONE_V2 will
6709 * - have absolute time-stamp.
6710 *
6711 * - Use #ASM_BIT_MASKIMESTAMPYPE_FLAG as the bitmask and
6712 * #ASM_SHIFTIMESTAMPYPE_FLAG as the shift value for this bit.
6713 *
6714 * All other bits are reserved; clients must set them to zero.
6715 */
6716
6717 u32 src_endpointype;
6718/* Specifies the endpoint providing the input samples.
6719 * Supported values:
6720 * - 0 -- Device matrix
6721 * - All other values are reserved; clients must set them to zero.
6722 * Otherwise, an error is returned.
6723 * The device matrix is the gateway from the tunneled Tx ports.
6724 */
6725
6726 u32 preprocopo_id;
6727/* Specifies the topology (order of processing) of preprocessing
6728 * algorithms. <i>None</i> means no preprocessing.
6729 * Supported values:
6730 * - #ASM_STREAM_PREPROCOPO_ID_DEFAULT
6731 * - #ASM_STREAM_PREPROCOPO_ID_NONE
6732 *
6733 * This field can also be enabled through SetParams flags.
6734 */
6735
6736 u32 enc_cfg_id;
6737/* Media configuration ID for encoded output.
6738 * Supported values:
6739 * - #ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V2
6740 * - #ASM_MEDIA_FMT_AAC_V2
6741 * - #ASM_MEDIA_FMT_AMRNB_FS
6742 * - #ASM_MEDIA_FMT_AMRWB_FS
6743 * - #ASM_MEDIA_FMT_V13K_FS
6744 * - #ASM_MEDIA_FMT_EVRC_FS
6745 * - #ASM_MEDIA_FMT_EVRCB_FS
6746 * - #ASM_MEDIA_FMT_EVRCWB_FS
6747 * - #ASM_MEDIA_FMT_SBC
6748 * - #ASM_MEDIA_FMT_G711_ALAW_FS
6749 * - #ASM_MEDIA_FMT_G711_MLAW_FS
6750 * - #ASM_MEDIA_FMT_G729A_FS
6751 * - #ASM_MEDIA_FMT_EXAMPLE
6752 * - #ASM_MEDIA_FMT_WMA_V8
6753 */
6754
6755 u16 bits_per_sample;
6756/* Number of bits per sample processed by ASM modules.
6757 * Supported values: 16 and 24 bits per sample
6758 */
6759
6760 u16 reserved;
6761/* Reserved for future use. This field must be set to zero.*/
6762} __packed;
6763
6764#define ASM_POPP_OUTPUT_SR_NATIVE_RATE 0
6765
6766/* Enumeration for the maximum sampling rate at the POPP output.*/
6767#define ASM_POPP_OUTPUT_SR_MAX_RATE 48000
6768
6769#define ASM_STREAM_CMD_OPEN_READWRITE_V2 0x00010D8D
6770#define ASM_STREAM_CMD_OPEN_READWRITE_V2 0x00010D8D
6771
6772struct asm_stream_cmd_open_readwrite_v2 {
6773 struct apr_hdr hdr;
6774 u32 mode_flags;
6775/* Mode flags.
6776 * Supported values for bit 2:
6777 * - 0 -- SR/CM change notification event is disabled.
6778 * - 1 -- SR/CM change notification event is enabled. Use
6779 * #ASM_BIT_MASK_SR_CM_CHANGE_NOTIFY_FLAG and
6780 * #ASM_SHIFT_SR_CM_CHANGE_NOTIFY_FLAG to set or
6781 * getting this flag.
6782 *
6783 * Supported values for bit 4:
6784 * - 0 -- Return read data buffer contains all encoded frames only; it
6785 * does not contain frame metadata.
6786 * - 1 -- Return read data buffer contains an array of metadata and
6787 * encoded frames.
6788 *
6789 * All other bits are reserved; clients must set them to zero.
6790 */
6791
6792 u32 postprocopo_id;
6793/* Specifies the topology (order of processing) of postprocessing
6794 * algorithms. <i>None</i> means no postprocessing.
6795 *
6796 * Supported values:
6797 * - #ASM_STREAM_POSTPROCOPO_ID_DEFAULT
6798 * - #ASM_STREAM_POSTPROCOPO_ID_MCH_PEAK_VOL
6799 * - #ASM_STREAM_POSTPROCOPO_ID_NONE
6800 */
6801
6802 u32 dec_fmt_id;
6803/* Specifies the media type of the input data. PCM indicates that
6804 * no decoding must be performed, e.g., this is an NT encoder
6805 * session.
6806 * Supported values:
6807 * - #ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V2
6808 * - #ASM_MEDIA_FMT_ADPCM
6809 * - #ASM_MEDIA_FMT_MP3
6810 * - #ASM_MEDIA_FMT_AAC_V2
6811 * - #ASM_MEDIA_FMT_DOLBY_AAC
6812 * - #ASM_MEDIA_FMT_AMRNB_FS
6813 * - #ASM_MEDIA_FMT_AMRWB_FS
6814 * - #ASM_MEDIA_FMT_V13K_FS
6815 * - #ASM_MEDIA_FMT_EVRC_FS
6816 * - #ASM_MEDIA_FMT_EVRCB_FS
6817 * - #ASM_MEDIA_FMT_EVRCWB_FS
6818 * - #ASM_MEDIA_FMT_SBC
6819 * - #ASM_MEDIA_FMT_WMA_V10PRO_V2
6820 * - #ASM_MEDIA_FMT_WMA_V9_V2
6821 * - #ASM_MEDIA_FMT_AMR_WB_PLUS_V2
6822 * - #ASM_MEDIA_FMT_AC3
6823 * - #ASM_MEDIA_FMT_G711_ALAW_FS
6824 * - #ASM_MEDIA_FMT_G711_MLAW_FS
6825 * - #ASM_MEDIA_FMT_G729A_FS
6826 * - #ASM_MEDIA_FMT_EXAMPLE
6827 */
6828
6829 u32 enc_cfg_id;
6830/* Specifies the media type for the output of the stream. PCM
6831 * indicates that no encoding must be performed, e.g., this is an NT
6832 * decoder session.
6833 * Supported values:
6834 * - #ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V2
6835 * - #ASM_MEDIA_FMT_AAC_V2
6836 * - #ASM_MEDIA_FMT_AMRNB_FS
6837 * - #ASM_MEDIA_FMT_AMRWB_FS
6838 * - #ASM_MEDIA_FMT_V13K_FS
6839 * - #ASM_MEDIA_FMT_EVRC_FS
6840 * - #ASM_MEDIA_FMT_EVRCB_FS
6841 * - #ASM_MEDIA_FMT_EVRCWB_FS
6842 * - #ASM_MEDIA_FMT_SBC
6843 * - #ASM_MEDIA_FMT_G711_ALAW_FS
6844 * - #ASM_MEDIA_FMT_G711_MLAW_FS
6845 * - #ASM_MEDIA_FMT_G729A_FS
6846 * - #ASM_MEDIA_FMT_EXAMPLE
6847 * - #ASM_MEDIA_FMT_WMA_V8
6848 */
6849
6850 u16 bits_per_sample;
6851/* Number of bits per sample processed by ASM modules.
6852 * Supported values: 16 and 24 bits per sample
6853 */
6854
6855 u16 reserved;
6856/* Reserved for future use. This field must be set to zero.*/
6857
6858} __packed;
6859
6860#define ASM_STREAM_CMD_OPEN_LOOPBACK_V2 0x00010D8E
6861struct asm_stream_cmd_open_loopback_v2 {
6862 struct apr_hdr hdr;
6863 u32 mode_flags;
6864/* Mode flags.
6865 * Bit 0-31: reserved; client should set these bits to 0
6866 */
6867 u16 src_endpointype;
6868 /* Endpoint type. 0 = Tx Matrix */
6869 u16 sink_endpointype;
6870 /* Endpoint type. 0 = Rx Matrix */
6871 u32 postprocopo_id;
6872/* Postprocessor topology ID. Specifies the topology of
6873 * postprocessing algorithms.
6874 */
6875
6876 u16 bits_per_sample;
6877/* The number of bits per sample processed by ASM modules
6878 * Supported values: 16 and 24 bits per sample
6879 */
6880 u16 reserved;
6881/* Reserved for future use. This field must be set to zero. */
6882} __packed;
6883
6884
6885#define ASM_STREAM_CMD_OPEN_TRANSCODE_LOOPBACK 0x00010DBA
6886
6887/* Bitmask for the stream's Performance mode. */
6888#define ASM_BIT_MASK_STREAM_PERF_MODE_FLAG_IN_OPEN_TRANSCODE_LOOPBACK \
6889 (0x70000000UL)
6890
6891/* Bit shift for the stream's Performance mode. */
6892#define ASM_SHIFT_STREAM_PERF_MODE_FLAG_IN_OPEN_TRANSCODE_LOOPBACK 28
6893
6894/* Bitmask for the decoder converter enable flag. */
6895#define ASM_BIT_MASK_DECODER_CONVERTER_FLAG (0x00000078UL)
6896
6897/* Shift value for the decoder converter enable flag. */
6898#define ASM_SHIFT_DECODER_CONVERTER_FLAG 3
6899
6900/* Converter mode is None (Default). */
6901#define ASM_CONVERTER_MODE_NONE 0
6902
6903/* Converter mode is DDP-to-DD. */
6904#define ASM_DDP_DD_CONVERTER_MODE 1
6905
6906/* Identifies a special converter mode where source and sink formats
6907 * are the same but postprocessing must applied. Therefore, Decode
6908 * @rarrow Re-encode is necessary.
6909 */
6910#define ASM_POST_PROCESS_CONVERTER_MODE 2
6911
6912
6913struct asm_stream_cmd_open_transcode_loopback_t {
6914 struct apr_hdr hdr;
6915 u32 mode_flags;
6916/* Mode Flags specifies the performance mode in which this stream
6917 * is to be opened.
6918 * Supported values{for bits 30 to 28}(stream_perf_mode flag)
6919 *
6920 * #ASM_LEGACY_STREAM_SESSION -- This mode ensures backward
6921 * compatibility to the original behavior
6922 * of ASM_STREAM_CMD_OPEN_TRANSCODE_LOOPBACK
6923 *
6924 * #ASM_LOW_LATENCY_STREAM_SESSION -- Opens a loopback session by using
6925 * shortened buffers in low latency POPP
6926 * - Recommendation: Do not enable high latency algorithms. They might
6927 * negate the benefits of opening a low latency stream, and they
6928 * might also suffer quality degradation from unexpected jitter.
6929 * - This Low Latency mode is supported only for PCM In and PCM Out
6930 * loopbacks. An error is returned if Low Latency mode is opened for
6931 * other transcode loopback modes.
6932 * - To configure this subfield, use
6933 * ASM_BIT_MASK_STREAM_PERF_MODE_FLAG_IN_OPEN_TRANSCODE_LOOPBACK and
6934 * ASM_SHIFT_STREAM_PERF_MODE_FLAG_IN_OPEN_TRANSCODE_LOOPBACK.
6935 *
6936 * Supported values{for bits 6 to 3} (decoder-converter compatibility)
6937 * #ASM_CONVERTER_MODE_NONE (0x0) -- Default
6938 * #ASM_DDP_DD_CONVERTER_MODE (0x1)
6939 * #ASM_POST_PROCESS_CONVERTER_MODE (0x2)
6940 * 0x3-0xF -- Reserved for future use
6941 * - Use #ASM_BIT_MASK_DECODER_CONVERTER_FLAG and
6942 * ASM_SHIFT_DECODER_CONVERTER_FLAG to set this bit
6943 * All other bits are reserved; clients must set them to 0.
6944 */
6945
6946 u32 src_format_id;
6947/* Specifies the media format of the input audio stream.
6948 *
6949 * Supported values
6950 * - #ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V2
6951 * - #ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V3
6952 * - #ASM_MEDIA_FMT_DTS
6953 * - #ASM_MEDIA_FMT_EAC3_DEC
6954 * - #ASM_MEDIA_FMT_EAC3
6955 * - #ASM_MEDIA_FMT_AC3_DEC
6956 * - #ASM_MEDIA_FMT_AC3
6957 */
6958 u32 sink_format_id;
6959/* Specifies the media format of the output stream.
6960 *
6961 * Supported values
6962 * - #ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V2
6963 * - #ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V3
6964 * - #ASM_MEDIA_FMT_DTS (not supported in Low Latency mode)
6965 * - #ASM_MEDIA_FMT_EAC3_DEC (not supported in Low Latency mode)
6966 * - #ASM_MEDIA_FMT_EAC3 (not supported in Low Latency mode)
6967 * - #ASM_MEDIA_FMT_AC3_DEC (not supported in Low Latency mode)
6968 * - #ASM_MEDIA_FMT_AC3 (not supported in Low Latency mode)
6969 */
6970
6971 u32 audproc_topo_id;
6972/* Postprocessing topology ID, which specifies the topology (order of
6973 * processing) of postprocessing algorithms.
6974 *
6975 * Supported values
6976 * - #ASM_STREAM_POSTPROC_TOPO_ID_DEFAULT
6977 * - #ASM_STREAM_POSTPROC_TOPO_ID_PEAKMETER
6978 * - #ASM_STREAM_POSTPROC_TOPO_ID_MCH_PEAK_VOL
6979 * - #ASM_STREAM_POSTPROC_TOPO_ID_NONE
6980 * Topologies can be added through #ASM_CMD_ADD_TOPOLOGIES.
6981 * This field is ignored for the Converter mode, in which no
6982 * postprocessing is performed.
6983 */
6984
6985 u16 src_endpoint_type;
6986/* Specifies the source endpoint that provides the input samples.
6987 *
6988 * Supported values
6989 * - 0 -- Tx device matrix or stream router (gateway to the hardware
6990 * ports)
6991 * - All other values are reserved
6992 * Clients must set this field to 0. Otherwise, an error is returned.
6993 */
6994
6995 u16 sink_endpoint_type;
6996/* Specifies the sink endpoint type.
6997 *
6998 * Supported values
6999 * - 0 -- Rx device matrix or stream router (gateway to the hardware
7000 * ports)
7001 * - All other values are reserved
7002 * Clients must set this field to 0. Otherwise, an error is returned.
7003 */
7004
7005 u16 bits_per_sample;
7006/* Number of bits per sample processed by the ASM modules.
7007 * Supported values 16, 24
7008 */
7009
7010 u16 reserved;
7011/* This field must be set to 0.
7012 */
7013} __packed;
7014
7015
7016#define ASM_STREAM_CMD_CLOSE 0x00010BCD
7017#define ASM_STREAM_CMD_FLUSH 0x00010BCE
7018
7019
7020#define ASM_STREAM_CMD_FLUSH_READBUFS 0x00010C09
7021#define ASM_STREAM_CMD_SET_PP_PARAMS_V2 0x00010DA1
7022
7023struct asm_stream_cmd_set_pp_params_v2 {
7024 u32 data_payload_addr_lsw;
7025/* LSW of parameter data payload address. Supported values: any. */
7026 u32 data_payload_addr_msw;
7027/* MSW of Parameter data payload address. Supported values: any.
7028 * - Must be set to zero for in-band data.
7029 * - In the case of 32 bit Shared memory address, msw field must be
7030 * - set to zero.
7031 * - In the case of 36 bit shared memory address, bit 31 to bit 4 of
7032 * msw
7033 *
7034 * - must be set to zero.
7035 */
7036 u32 mem_map_handle;
7037/* Supported Values: Any.
7038 * memory map handle returned by DSP through
7039 * ASM_CMD_SHARED_MEM_MAP_REGIONS
7040 * command.
7041 * if mmhandle is NULL, the ParamData payloads are within the
7042 * message payload (in-band).
7043 * If mmhandle is non-NULL, the ParamData payloads begin at the
7044 * address specified in the address msw and lsw (out-of-band).
7045 */
7046
7047 u32 data_payload_size;
7048/* Size in bytes of the variable payload accompanying the
7049 * message, or in shared memory. This field is used for parsing the
7050 * parameter payload.
7051 */
7052} __packed;
7053
7054
7055struct asm_stream_param_data_v2 {
7056 u32 module_id;
7057 /* Unique module ID. */
7058
7059 u32 param_id;
7060 /* Unique parameter ID. */
7061
7062 u16 param_size;
7063/* Data size of the param_id/module_id combination. This is
7064 * a multiple of 4 bytes.
7065 */
7066
7067 u16 reserved;
7068/* Reserved for future enhancements. This field must be set to
7069 * zero.
7070 */
7071
7072} __packed;
7073
7074#define ASM_STREAM_CMD_GET_PP_PARAMS_V2 0x00010DA2
7075
7076struct asm_stream_cmd_get_pp_params_v2 {
7077 u32 data_payload_addr_lsw;
7078 /* LSW of the parameter data payload address. */
7079 u32 data_payload_addr_msw;
7080/* MSW of the parameter data payload address.
7081 * - Size of the shared memory, if specified, shall be large enough
7082 * to contain the whole ParamData payload, including Module ID,
7083 * Param ID, Param Size, and Param Values
7084 * - Must be set to zero for in-band data
7085 * - In the case of 32 bit Shared memory address, msw field must be
7086 * set to zero.
7087 * - In the case of 36 bit shared memory address, bit 31 to bit 4 of
7088 * msw must be set to zero.
7089 */
7090
7091 u32 mem_map_handle;
7092/* Supported Values: Any.
7093 * memory map handle returned by DSP through ASM_CMD_SHARED_MEM_MAP_REGIONS
7094 * command.
7095 * if mmhandle is NULL, the ParamData payloads in the ACK are within the
7096 * message payload (in-band).
7097 * If mmhandle is non-NULL, the ParamData payloads in the ACK begin at the
7098 * address specified in the address msw and lsw.
7099 * (out-of-band).
7100 */
7101
7102 u32 module_id;
7103/* Unique module ID. */
7104
7105 u32 param_id;
7106/* Unique parameter ID. */
7107
7108 u16 param_max_size;
7109/* Maximum data size of the module_id/param_id combination. This
7110 * is a multiple of 4 bytes.
7111 */
7112
7113
7114 u16 reserved;
7115/* Reserved for backward compatibility. Clients must set this
7116 * field to zero.
7117 */
7118} __packed;
7119
7120#define ASM_STREAM_CMD_SET_ENCDEC_PARAM 0x00010C10
7121
7122#define ASM_STREAM_CMD_SET_ENCDEC_PARAM_V2 0x00013218
7123
7124struct asm_stream_cmd_set_encdec_param_v2 {
7125 u16 service_id;
7126 /* 0 - ASM_ENCODER_SVC; 1 - ASM_DECODER_SVC */
7127
7128 u16 reserved;
7129
7130 u32 param_id;
7131 /* ID of the parameter. */
7132
7133 u32 param_size;
7134 /*
7135 * Data size of this parameter, in bytes. The size is a multiple
7136 * of 4 bytes.
7137 */
7138} __packed;
7139
7140#define ASM_STREAM_CMD_REGISTER_ENCDEC_EVENTS 0x00013219
7141
7142#define ASM_STREAM_CMD_ENCDEC_EVENTS 0x0001321A
7143
7144#define AVS_PARAM_ID_RTIC_SHARED_MEMORY_ADDR 0x00013237
7145
7146struct avs_rtic_shared_mem_addr {
7147 struct apr_hdr hdr;
7148 struct asm_stream_cmd_set_encdec_param_v2 encdec;
7149 u32 shm_buf_addr_lsw;
7150 /* Lower 32 bit of the RTIC shared memory */
7151
7152 u32 shm_buf_addr_msw;
7153 /* Upper 32 bit of the RTIC shared memory */
7154
7155 u32 buf_size;
7156 /* Size of buffer */
7157
7158 u16 shm_buf_mem_pool_id;
7159 /* ADSP_MEMORY_MAP_SHMEM8_4K_POOL */
7160
7161 u16 shm_buf_num_regions;
7162 /* number of regions to map */
7163
7164 u32 shm_buf_flag;
7165 /* buffer property flag */
7166
7167 struct avs_shared_map_region_payload map_region;
7168 /* memory map region*/
7169} __packed;
7170
7171#define AVS_PARAM_ID_RTIC_EVENT_ACK 0x00013238
7172
7173struct avs_param_rtic_event_ack {
7174 struct apr_hdr hdr;
7175 struct asm_stream_cmd_set_encdec_param_v2 encdec;
7176} __packed;
7177
7178#define ASM_PARAM_ID_ENCDEC_BITRATE 0x00010C13
7179
7180struct asm_bitrate_param {
7181 u32 bitrate;
7182/* Maximum supported bitrate. Only the AAC encoder is supported.*/
7183
7184} __packed;
7185
7186#define ASM_PARAM_ID_ENCDEC_ENC_CFG_BLK_V2 0x00010DA3
7187#define ASM_PARAM_ID_AAC_SBR_PS_FLAG 0x00010C63
7188
7189/* Flag to turn off both SBR and PS processing, if they are
7190 * present in the bitstream.
7191 */
7192
7193#define ASM_AAC_SBR_OFF_PS_OFF (2)
7194
7195/* Flag to turn on SBR but turn off PS processing,if they are
7196 * present in the bitstream.
7197 */
7198
7199#define ASM_AAC_SBR_ON_PS_OFF (1)
7200
7201/* Flag to turn on both SBR and PS processing, if they are
7202 * present in the bitstream (default behavior).
7203 */
7204
7205
7206#define ASM_AAC_SBR_ON_PS_ON (0)
7207
7208/* Structure for an AAC SBR PS processing flag. */
7209
7210/* Payload of the #ASM_PARAM_ID_AAC_SBR_PS_FLAG parameter in the
7211 * #ASM_STREAM_CMD_SET_ENCDEC_PARAM command.
7212 */
7213struct asm_aac_sbr_ps_flag_param {
7214 struct apr_hdr hdr;
7215 struct asm_stream_cmd_set_encdec_param encdec;
7216 struct asm_enc_cfg_blk_param_v2 encblk;
7217
7218 u32 sbr_ps_flag;
7219/* Control parameter to enable or disable SBR/PS processing in
7220 * the AAC bitstream. Use the following macros to set this field:
7221 * - #ASM_AAC_SBR_OFF_PS_OFF -- Turn off both SBR and PS
7222 * processing, if they are present in the bitstream.
7223 * - #ASM_AAC_SBR_ON_PS_OFF -- Turn on SBR processing, but not PS
7224 * processing, if they are present in the bitstream.
7225 * - #ASM_AAC_SBR_ON_PS_ON -- Turn on both SBR and PS processing,
7226 * if they are present in the bitstream (default behavior).
7227 * - All other values are invalid.
7228 * Changes are applied to the next decoded frame.
7229 */
7230} __packed;
7231
7232#define ASM_PARAM_ID_AAC_DUAL_MONO_MAPPING 0x00010C64
7233
7234/* First single channel element in a dual mono bitstream.*/
7235#define ASM_AAC_DUAL_MONO_MAP_SCE_1 (1)
7236
7237/* Second single channel element in a dual mono bitstream.*/
7238#define ASM_AAC_DUAL_MONO_MAP_SCE_2 (2)
7239
7240/* Structure for AAC decoder dual mono channel mapping. */
7241
7242
7243struct asm_aac_dual_mono_mapping_param {
7244 struct apr_hdr hdr;
7245 struct asm_stream_cmd_set_encdec_param encdec;
7246 u16 left_channel_sce;
7247 u16 right_channel_sce;
7248
7249} __packed;
7250
7251#define ASM_STREAM_CMDRSP_GET_PP_PARAMS_V2 0x00010DA4
7252
7253struct asm_stream_cmdrsp_get_pp_params_v2 {
7254 u32 status;
7255} __packed;
7256
7257#define ASM_PARAM_ID_AC3_KARAOKE_MODE 0x00010D73
7258
7259/* Enumeration for both vocals in a karaoke stream.*/
7260#define AC3_KARAOKE_MODE_NO_VOCAL (0)
7261
7262/* Enumeration for only the left vocal in a karaoke stream.*/
7263#define AC3_KARAOKE_MODE_LEFT_VOCAL (1)
7264
7265/* Enumeration for only the right vocal in a karaoke stream.*/
7266#define AC3_KARAOKE_MODE_RIGHT_VOCAL (2)
7267
7268/* Enumeration for both vocal channels in a karaoke stream.*/
7269#define AC3_KARAOKE_MODE_BOTH_VOCAL (3)
7270#define ASM_PARAM_ID_AC3_DRC_MODE 0x00010D74
7271/* Enumeration for the Custom Analog mode.*/
7272#define AC3_DRC_MODE_CUSTOM_ANALOG (0)
7273
7274/* Enumeration for the Custom Digital mode.*/
7275#define AC3_DRC_MODE_CUSTOM_DIGITAL (1)
7276/* Enumeration for the Line Out mode (light compression).*/
7277#define AC3_DRC_MODE_LINE_OUT (2)
7278
7279/* Enumeration for the RF remodulation mode (heavy compression).*/
7280#define AC3_DRC_MODE_RF_REMOD (3)
7281#define ASM_PARAM_ID_AC3_DUAL_MONO_MODE 0x00010D75
7282
7283/* Enumeration for playing dual mono in stereo mode.*/
7284#define AC3_DUAL_MONO_MODE_STEREO (0)
7285
7286/* Enumeration for playing left mono.*/
7287#define AC3_DUAL_MONO_MODE_LEFT_MONO (1)
7288
7289/* Enumeration for playing right mono.*/
7290#define AC3_DUAL_MONO_MODE_RIGHT_MONO (2)
7291
7292/* Enumeration for mixing both dual mono channels and playing them.*/
7293#define AC3_DUAL_MONO_MODE_MIXED_MONO (3)
7294#define ASM_PARAM_ID_AC3_STEREO_DOWNMIX_MODE 0x00010D76
7295
7296/* Enumeration for using the Downmix mode indicated in the bitstream. */
7297
7298#define AC3_STEREO_DOWNMIX_MODE_AUTO_DETECT (0)
7299
7300/* Enumeration for Surround Compatible mode (preserves the
7301 * surround information).
7302 */
7303
7304#define AC3_STEREO_DOWNMIX_MODE_LT_RT (1)
7305/* Enumeration for Mono Compatible mode (if the output is to be
7306 * further downmixed to mono).
7307 */
7308
7309#define AC3_STEREO_DOWNMIX_MODE_LO_RO (2)
7310
7311/* ID of the AC3 PCM scale factor parameter in the
7312 * #ASM_STREAM_CMD_SET_ENCDEC_PARAM command.
7313 */
7314#define ASM_PARAM_ID_AC3_PCM_SCALEFACTOR 0x00010D78
7315
7316/* ID of the AC3 DRC boost scale factor parameter in the
7317 * #ASM_STREAM_CMD_SET_ENCDEC_PARAM command.
7318 */
7319#define ASM_PARAM_ID_AC3_DRC_BOOST_SCALEFACTOR 0x00010D79
7320
7321/* ID of the AC3 DRC cut scale factor parameter in the
7322 * #ASM_STREAM_CMD_SET_ENCDEC_PARAM command.
7323 */
7324#define ASM_PARAM_ID_AC3_DRC_CUT_SCALEFACTOR 0x00010D7A
7325
7326/* Structure for AC3 Generic Parameter. */
7327
7328/* Payload of the AC3 parameters in the
7329 * #ASM_STREAM_CMD_SET_ENCDEC_PARAM command.
7330 */
7331struct asm_ac3_generic_param {
7332 struct apr_hdr hdr;
7333 struct asm_stream_cmd_set_encdec_param encdec;
7334 struct asm_enc_cfg_blk_param_v2 encblk;
7335 u32 generic_parameter;
7336/* AC3 generic parameter. Select from one of the following
7337 * possible values.
7338 *
7339 * For #ASM_PARAM_ID_AC3_KARAOKE_MODE, supported values are:
7340 * - AC3_KARAOKE_MODE_NO_VOCAL
7341 * - AC3_KARAOKE_MODE_LEFT_VOCAL
7342 * - AC3_KARAOKE_MODE_RIGHT_VOCAL
7343 * - AC3_KARAOKE_MODE_BOTH_VOCAL
7344 *
7345 * For #ASM_PARAM_ID_AC3_DRC_MODE, supported values are:
7346 * - AC3_DRC_MODE_CUSTOM_ANALOG
7347 * - AC3_DRC_MODE_CUSTOM_DIGITAL
7348 * - AC3_DRC_MODE_LINE_OUT
7349 * - AC3_DRC_MODE_RF_REMOD
7350 *
7351 * For #ASM_PARAM_ID_AC3_DUAL_MONO_MODE, supported values are:
7352 * - AC3_DUAL_MONO_MODE_STEREO
7353 * - AC3_DUAL_MONO_MODE_LEFT_MONO
7354 * - AC3_DUAL_MONO_MODE_RIGHT_MONO
7355 * - AC3_DUAL_MONO_MODE_MIXED_MONO
7356 *
7357 * For #ASM_PARAM_ID_AC3_STEREO_DOWNMIX_MODE, supported values are:
7358 * - AC3_STEREO_DOWNMIX_MODE_AUTO_DETECT
7359 * - AC3_STEREO_DOWNMIX_MODE_LT_RT
7360 * - AC3_STEREO_DOWNMIX_MODE_LO_RO
7361 *
7362 * For #ASM_PARAM_ID_AC3_PCM_SCALEFACTOR, supported values are
7363 * 0 to 1 in Q31 format.
7364 *
7365 * For #ASM_PARAM_ID_AC3_DRC_BOOST_SCALEFACTOR, supported values are
7366 * 0 to 1 in Q31 format.
7367 *
7368 * For #ASM_PARAM_ID_AC3_DRC_CUT_SCALEFACTOR, supported values are
7369 * 0 to 1 in Q31 format.
7370 */
7371} __packed;
7372
7373/* Enumeration for Raw mode (no downmixing), which specifies
7374 * that all channels in the bitstream are to be played out as is
7375 * without any downmixing. (Default)
7376 */
7377
7378#define WMAPRO_CHANNEL_MASK_RAW (-1)
7379
7380/* Enumeration for setting the channel mask to 0. The 7.1 mode
7381 * (Home Theater) is assigned.
7382 */
7383
7384
7385#define WMAPRO_CHANNEL_MASK_ZERO 0x0000
7386
7387/* Speaker layout mask for one channel (Home Theater, mono).
7388 * - Speaker front center
7389 */
7390#define WMAPRO_CHANNEL_MASK_1_C 0x0004
7391
7392/* Speaker layout mask for two channels (Home Theater, stereo).
7393 * - Speaker front left
7394 * - Speaker front right
7395 */
7396#define WMAPRO_CHANNEL_MASK_2_L_R 0x0003
7397
7398/* Speaker layout mask for three channels (Home Theater).
7399 * - Speaker front left
7400 * - Speaker front right
7401 * - Speaker front center
7402 */
7403#define WMAPRO_CHANNEL_MASK_3_L_C_R 0x0007
7404
7405/* Speaker layout mask for two channels (stereo).
7406 * - Speaker back left
7407 * - Speaker back right
7408 */
7409#define WMAPRO_CHANNEL_MASK_2_Bl_Br 0x0030
7410
7411/* Speaker layout mask for four channels.
7412 * - Speaker front left
7413 * - Speaker front right
7414 * - Speaker back left
7415 * - Speaker back right
7416 */
7417#define WMAPRO_CHANNEL_MASK_4_L_R_Bl_Br 0x0033
7418
7419/* Speaker layout mask for four channels (Home Theater).
7420 * - Speaker front left
7421 * - Speaker front right
7422 * - Speaker front center
7423 * - Speaker back center
7424 */
7425#define WMAPRO_CHANNEL_MASK_4_L_R_C_Bc_HT 0x0107
7426/* Speaker layout mask for five channels.
7427 * - Speaker front left
7428 * - Speaker front right
7429 * - Speaker front center
7430 * - Speaker back left
7431 * - Speaker back right
7432 */
7433#define WMAPRO_CHANNEL_MASK_5_L_C_R_Bl_Br 0x0037
7434
7435/* Speaker layout mask for five channels (5 mode, Home Theater).
7436 * - Speaker front left
7437 * - Speaker front right
7438 * - Speaker front center
7439 * - Speaker side left
7440 * - Speaker side right
7441 */
7442#define WMAPRO_CHANNEL_MASK_5_L_C_R_Sl_Sr_HT 0x0607
7443/* Speaker layout mask for six channels (5.1 mode).
7444 * - Speaker front left
7445 * - Speaker front right
7446 * - Speaker front center
7447 * - Speaker low frequency
7448 * - Speaker back left
7449 * - Speaker back right
7450 */
7451#define WMAPRO_CHANNEL_MASK_5DOT1_L_C_R_Bl_Br_SLF 0x003F
7452/* Speaker layout mask for six channels (5.1 mode, Home Theater).
7453 * - Speaker front left
7454 * - Speaker front right
7455 * - Speaker front center
7456 * - Speaker low frequency
7457 * - Speaker side left
7458 * - Speaker side right
7459 */
7460#define WMAPRO_CHANNEL_MASK_5DOT1_L_C_R_Sl_Sr_SLF_HT 0x060F
7461/* Speaker layout mask for six channels (5.1 mode, no LFE).
7462 * - Speaker front left
7463 * - Speaker front right
7464 * - Speaker front center
7465 * - Speaker back left
7466 * - Speaker back right
7467 * - Speaker back center
7468 */
7469#define WMAPRO_CHANNEL_MASK_5DOT1_L_C_R_Bl_Br_Bc 0x0137
7470/* Speaker layout mask for six channels (5.1 mode, Home Theater,
7471 * no LFE).
7472 * - Speaker front left
7473 * - Speaker front right
7474 * - Speaker front center
7475 * - Speaker back center
7476 * - Speaker side left
7477 * - Speaker side right
7478 */
7479#define WMAPRO_CHANNEL_MASK_5DOT1_L_C_R_Sl_Sr_Bc_HT 0x0707
7480
7481/* Speaker layout mask for seven channels (6.1 mode).
7482 * - Speaker front left
7483 * - Speaker front right
7484 * - Speaker front center
7485 * - Speaker low frequency
7486 * - Speaker back left
7487 * - Speaker back right
7488 * - Speaker back center
7489 */
7490#define WMAPRO_CHANNEL_MASK_6DOT1_L_C_R_Bl_Br_Bc_SLF 0x013F
7491
7492/* Speaker layout mask for seven channels (6.1 mode, Home
7493 * Theater).
7494 * - Speaker front left
7495 * - Speaker front right
7496 * - Speaker front center
7497 * - Speaker low frequency
7498 * - Speaker back center
7499 * - Speaker side left
7500 * - Speaker side right
7501 */
7502#define WMAPRO_CHANNEL_MASK_6DOT1_L_C_R_Sl_Sr_Bc_SLF_HT 0x070F
7503
7504/* Speaker layout mask for seven channels (6.1 mode, no LFE).
7505 * - Speaker front left
7506 * - Speaker front right
7507 * - Speaker front center
7508 * - Speaker back left
7509 * - Speaker back right
7510 * - Speaker front left of center
7511 * - Speaker front right of center
7512 */
7513#define WMAPRO_CHANNEL_MASK_6DOT1_L_C_R_Bl_Br_SFLOC_SFROC 0x00F7
7514
7515/* Speaker layout mask for seven channels (6.1 mode, Home
7516 * Theater, no LFE).
7517 * - Speaker front left
7518 * - Speaker front right
7519 * - Speaker front center
7520 * - Speaker side left
7521 * - Speaker side right
7522 * - Speaker front left of center
7523 * - Speaker front right of center
7524 */
7525#define WMAPRO_CHANNEL_MASK_6DOT1_L_C_R_Sl_Sr_SFLOC_SFROC_HT 0x0637
7526
7527/* Speaker layout mask for eight channels (7.1 mode).
7528 * - Speaker front left
7529 * - Speaker front right
7530 * - Speaker front center
7531 * - Speaker back left
7532 * - Speaker back right
7533 * - Speaker low frequency
7534 * - Speaker front left of center
7535 * - Speaker front right of center
7536 */
7537#define WMAPRO_CHANNEL_MASK_7DOT1_L_C_R_Bl_Br_SLF_SFLOC_SFROC \
7538 0x00FF
7539
7540/* Speaker layout mask for eight channels (7.1 mode, Home Theater).
7541 * - Speaker front left
7542 * - Speaker front right
7543 * - Speaker front center
7544 * - Speaker side left
7545 * - Speaker side right
7546 * - Speaker low frequency
7547 * - Speaker front left of center
7548 * - Speaker front right of center
7549 *
7550 */
7551#define WMAPRO_CHANNEL_MASK_7DOT1_L_C_R_Sl_Sr_SLF_SFLOC_SFROC_HT \
7552 0x063F
7553
7554#define ASM_PARAM_ID_DEC_OUTPUT_CHAN_MAP 0x00010D82
7555
7556/* Maximum number of decoder output channels. */
7557#define MAX_CHAN_MAP_CHANNELS 16
7558
7559/* Structure for decoder output channel mapping. */
7560
7561/* Payload of the #ASM_PARAM_ID_DEC_OUTPUT_CHAN_MAP parameter in the
7562 * #ASM_STREAM_CMD_SET_ENCDEC_PARAM command.
7563 */
7564struct asm_dec_out_chan_map_param {
7565 struct apr_hdr hdr;
7566 struct asm_stream_cmd_set_encdec_param encdec;
7567 u32 num_channels;
7568/* Number of decoder output channels.
7569 * Supported values: 0 to #MAX_CHAN_MAP_CHANNELS
7570 *
7571 * A value of 0 indicates native channel mapping, which is valid
7572 * only for NT mode. This means the output of the decoder is to be
7573 * preserved as is.
7574 */
7575 u8 channel_mapping[MAX_CHAN_MAP_CHANNELS];
7576} __packed;
7577
7578#define ASM_STREAM_CMD_OPEN_WRITE_COMPRESSED 0x00010D84
7579
7580/* Bitmask for the IEC 61937 enable flag.*/
7581#define ASM_BIT_MASK_IEC_61937_STREAM_FLAG (0x00000001UL)
7582
7583/* Shift value for the IEC 61937 enable flag.*/
7584#define ASM_SHIFT_IEC_61937_STREAM_FLAG 0
7585
7586/* Bitmask for the IEC 60958 enable flag.*/
7587#define ASM_BIT_MASK_IEC_60958_STREAM_FLAG (0x00000002UL)
7588
7589/* Shift value for the IEC 60958 enable flag.*/
7590#define ASM_SHIFT_IEC_60958_STREAM_FLAG 1
7591
7592/* Payload format for open write compressed command */
7593
7594/* Payload format for the #ASM_STREAM_CMD_OPEN_WRITE_COMPRESSED
7595 * command, which opens a stream for a given session ID and stream ID
7596 * to be rendered in the compressed format.
7597 */
7598
7599struct asm_stream_cmd_open_write_compressed {
7600 struct apr_hdr hdr;
7601 u32 flags;
7602/* Mode flags that configure the stream for a specific format.
7603 * Supported values:
7604 * - Bit 0 -- IEC 61937 compatibility
7605 * - 0 -- Stream is not in IEC 61937 format
7606 * - 1 -- Stream is in IEC 61937 format
7607 * - Bit 1 -- IEC 60958 compatibility
7608 * - 0 -- Stream is not in IEC 60958 format
7609 * - 1 -- Stream is in IEC 60958 format
7610 * - Bits 2 to 31 -- 0 (Reserved)
7611 *
7612 * For the same stream, bit 0 cannot be set to 0 and bit 1 cannot
7613 * be set to 1. A compressed stream connot have IEC 60958
7614 * packetization applied without IEC 61937 packetization.
7615 * @note1hang Currently, IEC 60958 packetized input streams are not
7616 * supported.
7617 */
7618
7619
7620 u32 fmt_id;
7621/* Specifies the media type of the HDMI stream to be opened.
7622 * Supported values:
7623 * - #ASM_MEDIA_FMT_AC3
7624 * - #ASM_MEDIA_FMT_EAC3
7625 * - #ASM_MEDIA_FMT_DTS
7626 * - #ASM_MEDIA_FMT_ATRAC
7627 * - #ASM_MEDIA_FMT_MAT
7628 *
7629 * @note1hang This field must be set to a valid media type even if
7630 * IEC 61937 packetization is not performed by the aDSP.
7631 */
7632
7633} __packed;
7634
7635
7636/* Indicates the number of samples per channel to be removed from the
7637 * beginning of the stream.
7638 */
7639#define ASM_DATA_CMD_REMOVE_INITIAL_SILENCE 0x00010D67
7640
7641/* Indicates the number of samples per channel to be removed from
7642 * the end of the stream.
7643 */
7644#define ASM_DATA_CMD_REMOVE_TRAILING_SILENCE 0x00010D68
7645
7646struct asm_data_cmd_remove_silence {
7647 struct apr_hdr hdr;
7648 u32 num_samples_to_remove;
7649 /* < Number of samples per channel to be removed.
7650 * @values 0 to (2@sscr{32}-1)
7651 */
7652} __packed;
7653
7654#define ASM_STREAM_CMD_OPEN_READ_COMPRESSED 0x00010D95
7655
7656struct asm_stream_cmd_open_read_compressed {
7657 struct apr_hdr hdr;
7658 u32 mode_flags;
7659/* Mode flags that indicate whether meta information per encoded
7660 * frame is to be provided.
7661 * Supported values for bit 4:
7662 * - 0 -- Return data buffer contains all encoded frames only; it does
7663 * not contain frame metadata.
7664 * - 1 -- Return data buffer contains an array of metadata and encoded
7665 * frames.
7666 * - Use #ASM_BIT_MASK_META_INFO_FLAG to set the bitmask and
7667 * #ASM_SHIFT_META_INFO_FLAG to set the shift value for this bit.
7668 * All other bits are reserved; clients must set them to zero.
7669 */
7670
7671 u32 frames_per_buf;
7672/* Indicates the number of frames that need to be returned per
7673 * read buffer
7674 * Supported values: should be greater than 0
7675 */
7676
7677} __packed;
7678
7679/* adsp_asm_stream_commands.h*/
7680
7681
7682/* adsp_asm_api.h (no changes)*/
7683#define ASM_STREAM_POSTPROCOPO_ID_DEFAULT \
7684 0x00010BE4
7685#define ASM_STREAM_POSTPROCOPO_ID_PEAKMETER \
7686 0x00010D83
7687#define ASM_STREAM_POSTPROCOPO_ID_NONE \
7688 0x00010C68
7689#define ASM_STREAM_POSTPROCOPO_ID_MCH_PEAK_VOL \
7690 0x00010D8B
7691#define ASM_STREAM_PREPROCOPO_ID_DEFAULT \
7692 ASM_STREAM_POSTPROCOPO_ID_DEFAULT
7693#define ASM_STREAM_PREPROCOPO_ID_NONE \
7694 ASM_STREAM_POSTPROCOPO_ID_NONE
7695#define ADM_CMD_COPP_OPENOPOLOGY_ID_NONE_AUDIO_COPP \
7696 0x00010312
7697#define ADM_CMD_COPP_OPENOPOLOGY_ID_SPEAKER_MONO_AUDIO_COPP \
7698 0x00010313
7699#define ADM_CMD_COPP_OPENOPOLOGY_ID_SPEAKER_STEREO_AUDIO_COPP \
7700 0x00010314
7701#define ADM_CMD_COPP_OPENOPOLOGY_ID_SPEAKER_STEREO_IIR_AUDIO_COPP\
7702 0x00010704
7703#define ADM_CMD_COPP_OPENOPOLOGY_ID_SPEAKER_MONO_AUDIO_COPP_MBDRCV2\
7704 0x0001070D
7705#define ADM_CMD_COPP_OPENOPOLOGY_ID_SPEAKER_STEREO_AUDIO_COPP_MBDRCV2\
7706 0x0001070E
7707#define ADM_CMD_COPP_OPENOPOLOGY_ID_SPEAKER_STEREO_IIR_AUDIO_COPP_MBDRCV2\
7708 0x0001070F
7709#define ADM_CMD_COPP_OPENOPOLOGY_ID_SPEAKER_STEREO_AUDIO_COPP_MBDRC_V3 \
7710 0x11000000
7711#define ADM_CMD_COPP_OPENOPOLOGY_ID_SPEAKER_MCH_PEAK_VOL \
7712 0x0001031B
7713#define ADM_CMD_COPP_OPENOPOLOGY_ID_MIC_MONO_AUDIO_COPP 0x00010315
7714#define ADM_CMD_COPP_OPENOPOLOGY_ID_MIC_STEREO_AUDIO_COPP 0x00010316
7715#define AUDPROC_COPPOPOLOGY_ID_MCHAN_IIR_AUDIO 0x00010715
7716#define ADM_CMD_COPP_OPENOPOLOGY_ID_DEFAULT_AUDIO_COPP 0x00010BE3
7717#define ADM_CMD_COPP_OPENOPOLOGY_ID_PEAKMETER_AUDIO_COPP 0x00010317
7718#define AUDPROC_MODULE_ID_AIG 0x00010716
7719#define AUDPROC_PARAM_ID_AIG_ENABLE 0x00010717
7720#define AUDPROC_PARAM_ID_AIG_CONFIG 0x00010718
7721
7722struct Audio_AigParam {
7723 uint16_t mode;
7724/*< Mode word for enabling AIG/SIG mode .
7725 * Byte offset: 0
7726 */
7727 int16_t staticGainL16Q12;
7728/*< Static input gain when aigMode is set to 1.
7729 * Byte offset: 2
7730 */
7731 int16_t initialGainDBL16Q7;
7732/*<Initial value that the adaptive gain update starts from dB
7733 * Q7 Byte offset: 4
7734 */
7735 int16_t idealRMSDBL16Q7;
7736/*<Average RMS level that AIG attempts to achieve Q8.7
7737 * Byte offset: 6
7738 */
7739 int32_t noiseGateL32;
7740/*Threshold below which signal is considered as noise and AIG
7741 * Byte offset: 8
7742 */
7743 int32_t minGainL32Q15;
7744/*Minimum gain that can be provided by AIG Q16.15
7745 * Byte offset: 12
7746 */
7747 int32_t maxGainL32Q15;
7748/*Maximum gain that can be provided by AIG Q16.15
7749 * Byte offset: 16
7750 */
7751 uint32_t gainAtRtUL32Q31;
7752/*Attack/release time for AIG update Q1.31
7753 * Byte offset: 20
7754 */
7755 uint32_t longGainAtRtUL32Q31;
7756/*Long attack/release time while updating gain for
7757 * noise/silence Q1.31 Byte offset: 24
7758 */
7759
7760 uint32_t rmsTavUL32Q32;
7761/* RMS smoothing time constant used for long-term RMS estimate
7762 * Q0.32 Byte offset: 28
7763 */
7764
7765 uint32_t gainUpdateStartTimMsUL32Q0;
7766/* The waiting time before which AIG starts to apply adaptive
7767 * gain update Q32.0 Byte offset: 32
7768 */
7769
7770} __packed;
7771
7772
7773#define ADM_MODULE_ID_EANS 0x00010C4A
7774#define ADM_PARAM_ID_EANS_ENABLE 0x00010C4B
7775#define ADM_PARAM_ID_EANS_PARAMS 0x00010C4C
7776
7777struct adm_eans_enable {
7778
7779 uint32_t enable_flag;
7780/*< Specifies whether EANS is disabled (0) or enabled
7781 * (nonzero).
7782 * This is supported only for sampling rates of 8, 12, 16, 24, 32,
7783 * and 48 kHz. It is not supported for sampling rates of 11.025,
7784 * 22.05, or 44.1 kHz.
7785 */
7786
7787} __packed;
7788
7789
7790struct adm_eans_params {
7791 int16_t eans_mode;
7792/*< Mode word for enabling/disabling submodules.
7793 * Byte offset: 0
7794 */
7795
7796 int16_t eans_input_gain;
7797/*< Q2.13 input gain to the EANS module.
7798 * Byte offset: 2
7799 */
7800
7801 int16_t eans_output_gain;
7802/*< Q2.13 output gain to the EANS module.
7803 * Byte offset: 4
7804 */
7805
7806 int16_t eansarget_ns;
7807/*< Target noise suppression level in dB.
7808 * Byte offset: 6
7809 */
7810
7811 int16_t eans_s_alpha;
7812/*< Q3.12 over-subtraction factor for stationary noise
7813 * suppression.
7814 * Byte offset: 8
7815 */
7816
7817 int16_t eans_n_alpha;
7818/* < Q3.12 over-subtraction factor for nonstationary noise
7819 * suppression.
7820 * Byte offset: 10
7821 */
7822
7823 int16_t eans_n_alphamax;
7824/*< Q3.12 maximum over-subtraction factor for nonstationary
7825 * noise suppression.
7826 * Byte offset: 12
7827 */
7828 int16_t eans_e_alpha;
7829/*< Q15 scaling factor for excess noise suppression.
7830 * Byte offset: 14
7831 */
7832
7833 int16_t eans_ns_snrmax;
7834/*< Upper boundary in dB for SNR estimation.
7835 * Byte offset: 16
7836 */
7837
7838 int16_t eans_sns_block;
7839/*< Quarter block size for stationary noise suppression.
7840 * Byte offset: 18
7841 */
7842
7843 int16_t eans_ns_i;
7844/*< Initialization block size for noise suppression.
7845 * Byte offset: 20
7846 */
7847 int16_t eans_np_scale;
7848/*< Power scale factor for nonstationary noise update.
7849 * Byte offset: 22
7850 */
7851
7852 int16_t eans_n_lambda;
7853/*< Smoothing factor for higher level nonstationary noise
7854 * update.
7855 * Byte offset: 24
7856 */
7857
7858 int16_t eans_n_lambdaf;
7859/*< Medium averaging factor for noise update.
7860 * Byte offset: 26
7861 */
7862
7863 int16_t eans_gs_bias;
7864/*< Bias factor in dB for gain calculation.
7865 * Byte offset: 28
7866 */
7867
7868 int16_t eans_gs_max;
7869/*< SNR lower boundary in dB for aggressive gain calculation.
7870 * Byte offset: 30
7871 */
7872
7873 int16_t eans_s_alpha_hb;
7874/*< Q3.12 over-subtraction factor for high-band stationary
7875 * noise suppression.
7876 * Byte offset: 32
7877 */
7878
7879 int16_t eans_n_alphamax_hb;
7880/*< Q3.12 maximum over-subtraction factor for high-band
7881 * nonstationary noise suppression.
7882 * Byte offset: 34
7883 */
7884
7885 int16_t eans_e_alpha_hb;
7886/*< Q15 scaling factor for high-band excess noise suppression.
7887 * Byte offset: 36
7888 */
7889
7890 int16_t eans_n_lambda0;
7891/*< Smoothing factor for nonstationary noise update during
7892 * speech activity.
7893 * Byte offset: 38
7894 */
7895
7896 int16_t thresh;
7897/*< Threshold for generating a binary VAD decision.
7898 * Byte offset: 40
7899 */
7900
7901 int16_t pwr_scale;
7902/*< Indirect lower boundary of the noise level estimate.
7903 * Byte offset: 42
7904 */
7905
7906 int16_t hangover_max;
7907/*< Avoids mid-speech clipping and reliably detects weak speech
7908 * bursts at the end of speech activity.
7909 * Byte offset: 44
7910 */
7911
7912 int16_t alpha_snr;
7913/*< Controls responsiveness of the VAD.
7914 * Byte offset: 46
7915 */
7916
7917 int16_t snr_diff_max;
7918/*< Maximum SNR difference. Decreasing this parameter value may
7919 * help in making correct decisions during abrupt changes; however,
7920 * decreasing too much may increase false alarms during long
7921 * pauses/silences.
7922 * Byte offset: 48
7923 */
7924
7925 int16_t snr_diff_min;
7926/*< Minimum SNR difference. Decreasing this parameter value may
7927 * help in making correct decisions during abrupt changes; however,
7928 * decreasing too much may increase false alarms during long
7929 * pauses/silences.
7930 * Byte offset: 50
7931 */
7932
7933 int16_t init_length;
7934/*< Defines the number of frames for which a noise level
7935 * estimate is set to a fixed value.
7936 * Byte offset: 52
7937 */
7938
7939 int16_t max_val;
7940/*< Defines the upper limit of the noise level.
7941 * Byte offset: 54
7942 */
7943
7944 int16_t init_bound;
7945/*< Defines the initial bounding value for the noise level
7946 * estimate. This is used during the initial segment defined by the
7947 * init_length parameter.
7948 * Byte offset: 56
7949 */
7950
7951 int16_t reset_bound;
7952/*< Reset boundary for noise tracking.
7953 * Byte offset: 58
7954 */
7955
7956 int16_t avar_scale;
7957/*< Defines the bias factor in noise estimation.
7958 * Byte offset: 60
7959 */
7960
7961 int16_t sub_nc;
7962/*< Defines the window length for noise estimation.
7963 * Byte offset: 62
7964 */
7965
7966 int16_t spow_min;
7967/*< Defines the minimum signal power required to update the
7968 * boundaries for the noise floor estimate.
7969 * Byte offset: 64
7970 */
7971
7972 int16_t eans_gs_fast;
7973/*< Fast smoothing factor for postprocessor gain.
7974 * Byte offset: 66
7975 */
7976
7977 int16_t eans_gs_med;
7978/*< Medium smoothing factor for postprocessor gain.
7979 * Byte offset: 68
7980 */
7981
7982 int16_t eans_gs_slow;
7983/*< Slow smoothing factor for postprocessor gain.
7984 * Byte offset: 70
7985 */
7986
7987 int16_t eans_swb_salpha;
7988/*< Q3.12 super wideband aggressiveness factor for stationary
7989 * noise suppression.
7990 * Byte offset: 72
7991 */
7992
7993 int16_t eans_swb_nalpha;
7994/*< Q3.12 super wideband aggressiveness factor for
7995 * nonstationary noise suppression.
7996 * Byte offset: 74
7997 */
7998} __packed;
7999#define ADM_MODULE_IDX_MIC_GAIN_CTRL 0x00010C35
8000
8001/* @addtogroup audio_pp_param_ids
8002 * ID of the Tx mic gain control parameter used by the
8003 * #ADM_MODULE_IDX_MIC_GAIN_CTRL module.
8004 * @messagepayload
8005 * @structure{admx_mic_gain}
8006 * @tablespace
8007 * @inputtable{Audio_Postproc_ADM_PARAM_IDX_MIC_GAIN.tex}
8008 */
8009#define ADM_PARAM_IDX_MIC_GAIN 0x00010C36
8010
8011/* Structure for a Tx mic gain parameter for the mic gain
8012 * control module.
8013 */
8014
8015
8016/* @brief Payload of the #ADM_PARAM_IDX_MIC_GAIN parameter in the
8017 * Tx Mic Gain Control module.
8018 */
8019struct admx_mic_gain {
8020 uint16_t tx_mic_gain;
8021 /*< Linear gain in Q13 format. */
8022
8023 uint16_t reserved;
8024 /*< Clients must set this field to zero. */
8025} __packed;
8026
8027struct adm_set_mic_gain_params {
8028 struct adm_cmd_set_pp_params_v5 params;
8029 struct adm_param_data_v5 data;
8030 struct admx_mic_gain mic_gain_data;
8031} __packed;
8032
8033/* end_addtogroup audio_pp_param_ids */
8034
8035/* @ingroup audio_pp_module_ids
8036 * ID of the Rx Codec Gain Control module.
8037 *
8038 * This module supports the following parameter ID:
8039 * - #ADM_PARAM_ID_RX_CODEC_GAIN
8040 */
8041#define ADM_MODULE_ID_RX_CODEC_GAIN_CTRL 0x00010C37
8042
8043/* @addtogroup audio_pp_param_ids
8044 * ID of the Rx codec gain control parameter used by the
8045 * #ADM_MODULE_ID_RX_CODEC_GAIN_CTRL module.
8046 *
8047 * @messagepayload
8048 * @structure{adm_rx_codec_gain}
8049 * @tablespace
8050 * @inputtable{Audio_Postproc_ADM_PARAM_ID_RX_CODEC_GAIN.tex}
8051 */
8052#define ADM_PARAM_ID_RX_CODEC_GAIN 0x00010C38
8053
8054/* Structure for the Rx common codec gain control module. */
8055
8056
8057/* @brief Payload of the #ADM_PARAM_ID_RX_CODEC_GAIN parameter
8058 * in the Rx Codec Gain Control module.
8059 */
8060
8061
8062struct adm_rx_codec_gain {
8063 uint16_t rx_codec_gain;
8064 /* Linear gain in Q13 format. */
8065
8066 uint16_t reserved;
8067 /* Clients must set this field to zero.*/
8068} __packed;
8069
8070/* end_addtogroup audio_pp_param_ids */
8071
8072/* @ingroup audio_pp_module_ids
8073 * ID of the HPF Tuning Filter module on the Tx path.
8074 * This module supports the following parameter IDs:
8075 * - #ADM_PARAM_ID_HPF_IIRX_FILTER_ENABLE_CONFIG
8076 * - #ADM_PARAM_ID_HPF_IIRX_FILTER_PRE_GAIN
8077 * - #ADM_PARAM_ID_HPF_IIRX_FILTER_CONFIG_PARAMS
8078 */
8079#define ADM_MODULE_ID_HPF_IIRX_FILTER 0x00010C3D
8080
8081/* @addtogroup audio_pp_param_ids */
8082/* ID of the Tx HPF IIR filter enable parameter used by the
8083 * #ADM_MODULE_ID_HPF_IIRX_FILTER module.
8084 * @parspace Message payload
8085 * @structure{adm_hpfx_iir_filter_enable_cfg}
8086 * @tablespace
8087 * @inputtable{Audio_Postproc_ADM_PARAM_ID_HPF_IIRX_FILTER_ENABLE_CONFIG.tex}
8088 */
8089#define ADM_PARAM_ID_HPF_IIRX_FILTER_ENABLE_CONFIG 0x00010C3E
8090
8091/* ID of the Tx HPF IIR filter pregain parameter used by the
8092 * #ADM_MODULE_ID_HPF_IIRX_FILTER module.
8093 * @parspace Message payload
8094 * @structure{adm_hpfx_iir_filter_pre_gain}
8095 * @tablespace
8096 * @inputtable{Audio_Postproc_ADM_PARAM_ID_HPF_IIRX_FILTER_PRE_GAIN.tex}
8097 */
8098#define ADM_PARAM_ID_HPF_IIRX_FILTER_PRE_GAIN 0x00010C3F
8099
8100/* ID of the Tx HPF IIR filter configuration parameters used by the
8101 * #ADM_MODULE_ID_HPF_IIRX_FILTER module.
8102 * @parspace Message payload
8103 * @structure{adm_hpfx_iir_filter_cfg_params}
8104 * @tablespace
8105 * @inputtable{Audio_Postproc_ADM_PARAM_ID_HPF_IIRX_FILTER_CONFIG_PA
8106 * RAMS.tex}
8107 */
8108#define ADM_PARAM_ID_HPF_IIRX_FILTER_CONFIG_PARAMS 0x00010C40
8109
8110/* Structure for enabling a configuration parameter for
8111 * the HPF IIR tuning filter module on the Tx path.
8112 */
8113
8114/* @brief Payload of the #ADM_PARAM_ID_HPF_IIRX_FILTER_ENABLE_CONFIG
8115 * parameter in the Tx path HPF Tuning Filter module.
8116 */
8117struct adm_hpfx_iir_filter_enable_cfg {
8118 uint32_t enable_flag;
8119/* Specifies whether the HPF tuning filter is disabled (0) or
8120 * enabled (nonzero).
8121 */
8122} __packed;
8123
8124
8125/* Structure for the pregain parameter for the HPF
8126 * IIR tuning filter module on the Tx path.
8127 */
8128
8129
8130/* @brief Payload of the #ADM_PARAM_ID_HPF_IIRX_FILTER_PRE_GAIN parameter
8131 * in the Tx path HPF Tuning Filter module.
8132 */
8133struct adm_hpfx_iir_filter_pre_gain {
8134 uint16_t pre_gain;
8135 /* Linear gain in Q13 format. */
8136
8137 uint16_t reserved;
8138 /* Clients must set this field to zero.*/
8139} __packed;
8140
8141
8142/* Structure for the configuration parameter for the
8143 * HPF IIR tuning filter module on the Tx path.
8144 */
8145
8146
8147/* @brief Payload of the #ADM_PARAM_ID_HPF_IIRX_FILTER_CONFIG_PARAMS
8148 * parameters in the Tx path HPF Tuning Filter module. \n
8149 * \n
8150 * This structure is followed by tuning filter coefficients as follows: \n
8151 * - Sequence of int32_t FilterCoeffs.
8152 * Each band has five coefficients, each in int32_t format in the order of
8153 * b0, b1, b2, a1, a2.
8154 * - Sequence of int16_t NumShiftFactor.
8155 * One int16_t per band. The numerator shift factor is related to the Q
8156 * factor of the filter coefficients.
8157 * - Sequence of uint16_t PanSetting.
8158 * One uint16_t for each band to indicate application of the filter to
8159 * left (0), right (1), or both (2) channels.
8160 */
8161struct adm_hpfx_iir_filter_cfg_params {
8162 uint16_t num_biquad_stages;
8163/*< Number of bands.
8164 * Supported values: 0 to 20
8165 */
8166
8167 uint16_t reserved;
8168 /*< Clients must set this field to zero.*/
8169} __packed;
8170
8171/* end_addtogroup audio_pp_module_ids */
8172
8173/* @addtogroup audio_pp_module_ids */
8174/* ID of the Tx path IIR Tuning Filter module.
8175 * This module supports the following parameter IDs:
8176 * - #ADM_PARAM_IDX_IIR_FILTER_ENABLE_CONFIG
8177 */
8178#define ADM_MODULE_IDX_IIR_FILTER 0x00010C41
8179
8180/* ID of the Rx path IIR Tuning Filter module for the left channel.
8181 * The parameter IDs of the IIR tuning filter module
8182 * (#ASM_MODULE_ID_IIRUNING_FILTER) are used for the left IIR Rx tuning
8183 * filter.
8184 *
8185 * Pan parameters are not required for this per-channel IIR filter; the pan
8186 * parameters are ignored by this module.
8187 */
8188#define ADM_MODULE_ID_LEFT_IIRUNING_FILTER 0x00010705
8189
8190/* ID of the the Rx path IIR Tuning Filter module for the right
8191 * channel.
8192 * The parameter IDs of the IIR tuning filter module
8193 * (#ASM_MODULE_ID_IIRUNING_FILTER) are used for the right IIR Rx
8194 * tuning filter.
8195 *
8196 * Pan parameters are not required for this per-channel IIR filter;
8197 * the pan parameters are ignored by this module.
8198 */
8199#define ADM_MODULE_ID_RIGHT_IIRUNING_FILTER 0x00010706
8200
8201/* end_addtogroup audio_pp_module_ids */
8202
8203/* @addtogroup audio_pp_param_ids */
8204
8205/* ID of the Tx IIR filter enable parameter used by the
8206 * #ADM_MODULE_IDX_IIR_FILTER module.
8207 * @parspace Message payload
8208 * @structure{admx_iir_filter_enable_cfg}
8209 * @tablespace
8210 * @inputtable{Audio_Postproc_ADM_PARAM_IDX_IIR_FILTER_ENABLE_CONFIG.tex}
8211 */
8212#define ADM_PARAM_IDX_IIR_FILTER_ENABLE_CONFIG 0x00010C42
8213
8214/* ID of the Tx IIR filter pregain parameter used by the
8215 * #ADM_MODULE_IDX_IIR_FILTER module.
8216 * @parspace Message payload
8217 * @structure{admx_iir_filter_pre_gain}
8218 * @tablespace
8219 * @inputtable{Audio_Postproc_ADM_PARAM_IDX_IIR_FILTER_PRE_GAIN.tex}
8220 */
8221#define ADM_PARAM_IDX_IIR_FILTER_PRE_GAIN 0x00010C43
8222
8223/* ID of the Tx IIR filter configuration parameters used by the
8224 * #ADM_MODULE_IDX_IIR_FILTER module.
8225 * @parspace Message payload
8226 * @structure{admx_iir_filter_cfg_params}
8227 * @tablespace
8228 * @inputtable{Audio_Postproc_ADM_PARAM_IDX_IIR_FILTER_CONFIG_PARAMS.tex}
8229 */
8230#define ADM_PARAM_IDX_IIR_FILTER_CONFIG_PARAMS 0x00010C44
8231
8232/* Structure for enabling the configuration parameter for the
8233 * IIR filter module on the Tx path.
8234 */
8235
8236/* @brief Payload of the #ADM_PARAM_IDX_IIR_FILTER_ENABLE_CONFIG
8237 * parameter in the Tx Path IIR Tuning Filter module.
8238 */
8239
8240struct admx_iir_filter_enable_cfg {
8241 uint32_t enable_flag;
8242/*< Specifies whether the IIR tuning filter is disabled (0) or
8243 * enabled (nonzero).
8244 */
8245
8246} __packed;
8247
8248
8249/* Structure for the pregain parameter for the
8250 * IIR filter module on the Tx path.
8251 */
8252
8253
8254/* @brief Payload of the #ADM_PARAM_IDX_IIR_FILTER_PRE_GAIN
8255 * parameter in the Tx Path IIR Tuning Filter module.
8256 */
8257
8258struct admx_iir_filter_pre_gain {
8259 uint16_t pre_gain;
8260 /*< Linear gain in Q13 format. */
8261
8262 uint16_t reserved;
8263 /*< Clients must set this field to zero.*/
8264} __packed;
8265
8266
8267/* Structure for the configuration parameter for the
8268 * IIR filter module on the Tx path.
8269 */
8270
8271
8272/* @brief Payload of the #ADM_PARAM_IDX_IIR_FILTER_CONFIG_PARAMS
8273 * parameter in the Tx Path IIR Tuning Filter module. \n
8274 * \n
8275 * This structure is followed by the HPF IIR filter coefficients on
8276 * the Tx path as follows: \n
8277 * - Sequence of int32_t ulFilterCoeffs. Each band has five
8278 * coefficients, each in int32_t format in the order of b0, b1, b2,
8279 * a1, a2.
8280 * - Sequence of int16_t sNumShiftFactor. One int16_t per band. The
8281 * numerator shift factor is related to the Q factor of the filter
8282 * coefficients.
8283 * - Sequence of uint16_t usPanSetting. One uint16_t for each band
8284 * to indicate if the filter is applied to left (0), right (1), or
8285 * both (2) channels.
8286 */
8287struct admx_iir_filter_cfg_params {
8288 uint16_t num_biquad_stages;
8289/*< Number of bands.
8290 * Supported values: 0 to 20
8291 */
8292
8293 uint16_t reserved;
8294 /*< Clients must set this field to zero.*/
8295} __packed;
8296
8297/* end_addtogroup audio_pp_module_ids */
8298
8299/* @ingroup audio_pp_module_ids
8300 * ID of the QEnsemble module.
8301 * This module supports the following parameter IDs:
8302 * - #ADM_PARAM_ID_QENSEMBLE_ENABLE
8303 * - #ADM_PARAM_ID_QENSEMBLE_BACKGAIN
8304 * - #ADM_PARAM_ID_QENSEMBLE_SET_NEW_ANGLE
8305 */
8306#define ADM_MODULE_ID_QENSEMBLE 0x00010C59
8307
8308/* @addtogroup audio_pp_param_ids */
8309/* ID of the QEnsemble enable parameter used by the
8310 * #ADM_MODULE_ID_QENSEMBLE module.
8311 * @messagepayload
8312 * @structure{adm_qensemble_enable}
8313 * @tablespace
8314 * @inputtable{Audio_Postproc_ADM_PARAM_ID_QENSEMBLE_ENABLE.tex}
8315 */
8316#define ADM_PARAM_ID_QENSEMBLE_ENABLE 0x00010C60
8317
8318/* ID of the QEnsemble back gain parameter used by the
8319 * #ADM_MODULE_ID_QENSEMBLE module.
8320 * @messagepayload
8321 * @structure{adm_qensemble_param_backgain}
8322 * @tablespace
8323 * @inputtable{Audio_Postproc_ADM_PARAM_ID_QENSEMBLE_BACKGAIN.tex}
8324 */
8325#define ADM_PARAM_ID_QENSEMBLE_BACKGAIN 0x00010C61
8326
8327/* ID of the QEnsemble new angle parameter used by the
8328 * #ADM_MODULE_ID_QENSEMBLE module.
8329 * @messagepayload
8330 * @structure{adm_qensemble_param_set_new_angle}
8331 * @tablespace
8332 * @inputtable{Audio_Postproc_ADM_PARAM_ID_QENSEMBLE_SET_NEW_ANGLE.tex}
8333 */
8334#define ADM_PARAM_ID_QENSEMBLE_SET_NEW_ANGLE 0x00010C62
8335
8336/* Structure for enabling the configuration parameter for the
8337 * QEnsemble module.
8338 */
8339
8340
8341/* @brief Payload of the #ADM_PARAM_ID_QENSEMBLE_ENABLE
8342 * parameter used by the QEnsemble module.
8343 */
8344struct adm_qensemble_enable {
8345 uint32_t enable_flag;
8346/*< Specifies whether the QEnsemble module is disabled (0) or enabled
8347 * (nonzero).
8348 */
8349} __packed;
8350
8351
8352/* Structure for the background gain for the QEnsemble module. */
8353
8354
8355/* @brief Payload of the #ADM_PARAM_ID_QENSEMBLE_BACKGAIN
8356 * parameter used by
8357 * the QEnsemble module.
8358 */
8359struct adm_qensemble_param_backgain {
8360 int16_t back_gain;
8361/*< Linear gain in Q15 format.
8362 * Supported values: 0 to 32767
8363 */
8364
8365 uint16_t reserved;
8366 /*< Clients must set this field to zero.*/
8367} __packed;
8368/* Structure for setting a new angle for the QEnsemble module. */
8369
8370
8371/* @brief Payload of the #ADM_PARAM_ID_QENSEMBLE_SET_NEW_ANGLE
8372 * parameter used
8373 * by the QEnsemble module.
8374 */
8375struct adm_qensemble_param_set_new_angle {
8376 int16_t new_angle;
8377/*< New angle in degrees.
8378 * Supported values: 0 to 359
8379 */
8380
8381 int16_t time_ms;
8382/*< Transition time in milliseconds to set the new angle.
8383 * Supported values: 0 to 32767
8384 */
8385} __packed;
8386
8387
8388#define ADM_CMD_GET_PP_TOPO_MODULE_LIST 0x00010349
8389#define ADM_CMDRSP_GET_PP_TOPO_MODULE_LIST 0x00010350
8390#define AUDPROC_PARAM_ID_ENABLE 0x00010904
8391 /*
8392 * Payload of the ADM_CMD_GET_PP_TOPO_MODULE_LIST command.
8393 */
8394struct adm_cmd_get_pp_topo_module_list_t {
8395 struct apr_hdr hdr;
8396 /* Lower 32 bits of the 64-bit parameter data payload address. */
8397 uint32_t data_payload_addr_lsw;
8398 /*
8399 * Upper 32 bits of the 64-bit parameter data payload address.
8400 *
8401 *
8402 * The size of the shared memory, if specified, must be large enough to
8403 * contain the entire parameter data payload, including the module ID,
8404 * parameter ID, parameter size, and parameter values.
8405 */
8406 uint32_t data_payload_addr_msw;
8407 /*
8408 * Unique identifier for an address.
8409 *
8410 * This memory map handle is returned by the aDSP through the
8411 * #ADM_CMD_SHARED_MEM_MAP_REGIONS command.
8412 *
8413 * @values
8414 * - Non-NULL -- On acknowledgment, the parameter data payloads begin at
8415 * the address specified (out-of-band)
8416 * - NULL -- The acknowledgment's payload contains the parameter data
8417 * (in-band) @tablebulletend
8418 */
8419 uint32_t mem_map_handle;
8420 /*
8421 * Maximum data size of the list of modules. This
8422 * field is a multiple of 4 bytes.
8423 */
8424 uint16_t param_max_size;
8425 /* This field must be set to zero. */
8426 uint16_t reserved;
8427} __packed;
8428
8429/*
8430 * Payload of the ADM_CMDRSP_GET_PP_TOPO_MODULE_LIST message, which returns
8431 * module ids in response to an ADM_CMD_GET_PP_TOPO_MODULE_LIST command.
8432 * Immediately following this structure is the acknowledgment <b>module id
8433 * data variable payload</b> containing the pre/postprocessing module id
8434 * values. For an in-band scenario, the variable payload depends on the size
8435 * of the parameter.
8436 */
8437struct adm_cmd_rsp_get_pp_topo_module_list_t {
8438 /* Status message (error code). */
8439 uint32_t status;
8440} __packed;
8441
8442struct audproc_topology_module_id_info_t {
8443 uint32_t num_modules;
8444} __packed;
8445
8446/* end_addtogroup audio_pp_module_ids */
8447
8448/* @ingroup audio_pp_module_ids
8449 * ID of the Volume Control module pre/postprocessing block.
8450 * This module supports the following parameter IDs:
8451 * - #ASM_PARAM_ID_VOL_CTRL_MASTER_GAIN
8452 * - #ASM_PARAM_ID_MULTICHANNEL_GAIN
8453 * - #ASM_PARAM_ID_VOL_CTRL_MUTE_CONFIG
8454 * - #ASM_PARAM_ID_SOFT_VOL_STEPPING_PARAMETERS
8455 * - #ASM_PARAM_ID_SOFT_PAUSE_PARAMETERS
8456 * - #ASM_PARAM_ID_MULTICHANNEL_GAIN
8457 * - #ASM_PARAM_ID_MULTICHANNEL_MUTE
8458 */
8459#define ASM_MODULE_ID_VOL_CTRL 0x00010BFE
8460#define ASM_MODULE_ID_VOL_CTRL2 0x00010910
8461#define AUDPROC_MODULE_ID_VOL_CTRL ASM_MODULE_ID_VOL_CTRL
8462
8463/* @addtogroup audio_pp_param_ids */
8464/* ID of the master gain parameter used by the #ASM_MODULE_ID_VOL_CTRL
8465 * module.
8466 * @messagepayload
8467 * @structure{asm_volume_ctrl_master_gain}
8468 * @tablespace
8469 * @inputtable{Audio_Postproc_ASM_PARAM_ID_VOL_CTRL_MASTER_GAIN.tex}
8470 */
8471#define ASM_PARAM_ID_VOL_CTRL_MASTER_GAIN 0x00010BFF
8472#define AUDPROC_PARAM_ID_VOL_CTRL_MASTER_GAIN ASM_PARAM_ID_VOL_CTRL_MASTER_GAIN
8473
8474/* ID of the left/right channel gain parameter used by the
8475 * #ASM_MODULE_ID_VOL_CTRL module.
8476 * @messagepayload
8477 * @structure{asm_volume_ctrl_lr_chan_gain}
8478 * @tablespace
8479 * @inputtable{Audio_Postproc_ASM_PARAM_ID_MULTICHANNEL_GAIN.tex}
8480 */
8481#define ASM_PARAM_ID_VOL_CTRL_LR_CHANNEL_GAIN 0x00010C00
8482
8483/* ID of the mute configuration parameter used by the
8484 * #ASM_MODULE_ID_VOL_CTRL module.
8485 * @messagepayload
8486 * @structure{asm_volume_ctrl_mute_config}
8487 * @tablespace
8488 * @inputtable{Audio_Postproc_ASM_PARAM_ID_VOL_CTRL_MUTE_CONFIG.tex}
8489 */
8490#define ASM_PARAM_ID_VOL_CTRL_MUTE_CONFIG 0x00010C01
8491
8492/* ID of the soft stepping volume parameters used by the
8493 * #ASM_MODULE_ID_VOL_CTRL module.
8494 * @messagepayload
8495 * @structure{asm_soft_step_volume_params}
8496 * @tablespace
8497 * @inputtable{Audio_Postproc_ASM_PARAM_ID_SOFT_VOL_STEPPING_PARAMET
8498 * ERS.tex}
8499 */
8500#define ASM_PARAM_ID_SOFT_VOL_STEPPING_PARAMETERS 0x00010C29
8501#define AUDPROC_PARAM_ID_SOFT_VOL_STEPPING_PARAMETERS\
8502 ASM_PARAM_ID_SOFT_VOL_STEPPING_PARAMETERS
8503
8504/* ID of the soft pause parameters used by the #ASM_MODULE_ID_VOL_CTRL
8505 * module.
8506 */
8507#define ASM_PARAM_ID_SOFT_PAUSE_PARAMETERS 0x00010D6A
8508
8509/* ID of the multiple-channel volume control parameters used by the
8510 * #ASM_MODULE_ID_VOL_CTRL module.
8511 */
8512#define ASM_PARAM_ID_MULTICHANNEL_GAIN 0x00010713
8513
8514/* ID of the multiple-channel mute configuration parameters used by the
8515 * #ASM_MODULE_ID_VOL_CTRL module.
8516 */
8517
8518#define ASM_PARAM_ID_MULTICHANNEL_MUTE 0x00010714
8519
8520/* Structure for the master gain parameter for a volume control
8521 * module.
8522 */
8523
8524
8525/* @brief Payload of the #ASM_PARAM_ID_VOL_CTRL_MASTER_GAIN
8526 * parameter used by the Volume Control module.
8527 */
8528
8529
8530
8531struct asm_volume_ctrl_master_gain {
8532 struct apr_hdr hdr;
8533 struct asm_stream_cmd_set_pp_params_v2 param;
8534 struct asm_stream_param_data_v2 data;
8535 uint16_t master_gain;
8536 /* Linear gain in Q13 format. */
8537
8538 uint16_t reserved;
8539 /* Clients must set this field to zero. */
8540} __packed;
8541
8542
8543struct asm_volume_ctrl_lr_chan_gain {
8544 struct apr_hdr hdr;
8545 struct asm_stream_cmd_set_pp_params_v2 param;
8546 struct asm_stream_param_data_v2 data;
8547
8548 uint16_t l_chan_gain;
8549 /*< Linear gain in Q13 format for the left channel. */
8550
8551 uint16_t r_chan_gain;
8552 /*< Linear gain in Q13 format for the right channel.*/
8553} __packed;
8554
8555
8556/* Structure for the mute configuration parameter for a
8557 * volume control module.
8558 */
8559
8560
8561/* @brief Payload of the #ASM_PARAM_ID_VOL_CTRL_MUTE_CONFIG
8562 * parameter used by the Volume Control module.
8563 */
8564
8565
8566struct asm_volume_ctrl_mute_config {
8567 struct apr_hdr hdr;
8568 struct asm_stream_cmd_set_pp_params_v2 param;
8569 struct asm_stream_param_data_v2 data;
8570 uint32_t mute_flag;
8571/*< Specifies whether mute is disabled (0) or enabled (nonzero).*/
8572
8573} __packed;
8574
8575/*
8576 * Supported parameters for a soft stepping linear ramping curve.
8577 */
8578#define ASM_PARAM_SVC_RAMPINGCURVE_LINEAR 0
8579
8580/*
8581 * Exponential ramping curve.
8582 */
8583#define ASM_PARAM_SVC_RAMPINGCURVE_EXP 1
8584
8585/*
8586 * Logarithmic ramping curve.
8587 */
8588#define ASM_PARAM_SVC_RAMPINGCURVE_LOG 2
8589
8590/* Structure for holding soft stepping volume parameters. */
8591
8592
8593/* Payload of the #ASM_PARAM_ID_SOFT_VOL_STEPPING_PARAMETERS
8594 * parameters used by the Volume Control module.
8595 */
8596struct asm_soft_step_volume_params {
8597 struct apr_hdr hdr;
8598 struct asm_stream_cmd_set_pp_params_v2 param;
8599 struct asm_stream_param_data_v2 data;
8600 uint32_t period;
8601/*< Period in milliseconds.
8602 * Supported values: 0 to 15000
8603 */
8604
8605 uint32_t step;
8606/*< Step in microseconds.
8607 * Supported values: 0 to 15000000
8608 */
8609
8610 uint32_t ramping_curve;
8611/*< Ramping curve type.
8612 * Supported values:
8613 * - #ASM_PARAM_SVC_RAMPINGCURVE_LINEAR
8614 * - #ASM_PARAM_SVC_RAMPINGCURVE_EXP
8615 * - #ASM_PARAM_SVC_RAMPINGCURVE_LOG
8616 */
8617} __packed;
8618
8619
8620/* Structure for holding soft pause parameters. */
8621
8622
8623/* Payload of the #ASM_PARAM_ID_SOFT_PAUSE_PARAMETERS
8624 * parameters used by the Volume Control module.
8625 */
8626
8627
8628struct asm_soft_pause_params {
8629 struct apr_hdr hdr;
8630 struct asm_stream_cmd_set_pp_params_v2 param;
8631 struct asm_stream_param_data_v2 data;
8632 uint32_t enable_flag;
8633/*< Specifies whether soft pause is disabled (0) or enabled
8634 * (nonzero).
8635 */
8636
8637
8638
8639 uint32_t period;
8640/*< Period in milliseconds.
8641 * Supported values: 0 to 15000
8642 */
8643
8644 uint32_t step;
8645/*< Step in microseconds.
8646 * Supported values: 0 to 15000000
8647 */
8648
8649 uint32_t ramping_curve;
8650/*< Ramping curve.
8651 * Supported values:
8652 * - #ASM_PARAM_SVC_RAMPINGCURVE_LINEAR
8653 * - #ASM_PARAM_SVC_RAMPINGCURVE_EXP
8654 * - #ASM_PARAM_SVC_RAMPINGCURVE_LOG
8655 */
8656} __packed;
8657
8658
8659/* Maximum number of channels.*/
8660#define VOLUME_CONTROL_MAX_CHANNELS 8
8661
8662/* Structure for holding one channel type - gain pair. */
8663
8664
8665/* Payload of the #ASM_PARAM_ID_MULTICHANNEL_GAIN channel
8666 * type/gain pairs used by the Volume Control module. \n \n This
8667 * structure immediately follows the
8668 * asm_volume_ctrl_multichannel_gain structure.
8669 */
8670
8671
8672struct asm_volume_ctrl_channeltype_gain_pair {
8673 uint8_t channeltype;
8674 /*
8675 * Channel type for which the gain setting is to be applied.
8676 * Supported values:
8677 * - #PCM_CHANNEL_L
8678 * - #PCM_CHANNEL_R
8679 * - #PCM_CHANNEL_C
8680 * - #PCM_CHANNEL_LS
8681 * - #PCM_CHANNEL_RS
8682 * - #PCM_CHANNEL_LFE
8683 * - #PCM_CHANNEL_CS
8684 * - #PCM_CHANNEL_LB
8685 * - #PCM_CHANNEL_RB
8686 * - #PCM_CHANNELS
8687 * - #PCM_CHANNEL_CVH
8688 * - #PCM_CHANNEL_MS
8689 * - #PCM_CHANNEL_FLC
8690 * - #PCM_CHANNEL_FRC
8691 * - #PCM_CHANNEL_RLC
8692 * - #PCM_CHANNEL_RRC
8693 */
8694
8695 uint8_t reserved1;
8696 /* Clients must set this field to zero. */
8697
8698 uint8_t reserved2;
8699 /* Clients must set this field to zero. */
8700
8701 uint8_t reserved3;
8702 /* Clients must set this field to zero. */
8703
8704 uint32_t gain;
8705 /*
8706 * Gain value for this channel in Q28 format.
8707 * Supported values: Any
8708 */
8709} __packed;
8710
8711
8712/* Structure for the multichannel gain command */
8713
8714
8715/* Payload of the #ASM_PARAM_ID_MULTICHANNEL_GAIN
8716 * parameters used by the Volume Control module.
8717 */
8718
8719
8720struct asm_volume_ctrl_multichannel_gain {
8721 struct apr_hdr hdr;
8722 struct asm_stream_cmd_set_pp_params_v2 param;
8723 struct asm_stream_param_data_v2 data;
8724 uint32_t num_channels;
8725 /*
8726 * Number of channels for which gain values are provided. Any
8727 * channels present in the data for which gain is not provided are
8728 * set to unity gain.
8729 * Supported values: 1 to 8
8730 */
8731
8732 struct asm_volume_ctrl_channeltype_gain_pair
8733 gain_data[VOLUME_CONTROL_MAX_CHANNELS];
8734 /* Array of channel type/gain pairs.*/
8735} __packed;
8736
8737
8738/* Structure for holding one channel type - mute pair. */
8739
8740
8741/* Payload of the #ASM_PARAM_ID_MULTICHANNEL_MUTE channel
8742 * type/mute setting pairs used by the Volume Control module. \n \n
8743 * This structure immediately follows the
8744 * asm_volume_ctrl_multichannel_mute structure.
8745 */
8746
8747
8748struct asm_volume_ctrl_channelype_mute_pair {
8749 struct apr_hdr hdr;
8750 struct asm_stream_cmd_set_pp_params_v2 param;
8751 struct asm_stream_param_data_v2 data;
8752 uint8_t channelype;
8753/*< Channel type for which the mute setting is to be applied.
8754 * Supported values:
8755 * - #PCM_CHANNEL_L
8756 * - #PCM_CHANNEL_R
8757 * - #PCM_CHANNEL_C
8758 * - #PCM_CHANNEL_LS
8759 * - #PCM_CHANNEL_RS
8760 * - #PCM_CHANNEL_LFE
8761 * - #PCM_CHANNEL_CS
8762 * - #PCM_CHANNEL_LB
8763 * - #PCM_CHANNEL_RB
8764 * - #PCM_CHANNELS
8765 * - #PCM_CHANNEL_CVH
8766 * - #PCM_CHANNEL_MS
8767 * - #PCM_CHANNEL_FLC
8768 * - #PCM_CHANNEL_FRC
8769 * - #PCM_CHANNEL_RLC
8770 * - #PCM_CHANNEL_RRC
8771 */
8772
8773 uint8_t reserved1;
8774 /*< Clients must set this field to zero. */
8775
8776 uint8_t reserved2;
8777 /*< Clients must set this field to zero. */
8778
8779 uint8_t reserved3;
8780 /*< Clients must set this field to zero. */
8781
8782 uint32_t mute;
8783/*< Mute setting for this channel.
8784 * Supported values:
8785 * - 0 = Unmute
8786 * - Nonzero = Mute
8787 */
8788} __packed;
8789
8790
8791/* Structure for the multichannel mute command */
8792
8793
8794/* @brief Payload of the #ASM_PARAM_ID_MULTICHANNEL_MUTE
8795 * parameters used by the Volume Control module.
8796 */
8797
8798
8799struct asm_volume_ctrl_multichannel_mute {
8800 struct apr_hdr hdr;
8801 struct asm_stream_cmd_set_pp_params_v2 param;
8802 struct asm_stream_param_data_v2 data;
8803 uint32_t num_channels;
8804/*< Number of channels for which mute configuration is
8805 * provided. Any channels present in the data for which mute
8806 * configuration is not provided are set to unmute.
8807 * Supported values: 1 to 8
8808 */
8809
8810struct asm_volume_ctrl_channelype_mute_pair
8811 mute_data[VOLUME_CONTROL_MAX_CHANNELS];
8812 /*< Array of channel type/mute setting pairs.*/
8813} __packed;
8814/* end_addtogroup audio_pp_param_ids */
8815
8816/* audio_pp_module_ids
8817 * ID of the IIR Tuning Filter module.
8818 * This module supports the following parameter IDs:
8819 * - #ASM_PARAM_ID_IIRUNING_FILTER_ENABLE_CONFIG
8820 * - #ASM_PARAM_ID_IIRUNING_FILTER_PRE_GAIN
8821 * - #ASM_PARAM_ID_IIRUNING_FILTER_CONFIG_PARAMS
8822 */
8823#define ASM_MODULE_ID_IIRUNING_FILTER 0x00010C02
8824
8825/* @addtogroup audio_pp_param_ids */
8826/* ID of the IIR tuning filter enable parameter used by the
8827 * #ASM_MODULE_ID_IIRUNING_FILTER module.
8828 * @messagepayload
8829 * @structure{asm_iiruning_filter_enable}
8830 * @tablespace
8831 * @inputtable{Audio_Postproc_ASM_PARAM_ID_IIRUNING_FILTER_ENABLE_CO
8832 * NFIG.tex}
8833 */
8834#define ASM_PARAM_ID_IIRUNING_FILTER_ENABLE_CONFIG 0x00010C03
8835
8836/* ID of the IIR tuning filter pregain parameter used by the
8837 * #ASM_MODULE_ID_IIRUNING_FILTER module.
8838 */
8839#define ASM_PARAM_ID_IIRUNING_FILTER_PRE_GAIN 0x00010C04
8840
8841/* ID of the IIR tuning filter configuration parameters used by the
8842 * #ASM_MODULE_ID_IIRUNING_FILTER module.
8843 */
8844#define ASM_PARAM_ID_IIRUNING_FILTER_CONFIG_PARAMS 0x00010C05
8845
8846/* Structure for an enable configuration parameter for an
8847 * IIR tuning filter module.
8848 */
8849
8850
8851/* @brief Payload of the #ASM_PARAM_ID_IIRUNING_FILTER_ENABLE_CONFIG
8852 * parameter used by the IIR Tuning Filter module.
8853 */
8854struct asm_iiruning_filter_enable {
8855 uint32_t enable_flag;
8856/*< Specifies whether the IIR tuning filter is disabled (0) or
8857 * enabled (1).
8858 */
8859} __packed;
8860
8861/* Structure for the pregain parameter for an IIR tuning filter module. */
8862
8863
8864/* Payload of the #ASM_PARAM_ID_IIRUNING_FILTER_PRE_GAIN
8865 * parameters used by the IIR Tuning Filter module.
8866 */
8867struct asm_iiruning_filter_pregain {
8868 uint16_t pregain;
8869 /*< Linear gain in Q13 format. */
8870
8871 uint16_t reserved;
8872 /*< Clients must set this field to zero.*/
8873} __packed;
8874
8875/* Structure for the configuration parameter for an IIR tuning filter
8876 * module.
8877 */
8878
8879
8880/* @brief Payload of the #ASM_PARAM_ID_IIRUNING_FILTER_CONFIG_PARAMS
8881 * parameters used by the IIR Tuning Filter module. \n
8882 * \n
8883 * This structure is followed by the IIR filter coefficients: \n
8884 * - Sequence of int32_t FilterCoeffs \n
8885 * Five coefficients for each band. Each coefficient is in int32_t format, in
8886 * the order of b0, b1, b2, a1, a2.
8887 * - Sequence of int16_t NumShiftFactor \n
8888 * One int16_t per band. The numerator shift factor is related to the Q
8889 * factor of the filter coefficients.
8890 * - Sequence of uint16_t PanSetting \n
8891 * One uint16_t per band, indicating if the filter is applied to left (0),
8892 * right (1), or both (2) channels.
8893 */
8894struct asm_iir_filter_config_params {
8895 uint16_t num_biquad_stages;
8896/*< Number of bands.
8897 * Supported values: 0 to 20
8898 */
8899
8900 uint16_t reserved;
8901 /*< Clients must set this field to zero.*/
8902} __packed;
8903
8904/* audio_pp_module_ids
8905 * ID of the Multiband Dynamic Range Control (MBDRC) module on the Tx/Rx
8906 * paths.
8907 * This module supports the following parameter IDs:
8908 * - #ASM_PARAM_ID_MBDRC_ENABLE
8909 * - #ASM_PARAM_ID_MBDRC_CONFIG_PARAMS
8910 */
8911#define ASM_MODULE_ID_MBDRC 0x00010C06
8912
8913/* audio_pp_param_ids */
8914/* ID of the MBDRC enable parameter used by the #ASM_MODULE_ID_MBDRC module.
8915 * @messagepayload
8916 * @structure{asm_mbdrc_enable}
8917 * @tablespace
8918 * @inputtable{Audio_Postproc_ASM_PARAM_ID_MBDRC_ENABLE.tex}
8919 */
8920#define ASM_PARAM_ID_MBDRC_ENABLE 0x00010C07
8921
8922/* ID of the MBDRC configuration parameters used by the
8923 * #ASM_MODULE_ID_MBDRC module.
8924 * @messagepayload
8925 * @structure{asm_mbdrc_config_params}
8926 * @tablespace
8927 * @inputtable{Audio_Postproc_ASM_PARAM_ID_MBDRC_CONFIG_PARAMS.tex}
8928 *
8929 * @parspace Sub-band DRC configuration parameters
8930 * @structure{asm_subband_drc_config_params}
8931 * @tablespace
8932 * @inputtable{Audio_Postproc_ASM_PARAM_ID_MBDRC_CONFIG_PARAMS_subband_DRC.tex}
8933 *
8934 * @keep{6}
8935 * To obtain legacy ADRC from MBDRC, use the calibration tool to:
8936 *
8937 * - Enable MBDRC (EnableFlag = TRUE)
8938 * - Set number of bands to 1 (uiNumBands = 1)
8939 * - Enable the first MBDRC band (DrcMode[0] = DRC_ENABLED = 1)
8940 * - Clear the first band mute flag (MuteFlag[0] = 0)
8941 * - Set the first band makeup gain to unity (compMakeUpGain[0] = 0x2000)
8942 * - Use the legacy ADRC parameters to calibrate the rest of the MBDRC
8943 * parameters.
8944 */
8945#define ASM_PARAM_ID_MBDRC_CONFIG_PARAMS 0x00010C08
8946
8947/* end_addtogroup audio_pp_param_ids */
8948
8949/* audio_pp_module_ids
8950 * ID of the MMBDRC module version 2 pre/postprocessing block.
8951 * This module differs from the original MBDRC (#ASM_MODULE_ID_MBDRC) in
8952 * the length of the filters used in each sub-band.
8953 * This module supports the following parameter ID:
8954 * - #ASM_PARAM_ID_MBDRC_CONFIG_PARAMS_IMPROVED_FILTBANK_V2
8955 */
8956#define ASM_MODULE_ID_MBDRCV2 0x0001070B
8957
8958/* @addtogroup audio_pp_param_ids */
8959/* ID of the configuration parameters used by the
8960 * #ASM_MODULE_ID_MBDRCV2 module for the improved filter structure
8961 * of the MBDRC v2 pre/postprocessing block.
8962 * The update to this configuration structure from the original
8963 * MBDRC is the number of filter coefficients in the filter
8964 * structure. The sequence for is as follows:
8965 * - 1 band = 0 FIR coefficient + 1 mute flag + uint16_t padding
8966 * - 2 bands = 141 FIR coefficients + 2 mute flags + uint16_t padding
8967 * - 3 bands = 141+81 FIR coefficients + 3 mute flags + uint16_t padding
8968 * - 4 bands = 141+81+61 FIR coefficients + 4 mute flags + uint16_t
8969 * padding
8970 * - 5 bands = 141+81+61+61 FIR coefficients + 5 mute flags +
8971 * uint16_t padding
8972 * This block uses the same parameter structure as
8973 * #ASM_PARAM_ID_MBDRC_CONFIG_PARAMS.
8974 */
8975#define ASM_PARAM_ID_MBDRC_CONFIG_PARAMS_IMPROVED_FILTBANK_V2 \
8976 0x0001070C
8977
8978#define ASM_MODULE_ID_MBDRCV3 0x0001090B
8979/*
8980 * ID of the MMBDRC module version 3 pre/postprocessing block.
8981 * This module differs from MBDRCv2 (#ASM_MODULE_ID_MBDRCV2) in
8982 * that it supports both 16- and 24-bit data.
8983 * This module supports the following parameter ID:
8984 * - #ASM_PARAM_ID_MBDRC_ENABLE
8985 * - #ASM_PARAM_ID_MBDRC_CONFIG_PARAMS
8986 * - #ASM_PARAM_ID_MBDRC_CONFIG_PARAMS_V3
8987 * - #ASM_PARAM_ID_MBDRC_FILTER_XOVER_FREQS
8988 */
8989
8990/* Structure for the enable parameter for an MBDRC module. */
8991
8992
8993/* Payload of the #ASM_PARAM_ID_MBDRC_ENABLE parameter used by the
8994 * MBDRC module.
8995 */
8996struct asm_mbdrc_enable {
8997 uint32_t enable_flag;
8998/*< Specifies whether MBDRC is disabled (0) or enabled (nonzero).*/
8999} __packed;
9000
9001/* Structure for the configuration parameters for an MBDRC module. */
9002
9003
9004/* Payload of the #ASM_PARAM_ID_MBDRC_CONFIG_PARAMS
9005 * parameters used by the MBDRC module. \n \n Following this
9006 * structure is the payload for sub-band DRC configuration
9007 * parameters (asm_subband_drc_config_params). This sub-band
9008 * structure must be repeated for each band.
9009 */
9010
9011
9012struct asm_mbdrc_config_params {
9013 uint16_t num_bands;
9014/*< Number of bands.
9015 * Supported values: 1 to 5
9016 */
9017
9018 int16_t limiterhreshold;
9019/*< Threshold in decibels for the limiter output.
9020 * Supported values: -72 to 18 \n
9021 * Recommended value: 3994 (-0.22 db in Q3.12 format)
9022 */
9023
9024 int16_t limiter_makeup_gain;
9025/*< Makeup gain in decibels for the limiter output.
9026 * Supported values: -42 to 42 \n
9027 * Recommended value: 256 (0 dB in Q7.8 format)
9028 */
9029
9030 int16_t limiter_gc;
9031/*< Limiter gain recovery coefficient.
9032 * Supported values: 0.5 to 0.99 \n
9033 * Recommended value: 32440 (0.99 in Q15 format)
9034 */
9035
9036 int16_t limiter_delay;
9037/*< Limiter delay in samples.
9038 * Supported values: 0 to 10 \n
9039 * Recommended value: 262 (0.008 samples in Q15 format)
9040 */
9041
9042 int16_t limiter_max_wait;
9043/*< Maximum limiter waiting time in samples.
9044 * Supported values: 0 to 10 \n
9045 * Recommended value: 262 (0.008 samples in Q15 format)
9046 */
9047} __packed;
9048
9049/* DRC configuration structure for each sub-band of an MBDRC module. */
9050
9051
9052/* Payload of the #ASM_PARAM_ID_MBDRC_CONFIG_PARAMS DRC
9053 * configuration parameters for each sub-band in the MBDRC module.
9054 * After this DRC structure is configured for valid bands, the next
9055 * MBDRC setparams expects the sequence of sub-band MBDRC filter
9056 * coefficients (the length depends on the number of bands) plus the
9057 * mute flag for that band plus uint16_t padding.
9058 *
9059 * @keep{10}
9060 * The filter coefficient and mute flag are of type int16_t:
9061 * - FIR coefficient = int16_t firFilter
9062 * - Mute flag = int16_t fMuteFlag
9063 *
9064 * The sequence is as follows:
9065 * - 1 band = 0 FIR coefficient + 1 mute flag + uint16_t padding
9066 * - 2 bands = 97 FIR coefficients + 2 mute flags + uint16_t padding
9067 * - 3 bands = 97+33 FIR coefficients + 3 mute flags + uint16_t padding
9068 * - 4 bands = 97+33+33 FIR coefficients + 4 mute flags + uint16_t padding
9069 * - 5 bands = 97+33+33+33 FIR coefficients + 5 mute flags + uint16_t padding
9070 *
9071 * For improved filterbank, the sequence is as follows:
9072 * - 1 band = 0 FIR coefficient + 1 mute flag + uint16_t padding
9073 * - 2 bands = 141 FIR coefficients + 2 mute flags + uint16_t padding
9074 * - 3 bands = 141+81 FIR coefficients + 3 mute flags + uint16_t padding
9075 * - 4 bands = 141+81+61 FIR coefficients + 4 mute flags + uint16_t padding
9076 * - 5 bands = 141+81+61+61 FIR coefficients + 5 mute flags + uint16_t padding
9077 */
9078struct asm_subband_drc_config_params {
9079 int16_t drc_stereo_linked_flag;
9080/*< Specifies whether all stereo channels have the same applied
9081 * dynamics (1) or if they process their dynamics independently (0).
9082 * Supported values:
9083 * - 0 -- Not linked
9084 * - 1 -- Linked
9085 */
9086
9087 int16_t drc_mode;
9088/*< Specifies whether DRC mode is bypassed for sub-bands.
9089 * Supported values:
9090 * - 0 -- Disabled
9091 * - 1 -- Enabled
9092 */
9093
9094 int16_t drc_down_sample_level;
9095/*< DRC down sample level.
9096 * Supported values: @ge 1
9097 */
9098
9099 int16_t drc_delay;
9100/*< DRC delay in samples.
9101 * Supported values: 0 to 1200
9102 */
9103
9104 uint16_t drc_rmsime_avg_const;
9105/*< RMS signal energy time-averaging constant.
9106 * Supported values: 0 to 2^16-1
9107 */
9108
9109 uint16_t drc_makeup_gain;
9110/*< DRC makeup gain in decibels.
9111 * Supported values: 258 to 64917
9112 */
9113 /* Down expander settings */
9114 int16_t down_expdrhreshold;
9115/*< Down expander threshold.
9116 * Supported Q7 format values: 1320 to up_cmpsrhreshold
9117 */
9118
9119 int16_t down_expdr_slope;
9120/*< Down expander slope.
9121 * Supported Q8 format values: -32768 to 0.
9122 */
9123
9124 uint32_t down_expdr_attack;
9125/*< Down expander attack constant.
9126 * Supported Q31 format values: 196844 to 2^31.
9127 */
9128
9129 uint32_t down_expdr_release;
9130/*< Down expander release constant.
9131 * Supported Q31 format values: 19685 to 2^31
9132 */
9133
9134 uint16_t down_expdr_hysteresis;
9135/*< Down expander hysteresis constant.
9136 * Supported Q14 format values: 1 to 32690
9137 */
9138
9139 uint16_t reserved;
9140 /*< Clients must set this field to zero. */
9141
9142 int32_t down_expdr_min_gain_db;
9143/*< Down expander minimum gain.
9144 * Supported Q23 format values: -805306368 to 0.
9145 */
9146
9147 /* Up compressor settings */
9148
9149 int16_t up_cmpsrhreshold;
9150/*< Up compressor threshold.
9151 * Supported Q7 format values: down_expdrhreshold to
9152 * down_cmpsrhreshold.
9153 */
9154
9155 uint16_t up_cmpsr_slope;
9156/*< Up compressor slope.
9157 * Supported Q16 format values: 0 to 64881.
9158 */
9159
9160 uint32_t up_cmpsr_attack;
9161/*< Up compressor attack constant.
9162 * Supported Q31 format values: 196844 to 2^31.
9163 */
9164
9165 uint32_t up_cmpsr_release;
9166/*< Up compressor release constant.
9167 * Supported Q31 format values: 19685 to 2^31.
9168 */
9169
9170 uint16_t up_cmpsr_hysteresis;
9171/*< Up compressor hysteresis constant.
9172 * Supported Q14 format values: 1 to 32690.
9173 */
9174
9175 /* Down compressor settings */
9176
9177 int16_t down_cmpsrhreshold;
9178/*< Down compressor threshold.
9179 * Supported Q7 format values: up_cmpsrhreshold to 11560.
9180 */
9181
9182 uint16_t down_cmpsr_slope;
9183/*< Down compressor slope.
9184 * Supported Q16 format values: 0 to 64881.
9185 */
9186
9187 uint16_t reserved1;
9188/*< Clients must set this field to zero. */
9189
9190 uint32_t down_cmpsr_attack;
9191/*< Down compressor attack constant.
9192 * Supported Q31 format values: 196844 to 2^31.
9193 */
9194
9195 uint32_t down_cmpsr_release;
9196/*< Down compressor release constant.
9197 * Supported Q31 format values: 19685 to 2^31.
9198 */
9199
9200 uint16_t down_cmpsr_hysteresis;
9201/*< Down compressor hysteresis constant.
9202 * Supported Q14 values: 1 to 32690.
9203 */
9204
9205 uint16_t reserved2;
9206/*< Clients must set this field to zero.*/
9207} __packed;
9208
9209#define ASM_MODULE_ID_EQUALIZER 0x00010C27
9210#define ASM_PARAM_ID_EQUALIZER_PARAMETERS 0x00010C28
9211
9212#define ASM_MAX_EQ_BANDS 12
9213
9214struct asm_eq_per_band_params {
9215 uint32_t band_idx;
9216/*< Band index.
9217 * Supported values: 0 to 11
9218 */
9219
9220 uint32_t filterype;
9221/*< Type of filter.
9222 * Supported values:
9223 * - #ASM_PARAM_EQYPE_NONE
9224 * - #ASM_PARAM_EQ_BASS_BOOST
9225 * - #ASM_PARAM_EQ_BASS_CUT
9226 * - #ASM_PARAM_EQREBLE_BOOST
9227 * - #ASM_PARAM_EQREBLE_CUT
9228 * - #ASM_PARAM_EQ_BAND_BOOST
9229 * - #ASM_PARAM_EQ_BAND_CUT
9230 */
9231
9232 uint32_t center_freq_hz;
9233 /*< Filter band center frequency in Hertz. */
9234
9235 int32_t filter_gain;
9236/*< Filter band initial gain.
9237 * Supported values: +12 to -12 dB in 1 dB increments
9238 */
9239
9240 int32_t q_factor;
9241/*< Filter band quality factor expressed as a Q8 number, i.e., a
9242 * fixed-point number with q factor of 8. For example, 3000/(2^8).
9243 */
9244} __packed;
9245
9246struct asm_eq_params {
9247 struct apr_hdr hdr;
9248 struct asm_stream_cmd_set_pp_params_v2 param;
9249 struct asm_stream_param_data_v2 data;
9250 uint32_t enable_flag;
9251/*< Specifies whether the equalizer module is disabled (0) or enabled
9252 * (nonzero).
9253 */
9254
9255 uint32_t num_bands;
9256/*< Number of bands.
9257 * Supported values: 1 to 12
9258 */
9259 struct asm_eq_per_band_params eq_bands[ASM_MAX_EQ_BANDS];
9260
9261} __packed;
9262
9263/* No equalizer effect.*/
9264#define ASM_PARAM_EQYPE_NONE 0
9265
9266/* Bass boost equalizer effect.*/
9267#define ASM_PARAM_EQ_BASS_BOOST 1
9268
9269/*Bass cut equalizer effect.*/
9270#define ASM_PARAM_EQ_BASS_CUT 2
9271
9272/* Treble boost equalizer effect */
9273#define ASM_PARAM_EQREBLE_BOOST 3
9274
9275/* Treble cut equalizer effect.*/
9276#define ASM_PARAM_EQREBLE_CUT 4
9277
9278/* Band boost equalizer effect.*/
9279#define ASM_PARAM_EQ_BAND_BOOST 5
9280
9281/* Band cut equalizer effect.*/
9282#define ASM_PARAM_EQ_BAND_CUT 6
9283
9284/* Get & set params */
9285#define VSS_ICOMMON_CMD_SET_PARAM_V2 0x0001133D
9286#define VSS_ICOMMON_CMD_GET_PARAM_V2 0x0001133E
9287#define VSS_ICOMMON_RSP_GET_PARAM 0x00011008
9288
Laxminath Kasam38070be2017-08-17 18:21:59 +05309289#define VSS_MAX_AVCS_NUM_SERVICES 25
9290
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +05309291/* ID of the Bass Boost module.
9292 * This module supports the following parameter IDs:
9293 * - #AUDPROC_PARAM_ID_BASS_BOOST_ENABLE
9294 * - #AUDPROC_PARAM_ID_BASS_BOOST_MODE
9295 * - #AUDPROC_PARAM_ID_BASS_BOOST_STRENGTH
9296 */
9297#define AUDPROC_MODULE_ID_BASS_BOOST 0x000108A1
9298/* ID of the Bass Boost enable parameter used by
9299 * AUDPROC_MODULE_ID_BASS_BOOST.
9300 */
9301#define AUDPROC_PARAM_ID_BASS_BOOST_ENABLE 0x000108A2
9302/* ID of the Bass Boost mode parameter used by
9303 * AUDPROC_MODULE_ID_BASS_BOOST.
9304 */
9305#define AUDPROC_PARAM_ID_BASS_BOOST_MODE 0x000108A3
9306/* ID of the Bass Boost strength parameter used by
9307 * AUDPROC_MODULE_ID_BASS_BOOST.
9308 */
9309#define AUDPROC_PARAM_ID_BASS_BOOST_STRENGTH 0x000108A4
9310
9311/* ID of the PBE module.
9312 * This module supports the following parameter IDs:
9313 * - #AUDPROC_PARAM_ID_PBE_ENABLE
9314 * - #AUDPROC_PARAM_ID_PBE_PARAM_CONFIG
9315 */
9316#define AUDPROC_MODULE_ID_PBE 0x00010C2A
9317/* ID of the Bass Boost enable parameter used by
9318 * AUDPROC_MODULE_ID_BASS_BOOST.
9319 */
9320#define AUDPROC_PARAM_ID_PBE_ENABLE 0x00010C2B
9321/* ID of the Bass Boost mode parameter used by
9322 * AUDPROC_MODULE_ID_BASS_BOOST.
9323 */
9324#define AUDPROC_PARAM_ID_PBE_PARAM_CONFIG 0x00010C49
9325
9326/* ID of the Virtualizer module. This module supports the
9327 * following parameter IDs:
9328 * - #AUDPROC_PARAM_ID_VIRTUALIZER_ENABLE
9329 * - #AUDPROC_PARAM_ID_VIRTUALIZER_STRENGTH
9330 * - #AUDPROC_PARAM_ID_VIRTUALIZER_OUT_TYPE
9331 * - #AUDPROC_PARAM_ID_VIRTUALIZER_GAIN_ADJUST
9332 */
9333#define AUDPROC_MODULE_ID_VIRTUALIZER 0x000108A5
9334/* ID of the Virtualizer enable parameter used by
9335 * AUDPROC_MODULE_ID_VIRTUALIZER.
9336 */
9337#define AUDPROC_PARAM_ID_VIRTUALIZER_ENABLE 0x000108A6
9338/* ID of the Virtualizer strength parameter used by
9339 * AUDPROC_MODULE_ID_VIRTUALIZER.
9340 */
9341#define AUDPROC_PARAM_ID_VIRTUALIZER_STRENGTH 0x000108A7
9342/* ID of the Virtualizer out type parameter used by
9343 * AUDPROC_MODULE_ID_VIRTUALIZER.
9344 */
9345#define AUDPROC_PARAM_ID_VIRTUALIZER_OUT_TYPE 0x000108A8
9346/* ID of the Virtualizer out type parameter used by
9347 * AUDPROC_MODULE_ID_VIRTUALIZER.
9348 */
9349#define AUDPROC_PARAM_ID_VIRTUALIZER_GAIN_ADJUST 0x000108A9
9350
9351/* ID of the Reverb module. This module supports the following
9352 * parameter IDs:
9353 * - #AUDPROC_PARAM_ID_REVERB_ENABLE
9354 * - #AUDPROC_PARAM_ID_REVERB_MODE
9355 * - #AUDPROC_PARAM_ID_REVERB_PRESET
9356 * - #AUDPROC_PARAM_ID_REVERB_WET_MIX
9357 * - #AUDPROC_PARAM_ID_REVERB_GAIN_ADJUST
9358 * - #AUDPROC_PARAM_ID_REVERB_ROOM_LEVEL
9359 * - #AUDPROC_PARAM_ID_REVERB_ROOM_HF_LEVEL
9360 * - #AUDPROC_PARAM_ID_REVERB_DECAY_TIME
9361 * - #AUDPROC_PARAM_ID_REVERB_DECAY_HF_RATIO
9362 * - #AUDPROC_PARAM_ID_REVERB_REFLECTIONS_LEVEL
9363 * - #AUDPROC_PARAM_ID_REVERB_REFLECTIONS_DELAY
9364 * - #AUDPROC_PARAM_ID_REVERB_LEVEL
9365 * - #AUDPROC_PARAM_ID_REVERB_DELAY
9366 * - #AUDPROC_PARAM_ID_REVERB_DIFFUSION
9367 * - #AUDPROC_PARAM_ID_REVERB_DENSITY
9368 */
9369#define AUDPROC_MODULE_ID_REVERB 0x000108AA
9370/* ID of the Reverb enable parameter used by
9371 * AUDPROC_MODULE_ID_REVERB.
9372 */
9373#define AUDPROC_PARAM_ID_REVERB_ENABLE 0x000108AB
9374/* ID of the Reverb mode parameter used by
9375 * AUDPROC_MODULE_ID_REVERB.
9376 */
9377#define AUDPROC_PARAM_ID_REVERB_MODE 0x000108AC
9378/* ID of the Reverb preset parameter used by
9379 * AUDPROC_MODULE_ID_REVERB.
9380 */
9381#define AUDPROC_PARAM_ID_REVERB_PRESET 0x000108AD
9382/* ID of the Reverb wet mix parameter used by
9383 * AUDPROC_MODULE_ID_REVERB.
9384 */
9385#define AUDPROC_PARAM_ID_REVERB_WET_MIX 0x000108AE
9386/* ID of the Reverb gain adjust parameter used by
9387 * AUDPROC_MODULE_ID_REVERB.
9388 */
9389#define AUDPROC_PARAM_ID_REVERB_GAIN_ADJUST 0x000108AF
9390/* ID of the Reverb room level parameter used by
9391 * AUDPROC_MODULE_ID_REVERB.
9392 */
9393#define AUDPROC_PARAM_ID_REVERB_ROOM_LEVEL 0x000108B0
9394/* ID of the Reverb room hf level parameter used by
9395 * AUDPROC_MODULE_ID_REVERB.
9396 */
9397#define AUDPROC_PARAM_ID_REVERB_ROOM_HF_LEVEL 0x000108B1
9398/* ID of the Reverb decay time parameter used by
9399 * AUDPROC_MODULE_ID_REVERB.
9400 */
9401#define AUDPROC_PARAM_ID_REVERB_DECAY_TIME 0x000108B2
9402/* ID of the Reverb decay hf ratio parameter used by
9403 * AUDPROC_MODULE_ID_REVERB.
9404 */
9405#define AUDPROC_PARAM_ID_REVERB_DECAY_HF_RATIO 0x000108B3
9406/* ID of the Reverb reflections level parameter used by
9407 * AUDPROC_MODULE_ID_REVERB.
9408 */
9409#define AUDPROC_PARAM_ID_REVERB_REFLECTIONS_LEVEL 0x000108B4
9410/* ID of the Reverb reflections delay parameter used by
9411 * AUDPROC_MODULE_ID_REVERB.
9412 */
9413#define AUDPROC_PARAM_ID_REVERB_REFLECTIONS_DELAY 0x000108B5
9414/* ID of the Reverb level parameter used by
9415 * AUDPROC_MODULE_ID_REVERB.
9416 */
9417#define AUDPROC_PARAM_ID_REVERB_LEVEL 0x000108B6
9418/* ID of the Reverb delay parameter used by
9419 * AUDPROC_MODULE_ID_REVERB.
9420 */
9421#define AUDPROC_PARAM_ID_REVERB_DELAY 0x000108B7
9422/* ID of the Reverb diffusion parameter used by
9423 * AUDPROC_MODULE_ID_REVERB.
9424 */
9425#define AUDPROC_PARAM_ID_REVERB_DIFFUSION 0x000108B8
9426/* ID of the Reverb density parameter used by
9427 * AUDPROC_MODULE_ID_REVERB.
9428 */
9429#define AUDPROC_PARAM_ID_REVERB_DENSITY 0x000108B9
9430
9431/* ID of the Popless Equalizer module. This module supports the
9432 * following parameter IDs:
9433 * - #AUDPROC_PARAM_ID_EQ_ENABLE
9434 * - #AUDPROC_PARAM_ID_EQ_CONFIG
9435 * - #AUDPROC_PARAM_ID_EQ_NUM_BANDS
9436 * - #AUDPROC_PARAM_ID_EQ_BAND_LEVELS
9437 * - #AUDPROC_PARAM_ID_EQ_BAND_LEVEL_RANGE
9438 * - #AUDPROC_PARAM_ID_EQ_BAND_FREQS
9439 * - #AUDPROC_PARAM_ID_EQ_SINGLE_BAND_FREQ_RANGE
9440 * - #AUDPROC_PARAM_ID_EQ_SINGLE_BAND_FREQ
9441 * - #AUDPROC_PARAM_ID_EQ_BAND_INDEX
9442 * - #AUDPROC_PARAM_ID_EQ_PRESET_ID
9443 * - #AUDPROC_PARAM_ID_EQ_NUM_PRESETS
9444 * - #AUDPROC_PARAM_ID_EQ_GET_PRESET_NAME
9445 */
9446#define AUDPROC_MODULE_ID_POPLESS_EQUALIZER 0x000108BA
9447/* ID of the Popless Equalizer enable parameter used by
9448 * AUDPROC_MODULE_ID_POPLESS_EQUALIZER.
9449 */
9450#define AUDPROC_PARAM_ID_EQ_ENABLE 0x000108BB
9451/* ID of the Popless Equalizer config parameter used by
9452 * AUDPROC_MODULE_ID_POPLESS_EQUALIZER.
9453 */
9454#define AUDPROC_PARAM_ID_EQ_CONFIG 0x000108BC
9455/* ID of the Popless Equalizer number of bands parameter used
9456 * by AUDPROC_MODULE_ID_POPLESS_EQUALIZER. This param ID is
9457 * used for get param only.
9458 */
9459#define AUDPROC_PARAM_ID_EQ_NUM_BANDS 0x000108BD
9460/* ID of the Popless Equalizer band levels parameter used by
9461 * AUDPROC_MODULE_ID_POPLESS_EQUALIZER. This param ID is
9462 * used for get param only.
9463 */
9464#define AUDPROC_PARAM_ID_EQ_BAND_LEVELS 0x000108BE
9465/* ID of the Popless Equalizer band level range parameter used
9466 * by AUDPROC_MODULE_ID_POPLESS_EQUALIZER. This param ID is
9467 * used for get param only.
9468 */
9469#define AUDPROC_PARAM_ID_EQ_BAND_LEVEL_RANGE 0x000108BF
9470/* ID of the Popless Equalizer band frequencies parameter used
9471 * by AUDPROC_MODULE_ID_POPLESS_EQUALIZER. This param ID is
9472 * used for get param only.
9473 */
9474#define AUDPROC_PARAM_ID_EQ_BAND_FREQS 0x000108C0
9475/* ID of the Popless Equalizer single band frequency range
9476 * parameter used by AUDPROC_MODULE_ID_POPLESS_EQUALIZER.
9477 * This param ID is used for get param only.
9478 */
9479#define AUDPROC_PARAM_ID_EQ_SINGLE_BAND_FREQ_RANGE 0x000108C1
9480/* ID of the Popless Equalizer single band frequency parameter
9481 * used by AUDPROC_MODULE_ID_POPLESS_EQUALIZER. This param ID
9482 * is used for set param only.
9483 */
9484#define AUDPROC_PARAM_ID_EQ_SINGLE_BAND_FREQ 0x000108C2
9485/* ID of the Popless Equalizer band index parameter used by
9486 * AUDPROC_MODULE_ID_POPLESS_EQUALIZER.
9487 */
9488#define AUDPROC_PARAM_ID_EQ_BAND_INDEX 0x000108C3
9489/* ID of the Popless Equalizer preset id parameter used by
9490 * AUDPROC_MODULE_ID_POPLESS_EQUALIZER. This param ID is used
9491 * for get param only.
9492 */
9493#define AUDPROC_PARAM_ID_EQ_PRESET_ID 0x000108C4
9494/* ID of the Popless Equalizer number of presets parameter used
9495 * by AUDPROC_MODULE_ID_POPLESS_EQUALIZER. This param ID is used
9496 * for get param only.
9497 */
9498#define AUDPROC_PARAM_ID_EQ_NUM_PRESETS 0x000108C5
9499/* ID of the Popless Equalizer preset name parameter used by
9500 * AUDPROC_MODULE_ID_POPLESS_EQUALIZER. This param ID is used
9501 * for get param only.
9502 */
9503#define AUDPROC_PARAM_ID_EQ_PRESET_NAME 0x000108C6
9504
9505/* Set Q6 topologies */
9506#define ASM_CMD_ADD_TOPOLOGIES 0x00010DBE
9507#define ADM_CMD_ADD_TOPOLOGIES 0x00010335
9508#define AFE_CMD_ADD_TOPOLOGIES 0x000100f8
9509/* structure used for both ioctls */
9510struct cmd_set_topologies {
9511 struct apr_hdr hdr;
9512 u32 payload_addr_lsw;
9513 /* LSW of parameter data payload address.*/
9514 u32 payload_addr_msw;
9515 /* MSW of parameter data payload address.*/
9516 u32 mem_map_handle;
9517 /* Memory map handle returned by mem map command */
9518 u32 payload_size;
9519 /* Size in bytes of the variable payload in shared memory */
9520} __packed;
9521
9522/* This module represents the Rx processing of Feedback speaker protection.
9523 * It contains the excursion control, thermal protection,
9524 * analog clip manager features in it.
9525 * This module id will support following param ids.
9526 * - AFE_PARAM_ID_FBSP_MODE_RX_CFG
9527 */
9528
9529#define AFE_MODULE_FB_SPKR_PROT_RX 0x0001021C
9530#define AFE_MODULE_FB_SPKR_PROT_V2_RX 0x0001025F
Xiaojun Sang12120ab2017-09-28 18:21:21 +08009531#define AFE_PARAM_ID_SP_RX_LIMITER_TH 0x000102B1
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +05309532#define AFE_PARAM_ID_FBSP_MODE_RX_CFG 0x0001021D
9533#define AFE_PARAM_ID_FBSP_PTONE_RAMP_CFG 0x00010260
9534
9535struct asm_fbsp_mode_rx_cfg {
9536 uint32_t minor_version;
9537 uint32_t mode;
9538} __packed;
9539
9540/* This module represents the VI processing of feedback speaker protection.
9541 * It will receive Vsens and Isens from codec and generates necessary
9542 * parameters needed by Rx processing.
9543 * This module id will support following param ids.
9544 * - AFE_PARAM_ID_SPKR_CALIB_VI_PROC_CFG
9545 * - AFE_PARAM_ID_CALIB_RES_CFG
9546 * - AFE_PARAM_ID_FEEDBACK_PATH_CFG
9547 */
9548
9549#define AFE_MODULE_FB_SPKR_PROT_VI_PROC 0x00010226
9550#define AFE_MODULE_FB_SPKR_PROT_VI_PROC_V2 0x0001026A
9551
9552#define AFE_PARAM_ID_SPKR_CALIB_VI_PROC_CFG 0x0001022A
9553#define AFE_PARAM_ID_SPKR_CALIB_VI_PROC_CFG_V2 0x0001026B
9554
9555struct asm_spkr_calib_vi_proc_cfg {
9556 uint32_t minor_version;
9557 uint32_t operation_mode;
9558 uint32_t r0_t0_selection_flag[SP_V2_NUM_MAX_SPKR];
9559 int32_t r0_cali_q24[SP_V2_NUM_MAX_SPKR];
9560 int16_t t0_cali_q6[SP_V2_NUM_MAX_SPKR];
9561 uint32_t quick_calib_flag;
9562} __packed;
9563
9564#define AFE_PARAM_ID_CALIB_RES_CFG 0x0001022B
9565#define AFE_PARAM_ID_CALIB_RES_CFG_V2 0x0001026E
9566
9567struct asm_calib_res_cfg {
9568 uint32_t minor_version;
9569 int32_t r0_cali_q24[SP_V2_NUM_MAX_SPKR];
9570 uint32_t th_vi_ca_state;
9571} __packed;
9572
9573#define AFE_PARAM_ID_FEEDBACK_PATH_CFG 0x0001022C
9574#define AFE_MODULE_FEEDBACK 0x00010257
9575
9576struct asm_feedback_path_cfg {
9577 uint32_t minor_version;
9578 int32_t dst_portid;
9579 int32_t num_channels;
9580 int32_t chan_info[4];
9581} __packed;
9582
9583#define AFE_PARAM_ID_MODE_VI_PROC_CFG 0x00010227
9584
9585struct asm_mode_vi_proc_cfg {
9586 uint32_t minor_version;
9587 uint32_t cal_mode;
9588} __packed;
9589
9590#define AFE_MODULE_SPEAKER_PROTECTION_V2_TH_VI 0x0001026A
9591#define AFE_PARAM_ID_SP_V2_TH_VI_MODE_CFG 0x0001026B
9592#define AFE_PARAM_ID_SP_V2_TH_VI_FTM_CFG 0x0001029F
9593#define AFE_PARAM_ID_SP_V2_TH_VI_FTM_PARAMS 0x000102A0
9594
9595struct afe_sp_th_vi_mode_cfg {
9596 uint32_t minor_version;
9597 uint32_t operation_mode;
9598 /*
9599 * Operation mode of thermal VI module.
9600 * 0 -- Normal Running mode
9601 * 1 -- Calibration mode
9602 * 2 -- FTM mode
9603 */
9604 uint32_t r0t0_selection_flag[SP_V2_NUM_MAX_SPKR];
9605 /*
9606 * Specifies which set of R0, T0 values the algorithm will use.
9607 * This field is valid only in Normal mode (operation_mode = 0).
9608 * 0 -- Use calibrated R0, T0 value
9609 * 1 -- Use safe R0, T0 value
9610 */
9611 int32_t r0_cali_q24[SP_V2_NUM_MAX_SPKR];
9612 /*
9613 * Calibration point resistance per device. This field is valid
9614 * only in Normal mode (operation_mode = 0).
9615 * values 33554432 to 1073741824 Ohms (in Q24 format)
9616 */
9617 int16_t t0_cali_q6[SP_V2_NUM_MAX_SPKR];
9618 /*
9619 * Calibration point temperature per device. This field is valid
9620 * in both Normal mode and Calibration mode.
9621 * values -1920 to 5120 degrees C (in Q6 format)
9622 */
9623 uint32_t quick_calib_flag;
9624 /*
9625 * Indicates whether calibration is to be done in quick mode or not.
9626 * This field is valid only in Calibration mode (operation_mode = 1).
9627 * 0 -- Disabled
9628 * 1 -- Enabled
9629 */
9630} __packed;
9631
9632struct afe_sp_th_vi_ftm_cfg {
9633 uint32_t minor_version;
9634 uint32_t wait_time_ms[SP_V2_NUM_MAX_SPKR];
9635 /*
9636 * Wait time to heat up speaker before collecting statistics
9637 * for ftm mode in ms.
9638 * values 0 to 4294967295 ms
9639 */
9640 uint32_t ftm_time_ms[SP_V2_NUM_MAX_SPKR];
9641 /*
9642 * duration for which FTM statistics are collected in ms.
9643 * values 0 to 2000 ms
9644 */
9645} __packed;
9646
9647struct afe_sp_th_vi_ftm_params {
9648 uint32_t minor_version;
9649 int32_t dc_res_q24[SP_V2_NUM_MAX_SPKR];
9650 /*
9651 * DC resistance value in q24 format
9652 * values 0 to 2147483647 Ohms (in Q24 format)
9653 */
9654 int32_t temp_q22[SP_V2_NUM_MAX_SPKR];
9655 /*
9656 * temperature value in q22 format
9657 * values -125829120 to 2147483647 degC (in Q22 format)
9658 */
9659 uint32_t status[SP_V2_NUM_MAX_SPKR];
9660 /*
9661 * FTM packet status
9662 * 0 - Incorrect operation mode.This status is returned
9663 * when GET_PARAM is called in non FTM Mode
9664 * 1 - Inactive mode -- Port is not yet started.
9665 * 2 - Wait state. wait_time_ms has not yet elapsed
9666 * 3 - In progress state. ftm_time_ms has not yet elapsed.
9667 * 4 - Success.
9668 * 5 - Failed.
9669 */
9670} __packed;
9671
9672struct afe_sp_th_vi_get_param {
9673 struct apr_hdr hdr;
9674 struct afe_port_cmd_get_param_v2 get_param;
9675 struct afe_port_param_data_v2 pdata;
9676 struct afe_sp_th_vi_ftm_params param;
9677} __packed;
9678
9679struct afe_sp_th_vi_get_param_resp {
9680 uint32_t status;
9681 struct afe_port_param_data_v2 pdata;
9682 struct afe_sp_th_vi_ftm_params param;
9683} __packed;
9684
9685
9686#define AFE_MODULE_SPEAKER_PROTECTION_V2_EX_VI 0x0001026F
9687#define AFE_PARAM_ID_SP_V2_EX_VI_MODE_CFG 0x000102A1
9688#define AFE_PARAM_ID_SP_V2_EX_VI_FTM_CFG 0x000102A2
9689#define AFE_PARAM_ID_SP_V2_EX_VI_FTM_PARAMS 0x000102A3
9690
9691struct afe_sp_ex_vi_mode_cfg {
9692 uint32_t minor_version;
9693 uint32_t operation_mode;
9694 /*
9695 * Operation mode of Excursion VI module.
9696 * 0 - Normal Running mode
9697 * 2 - FTM mode
9698 */
9699} __packed;
9700
9701struct afe_sp_ex_vi_ftm_cfg {
9702 uint32_t minor_version;
9703 uint32_t wait_time_ms[SP_V2_NUM_MAX_SPKR];
9704 /*
9705 * Wait time to heat up speaker before collecting statistics
9706 * for ftm mode in ms.
9707 * values 0 to 4294967295 ms
9708 */
9709 uint32_t ftm_time_ms[SP_V2_NUM_MAX_SPKR];
9710 /*
9711 * duration for which FTM statistics are collected in ms.
9712 * values 0 to 2000 ms
9713 */
9714} __packed;
9715
9716struct afe_sp_ex_vi_ftm_params {
9717 uint32_t minor_version;
9718 int32_t freq_q20[SP_V2_NUM_MAX_SPKR];
9719 /*
9720 * Resonance frequency in q20 format
9721 * values 0 to 2147483647 Hz (in Q20 format)
9722 */
9723 int32_t resis_q24[SP_V2_NUM_MAX_SPKR];
9724 /*
9725 * Mechanical resistance in q24 format
9726 * values 0 to 2147483647 Ohms (in Q24 format)
9727 */
9728 int32_t qmct_q24[SP_V2_NUM_MAX_SPKR];
9729 /*
9730 * Mechanical Qfactor in q24 format
9731 * values 0 to 2147483647 (in Q24 format)
9732 */
9733 uint32_t status[SP_V2_NUM_MAX_SPKR];
9734 /*
9735 * FTM packet status
9736 * 0 - Incorrect operation mode.This status is returned
9737 * when GET_PARAM is called in non FTM Mode.
9738 * 1 - Inactive mode -- Port is not yet started.
9739 * 2 - Wait state. wait_time_ms has not yet elapsed
9740 * 3 - In progress state. ftm_time_ms has not yet elapsed.
9741 * 4 - Success.
9742 * 5 - Failed.
9743 */
9744} __packed;
9745
9746struct afe_sp_ex_vi_get_param {
9747 struct apr_hdr hdr;
9748 struct afe_port_cmd_get_param_v2 get_param;
9749 struct afe_port_param_data_v2 pdata;
9750 struct afe_sp_ex_vi_ftm_params param;
9751} __packed;
9752
9753struct afe_sp_ex_vi_get_param_resp {
9754 uint32_t status;
9755 struct afe_port_param_data_v2 pdata;
9756 struct afe_sp_ex_vi_ftm_params param;
9757} __packed;
9758
Xiaojun Sang12120ab2017-09-28 18:21:21 +08009759struct afe_sp_rx_limiter_th_param {
9760 uint32_t minor_version;
9761 uint32_t lim_thr_per_calib_q27[SP_V2_NUM_MAX_SPKR];
9762} __packed;
9763
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +05309764union afe_spkr_prot_config {
9765 struct asm_fbsp_mode_rx_cfg mode_rx_cfg;
9766 struct asm_spkr_calib_vi_proc_cfg vi_proc_cfg;
9767 struct asm_feedback_path_cfg feedback_path_cfg;
9768 struct asm_mode_vi_proc_cfg mode_vi_proc_cfg;
9769 struct afe_sp_th_vi_mode_cfg th_vi_mode_cfg;
9770 struct afe_sp_th_vi_ftm_cfg th_vi_ftm_cfg;
9771 struct afe_sp_ex_vi_mode_cfg ex_vi_mode_cfg;
9772 struct afe_sp_ex_vi_ftm_cfg ex_vi_ftm_cfg;
Xiaojun Sang12120ab2017-09-28 18:21:21 +08009773 struct afe_sp_rx_limiter_th_param limiter_th_cfg;
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +05309774} __packed;
9775
9776struct afe_spkr_prot_config_command {
9777 struct apr_hdr hdr;
9778 struct afe_port_cmd_set_param_v2 param;
9779 struct afe_port_param_data_v2 pdata;
9780 union afe_spkr_prot_config prot_config;
9781} __packed;
9782
9783struct afe_spkr_prot_get_vi_calib {
9784 struct apr_hdr hdr;
9785 struct afe_port_cmd_get_param_v2 get_param;
9786 struct afe_port_param_data_v2 pdata;
9787 struct asm_calib_res_cfg res_cfg;
9788} __packed;
9789
9790struct afe_spkr_prot_calib_get_resp {
9791 uint32_t status;
9792 struct afe_port_param_data_v2 pdata;
9793 struct asm_calib_res_cfg res_cfg;
9794} __packed;
9795
9796
9797/* SRS TRUMEDIA start */
9798/* topology */
9799#define SRS_TRUMEDIA_TOPOLOGY_ID 0x00010D90
9800/* module */
9801#define SRS_TRUMEDIA_MODULE_ID 0x10005010
9802/* parameters */
9803#define SRS_TRUMEDIA_PARAMS 0x10005011
9804#define SRS_TRUMEDIA_PARAMS_WOWHD 0x10005012
9805#define SRS_TRUMEDIA_PARAMS_CSHP 0x10005013
9806#define SRS_TRUMEDIA_PARAMS_HPF 0x10005014
9807#define SRS_TRUMEDIA_PARAMS_AEQ 0x10005015
9808#define SRS_TRUMEDIA_PARAMS_HL 0x10005016
9809#define SRS_TRUMEDIA_PARAMS_GEQ 0x10005017
9810
9811#define SRS_ID_GLOBAL 0x00000001
9812#define SRS_ID_WOWHD 0x00000002
9813#define SRS_ID_CSHP 0x00000003
9814#define SRS_ID_HPF 0x00000004
9815#define SRS_ID_AEQ 0x00000005
9816#define SRS_ID_HL 0x00000006
9817#define SRS_ID_GEQ 0x00000007
9818
9819#define SRS_CMD_UPLOAD 0x7FFF0000
9820#define SRS_PARAM_OFFSET_MASK 0x3FFF0000
9821#define SRS_PARAM_VALUE_MASK 0x0000FFFF
9822
9823struct srs_trumedia_params_GLOBAL {
9824 uint8_t v1;
9825 uint8_t v2;
9826 uint8_t v3;
9827 uint8_t v4;
9828 uint8_t v5;
9829 uint8_t v6;
9830 uint8_t v7;
9831 uint8_t v8;
9832 uint16_t v9;
9833} __packed;
9834
9835struct srs_trumedia_params_WOWHD {
9836 uint32_t v1;
9837 uint16_t v2;
9838 uint16_t v3;
9839 uint16_t v4;
9840 uint16_t v5;
9841 uint16_t v6;
9842 uint16_t v7;
9843 uint16_t v8;
9844 uint16_t v____A1;
9845 uint32_t v9;
9846 uint16_t v10;
9847 uint16_t v11;
9848 uint32_t v12[16];
9849 uint32_t v13[16];
9850 uint32_t v14[16];
9851 uint32_t v15[16];
9852 uint32_t v16;
9853 uint16_t v17;
9854 uint16_t v18;
9855} __packed;
9856
9857struct srs_trumedia_params_CSHP {
9858 uint32_t v1;
9859 uint16_t v2;
9860 uint16_t v3;
9861 uint16_t v4;
9862 uint16_t v5;
9863 uint16_t v6;
9864 uint16_t v____A1;
9865 uint32_t v7;
9866 uint16_t v8;
9867 uint16_t v9;
9868 uint32_t v10[16];
9869} __packed;
9870
9871struct srs_trumedia_params_HPF {
9872 uint32_t v1;
9873 uint32_t v2[26];
9874} __packed;
9875
9876struct srs_trumedia_params_AEQ {
9877 uint32_t v1;
9878 uint16_t v2;
9879 uint16_t v3;
9880 uint16_t v4;
9881 uint16_t v____A1;
9882 uint32_t v5[74];
9883 uint32_t v6[74];
9884 uint16_t v7[2048];
9885} __packed;
9886
9887struct srs_trumedia_params_HL {
9888 uint16_t v1;
9889 uint16_t v2;
9890 uint16_t v3;
9891 uint16_t v____A1;
9892 int32_t v4;
9893 uint32_t v5;
9894 uint16_t v6;
9895 uint16_t v____A2;
9896 uint32_t v7;
9897} __packed;
9898
9899struct srs_trumedia_params_GEQ {
9900 int16_t v1[10];
9901} __packed;
9902struct srs_trumedia_params {
9903 struct srs_trumedia_params_GLOBAL global;
9904 struct srs_trumedia_params_WOWHD wowhd;
9905 struct srs_trumedia_params_CSHP cshp;
9906 struct srs_trumedia_params_HPF hpf;
9907 struct srs_trumedia_params_AEQ aeq;
9908 struct srs_trumedia_params_HL hl;
9909 struct srs_trumedia_params_GEQ geq;
9910} __packed;
9911/* SRS TruMedia end */
9912
9913#define AUDPROC_PARAM_ID_ENABLE 0x00010904
9914#define ASM_STREAM_POSTPROC_TOPO_ID_SA_PLUS 0x1000FFFF
9915/* DTS Eagle */
9916#define AUDPROC_MODULE_ID_DTS_HPX_PREMIX 0x0001077C
9917#define AUDPROC_MODULE_ID_DTS_HPX_POSTMIX 0x0001077B
9918#define ASM_STREAM_POSTPROC_TOPO_ID_DTS_HPX 0x00010DED
9919#define ASM_STREAM_POSTPROC_TOPO_ID_HPX_PLUS 0x10015000
9920#define ASM_STREAM_POSTPROC_TOPO_ID_HPX_MASTER 0x10015001
9921struct asm_dts_eagle_param {
9922 struct apr_hdr hdr;
9923 struct asm_stream_cmd_set_pp_params_v2 param;
9924 struct asm_stream_param_data_v2 data;
9925} __packed;
9926
9927struct asm_dts_eagle_param_get {
9928 struct apr_hdr hdr;
9929 struct asm_stream_cmd_get_pp_params_v2 param;
9930} __packed;
9931
9932/* Opcode to set BT address and license for aptx decoder */
9933#define APTX_DECODER_BT_ADDRESS 0x00013201
9934#define APTX_CLASSIC_DEC_LICENSE_ID 0x00013202
9935
9936struct aptx_dec_bt_addr_cfg {
9937 uint32_t lap;
9938 uint32_t uap;
9939 uint32_t nap;
9940} __packed;
9941
9942struct aptx_dec_bt_dev_addr {
9943 struct apr_hdr hdr;
9944 struct asm_stream_cmd_set_encdec_param encdec;
9945 struct aptx_dec_bt_addr_cfg bt_addr_cfg;
9946} __packed;
9947
9948struct asm_aptx_dec_fmt_blk_v2 {
9949 struct apr_hdr hdr;
9950 struct asm_data_cmd_media_fmt_update_v2 fmtblk;
9951 u32 sample_rate;
9952/* Number of samples per second.
9953 * Supported values: 44100 and 48000 Hz
9954 */
9955} __packed;
9956
Laxminath Kasam38070be2017-08-17 18:21:59 +05309957/* Q6Core Specific */
9958#define AVCS_CMD_GET_FWK_VERSION (0x0001292C)
9959#define AVCS_CMDRSP_GET_FWK_VERSION (0x0001292D)
9960
9961#define AVCS_SERVICE_ID_ALL (0xFFFFFFFF)
Raja Mallike1b2f792018-06-01 13:17:36 +05309962#define AVCS_SERVICE_ID_AFE (0x4)
Laxminath Kasam38070be2017-08-17 18:21:59 +05309963#define APRV2_IDS_SERVICE_ID_ADSP_CVP_V (0xB)
Cong Tang76c7e642019-02-26 15:08:55 +08009964#define APRV2_IDS_SERVICE_ID_ADSP_AFE_V (0x4)
Laxminath Kasam38070be2017-08-17 18:21:59 +05309965
9966struct avcs_get_fwk_version {
9967 /*
9968 * Indicates the major version of the AVS build.
9969 * This value is incremented on chipset family boundaries.
9970 */
9971 uint32_t build_major_version;
9972
9973 /*
9974 * Minor version of the AVS build.
9975 * This value represents the mainline to which the AVS build belongs.
9976 */
9977 uint32_t build_minor_version;
9978
9979 /* Indicates the AVS branch version to which the image belongs. */
9980 uint32_t build_branch_version;
9981
9982 /* Indicates the AVS sub-branch or customer product line information. */
9983 uint32_t build_subbranch_version;
9984
9985 /* Number of supported AVS services in the current build. */
9986 uint32_t num_services;
9987};
9988
9989struct avs_svc_api_info {
9990 /*
9991 * APRV2 service IDs for the individual static services.
9992 *
9993 * @values
9994 * - APRV2_IDS_SERVICE_ID_ADSP_CORE_V
9995 * - APRV2_IDS_SERVICE_ID_ADSP_AFE_V
9996 * - APRV2_IDS_SERVICE_ID_ADSP_ASM_V
9997 * - APRV2_IDS_SERVICE_ID_ADSP_ADM_V
9998 * - APRV2_IDS_SERVICE_ID_ADSP_MVM_V
9999 * - APRV2_IDS_SERVICE_ID_ADSP_CVS_V
10000 * - APRV2_IDS_SERVICE_ID_ADSP_CVP_V
10001 * - APRV2_IDS_SERVICE_ID_ADSP_LSM_V
10002 */
10003 uint32_t service_id;
10004
10005 /*
10006 * Indicates the API version of the service.
10007 *
10008 * Each new API update that warrants a change on the HLOS side triggers
10009 * an increment in the version.
10010 */
10011 uint32_t api_version;
10012
10013 /*
10014 * Indicates the API increments on a sub-branch (not on the mainline).
10015 *
10016 * API branch version numbers can increment independently on different
10017 * sub-branches.
10018 */
10019 uint32_t api_branch_version;
10020};
10021
10022struct avcs_fwk_ver_info {
10023 struct avcs_get_fwk_version avcs_fwk_version;
Siena Richard2d0102d2017-09-05 11:15:45 -070010024 struct avs_svc_api_info services[0];
Laxminath Kasam38070be2017-08-17 18:21:59 +053010025} __packed;
10026
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +053010027/* LSM Specific */
10028#define VW_FEAT_DIM (39)
10029
Dieter Lueckinga8b8e3b2018-09-28 14:29:17 +020010030#define APRV2_IDS_SERVICE_ID_ADSP_ASM_V (0x7)
10031#define APRV2_IDS_SERVICE_ID_ADSP_ADM_V (0x8)
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +053010032#define APRV2_IDS_SERVICE_ID_ADSP_LSM_V (0xD)
10033#define APRV2_IDS_DOMAIN_ID_ADSP_V (0x4)
10034#define APRV2_IDS_DOMAIN_ID_APPS_V (0x5)
10035
10036#define LSM_SESSION_CMD_SHARED_MEM_MAP_REGIONS (0x00012A7F)
10037#define LSM_SESSION_CMDRSP_SHARED_MEM_MAP_REGIONS (0x00012A80)
10038#define LSM_SESSION_CMD_SHARED_MEM_UNMAP_REGIONS (0x00012A81)
10039#define LSM_SESSION_CMD_OPEN_TX (0x00012A82)
10040#define LSM_SESSION_CMD_CLOSE_TX (0x00012A88)
10041#define LSM_SESSION_CMD_SET_PARAMS (0x00012A83)
10042#define LSM_SESSION_CMD_SET_PARAMS_V2 (0x00012A8F)
10043#define LSM_SESSION_CMD_REGISTER_SOUND_MODEL (0x00012A84)
10044#define LSM_SESSION_CMD_DEREGISTER_SOUND_MODEL (0x00012A85)
10045#define LSM_SESSION_CMD_START (0x00012A86)
10046#define LSM_SESSION_CMD_STOP (0x00012A87)
10047#define LSM_SESSION_CMD_EOB (0x00012A89)
10048#define LSM_SESSION_CMD_READ (0x00012A8A)
10049#define LSM_SESSION_CMD_OPEN_TX_V2 (0x00012A8B)
10050#define LSM_CMD_ADD_TOPOLOGIES (0x00012A8C)
10051
10052#define LSM_SESSION_EVENT_DETECTION_STATUS (0x00012B00)
10053#define LSM_SESSION_EVENT_DETECTION_STATUS_V2 (0x00012B01)
10054#define LSM_DATA_EVENT_READ_DONE (0x00012B02)
10055#define LSM_DATA_EVENT_STATUS (0x00012B03)
10056#define LSM_SESSION_EVENT_DETECTION_STATUS_V3 (0x00012B04)
10057
10058#define LSM_MODULE_ID_VOICE_WAKEUP (0x00012C00)
10059#define LSM_PARAM_ID_ENDPOINT_DETECT_THRESHOLD (0x00012C01)
10060#define LSM_PARAM_ID_OPERATION_MODE (0x00012C02)
10061#define LSM_PARAM_ID_GAIN (0x00012C03)
10062#define LSM_PARAM_ID_CONNECT_TO_PORT (0x00012C04)
10063#define LSM_PARAM_ID_FEATURE_COMPENSATION_DATA (0x00012C07)
10064#define LSM_PARAM_ID_MIN_CONFIDENCE_LEVELS (0x00012C07)
10065#define LSM_MODULE_ID_LAB (0x00012C08)
10066#define LSM_PARAM_ID_LAB_ENABLE (0x00012C09)
10067#define LSM_PARAM_ID_LAB_CONFIG (0x00012C0A)
10068#define LSM_MODULE_ID_FRAMEWORK (0x00012C0E)
10069#define LSM_PARAM_ID_SWMAD_CFG (0x00012C18)
10070#define LSM_PARAM_ID_SWMAD_MODEL (0x00012C19)
10071#define LSM_PARAM_ID_SWMAD_ENABLE (0x00012C1A)
10072#define LSM_PARAM_ID_POLLING_ENABLE (0x00012C1B)
10073#define LSM_PARAM_ID_MEDIA_FMT (0x00012C1E)
10074#define LSM_PARAM_ID_FWK_MODE_CONFIG (0x00012C27)
10075
10076/* HW MAD specific */
10077#define AFE_MODULE_HW_MAD (0x00010230)
10078#define AFE_PARAM_ID_HW_MAD_CFG (0x00010231)
10079#define AFE_PARAM_ID_HW_MAD_CTRL (0x00010232)
10080#define AFE_PARAM_ID_SLIMBUS_SLAVE_PORT_CFG (0x00010233)
10081
10082/* SW MAD specific */
10083#define AFE_MODULE_SW_MAD (0x0001022D)
10084#define AFE_PARAM_ID_SW_MAD_CFG (0x0001022E)
10085#define AFE_PARAM_ID_SVM_MODEL (0x0001022F)
10086
10087/* Commands/Params to pass the codec/slimbus data to DSP */
10088#define AFE_SVC_CMD_SET_PARAM (0x000100f3)
10089#define AFE_MODULE_CDC_DEV_CFG (0x00010234)
10090#define AFE_PARAM_ID_CDC_SLIMBUS_SLAVE_CFG (0x00010235)
10091#define AFE_PARAM_ID_CDC_REG_CFG (0x00010236)
10092#define AFE_PARAM_ID_CDC_REG_CFG_INIT (0x00010237)
10093#define AFE_PARAM_ID_CDC_REG_PAGE_CFG (0x00010296)
10094
10095#define AFE_MAX_CDC_REGISTERS_TO_CONFIG (20)
10096
10097/* AANC Port Config Specific */
10098#define AFE_PARAM_ID_AANC_PORT_CONFIG (0x00010215)
10099#define AFE_API_VERSION_AANC_PORT_CONFIG (0x1)
10100#define AANC_TX_MIC_UNUSED (0)
10101#define AANC_TX_VOICE_MIC (1)
10102#define AANC_TX_ERROR_MIC (2)
10103#define AANC_TX_NOISE_MIC (3)
10104#define AFE_PORT_MAX_CHANNEL_CNT (8)
10105#define AFE_MODULE_AANC (0x00010214)
10106#define AFE_PARAM_ID_CDC_AANC_VERSION (0x0001023A)
10107#define AFE_API_VERSION_CDC_AANC_VERSION (0x1)
10108#define AANC_HW_BLOCK_VERSION_1 (1)
10109#define AANC_HW_BLOCK_VERSION_2 (2)
10110
10111/*Clip bank selection*/
10112#define AFE_API_VERSION_CLIP_BANK_SEL_CFG 0x1
10113#define AFE_CLIP_MAX_BANKS 4
10114#define AFE_PARAM_ID_CLIP_BANK_SEL_CFG 0x00010242
10115
10116struct afe_param_aanc_port_cfg {
10117 /* Minor version used for tracking the version of the module's
10118 * source port configuration.
10119 */
10120 uint32_t aanc_port_cfg_minor_version;
10121
10122 /* Sampling rate of the source Tx port. 8k - 192k*/
10123 uint32_t tx_port_sample_rate;
10124
10125 /* Channel mapping for the Tx port signal carrying Noise (X),
10126 * Error (E), and Voice (V) signals.
10127 */
10128 uint8_t tx_port_channel_map[AFE_PORT_MAX_CHANNEL_CNT];
10129
10130 /* Number of channels on the source Tx port. */
10131 uint16_t tx_port_num_channels;
10132
10133 /* Port ID of the Rx path reference signal. */
10134 uint16_t rx_path_ref_port_id;
10135
10136 /* Sampling rate of the reference port. 8k - 192k*/
10137 uint32_t ref_port_sample_rate;
10138} __packed;
10139
10140struct afe_param_id_cdc_aanc_version {
10141 /* Minor version used for tracking the version of the module's
10142 * hw version
10143 */
10144 uint32_t cdc_aanc_minor_version;
10145
10146 /* HW version. */
10147 uint32_t aanc_hw_version;
10148} __packed;
10149
10150struct afe_param_id_clip_bank_sel {
10151 /* Minor version used for tracking the version of the module's
10152 * hw version
10153 */
10154 uint32_t minor_version;
10155
10156 /* Number of banks to be read */
10157 uint32_t num_banks;
10158
10159 uint32_t bank_map[AFE_CLIP_MAX_BANKS];
10160} __packed;
10161
10162/* ERROR CODES */
10163/* Success. The operation completed with no errors. */
10164#define ADSP_EOK 0x00000000
10165/* General failure. */
10166#define ADSP_EFAILED 0x00000001
10167/* Bad operation parameter. */
10168#define ADSP_EBADPARAM 0x00000002
10169/* Unsupported routine or operation. */
10170#define ADSP_EUNSUPPORTED 0x00000003
10171/* Unsupported version. */
10172#define ADSP_EVERSION 0x00000004
10173/* Unexpected problem encountered. */
10174#define ADSP_EUNEXPECTED 0x00000005
10175/* Unhandled problem occurred. */
10176#define ADSP_EPANIC 0x00000006
10177/* Unable to allocate resource. */
10178#define ADSP_ENORESOURCE 0x00000007
10179/* Invalid handle. */
10180#define ADSP_EHANDLE 0x00000008
10181/* Operation is already processed. */
10182#define ADSP_EALREADY 0x00000009
10183/* Operation is not ready to be processed. */
10184#define ADSP_ENOTREADY 0x0000000A
10185/* Operation is pending completion. */
10186#define ADSP_EPENDING 0x0000000B
10187/* Operation could not be accepted or processed. */
10188#define ADSP_EBUSY 0x0000000C
10189/* Operation aborted due to an error. */
10190#define ADSP_EABORTED 0x0000000D
10191/* Operation preempted by a higher priority. */
10192#define ADSP_EPREEMPTED 0x0000000E
10193/* Operation requests intervention to complete. */
10194#define ADSP_ECONTINUE 0x0000000F
10195/* Operation requests immediate intervention to complete. */
10196#define ADSP_EIMMEDIATE 0x00000010
10197/* Operation is not implemented. */
10198#define ADSP_ENOTIMPL 0x00000011
10199/* Operation needs more data or resources. */
10200#define ADSP_ENEEDMORE 0x00000012
10201/* Operation does not have memory. */
10202#define ADSP_ENOMEMORY 0x00000014
10203/* Item does not exist. */
10204#define ADSP_ENOTEXIST 0x00000015
10205/* Max count for adsp error code sent to HLOS*/
10206#define ADSP_ERR_MAX (ADSP_ENOTEXIST + 1)
10207/* Operation is finished. */
10208#define ADSP_ETERMINATED 0x00011174
10209
10210/*bharath, adsp_error_codes.h */
10211
10212/* LPASS clock for I2S Interface */
10213
10214/* Supported OSR clock values */
10215#define Q6AFE_LPASS_OSR_CLK_12_P288_MHZ 0xBB8000
10216#define Q6AFE_LPASS_OSR_CLK_11_P2896_MHZ 0xAC4400
10217#define Q6AFE_LPASS_OSR_CLK_9_P600_MHZ 0x927C00
10218#define Q6AFE_LPASS_OSR_CLK_8_P192_MHZ 0x7D0000
10219#define Q6AFE_LPASS_OSR_CLK_6_P144_MHZ 0x5DC000
10220#define Q6AFE_LPASS_OSR_CLK_4_P096_MHZ 0x3E8000
10221#define Q6AFE_LPASS_OSR_CLK_3_P072_MHZ 0x2EE000
10222#define Q6AFE_LPASS_OSR_CLK_2_P048_MHZ 0x1F4000
10223#define Q6AFE_LPASS_OSR_CLK_1_P536_MHZ 0x177000
10224#define Q6AFE_LPASS_OSR_CLK_1_P024_MHZ 0xFA000
10225#define Q6AFE_LPASS_OSR_CLK_768_kHZ 0xBB800
10226#define Q6AFE_LPASS_OSR_CLK_512_kHZ 0x7D000
10227#define Q6AFE_LPASS_OSR_CLK_DISABLE 0x0
10228
10229/* Supported Bit clock values */
10230#define Q6AFE_LPASS_IBIT_CLK_12_P288_MHZ 0xBB8000
10231#define Q6AFE_LPASS_IBIT_CLK_11_P2896_MHZ 0xAC4400
10232#define Q6AFE_LPASS_IBIT_CLK_8_P192_MHZ 0x7D0000
10233#define Q6AFE_LPASS_IBIT_CLK_6_P144_MHZ 0x5DC000
10234#define Q6AFE_LPASS_IBIT_CLK_4_P096_MHZ 0x3E8000
10235#define Q6AFE_LPASS_IBIT_CLK_3_P072_MHZ 0x2EE000
10236#define Q6AFE_LPASS_IBIT_CLK_2_P8224_MHZ 0x2b1100
10237#define Q6AFE_LPASS_IBIT_CLK_2_P048_MHZ 0x1F4000
10238#define Q6AFE_LPASS_IBIT_CLK_1_P536_MHZ 0x177000
10239#define Q6AFE_LPASS_IBIT_CLK_1_P4112_MHZ 0x158880
10240#define Q6AFE_LPASS_IBIT_CLK_1_P024_MHZ 0xFA000
10241#define Q6AFE_LPASS_IBIT_CLK_768_KHZ 0xBB800
10242#define Q6AFE_LPASS_IBIT_CLK_512_KHZ 0x7D000
10243#define Q6AFE_LPASS_IBIT_CLK_256_KHZ 0x3E800
10244#define Q6AFE_LPASS_IBIT_CLK_DISABLE 0x0
10245
10246/* Supported LPASS CLK sources */
10247#define Q6AFE_LPASS_CLK_SRC_EXTERNAL 0
10248#define Q6AFE_LPASS_CLK_SRC_INTERNAL 1
10249
10250/* Supported LPASS CLK root*/
10251#define Q6AFE_LPASS_CLK_ROOT_DEFAULT 0
10252
10253enum afe_lpass_clk_mode {
10254 Q6AFE_LPASS_MODE_BOTH_INVALID,
10255 Q6AFE_LPASS_MODE_CLK1_VALID,
10256 Q6AFE_LPASS_MODE_CLK2_VALID,
10257 Q6AFE_LPASS_MODE_BOTH_VALID,
10258} __packed;
10259
10260/* Clock ID Enumeration Define. */
10261/* Clock ID for Primary I2S IBIT */
10262#define Q6AFE_LPASS_CLK_ID_PRI_MI2S_IBIT 0x100
10263/* Clock ID for Primary I2S EBIT */
10264#define Q6AFE_LPASS_CLK_ID_PRI_MI2S_EBIT 0x101
10265/* Clock ID for Secondary I2S IBIT */
10266#define Q6AFE_LPASS_CLK_ID_SEC_MI2S_IBIT 0x102
10267/* Clock ID for Secondary I2S EBIT */
10268#define Q6AFE_LPASS_CLK_ID_SEC_MI2S_EBIT 0x103
10269/* Clock ID for Tertiary I2S IBIT */
10270#define Q6AFE_LPASS_CLK_ID_TER_MI2S_IBIT 0x104
10271/* Clock ID for Tertiary I2S EBIT */
10272#define Q6AFE_LPASS_CLK_ID_TER_MI2S_EBIT 0x105
10273/* Clock ID for Quartnery I2S IBIT */
10274#define Q6AFE_LPASS_CLK_ID_QUAD_MI2S_IBIT 0x106
10275/* Clock ID for Quartnery I2S EBIT */
10276#define Q6AFE_LPASS_CLK_ID_QUAD_MI2S_EBIT 0x107
10277/* Clock ID for Speaker I2S IBIT */
10278#define Q6AFE_LPASS_CLK_ID_SPEAKER_I2S_IBIT 0x108
10279/* Clock ID for Speaker I2S EBIT */
10280#define Q6AFE_LPASS_CLK_ID_SPEAKER_I2S_EBIT 0x109
10281/* Clock ID for Speaker I2S OSR */
10282#define Q6AFE_LPASS_CLK_ID_SPEAKER_I2S_OSR 0x10A
10283
10284/* Clock ID for QUINARY I2S IBIT */
10285#define Q6AFE_LPASS_CLK_ID_QUI_MI2S_IBIT 0x10B
10286/* Clock ID for QUINARY I2S EBIT */
10287#define Q6AFE_LPASS_CLK_ID_QUI_MI2S_EBIT 0x10C
10288/* Clock ID for SENARY I2S IBIT */
10289#define Q6AFE_LPASS_CLK_ID_SEN_MI2S_IBIT 0x10D
10290/* Clock ID for SENARY I2S EBIT */
10291#define Q6AFE_LPASS_CLK_ID_SEN_MI2S_EBIT 0x10E
10292/* Clock ID for INT0 I2S IBIT */
10293#define Q6AFE_LPASS_CLK_ID_INT0_MI2S_IBIT 0x10F
10294/* Clock ID for INT1 I2S IBIT */
10295#define Q6AFE_LPASS_CLK_ID_INT1_MI2S_IBIT 0x110
10296/* Clock ID for INT2 I2S IBIT */
10297#define Q6AFE_LPASS_CLK_ID_INT2_MI2S_IBIT 0x111
10298/* Clock ID for INT3 I2S IBIT */
10299#define Q6AFE_LPASS_CLK_ID_INT3_MI2S_IBIT 0x112
10300/* Clock ID for INT4 I2S IBIT */
10301#define Q6AFE_LPASS_CLK_ID_INT4_MI2S_IBIT 0x113
10302/* Clock ID for INT5 I2S IBIT */
10303#define Q6AFE_LPASS_CLK_ID_INT5_MI2S_IBIT 0x114
10304/* Clock ID for INT6 I2S IBIT */
10305#define Q6AFE_LPASS_CLK_ID_INT6_MI2S_IBIT 0x115
10306
Rohit Kumara5077932017-09-10 22:05:05 +053010307/* Clock ID for QUINARY MI2S OSR CLK */
10308#define Q6AFE_LPASS_CLK_ID_QUI_MI2S_OSR 0x116
10309
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +053010310/* Clock ID for Primary PCM IBIT */
10311#define Q6AFE_LPASS_CLK_ID_PRI_PCM_IBIT 0x200
10312/* Clock ID for Primary PCM EBIT */
10313#define Q6AFE_LPASS_CLK_ID_PRI_PCM_EBIT 0x201
10314/* Clock ID for Secondary PCM IBIT */
10315#define Q6AFE_LPASS_CLK_ID_SEC_PCM_IBIT 0x202
10316/* Clock ID for Secondary PCM EBIT */
10317#define Q6AFE_LPASS_CLK_ID_SEC_PCM_EBIT 0x203
10318/* Clock ID for Tertiary PCM IBIT */
10319#define Q6AFE_LPASS_CLK_ID_TER_PCM_IBIT 0x204
10320/* Clock ID for Tertiary PCM EBIT */
10321#define Q6AFE_LPASS_CLK_ID_TER_PCM_EBIT 0x205
10322/* Clock ID for Quartery PCM IBIT */
10323#define Q6AFE_LPASS_CLK_ID_QUAD_PCM_IBIT 0x206
10324/* Clock ID for Quartery PCM EBIT */
10325#define Q6AFE_LPASS_CLK_ID_QUAD_PCM_EBIT 0x207
Rohit Kumara5077932017-09-10 22:05:05 +053010326/* Clock ID for Quinary PCM IBIT */
10327#define Q6AFE_LPASS_CLK_ID_QUIN_PCM_IBIT 0x208
10328/* Clock ID for Quinary PCM EBIT */
10329#define Q6AFE_LPASS_CLK_ID_QUIN_PCM_EBIT 0x209
10330/* Clock ID for QUINARY PCM OSR */
10331#define Q6AFE_LPASS_CLK_ID_QUI_PCM_OSR 0x20A
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +053010332
10333/** Clock ID for Primary TDM IBIT */
10334#define Q6AFE_LPASS_CLK_ID_PRI_TDM_IBIT 0x200
10335/** Clock ID for Primary TDM EBIT */
10336#define Q6AFE_LPASS_CLK_ID_PRI_TDM_EBIT 0x201
10337/** Clock ID for Secondary TDM IBIT */
10338#define Q6AFE_LPASS_CLK_ID_SEC_TDM_IBIT 0x202
10339/** Clock ID for Secondary TDM EBIT */
10340#define Q6AFE_LPASS_CLK_ID_SEC_TDM_EBIT 0x203
10341/** Clock ID for Tertiary TDM IBIT */
10342#define Q6AFE_LPASS_CLK_ID_TER_TDM_IBIT 0x204
10343/** Clock ID for Tertiary TDM EBIT */
10344#define Q6AFE_LPASS_CLK_ID_TER_TDM_EBIT 0x205
10345/** Clock ID for Quartery TDM IBIT */
10346#define Q6AFE_LPASS_CLK_ID_QUAD_TDM_IBIT 0x206
10347/** Clock ID for Quartery TDM EBIT */
10348#define Q6AFE_LPASS_CLK_ID_QUAD_TDM_EBIT 0x207
Rohit Kumara5077932017-09-10 22:05:05 +053010349/** Clock ID for Quinary TDM IBIT */
10350#define Q6AFE_LPASS_CLK_ID_QUIN_TDM_IBIT 0x208
10351/** Clock ID for Quinary TDM EBIT */
10352#define Q6AFE_LPASS_CLK_ID_QUIN_TDM_EBIT 0x209
10353/** Clock ID for Quinary TDM OSR */
10354#define Q6AFE_LPASS_CLK_ID_QUIN_TDM_OSR 0x20A
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +053010355
10356/* Clock ID for MCLK1 */
10357#define Q6AFE_LPASS_CLK_ID_MCLK_1 0x300
10358/* Clock ID for MCLK2 */
10359#define Q6AFE_LPASS_CLK_ID_MCLK_2 0x301
10360/* Clock ID for MCLK3 */
10361#define Q6AFE_LPASS_CLK_ID_MCLK_3 0x302
10362/* Clock ID for MCLK4 */
10363#define Q6AFE_LPASS_CLK_ID_MCLK_4 0x304
10364/* Clock ID for Internal Digital Codec Core */
10365#define Q6AFE_LPASS_CLK_ID_INTERNAL_DIGITAL_CODEC_CORE 0x303
10366/* Clock ID for INT MCLK0 */
10367#define Q6AFE_LPASS_CLK_ID_INT_MCLK_0 0x305
10368/* Clock ID for INT MCLK1 */
10369#define Q6AFE_LPASS_CLK_ID_INT_MCLK_1 0x306
10370/*
10371 * Clock ID for soundwire NPL.
10372 * This is the clock to be used to enable NPL clock for internal Soundwire.
10373 */
10374#define AFE_CLOCK_SET_CLOCK_ID_SWR_NPL_CLK 0x307
10375
10376/* Clock ID for AHB HDMI input */
10377#define Q6AFE_LPASS_CLK_ID_AHB_HDMI_INPUT 0x400
10378
10379/* Clock ID for SPDIF core */
10380#define Q6AFE_LPASS_CLK_ID_SPDIF_CORE 0x500
10381
10382
10383/* Clock attribute for invalid use (reserved for internal usage) */
10384#define Q6AFE_LPASS_CLK_ATTRIBUTE_INVALID 0x0
10385/* Clock attribute for no couple case */
10386#define Q6AFE_LPASS_CLK_ATTRIBUTE_COUPLE_NO 0x1
10387/* Clock attribute for dividend couple case */
10388#define Q6AFE_LPASS_CLK_ATTRIBUTE_COUPLE_DIVIDEND 0x2
10389/* Clock attribute for divisor couple case */
10390#define Q6AFE_LPASS_CLK_ATTRIBUTE_COUPLE_DIVISOR 0x3
10391/* Clock attribute for invert and no couple case */
10392#define Q6AFE_LPASS_CLK_ATTRIBUTE_INVERT_COUPLE_NO 0x4
10393/* Clock set API version */
10394#define Q6AFE_LPASS_CLK_CONFIG_API_VERSION 0x1
10395
10396struct afe_clk_set {
10397 /*
10398 * Minor version used for tracking clock set.
10399 * @values #AFE_API_VERSION_CLOCK_SET
10400 */
10401 uint32_t clk_set_minor_version;
10402
10403 /*
10404 * Clock ID
10405 * @values
10406 * - 0x100 to 0x10A - MSM8996
10407 * - 0x200 to 0x207 - MSM8996
10408 * - 0x300 to 0x302 - MSM8996 @tablebulletend
10409 */
10410 uint32_t clk_id;
10411
10412 /*
10413 * Clock frequency (in Hertz) to be set.
10414 * @values
10415 * - >= 0 for clock frequency to set @tablebulletend
10416 */
10417 uint32_t clk_freq_in_hz;
10418
10419 /* Use to specific divider for two clocks if needed.
10420 * Set to Q6AFE_LPASS_CLK_ATTRIBUTE_COUPLE_NO for no divider
10421 * relation clocks
10422 * @values
10423 * - #Q6AFE_LPASS_CLK_ATTRIBUTE_COUPLE_NO
10424 * - #Q6AFE_LPASS_CLK_ATTRIBUTE_COUPLE_DIVIDEND
10425 * - #Q6AFE_LPASS_CLK_ATTRIBUTE_COUPLE_DIVISOR @tablebulletend
10426 */
10427 uint16_t clk_attri;
10428
10429 /*
10430 * Specifies the root clock source.
10431 * Currently, only Q6AFE_LPASS_CLK_ROOT_DEFAULT is valid
10432 * @values
10433 * - 0 @tablebulletend
10434 */
10435 uint16_t clk_root;
10436
10437 /*
10438 * for enable and disable clock.
10439 * "clk_freq_in_hz", "clk_attri", and "clk_root"
10440 * are ignored in disable clock case.
10441 * @values 
10442 * - 0 -- Disabled
10443 * - 1 -- Enabled @tablebulletend
10444 */
10445 uint32_t enable;
10446};
10447
10448struct afe_clk_cfg {
10449/* Minor version used for tracking the version of the I2S
10450 * configuration interface.
10451 * Supported values: #AFE_API_VERSION_I2S_CONFIG
10452 */
10453 u32 i2s_cfg_minor_version;
10454
10455/* clk value 1 in MHz. */
10456 u32 clk_val1;
10457
10458/* clk value 2 in MHz. */
10459 u32 clk_val2;
10460
10461/* clk_src
10462 * #Q6AFE_LPASS_CLK_SRC_EXTERNAL
10463 * #Q6AFE_LPASS_CLK_SRC_INTERNAL
10464 */
10465
10466 u16 clk_src;
10467
10468/* clk_root -0 for default */
10469 u16 clk_root;
10470
10471/* clk_set_mode
10472 * #Q6AFE_LPASS_MODE_BOTH_INVALID
10473 * #Q6AFE_LPASS_MODE_CLK1_VALID
10474 * #Q6AFE_LPASS_MODE_CLK2_VALID
10475 * #Q6AFE_LPASS_MODE_BOTH_VALID
10476 */
10477 u16 clk_set_mode;
10478
10479/* This param id is used to configure I2S clk */
10480 u16 reserved;
10481} __packed;
10482
10483/* This param id is used to configure I2S clk */
10484#define AFE_PARAM_ID_LPAIF_CLK_CONFIG 0x00010238
10485#define AFE_MODULE_CLOCK_SET 0x0001028F
10486#define AFE_PARAM_ID_CLOCK_SET 0x00010290
10487
10488struct afe_lpass_clk_config_command {
10489 struct apr_hdr hdr;
10490 struct afe_port_cmd_set_param_v2 param;
10491 struct afe_port_param_data_v2 pdata;
10492 struct afe_clk_cfg clk_cfg;
10493} __packed;
10494
10495enum afe_lpass_digital_clk_src {
10496 Q6AFE_LPASS_DIGITAL_ROOT_INVALID,
10497 Q6AFE_LPASS_DIGITAL_ROOT_PRI_MI2S_OSR,
10498 Q6AFE_LPASS_DIGITAL_ROOT_SEC_MI2S_OSR,
10499 Q6AFE_LPASS_DIGITAL_ROOT_TER_MI2S_OSR,
10500 Q6AFE_LPASS_DIGITAL_ROOT_QUAD_MI2S_OSR,
10501 Q6AFE_LPASS_DIGITAL_ROOT_CDC_ROOT_CLK,
10502} __packed;
10503
10504/* This param id is used to configure internal clk */
10505#define AFE_PARAM_ID_INTERNAL_DIGIATL_CDC_CLK_CONFIG 0x00010239
10506
10507struct afe_digital_clk_cfg {
10508/* Minor version used for tracking the version of the I2S
10509 * configuration interface.
10510 * Supported values: #AFE_API_VERSION_I2S_CONFIG
10511 */
10512 u32 i2s_cfg_minor_version;
10513
10514/* clk value in MHz. */
10515 u32 clk_val;
10516
10517/* INVALID
10518 * PRI_MI2S_OSR
10519 * SEC_MI2S_OSR
10520 * TER_MI2S_OSR
10521 * QUAD_MI2S_OSR
10522 * DIGT_CDC_ROOT
10523 */
10524 u16 clk_root;
10525
10526/* This field must be set to zero. */
10527 u16 reserved;
10528} __packed;
10529
10530
10531struct afe_lpass_digital_clk_config_command {
10532 struct apr_hdr hdr;
10533 struct afe_port_cmd_set_param_v2 param;
10534 struct afe_port_param_data_v2 pdata;
10535 struct afe_digital_clk_cfg clk_cfg;
10536} __packed;
10537
10538/*
10539 * Opcode for AFE to start DTMF.
10540 */
10541#define AFE_PORTS_CMD_DTMF_CTL 0x00010102
10542
10543/** DTMF payload.*/
10544struct afe_dtmf_generation_command {
10545 struct apr_hdr hdr;
10546
10547 /*
10548 * Duration of the DTMF tone in ms.
10549 * -1 -> continuous,
10550 * 0 -> disable
10551 */
10552 int64_t duration_in_ms;
10553
10554 /*
10555 * The DTMF high tone frequency.
10556 */
10557 uint16_t high_freq;
10558
10559 /*
10560 * The DTMF low tone frequency.
10561 */
10562 uint16_t low_freq;
10563
10564 /*
10565 * The DTMF volume setting
10566 */
10567 uint16_t gain;
10568
10569 /*
10570 * The number of ports to enable/disable on.
10571 */
10572 uint16_t num_ports;
10573
10574 /*
10575 * The Destination ports - array .
10576 * For DTMF on multiple ports, portIds needs to
10577 * be populated numPorts times.
10578 */
10579 uint16_t port_ids;
10580
10581 /*
10582 * variable for 32 bit alignment of APR packet.
10583 */
10584 uint16_t reserved;
10585} __packed;
10586
10587enum afe_config_type {
10588 AFE_SLIMBUS_SLAVE_PORT_CONFIG,
10589 AFE_SLIMBUS_SLAVE_CONFIG,
10590 AFE_CDC_REGISTERS_CONFIG,
10591 AFE_AANC_VERSION,
10592 AFE_CDC_CLIP_REGISTERS_CONFIG,
10593 AFE_CLIP_BANK_SEL,
10594 AFE_CDC_REGISTER_PAGE_CONFIG,
10595 AFE_MAX_CONFIG_TYPES,
10596};
10597
10598struct afe_param_slimbus_slave_port_cfg {
10599 uint32_t minor_version;
10600 uint16_t slimbus_dev_id;
10601 uint16_t slave_dev_pgd_la;
10602 uint16_t slave_dev_intfdev_la;
10603 uint16_t bit_width;
10604 uint16_t data_format;
10605 uint16_t num_channels;
10606 uint16_t slave_port_mapping[AFE_PORT_MAX_AUDIO_CHAN_CNT];
10607} __packed;
10608
10609struct afe_param_cdc_slimbus_slave_cfg {
10610 uint32_t minor_version;
10611 uint32_t device_enum_addr_lsw;
10612 uint32_t device_enum_addr_msw;
10613 uint16_t tx_slave_port_offset;
10614 uint16_t rx_slave_port_offset;
10615} __packed;
10616
10617struct afe_param_cdc_reg_cfg {
10618 uint32_t minor_version;
10619 uint32_t reg_logical_addr;
10620 uint32_t reg_field_type;
10621 uint32_t reg_field_bit_mask;
10622 uint16_t reg_bit_width;
10623 uint16_t reg_offset_scale;
10624} __packed;
10625
10626#define AFE_API_VERSION_CDC_REG_PAGE_CFG 1
10627
10628enum {
10629 AFE_CDC_REG_PAGE_ASSIGN_PROC_ID_0 = 0,
10630 AFE_CDC_REG_PAGE_ASSIGN_PROC_ID_1,
10631 AFE_CDC_REG_PAGE_ASSIGN_PROC_ID_2,
10632 AFE_CDC_REG_PAGE_ASSIGN_PROC_ID_3,
10633};
10634
10635struct afe_param_cdc_reg_page_cfg {
10636 uint32_t minor_version;
10637 uint32_t enable;
10638 uint32_t proc_id;
10639} __packed;
10640
10641struct afe_param_cdc_reg_cfg_data {
10642 uint32_t num_registers;
10643 struct afe_param_cdc_reg_cfg *reg_data;
10644} __packed;
10645
10646struct afe_svc_cmd_set_param {
10647 uint32_t payload_size;
10648 uint32_t payload_address_lsw;
10649 uint32_t payload_address_msw;
10650 uint32_t mem_map_handle;
10651} __packed;
10652
10653struct afe_svc_param_data {
10654 uint32_t module_id;
10655 uint32_t param_id;
10656 uint16_t param_size;
10657 uint16_t reserved;
10658} __packed;
10659
10660struct afe_param_hw_mad_ctrl {
10661 uint32_t minor_version;
10662 uint16_t mad_type;
10663 uint16_t mad_enable;
10664} __packed;
10665
10666struct afe_cmd_hw_mad_ctrl {
10667 struct apr_hdr hdr;
10668 struct afe_port_cmd_set_param_v2 param;
10669 struct afe_port_param_data_v2 pdata;
10670 struct afe_param_hw_mad_ctrl payload;
10671} __packed;
10672
10673struct afe_cmd_hw_mad_slimbus_slave_port_cfg {
10674 struct apr_hdr hdr;
10675 struct afe_port_cmd_set_param_v2 param;
10676 struct afe_port_param_data_v2 pdata;
10677 struct afe_param_slimbus_slave_port_cfg sb_port_cfg;
10678} __packed;
10679
10680struct afe_cmd_sw_mad_enable {
10681 struct apr_hdr hdr;
10682 struct afe_port_cmd_set_param_v2 param;
10683 struct afe_port_param_data_v2 pdata;
10684} __packed;
10685
10686struct afe_param_cdc_reg_cfg_payload {
10687 struct afe_svc_param_data common;
10688 struct afe_param_cdc_reg_cfg reg_cfg;
10689} __packed;
10690
10691struct afe_lpass_clk_config_command_v2 {
10692 struct apr_hdr hdr;
10693 struct afe_svc_cmd_set_param param;
10694 struct afe_svc_param_data pdata;
10695 struct afe_clk_set clk_cfg;
10696} __packed;
10697
10698/*
10699 * reg_data's size can be up to AFE_MAX_CDC_REGISTERS_TO_CONFIG
10700 */
10701struct afe_svc_cmd_cdc_reg_cfg {
10702 struct apr_hdr hdr;
10703 struct afe_svc_cmd_set_param param;
10704 struct afe_param_cdc_reg_cfg_payload reg_data[0];
10705} __packed;
10706
10707struct afe_svc_cmd_init_cdc_reg_cfg {
10708 struct apr_hdr hdr;
10709 struct afe_svc_cmd_set_param param;
10710 struct afe_port_param_data_v2 init;
10711} __packed;
10712
10713struct afe_svc_cmd_sb_slave_cfg {
10714 struct apr_hdr hdr;
10715 struct afe_svc_cmd_set_param param;
10716 struct afe_port_param_data_v2 pdata;
10717 struct afe_param_cdc_slimbus_slave_cfg sb_slave_cfg;
10718} __packed;
10719
10720struct afe_svc_cmd_cdc_reg_page_cfg {
10721 struct apr_hdr hdr;
10722 struct afe_svc_cmd_set_param param;
10723 struct afe_port_param_data_v2 pdata;
10724 struct afe_param_cdc_reg_page_cfg cdc_reg_page_cfg;
10725} __packed;
10726
10727struct afe_svc_cmd_cdc_aanc_version {
10728 struct apr_hdr hdr;
10729 struct afe_svc_cmd_set_param param;
10730 struct afe_port_param_data_v2 pdata;
10731 struct afe_param_id_cdc_aanc_version version;
10732} __packed;
10733
10734struct afe_port_cmd_set_aanc_param {
10735 struct apr_hdr hdr;
10736 struct afe_port_cmd_set_param_v2 param;
10737 struct afe_port_param_data_v2 pdata;
10738 union {
10739 struct afe_param_aanc_port_cfg aanc_port_cfg;
10740 struct afe_mod_enable_param mod_enable;
10741 } __packed data;
10742} __packed;
10743
10744struct afe_port_cmd_set_aanc_acdb_table {
10745 struct apr_hdr hdr;
10746 struct afe_port_cmd_set_param_v2 param;
10747} __packed;
10748
10749/* Dolby DAP topology */
10750#define DOLBY_ADM_COPP_TOPOLOGY_ID 0x0001033B
10751#define DS2_ADM_COPP_TOPOLOGY_ID 0x1301033B
10752
10753/* RMS value from DSP */
10754#define RMS_MODULEID_APPI_PASSTHRU 0x10009011
10755#define RMS_PARAM_FIRST_SAMPLE 0x10009012
10756#define RMS_PAYLOAD_LEN 4
10757
10758/* Customized mixing in matix mixer */
10759#define MTMX_MODULE_ID_DEFAULT_CHMIXER 0x00010341
10760#define DEFAULT_CHMIXER_PARAM_ID_COEFF 0x00010342
10761#define CUSTOM_STEREO_PAYLOAD_SIZE 9
10762#define CUSTOM_STEREO_CMD_PARAM_SIZE 24
10763#define CUSTOM_STEREO_NUM_OUT_CH 0x0002
10764#define CUSTOM_STEREO_NUM_IN_CH 0x0002
10765#define CUSTOM_STEREO_INDEX_PARAM 0x0002
10766#define Q14_GAIN_ZERO_POINT_FIVE 0x2000
10767#define Q14_GAIN_UNITY 0x4000
10768
10769struct afe_svc_cmd_set_clip_bank_selection {
10770 struct apr_hdr hdr;
10771 struct afe_svc_cmd_set_param param;
10772 struct afe_port_param_data_v2 pdata;
10773 struct afe_param_id_clip_bank_sel bank_sel;
10774} __packed;
10775
10776/* Ultrasound supported formats */
10777#define US_POINT_EPOS_FORMAT_V2 0x0001272D
10778#define US_RAW_FORMAT_V2 0x0001272C
10779#define US_PROX_FORMAT_V4 0x0001273B
10780#define US_RAW_SYNC_FORMAT 0x0001272F
10781#define US_GES_SYNC_FORMAT 0x00012730
10782
10783#define AFE_MODULE_GROUP_DEVICE 0x00010254
10784#define AFE_PARAM_ID_GROUP_DEVICE_CFG 0x00010255
10785#define AFE_PARAM_ID_GROUP_DEVICE_ENABLE 0x00010256
10786#define AFE_GROUP_DEVICE_ID_SECONDARY_MI2S_RX 0x1102
10787
10788/* Payload of the #AFE_PARAM_ID_GROUP_DEVICE_CFG
10789 * parameter, which configures max of 8 AFE ports
10790 * into a group.
10791 * The fixed size of this structure is sixteen bytes.
10792 */
10793struct afe_group_device_group_cfg {
10794 u32 minor_version;
10795 u16 group_id;
10796 u16 num_channels;
10797 u16 port_id[8];
10798} __packed;
10799
10800#define AFE_GROUP_DEVICE_ID_PRIMARY_TDM_RX \
10801 (AFE_PORT_ID_PRIMARY_TDM_RX + 0x100)
10802#define AFE_GROUP_DEVICE_ID_PRIMARY_TDM_TX \
10803 (AFE_PORT_ID_PRIMARY_TDM_TX + 0x100)
10804#define AFE_GROUP_DEVICE_ID_SECONDARY_TDM_RX \
10805 (AFE_PORT_ID_SECONDARY_TDM_RX + 0x100)
10806#define AFE_GROUP_DEVICE_ID_SECONDARY_TDM_TX \
10807 (AFE_PORT_ID_SECONDARY_TDM_TX + 0x100)
10808#define AFE_GROUP_DEVICE_ID_TERTIARY_TDM_RX \
10809 (AFE_PORT_ID_TERTIARY_TDM_RX + 0x100)
10810#define AFE_GROUP_DEVICE_ID_TERTIARY_TDM_TX \
10811 (AFE_PORT_ID_TERTIARY_TDM_TX + 0x100)
10812#define AFE_GROUP_DEVICE_ID_QUATERNARY_TDM_RX \
10813 (AFE_PORT_ID_QUATERNARY_TDM_RX + 0x100)
10814#define AFE_GROUP_DEVICE_ID_QUATERNARY_TDM_TX \
10815 (AFE_PORT_ID_QUATERNARY_TDM_TX + 0x100)
Rohit Kumara5077932017-09-10 22:05:05 +053010816#define AFE_GROUP_DEVICE_ID_QUINARY_TDM_RX \
10817 (AFE_PORT_ID_QUINARY_TDM_RX + 0x100)
10818#define AFE_GROUP_DEVICE_ID_QUINARY_TDM_TX \
10819 (AFE_PORT_ID_QUINARY_TDM_TX + 0x100)
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +053010820
10821/* ID of the parameter used by #AFE_MODULE_GROUP_DEVICE to configure the
10822 * group device. #AFE_SVC_CMD_SET_PARAM can use this parameter ID.
10823 *
10824 * Requirements:
10825 * - Configure the group before the member ports in the group are
10826 * configured and started.
10827 * - Enable the group only after it is configured.
10828 * - Stop all member ports in the group before disabling the group.
10829 */
10830#define AFE_PARAM_ID_GROUP_DEVICE_TDM_CONFIG 0x0001029E
10831
10832/* Version information used to handle future additions to
10833 * AFE_PARAM_ID_GROUP_DEVICE_TDM_CONFIG processing (for backward compatibility).
10834 */
10835#define AFE_API_VERSION_GROUP_DEVICE_TDM_CONFIG 0x1
10836
10837/* Number of AFE ports in group device */
10838#define AFE_GROUP_DEVICE_NUM_PORTS 8
10839
10840/* Payload of the AFE_PARAM_ID_GROUP_DEVICE_TDM_CONFIG parameter ID
10841 * used by AFE_MODULE_GROUP_DEVICE.
10842 */
10843struct afe_param_id_group_device_tdm_cfg {
10844 u32 group_device_cfg_minor_version;
10845 /* Minor version used to track group device configuration.
10846 * @values #AFE_API_VERSION_GROUP_DEVICE_TDM_CONFIG
10847 */
10848
10849 u16 group_id;
10850 /* ID for the group device.
10851 * @values
10852 * - #AFE_GROUP_DEVICE_ID_PRIMARY_TDM_RX
10853 * - #AFE_GROUP_DEVICE_ID_PRIMARY_TDM_TX
10854 * - #AFE_GROUP_DEVICE_ID_SECONDARY_TDM_RX
10855 * - #AFE_GROUP_DEVICE_ID_SECONDARY_TDM_TX
10856 * - #AFE_GROUP_DEVICE_ID_TERTIARY_TDM_RX
10857 * - #AFE_GROUP_DEVICE_ID_TERTIARY_TDM_TX
10858 * - #AFE_GROUP_DEVICE_ID_QUATERNARY_TDM_RX
10859 * - #AFE_GROUP_DEVICE_ID_QUATERNARY_TDM_TX
10860 */
10861
10862 u16 reserved;
10863 /* 0 */
10864
10865 u16 port_id[AFE_GROUP_DEVICE_NUM_PORTS];
10866 /* Array of member port IDs of this group.
10867 * @values
10868 * - #AFE_PORT_ID_PRIMARY_TDM_RX
10869 * - #AFE_PORT_ID_PRIMARY_TDM_RX_1
10870 * - #AFE_PORT_ID_PRIMARY_TDM_RX_2
10871 * - #AFE_PORT_ID_PRIMARY_TDM_RX_3
10872 * - #AFE_PORT_ID_PRIMARY_TDM_RX_4
10873 * - #AFE_PORT_ID_PRIMARY_TDM_RX_5
10874 * - #AFE_PORT_ID_PRIMARY_TDM_RX_6
10875 * - #AFE_PORT_ID_PRIMARY_TDM_RX_7
10876
10877 * - #AFE_PORT_ID_PRIMARY_TDM_TX
10878 * - #AFE_PORT_ID_PRIMARY_TDM_TX_1
10879 * - #AFE_PORT_ID_PRIMARY_TDM_TX_2
10880 * - #AFE_PORT_ID_PRIMARY_TDM_TX_3
10881 * - #AFE_PORT_ID_PRIMARY_TDM_TX_4
10882 * - #AFE_PORT_ID_PRIMARY_TDM_TX_5
10883 * - #AFE_PORT_ID_PRIMARY_TDM_TX_6
10884 * - #AFE_PORT_ID_PRIMARY_TDM_TX_7
10885
10886 * - #AFE_PORT_ID_SECONDARY_TDM_RX
10887 * - #AFE_PORT_ID_SECONDARY_TDM_RX_1
10888 * - #AFE_PORT_ID_SECONDARY_TDM_RX_2
10889 * - #AFE_PORT_ID_SECONDARY_TDM_RX_3
10890 * - #AFE_PORT_ID_SECONDARY_TDM_RX_4
10891 * - #AFE_PORT_ID_SECONDARY_TDM_RX_5
10892 * - #AFE_PORT_ID_SECONDARY_TDM_RX_6
10893 * - #AFE_PORT_ID_SECONDARY_TDM_RX_7
10894
10895 * - #AFE_PORT_ID_SECONDARY_TDM_TX
10896 * - #AFE_PORT_ID_SECONDARY_TDM_TX_1
10897 * - #AFE_PORT_ID_SECONDARY_TDM_TX_2
10898 * - #AFE_PORT_ID_SECONDARY_TDM_TX_3
10899 * - #AFE_PORT_ID_SECONDARY_TDM_TX_4
10900 * - #AFE_PORT_ID_SECONDARY_TDM_TX_5
10901 * - #AFE_PORT_ID_SECONDARY_TDM_TX_6
10902 * - #AFE_PORT_ID_SECONDARY_TDM_TX_7
10903
10904 * - #AFE_PORT_ID_TERTIARY_TDM_RX
10905 * - #AFE_PORT_ID_TERTIARY_TDM_RX_1
10906 * - #AFE_PORT_ID_TERTIARY_TDM_RX_2
10907 * - #AFE_PORT_ID_TERTIARY_TDM_RX_3
10908 * - #AFE_PORT_ID_TERTIARY_TDM_RX_4
10909 * - #AFE_PORT_ID_TERTIARY_TDM_RX_5
10910 * - #AFE_PORT_ID_TERTIARY_TDM_RX_6
10911 * - #AFE_PORT_ID_TERTIARY_TDM_RX_7
10912
10913 * - #AFE_PORT_ID_TERTIARY_TDM_TX
10914 * - #AFE_PORT_ID_TERTIARY_TDM_TX_1
10915 * - #AFE_PORT_ID_TERTIARY_TDM_TX_2
10916 * - #AFE_PORT_ID_TERTIARY_TDM_TX_3
10917 * - #AFE_PORT_ID_TERTIARY_TDM_TX_4
10918 * - #AFE_PORT_ID_TERTIARY_TDM_TX_5
10919 * - #AFE_PORT_ID_TERTIARY_TDM_TX_6
10920 * - #AFE_PORT_ID_TERTIARY_TDM_TX_7
10921
10922 * - #AFE_PORT_ID_QUATERNARY_TDM_RX
10923 * - #AFE_PORT_ID_QUATERNARY_TDM_RX_1
10924 * - #AFE_PORT_ID_QUATERNARY_TDM_RX_2
10925 * - #AFE_PORT_ID_QUATERNARY_TDM_RX_3
10926 * - #AFE_PORT_ID_QUATERNARY_TDM_RX_4
10927 * - #AFE_PORT_ID_QUATERNARY_TDM_RX_5
10928 * - #AFE_PORT_ID_QUATERNARY_TDM_RX_6
10929 * - #AFE_PORT_ID_QUATERNARY_TDM_RX_7
10930
10931 * - #AFE_PORT_ID_QUATERNARY_TDM_TX
10932 * - #AFE_PORT_ID_QUATERNARY_TDM_TX_1
10933 * - #AFE_PORT_ID_QUATERNARY_TDM_TX_2
10934 * - #AFE_PORT_ID_QUATERNARY_TDM_TX_3
10935 * - #AFE_PORT_ID_QUATERNARY_TDM_TX_4
10936 * - #AFE_PORT_ID_QUATERNARY_TDM_TX_5
10937 * - #AFE_PORT_ID_QUATERNARY_TDM_TX_6
10938 * - #AFE_PORT_ID_QUATERNARY_TDM_TX_7
10939 * @tablebulletend
10940 */
10941
10942 u32 num_channels;
10943 /* Number of enabled slots for TDM frame.
10944 * @values 1 to 8
10945 */
10946
10947 u32 sample_rate;
10948 /* Sampling rate of the port.
10949 * @values
10950 * - #AFE_PORT_SAMPLE_RATE_8K
10951 * - #AFE_PORT_SAMPLE_RATE_16K
10952 * - #AFE_PORT_SAMPLE_RATE_24K
10953 * - #AFE_PORT_SAMPLE_RATE_32K
10954 * - #AFE_PORT_SAMPLE_RATE_48K @tablebulletend
10955 */
10956
10957 u32 bit_width;
10958 /* Bit width of the sample.
10959 * @values 16, 24, (32)
10960 */
10961
10962 u16 nslots_per_frame;
10963 /* Number of slots per frame. Typical : 1, 2, 4, 8, 16, 32.
10964 * @values 1 - 32
10965 */
10966
10967 u16 slot_width;
10968 /* Slot width of the slot in a TDM frame. (slot_width >= bit_width)
10969 * have to be satisfied.
10970 * @values 16, 24, 32
10971 */
10972
10973 u32 slot_mask;
10974 /* Position of active slots. When that bit is set, that paricular
10975 * slot is active.
10976 * Number of active slots can be inferred by number of bits set in
10977 * the mask. Only 8 individual bits can be enabled.
10978 * Bits 0..31 corresponding to slot 0..31
10979 * @values 1 to 2^32 -1
10980 */
10981} __packed;
10982
10983/* Payload of the #AFE_PARAM_ID_GROUP_DEVICE_ENABLE
10984 * parameter, which enables or
10985 * disables any module.
10986 * The fixed size of this structure is four bytes.
10987 */
10988
10989struct afe_group_device_enable {
10990 u16 group_id;
10991 /* valid value is AFE_GROUP_DEVICE_ID_SECONDARY_MI2S_RX */
10992 u16 enable;
10993 /* Enables (1) or disables (0) the module. */
10994} __packed;
10995
10996union afe_port_group_config {
10997 struct afe_group_device_group_cfg group_cfg;
10998 struct afe_group_device_enable group_enable;
10999 struct afe_param_id_group_device_tdm_cfg tdm_cfg;
11000} __packed;
11001
11002struct afe_port_group_create {
11003 struct apr_hdr hdr;
11004 struct afe_svc_cmd_set_param param;
11005 struct afe_port_param_data_v2 pdata;
11006 union afe_port_group_config data;
11007} __packed;
11008
11009/* ID of the parameter used by #AFE_MODULE_AUDIO_DEV_INTERFACE to specify
11010 * the timing statistics of the corresponding device interface.
11011 * Client can periodically query for the device time statistics to help adjust
11012 * the PLL based on the drift value. The get param command must be sent to
11013 * AFE port ID corresponding to device interface
11014
11015 * This parameter ID supports following get param commands:
11016 * #AFE_PORT_CMD_GET_PARAM_V2 and
11017 * #AFE_PORT_CMD_GET_PARAM_V3.
11018 */
11019#define AFE_PARAM_ID_DEV_TIMING_STATS 0x000102AD
11020
11021/* Version information used to handle future additions to AFE device
11022 * interface timing statistics (for backward compatibility).
11023 */
11024#define AFE_API_VERSION_DEV_TIMING_STATS 0x1
11025
11026/* Enumeration for specifying a sink(Rx) device */
11027#define AFE_SINK_DEVICE 0x0
11028
11029/* Enumeration for specifying a source(Tx) device */
11030#define AFE_SOURCE_DEVICE 0x1
11031
11032/* Enumeration for specifying the drift reference is of type AV Timer */
11033#define AFE_REF_TIMER_TYPE_AVTIMER 0x0
11034
11035/* Message payload structure for the
11036 * AFE_PARAM_ID_DEV_TIMING_STATS parameter.
11037 */
11038struct afe_param_id_dev_timing_stats {
11039 /* Minor version used to track the version of device interface timing
11040 * statistics. Currently, the supported version is 1.
11041 * @values #AFE_API_VERSION_DEV_TIMING_STATS
11042 */
11043 u32 minor_version;
11044
11045 /* Indicates the device interface direction as either
11046 * source (Tx) or sink (Rx).
11047 * @values
11048 * #AFE_SINK_DEVICE
11049 * #AFE_SOURCE_DEVICE
11050 */
11051 u16 device_direction;
11052
11053 /* Reference timer for drift accumulation and time stamp information.
11054 * @values
11055 * #AFE_REF_TIMER_TYPE_AVTIMER @tablebulletend
11056 */
11057 u16 reference_timer;
11058
11059 /*
11060 * Flag to indicate if resync is required on the client side for
11061 * drift correction. Flag is set to TRUE for the first get_param
11062 * response after device interface starts. This flag value can be
11063 * used by client to identify if device interface restart has
11064 * happened and if any re-sync is required at their end for drift
11065 * correction.
11066 * @values
11067 * 0: FALSE (Resync not required)
11068 * 1: TRUE (Resync required) @tablebulletend
11069 */
11070 u32 resync_flag;
11071
11072 /* Accumulated drift value in microseconds. This value is updated
11073 * every 100th ms.
11074 * Positive drift value indicates AV timer is running faster than device
11075 * Negative drift value indicates AV timer is running slower than device
11076 * @values Any valid int32 number
11077 */
11078 s32 acc_drift_value;
11079
11080 /* Lower 32 bits of the 64-bit absolute timestamp of reference
11081 * timer in microseconds.
11082
11083 * This timestamp corresponds to the time when the drift values
11084 * are accumlated for every 100th ms.
11085 * @values Any valid uint32 number
11086 */
11087 u32 ref_timer_abs_ts_lsw;
11088
11089 /* Upper 32 bits of the 64-bit absolute timestamp of reference
11090 * timer in microseconds.
11091 * This timestamp corresponds to the time when the drift values
11092 * are accumlated for every 100th ms.
11093 * @values Any valid uint32 number
11094 */
11095 u32 ref_timer_abs_ts_msw;
11096} __packed;
11097
11098struct afe_av_dev_drift_get_param {
11099 struct apr_hdr hdr;
11100 struct afe_port_cmd_get_param_v2 get_param;
11101 struct afe_port_param_data_v2 pdata;
11102 struct afe_param_id_dev_timing_stats timing_stats;
11103} __packed;
11104
11105struct afe_av_dev_drift_get_param_resp {
11106 uint32_t status;
11107 struct afe_port_param_data_v2 pdata;
11108 struct afe_param_id_dev_timing_stats timing_stats;
11109} __packed;
11110
11111/* Command for Matrix or Stream Router */
11112#define ASM_SESSION_CMD_SET_MTMX_STRTR_PARAMS_V2 0x00010DCE
11113/* Module for AVSYNC */
11114#define ASM_SESSION_MTMX_STRTR_MODULE_ID_AVSYNC 0x00010DC6
11115
11116/* Parameter used by #ASM_SESSION_MTMX_STRTR_MODULE_ID_AVSYNC to specify the
11117 * render window start value. This parameter is supported only for a Set
11118 * command (not a Get command) in the Rx direction
11119 * (#ASM_SESSION_CMD_SET_MTMX_STRTR_PARAMS_V2).
11120 * Render window start is a value (session time minus timestamp, or ST-TS)
11121 * below which frames are held, and after which frames are immediately
11122 * rendered.
11123 */
11124#define ASM_SESSION_MTMX_STRTR_PARAM_RENDER_WINDOW_START_V2 0x00010DD1
11125
11126/* Parameter used by #ASM_SESSION_MTMX_STRTR_MODULE_ID_AVSYNC to specify the
11127 * render window end value. This parameter is supported only for a Set
11128 * command (not a Get command) in the Rx direction
11129 * (#ASM_SESSION_CMD_SET_MTMX_STRTR_PARAMS_V2). Render window end is a value
11130 * (session time minus timestamp) above which frames are dropped, and below
11131 * which frames are immediately rendered.
11132 */
11133#define ASM_SESSION_MTMX_STRTR_PARAM_RENDER_WINDOW_END_V2 0x00010DD2
11134
11135/* Generic payload of the window parameters in the
11136 * #ASM_SESSION_MTMX_STRTR_MODULE_ID_AVSYNC module.
11137 * This payload is supported only for a Set command
11138 * (not a Get command) on the Rx path.
11139 */
11140struct asm_session_mtmx_strtr_param_window_v2_t {
11141 u32 window_lsw;
11142 /* Lower 32 bits of the render window start value. */
11143
11144 u32 window_msw;
11145 /* Upper 32 bits of the render window start value.
11146 *
11147 * The 64-bit number formed by window_lsw and window_msw specifies a
11148 * signed 64-bit window value in microseconds. The sign extension is
11149 * necessary. This value is used by the following parameter IDs:
11150 * #ASM_SESSION_MTMX_STRTR_PARAM_RENDER_WINDOW_START_V2
11151 * #ASM_SESSION_MTMX_STRTR_PARAM_RENDER_WINDOW_END_V2
11152 * #ASM_SESSION_MTMX_STRTR_PARAM_STAT_WINDOW_START_V2
11153 * #ASM_SESSION_MTMX_STRTR_PARAM_STAT_WINDOW_END_V2
11154 * The value depends on which parameter ID is used.
11155 * The aDSP honors the windows at a granularity of 1 ms.
11156 */
11157};
11158
11159struct asm_session_cmd_set_mtmx_strstr_params_v2 {
11160 uint32_t data_payload_addr_lsw;
11161 /* Lower 32 bits of the 64-bit data payload address. */
11162
11163 uint32_t data_payload_addr_msw;
11164 /* Upper 32 bits of the 64-bit data payload address.
11165 * If the address is not sent (NULL), the message is in the payload.
11166 * If the address is sent (non-NULL), the parameter data payloads
11167 * begin at the specified address.
11168 */
11169
11170 uint32_t mem_map_handle;
11171 /* Unique identifier for an address. This memory map handle is returned
11172 * by the aDSP through the #ASM_CMD_SHARED_MEM_MAP_REGIONS command.
11173 * values
11174 * - NULL -- Parameter data payloads are within the message payload
11175 * (in-band).
11176 * - Non-NULL -- Parameter data payloads begin at the address specified
11177 * in the data_payload_addr_lsw and data_payload_addr_msw fields
11178 * (out-of-band).
11179 */
11180
11181 uint32_t data_payload_size;
11182 /* Actual size of the variable payload accompanying the message, or in
11183 * shared memory. This field is used for parsing the parameter payload.
11184 * values > 0 bytes
11185 */
11186
11187 uint32_t direction;
11188 /* Direction of the entity (matrix mixer or stream router) on which
11189 * the parameter is to be set.
11190 * values
11191 * - 0 -- Rx (for Rx stream router or Rx matrix mixer)
11192 * - 1 -- Tx (for Tx stream router or Tx matrix mixer)
11193 */
11194};
11195
11196/* Parameter used by #ASM_SESSION_MTMX_STRTR_MODULE_ID_AVSYNC which allows the
11197 * audio client choose the rendering decision that the audio DSP should use.
11198 */
11199#define ASM_SESSION_MTMX_STRTR_PARAM_RENDER_MODE_CMD 0x00012F0D
11200
11201/* Indicates that rendering decision will be based on default rate
11202 * (session clock based rendering, device driven).
11203 * 1. The default session clock based rendering is inherently driven
11204 * by the timing of the device.
11205 * 2. After the initial decision is made (first buffer after a run
11206 * command), subsequent data rendering decisions are made with
11207 * respect to the rate at which the device is rendering, thus deriving
11208 * its timing from the device.
11209 * 3. While this decision making is simple, it has some inherent limitations
11210 * (mentioned in the next section).
11211 * 4. If this API is not set, the session clock based rendering will be assumed
11212 * and this will ensure that the DSP is backward compatible.
11213 */
11214#define ASM_SESSION_MTMX_STRTR_PARAM_RENDER_DEFAULT 0
11215
11216/* Indicates that rendering decision will be based on local clock rate.
11217 * 1. In the DSP loopback/client loopback use cases (frame based
11218 * inputs), the incoming data into audio DSP is time-stamped at the
11219 * local clock rate (STC).
11220 * 2. This TS rate may match the incoming data rate or maybe different
11221 * from the incoming data rate.
11222 * 3. Regardless, the data will be time-stamped with local STC and
11223 * therefore, the client is recommended to set this mode for these
11224 * use cases. This method is inherently more robust to sequencing
11225 * (AFE Start/Stop) and device switches, among other benefits.
11226 * 4. This API will inform the DSP to compare every incoming buffer TS
11227 * against local STC.
11228 * 5. DSP will continue to honor render windows APIs, as before.
11229 */
11230#define ASM_SESSION_MTMX_STRTR_PARAM_RENDER_LOCAL_STC 1
11231
11232/* Structure for rendering decision parameter */
11233struct asm_session_mtmx_strtr_param_render_mode_t {
11234 /* Specifies the type of rendering decision the audio DSP should use.
11235 *
11236 * @values
11237 * - #ASM_SESSION_MTMX_STRTR_PARAM_RENDER_DEFAULT
11238 * - #ASM_SESSION_MTMX_STRTR_PARAM_RENDER_LOCAL_STC
11239 */
11240 u32 flags;
11241} __packed;
11242
11243/* Parameter used by #ASM_SESSION_MTMX_STRTR_MODULE_ID_AVSYNC which allows the
11244 * audio client to specify the clock recovery mechanism that the audio DSP
11245 * should use.
11246 */
11247
11248#define ASM_SESSION_MTMX_STRTR_PARAM_CLK_REC_CMD 0x00012F0E
11249
11250/* Indicates that default clock recovery will be used (no clock recovery).
11251 * If the client wishes that no clock recovery be done, the client can
11252 * choose this. This means that no attempt will made by the DSP to try and
11253 * match the rates of the input and output audio.
11254 */
11255#define ASM_SESSION_MTMX_STRTR_PARAM_CLK_REC_NONE 0
11256
11257/* Indicates that independent clock recovery needs to be used.
11258 * 1. In the DSP loopback/client loopback use cases (frame based inputs),
11259 * the client should choose the independent clock recovery option.
11260 * 2. This basically de-couples the audio and video from knowing each others
11261 * clock sources and lets the audio DSP independently rate match the input
11262 * and output rates.
11263 * 3. After drift detection, the drift correction is achieved by either pulling
11264 * the PLLs (if applicable) or by stream to device rate matching
11265 * (for PCM use cases) by comparing drift with respect to STC.
11266 * 4. For passthrough use cases, since the PLL pulling is the only option,
11267 * a best effort will be made.
11268 * If PLL pulling is not possible / available, the rendering will be
11269 * done without rate matching.
11270 */
11271#define ASM_SESSION_MTMX_STRTR_PARAM_CLK_REC_AUTO 1
11272
11273/* Payload of the #ASM_SESSION_MTMX_STRTR_PARAM_CLK_REC parameter.
11274 */
11275struct asm_session_mtmx_strtr_param_clk_rec_t {
11276 /* Specifies the type of clock recovery that the audio DSP should
11277 * use for rate matching.
11278 */
11279
11280 /* @values
11281 * #ASM_SESSION_MTMX_STRTR_PARAM_CLK_REC_DEFAULT
11282 * #ASM_SESSION_MTMX_STRTR_PARAM_CLK_REC_INDEPENDENT
11283 */
11284 u32 flags;
11285} __packed;
11286
11287
11288/* Parameter used by #ASM_SESSION_MTMX_STRTR_MODULE_ID_AVSYNC to
11289 * realize smoother adjustment of audio session clock for a specified session.
11290 * The desired audio session clock adjustment(in micro seconds) is specified
11291 * using the command #ASM_SESSION_CMD_ADJUST_SESSION_CLOCK_V2.
11292 * Delaying/Advancing the session clock would be implemented by inserting
11293 * interpolated/dropping audio samples in the playback path respectively.
11294 * Also, this parameter has to be configured before the Audio Session is put
11295 * to RUN state to avoid cold start latency/glitches in the playback.
11296 */
11297
11298#define ASM_SESSION_MTMX_PARAM_ADJUST_SESSION_TIME_CTL 0x00013217
11299
11300struct asm_session_mtmx_param_adjust_session_time_ctl_t {
11301 /* Specifies whether the module is enabled or not
11302 * @values
11303 * 0 -- disabled
11304 * 1 -- enabled
11305 */
11306 u32 enable;
11307};
11308
11309union asm_session_mtmx_strtr_param_config {
11310 struct asm_session_mtmx_strtr_param_window_v2_t window_param;
11311 struct asm_session_mtmx_strtr_param_render_mode_t render_param;
11312 struct asm_session_mtmx_strtr_param_clk_rec_t clk_rec_param;
11313 struct asm_session_mtmx_param_adjust_session_time_ctl_t adj_time_param;
11314} __packed;
11315
11316struct asm_mtmx_strtr_params {
11317 struct apr_hdr hdr;
11318 struct asm_session_cmd_set_mtmx_strstr_params_v2 param;
11319 struct asm_stream_param_data_v2 data;
11320 union asm_session_mtmx_strtr_param_config config;
11321} __packed;
11322
11323#define ASM_SESSION_CMD_GET_MTMX_STRTR_PARAMS_V2 0x00010DCF
11324#define ASM_SESSION_CMDRSP_GET_MTMX_STRTR_PARAMS_V2 0x00010DD0
11325
11326#define ASM_SESSION_MTMX_STRTR_PARAM_SESSION_TIME_V3 0x00012F0B
11327#define ASM_SESSION_MTMX_STRTR_PARAM_STIME_TSTMP_FLG_BMASK (0x80000000UL)
11328
11329struct asm_session_cmd_get_mtmx_strstr_params_v2 {
11330 uint32_t data_payload_addr_lsw;
11331 /* Lower 32 bits of the 64-bit data payload address. */
11332
11333 uint32_t data_payload_addr_msw;
11334 /*
11335 * Upper 32 bits of the 64-bit data payload address.
11336 * If the address is not sent (NULL), the message is in the payload.
11337 * If the address is sent (non-NULL), the parameter data payloads
11338 * begin at the specified address.
11339 */
11340
11341 uint32_t mem_map_handle;
11342 /*
11343 * Unique identifier for an address. This memory map handle is returned
11344 * by the aDSP through the #ASM_CMD_SHARED_MEM_MAP_REGIONS command.
11345 * values
11346 * - NULL -- Parameter data payloads are within the message payload
11347 * (in-band).
11348 * - Non-NULL -- Parameter data payloads begin at the address specified
11349 * in the data_payload_addr_lsw and data_payload_addr_msw fields
11350 * (out-of-band).
11351 */
11352 uint32_t direction;
11353 /*
11354 * Direction of the entity (matrix mixer or stream router) on which
11355 * the parameter is to be set.
11356 * values
11357 * - 0 -- Rx (for Rx stream router or Rx matrix mixer)
11358 * - 1 -- Tx (for Tx stream router or Tx matrix mixer)
11359 */
11360 uint32_t module_id;
11361 /* Unique module ID. */
11362
11363 uint32_t param_id;
11364 /* Unique parameter ID. */
11365
11366 uint32_t param_max_size;
11367};
11368
11369struct asm_session_mtmx_strtr_param_session_time_v3_t {
11370 uint32_t session_time_lsw;
11371 /* Lower 32 bits of the current session time in microseconds */
11372
11373 uint32_t session_time_msw;
11374 /*
11375 * Upper 32 bits of the current session time in microseconds.
11376 * The 64-bit number formed by session_time_lsw and session_time_msw
11377 * is treated as signed.
11378 */
11379
11380 uint32_t absolute_time_lsw;
11381 /*
11382 * Lower 32 bits of the 64-bit absolute time in microseconds.
11383 * This is the time when the sample corresponding to the
11384 * session_time_lsw is rendered to the hardware. This absolute
11385 * time can be slightly in the future or past.
11386 */
11387
11388 uint32_t absolute_time_msw;
11389 /*
11390 * Upper 32 bits of the 64-bit absolute time in microseconds.
11391 * This is the time when the sample corresponding to the
11392 * session_time_msw is rendered to hardware. This absolute
11393 * time can be slightly in the future or past. The 64-bit number
11394 * formed by absolute_time_lsw and absolute_time_msw is treated as
11395 * unsigned.
11396 */
11397
11398 uint32_t time_stamp_lsw;
11399 /* Lower 32 bits of the last processed timestamp in microseconds */
11400
11401 uint32_t time_stamp_msw;
11402 /*
11403 * Upper 32 bits of the last processed timestamp in microseconds.
11404 * The 64-bit number formed by time_stamp_lsw and time_stamp_lsw
11405 * is treated as unsigned.
11406 */
11407
11408 uint32_t flags;
11409 /*
11410 * Keeps track of any additional flags needed.
11411 * @values{for bit 31}
11412 * - 0 -- Uninitialized/invalid
11413 * - 1 -- Valid
11414 * All other bits are reserved; clients must set them to zero.
11415 */
11416};
11417
11418union asm_session_mtmx_strtr_data_type {
11419 struct asm_session_mtmx_strtr_param_session_time_v3_t session_time;
11420};
11421
11422struct asm_mtmx_strtr_get_params {
11423 struct apr_hdr hdr;
11424 struct asm_session_cmd_get_mtmx_strstr_params_v2 param_info;
11425} __packed;
11426
11427struct asm_mtmx_strtr_get_params_cmdrsp {
11428 uint32_t err_code;
11429 struct asm_stream_param_data_v2 param_info;
11430 union asm_session_mtmx_strtr_data_type param_data;
11431} __packed;
11432
11433#define AUDPROC_MODULE_ID_RESAMPLER 0x00010719
11434
11435enum {
11436 LEGACY_PCM = 0,
11437 COMPRESSED_PASSTHROUGH,
11438 COMPRESSED_PASSTHROUGH_CONVERT,
11439 COMPRESSED_PASSTHROUGH_DSD,
11440 LISTEN,
11441 COMPRESSED_PASSTHROUGH_GEN,
11442 COMPRESSED_PASSTHROUGH_IEC61937
11443};
11444
11445#define AUDPROC_MODULE_ID_COMPRESSED_MUTE 0x00010770
11446#define AUDPROC_PARAM_ID_COMPRESSED_MUTE 0x00010771
11447
11448struct adm_set_compressed_device_mute {
11449 struct adm_cmd_set_pp_params_v5 command;
11450 struct adm_param_data_v5 params;
11451 u32 mute_on;
11452} __packed;
11453
11454#define AUDPROC_MODULE_ID_COMPRESSED_LATENCY 0x0001076E
11455#define AUDPROC_PARAM_ID_COMPRESSED_LATENCY 0x0001076F
11456
11457struct adm_set_compressed_device_latency {
11458 struct adm_cmd_set_pp_params_v5 command;
11459 struct adm_param_data_v5 params;
11460 u32 latency;
11461} __packed;
11462
11463#define VOICEPROC_MODULE_ID_GENERIC_TX 0x00010EF6
11464#define VOICEPROC_PARAM_ID_FLUENCE_SOUNDFOCUS 0x00010E37
11465#define VOICEPROC_PARAM_ID_FLUENCE_SOURCETRACKING 0x00010E38
11466#define MAX_SECTORS 8
11467#define MAX_NOISE_SOURCE_INDICATORS 3
11468#define MAX_POLAR_ACTIVITY_INDICATORS 360
11469
11470struct sound_focus_param {
11471 uint16_t start_angle[MAX_SECTORS];
11472 uint8_t enable[MAX_SECTORS];
11473 uint16_t gain_step;
11474} __packed;
11475
11476struct source_tracking_param {
11477 uint8_t vad[MAX_SECTORS];
11478 uint16_t doa_speech;
11479 uint16_t doa_noise[MAX_NOISE_SOURCE_INDICATORS];
11480 uint8_t polar_activity[MAX_POLAR_ACTIVITY_INDICATORS];
11481} __packed;
11482
11483struct adm_param_fluence_soundfocus_t {
11484 uint16_t start_angles[MAX_SECTORS];
11485 uint8_t enables[MAX_SECTORS];
11486 uint16_t gain_step;
11487 uint16_t reserved;
11488} __packed;
11489
11490struct adm_set_fluence_soundfocus_param {
11491 struct adm_cmd_set_pp_params_v5 params;
11492 struct adm_param_data_v5 data;
11493 struct adm_param_fluence_soundfocus_t soundfocus_data;
11494} __packed;
11495
11496struct adm_param_fluence_sourcetracking_t {
11497 uint8_t vad[MAX_SECTORS];
11498 uint16_t doa_speech;
11499 uint16_t doa_noise[MAX_NOISE_SOURCE_INDICATORS];
11500 uint8_t polar_activity[MAX_POLAR_ACTIVITY_INDICATORS];
11501} __packed;
11502
11503#define AUDPROC_MODULE_ID_AUDIOSPHERE 0x00010916
11504#define AUDPROC_PARAM_ID_AUDIOSPHERE_ENABLE 0x00010917
11505#define AUDPROC_PARAM_ID_AUDIOSPHERE_STRENGTH 0x00010918
11506#define AUDPROC_PARAM_ID_AUDIOSPHERE_CONFIG_MODE 0x00010919
11507
11508#define AUDPROC_PARAM_ID_AUDIOSPHERE_COEFFS_STEREO_INPUT 0x0001091A
11509#define AUDPROC_PARAM_ID_AUDIOSPHERE_COEFFS_MULTICHANNEL_INPUT 0x0001091B
11510#define AUDPROC_PARAM_ID_AUDIOSPHERE_DESIGN_STEREO_INPUT 0x0001091C
11511#define AUDPROC_PARAM_ID_AUDIOSPHERE_DESIGN_MULTICHANNEL_INPUT 0x0001091D
11512
11513#define AUDPROC_PARAM_ID_AUDIOSPHERE_OPERATING_INPUT_MEDIA_INFO 0x0001091E
11514
11515#define AUDPROC_MODULE_ID_VOICE_TX_SECNS 0x10027059
11516#define AUDPROC_PARAM_IDX_SEC_PRIMARY_MIC_CH 0x10014444
11517
11518struct admx_sec_primary_mic_ch {
11519 uint16_t version;
11520 uint16_t reserved;
11521 uint16_t sec_primary_mic_ch;
11522 uint16_t reserved1;
11523} __packed;
11524
11525
11526struct adm_set_sec_primary_ch_params {
11527 struct adm_cmd_set_pp_params_v5 params;
11528 struct adm_param_data_v5 data;
11529 struct admx_sec_primary_mic_ch sec_primary_mic_ch_data;
11530} __packed;
11531#endif /*_APR_AUDIO_V2_H_ */