summaryrefslogtreecommitdiff
path: root/sound/soc/codecs/tlv320aic32x4.h
blob: 936bb7a1b5c871f48e6a0240dd02ae1b81b19c26 (plain)
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
/*
 * tlv320aic32x4.h
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 */


#ifndef _TLV320AIC32X4_H
#define _TLV320AIC32X4_H

struct device;
struct regmap_config;

extern const struct regmap_config aic32x4_regmap_config;
int aic32x4_probe(struct device *dev, struct regmap *regmap);
int aic32x4_remove(struct device *dev);

/* tlv320aic32x4 register space (in decimal to match datasheet) */

#define AIC32X4_REG(page, reg)	((page * 128) + reg)

#define	AIC32X4_PSEL		AIC32X4_REG(0, 0)

#define	AIC32X4_RESET		AIC32X4_REG(0, 1)
#define	AIC32X4_CLKMUX		AIC32X4_REG(0, 4)
#define	AIC32X4_PLLPR		AIC32X4_REG(0, 5)
#define	AIC32X4_PLLJ		AIC32X4_REG(0, 6)
#define	AIC32X4_PLLDMSB		AIC32X4_REG(0, 7)
#define	AIC32X4_PLLDLSB		AIC32X4_REG(0, 8)
#define	AIC32X4_NDAC		AIC32X4_REG(0, 11)
#define	AIC32X4_MDAC		AIC32X4_REG(0, 12)
#define AIC32X4_DOSRMSB		AIC32X4_REG(0, 13)
#define AIC32X4_DOSRLSB		AIC32X4_REG(0, 14)
#define	AIC32X4_NADC		AIC32X4_REG(0, 18)
#define	AIC32X4_MADC		AIC32X4_REG(0, 19)
#define AIC32X4_AOSR		AIC32X4_REG(0, 20)
#define AIC32X4_CLKMUX2		AIC32X4_REG(0, 25)
#define AIC32X4_CLKOUTM		AIC32X4_REG(0, 26)
#define AIC32X4_IFACE1		AIC32X4_REG(0, 27)
#define AIC32X4_IFACE2		AIC32X4_REG(0, 28)
#define AIC32X4_IFACE3		AIC32X4_REG(0, 29)
#define AIC32X4_BCLKN		AIC32X4_REG(0, 30)
#define AIC32X4_IFACE4		AIC32X4_REG(0, 31)
#define AIC32X4_IFACE5		AIC32X4_REG(0, 32)
#define AIC32X4_IFACE6		AIC32X4_REG(0, 33)
#define AIC32X4_GPIOCTL		AIC32X4_REG(0, 52)
#define AIC32X4_DOUTCTL		AIC32X4_REG(0, 53)
#define AIC32X4_DINCTL		AIC32X4_REG(0, 54)
#define AIC32X4_MISOCTL		AIC32X4_REG(0, 55)
#define AIC32X4_SCLKCTL		AIC32X4_REG(0, 56)
#define AIC32X4_DACSPB		AIC32X4_REG(0, 60)
#define AIC32X4_ADCSPB		AIC32X4_REG(0, 61)
#define AIC32X4_DACSETUP	AIC32X4_REG(0, 63)
#define AIC32X4_DACMUTE		AIC32X4_REG(0, 64)
#define AIC32X4_LDACVOL		AIC32X4_REG(0, 65)
#define AIC32X4_RDACVOL		AIC32X4_REG(0, 66)
#define AIC32X4_ADCSETUP	AIC32X4_REG(0, 81)
#define	AIC32X4_ADCFGA		AIC32X4_REG(0, 82)
#define AIC32X4_LADCVOL		AIC32X4_REG(0, 83)
#define AIC32X4_RADCVOL		AIC32X4_REG(0, 84)
#define AIC32X4_LAGC1		AIC32X4_REG(0, 86)
#define AIC32X4_LAGC2		AIC32X4_REG(0, 87)
#define AIC32X4_LAGC3		AIC32X4_REG(0, 88)
#define AIC32X4_LAGC4		AIC32X4_REG(0, 89)
#define AIC32X4_LAGC5		AIC32X4_REG(0, 90)
#define AIC32X4_LAGC6		AIC32X4_REG(0, 91)
#define AIC32X4_LAGC7		AIC32X4_REG(0, 92)
#define AIC32X4_RAGC1		AIC32X4_REG(0, 94)
#define AIC32X4_RAGC2		AIC32X4_REG(0, 95)
#define AIC32X4_RAGC3		AIC32X4_REG(0, 96)
#define AIC32X4_RAGC4		AIC32X4_REG(0, 97)
#define AIC32X4_RAGC5		AIC32X4_REG(0, 98)
#define AIC32X4_RAGC6		AIC32X4_REG(0, 99)
#define AIC32X4_RAGC7		AIC32X4_REG(0, 100)

