xref: /openbmc/linux/sound/soc/codecs/max9860.h (revision e021ae7f)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Driver for the MAX9860 Mono Audio Voice Codec
4  *
5  * Author: Peter Rosin <peda@axentia.s>
6  *         Copyright 2016 Axentia Technologies
7  */
8 
9 #ifndef _SND_SOC_MAX9860
10 #define _SND_SOC_MAX9860
11 
12 #define MAX9860_INTRSTATUS   0x00
13 #define MAX9860_MICREADBACK  0x01
14 #define MAX9860_INTEN        0x02
15 #define MAX9860_SYSCLK       0x03
16 #define MAX9860_AUDIOCLKHIGH 0x04
17 #define MAX9860_AUDIOCLKLOW  0x05
18 #define MAX9860_IFC1A        0x06
19 #define MAX9860_IFC1B        0x07
20 #define MAX9860_VOICEFLTR    0x08
21 #define MAX9860_DACATTN      0x09
22 #define MAX9860_ADCLEVEL     0x0a
23 #define MAX9860_DACGAIN      0x0b
24 #define MAX9860_MICGAIN      0x0c
25 #define MAX9860_RESERVED     0x0d
26 #define MAX9860_MICADC       0x0e
27 #define MAX9860_NOISEGATE    0x0f
28 #define MAX9860_PWRMAN       0x10
29 #define MAX9860_REVISION     0xff
30 
31 #define MAX9860_MAX_REGISTER 0xff
32 
33 /* INTRSTATUS */
34 #define MAX9860_CLD          0x80
35 #define MAX9860_SLD          0x40
36 #define MAX9860_ULK          0x20
37 
38 /* MICREADBACK */
39 #define MAX9860_NG           0xe0
40 #define MAX9860_AGC          0x1f
41 
42 /* INTEN */
43 #define MAX9860_ICLD         0x80
44 #define MAX9860_ISLD         0x40
45 #define MAX9860_IULK         0x20
46 
47 /* SYSCLK */
48 #define MAX9860_PSCLK        0x30
49 #define MAX9860_PSCLK_OFF    0x00
50 #define MAX9860_PSCLK_SHIFT  4
51 #define MAX9860_FREQ         0x06
52 #define MAX9860_FREQ_NORMAL  0x00
53 #define MAX9860_FREQ_12MHZ   0x02
54 #define MAX9860_FREQ_13MHZ   0x04
55 #define MAX9860_FREQ_19_2MHZ 0x06
56 #define MAX9860_16KHZ        0x01
57 
58 /* AUDIOCLKHIGH */
59 #define MAX9860_PLL          0x80
60 #define MAX9860_NHI          0x7f
61 
62 /* AUDIOCLKLOW */
63 #define MAX9860_NLO          0xff
64 
65 /* IFC1A */
66 #define MAX9860_MASTER       0x80
67 #define MAX9860_WCI          0x40
68 #define MAX9860_DBCI         0x20
69 #define MAX9860_DDLY         0x10
70 #define MAX9860_HIZ          0x08
71 #define MAX9860_TDM          0x04
72 
73 /* IFC1B */
74 #define MAX9860_ABCI         0x20
75 #define MAX9860_ADLY         0x10
76 #define MAX9860_ST           0x08
77 #define MAX9860_BSEL         0x07
78 #define MAX9860_BSEL_OFF     0x00
79 #define MAX9860_BSEL_64X     0x01
80 #define MAX9860_BSEL_48X     0x02
81 #define MAX9860_BSEL_PCLK_2  0x04
82 #define MAX9860_BSEL_PCLK_4  0x05
83 #define MAX9860_BSEL_PCLK_8  0x06
84 #define MAX9860_BSEL_PCLK_16 0x07
85 
86 /* VOICEFLTR */
87 #define MAX9860_AVFLT        0xf0
88 #define MAX9860_AVFLT_SHIFT  4
89 #define MAX9860_AVFLT_COUNT  6
90 #define MAX9860_DVFLT        0x0f
91 #define MAX9860_DVFLT_SHIFT  0
92 #define MAX9860_DVFLT_COUNT  6
93 
94 /* DACATTN */
95 #define MAX9860_DVA          0xfe
96 #define MAX9860_DVA_SHIFT    1
97 #define MAX9860_DVA_MUTE     0x5e
98 
99 /* ADCLEVEL */
100 #define MAX9860_ADCRL        0xf0
101 #define MAX9860_ADCRL_SHIFT  4
102 #define MAX9860_ADCLL        0x0f
103 #define MAX9860_ADCLL_SHIFT  0
104 #define MAX9860_ADCxL_MIN    15
105 
106 /* DACGAIN */
107 #define MAX9860_DVG          0x60
108 #define MAX9860_DVG_SHIFT    5
109 #define MAX9860_DVG_MAX      3
110 #define MAX9860_DVST         0x1f
111 #define MAX9860_DVST_SHIFT   0
112 #define MAX9860_DVST_MIN     31
113 
114 /* MICGAIN */
115 #define MAX9860_PAM          0x60
116 #define MAX9860_PAM_SHIFT    5
117 #define MAX9860_PAM_MAX      3
118 #define MAX9860_PGAM         0x1f
119 #define MAX9860_PGAM_SHIFT   0
120 #define MAX9860_PGAM_MIN     20
121 
122 /* MICADC */
123 #define MAX9860_AGCSRC       0x80
124 #define MAX9860_AGCSRC_SHIFT 7
125 #define MAX9860_AGCSRC_COUNT 2
126 #define MAX9860_AGCRLS       0x70
127 #define MAX9860_AGCRLS_SHIFT 4
128 #define MAX9860_AGCRLS_COUNT 8
129 #define MAX9860_AGCATK       0x0c
130 #define MAX9860_AGCATK_SHIFT 2
131 #define MAX9860_AGCATK_COUNT 4
132 #define MAX9860_AGCHLD       0x03
133 #define MAX9860_AGCHLD_OFF   0x00
134 #define MAX9860_AGCHLD_SHIFT 0
135 #define MAX9860_AGCHLD_COUNT 4
136 
137 /* NOISEGATE */
138 #define MAX9860_ANTH         0xf0
139 #define MAX9860_ANTH_SHIFT   4
140 #define MAX9860_ANTH_MAX     15
141 #define MAX9860_AGCTH        0x0f
142 #define MAX9860_AGCTH_SHIFT  0
143 #define MAX9860_AGCTH_MIN    15
144 
145 /* PWRMAN */
146 #define MAX9860_SHDN         0x80
147 #define MAX9860_DACEN        0x08
148 #define MAX9860_DACEN_SHIFT  3
149 #define MAX9860_ADCLEN       0x02
150 #define MAX9860_ADCLEN_SHIFT 1
151 #define MAX9860_ADCREN       0x01
152 #define MAX9860_ADCREN_SHIFT 0
153 
154 #endif /* _SND_SOC_MAX9860 */
155