aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/bhyve/hda_reg.h
blob: dd7098524537e5e7aa5f7567bc225f58bc749eff (plain) (blame)
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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
/*-
 * Copyright (c) 2006 Stephane E. Potvin <sepotvin@videotron.ca>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 *
 * $FreeBSD$
 */

#ifndef _HDA_REG_H_
#define _HDA_REG_H_

/****************************************************************************
 * HDA Device Verbs
 ****************************************************************************/

/* HDA Command */
#define HDA_CMD_VERB_MASK				0x000fffff
#define HDA_CMD_VERB_SHIFT				0
#define HDA_CMD_NID_MASK				0x0ff00000
#define HDA_CMD_NID_SHIFT				20
#define HDA_CMD_CAD_MASK				0xf0000000
#define HDA_CMD_CAD_SHIFT				28

#define HDA_CMD_VERB_4BIT_SHIFT				16
#define HDA_CMD_VERB_12BIT_SHIFT			8

#define HDA_CMD_VERB_4BIT(verb, payload)				\
    (((verb) << HDA_CMD_VERB_4BIT_SHIFT) | (payload))
#define HDA_CMD_4BIT(cad, nid, verb, payload)				\
    (((cad) << HDA_CMD_CAD_SHIFT) |					\
    ((nid) << HDA_CMD_NID_SHIFT) |					\
    (HDA_CMD_VERB_4BIT((verb), (payload))))

#define HDA_CMD_VERB_12BIT(verb, payload)				\
    (((verb) << HDA_CMD_VERB_12BIT_SHIFT) | (payload))
#define HDA_CMD_12BIT(cad, nid, verb, payload)				\
    (((cad) << HDA_CMD_CAD_SHIFT) |					\
    ((nid) << HDA_CMD_NID_SHIFT) |					\
    (HDA_CMD_VERB_12BIT((verb), (payload))))

/* Get Parameter */
#define HDA_CMD_VERB_GET_PARAMETER			0xf00

#define HDA_CMD_GET_PARAMETER(cad, nid, payload)			\
    (HDA_CMD_12BIT((cad), (nid),					\
    HDA_CMD_VERB_GET_PARAMETER, (payload)))

/* Connection Select Control */
#define HDA_CMD_VERB_GET_CONN_SELECT_CONTROL		0xf01
#define HDA_CMD_VERB_SET_CONN_SELECT_CONTROL		0x701

#define HDA_CMD_GET_CONN_SELECT_CONTROL(cad, nid)			\
    (HDA_CMD_12BIT((cad), (nid),					\
    HDA_CMD_VERB_GET_CONN_SELECT_CONTROL, 0x0))
#define HDA_CMD_SET_CONNECTION_SELECT_CONTROL(cad, nid, payload)	\
    (HDA_CMD_12BIT((cad), (nid),					\
    HDA_CMD_VERB_SET_CONN_SELECT_CONTROL, (payload)))

/* Connection List Entry */
#define HDA_CMD_VERB_GET_CONN_LIST_ENTRY		0xf02

#define HDA_CMD_GET_CONN_LIST_ENTRY(cad, nid, payload)			\
    (HDA_CMD_12BIT((cad), (nid),					\
    HDA_CMD_VERB_GET_CONN_LIST_ENTRY, (payload)))

#define HDA_CMD_GET_CONN_LIST_ENTRY_SIZE_SHORT		1
#define HDA_CMD_GET_CONN_LIST_ENTRY_SIZE_LONG		2

/* Processing State */
#define HDA_CMD_VERB_GET_PROCESSING_STATE		0xf03
#define HDA_CMD_VERB_SET_PROCESSING_STATE		0x703

#define HDA_CMD_GET_PROCESSING_STATE(cad, nid)				\
    (HDA_CMD_12BIT((cad), (nid),					\
    HDA_CMD_VERB_GET_PROCESSING_STATE, 0x0))
#define HDA_CMD_SET_PROCESSING_STATE(cad, nid, payload)			\
    (HDA_CMD_12BIT((cad), (nid),					\
    HDA_CMD_VERB_SET_PROCESSING_STATE, (payload)))

#define HDA_CMD_GET_PROCESSING_STATE_STATE_OFF		0x00
#define HDA_CMD_GET_PROCESSING_STATE_STATE_ON		0x01
#define HDA_CMD_GET_PROCESSING_STATE_STATE_BENIGN	0x02

/* Coefficient Index */
#define HDA_CMD_VERB_GET_COEFF_INDEX			0xd
#define HDA_CMD_VERB_SET_COEFF_INDEX			0x5

#define HDA_CMD_GET_COEFF_INDEX(cad, nid)				\
    (HDA_CMD_4BIT((cad), (nid),						\
    HDA_CMD_VERB_GET_COEFF_INDEX, 0x0))
#define HDA_CMD_SET_COEFF_INDEX(cad, nid, payload)			\
    (HDA_CMD_4BIT((cad), (nid),						\
    HDA_CMD_VERB_SET_COEFF_INDEX, (payload)))

/* Processing Coefficient */
#define HDA_CMD_VERB_GET_PROCESSING_COEFF		0xc
#define HDA_CMD_VERB_SET_PROCESSING_COEFF		0x4

#define HDA_CMD_GET_PROCESSING_COEFF(cad, nid)				\
    (HDA_CMD_4BIT((cad), (nid),						\
    HDA_CMD_VERB_GET_PROCESSING_COEFF, 0x0))
#define HDA_CMD_SET_PROCESSING_COEFF(cad, nid, payload)			\
    (HDA_CMD_4BIT((cad), (nid),						\
    HDA_CMD_VERB_SET_PROCESSING_COEFF, (payload)))

/* Amplifier Gain/Mute */
#define HDA_CMD_VERB_GET_AMP_GAIN_MUTE			0xb
#define HDA_CMD_VERB_SET_AMP_GAIN_MUTE			0x3

#define HDA_CMD_GET_AMP_GAIN_MUTE(cad, nid, payload)			\
    (HDA_CMD_4BIT((cad), (nid),						\
    HDA_CMD_VERB_GET_AMP_GAIN_MUTE, (payload)))
#define HDA_CMD_SET_AMP_GAIN_MUTE(cad, nid, payload)			\
    (HDA_CMD_4BIT((cad), (nid),						\
    HDA_CMD_VERB_SET_AMP_GAIN_MUTE, (payload)))

#define HDA_CMD_GET_AMP_GAIN_MUTE_INPUT		0x0000
#define HDA_CMD_GET_AMP_GAIN_MUTE_OUTPUT	0x8000
#define HDA_CMD_GET_AMP_GAIN_MUTE_RIGHT		0x0000
#define HDA_CMD_GET_AMP_GAIN_MUTE_LEFT		0x2000

#define HDA_CMD_GET_AMP_GAIN_MUTE_MUTE_MASK	0x00000008
#define HDA_CMD_GET_AMP_GAIN_MUTE_MUTE_SHIFT	7
#define HDA_CMD_GET_AMP_GAIN_MUTE_GAIN_MASK	0x00000007
#define HDA_CMD_GET_AMP_GAIN_MUTE_GAIN_SHIFT	0

#define HDA_CMD_GET_AMP_GAIN_MUTE_MUTE(rsp)				\
    (((rsp) & HDA_CMD_GET_AMP_GAIN_MUTE_MUTE_MASK) >>			\
    HDA_CMD_GET_AMP_GAIN_MUTE_MUTE_SHIFT)
#define HDA_CMD_GET_AMP_GAIN_MUTE_GAIN(rsp)				\
    (((rsp) & HDA_CMD_GET_AMP_GAIN_MUTE_GAIN_MASK) >>			\
    HDA_CMD_GET_AMP_GAIN_MUTE_GAIN_SHIFT)

#define HDA_CMD_SET_AMP_GAIN_MUTE_OUTPUT	0x8000
#define HDA_CMD_SET_AMP_GAIN_MUTE_INPUT		0x4000
#define HDA_CMD_SET_AMP_GAIN_MUTE_LEFT		0x2000
#define HDA_CMD_SET_AMP_GAIN_MUTE_RIGHT		0x1000
#define HDA_CMD_SET_AMP_GAIN_MUTE_INDEX_MASK	0x0f00
#define HDA_CMD_SET_AMP_GAIN_MUTE_INDEX_SHIFT	8
#define HDA_CMD_SET_AMP_GAIN_MUTE_MUTE		0x0080
#define HDA_CMD_SET_AMP_GAIN_MUTE_GAIN_MASK	0x0007
#define HDA_CMD_SET_AMP_GAIN_MUTE_GAIN_SHIFT	0

#define HDA_CMD_SET_AMP_GAIN_MUTE_INDEX(index)				\
    (((index) << HDA_CMD_SET_AMP_GAIN_MUTE_INDEX_SHIFT) &		\
    HDA_CMD_SET_AMP_GAIN_MUTE_INDEX_MASK)
#define HDA_CMD_SET_AMP_GAIN_MUTE_GAIN(index)				\
    (((index) << HDA_CMD_SET_AMP_GAIN_MUTE_GAIN_SHIFT) &		\
    HDA_CMD_SET_AMP_GAIN_MUTE_GAIN_MASK)

/* Converter format */
#define HDA_CMD_VERB_GET_CONV_FMT			0xa
#define HDA_CMD_VERB_SET_CONV_FMT			0x2

#define HDA_CMD_GET_CONV_FMT(cad, nid)					\
    (HDA_CMD_4BIT((cad), (nid),						\
    HDA_CMD_VERB_GET_CONV_FMT, 0x0))
#define HDA_CMD_SET_CONV_FMT(cad, nid, payload)				\
    (HDA_CMD_4BIT((cad), (nid),						\
    HDA_CMD_VERB_SET_CONV_FMT, (payload)))

/* Digital Converter Control */
#define HDA_CMD_VERB_GET_DIGITAL_CONV_FMT1		0xf0d
#define HDA_CMD_VERB_GET_DIGITAL_CONV_FMT2		0xf0e
#define HDA_CMD_VERB_SET_DIGITAL_CONV_FMT1		0x70d
#define HDA_CMD_VERB_SET_DIGITAL_CONV_FMT2		0x70e

#define HDA_CMD_GET_DIGITAL_CONV_FMT(cad, nid)				\
    (HDA_CMD_12BIT((cad), (nid),					\
    HDA_CMD_VERB_GET_DIGITAL_CONV_FMT1, 0x0))
#define HDA_CMD_SET_DIGITAL_CONV_FMT1(cad, nid, payload)		\
    (HDA_CMD_12BIT((cad), (nid),					\
    HDA_CMD_VERB_SET_DIGITAL_CONV_FMT1, (payload)))
#define HDA_CMD_SET_DIGITAL_CONV_FMT2(cad, nid, payload)		\
    (HDA_CMD_12BIT((cad), (nid),					\
    HDA_CMD_VERB_SET_DIGITAL_CONV_FMT2, (payload)))

#define HDA_CMD_GET_DIGITAL_CONV_FMT_CC_MASK		0x7f00
#define HDA_CMD_GET_DIGITAL_CONV_FMT_CC_SHIFT		8
#define HDA_CMD_GET_DIGITAL_CONV_FMT_L_MASK		0x0080
#define HDA_CMD_GET_DIGITAL_CONV_FMT_L_SHIFT		7
#define HDA_CMD_GET_DIGITAL_CONV_FMT_PRO_MASK		0x0040
#define HDA_CMD_GET_DIGITAL_CONV_FMT_PRO_SHIFT		6
#define HDA_CMD_GET_DIGITAL_CONV_FMT_NAUDIO_MASK	0x0020
#define HDA_CMD_GET_DIGITAL_CONV_FMT_NAUDIO_SHIFT	5
#define HDA_CMD_GET_DIGITAL_CONV_FMT_COPY_MASK		0x0010
#define HDA_CMD_GET_DIGITAL_CONV_FMT_COPY_SHIFT		4
#define HDA_CMD_GET_DIGITAL_CONV_FMT_PRE_MASK		0x0008
#define HDA_CMD_GET_DIGITAL_CONV_FMT_PRE_SHIFT		3
#define HDA_CMD_GET_DIGITAL_CONV_FMT_VCFG_MASK		0x0004
#define HDA_CMD_GET_DIGITAL_CONV_FMT_VCFG_SHIFT		2
#define HDA_CMD_GET_DIGITAL_CONV_FMT_V_MASK		0x0002
#define HDA_CMD_GET_DIGITAL_CONV_FMT_V_SHIFT		1
#define HDA_CMD_GET_DIGITAL_CONV_FMT_DIGEN_MASK		0x0001
#define HDA_CMD_GET_DIGITAL_CONV_FMT_DIGEN_SHIFT	0

#define HDA_CMD_GET_DIGITAL_CONV_FMT_CC(rsp)				\
    (((rsp) & HDA_CMD_GET_DIGITAL_CONV_FMT_CC_MASK) >>			\
    HDA_CMD_GET_DIGITAL_CONV_FMT_CC_SHIFT)
