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