/
apr_audio-v2.h
8021 lines (6715 loc) · 234 KB
/
apr_audio-v2.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/* Copyright (c) 2012-2015, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
* only version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#ifndef _APR_AUDIO_V2_H_
#define _APR_AUDIO_V2_H_
#include <linux/qdsp6v2/apr.h>
/* size of header needed for passing data out of band */
#define APR_CMD_OB_HDR_SZ 12
/* size of header needed for getting data */
#define APR_CMD_GET_HDR_SZ 16
struct param_outband {
size_t size;
void *kvaddr;
phys_addr_t paddr;
};
#define ADSP_ADM_VERSION 0x00070000
#define ADM_CMD_SHARED_MEM_MAP_REGIONS 0x00010322
#define ADM_CMDRSP_SHARED_MEM_MAP_REGIONS 0x00010323
#define ADM_CMD_SHARED_MEM_UNMAP_REGIONS 0x00010324
#define ADM_CMD_MATRIX_MAP_ROUTINGS_V5 0x00010325
#define ADM_CMD_STREAM_DEVICE_MAP_ROUTINGS_V5 0x0001033D
/* Enumeration for an audio Rx matrix ID.*/
#define ADM_MATRIX_ID_AUDIO_RX 0
#define ADM_MATRIX_ID_AUDIO_TX 1
#define ADM_MATRIX_ID_COMPRESSED_AUDIO_RX 2
/* Enumeration for an audio Tx matrix ID.*/
#define ADM_MATRIX_ID_AUDIOX 1
#define ADM_MAX_COPPS 5
/* make sure this matches with msm_audio_calibration */
#define SP_V2_NUM_MAX_SPKR 2
/* Session map node structure.
* Immediately following this structure are num_copps
* entries of COPP IDs. The COPP IDs are 16 bits, so
* there might be a padding 16-bit field if num_copps
* is odd.
*/
struct adm_session_map_node_v5 {
u16 session_id;
/* Handle of the ASM session to be routed. Supported values: 1
* to 8.
*/
u16 num_copps;
/* Number of COPPs to which this session is to be routed.
Supported values: 0 < num_copps <= ADM_MAX_COPPS.
*/
} __packed;
/* Payload of the #ADM_CMD_MATRIX_MAP_ROUTINGS_V5 command.
* Immediately following this structure are num_sessions of the session map
* node payload (adm_session_map_node_v5).
*/
struct adm_cmd_matrix_map_routings_v5 {
struct apr_hdr hdr;
u32 matrix_id;
/* Specifies whether the matrix ID is Audio Rx (0) or Audio Tx
* (1). Use the ADM_MATRIX_ID_AUDIO_RX or ADM_MATRIX_ID_AUDIOX
* macros to set this field.
*/
u32 num_sessions;
/* Number of sessions being updated by this command (optional).*/
} __packed;
/* This command allows a client to open a COPP/Voice Proc. TX module
* and sets up the device session: Matrix -> COPP -> AFE on the RX
* and AFE -> COPP -> Matrix on the TX. This enables PCM data to
* be transferred to/from the endpoint (AFEPortID).
*
* @return
* #ADM_CMDRSP_DEVICE_OPEN_V5 with the resulting status and
* COPP ID.
*/
#define ADM_CMD_DEVICE_OPEN_V5 0x00010326
/* Definition for a low latency stream session. */
#define ADM_LOW_LATENCY_DEVICE_SESSION 0x2000
/* Definition for a ultra low latency stream session. */
#define ADM_ULTRA_LOW_LATENCY_DEVICE_SESSION 0x4000
/* Definition for a legacy device session. */
#define ADM_LEGACY_DEVICE_SESSION 0
/* Indicates that endpoint_id_2 is to be ignored.*/
#define ADM_CMD_COPP_OPEN_END_POINT_ID_2_IGNORE 0xFFFF
#define ADM_CMD_COPP_OPEN_MODE_OF_OPERATION_RX_PATH_COPP 1
#define ADM_CMD_COPP_OPEN_MODE_OF_OPERATIONX_PATH_LIVE_COPP 2
#define ADM_CMD_COPP_OPEN_MODE_OF_OPERATIONX_PATH_NON_LIVE_COPP 3
/* Indicates that an audio COPP is to send/receive a mono PCM
* stream to/from
* END_POINT_ID_1.
*/
#define ADM_CMD_COPP_OPEN_CHANNEL_CONFIG_MONO 1
/* Indicates that an audio COPP is to send/receive a
* stereo PCM stream to/from END_POINT_ID_1.
*/
#define ADM_CMD_COPP_OPEN_CHANNEL_CONFIG_STEREO 2
/* Sample rate is 8000 Hz.*/
#define ADM_CMD_COPP_OPEN_SAMPLE_RATE_8K 8000
/* Sample rate is 16000 Hz.*/
#define ADM_CMD_COPP_OPEN_SAMPLE_RATE_16K 16000
/* Sample rate is 48000 Hz.*/
#define ADM_CMD_COPP_OPEN_SAMPLE_RATE_48K 48000
/* Definition for a COPP live input flag bitmask.*/
#define ADM_BIT_MASK_COPP_LIVE_INPUT_FLAG (0x0001U)
/* Definition for a COPP live shift value bitmask.*/
#define ADM_SHIFT_COPP_LIVE_INPUT_FLAG 0
/* Definition for the COPP ID bitmask.*/
#define ADM_BIT_MASK_COPP_ID (0x0000FFFFUL)
/* Definition for the COPP ID shift value.*/
#define ADM_SHIFT_COPP_ID 0
/* Definition for the service ID bitmask.*/
#define ADM_BIT_MASK_SERVICE_ID (0x00FF0000UL)
/* Definition for the service ID shift value.*/
#define ADM_SHIFT_SERVICE_ID 16
/* Definition for the domain ID bitmask.*/
#define ADM_BIT_MASK_DOMAIN_ID (0xFF000000UL)
/* Definition for the domain ID shift value.*/
#define ADM_SHIFT_DOMAIN_ID 24
/* ADM device open command payload of the
#ADM_CMD_DEVICE_OPEN_V5 command.
*/
struct adm_cmd_device_open_v5 {
struct apr_hdr hdr;
u16 flags;
/* Reserved for future use. Clients must set this field
* to zero.
*/
u16 mode_of_operation;
/* Specifies whether the COPP must be opened on the Tx or Rx
* path. Use the ADM_CMD_COPP_OPEN_MODE_OF_OPERATION_* macros for
* supported values and interpretation.
* Supported values:
* - 0x1 -- Rx path COPP
* - 0x2 -- Tx path live COPP
* - 0x3 -- Tx path nonlive COPP
* Live connections cause sample discarding in the Tx device
* matrix if the destination output ports do not pull them
* fast enough. Nonlive connections queue the samples
* indefinitely.
*/
u16 endpoint_id_1;
/* Logical and physical endpoint ID of the audio path.
* If the ID is a voice processor Tx block, it receives near
* samples. Supported values: Any pseudoport, AFE Rx port,
* or AFE Tx port For a list of valid IDs, refer to
* @xhyperref{Q4,[Q4]}.
* Q4 = Hexagon Multimedia: AFE Interface Specification
*/
u16 endpoint_id_2;
/* Logical and physical endpoint ID 2 for a voice processor
* Tx block.
* This is not applicable to audio COPP.
* Supported values:
* - AFE Rx port
* - 0xFFFF -- Endpoint 2 is unavailable and the voice
* processor Tx
* block ignores this endpoint
* When the voice processor Tx block is created on the audio
* record path,
* it can receive far-end samples from an AFE Rx port if the
* voice call
* is active. The ID of the AFE port is provided in this
* field.
* For a list of valid IDs, refer @xhyperref{Q4,[Q4]}.
*/
u32 topology_id;
/* Audio COPP topology ID; 32-bit GUID. */
u16 dev_num_channel;
/* Number of channels the audio COPP sends to/receives from
* the endpoint.
* Supported values: 1 to 8.
* The value is ignored for the voice processor Tx block,
* where channel
* configuration is derived from the topology ID.
*/
u16 bit_width;
/* Bit width (in bits) that the audio COPP sends to/receives
* from the
* endpoint. The value is ignored for the voice processing
* Tx block,
* where the PCM width is 16 bits.
*/
u32 sample_rate;
/* Sampling rate at which the audio COPP/voice processor
* Tx block
* interfaces with the endpoint.
* Supported values for voice processor Tx: 8000, 16000,
* 48000 Hz
* Supported values for audio COPP: >0 and <=192 kHz
*/
u8 dev_channel_mapping[8];
/* Array of channel mapping of buffers that the audio COPP
* sends to the endpoint. Channel[i] mapping describes channel
* I inside the buffer, where 0 < i < dev_num_channel.
* This value is relevent only for an audio Rx COPP.
* For the voice processor block and Tx audio block, this field
* is set to zero and is ignored.
*/
} __packed;
/*
* This command allows the client to close a COPP and disconnect
* the device session.
*/
#define ADM_CMD_DEVICE_CLOSE_V5 0x00010327
/* Sets one or more parameters to a COPP.
*/
#define ADM_CMD_SET_PP_PARAMS_V5 0x00010328
/* Payload of the #ADM_CMD_SET_PP_PARAMS_V5 command.
* If the data_payload_addr_lsw and data_payload_addr_msw element
* are NULL, a series of adm_param_datastructures immediately
* follows, whose total size is data_payload_size bytes.
*/
struct adm_cmd_set_pp_params_v5 {
struct apr_hdr hdr;
u32 payload_addr_lsw;
/* LSW of parameter data payload address.*/
u32 payload_addr_msw;
/* MSW of parameter data payload address.*/
u32 mem_map_handle;
/* Memory map handle returned by ADM_CMD_SHARED_MEM_MAP_REGIONS
* command */
/* If mem_map_handle is zero implies the message is in
* the payload */
u32 payload_size;
/* Size in bytes of the variable payload accompanying this
* message or
* in shared memory. This is used for parsing the parameter
* payload.
*/
} __packed;
/* Payload format for COPP parameter data.
* Immediately following this structure are param_size bytes
* of parameter
* data.
*/
struct adm_param_data_v5 {
u32 module_id;
/* Unique ID of the module. */
u32 param_id;
/* Unique ID of the parameter. */
u16 param_size;
/* Data size of the param_id/module_id combination.
This value is a
multiple of 4 bytes. */
u16 reserved;
/* Reserved for future enhancements.
* This field must be set to zero.
*/
} __packed;
/* set customized mixing on matrix mixer */
#define ADM_CMD_SET_PSPD_MTMX_STRTR_PARAMS_V5 0x00010344
struct adm_cmd_set_pspd_mtmx_strtr_params_v5 {
struct apr_hdr hdr;
/* LSW of parameter data payload address.*/
u32 payload_addr_lsw;
/* MSW of parameter data payload address.*/
u32 payload_addr_msw;
/* Memory map handle returned by ADM_CMD_SHARED_MEM_MAP_REGIONS */
/* command. If mem_map_handle is zero implies the message is in */
/* the payload */
u32 mem_map_handle;
/* Size in bytes of the variable payload accompanying this */
/* message or in shared memory. This is used for parsing the */
/* parameter payload. */
u32 payload_size;
u16 direction;
u16 sessionid;
u16 deviceid;
u16 reserved;
} __packed;
/* Defined specifically for in-band use, includes params */
struct adm_cmd_set_pp_params_inband_v5 {
struct apr_hdr hdr;
/* LSW of parameter data payload address.*/
u32 payload_addr_lsw;
/* MSW of parameter data payload address.*/
u32 payload_addr_msw;
/* Memory map handle returned by ADM_CMD_SHARED_MEM_MAP_REGIONS */
/* command. If mem_map_handle is zero implies the message is in */
/* the payload */
u32 mem_map_handle;
/* Size in bytes of the variable payload accompanying this */
/* message or in shared memory. This is used for parsing the */
/* parameter payload. */
u32 payload_size;
/* Parameters passed for in band payload */
struct adm_param_data_v5 params;
} __packed;
/* Returns the status and COPP ID to an #ADM_CMD_DEVICE_OPEN_V5 command.
*/
#define ADM_CMDRSP_DEVICE_OPEN_V5 0x00010329
/* Payload of the #ADM_CMDRSP_DEVICE_OPEN_V5 message,
* which returns the
* status and COPP ID to an #ADM_CMD_DEVICE_OPEN_V5 command.
*/
struct adm_cmd_rsp_device_open_v5 {
u32 status;
/* Status message (error code).*/
u16 copp_id;
/* COPP ID: Supported values: 0 <= copp_id < ADM_MAX_COPPS*/
u16 reserved;
/* Reserved. This field must be set to zero.*/
} __packed;
/* This command allows a query of one COPP parameter.
*/
#define ADM_CMD_GET_PP_PARAMS_V5 0x0001032A
/* Payload an #ADM_CMD_GET_PP_PARAMS_V5 command.
*/
struct adm_cmd_get_pp_params_v5 {
struct apr_hdr hdr;
u32 data_payload_addr_lsw;
/* LSW of parameter data payload address.*/
u32 data_payload_addr_msw;
/* MSW of parameter data payload address.*/
/* If the mem_map_handle is non zero,
* on ACK, the ParamData payloads begin at
* the address specified (out-of-band).
*/
u32 mem_map_handle;
/* Memory map handle returned
* by ADM_CMD_SHARED_MEM_MAP_REGIONS command.
* If the mem_map_handle is 0, it implies that
* the ACK's payload will contain the ParamData (in-band).
*/
u32 module_id;
/* Unique ID of the module. */
u32 param_id;
/* Unique ID of the parameter. */
u16 param_max_size;
/* Maximum data size of the parameter
*ID/module ID combination. This
* field is a multiple of 4 bytes.
*/
u16 reserved;
/* Reserved for future enhancements.
* This field must be set to zero.
*/
} __packed;
/* Returns parameter values
* in response to an #ADM_CMD_GET_PP_PARAMS_V5 command.
*/
#define ADM_CMDRSP_GET_PP_PARAMS_V5 0x0001032B
/* Payload of the #ADM_CMDRSP_GET_PP_PARAMS_V5 message,
* which returns parameter values in response
* to an #ADM_CMD_GET_PP_PARAMS_V5 command.
* Immediately following this
* structure is the adm_param_data_v5
* structure containing the pre/postprocessing
* parameter data. For an in-band
* scenario, the variable payload depends
* on the size of the parameter.
*/
struct adm_cmd_rsp_get_pp_params_v5 {
u32 status;
/* Status message (error code).*/
} __packed;
/* Structure for holding soft stepping volume parameters. */
/*
* Payload of the #ASM_PARAM_ID_SOFT_VOL_STEPPING_PARAMETERS
* parameters used by the Volume Control module.
*/
struct audproc_softvolume_params {
u32 period;
u32 step;
u32 rampingcurve;
} __packed;
struct audproc_volume_ctrl_master_gain {
struct adm_cmd_set_pp_params_v5 params;
struct adm_param_data_v5 data;
/* Linear gain in Q13 format. */
uint16_t master_gain;
/* Clients must set this field to zero. */
uint16_t reserved;
} __packed;
struct audproc_soft_step_volume_params {
struct adm_cmd_set_pp_params_v5 params;
struct adm_param_data_v5 data;
/*
* Period in milliseconds.
* Supported values: 0 to 15000
*/
uint32_t period;
/*
* Step in microseconds.
* Supported values: 0 to 15000000
*/
uint32_t step;
/*
* Ramping curve type.
* Supported values:
* - #AUDPROC_PARAM_SVC_RAMPINGCURVE_LINEAR
* - #AUDPROC_PARAM_SVC_RAMPINGCURVE_EXP
* - #AUDPROC_PARAM_SVC_RAMPINGCURVE_LOG
*/
uint32_t ramping_curve;
} __packed;
struct audproc_enable_param_t {
struct adm_cmd_set_pp_params_inband_v5 pp_params;
/*
* Specifies whether the Audio processing module is enabled.
* This parameter is generic/common parameter to configure or
* determine the state of any audio processing module.
* @values 0 : Disable 1: Enable
*/
uint32_t enable;
};
/*
* Allows a client to control the gains on various session-to-COPP paths.
*/
#define ADM_CMD_MATRIX_RAMP_GAINS_V5 0x0001032C
/* Indicates that the target gain in the
* current adm_session_copp_gain_v5
* structure is to be applied to all
* the session-to-COPP paths that exist for
* the specified session.
*/
#define ADM_CMD_MATRIX_RAMP_GAINS_COPP_ID_ALL_CONNECTED_COPPS 0xFFFF
/* Indicates that the target gain is
* to be immediately applied to the
* specified session-to-COPP path,
* without a ramping fashion.
*/
#define ADM_CMD_MATRIX_RAMP_GAINS_RAMP_DURATION_IMMEDIATE 0x0000
/* Enumeration for a linear ramping curve.*/
#define ADM_CMD_MATRIX_RAMP_GAINS_RAMP_CURVE_LINEAR 0x0000
/* Payload of the #ADM_CMD_MATRIX_RAMP_GAINS_V5 command.
* Immediately following this structure are num_gains of the
* adm_session_copp_gain_v5structure.
*/
struct adm_cmd_matrix_ramp_gains_v5 {
u32 matrix_id;
/* Specifies whether the matrix ID is Audio Rx (0) or Audio Tx (1).
* Use the ADM_MATRIX_ID_AUDIO_RX or ADM_MATRIX_ID_AUDIOX
* macros to set this field.
*/
u16 num_gains;
/* Number of gains being applied. */
u16 reserved_for_align;
/* Reserved. This field must be set to zero.*/
} __packed;
/* Session-to-COPP path gain structure, used by the
* #ADM_CMD_MATRIX_RAMP_GAINS_V5 command.
* This structure specifies the target
* gain (per channel) that must be applied
* to a particular session-to-COPP path in
* the audio matrix. The structure can
* also be used to apply the gain globally
* to all session-to-COPP paths that
* exist for the given session.
* The aDSP uses device channel mapping to
* determine which channel gains to
* use from this command. For example,
* if the device is configured as stereo,
* the aDSP uses only target_gain_ch_1 and
* target_gain_ch_2, and it ignores
* the others.
*/
struct adm_session_copp_gain_v5 {
u16 session_id;
/* Handle of the ASM session.
* Supported values: 1 to 8.
*/
u16 copp_id;
/* Handle of the COPP. Gain will be applied on the Session ID
* COPP ID path.
*/
u16 ramp_duration;
/* Duration (in milliseconds) of the ramp over
* which target gains are
* to be applied. Use
* #ADM_CMD_MATRIX_RAMP_GAINS_RAMP_DURATION_IMMEDIATE
* to indicate that gain must be applied immediately.
*/
u16 step_duration;
/* Duration (in milliseconds) of each step in the ramp.
* This parameter is ignored if ramp_duration is equal to
* #ADM_CMD_MATRIX_RAMP_GAINS_RAMP_DURATION_IMMEDIATE.
* Supported value: 1
*/
u16 ramp_curve;
/* Type of ramping curve.
* Supported value: #ADM_CMD_MATRIX_RAMP_GAINS_RAMP_CURVE_LINEAR
*/
u16 reserved_for_align;
/* Reserved. This field must be set to zero. */
u16 target_gain_ch_1;
/* Target linear gain for channel 1 in Q13 format; */
u16 target_gain_ch_2;
/* Target linear gain for channel 2 in Q13 format; */
u16 target_gain_ch_3;
/* Target linear gain for channel 3 in Q13 format; */
u16 target_gain_ch_4;
/* Target linear gain for channel 4 in Q13 format; */
u16 target_gain_ch_5;
/* Target linear gain for channel 5 in Q13 format; */
u16 target_gain_ch_6;
/* Target linear gain for channel 6 in Q13 format; */
u16 target_gain_ch_7;
/* Target linear gain for channel 7 in Q13 format; */
u16 target_gain_ch_8;
/* Target linear gain for channel 8 in Q13 format; */
} __packed;
/* Allows to set mute/unmute on various session-to-COPP paths.
* For every session-to-COPP path (stream-device interconnection),
* mute/unmute can be set individually on the output channels.
*/
#define ADM_CMD_MATRIX_MUTE_V5 0x0001032D
/* Indicates that mute/unmute in the
* current adm_session_copp_mute_v5structure
* is to be applied to all the session-to-COPP
* paths that exist for the specified session.
*/
#define ADM_CMD_MATRIX_MUTE_COPP_ID_ALL_CONNECTED_COPPS 0xFFFF
/* Payload of the #ADM_CMD_MATRIX_MUTE_V5 command*/
struct adm_cmd_matrix_mute_v5 {
u32 matrix_id;
/* Specifies whether the matrix ID is Audio Rx (0) or Audio Tx (1).
* Use the ADM_MATRIX_ID_AUDIO_RX or ADM_MATRIX_ID_AUDIOX
* macros to set this field.
*/
u16 session_id;
/* Handle of the ASM session.
* Supported values: 1 to 8.
*/
u16 copp_id;
/* Handle of the COPP.
* Use ADM_CMD_MATRIX_MUTE_COPP_ID_ALL_CONNECTED_COPPS
* to indicate that mute/unmute must be applied to
* all the COPPs connected to session_id.
* Supported values:
* - 0xFFFF -- Apply mute/unmute to all connected COPPs
* - Other values -- Valid COPP ID
*/
u8 mute_flag_ch_1;
/* Mute flag for channel 1 is set to unmute (0) or mute (1). */
u8 mute_flag_ch_2;
/* Mute flag for channel 2 is set to unmute (0) or mute (1). */
u8 mute_flag_ch_3;
/* Mute flag for channel 3 is set to unmute (0) or mute (1). */
u8 mute_flag_ch_4;
/* Mute flag for channel 4 is set to unmute (0) or mute (1). */
u8 mute_flag_ch_5;
/* Mute flag for channel 5 is set to unmute (0) or mute (1). */
u8 mute_flag_ch_6;
/* Mute flag for channel 6 is set to unmute (0) or mute (1). */
u8 mute_flag_ch_7;
/* Mute flag for channel 7 is set to unmute (0) or mute (1). */
u8 mute_flag_ch_8;
/* Mute flag for channel 8 is set to unmute (0) or mute (1). */
u16 ramp_duration;
/* Period (in milliseconds) over which the soft mute/unmute will be
* applied.
* Supported values: 0 (Default) to 0xFFFF
* The default of 0 means mute/unmute will be applied immediately.
*/
u16 reserved_for_align;
/* Clients must set this field to zero.*/
} __packed;
#define ASM_PARAM_ID_AAC_STEREO_MIX_COEFF_SELECTION_FLAG_V2 (0x00010DD8)
struct asm_aac_stereo_mix_coeff_selection_param_v2 {
struct apr_hdr hdr;
u32 param_id;
u32 param_size;
u32 aac_stereo_mix_coeff_flag;
} __packed;
/* Allows a client to connect the desired stream to
* the desired AFE port through the stream router
*
* This command allows the client to connect specified session to
* specified AFE port. This is used for compressed streams only
* opened using the #ASM_STREAM_CMD_OPEN_WRITE_COMPRESSED or
* #ASM_STREAM_CMD_OPEN_READ_COMPRESSED command.
*
* @prerequisites
* Session ID and AFE Port ID must be valid.
* #ASM_STREAM_CMD_OPEN_WRITE_COMPRESSED or
* #ASM_STREAM_CMD_OPEN_READ_COMPRESSED
* must have been called on this session.
*/
#define ADM_CMD_CONNECT_AFE_PORT_V5 0x0001032E
#define ADM_CMD_DISCONNECT_AFE_PORT_V5 0x0001032F
/* Enumeration for the Rx stream router ID.*/
#define ADM_STRTR_ID_RX 0
/* Enumeration for the Tx stream router ID.*/
#define ADM_STRTR_IDX 1
/* Payload of the #ADM_CMD_CONNECT_AFE_PORT_V5 command.*/
struct adm_cmd_connect_afe_port_v5 {
struct apr_hdr hdr;
u8 mode;
/* ID of the stream router (RX/TX). Use the
* ADM_STRTR_ID_RX or ADM_STRTR_IDX macros
* to set this field.
*/
u8 session_id;
/* Session ID of the stream to connect */
u16 afe_port_id;
/* Port ID of the AFE port to connect to.*/
u32 num_channels;
/* Number of device channels
* Supported values: 2(Audio Sample Packet),
* 8 (HBR Audio Stream Sample Packet)
*/
u32 sampling_rate;
/* Device sampling rate
* Supported values: Any
*/
} __packed;
/* adsp_adm_api.h */
/* Port ID. Update afe_get_port_index
* when a new port is added here. */
#define PRIMARY_I2S_RX 0
#define PRIMARY_I2S_TX 1
#define SECONDARY_I2S_RX 4
#define SECONDARY_I2S_TX 5
#define MI2S_RX 6
#define MI2S_TX 7
#define HDMI_RX 8
#define RSVD_2 9
#define RSVD_3 10
#define DIGI_MIC_TX 11
#define VOICE2_PLAYBACK_TX 0x8002
#define VOICE_RECORD_RX 0x8003
#define VOICE_RECORD_TX 0x8004
#define VOICE_PLAYBACK_TX 0x8005
/* Slimbus Multi channel port id pool */
#define SLIMBUS_0_RX 0x4000
#define SLIMBUS_0_TX 0x4001
#define SLIMBUS_1_RX 0x4002
#define SLIMBUS_1_TX 0x4003
#define SLIMBUS_2_RX 0x4004
#define SLIMBUS_2_TX 0x4005
#define SLIMBUS_3_RX 0x4006
#define SLIMBUS_3_TX 0x4007
#define SLIMBUS_4_RX 0x4008
#define SLIMBUS_4_TX 0x4009
#define SLIMBUS_5_RX 0x400a
#define SLIMBUS_5_TX 0x400b
#define SLIMBUS_6_RX 0x400c
#define SLIMBUS_6_TX 0x400d
#define SLIMBUS_PORT_LAST SLIMBUS_6_TX
#define INT_BT_SCO_RX 0x3000
#define INT_BT_SCO_TX 0x3001
#define INT_BT_A2DP_RX 0x3002
#define INT_FM_RX 0x3004
#define INT_FM_TX 0x3005
#define RT_PROXY_PORT_001_RX 0x2000
#define RT_PROXY_PORT_001_TX 0x2001
#define AFE_PORT_INVALID 0xFFFF
#define SLIMBUS_INVALID AFE_PORT_INVALID
#define AFE_PORT_CMD_START 0x000100ca
#define AFE_EVENT_RTPORT_START 0
#define AFE_EVENT_RTPORT_STOP 1
#define AFE_EVENT_RTPORT_LOW_WM 2
#define AFE_EVENT_RTPORT_HI_WM 3
#define ADSP_AFE_VERSION 0x00200000
/* Size of the range of port IDs for the audio interface. */
#define AFE_PORT_ID_AUDIO_IF_PORT_RANGE_SIZE 0xF
/* Size of the range of port IDs for internal BT-FM ports. */
#define AFE_PORT_ID_INTERNAL_BT_FM_RANGE_SIZE 0x6
/* Size of the range of port IDs for SLIMbus<sup>®
* </sup> multichannel
* ports.
*/
#define AFE_PORT_ID_SLIMBUS_RANGE_SIZE 0xA
/* Size of the range of port IDs for real-time proxy ports. */
#define AFE_PORT_ID_RT_PROXY_PORT_RANGE_SIZE 0x2
/* Size of the range of port IDs for pseudoports. */
#define AFE_PORT_ID_PSEUDOPORT_RANGE_SIZE 0x5
/* Start of the range of port IDs for the audio interface. */
#define AFE_PORT_ID_AUDIO_IF_PORT_RANGE_START 0x1000
/* End of the range of port IDs for the audio interface. */
#define AFE_PORT_ID_AUDIO_IF_PORT_RANGE_END \
(AFE_PORT_ID_AUDIO_IF_PORT_RANGE_START +\
AFE_PORT_ID_AUDIO_IF_PORT_RANGE_SIZE - 1)
/* Start of the range of port IDs for real-time proxy ports. */
#define AFE_PORT_ID_RT_PROXY_PORT_RANGE_START 0x2000
/* End of the range of port IDs for real-time proxy ports. */
#define AFE_PORT_ID_RT_PROXY_PORT_RANGE_END \
(AFE_PORT_ID_RT_PROXY_PORT_RANGE_START +\
AFE_PORT_ID_RT_PROXY_PORT_RANGE_SIZE-1)
/* Start of the range of port IDs for internal BT-FM devices. */
#define AFE_PORT_ID_INTERNAL_BT_FM_RANGE_START 0x3000
/* End of the range of port IDs for internal BT-FM devices. */
#define AFE_PORT_ID_INTERNAL_BT_FM_RANGE_END \
(AFE_PORT_ID_INTERNAL_BT_FM_RANGE_START +\
AFE_PORT_ID_INTERNAL_BT_FM_RANGE_SIZE-1)
/* Start of the range of port IDs for SLIMbus devices. */
#define AFE_PORT_ID_SLIMBUS_RANGE_START 0x4000
/* End of the range of port IDs for SLIMbus devices. */
#define AFE_PORT_ID_SLIMBUS_RANGE_END \
(AFE_PORT_ID_SLIMBUS_RANGE_START +\
AFE_PORT_ID_SLIMBUS_RANGE_SIZE-1)
/* Start of the range of port IDs for pseudoports. */
#define AFE_PORT_ID_PSEUDOPORT_RANGE_START 0x8001
/* End of the range of port IDs for pseudoports. */
#define AFE_PORT_ID_PSEUDOPORT_RANGE_END \
(AFE_PORT_ID_PSEUDOPORT_RANGE_START +\
AFE_PORT_ID_PSEUDOPORT_RANGE_SIZE-1)
#define AFE_PORT_ID_PRIMARY_MI2S_RX 0x1000
#define AFE_PORT_ID_PRIMARY_MI2S_TX 0x1001
#define AFE_PORT_ID_SECONDARY_MI2S_RX 0x1002
#define AFE_PORT_ID_SECONDARY_MI2S_TX 0x1003
#define AFE_PORT_ID_TERTIARY_MI2S_RX 0x1004
#define AFE_PORT_ID_TERTIARY_MI2S_TX 0x1005
#define AFE_PORT_ID_QUATERNARY_MI2S_RX 0x1006
#define AFE_PORT_ID_QUATERNARY_MI2S_TX 0x1007
#define AUDIO_PORT_ID_I2S_RX 0x1008
#define AFE_PORT_ID_DIGITAL_MIC_TX 0x1009
#define AFE_PORT_ID_PRIMARY_PCM_RX 0x100A
#define AFE_PORT_ID_PRIMARY_PCM_TX 0x100B
#define AFE_PORT_ID_SECONDARY_PCM_RX 0x100C
#define AFE_PORT_ID_SECONDARY_PCM_TX 0x100D
#define AFE_PORT_ID_MULTICHAN_HDMI_RX 0x100E
#define AFE_PORT_ID_SECONDARY_MI2S_RX_SD1 0x1010
/* ID of the senary MI2S Rx port. */
#define AFE_PORT_ID_SENARY_MI2S_RX 0x1018
/* ID of the senary MI2S Tx port. */
#define AFE_PORT_ID_SENARY_MI2S_TX 0x1019
#define AFE_PORT_ID_SPDIF_RX 0x5000
/* ID of the Quinary MI2S Rx port. */
#define AFE_PORT_ID_QUINARY_MI2S_RX 0x1016
/* ID of the Quinary MI2S Tx port. */
#define AFE_PORT_ID_QUINARY_MI2S_TX 0x1017
#define AFE_PORT_ID_MI2S_HDMI_RX AFE_PORT_ID_QUINARY_MI2S_RX
#define AFE_PORT_ID_RT_PROXY_PORT_001_RX 0x2000
#define AFE_PORT_ID_RT_PROXY_PORT_001_TX 0x2001
#define AFE_PORT_ID_INTERNAL_BT_SCO_RX 0x3000
#define AFE_PORT_ID_INTERNAL_BT_SCO_TX 0x3001
#define AFE_PORT_ID_INTERNAL_BT_A2DP_RX 0x3002
#define AFE_PORT_ID_INTERNAL_FM_RX 0x3004
#define AFE_PORT_ID_INTERNAL_FM_TX 0x3005
/* SLIMbus Rx port on channel 0. */
#define AFE_PORT_ID_SLIMBUS_MULTI_CHAN_0_RX 0x4000
/* SLIMbus Tx port on channel 0. */
#define AFE_PORT_ID_SLIMBUS_MULTI_CHAN_0_TX 0x4001
/* SLIMbus Rx port on channel 1. */
#define AFE_PORT_ID_SLIMBUS_MULTI_CHAN_1_RX 0x4002
/* SLIMbus Tx port on channel 1. */
#define AFE_PORT_ID_SLIMBUS_MULTI_CHAN_1_TX 0x4003
/* SLIMbus Rx port on channel 2. */
#define AFE_PORT_ID_SLIMBUS_MULTI_CHAN_2_RX 0x4004
/* SLIMbus Tx port on channel 2. */
#define AFE_PORT_ID_SLIMBUS_MULTI_CHAN_2_TX 0x4005
/* SLIMbus Rx port on channel 3. */
#define AFE_PORT_ID_SLIMBUS_MULTI_CHAN_3_RX 0x4006
/* SLIMbus Tx port on channel 3. */
#define AFE_PORT_ID_SLIMBUS_MULTI_CHAN_3_TX 0x4007
/* SLIMbus Rx port on channel 4. */
#define AFE_PORT_ID_SLIMBUS_MULTI_CHAN_4_RX 0x4008
/* SLIMbus Tx port on channel 4. */
#define AFE_PORT_ID_SLIMBUS_MULTI_CHAN_4_TX 0x4009
/* SLIMbus Rx port on channel 5. */
#define AFE_PORT_ID_SLIMBUS_MULTI_CHAN_5_RX 0x400a
/* SLIMbus Tx port on channel 5. */
#define AFE_PORT_ID_SLIMBUS_MULTI_CHAN_5_TX 0x400b
/* SLIMbus Rx port on channel 6. */
#define AFE_PORT_ID_SLIMBUS_MULTI_CHAN_6_RX 0x400c
/* SLIMbus Tx port on channel 6. */
#define AFE_PORT_ID_SLIMBUS_MULTI_CHAN_6_TX 0x400d
/* Generic pseudoport 1. */
#define AFE_PORT_ID_PSEUDOPORT_01 0x8001
/* Generic pseudoport 2. */
#define AFE_PORT_ID_PSEUDOPORT_02 0x8002
/* @xreflabel{hdr:AfePortIdPrimaryAuxPcmTx}
Primary Aux PCM Tx port ID.
*/
#define AFE_PORT_ID_PRIMARY_PCM_TX 0x100B
/* Pseudoport that corresponds to the voice Rx path.
* For recording, the voice Rx path samples are written to this
* port and consumed by the audio path.
*/
#define AFE_PORT_ID_VOICE_RECORD_RX 0x8003
/* Pseudoport that corresponds to the voice Tx path.
* For recording, the voice Tx path samples are written to this
* port and consumed by the audio path.
*/
#define AFE_PORT_ID_VOICE_RECORD_TX 0x8004
/* Pseudoport that corresponds to in-call voice delivery samples.
* During in-call audio delivery, the audio path delivers samples
* to this port from where the voice path delivers them on the
* Rx path.
*/
#define AFE_PORT_ID_VOICE2_PLAYBACK_TX 0x8002
#define AFE_PORT_ID_VOICE_PLAYBACK_TX 0x8005
#define AFE_PORT_ID_INVALID 0xFFFF
#define AAC_ENC_MODE_AAC_LC 0x02
#define AAC_ENC_MODE_AAC_P 0x05
#define AAC_ENC_MODE_EAAC_P 0x1D
#define AFE_PSEUDOPORT_CMD_START 0x000100cf
struct afe_pseudoport_start_command {
struct apr_hdr hdr;
u16 port_id; /* Pseudo Port 1 = 0x8000 */
/* Pseudo Port 2 = 0x8001 */
/* Pseudo Port 3 = 0x8002 */
u16 timing; /* FTRT = 0 , AVTimer = 1, */
} __packed;
#define AFE_PSEUDOPORT_CMD_STOP 0x000100d0
struct afe_pseudoport_stop_command {
struct apr_hdr hdr;
u16 port_id; /* Pseudo Port 1 = 0x8000 */
/* Pseudo Port 2 = 0x8001 */
/* Pseudo Port 3 = 0x8002 */
u16 reserved;
} __packed;
#define AFE_MODULE_SIDETONE_IIR_FILTER 0x00010202
#define AFE_PARAM_ID_ENABLE 0x00010203
/* Payload of the #AFE_PARAM_ID_ENABLE
* parameter, which enables or
* disables any module.
* The fixed size of this structure is four bytes.
*/
struct afe_mod_enable_param {
u16 enable;
/* Enables (1) or disables (0) the module. */
u16 reserved;
/* This field must be set to zero.
*/
} __packed;
/* ID of the configuration parameter used by the
* #AFE_MODULE_SIDETONE_IIR_FILTER module.
*/
#define AFE_PARAM_ID_SIDETONE_IIR_FILTER_CONFIG 0x00010204
struct afe_sidetone_iir_filter_config_params {
u16 num_biquad_stages;
/* Number of stages.
* Supported values: Minimum of 5 and maximum of 10
*/
u16 pregain;
/* Pregain for the compensating filter response.
* Supported values: Any number in Q13 format
*/
} __packed;
#define AFE_MODULE_LOOPBACK 0x00010205