diff options
Diffstat (limited to 'firmware/export/mas35xx.h')
-rw-r--r-- | firmware/export/mas35xx.h | 292 |
1 files changed, 0 insertions, 292 deletions
diff --git a/firmware/export/mas35xx.h b/firmware/export/mas35xx.h deleted file mode 100644 index 02691f3de2..0000000000 --- a/firmware/export/mas35xx.h +++ /dev/null | |||
@@ -1,292 +0,0 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Implementation of MAS35xx audiohw api driver. | ||
11 | * | ||
12 | * Copyright (C) 2007 by Christian Gmeiner | ||
13 | * | ||
14 | * This program is free software; you can redistribute it and/or | ||
15 | * modify it under the terms of the GNU General Public License | ||
16 | * as published by the Free Software Foundation; either version 2 | ||
17 | * of the License, or (at your option) any later version. | ||
18 | * | ||
19 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
20 | * KIND, either express or implied. | ||
21 | * | ||
22 | ****************************************************************************/ | ||
23 | |||
24 | #ifndef _MAS35XX_H | ||
25 | #define _MAS35XX_H | ||
26 | |||
27 | #include "config.h" | ||
28 | #include "mascodec.h" | ||
29 | |||
30 | #define MAS_BANK_D0 0 | ||
31 | #define MAS_BANK_D1 1 | ||
32 | |||
33 | /* registers common to all MAS35xx */ | ||
34 | #define MAS_REG_DCCF 0x8e | ||
35 | #define MAS_REG_MUTE 0xaa | ||
36 | #define MAS_REG_PIODATA 0xc8 | ||
37 | #define MAS_REG_StartUpConfig 0xe6 | ||
38 | #define MAS_REG_KPRESCALE 0xe7 | ||
39 | |||
40 | #if CONFIG_CODEC == MAS3507D | ||
41 | |||
42 | #define AUDIOHW_CAPS (BASS_CAP | TREBLE_CAP | PRESCALER_CAP) | ||
43 | |||
44 | AUDIOHW_SETTING(VOLUME, "dB", 0, 1, -78, 18, -18) | ||
45 | AUDIOHW_SETTING(BASS, "dB", 0, 1, -15, 15, 7) | ||
46 | AUDIOHW_SETTING(TREBLE, "dB", 0, 1, -15, 15, 7) | ||
47 | |||
48 | /* I2C defines */ | ||
49 | #define MAS_ADR 0x3a | ||
50 | #define MAS_DEV_WRITE (MAS_ADR | 0x00) | ||
51 | #define MAS_DEV_READ (MAS_ADR | 0x01) | ||
52 | |||
53 | /* MAS3507D registers */ | ||
54 | #define MAS_DATA_WRITE 0x68 | ||
55 | #define MAS_DATA_READ 0x69 | ||
56 | #define MAS_CONTROL 0x6a | ||
57 | |||
58 | #define MAS_REG_KBASS 0x6b | ||
59 | #define MAS_REG_KTREBLE 0x6f | ||
60 | |||
61 | /* MAS3507D commands */ | ||
62 | #define MAS_CMD_READ_ANCILLARY 0x30 | ||
63 | #define MAS_CMD_WRITE_REG 0x90 | ||
64 | #define MAS_CMD_WRITE_D0_MEM 0xa0 | ||
65 | #define MAS_CMD_WRITE_D1_MEM 0xb0 | ||
66 | #define MAS_CMD_READ_REG 0xd0 | ||
67 | #define MAS_CMD_READ_D0_MEM 0xe0 | ||
68 | #define MAS_CMD_READ_D1_MEM 0xf0 | ||
69 | |||
70 | /* MAS3507D D0 memmory cells */ | ||
71 | #define MAS_D0_MPEG_FRAME_COUNT 0x300 | ||
72 | #define MAS_D0_MPEG_STATUS_1 0x301 | ||
73 | #define MAS_D0_MPEG_STATUS_2 0x302 | ||
74 | #define MAS_D0_CRC_ERROR_COUNT 0x303 | ||
75 | #define MAS_D0_OUT_LL 0x7f8 | ||
76 | #define MAS_D0_OUT_LR 0x7f9 | ||
77 | #define MAS_D0_OUT_RL 0x7fa | ||
78 | #define MAS_D0_OUT_RR 0x7fb | ||
79 | |||
80 | static const unsigned int bass_table[] = | ||
81 | { | ||
82 | 0x9e400, /* -15dB */ | ||
83 | 0xa2800, /* -14dB */ | ||
84 | 0xa7400, /* -13dB */ | ||
85 | 0xac400, /* -12dB */ | ||
86 | 0xb1800, /* -11dB */ | ||
87 | 0xb7400, /* -10dB */ | ||
88 | 0xbd400, /* -9dB */ | ||
89 | 0xc3c00, /* -8dB */ | ||
90 | 0xca400, /* -7dB */ | ||
91 | 0xd1800, /* -6dB */ | ||
92 | 0xd8c00, /* -5dB */ | ||
93 | 0xe0400, /* -4dB */ | ||
94 | 0xe8000, /* -3dB */ | ||
95 | 0xefc00, /* -2dB */ | ||
96 | 0xf7c00, /* -1dB */ | ||
97 | 0, | ||
98 | 0x800, /* 1dB */ | ||
99 | 0x10000, /* 2dB */ | ||
100 | 0x17c00, /* 3dB */ | ||
101 | 0x1f800, /* 4dB */ | ||
102 | 0x27000, /* 5dB */ | ||
103 | 0x2e400, /* 6dB */ | ||
104 | 0x35800, /* 7dB */ | ||
105 | 0x3c000, /* 8dB */ | ||
106 | 0x42800, /* 9dB */ | ||
107 | 0x48800, /* 10dB */ | ||
108 | 0x4e400, /* 11dB */ | ||
109 | 0x53800, /* 12dB */ | ||
110 | 0x58800, /* 13dB */ | ||
111 | 0x5d400, /* 14dB */ | ||
112 | 0x61800 /* 15dB */ | ||
113 | }; | ||
114 | |||
115 | static const unsigned int treble_table[] = | ||
116 | { | ||
117 | 0xb2c00, /* -15dB */ | ||
118 | 0xbb400, /* -14dB */ | ||
119 | 0xc1800, /* -13dB */ | ||
120 | 0xc6c00, /* -12dB */ | ||
121 | 0xcbc00, /* -11dB */ | ||
122 | 0xd0400, /* -10dB */ | ||
123 | 0xd5000, /* -9dB */ | ||
124 | 0xd9800, /* -8dB */ | ||
125 | 0xde000, /* -7dB */ | ||
126 | 0xe2800, /* -6dB */ | ||
127 | 0xe7e00, /* -5dB */ | ||
128 | 0xec000, /* -4dB */ | ||
129 | 0xf0c00, /* -3dB */ | ||
130 | 0xf5c00, /* -2dB */ | ||
131 | 0xfac00, /* -1dB */ | ||
132 | 0, | ||
133 | 0x5400, /* 1dB */ | ||
134 | 0xac00, /* 2dB */ | ||
135 | 0x10400, /* 3dB */ | ||
136 | 0x16000, /* 4dB */ | ||
137 | 0x1c000, /* 5dB */ | ||
138 | 0x22400, /* 6dB */ | ||
139 | 0x28400, /* 7dB */ | ||
140 | 0x2ec00, /* 8dB */ | ||
141 | 0x35400, /* 9dB */ | ||
142 | 0x3c000, /* 10dB */ | ||
143 | 0x42c00, /* 11dB */ | ||
144 | 0x49c00, /* 12dB */ | ||
145 | 0x51800, /* 13dB */ | ||
146 | 0x58400, /* 14dB */ | ||
147 | 0x5f800 /* 15dB */ | ||
148 | }; | ||
149 | |||
150 | static const unsigned int prescale_table[] = | ||
151 | { | ||
152 | 0x80000, /* 0db */ | ||
153 | 0x8e000, /* 1dB */ | ||
154 | 0x9a400, /* 2dB */ | ||
155 | 0xa5800, /* 3dB */ | ||
156 | 0xaf400, /* 4dB */ | ||
157 | 0xb8000, /* 5dB */ | ||
158 | 0xbfc00, /* 6dB */ | ||
159 | 0xc6c00, /* 7dB */ | ||
160 | 0xcd000, /* 8dB */ | ||
161 | 0xd25c0, /* 9dB */ | ||
162 | 0xd7800, /* 10dB */ | ||
163 | 0xdc000, /* 11dB */ | ||
164 | 0xdfc00, /* 12dB */ | ||
165 | 0xe3400, /* 13dB */ | ||
166 | 0xe6800, /* 14dB */ | ||
167 | 0xe9400 /* 15dB */ | ||
168 | }; | ||
169 | |||
170 | #else /* CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F */ | ||
171 | |||
172 | AUDIOHW_SETTING(VOLUME, "dB", 0, 1,-100, 12, -25) | ||
173 | AUDIOHW_SETTING(BASS, "dB", 0, 1, -12, 12, 6) | ||
174 | AUDIOHW_SETTING(TREBLE, "dB", 0, 1, -12, 12, 6) | ||
175 | AUDIOHW_SETTING(LOUDNESS, "dB", 0, 1, 0, 17, 0) | ||
176 | AUDIOHW_SETTING(AVC, "", 0, 1, -1, 4, 0) | ||
177 | AUDIOHW_SETTING(MDB_STRENGTH, "dB", 0, 1, 0, 127, 48) | ||
178 | AUDIOHW_SETTING(MDB_HARMONICS, "%", 0, 1, 0, 100, 50) | ||
179 | AUDIOHW_SETTING(MDB_CENTER, "Hz", 0, 10, 20, 300, 60) | ||
180 | AUDIOHW_SETTING(MDB_SHAPE, "Hz", 0, 10, 50, 300, 90) | ||
181 | AUDIOHW_SETTING(MDB_ENABLE, "", 0, 1, 0, 1, 0) | ||
182 | AUDIOHW_SETTING(SUPERBASS, "", 0, 1, 0, 1, 0) | ||
183 | |||
184 | #if CONFIG_CODEC == MAS3587F && defined(HAVE_RECORDING) | ||
185 | /* MAS3587F and MAS3539F handle clipping prevention internally so we do not | ||
186 | * need the prescaler -> CLIPPING_CAP */ | ||
187 | #define AUDIOHW_CAPS (BASS_CAP | TREBLE_CAP | BALANCE_CAP | CLIPPING_CAP | \ | ||
188 | MONO_VOL_CAP | LIN_GAIN_CAP | MIC_GAIN_CAP) | ||
189 | AUDIOHW_SETTING(LEFT_GAIN, "dB", 1, 1, 0, 15, 8, (val - 2) * 15) | ||
190 | AUDIOHW_SETTING(RIGHT_GAIN, "dB", 1, 1, 0, 15, 8, (val - 2) * 15) | ||
191 | AUDIOHW_SETTING(MIC_GAIN, "dB", 1, 1, 0, 15, 2, val * 15 + 210) | ||
192 | #else | ||
193 | /* MAS3587F and MAS3539F handle clipping prevention internally so we do not | ||
194 | * need the prescaler -> CLIPPING_CAP */ | ||
195 | #define AUDIOHW_CAPS (BASS_CAP | TREBLE_CAP | BALANCE_CAP | CLIPPING_CAP | \ | ||
196 | MONO_VOL_CAP) | ||
197 | #endif /* MAS3587F && HAVE_RECORDING */ | ||
198 | |||
199 | /* I2C defines */ | ||
200 | #define MAS_ADR 0x3c | ||
201 | #define MAS_DEV_WRITE (MAS_ADR | 0x00) | ||
202 | #define MAS_DEV_READ (MAS_ADR | 0x01) | ||
203 | |||
204 | /* MAS3587F/MAS3539F registers */ | ||
205 | #define MAS_DATA_WRITE 0x68 | ||
206 | #define MAS_DATA_READ 0x69 | ||
207 | #define MAS_CODEC_WRITE 0x6c | ||
208 | #define MAS_CODEC_READ 0x6d | ||
209 | #define MAS_CONTROL 0x6a | ||
210 | #define MAS_DCCF 0x76 | ||
211 | #define MAS_DCFR 0x77 | ||
212 | |||
213 | #define MAS_REG_KMDB_SWITCH 0x21 | ||
214 | #define MAS_REG_KMDB_STR 0x22 | ||
215 | #define MAS_REG_KMDB_HAR 0x23 | ||
216 | #define MAS_REG_KMDB_FC 0x24 | ||
217 | #define MAS_REG_KLOUDNESS 0x1e | ||
218 | #define MAS_REG_QPEAK_L 0x0a | ||
219 | #define MAS_REG_QPEAK_R 0x0b | ||
220 | #define MAS_REG_DQPEAK_L 0x0c | ||
221 | #define MAS_REG_DQPEAK_R 0x0d | ||
222 | #define MAS_REG_VOLUME_CONTROL 0x10 | ||
223 | #define MAS_REG_BALANCE 0x11 | ||
224 | #define MAS_REG_KAVC 0x12 | ||
225 | #define MAS_REG_KBASS 0x14 | ||
226 | #define MAS_REG_KTREBLE 0x15 | ||
227 | |||
228 | /* MAS3587F/MAS3539F commands */ | ||
229 | #define MAS_CMD_READ_ANCILLARY 0x50 | ||
230 | #define MAS_CMD_FAST_PRG_DL 0x60 | ||
231 | #define MAS_CMD_READ_IC_VER 0x70 | ||
232 | #define MAS_CMD_READ_REG 0xa0 | ||
233 | #define MAS_CMD_WRITE_REG 0xb0 | ||
234 | #define MAS_CMD_READ_D0_MEM 0xc0 | ||
235 | #define MAS_CMD_READ_D1_MEM 0xd0 | ||
236 | #define MAS_CMD_WRITE_D0_MEM 0xe0 | ||
237 | #define MAS_CMD_WRITE_D1_MEM 0xf0 | ||
238 | |||
239 | /* MAS3587F D0 memory cells */ | ||
240 | #if CONFIG_CODEC == MAS3587F | ||
241 | #define MAS_D0_APP_SELECT 0x7f6 | ||
242 | #define MAS_D0_APP_RUNNING 0x7f7 | ||
243 | #define MAS_D0_ENCODER_CONTROL 0x7f0 | ||
244 | #define MAS_D0_IO_CONTROL_MAIN 0x7f1 | ||
245 | #define MAS_D0_INTERFACE_CONTROL 0x7f2 | ||
246 | #define MAS_D0_OFREQ_CONTROL 0x7f3 | ||
247 | #define MAS_D0_OUT_CLK_CONFIG 0x7f4 | ||
248 | #define MAS_D0_SPD_OUT_BITS 0x7f8 | ||
249 | #define MAS_D0_SOFT_MUTE 0x7f9 | ||
250 | #define MAS_D0_OUT_LL 0x7fc | ||
251 | #define MAS_D0_OUT_LR 0x7fd | ||
252 | #define MAS_D0_OUT_RL 0x7fe | ||
253 | #define MAS_D0_OUT_RR 0x7ff | ||
254 | #define MAS_D0_MPEG_FRAME_COUNT 0xfd0 | ||
255 | #define MAS_D0_MPEG_STATUS_1 0xfd1 | ||
256 | #define MAS_D0_MPEG_STATUS_2 0xfd2 | ||
257 | #define MAS_D0_CRC_ERROR_COUNT 0xfd3 | ||
258 | |||
259 | /* MAS3539F D0 memory cells */ | ||
260 | #elif CONFIG_CODEC == MAS3539F | ||
261 | #define MAS_D0_APP_SELECT 0x34b | ||
262 | #define MAS_D0_APP_RUNNING 0x34c | ||
263 | /* no encoder :( */ | ||
264 | #define MAS_D0_IO_CONTROL_MAIN 0x346 | ||
265 | #define MAS_D0_INTERFACE_CONTROL 0x347 | ||
266 | #define MAS_D0_OFREQ_CONTROL 0x348 | ||
267 | #define MAS_D0_OUT_CLK_CONFIG 0x349 | ||
268 | #define MAS_D0_SPD_OUT_BITS 0x351 | ||
269 | #define MAS_D0_SOFT_MUTE 0x350 | ||
270 | #define MAS_D0_OUT_LL 0x354 | ||
271 | #define MAS_D0_OUT_LR 0x355 | ||
272 | #define MAS_D0_OUT_RL 0x356 | ||
273 | #define MAS_D0_OUT_RR 0x357 | ||
274 | #define MAS_D0_MPEG_FRAME_COUNT 0xfd0 | ||
275 | #define MAS_D0_MPEG_STATUS_1 0xfd1 | ||
276 | #define MAS_D0_MPEG_STATUS_2 0xfd2 | ||
277 | #define MAS_D0_CRC_ERROR_COUNT 0xfd3 | ||
278 | #endif | ||
279 | |||
280 | /* Function prototypes */ | ||
281 | extern void audiohw_set_loudness(int value); | ||
282 | extern void audiohw_set_avc(int value); | ||
283 | extern void audiohw_set_mdb_strength(int value); | ||
284 | extern void audiohw_set_mdb_harmonics(int value); | ||
285 | extern void audiohw_set_mdb_center(int value); | ||
286 | extern void audiohw_set_mdb_shape(int value); | ||
287 | extern void audiohw_set_mdb_enable(int value); | ||
288 | extern void audiohw_set_superbass(int value); | ||
289 | |||
290 | #endif /* CONFIG_CODEC */ | ||
291 | |||
292 | #endif /* _MAS35XX_H */ | ||