xref: /linux/sound/soc/codecs/twl6040.h (revision 8ecbabd977dc64d2d8c9980420a3d72db06fe551)
1*8ecbabd9SMisael Lopez Cruz /*
2*8ecbabd9SMisael Lopez Cruz  * ALSA SoC TWL6040 codec driver
3*8ecbabd9SMisael Lopez Cruz  *
4*8ecbabd9SMisael Lopez Cruz  * Author:	Misael Lopez Cruz <x0052729@ti.com>
5*8ecbabd9SMisael Lopez Cruz  *
6*8ecbabd9SMisael Lopez Cruz  * This program is free software; you can redistribute it and/or
7*8ecbabd9SMisael Lopez Cruz  * modify it under the terms of the GNU General Public License
8*8ecbabd9SMisael Lopez Cruz  * version 2 as published by the Free Software Foundation.
9*8ecbabd9SMisael Lopez Cruz  *
10*8ecbabd9SMisael Lopez Cruz  * This program is distributed in the hope that it will be useful, but
11*8ecbabd9SMisael Lopez Cruz  * WITHOUT ANY WARRANTY; without even the implied warranty of
12*8ecbabd9SMisael Lopez Cruz  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13*8ecbabd9SMisael Lopez Cruz  * General Public License for more details.
14*8ecbabd9SMisael Lopez Cruz  *
15*8ecbabd9SMisael Lopez Cruz  * You should have received a copy of the GNU General Public License
16*8ecbabd9SMisael Lopez Cruz  * along with this program; if not, write to the Free Software
17*8ecbabd9SMisael Lopez Cruz  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18*8ecbabd9SMisael Lopez Cruz  * 02110-1301 USA
19*8ecbabd9SMisael Lopez Cruz  *
20*8ecbabd9SMisael Lopez Cruz  */
21*8ecbabd9SMisael Lopez Cruz 
22*8ecbabd9SMisael Lopez Cruz #ifndef __TWL6040_H__
23*8ecbabd9SMisael Lopez Cruz #define __TWL6040_H__
24*8ecbabd9SMisael Lopez Cruz 
25*8ecbabd9SMisael Lopez Cruz #define TWL6040_REG_ASICID		0x01
26*8ecbabd9SMisael Lopez Cruz #define TWL6040_REG_ASICREV		0x02
27*8ecbabd9SMisael Lopez Cruz #define TWL6040_REG_INTID		0x03
28*8ecbabd9SMisael Lopez Cruz #define TWL6040_REG_INTMR		0x04
29*8ecbabd9SMisael Lopez Cruz #define TWL6040_REG_NCPCTL		0x05
30*8ecbabd9SMisael Lopez Cruz #define TWL6040_REG_LDOCTL		0x06
31*8ecbabd9SMisael Lopez Cruz #define TWL6040_REG_HPPLLCTL		0x07
32*8ecbabd9SMisael Lopez Cruz #define TWL6040_REG_LPPLLCTL		0x08
33*8ecbabd9SMisael Lopez Cruz #define TWL6040_REG_LPPLLDIV		0x09
34*8ecbabd9SMisael Lopez Cruz #define TWL6040_REG_AMICBCTL		0x0A
35*8ecbabd9SMisael Lopez Cruz #define TWL6040_REG_DMICBCTL		0x0B
36*8ecbabd9SMisael Lopez Cruz #define TWL6040_REG_MICLCTL		0x0C
37*8ecbabd9SMisael Lopez Cruz #define TWL6040_REG_MICRCTL		0x0D
38*8ecbabd9SMisael Lopez Cruz #define TWL6040_REG_MICGAIN		0x0E
39*8ecbabd9SMisael Lopez Cruz #define TWL6040_REG_LINEGAIN		0x0F
40*8ecbabd9SMisael Lopez Cruz #define TWL6040_REG_HSLCTL		0x10
41*8ecbabd9SMisael Lopez Cruz #define TWL6040_REG_HSRCTL		0x11
42*8ecbabd9SMisael Lopez Cruz #define TWL6040_REG_HSGAIN		0x12
43*8ecbabd9SMisael Lopez Cruz #define TWL6040_REG_EARCTL		0x13
44*8ecbabd9SMisael Lopez Cruz #define TWL6040_REG_HFLCTL		0x14
45*8ecbabd9SMisael Lopez Cruz #define TWL6040_REG_HFLGAIN		0x15
46*8ecbabd9SMisael Lopez Cruz #define TWL6040_REG_HFRCTL		0x16
47*8ecbabd9SMisael Lopez Cruz #define TWL6040_REG_HFRGAIN		0x17
48*8ecbabd9SMisael Lopez Cruz #define TWL6040_REG_VIBCTLL		0x18
49*8ecbabd9SMisael Lopez Cruz #define TWL6040_REG_VIBDATL		0x19
50*8ecbabd9SMisael Lopez Cruz #define TWL6040_REG_VIBCTLR		0x1A
51*8ecbabd9SMisael Lopez Cruz #define TWL6040_REG_VIBDATR		0x1B
52*8ecbabd9SMisael Lopez Cruz #define TWL6040_REG_HKCTL1		0x1C
53*8ecbabd9SMisael Lopez Cruz #define TWL6040_REG_HKCTL2		0x1D
54*8ecbabd9SMisael Lopez Cruz #define TWL6040_REG_GPOCTL		0x1E
55*8ecbabd9SMisael Lopez Cruz #define TWL6040_REG_ALB			0x1F
56*8ecbabd9SMisael Lopez Cruz #define TWL6040_REG_DLB			0x20
57*8ecbabd9SMisael Lopez Cruz #define TWL6040_REG_TRIM1		0x28
58*8ecbabd9SMisael Lopez Cruz #define TWL6040_REG_TRIM2		0x29
59*8ecbabd9SMisael Lopez Cruz #define TWL6040_REG_TRIM3		0x2A
60*8ecbabd9SMisael Lopez Cruz #define TWL6040_REG_HSOTRIM		0x2B
61*8ecbabd9SMisael Lopez Cruz #define TWL6040_REG_HFOTRIM		0x2C
62*8ecbabd9SMisael Lopez Cruz #define TWL6040_REG_ACCCTL		0x2D
63*8ecbabd9SMisael Lopez Cruz #define TWL6040_REG_STATUS		0x2E
64*8ecbabd9SMisael Lopez Cruz 
65*8ecbabd9SMisael Lopez Cruz #define TWL6040_CACHEREGNUM		(TWL6040_REG_STATUS + 1)
66*8ecbabd9SMisael Lopez Cruz 
67*8ecbabd9SMisael Lopez Cruz #define TWL6040_VIOREGNUM		18
68*8ecbabd9SMisael Lopez Cruz #define TWL6040_VDDREGNUM		21
69*8ecbabd9SMisael Lopez Cruz 
70*8ecbabd9SMisael Lopez Cruz /* INTID (0x03) fields */
71*8ecbabd9SMisael Lopez Cruz 
72*8ecbabd9SMisael Lopez Cruz #define TWL6040_THINT			0x01
73*8ecbabd9SMisael Lopez Cruz #define TWL6040_PLUGINT			0x02
74*8ecbabd9SMisael Lopez Cruz #define TWL6040_UNPLUGINT		0x04
75*8ecbabd9SMisael Lopez Cruz #define TWL6040_HOOKINT			0x08
76*8ecbabd9SMisael Lopez Cruz #define TWL6040_HFINT			0x10
77*8ecbabd9SMisael Lopez Cruz #define TWL6040_VIBINT			0x20
78*8ecbabd9SMisael Lopez Cruz #define TWL6040_READYINT		0x40
79*8ecbabd9SMisael Lopez Cruz 
80*8ecbabd9SMisael Lopez Cruz /* INTMR (0x04) fields */
81*8ecbabd9SMisael Lopez Cruz 
82*8ecbabd9SMisael Lopez Cruz #define TWL6040_READYMSK		0x40
83*8ecbabd9SMisael Lopez Cruz #define TWL6040_ALLINT_MSK		0x7B
84*8ecbabd9SMisael Lopez Cruz 
85*8ecbabd9SMisael Lopez Cruz /* NCPCTL (0x05) fields */
86*8ecbabd9SMisael Lopez Cruz 
87*8ecbabd9SMisael Lopez Cruz #define TWL6040_NCPENA			0x01
88*8ecbabd9SMisael Lopez Cruz #define TWL6040_NCPOPEN			0x40
89*8ecbabd9SMisael Lopez Cruz 
90*8ecbabd9SMisael Lopez Cruz /* LDOCTL (0x06) fields */
91*8ecbabd9SMisael Lopez Cruz 
92*8ecbabd9SMisael Lopez Cruz #define TWL6040_LSLDOENA		0x01
93*8ecbabd9SMisael Lopez Cruz #define TWL6040_HSLDOENA		0x04
94*8ecbabd9SMisael Lopez Cruz #define TWL6040_REFENA			0x40
95*8ecbabd9SMisael Lopez Cruz #define TWL6040_OSCENA			0x80
96*8ecbabd9SMisael Lopez Cruz 
97*8ecbabd9SMisael Lopez Cruz /* HPPLLCTL (0x07) fields */
98*8ecbabd9SMisael Lopez Cruz 
99*8ecbabd9SMisael Lopez Cruz #define TWL6040_HPLLENA			0x01
100*8ecbabd9SMisael Lopez Cruz #define TWL6040_HPLLRST			0x02
101*8ecbabd9SMisael Lopez Cruz #define TWL6040_HPLLBP			0x04
102*8ecbabd9SMisael Lopez Cruz #define TWL6040_HPLLSQRENA		0x08
103*8ecbabd9SMisael Lopez Cruz #define TWL6040_HPLLSQRBP		0x10
104*8ecbabd9SMisael Lopez Cruz #define TWL6040_MCLK_12000KHZ		(0 << 5)
105*8ecbabd9SMisael Lopez Cruz #define TWL6040_MCLK_19200KHZ		(1 << 5)
106*8ecbabd9SMisael Lopez Cruz #define TWL6040_MCLK_26000KHZ		(2 << 5)
107*8ecbabd9SMisael Lopez Cruz #define TWL6040_MCLK_38400KHZ		(3 << 5)
108*8ecbabd9SMisael Lopez Cruz #define TWL6040_MCLK_MSK		0x60
109*8ecbabd9SMisael Lopez Cruz 
110*8ecbabd9SMisael Lopez Cruz /* LPPLLCTL (0x08) fields */
111*8ecbabd9SMisael Lopez Cruz 
112*8ecbabd9SMisael Lopez Cruz #define TWL6040_LPLLENA			0x01
113*8ecbabd9SMisael Lopez Cruz #define TWL6040_LPLLRST			0x02
114*8ecbabd9SMisael Lopez Cruz #define TWL6040_LPLLSEL			0x04
115*8ecbabd9SMisael Lopez Cruz #define TWL6040_LPLLFIN			0x08
116*8ecbabd9SMisael Lopez Cruz #define TWL6040_HPLLSEL			0x10
117*8ecbabd9SMisael Lopez Cruz 
118*8ecbabd9SMisael Lopez Cruz /* HSLCTL (0x10) fields */
119*8ecbabd9SMisael Lopez Cruz 
120*8ecbabd9SMisael Lopez Cruz #define TWL6040_HSDACMODEL		0x02
121*8ecbabd9SMisael Lopez Cruz #define TWL6040_HSDRVMODEL		0x08
122*8ecbabd9SMisael Lopez Cruz 
123*8ecbabd9SMisael Lopez Cruz /* HSRCTL (0x11) fields */
124*8ecbabd9SMisael Lopez Cruz 
125*8ecbabd9SMisael Lopez Cruz #define TWL6040_HSDACMODER		0x02
126*8ecbabd9SMisael Lopez Cruz #define TWL6040_HSDRVMODER		0x08
127*8ecbabd9SMisael Lopez Cruz 
128*8ecbabd9SMisael Lopez Cruz /* ACCCTL (0x2D) fields */
129*8ecbabd9SMisael Lopez Cruz 
130*8ecbabd9SMisael Lopez Cruz #define TWL6040_RESETSPLIT		0x04
131*8ecbabd9SMisael Lopez Cruz 
132*8ecbabd9SMisael Lopez Cruz #define TWL6040_SYSCLK_SEL_LPPLL	1
133*8ecbabd9SMisael Lopez Cruz #define TWL6040_SYSCLK_SEL_HPPLL	2
134*8ecbabd9SMisael Lopez Cruz 
135*8ecbabd9SMisael Lopez Cruz #define TWL6040_HPPLL_ID		1
136*8ecbabd9SMisael Lopez Cruz #define TWL6040_LPPLL_ID		2
137*8ecbabd9SMisael Lopez Cruz 
138*8ecbabd9SMisael Lopez Cruz extern struct snd_soc_dai twl6040_dai;
139*8ecbabd9SMisael Lopez Cruz extern struct snd_soc_codec_device soc_codec_dev_twl6040;
140*8ecbabd9SMisael Lopez Cruz 
141*8ecbabd9SMisael Lopez Cruz #endif /* End of __TWL6040_H__ */
142