#define AIC32X4_PWRCFG		AIC32X4_REG(1, 1)
#define AIC32X4_LDOCTL		AIC32X4_REG(1, 2)
#define AIC32X4_OUTPWRCTL	AIC32X4_REG(1, 9)
#define AIC32X4_CMMODE		AIC32X4_REG(1, 10)
#define AIC32X4_HPLROUTE	AIC32X4_REG(1, 12)
#define AIC32X4_HPRROUTE	AIC32X4_REG(1, 13)
#define AIC32X4_LOLROUTE	AIC32X4_REG(1, 14)
#define AIC32X4_LORROUTE	AIC32X4_REG(1, 15)
#define	AIC32X4_HPLGAIN		AIC32X4_REG(1, 16)
#define	AIC32X4_HPRGAIN		AIC32X4_REG(1, 17)
#define	AIC32X4_LOLGAIN		AIC32X4_REG(1, 18)
#define	AIC32X4_LORGAIN		AIC32X4_REG(1, 19)
#define AIC32X4_HEADSTART	AIC32X4_REG(1, 20)
#define AIC32X4_MICBIAS		AIC32X4_REG(1, 51)
#define AIC32X4_LMICPGAPIN	AIC32X4_REG(1, 52)
#define AIC32X4_LMICPGANIN	AIC32X4_REG(1, 54)
#define AIC32X4_RMICPGAPIN	AIC32X4_REG(1, 55)
#define AIC32X4_RMICPGANIN	AIC32X4_REG(1, 57)
#define AIC32X4_FLOATINGINPUT	AIC32X4_REG(1, 58)
#define AIC32X4_LMICPGAVOL	AIC32X4_REG(1, 59)
#define AIC32X4_RMICPGAVOL	AIC32X4_REG(1, 60)

#define AIC32X4_FREQ_12000000 12000000
#define AIC32X4_FREQ_24000000 24000000
#define AIC32X4_FREQ_25000000 25000000

#define AIC32X4_WORD_LEN_16BITS		0x00
#define AIC32X4_WORD_LEN_20BITS		0x01
#define AIC32X4_WORD_LEN_24BITS		0x02
#define AIC32X4_WORD_LEN_32BITS		0x03

#define AIC32X4_LADC_EN			(1 << 7)
#define AIC32X4_RADC_EN			(1 << 6)

#define AIC32X4_I2S_MODE		0x00
#define AIC32X4_DSP_MODE		0x01
#define AIC32X4_RIGHT_JUSTIFIED_MODE	0x02
#define AIC32X4_LEFT_JUSTIFIED_MODE	0x03

#define AIC32X4_AVDDWEAKDISABLE		0x08
#define AIC32X4_LDOCTLEN		0x01

#define AIC32X4_LDOIN_18_36		0x01
#define AIC32X4_LDOIN2HP		0x02

#define AIC32X4_DACSPBLOCK_MASK		0x1f
#define AIC32X4_ADCSPBLOCK_MASK		0x1f

#define AIC32X4_PLLJ_SHIFT		6
#define AIC32X4_DOSRMSB_SHIFT		4

#define AIC32X4_PLLCLKIN		0x03

#define AIC32X4_MICBIAS_LDOIN		0x08
#define AIC32X4_MICBIAS_2075V		0x60

#define AIC32X4_LMICPGANIN_IN2R_10K	0x10
#define AIC32X4_LMICPGANIN_CM1L_10K	0x40
#define AIC32X4_RMICPGANIN_IN1L_10K	0x10
#define AIC32X4_RMICPGANIN_CM1R_10K	0x40

#define AIC32X4_LMICPGAVOL_NOGAIN	0x80
#define AIC32X4_RMICPGAVOL_NOGAIN	0x80

#define AIC32X4_BCLKMASTER		0x08
#define AIC32X4_WCLKMASTER		0x04
#define AIC32X4_PLLEN			(0x01 << 7)
#define AIC32X4_NDACEN			(0x01 << 7)
#define AIC32X4_MDACEN			(0x01 << 7)
#define AIC32X4_NADCEN			(0x01 << 7)
#define AIC32X4_MADCEN			(0x01 << 7)
#define AIC32X4_BCLKEN			(0x01 << 7)
#define AIC32X4_DACEN			(0x03 << 6)
#define AIC32X4_RDAC2LCHN		(0x02 << 2)
#define AIC32X4_LDAC2RCHN		(0x02 << 4)
#define AIC32X4_LDAC2LCHN		(0x01 << 4)
#define AIC32X4_RDAC2RCHN		(0x01 << 2)
#define AIC32X4_DAC_CHAN_MASK		0x3c

#define AIC32X4_SSTEP2WCLK		0x01
#define AIC32X4_MUTEON			0x0C
#define	AIC32X4_DACMOD2BCLK		0x01

#endif				/* _TLV320AIC32X4_H */