#define HDA_CMD_GET_DIGITAL_CONV_FMT_L(rsp)				\
    (((rsp) & HDA_CMD_GET_DIGITAL_CONV_FMT_L_MASK) >>			\
    HDA_CMD_GET_DIGITAL_CONV_FMT_L_SHIFT)
#define HDA_CMD_GET_DIGITAL_CONV_FMT_PRO(rsp)				\
    (((rsp) & HDA_CMD_GET_DIGITAL_CONV_FMT_PRO_MASK) >>			\
    HDA_CMD_GET_DIGITAL_CONV_FMT_PRO_SHIFT)
#define HDA_CMD_GET_DIGITAL_CONV_FMT_NAUDIO(rsp)			\
    (((rsp) & HDA_CMD_GET_DIGITAL_CONV_FMT_NAUDIO_MASK) >>		\
    HDA_CMD_GET_DIGITAL_CONV_FMT_NAUDIO_SHIFT)
#define HDA_CMD_GET_DIGITAL_CONV_FMT_COPY(rsp)				\
    (((rsp) & HDA_CMD_GET_DIGITAL_CONV_FMT_COPY_MASK) >>		\
    HDA_CMD_GET_DIGITAL_CONV_FMT_COPY_SHIFT)
#define HDA_CMD_GET_DIGITAL_CONV_FMT_PRE(rsp)				\
    (((rsp) & HDA_CMD_GET_DIGITAL_CONV_FMT_PRE_MASK) >>			\
    HDA_CMD_GET_DIGITAL_CONV_FMT_PRE_SHIFT)
#define HDA_CMD_GET_DIGITAL_CONV_FMT_VCFG(rsp)				\
    (((rsp) & HDA_CMD_GET_DIGITAL_CONV_FMT_VCFG_MASK) >>		\
    HDA_CMD_GET_DIGITAL_CONV_FMT_VCFG_SHIFT)
#define HDA_CMD_GET_DIGITAL_CONV_FMT_V(rsp)				\
    (((rsp) & HDA_CMD_GET_DIGITAL_CONV_FMT_V_MASK) >>			\
    HDA_CMD_GET_DIGITAL_CONV_FMT_V_SHIFT)
#define HDA_CMD_GET_DIGITAL_CONV_FMT_DIGEN(rsp)				\
    (((rsp) & HDA_CMD_GET_DIGITAL_CONV_FMT_DIGEN_MASK) >>		\
    HDA_CMD_GET_DIGITAL_CONV_FMT_DIGEN_SHIFT)

#define HDA_CMD_SET_DIGITAL_CONV_FMT1_L			0x80
#define HDA_CMD_SET_DIGITAL_CONV_FMT1_PRO		0x40
#define HDA_CMD_SET_DIGITAL_CONV_FMT1_NAUDIO		0x20
#define HDA_CMD_SET_DIGITAL_CONV_FMT1_COPY		0x10
#define HDA_CMD_SET_DIGITAL_CONV_FMT1_PRE		0x08
#define HDA_CMD_SET_DIGITAL_CONV_FMT1_VCFG		0x04
#define HDA_CMD_SET_DIGITAL_CONV_FMT1_V			0x02
#define HDA_CMD_SET_DIGITAL_CONV_FMT1_DIGEN		0x01

/* Power State */
#define HDA_CMD_VERB_GET_POWER_STATE			0xf05
#define HDA_CMD_VERB_SET_POWER_STATE			0x705

#define HDA_CMD_GET_POWER_STATE(cad, nid)				\
    (HDA_CMD_12BIT((cad), (nid),					\
    HDA_CMD_VERB_GET_POWER_STATE, 0x0))
#define HDA_CMD_SET_POWER_STATE(cad, nid, payload)			\
    (HDA_CMD_12BIT((cad), (nid),					\
    HDA_CMD_VERB_SET_POWER_STATE, (payload)))

#define HDA_CMD_POWER_STATE_D0				0x00
#define HDA_CMD_POWER_STATE_D1				0x01
#define HDA_CMD_POWER_STATE_D2				0x02
#define HDA_CMD_POWER_STATE_D3				0x03

#define HDA_CMD_POWER_STATE_ACT_MASK			0x000000f0
#define HDA_CMD_POWER_STATE_ACT_SHIFT			4
#define HDA_CMD_POWER_STATE_SET_MASK			0x0000000f
#define HDA_CMD_POWER_STATE_SET_SHIFT			0

#define HDA_CMD_GET_POWER_STATE_ACT(rsp)				\
    (((rsp) & HDA_CMD_POWER_STATE_ACT_MASK) >>				\
    HDA_CMD_POWER_STATE_ACT_SHIFT)
#define HDA_CMD_GET_POWER_STATE_SET(rsp)				\
    (((rsp) & HDA_CMD_POWER_STATE_SET_MASK) >>				\
    HDA_CMD_POWER_STATE_SET_SHIFT)

#define HDA_CMD_SET_POWER_STATE_ACT(ps)					\
    (((ps) << HDA_CMD_POWER_STATE_ACT_SHIFT) &				\
    HDA_CMD_POWER_STATE_ACT_MASK)
#define HDA_CMD_SET_POWER_STATE_SET(ps)					\
    (((ps) << HDA_CMD_POWER_STATE_SET_SHIFT) &				\
    HDA_CMD_POWER_STATE_ACT_MASK)

/* Converter Stream, Channel */
#define HDA_CMD_VERB_GET_CONV_STREAM_CHAN		0xf06
#define HDA_CMD_VERB_SET_CONV_STREAM_CHAN		0x706

#define HDA_CMD_GET_CONV_STREAM_CHAN(cad, nid)				\
    (HDA_CMD_12BIT((cad), (nid),					\
    HDA_CMD_VERB_GET_CONV_STREAM_CHAN, 0x0))
#define HDA_CMD_SET_CONV_STREAM_CHAN(cad, nid, payload)			\
    (HDA_CMD_12BIT((cad), (nid),					\
    HDA_CMD_VERB_SET_CONV_STREAM_CHAN, (payload)))

#define HDA_CMD_CONV_STREAM_CHAN_STREAM_MASK		0x000000f0
#define HDA_CMD_CONV_STREAM_CHAN_STREAM_SHIFT		4
#define HDA_CMD_CONV_STREAM_CHAN_CHAN_MASK		0x0000000f
#define HDA_CMD_CONV_STREAM_CHAN_CHAN_SHIFT		0

#define HDA_CMD_GET_CONV_STREAM_CHAN_STREAM(rsp)			\
    (((rsp) & HDA_CMD_CONV_STREAM_CHAN_STREAM_MASK) >>			\
    HDA_CMD_CONV_STREAM_CHAN_STREAM_SHIFT)
#define HDA_CMD_GET_CONV_STREAM_CHAN_CHAN(rsp)				\
    (((rsp) & HDA_CMD_CONV_STREAM_CHAN_CHAN_MASK) >>			\
    HDA_CMD_CONV_STREAM_CHAN_CHAN_SHIFT)

#define HDA_CMD_SET_CONV_STREAM_CHAN_STREAM(param)			\
    (((param) << HDA_CMD_CONV_STREAM_CHAN_STREAM_SHIFT) &		\
    HDA_CMD_CONV_STREAM_CHAN_STREAM_MASK)
#define HDA_CMD_SET_CONV_STREAM_CHAN_CHAN(param)			\
    (((param) << HDA_CMD_CONV_STREAM_CHAN_CHAN_SHIFT) &			\
    HDA_CMD_CONV_STREAM_CHAN_CHAN_MASK)

/* Input Converter SDI Select */
#define HDA_CMD_VERB_GET_INPUT_CONVERTER_SDI_SELECT	0xf04
#define HDA_CMD_VERB_SET_INPUT_CONVERTER_SDI_SELECT	0x704

#define HDA_CMD_GET_INPUT_CONVERTER_SDI_SELECT(cad, nid)		\
    (HDA_CMD_12BIT((cad), (nid),					\
    HDA_CMD_VERB_GET_INPUT_CONVERTER_SDI_SELECT, 0x0))
#define HDA_CMD_SET_INPUT_CONVERTER_SDI_SELECT(cad, nid, payload)	\
    (HDA_CMD_12BIT((cad), (nid),					\
    HDA_CMD_VERB_SET_INPUT_CONVERTER_SDI_SELECT, (payload)))

/* Pin Widget Control */
#define HDA_CMD_VERB_GET_PIN_WIDGET_CTRL		0xf07
#define HDA_CMD_VERB_SET_PIN_WIDGET_CTRL		0x707

#define HDA_CMD_GET_PIN_WIDGET_CTRL(cad, nid)				\
    (HDA_CMD_12BIT((cad), (nid),					\
    HDA_CMD_VERB_GET_PIN_WIDGET_CTRL, 0x0))
#define HDA_CMD_SET_PIN_WIDGET_CTRL(cad, nid, payload)			\
    (HDA_CMD_12BIT((cad), (nid),					\
    HDA_CMD_VERB_SET_PIN_WIDGET_CTRL, (payload)))

#define HDA_CMD_GET_PIN_WIDGET_CTRL_HPHN_ENABLE_MASK	0x00000080
#define HDA_CMD_GET_PIN_WIDGET_CTRL_HPHN_ENABLE_SHIFT	7
#define HDA_CMD_GET_PIN_WIDGET_CTRL_OUT_ENABLE_MASK	0x00000040
#define HDA_CMD_GET_PIN_WIDGET_CTRL_OUT_ENABLE_SHIFT	6
#define HDA_CMD_GET_PIN_WIDGET_CTRL_IN_ENABLE_MASK	0x00000020
#define HDA_CMD_GET_PIN_WIDGET_CTRL_IN_ENABLE_SHIFT	5
#define HDA_CMD_GET_PIN_WIDGET_CTRL_VREF_ENABLE_MASK	0x00000007
#define HDA_CMD_GET_PIN_WIDGET_CTRL_VREF_ENABLE_SHIFT	0

#define HDA_CMD_GET_PIN_WIDGET_CTRL_HPHN_ENABLE(rsp)			\
    (((rsp) & HDA_CMD_GET_PIN_WIDGET_CTRL_HPHN_ENABLE_MASK) >>		\
    HDA_CMD_GET_PIN_WIDGET_CTRL_HPHN_ENABLE_SHIFT)
#define HDA_CMD_GET_PIN_WIDGET_CTRL_OUT_ENABLE(rsp)			\
    (((rsp) & HDA_CMD_GET_PIN_WIDGET_CTRL_OUT_ENABLE_MASK) >>		\
    HDA_GET_CMD_PIN_WIDGET_CTRL_OUT_ENABLE_SHIFT)
#define HDA_CMD_GET_PIN_WIDGET_CTRL_IN_ENABLE(rsp)			\
    (((rsp) & HDA_CMD_GET_PIN_WIDGET_CTRL_IN_ENABLE_MASK) >>		\
    HDA_CMD_GET_PIN_WIDGET_CTRL_IN_ENABLE_SHIFT)
#define HDA_CMD_GET_PIN_WIDGET_CTRL_VREF_ENABLE(rsp)			\
    (((rsp) & HDA_CMD_GET_PIN_WIDGET_CTRL_VREF_ENABLE_MASK) >>		\
    HDA_CMD_GET_PIN_WIDGET_CTRL_VREF_ENABLE_SHIFT)

#define HDA_CMD_SET_PIN_WIDGET_CTRL_HPHN_ENABLE		0x80
#define HDA_CMD_SET_PIN_WIDGET_CTRL_OUT_ENABLE		0x40
#define HDA_CMD_SET_PIN_WIDGET_CTRL_IN_ENABLE		0x20
#define HDA_CMD_SET_PIN_WIDGET_CTRL_VREF_ENABLE_MASK	0x07
#define HDA_CMD_SET_PIN_WIDGET_CTRL_VREF_ENABLE_SHIFT	0

#define HDA_CMD_SET_PIN_WIDGET_CTRL_VREF_ENABLE(param)			\
    (((param) << HDA_CMD_SET_PIN_WIDGET_CTRL_VREF_ENABLE_SHIFT) &	\
    HDA_CMD_SET_PIN_WIDGET_CTRL_VREF_ENABLE_MASK)

#define HDA_CMD_PIN_WIDGET_CTRL_VREF_ENABLE_HIZ		0
#define HDA_CMD_PIN_WIDGET_CTRL_VREF_ENABLE_50		1
#define HDA_CMD_PIN_WIDGET_CTRL_VREF_ENABLE_GROUND	2
#define HDA_CMD_PIN_WIDGET_CTRL_VREF_ENABLE_80		4
#define HDA_CMD_PIN_WIDGET_CTRL_VREF_ENABLE_100		5

/* Unsolicited Response */
#define HDA_CMD_VERB_GET_UNSOLICITED_RESPONSE		0xf08
#define HDA_CMD_VERB_SET_UNSOLICITED_RESPONSE		0x708

