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