xref: /openbmc/linux/sound/soc/codecs/rt1011.h (revision a382285b)
1d6e65bb7SShuming Fan /* SPDX-License-Identifier: GPL-2.0 */
2d6e65bb7SShuming Fan /*
3d6e65bb7SShuming Fan  * rt1011.h -- RT1011 ALSA SoC amplifier component driver header
4d6e65bb7SShuming Fan  *
5d6e65bb7SShuming Fan  * Copyright(c) 2019 Realtek Semiconductor Corp.
6d6e65bb7SShuming Fan  */
7d6e65bb7SShuming Fan 
8d6e65bb7SShuming Fan #ifndef _RT1011_H_
9d6e65bb7SShuming Fan #define _RT1011_H_
10d6e65bb7SShuming Fan 
11d6e65bb7SShuming Fan #define RT1011_DEVICE_ID_NUM 0x1011
12d6e65bb7SShuming Fan 
13d6e65bb7SShuming Fan #define RT1011_RESET				0x0000
14d6e65bb7SShuming Fan #define RT1011_CLK_1				0x0002
15d6e65bb7SShuming Fan #define RT1011_CLK_2				0x0004
16d6e65bb7SShuming Fan #define RT1011_CLK_3				0x0006
17d6e65bb7SShuming Fan #define RT1011_CLK_4				0x0008
18d6e65bb7SShuming Fan #define RT1011_PLL_1				0x000a
19d6e65bb7SShuming Fan #define RT1011_PLL_2				0x000c
20d6e65bb7SShuming Fan #define RT1011_SRC_1				0x000e
21d6e65bb7SShuming Fan #define RT1011_SRC_2				0x0010
22d6e65bb7SShuming Fan #define RT1011_SRC_3				0x0012
23d6e65bb7SShuming Fan #define RT1011_CLK_DET				0x0020
24d6e65bb7SShuming Fan #define RT1011_SIL_DET				0x0022
25d6e65bb7SShuming Fan #define RT1011_PRIV_INDEX			0x006a
26d6e65bb7SShuming Fan #define RT1011_PRIV_DATA			0x006c
27d6e65bb7SShuming Fan #define RT1011_CUSTOMER_ID			0x0076
28d6e65bb7SShuming Fan #define RT1011_FM_VER				0x0078
29d6e65bb7SShuming Fan #define RT1011_VERSION_ID			0x007a
30d6e65bb7SShuming Fan #define RT1011_VENDOR_ID			0x007c
31d6e65bb7SShuming Fan #define RT1011_DEVICE_ID			0x007d
32d6e65bb7SShuming Fan #define RT1011_DUM_RW_0				0x00f0
33d6e65bb7SShuming Fan #define RT1011_DUM_YUN				0x00f2
34d6e65bb7SShuming Fan #define RT1011_DUM_RW_1				0x00f3
35d6e65bb7SShuming Fan #define RT1011_DUM_RO				0x00f4
36d6e65bb7SShuming Fan #define RT1011_MAN_I2C_DEV			0x0100
37d6e65bb7SShuming Fan #define RT1011_DAC_SET_1			0x0102
38d6e65bb7SShuming Fan #define RT1011_DAC_SET_2			0x0104
39d6e65bb7SShuming Fan #define RT1011_DAC_SET_3			0x0106
40d6e65bb7SShuming Fan #define RT1011_ADC_SET				0x0107
41d6e65bb7SShuming Fan #define RT1011_ADC_SET_1			0x0108
42d6e65bb7SShuming Fan #define RT1011_ADC_SET_2			0x010a
43d6e65bb7SShuming Fan #define RT1011_ADC_SET_3			0x010c
44d6e65bb7SShuming Fan #define RT1011_ADC_SET_4			0x010e
45d6e65bb7SShuming Fan #define RT1011_ADC_SET_5			0x0110
46d6e65bb7SShuming Fan #define RT1011_TDM_TOTAL_SET		0x0111
47d6e65bb7SShuming Fan #define RT1011_TDM1_SET_TCON		0x0112
48d6e65bb7SShuming Fan #define RT1011_TDM1_SET_1			0x0114
49d6e65bb7SShuming Fan #define RT1011_TDM1_SET_2			0x0116
50d6e65bb7SShuming Fan #define RT1011_TDM1_SET_3			0x0118
51d6e65bb7SShuming Fan #define RT1011_TDM1_SET_4			0x011a
52d6e65bb7SShuming Fan #define RT1011_TDM1_SET_5			0x011c
53d6e65bb7SShuming Fan #define RT1011_TDM2_SET_1			0x011e
54d6e65bb7SShuming Fan #define RT1011_TDM2_SET_2			0x0120
55d6e65bb7SShuming Fan #define RT1011_TDM2_SET_3			0x0122
56d6e65bb7SShuming Fan #define RT1011_TDM2_SET_4			0x0124
57d6e65bb7SShuming Fan #define RT1011_TDM2_SET_5			0x0126
58d6e65bb7SShuming Fan #define RT1011_PWM_CAL				0x0200
59d6e65bb7SShuming Fan #define RT1011_MIXER_1				0x0300
60d6e65bb7SShuming Fan #define RT1011_MIXER_2				0x0302
61d6e65bb7SShuming Fan #define RT1011_ADRC_LIMIT			0x0310
62d6e65bb7SShuming Fan #define RT1011_A_PRO				0x0311
63d6e65bb7SShuming Fan #define RT1011_A_TIMING_1			0x0313
64d6e65bb7SShuming Fan #define RT1011_A_TIMING_2			0x0314
65d6e65bb7SShuming Fan #define RT1011_A_TEMP_SEN			0x0316
66d6e65bb7SShuming Fan #define RT1011_SPK_VOL_DET_1		0x0319
67d6e65bb7SShuming Fan #define RT1011_SPK_VOL_DET_2		0x031a
68d6e65bb7SShuming Fan #define RT1011_SPK_VOL_TEST_OUT		0x031b
69d6e65bb7SShuming Fan #define RT1011_VBAT_VOL_DET_1		0x031c
70d6e65bb7SShuming Fan #define RT1011_VBAT_VOL_DET_2		0x031d
71d6e65bb7SShuming Fan #define RT1011_VBAT_TEST_OUT_1		0x031e
72d6e65bb7SShuming Fan #define RT1011_VBAT_TEST_OUT_2		0x031f
73d6e65bb7SShuming Fan #define RT1011_VBAT_PROTECTION			0x0320
74d6e65bb7SShuming Fan #define RT1011_VBAT_DET				0x0321
75d6e65bb7SShuming Fan #define RT1011_POWER_1				0x0322
76d6e65bb7SShuming Fan #define RT1011_POWER_2				0x0324
77d6e65bb7SShuming Fan #define RT1011_POWER_3				0x0326
78d6e65bb7SShuming Fan #define RT1011_POWER_4				0x0328
79d6e65bb7SShuming Fan #define RT1011_POWER_5				0x0329
80d6e65bb7SShuming Fan #define RT1011_POWER_6				0x032a
81d6e65bb7SShuming Fan #define RT1011_POWER_7				0x032b
82d6e65bb7SShuming Fan #define RT1011_POWER_8				0x032c
83d6e65bb7SShuming Fan #define RT1011_POWER_9				0x032d
84d6e65bb7SShuming Fan #define RT1011_CLASS_D_POS			0x032e
85d6e65bb7SShuming Fan #define RT1011_BOOST_CON_1			0x0330
86d6e65bb7SShuming Fan #define RT1011_BOOST_CON_2			0x0332
87d6e65bb7SShuming Fan #define RT1011_ANALOG_CTRL			0x0334
88d6e65bb7SShuming Fan #define RT1011_POWER_SEQ			0x0340
89d6e65bb7SShuming Fan #define RT1011_SHORT_CIRCUIT_DET_1	0x0508
90d6e65bb7SShuming Fan #define RT1011_SHORT_CIRCUIT_DET_2	0x050a
91d6e65bb7SShuming Fan #define RT1011_SPK_TEMP_PROTECT_0		0x050c
92d6e65bb7SShuming Fan #define RT1011_SPK_TEMP_PROTECT_1		0x050d
93d6e65bb7SShuming Fan #define RT1011_SPK_TEMP_PROTECT_2		0x050e
94d6e65bb7SShuming Fan #define RT1011_SPK_TEMP_PROTECT_3		0x050f
95d6e65bb7SShuming Fan #define RT1011_SPK_TEMP_PROTECT_4		0x0510
96d6e65bb7SShuming Fan #define RT1011_SPK_TEMP_PROTECT_5		0x0511
97d6e65bb7SShuming Fan #define RT1011_SPK_TEMP_PROTECT_6		0x0512
98d6e65bb7SShuming Fan #define RT1011_SPK_TEMP_PROTECT_7		0x0516
99d6e65bb7SShuming Fan #define RT1011_SPK_TEMP_PROTECT_8		0x0517
100d6e65bb7SShuming Fan #define RT1011_SPK_TEMP_PROTECT_9		0x0518
101d6e65bb7SShuming Fan #define RT1011_SPK_PRO_DC_DET_1		0x0519
102d6e65bb7SShuming Fan #define RT1011_SPK_PRO_DC_DET_2		0x051a
103d6e65bb7SShuming Fan #define RT1011_SPK_PRO_DC_DET_3		0x051b
104d6e65bb7SShuming Fan #define RT1011_SPK_PRO_DC_DET_4		0x051c
105d6e65bb7SShuming Fan #define RT1011_SPK_PRO_DC_DET_5		0x051d
106d6e65bb7SShuming Fan #define RT1011_SPK_PRO_DC_DET_6		0x051e
107d6e65bb7SShuming Fan #define RT1011_SPK_PRO_DC_DET_7		0x051f
108d6e65bb7SShuming Fan #define RT1011_SPK_PRO_DC_DET_8		0x0520
109d6e65bb7SShuming Fan #define RT1011_SPL_1				0x0521
110d6e65bb7SShuming Fan #define RT1011_SPL_2				0x0522
111d6e65bb7SShuming Fan #define RT1011_SPL_3				0x0524
112d6e65bb7SShuming Fan #define RT1011_SPL_4				0x0526
113d6e65bb7SShuming Fan #define RT1011_THER_FOLD_BACK_1		0x0528
114d6e65bb7SShuming Fan #define RT1011_THER_FOLD_BACK_2		0x052a
115d6e65bb7SShuming Fan #define RT1011_EXCUR_PROTECT_1			0x0530
116d6e65bb7SShuming Fan #define RT1011_EXCUR_PROTECT_2			0x0532
117d6e65bb7SShuming Fan #define RT1011_EXCUR_PROTECT_3			0x0534
118d6e65bb7SShuming Fan #define RT1011_EXCUR_PROTECT_4			0x0535
119d6e65bb7SShuming Fan #define RT1011_BAT_GAIN_1			0x0536
120d6e65bb7SShuming Fan #define RT1011_BAT_GAIN_2			0x0538
121d6e65bb7SShuming Fan #define RT1011_BAT_GAIN_3			0x053a
122d6e65bb7SShuming Fan #define RT1011_BAT_GAIN_4			0x053c
123d6e65bb7SShuming Fan #define RT1011_BAT_GAIN_5			0x053d
124d6e65bb7SShuming Fan #define RT1011_BAT_GAIN_6			0x053e
125d6e65bb7SShuming Fan #define RT1011_BAT_GAIN_7			0x053f
126d6e65bb7SShuming Fan #define RT1011_BAT_GAIN_8			0x0540
127d6e65bb7SShuming Fan #define RT1011_BAT_GAIN_9			0x0541
128d6e65bb7SShuming Fan #define RT1011_BAT_GAIN_10			0x0542
129d6e65bb7SShuming Fan #define RT1011_BAT_GAIN_11			0x0543
130d6e65bb7SShuming Fan #define RT1011_BAT_RT_THMAX_1		0x0544
131d6e65bb7SShuming Fan #define RT1011_BAT_RT_THMAX_2		0x0545
132d6e65bb7SShuming Fan #define RT1011_BAT_RT_THMAX_3		0x0546
133d6e65bb7SShuming Fan #define RT1011_BAT_RT_THMAX_4		0x0547
134d6e65bb7SShuming Fan #define RT1011_BAT_RT_THMAX_5		0x0548
135d6e65bb7SShuming Fan #define RT1011_BAT_RT_THMAX_6		0x0549
136d6e65bb7SShuming Fan #define RT1011_BAT_RT_THMAX_7		0x054a
137d6e65bb7SShuming Fan #define RT1011_BAT_RT_THMAX_8		0x054b
138d6e65bb7SShuming Fan #define RT1011_BAT_RT_THMAX_9		0x054c
139d6e65bb7SShuming Fan #define RT1011_BAT_RT_THMAX_10		0x054d
140d6e65bb7SShuming Fan #define RT1011_BAT_RT_THMAX_11		0x054e
141d6e65bb7SShuming Fan #define RT1011_BAT_RT_THMAX_12		0x054f
142d6e65bb7SShuming Fan #define RT1011_SPREAD_SPECTURM		0x0568
143d6e65bb7SShuming Fan #define RT1011_PRO_GAIN_MODE		0x056a
144d6e65bb7SShuming Fan #define RT1011_RT_DRC_CROSS			0x0600
145d6e65bb7SShuming Fan #define RT1011_RT_DRC_HB_1			0x0611
146d6e65bb7SShuming Fan #define RT1011_RT_DRC_HB_2			0x0612
147d6e65bb7SShuming Fan #define RT1011_RT_DRC_HB_3			0x0613
148d6e65bb7SShuming Fan #define RT1011_RT_DRC_HB_4			0x0614
149d6e65bb7SShuming Fan #define RT1011_RT_DRC_HB_5			0x0615
150d6e65bb7SShuming Fan #define RT1011_RT_DRC_HB_6			0x0616
151d6e65bb7SShuming Fan #define RT1011_RT_DRC_HB_7			0x0617
152d6e65bb7SShuming Fan #define RT1011_RT_DRC_HB_8			0x0618
153d6e65bb7SShuming Fan #define RT1011_RT_DRC_BB_1			0x0621
154d6e65bb7SShuming Fan #define RT1011_RT_DRC_BB_2			0x0622
155d6e65bb7SShuming Fan #define RT1011_RT_DRC_BB_3			0x0623
156d6e65bb7SShuming Fan #define RT1011_RT_DRC_BB_4			0x0624
157d6e65bb7SShuming Fan #define RT1011_RT_DRC_BB_5			0x0625
158d6e65bb7SShuming Fan #define RT1011_RT_DRC_BB_6			0x0626
159d6e65bb7SShuming Fan #define RT1011_RT_DRC_BB_7			0x0627
160d6e65bb7SShuming Fan #define RT1011_RT_DRC_BB_8			0x0628
161d6e65bb7SShuming Fan #define RT1011_RT_DRC_POS_1			0x0631
162d6e65bb7SShuming Fan #define RT1011_RT_DRC_POS_2			0x0632
163d6e65bb7SShuming Fan #define RT1011_RT_DRC_POS_3			0x0633
164d6e65bb7SShuming Fan #define RT1011_RT_DRC_POS_4			0x0634
165d6e65bb7SShuming Fan #define RT1011_RT_DRC_POS_5			0x0635
166d6e65bb7SShuming Fan #define RT1011_RT_DRC_POS_6			0x0636
167d6e65bb7SShuming Fan #define RT1011_RT_DRC_POS_7			0x0637
168d6e65bb7SShuming Fan #define RT1011_RT_DRC_POS_8			0x0638
169d6e65bb7SShuming Fan #define RT1011_CROSS_BQ_SET_1		0x0702
170d6e65bb7SShuming Fan #define RT1011_CROSS_BQ_SET_2		0x0704
171d6e65bb7SShuming Fan #define RT1011_BQ_SET_0				0x0706
172d6e65bb7SShuming Fan #define RT1011_BQ_SET_1				0x0708
173d6e65bb7SShuming Fan #define RT1011_BQ_SET_2				0x070a
174d6e65bb7SShuming Fan #define RT1011_BQ_PRE_GAIN_28_16	0x0710
175d6e65bb7SShuming Fan #define RT1011_BQ_PRE_GAIN_15_0		0x0711
176d6e65bb7SShuming Fan #define RT1011_BQ_POST_GAIN_28_16	0x0712
177d6e65bb7SShuming Fan #define RT1011_BQ_POST_GAIN_15_0	0x0713
178d6e65bb7SShuming Fan 
179d6e65bb7SShuming Fan #define RT1011_BQ_H0_28_16					0x0720
180d6e65bb7SShuming Fan #define RT1011_BQ_A2_15_0						0x0729
181d6e65bb7SShuming Fan #define RT1011_BQ_1_H0_28_16					0x0730
182d6e65bb7SShuming Fan #define RT1011_BQ_1_A2_15_0					0x0739
183d6e65bb7SShuming Fan #define RT1011_BQ_2_H0_28_16					0x0740
184d6e65bb7SShuming Fan #define RT1011_BQ_2_A2_15_0					0x0749
185d6e65bb7SShuming Fan #define RT1011_BQ_3_H0_28_16					0x0750
186d6e65bb7SShuming Fan #define RT1011_BQ_3_A2_15_0					0x0759
187d6e65bb7SShuming Fan #define RT1011_BQ_4_H0_28_16					0x0760
188d6e65bb7SShuming Fan #define RT1011_BQ_4_A2_15_0					0x0769
189d6e65bb7SShuming Fan #define RT1011_BQ_5_H0_28_16					0x0770
190d6e65bb7SShuming Fan #define RT1011_BQ_5_A2_15_0					0x0779
191d6e65bb7SShuming Fan #define RT1011_BQ_6_H0_28_16					0x0780
192d6e65bb7SShuming Fan #define RT1011_BQ_6_A2_15_0					0x0789
193d6e65bb7SShuming Fan #define RT1011_BQ_7_H0_28_16					0x0790
194d6e65bb7SShuming Fan #define RT1011_BQ_7_A2_15_0					0x0799
195d6e65bb7SShuming Fan #define RT1011_BQ_8_H0_28_16					0x07a0
196d6e65bb7SShuming Fan #define RT1011_BQ_8_A2_15_0					0x07a9
197d6e65bb7SShuming Fan #define RT1011_BQ_9_H0_28_16					0x07b0
198d6e65bb7SShuming Fan #define RT1011_BQ_9_A2_15_0					0x07b9
199d6e65bb7SShuming Fan #define RT1011_BQ_10_H0_28_16				0x07c0
200d6e65bb7SShuming Fan #define RT1011_BQ_10_A2_15_0					0x07c9
201d6e65bb7SShuming Fan #define RT1011_TEST_PAD_STATUS				0x1000
202d6e65bb7SShuming Fan #define RT1011_SYSTEM_RESET_1				0x1007
203d6e65bb7SShuming Fan #define RT1011_SYSTEM_RESET_2				0x1008
204d6e65bb7SShuming Fan #define RT1011_SYSTEM_RESET_3				0x1009
205d6e65bb7SShuming Fan #define RT1011_ADCDAT_OUT_SOURCE			0x100D
206d6e65bb7SShuming Fan #define RT1011_PLL_INTERNAL_SET				0x1010
207d6e65bb7SShuming Fan #define RT1011_TEST_OUT_1						0x1020
208d6e65bb7SShuming Fan #define RT1011_TEST_OUT_3						0x1024
209d6e65bb7SShuming Fan #define RT1011_DC_CALIB_CLASSD_1			0x1200
210d6e65bb7SShuming Fan #define RT1011_DC_CALIB_CLASSD_2			0x1202
211d6e65bb7SShuming Fan #define RT1011_DC_CALIB_CLASSD_3			0x1204
212d6e65bb7SShuming Fan #define RT1011_DC_CALIB_CLASSD_5			0x1208
213d6e65bb7SShuming Fan #define RT1011_DC_CALIB_CLASSD_6			0x120a
214d6e65bb7SShuming Fan #define RT1011_DC_CALIB_CLASSD_7			0x120c
215d6e65bb7SShuming Fan #define RT1011_DC_CALIB_CLASSD_8			0x120e
216d6e65bb7SShuming Fan #define RT1011_DC_CALIB_CLASSD_10			0x1212
217d6e65bb7SShuming Fan #define RT1011_CLASSD_INTERNAL_SET_1		0x1300
218d6e65bb7SShuming Fan #define RT1011_CLASSD_INTERNAL_SET_3		0x1304
219d6e65bb7SShuming Fan #define RT1011_CLASSD_INTERNAL_SET_8		0x130c
220d6e65bb7SShuming Fan #define RT1011_VREF_LV_1						0x131a
221d6e65bb7SShuming Fan #define RT1011_SMART_BOOST_TIMING_1		0x1322
222d6e65bb7SShuming Fan #define RT1011_SMART_BOOST_TIMING_36		0x1349
223d6e65bb7SShuming Fan #define RT1011_SINE_GEN_REG_1				0x1500
224d6e65bb7SShuming Fan #define RT1011_SINE_GEN_REG_2				0x1502
225d6e65bb7SShuming Fan #define RT1011_SINE_GEN_REG_3				0x1504
226d6e65bb7SShuming Fan #define RT1011_STP_INITIAL_RS_TEMP			0x1510
227d6e65bb7SShuming Fan #define RT1011_STP_CALIB_RS_TEMP			0x152a
228d6e65bb7SShuming Fan #define RT1011_INIT_RECIPROCAL_REG_24_16				0x1538
229d6e65bb7SShuming Fan #define RT1011_INIT_RECIPROCAL_REG_15_0				0x1539
2303403b808SShuming Fan #define RT1011_STP_INITIAL_RESISTANCE_TEMP				0x153c
231d6e65bb7SShuming Fan #define RT1011_STP_ALPHA_RECIPROCAL_MSB				0x153e
232d6e65bb7SShuming Fan #define RT1011_SPK_RESISTANCE_1				0x1544
233d6e65bb7SShuming Fan #define RT1011_SPK_RESISTANCE_2				0x1546
234d6e65bb7SShuming Fan #define RT1011_SPK_THERMAL					0x1548
235d6e65bb7SShuming Fan #define RT1011_STP_OTP_TH						0x1552
236d6e65bb7SShuming Fan #define RT1011_ALC_BK_GAIN_O					0x1554
237d6e65bb7SShuming Fan #define RT1011_ALC_BK_GAIN_O_PRE			0x1556
238d6e65bb7SShuming Fan #define RT1011_SPK_DC_O_23_16				0x155a
239d6e65bb7SShuming Fan #define RT1011_SPK_DC_O_15_0					0x155c
240d6e65bb7SShuming Fan #define RT1011_INIT_RECIPROCAL_SYN_24_16	0x1560
241d6e65bb7SShuming Fan #define RT1011_INIT_RECIPROCAL_SYN_15_0	0x1562
242d6e65bb7SShuming Fan #define RT1011_STP_BQ_1_A1_L_28_16			0x1570
243d6e65bb7SShuming Fan #define RT1011_STP_BQ_1_H0_R_15_0			0x1583
244d6e65bb7SShuming Fan #define RT1011_STP_BQ_2_A1_L_28_16			0x1590
245d6e65bb7SShuming Fan #define RT1011_SPK_EXCURSION_23_16			0x15be
246d6e65bb7SShuming Fan #define RT1011_SPK_EXCURSION_15_0			0x15bf
247d6e65bb7SShuming Fan #define RT1011_SEP_MAIN_OUT_23_16			0x15c0
248d6e65bb7SShuming Fan #define RT1011_SEP_MAIN_OUT_15_0			0x15c1
249d6e65bb7SShuming Fan #define RT1011_SEP_RE_REG_15_0				0x15f9
250d6e65bb7SShuming Fan #define RT1011_DRC_CF_PARAMS_1				0x1600
251d6e65bb7SShuming Fan #define RT1011_DRC_CF_PARAMS_12				0x160b
252d6e65bb7SShuming Fan #define RT1011_ALC_DRC_HB_INTERNAL_1		0x1611
253d6e65bb7SShuming Fan #define RT1011_ALC_DRC_HB_INTERNAL_5		0x1615
254d6e65bb7SShuming Fan #define RT1011_ALC_DRC_HB_INTERNAL_6		0x1616
255d6e65bb7SShuming Fan #define RT1011_ALC_DRC_HB_INTERNAL_7		0x1617
256d6e65bb7SShuming Fan #define RT1011_ALC_DRC_BB_INTERNAL_1		0x1621
257d6e65bb7SShuming Fan #define RT1011_ALC_DRC_BB_INTERNAL_5		0x1625
258d6e65bb7SShuming Fan #define RT1011_ALC_DRC_BB_INTERNAL_6		0x1626
259d6e65bb7SShuming Fan #define RT1011_ALC_DRC_BB_INTERNAL_7		0x1627
260d6e65bb7SShuming Fan #define RT1011_ALC_DRC_POS_INTERNAL_1		0x1631
261d6e65bb7SShuming Fan #define RT1011_ALC_DRC_POS_INTERNAL_5		0x1635
262d6e65bb7SShuming Fan #define RT1011_ALC_DRC_POS_INTERNAL_6		0x1636
263d6e65bb7SShuming Fan #define RT1011_ALC_DRC_POS_INTERNAL_7		0x1637
264d6e65bb7SShuming Fan #define RT1011_ALC_DRC_POS_INTERNAL_8		0x1638
265d6e65bb7SShuming Fan #define RT1011_ALC_DRC_POS_INTERNAL_9		0x163a
266d6e65bb7SShuming Fan #define RT1011_ALC_DRC_POS_INTERNAL_10	0x163c
267d6e65bb7SShuming Fan #define RT1011_ALC_DRC_POS_INTERNAL_11	0x163e
268d6e65bb7SShuming Fan #define RT1011_BQ_1_PARAMS_CHECK_5			0x1648
269d6e65bb7SShuming Fan #define RT1011_BQ_2_PARAMS_CHECK_1			0x1650
270d6e65bb7SShuming Fan #define RT1011_BQ_2_PARAMS_CHECK_5			0x1658
271d6e65bb7SShuming Fan #define RT1011_BQ_3_PARAMS_CHECK_1			0x1660
272d6e65bb7SShuming Fan #define RT1011_BQ_3_PARAMS_CHECK_5			0x1668
273d6e65bb7SShuming Fan #define RT1011_BQ_4_PARAMS_CHECK_1			0x1670
274d6e65bb7SShuming Fan #define RT1011_BQ_4_PARAMS_CHECK_5			0x1678
275d6e65bb7SShuming Fan #define RT1011_BQ_5_PARAMS_CHECK_1			0x1680
276d6e65bb7SShuming Fan #define RT1011_BQ_5_PARAMS_CHECK_5			0x1688
277d6e65bb7SShuming Fan #define RT1011_BQ_6_PARAMS_CHECK_1			0x1690
278d6e65bb7SShuming Fan #define RT1011_BQ_6_PARAMS_CHECK_5			0x1698
279d6e65bb7SShuming Fan #define RT1011_BQ_7_PARAMS_CHECK_1			0x1700
280d6e65bb7SShuming Fan #define RT1011_BQ_7_PARAMS_CHECK_5			0x1708
281d6e65bb7SShuming Fan #define RT1011_BQ_8_PARAMS_CHECK_1			0x1710
282d6e65bb7SShuming Fan #define RT1011_BQ_8_PARAMS_CHECK_5			0x1718
283d6e65bb7SShuming Fan #define RT1011_BQ_9_PARAMS_CHECK_1			0x1720
284d6e65bb7SShuming Fan #define RT1011_BQ_9_PARAMS_CHECK_5			0x1728
285d6e65bb7SShuming Fan #define RT1011_BQ_10_PARAMS_CHECK_1		0x1730
286d6e65bb7SShuming Fan #define RT1011_BQ_10_PARAMS_CHECK_5		0x1738
287d6e65bb7SShuming Fan #define RT1011_IRQ_1							0x173a
288d6e65bb7SShuming Fan #define RT1011_PART_NUMBER_EFUSE			0x173e
289d6e65bb7SShuming Fan #define RT1011_EFUSE_CONTROL_1				0x17bb
290d6e65bb7SShuming Fan #define RT1011_EFUSE_CONTROL_2				0x17bd
291d6e65bb7SShuming Fan #define RT1011_EFUSE_MATCH_DONE				0x17cb
292d6e65bb7SShuming Fan #define RT1011_EFUSE_ADC_OFFSET_18_16				0x17e5
293d6e65bb7SShuming Fan #define RT1011_EFUSE_ADC_OFFSET_15_0				0x17e7
294d6e65bb7SShuming Fan #define RT1011_EFUSE_DAC_OFFSET_G0_20_16				0x17e9
295d6e65bb7SShuming Fan #define RT1011_EFUSE_DAC_OFFSET_G0_15_0				0x17eb
296d6e65bb7SShuming Fan #define RT1011_EFUSE_DAC_OFFSET_G1_20_16				0x17ed
297d6e65bb7SShuming Fan #define RT1011_EFUSE_DAC_OFFSET_G1_15_0				0x17ef
298d6e65bb7SShuming Fan #define RT1011_EFUSE_READ_R0_3_15_0		0x1803
299d6e65bb7SShuming Fan #define RT1011_MAX_REG				0x1803
300d6e65bb7SShuming Fan #define RT1011_REG_DISP_LEN 23
301d6e65bb7SShuming Fan 
302d6e65bb7SShuming Fan 
303d6e65bb7SShuming Fan /* CLOCK-2 (0x0004) */
304d6e65bb7SShuming Fan #define RT1011_FS_SYS_PRE_MASK			(0x3 << 14)
305d6e65bb7SShuming Fan #define RT1011_FS_SYS_PRE_SFT			14
306d6e65bb7SShuming Fan #define RT1011_FS_SYS_PRE_MCLK			(0x0 << 14)
307d6e65bb7SShuming Fan #define RT1011_FS_SYS_PRE_BCLK			(0x1 << 14)
308d6e65bb7SShuming Fan #define RT1011_FS_SYS_PRE_PLL1			(0x2 << 14)
309d6e65bb7SShuming Fan #define RT1011_FS_SYS_PRE_RCCLK			(0x3 << 14)
310d6e65bb7SShuming Fan #define RT1011_PLL1_SRC_MASK			(0x1 << 13)
311d6e65bb7SShuming Fan #define RT1011_PLL1_SRC_SFT			13
312d6e65bb7SShuming Fan #define RT1011_PLL1_SRC_PLL2			(0x0 << 13)
313d6e65bb7SShuming Fan #define RT1011_PLL1_SRC_BCLK			(0x1 << 13)
314d6e65bb7SShuming Fan #define RT1011_PLL2_SRC_MASK			(0x1 << 12)
315d6e65bb7SShuming Fan #define RT1011_PLL2_SRC_SFT			12
316d6e65bb7SShuming Fan #define RT1011_PLL2_SRC_MCLK			(0x0 << 12)
317d6e65bb7SShuming Fan #define RT1011_PLL2_SRC_RCCLK			(0x1 << 12)
318d6e65bb7SShuming Fan #define RT1011_PLL2_SRC_DIV_MASK			(0x3 << 10)
319d6e65bb7SShuming Fan #define RT1011_PLL2_SRC_DIV_SFT			10
320d6e65bb7SShuming Fan #define RT1011_SRCIN_DIV_MASK			(0x3 << 8)
321d6e65bb7SShuming Fan #define RT1011_SRCIN_DIV_SFT			8
322d6e65bb7SShuming Fan #define RT1011_FS_SYS_DIV_MASK			(0x7 << 4)
323d6e65bb7SShuming Fan #define RT1011_FS_SYS_DIV_SFT			4
324d6e65bb7SShuming Fan 
325d6e65bb7SShuming Fan /* PLL-1 (0x000a) */
326d6e65bb7SShuming Fan #define RT1011_PLL1_QM_MASK			(0xf << 12)
327d6e65bb7SShuming Fan #define RT1011_PLL1_QM_SFT			12
328d6e65bb7SShuming Fan #define RT1011_PLL1_BPM_MASK			(0x1 << 11)
329d6e65bb7SShuming Fan #define RT1011_PLL1_BPM_SFT			11
330d6e65bb7SShuming Fan #define RT1011_PLL1_BPM			(0x1 << 11)
331d6e65bb7SShuming Fan #define RT1011_PLL1_QN_MASK			(0x1ff << 0)
332d6e65bb7SShuming Fan #define RT1011_PLL1_QN_SFT			0
333d6e65bb7SShuming Fan 
334d6e65bb7SShuming Fan /* PLL-2 (0x000c) */
335d6e65bb7SShuming Fan #define RT1011_PLL2_BPK_MASK			(0x1 << 5)
336d6e65bb7SShuming Fan #define RT1011_PLL2_BPK_SFT			5
337d6e65bb7SShuming Fan #define RT1011_PLL2_BPK			(0x1 << 5)
338d6e65bb7SShuming Fan #define RT1011_PLL2_QK_MASK			(0x1f << 0)
339d6e65bb7SShuming Fan #define RT1011_PLL2_QK_SFT			0
340d6e65bb7SShuming Fan 
341d6e65bb7SShuming Fan /* Clock Detect (0x0020) */
342d6e65bb7SShuming Fan #define RT1011_EN_MCLK_DET_MASK			(0x1 << 15)
343d6e65bb7SShuming Fan #define RT1011_EN_MCLK_DET_SFT			15
344d6e65bb7SShuming Fan #define RT1011_EN_MCLK_DET			(0x1 << 15)
345d6e65bb7SShuming Fan 
346d6e65bb7SShuming Fan /* DAC Setting-2 (0x0104) */
347d6e65bb7SShuming Fan #define RT1011_EN_CKGEN_DAC_MASK			(0x1 << 13)
348d6e65bb7SShuming Fan #define RT1011_EN_CKGEN_DAC_SFT			13
349d6e65bb7SShuming Fan #define RT1011_EN_CKGEN_DAC			(0x1 << 13)
350d6e65bb7SShuming Fan 
351d6e65bb7SShuming Fan /* DAC Setting-3 (0x0106) */
352d6e65bb7SShuming Fan #define RT1011_DA_MUTE_EN_MASK			(0x1 << 15)
353d6e65bb7SShuming Fan #define RT1011_DA_MUTE_EN_SFT			15
354d6e65bb7SShuming Fan 
355d6e65bb7SShuming Fan /* ADC Setting-5 (0x0110) */
356d6e65bb7SShuming Fan #define RT1011_AD_EN_CKGEN_ADC_MASK			(0x1 << 9)
357d6e65bb7SShuming Fan #define RT1011_AD_EN_CKGEN_ADC_SFT			9
358d6e65bb7SShuming Fan #define RT1011_AD_EN_CKGEN_ADC			(0x1 << 9)
359d6e65bb7SShuming Fan 
360d6e65bb7SShuming Fan /* TDM Total Setting (0x0111) */
361d6e65bb7SShuming Fan #define RT1011_I2S_TDM_MS_MASK			(0x1 << 14)
362d6e65bb7SShuming Fan #define RT1011_I2S_TDM_MS_SFT			14
363d6e65bb7SShuming Fan #define RT1011_I2S_TDM_MS_S			(0x0 << 14)
364d6e65bb7SShuming Fan #define RT1011_I2S_TDM_MS_M			(0x1 << 14)
365d6e65bb7SShuming Fan #define RT1011_I2S_TX_DL_MASK			(0x7 << 8)
366d6e65bb7SShuming Fan #define RT1011_I2S_TX_DL_SFT			8
367d6e65bb7SShuming Fan #define RT1011_I2S_TX_DL_16B			(0x0 << 8)
368d6e65bb7SShuming Fan #define RT1011_I2S_TX_DL_20B			(0x1 << 8)
369d6e65bb7SShuming Fan #define RT1011_I2S_TX_DL_24B			(0x2 << 8)
370d6e65bb7SShuming Fan #define RT1011_I2S_TX_DL_32B			(0x3 << 8)
371d6e65bb7SShuming Fan #define RT1011_I2S_TX_DL_8B			(0x4 << 8)
372d6e65bb7SShuming Fan #define RT1011_I2S_RX_DL_MASK			(0x7 << 5)
373d6e65bb7SShuming Fan #define RT1011_I2S_RX_DL_SFT			5
374d6e65bb7SShuming Fan #define RT1011_I2S_RX_DL_16B			(0x0 << 5)
375d6e65bb7SShuming Fan #define RT1011_I2S_RX_DL_20B			(0x1 << 5)
376d6e65bb7SShuming Fan #define RT1011_I2S_RX_DL_24B			(0x2 << 5)
377d6e65bb7SShuming Fan #define RT1011_I2S_RX_DL_32B			(0x3 << 5)
378d6e65bb7SShuming Fan #define RT1011_I2S_RX_DL_8B			(0x4 << 5)
379d6e65bb7SShuming Fan #define RT1011_ADCDAT1_PIN_CONFIG			(0x1 << 4)
380d6e65bb7SShuming Fan #define RT1011_ADCDAT1_OUTPUT			(0x0 << 4)
381d6e65bb7SShuming Fan #define RT1011_ADCDAT1_INPUT			(0x1 << 4)
382d6e65bb7SShuming Fan #define RT1011_ADCDAT2_PIN_CONFIG			(0x1 << 3)
383d6e65bb7SShuming Fan #define RT1011_ADCDAT2_OUTPUT			(0x0 << 3)
384d6e65bb7SShuming Fan #define RT1011_ADCDAT2_INPUT			(0x1 << 3)
385d6e65bb7SShuming Fan #define RT1011_I2S_TDM_DF_MASK			(0x7 << 0)
386d6e65bb7SShuming Fan #define RT1011_I2S_TDM_DF_SFT			0
387d6e65bb7SShuming Fan #define RT1011_I2S_TDM_DF_I2S			(0x0)
388d6e65bb7SShuming Fan #define RT1011_I2S_TDM_DF_LEFT			(0x1)
389d6e65bb7SShuming Fan #define RT1011_I2S_TDM_DF_PCM_A			(0x2)
390d6e65bb7SShuming Fan #define RT1011_I2S_TDM_DF_PCM_B			(0x3)
391d6e65bb7SShuming Fan #define RT1011_I2S_TDM_DF_PCM_A_N			(0x6)
392d6e65bb7SShuming Fan #define RT1011_I2S_TDM_DF_PCM_B_N			(0x7)
393d6e65bb7SShuming Fan 
394d6e65bb7SShuming Fan /* TDM_tcon Setting (0x0112) */
395d6e65bb7SShuming Fan #define RT1011_TCON_DF_MASK			(0x7 << 13)
396d6e65bb7SShuming Fan #define RT1011_TCON_DF_SFT			13
397d6e65bb7SShuming Fan #define RT1011_TCON_DF_I2S			(0x0 << 13)
398d6e65bb7SShuming Fan #define RT1011_TCON_DF_LEFT			(0x1 << 13)
399d6e65bb7SShuming Fan #define RT1011_TCON_DF_PCM_A			(0x2 << 13)
400d6e65bb7SShuming Fan #define RT1011_TCON_DF_PCM_B			(0x3 << 13)
401d6e65bb7SShuming Fan #define RT1011_TCON_DF_PCM_A_N			(0x6 << 13)
402d6e65bb7SShuming Fan #define RT1011_TCON_DF_PCM_B_N			(0x7 << 13)
403d6e65bb7SShuming Fan #define RT1011_TCON_BCLK_SEL_MASK			(0x3 << 10)
404d6e65bb7SShuming Fan #define RT1011_TCON_BCLK_SEL_SFT			10
405d6e65bb7SShuming Fan #define RT1011_TCON_BCLK_SEL_32FS			(0x0 << 10)
406d6e65bb7SShuming Fan #define RT1011_TCON_BCLK_SEL_64FS			(0x1 << 10)
407d6e65bb7SShuming Fan #define RT1011_TCON_BCLK_SEL_128FS			(0x2 << 10)
408d6e65bb7SShuming Fan #define RT1011_TCON_BCLK_SEL_256FS			(0x3 << 10)
409d6e65bb7SShuming Fan #define RT1011_TCON_CH_LEN_MASK			(0x3 << 5)
410d6e65bb7SShuming Fan #define RT1011_TCON_CH_LEN_SFT			5
411d6e65bb7SShuming Fan #define RT1011_TCON_CH_LEN_16B			(0x0 << 5)
412d6e65bb7SShuming Fan #define RT1011_TCON_CH_LEN_20B			(0x1 << 5)
413d6e65bb7SShuming Fan #define RT1011_TCON_CH_LEN_24B			(0x2 << 5)
414d6e65bb7SShuming Fan #define RT1011_TCON_CH_LEN_32B			(0x3 << 5)
415d6e65bb7SShuming Fan #define RT1011_TCON_BCLK_MST_MASK			(0x1 << 4)
416d6e65bb7SShuming Fan #define RT1011_TCON_BCLK_MST_SFT			4
417d6e65bb7SShuming Fan #define RT1011_TCON_BCLK_MST_INV		(0x1 << 4)
418d6e65bb7SShuming Fan 
419d6e65bb7SShuming Fan /* TDM1 Setting-1 (0x0114) */
420d6e65bb7SShuming Fan #define RT1011_TDM_INV_BCLK_MASK			(0x1 << 15)
421d6e65bb7SShuming Fan #define RT1011_TDM_INV_BCLK_SFT			15
422d6e65bb7SShuming Fan #define RT1011_TDM_INV_BCLK		(0x1 << 15)
423d6e65bb7SShuming Fan #define RT1011_I2S_CH_TX_MASK			(0x3 << 10)
424d6e65bb7SShuming Fan #define RT1011_I2S_CH_TX_SFT			10
425d6e65bb7SShuming Fan #define RT1011_I2S_TX_2CH			(0x0 << 10)
426d6e65bb7SShuming Fan #define RT1011_I2S_TX_4CH			(0x1 << 10)
427d6e65bb7SShuming Fan #define RT1011_I2S_TX_6CH			(0x2 << 10)
428d6e65bb7SShuming Fan #define RT1011_I2S_TX_8CH			(0x3 << 10)
429d6e65bb7SShuming Fan #define RT1011_I2S_CH_RX_MASK			(0x3 << 8)
430d6e65bb7SShuming Fan #define RT1011_I2S_CH_RX_SFT			8
431d6e65bb7SShuming Fan #define RT1011_I2S_RX_2CH			(0x0 << 8)
432d6e65bb7SShuming Fan #define RT1011_I2S_RX_4CH			(0x1 << 8)
433d6e65bb7SShuming Fan #define RT1011_I2S_RX_6CH			(0x2 << 8)
434d6e65bb7SShuming Fan #define RT1011_I2S_RX_8CH			(0x3 << 8)
435d6e65bb7SShuming Fan #define RT1011_I2S_LR_CH_SEL_MASK			(0x1 << 7)
436d6e65bb7SShuming Fan #define RT1011_I2S_LR_CH_SEL_SFT			7
437d6e65bb7SShuming Fan #define RT1011_I2S_LEFT_CH_SEL			(0x0 << 7)
438d6e65bb7SShuming Fan #define RT1011_I2S_RIGHT_CH_SEL			(0x1 << 7)
439d6e65bb7SShuming Fan #define RT1011_I2S_CH_TX_LEN_MASK			(0x7 << 4)
440d6e65bb7SShuming Fan #define RT1011_I2S_CH_TX_LEN_SFT			4
441d6e65bb7SShuming Fan #define RT1011_I2S_CH_TX_LEN_16B			(0x0 << 4)
442d6e65bb7SShuming Fan #define RT1011_I2S_CH_TX_LEN_20B			(0x1 << 4)
443d6e65bb7SShuming Fan #define RT1011_I2S_CH_TX_LEN_24B			(0x2 << 4)
444d6e65bb7SShuming Fan #define RT1011_I2S_CH_TX_LEN_32B			(0x3 << 4)
445d6e65bb7SShuming Fan #define RT1011_I2S_CH_TX_LEN_8B			(0x4 << 4)
446d6e65bb7SShuming Fan #define RT1011_I2S_CH_RX_LEN_MASK			(0x7 << 0)
447d6e65bb7SShuming Fan #define RT1011_I2S_CH_RX_LEN_SFT			0
448d6e65bb7SShuming Fan #define RT1011_I2S_CH_RX_LEN_16B			(0x0 << 0)
449d6e65bb7SShuming Fan #define RT1011_I2S_CH_RX_LEN_20B			(0x1 << 0)
450d6e65bb7SShuming Fan #define RT1011_I2S_CH_RX_LEN_24B			(0x2 << 0)
451d6e65bb7SShuming Fan #define RT1011_I2S_CH_RX_LEN_32B			(0x3 << 0)
452d6e65bb7SShuming Fan #define RT1011_I2S_CH_RX_LEN_8B			(0x4 << 0)
453d6e65bb7SShuming Fan 
454d6e65bb7SShuming Fan /* TDM1 Setting-2 (0x0116) */
455d6e65bb7SShuming Fan #define RT1011_TDM_I2S_DOCK_ADCDAT_LEN_1_MASK			(0x7 << 13)
456d6e65bb7SShuming Fan #define RT1011_TDM_I2S_DOCK_ADCDAT_2CH			(0x1 << 13)
457d6e65bb7SShuming Fan #define RT1011_TDM_I2S_DOCK_ADCDAT_4CH			(0x3 << 13)
458d6e65bb7SShuming Fan #define RT1011_TDM_I2S_DOCK_ADCDAT_6CH			(0x5 << 13)
459d6e65bb7SShuming Fan #define RT1011_TDM_I2S_DOCK_ADCDAT_8CH			(0x7 << 13)
460d6e65bb7SShuming Fan #define RT1011_TDM_I2S_DOCK_EN_1_MASK			(0x1 << 3)
461d6e65bb7SShuming Fan #define RT1011_TDM_I2S_DOCK_EN_1_SFT			3
462d6e65bb7SShuming Fan #define RT1011_TDM_I2S_DOCK_EN_1		(0x1 << 3)
46381bd644fSShuming Fan #define RT1011_TDM_ADCDAT1_DATA_LOCATION			(0x7 << 0)
46481bd644fSShuming Fan 
46581bd644fSShuming Fan /* TDM1 Setting-3 (0x0118) */
46681bd644fSShuming Fan #define RT1011_TDM_I2S_RX_ADC1_1_MASK			(0x3 << 6)
46781bd644fSShuming Fan #define RT1011_TDM_I2S_RX_ADC2_1_MASK			(0x3 << 4)
46881bd644fSShuming Fan #define RT1011_TDM_I2S_RX_ADC3_1_MASK			(0x3 << 2)
46981bd644fSShuming Fan #define RT1011_TDM_I2S_RX_ADC4_1_MASK			(0x3 << 0)
47081bd644fSShuming Fan #define RT1011_TDM_I2S_RX_ADC1_1_LL			(0x2 << 6)
47181bd644fSShuming Fan #define RT1011_TDM_I2S_RX_ADC2_1_LL			(0x2 << 4)
47281bd644fSShuming Fan #define RT1011_TDM_I2S_RX_ADC3_1_LL			(0x2 << 2)
47381bd644fSShuming Fan #define RT1011_TDM_I2S_RX_ADC4_1_LL			(0x2 << 0)
47481bd644fSShuming Fan 
47581bd644fSShuming Fan /* TDM1 Setting-4 (0x011a) */
47681bd644fSShuming Fan #define RT1011_TDM_I2S_TX_L_DAC1_1_MASK			(0x7 << 12)
47781bd644fSShuming Fan #define RT1011_TDM_I2S_TX_R_DAC1_1_MASK			(0x7 << 8)
47881bd644fSShuming Fan #define RT1011_TDM_I2S_TX_L_DAC1_1_SFT 12
47981bd644fSShuming Fan #define RT1011_TDM_I2S_TX_R_DAC1_1_SFT 8
480d6e65bb7SShuming Fan 
481d6e65bb7SShuming Fan /* TDM2 Setting-2 (0x0120) */
482d6e65bb7SShuming Fan #define RT1011_TDM_I2S_DOCK_ADCDAT_LEN_2_MASK			(0x7 << 13)
483d6e65bb7SShuming Fan #define RT1011_TDM_I2S_DOCK_EN_2_MASK			(0x1 << 3)
484d6e65bb7SShuming Fan #define RT1011_TDM_I2S_DOCK_EN_2_SFT			3
485d6e65bb7SShuming Fan #define RT1011_TDM_I2S_DOCK_EN_2		(0x1 << 3)
486d6e65bb7SShuming Fan 
487d6e65bb7SShuming Fan /* MIXER 1 (0x0300) */
488d6e65bb7SShuming Fan #define RT1011_MIXER_MUTE_MIX_I_MASK			(0x1 << 15)
489d6e65bb7SShuming Fan #define RT1011_MIXER_MUTE_MIX_I_SFT			15
490d6e65bb7SShuming Fan #define RT1011_MIXER_MUTE_MIX_I		(0x1 << 15)
491d6e65bb7SShuming Fan #define RT1011_MIXER_MUTE_SUM_I_MASK			(0x1 << 14)
492d6e65bb7SShuming Fan #define RT1011_MIXER_MUTE_SUM_I_SFT			14
493d6e65bb7SShuming Fan #define RT1011_MIXER_MUTE_SUM_I		(0x1 << 14)
494d6e65bb7SShuming Fan #define RT1011_MIXER_MUTE_MIX_V_MASK			(0x1 << 7)
495d6e65bb7SShuming Fan #define RT1011_MIXER_MUTE_MIX_V_SFT			7
496d6e65bb7SShuming Fan #define RT1011_MIXER_MUTE_MIX_V		(0x1 << 7)
497d6e65bb7SShuming Fan #define RT1011_MIXER_MUTE_SUM_V_MASK			(0x1 << 6)
498d6e65bb7SShuming Fan #define RT1011_MIXER_MUTE_SUM_V_SFT			6
499d6e65bb7SShuming Fan #define RT1011_MIXER_MUTE_SUM_V		(0x1 << 6)
500d6e65bb7SShuming Fan 
501d6e65bb7SShuming Fan /* Analog Temperature Sensor (0x0316) */
502d6e65bb7SShuming Fan #define RT1011_POW_TEMP_REG				(0x1 << 2)
503d6e65bb7SShuming Fan #define RT1011_POW_TEMP_REG_BIT			2
504d6e65bb7SShuming Fan 
505d6e65bb7SShuming Fan /* POWER-1 (0x0322) */
506d6e65bb7SShuming Fan #define RT1011_POW_LDO2				(0x1 << 15)
507d6e65bb7SShuming Fan #define RT1011_POW_LDO2_BIT			15
508d6e65bb7SShuming Fan #define RT1011_POW_DAC				(0x1 << 14)
509d6e65bb7SShuming Fan #define RT1011_POW_DAC_BIT			14
510d6e65bb7SShuming Fan #define RT1011_POW_CLK12M				(0x1 << 13)
511d6e65bb7SShuming Fan #define RT1011_POW_CLK12M_BIT		13
512d6e65bb7SShuming Fan #define RT1011_POW_TEMP				(0x1 << 12)
513d6e65bb7SShuming Fan #define RT1011_POW_TEMP_BIT			12
514d6e65bb7SShuming Fan #define RT1011_POW_ISENSE_SPK				(0x1 << 7)
515d6e65bb7SShuming Fan #define RT1011_POW_ISENSE_SPK_BIT			7
516d6e65bb7SShuming Fan #define RT1011_POW_LPF_SPK				(0x1 << 6)
517d6e65bb7SShuming Fan #define RT1011_POW_LPF_SPK_BIT			6
518d6e65bb7SShuming Fan #define RT1011_POW_VSENSE_SPK				(0x1 << 5)
519d6e65bb7SShuming Fan #define RT1011_POW_VSENSE_SPK_BIT			5
520d6e65bb7SShuming Fan #define RT1011_POW_TWO_BATTERY_SPK				(0x1 << 4)
521d6e65bb7SShuming Fan #define RT1011_POW_TWO_BATTERY_SPK_BIT			4
522d6e65bb7SShuming Fan 
523d6e65bb7SShuming Fan /* POWER-2 (0x0324) */
524d6e65bb7SShuming Fan #define RT1011_PLLEN				(0x1 << 2)
525d6e65bb7SShuming Fan #define RT1011_PLLEN_BIT			2
526d6e65bb7SShuming Fan #define RT1011_POW_BG				(0x1 << 1)
527d6e65bb7SShuming Fan #define RT1011_POW_BG_BIT			1
528d6e65bb7SShuming Fan #define RT1011_POW_BG_MBIAS_LV				(0x1 << 0)
529d6e65bb7SShuming Fan #define RT1011_POW_BG_MBIAS_LV_BIT		0
530d6e65bb7SShuming Fan 
531d6e65bb7SShuming Fan /* POWER-3 (0x0326) */
532d6e65bb7SShuming Fan #define RT1011_POW_DET_SPKVDD			(0x1 << 15)
533d6e65bb7SShuming Fan #define RT1011_POW_DET_SPKVDD_BIT		15
534d6e65bb7SShuming Fan #define RT1011_POW_DET_VBAT				(0x1 << 14)
535d6e65bb7SShuming Fan #define RT1011_POW_DET_VBAT_BIT			14
536d6e65bb7SShuming Fan #define RT1011_POW_FC						(0x1 << 13)
537d6e65bb7SShuming Fan #define RT1011_POW_FC_BIT					13
538d6e65bb7SShuming Fan #define RT1011_POW_MBIAS_LV				(0x1 << 12)
539d6e65bb7SShuming Fan #define RT1011_POW_MBIAS_LV_BIT			12
540d6e65bb7SShuming Fan #define RT1011_POW_ADC_I					(0x1 << 11)
541d6e65bb7SShuming Fan #define RT1011_POW_ADC_I_BIT				11
542d6e65bb7SShuming Fan #define RT1011_POW_ADC_V					(0x1 << 10)
543d6e65bb7SShuming Fan #define RT1011_POW_ADC_V_BIT				10
544d6e65bb7SShuming Fan #define RT1011_POW_ADC_T					(0x1 << 9)
545d6e65bb7SShuming Fan #define RT1011_POW_ADC_T_BIT				9
546d6e65bb7SShuming Fan #define RT1011_POWD_ADC_T					(0x1 << 8)
547d6e65bb7SShuming Fan #define RT1011_POWD_ADC_T_BIT			8
548d6e65bb7SShuming Fan #define RT1011_POW_MIX_I					(0x1 << 7)
549d6e65bb7SShuming Fan #define RT1011_POW_MIX_I_BIT				7
550d6e65bb7SShuming Fan #define RT1011_POW_MIX_V					(0x1 << 6)
551d6e65bb7SShuming Fan #define RT1011_POW_MIX_V_BIT				6
552d6e65bb7SShuming Fan #define RT1011_POW_SUM_I					(0x1 << 5)
553d6e65bb7SShuming Fan #define RT1011_POW_SUM_I_BIT				5
554d6e65bb7SShuming Fan #define RT1011_POW_SUM_V					(0x1 << 4)
555d6e65bb7SShuming Fan #define RT1011_POW_SUM_V_BIT				4
556d6e65bb7SShuming Fan #define RT1011_POW_MIX_T					(0x1 << 2)
557d6e65bb7SShuming Fan #define RT1011_POW_MIX_T_BIT				2
558d6e65bb7SShuming Fan #define RT1011_BYPASS_MIX_T				(0x1 << 1)
559d6e65bb7SShuming Fan #define RT1011_BYPASS_MIX_T_BIT			1
560d6e65bb7SShuming Fan #define RT1011_POW_VREF_LV				(0x1 << 0)
561d6e65bb7SShuming Fan #define RT1011_POW_VREF_LV_BIT			0
562d6e65bb7SShuming Fan 
563d6e65bb7SShuming Fan /* POWER-4 (0x0328) */
564d6e65bb7SShuming Fan #define RT1011_POW_EN_SWR			(0x1 << 12)
565d6e65bb7SShuming Fan #define RT1011_POW_EN_SWR_BIT		12
566d6e65bb7SShuming Fan #define RT1011_POW_EN_PASS_BGOK_SWR			(0x1 << 10)
567d6e65bb7SShuming Fan #define RT1011_POW_EN_PASS_BGOK_SWR_BIT		10
568d6e65bb7SShuming Fan #define RT1011_POW_EN_PASS_VPOK_SWR			(0x1 << 9)
569d6e65bb7SShuming Fan #define RT1011_POW_EN_PASS_VPOK_SWR_BIT		9
570d6e65bb7SShuming Fan 
571d6e65bb7SShuming Fan /* POWER-9 (0x032d) */
572d6e65bb7SShuming Fan #define RT1011_POW_SDB_REG_MASK			(0x1 << 9)
573d6e65bb7SShuming Fan #define RT1011_POW_SDB_REG_BIT		9
574d6e65bb7SShuming Fan #define RT1011_POW_SDB_REG		(0x1 << 9)
575d6e65bb7SShuming Fan #define RT1011_POW_SEL_SDB_MODE_MASK			(0x1 << 6)
576d6e65bb7SShuming Fan #define RT1011_POW_SEL_SDB_MODE_BIT		6
577d6e65bb7SShuming Fan #define RT1011_POW_SEL_SDB_MODE		(0x1 << 6)
578d6e65bb7SShuming Fan #define RT1011_POW_MNL_SDB_MASK			(0x1 << 5)
579d6e65bb7SShuming Fan #define RT1011_POW_MNL_SDB_BIT		5
580d6e65bb7SShuming Fan #define RT1011_POW_MNL_SDB		(0x1 << 5)
581d6e65bb7SShuming Fan 
582d6e65bb7SShuming Fan /* SPK Protection-Temperature Protection (0x050c) */
583d6e65bb7SShuming Fan #define RT1011_STP_EN_MASK			(0x1 << 15)
584d6e65bb7SShuming Fan #define RT1011_STP_EN_BIT		15
585d6e65bb7SShuming Fan #define RT1011_STP_EN		(0x1 << 15)
586d6e65bb7SShuming Fan #define RT1011_STP_RS_CLB_EN_MASK			(0x1 << 14)
587d6e65bb7SShuming Fan #define RT1011_STP_RS_CLB_EN_BIT		14
588d6e65bb7SShuming Fan #define RT1011_STP_RS_CLB_EN		(0x1 << 14)
589d6e65bb7SShuming Fan 
590d6e65bb7SShuming Fan /* SPK Protection-Temperature Protection-4 (0x0510) */
591d6e65bb7SShuming Fan #define RT1011_STP_R0_SELECT_MASK			(0x3 << 6)
592d6e65bb7SShuming Fan #define RT1011_STP_R0_SELECT_EFUSE			(0x0 << 6)
593d6e65bb7SShuming Fan #define RT1011_STP_R0_SELECT_START_VAL	(0x1 << 6)
594d6e65bb7SShuming Fan #define RT1011_STP_R0_SELECT_REG			(0x2 << 6)
595d6e65bb7SShuming Fan #define RT1011_STP_R0_SELECT_FORCE_ZERO	(0x3 << 6)
596d6e65bb7SShuming Fan 
597d6e65bb7SShuming Fan /* SPK Protection-Temperature Protection-6 (0x0512) */
598d6e65bb7SShuming Fan #define RT1011_STP_R0_EN_MASK			(0x1 << 7)
599d6e65bb7SShuming Fan #define RT1011_STP_R0_EN_BIT		7
600d6e65bb7SShuming Fan #define RT1011_STP_R0_EN		(0x1 << 7)
601d6e65bb7SShuming Fan #define RT1011_STP_T0_EN_MASK			(0x1 << 6)
602d6e65bb7SShuming Fan #define RT1011_STP_T0_EN_BIT		6
603d6e65bb7SShuming Fan #define RT1011_STP_T0_EN		(0x1 << 6)
604d6e65bb7SShuming Fan 
60581bd644fSShuming Fan /* Cross Biquad Setting-1 (0x0702) */
60681bd644fSShuming Fan #define RT1011_MONO_LR_SEL_MASK			(0x3 << 5)
60781bd644fSShuming Fan #define RT1011_MONO_L_CHANNEL			(0x0 << 5)
60881bd644fSShuming Fan #define RT1011_MONO_R_CHANNEL			(0x1 << 5)
60981bd644fSShuming Fan #define RT1011_MONO_LR_MIX_CHANNEL			(0x2 << 5)
61081bd644fSShuming Fan 
611d6e65bb7SShuming Fan /* ClassD Internal Setting-1 (0x1300) */
612d6e65bb7SShuming Fan #define RT1011_DRIVER_READY_SPK			(0x1 << 12)
613d6e65bb7SShuming Fan #define RT1011_DRIVER_READY_SPK_BIT		12
614d6e65bb7SShuming Fan #define RT1011_RECV_MODE_SPK_MASK			(0x1 << 5)
615d6e65bb7SShuming Fan #define RT1011_SPK_MODE			(0x0 << 5)
616d6e65bb7SShuming Fan #define RT1011_RECV_MODE			(0x1 << 5)
617d6e65bb7SShuming Fan #define RT1011_RECV_MODE_SPK_BIT		5
618d6e65bb7SShuming Fan 
619d6e65bb7SShuming Fan /* ClassD Internal Setting-3 (0x1304) */
620d6e65bb7SShuming Fan #define RT1011_REG_GAIN_CLASSD_RI_SPK_MASK			(0x7 << 12)
621d6e65bb7SShuming Fan #define RT1011_REG_GAIN_CLASSD_RI_410K (0x0 << 12)
622d6e65bb7SShuming Fan #define RT1011_REG_GAIN_CLASSD_RI_95K (0x1 << 12)
623d6e65bb7SShuming Fan #define RT1011_REG_GAIN_CLASSD_RI_82P5K (0x2 << 12)
624d6e65bb7SShuming Fan #define RT1011_REG_GAIN_CLASSD_RI_72P5K (0x3 << 12)
625d6e65bb7SShuming Fan #define RT1011_REG_GAIN_CLASSD_RI_62P5K (0x4 << 12)
626d6e65bb7SShuming Fan 
627d6e65bb7SShuming Fan /* ClassD Internal Setting-8 (0x130c) */
628d6e65bb7SShuming Fan #define RT1011_TM_PORPVDD_SPK		(0x1 << 1)
629d6e65bb7SShuming Fan #define RT1011_TM_PORPVDD_SPK_BIT		1
630d6e65bb7SShuming Fan 
631d6e65bb7SShuming Fan /* SPK Protection-Temperature Protection-SINE_GEN_REG-1 (0x1500) */
632d6e65bb7SShuming Fan #define RT1011_STP_SIN_GEN_EN_MASK (0x1 << 13)
633d6e65bb7SShuming Fan #define RT1011_STP_SIN_GEN_EN		(0x1 << 13)
634d6e65bb7SShuming Fan #define RT1011_STP_SIN_GEN_EN_BIT		13
635d6e65bb7SShuming Fan 
636d6e65bb7SShuming Fan 
637d6e65bb7SShuming Fan /* System Clock Source */
638d6e65bb7SShuming Fan enum {
639d6e65bb7SShuming Fan 	RT1011_FS_SYS_PRE_S_MCLK,
640d6e65bb7SShuming Fan 	RT1011_FS_SYS_PRE_S_BCLK,
641d6e65bb7SShuming Fan 	RT1011_FS_SYS_PRE_S_PLL1,
642d6e65bb7SShuming Fan 	RT1011_FS_SYS_PRE_S_RCCLK,	/* 12M Hz */
643d6e65bb7SShuming Fan };
644d6e65bb7SShuming Fan 
645d6e65bb7SShuming Fan /* PLL Source 1/2 */
646d6e65bb7SShuming Fan enum {
647d6e65bb7SShuming Fan 	RT1011_PLL1_S_BCLK,
648d6e65bb7SShuming Fan 	RT1011_PLL2_S_MCLK,
649d6e65bb7SShuming Fan 	RT1011_PLL2_S_RCCLK,	/* 12M Hz */
650d6e65bb7SShuming Fan };
651d6e65bb7SShuming Fan 
652d6e65bb7SShuming Fan enum {
653d6e65bb7SShuming Fan 	RT1011_AIF1,
654d6e65bb7SShuming Fan 	RT1011_AIFS
655d6e65bb7SShuming Fan };
656d6e65bb7SShuming Fan 
657*a382285bSJack Yu enum {
658*a382285bSJack Yu 	RT1011_I2S_REF_NONE,
659*a382285bSJack Yu 	RT1011_I2S_REF_LEFT_CH,
660*a382285bSJack Yu 	RT1011_I2S_REF_RIGHT_CH,
661*a382285bSJack Yu };
662*a382285bSJack Yu 
663d6e65bb7SShuming Fan /* BiQual & DRC related settings */
664d6e65bb7SShuming Fan #define RT1011_BQ_DRC_NUM 128
665d6e65bb7SShuming Fan struct rt1011_bq_drc_params {
666d6e65bb7SShuming Fan 	unsigned short val;
667d6e65bb7SShuming Fan 	unsigned short reg;
668d6e65bb7SShuming Fan #ifdef CONFIG_64BIT
669d6e65bb7SShuming Fan 	unsigned int reserved;
670d6e65bb7SShuming Fan #endif
671d6e65bb7SShuming Fan };
672d6e65bb7SShuming Fan enum {
673d6e65bb7SShuming Fan 	RT1011_ADVMODE_INITIAL_SET,
674d6e65bb7SShuming Fan 	RT1011_ADVMODE_SEP_BQ_COEFF,
675d6e65bb7SShuming Fan 	RT1011_ADVMODE_EQ_BQ_COEFF,
676d6e65bb7SShuming Fan 	RT1011_ADVMODE_BQ_UI_COEFF,
677d6e65bb7SShuming Fan 	RT1011_ADVMODE_SMARTBOOST_COEFF,
678d6e65bb7SShuming Fan 	RT1011_ADVMODE_NUM,
679d6e65bb7SShuming Fan };
680d6e65bb7SShuming Fan 
681d6e65bb7SShuming Fan struct rt1011_priv {
682d6e65bb7SShuming Fan 	struct snd_soc_component *component;
683d6e65bb7SShuming Fan 	struct regmap *regmap;
684d6e65bb7SShuming Fan 	struct work_struct cali_work;
685d6e65bb7SShuming Fan 	struct rt1011_bq_drc_params **bq_drc_params;
686d6e65bb7SShuming Fan 
687d6e65bb7SShuming Fan 	int sysclk;
688d6e65bb7SShuming Fan 	int sysclk_src;
689d6e65bb7SShuming Fan 	int lrck;
690d6e65bb7SShuming Fan 	int bclk;
691d6e65bb7SShuming Fan 	int id;
692d6e65bb7SShuming Fan 
693d6e65bb7SShuming Fan 	int pll_src;
694d6e65bb7SShuming Fan 	int pll_in;
695d6e65bb7SShuming Fan 	int pll_out;
696d6e65bb7SShuming Fan 
697d6e65bb7SShuming Fan 	int bq_drc_set;
6980922c7a5SShuming Fan 	unsigned int r0_reg, cali_done;
6998de6e755SShuming Fan 	unsigned int r0_calib, temperature_calib;
700d6e65bb7SShuming Fan 	int recv_spk_mode;
701*a382285bSJack Yu 	int i2s_ref;
702d6e65bb7SShuming Fan };
703d6e65bb7SShuming Fan 
704d6e65bb7SShuming Fan #endif		/* end of _RT1011_H_ */
705