#define HDA_CMD_GET_UNSOLICITED_RESPONSE(cad, nid)			\
    (HDA_CMD_12BIT((cad), (nid),					\
    HDA_CMD_VERB_GET_UNSOLICITED_RESPONSE, 0x0))
#define HDA_CMD_SET_UNSOLICITED_RESPONSE(cad, nid, payload)		\
    (HDA_CMD_12BIT((cad), (nid),					\
    HDA_CMD_VERB_SET_UNSOLICITED_RESPONSE, (payload)))

#define HDA_CMD_GET_UNSOLICITED_RESPONSE_ENABLE_MASK	0x00000080
#define HDA_CMD_GET_UNSOLICITED_RESPONSE_ENABLE_SHIFT	7
#define HDA_CMD_GET_UNSOLICITED_RESPONSE_TAG_MASK	0x0000001f
#define HDA_CMD_GET_UNSOLICITED_RESPONSE_TAG_SHIFT	0

#define HDA_CMD_GET_UNSOLICITED_RESPONSE_ENABLE(rsp)			\
    (((rsp) & HDA_CMD_GET_UNSOLICITED_RESPONSE_ENABLE_MASK) >>		\
    HDA_CMD_GET_UNSOLICITED_RESPONSE_ENABLE_SHIFT)
#define HDA_CMD_GET_UNSOLICITED_RESPONSE_TAG(rsp)			\
    (((rsp) & HDA_CMD_GET_UNSOLICITED_RESPONSE_TAG_MASK) >>		\
    HDA_CMD_GET_UNSOLICITED_RESPONSE_TAG_SHIFT)

#define HDA_CMD_SET_UNSOLICITED_RESPONSE_ENABLE		0x80
#define HDA_CMD_SET_UNSOLICITED_RESPONSE_TAG_MASK	0x3f
#define HDA_CMD_SET_UNSOLICITED_RESPONSE_TAG_SHIFT	0

#define HDA_CMD_SET_UNSOLICITED_RESPONSE_TAG(param)			\
    (((param) << HDA_CMD_SET_UNSOLICITED_RESPONSE_TAG_SHIFT) &		\
    HDA_CMD_SET_UNSOLICITED_RESPONSE_TAG_MASK)

/* Pin Sense */
#define HDA_CMD_VERB_GET_PIN_SENSE			0xf09
#define HDA_CMD_VERB_SET_PIN_SENSE			0x709

#define HDA_CMD_GET_PIN_SENSE(cad, nid)					\
    (HDA_CMD_12BIT((cad), (nid),					\
    HDA_CMD_VERB_GET_PIN_SENSE, 0x0))
#define HDA_CMD_SET_PIN_SENSE(cad, nid, payload)			\
    (HDA_CMD_12BIT((cad), (nid),					\
    HDA_CMD_VERB_SET_PIN_SENSE, (payload)))

#define HDA_CMD_GET_PIN_SENSE_PRESENCE_DETECT		0x80000000
#define HDA_CMD_GET_PIN_SENSE_ELD_VALID			0x40000000
#define HDA_CMD_GET_PIN_SENSE_IMP_SENSE_MASK		0x7fffffff
#define HDA_CMD_GET_PIN_SENSE_IMP_SENSE_SHIFT		0

#define HDA_CMD_GET_PIN_SENSE_IMP_SENSE(rsp)				\
    (((rsp) & HDA_CMD_GET_PIN_SENSE_IMP_SENSE_MASK) >>			\
    HDA_CMD_GET_PIN_SENSE_IMP_SENSE_SHIFT)

#define HDA_CMD_GET_PIN_SENSE_IMP_SENSE_INVALID		0x7fffffff

#define HDA_CMD_SET_PIN_SENSE_LEFT_CHANNEL		0x00
#define HDA_CMD_SET_PIN_SENSE_RIGHT_CHANNEL		0x01

/* EAPD/BTL Enable */
#define HDA_CMD_VERB_GET_EAPD_BTL_ENABLE		0xf0c
#define HDA_CMD_VERB_SET_EAPD_BTL_ENABLE		0x70c

#define HDA_CMD_GET_EAPD_BTL_ENABLE(cad, nid)				\
    (HDA_CMD_12BIT((cad), (nid),					\
    HDA_CMD_VERB_GET_EAPD_BTL_ENABLE, 0x0))
#define HDA_CMD_SET_EAPD_BTL_ENABLE(cad, nid, payload)			\
    (HDA_CMD_12BIT((cad), (nid),					\
    HDA_CMD_VERB_SET_EAPD_BTL_ENABLE, (payload)))

#define HDA_CMD_GET_EAPD_BTL_ENABLE_LR_SWAP_MASK	0x00000004
#define HDA_CMD_GET_EAPD_BTL_ENABLE_LR_SWAP_SHIFT	2
#define HDA_CMD_GET_EAPD_BTL_ENABLE_EAPD_MASK		0x00000002
#define HDA_CMD_GET_EAPD_BTL_ENABLE_EAPD_SHIFT		1
#define HDA_CMD_GET_EAPD_BTL_ENABLE_BTL_MASK		0x00000001
#define HDA_CMD_GET_EAPD_BTL_ENABLE_BTL_SHIFT		0

#define HDA_CMD_GET_EAPD_BTL_ENABLE_LR_SWAP(rsp)			\
    (((rsp) & HDA_CMD_GET_EAPD_BTL_ENABLE_LR_SWAP_MASK) >>		\
    HDA_CMD_GET_EAPD_BTL_ENABLE_LR_SWAP_SHIFT)
#define HDA_CMD_GET_EAPD_BTL_ENABLE_EAPD(rsp)				\
    (((rsp) & HDA_CMD_GET_EAPD_BTL_ENABLE_EAPD_MASK) >>			\
    HDA_CMD_GET_EAPD_BTL_ENABLE_EAPD_SHIFT)
#define HDA_CMD_GET_EAPD_BTL_ENABLE_BTL(rsp)				\
    (((rsp) & HDA_CMD_GET_EAPD_BTL_ENABLE_BTL_MASK) >>			\
    HDA_CMD_GET_EAPD_BTL_ENABLE_BTL_SHIFT)

#define HDA_CMD_SET_EAPD_BTL_ENABLE_LR_SWAP		0x04
#define HDA_CMD_SET_EAPD_BTL_ENABLE_EAPD		0x02
#define HDA_CMD_SET_EAPD_BTL_ENABLE_BTL			0x01

/* GPI Data */
#define HDA_CMD_VERB_GET_GPI_DATA			0xf10
#define HDA_CMD_VERB_SET_GPI_DATA			0x710

#define HDA_CMD_GET_GPI_DATA(cad, nid)					\
    (HDA_CMD_12BIT((cad), (nid),					\
    HDA_CMD_VERB_GET_GPI_DATA, 0x0))
#define HDA_CMD_SET_GPI_DATA(cad, nid)					\
    (HDA_CMD_12BIT((cad), (nid),					\
    HDA_CMD_VERB_SET_GPI_DATA, (payload)))

/* GPI Wake Enable Mask */
#define HDA_CMD_VERB_GET_GPI_WAKE_ENABLE_MASK		0xf11
#define HDA_CMD_VERB_SET_GPI_WAKE_ENABLE_MASK		0x711

#define HDA_CMD_GET_GPI_WAKE_ENABLE_MASK(cad, nid)			\
    (HDA_CMD_12BIT((cad), (nid),					\
    HDA_CMD_VERB_GET_GPI_WAKE_ENABLE_MASK, 0x0))
#define HDA_CMD_SET_GPI_WAKE_ENABLE_MASK(cad, nid, payload)		\
    (HDA_CMD_12BIT((cad), (nid),					\
    HDA_CMD_VERB_SET_GPI_WAKE_ENABLE_MASK, (payload)))

/* GPI Unsolicited Enable Mask */
#define HDA_CMD_VERB_GET_GPI_UNSOLICITED_ENABLE_MASK	0xf12
#define HDA_CMD_VERB_SET_GPI_UNSOLICITED_ENABLE_MASK	0x712

#define HDA_CMD_GET_GPI_UNSOLICITED_ENABLE_MASK(cad, nid)		\
    (HDA_CMD_12BIT((cad), (nid),					\
    HDA_CMD_VERB_GET_GPI_UNSOLICITED_ENABLE_MASK, 0x0))
#define HDA_CMD_SET_GPI_UNSOLICITED_ENABLE_MASK(cad, nid, payload)	\
    (HDA_CMD_12BIT((cad), (nid),					\
    HDA_CMD_VERB_SET_GPI_UNSOLICITED_ENABLE_MASK, (payload)))

/* GPI Sticky Mask */
#define HDA_CMD_VERB_GET_GPI_STICKY_MASK		0xf13
#define HDA_CMD_VERB_SET_GPI_STICKY_MASK		0x713

#define HDA_CMD_GET_GPI_STICKY_MASK(cad, nid)				\
    (HDA_CMD_12BIT((cad), (nid),					\
    HDA_CMD_VERB_GET_GPI_STICKY_MASK, 0x0))
#define HDA_CMD_SET_GPI_STICKY_MASK(cad, nid, payload)			\
    (HDA_CMD_12BIT((cad), (nid),					\
    HDA_CMD_VERB_SET_GPI_STICKY_MASK, (payload)))

/* GPO Data */
#define HDA_CMD_VERB_GET_GPO_DATA			0xf14
#define HDA_CMD_VERB_SET_GPO_DATA			0x714

#define HDA_CMD_GET_GPO_DATA(cad, nid)					\
    (HDA_CMD_12BIT((cad), (nid),					\
    HDA_CMD_VERB_GET_GPO_DATA, 0x0))
#define HDA_CMD_SET_GPO_DATA(cad, nid, payload)				\
    (HDA_CMD_12BIT((cad), (nid),					\
    HDA_CMD_VERB_SET_GPO_DATA, (payload)))

/* GPIO Data */
#define HDA_CMD_VERB_GET_GPIO_DATA			0xf15
#define HDA_CMD_VERB_SET_GPIO_DATA			0x715

#define HDA_CMD_GET_GPIO_DATA(cad, nid)					\
    (HDA_CMD_12BIT((cad), (nid),					\
    HDA_CMD_VERB_GET_GPIO_DATA, 0x0))
#define HDA_CMD_SET_GPIO_DATA(cad, nid, payload)			\
    (HDA_CMD_12BIT((cad), (nid),					\
    HDA_CMD_VERB_SET_GPIO_DATA, (payload)))

/* GPIO Enable Mask */
#define HDA_CMD_VERB_GET_GPIO_ENABLE_MASK		0xf16
#define HDA_CMD_VERB_SET_GPIO_ENABLE_MASK		0x716

#define HDA_CMD_GET_GPIO_ENABLE_MASK(cad, nid)				\
    (HDA_CMD_12BIT((cad), (nid),					\
    HDA_CMD_VERB_GET_GPIO_ENABLE_MASK, 0x0))
#define HDA_CMD_SET_GPIO_ENABLE_MASK(cad, nid, payload)			\
    (HDA_CMD_12BIT((cad), (nid),					\
    HDA_CMD_VERB_SET_GPIO_ENABLE_MASK, (payload)))

/* GPIO Direction */
#define HDA_CMD_VERB_GET_GPIO_DIRECTION			0xf17
#define HDA_CMD_VERB_SET_GPIO_DIRECTION			0x717

#define HDA_CMD_GET_GPIO_DIRECTION(cad, nid)				\
    (HDA_CMD_12BIT((cad), (nid),					\
    HDA_CMD_VERB_GET_GPIO_DIRECTION, 0x0))
#define HDA_CMD_SET_GPIO_DIRECTION(cad, nid, payload)			\
    (HDA_CMD_12BIT((cad), (nid),					\
    HDA_CMD_VERB_SET_GPIO_DIRECTION, (payload)))

/* GPIO Wake Enable Mask */
#define HDA_CMD_VERB_GET_GPIO_WAKE_ENABLE_MASK		0xf18
#define HDA_CMD_VERB_SET_GPIO_WAKE_ENABLE_MASK		0x718

#define HDA_CMD_GET_GPIO_WAKE_ENABLE_MASK(cad, nid)			\
    (HDA_CMD_12BIT((cad), (nid),					\
    HDA_CMD_VERB_GET_GPIO_WAKE_ENABLE_MASK, 0x0))
#define HDA_CMD_SET_GPIO_WAKE_ENABLE_MASK(cad, nid, payload)		\
    (HDA_CMD_12BIT((cad), (nid),					\
    HDA_CMD_VERB_SET_GPIO_WAKE_ENABLE_MASK, (payload)))

/* GPIO Unsolicited Enable Mask */
#define HDA_CMD_VERB_GET_GPIO_UNSOLICITED_ENABLE_MASK	0xf19
#define HDA_CMD_VERB_SET_GPIO_UNSOLICITED_ENABLE_MASK	0x719

