blob: dbeb6de77c48d732b5933bd925f92f75e2ee3ba5 [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
3253/*
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +05303254 * Data format to send compressed data
3255 * is transmitted/received over Slimbus lines.
3256 */
3257#define AFE_SB_DATA_FORMAT_GENERIC_COMPRESSED 0x3
3258
3259/*
3260 * ID for AFE port module. This will be used to define port properties.
3261 * This module supports following parameter IDs:
3262 * #AFE_PARAM_ID_PORT_MEDIA_TYPE
3263 * To configure the port property, the client must use the
3264 * #AFE_PORT_CMD_SET_PARAM_V2 command,
3265 * and fill the module ID with the respective parameter IDs as listed above.
3266 * @apr_hdr_fields
3267 * Opcode -- AFE_MODULE_PORT
3268 */
3269#define AFE_MODULE_PORT 0x000102a6
3270
3271/*
3272 * ID of the parameter used by #AFE_MODULE_PORT to set the port media type.
3273 * parameter ID is currently supported using#AFE_PORT_CMD_SET_PARAM_V2 command.
3274 */
3275#define AFE_PARAM_ID_PORT_MEDIA_TYPE 0x000102a7
3276
3277/*
3278 * Macros for defining the "data_format" field in the
3279 * #AFE_PARAM_ID_PORT_MEDIA_TYPE
3280 */
3281#define AFE_PORT_DATA_FORMAT_PCM 0x0
3282#define AFE_PORT_DATA_FORMAT_GENERIC_COMPRESSED 0x1
3283
3284/*
3285 * Macro for defining the "minor_version" field in the
3286 * #AFE_PARAM_ID_PORT_MEDIA_TYPE
3287 */
3288#define AFE_API_VERSION_PORT_MEDIA_TYPE 0x1
3289
3290#define ASM_MEDIA_FMT_NONE 0x0
3291
3292/*
3293 * Media format ID for SBC encode configuration.
3294 * @par SBC encode configuration (asm_sbc_enc_cfg_t)
3295 * @table{weak__asm__sbc__enc__cfg__t}
3296 */
3297#define ASM_MEDIA_FMT_SBC 0x00010BF2
3298
3299/* SBC channel Mono mode.*/
3300#define ASM_MEDIA_FMT_SBC_CHANNEL_MODE_MONO 1
3301
3302/* SBC channel Stereo mode. */
3303#define ASM_MEDIA_FMT_SBC_CHANNEL_MODE_STEREO 2
3304
3305/* SBC channel Dual Mono mode. */
3306#define ASM_MEDIA_FMT_SBC_CHANNEL_MODE_DUAL_MONO 8
3307
3308/* SBC channel Joint Stereo mode. */
3309#define ASM_MEDIA_FMT_SBC_CHANNEL_MODE_JOINT_STEREO 9
3310
3311/* SBC bit allocation method = loudness. */
3312#define ASM_MEDIA_FMT_SBC_ALLOCATION_METHOD_LOUDNESS 0
3313
3314/* SBC bit allocation method = SNR. */
3315#define ASM_MEDIA_FMT_SBC_ALLOCATION_METHOD_SNR 1
3316
3317
3318/*
3319 * Payload of the SBC encoder configuration parameters in the
3320 * #ASM_MEDIA_FMT_SBC media format.
3321 */
3322struct asm_sbc_enc_cfg_t {
3323 /*
3324 * Number of subbands.
3325 * @values 4, 8
3326 */
3327 uint32_t num_subbands;
3328
3329 /*
3330 * Size of the encoded block in samples.
3331 * @values 4, 8, 12, 16
3332 */
3333 uint32_t blk_len;
3334
3335 /*
3336 * Mode used to allocate bits between channels.
3337 * @values
3338 * 0 (Native mode)
3339 * #ASM_MEDIA_FMT_SBC_CHANNEL_MODE_MONO
3340 * #ASM_MEDIA_FMT_SBC_CHANNEL_MODE_STEREO
3341 * #ASM_MEDIA_FMT_SBC_CHANNEL_MODE_DUAL_MONO
3342 * #ASM_MEDIA_FMT_SBC_CHANNEL_MODE_JOINT_STEREO
3343 * Native mode indicates that encoding must be performed with the number
3344 * of channels at the input.
3345 * If postprocessing outputs one-channel data, Mono mode is used. If
3346 * postprocessing outputs two-channel data, Stereo mode is used.
3347 * The number of channels must not change during encoding.
3348 */
3349 uint32_t channel_mode;
3350
3351 /*
3352 * Encoder bit allocation method.
3353 * @values
3354 * #ASM_MEDIA_FMT_SBC_ALLOCATION_METHOD_LOUDNESS
3355 * #ASM_MEDIA_FMT_SBC_ALLOCATION_METHOD_SNR @tablebulletend
3356 */
3357 uint32_t alloc_method;
3358
3359 /*
3360 * Number of encoded bits per second.
3361 * @values
3362 * Mono channel -- Maximum of 320 kbps
3363 * Stereo channel -- Maximum of 512 kbps @tablebulletend
3364 */
3365 uint32_t bit_rate;
3366
3367 /*
3368 * Number of samples per second.
3369 * @values 0 (Native mode), 16000, 32000, 44100, 48000&nbsp;Hz
3370 * Native mode indicates that encoding must be performed with the
3371 * sampling rate at the input.
3372 * The sampling rate must not change during encoding.
3373 */
3374 uint32_t sample_rate;
3375};
3376
3377#define ASM_MEDIA_FMT_AAC_AOT_LC 2
3378#define ASM_MEDIA_FMT_AAC_AOT_SBR 5
3379#define ASM_MEDIA_FMT_AAC_AOT_PS 29
3380#define ASM_MEDIA_FMT_AAC_FORMAT_FLAG_ADTS 0
3381#define ASM_MEDIA_FMT_AAC_FORMAT_FLAG_RAW 3
3382
3383struct asm_aac_enc_cfg_v2_t {
3384
3385 /* Encoding rate in bits per second.*/
3386 uint32_t bit_rate;
3387
3388 /*
3389 * Encoding mode.
3390 * Supported values:
3391 * #ASM_MEDIA_FMT_AAC_AOT_LC
3392 * #ASM_MEDIA_FMT_AAC_AOT_SBR
3393 * #ASM_MEDIA_FMT_AAC_AOT_PS
3394 */
3395 uint32_t enc_mode;
3396
3397 /*
3398 * AAC format flag.
3399 * Supported values:
3400 * #ASM_MEDIA_FMT_AAC_FORMAT_FLAG_ADTS
3401 * #ASM_MEDIA_FMT_AAC_FORMAT_FLAG_RAW
3402 */
3403 uint16_t aac_fmt_flag;
3404
3405 /*
3406 * Number of channels to encode.
3407 * Supported values:
3408 * 0 - Native mode
3409 * 1 - Mono
3410 * 2 - Stereo
3411 * Other values are not supported.
3412 * @note1hang The eAAC+ encoder mode supports only stereo.
3413 * Native mode indicates that encoding must be performed with the
3414 * number of channels at the input.
3415 * The number of channels must not change during encoding.
3416 */
3417 uint16_t channel_cfg;
3418
3419 /*
3420 * Number of samples per second.
3421 * Supported values: - 0 -- Native mode - For other values,
3422 * Native mode indicates that encoding must be performed with the
3423 * sampling rate at the input.
3424 * The sampling rate must not change during encoding.
3425 */
3426 uint32_t sample_rate;
3427} __packed;
3428
3429/* FMT ID for apt-X Classic */
3430#define ASM_MEDIA_FMT_APTX 0x000131ff
3431
3432/* FMT ID for apt-X HD */
3433#define ASM_MEDIA_FMT_APTX_HD 0x00013200
3434
3435#define PCM_CHANNEL_L 1
3436#define PCM_CHANNEL_R 2
3437#define PCM_CHANNEL_C 3
3438
Preetam Singh Ranawat54028492017-09-04 11:42:26 +05303439struct asm_custom_enc_cfg_t {
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +05303440 uint32_t sample_rate;
3441 /* Mono or stereo */
3442 uint16_t num_channels;
3443 uint16_t reserved;
3444 /* num_ch == 1, then PCM_CHANNEL_C,
3445 * num_ch == 2, then {PCM_CHANNEL_L, PCM_CHANNEL_R}
3446 */
3447 uint8_t channel_mapping[8];
3448 uint32_t custom_size;
3449} __packed;
Preetam Singh Ranawat899b78b2017-09-07 12:36:06 -07003450
3451struct asm_aptx_v2_enc_cfg_ext_t {
3452 /*
3453 * sync mode: 0x0 = stereo sync mode (default)
3454 * 0x01 = dual mono sync mode
3455 * 0x02 = dual mono with no sync on either L or R
3456 */
3457 uint32_t sync_mode;
3458} __packed;
3459
3460struct asm_aptx_enc_cfg_t {
3461 struct asm_custom_enc_cfg_t custom_cfg;
3462 struct asm_aptx_v2_enc_cfg_ext_t aptx_v2_cfg;
3463} __packed;
3464
Preetam Singh Ranawat54028492017-09-04 11:42:26 +05303465#define ASM_MEDIA_FMT_CELT 0x00013221
3466struct asm_celt_specific_enc_cfg_t {
3467 /*
3468 * Bit rate used for encoding.
3469 * This is used to calculate the upper threshold
3470 * for bytes per frame if vbr_flag is 1.
3471 * Or else, this will be used as a regular constant
3472 * bit rate for encoder output.
3473 * @Range : 32000 to 1536000
3474 * @Default: 128
3475 */
3476 uint32_t bit_rate;
3477 /*
3478 * Frame size used for encoding.
3479 * @Range : 64, 128, 256, 512
3480 * @Default: 256
3481 */
3482 uint16_t frame_size;
3483 /*
3484 * complexity of algorithm.
3485 * @Range : 0-10
3486 * @Default: 3
3487 */
3488 uint16_t complexity;
3489 /*
3490 * Switch variable for prediction feature.
3491 * Used to choose between the level of interframe
3492 * predictions allowed while encoding.
3493 * @Range:
3494 * 0: Independent Frames.
3495 * 1: Short Term interframe prediction allowed.
3496 * 2: Long term prediction allowed.
3497 * @Default: 2
3498 */
3499 uint16_t prediction_mode;
3500 /*
3501 * Variable Bit Rate flag.
3502 * @Default: 0
3503 */
3504 uint16_t vbr_flag;
3505} __packed;
3506
3507struct asm_celt_enc_cfg_t {
3508 struct asm_custom_enc_cfg_t custom_config;
3509 struct asm_celt_specific_enc_cfg_t celt_specific_config;
3510} __packed;
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +05303511
Preetam Singh Ranawat0a087af2017-10-25 15:02:28 +05303512#define ASM_MEDIA_FMT_LDAC 0x00013224
3513struct asm_ldac_specific_enc_cfg_t {
3514 /*
3515 * This is used to calculate the encoder output
3516 * bytes per frame (i.e. bytes per packet).
3517 * Bit rate also configures the EQMID.
3518 * The min bit rate 303000 bps is calculated for
3519 * 44.1 kHz and 88.2 KHz sampling frequencies with
3520 * Mobile use Quality.
3521 * The max bit rate of 990000 bps is calculated for
3522 * 96kHz and 48 KHz with High Quality
3523 * @Range(in bits per second)
3524 * 303000 for Mobile use Quality
3525 * 606000 for standard Quality
3526 * 909000 for High Quality
3527 */
3528 uint32_t bit_rate;
3529 /*
3530 * The channel setting information for LDAC specification
3531 * of Bluetooth A2DP which is determined by SRC and SNK
3532 * devices in Bluetooth transmission.
3533 * @Range:
3534 * 0 for native mode
3535 * 4 for mono
3536 * 2 for dual channel
3537 * 1 for stereo
3538 */
3539 uint16_t channel_mode;
3540 /*
3541 * Maximum Transmission Unit (MTU).
3542 * The minimum MTU that a L2CAP implementation for LDAC shall
3543 * support is 679 bytes, because LDAC is optimized with 2-DH5
3544 * packet as its target.
3545 * @Range : 679
3546 * @Default: 679 for LDACBT_MTU_2DH5
3547 */
3548 uint16_t mtu;
3549} __packed;
3550
3551struct asm_ldac_enc_cfg_t {
3552 struct asm_custom_enc_cfg_t custom_config;
3553 struct asm_ldac_specific_enc_cfg_t ldac_specific_config;
Aniket Kumar Lataf8664712018-02-22 14:46:09 -08003554 struct afe_abr_enc_cfg_t abr_config;
Preetam Singh Ranawat0a087af2017-10-25 15:02:28 +05303555} __packed;
3556
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +05303557struct afe_enc_fmt_id_param_t {
3558 /*
3559 * Supported values:
3560 * #ASM_MEDIA_FMT_SBC
3561 * #ASM_MEDIA_FMT_AAC_V2
3562 * Any OpenDSP supported values
3563 */
3564 uint32_t fmt_id;
3565} __packed;
3566
3567struct afe_port_media_type_t {
3568 /*
3569 * Minor version
3570 * @values #AFE_API_VERSION_PORT_MEDIA_TYPE.
3571 */
3572 uint32_t minor_version;
3573
3574 /*
3575 * Sampling rate of the port.
3576 * @values
3577 * #AFE_PORT_SAMPLE_RATE_8K
3578 * #AFE_PORT_SAMPLE_RATE_11_025K
3579 * #AFE_PORT_SAMPLE_RATE_12K
3580 * #AFE_PORT_SAMPLE_RATE_16K
3581 * #AFE_PORT_SAMPLE_RATE_22_05K
3582 * #AFE_PORT_SAMPLE_RATE_24K
3583 * #AFE_PORT_SAMPLE_RATE_32K
3584 * #AFE_PORT_SAMPLE_RATE_44_1K
3585 * #AFE_PORT_SAMPLE_RATE_48K
3586 * #AFE_PORT_SAMPLE_RATE_88_2K
3587 * #AFE_PORT_SAMPLE_RATE_96K
3588 * #AFE_PORT_SAMPLE_RATE_176_4K
3589 * #AFE_PORT_SAMPLE_RATE_192K
3590 * #AFE_PORT_SAMPLE_RATE_352_8K
3591 * #AFE_PORT_SAMPLE_RATE_384K
3592 */
3593 uint32_t sample_rate;
3594
3595 /*
3596 * Bit width of the sample.
3597 * @values 16, 24
3598 */
3599 uint16_t bit_width;
3600
3601 /*
3602 * Number of channels.
3603 * @values 1 to #AFE_PORT_MAX_AUDIO_CHAN_CNT
3604 */
3605 uint16_t num_channels;
3606
3607 /*
3608 * Data format supported by this port.
3609 * If the port media type and device media type are different,
3610 * it signifies a encoding/decoding use case
3611 * @values
3612 * #AFE_PORT_DATA_FORMAT_PCM
3613 * #AFE_PORT_DATA_FORMAT_GENERIC_COMPRESSED
3614 */
3615 uint16_t data_format;
3616
3617 /*This field must be set to zero.*/
3618 uint16_t reserved;
3619} __packed;
3620
3621union afe_enc_config_data {
3622 struct asm_sbc_enc_cfg_t sbc_config;
3623 struct asm_aac_enc_cfg_v2_t aac_config;
Preetam Singh Ranawat54028492017-09-04 11:42:26 +05303624 struct asm_custom_enc_cfg_t custom_config;
3625 struct asm_celt_enc_cfg_t celt_config;
Preetam Singh Ranawat899b78b2017-09-07 12:36:06 -07003626 struct asm_aptx_enc_cfg_t aptx_config;
Preetam Singh Ranawat0a087af2017-10-25 15:02:28 +05303627 struct asm_ldac_enc_cfg_t ldac_config;
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +05303628};
3629
3630struct afe_enc_config {
3631 u32 format;
Preetam Singh Ranawatf746a872017-10-20 18:13:14 +05303632 u32 scrambler_mode;
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +05303633 union afe_enc_config_data data;
3634};
3635
Aniket Kumar Lataf8664712018-02-22 14:46:09 -08003636struct afe_dec_config {
3637 u32 format;
3638 struct afe_abr_dec_cfg_t abr_dec_cfg;
3639};
3640
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +05303641struct afe_enc_cfg_blk_param_t {
3642 uint32_t enc_cfg_blk_size;
3643 /*
3644 *Size of the encoder configuration block that follows this member
3645 */
3646 union afe_enc_config_data enc_blk_config;
3647};
3648
3649/*
3650 * Payload of the AVS_ENCODER_PARAM_ID_PACKETIZER_ID parameter.
3651 */
3652struct avs_enc_packetizer_id_param_t {
3653 /*
3654 * Supported values:
3655 * #AVS_MODULE_ID_PACKETIZER_COP
3656 * Any OpenDSP supported values
3657 */
3658 uint32_t enc_packetizer_id;
3659};
3660
Preetam Singh Ranawatf746a872017-10-20 18:13:14 +05303661/*
3662 * Payload of the AVS_ENCODER_PARAM_ID_ENABLE_SCRAMBLING parameter.
3663 */
3664struct avs_enc_set_scrambler_param_t {
3665 /*
3666 * Supported values:
3667 * 1 : enable scrambler
3668 * 0 : disable scrambler
3669 */
3670 uint32_t enable_scrambler;
3671};
3672
Aniket Kumar Lataf8664712018-02-22 14:46:09 -08003673/*
3674 * Payload of the AVS_ENCODER_PARAM_ID_BIT_RATE_LEVEL_MAP parameter.
3675 */
3676struct afe_enc_level_to_bitrate_map_param_t {
3677 /*
3678 * Parameter for mapping link quality level to bitrate.
3679 */
3680 struct afe_quality_level_to_bitrate_info mapping_table;
3681};
3682
3683/*
3684 * Payload of the AVS_ENCDEC_PARAM_ID_DEC_TO_ENC_COMMUNICATION parameter.
3685 */
3686struct afe_enc_dec_imc_info_param_t {
3687 /*
3688 * Parameter to set up Inter Module Communication (IMC) between
3689 * AFE Decoder and Encoder.
3690 */
3691 struct afe_imc_dec_enc_info imc_info;
3692};
3693
3694/*
3695 * Payload of the AVS_DECODER_PARAM_ID_DEPACKETIZER_ID parameter.
3696 */
3697struct avs_dec_depacketizer_id_param_t {
3698 /*
3699 * Supported values:
3700 * #AVS_MODULE_ID_DEPACKETIZER_COP
3701 * Any OpenDSP supported values
3702 */
3703 uint32_t dec_depacketizer_id;
3704};
3705
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +05303706union afe_port_config {
3707 struct afe_param_id_pcm_cfg pcm;
3708 struct afe_param_id_i2s_cfg i2s;
3709 struct afe_param_id_hdmi_multi_chan_audio_cfg hdmi_multi_ch;
3710 struct afe_param_id_slimbus_cfg slim_sch;
3711 struct afe_param_id_rt_proxy_port_cfg rtproxy;
3712 struct afe_param_id_internal_bt_fm_cfg int_bt_fm;
3713 struct afe_param_id_pseudo_port_cfg pseudo_port;
3714 struct afe_param_id_device_hw_delay_cfg hw_delay;
3715 struct afe_param_id_spdif_cfg spdif;
3716 struct afe_param_id_set_topology_cfg topology;
3717 struct afe_param_id_tdm_cfg tdm;
3718 struct afe_param_id_usb_audio_cfg usb_audio;
Preetam Singh Ranawat899b78b2017-09-07 12:36:06 -07003719 struct afe_param_id_aptx_sync_mode sync_mode_param;
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +05303720 struct afe_enc_fmt_id_param_t enc_fmt;
3721 struct afe_port_media_type_t media_type;
3722 struct afe_enc_cfg_blk_param_t enc_blk_param;
3723 struct avs_enc_packetizer_id_param_t enc_pkt_id_param;
Preetam Singh Ranawatf746a872017-10-20 18:13:14 +05303724 struct avs_enc_set_scrambler_param_t enc_set_scrambler_param;
Aniket Kumar Lataf8664712018-02-22 14:46:09 -08003725 struct avs_dec_depacketizer_id_param_t dec_depkt_id_param;
3726 struct afe_enc_level_to_bitrate_map_param_t map_param;
3727 struct afe_enc_dec_imc_info_param_t imc_info_param;
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +05303728} __packed;
3729
3730struct afe_audioif_config_command_no_payload {
3731 struct apr_hdr hdr;
3732 struct afe_port_cmd_set_param_v2 param;
3733} __packed;
3734
3735struct afe_audioif_config_command {
3736 struct apr_hdr hdr;
3737 struct afe_port_cmd_set_param_v2 param;
3738 struct afe_port_param_data_v2 pdata;
3739 union afe_port_config port;
3740} __packed;
3741
3742#define AFE_PORT_CMD_DEVICE_START 0x000100E5
3743
3744/* Payload of the #AFE_PORT_CMD_DEVICE_START.*/
3745struct afe_port_cmd_device_start {
3746 struct apr_hdr hdr;
3747 u16 port_id;
3748/* Port interface and direction (Rx or Tx) to start. An even
3749 * number represents the Rx direction, and an odd number represents
3750 * the Tx direction.
3751 */
3752
3753
3754 u16 reserved;
3755/* Reserved for 32-bit alignment. This field must be set to 0.*/
3756
3757} __packed;
3758
3759#define AFE_PORT_CMD_DEVICE_STOP 0x000100E6
3760
3761/* Payload of the #AFE_PORT_CMD_DEVICE_STOP. */
3762struct afe_port_cmd_device_stop {
3763 struct apr_hdr hdr;
3764 u16 port_id;
3765/* Port interface and direction (Rx or Tx) to start. An even
3766 * number represents the Rx direction, and an odd number represents
3767 * the Tx direction.
3768 */
3769
3770 u16 reserved;
3771/* Reserved for 32-bit alignment. This field must be set to 0.*/
3772} __packed;
3773
3774#define AFE_SERVICE_CMD_SHARED_MEM_MAP_REGIONS 0x000100EA
3775
3776/* Memory map regions command payload used by the
3777 * #AFE_SERVICE_CMD_SHARED_MEM_MAP_REGIONS .
3778 * This structure allows clients to map multiple shared memory
3779 * regions in a single command. Following this structure are
3780 * num_regions of afe_service_shared_map_region_payload.
3781 */
3782struct afe_service_cmd_shared_mem_map_regions {
3783 struct apr_hdr hdr;
3784u16 mem_pool_id;
3785/* Type of memory on which this memory region is mapped.
3786 * Supported values:
3787 * - #ADSP_MEMORY_MAP_EBI_POOL
3788 * - #ADSP_MEMORY_MAP_SMI_POOL
3789 * - #ADSP_MEMORY_MAP_SHMEM8_4K_POOL
3790 * - Other values are reserved
3791 *
3792 * The memory pool ID implicitly defines the characteristics of the
3793 * memory. Characteristics may include alignment type, permissions,
3794 * etc.
3795 *
3796 * ADSP_MEMORY_MAP_EBI_POOL is External Buffer Interface type memory
3797 * ADSP_MEMORY_MAP_SMI_POOL is Shared Memory Interface type memory
3798 * ADSP_MEMORY_MAP_SHMEM8_4K_POOL is shared memory, byte
3799 * addressable, and 4 KB aligned.
3800 */
3801
3802
3803 u16 num_regions;
3804/* Number of regions to map.
3805 * Supported values:
3806 * - Any value greater than zero
3807 */
3808
3809 u32 property_flag;
3810/* Configures one common property for all the regions in the
3811 * payload.
3812 *
3813 * Supported values: - 0x00000000 to 0x00000001
3814 *
3815 * b0 - bit 0 indicates physical or virtual mapping 0 Shared memory
3816 * address provided in afe_service_shared_map_region_payloadis a
3817 * physical address. The shared memory needs to be mapped( hardware
3818 * TLB entry) and a software entry needs to be added for internal
3819 * book keeping.
3820 *
3821 * 1 Shared memory address provided in
3822 * afe_service_shared_map_region_payloadis a virtual address. The
3823 * shared memory must not be mapped (since hardware TLB entry is
3824 * already available) but a software entry needs to be added for
3825 * internal book keeping. This can be useful if two services with in
3826 * ADSP is communicating via APR. They can now directly communicate
3827 * via the Virtual address instead of Physical address. The virtual
3828 * regions must be contiguous. num_regions must be 1 in this case.
3829 *
3830 * b31-b1 - reserved bits. must be set to zero
3831 */
3832
3833
3834} __packed;
3835/* Map region payload used by the
3836 * afe_service_shared_map_region_payloadstructure.
3837 */
3838struct afe_service_shared_map_region_payload {
3839 u32 shm_addr_lsw;
3840/* least significant word of starting address in the memory
3841 * region to map. It must be contiguous memory, and it must be 4 KB
3842 * aligned.
3843 * Supported values: - Any 32 bit value
3844 */
3845
3846
3847 u32 shm_addr_msw;
3848/* most significant word of startng address in the memory region
3849 * to map. For 32 bit shared memory address, this field must be set
3850 * to zero. For 36 bit shared memory address, bit31 to bit 4 must be
3851 * set to zero
3852 *
3853 * Supported values: - For 32 bit shared memory address, this field
3854 * must be set to zero. - For 36 bit shared memory address, bit31 to
3855 * bit 4 must be set to zero - For 64 bit shared memory address, any
3856 * 32 bit value
3857 */
3858
3859
3860 u32 mem_size_bytes;
3861/* Number of bytes in the region. The aDSP will always map the
3862 * regions as virtual contiguous memory, but the memory size must be
3863 * in multiples of 4 KB to avoid gaps in the virtually contiguous
3864 * mapped memory.
3865 *
3866 * Supported values: - multiples of 4KB
3867 */
3868
3869} __packed;
3870
3871#define AFE_SERVICE_CMDRSP_SHARED_MEM_MAP_REGIONS 0x000100EB
3872struct afe_service_cmdrsp_shared_mem_map_regions {
3873 u32 mem_map_handle;
3874/* A memory map handle encapsulating shared memory attributes is
3875 * returned iff AFE_SERVICE_CMD_SHARED_MEM_MAP_REGIONS command is
3876 * successful. In the case of failure , a generic APR error response
3877 * is returned to the client.
3878 *
3879 * Supported Values: - Any 32 bit value
3880 */
3881
3882} __packed;
3883#define AFE_SERVICE_CMD_SHARED_MEM_UNMAP_REGIONS 0x000100EC
3884/* Memory unmap regions command payload used by the
3885 * #AFE_SERVICE_CMD_SHARED_MEM_UNMAP_REGIONS
3886 *
3887 * This structure allows clients to unmap multiple shared memory
3888 * regions in a single command.
3889 */
3890
3891
3892struct afe_service_cmd_shared_mem_unmap_regions {
3893 struct apr_hdr hdr;
3894u32 mem_map_handle;
3895/* memory map handle returned by
3896 * AFE_SERVICE_CMD_SHARED_MEM_MAP_REGIONS commands
3897 *
3898 * Supported Values:
3899 * - Any 32 bit value
3900 */
3901} __packed;
3902
3903#define AFE_PORT_CMD_GET_PARAM_V2 0x000100F0
3904
3905/* Payload of the #AFE_PORT_CMD_GET_PARAM_V2 command,
3906 * which queries for one post/preprocessing parameter of a
3907 * stream.
3908 */
3909struct afe_port_cmd_get_param_v2 {
3910 u16 port_id;
3911/* Port interface and direction (Rx or Tx) to start. */
3912
3913 u16 payload_size;
3914/* Maximum data size of the parameter ID/module ID combination.
3915 * This is a multiple of four bytes
3916 * Supported values: > 0
3917 */
3918
3919 u32 payload_address_lsw;
3920/* LSW of 64 bit Payload address. Address should be 32-byte,
3921 * 4kbyte aligned and must be contig memory.
3922 */
3923
3924
3925 u32 payload_address_msw;
3926/* MSW of 64 bit Payload address. In case of 32-bit shared
3927 * memory address, this field must be set to zero. In case of 36-bit
3928 * shared memory address, bit-4 to bit-31 must be set to zero.
3929 * Address should be 32-byte, 4kbyte aligned and must be contiguous
3930 * memory.
3931 */
3932
3933 u32 mem_map_handle;
3934/* Memory map handle returned by
3935 * AFE_SERVICE_CMD_SHARED_MEM_MAP_REGIONS commands.
3936 * Supported Values: - NULL -- Message. The parameter data is
3937 * in-band. - Non-NULL -- The parameter data is Out-band.Pointer to
3938 * - the physical address in shared memory of the payload data.
3939 * For detailed payload content, see the afe_port_param_data_v2
3940 * structure
3941 */
3942
3943
3944 u32 module_id;
3945/* ID of the module to be queried.
3946 * Supported values: Valid module ID
3947 */
3948
3949 u32 param_id;
3950/* ID of the parameter to be queried.
3951 * Supported values: Valid parameter ID
3952 */
3953} __packed;
3954
3955#define AFE_PORT_CMDRSP_GET_PARAM_V2 0x00010106
3956
3957/* Payload of the #AFE_PORT_CMDRSP_GET_PARAM_V2 message, which
3958 * responds to an #AFE_PORT_CMD_GET_PARAM_V2 command.
3959 *
3960 * Immediately following this structure is the parameters structure
3961 * (afe_port_param_data) containing the response(acknowledgment)
3962 * parameter payload. This payload is included for an in-band
3963 * scenario. For an address/shared memory-based set parameter, this
3964 * payload is not needed.
3965 */
3966
3967
3968struct afe_port_cmdrsp_get_param_v2 {
3969 u32 status;
3970} __packed;
3971
3972#define AFE_PARAM_ID_LPASS_CORE_SHARED_CLOCK_CONFIG 0x0001028C
3973#define AFE_API_VERSION_LPASS_CORE_SHARED_CLK_CONFIG 0x1
3974
3975/* Payload of the AFE_PARAM_ID_LPASS_CORE_SHARED_CLOCK_CONFIG parameter used by
3976 * AFE_MODULE_AUDIO_DEV_INTERFACE.
3977 */
3978struct afe_param_id_lpass_core_shared_clk_cfg {
3979 u32 lpass_core_shared_clk_cfg_minor_version;
3980/*
3981 * Minor version used for lpass core shared clock configuration
3982 * Supported value: AFE_API_VERSION_LPASS_CORE_SHARED_CLK_CONFIG
3983 */
3984 u32 enable;
3985/*
3986 * Specifies whether the lpass core shared clock is
3987 * enabled (1) or disabled (0).
3988 */
3989} __packed;
3990
3991struct afe_lpass_core_shared_clk_config_command {
3992 struct apr_hdr hdr;
3993 struct afe_port_cmd_set_param_v2 param;
3994 struct afe_port_param_data_v2 pdata;
3995 struct afe_param_id_lpass_core_shared_clk_cfg clk_cfg;
3996} __packed;
3997
3998/* adsp_afe_service_commands.h */
3999
4000#define ADSP_MEMORY_MAP_EBI_POOL 0
4001
4002#define ADSP_MEMORY_MAP_SMI_POOL 1
4003#define ADSP_MEMORY_MAP_IMEM_POOL 2
4004#define ADSP_MEMORY_MAP_SHMEM8_4K_POOL 3
4005
4006/* Definition of virtual memory flag */
4007#define ADSP_MEMORY_MAP_VIRTUAL_MEMORY 1
4008
4009/* Definition of physical memory flag */
4010#define ADSP_MEMORY_MAP_PHYSICAL_MEMORY 0
4011
4012#define NULL_POPP_TOPOLOGY 0x00010C68
4013#define NULL_COPP_TOPOLOGY 0x00010312
4014#define DEFAULT_COPP_TOPOLOGY 0x00010314
4015#define DEFAULT_POPP_TOPOLOGY 0x00010BE4
4016#define COMPRESSED_PASSTHROUGH_DEFAULT_TOPOLOGY 0x0001076B
4017#define COMPRESSED_PASSTHROUGH_NONE_TOPOLOGY 0x00010774
Bala Kishore Pati798cbf82018-10-22 11:58:41 +05304018#define VPM_TX_SM_ECNS_COPP_TOPOLOGY 0x00010F71
Laxminath Kasam8f7ccc22017-08-28 17:35:04 +05304019#define VPM_TX_SM_ECNS_V2_COPP_TOPOLOGY 0x00010F89
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +05304020#define VPM_TX_DM_FLUENCE_COPP_TOPOLOGY 0x00010F72
4021#define VPM_TX_QMIC_FLUENCE_COPP_TOPOLOGY 0x00010F75
4022#define VPM_TX_DM_RFECNS_COPP_TOPOLOGY 0x00010F86
4023#define ADM_CMD_COPP_OPEN_TOPOLOGY_ID_DTS_HPX 0x10015002
4024#define ADM_CMD_COPP_OPEN_TOPOLOGY_ID_AUDIOSPHERE 0x10028000
4025
4026/* Memory map regions command payload used by the
4027 * #ASM_CMD_SHARED_MEM_MAP_REGIONS ,#ADM_CMD_SHARED_MEM_MAP_REGIONS
4028 * commands.
4029 *
4030 * This structure allows clients to map multiple shared memory
4031 * regions in a single command. Following this structure are
4032 * num_regions of avs_shared_map_region_payload.
4033 */
4034
4035
4036struct avs_cmd_shared_mem_map_regions {
4037 struct apr_hdr hdr;
4038 u16 mem_pool_id;
4039/* Type of memory on which this memory region is mapped.
4040 *
4041 * Supported values: - #ADSP_MEMORY_MAP_EBI_POOL -
4042 * #ADSP_MEMORY_MAP_SMI_POOL - #ADSP_MEMORY_MAP_IMEM_POOL
4043 * (unsupported) - #ADSP_MEMORY_MAP_SHMEM8_4K_POOL - Other values
4044 * are reserved
4045 *
4046 * The memory ID implicitly defines the characteristics of the
4047 * memory. Characteristics may include alignment type, permissions,
4048 * etc.
4049 *
4050 * SHMEM8_4K is shared memory, byte addressable, and 4 KB aligned.
4051 */
4052
4053
4054 u16 num_regions;
4055 /* Number of regions to map.*/
4056
4057 u32 property_flag;
4058/* Configures one common property for all the regions in the
4059 * payload. No two regions in the same memory map regions cmd can
4060 * have differnt property. Supported values: - 0x00000000 to
4061 * 0x00000001
4062 *
4063 * b0 - bit 0 indicates physical or virtual mapping 0 shared memory
4064 * address provided in avs_shared_map_regions_payload is physical
4065 * address. The shared memory needs to be mapped( hardware TLB
4066 * entry)
4067 *
4068 * and a software entry needs to be added for internal book keeping.
4069 *
4070 * 1 Shared memory address provided in MayPayload[usRegions] is
4071 * virtual address. The shared memory must not be mapped (since
4072 * hardware TLB entry is already available) but a software entry
4073 * needs to be added for internal book keeping. This can be useful
4074 * if two services with in ADSP is communicating via APR. They can
4075 * now directly communicate via the Virtual address instead of
4076 * Physical address. The virtual regions must be contiguous.
4077 *
4078 * b31-b1 - reserved bits. must be set to zero
4079 */
4080
4081} __packed;
4082
4083struct avs_shared_map_region_payload {
4084 u32 shm_addr_lsw;
4085/* least significant word of shared memory address of the memory
4086 * region to map. It must be contiguous memory, and it must be 4 KB
4087 * aligned.
4088 */
4089
4090 u32 shm_addr_msw;
4091/* most significant word of shared memory address of the memory
4092 * region to map. For 32 bit shared memory address, this field must
4093 * tbe set to zero. For 36 bit shared memory address, bit31 to bit 4
4094 * must be set to zero
4095 */
4096
4097 u32 mem_size_bytes;
4098/* Number of bytes in the region.
4099 *
4100 * The aDSP will always map the regions as virtual contiguous
4101 * memory, but the memory size must be in multiples of 4 KB to avoid
4102 * gaps in the virtually contiguous mapped memory.
4103 */
4104
4105} __packed;
4106
4107struct avs_cmd_shared_mem_unmap_regions {
4108 struct apr_hdr hdr;
4109 u32 mem_map_handle;
4110/* memory map handle returned by ASM_CMD_SHARED_MEM_MAP_REGIONS
4111 * , ADM_CMD_SHARED_MEM_MAP_REGIONS, commands
4112 */
4113
4114} __packed;
4115
4116/* Memory map command response payload used by the
4117 * #ASM_CMDRSP_SHARED_MEM_MAP_REGIONS
4118 * ,#ADM_CMDRSP_SHARED_MEM_MAP_REGIONS
4119 */
4120
4121
4122struct avs_cmdrsp_shared_mem_map_regions {
4123 u32 mem_map_handle;
4124/* A memory map handle encapsulating shared memory attributes is
4125 * returned
4126 */
4127
4128} __packed;
4129
4130/*adsp_audio_memmap_api.h*/
4131
4132/* ASM related data structures */
4133struct asm_wma_cfg {
4134 u16 format_tag;
4135 u16 ch_cfg;
4136 u32 sample_rate;
4137 u32 avg_bytes_per_sec;
4138 u16 block_align;
4139 u16 valid_bits_per_sample;
4140 u32 ch_mask;
4141 u16 encode_opt;
4142 u16 adv_encode_opt;
4143 u32 adv_encode_opt2;
4144 u32 drc_peak_ref;
4145 u32 drc_peak_target;
4146 u32 drc_ave_ref;
4147 u32 drc_ave_target;
4148} __packed;
4149
4150struct asm_wmapro_cfg {
4151 u16 format_tag;
4152 u16 ch_cfg;
4153 u32 sample_rate;
4154 u32 avg_bytes_per_sec;
4155 u16 block_align;
4156 u16 valid_bits_per_sample;
4157 u32 ch_mask;
4158 u16 encode_opt;
4159 u16 adv_encode_opt;
4160 u32 adv_encode_opt2;
4161 u32 drc_peak_ref;
4162 u32 drc_peak_target;
4163 u32 drc_ave_ref;
4164 u32 drc_ave_target;
4165} __packed;
4166
4167struct asm_aac_cfg {
4168 u16 format;
4169 u16 aot;
4170 u16 ep_config;
4171 u16 section_data_resilience;
4172 u16 scalefactor_data_resilience;
4173 u16 spectral_data_resilience;
4174 u16 ch_cfg;
4175 u16 reserved;
4176 u32 sample_rate;
4177} __packed;
4178
4179struct asm_amrwbplus_cfg {
4180 u32 size_bytes;
4181 u32 version;
4182 u32 num_channels;
4183 u32 amr_band_mode;
4184 u32 amr_dtx_mode;
4185 u32 amr_frame_fmt;
4186 u32 amr_lsf_idx;
4187} __packed;
4188
4189struct asm_flac_cfg {
4190 u32 sample_rate;
4191 u32 ext_sample_rate;
4192 u32 min_frame_size;
4193 u32 max_frame_size;
4194 u16 stream_info_present;
4195 u16 min_blk_size;
4196 u16 max_blk_size;
4197 u16 ch_cfg;
4198 u16 sample_size;
4199 u16 md5_sum;
4200};
4201
4202struct asm_alac_cfg {
4203 u32 frame_length;
4204 u8 compatible_version;
4205 u8 bit_depth;
4206 u8 pb;
4207 u8 mb;
4208 u8 kb;
4209 u8 num_channels;
4210 u16 max_run;
4211 u32 max_frame_bytes;
4212 u32 avg_bit_rate;
4213 u32 sample_rate;
4214 u32 channel_layout_tag;
4215};
4216
4217struct asm_g711_dec_cfg {
4218 u32 sample_rate;
4219};
4220
4221struct asm_vorbis_cfg {
4222 u32 bit_stream_fmt;
4223};
4224
4225struct asm_ape_cfg {
4226 u16 compatible_version;
4227 u16 compression_level;
4228 u32 format_flags;
4229 u32 blocks_per_frame;
4230 u32 final_frame_blocks;
4231 u32 total_frames;
4232 u16 bits_per_sample;
4233 u16 num_channels;
4234 u32 sample_rate;
4235 u32 seek_table_present;
4236};
4237
4238struct asm_dsd_cfg {
4239 u16 num_version;
4240 u16 is_bitwise_big_endian;
4241 u16 dsd_channel_block_size;
4242 u16 num_channels;
4243 u8 channel_mapping[8];
4244 u32 dsd_data_rate;
4245};
4246
4247struct asm_softpause_params {
4248 u32 enable;
4249 u32 period;
4250 u32 step;
4251 u32 rampingcurve;
4252} __packed;
4253
4254struct asm_softvolume_params {
4255 u32 period;
4256 u32 step;
4257 u32 rampingcurve;
4258} __packed;
4259
4260#define ASM_END_POINT_DEVICE_MATRIX 0
4261
4262#define PCM_CHANNEL_NULL 0
4263
4264/* Front left channel. */
4265#define PCM_CHANNEL_FL 1
4266
4267/* Front right channel. */
4268#define PCM_CHANNEL_FR 2
4269
4270/* Front center channel. */
4271#define PCM_CHANNEL_FC 3
4272
4273/* Left surround channel.*/
4274#define PCM_CHANNEL_LS 4
4275
4276/* Right surround channel.*/
4277#define PCM_CHANNEL_RS 5
4278
4279/* Low frequency effect channel. */
4280#define PCM_CHANNEL_LFE 6
4281
4282/* Center surround channel; Rear center channel. */
4283#define PCM_CHANNEL_CS 7
4284
4285/* Left back channel; Rear left channel. */
4286#define PCM_CHANNEL_LB 8
4287
4288/* Right back channel; Rear right channel. */
4289#define PCM_CHANNEL_RB 9
4290
4291/* Top surround channel. */
4292#define PCM_CHANNELS 10
4293
4294/* Center vertical height channel.*/
4295#define PCM_CHANNEL_CVH 11
4296
4297/* Mono surround channel.*/
4298#define PCM_CHANNEL_MS 12
4299
4300/* Front left of center. */
4301#define PCM_CHANNEL_FLC 13
4302
4303/* Front right of center. */
4304#define PCM_CHANNEL_FRC 14
4305
4306/* Rear left of center. */
4307#define PCM_CHANNEL_RLC 15
4308
Rohit kumar4ea92b12019-02-01 18:05:33 +05304309/* Rear right of center. Update PCM_MAX_CHMAP_ID when
4310 * this list is extended.
4311 */
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +05304312#define PCM_CHANNEL_RRC 16
4313
Rohit kumar4ea92b12019-02-01 18:05:33 +05304314/* Max valid channel map index */
4315#define PCM_MAX_CHMAP_ID PCM_CHANNEL_RRC
4316
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +05304317#define PCM_FORMAT_MAX_NUM_CHANNEL 8
4318
4319#define ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V2 0x00010DA5
4320
4321#define ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V3 0x00010DDC
4322
4323#define ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V4 0x0001320C
4324
4325#define ASM_MEDIA_FMT_EVRCB_FS 0x00010BEF
4326
4327#define ASM_MEDIA_FMT_EVRCWB_FS 0x00010BF0
4328
4329#define ASM_MEDIA_FMT_GENERIC_COMPRESSED 0x00013212
4330
4331#define ASM_MAX_EQ_BANDS 12
4332
4333#define ASM_DATA_CMD_MEDIA_FMT_UPDATE_V2 0x00010D98
4334
4335struct asm_data_cmd_media_fmt_update_v2 {
4336u32 fmt_blk_size;
4337 /* Media format block size in bytes.*/
4338} __packed;
4339
4340struct asm_generic_compressed_fmt_blk_t {
4341 struct apr_hdr hdr;
4342 struct asm_data_cmd_media_fmt_update_v2 fmt_blk;
4343
4344 /*
4345 * Channel mapping array of bitstream output.
4346 * Channel[i] mapping describes channel i inside the buffer, where
4347 * i < num_channels. All valid used channels must be
4348 * present at the beginning of the array.
4349 */
4350 uint8_t channel_mapping[8];
4351
4352 /*
4353 * Number of channels of the incoming bitstream.
4354 * Supported values: 1,2,3,4,5,6,7,8
4355 */
4356 uint16_t num_channels;
4357
4358 /*
4359 * Nominal bits per sample value of the incoming bitstream.
4360 * Supported values: 16, 32
4361 */
4362 uint16_t bits_per_sample;
4363
4364 /*
4365 * Nominal sampling rate of the incoming bitstream.
4366 * Supported values: 8000, 11025, 16000, 22050, 24000, 32000,
4367 * 44100, 48000, 88200, 96000, 176400, 192000,
4368 * 352800, 384000
4369 */
4370 uint32_t sampling_rate;
4371
4372} __packed;
4373
4374
4375/* Command to send sample rate & channels for IEC61937 (compressed) or IEC60958
4376 * (pcm) streams. Both audio standards use the same format and are used for
4377 * HDMI or SPDIF.
4378 */
4379#define ASM_DATA_CMD_IEC_60958_MEDIA_FMT 0x0001321E
4380
4381struct asm_iec_compressed_fmt_blk_t {
4382 struct apr_hdr hdr;
4383
4384 /*
4385 * Nominal sampling rate of the incoming bitstream.
4386 * Supported values: 8000, 11025, 16000, 22050, 24000, 32000,
4387 * 44100, 48000, 88200, 96000, 176400, 192000,
4388 * 352800, 384000
4389 */
4390 uint32_t sampling_rate;
4391
4392 /*
4393 * Number of channels of the incoming bitstream.
4394 * Supported values: 1,2,3,4,5,6,7,8
4395 */
4396 uint32_t num_channels;
4397
4398} __packed;
4399
4400struct asm_multi_channel_pcm_fmt_blk_v2 {
4401 struct apr_hdr hdr;
4402 struct asm_data_cmd_media_fmt_update_v2 fmt_blk;
4403
4404 u16 num_channels;
4405 /* Number of channels. Supported values: 1 to 8 */
4406 u16 bits_per_sample;
4407/* Number of bits per sample per channel. * Supported values:
4408 * 16, 24 * When used for playback, the client must send 24-bit
4409 * samples packed in 32-bit words. The 24-bit samples must be placed
4410 * in the most significant 24 bits of the 32-bit word. When used for
4411 * recording, the aDSP sends 24-bit samples packed in 32-bit words.
4412 * The 24-bit samples are placed in the most significant 24 bits of
4413 * the 32-bit word.
4414 */
4415
4416
4417 u32 sample_rate;
4418/* Number of samples per second (in Hertz).
4419 * Supported values: 2000 to 48000
4420 */
4421
4422 u16 is_signed;
4423 /* Flag that indicates the samples are signed (1). */
4424
4425 u16 reserved;
4426 /* reserved field for 32 bit alignment. must be set to zero. */
4427
4428 u8 channel_mapping[8];
4429/* Channel array of size 8.
4430 * Supported values:
4431 * - #PCM_CHANNEL_L
4432 * - #PCM_CHANNEL_R
4433 * - #PCM_CHANNEL_C
4434 * - #PCM_CHANNEL_LS
4435 * - #PCM_CHANNEL_RS
4436 * - #PCM_CHANNEL_LFE
4437 * - #PCM_CHANNEL_CS
4438 * - #PCM_CHANNEL_LB
4439 * - #PCM_CHANNEL_RB
4440 * - #PCM_CHANNELS
4441 * - #PCM_CHANNEL_CVH
4442 * - #PCM_CHANNEL_MS
4443 * - #PCM_CHANNEL_FLC
4444 * - #PCM_CHANNEL_FRC
4445 * - #PCM_CHANNEL_RLC
4446 * - #PCM_CHANNEL_RRC
4447 *
4448 * Channel[i] mapping describes channel I. Each element i of the
4449 * array describes channel I inside the buffer where 0 @le I <
4450 * num_channels. An unused channel is set to zero.
4451 */
4452} __packed;
4453
4454struct asm_multi_channel_pcm_fmt_blk_v3 {
4455 uint16_t num_channels;
4456/*
4457 * Number of channels
4458 * Supported values: 1 to 8
4459 */
4460
4461 uint16_t bits_per_sample;
4462/*
4463 * Number of bits per sample per channel
4464 * Supported values: 16, 24
4465 */
4466
4467 uint32_t sample_rate;
4468/*
4469 * Number of samples per second
4470 * Supported values: 2000 to 48000, 96000,192000 Hz
4471 */
4472
4473 uint16_t is_signed;
4474/* Flag that indicates that PCM samples are signed (1) */
4475
4476 uint16_t sample_word_size;
4477/*
4478 * Size in bits of the word that holds a sample of a channel.
4479 * Supported values: 12,24,32
4480 */
4481
4482 uint8_t channel_mapping[8];
4483/*
4484 * Each element, i, in the array describes channel i inside the buffer where
4485 * 0 <= i < num_channels. Unused channels are set to 0.
4486 */
4487} __packed;
4488
4489struct asm_multi_channel_pcm_fmt_blk_v4 {
4490 uint16_t num_channels;
4491/*
4492 * Number of channels
4493 * Supported values: 1 to 8
4494 */
4495
4496 uint16_t bits_per_sample;
4497/*
4498 * Number of bits per sample per channel
4499 * Supported values: 16, 24, 32
4500 */
4501
4502 uint32_t sample_rate;
4503/*
4504 * Number of samples per second
4505 * Supported values: 2000 to 48000, 96000,192000 Hz
4506 */
4507
4508 uint16_t is_signed;
4509/* Flag that indicates that PCM samples are signed (1) */
4510
4511 uint16_t sample_word_size;
4512/*
4513 * Size in bits of the word that holds a sample of a channel.
4514 * Supported values: 12,24,32
4515 */
4516
4517 uint8_t channel_mapping[8];
4518/*
4519 * Each element, i, in the array describes channel i inside the buffer where
4520 * 0 <= i < num_channels. Unused channels are set to 0.
4521 */
4522 uint16_t endianness;
4523/*
4524 * Flag to indicate the endianness of the pcm sample
4525 * Supported values: 0 - Little endian (all other formats)
4526 * 1 - Big endian (AIFF)
4527 */
4528 uint16_t mode;
4529/*
4530 * Mode to provide additional info about the pcm input data.
4531 * Supported values: 0 - Default QFs (Q15 for 16b, Q23 for packed 24b,
4532 * Q31 for unpacked 24b or 32b)
4533 * 15 - for 16 bit
4534 * 23 - for 24b packed or 8.24 format
4535 * 31 - for 24b unpacked or 32bit
4536 */
4537} __packed;
4538
4539/*
4540 * Payload of the multichannel PCM configuration parameters in
4541 * the ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V3 media format.
4542 */
4543struct asm_multi_channel_pcm_fmt_blk_param_v3 {
4544 struct apr_hdr hdr;
4545 struct asm_data_cmd_media_fmt_update_v2 fmt_blk;
4546 struct asm_multi_channel_pcm_fmt_blk_v3 param;
4547} __packed;
4548
4549/*
4550 * Payload of the multichannel PCM configuration parameters in
4551 * the ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V4 media format.
4552 */
4553struct asm_multi_channel_pcm_fmt_blk_param_v4 {
4554 struct apr_hdr hdr;
4555 struct asm_data_cmd_media_fmt_update_v2 fmt_blk;
4556 struct asm_multi_channel_pcm_fmt_blk_v4 param;
4557} __packed;
4558
4559struct asm_stream_cmd_set_encdec_param {
4560 u32 param_id;
4561 /* ID of the parameter. */
4562
4563 u32 param_size;
4564/* Data size of this parameter, in bytes. The size is a multiple
4565 * of 4 bytes.
4566 */
4567
4568} __packed;
4569
4570struct asm_enc_cfg_blk_param_v2 {
4571 u32 frames_per_buf;
4572/* Number of encoded frames to pack into each buffer.
4573 *
4574 * @note1hang This is only guidance information for the aDSP. The
4575 * number of encoded frames put into each buffer (specified by the
4576 * client) is less than or equal to this number.
4577 */
4578
4579 u32 enc_cfg_blk_size;
4580/* Size in bytes of the encoder configuration block that follows
4581 * this member.
4582 */
4583
4584} __packed;
4585
4586/* @brief Dolby Digital Plus end point configuration structure
4587 */
4588struct asm_dec_ddp_endp_param_v2 {
4589 struct apr_hdr hdr;
4590 struct asm_stream_cmd_set_encdec_param encdec;
4591 int endp_param_value;
4592} __packed;
4593
4594/*
4595 * Payload of the multichannel PCM encoder configuration parameters in
4596 * the ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V4 media format.
4597 */
4598
4599struct asm_multi_channel_pcm_enc_cfg_v4 {
4600 struct apr_hdr hdr;
4601 struct asm_stream_cmd_set_encdec_param encdec;
4602 struct asm_enc_cfg_blk_param_v2 encblk;
4603 uint16_t num_channels;
4604 /*
4605 * Number of PCM channels.
4606 * @values
4607 * - 0 -- Native mode
4608 * - 1 -- 8 channels
4609 * Native mode indicates that encoding must be performed with the number
4610 * of channels at the input.
4611 */
4612 uint16_t bits_per_sample;
4613 /*
4614 * Number of bits per sample per channel.
4615 * @values 16, 24
4616 */
4617 uint32_t sample_rate;
4618 /*
4619 * Number of samples per second.
4620 * @values 0, 8000 to 48000 Hz
4621 * A value of 0 indicates the native sampling rate. Encoding is
4622 * performed at the input sampling rate.
4623 */
4624 uint16_t is_signed;
4625 /*
4626 * Flag that indicates the PCM samples are signed (1). Currently, only
4627 * signed PCM samples are supported.
4628 */
4629 uint16_t sample_word_size;
4630 /*
4631 * The size in bits of the word that holds a sample of a channel.
4632 * @values 16, 24, 32
4633 * 16-bit samples are always placed in 16-bit words:
4634 * sample_word_size = 1.
4635 * 24-bit samples can be placed in 32-bit words or in consecutive
4636 * 24-bit words.
4637 * - If sample_word_size = 32, 24-bit samples are placed in the
4638 * most significant 24 bits of a 32-bit word.
4639 * - If sample_word_size = 24, 24-bit samples are placed in
4640 * 24-bit words. @tablebulletend
4641 */
4642 uint8_t channel_mapping[8];
4643 /*
4644 * Channel mapping array expected at the encoder output.
4645 * Channel[i] mapping describes channel i inside the buffer, where
4646 * 0 @le i < num_channels. All valid used channels must be present at
4647 * the beginning of the array.
4648 * If Native mode is set for the channels, this field is ignored.
4649 * @values See Section @xref{dox:PcmChannelDefs}
4650 */
4651 uint16_t endianness;
4652 /*
4653 * Flag to indicate the endianness of the pcm sample
4654 * Supported values: 0 - Little endian (all other formats)
4655 * 1 - Big endian (AIFF)
4656 */
4657 uint16_t mode;
4658 /*
4659 * Mode to provide additional info about the pcm input data.
4660 * Supported values: 0 - Default QFs (Q15 for 16b, Q23 for packed 24b,
4661 * Q31 for unpacked 24b or 32b)
4662 * 15 - for 16 bit
4663 * 23 - for 24b packed or 8.24 format
4664 * 31 - for 24b unpacked or 32bit
4665 */
4666} __packed;
4667
4668/*
4669 * Payload of the multichannel PCM encoder configuration parameters in
4670 * the ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V3 media format.
4671 */
4672
4673struct asm_multi_channel_pcm_enc_cfg_v3 {
4674 struct apr_hdr hdr;
4675 struct asm_stream_cmd_set_encdec_param encdec;
4676 struct asm_enc_cfg_blk_param_v2 encblk;
4677 uint16_t num_channels;
4678 /*
4679 * Number of PCM channels.
4680 * @values
4681 * - 0 -- Native mode
4682 * - 1 -- 8 channels
4683 * Native mode indicates that encoding must be performed with the number
4684 * of channels at the input.
4685 */
4686 uint16_t bits_per_sample;
4687 /*
4688 * Number of bits per sample per channel.
4689 * @values 16, 24
4690 */
4691 uint32_t sample_rate;
4692 /*
4693 * Number of samples per second.
4694 * @values 0, 8000 to 48000 Hz
4695 * A value of 0 indicates the native sampling rate. Encoding is
4696 * performed at the input sampling rate.
4697 */
4698 uint16_t is_signed;
4699 /*
4700 * Flag that indicates the PCM samples are signed (1). Currently, only
4701 * signed PCM samples are supported.
4702 */
4703 uint16_t sample_word_size;
4704 /*
4705 * The size in bits of the word that holds a sample of a channel.
4706 * @values 16, 24, 32
4707 * 16-bit samples are always placed in 16-bit words:
4708 * sample_word_size = 1.
4709 * 24-bit samples can be placed in 32-bit words or in consecutive
4710 * 24-bit words.
4711 * - If sample_word_size = 32, 24-bit samples are placed in the
4712 * most significant 24 bits of a 32-bit word.
4713 * - If sample_word_size = 24, 24-bit samples are placed in
4714 * 24-bit words. @tablebulletend
4715 */
4716 uint8_t channel_mapping[8];
4717 /*
4718 * Channel mapping array expected at the encoder output.
4719 * Channel[i] mapping describes channel i inside the buffer, where
4720 * 0 @le i < num_channels. All valid used channels must be present at
4721 * the beginning of the array.
4722 * If Native mode is set for the channels, this field is ignored.
4723 * @values See Section @xref{dox:PcmChannelDefs}
4724 */
4725};
4726
4727/* @brief Multichannel PCM encoder configuration structure used
4728 * in the #ASM_PARAM_ID_ENCDEC_ENC_CFG_BLK_V2 command.
4729 */
4730
4731struct asm_multi_channel_pcm_enc_cfg_v2 {
4732 struct apr_hdr hdr;
4733 struct asm_stream_cmd_set_encdec_param encdec;
4734 struct asm_enc_cfg_blk_param_v2 encblk;
4735 uint16_t num_channels;
4736/*< Number of PCM channels.
4737 *
4738 * Supported values: - 0 -- Native mode - 1 -- 8 Native mode
4739 * indicates that encoding must be performed with the number of
4740 * channels at the input.
4741 */
4742
4743 uint16_t bits_per_sample;
4744/*< Number of bits per sample per channel.
4745 * Supported values: 16, 24
4746 */
4747
4748 uint32_t sample_rate;
4749/*< Number of samples per second (in Hertz).
4750 *
4751 * Supported values: 0, 8000 to 48000 A value of 0 indicates the
4752 * native sampling rate. Encoding is performed at the input sampling
4753 * rate.
4754 */
4755
4756 uint16_t is_signed;
4757/*< Specifies whether the samples are signed (1). Currently,
4758 * only signed samples are supported.
4759 */
4760
4761 uint16_t reserved;
4762/*< reserved field for 32 bit alignment. must be set to zero.*/
4763
4764
4765 uint8_t channel_mapping[8];
4766} __packed;
4767
4768#define ASM_MEDIA_FMT_MP3 0x00010BE9
4769#define ASM_MEDIA_FMT_AAC_V2 0x00010DA6
4770
4771/* @xreflabel
4772 * {hdr:AsmMediaFmtDolbyAac} Media format ID for the
4773 * Dolby AAC decoder. This format ID is be used if the client wants
4774 * to use the Dolby AAC decoder to decode MPEG2 and MPEG4 AAC
4775 * contents.
4776 */
4777
4778#define ASM_MEDIA_FMT_DOLBY_AAC 0x00010D86
4779
4780/* Enumeration for the audio data transport stream AAC format. */
4781#define ASM_MEDIA_FMT_AAC_FORMAT_FLAG_ADTS 0
4782
4783/* Enumeration for low overhead audio stream AAC format. */
4784#define ASM_MEDIA_FMT_AAC_FORMAT_FLAG_LOAS 1
4785
4786/* Enumeration for the audio data interchange format
4787 * AAC format.
4788 */
4789#define ASM_MEDIA_FMT_AAC_FORMAT_FLAG_ADIF 2
4790
4791/* Enumeration for the raw AAC format. */
4792#define ASM_MEDIA_FMT_AAC_FORMAT_FLAG_RAW 3
4793
4794/* Enumeration for the AAC LATM format. */
4795#define ASM_MEDIA_FMT_AAC_FORMAT_FLAG_LATM 4
4796
4797#define ASM_MEDIA_FMT_AAC_AOT_LC 2
4798#define ASM_MEDIA_FMT_AAC_AOT_SBR 5
4799#define ASM_MEDIA_FMT_AAC_AOT_PS 29
4800#define ASM_MEDIA_FMT_AAC_AOT_BSAC 22
4801
4802struct asm_aac_fmt_blk_v2 {
4803 struct apr_hdr hdr;
4804 struct asm_data_cmd_media_fmt_update_v2 fmt_blk;
4805
4806 u16 aac_fmt_flag;
4807/* Bitstream format option.
4808 * Supported values:
4809 * - #ASM_MEDIA_FMT_AAC_FORMAT_FLAG_ADTS
4810 * - #ASM_MEDIA_FMT_AAC_FORMAT_FLAG_LOAS
4811 * - #ASM_MEDIA_FMT_AAC_FORMAT_FLAG_ADIF
4812 * - #ASM_MEDIA_FMT_AAC_FORMAT_FLAG_RAW
4813 */
4814
4815 u16 audio_objype;
4816/* Audio Object Type (AOT) present in the AAC stream.
4817 * Supported values:
4818 * - #ASM_MEDIA_FMT_AAC_AOT_LC
4819 * - #ASM_MEDIA_FMT_AAC_AOT_SBR
4820 * - #ASM_MEDIA_FMT_AAC_AOT_BSAC
4821 * - #ASM_MEDIA_FMT_AAC_AOT_PS
4822 * - Otherwise -- Not supported
4823 */
4824
4825 u16 channel_config;
4826/* Number of channels present in the AAC stream.
4827 * Supported values:
4828 * - 1 -- Mono
4829 * - 2 -- Stereo
4830 * - 6 -- 5.1 content
4831 */
4832
4833 u16 total_size_of_PCE_bits;
4834/* greater or equal to zero. * -In case of RAW formats and
4835 * channel config = 0 (PCE), client can send * the bit stream
4836 * containing PCE immediately following this structure * (in-band).
4837 * -This number does not include bits included for 32 bit alignment.
4838 * -If zero, then the PCE info is assumed to be available in the
4839 * audio -bit stream & not in-band.
4840 */
4841
4842 u32 sample_rate;
4843/* Number of samples per second (in Hertz).
4844 *
4845 * Supported values: 8000, 11025, 12000, 16000, 22050, 24000, 32000,
4846 * 44100, 48000
4847 *
4848 * This field must be equal to the sample rate of the AAC-LC
4849 * decoder's output. - For MP4 or 3GP containers, this is indicated
4850 * by the samplingFrequencyIndex field in the AudioSpecificConfig
4851 * element. - For ADTS format, this is indicated by the
4852 * samplingFrequencyIndex in the ADTS fixed header. - For ADIF
4853 * format, this is indicated by the samplingFrequencyIndex in the
4854 * program_config_element present in the ADIF header.
4855 */
4856
4857} __packed;
4858
4859struct asm_aac_enc_cfg_v2 {
4860 struct apr_hdr hdr;
4861 struct asm_stream_cmd_set_encdec_param encdec;
4862 struct asm_enc_cfg_blk_param_v2 encblk;
4863
4864 u32 bit_rate;
4865 /* Encoding rate in bits per second. */
4866 u32 enc_mode;
4867/* Encoding mode.
4868 * Supported values:
4869 * - #ASM_MEDIA_FMT_AAC_AOT_LC
4870 * - #ASM_MEDIA_FMT_AAC_AOT_SBR
4871 * - #ASM_MEDIA_FMT_AAC_AOT_PS
4872 */
4873 u16 aac_fmt_flag;
4874/* AAC format flag.
4875 * Supported values:
4876 * - #ASM_MEDIA_FMT_AAC_FORMAT_FLAG_ADTS
4877 * - #ASM_MEDIA_FMT_AAC_FORMAT_FLAG_RAW
4878 */
4879 u16 channel_cfg;
4880/* Number of channels to encode.
4881 * Supported values:
4882 * - 0 -- Native mode
4883 * - 1 -- Mono
4884 * - 2 -- Stereo
4885 * - Other values are not supported.
4886 * @note1hang The eAAC+ encoder mode supports only stereo.
4887 * Native mode indicates that encoding must be performed with the
4888 * number of channels at the input.
4889 * The number of channels must not change during encoding.
4890 */
4891
4892 u32 sample_rate;
4893/* Number of samples per second.
4894 * Supported values: - 0 -- Native mode - For other values,
4895 * Native mode indicates that encoding must be performed with the
4896 * sampling rate at the input.
4897 * The sampling rate must not change during encoding.
4898 */
4899
4900} __packed;
4901
4902#define ASM_MEDIA_FMT_G711_ALAW_FS 0x00010BF7
4903#define ASM_MEDIA_FMT_G711_MLAW_FS 0x00010C2E
4904
4905struct asm_g711_enc_cfg_v2 {
4906 struct apr_hdr hdr;
4907 struct asm_stream_cmd_set_encdec_param encdec;
4908 struct asm_enc_cfg_blk_param_v2 encblk;
4909
4910 u32 sample_rate;
4911/*
4912 * Number of samples per second.
4913 * Supported values: 8000, 16000 Hz
4914 */
4915
4916} __packed;
4917
4918struct asm_vorbis_fmt_blk_v2 {
4919 struct apr_hdr hdr;
4920 struct asm_data_cmd_media_fmt_update_v2 fmtblk;
4921 u32 bit_stream_fmt;
4922/* Bit stream format.
4923 * Supported values:
4924 * - 0 -- Raw bitstream
4925 * - 1 -- Transcoded bitstream
4926 *
4927 * Transcoded bitstream containing the size of the frame as the first
4928 * word in each frame.
4929 */
4930
4931} __packed;
4932
4933struct asm_flac_fmt_blk_v2 {
4934 struct apr_hdr hdr;
4935 struct asm_data_cmd_media_fmt_update_v2 fmtblk;
4936
4937 u16 is_stream_info_present;
4938/* Specifies whether stream information is present in the FLAC format
4939 * block.
4940 *
4941 * Supported values:
4942 * - 0 -- Stream information is not present in this message
4943 * - 1 -- Stream information is present in this message
4944 *
4945 * When set to 1, the FLAC bitstream was successfully parsed by the
4946 * client, and other fields in the FLAC format block can be read by the
4947 * decoder to get metadata stream information.
4948 */
4949
4950 u16 num_channels;
4951/* Number of channels for decoding.
4952 * Supported values: 1 to 2
4953 */
4954
4955 u16 min_blk_size;
4956/* Minimum block size (in samples) used in the stream. It must be less
4957 * than or equal to max_blk_size.
4958 */
4959
4960 u16 max_blk_size;
4961/* Maximum block size (in samples) used in the stream. If the
4962 * minimum block size equals the maximum block size, a fixed block
4963 * size stream is implied.
4964 */
4965
4966 u16 md5_sum[8];
4967/* MD5 signature array of the unencoded audio data. This allows the
4968 * decoder to determine if an error exists in the audio data, even when
4969 * the error does not result in an invalid bitstream.
4970 */
4971
4972 u32 sample_rate;
4973/* Number of samples per second.
4974 * Supported values: 8000 to 48000 Hz
4975 */
4976
4977 u32 min_frame_size;
4978/* Minimum frame size used in the stream.
4979 * Supported values:
4980 * - > 0 bytes
4981 * - 0 -- The value is unknown
4982 */
4983
4984 u32 max_frame_size;
4985/* Maximum frame size used in the stream.
4986 * Supported values:
4987 * -- > 0 bytes
4988 * -- 0 . The value is unknown
4989 */
4990
4991 u16 sample_size;
4992/* Bits per sample.Supported values: 8, 16 */
4993
4994 u16 reserved;
4995/* Clients must set this field to zero
4996 */
4997
4998} __packed;
4999
5000struct asm_alac_fmt_blk_v2 {
5001 struct apr_hdr hdr;
5002 struct asm_data_cmd_media_fmt_update_v2 fmtblk;
5003
5004 u32 frame_length;
5005 u8 compatible_version;
5006 u8 bit_depth;
5007 u8 pb;
5008 u8 mb;
5009 u8 kb;
5010 u8 num_channels;
5011 u16 max_run;
5012 u32 max_frame_bytes;
5013 u32 avg_bit_rate;
5014 u32 sample_rate;
5015 u32 channel_layout_tag;
5016
5017} __packed;
5018
5019struct asm_g711_dec_fmt_blk_v2 {
5020 struct apr_hdr hdr;
5021 struct asm_data_cmd_media_fmt_update_v2 fmtblk;
5022 u32 sample_rate;
5023} __packed;
5024
5025struct asm_ape_fmt_blk_v2 {
5026 struct apr_hdr hdr;
5027 struct asm_data_cmd_media_fmt_update_v2 fmtblk;
5028
5029 u16 compatible_version;
5030 u16 compression_level;
5031 u32 format_flags;
5032 u32 blocks_per_frame;
5033 u32 final_frame_blocks;
5034 u32 total_frames;
5035 u16 bits_per_sample;
5036 u16 num_channels;
5037 u32 sample_rate;
5038 u32 seek_table_present;
5039
5040} __packed;
5041
5042struct asm_dsd_fmt_blk_v2 {
5043 struct apr_hdr hdr;
5044 struct asm_data_cmd_media_fmt_update_v2 fmtblk;
5045
5046 u16 num_version;
5047 u16 is_bitwise_big_endian;
5048 u16 dsd_channel_block_size;
5049 u16 num_channels;
5050 u8 channel_mapping[8];
5051 u32 dsd_data_rate;
5052
5053} __packed;
5054
5055#define ASM_MEDIA_FMT_AMRNB_FS 0x00010BEB
5056
5057/* Enumeration for 4.75 kbps AMR-NB Encoding mode. */
5058#define ASM_MEDIA_FMT_AMRNB_FS_ENCODE_MODE_MR475 0
5059
5060/* Enumeration for 5.15 kbps AMR-NB Encoding mode. */
5061#define ASM_MEDIA_FMT_AMRNB_FS_ENCODE_MODE_MR515 1
5062
5063/* Enumeration for 5.90 kbps AMR-NB Encoding mode. */
5064#define ASM_MEDIA_FMT_AMRNB_FS_ENCODE_MODE_MMR59 2
5065
5066/* Enumeration for 6.70 kbps AMR-NB Encoding mode. */
5067#define ASM_MEDIA_FMT_AMRNB_FS_ENCODE_MODE_MMR67 3
5068
5069/* Enumeration for 7.40 kbps AMR-NB Encoding mode. */
5070#define ASM_MEDIA_FMT_AMRNB_FS_ENCODE_MODE_MMR74 4
5071
5072/* Enumeration for 7.95 kbps AMR-NB Encoding mode. */
5073#define ASM_MEDIA_FMT_AMRNB_FS_ENCODE_MODE_MMR795 5
5074
5075/* Enumeration for 10.20 kbps AMR-NB Encoding mode. */
5076#define ASM_MEDIA_FMT_AMRNB_FS_ENCODE_MODE_MMR102 6
5077
5078/* Enumeration for 12.20 kbps AMR-NB Encoding mode. */
5079#define ASM_MEDIA_FMT_AMRNB_FS_ENCODE_MODE_MMR122 7
5080
5081/* Enumeration for AMR-NB Discontinuous Transmission mode off. */
5082#define ASM_MEDIA_FMT_AMRNB_FS_DTX_MODE_OFF 0
5083
5084/* Enumeration for AMR-NB DTX mode VAD1. */
5085#define ASM_MEDIA_FMT_AMRNB_FS_DTX_MODE_VAD1 1
5086
5087/* Enumeration for AMR-NB DTX mode VAD2. */
5088#define ASM_MEDIA_FMT_AMRNB_FS_DTX_MODE_VAD2 2
5089
5090/* Enumeration for AMR-NB DTX mode auto. */
5091#define ASM_MEDIA_FMT_AMRNB_FS_DTX_MODE_AUTO 3
5092
5093struct asm_amrnb_enc_cfg {
5094 struct apr_hdr hdr;
5095 struct asm_stream_cmd_set_encdec_param encdec;
5096 struct asm_enc_cfg_blk_param_v2 encblk;
5097
5098 u16 enc_mode;
5099/* AMR-NB encoding rate.
5100 * Supported values:
5101 * Use the ASM_MEDIA_FMT_AMRNB_FS_ENCODE_MODE_*
5102 * macros
5103 */
5104
5105 u16 dtx_mode;
5106/* Specifies whether DTX mode is disabled or enabled.
5107 * Supported values:
5108 * - #ASM_MEDIA_FMT_AMRNB_FS_DTX_MODE_OFF
5109 * - #ASM_MEDIA_FMT_AMRNB_FS_DTX_MODE_VAD1
5110 */
5111} __packed;
5112
5113#define ASM_MEDIA_FMT_AMRWB_FS 0x00010BEC
5114
5115/* Enumeration for 6.6 kbps AMR-WB Encoding mode. */
5116#define ASM_MEDIA_FMT_AMRWB_FS_ENCODE_MODE_MR66 0
5117
5118/* Enumeration for 8.85 kbps AMR-WB Encoding mode. */
5119#define ASM_MEDIA_FMT_AMRWB_FS_ENCODE_MODE_MR885 1
5120
5121/* Enumeration for 12.65 kbps AMR-WB Encoding mode. */
5122#define ASM_MEDIA_FMT_AMRWB_FS_ENCODE_MODE_MR1265 2
5123
5124/* Enumeration for 14.25 kbps AMR-WB Encoding mode. */
5125#define ASM_MEDIA_FMT_AMRWB_FS_ENCODE_MODE_MR1425 3
5126
5127/* Enumeration for 15.85 kbps AMR-WB Encoding mode. */
5128#define ASM_MEDIA_FMT_AMRWB_FS_ENCODE_MODE_MR1585 4
5129
5130/* Enumeration for 18.25 kbps AMR-WB Encoding mode. */
5131#define ASM_MEDIA_FMT_AMRWB_FS_ENCODE_MODE_MR1825 5
5132
5133/* Enumeration for 19.85 kbps AMR-WB Encoding mode. */
5134#define ASM_MEDIA_FMT_AMRWB_FS_ENCODE_MODE_MR1985 6
5135
5136/* Enumeration for 23.05 kbps AMR-WB Encoding mode. */
5137#define ASM_MEDIA_FMT_AMRWB_FS_ENCODE_MODE_MR2305 7
5138
5139/* Enumeration for 23.85 kbps AMR-WB Encoding mode. */
5140#define ASM_MEDIA_FMT_AMRWB_FS_ENCODE_MODE_MR2385 8
5141
5142struct asm_amrwb_enc_cfg {
5143 struct apr_hdr hdr;
5144 struct asm_stream_cmd_set_encdec_param encdec;
5145 struct asm_enc_cfg_blk_param_v2 encblk;
5146
5147 u16 enc_mode;
5148/* AMR-WB encoding rate.
5149 * Suupported values:
5150 * Use the ASM_MEDIA_FMT_AMRWB_FS_ENCODE_MODE_*
5151 * macros
5152 */
5153
5154 u16 dtx_mode;
5155/* Specifies whether DTX mode is disabled or enabled.
5156 * Supported values:
5157 * - #ASM_MEDIA_FMT_AMRNB_FS_DTX_MODE_OFF
5158 * - #ASM_MEDIA_FMT_AMRNB_FS_DTX_MODE_VAD1
5159 */
5160} __packed;
5161
5162#define ASM_MEDIA_FMT_V13K_FS 0x00010BED
5163
5164/* Enumeration for 14.4 kbps V13K Encoding mode. */
5165#define ASM_MEDIA_FMT_V13K_FS_ENCODE_MODE_MR1440 0
5166
5167/* Enumeration for 12.2 kbps V13K Encoding mode. */
5168#define ASM_MEDIA_FMT_V13K_FS_ENCODE_MODE_MR1220 1
5169
5170/* Enumeration for 11.2 kbps V13K Encoding mode. */
5171#define ASM_MEDIA_FMT_V13K_FS_ENCODE_MODE_MR1120 2
5172
5173/* Enumeration for 9.0 kbps V13K Encoding mode. */
5174#define ASM_MEDIA_FMT_V13K_FS_ENCODE_MODE_MR90 3
5175
5176/* Enumeration for 7.2 kbps V13K eEncoding mode. */
5177#define ASM_MEDIA_FMT_V13K_FS_ENCODE_MODE_MR720 4
5178
5179/* Enumeration for 1/8 vocoder rate.*/
5180#define ASM_MEDIA_FMT_VOC_ONE_EIGHTH_RATE 1
5181
5182/* Enumeration for 1/4 vocoder rate. */
5183#define ASM_MEDIA_FMT_VOC_ONE_FOURTH_RATE 2
5184
5185/* Enumeration for 1/2 vocoder rate. */
5186#define ASM_MEDIA_FMT_VOC_HALF_RATE 3
5187
5188/* Enumeration for full vocoder rate. */
5189#define ASM_MEDIA_FMT_VOC_FULL_RATE 4
5190
5191struct asm_v13k_enc_cfg {
5192 struct apr_hdr hdr;
5193 struct asm_stream_cmd_set_encdec_param encdec;
5194 struct asm_enc_cfg_blk_param_v2 encblk;
5195 u16 max_rate;
5196/* Maximum allowed encoder frame rate.
5197 * Supported values:
5198 * - #ASM_MEDIA_FMT_VOC_ONE_EIGHTH_RATE
5199 * - #ASM_MEDIA_FMT_VOC_ONE_FOURTH_RATE
5200 * - #ASM_MEDIA_FMT_VOC_HALF_RATE
5201 * - #ASM_MEDIA_FMT_VOC_FULL_RATE
5202 */
5203
5204 u16 min_rate;
5205/* Minimum allowed encoder frame rate.
5206 * Supported values:
5207 * - #ASM_MEDIA_FMT_VOC_ONE_EIGHTH_RATE
5208 * - #ASM_MEDIA_FMT_VOC_ONE_FOURTH_RATE
5209 * - #ASM_MEDIA_FMT_VOC_HALF_RATE
5210 * - #ASM_MEDIA_FMT_VOC_FULL_RATE
5211 */
5212
5213 u16 reduced_rate_cmd;
5214/* Reduced rate command, used to change
5215 * the average bitrate of the V13K
5216 * vocoder.
5217 * Supported values:
5218 * - #ASM_MEDIA_FMT_V13K_FS_ENCODE_MODE_MR1440 (Default)
5219 * - #ASM_MEDIA_FMT_V13K_FS_ENCODE_MODE_MR1220
5220 * - #ASM_MEDIA_FMT_V13K_FS_ENCODE_MODE_MR1120
5221 * - #ASM_MEDIA_FMT_V13K_FS_ENCODE_MODE_MR90
5222 * - #ASM_MEDIA_FMT_V13K_FS_ENCODE_MODE_MR720
5223 */
5224
5225 u16 rate_mod_cmd;
5226/* Rate modulation command. Default = 0.
5227 *- If bit 0=1, rate control is enabled.
5228 *- If bit 1=1, the maximum number of consecutive full rate
5229 * frames is limited with numbers supplied in
5230 * bits 2 to 10.
5231 *- If bit 1=0, the minimum number of non-full rate frames
5232 * in between two full rate frames is forced to
5233 * the number supplied in bits 2 to 10. In both cases, if necessary,
5234 * half rate is used to substitute full rate. - Bits 15 to 10 are
5235 * reserved and must all be set to zero.
5236 */
5237
5238} __packed;
5239
5240#define ASM_MEDIA_FMT_EVRC_FS 0x00010BEE
5241
5242/* EVRC encoder configuration structure used in the
5243 * #ASM_PARAM_ID_ENCDEC_ENC_CFG_BLK_V2 command.
5244 */
5245struct asm_evrc_enc_cfg {
5246 struct apr_hdr hdr;
5247 struct asm_stream_cmd_set_encdec_param encdec;
5248 struct asm_enc_cfg_blk_param_v2 encblk;
5249 u16 max_rate;
5250/* Maximum allowed encoder frame rate.
5251 * Supported values:
5252 * - #ASM_MEDIA_FMT_VOC_ONE_EIGHTH_RATE
5253 * - #ASM_MEDIA_FMT_VOC_ONE_FOURTH_RATE
5254 * - #ASM_MEDIA_FMT_VOC_HALF_RATE
5255 * - #ASM_MEDIA_FMT_VOC_FULL_RATE
5256 */
5257
5258 u16 min_rate;
5259/* Minimum allowed encoder frame rate.
5260 * Supported values:
5261 * - #ASM_MEDIA_FMT_VOC_ONE_EIGHTH_RATE
5262 * - #ASM_MEDIA_FMT_VOC_ONE_FOURTH_RATE
5263 * - #ASM_MEDIA_FMT_VOC_HALF_RATE
5264 * - #ASM_MEDIA_FMT_VOC_FULL_RATE
5265 */
5266
5267 u16 rate_mod_cmd;
5268/* Rate modulation command. Default: 0.
5269 * - If bit 0=1, rate control is enabled.
5270 * - If bit 1=1, the maximum number of consecutive full rate frames
5271 * is limited with numbers supplied in bits 2 to 10.
5272 *
5273 * - If bit 1=0, the minimum number of non-full rate frames in
5274 * between two full rate frames is forced to the number supplied in
5275 * bits 2 to 10. In both cases, if necessary, half rate is used to
5276 * substitute full rate.
5277 *
5278 * - Bits 15 to 10 are reserved and must all be set to zero.
5279 */
5280
5281 u16 reserved;
5282 /* Reserved. Clients must set this field to zero. */
5283} __packed;
5284
5285#define ASM_MEDIA_FMT_WMA_V10PRO_V2 0x00010DA7
5286
5287struct asm_wmaprov10_fmt_blk_v2 {
5288 struct apr_hdr hdr;
5289 struct asm_data_cmd_media_fmt_update_v2 fmtblk;
5290
5291 u16 fmtag;
5292/* WMA format type.
5293 * Supported values:
5294 * - 0x162 -- WMA 9 Pro
5295 * - 0x163 -- WMA 9 Pro Lossless
5296 * - 0x166 -- WMA 10 Pro
5297 * - 0x167 -- WMA 10 Pro Lossless
5298 */
5299
5300 u16 num_channels;
5301/* Number of channels encoded in the input stream.
5302 * Supported values: 1 to 8
5303 */
5304
5305 u32 sample_rate;
5306/* Number of samples per second (in Hertz).
5307 * Supported values: 11025, 16000, 22050, 32000, 44100, 48000,
5308 * 88200, 96000
5309 */
5310
5311 u32 avg_bytes_per_sec;
5312/* Bitrate expressed as the average bytes per second.
5313 * Supported values: 2000 to 96000
5314 */
5315
5316 u16 blk_align;
5317/* Size of the bitstream packet size in bytes. WMA Pro files
5318 * have a payload of one block per bitstream packet.
5319 * Supported values: @le 13376
5320 */
5321
5322 u16 bits_per_sample;
5323/* Number of bits per sample in the encoded WMA stream.
5324 * Supported values: 16, 24
5325 */
5326
5327 u32 channel_mask;
5328/* Bit-packed double word (32-bits) that indicates the
5329 * recommended speaker positions for each source channel.
5330 */
5331
5332 u16 enc_options;
5333/* Bit-packed word with values that indicate whether certain
5334 * features of the bitstream are used.
5335 * Supported values: - 0x0001 -- ENCOPT3_PURE_LOSSLESS - 0x0006 --
5336 * ENCOPT3_FRM_SIZE_MOD - 0x0038 -- ENCOPT3_SUBFRM_DIV - 0x0040 --
5337 * ENCOPT3_WRITE_FRAMESIZE_IN_HDR - 0x0080 --
5338 * ENCOPT3_GENERATE_DRC_PARAMS - 0x0100 -- ENCOPT3_RTMBITS
5339 */
5340
5341
5342 u16 usAdvancedEncodeOpt;
5343 /* Advanced encoding option. */
5344
5345 u32 advanced_enc_options2;
5346 /* Advanced encoding option 2. */
5347
5348} __packed;
5349
5350#define ASM_MEDIA_FMT_WMA_V9_V2 0x00010DA8
5351struct asm_wmastdv9_fmt_blk_v2 {
5352 struct apr_hdr hdr;
5353 struct asm_data_cmd_media_fmt_update_v2 fmtblk;
5354 u16 fmtag;
5355/* WMA format tag.
5356 * Supported values: 0x161 (WMA 9 standard)
5357 */
5358
5359 u16 num_channels;
5360/* Number of channels in the stream.
5361 * Supported values: 1, 2
5362 */
5363
5364 u32 sample_rate;
5365/* Number of samples per second (in Hertz).
5366 * Supported values: 48000
5367 */
5368
5369 u32 avg_bytes_per_sec;
5370 /* Bitrate expressed as the average bytes per second. */
5371
5372 u16 blk_align;
5373/* Block align. All WMA files with a maximum packet size of
5374 * 13376 are supported.
5375 */
5376
5377
5378 u16 bits_per_sample;
5379/* Number of bits per sample in the output.
5380 * Supported values: 16
5381 */
5382
5383 u32 channel_mask;
5384/* Channel mask.
5385 * Supported values:
5386 * - 3 -- Stereo (front left/front right)
5387 * - 4 -- Mono (center)
5388 */
5389
5390 u16 enc_options;
5391 /* Options used during encoding. */
5392
5393 u16 reserved;
5394
5395} __packed;
5396
5397#define ASM_MEDIA_FMT_WMA_V8 0x00010D91
5398
5399struct asm_wmastdv8_enc_cfg {
5400 struct apr_hdr hdr;
5401 struct asm_stream_cmd_set_encdec_param encdec;
5402 struct asm_enc_cfg_blk_param_v2 encblk;
5403 u32 bit_rate;
5404 /* Encoding rate in bits per second. */
5405
5406 u32 sample_rate;
5407/* Number of samples per second.
5408 *
5409 * Supported values:
5410 * - 0 -- Native mode
5411 * - Other Supported values are 22050, 32000, 44100, and 48000.
5412 *
5413 * Native mode indicates that encoding must be performed with the
5414 * sampling rate at the input.
5415 * The sampling rate must not change during encoding.
5416 */
5417
5418 u16 channel_cfg;
5419/* Number of channels to encode.
5420 * Supported values:
5421 * - 0 -- Native mode
5422 * - 1 -- Mono
5423 * - 2 -- Stereo
5424 * - Other values are not supported.
5425 *
5426 * Native mode indicates that encoding must be performed with the
5427 * number of channels at the input.
5428 * The number of channels must not change during encoding.
5429 */
5430
5431 u16 reserved;
5432 /* Reserved. Clients must set this field to zero.*/
5433 } __packed;
5434
5435#define ASM_MEDIA_FMT_AMR_WB_PLUS_V2 0x00010DA9
5436
5437struct asm_amrwbplus_fmt_blk_v2 {
5438 struct apr_hdr hdr;
5439 struct asm_data_cmd_media_fmt_update_v2 fmtblk;
5440 u32 amr_frame_fmt;
5441/* AMR frame format.
5442 * Supported values:
5443 * - 6 -- Transport Interface Format (TIF)
5444 * - Any other value -- File storage format (FSF)
5445 *
5446 * TIF stream contains 2-byte header for each frame within the
5447 * superframe. FSF stream contains one 2-byte header per superframe.
5448 */
5449
5450} __packed;
5451
5452#define ASM_MEDIA_FMT_AC3 0x00010DEE
5453#define ASM_MEDIA_FMT_EAC3 0x00010DEF
5454#define ASM_MEDIA_FMT_DTS 0x00010D88
5455#define ASM_MEDIA_FMT_MP2 0x00010DE9
5456#define ASM_MEDIA_FMT_FLAC 0x00010C16
5457#define ASM_MEDIA_FMT_ALAC 0x00012F31
5458#define ASM_MEDIA_FMT_VORBIS 0x00010C15
5459#define ASM_MEDIA_FMT_APE 0x00012F32
5460#define ASM_MEDIA_FMT_DSD 0x00012F3E
5461#define ASM_MEDIA_FMT_TRUEHD 0x00013215
5462/* 0x0 is used for fomat ID since ADSP dynamically determines the
5463 * format encapsulated in the IEC61937 (compressed) or IEC60958
5464 * (pcm) packets.
5465 */
5466#define ASM_MEDIA_FMT_IEC 0x00000000
5467
5468/* Media format ID for adaptive transform acoustic coding. This
5469 * ID is used by the #ASM_STREAM_CMD_OPEN_WRITE_COMPRESSED command
5470 * only.
5471 */
5472
5473#define ASM_MEDIA_FMT_ATRAC 0x00010D89
5474
5475/* Media format ID for metadata-enhanced audio transmission.
5476 * This ID is used by the #ASM_STREAM_CMD_OPEN_WRITE_COMPRESSED
5477 * command only.
5478 */
5479
5480#define ASM_MEDIA_FMT_MAT 0x00010D8A
5481
5482/* adsp_media_fmt.h */
5483
5484#define ASM_DATA_CMD_WRITE_V2 0x00010DAB
5485
5486struct asm_data_cmd_write_v2 {
5487 struct apr_hdr hdr;
5488 u32 buf_addr_lsw;
5489/* The 64 bit address msw-lsw should be a valid, mapped address.
5490 * 64 bit address should be a multiple of 32 bytes
5491 */
5492
5493 u32 buf_addr_msw;
5494/* The 64 bit address msw-lsw should be a valid, mapped address.
5495 * 64 bit address should be a multiple of 32 bytes.
5496 * -Address of the buffer containing the data to be decoded.
5497 * The buffer should be aligned to a 32 byte boundary.
5498 * -In the case of 32 bit Shared memory address, msw field must
5499 * -be set to zero.
5500 * -In the case of 36 bit shared memory address, bit 31 to bit 4
5501 * -of msw must be set to zero.
5502 */
5503 u32 mem_map_handle;
5504/* memory map handle returned by DSP through
5505 * ASM_CMD_SHARED_MEM_MAP_REGIONS command
5506 */
5507 u32 buf_size;
5508/* Number of valid bytes available in the buffer for decoding. The
5509 * first byte starts at buf_addr.
5510 */
5511
5512 u32 seq_id;
5513 /* Optional buffer sequence ID. */
5514
5515 u32 timestamp_lsw;
5516/* Lower 32 bits of the 64-bit session time in microseconds of the
5517 * first buffer sample.
5518 */
5519
5520 u32 timestamp_msw;
5521/* Upper 32 bits of the 64-bit session time in microseconds of the
5522 * first buffer sample.
5523 */
5524
5525 u32 flags;
5526/* Bitfield of flags.
5527 * Supported values for bit 31:
5528 * - 1 -- Valid timestamp.
5529 * - 0 -- Invalid timestamp.
5530 * - Use #ASM_BIT_MASKIMESTAMP_VALID_FLAG as the bitmask and
5531 * #ASM_SHIFTIMESTAMP_VALID_FLAG as the shift value to set this bit.
5532 * Supported values for bit 30:
5533 * - 1 -- Last buffer.
5534 * - 0 -- Not the last buffer.
5535 *
5536 * Supported values for bit 29:
5537 * - 1 -- Continue the timestamp from the previous buffer.
5538 * - 0 -- Timestamp of the current buffer is not related
5539 * to the timestamp of the previous buffer.
5540 * - Use #ASM_BIT_MASKS_CONTINUE_FLAG and #ASM_SHIFTS_CONTINUE_FLAG
5541 * to set this bit.
5542 *
5543 * Supported values for bit 4:
5544 * - 1 -- End of the frame.
5545 * - 0 -- Not the end of frame, or this information is not known.
5546 * - Use #ASM_BIT_MASK_EOF_FLAG as the bitmask and #ASM_SHIFT_EOF_FLAG
5547 * as the shift value to set this bit.
5548 *
5549 * All other bits are reserved and must be set to 0.
5550 *
5551 * If bit 31=0 and bit 29=1: The timestamp of the first sample in
5552 * this buffer continues from the timestamp of the last sample in
5553 * the previous buffer. If there is no previous buffer (i.e., this
5554 * is the first buffer sent after opening the stream or after a
5555 * flush operation), or if the previous buffer does not have a valid
5556 * timestamp, the samples in the current buffer also do not have a
5557 * valid timestamp. They are played out as soon as possible.
5558 *
5559 *
5560 * If bit 31=0 and bit 29=0: No timestamp is associated with the
5561 * first sample in this buffer. The samples are played out as soon
5562 * as possible.
5563 *
5564 *
5565 * If bit 31=1 and bit 29 is ignored: The timestamp specified in
5566 * this payload is honored.
5567 *
5568 *
5569 * If bit 30=0: Not the last buffer in the stream. This is useful
5570 * in removing trailing samples.
5571 *
5572 *
5573 * For bit 4: The client can set this flag for every buffer sent in
5574 * which the last byte is the end of a frame. If this flag is set,
5575 * the buffer can contain data from multiple frames, but it should
5576 * always end at a frame boundary. Restrictions allow the aDSP to
5577 * detect an end of frame without requiring additional processing.
5578 */
5579
5580} __packed;
5581
5582#define ASM_DATA_CMD_READ_V2 0x00010DAC
5583
5584struct asm_data_cmd_read_v2 {
5585 struct apr_hdr hdr;
5586 u32 buf_addr_lsw;
5587/* the 64 bit address msw-lsw should be a valid mapped address
5588 * and should be a multiple of 32 bytes
5589 */
5590
5591
5592 u32 buf_addr_msw;
5593/* the 64 bit address msw-lsw should be a valid mapped address
5594 * and should be a multiple of 32 bytes.
5595 * - Address of the buffer where the DSP puts the encoded data,
5596 * potentially, at an offset specified by the uOffset field in
5597 * ASM_DATA_EVENT_READ_DONE structure. The buffer should be aligned
5598 * to a 32 byte boundary.
5599 * - In the case of 32 bit Shared memory address, msw field must
5600 * - be set to zero.
5601 * - In the case of 36 bit shared memory address, bit 31 to bit
5602 * - 4 of msw must be set to zero.
5603 */
5604 u32 mem_map_handle;
5605/* memory map handle returned by DSP through
5606 * ASM_CMD_SHARED_MEM_MAP_REGIONS command.
5607 */
5608
5609 u32 buf_size;
5610/* Number of bytes available for the aDSP to write. The aDSP
5611 * starts writing from buf_addr.
5612 */
5613
5614 u32 seq_id;
5615 /* Optional buffer sequence ID. */
5616} __packed;
5617
5618#define ASM_DATA_CMD_EOS 0x00010BDB
5619#define ASM_DATA_EVENT_RENDERED_EOS 0x00010C1C
5620#define ASM_DATA_EVENT_EOS 0x00010BDD
5621
5622#define ASM_DATA_EVENT_WRITE_DONE_V2 0x00010D99
5623struct asm_data_event_write_done_v2 {
5624 u32 buf_addr_lsw;
5625 /* lsw of the 64 bit address */
5626 u32 buf_addr_msw;
5627 /* msw of the 64 bit address. address given by the client in
5628 * ASM_DATA_CMD_WRITE_V2 command.
5629 */
5630 u32 mem_map_handle;
5631 /* memory map handle in the ASM_DATA_CMD_WRITE_V2 */
5632
5633 u32 status;
5634/* Status message (error code) that indicates whether the
5635 * referenced buffer has been successfully consumed.
5636 * Supported values: Refer to @xhyperref{Q3,[Q3]}
5637 */
5638} __packed;
5639
5640#define ASM_DATA_EVENT_READ_DONE_V2 0x00010D9A
5641
5642/* Definition of the frame metadata flag bitmask.*/
5643#define ASM_BIT_MASK_FRAME_METADATA_FLAG (0x40000000UL)
5644
5645/* Definition of the frame metadata flag shift value. */
5646#define ASM_SHIFT_FRAME_METADATA_FLAG 30
5647
5648struct asm_data_event_read_done_v2 {
5649 u32 status;
5650/* Status message (error code).
5651 * Supported values: Refer to @xhyperref{Q3,[Q3]}
5652 */
5653
5654u32 buf_addr_lsw;
5655/* 64 bit address msw-lsw is a valid, mapped address. 64 bit
5656 * address is a multiple of 32 bytes.
5657 */
5658
5659u32 buf_addr_msw;
5660/* 64 bit address msw-lsw is a valid, mapped address. 64 bit
5661 * address is a multiple of 32 bytes.
5662 *
5663 * -Same address provided by the client in ASM_DATA_CMD_READ_V2
5664 * -In the case of 32 bit Shared memory address, msw field is set to
5665 * zero.
5666 * -In the case of 36 bit shared memory address, bit 31 to bit 4
5667 * -of msw is set to zero.
5668 */
5669
5670u32 mem_map_handle;
5671/* memory map handle in the ASM_DATA_CMD_READ_V2 */
5672
5673u32 enc_framesotal_size;
5674/* Total size of the encoded frames in bytes.
5675 * Supported values: >0
5676 */
5677
5678u32 offset;
5679/* Offset (from buf_addr) to the first byte of the first encoded
5680 * frame. All encoded frames are consecutive, starting from this
5681 * offset.
5682 * Supported values: > 0
5683 */
5684
5685u32 timestamp_lsw;
5686/* Lower 32 bits of the 64-bit session time in microseconds of
5687 * the first sample in the buffer. If Bit 5 of mode_flags flag of
5688 * ASM_STREAM_CMD_OPEN_READ_V2 is 1 then the 64 bit timestamp is
5689 * absolute capture time otherwise it is relative session time. The
5690 * absolute timestamp doesn't reset unless the system is reset.
5691 */
5692
5693
5694u32 timestamp_msw;
5695/* Upper 32 bits of the 64-bit session time in microseconds of
5696 * the first sample in the buffer.
5697 */
5698
5699
5700u32 flags;
5701/* Bitfield of flags. Bit 30 indicates whether frame metadata is
5702 * present. If frame metadata is present, num_frames consecutive
5703 * instances of @xhyperref{hdr:FrameMetaData,Frame metadata} start
5704 * at the buffer address.
5705 * Supported values for bit 31:
5706 * - 1 -- Timestamp is valid.
5707 * - 0 -- Timestamp is invalid.
5708 * - Use #ASM_BIT_MASKIMESTAMP_VALID_FLAG and
5709 * #ASM_SHIFTIMESTAMP_VALID_FLAG to set this bit.
5710 *
5711 * Supported values for bit 30:
5712 * - 1 -- Frame metadata is present.
5713 * - 0 -- Frame metadata is absent.
5714 * - Use #ASM_BIT_MASK_FRAME_METADATA_FLAG and
5715 * #ASM_SHIFT_FRAME_METADATA_FLAG to set this bit.
5716 *
5717 * All other bits are reserved; the aDSP sets them to 0.
5718 */
5719
5720u32 num_frames;
5721/* Number of encoded frames in the buffer. */
5722
5723u32 seq_id;
5724/* Optional buffer sequence ID. */
5725} __packed;
5726
5727struct asm_data_read_buf_metadata_v2 {
5728 u32 offset;
5729/* Offset from buf_addr in #ASM_DATA_EVENT_READ_DONE_PAYLOAD to
5730 * the frame associated with this metadata.
5731 * Supported values: > 0
5732 */
5733
5734u32 frm_size;
5735/* Size of the encoded frame in bytes.
5736 * Supported values: > 0
5737 */
5738
5739u32 num_encoded_pcm_samples;
5740/* Number of encoded PCM samples (per channel) in the frame
5741 * associated with this metadata.
5742 * Supported values: > 0
5743 */
5744
5745u32 timestamp_lsw;
5746/* Lower 32 bits of the 64-bit session time in microseconds of the
5747 * first sample for this frame.
5748 * If Bit 5 of mode_flags flag of ASM_STREAM_CMD_OPEN_READ_V2 is 1
5749 * then the 64 bit timestamp is absolute capture time otherwise it
5750 * is relative session time. The absolute timestamp doesn't reset
5751 * unless the system is reset.
5752 */
5753
5754
5755u32 timestamp_msw;
5756/* Lower 32 bits of the 64-bit session time in microseconds of the
5757 * first sample for this frame.
5758 */
5759
5760u32 flags;
5761/* Frame flags.
5762 * Supported values for bit 31:
5763 * - 1 -- Time stamp is valid
5764 * - 0 -- Time stamp is not valid
5765 * - All other bits are reserved; the aDSP sets them to 0.
5766 */
5767} __packed;
5768
5769/* Notifies the client of a change in the data sampling rate or
5770 * Channel mode. This event is raised by the decoder service. The
5771 * event is enabled through the mode flags of
5772 * #ASM_STREAM_CMD_OPEN_WRITE_V2 or
5773 * #ASM_STREAM_CMD_OPEN_READWRITE_V2. - The decoder detects a change
5774 * in the output sampling frequency or the number/positioning of
5775 * output channels, or if it is the first frame decoded.The new
5776 * sampling frequency or the new channel configuration is
5777 * communicated back to the client asynchronously.
5778 */
5779
5780#define ASM_DATA_EVENT_SR_CM_CHANGE_NOTIFY 0x00010C65
5781
5782/* Payload of the #ASM_DATA_EVENT_SR_CM_CHANGE_NOTIFY event.
5783 * This event is raised when the following conditions are both true:
5784 * - The event is enabled through the mode_flags of
5785 * #ASM_STREAM_CMD_OPEN_WRITE_V2 or
5786 * #ASM_STREAM_CMD_OPEN_READWRITE_V2. - The decoder detects a change
5787 * in either the output sampling frequency or the number/positioning
5788 * of output channels, or if it is the first frame decoded.
5789 * This event is not raised (even if enabled) if the decoder is
5790 * MIDI, because
5791 */
5792
5793
5794struct asm_data_event_sr_cm_change_notify {
5795 u32 sample_rate;
5796/* New sampling rate (in Hertz) after detecting a change in the
5797 * bitstream.
5798 * Supported values: 2000 to 48000
5799 */
5800
5801 u16 num_channels;
5802/* New number of channels after detecting a change in the
5803 * bitstream.
5804 * Supported values: 1 to 8
5805 */
5806
5807
5808 u16 reserved;
5809 /* Reserved for future use. This field must be set to 0.*/
5810
5811 u8 channel_mapping[8];
5812
5813} __packed;
5814
5815/* Notifies the client of a data sampling rate or channel mode
5816 * change. This event is raised by the encoder service.
5817 * This event is raised when :
5818 * - Native mode encoding was requested in the encoder
5819 * configuration (i.e., the channel number was 0), the sample rate
5820 * was 0, or both were 0.
5821 *
5822 * - The input data frame at the encoder is the first one, or the
5823 * sampling rate/channel mode is different from the previous input
5824 * data frame.
5825 *
5826 */
5827#define ASM_DATA_EVENT_ENC_SR_CM_CHANGE_NOTIFY 0x00010BDE
5828
5829struct asm_data_event_enc_sr_cm_change_notify {
5830 u32 sample_rate;
5831/* New sampling rate (in Hertz) after detecting a change in the
5832 * input data.
5833 * Supported values: 2000 to 48000
5834 */
5835
5836
5837 u16 num_channels;
5838/* New number of channels after detecting a change in the input
5839 * data. Supported values: 1 to 8
5840 */
5841
5842
5843 u16 bits_per_sample;
5844/* New bits per sample after detecting a change in the input
5845 * data.
5846 * Supported values: 16, 24
5847 */
5848
5849
5850 u8 channel_mapping[8];
5851
5852} __packed;
5853#define ASM_DATA_CMD_IEC_60958_FRAME_RATE 0x00010D87
5854
5855
5856/* Payload of the #ASM_DATA_CMD_IEC_60958_FRAME_RATE command,
5857 * which is used to indicate the IEC 60958 frame rate of a given
5858 * packetized audio stream.
5859 */
5860
5861struct asm_data_cmd_iec_60958_frame_rate {
5862 u32 frame_rate;
5863/* IEC 60958 frame rate of the incoming IEC 61937 packetized stream.
5864 * Supported values: Any valid frame rate
5865 */
5866} __packed;
5867
5868/* adsp_asm_data_commands.h*/
5869/* Definition of the stream ID bitmask.*/
5870#define ASM_BIT_MASK_STREAM_ID (0x000000FFUL)
5871
5872/* Definition of the stream ID shift value.*/
5873#define ASM_SHIFT_STREAM_ID 0
5874
5875/* Definition of the session ID bitmask.*/
5876#define ASM_BIT_MASK_SESSION_ID (0x0000FF00UL)
5877
5878/* Definition of the session ID shift value.*/
5879#define ASM_SHIFT_SESSION_ID 8
5880
5881/* Definition of the service ID bitmask.*/
5882#define ASM_BIT_MASK_SERVICE_ID (0x00FF0000UL)
5883
5884/* Definition of the service ID shift value.*/
5885#define ASM_SHIFT_SERVICE_ID 16
5886
5887/* Definition of the domain ID bitmask.*/
5888#define ASM_BIT_MASK_DOMAIN_ID (0xFF000000UL)
5889
5890/* Definition of the domain ID shift value.*/
5891#define ASM_SHIFT_DOMAIN_ID 24
5892
5893#define ASM_CMD_SHARED_MEM_MAP_REGIONS 0x00010D92
5894#define ASM_CMDRSP_SHARED_MEM_MAP_REGIONS 0x00010D93
5895#define ASM_CMD_SHARED_MEM_UNMAP_REGIONS 0x00010D94
5896
5897/* adsp_asm_service_commands.h */
5898
5899#define ASM_MAX_SESSION_ID (15)
5900
5901/* Maximum number of sessions.*/
5902#define ASM_MAX_NUM_SESSIONS ASM_MAX_SESSION_ID
5903
5904/* Maximum number of streams per session.*/
5905#define ASM_MAX_STREAMS_PER_SESSION (8)
5906#define ASM_SESSION_CMD_RUN_V2 0x00010DAA
5907#define ASM_SESSION_CMD_RUN_STARTIME_RUN_IMMEDIATE 0
5908#define ASM_SESSION_CMD_RUN_STARTIME_RUN_AT_ABSOLUTEIME 1
5909#define ASM_SESSION_CMD_RUN_STARTIME_RUN_AT_RELATIVEIME 2
5910#define ASM_SESSION_CMD_RUN_STARTIME_RUN_WITH_DELAY 3
5911
5912#define ASM_BIT_MASK_RUN_STARTIME (0x00000003UL)
5913
5914/* Bit shift value used to specify the start time for the
5915 * ASM_SESSION_CMD_RUN_V2 command.
5916 */
5917#define ASM_SHIFT_RUN_STARTIME 0
5918struct asm_session_cmd_run_v2 {
5919 struct apr_hdr hdr;
5920 u32 flags;
5921/* Specifies whether to run immediately or at a specific
5922 * rendering time or with a specified delay. Run with delay is
5923 * useful for delaying in case of ASM loopback opened through
5924 * ASM_STREAM_CMD_OPEN_LOOPBACK_V2. Use #ASM_BIT_MASK_RUN_STARTIME
5925 * and #ASM_SHIFT_RUN_STARTIME to set this 2-bit flag.
5926 *
5927 *
5928 *Bits 0 and 1 can take one of four possible values:
5929 *
5930 *- #ASM_SESSION_CMD_RUN_STARTIME_RUN_IMMEDIATE
5931 *- #ASM_SESSION_CMD_RUN_STARTIME_RUN_AT_ABSOLUTEIME
5932 *- #ASM_SESSION_CMD_RUN_STARTIME_RUN_AT_RELATIVEIME
5933 *- #ASM_SESSION_CMD_RUN_STARTIME_RUN_WITH_DELAY
5934 *
5935 *All other bits are reserved; clients must set them to zero.
5936 */
5937
5938 u32 time_lsw;
5939/* Lower 32 bits of the time in microseconds used to align the
5940 * session origin time. When bits 0-1 of flags is
5941 * ASM_SESSION_CMD_RUN_START_RUN_WITH_DELAY, time lsw is the lsw of
5942 * the delay in us. For ASM_SESSION_CMD_RUN_START_RUN_WITH_DELAY,
5943 * maximum value of the 64 bit delay is 150 ms.
5944 */
5945
5946 u32 time_msw;
5947/* Upper 32 bits of the time in microseconds used to align the
5948 * session origin time. When bits 0-1 of flags is
5949 * ASM_SESSION_CMD_RUN_START_RUN_WITH_DELAY, time msw is the msw of
5950 * the delay in us. For ASM_SESSION_CMD_RUN_START_RUN_WITH_DELAY,
5951 * maximum value of the 64 bit delay is 150 ms.
5952 */
5953
5954} __packed;
5955
5956#define ASM_SESSION_CMD_PAUSE 0x00010BD3
5957#define ASM_SESSION_CMD_SUSPEND 0x00010DEC
5958#define ASM_SESSION_CMD_GET_SESSIONTIME_V3 0x00010D9D
5959#define ASM_SESSION_CMD_REGISTER_FOR_RX_UNDERFLOW_EVENTS 0x00010BD5
5960
5961struct asm_session_cmd_rgstr_rx_underflow {
5962 struct apr_hdr hdr;
5963 u16 enable_flag;
5964/* Specifies whether a client is to receive events when an Rx
5965 * session underflows.
5966 * Supported values:
5967 * - 0 -- Do not send underflow events
5968 * - 1 -- Send underflow events
5969 */
5970 u16 reserved;
5971 /* Reserved. This field must be set to zero.*/
5972} __packed;
5973
5974#define ASM_SESSION_CMD_REGISTER_FORX_OVERFLOW_EVENTS 0x00010BD6
5975
5976struct asm_session_cmd_regx_overflow {
5977 struct apr_hdr hdr;
5978 u16 enable_flag;
5979/* Specifies whether a client is to receive events when a Tx
5980 * session overflows.
5981 * Supported values:
5982 * - 0 -- Do not send overflow events
5983 * - 1 -- Send overflow events
5984 */
5985
5986 u16 reserved;
5987 /* Reserved. This field must be set to zero.*/
5988} __packed;
5989
5990#define ASM_SESSION_EVENT_RX_UNDERFLOW 0x00010C17
5991#define ASM_SESSION_EVENTX_OVERFLOW 0x00010C18
5992#define ASM_SESSION_CMDRSP_GET_SESSIONTIME_V3 0x00010D9E
5993
5994struct asm_session_cmdrsp_get_sessiontime_v3 {
5995 u32 status;
5996 /* Status message (error code).
5997 * Supported values: Refer to @xhyperref{Q3,[Q3]}
5998 */
5999
6000 u32 sessiontime_lsw;
6001 /* Lower 32 bits of the current session time in microseconds.*/
6002
6003 u32 sessiontime_msw;
6004 /* Upper 32 bits of the current session time in microseconds.*/
6005
6006 u32 absolutetime_lsw;
6007/* Lower 32 bits in micro seconds of the absolute time at which
6008 * the * sample corresponding to the above session time gets
6009 * rendered * to hardware. This absolute time may be slightly in the
6010 * future or past.
6011 */
6012
6013
6014 u32 absolutetime_msw;
6015/* Upper 32 bits in micro seconds of the absolute time at which
6016 * the * sample corresponding to the above session time gets
6017 * rendered to * hardware. This absolute time may be slightly in the
6018 * future or past.
6019 */
6020
6021} __packed;
6022
6023#define ASM_SESSION_CMD_ADJUST_SESSION_CLOCK_V2 0x00010D9F
6024
6025struct asm_session_cmd_adjust_session_clock_v2 {
6026 struct apr_hdr hdr;
6027u32 adjustime_lsw;
6028/* Lower 32 bits of the signed 64-bit quantity that specifies the
6029 * adjustment time in microseconds to the session clock.
6030 *
6031 * Positive values indicate advancement of the session clock.
6032 * Negative values indicate delay of the session clock.
6033 */
6034
6035
6036 u32 adjustime_msw;
6037/* Upper 32 bits of the signed 64-bit quantity that specifies
6038 * the adjustment time in microseconds to the session clock.
6039 * Positive values indicate advancement of the session clock.
6040 * Negative values indicate delay of the session clock.
6041 */
6042
6043} __packed;
6044
6045#define ASM_SESSION_CMDRSP_ADJUST_SESSION_CLOCK_V2 0x00010DA0
6046
6047struct asm_session_cmdrsp_adjust_session_clock_v2 {
6048 u32 status;
6049/* Status message (error code).
6050 * Supported values: Refer to @xhyperref{Q3,[Q3]}
6051 * An error means the session clock is not adjusted. In this case,
6052 * the next two fields are irrelevant.
6053 */
6054
6055
6056 u32 actual_adjustime_lsw;
6057/* Lower 32 bits of the signed 64-bit quantity that specifies
6058 * the actual adjustment in microseconds performed by the aDSP.
6059 * A positive value indicates advancement of the session clock. A
6060 * negative value indicates delay of the session clock.
6061 */
6062
6063
6064 u32 actual_adjustime_msw;
6065/* Upper 32 bits of the signed 64-bit quantity that specifies
6066 * the actual adjustment in microseconds performed by the aDSP.
6067 * A positive value indicates advancement of the session clock. A
6068 * negative value indicates delay of the session clock.
6069 */
6070
6071
6072 u32 cmd_latency_lsw;
6073/* Lower 32 bits of the unsigned 64-bit quantity that specifies
6074 * the amount of time in microseconds taken to perform the session
6075 * clock adjustment.
6076 */
6077
6078
6079 u32 cmd_latency_msw;
6080/* Upper 32 bits of the unsigned 64-bit quantity that specifies
6081 * the amount of time in microseconds taken to perform the session
6082 * clock adjustment.
6083 */
6084
6085} __packed;
6086
6087#define ASM_SESSION_CMD_GET_PATH_DELAY_V2 0x00010DAF
6088#define ASM_SESSION_CMDRSP_GET_PATH_DELAY_V2 0x00010DB0
6089
6090struct asm_session_cmdrsp_get_path_delay_v2 {
6091 u32 status;
6092/* Status message (error code). Whether this get delay operation
6093 * is successful or not. Delay value is valid only if status is
6094 * success.
6095 * Supported values: Refer to @xhyperref{Q5,[Q5]}
6096 */
6097
6098 u32 audio_delay_lsw;
6099 /* Upper 32 bits of the aDSP delay in microseconds. */
6100
6101 u32 audio_delay_msw;
6102 /* Lower 32 bits of the aDSP delay in microseconds. */
6103
6104} __packed;
6105
6106/* adsp_asm_session_command.h*/
6107#define ASM_STREAM_CMD_OPEN_WRITE_V3 0x00010DB3
6108
6109#define ASM_LOW_LATENCY_STREAM_SESSION 0x10000000
6110
6111#define ASM_ULTRA_LOW_LATENCY_STREAM_SESSION 0x20000000
6112
6113#define ASM_ULL_POST_PROCESSING_STREAM_SESSION 0x40000000
6114
6115#define ASM_LEGACY_STREAM_SESSION 0
6116
6117
6118struct asm_stream_cmd_open_write_v3 {
6119 struct apr_hdr hdr;
6120 uint32_t mode_flags;
6121/* Mode flags that configure the stream to notify the client
6122 * whenever it detects an SR/CM change at the input to its POPP.
6123 * Supported values for bits 0 to 1:
6124 * - Reserved; clients must set them to zero.
6125 * Supported values for bit 2:
6126 * - 0 -- SR/CM change notification event is disabled.
6127 * - 1 -- SR/CM change notification event is enabled.
6128 * - Use #ASM_BIT_MASK_SR_CM_CHANGE_NOTIFY_FLAG and
6129 * #ASM_SHIFT_SR_CM_CHANGE_NOTIFY_FLAG to set or get this bit.
6130 *
6131 * Supported values for bit 31:
6132 * - 0 -- Stream to be opened in on-Gapless mode.
6133 * - 1 -- Stream to be opened in Gapless mode. In Gapless mode,
6134 * successive streams must be opened with same session ID but
6135 * different stream IDs.
6136 *
6137 * - Use #ASM_BIT_MASK_GAPLESS_MODE_FLAG and
6138 * #ASM_SHIFT_GAPLESS_MODE_FLAG to set or get this bit.
6139 *
6140 *
6141 * @note1hang MIDI and DTMF streams cannot be opened in Gapless mode.
6142 */
6143
6144 uint16_t sink_endpointype;
6145/*< Sink point type.
6146 * Supported values:
6147 * - 0 -- Device matrix
6148 * - Other values are reserved.
6149 *
6150 * The device matrix is the gateway to the hardware ports.
6151 */
6152
6153 uint16_t bits_per_sample;
6154/*< Number of bits per sample processed by ASM modules.
6155 * Supported values: 16 and 24 bits per sample
6156 */
6157
6158 uint32_t postprocopo_id;
6159/*< Specifies the topology (order of processing) of
6160 * postprocessing algorithms. <i>None</i> means no postprocessing.
6161 * Supported values:
6162 * - #ASM_STREAM_POSTPROCOPO_ID_DEFAULT
6163 * - #ASM_STREAM_POSTPROCOPO_ID_MCH_PEAK_VOL
6164 * - #ASM_STREAM_POSTPROCOPO_ID_NONE
6165 *
6166 * This field can also be enabled through SetParams flags.
6167 */
6168
6169 uint32_t dec_fmt_id;
6170/*< Configuration ID of the decoder media format.
6171 *
6172 * Supported values:
6173 * - #ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V2
6174 * - #ASM_MEDIA_FMT_ADPCM
6175 * - #ASM_MEDIA_FMT_MP3
6176 * - #ASM_MEDIA_FMT_AAC_V2
6177 * - #ASM_MEDIA_FMT_DOLBY_AAC
6178 * - #ASM_MEDIA_FMT_AMRNB_FS
6179 * - #ASM_MEDIA_FMT_AMRWB_FS
6180 * - #ASM_MEDIA_FMT_AMR_WB_PLUS_V2
6181 * - #ASM_MEDIA_FMT_V13K_FS
6182 * - #ASM_MEDIA_FMT_EVRC_FS
6183 * - #ASM_MEDIA_FMT_EVRCB_FS
6184 * - #ASM_MEDIA_FMT_EVRCWB_FS
6185 * - #ASM_MEDIA_FMT_SBC
6186 * - #ASM_MEDIA_FMT_WMA_V10PRO_V2
6187 * - #ASM_MEDIA_FMT_WMA_V9_V2
6188 * - #ASM_MEDIA_FMT_AC3
6189 * - #ASM_MEDIA_FMT_EAC3
6190 * - #ASM_MEDIA_FMT_G711_ALAW_FS
6191 * - #ASM_MEDIA_FMT_G711_MLAW_FS
6192 * - #ASM_MEDIA_FMT_G729A_FS
6193 * - #ASM_MEDIA_FMT_FR_FS
6194 * - #ASM_MEDIA_FMT_VORBIS
6195 * - #ASM_MEDIA_FMT_FLAC
6196 * - #ASM_MEDIA_FMT_ALAC
6197 * - #ASM_MEDIA_FMT_APE
6198 * - #ASM_MEDIA_FMT_EXAMPLE
6199 */
6200} __packed;
6201
6202#define ASM_STREAM_CMD_OPEN_PULL_MODE_WRITE 0x00010DD9
6203
6204/* Bitmask for the stream_perf_mode subfield. */
6205#define ASM_BIT_MASK_STREAM_PERF_FLAG_PULL_MODE_WRITE 0xE0000000UL
6206
6207/* Bitmask for the stream_perf_mode subfield. */
6208#define ASM_SHIFT_STREAM_PERF_FLAG_PULL_MODE_WRITE 29
6209
6210#define ASM_STREAM_CMD_OPEN_PUSH_MODE_READ 0x00010DDA
6211
6212#define ASM_BIT_MASK_STREAM_PERF_FLAG_PUSH_MODE_READ 0xE0000000UL
6213
6214#define ASM_SHIFT_STREAM_PERF_FLAG_PUSH_MODE_READ 29
6215
6216#define ASM_DATA_EVENT_WATERMARK 0x00010DDB
6217
6218struct asm_shared_position_buffer {
6219 volatile uint32_t frame_counter;
6220/* Counter used to handle interprocessor synchronization issues.
6221 * When frame_counter is 0: read_index, wall_clock_us_lsw, and
6222 * wall_clock_us_msw are invalid.
6223 * Supported values: >= 0.
6224 */
6225
6226 volatile uint32_t index;
6227/* Index in bytes from where the aDSP is reading/writing.
6228 * Supported values: 0 to circular buffer size - 1
6229 */
6230
6231 volatile uint32_t wall_clock_us_lsw;
6232/* Lower 32 bits of the 64-bit wall clock time in microseconds when the
6233 * read index was updated.
6234 * Supported values: >= 0
6235 */
6236
6237 volatile uint32_t wall_clock_us_msw;
6238/* Upper 32 bits of the 64 bit wall clock time in microseconds when the
6239 * read index was updated
6240 * Supported values: >= 0
6241 */
6242} __packed;
6243
6244struct asm_shared_watermark_level {
6245 uint32_t watermark_level_bytes;
6246} __packed;
6247
6248struct asm_stream_cmd_open_shared_io {
6249 struct apr_hdr hdr;
6250 uint32_t mode_flags;
6251 uint16_t endpoint_type;
6252 uint16_t topo_bits_per_sample;
6253 uint32_t topo_id;
6254 uint32_t fmt_id;
6255 uint32_t shared_pos_buf_phy_addr_lsw;
6256 uint32_t shared_pos_buf_phy_addr_msw;
6257 uint16_t shared_pos_buf_mem_pool_id;
6258 uint16_t shared_pos_buf_num_regions;
6259 uint32_t shared_pos_buf_property_flag;
6260 uint32_t shared_circ_buf_start_phy_addr_lsw;
6261 uint32_t shared_circ_buf_start_phy_addr_msw;
6262 uint32_t shared_circ_buf_size;
6263 uint16_t shared_circ_buf_mem_pool_id;
6264 uint16_t shared_circ_buf_num_regions;
6265 uint32_t shared_circ_buf_property_flag;
6266 uint32_t num_watermark_levels;
6267 struct asm_multi_channel_pcm_fmt_blk_v3 fmt;
6268 struct avs_shared_map_region_payload map_region_pos_buf;
6269 struct avs_shared_map_region_payload map_region_circ_buf;
6270 struct asm_shared_watermark_level watermark[0];
6271} __packed;
6272
6273#define ASM_STREAM_CMD_OPEN_READ_V3 0x00010DB4
6274
6275/* Definition of the timestamp type flag bitmask */
6276#define ASM_BIT_MASKIMESTAMPYPE_FLAG (0x00000020UL)
6277
6278/* Definition of the timestamp type flag shift value. */
6279#define ASM_SHIFTIMESTAMPYPE_FLAG 5
6280
6281/* Relative timestamp is identified by this value.*/
6282#define ASM_RELATIVEIMESTAMP 0
6283
6284/* Absolute timestamp is identified by this value.*/
6285#define ASM_ABSOLUTEIMESTAMP 1
6286
6287/* Bit value for Low Latency Tx stream subfield */
6288#define ASM_LOW_LATENCY_TX_STREAM_SESSION 1
6289
6290/* Bit shift for the stream_perf_mode subfield. */
6291#define ASM_SHIFT_STREAM_PERF_MODE_FLAG_IN_OPEN_READ 29
6292
6293struct asm_stream_cmd_open_read_v3 {
6294 struct apr_hdr hdr;
6295 u32 mode_flags;
6296/* Mode flags that indicate whether meta information per encoded
6297 * frame is to be provided.
6298 * Supported values for bit 4:
6299 *
6300 * - 0 -- Return data buffer contains all encoded frames only; it
6301 * does not contain frame metadata.
6302 *
6303 * - 1 -- Return data buffer contains an array of metadata and
6304 * encoded frames.
6305 *
6306 * - Use #ASM_BIT_MASK_META_INFO_FLAG as the bitmask and
6307 * #ASM_SHIFT_META_INFO_FLAG as the shift value for this bit.
6308 *
6309 *
6310 * Supported values for bit 5:
6311 *
6312 * - ASM_RELATIVEIMESTAMP -- ASM_DATA_EVENT_READ_DONE_V2 will have
6313 * - relative time-stamp.
6314 * - ASM_ABSOLUTEIMESTAMP -- ASM_DATA_EVENT_READ_DONE_V2 will
6315 * - have absolute time-stamp.
6316 *
6317 * - Use #ASM_BIT_MASKIMESTAMPYPE_FLAG as the bitmask and
6318 * #ASM_SHIFTIMESTAMPYPE_FLAG as the shift value for this bit.
6319 *
6320 * All other bits are reserved; clients must set them to zero.
6321 */
6322
6323 u32 src_endpointype;
6324/* Specifies the endpoint providing the input samples.
6325 * Supported values:
6326 * - 0 -- Device matrix
6327 * - All other values are reserved; clients must set them to zero.
6328 * Otherwise, an error is returned.
6329 * The device matrix is the gateway from the tunneled Tx ports.
6330 */
6331
6332 u32 preprocopo_id;
6333/* Specifies the topology (order of processing) of preprocessing
6334 * algorithms. <i>None</i> means no preprocessing.
6335 * Supported values:
6336 * - #ASM_STREAM_PREPROCOPO_ID_DEFAULT
6337 * - #ASM_STREAM_PREPROCOPO_ID_NONE
6338 *
6339 * This field can also be enabled through SetParams flags.
6340 */
6341
6342 u32 enc_cfg_id;
6343/* Media configuration ID for encoded output.
6344 * Supported values:
6345 * - #ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V2
6346 * - #ASM_MEDIA_FMT_AAC_V2
6347 * - #ASM_MEDIA_FMT_AMRNB_FS
6348 * - #ASM_MEDIA_FMT_AMRWB_FS
6349 * - #ASM_MEDIA_FMT_V13K_FS
6350 * - #ASM_MEDIA_FMT_EVRC_FS
6351 * - #ASM_MEDIA_FMT_EVRCB_FS
6352 * - #ASM_MEDIA_FMT_EVRCWB_FS
6353 * - #ASM_MEDIA_FMT_SBC
6354 * - #ASM_MEDIA_FMT_G711_ALAW_FS
6355 * - #ASM_MEDIA_FMT_G711_MLAW_FS
6356 * - #ASM_MEDIA_FMT_G729A_FS
6357 * - #ASM_MEDIA_FMT_EXAMPLE
6358 * - #ASM_MEDIA_FMT_WMA_V8
6359 */
6360
6361 u16 bits_per_sample;
6362/* Number of bits per sample processed by ASM modules.
6363 * Supported values: 16 and 24 bits per sample
6364 */
6365
6366 u16 reserved;
6367/* Reserved for future use. This field must be set to zero.*/
6368} __packed;
6369
6370#define ASM_POPP_OUTPUT_SR_NATIVE_RATE 0
6371
6372/* Enumeration for the maximum sampling rate at the POPP output.*/
6373#define ASM_POPP_OUTPUT_SR_MAX_RATE 48000
6374
6375#define ASM_STREAM_CMD_OPEN_READWRITE_V2 0x00010D8D
6376#define ASM_STREAM_CMD_OPEN_READWRITE_V2 0x00010D8D
6377
6378struct asm_stream_cmd_open_readwrite_v2 {
6379 struct apr_hdr hdr;
6380 u32 mode_flags;
6381/* Mode flags.
6382 * Supported values for bit 2:
6383 * - 0 -- SR/CM change notification event is disabled.
6384 * - 1 -- SR/CM change notification event is enabled. Use
6385 * #ASM_BIT_MASK_SR_CM_CHANGE_NOTIFY_FLAG and
6386 * #ASM_SHIFT_SR_CM_CHANGE_NOTIFY_FLAG to set or
6387 * getting this flag.
6388 *
6389 * Supported values for bit 4:
6390 * - 0 -- Return read data buffer contains all encoded frames only; it
6391 * does not contain frame metadata.
6392 * - 1 -- Return read data buffer contains an array of metadata and
6393 * encoded frames.
6394 *
6395 * All other bits are reserved; clients must set them to zero.
6396 */
6397
6398 u32 postprocopo_id;
6399/* Specifies the topology (order of processing) of postprocessing
6400 * algorithms. <i>None</i> means no postprocessing.
6401 *
6402 * Supported values:
6403 * - #ASM_STREAM_POSTPROCOPO_ID_DEFAULT
6404 * - #ASM_STREAM_POSTPROCOPO_ID_MCH_PEAK_VOL
6405 * - #ASM_STREAM_POSTPROCOPO_ID_NONE
6406 */
6407
6408 u32 dec_fmt_id;
6409/* Specifies the media type of the input data. PCM indicates that
6410 * no decoding must be performed, e.g., this is an NT encoder
6411 * session.
6412 * Supported values:
6413 * - #ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V2
6414 * - #ASM_MEDIA_FMT_ADPCM
6415 * - #ASM_MEDIA_FMT_MP3
6416 * - #ASM_MEDIA_FMT_AAC_V2
6417 * - #ASM_MEDIA_FMT_DOLBY_AAC
6418 * - #ASM_MEDIA_FMT_AMRNB_FS
6419 * - #ASM_MEDIA_FMT_AMRWB_FS
6420 * - #ASM_MEDIA_FMT_V13K_FS
6421 * - #ASM_MEDIA_FMT_EVRC_FS
6422 * - #ASM_MEDIA_FMT_EVRCB_FS
6423 * - #ASM_MEDIA_FMT_EVRCWB_FS
6424 * - #ASM_MEDIA_FMT_SBC
6425 * - #ASM_MEDIA_FMT_WMA_V10PRO_V2
6426 * - #ASM_MEDIA_FMT_WMA_V9_V2
6427 * - #ASM_MEDIA_FMT_AMR_WB_PLUS_V2
6428 * - #ASM_MEDIA_FMT_AC3
6429 * - #ASM_MEDIA_FMT_G711_ALAW_FS
6430 * - #ASM_MEDIA_FMT_G711_MLAW_FS
6431 * - #ASM_MEDIA_FMT_G729A_FS
6432 * - #ASM_MEDIA_FMT_EXAMPLE
6433 */
6434
6435 u32 enc_cfg_id;
6436/* Specifies the media type for the output of the stream. PCM
6437 * indicates that no encoding must be performed, e.g., this is an NT
6438 * decoder session.
6439 * Supported values:
6440 * - #ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V2
6441 * - #ASM_MEDIA_FMT_AAC_V2
6442 * - #ASM_MEDIA_FMT_AMRNB_FS
6443 * - #ASM_MEDIA_FMT_AMRWB_FS
6444 * - #ASM_MEDIA_FMT_V13K_FS
6445 * - #ASM_MEDIA_FMT_EVRC_FS
6446 * - #ASM_MEDIA_FMT_EVRCB_FS
6447 * - #ASM_MEDIA_FMT_EVRCWB_FS
6448 * - #ASM_MEDIA_FMT_SBC
6449 * - #ASM_MEDIA_FMT_G711_ALAW_FS
6450 * - #ASM_MEDIA_FMT_G711_MLAW_FS
6451 * - #ASM_MEDIA_FMT_G729A_FS
6452 * - #ASM_MEDIA_FMT_EXAMPLE
6453 * - #ASM_MEDIA_FMT_WMA_V8
6454 */
6455
6456 u16 bits_per_sample;
6457/* Number of bits per sample processed by ASM modules.
6458 * Supported values: 16 and 24 bits per sample
6459 */
6460
6461 u16 reserved;
6462/* Reserved for future use. This field must be set to zero.*/
6463
6464} __packed;
6465
6466#define ASM_STREAM_CMD_OPEN_LOOPBACK_V2 0x00010D8E
6467struct asm_stream_cmd_open_loopback_v2 {
6468 struct apr_hdr hdr;
6469 u32 mode_flags;
6470/* Mode flags.
6471 * Bit 0-31: reserved; client should set these bits to 0
6472 */
6473 u16 src_endpointype;
6474 /* Endpoint type. 0 = Tx Matrix */
6475 u16 sink_endpointype;
6476 /* Endpoint type. 0 = Rx Matrix */
6477 u32 postprocopo_id;
6478/* Postprocessor topology ID. Specifies the topology of
6479 * postprocessing algorithms.
6480 */
6481
6482 u16 bits_per_sample;
6483/* The number of bits per sample processed by ASM modules
6484 * Supported values: 16 and 24 bits per sample
6485 */
6486 u16 reserved;
6487/* Reserved for future use. This field must be set to zero. */
6488} __packed;
6489
6490
6491#define ASM_STREAM_CMD_OPEN_TRANSCODE_LOOPBACK 0x00010DBA
6492
6493/* Bitmask for the stream's Performance mode. */
6494#define ASM_BIT_MASK_STREAM_PERF_MODE_FLAG_IN_OPEN_TRANSCODE_LOOPBACK \
6495 (0x70000000UL)
6496
6497/* Bit shift for the stream's Performance mode. */
6498#define ASM_SHIFT_STREAM_PERF_MODE_FLAG_IN_OPEN_TRANSCODE_LOOPBACK 28
6499
6500/* Bitmask for the decoder converter enable flag. */
6501#define ASM_BIT_MASK_DECODER_CONVERTER_FLAG (0x00000078UL)
6502
6503/* Shift value for the decoder converter enable flag. */
6504#define ASM_SHIFT_DECODER_CONVERTER_FLAG 3
6505
6506/* Converter mode is None (Default). */
6507#define ASM_CONVERTER_MODE_NONE 0
6508
6509/* Converter mode is DDP-to-DD. */
6510#define ASM_DDP_DD_CONVERTER_MODE 1
6511
6512/* Identifies a special converter mode where source and sink formats
6513 * are the same but postprocessing must applied. Therefore, Decode
6514 * @rarrow Re-encode is necessary.
6515 */
6516#define ASM_POST_PROCESS_CONVERTER_MODE 2
6517
6518
6519struct asm_stream_cmd_open_transcode_loopback_t {
6520 struct apr_hdr hdr;
6521 u32 mode_flags;
6522/* Mode Flags specifies the performance mode in which this stream
6523 * is to be opened.
6524 * Supported values{for bits 30 to 28}(stream_perf_mode flag)
6525 *
6526 * #ASM_LEGACY_STREAM_SESSION -- This mode ensures backward
6527 * compatibility to the original behavior
6528 * of ASM_STREAM_CMD_OPEN_TRANSCODE_LOOPBACK
6529 *
6530 * #ASM_LOW_LATENCY_STREAM_SESSION -- Opens a loopback session by using
6531 * shortened buffers in low latency POPP
6532 * - Recommendation: Do not enable high latency algorithms. They might
6533 * negate the benefits of opening a low latency stream, and they
6534 * might also suffer quality degradation from unexpected jitter.
6535 * - This Low Latency mode is supported only for PCM In and PCM Out
6536 * loopbacks. An error is returned if Low Latency mode is opened for
6537 * other transcode loopback modes.
6538 * - To configure this subfield, use
6539 * ASM_BIT_MASK_STREAM_PERF_MODE_FLAG_IN_OPEN_TRANSCODE_LOOPBACK and
6540 * ASM_SHIFT_STREAM_PERF_MODE_FLAG_IN_OPEN_TRANSCODE_LOOPBACK.
6541 *
6542 * Supported values{for bits 6 to 3} (decoder-converter compatibility)
6543 * #ASM_CONVERTER_MODE_NONE (0x0) -- Default
6544 * #ASM_DDP_DD_CONVERTER_MODE (0x1)
6545 * #ASM_POST_PROCESS_CONVERTER_MODE (0x2)
6546 * 0x3-0xF -- Reserved for future use
6547 * - Use #ASM_BIT_MASK_DECODER_CONVERTER_FLAG and
6548 * ASM_SHIFT_DECODER_CONVERTER_FLAG to set this bit
6549 * All other bits are reserved; clients must set them to 0.
6550 */
6551
6552 u32 src_format_id;
6553/* Specifies the media format of the input audio stream.
6554 *
6555 * Supported values
6556 * - #ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V2
6557 * - #ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V3
6558 * - #ASM_MEDIA_FMT_DTS
6559 * - #ASM_MEDIA_FMT_EAC3_DEC
6560 * - #ASM_MEDIA_FMT_EAC3
6561 * - #ASM_MEDIA_FMT_AC3_DEC
6562 * - #ASM_MEDIA_FMT_AC3
6563 */
6564 u32 sink_format_id;
6565/* Specifies the media format of the output stream.
6566 *
6567 * Supported values
6568 * - #ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V2
6569 * - #ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V3
6570 * - #ASM_MEDIA_FMT_DTS (not supported in Low Latency mode)
6571 * - #ASM_MEDIA_FMT_EAC3_DEC (not supported in Low Latency mode)
6572 * - #ASM_MEDIA_FMT_EAC3 (not supported in Low Latency mode)
6573 * - #ASM_MEDIA_FMT_AC3_DEC (not supported in Low Latency mode)
6574 * - #ASM_MEDIA_FMT_AC3 (not supported in Low Latency mode)
6575 */
6576
6577 u32 audproc_topo_id;
6578/* Postprocessing topology ID, which specifies the topology (order of
6579 * processing) of postprocessing algorithms.
6580 *
6581 * Supported values
6582 * - #ASM_STREAM_POSTPROC_TOPO_ID_DEFAULT
6583 * - #ASM_STREAM_POSTPROC_TOPO_ID_PEAKMETER
6584 * - #ASM_STREAM_POSTPROC_TOPO_ID_MCH_PEAK_VOL
6585 * - #ASM_STREAM_POSTPROC_TOPO_ID_NONE
6586 * Topologies can be added through #ASM_CMD_ADD_TOPOLOGIES.
6587 * This field is ignored for the Converter mode, in which no
6588 * postprocessing is performed.
6589 */
6590
6591 u16 src_endpoint_type;
6592/* Specifies the source endpoint that provides the input samples.
6593 *
6594 * Supported values
6595 * - 0 -- Tx device matrix or stream router (gateway to the hardware
6596 * ports)
6597 * - All other values are reserved
6598 * Clients must set this field to 0. Otherwise, an error is returned.
6599 */
6600
6601 u16 sink_endpoint_type;
6602/* Specifies the sink endpoint type.
6603 *
6604 * Supported values
6605 * - 0 -- Rx device matrix or stream router (gateway to the hardware
6606 * ports)
6607 * - All other values are reserved
6608 * Clients must set this field to 0. Otherwise, an error is returned.
6609 */
6610
6611 u16 bits_per_sample;
6612/* Number of bits per sample processed by the ASM modules.
6613 * Supported values 16, 24
6614 */
6615
6616 u16 reserved;
6617/* This field must be set to 0.
6618 */
6619} __packed;
6620
6621
6622#define ASM_STREAM_CMD_CLOSE 0x00010BCD
6623#define ASM_STREAM_CMD_FLUSH 0x00010BCE
6624
6625
6626#define ASM_STREAM_CMD_FLUSH_READBUFS 0x00010C09
6627#define ASM_STREAM_CMD_SET_PP_PARAMS_V2 0x00010DA1
6628
6629struct asm_stream_cmd_set_pp_params_v2 {
6630 u32 data_payload_addr_lsw;
6631/* LSW of parameter data payload address. Supported values: any. */
6632 u32 data_payload_addr_msw;
6633/* MSW of Parameter data payload address. Supported values: any.
6634 * - Must be set to zero for in-band data.
6635 * - In the case of 32 bit Shared memory address, msw field must be
6636 * - set to zero.
6637 * - In the case of 36 bit shared memory address, bit 31 to bit 4 of
6638 * msw
6639 *
6640 * - must be set to zero.
6641 */
6642 u32 mem_map_handle;
6643/* Supported Values: Any.
6644 * memory map handle returned by DSP through
6645 * ASM_CMD_SHARED_MEM_MAP_REGIONS
6646 * command.
6647 * if mmhandle is NULL, the ParamData payloads are within the
6648 * message payload (in-band).
6649 * If mmhandle is non-NULL, the ParamData payloads begin at the
6650 * address specified in the address msw and lsw (out-of-band).
6651 */
6652
6653 u32 data_payload_size;
6654/* Size in bytes of the variable payload accompanying the
6655 * message, or in shared memory. This field is used for parsing the
6656 * parameter payload.
6657 */
6658} __packed;
6659
6660
6661struct asm_stream_param_data_v2 {
6662 u32 module_id;
6663 /* Unique module ID. */
6664
6665 u32 param_id;
6666 /* Unique parameter ID. */
6667
6668 u16 param_size;
6669/* Data size of the param_id/module_id combination. This is
6670 * a multiple of 4 bytes.
6671 */
6672
6673 u16 reserved;
6674/* Reserved for future enhancements. This field must be set to
6675 * zero.
6676 */
6677
6678} __packed;
6679
6680#define ASM_STREAM_CMD_GET_PP_PARAMS_V2 0x00010DA2
6681
6682struct asm_stream_cmd_get_pp_params_v2 {
6683 u32 data_payload_addr_lsw;
6684 /* LSW of the parameter data payload address. */
6685 u32 data_payload_addr_msw;
6686/* MSW of the parameter data payload address.
6687 * - Size of the shared memory, if specified, shall be large enough
6688 * to contain the whole ParamData payload, including Module ID,
6689 * Param ID, Param Size, and Param Values
6690 * - Must be set to zero for in-band data
6691 * - In the case of 32 bit Shared memory address, msw field must be
6692 * set to zero.
6693 * - In the case of 36 bit shared memory address, bit 31 to bit 4 of
6694 * msw must be set to zero.
6695 */
6696
6697 u32 mem_map_handle;
6698/* Supported Values: Any.
6699 * memory map handle returned by DSP through ASM_CMD_SHARED_MEM_MAP_REGIONS
6700 * command.
6701 * if mmhandle is NULL, the ParamData payloads in the ACK are within the
6702 * message payload (in-band).
6703 * If mmhandle is non-NULL, the ParamData payloads in the ACK begin at the
6704 * address specified in the address msw and lsw.
6705 * (out-of-band).
6706 */
6707
6708 u32 module_id;
6709/* Unique module ID. */
6710
6711 u32 param_id;
6712/* Unique parameter ID. */
6713
6714 u16 param_max_size;
6715/* Maximum data size of the module_id/param_id combination. This
6716 * is a multiple of 4 bytes.
6717 */
6718
6719
6720 u16 reserved;
6721/* Reserved for backward compatibility. Clients must set this
6722 * field to zero.
6723 */
6724} __packed;
6725
6726#define ASM_STREAM_CMD_SET_ENCDEC_PARAM 0x00010C10
6727
6728#define ASM_STREAM_CMD_SET_ENCDEC_PARAM_V2 0x00013218
6729
6730struct asm_stream_cmd_set_encdec_param_v2 {
6731 u16 service_id;
6732 /* 0 - ASM_ENCODER_SVC; 1 - ASM_DECODER_SVC */
6733
6734 u16 reserved;
6735
6736 u32 param_id;
6737 /* ID of the parameter. */
6738
6739 u32 param_size;
6740 /*
6741 * Data size of this parameter, in bytes. The size is a multiple
6742 * of 4 bytes.
6743 */
6744} __packed;
6745
6746#define ASM_STREAM_CMD_REGISTER_ENCDEC_EVENTS 0x00013219
6747
6748#define ASM_STREAM_CMD_ENCDEC_EVENTS 0x0001321A
6749
6750#define AVS_PARAM_ID_RTIC_SHARED_MEMORY_ADDR 0x00013237
6751
6752struct avs_rtic_shared_mem_addr {
6753 struct apr_hdr hdr;
6754 struct asm_stream_cmd_set_encdec_param_v2 encdec;
6755 u32 shm_buf_addr_lsw;
6756 /* Lower 32 bit of the RTIC shared memory */
6757
6758 u32 shm_buf_addr_msw;
6759 /* Upper 32 bit of the RTIC shared memory */
6760
6761 u32 buf_size;
6762 /* Size of buffer */
6763
6764 u16 shm_buf_mem_pool_id;
6765 /* ADSP_MEMORY_MAP_SHMEM8_4K_POOL */
6766
6767 u16 shm_buf_num_regions;
6768 /* number of regions to map */
6769
6770 u32 shm_buf_flag;
6771 /* buffer property flag */
6772
6773 struct avs_shared_map_region_payload map_region;
6774 /* memory map region*/
6775} __packed;
6776
6777#define AVS_PARAM_ID_RTIC_EVENT_ACK 0x00013238
6778
6779struct avs_param_rtic_event_ack {
6780 struct apr_hdr hdr;
6781 struct asm_stream_cmd_set_encdec_param_v2 encdec;
6782} __packed;
6783
6784#define ASM_PARAM_ID_ENCDEC_BITRATE 0x00010C13
6785
6786struct asm_bitrate_param {
6787 u32 bitrate;
6788/* Maximum supported bitrate. Only the AAC encoder is supported.*/
6789
6790} __packed;
6791
6792#define ASM_PARAM_ID_ENCDEC_ENC_CFG_BLK_V2 0x00010DA3
6793#define ASM_PARAM_ID_AAC_SBR_PS_FLAG 0x00010C63
6794
6795/* Flag to turn off both SBR and PS processing, if they are
6796 * present in the bitstream.
6797 */
6798
6799#define ASM_AAC_SBR_OFF_PS_OFF (2)
6800
6801/* Flag to turn on SBR but turn off PS processing,if they are
6802 * present in the bitstream.
6803 */
6804
6805#define ASM_AAC_SBR_ON_PS_OFF (1)
6806
6807/* Flag to turn on both SBR and PS processing, if they are
6808 * present in the bitstream (default behavior).
6809 */
6810
6811
6812#define ASM_AAC_SBR_ON_PS_ON (0)
6813
6814/* Structure for an AAC SBR PS processing flag. */
6815
6816/* Payload of the #ASM_PARAM_ID_AAC_SBR_PS_FLAG parameter in the
6817 * #ASM_STREAM_CMD_SET_ENCDEC_PARAM command.
6818 */
6819struct asm_aac_sbr_ps_flag_param {
6820 struct apr_hdr hdr;
6821 struct asm_stream_cmd_set_encdec_param encdec;
6822 struct asm_enc_cfg_blk_param_v2 encblk;
6823
6824 u32 sbr_ps_flag;
6825/* Control parameter to enable or disable SBR/PS processing in
6826 * the AAC bitstream. Use the following macros to set this field:
6827 * - #ASM_AAC_SBR_OFF_PS_OFF -- Turn off both SBR and PS
6828 * processing, if they are present in the bitstream.
6829 * - #ASM_AAC_SBR_ON_PS_OFF -- Turn on SBR processing, but not PS
6830 * processing, if they are present in the bitstream.
6831 * - #ASM_AAC_SBR_ON_PS_ON -- Turn on both SBR and PS processing,
6832 * if they are present in the bitstream (default behavior).
6833 * - All other values are invalid.
6834 * Changes are applied to the next decoded frame.
6835 */
6836} __packed;
6837
6838#define ASM_PARAM_ID_AAC_DUAL_MONO_MAPPING 0x00010C64
6839
6840/* First single channel element in a dual mono bitstream.*/
6841#define ASM_AAC_DUAL_MONO_MAP_SCE_1 (1)
6842
6843/* Second single channel element in a dual mono bitstream.*/
6844#define ASM_AAC_DUAL_MONO_MAP_SCE_2 (2)
6845
6846/* Structure for AAC decoder dual mono channel mapping. */
6847
6848
6849struct asm_aac_dual_mono_mapping_param {
6850 struct apr_hdr hdr;
6851 struct asm_stream_cmd_set_encdec_param encdec;
6852 u16 left_channel_sce;
6853 u16 right_channel_sce;
6854
6855} __packed;
6856
6857#define ASM_STREAM_CMDRSP_GET_PP_PARAMS_V2 0x00010DA4
6858
6859struct asm_stream_cmdrsp_get_pp_params_v2 {
6860 u32 status;
6861} __packed;
6862
6863#define ASM_PARAM_ID_AC3_KARAOKE_MODE 0x00010D73
6864
6865/* Enumeration for both vocals in a karaoke stream.*/
6866#define AC3_KARAOKE_MODE_NO_VOCAL (0)
6867
6868/* Enumeration for only the left vocal in a karaoke stream.*/
6869#define AC3_KARAOKE_MODE_LEFT_VOCAL (1)
6870
6871/* Enumeration for only the right vocal in a karaoke stream.*/
6872#define AC3_KARAOKE_MODE_RIGHT_VOCAL (2)
6873
6874/* Enumeration for both vocal channels in a karaoke stream.*/
6875#define AC3_KARAOKE_MODE_BOTH_VOCAL (3)
6876#define ASM_PARAM_ID_AC3_DRC_MODE 0x00010D74
6877/* Enumeration for the Custom Analog mode.*/
6878#define AC3_DRC_MODE_CUSTOM_ANALOG (0)
6879
6880/* Enumeration for the Custom Digital mode.*/
6881#define AC3_DRC_MODE_CUSTOM_DIGITAL (1)
6882/* Enumeration for the Line Out mode (light compression).*/
6883#define AC3_DRC_MODE_LINE_OUT (2)
6884
6885/* Enumeration for the RF remodulation mode (heavy compression).*/
6886#define AC3_DRC_MODE_RF_REMOD (3)
6887#define ASM_PARAM_ID_AC3_DUAL_MONO_MODE 0x00010D75
6888
6889/* Enumeration for playing dual mono in stereo mode.*/
6890#define AC3_DUAL_MONO_MODE_STEREO (0)
6891
6892/* Enumeration for playing left mono.*/
6893#define AC3_DUAL_MONO_MODE_LEFT_MONO (1)
6894
6895/* Enumeration for playing right mono.*/
6896#define AC3_DUAL_MONO_MODE_RIGHT_MONO (2)
6897
6898/* Enumeration for mixing both dual mono channels and playing them.*/
6899#define AC3_DUAL_MONO_MODE_MIXED_MONO (3)
6900#define ASM_PARAM_ID_AC3_STEREO_DOWNMIX_MODE 0x00010D76
6901
6902/* Enumeration for using the Downmix mode indicated in the bitstream. */
6903
6904#define AC3_STEREO_DOWNMIX_MODE_AUTO_DETECT (0)
6905
6906/* Enumeration for Surround Compatible mode (preserves the
6907 * surround information).
6908 */
6909
6910#define AC3_STEREO_DOWNMIX_MODE_LT_RT (1)
6911/* Enumeration for Mono Compatible mode (if the output is to be
6912 * further downmixed to mono).
6913 */
6914
6915#define AC3_STEREO_DOWNMIX_MODE_LO_RO (2)
6916
6917/* ID of the AC3 PCM scale factor parameter in the
6918 * #ASM_STREAM_CMD_SET_ENCDEC_PARAM command.
6919 */
6920#define ASM_PARAM_ID_AC3_PCM_SCALEFACTOR 0x00010D78
6921
6922/* ID of the AC3 DRC boost scale factor parameter in the
6923 * #ASM_STREAM_CMD_SET_ENCDEC_PARAM command.
6924 */
6925#define ASM_PARAM_ID_AC3_DRC_BOOST_SCALEFACTOR 0x00010D79
6926
6927/* ID of the AC3 DRC cut scale factor parameter in the
6928 * #ASM_STREAM_CMD_SET_ENCDEC_PARAM command.
6929 */
6930#define ASM_PARAM_ID_AC3_DRC_CUT_SCALEFACTOR 0x00010D7A
6931
6932/* Structure for AC3 Generic Parameter. */
6933
6934/* Payload of the AC3 parameters in the
6935 * #ASM_STREAM_CMD_SET_ENCDEC_PARAM command.
6936 */
6937struct asm_ac3_generic_param {
6938 struct apr_hdr hdr;
6939 struct asm_stream_cmd_set_encdec_param encdec;
6940 struct asm_enc_cfg_blk_param_v2 encblk;
6941 u32 generic_parameter;
6942/* AC3 generic parameter. Select from one of the following
6943 * possible values.
6944 *
6945 * For #ASM_PARAM_ID_AC3_KARAOKE_MODE, supported values are:
6946 * - AC3_KARAOKE_MODE_NO_VOCAL
6947 * - AC3_KARAOKE_MODE_LEFT_VOCAL
6948 * - AC3_KARAOKE_MODE_RIGHT_VOCAL
6949 * - AC3_KARAOKE_MODE_BOTH_VOCAL
6950 *
6951 * For #ASM_PARAM_ID_AC3_DRC_MODE, supported values are:
6952 * - AC3_DRC_MODE_CUSTOM_ANALOG
6953 * - AC3_DRC_MODE_CUSTOM_DIGITAL
6954 * - AC3_DRC_MODE_LINE_OUT
6955 * - AC3_DRC_MODE_RF_REMOD
6956 *
6957 * For #ASM_PARAM_ID_AC3_DUAL_MONO_MODE, supported values are:
6958 * - AC3_DUAL_MONO_MODE_STEREO
6959 * - AC3_DUAL_MONO_MODE_LEFT_MONO
6960 * - AC3_DUAL_MONO_MODE_RIGHT_MONO
6961 * - AC3_DUAL_MONO_MODE_MIXED_MONO
6962 *
6963 * For #ASM_PARAM_ID_AC3_STEREO_DOWNMIX_MODE, supported values are:
6964 * - AC3_STEREO_DOWNMIX_MODE_AUTO_DETECT
6965 * - AC3_STEREO_DOWNMIX_MODE_LT_RT
6966 * - AC3_STEREO_DOWNMIX_MODE_LO_RO
6967 *
6968 * For #ASM_PARAM_ID_AC3_PCM_SCALEFACTOR, supported values are
6969 * 0 to 1 in Q31 format.
6970 *
6971 * For #ASM_PARAM_ID_AC3_DRC_BOOST_SCALEFACTOR, supported values are
6972 * 0 to 1 in Q31 format.
6973 *
6974 * For #ASM_PARAM_ID_AC3_DRC_CUT_SCALEFACTOR, supported values are
6975 * 0 to 1 in Q31 format.
6976 */
6977} __packed;
6978
6979/* Enumeration for Raw mode (no downmixing), which specifies
6980 * that all channels in the bitstream are to be played out as is
6981 * without any downmixing. (Default)
6982 */
6983
6984#define WMAPRO_CHANNEL_MASK_RAW (-1)
6985
6986/* Enumeration for setting the channel mask to 0. The 7.1 mode
6987 * (Home Theater) is assigned.
6988 */
6989
6990
6991#define WMAPRO_CHANNEL_MASK_ZERO 0x0000
6992
6993/* Speaker layout mask for one channel (Home Theater, mono).
6994 * - Speaker front center
6995 */
6996#define WMAPRO_CHANNEL_MASK_1_C 0x0004
6997
6998/* Speaker layout mask for two channels (Home Theater, stereo).
6999 * - Speaker front left
7000 * - Speaker front right
7001 */
7002#define WMAPRO_CHANNEL_MASK_2_L_R 0x0003
7003
7004/* Speaker layout mask for three channels (Home Theater).
7005 * - Speaker front left
7006 * - Speaker front right
7007 * - Speaker front center
7008 */
7009#define WMAPRO_CHANNEL_MASK_3_L_C_R 0x0007
7010
7011/* Speaker layout mask for two channels (stereo).
7012 * - Speaker back left
7013 * - Speaker back right
7014 */
7015#define WMAPRO_CHANNEL_MASK_2_Bl_Br 0x0030
7016
7017/* Speaker layout mask for four channels.
7018 * - Speaker front left
7019 * - Speaker front right
7020 * - Speaker back left
7021 * - Speaker back right
7022 */
7023#define WMAPRO_CHANNEL_MASK_4_L_R_Bl_Br 0x0033
7024
7025/* Speaker layout mask for four channels (Home Theater).
7026 * - Speaker front left
7027 * - Speaker front right
7028 * - Speaker front center
7029 * - Speaker back center
7030 */
7031#define WMAPRO_CHANNEL_MASK_4_L_R_C_Bc_HT 0x0107
7032/* Speaker layout mask for five channels.
7033 * - Speaker front left
7034 * - Speaker front right
7035 * - Speaker front center
7036 * - Speaker back left
7037 * - Speaker back right
7038 */
7039#define WMAPRO_CHANNEL_MASK_5_L_C_R_Bl_Br 0x0037
7040
7041/* Speaker layout mask for five channels (5 mode, Home Theater).
7042 * - Speaker front left
7043 * - Speaker front right
7044 * - Speaker front center
7045 * - Speaker side left
7046 * - Speaker side right
7047 */
7048#define WMAPRO_CHANNEL_MASK_5_L_C_R_Sl_Sr_HT 0x0607
7049/* Speaker layout mask for six channels (5.1 mode).
7050 * - Speaker front left
7051 * - Speaker front right
7052 * - Speaker front center
7053 * - Speaker low frequency
7054 * - Speaker back left
7055 * - Speaker back right
7056 */
7057#define WMAPRO_CHANNEL_MASK_5DOT1_L_C_R_Bl_Br_SLF 0x003F
7058/* Speaker layout mask for six channels (5.1 mode, Home Theater).
7059 * - Speaker front left
7060 * - Speaker front right
7061 * - Speaker front center
7062 * - Speaker low frequency
7063 * - Speaker side left
7064 * - Speaker side right
7065 */
7066#define WMAPRO_CHANNEL_MASK_5DOT1_L_C_R_Sl_Sr_SLF_HT 0x060F
7067/* Speaker layout mask for six channels (5.1 mode, no LFE).
7068 * - Speaker front left
7069 * - Speaker front right
7070 * - Speaker front center
7071 * - Speaker back left
7072 * - Speaker back right
7073 * - Speaker back center
7074 */
7075#define WMAPRO_CHANNEL_MASK_5DOT1_L_C_R_Bl_Br_Bc 0x0137
7076/* Speaker layout mask for six channels (5.1 mode, Home Theater,
7077 * no LFE).
7078 * - Speaker front left
7079 * - Speaker front right
7080 * - Speaker front center
7081 * - Speaker back center
7082 * - Speaker side left
7083 * - Speaker side right
7084 */
7085#define WMAPRO_CHANNEL_MASK_5DOT1_L_C_R_Sl_Sr_Bc_HT 0x0707
7086
7087/* Speaker layout mask for seven channels (6.1 mode).
7088 * - Speaker front left
7089 * - Speaker front right
7090 * - Speaker front center
7091 * - Speaker low frequency
7092 * - Speaker back left
7093 * - Speaker back right
7094 * - Speaker back center
7095 */
7096#define WMAPRO_CHANNEL_MASK_6DOT1_L_C_R_Bl_Br_Bc_SLF 0x013F
7097
7098/* Speaker layout mask for seven channels (6.1 mode, Home
7099 * Theater).
7100 * - Speaker front left
7101 * - Speaker front right
7102 * - Speaker front center
7103 * - Speaker low frequency
7104 * - Speaker back center
7105 * - Speaker side left
7106 * - Speaker side right
7107 */
7108#define WMAPRO_CHANNEL_MASK_6DOT1_L_C_R_Sl_Sr_Bc_SLF_HT 0x070F
7109
7110/* Speaker layout mask for seven channels (6.1 mode, no LFE).
7111 * - Speaker front left
7112 * - Speaker front right
7113 * - Speaker front center
7114 * - Speaker back left
7115 * - Speaker back right
7116 * - Speaker front left of center
7117 * - Speaker front right of center
7118 */
7119#define WMAPRO_CHANNEL_MASK_6DOT1_L_C_R_Bl_Br_SFLOC_SFROC 0x00F7
7120
7121/* Speaker layout mask for seven channels (6.1 mode, Home
7122 * Theater, no LFE).
7123 * - Speaker front left
7124 * - Speaker front right
7125 * - Speaker front center
7126 * - Speaker side left
7127 * - Speaker side right
7128 * - Speaker front left of center
7129 * - Speaker front right of center
7130 */
7131#define WMAPRO_CHANNEL_MASK_6DOT1_L_C_R_Sl_Sr_SFLOC_SFROC_HT 0x0637
7132
7133/* Speaker layout mask for eight channels (7.1 mode).
7134 * - Speaker front left
7135 * - Speaker front right
7136 * - Speaker front center
7137 * - Speaker back left
7138 * - Speaker back right
7139 * - Speaker low frequency
7140 * - Speaker front left of center
7141 * - Speaker front right of center
7142 */
7143#define WMAPRO_CHANNEL_MASK_7DOT1_L_C_R_Bl_Br_SLF_SFLOC_SFROC \
7144 0x00FF
7145
7146/* Speaker layout mask for eight channels (7.1 mode, Home Theater).
7147 * - Speaker front left
7148 * - Speaker front right
7149 * - Speaker front center
7150 * - Speaker side left
7151 * - Speaker side right
7152 * - Speaker low frequency
7153 * - Speaker front left of center
7154 * - Speaker front right of center
7155 *
7156 */
7157#define WMAPRO_CHANNEL_MASK_7DOT1_L_C_R_Sl_Sr_SLF_SFLOC_SFROC_HT \
7158 0x063F
7159
7160#define ASM_PARAM_ID_DEC_OUTPUT_CHAN_MAP 0x00010D82
7161
7162/* Maximum number of decoder output channels. */
7163#define MAX_CHAN_MAP_CHANNELS 16
7164
7165/* Structure for decoder output channel mapping. */
7166
7167/* Payload of the #ASM_PARAM_ID_DEC_OUTPUT_CHAN_MAP parameter in the
7168 * #ASM_STREAM_CMD_SET_ENCDEC_PARAM command.
7169 */
7170struct asm_dec_out_chan_map_param {
7171 struct apr_hdr hdr;
7172 struct asm_stream_cmd_set_encdec_param encdec;
7173 u32 num_channels;
7174/* Number of decoder output channels.
7175 * Supported values: 0 to #MAX_CHAN_MAP_CHANNELS
7176 *
7177 * A value of 0 indicates native channel mapping, which is valid
7178 * only for NT mode. This means the output of the decoder is to be
7179 * preserved as is.
7180 */
7181 u8 channel_mapping[MAX_CHAN_MAP_CHANNELS];
7182} __packed;
7183
7184#define ASM_STREAM_CMD_OPEN_WRITE_COMPRESSED 0x00010D84
7185
7186/* Bitmask for the IEC 61937 enable flag.*/
7187#define ASM_BIT_MASK_IEC_61937_STREAM_FLAG (0x00000001UL)
7188
7189/* Shift value for the IEC 61937 enable flag.*/
7190#define ASM_SHIFT_IEC_61937_STREAM_FLAG 0
7191
7192/* Bitmask for the IEC 60958 enable flag.*/
7193#define ASM_BIT_MASK_IEC_60958_STREAM_FLAG (0x00000002UL)
7194
7195/* Shift value for the IEC 60958 enable flag.*/
7196#define ASM_SHIFT_IEC_60958_STREAM_FLAG 1
7197
7198/* Payload format for open write compressed command */
7199
7200/* Payload format for the #ASM_STREAM_CMD_OPEN_WRITE_COMPRESSED
7201 * command, which opens a stream for a given session ID and stream ID
7202 * to be rendered in the compressed format.
7203 */
7204
7205struct asm_stream_cmd_open_write_compressed {
7206 struct apr_hdr hdr;
7207 u32 flags;
7208/* Mode flags that configure the stream for a specific format.
7209 * Supported values:
7210 * - Bit 0 -- IEC 61937 compatibility
7211 * - 0 -- Stream is not in IEC 61937 format
7212 * - 1 -- Stream is in IEC 61937 format
7213 * - Bit 1 -- IEC 60958 compatibility
7214 * - 0 -- Stream is not in IEC 60958 format
7215 * - 1 -- Stream is in IEC 60958 format
7216 * - Bits 2 to 31 -- 0 (Reserved)
7217 *
7218 * For the same stream, bit 0 cannot be set to 0 and bit 1 cannot
7219 * be set to 1. A compressed stream connot have IEC 60958
7220 * packetization applied without IEC 61937 packetization.
7221 * @note1hang Currently, IEC 60958 packetized input streams are not
7222 * supported.
7223 */
7224
7225
7226 u32 fmt_id;
7227/* Specifies the media type of the HDMI stream to be opened.
7228 * Supported values:
7229 * - #ASM_MEDIA_FMT_AC3
7230 * - #ASM_MEDIA_FMT_EAC3
7231 * - #ASM_MEDIA_FMT_DTS
7232 * - #ASM_MEDIA_FMT_ATRAC
7233 * - #ASM_MEDIA_FMT_MAT
7234 *
7235 * @note1hang This field must be set to a valid media type even if
7236 * IEC 61937 packetization is not performed by the aDSP.
7237 */
7238
7239} __packed;
7240
7241
7242/* Indicates the number of samples per channel to be removed from the
7243 * beginning of the stream.
7244 */
7245#define ASM_DATA_CMD_REMOVE_INITIAL_SILENCE 0x00010D67
7246
7247/* Indicates the number of samples per channel to be removed from
7248 * the end of the stream.
7249 */
7250#define ASM_DATA_CMD_REMOVE_TRAILING_SILENCE 0x00010D68
7251
7252struct asm_data_cmd_remove_silence {
7253 struct apr_hdr hdr;
7254 u32 num_samples_to_remove;
7255 /* < Number of samples per channel to be removed.
7256 * @values 0 to (2@sscr{32}-1)
7257 */
7258} __packed;
7259
7260#define ASM_STREAM_CMD_OPEN_READ_COMPRESSED 0x00010D95
7261
7262struct asm_stream_cmd_open_read_compressed {
7263 struct apr_hdr hdr;
7264 u32 mode_flags;
7265/* Mode flags that indicate whether meta information per encoded
7266 * frame is to be provided.
7267 * Supported values for bit 4:
7268 * - 0 -- Return data buffer contains all encoded frames only; it does
7269 * not contain frame metadata.
7270 * - 1 -- Return data buffer contains an array of metadata and encoded
7271 * frames.
7272 * - Use #ASM_BIT_MASK_META_INFO_FLAG to set the bitmask and
7273 * #ASM_SHIFT_META_INFO_FLAG to set the shift value for this bit.
7274 * All other bits are reserved; clients must set them to zero.
7275 */
7276
7277 u32 frames_per_buf;
7278/* Indicates the number of frames that need to be returned per
7279 * read buffer
7280 * Supported values: should be greater than 0
7281 */
7282
7283} __packed;
7284
7285/* adsp_asm_stream_commands.h*/
7286
7287
7288/* adsp_asm_api.h (no changes)*/
7289#define ASM_STREAM_POSTPROCOPO_ID_DEFAULT \
7290 0x00010BE4
7291#define ASM_STREAM_POSTPROCOPO_ID_PEAKMETER \
7292 0x00010D83
7293#define ASM_STREAM_POSTPROCOPO_ID_NONE \
7294 0x00010C68
7295#define ASM_STREAM_POSTPROCOPO_ID_MCH_PEAK_VOL \
7296 0x00010D8B
7297#define ASM_STREAM_PREPROCOPO_ID_DEFAULT \
7298 ASM_STREAM_POSTPROCOPO_ID_DEFAULT
7299#define ASM_STREAM_PREPROCOPO_ID_NONE \
7300 ASM_STREAM_POSTPROCOPO_ID_NONE
7301#define ADM_CMD_COPP_OPENOPOLOGY_ID_NONE_AUDIO_COPP \
7302 0x00010312
7303#define ADM_CMD_COPP_OPENOPOLOGY_ID_SPEAKER_MONO_AUDIO_COPP \
7304 0x00010313
7305#define ADM_CMD_COPP_OPENOPOLOGY_ID_SPEAKER_STEREO_AUDIO_COPP \
7306 0x00010314
7307#define ADM_CMD_COPP_OPENOPOLOGY_ID_SPEAKER_STEREO_IIR_AUDIO_COPP\
7308 0x00010704
7309#define ADM_CMD_COPP_OPENOPOLOGY_ID_SPEAKER_MONO_AUDIO_COPP_MBDRCV2\
7310 0x0001070D
7311#define ADM_CMD_COPP_OPENOPOLOGY_ID_SPEAKER_STEREO_AUDIO_COPP_MBDRCV2\
7312 0x0001070E
7313#define ADM_CMD_COPP_OPENOPOLOGY_ID_SPEAKER_STEREO_IIR_AUDIO_COPP_MBDRCV2\
7314 0x0001070F
7315#define ADM_CMD_COPP_OPENOPOLOGY_ID_SPEAKER_STEREO_AUDIO_COPP_MBDRC_V3 \
7316 0x11000000
7317#define ADM_CMD_COPP_OPENOPOLOGY_ID_SPEAKER_MCH_PEAK_VOL \
7318 0x0001031B
7319#define ADM_CMD_COPP_OPENOPOLOGY_ID_MIC_MONO_AUDIO_COPP 0x00010315
7320#define ADM_CMD_COPP_OPENOPOLOGY_ID_MIC_STEREO_AUDIO_COPP 0x00010316
7321#define AUDPROC_COPPOPOLOGY_ID_MCHAN_IIR_AUDIO 0x00010715
7322#define ADM_CMD_COPP_OPENOPOLOGY_ID_DEFAULT_AUDIO_COPP 0x00010BE3
7323#define ADM_CMD_COPP_OPENOPOLOGY_ID_PEAKMETER_AUDIO_COPP 0x00010317
7324#define AUDPROC_MODULE_ID_AIG 0x00010716
7325#define AUDPROC_PARAM_ID_AIG_ENABLE 0x00010717
7326#define AUDPROC_PARAM_ID_AIG_CONFIG 0x00010718
7327
7328struct Audio_AigParam {
7329 uint16_t mode;
7330/*< Mode word for enabling AIG/SIG mode .
7331 * Byte offset: 0
7332 */
7333 int16_t staticGainL16Q12;
7334/*< Static input gain when aigMode is set to 1.
7335 * Byte offset: 2
7336 */
7337 int16_t initialGainDBL16Q7;
7338/*<Initial value that the adaptive gain update starts from dB
7339 * Q7 Byte offset: 4
7340 */
7341 int16_t idealRMSDBL16Q7;
7342/*<Average RMS level that AIG attempts to achieve Q8.7
7343 * Byte offset: 6
7344 */
7345 int32_t noiseGateL32;
7346/*Threshold below which signal is considered as noise and AIG
7347 * Byte offset: 8
7348 */
7349 int32_t minGainL32Q15;
7350/*Minimum gain that can be provided by AIG Q16.15
7351 * Byte offset: 12
7352 */
7353 int32_t maxGainL32Q15;
7354/*Maximum gain that can be provided by AIG Q16.15
7355 * Byte offset: 16
7356 */
7357 uint32_t gainAtRtUL32Q31;
7358/*Attack/release time for AIG update Q1.31
7359 * Byte offset: 20
7360 */
7361 uint32_t longGainAtRtUL32Q31;
7362/*Long attack/release time while updating gain for
7363 * noise/silence Q1.31 Byte offset: 24
7364 */
7365
7366 uint32_t rmsTavUL32Q32;
7367/* RMS smoothing time constant used for long-term RMS estimate
7368 * Q0.32 Byte offset: 28
7369 */
7370
7371 uint32_t gainUpdateStartTimMsUL32Q0;
7372/* The waiting time before which AIG starts to apply adaptive
7373 * gain update Q32.0 Byte offset: 32
7374 */
7375
7376} __packed;
7377
7378
7379#define ADM_MODULE_ID_EANS 0x00010C4A
7380#define ADM_PARAM_ID_EANS_ENABLE 0x00010C4B
7381#define ADM_PARAM_ID_EANS_PARAMS 0x00010C4C
7382
7383struct adm_eans_enable {
7384
7385 uint32_t enable_flag;
7386/*< Specifies whether EANS is disabled (0) or enabled
7387 * (nonzero).
7388 * This is supported only for sampling rates of 8, 12, 16, 24, 32,
7389 * and 48 kHz. It is not supported for sampling rates of 11.025,
7390 * 22.05, or 44.1 kHz.
7391 */
7392
7393} __packed;
7394
7395
7396struct adm_eans_params {
7397 int16_t eans_mode;
7398/*< Mode word for enabling/disabling submodules.
7399 * Byte offset: 0
7400 */
7401
7402 int16_t eans_input_gain;
7403/*< Q2.13 input gain to the EANS module.
7404 * Byte offset: 2
7405 */
7406
7407 int16_t eans_output_gain;
7408/*< Q2.13 output gain to the EANS module.
7409 * Byte offset: 4
7410 */
7411
7412 int16_t eansarget_ns;
7413/*< Target noise suppression level in dB.
7414 * Byte offset: 6
7415 */
7416
7417 int16_t eans_s_alpha;
7418/*< Q3.12 over-subtraction factor for stationary noise
7419 * suppression.
7420 * Byte offset: 8
7421 */
7422
7423 int16_t eans_n_alpha;
7424/* < Q3.12 over-subtraction factor for nonstationary noise
7425 * suppression.
7426 * Byte offset: 10
7427 */
7428
7429 int16_t eans_n_alphamax;
7430/*< Q3.12 maximum over-subtraction factor for nonstationary
7431 * noise suppression.
7432 * Byte offset: 12
7433 */
7434 int16_t eans_e_alpha;
7435/*< Q15 scaling factor for excess noise suppression.
7436 * Byte offset: 14
7437 */
7438
7439 int16_t eans_ns_snrmax;
7440/*< Upper boundary in dB for SNR estimation.
7441 * Byte offset: 16
7442 */
7443
7444 int16_t eans_sns_block;
7445/*< Quarter block size for stationary noise suppression.
7446 * Byte offset: 18
7447 */
7448
7449 int16_t eans_ns_i;
7450/*< Initialization block size for noise suppression.
7451 * Byte offset: 20
7452 */
7453 int16_t eans_np_scale;
7454/*< Power scale factor for nonstationary noise update.
7455 * Byte offset: 22
7456 */
7457
7458 int16_t eans_n_lambda;
7459/*< Smoothing factor for higher level nonstationary noise
7460 * update.
7461 * Byte offset: 24
7462 */
7463
7464 int16_t eans_n_lambdaf;
7465/*< Medium averaging factor for noise update.
7466 * Byte offset: 26
7467 */
7468
7469 int16_t eans_gs_bias;
7470/*< Bias factor in dB for gain calculation.
7471 * Byte offset: 28
7472 */
7473
7474 int16_t eans_gs_max;
7475/*< SNR lower boundary in dB for aggressive gain calculation.
7476 * Byte offset: 30
7477 */
7478
7479 int16_t eans_s_alpha_hb;
7480/*< Q3.12 over-subtraction factor for high-band stationary
7481 * noise suppression.
7482 * Byte offset: 32
7483 */
7484
7485 int16_t eans_n_alphamax_hb;
7486/*< Q3.12 maximum over-subtraction factor for high-band
7487 * nonstationary noise suppression.
7488 * Byte offset: 34
7489 */
7490
7491 int16_t eans_e_alpha_hb;
7492/*< Q15 scaling factor for high-band excess noise suppression.
7493 * Byte offset: 36
7494 */
7495
7496 int16_t eans_n_lambda0;
7497/*< Smoothing factor for nonstationary noise update during
7498 * speech activity.
7499 * Byte offset: 38
7500 */
7501
7502 int16_t thresh;
7503/*< Threshold for generating a binary VAD decision.
7504 * Byte offset: 40
7505 */
7506
7507 int16_t pwr_scale;
7508/*< Indirect lower boundary of the noise level estimate.
7509 * Byte offset: 42
7510 */
7511
7512 int16_t hangover_max;
7513/*< Avoids mid-speech clipping and reliably detects weak speech
7514 * bursts at the end of speech activity.
7515 * Byte offset: 44
7516 */
7517
7518 int16_t alpha_snr;
7519/*< Controls responsiveness of the VAD.
7520 * Byte offset: 46
7521 */
7522
7523 int16_t snr_diff_max;
7524/*< Maximum SNR difference. Decreasing this parameter value may
7525 * help in making correct decisions during abrupt changes; however,
7526 * decreasing too much may increase false alarms during long
7527 * pauses/silences.
7528 * Byte offset: 48
7529 */
7530
7531 int16_t snr_diff_min;
7532/*< Minimum SNR difference. Decreasing this parameter value may
7533 * help in making correct decisions during abrupt changes; however,
7534 * decreasing too much may increase false alarms during long
7535 * pauses/silences.
7536 * Byte offset: 50
7537 */
7538
7539 int16_t init_length;
7540/*< Defines the number of frames for which a noise level
7541 * estimate is set to a fixed value.
7542 * Byte offset: 52
7543 */
7544
7545 int16_t max_val;
7546/*< Defines the upper limit of the noise level.
7547 * Byte offset: 54
7548 */
7549
7550 int16_t init_bound;
7551/*< Defines the initial bounding value for the noise level
7552 * estimate. This is used during the initial segment defined by the
7553 * init_length parameter.
7554 * Byte offset: 56
7555 */
7556
7557 int16_t reset_bound;
7558/*< Reset boundary for noise tracking.
7559 * Byte offset: 58
7560 */
7561
7562 int16_t avar_scale;
7563/*< Defines the bias factor in noise estimation.
7564 * Byte offset: 60
7565 */
7566
7567 int16_t sub_nc;
7568/*< Defines the window length for noise estimation.
7569 * Byte offset: 62
7570 */
7571
7572 int16_t spow_min;
7573/*< Defines the minimum signal power required to update the
7574 * boundaries for the noise floor estimate.
7575 * Byte offset: 64
7576 */
7577
7578 int16_t eans_gs_fast;
7579/*< Fast smoothing factor for postprocessor gain.
7580 * Byte offset: 66
7581 */
7582
7583 int16_t eans_gs_med;
7584/*< Medium smoothing factor for postprocessor gain.
7585 * Byte offset: 68
7586 */
7587
7588 int16_t eans_gs_slow;
7589/*< Slow smoothing factor for postprocessor gain.
7590 * Byte offset: 70
7591 */
7592
7593 int16_t eans_swb_salpha;
7594/*< Q3.12 super wideband aggressiveness factor for stationary
7595 * noise suppression.
7596 * Byte offset: 72
7597 */
7598
7599 int16_t eans_swb_nalpha;
7600/*< Q3.12 super wideband aggressiveness factor for
7601 * nonstationary noise suppression.
7602 * Byte offset: 74
7603 */
7604} __packed;
7605#define ADM_MODULE_IDX_MIC_GAIN_CTRL 0x00010C35
7606
7607/* @addtogroup audio_pp_param_ids
7608 * ID of the Tx mic gain control parameter used by the
7609 * #ADM_MODULE_IDX_MIC_GAIN_CTRL module.
7610 * @messagepayload
7611 * @structure{admx_mic_gain}
7612 * @tablespace
7613 * @inputtable{Audio_Postproc_ADM_PARAM_IDX_MIC_GAIN.tex}
7614 */
7615#define ADM_PARAM_IDX_MIC_GAIN 0x00010C36
7616
7617/* Structure for a Tx mic gain parameter for the mic gain
7618 * control module.
7619 */
7620
7621
7622/* @brief Payload of the #ADM_PARAM_IDX_MIC_GAIN parameter in the
7623 * Tx Mic Gain Control module.
7624 */
7625struct admx_mic_gain {
7626 uint16_t tx_mic_gain;
7627 /*< Linear gain in Q13 format. */
7628
7629 uint16_t reserved;
7630 /*< Clients must set this field to zero. */
7631} __packed;
7632
7633struct adm_set_mic_gain_params {
7634 struct adm_cmd_set_pp_params_v5 params;
7635 struct adm_param_data_v5 data;
7636 struct admx_mic_gain mic_gain_data;
7637} __packed;
7638
7639/* end_addtogroup audio_pp_param_ids */
7640
7641/* @ingroup audio_pp_module_ids
7642 * ID of the Rx Codec Gain Control module.
7643 *
7644 * This module supports the following parameter ID:
7645 * - #ADM_PARAM_ID_RX_CODEC_GAIN
7646 */
7647#define ADM_MODULE_ID_RX_CODEC_GAIN_CTRL 0x00010C37
7648
7649/* @addtogroup audio_pp_param_ids
7650 * ID of the Rx codec gain control parameter used by the
7651 * #ADM_MODULE_ID_RX_CODEC_GAIN_CTRL module.
7652 *
7653 * @messagepayload
7654 * @structure{adm_rx_codec_gain}
7655 * @tablespace
7656 * @inputtable{Audio_Postproc_ADM_PARAM_ID_RX_CODEC_GAIN.tex}
7657 */
7658#define ADM_PARAM_ID_RX_CODEC_GAIN 0x00010C38
7659
7660/* Structure for the Rx common codec gain control module. */
7661
7662
7663/* @brief Payload of the #ADM_PARAM_ID_RX_CODEC_GAIN parameter
7664 * in the Rx Codec Gain Control module.
7665 */
7666
7667
7668struct adm_rx_codec_gain {
7669 uint16_t rx_codec_gain;
7670 /* Linear gain in Q13 format. */
7671
7672 uint16_t reserved;
7673 /* Clients must set this field to zero.*/
7674} __packed;
7675
7676/* end_addtogroup audio_pp_param_ids */
7677
7678/* @ingroup audio_pp_module_ids
7679 * ID of the HPF Tuning Filter module on the Tx path.
7680 * This module supports the following parameter IDs:
7681 * - #ADM_PARAM_ID_HPF_IIRX_FILTER_ENABLE_CONFIG
7682 * - #ADM_PARAM_ID_HPF_IIRX_FILTER_PRE_GAIN
7683 * - #ADM_PARAM_ID_HPF_IIRX_FILTER_CONFIG_PARAMS
7684 */
7685#define ADM_MODULE_ID_HPF_IIRX_FILTER 0x00010C3D
7686
7687/* @addtogroup audio_pp_param_ids */
7688/* ID of the Tx HPF IIR filter enable parameter used by the
7689 * #ADM_MODULE_ID_HPF_IIRX_FILTER module.
7690 * @parspace Message payload
7691 * @structure{adm_hpfx_iir_filter_enable_cfg}
7692 * @tablespace
7693 * @inputtable{Audio_Postproc_ADM_PARAM_ID_HPF_IIRX_FILTER_ENABLE_CONFIG.tex}
7694 */
7695#define ADM_PARAM_ID_HPF_IIRX_FILTER_ENABLE_CONFIG 0x00010C3E
7696
7697/* ID of the Tx HPF IIR filter pregain parameter used by the
7698 * #ADM_MODULE_ID_HPF_IIRX_FILTER module.
7699 * @parspace Message payload
7700 * @structure{adm_hpfx_iir_filter_pre_gain}
7701 * @tablespace
7702 * @inputtable{Audio_Postproc_ADM_PARAM_ID_HPF_IIRX_FILTER_PRE_GAIN.tex}
7703 */
7704#define ADM_PARAM_ID_HPF_IIRX_FILTER_PRE_GAIN 0x00010C3F
7705
7706/* ID of the Tx HPF IIR filter configuration parameters used by the
7707 * #ADM_MODULE_ID_HPF_IIRX_FILTER module.
7708 * @parspace Message payload
7709 * @structure{adm_hpfx_iir_filter_cfg_params}
7710 * @tablespace
7711 * @inputtable{Audio_Postproc_ADM_PARAM_ID_HPF_IIRX_FILTER_CONFIG_PA
7712 * RAMS.tex}
7713 */
7714#define ADM_PARAM_ID_HPF_IIRX_FILTER_CONFIG_PARAMS 0x00010C40
7715
7716/* Structure for enabling a configuration parameter for
7717 * the HPF IIR tuning filter module on the Tx path.
7718 */
7719
7720/* @brief Payload of the #ADM_PARAM_ID_HPF_IIRX_FILTER_ENABLE_CONFIG
7721 * parameter in the Tx path HPF Tuning Filter module.
7722 */
7723struct adm_hpfx_iir_filter_enable_cfg {
7724 uint32_t enable_flag;
7725/* Specifies whether the HPF tuning filter is disabled (0) or
7726 * enabled (nonzero).
7727 */
7728} __packed;
7729
7730
7731/* Structure for the pregain parameter for the HPF
7732 * IIR tuning filter module on the Tx path.
7733 */
7734
7735
7736/* @brief Payload of the #ADM_PARAM_ID_HPF_IIRX_FILTER_PRE_GAIN parameter
7737 * in the Tx path HPF Tuning Filter module.
7738 */
7739struct adm_hpfx_iir_filter_pre_gain {
7740 uint16_t pre_gain;
7741 /* Linear gain in Q13 format. */
7742
7743 uint16_t reserved;
7744 /* Clients must set this field to zero.*/
7745} __packed;
7746
7747
7748/* Structure for the configuration parameter for the
7749 * HPF IIR tuning filter module on the Tx path.
7750 */
7751
7752
7753/* @brief Payload of the #ADM_PARAM_ID_HPF_IIRX_FILTER_CONFIG_PARAMS
7754 * parameters in the Tx path HPF Tuning Filter module. \n
7755 * \n
7756 * This structure is followed by tuning filter coefficients as follows: \n
7757 * - Sequence of int32_t FilterCoeffs.
7758 * Each band has five coefficients, each in int32_t format in the order of
7759 * b0, b1, b2, a1, a2.
7760 * - Sequence of int16_t NumShiftFactor.
7761 * One int16_t per band. The numerator shift factor is related to the Q
7762 * factor of the filter coefficients.
7763 * - Sequence of uint16_t PanSetting.
7764 * One uint16_t for each band to indicate application of the filter to
7765 * left (0), right (1), or both (2) channels.
7766 */
7767struct adm_hpfx_iir_filter_cfg_params {
7768 uint16_t num_biquad_stages;
7769/*< Number of bands.
7770 * Supported values: 0 to 20
7771 */
7772
7773 uint16_t reserved;
7774 /*< Clients must set this field to zero.*/
7775} __packed;
7776
7777/* end_addtogroup audio_pp_module_ids */
7778
7779/* @addtogroup audio_pp_module_ids */
7780/* ID of the Tx path IIR Tuning Filter module.
7781 * This module supports the following parameter IDs:
7782 * - #ADM_PARAM_IDX_IIR_FILTER_ENABLE_CONFIG
7783 */
7784#define ADM_MODULE_IDX_IIR_FILTER 0x00010C41
7785
7786/* ID of the Rx path IIR Tuning Filter module for the left channel.
7787 * The parameter IDs of the IIR tuning filter module
7788 * (#ASM_MODULE_ID_IIRUNING_FILTER) are used for the left IIR Rx tuning
7789 * filter.
7790 *
7791 * Pan parameters are not required for this per-channel IIR filter; the pan
7792 * parameters are ignored by this module.
7793 */
7794#define ADM_MODULE_ID_LEFT_IIRUNING_FILTER 0x00010705
7795
7796/* ID of the the Rx path IIR Tuning Filter module for the right
7797 * channel.
7798 * The parameter IDs of the IIR tuning filter module
7799 * (#ASM_MODULE_ID_IIRUNING_FILTER) are used for the right IIR Rx
7800 * tuning filter.
7801 *
7802 * Pan parameters are not required for this per-channel IIR filter;
7803 * the pan parameters are ignored by this module.
7804 */
7805#define ADM_MODULE_ID_RIGHT_IIRUNING_FILTER 0x00010706
7806
7807/* end_addtogroup audio_pp_module_ids */
7808
7809/* @addtogroup audio_pp_param_ids */
7810
7811/* ID of the Tx IIR filter enable parameter used by the
7812 * #ADM_MODULE_IDX_IIR_FILTER module.
7813 * @parspace Message payload
7814 * @structure{admx_iir_filter_enable_cfg}
7815 * @tablespace
7816 * @inputtable{Audio_Postproc_ADM_PARAM_IDX_IIR_FILTER_ENABLE_CONFIG.tex}
7817 */
7818#define ADM_PARAM_IDX_IIR_FILTER_ENABLE_CONFIG 0x00010C42
7819
7820/* ID of the Tx IIR filter pregain parameter used by the
7821 * #ADM_MODULE_IDX_IIR_FILTER module.
7822 * @parspace Message payload
7823 * @structure{admx_iir_filter_pre_gain}
7824 * @tablespace
7825 * @inputtable{Audio_Postproc_ADM_PARAM_IDX_IIR_FILTER_PRE_GAIN.tex}
7826 */
7827#define ADM_PARAM_IDX_IIR_FILTER_PRE_GAIN 0x00010C43
7828
7829/* ID of the Tx IIR filter configuration parameters used by the
7830 * #ADM_MODULE_IDX_IIR_FILTER module.
7831 * @parspace Message payload
7832 * @structure{admx_iir_filter_cfg_params}
7833 * @tablespace
7834 * @inputtable{Audio_Postproc_ADM_PARAM_IDX_IIR_FILTER_CONFIG_PARAMS.tex}
7835 */
7836#define ADM_PARAM_IDX_IIR_FILTER_CONFIG_PARAMS 0x00010C44
7837
7838/* Structure for enabling the configuration parameter for the
7839 * IIR filter module on the Tx path.
7840 */
7841
7842/* @brief Payload of the #ADM_PARAM_IDX_IIR_FILTER_ENABLE_CONFIG
7843 * parameter in the Tx Path IIR Tuning Filter module.
7844 */
7845
7846struct admx_iir_filter_enable_cfg {
7847 uint32_t enable_flag;
7848/*< Specifies whether the IIR tuning filter is disabled (0) or
7849 * enabled (nonzero).
7850 */
7851
7852} __packed;
7853
7854
7855/* Structure for the pregain parameter for the
7856 * IIR filter module on the Tx path.
7857 */
7858
7859
7860/* @brief Payload of the #ADM_PARAM_IDX_IIR_FILTER_PRE_GAIN
7861 * parameter in the Tx Path IIR Tuning Filter module.
7862 */
7863
7864struct admx_iir_filter_pre_gain {
7865 uint16_t pre_gain;
7866 /*< Linear gain in Q13 format. */
7867
7868 uint16_t reserved;
7869 /*< Clients must set this field to zero.*/
7870} __packed;
7871
7872
7873/* Structure for the configuration parameter for the
7874 * IIR filter module on the Tx path.
7875 */
7876
7877
7878/* @brief Payload of the #ADM_PARAM_IDX_IIR_FILTER_CONFIG_PARAMS
7879 * parameter in the Tx Path IIR Tuning Filter module. \n
7880 * \n
7881 * This structure is followed by the HPF IIR filter coefficients on
7882 * the Tx path as follows: \n
7883 * - Sequence of int32_t ulFilterCoeffs. Each band has five
7884 * coefficients, each in int32_t format in the order of b0, b1, b2,
7885 * a1, a2.
7886 * - Sequence of int16_t sNumShiftFactor. One int16_t per band. The
7887 * numerator shift factor is related to the Q factor of the filter
7888 * coefficients.
7889 * - Sequence of uint16_t usPanSetting. One uint16_t for each band
7890 * to indicate if the filter is applied to left (0), right (1), or
7891 * both (2) channels.
7892 */
7893struct admx_iir_filter_cfg_params {
7894 uint16_t num_biquad_stages;
7895/*< Number of bands.
7896 * Supported values: 0 to 20
7897 */
7898
7899 uint16_t reserved;
7900 /*< Clients must set this field to zero.*/
7901} __packed;
7902
7903/* end_addtogroup audio_pp_module_ids */
7904
7905/* @ingroup audio_pp_module_ids
7906 * ID of the QEnsemble module.
7907 * This module supports the following parameter IDs:
7908 * - #ADM_PARAM_ID_QENSEMBLE_ENABLE
7909 * - #ADM_PARAM_ID_QENSEMBLE_BACKGAIN
7910 * - #ADM_PARAM_ID_QENSEMBLE_SET_NEW_ANGLE
7911 */
7912#define ADM_MODULE_ID_QENSEMBLE 0x00010C59
7913
7914/* @addtogroup audio_pp_param_ids */
7915/* ID of the QEnsemble enable parameter used by the
7916 * #ADM_MODULE_ID_QENSEMBLE module.
7917 * @messagepayload
7918 * @structure{adm_qensemble_enable}
7919 * @tablespace
7920 * @inputtable{Audio_Postproc_ADM_PARAM_ID_QENSEMBLE_ENABLE.tex}
7921 */
7922#define ADM_PARAM_ID_QENSEMBLE_ENABLE 0x00010C60
7923
7924/* ID of the QEnsemble back gain parameter used by the
7925 * #ADM_MODULE_ID_QENSEMBLE module.
7926 * @messagepayload
7927 * @structure{adm_qensemble_param_backgain}
7928 * @tablespace
7929 * @inputtable{Audio_Postproc_ADM_PARAM_ID_QENSEMBLE_BACKGAIN.tex}
7930 */
7931#define ADM_PARAM_ID_QENSEMBLE_BACKGAIN 0x00010C61
7932
7933/* ID of the QEnsemble new angle parameter used by the
7934 * #ADM_MODULE_ID_QENSEMBLE module.
7935 * @messagepayload
7936 * @structure{adm_qensemble_param_set_new_angle}
7937 * @tablespace
7938 * @inputtable{Audio_Postproc_ADM_PARAM_ID_QENSEMBLE_SET_NEW_ANGLE.tex}
7939 */
7940#define ADM_PARAM_ID_QENSEMBLE_SET_NEW_ANGLE 0x00010C62
7941
7942/* Structure for enabling the configuration parameter for the
7943 * QEnsemble module.
7944 */
7945
7946
7947/* @brief Payload of the #ADM_PARAM_ID_QENSEMBLE_ENABLE
7948 * parameter used by the QEnsemble module.
7949 */
7950struct adm_qensemble_enable {
7951 uint32_t enable_flag;
7952/*< Specifies whether the QEnsemble module is disabled (0) or enabled
7953 * (nonzero).
7954 */
7955} __packed;
7956
7957
7958/* Structure for the background gain for the QEnsemble module. */
7959
7960
7961/* @brief Payload of the #ADM_PARAM_ID_QENSEMBLE_BACKGAIN
7962 * parameter used by
7963 * the QEnsemble module.
7964 */
7965struct adm_qensemble_param_backgain {
7966 int16_t back_gain;
7967/*< Linear gain in Q15 format.
7968 * Supported values: 0 to 32767
7969 */
7970
7971 uint16_t reserved;
7972 /*< Clients must set this field to zero.*/
7973} __packed;
7974/* Structure for setting a new angle for the QEnsemble module. */
7975
7976
7977/* @brief Payload of the #ADM_PARAM_ID_QENSEMBLE_SET_NEW_ANGLE
7978 * parameter used
7979 * by the QEnsemble module.
7980 */
7981struct adm_qensemble_param_set_new_angle {
7982 int16_t new_angle;
7983/*< New angle in degrees.
7984 * Supported values: 0 to 359
7985 */
7986
7987 int16_t time_ms;
7988/*< Transition time in milliseconds to set the new angle.
7989 * Supported values: 0 to 32767
7990 */
7991} __packed;
7992
7993
7994#define ADM_CMD_GET_PP_TOPO_MODULE_LIST 0x00010349
7995#define ADM_CMDRSP_GET_PP_TOPO_MODULE_LIST 0x00010350
7996#define AUDPROC_PARAM_ID_ENABLE 0x00010904
7997 /*
7998 * Payload of the ADM_CMD_GET_PP_TOPO_MODULE_LIST command.
7999 */
8000struct adm_cmd_get_pp_topo_module_list_t {
8001 struct apr_hdr hdr;
8002 /* Lower 32 bits of the 64-bit parameter data payload address. */
8003 uint32_t data_payload_addr_lsw;
8004 /*
8005 * Upper 32 bits of the 64-bit parameter data payload address.
8006 *
8007 *
8008 * The size of the shared memory, if specified, must be large enough to
8009 * contain the entire parameter data payload, including the module ID,
8010 * parameter ID, parameter size, and parameter values.
8011 */
8012 uint32_t data_payload_addr_msw;
8013 /*
8014 * Unique identifier for an address.
8015 *
8016 * This memory map handle is returned by the aDSP through the
8017 * #ADM_CMD_SHARED_MEM_MAP_REGIONS command.
8018 *
8019 * @values
8020 * - Non-NULL -- On acknowledgment, the parameter data payloads begin at
8021 * the address specified (out-of-band)
8022 * - NULL -- The acknowledgment's payload contains the parameter data
8023 * (in-band) @tablebulletend
8024 */
8025 uint32_t mem_map_handle;
8026 /*
8027 * Maximum data size of the list of modules. This
8028 * field is a multiple of 4 bytes.
8029 */
8030 uint16_t param_max_size;
8031 /* This field must be set to zero. */
8032 uint16_t reserved;
8033} __packed;
8034
8035/*
8036 * Payload of the ADM_CMDRSP_GET_PP_TOPO_MODULE_LIST message, which returns
8037 * module ids in response to an ADM_CMD_GET_PP_TOPO_MODULE_LIST command.
8038 * Immediately following this structure is the acknowledgment <b>module id
8039 * data variable payload</b> containing the pre/postprocessing module id
8040 * values. For an in-band scenario, the variable payload depends on the size
8041 * of the parameter.
8042 */
8043struct adm_cmd_rsp_get_pp_topo_module_list_t {
8044 /* Status message (error code). */
8045 uint32_t status;
8046} __packed;
8047
8048struct audproc_topology_module_id_info_t {
8049 uint32_t num_modules;
8050} __packed;
8051
8052/* end_addtogroup audio_pp_module_ids */
8053
8054/* @ingroup audio_pp_module_ids
8055 * ID of the Volume Control module pre/postprocessing block.
8056 * This module supports the following parameter IDs:
8057 * - #ASM_PARAM_ID_VOL_CTRL_MASTER_GAIN
8058 * - #ASM_PARAM_ID_MULTICHANNEL_GAIN
8059 * - #ASM_PARAM_ID_VOL_CTRL_MUTE_CONFIG
8060 * - #ASM_PARAM_ID_SOFT_VOL_STEPPING_PARAMETERS
8061 * - #ASM_PARAM_ID_SOFT_PAUSE_PARAMETERS
8062 * - #ASM_PARAM_ID_MULTICHANNEL_GAIN
8063 * - #ASM_PARAM_ID_MULTICHANNEL_MUTE
8064 */
8065#define ASM_MODULE_ID_VOL_CTRL 0x00010BFE
8066#define ASM_MODULE_ID_VOL_CTRL2 0x00010910
8067#define AUDPROC_MODULE_ID_VOL_CTRL ASM_MODULE_ID_VOL_CTRL
8068
8069/* @addtogroup audio_pp_param_ids */
8070/* ID of the master gain parameter used by the #ASM_MODULE_ID_VOL_CTRL
8071 * module.
8072 * @messagepayload
8073 * @structure{asm_volume_ctrl_master_gain}
8074 * @tablespace
8075 * @inputtable{Audio_Postproc_ASM_PARAM_ID_VOL_CTRL_MASTER_GAIN.tex}
8076 */
8077#define ASM_PARAM_ID_VOL_CTRL_MASTER_GAIN 0x00010BFF
8078#define AUDPROC_PARAM_ID_VOL_CTRL_MASTER_GAIN ASM_PARAM_ID_VOL_CTRL_MASTER_GAIN
8079
8080/* ID of the left/right channel gain parameter used by the
8081 * #ASM_MODULE_ID_VOL_CTRL module.
8082 * @messagepayload
8083 * @structure{asm_volume_ctrl_lr_chan_gain}
8084 * @tablespace
8085 * @inputtable{Audio_Postproc_ASM_PARAM_ID_MULTICHANNEL_GAIN.tex}
8086 */
8087#define ASM_PARAM_ID_VOL_CTRL_LR_CHANNEL_GAIN 0x00010C00
8088
8089/* ID of the mute configuration parameter used by the
8090 * #ASM_MODULE_ID_VOL_CTRL module.
8091 * @messagepayload
8092 * @structure{asm_volume_ctrl_mute_config}
8093 * @tablespace
8094 * @inputtable{Audio_Postproc_ASM_PARAM_ID_VOL_CTRL_MUTE_CONFIG.tex}
8095 */
8096#define ASM_PARAM_ID_VOL_CTRL_MUTE_CONFIG 0x00010C01
8097
8098/* ID of the soft stepping volume parameters used by the
8099 * #ASM_MODULE_ID_VOL_CTRL module.
8100 * @messagepayload
8101 * @structure{asm_soft_step_volume_params}
8102 * @tablespace
8103 * @inputtable{Audio_Postproc_ASM_PARAM_ID_SOFT_VOL_STEPPING_PARAMET
8104 * ERS.tex}
8105 */
8106#define ASM_PARAM_ID_SOFT_VOL_STEPPING_PARAMETERS 0x00010C29
8107#define AUDPROC_PARAM_ID_SOFT_VOL_STEPPING_PARAMETERS\
8108 ASM_PARAM_ID_SOFT_VOL_STEPPING_PARAMETERS
8109
8110/* ID of the soft pause parameters used by the #ASM_MODULE_ID_VOL_CTRL
8111 * module.
8112 */
8113#define ASM_PARAM_ID_SOFT_PAUSE_PARAMETERS 0x00010D6A
8114
8115/* ID of the multiple-channel volume control parameters used by the
8116 * #ASM_MODULE_ID_VOL_CTRL module.
8117 */
8118#define ASM_PARAM_ID_MULTICHANNEL_GAIN 0x00010713
8119
8120/* ID of the multiple-channel mute configuration parameters used by the
8121 * #ASM_MODULE_ID_VOL_CTRL module.
8122 */
8123
8124#define ASM_PARAM_ID_MULTICHANNEL_MUTE 0x00010714
8125
8126/* Structure for the master gain parameter for a volume control
8127 * module.
8128 */
8129
8130
8131/* @brief Payload of the #ASM_PARAM_ID_VOL_CTRL_MASTER_GAIN
8132 * parameter used by the Volume Control module.
8133 */
8134
8135
8136
8137struct asm_volume_ctrl_master_gain {
8138 struct apr_hdr hdr;
8139 struct asm_stream_cmd_set_pp_params_v2 param;
8140 struct asm_stream_param_data_v2 data;
8141 uint16_t master_gain;
8142 /* Linear gain in Q13 format. */
8143
8144 uint16_t reserved;
8145 /* Clients must set this field to zero. */
8146} __packed;
8147
8148
8149struct asm_volume_ctrl_lr_chan_gain {
8150 struct apr_hdr hdr;
8151 struct asm_stream_cmd_set_pp_params_v2 param;
8152 struct asm_stream_param_data_v2 data;
8153
8154 uint16_t l_chan_gain;
8155 /*< Linear gain in Q13 format for the left channel. */
8156
8157 uint16_t r_chan_gain;
8158 /*< Linear gain in Q13 format for the right channel.*/
8159} __packed;
8160
8161
8162/* Structure for the mute configuration parameter for a
8163 * volume control module.
8164 */
8165
8166
8167/* @brief Payload of the #ASM_PARAM_ID_VOL_CTRL_MUTE_CONFIG
8168 * parameter used by the Volume Control module.
8169 */
8170
8171
8172struct asm_volume_ctrl_mute_config {
8173 struct apr_hdr hdr;
8174 struct asm_stream_cmd_set_pp_params_v2 param;
8175 struct asm_stream_param_data_v2 data;
8176 uint32_t mute_flag;
8177/*< Specifies whether mute is disabled (0) or enabled (nonzero).*/
8178
8179} __packed;
8180
8181/*
8182 * Supported parameters for a soft stepping linear ramping curve.
8183 */
8184#define ASM_PARAM_SVC_RAMPINGCURVE_LINEAR 0
8185
8186/*
8187 * Exponential ramping curve.
8188 */
8189#define ASM_PARAM_SVC_RAMPINGCURVE_EXP 1
8190
8191/*
8192 * Logarithmic ramping curve.
8193 */
8194#define ASM_PARAM_SVC_RAMPINGCURVE_LOG 2
8195
8196/* Structure for holding soft stepping volume parameters. */
8197
8198
8199/* Payload of the #ASM_PARAM_ID_SOFT_VOL_STEPPING_PARAMETERS
8200 * parameters used by the Volume Control module.
8201 */
8202struct asm_soft_step_volume_params {
8203 struct apr_hdr hdr;
8204 struct asm_stream_cmd_set_pp_params_v2 param;
8205 struct asm_stream_param_data_v2 data;
8206 uint32_t period;
8207/*< Period in milliseconds.
8208 * Supported values: 0 to 15000
8209 */
8210
8211 uint32_t step;
8212/*< Step in microseconds.
8213 * Supported values: 0 to 15000000
8214 */
8215
8216 uint32_t ramping_curve;
8217/*< Ramping curve type.
8218 * Supported values:
8219 * - #ASM_PARAM_SVC_RAMPINGCURVE_LINEAR
8220 * - #ASM_PARAM_SVC_RAMPINGCURVE_EXP
8221 * - #ASM_PARAM_SVC_RAMPINGCURVE_LOG
8222 */
8223} __packed;
8224
8225
8226/* Structure for holding soft pause parameters. */
8227
8228
8229/* Payload of the #ASM_PARAM_ID_SOFT_PAUSE_PARAMETERS
8230 * parameters used by the Volume Control module.
8231 */
8232
8233
8234struct asm_soft_pause_params {
8235 struct apr_hdr hdr;
8236 struct asm_stream_cmd_set_pp_params_v2 param;
8237 struct asm_stream_param_data_v2 data;
8238 uint32_t enable_flag;
8239/*< Specifies whether soft pause is disabled (0) or enabled
8240 * (nonzero).
8241 */
8242
8243
8244
8245 uint32_t period;
8246/*< Period in milliseconds.
8247 * Supported values: 0 to 15000
8248 */
8249
8250 uint32_t step;
8251/*< Step in microseconds.
8252 * Supported values: 0 to 15000000
8253 */
8254
8255 uint32_t ramping_curve;
8256/*< Ramping curve.
8257 * Supported values:
8258 * - #ASM_PARAM_SVC_RAMPINGCURVE_LINEAR
8259 * - #ASM_PARAM_SVC_RAMPINGCURVE_EXP
8260 * - #ASM_PARAM_SVC_RAMPINGCURVE_LOG
8261 */
8262} __packed;
8263
8264
8265/* Maximum number of channels.*/
8266#define VOLUME_CONTROL_MAX_CHANNELS 8
8267
8268/* Structure for holding one channel type - gain pair. */
8269
8270
8271/* Payload of the #ASM_PARAM_ID_MULTICHANNEL_GAIN channel
8272 * type/gain pairs used by the Volume Control module. \n \n This
8273 * structure immediately follows the
8274 * asm_volume_ctrl_multichannel_gain structure.
8275 */
8276
8277
8278struct asm_volume_ctrl_channeltype_gain_pair {
8279 uint8_t channeltype;
8280 /*
8281 * Channel type for which the gain setting is to be applied.
8282 * Supported values:
8283 * - #PCM_CHANNEL_L
8284 * - #PCM_CHANNEL_R
8285 * - #PCM_CHANNEL_C
8286 * - #PCM_CHANNEL_LS
8287 * - #PCM_CHANNEL_RS
8288 * - #PCM_CHANNEL_LFE
8289 * - #PCM_CHANNEL_CS
8290 * - #PCM_CHANNEL_LB
8291 * - #PCM_CHANNEL_RB
8292 * - #PCM_CHANNELS
8293 * - #PCM_CHANNEL_CVH
8294 * - #PCM_CHANNEL_MS
8295 * - #PCM_CHANNEL_FLC
8296 * - #PCM_CHANNEL_FRC
8297 * - #PCM_CHANNEL_RLC
8298 * - #PCM_CHANNEL_RRC
8299 */
8300
8301 uint8_t reserved1;
8302 /* Clients must set this field to zero. */
8303
8304 uint8_t reserved2;
8305 /* Clients must set this field to zero. */
8306
8307 uint8_t reserved3;
8308 /* Clients must set this field to zero. */
8309
8310 uint32_t gain;
8311 /*
8312 * Gain value for this channel in Q28 format.
8313 * Supported values: Any
8314 */
8315} __packed;
8316
8317
8318/* Structure for the multichannel gain command */
8319
8320
8321/* Payload of the #ASM_PARAM_ID_MULTICHANNEL_GAIN
8322 * parameters used by the Volume Control module.
8323 */
8324
8325
8326struct asm_volume_ctrl_multichannel_gain {
8327 struct apr_hdr hdr;
8328 struct asm_stream_cmd_set_pp_params_v2 param;
8329 struct asm_stream_param_data_v2 data;
8330 uint32_t num_channels;
8331 /*
8332 * Number of channels for which gain values are provided. Any
8333 * channels present in the data for which gain is not provided are
8334 * set to unity gain.
8335 * Supported values: 1 to 8
8336 */
8337
8338 struct asm_volume_ctrl_channeltype_gain_pair
8339 gain_data[VOLUME_CONTROL_MAX_CHANNELS];
8340 /* Array of channel type/gain pairs.*/
8341} __packed;
8342
8343
8344/* Structure for holding one channel type - mute pair. */
8345
8346
8347/* Payload of the #ASM_PARAM_ID_MULTICHANNEL_MUTE channel
8348 * type/mute setting pairs used by the Volume Control module. \n \n
8349 * This structure immediately follows the
8350 * asm_volume_ctrl_multichannel_mute structure.
8351 */
8352
8353
8354struct asm_volume_ctrl_channelype_mute_pair {
8355 struct apr_hdr hdr;
8356 struct asm_stream_cmd_set_pp_params_v2 param;
8357 struct asm_stream_param_data_v2 data;
8358 uint8_t channelype;
8359/*< Channel type for which the mute setting is to be applied.
8360 * Supported values:
8361 * - #PCM_CHANNEL_L
8362 * - #PCM_CHANNEL_R
8363 * - #PCM_CHANNEL_C
8364 * - #PCM_CHANNEL_LS
8365 * - #PCM_CHANNEL_RS
8366 * - #PCM_CHANNEL_LFE
8367 * - #PCM_CHANNEL_CS
8368 * - #PCM_CHANNEL_LB
8369 * - #PCM_CHANNEL_RB
8370 * - #PCM_CHANNELS
8371 * - #PCM_CHANNEL_CVH
8372 * - #PCM_CHANNEL_MS
8373 * - #PCM_CHANNEL_FLC
8374 * - #PCM_CHANNEL_FRC
8375 * - #PCM_CHANNEL_RLC
8376 * - #PCM_CHANNEL_RRC
8377 */
8378
8379 uint8_t reserved1;
8380 /*< Clients must set this field to zero. */
8381
8382 uint8_t reserved2;
8383 /*< Clients must set this field to zero. */
8384
8385 uint8_t reserved3;
8386 /*< Clients must set this field to zero. */
8387
8388 uint32_t mute;
8389/*< Mute setting for this channel.
8390 * Supported values:
8391 * - 0 = Unmute
8392 * - Nonzero = Mute
8393 */
8394} __packed;
8395
8396
8397/* Structure for the multichannel mute command */
8398
8399
8400/* @brief Payload of the #ASM_PARAM_ID_MULTICHANNEL_MUTE
8401 * parameters used by the Volume Control module.
8402 */
8403
8404
8405struct asm_volume_ctrl_multichannel_mute {
8406 struct apr_hdr hdr;
8407 struct asm_stream_cmd_set_pp_params_v2 param;
8408 struct asm_stream_param_data_v2 data;
8409 uint32_t num_channels;
8410/*< Number of channels for which mute configuration is
8411 * provided. Any channels present in the data for which mute
8412 * configuration is not provided are set to unmute.
8413 * Supported values: 1 to 8
8414 */
8415
8416struct asm_volume_ctrl_channelype_mute_pair
8417 mute_data[VOLUME_CONTROL_MAX_CHANNELS];
8418 /*< Array of channel type/mute setting pairs.*/
8419} __packed;
8420/* end_addtogroup audio_pp_param_ids */
8421
8422/* audio_pp_module_ids
8423 * ID of the IIR Tuning Filter module.
8424 * This module supports the following parameter IDs:
8425 * - #ASM_PARAM_ID_IIRUNING_FILTER_ENABLE_CONFIG
8426 * - #ASM_PARAM_ID_IIRUNING_FILTER_PRE_GAIN
8427 * - #ASM_PARAM_ID_IIRUNING_FILTER_CONFIG_PARAMS
8428 */
8429#define ASM_MODULE_ID_IIRUNING_FILTER 0x00010C02
8430
8431/* @addtogroup audio_pp_param_ids */
8432/* ID of the IIR tuning filter enable parameter used by the
8433 * #ASM_MODULE_ID_IIRUNING_FILTER module.
8434 * @messagepayload
8435 * @structure{asm_iiruning_filter_enable}
8436 * @tablespace
8437 * @inputtable{Audio_Postproc_ASM_PARAM_ID_IIRUNING_FILTER_ENABLE_CO
8438 * NFIG.tex}
8439 */
8440#define ASM_PARAM_ID_IIRUNING_FILTER_ENABLE_CONFIG 0x00010C03
8441
8442/* ID of the IIR tuning filter pregain parameter used by the
8443 * #ASM_MODULE_ID_IIRUNING_FILTER module.
8444 */
8445#define ASM_PARAM_ID_IIRUNING_FILTER_PRE_GAIN 0x00010C04
8446
8447/* ID of the IIR tuning filter configuration parameters used by the
8448 * #ASM_MODULE_ID_IIRUNING_FILTER module.
8449 */
8450#define ASM_PARAM_ID_IIRUNING_FILTER_CONFIG_PARAMS 0x00010C05
8451
8452/* Structure for an enable configuration parameter for an
8453 * IIR tuning filter module.
8454 */
8455
8456
8457/* @brief Payload of the #ASM_PARAM_ID_IIRUNING_FILTER_ENABLE_CONFIG
8458 * parameter used by the IIR Tuning Filter module.
8459 */
8460struct asm_iiruning_filter_enable {
8461 uint32_t enable_flag;
8462/*< Specifies whether the IIR tuning filter is disabled (0) or
8463 * enabled (1).
8464 */
8465} __packed;
8466
8467/* Structure for the pregain parameter for an IIR tuning filter module. */
8468
8469
8470/* Payload of the #ASM_PARAM_ID_IIRUNING_FILTER_PRE_GAIN
8471 * parameters used by the IIR Tuning Filter module.
8472 */
8473struct asm_iiruning_filter_pregain {
8474 uint16_t pregain;
8475 /*< Linear gain in Q13 format. */
8476
8477 uint16_t reserved;
8478 /*< Clients must set this field to zero.*/
8479} __packed;
8480
8481/* Structure for the configuration parameter for an IIR tuning filter
8482 * module.
8483 */
8484
8485
8486/* @brief Payload of the #ASM_PARAM_ID_IIRUNING_FILTER_CONFIG_PARAMS
8487 * parameters used by the IIR Tuning Filter module. \n
8488 * \n
8489 * This structure is followed by the IIR filter coefficients: \n
8490 * - Sequence of int32_t FilterCoeffs \n
8491 * Five coefficients for each band. Each coefficient is in int32_t format, in
8492 * the order of b0, b1, b2, a1, a2.
8493 * - Sequence of int16_t NumShiftFactor \n
8494 * One int16_t per band. The numerator shift factor is related to the Q
8495 * factor of the filter coefficients.
8496 * - Sequence of uint16_t PanSetting \n
8497 * One uint16_t per band, indicating if the filter is applied to left (0),
8498 * right (1), or both (2) channels.
8499 */
8500struct asm_iir_filter_config_params {
8501 uint16_t num_biquad_stages;
8502/*< Number of bands.
8503 * Supported values: 0 to 20
8504 */
8505
8506 uint16_t reserved;
8507 /*< Clients must set this field to zero.*/
8508} __packed;
8509
8510/* audio_pp_module_ids
8511 * ID of the Multiband Dynamic Range Control (MBDRC) module on the Tx/Rx
8512 * paths.
8513 * This module supports the following parameter IDs:
8514 * - #ASM_PARAM_ID_MBDRC_ENABLE
8515 * - #ASM_PARAM_ID_MBDRC_CONFIG_PARAMS
8516 */
8517#define ASM_MODULE_ID_MBDRC 0x00010C06
8518
8519/* audio_pp_param_ids */
8520/* ID of the MBDRC enable parameter used by the #ASM_MODULE_ID_MBDRC module.
8521 * @messagepayload
8522 * @structure{asm_mbdrc_enable}
8523 * @tablespace
8524 * @inputtable{Audio_Postproc_ASM_PARAM_ID_MBDRC_ENABLE.tex}
8525 */
8526#define ASM_PARAM_ID_MBDRC_ENABLE 0x00010C07
8527
8528/* ID of the MBDRC configuration parameters used by the
8529 * #ASM_MODULE_ID_MBDRC module.
8530 * @messagepayload
8531 * @structure{asm_mbdrc_config_params}
8532 * @tablespace
8533 * @inputtable{Audio_Postproc_ASM_PARAM_ID_MBDRC_CONFIG_PARAMS.tex}
8534 *
8535 * @parspace Sub-band DRC configuration parameters
8536 * @structure{asm_subband_drc_config_params}
8537 * @tablespace
8538 * @inputtable{Audio_Postproc_ASM_PARAM_ID_MBDRC_CONFIG_PARAMS_subband_DRC.tex}
8539 *
8540 * @keep{6}
8541 * To obtain legacy ADRC from MBDRC, use the calibration tool to:
8542 *
8543 * - Enable MBDRC (EnableFlag = TRUE)
8544 * - Set number of bands to 1 (uiNumBands = 1)
8545 * - Enable the first MBDRC band (DrcMode[0] = DRC_ENABLED = 1)
8546 * - Clear the first band mute flag (MuteFlag[0] = 0)
8547 * - Set the first band makeup gain to unity (compMakeUpGain[0] = 0x2000)
8548 * - Use the legacy ADRC parameters to calibrate the rest of the MBDRC
8549 * parameters.
8550 */
8551#define ASM_PARAM_ID_MBDRC_CONFIG_PARAMS 0x00010C08
8552
8553/* end_addtogroup audio_pp_param_ids */
8554
8555/* audio_pp_module_ids
8556 * ID of the MMBDRC module version 2 pre/postprocessing block.
8557 * This module differs from the original MBDRC (#ASM_MODULE_ID_MBDRC) in
8558 * the length of the filters used in each sub-band.
8559 * This module supports the following parameter ID:
8560 * - #ASM_PARAM_ID_MBDRC_CONFIG_PARAMS_IMPROVED_FILTBANK_V2
8561 */
8562#define ASM_MODULE_ID_MBDRCV2 0x0001070B
8563
8564/* @addtogroup audio_pp_param_ids */
8565/* ID of the configuration parameters used by the
8566 * #ASM_MODULE_ID_MBDRCV2 module for the improved filter structure
8567 * of the MBDRC v2 pre/postprocessing block.
8568 * The update to this configuration structure from the original
8569 * MBDRC is the number of filter coefficients in the filter
8570 * structure. The sequence for is as follows:
8571 * - 1 band = 0 FIR coefficient + 1 mute flag + uint16_t padding
8572 * - 2 bands = 141 FIR coefficients + 2 mute flags + uint16_t padding
8573 * - 3 bands = 141+81 FIR coefficients + 3 mute flags + uint16_t padding
8574 * - 4 bands = 141+81+61 FIR coefficients + 4 mute flags + uint16_t
8575 * padding
8576 * - 5 bands = 141+81+61+61 FIR coefficients + 5 mute flags +
8577 * uint16_t padding
8578 * This block uses the same parameter structure as
8579 * #ASM_PARAM_ID_MBDRC_CONFIG_PARAMS.
8580 */
8581#define ASM_PARAM_ID_MBDRC_CONFIG_PARAMS_IMPROVED_FILTBANK_V2 \
8582 0x0001070C
8583
8584#define ASM_MODULE_ID_MBDRCV3 0x0001090B
8585/*
8586 * ID of the MMBDRC module version 3 pre/postprocessing block.
8587 * This module differs from MBDRCv2 (#ASM_MODULE_ID_MBDRCV2) in
8588 * that it supports both 16- and 24-bit data.
8589 * This module supports the following parameter ID:
8590 * - #ASM_PARAM_ID_MBDRC_ENABLE
8591 * - #ASM_PARAM_ID_MBDRC_CONFIG_PARAMS
8592 * - #ASM_PARAM_ID_MBDRC_CONFIG_PARAMS_V3
8593 * - #ASM_PARAM_ID_MBDRC_FILTER_XOVER_FREQS
8594 */
8595
8596/* Structure for the enable parameter for an MBDRC module. */
8597
8598
8599/* Payload of the #ASM_PARAM_ID_MBDRC_ENABLE parameter used by the
8600 * MBDRC module.
8601 */
8602struct asm_mbdrc_enable {
8603 uint32_t enable_flag;
8604/*< Specifies whether MBDRC is disabled (0) or enabled (nonzero).*/
8605} __packed;
8606
8607/* Structure for the configuration parameters for an MBDRC module. */
8608
8609
8610/* Payload of the #ASM_PARAM_ID_MBDRC_CONFIG_PARAMS
8611 * parameters used by the MBDRC module. \n \n Following this
8612 * structure is the payload for sub-band DRC configuration
8613 * parameters (asm_subband_drc_config_params). This sub-band
8614 * structure must be repeated for each band.
8615 */
8616
8617
8618struct asm_mbdrc_config_params {
8619 uint16_t num_bands;
8620/*< Number of bands.
8621 * Supported values: 1 to 5
8622 */
8623
8624 int16_t limiterhreshold;
8625/*< Threshold in decibels for the limiter output.
8626 * Supported values: -72 to 18 \n
8627 * Recommended value: 3994 (-0.22 db in Q3.12 format)
8628 */
8629
8630 int16_t limiter_makeup_gain;
8631/*< Makeup gain in decibels for the limiter output.
8632 * Supported values: -42 to 42 \n
8633 * Recommended value: 256 (0 dB in Q7.8 format)
8634 */
8635
8636 int16_t limiter_gc;
8637/*< Limiter gain recovery coefficient.
8638 * Supported values: 0.5 to 0.99 \n
8639 * Recommended value: 32440 (0.99 in Q15 format)
8640 */
8641
8642 int16_t limiter_delay;
8643/*< Limiter delay in samples.
8644 * Supported values: 0 to 10 \n
8645 * Recommended value: 262 (0.008 samples in Q15 format)
8646 */
8647
8648 int16_t limiter_max_wait;
8649/*< Maximum limiter waiting time in samples.
8650 * Supported values: 0 to 10 \n
8651 * Recommended value: 262 (0.008 samples in Q15 format)
8652 */
8653} __packed;
8654
8655/* DRC configuration structure for each sub-band of an MBDRC module. */
8656
8657
8658/* Payload of the #ASM_PARAM_ID_MBDRC_CONFIG_PARAMS DRC
8659 * configuration parameters for each sub-band in the MBDRC module.
8660 * After this DRC structure is configured for valid bands, the next
8661 * MBDRC setparams expects the sequence of sub-band MBDRC filter
8662 * coefficients (the length depends on the number of bands) plus the
8663 * mute flag for that band plus uint16_t padding.
8664 *
8665 * @keep{10}
8666 * The filter coefficient and mute flag are of type int16_t:
8667 * - FIR coefficient = int16_t firFilter
8668 * - Mute flag = int16_t fMuteFlag
8669 *
8670 * The sequence is as follows:
8671 * - 1 band = 0 FIR coefficient + 1 mute flag + uint16_t padding
8672 * - 2 bands = 97 FIR coefficients + 2 mute flags + uint16_t padding
8673 * - 3 bands = 97+33 FIR coefficients + 3 mute flags + uint16_t padding
8674 * - 4 bands = 97+33+33 FIR coefficients + 4 mute flags + uint16_t padding
8675 * - 5 bands = 97+33+33+33 FIR coefficients + 5 mute flags + uint16_t padding
8676 *
8677 * For improved filterbank, the sequence is as follows:
8678 * - 1 band = 0 FIR coefficient + 1 mute flag + uint16_t padding
8679 * - 2 bands = 141 FIR coefficients + 2 mute flags + uint16_t padding
8680 * - 3 bands = 141+81 FIR coefficients + 3 mute flags + uint16_t padding
8681 * - 4 bands = 141+81+61 FIR coefficients + 4 mute flags + uint16_t padding
8682 * - 5 bands = 141+81+61+61 FIR coefficients + 5 mute flags + uint16_t padding
8683 */
8684struct asm_subband_drc_config_params {
8685 int16_t drc_stereo_linked_flag;
8686/*< Specifies whether all stereo channels have the same applied
8687 * dynamics (1) or if they process their dynamics independently (0).
8688 * Supported values:
8689 * - 0 -- Not linked
8690 * - 1 -- Linked
8691 */
8692
8693 int16_t drc_mode;
8694/*< Specifies whether DRC mode is bypassed for sub-bands.
8695 * Supported values:
8696 * - 0 -- Disabled
8697 * - 1 -- Enabled
8698 */
8699
8700 int16_t drc_down_sample_level;
8701/*< DRC down sample level.
8702 * Supported values: @ge 1
8703 */
8704
8705 int16_t drc_delay;
8706/*< DRC delay in samples.
8707 * Supported values: 0 to 1200
8708 */
8709
8710 uint16_t drc_rmsime_avg_const;
8711/*< RMS signal energy time-averaging constant.
8712 * Supported values: 0 to 2^16-1
8713 */
8714
8715 uint16_t drc_makeup_gain;
8716/*< DRC makeup gain in decibels.
8717 * Supported values: 258 to 64917
8718 */
8719 /* Down expander settings */
8720 int16_t down_expdrhreshold;
8721/*< Down expander threshold.
8722 * Supported Q7 format values: 1320 to up_cmpsrhreshold
8723 */
8724
8725 int16_t down_expdr_slope;
8726/*< Down expander slope.
8727 * Supported Q8 format values: -32768 to 0.
8728 */
8729
8730 uint32_t down_expdr_attack;
8731/*< Down expander attack constant.
8732 * Supported Q31 format values: 196844 to 2^31.
8733 */
8734
8735 uint32_t down_expdr_release;
8736/*< Down expander release constant.
8737 * Supported Q31 format values: 19685 to 2^31
8738 */
8739
8740 uint16_t down_expdr_hysteresis;
8741/*< Down expander hysteresis constant.
8742 * Supported Q14 format values: 1 to 32690
8743 */
8744
8745 uint16_t reserved;
8746 /*< Clients must set this field to zero. */
8747
8748 int32_t down_expdr_min_gain_db;
8749/*< Down expander minimum gain.
8750 * Supported Q23 format values: -805306368 to 0.
8751 */
8752
8753 /* Up compressor settings */
8754
8755 int16_t up_cmpsrhreshold;
8756/*< Up compressor threshold.
8757 * Supported Q7 format values: down_expdrhreshold to
8758 * down_cmpsrhreshold.
8759 */
8760
8761 uint16_t up_cmpsr_slope;
8762/*< Up compressor slope.
8763 * Supported Q16 format values: 0 to 64881.
8764 */
8765
8766 uint32_t up_cmpsr_attack;
8767/*< Up compressor attack constant.
8768 * Supported Q31 format values: 196844 to 2^31.
8769 */
8770
8771 uint32_t up_cmpsr_release;
8772/*< Up compressor release constant.
8773 * Supported Q31 format values: 19685 to 2^31.
8774 */
8775
8776 uint16_t up_cmpsr_hysteresis;
8777/*< Up compressor hysteresis constant.
8778 * Supported Q14 format values: 1 to 32690.
8779 */
8780
8781 /* Down compressor settings */
8782
8783 int16_t down_cmpsrhreshold;
8784/*< Down compressor threshold.
8785 * Supported Q7 format values: up_cmpsrhreshold to 11560.
8786 */
8787
8788 uint16_t down_cmpsr_slope;
8789/*< Down compressor slope.
8790 * Supported Q16 format values: 0 to 64881.
8791 */
8792
8793 uint16_t reserved1;
8794/*< Clients must set this field to zero. */
8795
8796 uint32_t down_cmpsr_attack;
8797/*< Down compressor attack constant.
8798 * Supported Q31 format values: 196844 to 2^31.
8799 */
8800
8801 uint32_t down_cmpsr_release;
8802/*< Down compressor release constant.
8803 * Supported Q31 format values: 19685 to 2^31.
8804 */
8805
8806 uint16_t down_cmpsr_hysteresis;
8807/*< Down compressor hysteresis constant.
8808 * Supported Q14 values: 1 to 32690.
8809 */
8810
8811 uint16_t reserved2;
8812/*< Clients must set this field to zero.*/
8813} __packed;
8814
8815#define ASM_MODULE_ID_EQUALIZER 0x00010C27
8816#define ASM_PARAM_ID_EQUALIZER_PARAMETERS 0x00010C28
8817
8818#define ASM_MAX_EQ_BANDS 12
8819
8820struct asm_eq_per_band_params {
8821 uint32_t band_idx;
8822/*< Band index.
8823 * Supported values: 0 to 11
8824 */
8825
8826 uint32_t filterype;
8827/*< Type of filter.
8828 * Supported values:
8829 * - #ASM_PARAM_EQYPE_NONE
8830 * - #ASM_PARAM_EQ_BASS_BOOST
8831 * - #ASM_PARAM_EQ_BASS_CUT
8832 * - #ASM_PARAM_EQREBLE_BOOST
8833 * - #ASM_PARAM_EQREBLE_CUT
8834 * - #ASM_PARAM_EQ_BAND_BOOST
8835 * - #ASM_PARAM_EQ_BAND_CUT
8836 */
8837
8838 uint32_t center_freq_hz;
8839 /*< Filter band center frequency in Hertz. */
8840
8841 int32_t filter_gain;
8842/*< Filter band initial gain.
8843 * Supported values: +12 to -12 dB in 1 dB increments
8844 */
8845
8846 int32_t q_factor;
8847/*< Filter band quality factor expressed as a Q8 number, i.e., a
8848 * fixed-point number with q factor of 8. For example, 3000/(2^8).
8849 */
8850} __packed;
8851
8852struct asm_eq_params {
8853 struct apr_hdr hdr;
8854 struct asm_stream_cmd_set_pp_params_v2 param;
8855 struct asm_stream_param_data_v2 data;
8856 uint32_t enable_flag;
8857/*< Specifies whether the equalizer module is disabled (0) or enabled
8858 * (nonzero).
8859 */
8860
8861 uint32_t num_bands;
8862/*< Number of bands.
8863 * Supported values: 1 to 12
8864 */
8865 struct asm_eq_per_band_params eq_bands[ASM_MAX_EQ_BANDS];
8866
8867} __packed;
8868
8869/* No equalizer effect.*/
8870#define ASM_PARAM_EQYPE_NONE 0
8871
8872/* Bass boost equalizer effect.*/
8873#define ASM_PARAM_EQ_BASS_BOOST 1
8874
8875/*Bass cut equalizer effect.*/
8876#define ASM_PARAM_EQ_BASS_CUT 2
8877
8878/* Treble boost equalizer effect */
8879#define ASM_PARAM_EQREBLE_BOOST 3
8880
8881/* Treble cut equalizer effect.*/
8882#define ASM_PARAM_EQREBLE_CUT 4
8883
8884/* Band boost equalizer effect.*/
8885#define ASM_PARAM_EQ_BAND_BOOST 5
8886
8887/* Band cut equalizer effect.*/
8888#define ASM_PARAM_EQ_BAND_CUT 6
8889
8890/* Get & set params */
8891#define VSS_ICOMMON_CMD_SET_PARAM_V2 0x0001133D
8892#define VSS_ICOMMON_CMD_GET_PARAM_V2 0x0001133E
8893#define VSS_ICOMMON_RSP_GET_PARAM 0x00011008
8894
Laxminath Kasam38070be2017-08-17 18:21:59 +05308895#define VSS_MAX_AVCS_NUM_SERVICES 25
8896
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +05308897/* ID of the Bass Boost module.
8898 * This module supports the following parameter IDs:
8899 * - #AUDPROC_PARAM_ID_BASS_BOOST_ENABLE
8900 * - #AUDPROC_PARAM_ID_BASS_BOOST_MODE
8901 * - #AUDPROC_PARAM_ID_BASS_BOOST_STRENGTH
8902 */
8903#define AUDPROC_MODULE_ID_BASS_BOOST 0x000108A1
8904/* ID of the Bass Boost enable parameter used by
8905 * AUDPROC_MODULE_ID_BASS_BOOST.
8906 */
8907#define AUDPROC_PARAM_ID_BASS_BOOST_ENABLE 0x000108A2
8908/* ID of the Bass Boost mode parameter used by
8909 * AUDPROC_MODULE_ID_BASS_BOOST.
8910 */
8911#define AUDPROC_PARAM_ID_BASS_BOOST_MODE 0x000108A3
8912/* ID of the Bass Boost strength parameter used by
8913 * AUDPROC_MODULE_ID_BASS_BOOST.
8914 */
8915#define AUDPROC_PARAM_ID_BASS_BOOST_STRENGTH 0x000108A4
8916
8917/* ID of the PBE module.
8918 * This module supports the following parameter IDs:
8919 * - #AUDPROC_PARAM_ID_PBE_ENABLE
8920 * - #AUDPROC_PARAM_ID_PBE_PARAM_CONFIG
8921 */
8922#define AUDPROC_MODULE_ID_PBE 0x00010C2A
8923/* ID of the Bass Boost enable parameter used by
8924 * AUDPROC_MODULE_ID_BASS_BOOST.
8925 */
8926#define AUDPROC_PARAM_ID_PBE_ENABLE 0x00010C2B
8927/* ID of the Bass Boost mode parameter used by
8928 * AUDPROC_MODULE_ID_BASS_BOOST.
8929 */
8930#define AUDPROC_PARAM_ID_PBE_PARAM_CONFIG 0x00010C49
8931
8932/* ID of the Virtualizer module. This module supports the
8933 * following parameter IDs:
8934 * - #AUDPROC_PARAM_ID_VIRTUALIZER_ENABLE
8935 * - #AUDPROC_PARAM_ID_VIRTUALIZER_STRENGTH
8936 * - #AUDPROC_PARAM_ID_VIRTUALIZER_OUT_TYPE
8937 * - #AUDPROC_PARAM_ID_VIRTUALIZER_GAIN_ADJUST
8938 */
8939#define AUDPROC_MODULE_ID_VIRTUALIZER 0x000108A5
8940/* ID of the Virtualizer enable parameter used by
8941 * AUDPROC_MODULE_ID_VIRTUALIZER.
8942 */
8943#define AUDPROC_PARAM_ID_VIRTUALIZER_ENABLE 0x000108A6
8944/* ID of the Virtualizer strength parameter used by
8945 * AUDPROC_MODULE_ID_VIRTUALIZER.
8946 */
8947#define AUDPROC_PARAM_ID_VIRTUALIZER_STRENGTH 0x000108A7
8948/* ID of the Virtualizer out type parameter used by
8949 * AUDPROC_MODULE_ID_VIRTUALIZER.
8950 */
8951#define AUDPROC_PARAM_ID_VIRTUALIZER_OUT_TYPE 0x000108A8
8952/* ID of the Virtualizer out type parameter used by
8953 * AUDPROC_MODULE_ID_VIRTUALIZER.
8954 */
8955#define AUDPROC_PARAM_ID_VIRTUALIZER_GAIN_ADJUST 0x000108A9
8956
8957/* ID of the Reverb module. This module supports the following
8958 * parameter IDs:
8959 * - #AUDPROC_PARAM_ID_REVERB_ENABLE
8960 * - #AUDPROC_PARAM_ID_REVERB_MODE
8961 * - #AUDPROC_PARAM_ID_REVERB_PRESET
8962 * - #AUDPROC_PARAM_ID_REVERB_WET_MIX
8963 * - #AUDPROC_PARAM_ID_REVERB_GAIN_ADJUST
8964 * - #AUDPROC_PARAM_ID_REVERB_ROOM_LEVEL
8965 * - #AUDPROC_PARAM_ID_REVERB_ROOM_HF_LEVEL
8966 * - #AUDPROC_PARAM_ID_REVERB_DECAY_TIME
8967 * - #AUDPROC_PARAM_ID_REVERB_DECAY_HF_RATIO
8968 * - #AUDPROC_PARAM_ID_REVERB_REFLECTIONS_LEVEL
8969 * - #AUDPROC_PARAM_ID_REVERB_REFLECTIONS_DELAY
8970 * - #AUDPROC_PARAM_ID_REVERB_LEVEL
8971 * - #AUDPROC_PARAM_ID_REVERB_DELAY
8972 * - #AUDPROC_PARAM_ID_REVERB_DIFFUSION
8973 * - #AUDPROC_PARAM_ID_REVERB_DENSITY
8974 */
8975#define AUDPROC_MODULE_ID_REVERB 0x000108AA
8976/* ID of the Reverb enable parameter used by
8977 * AUDPROC_MODULE_ID_REVERB.
8978 */
8979#define AUDPROC_PARAM_ID_REVERB_ENABLE 0x000108AB
8980/* ID of the Reverb mode parameter used by
8981 * AUDPROC_MODULE_ID_REVERB.
8982 */
8983#define AUDPROC_PARAM_ID_REVERB_MODE 0x000108AC
8984/* ID of the Reverb preset parameter used by
8985 * AUDPROC_MODULE_ID_REVERB.
8986 */
8987#define AUDPROC_PARAM_ID_REVERB_PRESET 0x000108AD
8988/* ID of the Reverb wet mix parameter used by
8989 * AUDPROC_MODULE_ID_REVERB.
8990 */
8991#define AUDPROC_PARAM_ID_REVERB_WET_MIX 0x000108AE
8992/* ID of the Reverb gain adjust parameter used by
8993 * AUDPROC_MODULE_ID_REVERB.
8994 */
8995#define AUDPROC_PARAM_ID_REVERB_GAIN_ADJUST 0x000108AF
8996/* ID of the Reverb room level parameter used by
8997 * AUDPROC_MODULE_ID_REVERB.
8998 */
8999#define AUDPROC_PARAM_ID_REVERB_ROOM_LEVEL 0x000108B0
9000/* ID of the Reverb room hf level parameter used by
9001 * AUDPROC_MODULE_ID_REVERB.
9002 */
9003#define AUDPROC_PARAM_ID_REVERB_ROOM_HF_LEVEL 0x000108B1
9004/* ID of the Reverb decay time parameter used by
9005 * AUDPROC_MODULE_ID_REVERB.
9006 */
9007#define AUDPROC_PARAM_ID_REVERB_DECAY_TIME 0x000108B2
9008/* ID of the Reverb decay hf ratio parameter used by
9009 * AUDPROC_MODULE_ID_REVERB.
9010 */
9011#define AUDPROC_PARAM_ID_REVERB_DECAY_HF_RATIO 0x000108B3
9012/* ID of the Reverb reflections level parameter used by
9013 * AUDPROC_MODULE_ID_REVERB.
9014 */
9015#define AUDPROC_PARAM_ID_REVERB_REFLECTIONS_LEVEL 0x000108B4
9016/* ID of the Reverb reflections delay parameter used by
9017 * AUDPROC_MODULE_ID_REVERB.
9018 */
9019#define AUDPROC_PARAM_ID_REVERB_REFLECTIONS_DELAY 0x000108B5
9020/* ID of the Reverb level parameter used by
9021 * AUDPROC_MODULE_ID_REVERB.
9022 */
9023#define AUDPROC_PARAM_ID_REVERB_LEVEL 0x000108B6
9024/* ID of the Reverb delay parameter used by
9025 * AUDPROC_MODULE_ID_REVERB.
9026 */
9027#define AUDPROC_PARAM_ID_REVERB_DELAY 0x000108B7
9028/* ID of the Reverb diffusion parameter used by
9029 * AUDPROC_MODULE_ID_REVERB.
9030 */
9031#define AUDPROC_PARAM_ID_REVERB_DIFFUSION 0x000108B8
9032/* ID of the Reverb density parameter used by
9033 * AUDPROC_MODULE_ID_REVERB.
9034 */
9035#define AUDPROC_PARAM_ID_REVERB_DENSITY 0x000108B9
9036
9037/* ID of the Popless Equalizer module. This module supports the
9038 * following parameter IDs:
9039 * - #AUDPROC_PARAM_ID_EQ_ENABLE
9040 * - #AUDPROC_PARAM_ID_EQ_CONFIG
9041 * - #AUDPROC_PARAM_ID_EQ_NUM_BANDS
9042 * - #AUDPROC_PARAM_ID_EQ_BAND_LEVELS
9043 * - #AUDPROC_PARAM_ID_EQ_BAND_LEVEL_RANGE
9044 * - #AUDPROC_PARAM_ID_EQ_BAND_FREQS
9045 * - #AUDPROC_PARAM_ID_EQ_SINGLE_BAND_FREQ_RANGE
9046 * - #AUDPROC_PARAM_ID_EQ_SINGLE_BAND_FREQ
9047 * - #AUDPROC_PARAM_ID_EQ_BAND_INDEX
9048 * - #AUDPROC_PARAM_ID_EQ_PRESET_ID
9049 * - #AUDPROC_PARAM_ID_EQ_NUM_PRESETS
9050 * - #AUDPROC_PARAM_ID_EQ_GET_PRESET_NAME
9051 */
9052#define AUDPROC_MODULE_ID_POPLESS_EQUALIZER 0x000108BA
9053/* ID of the Popless Equalizer enable parameter used by
9054 * AUDPROC_MODULE_ID_POPLESS_EQUALIZER.
9055 */
9056#define AUDPROC_PARAM_ID_EQ_ENABLE 0x000108BB
9057/* ID of the Popless Equalizer config parameter used by
9058 * AUDPROC_MODULE_ID_POPLESS_EQUALIZER.
9059 */
9060#define AUDPROC_PARAM_ID_EQ_CONFIG 0x000108BC
9061/* ID of the Popless Equalizer number of bands parameter used
9062 * by AUDPROC_MODULE_ID_POPLESS_EQUALIZER. This param ID is
9063 * used for get param only.
9064 */
9065#define AUDPROC_PARAM_ID_EQ_NUM_BANDS 0x000108BD
9066/* ID of the Popless Equalizer band levels parameter used by
9067 * AUDPROC_MODULE_ID_POPLESS_EQUALIZER. This param ID is
9068 * used for get param only.
9069 */
9070#define AUDPROC_PARAM_ID_EQ_BAND_LEVELS 0x000108BE
9071/* ID of the Popless Equalizer band level range parameter used
9072 * by AUDPROC_MODULE_ID_POPLESS_EQUALIZER. This param ID is
9073 * used for get param only.
9074 */
9075#define AUDPROC_PARAM_ID_EQ_BAND_LEVEL_RANGE 0x000108BF
9076/* ID of the Popless Equalizer band frequencies parameter used
9077 * by AUDPROC_MODULE_ID_POPLESS_EQUALIZER. This param ID is
9078 * used for get param only.
9079 */
9080#define AUDPROC_PARAM_ID_EQ_BAND_FREQS 0x000108C0
9081/* ID of the Popless Equalizer single band frequency range
9082 * parameter used by AUDPROC_MODULE_ID_POPLESS_EQUALIZER.
9083 * This param ID is used for get param only.
9084 */
9085#define AUDPROC_PARAM_ID_EQ_SINGLE_BAND_FREQ_RANGE 0x000108C1
9086/* ID of the Popless Equalizer single band frequency parameter
9087 * used by AUDPROC_MODULE_ID_POPLESS_EQUALIZER. This param ID
9088 * is used for set param only.
9089 */
9090#define AUDPROC_PARAM_ID_EQ_SINGLE_BAND_FREQ 0x000108C2
9091/* ID of the Popless Equalizer band index parameter used by
9092 * AUDPROC_MODULE_ID_POPLESS_EQUALIZER.
9093 */
9094#define AUDPROC_PARAM_ID_EQ_BAND_INDEX 0x000108C3
9095/* ID of the Popless Equalizer preset id parameter used by
9096 * AUDPROC_MODULE_ID_POPLESS_EQUALIZER. This param ID is used
9097 * for get param only.
9098 */
9099#define AUDPROC_PARAM_ID_EQ_PRESET_ID 0x000108C4
9100/* ID of the Popless Equalizer number of presets parameter used
9101 * by AUDPROC_MODULE_ID_POPLESS_EQUALIZER. This param ID is used
9102 * for get param only.
9103 */
9104#define AUDPROC_PARAM_ID_EQ_NUM_PRESETS 0x000108C5
9105/* ID of the Popless Equalizer preset name parameter used by
9106 * AUDPROC_MODULE_ID_POPLESS_EQUALIZER. This param ID is used
9107 * for get param only.
9108 */
9109#define AUDPROC_PARAM_ID_EQ_PRESET_NAME 0x000108C6
9110
9111/* Set Q6 topologies */
9112#define ASM_CMD_ADD_TOPOLOGIES 0x00010DBE
9113#define ADM_CMD_ADD_TOPOLOGIES 0x00010335
9114#define AFE_CMD_ADD_TOPOLOGIES 0x000100f8
9115/* structure used for both ioctls */
9116struct cmd_set_topologies {
9117 struct apr_hdr hdr;
9118 u32 payload_addr_lsw;
9119 /* LSW of parameter data payload address.*/
9120 u32 payload_addr_msw;
9121 /* MSW of parameter data payload address.*/
9122 u32 mem_map_handle;
9123 /* Memory map handle returned by mem map command */
9124 u32 payload_size;
9125 /* Size in bytes of the variable payload in shared memory */
9126} __packed;
9127
9128/* This module represents the Rx processing of Feedback speaker protection.
9129 * It contains the excursion control, thermal protection,
9130 * analog clip manager features in it.
9131 * This module id will support following param ids.
9132 * - AFE_PARAM_ID_FBSP_MODE_RX_CFG
9133 */
9134
9135#define AFE_MODULE_FB_SPKR_PROT_RX 0x0001021C
9136#define AFE_MODULE_FB_SPKR_PROT_V2_RX 0x0001025F
Xiaojun Sang12120ab2017-09-28 18:21:21 +08009137#define AFE_PARAM_ID_SP_RX_LIMITER_TH 0x000102B1
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +05309138#define AFE_PARAM_ID_FBSP_MODE_RX_CFG 0x0001021D
9139#define AFE_PARAM_ID_FBSP_PTONE_RAMP_CFG 0x00010260
9140
9141struct asm_fbsp_mode_rx_cfg {
9142 uint32_t minor_version;
9143 uint32_t mode;
9144} __packed;
9145
9146/* This module represents the VI processing of feedback speaker protection.
9147 * It will receive Vsens and Isens from codec and generates necessary
9148 * parameters needed by Rx processing.
9149 * This module id will support following param ids.
9150 * - AFE_PARAM_ID_SPKR_CALIB_VI_PROC_CFG
9151 * - AFE_PARAM_ID_CALIB_RES_CFG
9152 * - AFE_PARAM_ID_FEEDBACK_PATH_CFG
9153 */
9154
9155#define AFE_MODULE_FB_SPKR_PROT_VI_PROC 0x00010226
9156#define AFE_MODULE_FB_SPKR_PROT_VI_PROC_V2 0x0001026A
9157
9158#define AFE_PARAM_ID_SPKR_CALIB_VI_PROC_CFG 0x0001022A
9159#define AFE_PARAM_ID_SPKR_CALIB_VI_PROC_CFG_V2 0x0001026B
9160
9161struct asm_spkr_calib_vi_proc_cfg {
9162 uint32_t minor_version;
9163 uint32_t operation_mode;
9164 uint32_t r0_t0_selection_flag[SP_V2_NUM_MAX_SPKR];
9165 int32_t r0_cali_q24[SP_V2_NUM_MAX_SPKR];
9166 int16_t t0_cali_q6[SP_V2_NUM_MAX_SPKR];
9167 uint32_t quick_calib_flag;
9168} __packed;
9169
9170#define AFE_PARAM_ID_CALIB_RES_CFG 0x0001022B
9171#define AFE_PARAM_ID_CALIB_RES_CFG_V2 0x0001026E
9172
9173struct asm_calib_res_cfg {
9174 uint32_t minor_version;
9175 int32_t r0_cali_q24[SP_V2_NUM_MAX_SPKR];
9176 uint32_t th_vi_ca_state;
9177} __packed;
9178
9179#define AFE_PARAM_ID_FEEDBACK_PATH_CFG 0x0001022C
9180#define AFE_MODULE_FEEDBACK 0x00010257
9181
9182struct asm_feedback_path_cfg {
9183 uint32_t minor_version;
9184 int32_t dst_portid;
9185 int32_t num_channels;
9186 int32_t chan_info[4];
9187} __packed;
9188
9189#define AFE_PARAM_ID_MODE_VI_PROC_CFG 0x00010227
9190
9191struct asm_mode_vi_proc_cfg {
9192 uint32_t minor_version;
9193 uint32_t cal_mode;
9194} __packed;
9195
9196#define AFE_MODULE_SPEAKER_PROTECTION_V2_TH_VI 0x0001026A
9197#define AFE_PARAM_ID_SP_V2_TH_VI_MODE_CFG 0x0001026B
9198#define AFE_PARAM_ID_SP_V2_TH_VI_FTM_CFG 0x0001029F
9199#define AFE_PARAM_ID_SP_V2_TH_VI_FTM_PARAMS 0x000102A0
9200
9201struct afe_sp_th_vi_mode_cfg {
9202 uint32_t minor_version;
9203 uint32_t operation_mode;
9204 /*
9205 * Operation mode of thermal VI module.
9206 * 0 -- Normal Running mode
9207 * 1 -- Calibration mode
9208 * 2 -- FTM mode
9209 */
9210 uint32_t r0t0_selection_flag[SP_V2_NUM_MAX_SPKR];
9211 /*
9212 * Specifies which set of R0, T0 values the algorithm will use.
9213 * This field is valid only in Normal mode (operation_mode = 0).
9214 * 0 -- Use calibrated R0, T0 value
9215 * 1 -- Use safe R0, T0 value
9216 */
9217 int32_t r0_cali_q24[SP_V2_NUM_MAX_SPKR];
9218 /*
9219 * Calibration point resistance per device. This field is valid
9220 * only in Normal mode (operation_mode = 0).
9221 * values 33554432 to 1073741824 Ohms (in Q24 format)
9222 */
9223 int16_t t0_cali_q6[SP_V2_NUM_MAX_SPKR];
9224 /*
9225 * Calibration point temperature per device. This field is valid
9226 * in both Normal mode and Calibration mode.
9227 * values -1920 to 5120 degrees C (in Q6 format)
9228 */
9229 uint32_t quick_calib_flag;
9230 /*
9231 * Indicates whether calibration is to be done in quick mode or not.
9232 * This field is valid only in Calibration mode (operation_mode = 1).
9233 * 0 -- Disabled
9234 * 1 -- Enabled
9235 */
9236} __packed;
9237
9238struct afe_sp_th_vi_ftm_cfg {
9239 uint32_t minor_version;
9240 uint32_t wait_time_ms[SP_V2_NUM_MAX_SPKR];
9241 /*
9242 * Wait time to heat up speaker before collecting statistics
9243 * for ftm mode in ms.
9244 * values 0 to 4294967295 ms
9245 */
9246 uint32_t ftm_time_ms[SP_V2_NUM_MAX_SPKR];
9247 /*
9248 * duration for which FTM statistics are collected in ms.
9249 * values 0 to 2000 ms
9250 */
9251} __packed;
9252
9253struct afe_sp_th_vi_ftm_params {
9254 uint32_t minor_version;
9255 int32_t dc_res_q24[SP_V2_NUM_MAX_SPKR];
9256 /*
9257 * DC resistance value in q24 format
9258 * values 0 to 2147483647 Ohms (in Q24 format)
9259 */
9260 int32_t temp_q22[SP_V2_NUM_MAX_SPKR];
9261 /*
9262 * temperature value in q22 format
9263 * values -125829120 to 2147483647 degC (in Q22 format)
9264 */
9265 uint32_t status[SP_V2_NUM_MAX_SPKR];
9266 /*
9267 * FTM packet status
9268 * 0 - Incorrect operation mode.This status is returned
9269 * when GET_PARAM is called in non FTM Mode
9270 * 1 - Inactive mode -- Port is not yet started.
9271 * 2 - Wait state. wait_time_ms has not yet elapsed
9272 * 3 - In progress state. ftm_time_ms has not yet elapsed.
9273 * 4 - Success.
9274 * 5 - Failed.
9275 */
9276} __packed;
9277
9278struct afe_sp_th_vi_get_param {
9279 struct apr_hdr hdr;
9280 struct afe_port_cmd_get_param_v2 get_param;
9281 struct afe_port_param_data_v2 pdata;
9282 struct afe_sp_th_vi_ftm_params param;
9283} __packed;
9284
9285struct afe_sp_th_vi_get_param_resp {
9286 uint32_t status;
9287 struct afe_port_param_data_v2 pdata;
9288 struct afe_sp_th_vi_ftm_params param;
9289} __packed;
9290
9291
9292#define AFE_MODULE_SPEAKER_PROTECTION_V2_EX_VI 0x0001026F
9293#define AFE_PARAM_ID_SP_V2_EX_VI_MODE_CFG 0x000102A1
9294#define AFE_PARAM_ID_SP_V2_EX_VI_FTM_CFG 0x000102A2
9295#define AFE_PARAM_ID_SP_V2_EX_VI_FTM_PARAMS 0x000102A3
9296
9297struct afe_sp_ex_vi_mode_cfg {
9298 uint32_t minor_version;
9299 uint32_t operation_mode;
9300 /*
9301 * Operation mode of Excursion VI module.
9302 * 0 - Normal Running mode
9303 * 2 - FTM mode
9304 */
9305} __packed;
9306
9307struct afe_sp_ex_vi_ftm_cfg {
9308 uint32_t minor_version;
9309 uint32_t wait_time_ms[SP_V2_NUM_MAX_SPKR];
9310 /*
9311 * Wait time to heat up speaker before collecting statistics
9312 * for ftm mode in ms.
9313 * values 0 to 4294967295 ms
9314 */
9315 uint32_t ftm_time_ms[SP_V2_NUM_MAX_SPKR];
9316 /*
9317 * duration for which FTM statistics are collected in ms.
9318 * values 0 to 2000 ms
9319 */
9320} __packed;
9321
9322struct afe_sp_ex_vi_ftm_params {
9323 uint32_t minor_version;
9324 int32_t freq_q20[SP_V2_NUM_MAX_SPKR];
9325 /*
9326 * Resonance frequency in q20 format
9327 * values 0 to 2147483647 Hz (in Q20 format)
9328 */
9329 int32_t resis_q24[SP_V2_NUM_MAX_SPKR];
9330 /*
9331 * Mechanical resistance in q24 format
9332 * values 0 to 2147483647 Ohms (in Q24 format)
9333 */
9334 int32_t qmct_q24[SP_V2_NUM_MAX_SPKR];
9335 /*
9336 * Mechanical Qfactor in q24 format
9337 * values 0 to 2147483647 (in Q24 format)
9338 */
9339 uint32_t status[SP_V2_NUM_MAX_SPKR];
9340 /*
9341 * FTM packet status
9342 * 0 - Incorrect operation mode.This status is returned
9343 * when GET_PARAM is called in non FTM Mode.
9344 * 1 - Inactive mode -- Port is not yet started.
9345 * 2 - Wait state. wait_time_ms has not yet elapsed
9346 * 3 - In progress state. ftm_time_ms has not yet elapsed.
9347 * 4 - Success.
9348 * 5 - Failed.
9349 */
9350} __packed;
9351
9352struct afe_sp_ex_vi_get_param {
9353 struct apr_hdr hdr;
9354 struct afe_port_cmd_get_param_v2 get_param;
9355 struct afe_port_param_data_v2 pdata;
9356 struct afe_sp_ex_vi_ftm_params param;
9357} __packed;
9358
9359struct afe_sp_ex_vi_get_param_resp {
9360 uint32_t status;
9361 struct afe_port_param_data_v2 pdata;
9362 struct afe_sp_ex_vi_ftm_params param;
9363} __packed;
9364
Xiaojun Sang12120ab2017-09-28 18:21:21 +08009365struct afe_sp_rx_limiter_th_param {
9366 uint32_t minor_version;
9367 uint32_t lim_thr_per_calib_q27[SP_V2_NUM_MAX_SPKR];
9368} __packed;
9369
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +05309370union afe_spkr_prot_config {
9371 struct asm_fbsp_mode_rx_cfg mode_rx_cfg;
9372 struct asm_spkr_calib_vi_proc_cfg vi_proc_cfg;
9373 struct asm_feedback_path_cfg feedback_path_cfg;
9374 struct asm_mode_vi_proc_cfg mode_vi_proc_cfg;
9375 struct afe_sp_th_vi_mode_cfg th_vi_mode_cfg;
9376 struct afe_sp_th_vi_ftm_cfg th_vi_ftm_cfg;
9377 struct afe_sp_ex_vi_mode_cfg ex_vi_mode_cfg;
9378 struct afe_sp_ex_vi_ftm_cfg ex_vi_ftm_cfg;
Xiaojun Sang12120ab2017-09-28 18:21:21 +08009379 struct afe_sp_rx_limiter_th_param limiter_th_cfg;
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +05309380} __packed;
9381
9382struct afe_spkr_prot_config_command {
9383 struct apr_hdr hdr;
9384 struct afe_port_cmd_set_param_v2 param;
9385 struct afe_port_param_data_v2 pdata;
9386 union afe_spkr_prot_config prot_config;
9387} __packed;
9388
9389struct afe_spkr_prot_get_vi_calib {
9390 struct apr_hdr hdr;
9391 struct afe_port_cmd_get_param_v2 get_param;
9392 struct afe_port_param_data_v2 pdata;
9393 struct asm_calib_res_cfg res_cfg;
9394} __packed;
9395
9396struct afe_spkr_prot_calib_get_resp {
9397 uint32_t status;
9398 struct afe_port_param_data_v2 pdata;
9399 struct asm_calib_res_cfg res_cfg;
9400} __packed;
9401
9402
9403/* SRS TRUMEDIA start */
9404/* topology */
9405#define SRS_TRUMEDIA_TOPOLOGY_ID 0x00010D90
9406/* module */
9407#define SRS_TRUMEDIA_MODULE_ID 0x10005010
9408/* parameters */
9409#define SRS_TRUMEDIA_PARAMS 0x10005011
9410#define SRS_TRUMEDIA_PARAMS_WOWHD 0x10005012
9411#define SRS_TRUMEDIA_PARAMS_CSHP 0x10005013
9412#define SRS_TRUMEDIA_PARAMS_HPF 0x10005014
9413#define SRS_TRUMEDIA_PARAMS_AEQ 0x10005015
9414#define SRS_TRUMEDIA_PARAMS_HL 0x10005016
9415#define SRS_TRUMEDIA_PARAMS_GEQ 0x10005017
9416
9417#define SRS_ID_GLOBAL 0x00000001
9418#define SRS_ID_WOWHD 0x00000002
9419#define SRS_ID_CSHP 0x00000003
9420#define SRS_ID_HPF 0x00000004
9421#define SRS_ID_AEQ 0x00000005
9422#define SRS_ID_HL 0x00000006
9423#define SRS_ID_GEQ 0x00000007
9424
9425#define SRS_CMD_UPLOAD 0x7FFF0000
9426#define SRS_PARAM_OFFSET_MASK 0x3FFF0000
9427#define SRS_PARAM_VALUE_MASK 0x0000FFFF
9428
9429struct srs_trumedia_params_GLOBAL {
9430 uint8_t v1;
9431 uint8_t v2;
9432 uint8_t v3;
9433 uint8_t v4;
9434 uint8_t v5;
9435 uint8_t v6;
9436 uint8_t v7;
9437 uint8_t v8;
9438 uint16_t v9;
9439} __packed;
9440
9441struct srs_trumedia_params_WOWHD {
9442 uint32_t v1;
9443 uint16_t v2;
9444 uint16_t v3;
9445 uint16_t v4;
9446 uint16_t v5;
9447 uint16_t v6;
9448 uint16_t v7;
9449 uint16_t v8;
9450 uint16_t v____A1;
9451 uint32_t v9;
9452 uint16_t v10;
9453 uint16_t v11;
9454 uint32_t v12[16];
9455 uint32_t v13[16];
9456 uint32_t v14[16];
9457 uint32_t v15[16];
9458 uint32_t v16;
9459 uint16_t v17;
9460 uint16_t v18;
9461} __packed;
9462
9463struct srs_trumedia_params_CSHP {
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 v____A1;
9471 uint32_t v7;
9472 uint16_t v8;
9473 uint16_t v9;
9474 uint32_t v10[16];
9475} __packed;
9476
9477struct srs_trumedia_params_HPF {
9478 uint32_t v1;
9479 uint32_t v2[26];
9480} __packed;
9481
9482struct srs_trumedia_params_AEQ {
9483 uint32_t v1;
9484 uint16_t v2;
9485 uint16_t v3;
9486 uint16_t v4;
9487 uint16_t v____A1;
9488 uint32_t v5[74];
9489 uint32_t v6[74];
9490 uint16_t v7[2048];
9491} __packed;
9492
9493struct srs_trumedia_params_HL {
9494 uint16_t v1;
9495 uint16_t v2;
9496 uint16_t v3;
9497 uint16_t v____A1;
9498 int32_t v4;
9499 uint32_t v5;
9500 uint16_t v6;
9501 uint16_t v____A2;
9502 uint32_t v7;
9503} __packed;
9504
9505struct srs_trumedia_params_GEQ {
9506 int16_t v1[10];
9507} __packed;
9508struct srs_trumedia_params {
9509 struct srs_trumedia_params_GLOBAL global;
9510 struct srs_trumedia_params_WOWHD wowhd;
9511 struct srs_trumedia_params_CSHP cshp;
9512 struct srs_trumedia_params_HPF hpf;
9513 struct srs_trumedia_params_AEQ aeq;
9514 struct srs_trumedia_params_HL hl;
9515 struct srs_trumedia_params_GEQ geq;
9516} __packed;
9517/* SRS TruMedia end */
9518
9519#define AUDPROC_PARAM_ID_ENABLE 0x00010904
9520#define ASM_STREAM_POSTPROC_TOPO_ID_SA_PLUS 0x1000FFFF
9521/* DTS Eagle */
9522#define AUDPROC_MODULE_ID_DTS_HPX_PREMIX 0x0001077C
9523#define AUDPROC_MODULE_ID_DTS_HPX_POSTMIX 0x0001077B
9524#define ASM_STREAM_POSTPROC_TOPO_ID_DTS_HPX 0x00010DED
9525#define ASM_STREAM_POSTPROC_TOPO_ID_HPX_PLUS 0x10015000
9526#define ASM_STREAM_POSTPROC_TOPO_ID_HPX_MASTER 0x10015001
9527struct asm_dts_eagle_param {
9528 struct apr_hdr hdr;
9529 struct asm_stream_cmd_set_pp_params_v2 param;
9530 struct asm_stream_param_data_v2 data;
9531} __packed;
9532
9533struct asm_dts_eagle_param_get {
9534 struct apr_hdr hdr;
9535 struct asm_stream_cmd_get_pp_params_v2 param;
9536} __packed;
9537
9538/* Opcode to set BT address and license for aptx decoder */
9539#define APTX_DECODER_BT_ADDRESS 0x00013201
9540#define APTX_CLASSIC_DEC_LICENSE_ID 0x00013202
9541
9542struct aptx_dec_bt_addr_cfg {
9543 uint32_t lap;
9544 uint32_t uap;
9545 uint32_t nap;
9546} __packed;
9547
9548struct aptx_dec_bt_dev_addr {
9549 struct apr_hdr hdr;
9550 struct asm_stream_cmd_set_encdec_param encdec;
9551 struct aptx_dec_bt_addr_cfg bt_addr_cfg;
9552} __packed;
9553
9554struct asm_aptx_dec_fmt_blk_v2 {
9555 struct apr_hdr hdr;
9556 struct asm_data_cmd_media_fmt_update_v2 fmtblk;
9557 u32 sample_rate;
9558/* Number of samples per second.
9559 * Supported values: 44100 and 48000 Hz
9560 */
9561} __packed;
9562
Laxminath Kasam38070be2017-08-17 18:21:59 +05309563/* Q6Core Specific */
9564#define AVCS_CMD_GET_FWK_VERSION (0x0001292C)
9565#define AVCS_CMDRSP_GET_FWK_VERSION (0x0001292D)
9566
9567#define AVCS_SERVICE_ID_ALL (0xFFFFFFFF)
Raja Mallike1b2f792018-06-01 13:17:36 +05309568#define AVCS_SERVICE_ID_AFE (0x4)
Laxminath Kasam38070be2017-08-17 18:21:59 +05309569#define APRV2_IDS_SERVICE_ID_ADSP_CVP_V (0xB)
9570
9571struct avcs_get_fwk_version {
9572 /*
9573 * Indicates the major version of the AVS build.
9574 * This value is incremented on chipset family boundaries.
9575 */
9576 uint32_t build_major_version;
9577
9578 /*
9579 * Minor version of the AVS build.
9580 * This value represents the mainline to which the AVS build belongs.
9581 */
9582 uint32_t build_minor_version;
9583
9584 /* Indicates the AVS branch version to which the image belongs. */
9585 uint32_t build_branch_version;
9586
9587 /* Indicates the AVS sub-branch or customer product line information. */
9588 uint32_t build_subbranch_version;
9589
9590 /* Number of supported AVS services in the current build. */
9591 uint32_t num_services;
9592};
9593
9594struct avs_svc_api_info {
9595 /*
9596 * APRV2 service IDs for the individual static services.
9597 *
9598 * @values
9599 * - APRV2_IDS_SERVICE_ID_ADSP_CORE_V
9600 * - APRV2_IDS_SERVICE_ID_ADSP_AFE_V
9601 * - APRV2_IDS_SERVICE_ID_ADSP_ASM_V
9602 * - APRV2_IDS_SERVICE_ID_ADSP_ADM_V
9603 * - APRV2_IDS_SERVICE_ID_ADSP_MVM_V
9604 * - APRV2_IDS_SERVICE_ID_ADSP_CVS_V
9605 * - APRV2_IDS_SERVICE_ID_ADSP_CVP_V
9606 * - APRV2_IDS_SERVICE_ID_ADSP_LSM_V
9607 */
9608 uint32_t service_id;
9609
9610 /*
9611 * Indicates the API version of the service.
9612 *
9613 * Each new API update that warrants a change on the HLOS side triggers
9614 * an increment in the version.
9615 */
9616 uint32_t api_version;
9617
9618 /*
9619 * Indicates the API increments on a sub-branch (not on the mainline).
9620 *
9621 * API branch version numbers can increment independently on different
9622 * sub-branches.
9623 */
9624 uint32_t api_branch_version;
9625};
9626
9627struct avcs_fwk_ver_info {
9628 struct avcs_get_fwk_version avcs_fwk_version;
Siena Richard2d0102d2017-09-05 11:15:45 -07009629 struct avs_svc_api_info services[0];
Laxminath Kasam38070be2017-08-17 18:21:59 +05309630} __packed;
9631
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +05309632/* LSM Specific */
9633#define VW_FEAT_DIM (39)
9634
9635#define APRV2_IDS_SERVICE_ID_ADSP_LSM_V (0xD)
9636#define APRV2_IDS_DOMAIN_ID_ADSP_V (0x4)
9637#define APRV2_IDS_DOMAIN_ID_APPS_V (0x5)
9638
9639#define LSM_SESSION_CMD_SHARED_MEM_MAP_REGIONS (0x00012A7F)
9640#define LSM_SESSION_CMDRSP_SHARED_MEM_MAP_REGIONS (0x00012A80)
9641#define LSM_SESSION_CMD_SHARED_MEM_UNMAP_REGIONS (0x00012A81)
9642#define LSM_SESSION_CMD_OPEN_TX (0x00012A82)
9643#define LSM_SESSION_CMD_CLOSE_TX (0x00012A88)
9644#define LSM_SESSION_CMD_SET_PARAMS (0x00012A83)
9645#define LSM_SESSION_CMD_SET_PARAMS_V2 (0x00012A8F)
9646#define LSM_SESSION_CMD_REGISTER_SOUND_MODEL (0x00012A84)
9647#define LSM_SESSION_CMD_DEREGISTER_SOUND_MODEL (0x00012A85)
9648#define LSM_SESSION_CMD_START (0x00012A86)
9649#define LSM_SESSION_CMD_STOP (0x00012A87)
9650#define LSM_SESSION_CMD_EOB (0x00012A89)
9651#define LSM_SESSION_CMD_READ (0x00012A8A)
9652#define LSM_SESSION_CMD_OPEN_TX_V2 (0x00012A8B)
9653#define LSM_CMD_ADD_TOPOLOGIES (0x00012A8C)
9654
9655#define LSM_SESSION_EVENT_DETECTION_STATUS (0x00012B00)
9656#define LSM_SESSION_EVENT_DETECTION_STATUS_V2 (0x00012B01)
9657#define LSM_DATA_EVENT_READ_DONE (0x00012B02)
9658#define LSM_DATA_EVENT_STATUS (0x00012B03)
9659#define LSM_SESSION_EVENT_DETECTION_STATUS_V3 (0x00012B04)
9660
9661#define LSM_MODULE_ID_VOICE_WAKEUP (0x00012C00)
9662#define LSM_PARAM_ID_ENDPOINT_DETECT_THRESHOLD (0x00012C01)
9663#define LSM_PARAM_ID_OPERATION_MODE (0x00012C02)
9664#define LSM_PARAM_ID_GAIN (0x00012C03)
9665#define LSM_PARAM_ID_CONNECT_TO_PORT (0x00012C04)
9666#define LSM_PARAM_ID_FEATURE_COMPENSATION_DATA (0x00012C07)
9667#define LSM_PARAM_ID_MIN_CONFIDENCE_LEVELS (0x00012C07)
9668#define LSM_MODULE_ID_LAB (0x00012C08)
9669#define LSM_PARAM_ID_LAB_ENABLE (0x00012C09)
9670#define LSM_PARAM_ID_LAB_CONFIG (0x00012C0A)
9671#define LSM_MODULE_ID_FRAMEWORK (0x00012C0E)
9672#define LSM_PARAM_ID_SWMAD_CFG (0x00012C18)
9673#define LSM_PARAM_ID_SWMAD_MODEL (0x00012C19)
9674#define LSM_PARAM_ID_SWMAD_ENABLE (0x00012C1A)
9675#define LSM_PARAM_ID_POLLING_ENABLE (0x00012C1B)
9676#define LSM_PARAM_ID_MEDIA_FMT (0x00012C1E)
9677#define LSM_PARAM_ID_FWK_MODE_CONFIG (0x00012C27)
9678
9679/* HW MAD specific */
9680#define AFE_MODULE_HW_MAD (0x00010230)
9681#define AFE_PARAM_ID_HW_MAD_CFG (0x00010231)
9682#define AFE_PARAM_ID_HW_MAD_CTRL (0x00010232)
9683#define AFE_PARAM_ID_SLIMBUS_SLAVE_PORT_CFG (0x00010233)
9684
9685/* SW MAD specific */
9686#define AFE_MODULE_SW_MAD (0x0001022D)
9687#define AFE_PARAM_ID_SW_MAD_CFG (0x0001022E)
9688#define AFE_PARAM_ID_SVM_MODEL (0x0001022F)
9689
9690/* Commands/Params to pass the codec/slimbus data to DSP */
9691#define AFE_SVC_CMD_SET_PARAM (0x000100f3)
9692#define AFE_MODULE_CDC_DEV_CFG (0x00010234)
9693#define AFE_PARAM_ID_CDC_SLIMBUS_SLAVE_CFG (0x00010235)
9694#define AFE_PARAM_ID_CDC_REG_CFG (0x00010236)
9695#define AFE_PARAM_ID_CDC_REG_CFG_INIT (0x00010237)
9696#define AFE_PARAM_ID_CDC_REG_PAGE_CFG (0x00010296)
9697
9698#define AFE_MAX_CDC_REGISTERS_TO_CONFIG (20)
9699
9700/* AANC Port Config Specific */
9701#define AFE_PARAM_ID_AANC_PORT_CONFIG (0x00010215)
9702#define AFE_API_VERSION_AANC_PORT_CONFIG (0x1)
9703#define AANC_TX_MIC_UNUSED (0)
9704#define AANC_TX_VOICE_MIC (1)
9705#define AANC_TX_ERROR_MIC (2)
9706#define AANC_TX_NOISE_MIC (3)
9707#define AFE_PORT_MAX_CHANNEL_CNT (8)
9708#define AFE_MODULE_AANC (0x00010214)
9709#define AFE_PARAM_ID_CDC_AANC_VERSION (0x0001023A)
9710#define AFE_API_VERSION_CDC_AANC_VERSION (0x1)
9711#define AANC_HW_BLOCK_VERSION_1 (1)
9712#define AANC_HW_BLOCK_VERSION_2 (2)
9713
9714/*Clip bank selection*/
9715#define AFE_API_VERSION_CLIP_BANK_SEL_CFG 0x1
9716#define AFE_CLIP_MAX_BANKS 4
9717#define AFE_PARAM_ID_CLIP_BANK_SEL_CFG 0x00010242
9718
9719struct afe_param_aanc_port_cfg {
9720 /* Minor version used for tracking the version of the module's
9721 * source port configuration.
9722 */
9723 uint32_t aanc_port_cfg_minor_version;
9724
9725 /* Sampling rate of the source Tx port. 8k - 192k*/
9726 uint32_t tx_port_sample_rate;
9727
9728 /* Channel mapping for the Tx port signal carrying Noise (X),
9729 * Error (E), and Voice (V) signals.
9730 */
9731 uint8_t tx_port_channel_map[AFE_PORT_MAX_CHANNEL_CNT];
9732
9733 /* Number of channels on the source Tx port. */
9734 uint16_t tx_port_num_channels;
9735
9736 /* Port ID of the Rx path reference signal. */
9737 uint16_t rx_path_ref_port_id;
9738
9739 /* Sampling rate of the reference port. 8k - 192k*/
9740 uint32_t ref_port_sample_rate;
9741} __packed;
9742
9743struct afe_param_id_cdc_aanc_version {
9744 /* Minor version used for tracking the version of the module's
9745 * hw version
9746 */
9747 uint32_t cdc_aanc_minor_version;
9748
9749 /* HW version. */
9750 uint32_t aanc_hw_version;
9751} __packed;
9752
9753struct afe_param_id_clip_bank_sel {
9754 /* Minor version used for tracking the version of the module's
9755 * hw version
9756 */
9757 uint32_t minor_version;
9758
9759 /* Number of banks to be read */
9760 uint32_t num_banks;
9761
9762 uint32_t bank_map[AFE_CLIP_MAX_BANKS];
9763} __packed;
9764
9765/* ERROR CODES */
9766/* Success. The operation completed with no errors. */
9767#define ADSP_EOK 0x00000000
9768/* General failure. */
9769#define ADSP_EFAILED 0x00000001
9770/* Bad operation parameter. */
9771#define ADSP_EBADPARAM 0x00000002
9772/* Unsupported routine or operation. */
9773#define ADSP_EUNSUPPORTED 0x00000003
9774/* Unsupported version. */
9775#define ADSP_EVERSION 0x00000004
9776/* Unexpected problem encountered. */
9777#define ADSP_EUNEXPECTED 0x00000005
9778/* Unhandled problem occurred. */
9779#define ADSP_EPANIC 0x00000006
9780/* Unable to allocate resource. */
9781#define ADSP_ENORESOURCE 0x00000007
9782/* Invalid handle. */
9783#define ADSP_EHANDLE 0x00000008
9784/* Operation is already processed. */
9785#define ADSP_EALREADY 0x00000009
9786/* Operation is not ready to be processed. */
9787#define ADSP_ENOTREADY 0x0000000A
9788/* Operation is pending completion. */
9789#define ADSP_EPENDING 0x0000000B
9790/* Operation could not be accepted or processed. */
9791#define ADSP_EBUSY 0x0000000C
9792/* Operation aborted due to an error. */
9793#define ADSP_EABORTED 0x0000000D
9794/* Operation preempted by a higher priority. */
9795#define ADSP_EPREEMPTED 0x0000000E
9796/* Operation requests intervention to complete. */
9797#define ADSP_ECONTINUE 0x0000000F
9798/* Operation requests immediate intervention to complete. */
9799#define ADSP_EIMMEDIATE 0x00000010
9800/* Operation is not implemented. */
9801#define ADSP_ENOTIMPL 0x00000011
9802/* Operation needs more data or resources. */
9803#define ADSP_ENEEDMORE 0x00000012
9804/* Operation does not have memory. */
9805#define ADSP_ENOMEMORY 0x00000014
9806/* Item does not exist. */
9807#define ADSP_ENOTEXIST 0x00000015
9808/* Max count for adsp error code sent to HLOS*/
9809#define ADSP_ERR_MAX (ADSP_ENOTEXIST + 1)
9810/* Operation is finished. */
9811#define ADSP_ETERMINATED 0x00011174
9812
9813/*bharath, adsp_error_codes.h */
9814
9815/* LPASS clock for I2S Interface */
9816
9817/* Supported OSR clock values */
9818#define Q6AFE_LPASS_OSR_CLK_12_P288_MHZ 0xBB8000
9819#define Q6AFE_LPASS_OSR_CLK_11_P2896_MHZ 0xAC4400
9820#define Q6AFE_LPASS_OSR_CLK_9_P600_MHZ 0x927C00
9821#define Q6AFE_LPASS_OSR_CLK_8_P192_MHZ 0x7D0000
9822#define Q6AFE_LPASS_OSR_CLK_6_P144_MHZ 0x5DC000
9823#define Q6AFE_LPASS_OSR_CLK_4_P096_MHZ 0x3E8000
9824#define Q6AFE_LPASS_OSR_CLK_3_P072_MHZ 0x2EE000
9825#define Q6AFE_LPASS_OSR_CLK_2_P048_MHZ 0x1F4000
9826#define Q6AFE_LPASS_OSR_CLK_1_P536_MHZ 0x177000
9827#define Q6AFE_LPASS_OSR_CLK_1_P024_MHZ 0xFA000
9828#define Q6AFE_LPASS_OSR_CLK_768_kHZ 0xBB800
9829#define Q6AFE_LPASS_OSR_CLK_512_kHZ 0x7D000
9830#define Q6AFE_LPASS_OSR_CLK_DISABLE 0x0
9831
9832/* Supported Bit clock values */
9833#define Q6AFE_LPASS_IBIT_CLK_12_P288_MHZ 0xBB8000
9834#define Q6AFE_LPASS_IBIT_CLK_11_P2896_MHZ 0xAC4400
9835#define Q6AFE_LPASS_IBIT_CLK_8_P192_MHZ 0x7D0000
9836#define Q6AFE_LPASS_IBIT_CLK_6_P144_MHZ 0x5DC000
9837#define Q6AFE_LPASS_IBIT_CLK_4_P096_MHZ 0x3E8000
9838#define Q6AFE_LPASS_IBIT_CLK_3_P072_MHZ 0x2EE000
9839#define Q6AFE_LPASS_IBIT_CLK_2_P8224_MHZ 0x2b1100
9840#define Q6AFE_LPASS_IBIT_CLK_2_P048_MHZ 0x1F4000
9841#define Q6AFE_LPASS_IBIT_CLK_1_P536_MHZ 0x177000
9842#define Q6AFE_LPASS_IBIT_CLK_1_P4112_MHZ 0x158880
9843#define Q6AFE_LPASS_IBIT_CLK_1_P024_MHZ 0xFA000
9844#define Q6AFE_LPASS_IBIT_CLK_768_KHZ 0xBB800
9845#define Q6AFE_LPASS_IBIT_CLK_512_KHZ 0x7D000
9846#define Q6AFE_LPASS_IBIT_CLK_256_KHZ 0x3E800
9847#define Q6AFE_LPASS_IBIT_CLK_DISABLE 0x0
9848
9849/* Supported LPASS CLK sources */
9850#define Q6AFE_LPASS_CLK_SRC_EXTERNAL 0
9851#define Q6AFE_LPASS_CLK_SRC_INTERNAL 1
9852
9853/* Supported LPASS CLK root*/
9854#define Q6AFE_LPASS_CLK_ROOT_DEFAULT 0
9855
9856enum afe_lpass_clk_mode {
9857 Q6AFE_LPASS_MODE_BOTH_INVALID,
9858 Q6AFE_LPASS_MODE_CLK1_VALID,
9859 Q6AFE_LPASS_MODE_CLK2_VALID,
9860 Q6AFE_LPASS_MODE_BOTH_VALID,
9861} __packed;
9862
9863/* Clock ID Enumeration Define. */
9864/* Clock ID for Primary I2S IBIT */
9865#define Q6AFE_LPASS_CLK_ID_PRI_MI2S_IBIT 0x100
9866/* Clock ID for Primary I2S EBIT */
9867#define Q6AFE_LPASS_CLK_ID_PRI_MI2S_EBIT 0x101
9868/* Clock ID for Secondary I2S IBIT */
9869#define Q6AFE_LPASS_CLK_ID_SEC_MI2S_IBIT 0x102
9870/* Clock ID for Secondary I2S EBIT */
9871#define Q6AFE_LPASS_CLK_ID_SEC_MI2S_EBIT 0x103
9872/* Clock ID for Tertiary I2S IBIT */
9873#define Q6AFE_LPASS_CLK_ID_TER_MI2S_IBIT 0x104
9874/* Clock ID for Tertiary I2S EBIT */
9875#define Q6AFE_LPASS_CLK_ID_TER_MI2S_EBIT 0x105
9876/* Clock ID for Quartnery I2S IBIT */
9877#define Q6AFE_LPASS_CLK_ID_QUAD_MI2S_IBIT 0x106
9878/* Clock ID for Quartnery I2S EBIT */
9879#define Q6AFE_LPASS_CLK_ID_QUAD_MI2S_EBIT 0x107
9880/* Clock ID for Speaker I2S IBIT */
9881#define Q6AFE_LPASS_CLK_ID_SPEAKER_I2S_IBIT 0x108
9882/* Clock ID for Speaker I2S EBIT */
9883#define Q6AFE_LPASS_CLK_ID_SPEAKER_I2S_EBIT 0x109
9884/* Clock ID for Speaker I2S OSR */
9885#define Q6AFE_LPASS_CLK_ID_SPEAKER_I2S_OSR 0x10A
9886
9887/* Clock ID for QUINARY I2S IBIT */
9888#define Q6AFE_LPASS_CLK_ID_QUI_MI2S_IBIT 0x10B
9889/* Clock ID for QUINARY I2S EBIT */
9890#define Q6AFE_LPASS_CLK_ID_QUI_MI2S_EBIT 0x10C
9891/* Clock ID for SENARY I2S IBIT */
9892#define Q6AFE_LPASS_CLK_ID_SEN_MI2S_IBIT 0x10D
9893/* Clock ID for SENARY I2S EBIT */
9894#define Q6AFE_LPASS_CLK_ID_SEN_MI2S_EBIT 0x10E
9895/* Clock ID for INT0 I2S IBIT */
9896#define Q6AFE_LPASS_CLK_ID_INT0_MI2S_IBIT 0x10F
9897/* Clock ID for INT1 I2S IBIT */
9898#define Q6AFE_LPASS_CLK_ID_INT1_MI2S_IBIT 0x110
9899/* Clock ID for INT2 I2S IBIT */
9900#define Q6AFE_LPASS_CLK_ID_INT2_MI2S_IBIT 0x111
9901/* Clock ID for INT3 I2S IBIT */
9902#define Q6AFE_LPASS_CLK_ID_INT3_MI2S_IBIT 0x112
9903/* Clock ID for INT4 I2S IBIT */
9904#define Q6AFE_LPASS_CLK_ID_INT4_MI2S_IBIT 0x113
9905/* Clock ID for INT5 I2S IBIT */
9906#define Q6AFE_LPASS_CLK_ID_INT5_MI2S_IBIT 0x114
9907/* Clock ID for INT6 I2S IBIT */
9908#define Q6AFE_LPASS_CLK_ID_INT6_MI2S_IBIT 0x115
9909
Rohit Kumara5077932017-09-10 22:05:05 +05309910/* Clock ID for QUINARY MI2S OSR CLK */
9911#define Q6AFE_LPASS_CLK_ID_QUI_MI2S_OSR 0x116
9912
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +05309913/* Clock ID for Primary PCM IBIT */
9914#define Q6AFE_LPASS_CLK_ID_PRI_PCM_IBIT 0x200
9915/* Clock ID for Primary PCM EBIT */
9916#define Q6AFE_LPASS_CLK_ID_PRI_PCM_EBIT 0x201
9917/* Clock ID for Secondary PCM IBIT */
9918#define Q6AFE_LPASS_CLK_ID_SEC_PCM_IBIT 0x202
9919/* Clock ID for Secondary PCM EBIT */
9920#define Q6AFE_LPASS_CLK_ID_SEC_PCM_EBIT 0x203
9921/* Clock ID for Tertiary PCM IBIT */
9922#define Q6AFE_LPASS_CLK_ID_TER_PCM_IBIT 0x204
9923/* Clock ID for Tertiary PCM EBIT */
9924#define Q6AFE_LPASS_CLK_ID_TER_PCM_EBIT 0x205
9925/* Clock ID for Quartery PCM IBIT */
9926#define Q6AFE_LPASS_CLK_ID_QUAD_PCM_IBIT 0x206
9927/* Clock ID for Quartery PCM EBIT */
9928#define Q6AFE_LPASS_CLK_ID_QUAD_PCM_EBIT 0x207
Rohit Kumara5077932017-09-10 22:05:05 +05309929/* Clock ID for Quinary PCM IBIT */
9930#define Q6AFE_LPASS_CLK_ID_QUIN_PCM_IBIT 0x208
9931/* Clock ID for Quinary PCM EBIT */
9932#define Q6AFE_LPASS_CLK_ID_QUIN_PCM_EBIT 0x209
9933/* Clock ID for QUINARY PCM OSR */
9934#define Q6AFE_LPASS_CLK_ID_QUI_PCM_OSR 0x20A
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +05309935
9936/** Clock ID for Primary TDM IBIT */
9937#define Q6AFE_LPASS_CLK_ID_PRI_TDM_IBIT 0x200
9938/** Clock ID for Primary TDM EBIT */
9939#define Q6AFE_LPASS_CLK_ID_PRI_TDM_EBIT 0x201
9940/** Clock ID for Secondary TDM IBIT */
9941#define Q6AFE_LPASS_CLK_ID_SEC_TDM_IBIT 0x202
9942/** Clock ID for Secondary TDM EBIT */
9943#define Q6AFE_LPASS_CLK_ID_SEC_TDM_EBIT 0x203
9944/** Clock ID for Tertiary TDM IBIT */
9945#define Q6AFE_LPASS_CLK_ID_TER_TDM_IBIT 0x204
9946/** Clock ID for Tertiary TDM EBIT */
9947#define Q6AFE_LPASS_CLK_ID_TER_TDM_EBIT 0x205
9948/** Clock ID for Quartery TDM IBIT */
9949#define Q6AFE_LPASS_CLK_ID_QUAD_TDM_IBIT 0x206
9950/** Clock ID for Quartery TDM EBIT */
9951#define Q6AFE_LPASS_CLK_ID_QUAD_TDM_EBIT 0x207
Rohit Kumara5077932017-09-10 22:05:05 +05309952/** Clock ID for Quinary TDM IBIT */
9953#define Q6AFE_LPASS_CLK_ID_QUIN_TDM_IBIT 0x208
9954/** Clock ID for Quinary TDM EBIT */
9955#define Q6AFE_LPASS_CLK_ID_QUIN_TDM_EBIT 0x209
9956/** Clock ID for Quinary TDM OSR */
9957#define Q6AFE_LPASS_CLK_ID_QUIN_TDM_OSR 0x20A
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +05309958
9959/* Clock ID for MCLK1 */
9960#define Q6AFE_LPASS_CLK_ID_MCLK_1 0x300
9961/* Clock ID for MCLK2 */
9962#define Q6AFE_LPASS_CLK_ID_MCLK_2 0x301
9963/* Clock ID for MCLK3 */
9964#define Q6AFE_LPASS_CLK_ID_MCLK_3 0x302
9965/* Clock ID for MCLK4 */
9966#define Q6AFE_LPASS_CLK_ID_MCLK_4 0x304
9967/* Clock ID for Internal Digital Codec Core */
9968#define Q6AFE_LPASS_CLK_ID_INTERNAL_DIGITAL_CODEC_CORE 0x303
9969/* Clock ID for INT MCLK0 */
9970#define Q6AFE_LPASS_CLK_ID_INT_MCLK_0 0x305
9971/* Clock ID for INT MCLK1 */
9972#define Q6AFE_LPASS_CLK_ID_INT_MCLK_1 0x306
9973/*
9974 * Clock ID for soundwire NPL.
9975 * This is the clock to be used to enable NPL clock for internal Soundwire.
9976 */
9977#define AFE_CLOCK_SET_CLOCK_ID_SWR_NPL_CLK 0x307
9978
9979/* Clock ID for AHB HDMI input */
9980#define Q6AFE_LPASS_CLK_ID_AHB_HDMI_INPUT 0x400
9981
9982/* Clock ID for SPDIF core */
9983#define Q6AFE_LPASS_CLK_ID_SPDIF_CORE 0x500
9984
9985
9986/* Clock attribute for invalid use (reserved for internal usage) */
9987#define Q6AFE_LPASS_CLK_ATTRIBUTE_INVALID 0x0
9988/* Clock attribute for no couple case */
9989#define Q6AFE_LPASS_CLK_ATTRIBUTE_COUPLE_NO 0x1
9990/* Clock attribute for dividend couple case */
9991#define Q6AFE_LPASS_CLK_ATTRIBUTE_COUPLE_DIVIDEND 0x2
9992/* Clock attribute for divisor couple case */
9993#define Q6AFE_LPASS_CLK_ATTRIBUTE_COUPLE_DIVISOR 0x3
9994/* Clock attribute for invert and no couple case */
9995#define Q6AFE_LPASS_CLK_ATTRIBUTE_INVERT_COUPLE_NO 0x4
9996/* Clock set API version */
9997#define Q6AFE_LPASS_CLK_CONFIG_API_VERSION 0x1
9998
9999struct afe_clk_set {
10000 /*
10001 * Minor version used for tracking clock set.
10002 * @values #AFE_API_VERSION_CLOCK_SET
10003 */
10004 uint32_t clk_set_minor_version;
10005
10006 /*
10007 * Clock ID
10008 * @values
10009 * - 0x100 to 0x10A - MSM8996
10010 * - 0x200 to 0x207 - MSM8996
10011 * - 0x300 to 0x302 - MSM8996 @tablebulletend
10012 */
10013 uint32_t clk_id;
10014
10015 /*
10016 * Clock frequency (in Hertz) to be set.
10017 * @values
10018 * - >= 0 for clock frequency to set @tablebulletend
10019 */
10020 uint32_t clk_freq_in_hz;
10021
10022 /* Use to specific divider for two clocks if needed.
10023 * Set to Q6AFE_LPASS_CLK_ATTRIBUTE_COUPLE_NO for no divider
10024 * relation clocks
10025 * @values
10026 * - #Q6AFE_LPASS_CLK_ATTRIBUTE_COUPLE_NO
10027 * - #Q6AFE_LPASS_CLK_ATTRIBUTE_COUPLE_DIVIDEND
10028 * - #Q6AFE_LPASS_CLK_ATTRIBUTE_COUPLE_DIVISOR @tablebulletend
10029 */
10030 uint16_t clk_attri;
10031
10032 /*
10033 * Specifies the root clock source.
10034 * Currently, only Q6AFE_LPASS_CLK_ROOT_DEFAULT is valid
10035 * @values
10036 * - 0 @tablebulletend
10037 */
10038 uint16_t clk_root;
10039
10040 /*
10041 * for enable and disable clock.
10042 * "clk_freq_in_hz", "clk_attri", and "clk_root"
10043 * are ignored in disable clock case.
10044 * @values 
10045 * - 0 -- Disabled
10046 * - 1 -- Enabled @tablebulletend
10047 */
10048 uint32_t enable;
10049};
10050
10051struct afe_clk_cfg {
10052/* Minor version used for tracking the version of the I2S
10053 * configuration interface.
10054 * Supported values: #AFE_API_VERSION_I2S_CONFIG
10055 */
10056 u32 i2s_cfg_minor_version;
10057
10058/* clk value 1 in MHz. */
10059 u32 clk_val1;
10060
10061/* clk value 2 in MHz. */
10062 u32 clk_val2;
10063
10064/* clk_src
10065 * #Q6AFE_LPASS_CLK_SRC_EXTERNAL
10066 * #Q6AFE_LPASS_CLK_SRC_INTERNAL
10067 */
10068
10069 u16 clk_src;
10070
10071/* clk_root -0 for default */
10072 u16 clk_root;
10073
10074/* clk_set_mode
10075 * #Q6AFE_LPASS_MODE_BOTH_INVALID
10076 * #Q6AFE_LPASS_MODE_CLK1_VALID
10077 * #Q6AFE_LPASS_MODE_CLK2_VALID
10078 * #Q6AFE_LPASS_MODE_BOTH_VALID
10079 */
10080 u16 clk_set_mode;
10081
10082/* This param id is used to configure I2S clk */
10083 u16 reserved;
10084} __packed;
10085
10086/* This param id is used to configure I2S clk */
10087#define AFE_PARAM_ID_LPAIF_CLK_CONFIG 0x00010238
10088#define AFE_MODULE_CLOCK_SET 0x0001028F
10089#define AFE_PARAM_ID_CLOCK_SET 0x00010290
10090
10091struct afe_lpass_clk_config_command {
10092 struct apr_hdr hdr;
10093 struct afe_port_cmd_set_param_v2 param;
10094 struct afe_port_param_data_v2 pdata;
10095 struct afe_clk_cfg clk_cfg;
10096} __packed;
10097
10098enum afe_lpass_digital_clk_src {
10099 Q6AFE_LPASS_DIGITAL_ROOT_INVALID,
10100 Q6AFE_LPASS_DIGITAL_ROOT_PRI_MI2S_OSR,
10101 Q6AFE_LPASS_DIGITAL_ROOT_SEC_MI2S_OSR,
10102 Q6AFE_LPASS_DIGITAL_ROOT_TER_MI2S_OSR,
10103 Q6AFE_LPASS_DIGITAL_ROOT_QUAD_MI2S_OSR,
10104 Q6AFE_LPASS_DIGITAL_ROOT_CDC_ROOT_CLK,
10105} __packed;
10106
10107/* This param id is used to configure internal clk */
10108#define AFE_PARAM_ID_INTERNAL_DIGIATL_CDC_CLK_CONFIG 0x00010239
10109
10110struct afe_digital_clk_cfg {
10111/* Minor version used for tracking the version of the I2S
10112 * configuration interface.
10113 * Supported values: #AFE_API_VERSION_I2S_CONFIG
10114 */
10115 u32 i2s_cfg_minor_version;
10116
10117/* clk value in MHz. */
10118 u32 clk_val;
10119
10120/* INVALID
10121 * PRI_MI2S_OSR
10122 * SEC_MI2S_OSR
10123 * TER_MI2S_OSR
10124 * QUAD_MI2S_OSR
10125 * DIGT_CDC_ROOT
10126 */
10127 u16 clk_root;
10128
10129/* This field must be set to zero. */
10130 u16 reserved;
10131} __packed;
10132
10133
10134struct afe_lpass_digital_clk_config_command {
10135 struct apr_hdr hdr;
10136 struct afe_port_cmd_set_param_v2 param;
10137 struct afe_port_param_data_v2 pdata;
10138 struct afe_digital_clk_cfg clk_cfg;
10139} __packed;
10140
10141/*
10142 * Opcode for AFE to start DTMF.
10143 */
10144#define AFE_PORTS_CMD_DTMF_CTL 0x00010102
10145
10146/** DTMF payload.*/
10147struct afe_dtmf_generation_command {
10148 struct apr_hdr hdr;
10149
10150 /*
10151 * Duration of the DTMF tone in ms.
10152 * -1 -> continuous,
10153 * 0 -> disable
10154 */
10155 int64_t duration_in_ms;
10156
10157 /*
10158 * The DTMF high tone frequency.
10159 */
10160 uint16_t high_freq;
10161
10162 /*
10163 * The DTMF low tone frequency.
10164 */
10165 uint16_t low_freq;
10166
10167 /*
10168 * The DTMF volume setting
10169 */
10170 uint16_t gain;
10171
10172 /*
10173 * The number of ports to enable/disable on.
10174 */
10175 uint16_t num_ports;
10176
10177 /*
10178 * The Destination ports - array .
10179 * For DTMF on multiple ports, portIds needs to
10180 * be populated numPorts times.
10181 */
10182 uint16_t port_ids;
10183
10184 /*
10185 * variable for 32 bit alignment of APR packet.
10186 */
10187 uint16_t reserved;
10188} __packed;
10189
10190enum afe_config_type {
10191 AFE_SLIMBUS_SLAVE_PORT_CONFIG,
10192 AFE_SLIMBUS_SLAVE_CONFIG,
10193 AFE_CDC_REGISTERS_CONFIG,
10194 AFE_AANC_VERSION,
10195 AFE_CDC_CLIP_REGISTERS_CONFIG,
10196 AFE_CLIP_BANK_SEL,
10197 AFE_CDC_REGISTER_PAGE_CONFIG,
10198 AFE_MAX_CONFIG_TYPES,
10199};
10200
10201struct afe_param_slimbus_slave_port_cfg {
10202 uint32_t minor_version;
10203 uint16_t slimbus_dev_id;
10204 uint16_t slave_dev_pgd_la;
10205 uint16_t slave_dev_intfdev_la;
10206 uint16_t bit_width;
10207 uint16_t data_format;
10208 uint16_t num_channels;
10209 uint16_t slave_port_mapping[AFE_PORT_MAX_AUDIO_CHAN_CNT];
10210} __packed;
10211
10212struct afe_param_cdc_slimbus_slave_cfg {
10213 uint32_t minor_version;
10214 uint32_t device_enum_addr_lsw;
10215 uint32_t device_enum_addr_msw;
10216 uint16_t tx_slave_port_offset;
10217 uint16_t rx_slave_port_offset;
10218} __packed;
10219
10220struct afe_param_cdc_reg_cfg {
10221 uint32_t minor_version;
10222 uint32_t reg_logical_addr;
10223 uint32_t reg_field_type;
10224 uint32_t reg_field_bit_mask;
10225 uint16_t reg_bit_width;
10226 uint16_t reg_offset_scale;
10227} __packed;
10228
10229#define AFE_API_VERSION_CDC_REG_PAGE_CFG 1
10230
10231enum {
10232 AFE_CDC_REG_PAGE_ASSIGN_PROC_ID_0 = 0,
10233 AFE_CDC_REG_PAGE_ASSIGN_PROC_ID_1,
10234 AFE_CDC_REG_PAGE_ASSIGN_PROC_ID_2,
10235 AFE_CDC_REG_PAGE_ASSIGN_PROC_ID_3,
10236};
10237
10238struct afe_param_cdc_reg_page_cfg {
10239 uint32_t minor_version;
10240 uint32_t enable;
10241 uint32_t proc_id;
10242} __packed;
10243
10244struct afe_param_cdc_reg_cfg_data {
10245 uint32_t num_registers;
10246 struct afe_param_cdc_reg_cfg *reg_data;
10247} __packed;
10248
10249struct afe_svc_cmd_set_param {
10250 uint32_t payload_size;
10251 uint32_t payload_address_lsw;
10252 uint32_t payload_address_msw;
10253 uint32_t mem_map_handle;
10254} __packed;
10255
10256struct afe_svc_param_data {
10257 uint32_t module_id;
10258 uint32_t param_id;
10259 uint16_t param_size;
10260 uint16_t reserved;
10261} __packed;
10262
10263struct afe_param_hw_mad_ctrl {
10264 uint32_t minor_version;
10265 uint16_t mad_type;
10266 uint16_t mad_enable;
10267} __packed;
10268
10269struct afe_cmd_hw_mad_ctrl {
10270 struct apr_hdr hdr;
10271 struct afe_port_cmd_set_param_v2 param;
10272 struct afe_port_param_data_v2 pdata;
10273 struct afe_param_hw_mad_ctrl payload;
10274} __packed;
10275
10276struct afe_cmd_hw_mad_slimbus_slave_port_cfg {
10277 struct apr_hdr hdr;
10278 struct afe_port_cmd_set_param_v2 param;
10279 struct afe_port_param_data_v2 pdata;
10280 struct afe_param_slimbus_slave_port_cfg sb_port_cfg;
10281} __packed;
10282
10283struct afe_cmd_sw_mad_enable {
10284 struct apr_hdr hdr;
10285 struct afe_port_cmd_set_param_v2 param;
10286 struct afe_port_param_data_v2 pdata;
10287} __packed;
10288
10289struct afe_param_cdc_reg_cfg_payload {
10290 struct afe_svc_param_data common;
10291 struct afe_param_cdc_reg_cfg reg_cfg;
10292} __packed;
10293
10294struct afe_lpass_clk_config_command_v2 {
10295 struct apr_hdr hdr;
10296 struct afe_svc_cmd_set_param param;
10297 struct afe_svc_param_data pdata;
10298 struct afe_clk_set clk_cfg;
10299} __packed;
10300
10301/*
10302 * reg_data's size can be up to AFE_MAX_CDC_REGISTERS_TO_CONFIG
10303 */
10304struct afe_svc_cmd_cdc_reg_cfg {
10305 struct apr_hdr hdr;
10306 struct afe_svc_cmd_set_param param;
10307 struct afe_param_cdc_reg_cfg_payload reg_data[0];
10308} __packed;
10309
10310struct afe_svc_cmd_init_cdc_reg_cfg {
10311 struct apr_hdr hdr;
10312 struct afe_svc_cmd_set_param param;
10313 struct afe_port_param_data_v2 init;
10314} __packed;
10315
10316struct afe_svc_cmd_sb_slave_cfg {
10317 struct apr_hdr hdr;
10318 struct afe_svc_cmd_set_param param;
10319 struct afe_port_param_data_v2 pdata;
10320 struct afe_param_cdc_slimbus_slave_cfg sb_slave_cfg;
10321} __packed;
10322
10323struct afe_svc_cmd_cdc_reg_page_cfg {
10324 struct apr_hdr hdr;
10325 struct afe_svc_cmd_set_param param;
10326 struct afe_port_param_data_v2 pdata;
10327 struct afe_param_cdc_reg_page_cfg cdc_reg_page_cfg;
10328} __packed;
10329
10330struct afe_svc_cmd_cdc_aanc_version {
10331 struct apr_hdr hdr;
10332 struct afe_svc_cmd_set_param param;
10333 struct afe_port_param_data_v2 pdata;
10334 struct afe_param_id_cdc_aanc_version version;
10335} __packed;
10336
10337struct afe_port_cmd_set_aanc_param {
10338 struct apr_hdr hdr;
10339 struct afe_port_cmd_set_param_v2 param;
10340 struct afe_port_param_data_v2 pdata;
10341 union {
10342 struct afe_param_aanc_port_cfg aanc_port_cfg;
10343 struct afe_mod_enable_param mod_enable;
10344 } __packed data;
10345} __packed;
10346
10347struct afe_port_cmd_set_aanc_acdb_table {
10348 struct apr_hdr hdr;
10349 struct afe_port_cmd_set_param_v2 param;
10350} __packed;
10351
10352/* Dolby DAP topology */
10353#define DOLBY_ADM_COPP_TOPOLOGY_ID 0x0001033B
10354#define DS2_ADM_COPP_TOPOLOGY_ID 0x1301033B
10355
10356/* RMS value from DSP */
10357#define RMS_MODULEID_APPI_PASSTHRU 0x10009011
10358#define RMS_PARAM_FIRST_SAMPLE 0x10009012
10359#define RMS_PAYLOAD_LEN 4
10360
10361/* Customized mixing in matix mixer */
10362#define MTMX_MODULE_ID_DEFAULT_CHMIXER 0x00010341
10363#define DEFAULT_CHMIXER_PARAM_ID_COEFF 0x00010342
10364#define CUSTOM_STEREO_PAYLOAD_SIZE 9
10365#define CUSTOM_STEREO_CMD_PARAM_SIZE 24
10366#define CUSTOM_STEREO_NUM_OUT_CH 0x0002
10367#define CUSTOM_STEREO_NUM_IN_CH 0x0002
10368#define CUSTOM_STEREO_INDEX_PARAM 0x0002
10369#define Q14_GAIN_ZERO_POINT_FIVE 0x2000
10370#define Q14_GAIN_UNITY 0x4000
10371
10372struct afe_svc_cmd_set_clip_bank_selection {
10373 struct apr_hdr hdr;
10374 struct afe_svc_cmd_set_param param;
10375 struct afe_port_param_data_v2 pdata;
10376 struct afe_param_id_clip_bank_sel bank_sel;
10377} __packed;
10378
10379/* Ultrasound supported formats */
10380#define US_POINT_EPOS_FORMAT_V2 0x0001272D
10381#define US_RAW_FORMAT_V2 0x0001272C
10382#define US_PROX_FORMAT_V4 0x0001273B
10383#define US_RAW_SYNC_FORMAT 0x0001272F
10384#define US_GES_SYNC_FORMAT 0x00012730
10385
10386#define AFE_MODULE_GROUP_DEVICE 0x00010254
10387#define AFE_PARAM_ID_GROUP_DEVICE_CFG 0x00010255
10388#define AFE_PARAM_ID_GROUP_DEVICE_ENABLE 0x00010256
10389#define AFE_GROUP_DEVICE_ID_SECONDARY_MI2S_RX 0x1102
10390
10391/* Payload of the #AFE_PARAM_ID_GROUP_DEVICE_CFG
10392 * parameter, which configures max of 8 AFE ports
10393 * into a group.
10394 * The fixed size of this structure is sixteen bytes.
10395 */
10396struct afe_group_device_group_cfg {
10397 u32 minor_version;
10398 u16 group_id;
10399 u16 num_channels;
10400 u16 port_id[8];
10401} __packed;
10402
10403#define AFE_GROUP_DEVICE_ID_PRIMARY_TDM_RX \
10404 (AFE_PORT_ID_PRIMARY_TDM_RX + 0x100)
10405#define AFE_GROUP_DEVICE_ID_PRIMARY_TDM_TX \
10406 (AFE_PORT_ID_PRIMARY_TDM_TX + 0x100)
10407#define AFE_GROUP_DEVICE_ID_SECONDARY_TDM_RX \
10408 (AFE_PORT_ID_SECONDARY_TDM_RX + 0x100)
10409#define AFE_GROUP_DEVICE_ID_SECONDARY_TDM_TX \
10410 (AFE_PORT_ID_SECONDARY_TDM_TX + 0x100)
10411#define AFE_GROUP_DEVICE_ID_TERTIARY_TDM_RX \
10412 (AFE_PORT_ID_TERTIARY_TDM_RX + 0x100)
10413#define AFE_GROUP_DEVICE_ID_TERTIARY_TDM_TX \
10414 (AFE_PORT_ID_TERTIARY_TDM_TX + 0x100)
10415#define AFE_GROUP_DEVICE_ID_QUATERNARY_TDM_RX \
10416 (AFE_PORT_ID_QUATERNARY_TDM_RX + 0x100)
10417#define AFE_GROUP_DEVICE_ID_QUATERNARY_TDM_TX \
10418 (AFE_PORT_ID_QUATERNARY_TDM_TX + 0x100)
Rohit Kumara5077932017-09-10 22:05:05 +053010419#define AFE_GROUP_DEVICE_ID_QUINARY_TDM_RX \
10420 (AFE_PORT_ID_QUINARY_TDM_RX + 0x100)
10421#define AFE_GROUP_DEVICE_ID_QUINARY_TDM_TX \
10422 (AFE_PORT_ID_QUINARY_TDM_TX + 0x100)
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +053010423
10424/* ID of the parameter used by #AFE_MODULE_GROUP_DEVICE to configure the
10425 * group device. #AFE_SVC_CMD_SET_PARAM can use this parameter ID.
10426 *
10427 * Requirements:
10428 * - Configure the group before the member ports in the group are
10429 * configured and started.
10430 * - Enable the group only after it is configured.
10431 * - Stop all member ports in the group before disabling the group.
10432 */
10433#define AFE_PARAM_ID_GROUP_DEVICE_TDM_CONFIG 0x0001029E
10434
10435/* Version information used to handle future additions to
10436 * AFE_PARAM_ID_GROUP_DEVICE_TDM_CONFIG processing (for backward compatibility).
10437 */
10438#define AFE_API_VERSION_GROUP_DEVICE_TDM_CONFIG 0x1
10439
10440/* Number of AFE ports in group device */
10441#define AFE_GROUP_DEVICE_NUM_PORTS 8
10442
10443/* Payload of the AFE_PARAM_ID_GROUP_DEVICE_TDM_CONFIG parameter ID
10444 * used by AFE_MODULE_GROUP_DEVICE.
10445 */
10446struct afe_param_id_group_device_tdm_cfg {
10447 u32 group_device_cfg_minor_version;
10448 /* Minor version used to track group device configuration.
10449 * @values #AFE_API_VERSION_GROUP_DEVICE_TDM_CONFIG
10450 */
10451
10452 u16 group_id;
10453 /* ID for the group device.
10454 * @values
10455 * - #AFE_GROUP_DEVICE_ID_PRIMARY_TDM_RX
10456 * - #AFE_GROUP_DEVICE_ID_PRIMARY_TDM_TX
10457 * - #AFE_GROUP_DEVICE_ID_SECONDARY_TDM_RX
10458 * - #AFE_GROUP_DEVICE_ID_SECONDARY_TDM_TX
10459 * - #AFE_GROUP_DEVICE_ID_TERTIARY_TDM_RX
10460 * - #AFE_GROUP_DEVICE_ID_TERTIARY_TDM_TX
10461 * - #AFE_GROUP_DEVICE_ID_QUATERNARY_TDM_RX
10462 * - #AFE_GROUP_DEVICE_ID_QUATERNARY_TDM_TX
10463 */
10464
10465 u16 reserved;
10466 /* 0 */
10467
10468 u16 port_id[AFE_GROUP_DEVICE_NUM_PORTS];
10469 /* Array of member port IDs of this group.
10470 * @values
10471 * - #AFE_PORT_ID_PRIMARY_TDM_RX
10472 * - #AFE_PORT_ID_PRIMARY_TDM_RX_1
10473 * - #AFE_PORT_ID_PRIMARY_TDM_RX_2
10474 * - #AFE_PORT_ID_PRIMARY_TDM_RX_3
10475 * - #AFE_PORT_ID_PRIMARY_TDM_RX_4
10476 * - #AFE_PORT_ID_PRIMARY_TDM_RX_5
10477 * - #AFE_PORT_ID_PRIMARY_TDM_RX_6
10478 * - #AFE_PORT_ID_PRIMARY_TDM_RX_7
10479
10480 * - #AFE_PORT_ID_PRIMARY_TDM_TX
10481 * - #AFE_PORT_ID_PRIMARY_TDM_TX_1
10482 * - #AFE_PORT_ID_PRIMARY_TDM_TX_2
10483 * - #AFE_PORT_ID_PRIMARY_TDM_TX_3
10484 * - #AFE_PORT_ID_PRIMARY_TDM_TX_4
10485 * - #AFE_PORT_ID_PRIMARY_TDM_TX_5
10486 * - #AFE_PORT_ID_PRIMARY_TDM_TX_6
10487 * - #AFE_PORT_ID_PRIMARY_TDM_TX_7
10488
10489 * - #AFE_PORT_ID_SECONDARY_TDM_RX
10490 * - #AFE_PORT_ID_SECONDARY_TDM_RX_1
10491 * - #AFE_PORT_ID_SECONDARY_TDM_RX_2
10492 * - #AFE_PORT_ID_SECONDARY_TDM_RX_3
10493 * - #AFE_PORT_ID_SECONDARY_TDM_RX_4
10494 * - #AFE_PORT_ID_SECONDARY_TDM_RX_5
10495 * - #AFE_PORT_ID_SECONDARY_TDM_RX_6
10496 * - #AFE_PORT_ID_SECONDARY_TDM_RX_7
10497
10498 * - #AFE_PORT_ID_SECONDARY_TDM_TX
10499 * - #AFE_PORT_ID_SECONDARY_TDM_TX_1
10500 * - #AFE_PORT_ID_SECONDARY_TDM_TX_2
10501 * - #AFE_PORT_ID_SECONDARY_TDM_TX_3
10502 * - #AFE_PORT_ID_SECONDARY_TDM_TX_4
10503 * - #AFE_PORT_ID_SECONDARY_TDM_TX_5
10504 * - #AFE_PORT_ID_SECONDARY_TDM_TX_6
10505 * - #AFE_PORT_ID_SECONDARY_TDM_TX_7
10506
10507 * - #AFE_PORT_ID_TERTIARY_TDM_RX
10508 * - #AFE_PORT_ID_TERTIARY_TDM_RX_1
10509 * - #AFE_PORT_ID_TERTIARY_TDM_RX_2
10510 * - #AFE_PORT_ID_TERTIARY_TDM_RX_3
10511 * - #AFE_PORT_ID_TERTIARY_TDM_RX_4
10512 * - #AFE_PORT_ID_TERTIARY_TDM_RX_5
10513 * - #AFE_PORT_ID_TERTIARY_TDM_RX_6
10514 * - #AFE_PORT_ID_TERTIARY_TDM_RX_7
10515
10516 * - #AFE_PORT_ID_TERTIARY_TDM_TX
10517 * - #AFE_PORT_ID_TERTIARY_TDM_TX_1
10518 * - #AFE_PORT_ID_TERTIARY_TDM_TX_2
10519 * - #AFE_PORT_ID_TERTIARY_TDM_TX_3
10520 * - #AFE_PORT_ID_TERTIARY_TDM_TX_4
10521 * - #AFE_PORT_ID_TERTIARY_TDM_TX_5
10522 * - #AFE_PORT_ID_TERTIARY_TDM_TX_6
10523 * - #AFE_PORT_ID_TERTIARY_TDM_TX_7
10524
10525 * - #AFE_PORT_ID_QUATERNARY_TDM_RX
10526 * - #AFE_PORT_ID_QUATERNARY_TDM_RX_1
10527 * - #AFE_PORT_ID_QUATERNARY_TDM_RX_2
10528 * - #AFE_PORT_ID_QUATERNARY_TDM_RX_3
10529 * - #AFE_PORT_ID_QUATERNARY_TDM_RX_4
10530 * - #AFE_PORT_ID_QUATERNARY_TDM_RX_5
10531 * - #AFE_PORT_ID_QUATERNARY_TDM_RX_6
10532 * - #AFE_PORT_ID_QUATERNARY_TDM_RX_7
10533
10534 * - #AFE_PORT_ID_QUATERNARY_TDM_TX
10535 * - #AFE_PORT_ID_QUATERNARY_TDM_TX_1
10536 * - #AFE_PORT_ID_QUATERNARY_TDM_TX_2
10537 * - #AFE_PORT_ID_QUATERNARY_TDM_TX_3
10538 * - #AFE_PORT_ID_QUATERNARY_TDM_TX_4
10539 * - #AFE_PORT_ID_QUATERNARY_TDM_TX_5
10540 * - #AFE_PORT_ID_QUATERNARY_TDM_TX_6
10541 * - #AFE_PORT_ID_QUATERNARY_TDM_TX_7
10542 * @tablebulletend
10543 */
10544
10545 u32 num_channels;
10546 /* Number of enabled slots for TDM frame.
10547 * @values 1 to 8
10548 */
10549
10550 u32 sample_rate;
10551 /* Sampling rate of the port.
10552 * @values
10553 * - #AFE_PORT_SAMPLE_RATE_8K
10554 * - #AFE_PORT_SAMPLE_RATE_16K
10555 * - #AFE_PORT_SAMPLE_RATE_24K
10556 * - #AFE_PORT_SAMPLE_RATE_32K
10557 * - #AFE_PORT_SAMPLE_RATE_48K @tablebulletend
10558 */
10559
10560 u32 bit_width;
10561 /* Bit width of the sample.
10562 * @values 16, 24, (32)
10563 */
10564
10565 u16 nslots_per_frame;
10566 /* Number of slots per frame. Typical : 1, 2, 4, 8, 16, 32.
10567 * @values 1 - 32
10568 */
10569
10570 u16 slot_width;
10571 /* Slot width of the slot in a TDM frame. (slot_width >= bit_width)
10572 * have to be satisfied.
10573 * @values 16, 24, 32
10574 */
10575
10576 u32 slot_mask;
10577 /* Position of active slots. When that bit is set, that paricular
10578 * slot is active.
10579 * Number of active slots can be inferred by number of bits set in
10580 * the mask. Only 8 individual bits can be enabled.
10581 * Bits 0..31 corresponding to slot 0..31
10582 * @values 1 to 2^32 -1
10583 */
10584} __packed;
10585
10586/* Payload of the #AFE_PARAM_ID_GROUP_DEVICE_ENABLE
10587 * parameter, which enables or
10588 * disables any module.
10589 * The fixed size of this structure is four bytes.
10590 */
10591
10592struct afe_group_device_enable {
10593 u16 group_id;
10594 /* valid value is AFE_GROUP_DEVICE_ID_SECONDARY_MI2S_RX */
10595 u16 enable;
10596 /* Enables (1) or disables (0) the module. */
10597} __packed;
10598
10599union afe_port_group_config {
10600 struct afe_group_device_group_cfg group_cfg;
10601 struct afe_group_device_enable group_enable;
10602 struct afe_param_id_group_device_tdm_cfg tdm_cfg;
10603} __packed;
10604
10605struct afe_port_group_create {
10606 struct apr_hdr hdr;
10607 struct afe_svc_cmd_set_param param;
10608 struct afe_port_param_data_v2 pdata;
10609 union afe_port_group_config data;
10610} __packed;
10611
10612/* ID of the parameter used by #AFE_MODULE_AUDIO_DEV_INTERFACE to specify
10613 * the timing statistics of the corresponding device interface.
10614 * Client can periodically query for the device time statistics to help adjust
10615 * the PLL based on the drift value. The get param command must be sent to
10616 * AFE port ID corresponding to device interface
10617
10618 * This parameter ID supports following get param commands:
10619 * #AFE_PORT_CMD_GET_PARAM_V2 and
10620 * #AFE_PORT_CMD_GET_PARAM_V3.
10621 */
10622#define AFE_PARAM_ID_DEV_TIMING_STATS 0x000102AD
10623
10624/* Version information used to handle future additions to AFE device
10625 * interface timing statistics (for backward compatibility).
10626 */
10627#define AFE_API_VERSION_DEV_TIMING_STATS 0x1
10628
10629/* Enumeration for specifying a sink(Rx) device */
10630#define AFE_SINK_DEVICE 0x0
10631
10632/* Enumeration for specifying a source(Tx) device */
10633#define AFE_SOURCE_DEVICE 0x1
10634
10635/* Enumeration for specifying the drift reference is of type AV Timer */
10636#define AFE_REF_TIMER_TYPE_AVTIMER 0x0
10637
10638/* Message payload structure for the
10639 * AFE_PARAM_ID_DEV_TIMING_STATS parameter.
10640 */
10641struct afe_param_id_dev_timing_stats {
10642 /* Minor version used to track the version of device interface timing
10643 * statistics. Currently, the supported version is 1.
10644 * @values #AFE_API_VERSION_DEV_TIMING_STATS
10645 */
10646 u32 minor_version;
10647
10648 /* Indicates the device interface direction as either
10649 * source (Tx) or sink (Rx).
10650 * @values
10651 * #AFE_SINK_DEVICE
10652 * #AFE_SOURCE_DEVICE
10653 */
10654 u16 device_direction;
10655
10656 /* Reference timer for drift accumulation and time stamp information.
10657 * @values
10658 * #AFE_REF_TIMER_TYPE_AVTIMER @tablebulletend
10659 */
10660 u16 reference_timer;
10661
10662 /*
10663 * Flag to indicate if resync is required on the client side for
10664 * drift correction. Flag is set to TRUE for the first get_param
10665 * response after device interface starts. This flag value can be
10666 * used by client to identify if device interface restart has
10667 * happened and if any re-sync is required at their end for drift
10668 * correction.
10669 * @values
10670 * 0: FALSE (Resync not required)
10671 * 1: TRUE (Resync required) @tablebulletend
10672 */
10673 u32 resync_flag;
10674
10675 /* Accumulated drift value in microseconds. This value is updated
10676 * every 100th ms.
10677 * Positive drift value indicates AV timer is running faster than device
10678 * Negative drift value indicates AV timer is running slower than device
10679 * @values Any valid int32 number
10680 */
10681 s32 acc_drift_value;
10682
10683 /* Lower 32 bits of the 64-bit absolute timestamp of reference
10684 * timer in microseconds.
10685
10686 * This timestamp corresponds to the time when the drift values
10687 * are accumlated for every 100th ms.
10688 * @values Any valid uint32 number
10689 */
10690 u32 ref_timer_abs_ts_lsw;
10691
10692 /* Upper 32 bits of the 64-bit absolute timestamp of reference
10693 * timer in microseconds.
10694 * This timestamp corresponds to the time when the drift values
10695 * are accumlated for every 100th ms.
10696 * @values Any valid uint32 number
10697 */
10698 u32 ref_timer_abs_ts_msw;
10699} __packed;
10700
10701struct afe_av_dev_drift_get_param {
10702 struct apr_hdr hdr;
10703 struct afe_port_cmd_get_param_v2 get_param;
10704 struct afe_port_param_data_v2 pdata;
10705 struct afe_param_id_dev_timing_stats timing_stats;
10706} __packed;
10707
10708struct afe_av_dev_drift_get_param_resp {
10709 uint32_t status;
10710 struct afe_port_param_data_v2 pdata;
10711 struct afe_param_id_dev_timing_stats timing_stats;
10712} __packed;
10713
10714/* Command for Matrix or Stream Router */
10715#define ASM_SESSION_CMD_SET_MTMX_STRTR_PARAMS_V2 0x00010DCE
10716/* Module for AVSYNC */
10717#define ASM_SESSION_MTMX_STRTR_MODULE_ID_AVSYNC 0x00010DC6
10718
10719/* Parameter used by #ASM_SESSION_MTMX_STRTR_MODULE_ID_AVSYNC to specify the
10720 * render window start value. This parameter is supported only for a Set
10721 * command (not a Get command) in the Rx direction
10722 * (#ASM_SESSION_CMD_SET_MTMX_STRTR_PARAMS_V2).
10723 * Render window start is a value (session time minus timestamp, or ST-TS)
10724 * below which frames are held, and after which frames are immediately
10725 * rendered.
10726 */
10727#define ASM_SESSION_MTMX_STRTR_PARAM_RENDER_WINDOW_START_V2 0x00010DD1
10728
10729/* Parameter used by #ASM_SESSION_MTMX_STRTR_MODULE_ID_AVSYNC to specify the
10730 * render window end value. This parameter is supported only for a Set
10731 * command (not a Get command) in the Rx direction
10732 * (#ASM_SESSION_CMD_SET_MTMX_STRTR_PARAMS_V2). Render window end is a value
10733 * (session time minus timestamp) above which frames are dropped, and below
10734 * which frames are immediately rendered.
10735 */
10736#define ASM_SESSION_MTMX_STRTR_PARAM_RENDER_WINDOW_END_V2 0x00010DD2
10737
10738/* Generic payload of the window parameters in the
10739 * #ASM_SESSION_MTMX_STRTR_MODULE_ID_AVSYNC module.
10740 * This payload is supported only for a Set command
10741 * (not a Get command) on the Rx path.
10742 */
10743struct asm_session_mtmx_strtr_param_window_v2_t {
10744 u32 window_lsw;
10745 /* Lower 32 bits of the render window start value. */
10746
10747 u32 window_msw;
10748 /* Upper 32 bits of the render window start value.
10749 *
10750 * The 64-bit number formed by window_lsw and window_msw specifies a
10751 * signed 64-bit window value in microseconds. The sign extension is
10752 * necessary. This value is used by the following parameter IDs:
10753 * #ASM_SESSION_MTMX_STRTR_PARAM_RENDER_WINDOW_START_V2
10754 * #ASM_SESSION_MTMX_STRTR_PARAM_RENDER_WINDOW_END_V2
10755 * #ASM_SESSION_MTMX_STRTR_PARAM_STAT_WINDOW_START_V2
10756 * #ASM_SESSION_MTMX_STRTR_PARAM_STAT_WINDOW_END_V2
10757 * The value depends on which parameter ID is used.
10758 * The aDSP honors the windows at a granularity of 1 ms.
10759 */
10760};
10761
10762struct asm_session_cmd_set_mtmx_strstr_params_v2 {
10763 uint32_t data_payload_addr_lsw;
10764 /* Lower 32 bits of the 64-bit data payload address. */
10765
10766 uint32_t data_payload_addr_msw;
10767 /* Upper 32 bits of the 64-bit data payload address.
10768 * If the address is not sent (NULL), the message is in the payload.
10769 * If the address is sent (non-NULL), the parameter data payloads
10770 * begin at the specified address.
10771 */
10772
10773 uint32_t mem_map_handle;
10774 /* Unique identifier for an address. This memory map handle is returned
10775 * by the aDSP through the #ASM_CMD_SHARED_MEM_MAP_REGIONS command.
10776 * values
10777 * - NULL -- Parameter data payloads are within the message payload
10778 * (in-band).
10779 * - Non-NULL -- Parameter data payloads begin at the address specified
10780 * in the data_payload_addr_lsw and data_payload_addr_msw fields
10781 * (out-of-band).
10782 */
10783
10784 uint32_t data_payload_size;
10785 /* Actual size of the variable payload accompanying the message, or in
10786 * shared memory. This field is used for parsing the parameter payload.
10787 * values > 0 bytes
10788 */
10789
10790 uint32_t direction;
10791 /* Direction of the entity (matrix mixer or stream router) on which
10792 * the parameter is to be set.
10793 * values
10794 * - 0 -- Rx (for Rx stream router or Rx matrix mixer)
10795 * - 1 -- Tx (for Tx stream router or Tx matrix mixer)
10796 */
10797};
10798
10799/* Parameter used by #ASM_SESSION_MTMX_STRTR_MODULE_ID_AVSYNC which allows the
10800 * audio client choose the rendering decision that the audio DSP should use.
10801 */
10802#define ASM_SESSION_MTMX_STRTR_PARAM_RENDER_MODE_CMD 0x00012F0D
10803
10804/* Indicates that rendering decision will be based on default rate
10805 * (session clock based rendering, device driven).
10806 * 1. The default session clock based rendering is inherently driven
10807 * by the timing of the device.
10808 * 2. After the initial decision is made (first buffer after a run
10809 * command), subsequent data rendering decisions are made with
10810 * respect to the rate at which the device is rendering, thus deriving
10811 * its timing from the device.
10812 * 3. While this decision making is simple, it has some inherent limitations
10813 * (mentioned in the next section).
10814 * 4. If this API is not set, the session clock based rendering will be assumed
10815 * and this will ensure that the DSP is backward compatible.
10816 */
10817#define ASM_SESSION_MTMX_STRTR_PARAM_RENDER_DEFAULT 0
10818
10819/* Indicates that rendering decision will be based on local clock rate.
10820 * 1. In the DSP loopback/client loopback use cases (frame based
10821 * inputs), the incoming data into audio DSP is time-stamped at the
10822 * local clock rate (STC).
10823 * 2. This TS rate may match the incoming data rate or maybe different
10824 * from the incoming data rate.
10825 * 3. Regardless, the data will be time-stamped with local STC and
10826 * therefore, the client is recommended to set this mode for these
10827 * use cases. This method is inherently more robust to sequencing
10828 * (AFE Start/Stop) and device switches, among other benefits.
10829 * 4. This API will inform the DSP to compare every incoming buffer TS
10830 * against local STC.
10831 * 5. DSP will continue to honor render windows APIs, as before.
10832 */
10833#define ASM_SESSION_MTMX_STRTR_PARAM_RENDER_LOCAL_STC 1
10834
10835/* Structure for rendering decision parameter */
10836struct asm_session_mtmx_strtr_param_render_mode_t {
10837 /* Specifies the type of rendering decision the audio DSP should use.
10838 *
10839 * @values
10840 * - #ASM_SESSION_MTMX_STRTR_PARAM_RENDER_DEFAULT
10841 * - #ASM_SESSION_MTMX_STRTR_PARAM_RENDER_LOCAL_STC
10842 */
10843 u32 flags;
10844} __packed;
10845
10846/* Parameter used by #ASM_SESSION_MTMX_STRTR_MODULE_ID_AVSYNC which allows the
10847 * audio client to specify the clock recovery mechanism that the audio DSP
10848 * should use.
10849 */
10850
10851#define ASM_SESSION_MTMX_STRTR_PARAM_CLK_REC_CMD 0x00012F0E
10852
10853/* Indicates that default clock recovery will be used (no clock recovery).
10854 * If the client wishes that no clock recovery be done, the client can
10855 * choose this. This means that no attempt will made by the DSP to try and
10856 * match the rates of the input and output audio.
10857 */
10858#define ASM_SESSION_MTMX_STRTR_PARAM_CLK_REC_NONE 0
10859
10860/* Indicates that independent clock recovery needs to be used.
10861 * 1. In the DSP loopback/client loopback use cases (frame based inputs),
10862 * the client should choose the independent clock recovery option.
10863 * 2. This basically de-couples the audio and video from knowing each others
10864 * clock sources and lets the audio DSP independently rate match the input
10865 * and output rates.
10866 * 3. After drift detection, the drift correction is achieved by either pulling
10867 * the PLLs (if applicable) or by stream to device rate matching
10868 * (for PCM use cases) by comparing drift with respect to STC.
10869 * 4. For passthrough use cases, since the PLL pulling is the only option,
10870 * a best effort will be made.
10871 * If PLL pulling is not possible / available, the rendering will be
10872 * done without rate matching.
10873 */
10874#define ASM_SESSION_MTMX_STRTR_PARAM_CLK_REC_AUTO 1
10875
10876/* Payload of the #ASM_SESSION_MTMX_STRTR_PARAM_CLK_REC parameter.
10877 */
10878struct asm_session_mtmx_strtr_param_clk_rec_t {
10879 /* Specifies the type of clock recovery that the audio DSP should
10880 * use for rate matching.
10881 */
10882
10883 /* @values
10884 * #ASM_SESSION_MTMX_STRTR_PARAM_CLK_REC_DEFAULT
10885 * #ASM_SESSION_MTMX_STRTR_PARAM_CLK_REC_INDEPENDENT
10886 */
10887 u32 flags;
10888} __packed;
10889
10890
10891/* Parameter used by #ASM_SESSION_MTMX_STRTR_MODULE_ID_AVSYNC to
10892 * realize smoother adjustment of audio session clock for a specified session.
10893 * The desired audio session clock adjustment(in micro seconds) is specified
10894 * using the command #ASM_SESSION_CMD_ADJUST_SESSION_CLOCK_V2.
10895 * Delaying/Advancing the session clock would be implemented by inserting
10896 * interpolated/dropping audio samples in the playback path respectively.
10897 * Also, this parameter has to be configured before the Audio Session is put
10898 * to RUN state to avoid cold start latency/glitches in the playback.
10899 */
10900
10901#define ASM_SESSION_MTMX_PARAM_ADJUST_SESSION_TIME_CTL 0x00013217
10902
10903struct asm_session_mtmx_param_adjust_session_time_ctl_t {
10904 /* Specifies whether the module is enabled or not
10905 * @values
10906 * 0 -- disabled
10907 * 1 -- enabled
10908 */
10909 u32 enable;
10910};
10911
10912union asm_session_mtmx_strtr_param_config {
10913 struct asm_session_mtmx_strtr_param_window_v2_t window_param;
10914 struct asm_session_mtmx_strtr_param_render_mode_t render_param;
10915 struct asm_session_mtmx_strtr_param_clk_rec_t clk_rec_param;
10916 struct asm_session_mtmx_param_adjust_session_time_ctl_t adj_time_param;
10917} __packed;
10918
10919struct asm_mtmx_strtr_params {
10920 struct apr_hdr hdr;
10921 struct asm_session_cmd_set_mtmx_strstr_params_v2 param;
10922 struct asm_stream_param_data_v2 data;
10923 union asm_session_mtmx_strtr_param_config config;
10924} __packed;
10925
10926#define ASM_SESSION_CMD_GET_MTMX_STRTR_PARAMS_V2 0x00010DCF
10927#define ASM_SESSION_CMDRSP_GET_MTMX_STRTR_PARAMS_V2 0x00010DD0
10928
10929#define ASM_SESSION_MTMX_STRTR_PARAM_SESSION_TIME_V3 0x00012F0B
10930#define ASM_SESSION_MTMX_STRTR_PARAM_STIME_TSTMP_FLG_BMASK (0x80000000UL)
10931
10932struct asm_session_cmd_get_mtmx_strstr_params_v2 {
10933 uint32_t data_payload_addr_lsw;
10934 /* Lower 32 bits of the 64-bit data payload address. */
10935
10936 uint32_t data_payload_addr_msw;
10937 /*
10938 * Upper 32 bits of the 64-bit data payload address.
10939 * If the address is not sent (NULL), the message is in the payload.
10940 * If the address is sent (non-NULL), the parameter data payloads
10941 * begin at the specified address.
10942 */
10943
10944 uint32_t mem_map_handle;
10945 /*
10946 * Unique identifier for an address. This memory map handle is returned
10947 * by the aDSP through the #ASM_CMD_SHARED_MEM_MAP_REGIONS command.
10948 * values
10949 * - NULL -- Parameter data payloads are within the message payload
10950 * (in-band).
10951 * - Non-NULL -- Parameter data payloads begin at the address specified
10952 * in the data_payload_addr_lsw and data_payload_addr_msw fields
10953 * (out-of-band).
10954 */
10955 uint32_t direction;
10956 /*
10957 * Direction of the entity (matrix mixer or stream router) on which
10958 * the parameter is to be set.
10959 * values
10960 * - 0 -- Rx (for Rx stream router or Rx matrix mixer)
10961 * - 1 -- Tx (for Tx stream router or Tx matrix mixer)
10962 */
10963 uint32_t module_id;
10964 /* Unique module ID. */
10965
10966 uint32_t param_id;
10967 /* Unique parameter ID. */
10968
10969 uint32_t param_max_size;
10970};
10971
10972struct asm_session_mtmx_strtr_param_session_time_v3_t {
10973 uint32_t session_time_lsw;
10974 /* Lower 32 bits of the current session time in microseconds */
10975
10976 uint32_t session_time_msw;
10977 /*
10978 * Upper 32 bits of the current session time in microseconds.
10979 * The 64-bit number formed by session_time_lsw and session_time_msw
10980 * is treated as signed.
10981 */
10982
10983 uint32_t absolute_time_lsw;
10984 /*
10985 * Lower 32 bits of the 64-bit absolute time in microseconds.
10986 * This is the time when the sample corresponding to the
10987 * session_time_lsw is rendered to the hardware. This absolute
10988 * time can be slightly in the future or past.
10989 */
10990
10991 uint32_t absolute_time_msw;
10992 /*
10993 * Upper 32 bits of the 64-bit absolute time in microseconds.
10994 * This is the time when the sample corresponding to the
10995 * session_time_msw is rendered to hardware. This absolute
10996 * time can be slightly in the future or past. The 64-bit number
10997 * formed by absolute_time_lsw and absolute_time_msw is treated as
10998 * unsigned.
10999 */
11000
11001 uint32_t time_stamp_lsw;
11002 /* Lower 32 bits of the last processed timestamp in microseconds */
11003
11004 uint32_t time_stamp_msw;
11005 /*
11006 * Upper 32 bits of the last processed timestamp in microseconds.
11007 * The 64-bit number formed by time_stamp_lsw and time_stamp_lsw
11008 * is treated as unsigned.
11009 */
11010
11011 uint32_t flags;
11012 /*
11013 * Keeps track of any additional flags needed.
11014 * @values{for bit 31}
11015 * - 0 -- Uninitialized/invalid
11016 * - 1 -- Valid
11017 * All other bits are reserved; clients must set them to zero.
11018 */
11019};
11020
11021union asm_session_mtmx_strtr_data_type {
11022 struct asm_session_mtmx_strtr_param_session_time_v3_t session_time;
11023};
11024
11025struct asm_mtmx_strtr_get_params {
11026 struct apr_hdr hdr;
11027 struct asm_session_cmd_get_mtmx_strstr_params_v2 param_info;
11028} __packed;
11029
11030struct asm_mtmx_strtr_get_params_cmdrsp {
11031 uint32_t err_code;
11032 struct asm_stream_param_data_v2 param_info;
11033 union asm_session_mtmx_strtr_data_type param_data;
11034} __packed;
11035
11036#define AUDPROC_MODULE_ID_RESAMPLER 0x00010719
11037
11038enum {
11039 LEGACY_PCM = 0,
11040 COMPRESSED_PASSTHROUGH,
11041 COMPRESSED_PASSTHROUGH_CONVERT,
11042 COMPRESSED_PASSTHROUGH_DSD,
11043 LISTEN,
11044 COMPRESSED_PASSTHROUGH_GEN,
11045 COMPRESSED_PASSTHROUGH_IEC61937
11046};
11047
11048#define AUDPROC_MODULE_ID_COMPRESSED_MUTE 0x00010770
11049#define AUDPROC_PARAM_ID_COMPRESSED_MUTE 0x00010771
11050
11051struct adm_set_compressed_device_mute {
11052 struct adm_cmd_set_pp_params_v5 command;
11053 struct adm_param_data_v5 params;
11054 u32 mute_on;
11055} __packed;
11056
11057#define AUDPROC_MODULE_ID_COMPRESSED_LATENCY 0x0001076E
11058#define AUDPROC_PARAM_ID_COMPRESSED_LATENCY 0x0001076F
11059
11060struct adm_set_compressed_device_latency {
11061 struct adm_cmd_set_pp_params_v5 command;
11062 struct adm_param_data_v5 params;
11063 u32 latency;
11064} __packed;
11065
11066#define VOICEPROC_MODULE_ID_GENERIC_TX 0x00010EF6
11067#define VOICEPROC_PARAM_ID_FLUENCE_SOUNDFOCUS 0x00010E37
11068#define VOICEPROC_PARAM_ID_FLUENCE_SOURCETRACKING 0x00010E38
11069#define MAX_SECTORS 8
11070#define MAX_NOISE_SOURCE_INDICATORS 3
11071#define MAX_POLAR_ACTIVITY_INDICATORS 360
11072
11073struct sound_focus_param {
11074 uint16_t start_angle[MAX_SECTORS];
11075 uint8_t enable[MAX_SECTORS];
11076 uint16_t gain_step;
11077} __packed;
11078
11079struct source_tracking_param {
11080 uint8_t vad[MAX_SECTORS];
11081 uint16_t doa_speech;
11082 uint16_t doa_noise[MAX_NOISE_SOURCE_INDICATORS];
11083 uint8_t polar_activity[MAX_POLAR_ACTIVITY_INDICATORS];
11084} __packed;
11085
11086struct adm_param_fluence_soundfocus_t {
11087 uint16_t start_angles[MAX_SECTORS];
11088 uint8_t enables[MAX_SECTORS];
11089 uint16_t gain_step;
11090 uint16_t reserved;
11091} __packed;
11092
11093struct adm_set_fluence_soundfocus_param {
11094 struct adm_cmd_set_pp_params_v5 params;
11095 struct adm_param_data_v5 data;
11096 struct adm_param_fluence_soundfocus_t soundfocus_data;
11097} __packed;
11098
11099struct adm_param_fluence_sourcetracking_t {
11100 uint8_t vad[MAX_SECTORS];
11101 uint16_t doa_speech;
11102 uint16_t doa_noise[MAX_NOISE_SOURCE_INDICATORS];
11103 uint8_t polar_activity[MAX_POLAR_ACTIVITY_INDICATORS];
11104} __packed;
11105
11106#define AUDPROC_MODULE_ID_AUDIOSPHERE 0x00010916
11107#define AUDPROC_PARAM_ID_AUDIOSPHERE_ENABLE 0x00010917
11108#define AUDPROC_PARAM_ID_AUDIOSPHERE_STRENGTH 0x00010918
11109#define AUDPROC_PARAM_ID_AUDIOSPHERE_CONFIG_MODE 0x00010919
11110
11111#define AUDPROC_PARAM_ID_AUDIOSPHERE_COEFFS_STEREO_INPUT 0x0001091A
11112#define AUDPROC_PARAM_ID_AUDIOSPHERE_COEFFS_MULTICHANNEL_INPUT 0x0001091B
11113#define AUDPROC_PARAM_ID_AUDIOSPHERE_DESIGN_STEREO_INPUT 0x0001091C
11114#define AUDPROC_PARAM_ID_AUDIOSPHERE_DESIGN_MULTICHANNEL_INPUT 0x0001091D
11115
11116#define AUDPROC_PARAM_ID_AUDIOSPHERE_OPERATING_INPUT_MEDIA_INFO 0x0001091E
11117
11118#define AUDPROC_MODULE_ID_VOICE_TX_SECNS 0x10027059
11119#define AUDPROC_PARAM_IDX_SEC_PRIMARY_MIC_CH 0x10014444
11120
11121struct admx_sec_primary_mic_ch {
11122 uint16_t version;
11123 uint16_t reserved;
11124 uint16_t sec_primary_mic_ch;
11125 uint16_t reserved1;
11126} __packed;
11127
11128
11129struct adm_set_sec_primary_ch_params {
11130 struct adm_cmd_set_pp_params_v5 params;
11131 struct adm_param_data_v5 data;
11132 struct admx_sec_primary_mic_ch sec_primary_mic_ch_data;
11133} __packed;
11134#endif /*_APR_AUDIO_V2_H_ */