xref: /openbmc/linux/sound/soc/codecs/es8316.h (revision b8b88b70)
1b8b88b70SDaniel Drake /*
2b8b88b70SDaniel Drake  * Copyright Everest Semiconductor Co.,Ltd
3b8b88b70SDaniel Drake  *
4b8b88b70SDaniel Drake  * Author: David Yang <yangxiaohua@everest-semi.com>
5b8b88b70SDaniel Drake  *
6b8b88b70SDaniel Drake  * This program is free software; you can redistribute it and/or modify
7b8b88b70SDaniel Drake  * it under the terms of the GNU General Public License version 2 as
8b8b88b70SDaniel Drake  * published by the Free Software Foundation.
9b8b88b70SDaniel Drake  *
10b8b88b70SDaniel Drake  */
11b8b88b70SDaniel Drake 
12b8b88b70SDaniel Drake #ifndef _ES8316_H
13b8b88b70SDaniel Drake #define _ES8316_H
14b8b88b70SDaniel Drake 
15b8b88b70SDaniel Drake /*
16b8b88b70SDaniel Drake  * ES8316 register space
17b8b88b70SDaniel Drake  */
18b8b88b70SDaniel Drake 
19b8b88b70SDaniel Drake /* Reset Control */
20b8b88b70SDaniel Drake #define ES8316_RESET		0x00
21b8b88b70SDaniel Drake 
22b8b88b70SDaniel Drake /* Clock Management */
23b8b88b70SDaniel Drake #define ES8316_CLKMGR_CLKSW	0x01
24b8b88b70SDaniel Drake #define ES8316_CLKMGR_CLKSEL	0x02
25b8b88b70SDaniel Drake #define ES8316_CLKMGR_ADCOSR	0x03
26b8b88b70SDaniel Drake #define ES8316_CLKMGR_ADCDIV1	0x04
27b8b88b70SDaniel Drake #define ES8316_CLKMGR_ADCDIV2	0x05
28b8b88b70SDaniel Drake #define ES8316_CLKMGR_DACDIV1	0x06
29b8b88b70SDaniel Drake #define ES8316_CLKMGR_DACDIV2	0x07
30b8b88b70SDaniel Drake #define ES8316_CLKMGR_CPDIV	0x08
31b8b88b70SDaniel Drake 
32b8b88b70SDaniel Drake /* Serial Data Port Control */
33b8b88b70SDaniel Drake #define ES8316_SERDATA1		0x09
34b8b88b70SDaniel Drake #define ES8316_SERDATA_ADC	0x0a
35b8b88b70SDaniel Drake #define ES8316_SERDATA_DAC	0x0b
36b8b88b70SDaniel Drake 
37b8b88b70SDaniel Drake /* System Control */
38b8b88b70SDaniel Drake #define ES8316_SYS_VMIDSEL	0x0c
39b8b88b70SDaniel Drake #define ES8316_SYS_PDN		0x0d
40b8b88b70SDaniel Drake #define ES8316_SYS_LP1		0x0e
41b8b88b70SDaniel Drake #define ES8316_SYS_LP2		0x0f
42b8b88b70SDaniel Drake #define ES8316_SYS_VMIDLOW	0x10
43b8b88b70SDaniel Drake #define ES8316_SYS_VSEL		0x11
44b8b88b70SDaniel Drake #define ES8316_SYS_REF		0x12
45b8b88b70SDaniel Drake 
46b8b88b70SDaniel Drake /* Headphone Mixer */
47b8b88b70SDaniel Drake #define ES8316_HPMIX_SEL	0x13
48b8b88b70SDaniel Drake #define ES8316_HPMIX_SWITCH	0x14
49b8b88b70SDaniel Drake #define ES8316_HPMIX_PDN	0x15
50b8b88b70SDaniel Drake #define ES8316_HPMIX_VOL	0x16
51b8b88b70SDaniel Drake 
52b8b88b70SDaniel Drake /* Charge Pump Headphone driver */
53b8b88b70SDaniel Drake #define ES8316_CPHP_OUTEN	0x17
54b8b88b70SDaniel Drake #define ES8316_CPHP_ICAL_VOL	0x18
55b8b88b70SDaniel Drake #define ES8316_CPHP_PDN1	0x19
56b8b88b70SDaniel Drake #define ES8316_CPHP_PDN2	0x1a
57b8b88b70SDaniel Drake #define ES8316_CPHP_LDOCTL	0x1b
58b8b88b70SDaniel Drake 
59b8b88b70SDaniel Drake /* Calibration */
60b8b88b70SDaniel Drake #define ES8316_CAL_TYPE		0x1c
61b8b88b70SDaniel Drake #define ES8316_CAL_SET		0x1d
62b8b88b70SDaniel Drake #define ES8316_CAL_HPLIV	0x1e
63b8b88b70SDaniel Drake #define ES8316_CAL_HPRIV	0x1f
64b8b88b70SDaniel Drake #define ES8316_CAL_HPLMV	0x20
65b8b88b70SDaniel Drake #define ES8316_CAL_HPRMV	0x21
66b8b88b70SDaniel Drake 
67b8b88b70SDaniel Drake /* ADC Control */
68b8b88b70SDaniel Drake #define ES8316_ADC_PDN_LINSEL	0x22
69b8b88b70SDaniel Drake #define ES8316_ADC_PGAGAIN	0x23
70b8b88b70SDaniel Drake #define ES8316_ADC_D2SEPGA	0x24
71b8b88b70SDaniel Drake #define ES8316_ADC_DMIC		0x25
72b8b88b70SDaniel Drake #define ES8316_ADC_MUTE		0x26
73b8b88b70SDaniel Drake #define ES8316_ADC_VOLUME	0x27
74b8b88b70SDaniel Drake #define ES8316_ADC_ALC1		0x29
75b8b88b70SDaniel Drake #define ES8316_ADC_ALC2		0x2a
76b8b88b70SDaniel Drake #define ES8316_ADC_ALC3		0x2b
77b8b88b70SDaniel Drake #define ES8316_ADC_ALC4		0x2c
78b8b88b70SDaniel Drake #define ES8316_ADC_ALC5		0x2d
79b8b88b70SDaniel Drake #define ES8316_ADC_ALC_NG	0x2e
80b8b88b70SDaniel Drake 
81b8b88b70SDaniel Drake /* DAC Control */
82b8b88b70SDaniel Drake #define ES8316_DAC_PDN		0x2f
83b8b88b70SDaniel Drake #define ES8316_DAC_SET1		0x30
84b8b88b70SDaniel Drake #define ES8316_DAC_SET2		0x31
85b8b88b70SDaniel Drake #define ES8316_DAC_SET3		0x32
86b8b88b70SDaniel Drake #define ES8316_DAC_VOLL		0x33
87b8b88b70SDaniel Drake #define ES8316_DAC_VOLR		0x34
88b8b88b70SDaniel Drake 
89b8b88b70SDaniel Drake /* GPIO */
90b8b88b70SDaniel Drake #define ES8316_GPIO_SEL		0x4d
91b8b88b70SDaniel Drake #define ES8316_GPIO_DEBOUNCE	0x4e
92b8b88b70SDaniel Drake #define ES8316_GPIO_FLAG	0x4f
93b8b88b70SDaniel Drake 
94b8b88b70SDaniel Drake /* Test mode */
95b8b88b70SDaniel Drake #define ES8316_TESTMODE		0x50
96b8b88b70SDaniel Drake #define ES8316_TEST1		0x51
97b8b88b70SDaniel Drake #define ES8316_TEST2		0x52
98b8b88b70SDaniel Drake #define ES8316_TEST3		0x53
99b8b88b70SDaniel Drake 
100b8b88b70SDaniel Drake /*
101b8b88b70SDaniel Drake  * Field definitions
102b8b88b70SDaniel Drake  */
103b8b88b70SDaniel Drake 
104b8b88b70SDaniel Drake /* ES8316_RESET */
105b8b88b70SDaniel Drake #define ES8316_RESET_CSM_ON		0x80
106b8b88b70SDaniel Drake 
107b8b88b70SDaniel Drake /* ES8316_CLKMGR_CLKSW */
108b8b88b70SDaniel Drake #define ES8316_CLKMGR_CLKSW_MCLK_ON	0x40
109b8b88b70SDaniel Drake #define ES8316_CLKMGR_CLKSW_BCLK_ON	0x20
110b8b88b70SDaniel Drake 
111b8b88b70SDaniel Drake /* ES8316_SERDATA1 */
112b8b88b70SDaniel Drake #define ES8316_SERDATA1_MASTER		0x80
113b8b88b70SDaniel Drake #define ES8316_SERDATA1_BCLK_INV	0x20
114b8b88b70SDaniel Drake 
115b8b88b70SDaniel Drake /* ES8316_SERDATA_ADC and _DAC */
116b8b88b70SDaniel Drake #define ES8316_SERDATA2_FMT_MASK	0x3
117b8b88b70SDaniel Drake #define ES8316_SERDATA2_FMT_I2S		0x00
118b8b88b70SDaniel Drake #define ES8316_SERDATA2_FMT_LEFTJ	0x01
119b8b88b70SDaniel Drake #define ES8316_SERDATA2_FMT_RIGHTJ	0x02
120b8b88b70SDaniel Drake #define ES8316_SERDATA2_FMT_PCM		0x03
121b8b88b70SDaniel Drake #define ES8316_SERDATA2_ADCLRP		0x20
122b8b88b70SDaniel Drake #define ES8316_SERDATA2_LEN_MASK	0x1c
123b8b88b70SDaniel Drake #define ES8316_SERDATA2_LEN_24		0x00
124b8b88b70SDaniel Drake #define ES8316_SERDATA2_LEN_20		0x04
125b8b88b70SDaniel Drake #define ES8316_SERDATA2_LEN_18		0x08
126b8b88b70SDaniel Drake #define ES8316_SERDATA2_LEN_16		0x0c
127b8b88b70SDaniel Drake #define ES8316_SERDATA2_LEN_32		0x10
128b8b88b70SDaniel Drake 
129b8b88b70SDaniel Drake #endif
130