#define HDA_CMD_GET_GPIO_UNSOLICITED_ENABLE_MASK(cad, nid)		\
    (HDA_CMD_12BIT((cad), (nid),					\
    HDA_CMD_VERB_GET_GPIO_UNSOLICITED_ENABLE_MASK, 0x0))
#define HDA_CMD_SET_GPIO_UNSOLICITED_ENABLE_MASK(cad, nid, payload)	\
    (HDA_CMD_12BIT((cad), (nid),					\
    HDA_CMD_VERB_SET_GPIO_UNSOLICITED_ENABLE_MASK, (payload)))

/* GPIO_STICKY_MASK */
#define HDA_CMD_VERB_GET_GPIO_STICKY_MASK		0xf1a
#define HDA_CMD_VERB_SET_GPIO_STICKY_MASK		0x71a

#define HDA_CMD_GET_GPIO_STICKY_MASK(cad, nid)				\
    (HDA_CMD_12BIT((cad), (nid),					\
    HDA_CMD_VERB_GET_GPIO_STICKY_MASK, 0x0))
#define HDA_CMD_SET_GPIO_STICKY_MASK(cad, nid, payload)			\
    (HDA_CMD_12BIT((cad), (nid),					\
    HDA_CMD_VERB_SET_GPIO_STICKY_MASK, (payload)))

/* Beep Generation */
#define HDA_CMD_VERB_GET_BEEP_GENERATION		0xf0a
#define HDA_CMD_VERB_SET_BEEP_GENERATION		0x70a

#define HDA_CMD_GET_BEEP_GENERATION(cad, nid)				\
    (HDA_CMD_12BIT((cad), (nid),					\
    HDA_CMD_VERB_GET_BEEP_GENERATION, 0x0))
#define HDA_CMD_SET_BEEP_GENERATION(cad, nid, payload)			\
    (HDA_CMD_12BIT((cad), (nid),					\
    HDA_CMD_VERB_SET_BEEP_GENERATION, (payload)))

/* Volume Knob */
#define HDA_CMD_VERB_GET_VOLUME_KNOB			0xf0f
#define HDA_CMD_VERB_SET_VOLUME_KNOB			0x70f

#define HDA_CMD_GET_VOLUME_KNOB(cad, nid)				\
    (HDA_CMD_12BIT((cad), (nid),					\
    HDA_CMD_VERB_GET_VOLUME_KNOB, 0x0))
#define HDA_CMD_SET_VOLUME_KNOB(cad, nid, payload)			\
    (HDA_CMD_12BIT((cad), (nid),					\
    HDA_CMD_VERB_SET_VOLUME_KNOB, (payload)))

/* Subsystem ID */
#define HDA_CMD_VERB_GET_SUBSYSTEM_ID			0xf20
#define HDA_CMD_VERB_SET_SUSBYSTEM_ID1			0x720
#define HDA_CMD_VERB_SET_SUBSYSTEM_ID2			0x721
#define HDA_CMD_VERB_SET_SUBSYSTEM_ID3			0x722
#define HDA_CMD_VERB_SET_SUBSYSTEM_ID4			0x723

#define HDA_CMD_GET_SUBSYSTEM_ID(cad, nid)				\
    (HDA_CMD_12BIT((cad), (nid),					\
    HDA_CMD_VERB_GET_SUBSYSTEM_ID, 0x0))
#define HDA_CMD_SET_SUBSYSTEM_ID1(cad, nid, payload)			\
    (HDA_CMD_12BIT((cad), (nid),					\
    HDA_CMD_VERB_SET_SUSBYSTEM_ID1, (payload)))
#define HDA_CMD_SET_SUBSYSTEM_ID2(cad, nid, payload)			\
    (HDA_CMD_12BIT((cad), (nid),					\
    HDA_CMD_VERB_SET_SUSBYSTEM_ID2, (payload)))
#define HDA_CMD_SET_SUBSYSTEM_ID3(cad, nid, payload)			\
    (HDA_CMD_12BIT((cad), (nid),					\
    HDA_CMD_VERB_SET_SUSBYSTEM_ID3, (payload)))
#define HDA_CMD_SET_SUBSYSTEM_ID4(cad, nid, payload)			\
    (HDA_CMD_12BIT((cad), (nid),					\
    HDA_CMD_VERB_SET_SUSBYSTEM_ID4, (payload)))

/* Configuration Default */
#define HDA_CMD_VERB_GET_CONFIGURATION_DEFAULT		0xf1c
#define HDA_CMD_VERB_SET_CONFIGURATION_DEFAULT1		0x71c
#define HDA_CMD_VERB_SET_CONFIGURATION_DEFAULT2		0x71d
#define HDA_CMD_VERB_SET_CONFIGURATION_DEFAULT3		0x71e
#define HDA_CMD_VERB_SET_CONFIGURATION_DEFAULT4		0x71f

#define HDA_CMD_GET_CONFIGURATION_DEFAULT(cad, nid)			\
    (HDA_CMD_12BIT((cad), (nid),					\
    HDA_CMD_VERB_GET_CONFIGURATION_DEFAULT, 0x0))
#define HDA_CMD_SET_CONFIGURATION_DEFAULT1(cad, nid, payload)		\
    (HDA_CMD_12BIT((cad), (nid),					\
    HDA_CMD_VERB_SET_CONFIGURATION_DEFAULT1, (payload)))
#define HDA_CMD_SET_CONFIGURATION_DEFAULT2(cad, nid, payload)		\
    (HDA_CMD_12BIT((cad), (nid),					\
    HDA_CMD_VERB_SET_CONFIGURATION_DEFAULT2, (payload)))
#define HDA_CMD_SET_CONFIGURATION_DEFAULT3(cad, nid, payload)		\
    (HDA_CMD_12BIT((cad), (nid),					\
    HDA_CMD_VERB_SET_CONFIGURATION_DEFAULT3, (payload)))
#define HDA_CMD_SET_CONFIGURATION_DEFAULT4(cad, nid, payload)		\
    (HDA_CMD_12BIT((cad), (nid),					\
    HDA_CMD_VERB_SET_CONFIGURATION_DEFAULT4, (payload)))

/* Stripe Control */
#define HDA_CMD_VERB_GET_STRIPE_CONTROL			0xf24
#define HDA_CMD_VERB_SET_STRIPE_CONTROL			0x724

#define HDA_CMD_GET_STRIPE_CONTROL(cad, nid)				\
    (HDA_CMD_12BIT((cad), (nid),					\
    HDA_CMD_VERB_GET_STRIPE_CONTROL, 0x0))
#define HDA_CMD_SET_STRIPE_CONTROL(cad, nid, payload)			\
    (HDA_CMD_12BIT((cad), (nid),					\
    HDA_CMD_VERB_SET_STRIPE_CONTROL, (payload)))

/* Channel Count Control */
#define HDA_CMD_VERB_GET_CONV_CHAN_COUNT			0xf2d
#define HDA_CMD_VERB_SET_CONV_CHAN_COUNT			0x72d 

#define HDA_CMD_GET_CONV_CHAN_COUNT(cad, nid)				\
    (HDA_CMD_12BIT((cad), (nid),					\
    HDA_CMD_VERB_GET_CONV_CHAN_COUNT, 0x0))
#define HDA_CMD_SET_CONV_CHAN_COUNT(cad, nid, payload)			\
    (HDA_CMD_12BIT((cad), (nid),					\
    HDA_CMD_VERB_SET_CONV_CHAN_COUNT, (payload)))

#define HDA_CMD_VERB_GET_HDMI_DIP_SIZE			0xf2e 

#define HDA_CMD_GET_HDMI_DIP_SIZE(cad, nid, arg)			\
    (HDA_CMD_12BIT((cad), (nid),					\
    HDA_CMD_VERB_GET_HDMI_DIP_SIZE, (arg)))

#define HDA_CMD_VERB_GET_HDMI_ELDD			0xf2f 

#define HDA_CMD_GET_HDMI_ELDD(cad, nid, off)				\
    (HDA_CMD_12BIT((cad), (nid),					\
    HDA_CMD_VERB_GET_HDMI_ELDD, (off)))

#define HDA_CMD_VERB_GET_HDMI_DIP_INDEX			0xf30 
#define HDA_CMD_VERB_SET_HDMI_DIP_INDEX			0x730 

#define HDA_CMD_GET_HDMI_DIP_INDEX(cad, nid)				\
    (HDA_CMD_12BIT((cad), (nid),					\
    HDA_CMD_VERB_GET_HDMI_DIP_INDEX, 0x0))
#define HDA_CMD_SET_HDMI_DIP_INDEX(cad, nid, payload)			\
    (HDA_CMD_12BIT((cad), (nid),					\
    HDA_CMD_VERB_SET_HDMI_DIP_INDEX, (payload)))

#define HDA_CMD_VERB_GET_HDMI_DIP_DATA			0xf31 
#define HDA_CMD_VERB_SET_HDMI_DIP_DATA			0x731 

#define HDA_CMD_GET_HDMI_DIP_DATA(cad, nid)				\
    (HDA_CMD_12BIT((cad), (nid),					\
    HDA_CMD_VERB_GET_HDMI_DIP_DATA, 0x0))
#define HDA_CMD_SET_HDMI_DIP_DATA(cad, nid, payload)			\
    (HDA_CMD_12BIT((cad), (nid),					\
    HDA_CMD_VERB_SET_HDMI_DIP_DATA, (payload)))

#define HDA_CMD_VERB_GET_HDMI_DIP_XMIT			0xf32 
#define HDA_CMD_VERB_SET_HDMI_DIP_XMIT			0x732 

#define HDA_CMD_GET_HDMI_DIP_XMIT(cad, nid)				\
    (HDA_CMD_12BIT((cad), (nid),					\
    HDA_CMD_VERB_GET_HDMI_DIP_XMIT, 0x0))
#define HDA_CMD_SET_HDMI_DIP_XMIT(cad, nid, payload)			\
    (HDA_CMD_12BIT((cad), (nid),					\
    HDA_CMD_VERB_SET_HDMI_DIP_XMIT, (payload)))

#define HDA_CMD_VERB_GET_HDMI_CP_CTRL			0xf33 
#define HDA_CMD_VERB_SET_HDMI_CP_CTRL			0x733 

#define HDA_CMD_VERB_GET_HDMI_CHAN_SLOT			0xf34 
#define HDA_CMD_VERB_SET_HDMI_CHAN_SLOT			0x734 

#define HDA_CMD_GET_HDMI_CHAN_SLOT(cad, nid)				\
    (HDA_CMD_12BIT((cad), (nid),					\
    HDA_CMD_VERB_GET_HDMI_CHAN_SLOT, 0x0))
#define HDA_CMD_SET_HDMI_CHAN_SLOT(cad, nid, payload)			\
    (HDA_CMD_12BIT((cad), (nid),					\
    HDA_CMD_VERB_SET_HDMI_CHAN_SLOT, (payload)))

#define	HDA_HDMI_CODING_TYPE_REF_STREAM_HEADER		0
#define	HDA_HDMI_CODING_TYPE_LPCM			1
#define	HDA_HDMI_CODING_TYPE_AC3			2
#define	HDA_HDMI_CODING_TYPE_MPEG1			3
#define	HDA_HDMI_CODING_TYPE_MP3			4
#define	HDA_HDMI_CODING_TYPE_MPEG2			5
#define	HDA_HDMI_CODING_TYPE_AACLC			6
#define	HDA_HDMI_CODING_TYPE_DTS			7
#define	HDA_HDMI_CODING_TYPE_ATRAC			8
#define	HDA_HDMI_CODING_TYPE_SACD			9
#define	HDA_HDMI_CODING_TYPE_EAC3			10
#define	HDA_HDMI_CODING_TYPE_DTS_HD			11
#define	HDA_HDMI_CODING_TYPE_MLP			12
#define	HDA_HDMI_CODING_TYPE_DST			13
#define	HDA_HDMI_CODING_TYPE_WMAPRO			14
#define	HDA_HDMI_CODING_TYPE_REF_CTX			15

/* Function Reset */
#define HDA_CMD_VERB_FUNCTION_RESET			0x7ff

#define HDA_CMD_FUNCTION_RESET(cad, nid)				\
    (HDA_CMD_12BIT((cad), (nid),					\
    HDA_CMD_VERB_FUNCTION_RESET, 0x0))


/****************************************************************************
 * HDA Device Parameters
 ****************************************************************************/

/* Vendor ID */
#define HDA_PARAM_VENDOR_ID				0x00

#define HDA_PARAM_VENDOR_ID_VENDOR_ID_MASK		0xffff0000
#define HDA_PARAM_VENDOR_ID_VENDOR_ID_SHIFT		16
#define HDA_PARAM_VENDOR_ID_DEVICE_ID_MASK		0x0000ffff
#define HDA_PARAM_VENDOR_ID_DEVICE_ID_SHIFT		0

#define HDA_PARAM_VENDOR_ID_VENDOR_ID(param)				\
    (((param) & HDA_PARAM_VENDOR_ID_VENDOR_ID_MASK) >>			\
    HDA_PARAM_VENDOR_ID_VENDOR_ID_SHIFT)
