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