xref: /linux/sound/soc/codecs/sgtl5000.h (revision 9b34e6cc3bc2bf826c078c93c81b46f6c08da25f)
1*9b34e6ccSZeng Zhaoming /*
2*9b34e6ccSZeng Zhaoming  * sgtl5000.h - SGTL5000 audio codec interface
3*9b34e6ccSZeng Zhaoming  *
4*9b34e6ccSZeng Zhaoming  * Copyright 2010-2011 Freescale Semiconductor, Inc.
5*9b34e6ccSZeng Zhaoming  *
6*9b34e6ccSZeng Zhaoming  * This program is free software; you can redistribute it and/or modify
7*9b34e6ccSZeng Zhaoming  * it under the terms of the GNU General Public License version 2 as
8*9b34e6ccSZeng Zhaoming  * published by the Free Software Foundation.
9*9b34e6ccSZeng Zhaoming  */
10*9b34e6ccSZeng Zhaoming 
11*9b34e6ccSZeng Zhaoming #ifndef _SGTL5000_H
12*9b34e6ccSZeng Zhaoming #define _SGTL5000_H
13*9b34e6ccSZeng Zhaoming 
14*9b34e6ccSZeng Zhaoming #include <linux/i2c.h>
15*9b34e6ccSZeng Zhaoming 
16*9b34e6ccSZeng Zhaoming /*
17*9b34e6ccSZeng Zhaoming  * Register values.
18*9b34e6ccSZeng Zhaoming  */
19*9b34e6ccSZeng Zhaoming #define SGTL5000_CHIP_ID			0x0000
20*9b34e6ccSZeng Zhaoming #define SGTL5000_CHIP_DIG_POWER			0x0002
21*9b34e6ccSZeng Zhaoming #define SGTL5000_CHIP_CLK_CTRL			0x0004
22*9b34e6ccSZeng Zhaoming #define SGTL5000_CHIP_I2S_CTRL			0x0006
23*9b34e6ccSZeng Zhaoming #define SGTL5000_CHIP_SSS_CTRL			0x000a
24*9b34e6ccSZeng Zhaoming #define SGTL5000_CHIP_ADCDAC_CTRL		0x000e
25*9b34e6ccSZeng Zhaoming #define SGTL5000_CHIP_DAC_VOL			0x0010
26*9b34e6ccSZeng Zhaoming #define SGTL5000_CHIP_PAD_STRENGTH		0x0014
27*9b34e6ccSZeng Zhaoming #define SGTL5000_CHIP_ANA_ADC_CTRL		0x0020
28*9b34e6ccSZeng Zhaoming #define SGTL5000_CHIP_ANA_HP_CTRL		0x0022
29*9b34e6ccSZeng Zhaoming #define SGTL5000_CHIP_ANA_CTRL			0x0024
30*9b34e6ccSZeng Zhaoming #define SGTL5000_CHIP_LINREG_CTRL		0x0026
31*9b34e6ccSZeng Zhaoming #define SGTL5000_CHIP_REF_CTRL			0x0028
32*9b34e6ccSZeng Zhaoming #define SGTL5000_CHIP_MIC_CTRL			0x002a
33*9b34e6ccSZeng Zhaoming #define SGTL5000_CHIP_LINE_OUT_CTRL		0x002c
34*9b34e6ccSZeng Zhaoming #define SGTL5000_CHIP_LINE_OUT_VOL		0x002e
35*9b34e6ccSZeng Zhaoming #define SGTL5000_CHIP_ANA_POWER			0x0030
36*9b34e6ccSZeng Zhaoming #define SGTL5000_CHIP_PLL_CTRL			0x0032
37*9b34e6ccSZeng Zhaoming #define SGTL5000_CHIP_CLK_TOP_CTRL		0x0034
38*9b34e6ccSZeng Zhaoming #define SGTL5000_CHIP_ANA_STATUS		0x0036
39*9b34e6ccSZeng Zhaoming #define SGTL5000_CHIP_SHORT_CTRL		0x003c
40*9b34e6ccSZeng Zhaoming #define SGTL5000_CHIP_ANA_TEST2			0x003a
41*9b34e6ccSZeng Zhaoming #define SGTL5000_DAP_CTRL			0x0100
42*9b34e6ccSZeng Zhaoming #define SGTL5000_DAP_PEQ			0x0102
43*9b34e6ccSZeng Zhaoming #define SGTL5000_DAP_BASS_ENHANCE		0x0104
44*9b34e6ccSZeng Zhaoming #define SGTL5000_DAP_BASS_ENHANCE_CTRL		0x0106
45*9b34e6ccSZeng Zhaoming #define SGTL5000_DAP_AUDIO_EQ			0x0108
46*9b34e6ccSZeng Zhaoming #define SGTL5000_DAP_SURROUND			0x010a
47*9b34e6ccSZeng Zhaoming #define SGTL5000_DAP_FLT_COEF_ACCESS		0x010c
48*9b34e6ccSZeng Zhaoming #define SGTL5000_DAP_COEF_WR_B0_MSB		0x010e
49*9b34e6ccSZeng Zhaoming #define SGTL5000_DAP_COEF_WR_B0_LSB		0x0110
50*9b34e6ccSZeng Zhaoming #define SGTL5000_DAP_EQ_BASS_BAND0		0x0116
51*9b34e6ccSZeng Zhaoming #define SGTL5000_DAP_EQ_BASS_BAND1		0x0118
52*9b34e6ccSZeng Zhaoming #define SGTL5000_DAP_EQ_BASS_BAND2		0x011a
53*9b34e6ccSZeng Zhaoming #define SGTL5000_DAP_EQ_BASS_BAND3		0x011c
54*9b34e6ccSZeng Zhaoming #define SGTL5000_DAP_EQ_BASS_BAND4		0x011e
55*9b34e6ccSZeng Zhaoming #define SGTL5000_DAP_MAIN_CHAN			0x0120
56*9b34e6ccSZeng Zhaoming #define SGTL5000_DAP_MIX_CHAN			0x0122
57*9b34e6ccSZeng Zhaoming #define SGTL5000_DAP_AVC_CTRL			0x0124
58*9b34e6ccSZeng Zhaoming #define SGTL5000_DAP_AVC_THRESHOLD		0x0126
59*9b34e6ccSZeng Zhaoming #define SGTL5000_DAP_AVC_ATTACK			0x0128
60*9b34e6ccSZeng Zhaoming #define SGTL5000_DAP_AVC_DECAY			0x012a
61*9b34e6ccSZeng Zhaoming #define SGTL5000_DAP_COEF_WR_B1_MSB		0x012c
62*9b34e6ccSZeng Zhaoming #define SGTL5000_DAP_COEF_WR_B1_LSB		0x012e
63*9b34e6ccSZeng Zhaoming #define SGTL5000_DAP_COEF_WR_B2_MSB		0x0130
64*9b34e6ccSZeng Zhaoming #define SGTL5000_DAP_COEF_WR_B2_LSB		0x0132
65*9b34e6ccSZeng Zhaoming #define SGTL5000_DAP_COEF_WR_A1_MSB		0x0134
66*9b34e6ccSZeng Zhaoming #define SGTL5000_DAP_COEF_WR_A1_LSB		0x0136
67*9b34e6ccSZeng Zhaoming #define SGTL5000_DAP_COEF_WR_A2_MSB		0x0138
68*9b34e6ccSZeng Zhaoming #define SGTL5000_DAP_COEF_WR_A2_LSB		0x013a
69*9b34e6ccSZeng Zhaoming 
70*9b34e6ccSZeng Zhaoming /*
71*9b34e6ccSZeng Zhaoming  * Field Definitions.
72*9b34e6ccSZeng Zhaoming  */
73*9b34e6ccSZeng Zhaoming 
74*9b34e6ccSZeng Zhaoming /*
75*9b34e6ccSZeng Zhaoming  * SGTL5000_CHIP_ID
76*9b34e6ccSZeng Zhaoming  */
77*9b34e6ccSZeng Zhaoming #define SGTL5000_PARTID_MASK			0xff00
78*9b34e6ccSZeng Zhaoming #define SGTL5000_PARTID_SHIFT			8
79*9b34e6ccSZeng Zhaoming #define SGTL5000_PARTID_WIDTH			8
80*9b34e6ccSZeng Zhaoming #define SGTL5000_PARTID_PART_ID			0xa0
81*9b34e6ccSZeng Zhaoming #define SGTL5000_REVID_MASK			0x00ff
82*9b34e6ccSZeng Zhaoming #define SGTL5000_REVID_SHIFT			0
83*9b34e6ccSZeng Zhaoming #define SGTL5000_REVID_WIDTH			8
84*9b34e6ccSZeng Zhaoming 
85*9b34e6ccSZeng Zhaoming /*
86*9b34e6ccSZeng Zhaoming  * SGTL5000_CHIP_DIG_POWER
87*9b34e6ccSZeng Zhaoming  */
88*9b34e6ccSZeng Zhaoming #define SGTL5000_ADC_EN				0x0040
89*9b34e6ccSZeng Zhaoming #define SGTL5000_DAC_EN				0x0020
90*9b34e6ccSZeng Zhaoming #define SGTL5000_DAP_POWERUP			0x0010
91*9b34e6ccSZeng Zhaoming #define SGTL5000_I2S_OUT_POWERUP		0x0002
92*9b34e6ccSZeng Zhaoming #define SGTL5000_I2S_IN_POWERUP			0x0001
93*9b34e6ccSZeng Zhaoming 
94*9b34e6ccSZeng Zhaoming /*
95*9b34e6ccSZeng Zhaoming  * SGTL5000_CHIP_CLK_CTRL
96*9b34e6ccSZeng Zhaoming  */
97*9b34e6ccSZeng Zhaoming #define SGTL5000_RATE_MODE_MASK			0x0030
98*9b34e6ccSZeng Zhaoming #define SGTL5000_RATE_MODE_SHIFT		4
99*9b34e6ccSZeng Zhaoming #define SGTL5000_RATE_MODE_WIDTH		2
100*9b34e6ccSZeng Zhaoming #define SGTL5000_RATE_MODE_DIV_1		0
101*9b34e6ccSZeng Zhaoming #define SGTL5000_RATE_MODE_DIV_2		1
102*9b34e6ccSZeng Zhaoming #define SGTL5000_RATE_MODE_DIV_4		2
103*9b34e6ccSZeng Zhaoming #define SGTL5000_RATE_MODE_DIV_6		3
104*9b34e6ccSZeng Zhaoming #define SGTL5000_SYS_FS_MASK			0x000c
105*9b34e6ccSZeng Zhaoming #define SGTL5000_SYS_FS_SHIFT			2
106*9b34e6ccSZeng Zhaoming #define SGTL5000_SYS_FS_WIDTH			2
107*9b34e6ccSZeng Zhaoming #define SGTL5000_SYS_FS_32k			0x0
108*9b34e6ccSZeng Zhaoming #define SGTL5000_SYS_FS_44_1k			0x1
109*9b34e6ccSZeng Zhaoming #define SGTL5000_SYS_FS_48k			0x2
110*9b34e6ccSZeng Zhaoming #define SGTL5000_SYS_FS_96k			0x3
111*9b34e6ccSZeng Zhaoming #define SGTL5000_MCLK_FREQ_MASK			0x0003
112*9b34e6ccSZeng Zhaoming #define SGTL5000_MCLK_FREQ_SHIFT		0
113*9b34e6ccSZeng Zhaoming #define SGTL5000_MCLK_FREQ_WIDTH		2
114*9b34e6ccSZeng Zhaoming #define SGTL5000_MCLK_FREQ_256FS		0x0
115*9b34e6ccSZeng Zhaoming #define SGTL5000_MCLK_FREQ_384FS		0x1
116*9b34e6ccSZeng Zhaoming #define SGTL5000_MCLK_FREQ_512FS		0x2
117*9b34e6ccSZeng Zhaoming #define SGTL5000_MCLK_FREQ_PLL			0x3
118*9b34e6ccSZeng Zhaoming 
119*9b34e6ccSZeng Zhaoming /*
120*9b34e6ccSZeng Zhaoming  * SGTL5000_CHIP_I2S_CTRL
121*9b34e6ccSZeng Zhaoming  */
122*9b34e6ccSZeng Zhaoming #define SGTL5000_I2S_SCLKFREQ_MASK		0x0100
123*9b34e6ccSZeng Zhaoming #define SGTL5000_I2S_SCLKFREQ_SHIFT		8
124*9b34e6ccSZeng Zhaoming #define SGTL5000_I2S_SCLKFREQ_WIDTH		1
125*9b34e6ccSZeng Zhaoming #define SGTL5000_I2S_SCLKFREQ_64FS		0x0
126*9b34e6ccSZeng Zhaoming #define SGTL5000_I2S_SCLKFREQ_32FS		0x1	/* Not for RJ mode */
127*9b34e6ccSZeng Zhaoming #define SGTL5000_I2S_MASTER			0x0080
128*9b34e6ccSZeng Zhaoming #define SGTL5000_I2S_SCLK_INV			0x0040
129*9b34e6ccSZeng Zhaoming #define SGTL5000_I2S_DLEN_MASK			0x0030
130*9b34e6ccSZeng Zhaoming #define SGTL5000_I2S_DLEN_SHIFT			4
131*9b34e6ccSZeng Zhaoming #define SGTL5000_I2S_DLEN_WIDTH			2
132*9b34e6ccSZeng Zhaoming #define SGTL5000_I2S_DLEN_32			0x0
133*9b34e6ccSZeng Zhaoming #define SGTL5000_I2S_DLEN_24			0x1
134*9b34e6ccSZeng Zhaoming #define SGTL5000_I2S_DLEN_20			0x2
135*9b34e6ccSZeng Zhaoming #define SGTL5000_I2S_DLEN_16			0x3
136*9b34e6ccSZeng Zhaoming #define SGTL5000_I2S_MODE_MASK			0x000c
137*9b34e6ccSZeng Zhaoming #define SGTL5000_I2S_MODE_SHIFT			2
138*9b34e6ccSZeng Zhaoming #define SGTL5000_I2S_MODE_WIDTH			2
139*9b34e6ccSZeng Zhaoming #define SGTL5000_I2S_MODE_I2S_LJ		0x0
140*9b34e6ccSZeng Zhaoming #define SGTL5000_I2S_MODE_RJ			0x1
141*9b34e6ccSZeng Zhaoming #define SGTL5000_I2S_MODE_PCM			0x2
142*9b34e6ccSZeng Zhaoming #define SGTL5000_I2S_LRALIGN			0x0002
143*9b34e6ccSZeng Zhaoming #define SGTL5000_I2S_LRPOL			0x0001	/* set for which mode */
144*9b34e6ccSZeng Zhaoming 
145*9b34e6ccSZeng Zhaoming /*
146*9b34e6ccSZeng Zhaoming  * SGTL5000_CHIP_SSS_CTRL
147*9b34e6ccSZeng Zhaoming  */
148*9b34e6ccSZeng Zhaoming #define SGTL5000_DAP_MIX_LRSWAP			0x4000
149*9b34e6ccSZeng Zhaoming #define SGTL5000_DAP_LRSWAP			0x2000
150*9b34e6ccSZeng Zhaoming #define SGTL5000_DAC_LRSWAP			0x1000
151*9b34e6ccSZeng Zhaoming #define SGTL5000_I2S_OUT_LRSWAP			0x0400
152*9b34e6ccSZeng Zhaoming #define SGTL5000_DAP_MIX_SEL_MASK		0x0300
153*9b34e6ccSZeng Zhaoming #define SGTL5000_DAP_MIX_SEL_SHIFT		8
154*9b34e6ccSZeng Zhaoming #define SGTL5000_DAP_MIX_SEL_WIDTH		2
155*9b34e6ccSZeng Zhaoming #define SGTL5000_DAP_MIX_SEL_ADC		0x0
156*9b34e6ccSZeng Zhaoming #define SGTL5000_DAP_MIX_SEL_I2S_IN		0x1
157*9b34e6ccSZeng Zhaoming #define SGTL5000_DAP_SEL_MASK			0x00c0
158*9b34e6ccSZeng Zhaoming #define SGTL5000_DAP_SEL_SHIFT			6
159*9b34e6ccSZeng Zhaoming #define SGTL5000_DAP_SEL_WIDTH			2
160*9b34e6ccSZeng Zhaoming #define SGTL5000_DAP_SEL_ADC			0x0
161*9b34e6ccSZeng Zhaoming #define SGTL5000_DAP_SEL_I2S_IN			0x1
162*9b34e6ccSZeng Zhaoming #define SGTL5000_DAC_SEL_MASK			0x0030
163*9b34e6ccSZeng Zhaoming #define SGTL5000_DAC_SEL_SHIFT			4
164*9b34e6ccSZeng Zhaoming #define SGTL5000_DAC_SEL_WIDTH			2
165*9b34e6ccSZeng Zhaoming #define SGTL5000_DAC_SEL_ADC			0x0
166*9b34e6ccSZeng Zhaoming #define SGTL5000_DAC_SEL_I2S_IN			0x1
167*9b34e6ccSZeng Zhaoming #define SGTL5000_DAC_SEL_DAP			0x3
168*9b34e6ccSZeng Zhaoming #define SGTL5000_I2S_OUT_SEL_MASK		0x0003
169*9b34e6ccSZeng Zhaoming #define SGTL5000_I2S_OUT_SEL_SHIFT		0
170*9b34e6ccSZeng Zhaoming #define SGTL5000_I2S_OUT_SEL_WIDTH		2
171*9b34e6ccSZeng Zhaoming #define SGTL5000_I2S_OUT_SEL_ADC		0x0
172*9b34e6ccSZeng Zhaoming #define SGTL5000_I2S_OUT_SEL_I2S_IN		0x1
173*9b34e6ccSZeng Zhaoming #define SGTL5000_I2S_OUT_SEL_DAP		0x3
174*9b34e6ccSZeng Zhaoming 
175*9b34e6ccSZeng Zhaoming /*
176*9b34e6ccSZeng Zhaoming  * SGTL5000_CHIP_ADCDAC_CTRL
177*9b34e6ccSZeng Zhaoming  */
178*9b34e6ccSZeng Zhaoming #define SGTL5000_VOL_BUSY_DAC_RIGHT		0x2000
179*9b34e6ccSZeng Zhaoming #define SGTL5000_VOL_BUSY_DAC_LEFT		0x1000
180*9b34e6ccSZeng Zhaoming #define SGTL5000_DAC_VOL_RAMP_EN		0x0200
181*9b34e6ccSZeng Zhaoming #define SGTL5000_DAC_VOL_RAMP_EXPO		0x0100
182*9b34e6ccSZeng Zhaoming #define SGTL5000_DAC_MUTE_RIGHT			0x0008
183*9b34e6ccSZeng Zhaoming #define SGTL5000_DAC_MUTE_LEFT			0x0004
184*9b34e6ccSZeng Zhaoming #define SGTL5000_ADC_HPF_FREEZE			0x0002
185*9b34e6ccSZeng Zhaoming #define SGTL5000_ADC_HPF_BYPASS			0x0001
186*9b34e6ccSZeng Zhaoming 
187*9b34e6ccSZeng Zhaoming /*
188*9b34e6ccSZeng Zhaoming  * SGTL5000_CHIP_DAC_VOL
189*9b34e6ccSZeng Zhaoming  */
190*9b34e6ccSZeng Zhaoming #define SGTL5000_DAC_VOL_RIGHT_MASK		0xff00
191*9b34e6ccSZeng Zhaoming #define SGTL5000_DAC_VOL_RIGHT_SHIFT		8
192*9b34e6ccSZeng Zhaoming #define SGTL5000_DAC_VOL_RIGHT_WIDTH		8
193*9b34e6ccSZeng Zhaoming #define SGTL5000_DAC_VOL_LEFT_MASK		0x00ff
194*9b34e6ccSZeng Zhaoming #define SGTL5000_DAC_VOL_LEFT_SHIFT		0
195*9b34e6ccSZeng Zhaoming #define SGTL5000_DAC_VOL_LEFT_WIDTH		8
196*9b34e6ccSZeng Zhaoming 
197*9b34e6ccSZeng Zhaoming /*
198*9b34e6ccSZeng Zhaoming  * SGTL5000_CHIP_PAD_STRENGTH
199*9b34e6ccSZeng Zhaoming  */
200*9b34e6ccSZeng Zhaoming #define SGTL5000_PAD_I2S_LRCLK_MASK		0x0300
201*9b34e6ccSZeng Zhaoming #define SGTL5000_PAD_I2S_LRCLK_SHIFT		8
202*9b34e6ccSZeng Zhaoming #define SGTL5000_PAD_I2S_LRCLK_WIDTH		2
203*9b34e6ccSZeng Zhaoming #define SGTL5000_PAD_I2S_SCLK_MASK		0x00c0
204*9b34e6ccSZeng Zhaoming #define SGTL5000_PAD_I2S_SCLK_SHIFT		6
205*9b34e6ccSZeng Zhaoming #define SGTL5000_PAD_I2S_SCLK_WIDTH		2
206*9b34e6ccSZeng Zhaoming #define SGTL5000_PAD_I2S_DOUT_MASK		0x0030
207*9b34e6ccSZeng Zhaoming #define SGTL5000_PAD_I2S_DOUT_SHIFT		4
208*9b34e6ccSZeng Zhaoming #define SGTL5000_PAD_I2S_DOUT_WIDTH		2
209*9b34e6ccSZeng Zhaoming #define SGTL5000_PAD_I2C_SDA_MASK		0x000c
210*9b34e6ccSZeng Zhaoming #define SGTL5000_PAD_I2C_SDA_SHIFT		2
211*9b34e6ccSZeng Zhaoming #define SGTL5000_PAD_I2C_SDA_WIDTH		2
212*9b34e6ccSZeng Zhaoming #define SGTL5000_PAD_I2C_SCL_MASK		0x0003
213*9b34e6ccSZeng Zhaoming #define SGTL5000_PAD_I2C_SCL_SHIFT		0
214*9b34e6ccSZeng Zhaoming #define SGTL5000_PAD_I2C_SCL_WIDTH		2
215*9b34e6ccSZeng Zhaoming 
216*9b34e6ccSZeng Zhaoming /*
217*9b34e6ccSZeng Zhaoming  * SGTL5000_CHIP_ANA_ADC_CTRL
218*9b34e6ccSZeng Zhaoming  */
219*9b34e6ccSZeng Zhaoming #define SGTL5000_ADC_VOL_M6DB			0x0100
220*9b34e6ccSZeng Zhaoming #define SGTL5000_ADC_VOL_RIGHT_MASK		0x00f0
221*9b34e6ccSZeng Zhaoming #define SGTL5000_ADC_VOL_RIGHT_SHIFT		4
222*9b34e6ccSZeng Zhaoming #define SGTL5000_ADC_VOL_RIGHT_WIDTH		4
223*9b34e6ccSZeng Zhaoming #define SGTL5000_ADC_VOL_LEFT_MASK		0x000f
224*9b34e6ccSZeng Zhaoming #define SGTL5000_ADC_VOL_LEFT_SHIFT		0
225*9b34e6ccSZeng Zhaoming #define SGTL5000_ADC_VOL_LEFT_WIDTH		4
226*9b34e6ccSZeng Zhaoming 
227*9b34e6ccSZeng Zhaoming /*
228*9b34e6ccSZeng Zhaoming  * SGTL5000_CHIP_ANA_HP_CTRL
229*9b34e6ccSZeng Zhaoming  */
230*9b34e6ccSZeng Zhaoming #define SGTL5000_HP_VOL_RIGHT_MASK		0x7f00
231*9b34e6ccSZeng Zhaoming #define SGTL5000_HP_VOL_RIGHT_SHIFT		8
232*9b34e6ccSZeng Zhaoming #define SGTL5000_HP_VOL_RIGHT_WIDTH		7
233*9b34e6ccSZeng Zhaoming #define SGTL5000_HP_VOL_LEFT_MASK		0x007f
234*9b34e6ccSZeng Zhaoming #define SGTL5000_HP_VOL_LEFT_SHIFT		0
235*9b34e6ccSZeng Zhaoming #define SGTL5000_HP_VOL_LEFT_WIDTH		7
236*9b34e6ccSZeng Zhaoming 
237*9b34e6ccSZeng Zhaoming /*
238*9b34e6ccSZeng Zhaoming  * SGTL5000_CHIP_ANA_CTRL
239*9b34e6ccSZeng Zhaoming  */
240*9b34e6ccSZeng Zhaoming #define SGTL5000_LINE_OUT_MUTE			0x0100
241*9b34e6ccSZeng Zhaoming #define SGTL5000_HP_SEL_MASK			0x0040
242*9b34e6ccSZeng Zhaoming #define SGTL5000_HP_SEL_SHIFT			6
243*9b34e6ccSZeng Zhaoming #define SGTL5000_HP_SEL_WIDTH			1
244*9b34e6ccSZeng Zhaoming #define SGTL5000_HP_SEL_DAC			0x0
245*9b34e6ccSZeng Zhaoming #define SGTL5000_HP_SEL_LINE_IN			0x1
246*9b34e6ccSZeng Zhaoming #define SGTL5000_HP_ZCD_EN			0x0020
247*9b34e6ccSZeng Zhaoming #define SGTL5000_HP_MUTE			0x0010
248*9b34e6ccSZeng Zhaoming #define SGTL5000_ADC_SEL_MASK			0x0004
249*9b34e6ccSZeng Zhaoming #define SGTL5000_ADC_SEL_SHIFT			2
250*9b34e6ccSZeng Zhaoming #define SGTL5000_ADC_SEL_WIDTH			1
251*9b34e6ccSZeng Zhaoming #define SGTL5000_ADC_SEL_MIC			0x0
252*9b34e6ccSZeng Zhaoming #define SGTL5000_ADC_SEL_LINE_IN		0x1
253*9b34e6ccSZeng Zhaoming #define SGTL5000_ADC_ZCD_EN			0x0002
254*9b34e6ccSZeng Zhaoming #define SGTL5000_ADC_MUTE			0x0001
255*9b34e6ccSZeng Zhaoming 
256*9b34e6ccSZeng Zhaoming /*
257*9b34e6ccSZeng Zhaoming  * SGTL5000_CHIP_LINREG_CTRL
258*9b34e6ccSZeng Zhaoming  */
259*9b34e6ccSZeng Zhaoming #define SGTL5000_VDDC_MAN_ASSN_MASK		0x0040
260*9b34e6ccSZeng Zhaoming #define SGTL5000_VDDC_MAN_ASSN_SHIFT		6
261*9b34e6ccSZeng Zhaoming #define SGTL5000_VDDC_MAN_ASSN_WIDTH		1
262*9b34e6ccSZeng Zhaoming #define SGTL5000_VDDC_MAN_ASSN_VDDA		0x0
263*9b34e6ccSZeng Zhaoming #define SGTL5000_VDDC_MAN_ASSN_VDDIO		0x1
264*9b34e6ccSZeng Zhaoming #define SGTL5000_VDDC_ASSN_OVRD			0x0020
265*9b34e6ccSZeng Zhaoming #define SGTL5000_LINREG_VDDD_MASK		0x000f
266*9b34e6ccSZeng Zhaoming #define SGTL5000_LINREG_VDDD_SHIFT		0
267*9b34e6ccSZeng Zhaoming #define SGTL5000_LINREG_VDDD_WIDTH		4
268*9b34e6ccSZeng Zhaoming 
269*9b34e6ccSZeng Zhaoming /*
270*9b34e6ccSZeng Zhaoming  * SGTL5000_CHIP_REF_CTRL
271*9b34e6ccSZeng Zhaoming  */
272*9b34e6ccSZeng Zhaoming #define SGTL5000_ANA_GND_MASK			0x01f0
273*9b34e6ccSZeng Zhaoming #define SGTL5000_ANA_GND_SHIFT			4
274*9b34e6ccSZeng Zhaoming #define SGTL5000_ANA_GND_WIDTH			5
275*9b34e6ccSZeng Zhaoming #define SGTL5000_ANA_GND_BASE			800	/* mv */
276*9b34e6ccSZeng Zhaoming #define SGTL5000_ANA_GND_STP			25	/*mv */
277*9b34e6ccSZeng Zhaoming #define SGTL5000_BIAS_CTRL_MASK			0x000e
278*9b34e6ccSZeng Zhaoming #define SGTL5000_BIAS_CTRL_SHIFT		1
279*9b34e6ccSZeng Zhaoming #define SGTL5000_BIAS_CTRL_WIDTH		3
280*9b34e6ccSZeng Zhaoming #define SGTL5000_SMALL_POP			0x0001
281*9b34e6ccSZeng Zhaoming 
282*9b34e6ccSZeng Zhaoming /*
283*9b34e6ccSZeng Zhaoming  * SGTL5000_CHIP_MIC_CTRL
284*9b34e6ccSZeng Zhaoming  */
285*9b34e6ccSZeng Zhaoming #define SGTL5000_BIAS_R_MASK			0x0200
286*9b34e6ccSZeng Zhaoming #define SGTL5000_BIAS_R_SHIFT			8
287*9b34e6ccSZeng Zhaoming #define SGTL5000_BIAS_R_WIDTH			2
288*9b34e6ccSZeng Zhaoming #define SGTL5000_BIAS_R_off			0x0
289*9b34e6ccSZeng Zhaoming #define SGTL5000_BIAS_R_2K			0x1
290*9b34e6ccSZeng Zhaoming #define SGTL5000_BIAS_R_4k			0x2
291*9b34e6ccSZeng Zhaoming #define SGTL5000_BIAS_R_8k			0x3
292*9b34e6ccSZeng Zhaoming #define SGTL5000_BIAS_VOLT_MASK			0x0070
293*9b34e6ccSZeng Zhaoming #define SGTL5000_BIAS_VOLT_SHIFT		4
294*9b34e6ccSZeng Zhaoming #define SGTL5000_BIAS_VOLT_WIDTH		3
295*9b34e6ccSZeng Zhaoming #define SGTL5000_MIC_GAIN_MASK			0x0003
296*9b34e6ccSZeng Zhaoming #define SGTL5000_MIC_GAIN_SHIFT			0
297*9b34e6ccSZeng Zhaoming #define SGTL5000_MIC_GAIN_WIDTH			2
298*9b34e6ccSZeng Zhaoming 
299*9b34e6ccSZeng Zhaoming /*
300*9b34e6ccSZeng Zhaoming  * SGTL5000_CHIP_LINE_OUT_CTRL
301*9b34e6ccSZeng Zhaoming  */
302*9b34e6ccSZeng Zhaoming #define SGTL5000_LINE_OUT_CURRENT_MASK		0x0f00
303*9b34e6ccSZeng Zhaoming #define SGTL5000_LINE_OUT_CURRENT_SHIFT		8
304*9b34e6ccSZeng Zhaoming #define SGTL5000_LINE_OUT_CURRENT_WIDTH		4
305*9b34e6ccSZeng Zhaoming #define SGTL5000_LINE_OUT_CURRENT_180u		0x0
306*9b34e6ccSZeng Zhaoming #define SGTL5000_LINE_OUT_CURRENT_270u		0x1
307*9b34e6ccSZeng Zhaoming #define SGTL5000_LINE_OUT_CURRENT_360u		0x3
308*9b34e6ccSZeng Zhaoming #define SGTL5000_LINE_OUT_CURRENT_450u		0x7
309*9b34e6ccSZeng Zhaoming #define SGTL5000_LINE_OUT_CURRENT_540u		0xf
310*9b34e6ccSZeng Zhaoming #define SGTL5000_LINE_OUT_GND_MASK		0x003f
311*9b34e6ccSZeng Zhaoming #define SGTL5000_LINE_OUT_GND_SHIFT		0
312*9b34e6ccSZeng Zhaoming #define SGTL5000_LINE_OUT_GND_WIDTH		6
313*9b34e6ccSZeng Zhaoming #define SGTL5000_LINE_OUT_GND_BASE		800	/* mv */
314*9b34e6ccSZeng Zhaoming #define SGTL5000_LINE_OUT_GND_STP		25
315*9b34e6ccSZeng Zhaoming #define SGTL5000_LINE_OUT_GND_MAX		0x23
316*9b34e6ccSZeng Zhaoming 
317*9b34e6ccSZeng Zhaoming /*
318*9b34e6ccSZeng Zhaoming  * SGTL5000_CHIP_LINE_OUT_VOL
319*9b34e6ccSZeng Zhaoming  */
320*9b34e6ccSZeng Zhaoming #define SGTL5000_LINE_OUT_VOL_RIGHT_MASK	0x1f00
321*9b34e6ccSZeng Zhaoming #define SGTL5000_LINE_OUT_VOL_RIGHT_SHIFT	8
322*9b34e6ccSZeng Zhaoming #define SGTL5000_LINE_OUT_VOL_RIGHT_WIDTH	5
323*9b34e6ccSZeng Zhaoming #define SGTL5000_LINE_OUT_VOL_LEFT_MASK		0x001f
324*9b34e6ccSZeng Zhaoming #define SGTL5000_LINE_OUT_VOL_LEFT_SHIFT	0
325*9b34e6ccSZeng Zhaoming #define SGTL5000_LINE_OUT_VOL_LEFT_WIDTH	5
326*9b34e6ccSZeng Zhaoming 
327*9b34e6ccSZeng Zhaoming /*
328*9b34e6ccSZeng Zhaoming  * SGTL5000_CHIP_ANA_POWER
329*9b34e6ccSZeng Zhaoming  */
330*9b34e6ccSZeng Zhaoming #define SGTL5000_DAC_STEREO			0x4000
331*9b34e6ccSZeng Zhaoming #define SGTL5000_LINREG_SIMPLE_POWERUP		0x2000
332*9b34e6ccSZeng Zhaoming #define SGTL5000_STARTUP_POWERUP		0x1000
333*9b34e6ccSZeng Zhaoming #define SGTL5000_VDDC_CHRGPMP_POWERUP		0x0800
334*9b34e6ccSZeng Zhaoming #define SGTL5000_PLL_POWERUP			0x0400
335*9b34e6ccSZeng Zhaoming #define SGTL5000_LINEREG_D_POWERUP		0x0200
336*9b34e6ccSZeng Zhaoming #define SGTL5000_VCOAMP_POWERUP			0x0100
337*9b34e6ccSZeng Zhaoming #define SGTL5000_VAG_POWERUP			0x0080
338*9b34e6ccSZeng Zhaoming #define SGTL5000_ADC_STEREO			0x0040
339*9b34e6ccSZeng Zhaoming #define SGTL5000_REFTOP_POWERUP			0x0020
340*9b34e6ccSZeng Zhaoming #define SGTL5000_HP_POWERUP			0x0010
341*9b34e6ccSZeng Zhaoming #define SGTL5000_DAC_POWERUP			0x0008
342*9b34e6ccSZeng Zhaoming #define SGTL5000_CAPLESS_HP_POWERUP		0x0004
343*9b34e6ccSZeng Zhaoming #define SGTL5000_ADC_POWERUP			0x0002
344*9b34e6ccSZeng Zhaoming #define SGTL5000_LINE_OUT_POWERUP		0x0001
345*9b34e6ccSZeng Zhaoming 
346*9b34e6ccSZeng Zhaoming /*
347*9b34e6ccSZeng Zhaoming  * SGTL5000_CHIP_PLL_CTRL
348*9b34e6ccSZeng Zhaoming  */
349*9b34e6ccSZeng Zhaoming #define SGTL5000_PLL_INT_DIV_MASK		0xf800
350*9b34e6ccSZeng Zhaoming #define SGTL5000_PLL_INT_DIV_SHIFT		11
351*9b34e6ccSZeng Zhaoming #define SGTL5000_PLL_INT_DIV_WIDTH		5
352*9b34e6ccSZeng Zhaoming #define SGTL5000_PLL_FRAC_DIV_MASK		0x0700
353*9b34e6ccSZeng Zhaoming #define SGTL5000_PLL_FRAC_DIV_SHIFT		0
354*9b34e6ccSZeng Zhaoming #define SGTL5000_PLL_FRAC_DIV_WIDTH		11
355*9b34e6ccSZeng Zhaoming 
356*9b34e6ccSZeng Zhaoming /*
357*9b34e6ccSZeng Zhaoming  * SGTL5000_CHIP_CLK_TOP_CTRL
358*9b34e6ccSZeng Zhaoming  */
359*9b34e6ccSZeng Zhaoming #define SGTL5000_INT_OSC_EN			0x0800
360*9b34e6ccSZeng Zhaoming #define SGTL5000_INPUT_FREQ_DIV2		0x0008
361*9b34e6ccSZeng Zhaoming 
362*9b34e6ccSZeng Zhaoming /*
363*9b34e6ccSZeng Zhaoming  * SGTL5000_CHIP_ANA_STATUS
364*9b34e6ccSZeng Zhaoming  */
365*9b34e6ccSZeng Zhaoming #define SGTL5000_HP_LRSHORT			0x0200
366*9b34e6ccSZeng Zhaoming #define SGTL5000_CAPLESS_SHORT			0x0100
367*9b34e6ccSZeng Zhaoming #define SGTL5000_PLL_LOCKED			0x0010
368*9b34e6ccSZeng Zhaoming 
369*9b34e6ccSZeng Zhaoming /*
370*9b34e6ccSZeng Zhaoming  * SGTL5000_CHIP_SHORT_CTRL
371*9b34e6ccSZeng Zhaoming  */
372*9b34e6ccSZeng Zhaoming #define SGTL5000_LVLADJR_MASK			0x7000
373*9b34e6ccSZeng Zhaoming #define SGTL5000_LVLADJR_SHIFT			12
374*9b34e6ccSZeng Zhaoming #define SGTL5000_LVLADJR_WIDTH			3
375*9b34e6ccSZeng Zhaoming #define SGTL5000_LVLADJL_MASK			0x0700
376*9b34e6ccSZeng Zhaoming #define SGTL5000_LVLADJL_SHIFT			8
377*9b34e6ccSZeng Zhaoming #define SGTL5000_LVLADJL_WIDTH			3
378*9b34e6ccSZeng Zhaoming #define SGTL5000_LVLADJC_MASK			0x0070
379*9b34e6ccSZeng Zhaoming #define SGTL5000_LVLADJC_SHIFT			4
380*9b34e6ccSZeng Zhaoming #define SGTL5000_LVLADJC_WIDTH			3
381*9b34e6ccSZeng Zhaoming #define SGTL5000_LR_SHORT_MOD_MASK		0x000c
382*9b34e6ccSZeng Zhaoming #define SGTL5000_LR_SHORT_MOD_SHIFT		2
383*9b34e6ccSZeng Zhaoming #define SGTL5000_LR_SHORT_MOD_WIDTH		2
384*9b34e6ccSZeng Zhaoming #define SGTL5000_CM_SHORT_MOD_MASK		0x0003
385*9b34e6ccSZeng Zhaoming #define SGTL5000_CM_SHORT_MOD_SHIFT		0
386*9b34e6ccSZeng Zhaoming #define SGTL5000_CM_SHORT_MOD_WIDTH		2
387*9b34e6ccSZeng Zhaoming 
388*9b34e6ccSZeng Zhaoming /*
389*9b34e6ccSZeng Zhaoming  *SGTL5000_CHIP_ANA_TEST2
390*9b34e6ccSZeng Zhaoming  */
391*9b34e6ccSZeng Zhaoming #define SGTL5000_MONO_DAC			0x1000
392*9b34e6ccSZeng Zhaoming 
393*9b34e6ccSZeng Zhaoming /*
394*9b34e6ccSZeng Zhaoming  * SGTL5000_DAP_CTRL
395*9b34e6ccSZeng Zhaoming  */
396*9b34e6ccSZeng Zhaoming #define SGTL5000_DAP_MIX_EN			0x0010
397*9b34e6ccSZeng Zhaoming #define SGTL5000_DAP_EN				0x0001
398*9b34e6ccSZeng Zhaoming 
399*9b34e6ccSZeng Zhaoming #define SGTL5000_SYSCLK				0x00
400*9b34e6ccSZeng Zhaoming #define SGTL5000_LRCLK				0x01
401*9b34e6ccSZeng Zhaoming 
402*9b34e6ccSZeng Zhaoming #endif
403