#define HDA_PARAM_VENDOR_ID_DEVICE_ID(param)				\
    (((param) & HDA_PARAM_VENDOR_ID_DEVICE_ID_MASK) >>			\
    HDA_PARAM_VENDOR_ID_DEVICE_ID_SHIFT)

/* Revision ID */
#define HDA_PARAM_REVISION_ID				0x02

#define HDA_PARAM_REVISION_ID_MAJREV_MASK		0x00f00000
#define HDA_PARAM_REVISION_ID_MAJREV_SHIFT		20
#define HDA_PARAM_REVISION_ID_MINREV_MASK		0x000f0000
#define HDA_PARAM_REVISION_ID_MINREV_SHIFT		16
#define HDA_PARAM_REVISION_ID_REVISION_ID_MASK		0x0000ff00
#define HDA_PARAM_REVISION_ID_REVISION_ID_SHIFT		8
#define HDA_PARAM_REVISION_ID_STEPPING_ID_MASK		0x000000ff
#define HDA_PARAM_REVISION_ID_STEPPING_ID_SHIFT		0

#define HDA_PARAM_REVISION_ID_MAJREV(param)				\
    (((param) & HDA_PARAM_REVISION_ID_MAJREV_MASK) >>			\
    HDA_PARAM_REVISION_ID_MAJREV_SHIFT)
#define HDA_PARAM_REVISION_ID_MINREV(param)				\
    (((param) & HDA_PARAM_REVISION_ID_MINREV_MASK) >>			\
    HDA_PARAM_REVISION_ID_MINREV_SHIFT)
#define HDA_PARAM_REVISION_ID_REVISION_ID(param)			\
    (((param) & HDA_PARAM_REVISION_ID_REVISION_ID_MASK) >>		\
    HDA_PARAM_REVISION_ID_REVISION_ID_SHIFT)
#define HDA_PARAM_REVISION_ID_STEPPING_ID(param)			\
    (((param) & HDA_PARAM_REVISION_ID_STEPPING_ID_MASK) >>		\
    HDA_PARAM_REVISION_ID_STEPPING_ID_SHIFT)

/* Subordinate Node Cound */
#define HDA_PARAM_SUB_NODE_COUNT			0x04

#define HDA_PARAM_SUB_NODE_COUNT_START_MASK		0x00ff0000
#define HDA_PARAM_SUB_NODE_COUNT_START_SHIFT		16
#define HDA_PARAM_SUB_NODE_COUNT_TOTAL_MASK		0x000000ff
#define HDA_PARAM_SUB_NODE_COUNT_TOTAL_SHIFT		0

#define HDA_PARAM_SUB_NODE_COUNT_START(param)				\
    (((param) & HDA_PARAM_SUB_NODE_COUNT_START_MASK) >>			\
    HDA_PARAM_SUB_NODE_COUNT_START_SHIFT)
#define HDA_PARAM_SUB_NODE_COUNT_TOTAL(param)				\
    (((param) & HDA_PARAM_SUB_NODE_COUNT_TOTAL_MASK) >>			\
    HDA_PARAM_SUB_NODE_COUNT_TOTAL_SHIFT)

/* Function Group Type */
#define HDA_PARAM_FCT_GRP_TYPE				0x05

#define HDA_PARAM_FCT_GRP_TYPE_UNSOL_MASK		0x00000100
#define HDA_PARAM_FCT_GRP_TYPE_UNSOL_SHIFT		8
#define HDA_PARAM_FCT_GRP_TYPE_NODE_TYPE_MASK		0x000000ff
#define HDA_PARAM_FCT_GRP_TYPE_NODE_TYPE_SHIFT	0

#define HDA_PARAM_FCT_GRP_TYPE_UNSOL(param)				\
    (((param) & HDA_PARAM_FCT_GRP_TYPE_UNSOL_MASK) >>			\
    HDA_PARAM_FCT_GROUP_TYPE_UNSOL_SHIFT)
#define HDA_PARAM_FCT_GRP_TYPE_NODE_TYPE(param)				\
    (((param) & HDA_PARAM_FCT_GRP_TYPE_NODE_TYPE_MASK) >>		\
    HDA_PARAM_FCT_GRP_TYPE_NODE_TYPE_SHIFT)

#define HDA_PARAM_FCT_GRP_TYPE_NODE_TYPE_AUDIO		0x01
#define HDA_PARAM_FCT_GRP_TYPE_NODE_TYPE_MODEM		0x02

/* Audio Function Group Capabilities */
#define HDA_PARAM_AUDIO_FCT_GRP_CAP			0x08

#define HDA_PARAM_AUDIO_FCT_GRP_CAP_BEEP_GEN_MASK	0x00010000
#define HDA_PARAM_AUDIO_FCT_GRP_CAP_BEEP_GEN_SHIFT	16
#define HDA_PARAM_AUDIO_FCT_GRP_CAP_INPUT_DELAY_MASK	0x00000f00
#define HDA_PARAM_AUDIO_FCT_GRP_CAP_INPUT_DELAY_SHIFT	8
#define HDA_PARAM_AUDIO_FCT_GRP_CAP_OUTPUT_DELAY_MASK	0x0000000f
#define HDA_PARAM_AUDIO_FCT_GRP_CAP_OUTPUT_DELAY_SHIFT	0

#define HDA_PARAM_AUDIO_FCT_GRP_CAP_BEEP_GEN(param)			\
    (((param) & HDA_PARAM_AUDIO_FCT_GRP_CAP_BEEP_GEN_MASK) >>		\
    HDA_PARAM_AUDIO_FCT_GRP_CAP_BEEP_GEN_SHIFT)
#define HDA_PARAM_AUDIO_FCT_GRP_CAP_INPUT_DELAY(param)			\
    (((param) & HDA_PARAM_AUDIO_FCT_GRP_CAP_INPUT_DELAY_MASK) >>	\
    HDA_PARAM_AUDIO_FCT_GRP_CAP_INPUT_DELAY_SHIFT)
#define HDA_PARAM_AUDIO_FCT_GRP_CAP_OUTPUT_DELAY(param)			\
    (((param) & HDA_PARAM_AUDIO_FCT_GRP_CAP_OUTPUT_DELAY_MASK) >>	\
    HDA_PARAM_AUDIO_FCT_GRP_CAP_OUTPUT_DELAY_SHIFT)

/* Audio Widget Capabilities */
#define HDA_PARAM_AUDIO_WIDGET_CAP			0x09

#define HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_MASK		0x00f00000
#define HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_SHIFT		20
#define HDA_PARAM_AUDIO_WIDGET_CAP_DELAY_MASK		0x000f0000
#define HDA_PARAM_AUDIO_WIDGET_CAP_DELAY_SHIFT		16
#define HDA_PARAM_AUDIO_WIDGET_CAP_CC_EXT_MASK		0x0000e000
#define HDA_PARAM_AUDIO_WIDGET_CAP_CC_EXT_SHIFT		13
#define HDA_PARAM_AUDIO_WIDGET_CAP_CP_MASK		0x00001000
#define HDA_PARAM_AUDIO_WIDGET_CAP_CP_SHIFT		12
#define HDA_PARAM_AUDIO_WIDGET_CAP_LR_SWAP_MASK		0x00000800
#define HDA_PARAM_AUDIO_WIDGET_CAP_LR_SWAP_SHIFT	11
#define HDA_PARAM_AUDIO_WIDGET_CAP_POWER_CTRL_MASK	0x00000400
#define HDA_PARAM_AUDIO_WIDGET_CAP_POWER_CTRL_SHIFT	10
#define HDA_PARAM_AUDIO_WIDGET_CAP_DIGITAL_MASK		0x00000200
#define HDA_PARAM_AUDIO_WIDGET_CAP_DIGITAL_SHIFT	9
#define HDA_PARAM_AUDIO_WIDGET_CAP_CONN_LIST_MASK	0x00000100
#define HDA_PARAM_AUDIO_WIDGET_CAP_CONN_LIST_SHIFT	8
#define HDA_PARAM_AUDIO_WIDGET_CAP_UNSOL_CAP_MASK	0x00000080
#define HDA_PARAM_AUDIO_WIDGET_CAP_UNSOL_CAP_SHIFT	7
#define HDA_PARAM_AUDIO_WIDGET_CAP_PROC_WIDGET_MASK	0x00000040
#define HDA_PARAM_AUDIO_WIDGET_CAP_PROC_WIDGET_SHIFT	6
#define HDA_PARAM_AUDIO_WIDGET_CAP_STRIPE_MASK		0x00000020
#define HDA_PARAM_AUDIO_WIDGET_CAP_STRIPE_SHIFT		5
#define HDA_PARAM_AUDIO_WIDGET_CAP_FORMAT_OVR_MASK	0x00000010
#define HDA_PARAM_AUDIO_WIDGET_CAP_FORMAT_OVR_SHIFT	4
#define HDA_PARAM_AUDIO_WIDGET_CAP_AMP_OVR_MASK		0x00000008
#define HDA_PARAM_AUDIO_WIDGET_CAP_AMP_OVR_SHIFT	3
#define HDA_PARAM_AUDIO_WIDGET_CAP_OUT_AMP_MASK		0x00000004
#define HDA_PARAM_AUDIO_WIDGET_CAP_OUT_AMP_SHIFT	2
#define HDA_PARAM_AUDIO_WIDGET_CAP_IN_AMP_MASK		0x00000002
#define HDA_PARAM_AUDIO_WIDGET_CAP_IN_AMP_SHIFT		1
#define HDA_PARAM_AUDIO_WIDGET_CAP_STEREO_MASK		0x00000001
#define HDA_PARAM_AUDIO_WIDGET_CAP_STEREO_SHIFT		0

#define HDA_PARAM_AUDIO_WIDGET_CAP_TYPE(param)				\
    (((param) & HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_MASK) >>		\
    HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_SHIFT)
#define HDA_PARAM_AUDIO_WIDGET_CAP_DELAY(param)				\
    (((param) & HDA_PARAM_AUDIO_WIDGET_CAP_DELAY_MASK) >>		\
    HDA_PARAM_AUDIO_WIDGET_CAP_DELAY_SHIFT)
#define HDA_PARAM_AUDIO_WIDGET_CAP_CC(param)				\
    ((((param) & HDA_PARAM_AUDIO_WIDGET_CAP_CC_EXT_MASK) >>		\
    (HDA_PARAM_AUDIO_WIDGET_CAP_CC_EXT_SHIFT - 1)) |			\
    (((param) & HDA_PARAM_AUDIO_WIDGET_CAP_STEREO_MASK) >>		\
    HDA_PARAM_AUDIO_WIDGET_CAP_STEREO_SHIFT))
#define HDA_PARAM_AUDIO_WIDGET_CAP_CP(param)				\
    (((param) & HDA_PARAM_AUDIO_WIDGET_CAP_CP_MASK) >>			\
    HDA_PARAM_AUDIO_WIDGET_CAP_CP_SHIFT)
#define HDA_PARAM_AUDIO_WIDGET_CAP_LR_SWAP(param)			\
    (((param) & HDA_PARAM_AUDIO_WIDGET_CAP_LR_SWAP_MASK) >>		\
    HDA_PARAM_AUDIO_WIDGET_CAP_LR_SWAP_SHIFT)
#define HDA_PARAM_AUDIO_WIDGET_CAP_POWER_CTRL(param)			\
    (((param) & HDA_PARAM_AUDIO_WIDGET_CAP_POWER_CTRL_MASK) >>		\
    HDA_PARAM_AUDIO_WIDGET_CAP_POWER_CTRL_SHIFT)
#define HDA_PARAM_AUDIO_WIDGET_CAP_DIGITAL(param)			\
    (((param) & HDA_PARAM_AUDIO_WIDGET_CAP_DIGITAL_MASK) >>		\
    HDA_PARAM_AUDIO_WIDGET_CAP_DIGITAL_SHIFT)
#define HDA_PARAM_AUDIO_WIDGET_CAP_CONN_LIST(param)			\
    (((param) & HDA_PARAM_AUDIO_WIDGET_CAP_CONN_LIST_MASK) >>		\
    HDA_PARAM_AUDIO_WIDGET_CAP_CONN_LIST_SHIFT)
#define HDA_PARAM_AUDIO_WIDGET_CAP_UNSOL_CAP(param)			\
    (((param) & HDA_PARAM_AUDIO_WIDGET_CAP_UNSOL_CAP_MASK) >>		\
    HDA_PARAM_AUDIO_WIDGET_CAP_UNSOL_CAP_SHIFT)
#define HDA_PARAM_AUDIO_WIDGET_CAP_PROC_WIDGET(param)			\
    (((param) & HDA_PARAM_AUDIO_WIDGET_CAP_PROC_WIDGET_MASK) >>		\
    HDA_PARAM_AUDIO_WIDGET_CAP_PROC_WIDGET_SHIFT)
