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