#define HDA_PARAM_AUDIO_WIDGET_CAP_STRIPE(param)			\
    (((param) & HDA_PARAM_AUDIO_WIDGET_CAP_STRIPE_MASK) >>		\
    HDA_PARAM_AUDIO_WIDGET_CAP_STRIPE_SHIFT)
#define HDA_PARAM_AUDIO_WIDGET_CAP_FORMAT_OVR(param)			\
    (((param) & HDA_PARAM_AUDIO_WIDGET_CAP_FORMAT_OVR_MASK) >>		\
    HDA_PARAM_AUDIO_WIDGET_CAP_FORMAT_OVR_SHIFT)
#define HDA_PARAM_AUDIO_WIDGET_CAP_AMP_OVR(param)			\
    (((param) & HDA_PARAM_AUDIO_WIDGET_CAP_AMP_OVR_MASK) >>		\
    HDA_PARAM_AUDIO_WIDGET_CAP_AMP_OVR_SHIFT)
#define HDA_PARAM_AUDIO_WIDGET_CAP_OUT_AMP(param)			\
    (((param) & HDA_PARAM_AUDIO_WIDGET_CAP_OUT_AMP_MASK) >>		\
    HDA_PARAM_AUDIO_WIDGET_CAP_OUT_AMP_SHIFT)
#define HDA_PARAM_AUDIO_WIDGET_CAP_IN_AMP(param)			\
    (((param) & HDA_PARAM_AUDIO_WIDGET_CAP_IN_AMP_MASK) >>		\
    HDA_PARAM_AUDIO_WIDGET_CAP_IN_AMP_SHIFT)
#define HDA_PARAM_AUDIO_WIDGET_CAP_STEREO(param)			\
    (((param) & HDA_PARAM_AUDIO_WIDGET_CAP_STEREO_MASK) >>		\
    HDA_PARAM_AUDIO_WIDGET_CAP_STEREO_SHIFT)

#define HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_AUDIO_OUTPUT	0x0
#define HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_AUDIO_INPUT	0x1
#define HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_AUDIO_MIXER	0x2
#define HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_AUDIO_SELECTOR	0x3
#define HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_PIN_COMPLEX	0x4
#define HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_POWER_WIDGET	0x5
#define HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_VOLUME_WIDGET	0x6
#define HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_BEEP_WIDGET	0x7
#define HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_VENDOR_WIDGET	0xf

/* Supported PCM Size, Rates */

#define HDA_PARAM_SUPP_PCM_SIZE_RATE			0x0a

#define HDA_PARAM_SUPP_PCM_SIZE_RATE_32BIT_MASK		0x00100000
#define HDA_PARAM_SUPP_PCM_SIZE_RATE_32BIT_SHIFT	20
#define HDA_PARAM_SUPP_PCM_SIZE_RATE_24BIT_MASK		0x00080000
#define HDA_PARAM_SUPP_PCM_SIZE_RATE_24BIT_SHIFT	19
#define HDA_PARAM_SUPP_PCM_SIZE_RATE_20BIT_MASK		0x00040000
#define HDA_PARAM_SUPP_PCM_SIZE_RATE_20BIT_SHIFT	18
#define HDA_PARAM_SUPP_PCM_SIZE_RATE_16BIT_MASK		0x00020000
#define HDA_PARAM_SUPP_PCM_SIZE_RATE_16BIT_SHIFT	17
#define HDA_PARAM_SUPP_PCM_SIZE_RATE_8BIT_MASK		0x00010000
#define HDA_PARAM_SUPP_PCM_SIZE_RATE_8BIT_SHIFT		16
#define HDA_PARAM_SUPP_PCM_SIZE_RATE_8KHZ_MASK		0x00000001
#define HDA_PARAM_SUPP_PCM_SIZE_RATE_8KHZ_SHIFT		0
#define HDA_PARAM_SUPP_PCM_SIZE_RATE_11KHZ_MASK		0x00000002
#define HDA_PARAM_SUPP_PCM_SIZE_RATE_11KHZ_SHIFT	1
#define HDA_PARAM_SUPP_PCM_SIZE_RATE_16KHZ_MASK		0x00000004
#define HDA_PARAM_SUPP_PCM_SIZE_RATE_16KHZ_SHIFT	2
#define HDA_PARAM_SUPP_PCM_SIZE_RATE_22KHZ_MASK		0x00000008
#define HDA_PARAM_SUPP_PCM_SIZE_RATE_22KHZ_SHIFT	3
#define HDA_PARAM_SUPP_PCM_SIZE_RATE_32KHZ_MASK		0x00000010
#define HDA_PARAM_SUPP_PCM_SIZE_RATE_32KHZ_SHIFT	4
#define HDA_PARAM_SUPP_PCM_SIZE_RATE_44KHZ_MASK		0x00000020
#define HDA_PARAM_SUPP_PCM_SIZE_RATE_44KHZ_SHIFT	5
#define HDA_PARAM_SUPP_PCM_SIZE_RATE_48KHZ_MASK		0x00000040
#define HDA_PARAM_SUPP_PCM_SIZE_RATE_48KHZ_SHIFT	6
#define HDA_PARAM_SUPP_PCM_SIZE_RATE_88KHZ_MASK		0x00000080
#define HDA_PARAM_SUPP_PCM_SIZE_RATE_88KHZ_SHIFT	7
#define HDA_PARAM_SUPP_PCM_SIZE_RATE_96KHZ_MASK		0x00000100
#define HDA_PARAM_SUPP_PCM_SIZE_RATE_96KHZ_SHIFT	8
#define HDA_PARAM_SUPP_PCM_SIZE_RATE_176KHZ_MASK	0x00000200
#define HDA_PARAM_SUPP_PCM_SIZE_RATE_176KHZ_SHIFT	9
#define HDA_PARAM_SUPP_PCM_SIZE_RATE_192KHZ_MASK	0x00000400
#define HDA_PARAM_SUPP_PCM_SIZE_RATE_192KHZ_SHIFT	10
#define HDA_PARAM_SUPP_PCM_SIZE_RATE_384KHZ_MASK	0x00000800
#define HDA_PARAM_SUPP_PCM_SIZE_RATE_384KHZ_SHIFT	11

#define HDA_PARAM_SUPP_PCM_SIZE_RATE_32BIT(param)			\
    (((param) & HDA_PARAM_SUPP_PCM_SIZE_RATE_32BIT_MASK) >>		\
    HDA_PARAM_SUPP_PCM_SIZE_RATE_32BIT_SHIFT)
#define HDA_PARAM_SUPP_PCM_SIZE_RATE_24BIT(param)			\
    (((param) & HDA_PARAM_SUPP_PCM_SIZE_RATE_24BIT_MASK) >>		\
    HDA_PARAM_SUPP_PCM_SIZE_RATE_24BIT_SHIFT)
#define HDA_PARAM_SUPP_PCM_SIZE_RATE_20BIT(param)			\
    (((param) & HDA_PARAM_SUPP_PCM_SIZE_RATE_20BIT_MASK) >>		\
    HDA_PARAM_SUPP_PCM_SIZE_RATE_20BIT_SHIFT)
#define HDA_PARAM_SUPP_PCM_SIZE_RATE_16BIT(param)			\
    (((param) & HDA_PARAM_SUPP_PCM_SIZE_RATE_16BIT_MASK) >>		\
    HDA_PARAM_SUPP_PCM_SIZE_RATE_16BIT_SHIFT)
#define HDA_PARAM_SUPP_PCM_SIZE_RATE_8BIT(param)			\
    (((param) & HDA_PARAM_SUPP_PCM_SIZE_RATE_8BIT_MASK) >>		\
    HDA_PARAM_SUPP_PCM_SIZE_RATE_8BIT_SHIFT)
#define HDA_PARAM_SUPP_PCM_SIZE_RATE_8KHZ(param)			\
    (((param) & HDA_PARAM_SUPP_PCM_SIZE_RATE_8KHZ_MASK) >>		\
    HDA_PARAM_SUPP_PCM_SIZE_RATE_8KHZ_SHIFT)
#define HDA_PARAM_SUPP_PCM_SIZE_RATE_11KHZ(param)			\
    (((param) & HDA_PARAM_SUPP_PCM_SIZE_RATE_11KHZ_MASK) >>		\
    HDA_PARAM_SUPP_PCM_SIZE_RATE_11KHZ_SHIFT)
#define HDA_PARAM_SUPP_PCM_SIZE_RATE_16KHZ(param)			\
    (((param) & HDA_PARAM_SUPP_PCM_SIZE_RATE_16KHZ_MASK) >>		\
    HDA_PARAM_SUPP_PCM_SIZE_RATE_16KHZ_SHIFT)
#define HDA_PARAM_SUPP_PCM_SIZE_RATE_22KHZ(param)			\
    (((param) & HDA_PARAM_SUPP_PCM_SIZE_RATE_22KHZ_MASK) >>		\
    HDA_PARAM_SUPP_PCM_SIZE_RATE_22KHZ_SHIFT)
#define HDA_PARAM_SUPP_PCM_SIZE_RATE_32KHZ(param)			\
    (((param) & HDA_PARAM_SUPP_PCM_SIZE_RATE_32KHZ_MASK) >>		\
    HDA_PARAM_SUPP_PCM_SIZE_RATE_32KHZ_SHIFT)
#define HDA_PARAM_SUPP_PCM_SIZE_RATE_44KHZ(param)			\
    (((param) & HDA_PARAM_SUPP_PCM_SIZE_RATE_44KHZ_MASK) >>		\
    HDA_PARAM_SUPP_PCM_SIZE_RATE_44KHZ_SHIFT)
#define HDA_PARAM_SUPP_PCM_SIZE_RATE_48KHZ(param)			\
    (((param) & HDA_PARAM_SUPP_PCM_SIZE_RATE_48KHZ_MASK) >>		\
    HDA_PARAM_SUPP_PCM_SIZE_RATE_48KHZ_SHIFT)
#define HDA_PARAM_SUPP_PCM_SIZE_RATE_88KHZ(param)			\
    (((param) & HDA_PARAM_SUPP_PCM_SIZE_RATE_88KHZ_MASK) >>		\
    HDA_PARAM_SUPP_PCM_SIZE_RATE_88KHZ_SHIFT)
#define HDA_PARAM_SUPP_PCM_SIZE_RATE_96KHZ(param)			\
    (((param) & HDA_PARAM_SUPP_PCM_SIZE_RATE_96KHZ_MASK) >>		\
    HDA_PARAM_SUPP_PCM_SIZE_RATE_96KHZ_SHIFT)
#define HDA_PARAM_SUPP_PCM_SIZE_RATE_176KHZ(param)			\
    (((param) & HDA_PARAM_SUPP_PCM_SIZE_RATE_176KHZ_MASK) >>		\
    HDA_PARAM_SUPP_PCM_SIZE_RATE_176KHZ_SHIFT)
#define HDA_PARAM_SUPP_PCM_SIZE_RATE_192KHZ(param)			\
    (((param) & HDA_PARAM_SUPP_PCM_SIZE_RATE_192KHZ_MASK) >>		\
    HDA_PARAM_SUPP_PCM_SIZE_RATE_192KHZ_SHIFT)
#define HDA_PARAM_SUPP_PCM_SIZE_RATE_384KHZ(param)			\
    (((param) & HDA_PARAM_SUPP_PCM_SIZE_RATE_384KHZ_MASK) >>		\
    HDA_PARAM_SUPP_PCM_SIZE_RATE_384KHZ_SHIFT)

/* Supported Stream Formats */
#define HDA_PARAM_SUPP_STREAM_FORMATS			0x0b

#define HDA_PARAM_SUPP_STREAM_FORMATS_AC3_MASK		0x00000004
#define HDA_PARAM_SUPP_STREAM_FORMATS_AC3_SHIFT		2
#define HDA_PARAM_SUPP_STREAM_FORMATS_FLOAT32_MASK	0x00000002
#define HDA_PARAM_SUPP_STREAM_FORMATS_FLOAT32_SHIFT	1
#define HDA_PARAM_SUPP_STREAM_FORMATS_PCM_MASK		0x00000001
#define HDA_PARAM_SUPP_STREAM_FORMATS_PCM_SHIFT		0

#define HDA_PARAM_SUPP_STREAM_FORMATS_AC3(param)			\
    (((param) & HDA_PARAM_SUPP_STREAM_FORMATS_AC3_MASK) >>		\
    HDA_PARAM_SUPP_STREAM_FORMATS_AC3_SHIFT)
#define HDA_PARAM_SUPP_STREAM_FORMATS_FLOAT32(param)			\
    (((param) & HDA_PARAM_SUPP_STREAM_FORMATS_FLOAT32_MASK) >>		\
    HDA_PARAM_SUPP_STREAM_FORMATS_FLOAT32_SHIFT)
#define HDA_PARAM_SUPP_STREAM_FORMATS_PCM(param)			\
    (((param) & HDA_PARAM_SUPP_STREAM_FORMATS_PCM_MASK) >>		\
    HDA_PARAM_SUPP_STREAM_FORMATS_PCM_SHIFT)

/* Pin Capabilities */
#define HDA_PARAM_PIN_CAP				0x0c

#define HDA_PARAM_PIN_CAP_HBR_MASK			0x08000000
#define HDA_PARAM_PIN_CAP_HBR_SHIFT			27
#define HDA_PARAM_PIN_CAP_DP_MASK			0x01000000
#define HDA_PARAM_PIN_CAP_DP_SHIFT			24
#define HDA_PARAM_PIN_CAP_EAPD_CAP_MASK			0x00010000
#define HDA_PARAM_PIN_CAP_EAPD_CAP_SHIFT		16
#define HDA_PARAM_PIN_CAP_VREF_CTRL_MASK		0x0000ff00
#define HDA_PARAM_PIN_CAP_VREF_CTRL_SHIFT		8
#define HDA_PARAM_PIN_CAP_VREF_CTRL_100_MASK		0x00002000
#define HDA_PARAM_PIN_CAP_VREF_CTRL_100_SHIFT		13
#define HDA_PARAM_PIN_CAP_VREF_CTRL_80_MASK		0x00001000
#define HDA_PARAM_PIN_CAP_VREF_CTRL_80_SHIFT		12
#define HDA_PARAM_PIN_CAP_VREF_CTRL_GROUND_MASK		0x00000400
#define HDA_PARAM_PIN_CAP_VREF_CTRL_GROUND_SHIFT	10
#define HDA_PARAM_PIN_CAP_VREF_CTRL_50_MASK		0x00000200
#define HDA_PARAM_PIN_CAP_VREF_CTRL_50_SHIFT		9
#define HDA_PARAM_PIN_CAP_VREF_CTRL_HIZ_MASK		0x00000100
#define HDA_PARAM_PIN_CAP_VREF_CTRL_HIZ_SHIFT		8
#define HDA_PARAM_PIN_CAP_HDMI_MASK			0x00000080
#define HDA_PARAM_PIN_CAP_HDMI_SHIFT			7
#define HDA_PARAM_PIN_CAP_BALANCED_IO_PINS_MASK		0x00000040
#define HDA_PARAM_PIN_CAP_BALANCED_IO_PINS_SHIFT	6
#define HDA_PARAM_PIN_CAP_INPUT_CAP_MASK		0x00000020
#define HDA_PARAM_PIN_CAP_INPUT_CAP_SHIFT		5
#define HDA_PARAM_PIN_CAP_OUTPUT_CAP_MASK		0x00000010
#define HDA_PARAM_PIN_CAP_OUTPUT_CAP_SHIFT		4
#define HDA_PARAM_PIN_CAP_HEADPHONE_CAP_MASK		0x00000008
#define HDA_PARAM_PIN_CAP_HEADPHONE_CAP_SHIFT		3
#define HDA_PARAM_PIN_CAP_PRESENCE_DETECT_CAP_MASK	0x00000004
#define HDA_PARAM_PIN_CAP_PRESENCE_DETECT_CAP_SHIFT	2
#define HDA_PARAM_PIN_CAP_TRIGGER_REQD_MASK		0x00000002
#define HDA_PARAM_PIN_CAP_TRIGGER_REQD_SHIFT		1
#define HDA_PARAM_PIN_CAP_IMP_SENSE_CAP_MASK		0x00000001
#define HDA_PARAM_PIN_CAP_IMP_SENSE_CAP_SHIFT		0

#define HDA_PARAM_PIN_CAP_HBR(param)					\
    (((param) & HDA_PARAM_PIN_CAP_HBR_MASK) >>				\
    HDA_PARAM_PIN_CAP_HBR_SHIFT)
#define HDA_PARAM_PIN_CAP_DP(param)					\
    (((param) & HDA_PARAM_PIN_CAP_DP_MASK) >>				\
    HDA_PARAM_PIN_CAP_DP_SHIFT)
#define HDA_PARAM_PIN_CAP_EAPD_CAP(param)				\
    (((param) & HDA_PARAM_PIN_CAP_EAPD_CAP_MASK) >>			\
    HDA_PARAM_PIN_CAP_EAPD_CAP_SHIFT)
#define HDA_PARAM_PIN_CAP_VREF_CTRL(param)				\
    (((param) & HDA_PARAM_PIN_CAP_VREF_CTRL_MASK) >>			\
    HDA_PARAM_PIN_CAP_VREF_CTRL_SHIFT)
#define HDA_PARAM_PIN_CAP_VREF_CTRL_100(param)				\
    (((param) & HDA_PARAM_PIN_CAP_VREF_CTRL_100_MASK) >>		\
    HDA_PARAM_PIN_CAP_VREF_CTRL_100_SHIFT)
#define HDA_PARAM_PIN_CAP_VREF_CTRL_80(param)				\
    (((param) & HDA_PARAM_PIN_CAP_VREF_CTRL_80_MASK) >>			\
    HDA_PARAM_PIN_CAP_VREF_CTRL_80_SHIFT)
#define HDA_PARAM_PIN_CAP_VREF_CTRL_GROUND(param)			\
    (((param) & HDA_PARAM_PIN_CAP_VREF_CTRL_GROUND_MASK) >>		\
    HDA_PARAM_PIN_CAP_VREF_CTRL_GROUND_SHIFT)
#define HDA_PARAM_PIN_CAP_VREF_CTRL_50(param)				\
    (((param) & HDA_PARAM_PIN_CAP_VREF_CTRL_50_MASK) >>			\
    HDA_PARAM_PIN_CAP_VREF_CTRL_50_SHIFT)
#define HDA_PARAM_PIN_CAP_VREF_CTRL_HIZ(param)				\
    (((param) & HDA_PARAM_PIN_CAP_VREF_CTRL_HIZ_MASK) >>		\
    HDA_PARAM_PIN_CAP_VREF_CTRL_HIZ_SHIFT)
#define HDA_PARAM_PIN_CAP_HDMI(param)					\
    (((param) & HDA_PARAM_PIN_CAP_HDMI_MASK) >>				\
    HDA_PARAM_PIN_CAP_HDMI_SHIFT)
#define HDA_PARAM_PIN_CAP_BALANCED_IO_PINS(param)			\
    (((param) & HDA_PARAM_PIN_CAP_BALANCED_IO_PINS_MASK) >>		\
    HDA_PARAM_PIN_CAP_BALANCED_IO_PINS_SHIFT)
#define HDA_PARAM_PIN_CAP_INPUT_CAP(param)				\
    (((param) & HDA_PARAM_PIN_CAP_INPUT_CAP_MASK) >>			\
    HDA_PARAM_PIN_CAP_INPUT_CAP_SHIFT)
#define HDA_PARAM_PIN_CAP_OUTPUT_CAP(param)				\
    (((param) & HDA_PARAM_PIN_CAP_OUTPUT_CAP_MASK) >>			\
    HDA_PARAM_PIN_CAP_OUTPUT_CAP_SHIFT)
#define HDA_PARAM_PIN_CAP_HEADPHONE_CAP(param)				\
    (((param) & HDA_PARAM_PIN_CAP_HEADPHONE_CAP_MASK) >>		\
    HDA_PARAM_PIN_CAP_HEADPHONE_CAP_SHIFT)
#define HDA_PARAM_PIN_CAP_PRESENCE_DETECT_CAP(param)			\
    (((param) & HDA_PARAM_PIN_CAP_PRESENCE_DETECT_CAP_MASK) >>		\
    HDA_PARAM_PIN_CAP_PRESENCE_DETECT_CAP_SHIFT)
#define HDA_PARAM_PIN_CAP_TRIGGER_REQD(param)				\
    (((param) & HDA_PARAM_PIN_CAP_TRIGGER_REQD_MASK) >>			\
    HDA_PARAM_PIN_CAP_TRIGGER_REQD_SHIFT)
#define HDA_PARAM_PIN_CAP_IMP_SENSE_CAP(param)				\
    (((param) & HDA_PARAM_PIN_CAP_IMP_SENSE_CAP_MASK) >>		\
    HDA_PARAM_PIN_CAP_IMP_SENSE_CAP_SHIFT)

/* Input Amplifier Capabilities */
#define HDA_PARAM_INPUT_AMP_CAP				0x0d

#define HDA_PARAM_INPUT_AMP_CAP_MUTE_CAP_MASK		0x80000000
#define HDA_PARAM_INPUT_AMP_CAP_MUTE_CAP_SHIFT		31
#define HDA_PARAM_INPUT_AMP_CAP_STEPSIZE_MASK		0x007f0000
#define HDA_PARAM_INPUT_AMP_CAP_STEPSIZE_SHIFT		16
#define HDA_PARAM_INPUT_AMP_CAP_NUMSTEPS_MASK		0x00007f00
#define HDA_PARAM_INPUT_AMP_CAP_NUMSTEPS_SHIFT		8
#define HDA_PARAM_INPUT_AMP_CAP_OFFSET_MASK		0x0000007f
#define HDA_PARAM_INPUT_AMP_CAP_OFFSET_SHIFT		0

#define HDA_PARAM_INPUT_AMP_CAP_MUTE_CAP(param)				\
    (((param) & HDA_PARAM_INPUT_AMP_CAP_MUTE_CAP_MASK) >>		\
    HDA_PARAM_INPUT_AMP_CAP_MUTE_CAP_SHIFT)
#define HDA_PARAM_INPUT_AMP_CAP_STEPSIZE(param)				\
    (((param) & HDA_PARAM_INPUT_AMP_CAP_STEPSIZE_MASK) >>		\
    HDA_PARAM_INPUT_AMP_CAP_STEPSIZE_SHIFT)
#define HDA_PARAM_INPUT_AMP_CAP_NUMSTEPS(param)				\
    (((param) & HDA_PARAM_INPUT_AMP_CAP_NUMSTEPS_MASK) >>		\
    HDA_PARAM_INPUT_AMP_CAP_NUMSTEPS_SHIFT)
#define HDA_PARAM_INPUT_AMP_CAP_OFFSET(param)				\
    (((param) & HDA_PARAM_INPUT_AMP_CAP_OFFSET_MASK) >>			\
    HDA_PARAM_INPUT_AMP_CAP_OFFSET_SHIFT)

/* Output Amplifier Capabilities */
#define HDA_PARAM_OUTPUT_AMP_CAP			0x12

#define HDA_PARAM_OUTPUT_AMP_CAP_MUTE_CAP_MASK		0x80000000
#define HDA_PARAM_OUTPUT_AMP_CAP_MUTE_CAP_SHIFT		31
#define HDA_PARAM_OUTPUT_AMP_CAP_STEPSIZE_MASK		0x007f0000
#define HDA_PARAM_OUTPUT_AMP_CAP_STEPSIZE_SHIFT		16
#define HDA_PARAM_OUTPUT_AMP_CAP_NUMSTEPS_MASK		0x00007f00
#define HDA_PARAM_OUTPUT_AMP_CAP_NUMSTEPS_SHIFT		8
#define HDA_PARAM_OUTPUT_AMP_CAP_OFFSET_MASK		0x0000007f
#define HDA_PARAM_OUTPUT_AMP_CAP_OFFSET_SHIFT		0

#define HDA_PARAM_OUTPUT_AMP_CAP_MUTE_CAP(param)			\
    (((param) & HDA_PARAM_OUTPUT_AMP_CAP_MUTE_CAP_MASK) >>		\
    HDA_PARAM_OUTPUT_AMP_CAP_MUTE_CAP_SHIFT)
#define HDA_PARAM_OUTPUT_AMP_CAP_STEPSIZE(param)			\
    (((param) & HDA_PARAM_OUTPUT_AMP_CAP_STEPSIZE_MASK) >>		\
    HDA_PARAM_OUTPUT_AMP_CAP_STEPSIZE_SHIFT)
#define HDA_PARAM_OUTPUT_AMP_CAP_NUMSTEPS(param)			\
    (((param) & HDA_PARAM_OUTPUT_AMP_CAP_NUMSTEPS_MASK) >>		\
    HDA_PARAM_OUTPUT_AMP_CAP_NUMSTEPS_SHIFT)
#define HDA_PARAM_OUTPUT_AMP_CAP_OFFSET(param)				\
    (((param) & HDA_PARAM_OUTPUT_AMP_CAP_OFFSET_MASK) >>		\
    HDA_PARAM_OUTPUT_AMP_CAP_OFFSET_SHIFT)

/* Connection List Length */
#define HDA_PARAM_CONN_LIST_LENGTH			0x0e

#define HDA_PARAM_CONN_LIST_LENGTH_LONG_FORM_MASK	0x00000080
#define HDA_PARAM_CONN_LIST_LENGTH_LONG_FORM_SHIFT	7
#define HDA_PARAM_CONN_LIST_LENGTH_LIST_LENGTH_MASK	0x0000007f
#define HDA_PARAM_CONN_LIST_LENGTH_LIST_LENGTH_SHIFT	0

#define HDA_PARAM_CONN_LIST_LENGTH_LONG_FORM(param)			\
    (((param) & HDA_PARAM_CONN_LIST_LENGTH_LONG_FORM_MASK) >>		\
    HDA_PARAM_CONN_LIST_LENGTH_LONG_FORM_SHIFT)
#define HDA_PARAM_CONN_LIST_LENGTH_LIST_LENGTH(param)			\
    (((param) & HDA_PARAM_CONN_LIST_LENGTH_LIST_LENGTH_MASK) >>		\
    HDA_PARAM_CONN_LIST_LENGTH_LIST_LENGTH_SHIFT)

/* Supported Power States */
#define HDA_PARAM_SUPP_POWER_STATES			0x0f

#define HDA_PARAM_SUPP_POWER_STATES_D3_MASK		0x00000008
#define HDA_PARAM_SUPP_POWER_STATES_D3_SHIFT		3
#define HDA_PARAM_SUPP_POWER_STATES_D2_MASK		0x00000004
#define HDA_PARAM_SUPP_POWER_STATES_D2_SHIFT		2
#define HDA_PARAM_SUPP_POWER_STATES_D1_MASK		0x00000002
#define HDA_PARAM_SUPP_POWER_STATES_D1_SHIFT		1
#define HDA_PARAM_SUPP_POWER_STATES_D0_MASK		0x00000001
#define HDA_PARAM_SUPP_POWER_STATES_D0_SHIFT		0

#define HDA_PARAM_SUPP_POWER_STATES_D3(param)				\
    (((param) & HDA_PARAM_SUPP_POWER_STATES_D3_MASK) >>			\
    HDA_PARAM_SUPP_POWER_STATES_D3_SHIFT)
#define HDA_PARAM_SUPP_POWER_STATES_D2(param)				\
    (((param) & HDA_PARAM_SUPP_POWER_STATES_D2_MASK) >>			\
    HDA_PARAM_SUPP_POWER_STATES_D2_SHIFT)
#define HDA_PARAM_SUPP_POWER_STATES_D1(param)				\
    (((param) & HDA_PARAM_SUPP_POWER_STATES_D1_MASK) >>			\
    HDA_PARAM_SUPP_POWER_STATES_D1_SHIFT)
#define HDA_PARAM_SUPP_POWER_STATES_D0(param)				\
    (((param) & HDA_PARAM_SUPP_POWER_STATES_D0_MASK) >>			\
    HDA_PARAM_SUPP_POWER_STATES_D0_SHIFT)

/* Processing Capabilities */
#define HDA_PARAM_PROCESSING_CAP			0x10

#define HDA_PARAM_PROCESSING_CAP_NUMCOEFF_MASK		0x0000ff00
#define HDA_PARAM_PROCESSING_CAP_NUMCOEFF_SHIFT		8
#define HDA_PARAM_PROCESSING_CAP_BENIGN_MASK		0x00000001
#define HDA_PARAM_PROCESSING_CAP_BENIGN_SHIFT		0

#define HDA_PARAM_PROCESSING_CAP_NUMCOEFF(param)			\
    (((param) & HDA_PARAM_PROCESSING_CAP_NUMCOEFF_MASK) >>		\
    HDA_PARAM_PROCESSING_CAP_NUMCOEFF_SHIFT)
#define HDA_PARAM_PROCESSING_CAP_BENIGN(param)				\
    (((param) & HDA_PARAM_PROCESSING_CAP_BENIGN_MASK) >>		\
    HDA_PARAM_PROCESSING_CAP_BENIGN_SHIFT)

/* GPIO Count */
#define HDA_PARAM_GPIO_COUNT				0x11

#define HDA_PARAM_GPIO_COUNT_GPI_WAKE_MASK		0x80000000
#define HDA_PARAM_GPIO_COUNT_GPI_WAKE_SHIFT		31
#define HDA_PARAM_GPIO_COUNT_GPI_UNSOL_MASK		0x40000000
#define HDA_PARAM_GPIO_COUNT_GPI_UNSOL_SHIFT		30
#define HDA_PARAM_GPIO_COUNT_NUM_GPI_MASK		0x00ff0000
#define HDA_PARAM_GPIO_COUNT_NUM_GPI_SHIFT		16
#define HDA_PARAM_GPIO_COUNT_NUM_GPO_MASK		0x0000ff00
#define HDA_PARAM_GPIO_COUNT_NUM_GPO_SHIFT		8
#define HDA_PARAM_GPIO_COUNT_NUM_GPIO_MASK		0x000000ff
#define HDA_PARAM_GPIO_COUNT_NUM_GPIO_SHIFT		0

#define HDA_PARAM_GPIO_COUNT_GPI_WAKE(param)				\
    (((param) & HDA_PARAM_GPIO_COUNT_GPI_WAKE_MASK) >>			\
    HDA_PARAM_GPIO_COUNT_GPI_WAKE_SHIFT)
#define HDA_PARAM_GPIO_COUNT_GPI_UNSOL(param)				\
    (((param) & HDA_PARAM_GPIO_COUNT_GPI_UNSOL_MASK) >>			\
    HDA_PARAM_GPIO_COUNT_GPI_UNSOL_SHIFT)
#define HDA_PARAM_GPIO_COUNT_NUM_GPI(param)				\
    (((param) & HDA_PARAM_GPIO_COUNT_NUM_GPI_MASK) >>			\
    HDA_PARAM_GPIO_COUNT_NUM_GPI_SHIFT)
#define HDA_PARAM_GPIO_COUNT_NUM_GPO(param)				\
    (((param) & HDA_PARAM_GPIO_COUNT_NUM_GPO_MASK) >>			\
    HDA_PARAM_GPIO_COUNT_NUM_GPO_SHIFT)
#define HDA_PARAM_GPIO_COUNT_NUM_GPIO(param)				\
    (((param) & HDA_PARAM_GPIO_COUNT_NUM_GPIO_MASK) >>			\
    HDA_PARAM_GPIO_COUNT_NUM_GPIO_SHIFT)

/* Volume Knob Capabilities */
#define HDA_PARAM_VOLUME_KNOB_CAP			0x13

#define HDA_PARAM_VOLUME_KNOB_CAP_DELTA_MASK		0x00000080
#define HDA_PARAM_VOLUME_KNOB_CAP_DELTA_SHIFT		7
#define HDA_PARAM_VOLUME_KNOB_CAP_NUM_STEPS_MASK	0x0000007f
#define HDA_PARAM_VOLUME_KNOB_CAP_NUM_STEPS_SHIFT	0

#define HDA_PARAM_VOLUME_KNOB_CAP_DELTA(param)				\
    (((param) & HDA_PARAM_VOLUME_KNOB_CAP_DELTA_MASK) >>		\
    HDA_PARAM_VOLUME_KNOB_CAP_DELTA_SHIFT)
#define HDA_PARAM_VOLUME_KNOB_CAP_NUM_STEPS(param)			\
    (((param) & HDA_PARAM_VOLUME_KNOB_CAP_NUM_STEPS_MASK) >>		\
    HDA_PARAM_VOLUME_KNOB_CAP_NUM_STEPS_SHIFT)


#define HDA_CONFIG_DEFAULTCONF_SEQUENCE_MASK		0x0000000f
#define HDA_CONFIG_DEFAULTCONF_SEQUENCE_SHIFT		0
#define HDA_CONFIG_DEFAULTCONF_ASSOCIATION_MASK		0x000000f0
#define HDA_CONFIG_DEFAULTCONF_ASSOCIATION_SHIFT	4
#define HDA_CONFIG_DEFAULTCONF_MISC_MASK		0x00000f00
#define HDA_CONFIG_DEFAULTCONF_MISC_SHIFT		8
#define HDA_CONFIG_DEFAULTCONF_COLOR_MASK		0x0000f000
#define HDA_CONFIG_DEFAULTCONF_COLOR_SHIFT		12
#define HDA_CONFIG_DEFAULTCONF_CONNECTION_TYPE_MASK	0x000f0000
#define HDA_CONFIG_DEFAULTCONF_CONNECTION_TYPE_SHIFT	16
#define HDA_CONFIG_DEFAULTCONF_DEVICE_MASK		0x00f00000
#define HDA_CONFIG_DEFAULTCONF_DEVICE_SHIFT		20
#define HDA_CONFIG_DEFAULTCONF_LOCATION_MASK		0x3f000000
#define HDA_CONFIG_DEFAULTCONF_LOCATION_SHIFT		24
#define HDA_CONFIG_DEFAULTCONF_CONNECTIVITY_MASK	0xc0000000
#define HDA_CONFIG_DEFAULTCONF_CONNECTIVITY_SHIFT	30

#define HDA_CONFIG_DEFAULTCONF_SEQUENCE(conf)				\
    (((conf) & HDA_CONFIG_DEFAULTCONF_SEQUENCE_MASK) >>			\
    HDA_CONFIG_DEFAULTCONF_SEQUENCE_SHIFT)
#define HDA_CONFIG_DEFAULTCONF_ASSOCIATION(conf)			\
    (((conf) & HDA_CONFIG_DEFAULTCONF_ASSOCIATION_MASK) >>		\
    HDA_CONFIG_DEFAULTCONF_ASSOCIATION_SHIFT)
#define HDA_CONFIG_DEFAULTCONF_MISC(conf)				\
    (((conf) & HDA_CONFIG_DEFAULTCONF_MISC_MASK) >>			\
    HDA_CONFIG_DEFAULTCONF_MISC_SHIFT)
#define HDA_CONFIG_DEFAULTCONF_COLOR(conf)				\
    (((conf) & HDA_CONFIG_DEFAULTCONF_COLOR_MASK) >>			\
    HDA_CONFIG_DEFAULTCONF_COLOR_SHIFT)
#define HDA_CONFIG_DEFAULTCONF_CONNECTION_TYPE(conf)			\
    (((conf) & HDA_CONFIG_DEFAULTCONF_CONNECTION_TYPE_MASK) >>		\
    HDA_CONFIG_DEFAULTCONF_CONNECTION_TYPE_SHIFT)
#define HDA_CONFIG_DEFAULTCONF_DEVICE(conf)				\
    (((conf) & HDA_CONFIG_DEFAULTCONF_DEVICE_MASK) >>			\
    HDA_CONFIG_DEFAULTCONF_DEVICE_SHIFT)
#define HDA_CONFIG_DEFAULTCONF_LOCATION(conf)				\
    (((conf) & HDA_CONFIG_DEFAULTCONF_LOCATION_MASK) >>			\
    HDA_CONFIG_DEFAULTCONF_LOCATION_SHIFT)
#define HDA_CONFIG_DEFAULTCONF_CONNECTIVITY(conf)			\
    (((conf) & HDA_CONFIG_DEFAULTCONF_CONNECTIVITY_MASK) >>		\
    HDA_CONFIG_DEFAULTCONF_CONNECTIVITY_SHIFT)

#define HDA_CONFIG_DEFAULTCONF_CONNECTIVITY_JACK		(0<<30)
#define HDA_CONFIG_DEFAULTCONF_CONNECTIVITY_NONE		(1<<30)
#define HDA_CONFIG_DEFAULTCONF_CONNECTIVITY_FIXED		(2<<30)
#define HDA_CONFIG_DEFAULTCONF_CONNECTIVITY_BOTH		(3<<30)

#define HDA_CONFIG_DEFAULTCONF_DEVICE_LINE_OUT			(0<<20)
#define HDA_CONFIG_DEFAULTCONF_DEVICE_SPEAKER			(1<<20)
#define HDA_CONFIG_DEFAULTCONF_DEVICE_HP_OUT			(2<<20)
#define HDA_CONFIG_DEFAULTCONF_DEVICE_CD			(3<<20)
#define HDA_CONFIG_DEFAULTCONF_DEVICE_SPDIF_OUT			(4<<20)
#define HDA_CONFIG_DEFAULTCONF_DEVICE_DIGITAL_OTHER_OUT		(5<<20)
#define HDA_CONFIG_DEFAULTCONF_DEVICE_MODEM_LINE		(6<<20)
#define HDA_CONFIG_DEFAULTCONF_DEVICE_MODEM_HANDSET		(7<<20)
#define HDA_CONFIG_DEFAULTCONF_DEVICE_LINE_IN			(8<<20)
#define HDA_CONFIG_DEFAULTCONF_DEVICE_AUX			(9<<20)
#define HDA_CONFIG_DEFAULTCONF_DEVICE_MIC_IN			(10<<20)
#define HDA_CONFIG_DEFAULTCONF_DEVICE_TELEPHONY			(11<<20)
#define HDA_CONFIG_DEFAULTCONF_DEVICE_SPDIF_IN			(12<<20)
#define HDA_CONFIG_DEFAULTCONF_DEVICE_DIGITAL_OTHER_IN		(13<<20)
#define HDA_CONFIG_DEFAULTCONF_DEVICE_OTHER			(15<<20)

#endif /* _HDA_REG_H_ */