aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc')
-rw-r--r--sound/soc/atmel/playpaq_wm8510.c471
-rw-r--r--sound/soc/codecs/Patch_base_jazz_Rate48_pps_driver.h96
-rw-r--r--sound/soc/codecs/Patch_base_main_Rate48_pps_driver.h96
-rw-r--r--sound/soc/codecs/Patch_base_pop_Rate48_pps_driver.h96
-rw-r--r--sound/soc/codecs/Patch_base_rock_Rate48_pps_driver.h96
-rw-r--r--sound/soc/codecs/ads117x.h13
-rw-r--r--sound/soc/codecs/aic326x_tiload.c312
-rw-r--r--sound/soc/codecs/aic326x_tiload.h36
-rw-r--r--sound/soc/codecs/base_main_Rate48_pps_driver.h5979
-rw-r--r--sound/soc/codecs/first_rate_pps_driver.h5959
-rw-r--r--sound/soc/codecs/rt5639.c2444
-rw-r--r--sound/soc/codecs/rt5639.h2104
-rw-r--r--sound/soc/codecs/rt5640.c2546
-rw-r--r--sound/soc/codecs/rt5640.h2098
-rw-r--r--sound/soc/codecs/second_rate_pps_driver.h3626
-rw-r--r--sound/soc/codecs/tlv320aic326x.c4528
-rw-r--r--sound/soc/codecs/tlv320aic326x.h684
-rw-r--r--sound/soc/codecs/tlv320aic326x_mini-dsp.c1796
-rw-r--r--sound/soc/codecs/tlv320aic326x_mini-dsp.h128
-rw-r--r--sound/soc/codecs/tlv320aic326x_minidsp_config.c495
-rw-r--r--sound/soc/codecs/wm8994-tables.c3147
-rw-r--r--sound/soc/ep93xx/Kconfig41
-rw-r--r--sound/soc/ep93xx/Makefile17
-rw-r--r--sound/soc/ep93xx/edb93xx.c142
-rw-r--r--sound/soc/ep93xx/ep93xx-ac97.c467
-rw-r--r--sound/soc/ep93xx/ep93xx-i2s.c483
-rw-r--r--sound/soc/ep93xx/ep93xx-pcm.c357
-rw-r--r--sound/soc/ep93xx/ep93xx-pcm.h20
-rw-r--r--sound/soc/ep93xx/simone.c91
-rw-r--r--sound/soc/ep93xx/snappercl15.c146
-rw-r--r--sound/soc/imx/Kconfig59
-rw-r--r--sound/soc/imx/Makefile19
-rw-r--r--sound/soc/imx/eukrea-tlv320.c131
-rw-r--r--sound/soc/imx/imx-pcm-dma-mx2.c341
-rw-r--r--sound/soc/imx/imx-pcm-fiq.c346
-rw-r--r--sound/soc/imx/imx-ssi.c778
-rw-r--r--sound/soc/imx/imx-ssi.h236
-rw-r--r--sound/soc/imx/mx27vis-aic32x4.c137
-rw-r--r--sound/soc/imx/phycore-ac97.c99
-rw-r--r--sound/soc/imx/wm1133-ev1.c303
-rw-r--r--sound/soc/omap/igep0020.c137
-rw-r--r--sound/soc/omap/mcpdm.c470
-rw-r--r--sound/soc/omap/mcpdm.h153
-rw-r--r--sound/soc/omap/omap3beagle.c149
-rw-r--r--sound/soc/omap/omap3evm.c135
-rw-r--r--sound/soc/omap/omap4-hdmi-card.c129
-rw-r--r--sound/soc/omap/overo.c139
-rw-r--r--sound/soc/omap/sdp4430.c223
-rw-r--r--sound/soc/samsung/speyside_wm8962.c270
-rw-r--r--sound/soc/sh/fsi-ak4642.c209
-rw-r--r--sound/soc/sh/fsi-da7210.c79
-rw-r--r--sound/soc/sh/fsi-hdmi.c127
-rw-r--r--sound/soc/tegra/tegra30_dam.c650
-rw-r--r--sound/soc/tegra/tegra30_dam.h163
-rw-r--r--sound/soc/tegra/tegra30_spdif.c505
-rw-r--r--sound/soc/tegra/tegra30_spdif.h777
-rw-r--r--sound/soc/tegra/tegra_aic326x.c1281
-rw-r--r--sound/soc/tegra/tegra_max98088.c1233
-rw-r--r--sound/soc/tegra/tegra_max98095.c723
-rw-r--r--sound/soc/tegra/tegra_p1852.c272
-rw-r--r--sound/soc/tegra/tegra_rt5640.c738
61 files changed, 49525 insertions, 0 deletions
diff --git a/sound/soc/atmel/playpaq_wm8510.c b/sound/soc/atmel/playpaq_wm8510.c
new file mode 100644
index 00000000000..1aac2f4dbcf
--- /dev/null
+++ b/sound/soc/atmel/playpaq_wm8510.c
@@ -0,0 +1,471 @@
1/* sound/soc/at32/playpaq_wm8510.c
2 * ASoC machine driver for PlayPaq using WM8510 codec
3 *
4 * Copyright (C) 2008 Long Range Systems
5 * Geoffrey Wossum <gwossum@acm.org>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 * This code is largely inspired by sound/soc/at91/eti_b1_wm8731.c
12 *
13 * NOTE: If you don't have the AT32 enhanced portmux configured (which
14 * isn't currently in the mainline or Atmel patched kernel), you will
15 * need to set the MCLK pin (PA30) to peripheral A in your board initialization
16 * code. Something like:
17 * at32_select_periph(GPIO_PIN_PA(30), GPIO_PERIPH_A, 0);
18 *
19 */
20
21/* #define DEBUG */
22
23#include <linux/module.h>
24#include <linux/moduleparam.h>
25#include <linux/kernel.h>
26#include <linux/errno.h>
27#include <linux/clk.h>
28#include <linux/timer.h>
29#include <linux/interrupt.h>
30#include <linux/platform_device.h>
31
32#include <sound/core.h>
33#include <sound/pcm.h>
34#include <sound/pcm_params.h>
35#include <sound/soc.h>
36
37#include <mach/at32ap700x.h>
38#include <mach/portmux.h>
39
40#include "../codecs/wm8510.h"
41#include "atmel-pcm.h"
42#include "atmel_ssc_dai.h"
43
44
45/*-------------------------------------------------------------------------*\
46 * constants
47\*-------------------------------------------------------------------------*/
48#define MCLK_PIN GPIO_PIN_PA(30)
49#define MCLK_PERIPH GPIO_PERIPH_A
50
51
52/*-------------------------------------------------------------------------*\
53 * data types
54\*-------------------------------------------------------------------------*/
55/* SSC clocking data */
56struct ssc_clock_data {
57 /* CMR div */
58 unsigned int cmr_div;
59
60 /* Frame period (as needed by xCMR.PERIOD) */
61 unsigned int period;
62
63 /* The SSC clock rate these settings where calculated for */
64 unsigned long ssc_rate;
65};
66
67
68/*-------------------------------------------------------------------------*\
69 * module data
70\*-------------------------------------------------------------------------*/
71static struct clk *_gclk0;
72static struct clk *_pll0;
73
74#define CODEC_CLK (_gclk0)
75
76
77/*-------------------------------------------------------------------------*\
78 * Sound SOC operations
79\*-------------------------------------------------------------------------*/
80#if defined CONFIG_SND_AT32_SOC_PLAYPAQ_SLAVE
81static struct ssc_clock_data playpaq_wm8510_calc_ssc_clock(
82 struct snd_pcm_hw_params *params,
83 struct snd_soc_dai *cpu_dai)
84{
85 struct at32_ssc_info *ssc_p = snd_soc_dai_get_drvdata(cpu_dai);
86 struct ssc_device *ssc = ssc_p->ssc;
87 struct ssc_clock_data cd;
88 unsigned int rate, width_bits, channels;
89 unsigned int bitrate, ssc_div;
90 unsigned actual_rate;
91
92
93 /*
94 * Figure out required bitrate
95 */
96 rate = params_rate(params);
97 channels = params_channels(params);
98 width_bits = snd_pcm_format_physical_width(params_format(params));
99 bitrate = rate * width_bits * channels;
100
101
102 /*
103 * Figure out required SSC divider and period for required bitrate
104 */
105 cd.ssc_rate = clk_get_rate(ssc->clk);
106 ssc_div = cd.ssc_rate / bitrate;
107 cd.cmr_div = ssc_div / 2;
108 if (ssc_div & 1) {
109 /* round cmr_div up */
110 cd.cmr_div++;
111 }
112 cd.period = width_bits - 1;
113
114
115 /*
116 * Find actual rate, compare to requested rate
117 */
118 actual_rate = (cd.ssc_rate / (cd.cmr_div * 2)) / (2 * (cd.period + 1));
119 pr_debug("playpaq_wm8510: Request rate = %u, actual rate = %u\n",
120 rate, actual_rate);
121
122
123 return cd;
124}
125#endif /* CONFIG_SND_AT32_SOC_PLAYPAQ_SLAVE */
126
127
128
129static int playpaq_wm8510_hw_params(struct snd_pcm_substream *substream,
130 struct snd_pcm_hw_params *params)
131{
132 struct snd_soc_pcm_runtime *rtd = substream->private_data;
133 struct snd_soc_dai *codec_dai = rtd->codec_dai;
134 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
135 struct at32_ssc_info *ssc_p = snd_soc_dai_get_drvdata(cpu_dai);
136 struct ssc_device *ssc = ssc_p->ssc;
137 unsigned int pll_out = 0, bclk = 0, mclk_div = 0;
138 int ret;
139
140
141 /* Due to difficulties with getting the correct clocks from the AT32's
142 * PLL0, we're going to let the CODEC be in charge of all the clocks
143 */
144#if !defined CONFIG_SND_AT32_SOC_PLAYPAQ_SLAVE
145 const unsigned int fmt = (SND_SOC_DAIFMT_I2S |
146 SND_SOC_DAIFMT_NB_NF |
147 SND_SOC_DAIFMT_CBM_CFM);
148#else
149 struct ssc_clock_data cd;
150 const unsigned int fmt = (SND_SOC_DAIFMT_I2S |
151 SND_SOC_DAIFMT_NB_NF |
152 SND_SOC_DAIFMT_CBS_CFS);
153#endif
154
155 if (ssc == NULL) {
156 pr_warning("playpaq_wm8510_hw_params: ssc is NULL!\n");
157 return -EINVAL;
158 }
159
160
161 /*
162 * Figure out PLL and BCLK dividers for WM8510
163 */
164 switch (params_rate(params)) {
165 case 48000:
166 pll_out = 24576000;
167 mclk_div = WM8510_MCLKDIV_2;
168 bclk = WM8510_BCLKDIV_8;
169 break;
170
171 case 44100:
172 pll_out = 22579200;
173 mclk_div = WM8510_MCLKDIV_2;
174 bclk = WM8510_BCLKDIV_8;
175 break;
176
177 case 22050:
178 pll_out = 22579200;
179 mclk_div = WM8510_MCLKDIV_4;
180 bclk = WM8510_BCLKDIV_8;
181 break;
182
183 case 16000:
184 pll_out = 24576000;
185 mclk_div = WM8510_MCLKDIV_6;
186 bclk = WM8510_BCLKDIV_8;
187 break;
188
189 case 11025:
190 pll_out = 22579200;
191 mclk_div = WM8510_MCLKDIV_8;
192 bclk = WM8510_BCLKDIV_8;
193 break;
194
195 case 8000:
196 pll_out = 24576000;
197 mclk_div = WM8510_MCLKDIV_12;
198 bclk = WM8510_BCLKDIV_8;
199 break;
200
201 default:
202 pr_warning("playpaq_wm8510: Unsupported sample rate %d\n",
203 params_rate(params));
204 return -EINVAL;
205 }
206
207
208 /*
209 * set CPU and CODEC DAI configuration
210 */
211 ret = snd_soc_dai_set_fmt(codec_dai, fmt);
212 if (ret < 0) {
213 pr_warning("playpaq_wm8510: "
214 "Failed to set CODEC DAI format (%d)\n",
215 ret);
216 return ret;
217 }
218 ret = snd_soc_dai_set_fmt(cpu_dai, fmt);
219 if (ret < 0) {
220 pr_warning("playpaq_wm8510: "
221 "Failed to set CPU DAI format (%d)\n",
222 ret);
223 return ret;
224 }
225
226
227 /*
228 * Set CPU clock configuration
229 */
230#if defined CONFIG_SND_AT32_SOC_PLAYPAQ_SLAVE
231 cd = playpaq_wm8510_calc_ssc_clock(params, cpu_dai);
232 pr_debug("playpaq_wm8510: cmr_div = %d, period = %d\n",
233 cd.cmr_div, cd.period);
234 ret = snd_soc_dai_set_clkdiv(cpu_dai, AT32_SSC_CMR_DIV, cd.cmr_div);
235 if (ret < 0) {
236 pr_warning("playpaq_wm8510: Failed to set CPU CMR_DIV (%d)\n",
237 ret);
238 return ret;
239 }
240 ret = snd_soc_dai_set_clkdiv(cpu_dai, AT32_SSC_TCMR_PERIOD,
241 cd.period);
242 if (ret < 0) {
243 pr_warning("playpaq_wm8510: "
244 "Failed to set CPU transmit period (%d)\n",
245 ret);
246 return ret;
247 }
248#endif /* CONFIG_SND_AT32_SOC_PLAYPAQ_SLAVE */
249
250
251 /*
252 * Set CODEC clock configuration
253 */
254 pr_debug("playpaq_wm8510: "
255 "pll_in = %ld, pll_out = %u, bclk = %x, mclk = %x\n",
256 clk_get_rate(CODEC_CLK), pll_out, bclk, mclk_div);
257
258
259#if !defined CONFIG_SND_AT32_SOC_PLAYPAQ_SLAVE
260 ret = snd_soc_dai_set_clkdiv(codec_dai, WM8510_BCLKDIV, bclk);
261 if (ret < 0) {
262 pr_warning
263 ("playpaq_wm8510: Failed to set CODEC DAI BCLKDIV (%d)\n",
264 ret);
265 return ret;
266 }
267#endif /* CONFIG_SND_AT32_SOC_PLAYPAQ_SLAVE */
268
269
270 ret = snd_soc_dai_set_pll(codec_dai, 0, 0,
271 clk_get_rate(CODEC_CLK), pll_out);
272 if (ret < 0) {
273 pr_warning("playpaq_wm8510: Failed to set CODEC DAI PLL (%d)\n",
274 ret);
275 return ret;
276 }
277
278
279 ret = snd_soc_dai_set_clkdiv(codec_dai, WM8510_MCLKDIV, mclk_div);
280 if (ret < 0) {
281 pr_warning("playpaq_wm8510: Failed to set CODEC MCLKDIV (%d)\n",
282 ret);
283 return ret;
284 }
285
286
287 return 0;
288}
289
290
291
292static struct snd_soc_ops playpaq_wm8510_ops = {
293 .hw_params = playpaq_wm8510_hw_params,
294};
295
296
297
298static const struct snd_soc_dapm_widget playpaq_dapm_widgets[] = {
299 SND_SOC_DAPM_MIC("Int Mic", NULL),
300 SND_SOC_DAPM_SPK("Ext Spk", NULL),
301};
302
303
304
305static const struct snd_soc_dapm_route intercon[] = {
306 /* speaker connected to SPKOUT */
307 {"Ext Spk", NULL, "SPKOUTP"},
308 {"Ext Spk", NULL, "SPKOUTN"},
309
310 {"Mic Bias", NULL, "Int Mic"},
311 {"MICN", NULL, "Mic Bias"},
312 {"MICP", NULL, "Mic Bias"},
313};
314
315
316
317static int playpaq_wm8510_init(struct snd_soc_pcm_runtime *rtd)
318{
319 struct snd_soc_codec *codec = rtd->codec;
320 struct snd_soc_dapm_context *dapm = &codec->dapm;
321 int i;
322
323 /*
324 * Add DAPM widgets
325 */
326 for (i = 0; i < ARRAY_SIZE(playpaq_dapm_widgets); i++)
327 snd_soc_dapm_new_control(dapm, &playpaq_dapm_widgets[i]);
328
329
330
331 /*
332 * Setup audio path interconnects
333 */
334 snd_soc_dapm_add_routes(dapm, intercon, ARRAY_SIZE(intercon));
335
336
337
338 /* always connected pins */
339 snd_soc_dapm_enable_pin(dapm, "Int Mic");
340 snd_soc_dapm_enable_pin(dapm, "Ext Spk");
341 snd_soc_dapm_sync(dapm);
342
343
344
345 /* Make CSB show PLL rate */
346 snd_soc_dai_set_clkdiv(rtd->codec_dai, WM8510_OPCLKDIV,
347 WM8510_OPCLKDIV_1 | 4);
348
349 return 0;
350}
351
352
353
354static struct snd_soc_dai_link playpaq_wm8510_dai = {
355 .name = "WM8510",
356 .stream_name = "WM8510 PCM",
357 .cpu_dai_name= "atmel-ssc-dai.0",
358 .platform_name = "atmel-pcm-audio",
359 .codec_name = "wm8510-codec.0-0x1a",
360 .codec_dai_name = "wm8510-hifi",
361 .init = playpaq_wm8510_init,
362 .ops = &playpaq_wm8510_ops,
363};
364
365
366
367static struct snd_soc_card snd_soc_playpaq = {
368 .name = "LRS_PlayPaq_WM8510",
369 .dai_link = &playpaq_wm8510_dai,
370 .num_links = 1,
371};
372
373static struct platform_device *playpaq_snd_device;
374
375
376static int __init playpaq_asoc_init(void)
377{
378 int ret = 0;
379
380 /*
381 * Configure MCLK for WM8510
382 */
383 _gclk0 = clk_get(NULL, "gclk0");
384 if (IS_ERR(_gclk0)) {
385 _gclk0 = NULL;
386 goto err_gclk0;
387 }
388 _pll0 = clk_get(NULL, "pll0");
389 if (IS_ERR(_pll0)) {
390 _pll0 = NULL;
391 goto err_pll0;
392 }
393 if (clk_set_parent(_gclk0, _pll0)) {
394 pr_warning("snd-soc-playpaq: "
395 "Failed to set PLL0 as parent for DAC clock\n");
396 goto err_set_clk;
397 }
398 clk_set_rate(CODEC_CLK, 12000000);
399 clk_enable(CODEC_CLK);
400
401#if defined CONFIG_AT32_ENHANCED_PORTMUX
402 at32_select_periph(MCLK_PIN, MCLK_PERIPH, 0);
403#endif
404
405
406 /*
407 * Create and register platform device
408 */
409 playpaq_snd_device = platform_device_alloc("soc-audio", 0);
410 if (playpaq_snd_device == NULL) {
411 ret = -ENOMEM;
412 goto err_device_alloc;
413 }
414
415 platform_set_drvdata(playpaq_snd_device, &snd_soc_playpaq);
416
417 ret = platform_device_add(playpaq_snd_device);
418 if (ret) {
419 pr_warning("playpaq_wm8510: platform_device_add failed (%d)\n",
420 ret);
421 goto err_device_add;
422 }
423
424 return 0;
425
426
427err_device_add:
428 if (playpaq_snd_device != NULL) {
429 platform_device_put(playpaq_snd_device);
430 playpaq_snd_device = NULL;
431 }
432err_device_alloc:
433err_set_clk:
434 if (_pll0 != NULL) {
435 clk_put(_pll0);
436 _pll0 = NULL;
437 }
438err_pll0:
439 if (_gclk0 != NULL) {
440 clk_put(_gclk0);
441 _gclk0 = NULL;
442 }
443 return ret;
444}
445
446
447static void __exit playpaq_asoc_exit(void)
448{
449 if (_gclk0 != NULL) {
450 clk_put(_gclk0);
451 _gclk0 = NULL;
452 }
453 if (_pll0 != NULL) {
454 clk_put(_pll0);
455 _pll0 = NULL;
456 }
457
458#if defined CONFIG_AT32_ENHANCED_PORTMUX
459 at32_free_pin(MCLK_PIN);
460#endif
461
462 platform_device_unregister(playpaq_snd_device);
463 playpaq_snd_device = NULL;
464}
465
466module_init(playpaq_asoc_init);
467module_exit(playpaq_asoc_exit);
468
469MODULE_AUTHOR("Geoffrey Wossum <gwossum@acm.org>");
470MODULE_DESCRIPTION("ASoC machine driver for LRS PlayPaq");
471MODULE_LICENSE("GPL");
diff --git a/sound/soc/codecs/Patch_base_jazz_Rate48_pps_driver.h b/sound/soc/codecs/Patch_base_jazz_Rate48_pps_driver.h
new file mode 100644
index 00000000000..bbea174e3d2
--- /dev/null
+++ b/sound/soc/codecs/Patch_base_jazz_Rate48_pps_driver.h
@@ -0,0 +1,96 @@
1/*
2 * linux/sound/soc/codecs/Patch_base_jazz_Rate48_pps_driver.h
3 *
4 *
5 * Copyright (C) 2011 Texas Instruments, Inc.
6 *
7 * This package is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
12 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
13 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
14 *
15*/
16
17reg_value jazz_A_reg_values[] = {
18};
19#define miniDSP_A_reg_values_COEFF_START 0
20#define miniDSP_A_reg_values_COEFF_SIZE 0
21#define miniDSP_A_reg_values_INST_START 0
22#define miniDSP_A_reg_values_INST_SIZE 0
23
24reg_value jazz_D_reg_values[] = {
25 {0, 0x0},
26 {0x7F, 0x50},
27 { 0, 0x01},
28 { 36, 0xB0},
29 { 37, 0x00},
30 { 38, 0x00},
31 { 39, 0x00},
32 { 40, 0xE0},
33 { 41, 0x00},
34 { 42, 0x00},
35 { 43, 0x00},
36 { 44, 0x08},
37 { 45, 0x00},
38 { 46, 0x00},
39 { 47, 0x00},
40 { 48, 0x40},
41 { 49, 0x00},
42 { 50, 0x00},
43 { 51, 0x00},
44 { 52, 0x58},
45 { 53, 0x00},
46 { 54, 0x00},
47 { 55, 0x00},
48 { 0, 0x09},
49 {100, 0xB0},
50 {101, 0x00},
51 {102, 0x00},
52 {103, 0x00},
53 {104, 0xE0},
54 {105, 0x00},
55 {106, 0x00},
56 {107, 0x00},
57 {108, 0x08},
58 {109, 0x00},
59 {110, 0x00},
60 {111, 0x00},
61 {112, 0x40},
62 {113, 0x00},
63 {114, 0x00},
64 {115, 0x00},
65 {116, 0x58},
66 {117, 0x00},
67 {118, 0x00},
68 {119, 0x00},
69 { 0, 0x0},
70 { 0x7F, 0x3C},
71 { 0, 0x01},
72 { 24, 0xB0},
73 { 25, 0x00},
74 { 26, 0x00},
75 { 27, 0x00},
76 { 28, 0xE0},
77 { 29, 0x00},
78 { 30, 0x00},
79 { 31, 0x00},
80 { 32, 0x08},
81 { 33, 0x00},
82 { 34, 0x00},
83 { 35, 0x00},
84 { 36, 0x40},
85 { 37, 0x00},
86 { 38, 0x00},
87 { 39, 0x00},
88 { 40, 0x58},
89 { 41, 0x00},
90 { 42, 0x00},
91 { 43, 0x00},
92};
93#define miniDSP_D_reg_values_COEFF_START 0
94#define miniDSP_D_reg_values_COEFF_SIZE 67
95#define miniDSP_D_reg_values_INST_START 67
96#define miniDSP_D_reg_values_INST_SIZE 0
diff --git a/sound/soc/codecs/Patch_base_main_Rate48_pps_driver.h b/sound/soc/codecs/Patch_base_main_Rate48_pps_driver.h
new file mode 100644
index 00000000000..80cc3416c34
--- /dev/null
+++ b/sound/soc/codecs/Patch_base_main_Rate48_pps_driver.h
@@ -0,0 +1,96 @@
1/*
2 * linux/sound/soc/codecs/Patch_base_main_Rate48_pps_driver.h
3 *
4 *
5 * Copyright (C) 2011 Texas Instruments, Inc.
6 *
7 * This package is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
12 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
13 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
14 *
15*/
16
17reg_value main_A_reg_values[] = {
18};
19#define miniDSP_A_reg_values_COEFF_START 0
20#define miniDSP_A_reg_values_COEFF_SIZE 0
21#define miniDSP_A_reg_values_INST_START 0
22#define miniDSP_A_reg_values_INST_SIZE 0
23
24reg_value main_D_reg_values[] = {
25 { 0, 0x0},
26 { 0x7F, 0x50},
27 { 0, 0x01},
28 { 36, 0x00},
29 { 37, 0x00},
30 { 38, 0x00},
31 { 39, 0x00},
32 { 40, 0x00},
33 { 41, 0x00},
34 { 42, 0x00},
35 { 43, 0x00},
36 { 44, 0x00},
37 { 45, 0x00},
38 { 46, 0x00},
39 { 47, 0x00},
40 { 48, 0x00},
41 { 49, 0x00},
42 { 50, 0x00},
43 { 51, 0x00},
44 { 52, 0x00},
45 { 53, 0x00},
46 { 54, 0x00},
47 { 55, 0x00},
48 { 0, 0x09},
49 {100, 0x00},
50 {101, 0x00},
51 {102, 0x00},
52 {103, 0x00},
53 {104, 0x00},
54 {105, 0x00},
55 {106, 0x00},
56 {107, 0x00},
57 {108, 0x00},
58 {109, 0x00},
59 {110, 0x00},
60 {111, 0x00},
61 {112, 0x00},
62 {113, 0x00},
63 {114, 0x00},
64 {115, 0x00},
65 {116, 0x00},
66 {117, 0x00},
67 {118, 0x00},
68 {119, 0x00},
69 { 0, 0x0},
70 { 0x7F, 0x3C},
71 { 0, 0x01},
72 { 24, 0x00},
73 { 25, 0x00},
74 { 26, 0x00},
75 { 27, 0x00},
76 { 28, 0x00},
77 { 29, 0x00},
78 { 30, 0x00},
79 { 31, 0x00},
80 { 32, 0x00},
81 { 33, 0x00},
82 { 34, 0x00},
83 { 35, 0x00},
84 { 36, 0x00},
85 { 37, 0x00},
86 { 38, 0x00},
87 { 39, 0x00},
88 { 40, 0x00},
89 { 41, 0x00},
90 { 42, 0x00},
91 { 43, 0x00},
92};
93#define miniDSP_D_reg_values_COEFF_START 0
94#define miniDSP_D_reg_values_COEFF_SIZE 67
95#define miniDSP_D_reg_values_INST_START 67
96#define miniDSP_D_reg_values_INST_SIZE 0
diff --git a/sound/soc/codecs/Patch_base_pop_Rate48_pps_driver.h b/sound/soc/codecs/Patch_base_pop_Rate48_pps_driver.h
new file mode 100644
index 00000000000..c2c3d0a1df8
--- /dev/null
+++ b/sound/soc/codecs/Patch_base_pop_Rate48_pps_driver.h
@@ -0,0 +1,96 @@
1/*
2 * linux/sound/soc/codecs/Patch_base_pop_Rate48_pps_driver.h
3 *
4 *
5 * Copyright (C) 2011 Texas Instruments, Inc.
6 *
7 * This package is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
12 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
13 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
14 *
15*/
16
17reg_value pop_A_reg_values[] = {
18};
19#define miniDSP_A_reg_values_COEFF_START 0
20#define miniDSP_A_reg_values_COEFF_SIZE 0
21#define miniDSP_A_reg_values_INST_START 0
22#define miniDSP_A_reg_values_INST_SIZE 0
23
24reg_value pop_D_reg_values[] = {
25 { 0, 0x0},
26 { 0x7F, 0x50},
27 { 0, 0x01},
28 { 36, 0x40},
29 { 37, 0x00},
30 { 38, 0x00},
31 { 39, 0x00},
32 { 40, 0x20},
33 { 41, 0x00},
34 { 42, 0x00},
35 { 43, 0x00},
36 { 44, 0x00},
37 { 45, 0x00},
38 { 46, 0x00},
39 { 47, 0x00},
40 { 48, 0xD8},
41 { 49, 0x00},
42 { 50, 0x00},
43 { 51, 0x00},
44 { 52, 0xB0},
45 { 53, 0x00},
46 { 54, 0x00},
47 { 55, 0x00},
48 { 0, 0x09},
49 {100, 0x40},
50 {101, 0x00},
51 {102, 0x00},
52 {103, 0x00},
53 {104, 0x20},
54 {105, 0x00},
55 {106, 0x00},
56 {107, 0x00},
57 {108, 0x00},
58 {109, 0x00},
59 {110, 0x00},
60 {111, 0x00},
61 {112, 0xD8},
62 {113, 0x00},
63 {114, 0x00},
64 {115, 0x00},
65 {116, 0xB0},
66 {117, 0x00},
67 {118, 0x00},
68 {119, 0x00},
69 { 0, 0x0},
70 { 0x7F, 0x3C},
71 { 0, 0x01},
72 { 24, 0x40},
73 { 25, 0x00},
74 { 26, 0x00},
75 { 27, 0x00},
76 { 28, 0x20},
77 { 29, 0x00},
78 { 30, 0x00},
79 { 31, 0x00},
80 { 32, 0x00},
81 { 33, 0x00},
82 { 34, 0x00},
83 { 35, 0x00},
84 { 36, 0xD8},
85 { 37, 0x00},
86 { 38, 0x00},
87 { 39, 0x00},
88 { 40, 0xB0},
89 { 41, 0x00},
90 { 42, 0x00},
91 { 43, 0x00},
92};
93#define miniDSP_D_reg_values_COEFF_START 0
94#define miniDSP_D_reg_values_COEFF_SIZE 67
95#define miniDSP_D_reg_values_INST_START 67
96#define miniDSP_D_reg_values_INST_SIZE 0
diff --git a/sound/soc/codecs/Patch_base_rock_Rate48_pps_driver.h b/sound/soc/codecs/Patch_base_rock_Rate48_pps_driver.h
new file mode 100644
index 00000000000..954c7c37478
--- /dev/null
+++ b/sound/soc/codecs/Patch_base_rock_Rate48_pps_driver.h
@@ -0,0 +1,96 @@
1/*
2 * linux/sound/soc/codecs/Patch_base_rock_Rate48_pps_driver.h
3 *
4 *
5 * Copyright (C) 2011 Texas Instruments, Inc.
6 *
7 * This package is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
12 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
13 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
14 *
15*/
16
17reg_value rock_A_reg_values[] = {
18};
19#define miniDSP_A_reg_values_COEFF_START 0
20#define miniDSP_A_reg_values_COEFF_SIZE 0
21#define miniDSP_A_reg_values_INST_START 0
22#define miniDSP_A_reg_values_INST_SIZE 0
23
24reg_value rock_D_reg_values[] = {
25 { 0, 0x0},
26 { 0x7F, 0x50},
27 { 0, 0x01},
28 { 36, 0x58},
29 { 37, 0x00},
30 { 38, 0x00},
31 { 39, 0x00},
32 { 40, 0x30},
33 { 41, 0x00},
34 { 42, 0x00},
35 { 43, 0x00},
36 { 44, 0xD8},
37 { 45, 0x00},
38 { 46, 0x00},
39 { 47, 0x00},
40 { 48, 0xF0},
41 { 49, 0x00},
42 { 50, 0x00},
43 { 51, 0x00},
44 { 52, 0x60},
45 { 53, 0x00},
46 { 54, 0x00},
47 { 55, 0x00},
48 { 0, 0x09},
49 {100, 0x58},
50 {101, 0x00},
51 {102, 0x00},
52 {103, 0x00},
53 {104, 0x30},
54 {105, 0x00},
55 {106, 0x00},
56 {107, 0x00},
57 {108, 0xD8},
58 {109, 0x00},
59 {110, 0x00},
60 {111, 0x00},
61 {112, 0xF0},
62 {113, 0x00},
63 {114, 0x00},
64 {115, 0x00},
65 {116, 0x60},
66 {117, 0x00},
67 {118, 0x00},
68 {119, 0x00},
69 { 0, 0x0},
70 { 0x7F, 0x3C},
71 { 0, 0x01},
72 { 24, 0x58},
73 { 25, 0x00},
74 { 26, 0x00},
75 { 27, 0x00},
76 { 28, 0x30},
77 { 29, 0x00},
78 { 30, 0x00},
79 { 31, 0x00},
80 { 32, 0xD8},
81 { 33, 0x00},
82 { 34, 0x00},
83 { 35, 0x00},
84 { 36, 0xF0},
85 { 37, 0x00},
86 { 38, 0x00},
87 { 39, 0x00},
88 { 40, 0x60},
89 { 41, 0x00},
90 { 42, 0x00},
91 { 43, 0x00},
92};
93#define miniDSP_D_reg_values_COEFF_START 0
94#define miniDSP_D_reg_values_COEFF_SIZE 67
95#define miniDSP_D_reg_values_INST_START 67
96#define miniDSP_D_reg_values_INST_SIZE 0
diff --git a/sound/soc/codecs/ads117x.h b/sound/soc/codecs/ads117x.h
new file mode 100644
index 00000000000..3ce02861400
--- /dev/null
+++ b/sound/soc/codecs/ads117x.h
@@ -0,0 +1,13 @@
1/*
2 * ads117x.h -- Driver for ads1174/8 ADC chips
3 *
4 * Copyright 2009 ShotSpotter Inc.
5 * Author: Graeme Gregory <gg@slimlogic.co.uk>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 */
12extern struct snd_soc_dai_driver ads117x_dai;
13extern struct snd_soc_codec_driver soc_codec_dev_ads117x;
diff --git a/sound/soc/codecs/aic326x_tiload.c b/sound/soc/codecs/aic326x_tiload.c
new file mode 100644
index 00000000000..00aa4d4ce7d
--- /dev/null
+++ b/sound/soc/codecs/aic326x_tiload.c
@@ -0,0 +1,312 @@
1/*
2 * linux/sound/soc/codecs/AIC3262_tiload.c
3 *
4 *
5 * Copyright (C) 2010 Texas Instruments, Inc.
6 *
7 *
8 *
9 * This package is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 *
13 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
14 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
15 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
16 *
17 * History:
18 *
19 * Rev 0.1 Tiload support 16-09-2010
20 *
21 * The Tiload programming support is added to AIC3262.
22 *
23 */
24
25#include <linux/module.h>
26#include <linux/moduleparam.h>
27#include <linux/init.h>
28#include <linux/kernel.h>
29#include <linux/fs.h>
30#include <linux/types.h>
31#include <linux/kdev_t.h>
32#include <linux/cdev.h>
33#include <linux/device.h>
34#include <asm/io.h>
35#include <linux/delay.h>
36#include <linux/i2c.h>
37#include <linux/platform_device.h>
38#include <sound/soc.h>
39#include <sound/control.h>
40
41#include "tlv320aic326x.h"
42#include "aic326x_tiload.h"
43
44/* enable debug prints in the driver */
45#define DEBUG
46//#undef DEBUG
47
48#ifdef DEBUG
49#define dprintk(x...) printk(x)
50#else
51#define dprintk(x...)
52#endif
53
54#ifdef AIC3262_TiLoad
55
56/* Function prototypes */
57#ifdef REG_DUMP_aic3262
58static void aic3262_dump_page(struct i2c_client *i2c, u8 page);
59#endif
60
61/* externs */
62extern int aic3262_change_page(struct snd_soc_codec *codec, u8 new_page);
63extern int aic3262_change_book(struct snd_soc_codec *codec, u8 new_book);
64extern int aic3262_write(struct snd_soc_codec *codec, u16 reg, u8 value);
65int aic3262_driver_init(struct snd_soc_codec *codec);
66/************** Dynamic aic3262 driver, TI LOAD support ***************/
67
68static struct cdev *aic3262_cdev;
69static int aic3262_major = 0; /* Dynamic allocation of Mjr No. */
70static int aic3262_opened = 0; /* Dynamic allocation of Mjr No. */
71static struct snd_soc_codec *aic3262_codec;
72struct class *tiload_class;
73static unsigned int magic_num = 0xE0;
74
75/******************************** Debug section *****************************/
76
77#ifdef REG_DUMP_aic3262
78/*
79 *----------------------------------------------------------------------------
80 * Function : aic3262_dump_page
81 * Purpose : Read and display one codec register page, for debugging purpose
82 *----------------------------------------------------------------------------
83 */
84static void aic3262_dump_page(struct i2c_client *i2c, u8 page)
85{
86 int i;
87 u8 data;
88 u8 test_page_array[8];
89
90 dprintk("TiLoad DRIVER : %s\n", __FUNCTION__);
91 aic3262_change_page(codec, page);
92
93 data = 0x0;
94
95 i2c_master_send(i2c, data, 1);
96 i2c_master_recv(i2c, test_page_array, 8);
97
98 printk("\n------- aic3262 PAGE %d DUMP --------\n", page);
99 for (i = 0; i < 8; i++) {
100 printk(" [ %d ] = 0x%x\n", i, test_page_array[i]);
101 }
102}
103#endif
104
105/*
106 *----------------------------------------------------------------------------
107 * Function : tiload_open
108 *
109 * Purpose : open method for aic3262-tiload programming interface
110 *----------------------------------------------------------------------------
111 */
112static int tiload_open(struct inode *in, struct file *filp)
113{
114 dprintk("TiLoad DRIVER : %s\n", __FUNCTION__);
115 if (aic3262_opened) {
116 printk("%s device is already opened\n", "aic3262");
117 printk("%s: only one instance of driver is allowed\n",
118 "aic3262");
119 return -1;
120 }
121 aic3262_opened++;
122 return 0;
123}
124
125/*
126 *----------------------------------------------------------------------------
127 * Function : tiload_release
128 *
129 * Purpose : close method for aic3262_tilaod programming interface
130 *----------------------------------------------------------------------------
131 */
132static int tiload_release(struct inode *in, struct file *filp)
133{
134 dprintk("TiLoad DRIVER : %s\n", __FUNCTION__);
135 aic3262_opened--;
136 return 0;
137}
138
139/*
140 *----------------------------------------------------------------------------
141 * Function : tiload_read
142 *
143 * Purpose : read method for mini dsp programming interface
144 *----------------------------------------------------------------------------
145 */
146static ssize_t tiload_read(struct file *file, char __user * buf,
147 size_t count, loff_t * offset)
148{
149 static char rd_data[8];
150 char reg_addr;
151 size_t size;
152 #ifdef DEBUG
153 int i;
154 #endif
155 struct i2c_client *i2c = aic3262_codec->control_data;
156
157 dprintk("TiLoad DRIVER : %s\n", __FUNCTION__);
158 if (count > 128) {
159 printk("Max 128 bytes can be read\n");
160 count = 128;
161 }
162
163 /* copy register address from user space */
164 size = copy_from_user(&reg_addr, buf, 1);
165 if (size != 0) {
166 printk("read: copy_from_user failure\n");
167 return -1;
168 }
169 /* Send the address to device thats is to be read */
170
171 if (i2c_master_send(i2c, &reg_addr, 1) != 1) {
172 dprintk("Can not write register address\n");
173 return -1;
174 }
175 /* read the codec device registers */
176 size = i2c_master_recv(i2c, rd_data, count);
177#ifdef DEBUG
178 printk(KERN_ERR "read size = %d, reg_addr= %x , count = %d\n",
179 (int)size, reg_addr, (int)count);
180 for (i = 0; i < (int)size; i++) {
181 printk(KERN_ERR "rd_data[%d]=%x\n", i, rd_data[i]);
182 }
183#endif
184 if (size != count) {
185 printk("read %d registers from the codec\n", size);
186 }
187
188 if (copy_to_user(buf, rd_data, size) != 0) {
189 dprintk("copy_to_user failed\n");
190 return -1;
191 }
192
193 return size;
194}
195
196/*
197 *----------------------------------------------------------------------------
198 * Function : tiload_write
199 *
200 * Purpose : write method for aic3262_tiload programming interface
201 *----------------------------------------------------------------------------
202 */
203static ssize_t tiload_write(struct file *file, const char __user * buf,
204 size_t count, loff_t * offset)
205{
206 static char wr_data[8];
207 u8 pg_no;
208 #ifdef DEBUG
209 int i;
210 #endif
211 struct i2c_client *i2c = aic3262_codec->control_data;
212 struct aic3262_priv *aic3262_private = snd_soc_codec_get_drvdata(aic3262_codec);
213
214 dprintk("TiLoad DRIVER : %s\n", __FUNCTION__);
215 /* copy buffer from user space */
216 if (copy_from_user(wr_data, buf, count)) {
217 printk("copy_from_user failure\n");
218 return -1;
219 }
220#ifdef DEBUG
221 printk(KERN_ERR "write size = %d\n", (int)count);
222 for (i = 0; i < (int)count; i++) {
223 printk(KERN_INFO "\nwr_data[%d]=%x\n", i, wr_data[i]);
224 }
225#endif
226 if (wr_data[0] == 0) {
227 aic3262_change_page(aic3262_codec, wr_data[1]);
228 return count;
229 }
230 pg_no = aic3262_private->page_no;
231
232 if ((wr_data[0] == 127) && (pg_no == 0)) {
233 aic3262_change_book(aic3262_codec, wr_data[1]);
234 return count;
235 }
236 return i2c_master_send(i2c, wr_data, count);
237}
238
239static int tiload_ioctl( struct file *filp,
240 unsigned int cmd, unsigned long arg)
241{
242 int num = 0;
243 void __user *argp = (void __user *)arg;
244 if (_IOC_TYPE(cmd) != aic3262_IOC_MAGIC)
245 return -ENOTTY;
246
247 dprintk("TiLoad DRIVER : %s\n", __FUNCTION__);
248 switch (cmd) {
249 case aic3262_IOMAGICNUM_GET:
250 num = copy_to_user(argp, &magic_num, sizeof(int));
251 break;
252 case aic3262_IOMAGICNUM_SET:
253 num = copy_from_user(&magic_num, argp, sizeof(int));
254 break;
255 }
256 return num;
257}
258
259/*********** File operations structure for aic3262-tiload programming *************/
260static struct file_operations aic3262_fops = {
261 .owner = THIS_MODULE,
262 .open = tiload_open,
263 .release = tiload_release,
264 .read = tiload_read,
265 .write = tiload_write,
266 .unlocked_ioctl = tiload_ioctl,
267};
268
269/*
270 *----------------------------------------------------------------------------
271 * Function : aic3262_driver_init
272 *
273 * Purpose : Register a char driver for dynamic aic3262-tiload programming
274 *----------------------------------------------------------------------------
275 */
276int aic3262_driver_init(struct snd_soc_codec *codec)
277{
278 int result;
279
280 dev_t dev = MKDEV(aic3262_major, 0);
281 printk("TiLoad DRIVER : %s\n", __FUNCTION__);
282 aic3262_codec = codec;
283
284 printk("allocating dynamic major number\n");
285
286 result = alloc_chrdev_region(&dev, 0, 1, DEVICE_NAME);
287 if (result < 0) {
288 printk("cannot allocate major number %d\n", aic3262_major);
289 return result;
290 }
291 tiload_class = class_create(THIS_MODULE, DEVICE_NAME);
292 aic3262_major = MAJOR(dev);
293 printk("allocated Major Number: %d\n", aic3262_major);
294
295 aic3262_cdev = cdev_alloc();
296 cdev_init(aic3262_cdev, &aic3262_fops);
297 aic3262_cdev->owner = THIS_MODULE;
298 aic3262_cdev->ops = &aic3262_fops;
299
300 if (cdev_add(aic3262_cdev, dev, 1) < 0) {
301 dprintk("aic3262_driver: cdev_add failed \n");
302 unregister_chrdev_region(dev, 1);
303 aic3262_cdev = NULL;
304 return 1;
305 }
306 printk("Registered aic3262 TiLoad driver, Major number: %d \n",
307 aic3262_major);
308 //class_device_create(tiload_class, NULL, dev, NULL, DEVICE_NAME, 0);
309 return 0;
310}
311
312#endif
diff --git a/sound/soc/codecs/aic326x_tiload.h b/sound/soc/codecs/aic326x_tiload.h
new file mode 100644
index 00000000000..6621a4127b1
--- /dev/null
+++ b/sound/soc/codecs/aic326x_tiload.h
@@ -0,0 +1,36 @@
1/*
2 * linux/sound/soc/codecs/aic3262_tiload.h
3 *
4 *
5 * Copyright (C) 2012 Texas Instruments, Inc.
6 *
7 *
8 *
9 * This package is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 *
13 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
14 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
15 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
16 *
17 * History:
18 *
19 *
20 *
21 *
22 */
23
24#ifndef _AIC3262_TILOAD_H
25#define _AIC3262_TILOAD_H
26
27/* typedefs required for the included header files */
28typedef char *string;
29
30/* defines */
31#define DEVICE_NAME "tiload_node"
32#define aic3262_IOC_MAGIC 0xE0
33#define aic3262_IOMAGICNUM_GET _IOR(aic3262_IOC_MAGIC, 1, int)
34#define aic3262_IOMAGICNUM_SET _IOW(aic3262_IOC_MAGIC, 2, int)
35
36#endif
diff --git a/sound/soc/codecs/base_main_Rate48_pps_driver.h b/sound/soc/codecs/base_main_Rate48_pps_driver.h
new file mode 100644
index 00000000000..4d6f227cc42
--- /dev/null
+++ b/sound/soc/codecs/base_main_Rate48_pps_driver.h
@@ -0,0 +1,5979 @@
1static control base_speaker_SRS_MUX_controls[] = {
2/*{4,28,1,0},
3{4,36,1,1},
4{4,112,1,2}*/
5};
6
7static char * base_speaker_SRS_MUX_control_names[] = {
8/*"Stereo_Mux_1",
9"Stereo_Mux_3",
10"Stereo_Mux_4"*/
11};
12
13static control base_speaker_SRS_VOLUME_controls[] = {
14};
15
16static char * base_speaker_SRS_VOLUME_control_names[] = {
17};
18
19/*//INSTRUCTIONS & COEFFICIENTS
20typedef struct {
21 u8 reg_off;
22 u8 reg_val;
23} reg_value;*/
24
25static char * base_speaker_SRS_REG_Section_names[] = {
26 "miniDSP_A_reg_values",
27 "miniDSP_D_reg_values",
28};
29
30reg_value base_speaker_SRS_REG_init_Section_program[] = {
31 { 0,0x0},
32 { 0x7F,0x00},
33// # Set AutoINC
34 {121,0x01},
35 { 0x7F,0x78},
36// # reg[120][0][50] = 0x88 ; Interpolation Ratio is 8, FIFO = Enabled
37 { 50,0x88},
38 { 0x7F,0x64},
39// # reg[100][0][50] = 0xa4 ; Decimation Ratio is 4, CIC AutoNorm = Enabled, FIFO = Enabled
40 { 50,0xA4},
41 { 0x7F,0x78},
42// # reg[120][0][24]=0x80
43 { 24,0x80},
44};
45
46reg_value base_speaker_SRS_REG_post_Section_program[] = {
47 { 0,0x0},
48 { 0x7F,0x28},
49// # reg[40][0][1] = 0x04 ; adaptive mode for ADC
50 { 1,0x04},
51 { 0x7F,0x50},
52// # reg[80][0][1] = 0x04 ; adaptive mode for DAC
53 { 1,0x04},
54 { 0x7F,0x64},
55// # reg[100][0][48] = 4
56 { 48,0x04},
57// # reg[100][0][49] = 0
58 { 49,0x00},
59 { 0x7F,0x78},
60// # reg[120][0][48] = 4
61 { 48,0x04},
62// # reg[120][0][49] = 0
63 { 49,0x00},
64 { 0x7F,0x64},
65// # reg[100][0][20] = 0x00 ; Disable ADC double buffer mode
66 { 20,0x00},
67 { 0x7F,0x78},
68// # reg[120][0][20] = 0x00 ; Disable DAC double buffer mode
69 { 20,0x00},
70
71};
72
73reg_value base_speaker_SRS_miniDSP_A_reg_values[] = {
74 { 0,0x0},
75 { 0x7F,0x28},
76 { 0,0x01},
77 { 8,0x00},
78 { 9,0xA7},
79 { 10,0xF8},
80 { 11,0x00},
81 { 12,0x7E},
82 { 13,0xB0},
83 { 14,0x10},
84 { 15,0x00},
85 { 16,0x7F},
86 { 17,0xFF},
87 { 18,0xFF},
88 { 19,0x00},
89 { 20,0x00},
90 { 21,0x00},
91 { 22,0x00},
92 { 23,0x00},
93 { 24,0x00},
94 { 25,0x00},
95 { 26,0x00},
96 { 27,0x00},
97 { 28,0xFF},
98 { 29,0xFF},
99 { 30,0xFF},
100 { 31,0x00},
101 { 32,0x80},
102 { 33,0x00},
103 { 34,0x00},
104 { 35,0x00},
105 { 36,0x7F},
106 { 37,0xFF},
107 { 38,0xFF},
108 { 39,0x00},
109 { 40,0x40},
110 { 41,0x00},
111 { 42,0x00},
112 { 43,0x00},
113 { 44,0x00},
114 { 45,0x00},
115 { 46,0x00},
116 { 47,0x00},
117 { 48,0xFF},
118 { 49,0x9E},
119 { 50,0x00},
120 { 51,0x00},
121 { 52,0xF7},
122 { 53,0x10},
123 { 54,0x00},
124 { 55,0x00},
125 { 56,0x26},
126 { 57,0xF0},
127 { 58,0x00},
128 { 59,0x00},
129 { 60,0x02},
130 { 61,0x61},
131 { 62,0x00},
132 { 63,0x00},
133 { 64,0x40},
134 { 65,0x02},
135 { 66,0x00},
136 { 67,0x00},
137 { 68,0xFF},
138 { 69,0xFC},
139 { 70,0x00},
140 { 71,0x00},
141 { 72,0xFF},
142 { 73,0xFD},
143 { 74,0x00},
144 { 75,0x00},
145 { 76,0xFF},
146 { 77,0xE5},
147 { 78,0x00},
148 { 79,0x00},
149 { 80,0xFF},
150 { 81,0xA7},
151 { 82,0x00},
152 { 83,0x00},
153 { 84,0xFF},
154 { 85,0xC7},
155 { 86,0x00},
156 { 87,0x00},
157 { 88,0xFF},
158 { 89,0xCE},
159 { 90,0x00},
160 { 91,0x00},
161 { 92,0xFF},
162 { 93,0xFE},
163 { 94,0x00},
164 { 95,0x00},
165 { 96,0xFE},
166 { 97,0xF7},
167 { 98,0x00},
168 { 99,0x00},
169 {100,0xFF},
170 {101,0x46},
171 {102,0x00},
172 {103,0x00},
173 {104,0xFF},
174 {105,0x22},
175 {106,0x00},
176 {107,0x00},
177 {108,0x7F},
178 {109,0xFF},
179 {110,0xFF},
180 {111,0x00},
181 {112,0x00},
182 {113,0x00},
183 {114,0x00},
184 {115,0x00},
185 {116,0x00},
186 {117,0x00},
187 {118,0x00},
188 {119,0x00},
189 {120,0x00},
190 {121,0x00},
191 {122,0x00},
192 {123,0x00},
193 {124,0x00},
194 {125,0x00},
195 {126,0x00},
196 {127,0x00},
197 { 0,0x02},
198 { 8,0xFF},
199 { 9,0x0F},
200 { 10,0x00},
201 { 11,0x00},
202 { 12,0xFA},
203 { 13,0x8C},
204 { 14,0x00},
205 { 15,0x00},
206 { 16,0xF5},
207 { 17,0x08},
208 { 18,0x00},
209 { 19,0x00},
210 { 20,0xFD},
211 { 21,0x92},
212 { 22,0x00},
213 { 23,0x00},
214 { 24,0xF3},
215 { 25,0xA3},
216 { 26,0x00},
217 { 27,0x00},
218 { 28,0x03},
219 { 29,0xB3},
220 { 30,0x00},
221 { 31,0x00},
222 { 32,0x00},
223 { 33,0x33},
224 { 34,0x00},
225 { 35,0x00},
226 { 36,0x00},
227 { 37,0x71},
228 { 38,0x00},
229 { 39,0x00},
230 { 40,0x40},
231 { 41,0x60},
232 { 42,0x00},
233 { 43,0x00},
234 { 44,0x00},
235 { 45,0xE2},
236 { 46,0x00},
237 { 47,0x00},
238 { 48,0x00},
239 { 49,0xC6},
240 { 50,0x00},
241 { 51,0x00},
242 { 52,0x00},
243 { 53,0x87},
244 { 54,0x00},
245 { 55,0x00},
246 { 56,0x00},
247 { 57,0x0F},
248 { 58,0x00},
249 { 59,0x00},
250 { 60,0x00},
251 { 61,0x0A},
252 { 62,0x00},
253 { 63,0x00},
254 { 64,0x00},
255 { 65,0x02},
256 { 66,0x00},
257 { 67,0x00},
258 { 68,0x01},
259 { 69,0x81},
260 { 70,0x00},
261 { 71,0x00},
262 { 72,0x18},
263 { 73,0x89},
264 { 74,0x00},
265 { 75,0x00},
266 { 76,0x07},
267 { 77,0xFB},
268 { 78,0x00},
269 { 79,0x00},
270 { 80,0x03},
271 { 81,0xBE},
272 { 82,0x00},
273 { 83,0x00},
274 { 0,0x09},
275 { 72,0x00},
276 { 73,0xA7},
277 { 74,0xF8},
278 { 75,0x00},
279 { 76,0x7E},
280 { 77,0xB0},
281 { 78,0x10},
282 { 79,0x00},
283 { 80,0x7F},
284 { 81,0xFF},
285 { 82,0xFF},
286 { 83,0x00},
287 { 84,0x00},
288 { 85,0x00},
289 { 86,0x00},
290 { 87,0x00},
291 { 88,0x00},
292 { 89,0x00},
293 { 90,0x00},
294 { 91,0x00},
295 { 92,0xFF},
296 { 93,0xFF},
297 { 94,0xFF},
298 { 95,0x00},
299 { 96,0x80},
300 { 97,0x00},
301 { 98,0x00},
302 { 99,0x00},
303 {100,0x7F},
304 {101,0xFF},
305 {102,0xFF},
306 {103,0x00},
307 {104,0x40},
308 {105,0x00},
309 {106,0x00},
310 {107,0x00},
311 {108,0x00},
312 {109,0x00},
313 {110,0x00},
314 {111,0x00},
315 {112,0xFF},
316 {113,0x9E},
317 {114,0x00},
318 {115,0x00},
319 {116,0xF7},
320 {117,0x10},
321 {118,0x00},
322 {119,0x00},
323 {120,0x26},
324 {121,0xF0},
325 {122,0x00},
326 {123,0x00},
327 {124,0x02},
328 {125,0x61},
329 {126,0x00},
330 {127,0x00},
331 { 0,0x0A},
332 { 8,0x40},
333 { 9,0x02},
334 { 10,0x00},
335 { 11,0x00},
336 { 12,0xFF},
337 { 13,0xFC},
338 { 14,0x00},
339 { 15,0x00},
340 { 16,0xFF},
341 { 17,0xFD},
342 { 18,0x00},
343 { 19,0x00},
344 { 20,0xFF},
345 { 21,0xE5},
346 { 22,0x00},
347 { 23,0x00},
348 { 24,0xFF},
349 { 25,0xA7},
350 { 26,0x00},
351 { 27,0x00},
352 { 28,0xFF},
353 { 29,0xC7},
354 { 30,0x00},
355 { 31,0x00},
356 { 32,0xFF},
357 { 33,0xCE},
358 { 34,0x00},
359 { 35,0x00},
360 { 36,0xFF},
361 { 37,0xFE},
362 { 38,0x00},
363 { 39,0x00},
364 { 40,0xFE},
365 { 41,0xF7},
366 { 42,0x00},
367 { 43,0x00},
368 { 44,0xFF},
369 { 45,0x46},
370 { 46,0x00},
371 { 47,0x00},
372 { 48,0xFF},
373 { 49,0x22},
374 { 50,0x00},
375 { 51,0x00},
376 { 52,0x7F},
377 { 53,0xFF},
378 { 54,0xFF},
379 { 55,0x00},
380 { 56,0x00},
381 { 57,0x00},
382 { 58,0x00},
383 { 59,0x00},
384 { 60,0x00},
385 { 61,0x00},
386 { 62,0x00},
387 { 63,0x00},
388 { 64,0x00},
389 { 65,0x00},
390 { 66,0x00},
391 { 67,0x00},
392 { 68,0x00},
393 { 69,0x00},
394 { 70,0x00},
395 { 71,0x00},
396 { 72,0xFF},
397 { 73,0x0F},
398 { 74,0x00},
399 { 75,0x00},
400 { 76,0xFA},
401 { 77,0x8C},
402 { 78,0x00},
403 { 79,0x00},
404 { 80,0xF5},
405 { 81,0x08},
406 { 82,0x00},
407 { 83,0x00},
408 { 84,0xFD},
409 { 85,0x92},
410 { 86,0x00},
411 { 87,0x00},
412 { 88,0xF3},
413 { 89,0xA3},
414 { 90,0x00},
415 { 91,0x00},
416 { 92,0x03},
417 { 93,0xB3},
418 { 94,0x00},
419 { 95,0x00},
420 { 96,0x00},
421 { 97,0x33},
422 { 98,0x00},
423 { 99,0x00},
424 {100,0x00},
425 {101,0x71},
426 {102,0x00},
427 {103,0x00},
428 {104,0x40},
429 {105,0x60},
430 {106,0x00},
431 {107,0x00},
432 {108,0x00},
433 {109,0xE2},
434 {110,0x00},
435 {111,0x00},
436 {112,0x00},
437 {113,0xC6},
438 {114,0x00},
439 {115,0x00},
440 {116,0x00},
441 {117,0x87},
442 {118,0x00},
443 {119,0x00},
444 {120,0x00},
445 {121,0x0F},
446 {122,0x00},
447 {123,0x00},
448 {124,0x00},
449 {125,0x0A},
450 {126,0x00},
451 {127,0x00},
452 { 0,0x0B},
453 { 8,0x00},
454 { 9,0x02},
455 { 10,0x00},
456 { 11,0x00},
457 { 12,0x01},
458 { 13,0x81},
459 { 14,0x00},
460 { 15,0x00},
461 { 16,0x18},
462 { 17,0x89},
463 { 18,0x00},
464 { 19,0x00},
465 { 20,0x07},
466 { 21,0xFB},
467 { 22,0x00},
468 { 23,0x00},
469 { 24,0x03},
470 { 25,0xBE},
471 { 26,0x00},
472 { 27,0x00},
473 { 0,0x0},
474 { 0x7F,0x14},
475 { 0,0x01},
476 { 8,0xC0},
477 { 9,0x00},
478 { 10,0x00},
479 { 11,0x00},
480 { 12,0xC0},
481 { 13,0x00},
482 { 14,0x00},
483 { 15,0x00},
484 { 0,0x0},
485 { 0x7F,0x64},
486 { 0,0x01},
487 { 8,0x58},
488 { 9,0x60},
489 { 10,0x08},
490 { 11,0x01},
491 { 12,0x60},
492 { 13,0x60},
493 { 14,0x00},
494 { 15,0x00},
495 { 16,0x58},
496 { 17,0x60},
497 { 18,0x00},
498 { 19,0x09},
499 { 20,0x00},
500 { 21,0x00},
501 { 22,0x00},
502 { 23,0x00},
503 { 24,0x44},
504 { 25,0x00},
505 { 26,0xC0},
506 { 27,0x07},
507 { 28,0x04},
508 { 29,0x00},
509 { 30,0x00},
510 { 31,0x00},
511 { 32,0x04},
512 { 33,0x00},
513 { 34,0x00},
514 { 35,0x0D},
515 { 36,0x04},
516 { 37,0x00},
517 { 38,0x00},
518 { 39,0x08},
519 { 40,0x04},
520 { 41,0x00},
521 { 42,0x00},
522 { 43,0x04},
523 { 44,0x00},
524 { 45,0x00},
525 { 46,0x00},
526 { 47,0x00},
527 { 48,0x00},
528 { 49,0x00},
529 { 50,0x00},
530 { 51,0x00},
531 { 52,0x44},
532 { 53,0x00},
533 { 54,0x00},
534 { 55,0x07},
535 { 56,0x21},
536 { 57,0x00},
537 { 58,0x20},
538 { 59,0x00},
539 { 60,0x4B},
540 { 61,0x00},
541 { 62,0xC0},
542 { 63,0x00},
543 { 64,0x4B},
544 { 65,0x00},
545 { 66,0xE0},
546 { 67,0x00},
547 { 68,0x10},
548 { 69,0x00},
549 { 70,0x00},
550 { 71,0x00},
551 { 72,0x10},
552 { 73,0x00},
553 { 74,0x00},
554 { 75,0x0D},
555 { 76,0x10},
556 { 77,0x00},
557 { 78,0x00},
558 { 79,0x08},
559 { 80,0x10},
560 { 81,0x00},
561 { 82,0x00},
562 { 83,0x04},
563 { 84,0x18},
564 { 85,0x01},
565 { 86,0xC0},
566 { 87,0x0F},
567 { 88,0x1C},
568 { 89,0x01},
569 { 90,0xA0},
570 { 91,0x09},
571 { 92,0x1C},
572 { 93,0x01},
573 { 94,0xA0},
574 { 95,0x03},
575 { 96,0x1C},
576 { 97,0x01},
577 { 98,0x80},
578 { 99,0x0A},
579 {100,0x1C},
580 {101,0x01},
581 {102,0x80},
582 {103,0x02},
583 {104,0x1C},
584 {105,0x01},
585 {106,0x40},
586 {107,0x0C},
587 {108,0x1C},
588 {109,0x01},
589 {110,0x40},
590 {111,0x00},
591 {112,0x1C},
592 {113,0x01},
593 {114,0x60},
594 {115,0x01},
595 {116,0x1C},
596 {117,0x01},
597 {118,0x60},
598 {119,0x0B},
599 {120,0x18},
600 {121,0x01},
601 {122,0x40},
602 {123,0x03},
603 {124,0x1C},
604 {125,0x01},
605 {126,0x40},
606 {127,0x08},
607 { 0,0x02},
608 { 8,0x1C},
609 { 9,0x01},
610 { 10,0x60},
611 { 11,0x09},
612 { 12,0x10},
613 { 13,0x00},
614 { 14,0x00},
615 { 15,0x2D},
616 { 16,0x1C},
617 { 17,0x01},
618 { 18,0x60},
619 { 19,0x02},
620 { 20,0x1C},
621 { 21,0x01},
622 { 22,0x80},
623 { 23,0x01},
624 { 24,0x1C},
625 { 25,0x01},
626 { 26,0x80},
627 { 27,0x0A},
628 { 28,0x1C},
629 { 29,0x01},
630 { 30,0xA0},
631 { 31,0x00},
632 { 32,0x1C},
633 { 33,0x01},
634 { 34,0xA0},
635 { 35,0x0B},
636 { 36,0x1C},
637 { 37,0x01},
638 { 38,0xC0},
639 { 39,0x06},
640 { 40,0x00},
641 { 41,0x00},
642 { 42,0x00},
643 { 43,0x00},
644 { 44,0x00},
645 { 45,0x00},
646 { 46,0x00},
647 { 47,0x00},
648 { 48,0x00},
649 { 49,0x00},
650 { 50,0x00},
651 { 51,0x00},
652 { 52,0x10},
653 { 53,0x00},
654 { 54,0x00},
655 { 55,0x0F},
656 { 56,0x18},
657 { 57,0x01},
658 { 58,0xE0},
659 { 59,0x2C},
660 { 60,0x1C},
661 { 61,0x02},
662 { 62,0x00},
663 { 63,0x11},
664 { 64,0x1C},
665 { 65,0x02},
666 { 66,0x00},
667 { 67,0x48},
668 { 68,0x1C},
669 { 69,0x01},
670 { 70,0xE0},
671 { 71,0x2D},
672 { 72,0x1C},
673 { 73,0x02},
674 { 74,0x20},
675 { 75,0x2F},
676 { 76,0x1C},
677 { 77,0x02},
678 { 78,0x20},
679 { 79,0x2A},
680 { 80,0x1C},
681 { 81,0x02},
682 { 82,0x40},
683 { 83,0x31},
684 { 84,0x1C},
685 { 85,0x02},
686 { 86,0x40},
687 { 87,0x28},
688 { 88,0x1C},
689 { 89,0x02},
690 { 90,0x60},
691 { 91,0x37},
692 { 92,0x1C},
693 { 93,0x02},
694 { 94,0x60},
695 { 95,0x22},
696 { 96,0x1C},
697 { 97,0x02},
698 { 98,0x80},
699 { 99,0x14},
700 {100,0x1C},
701 {101,0x02},
702 {102,0x80},
703 {103,0x45},
704 {104,0x1C},
705 {105,0x02},
706 {106,0xA0},
707 {107,0x12},
708 {108,0x1C},
709 {109,0x02},
710 {110,0xA0},
711 {111,0x47},
712 {112,0x1C},
713 {113,0x02},
714 {114,0xC0},
715 {115,0x38},
716 {116,0x1C},
717 {117,0x02},
718 {118,0xC0},
719 {119,0x21},
720 {120,0x1C},
721 {121,0x02},
722 {122,0xE0},
723 {123,0x33},
724 {124,0x1C},
725 {125,0x02},
726 {126,0xE0},
727 {127,0x26},
728 { 0,0x03},
729 { 8,0x1C},
730 { 9,0x03},
731 { 10,0x00},
732 { 11,0x16},
733 { 12,0x1C},
734 { 13,0x03},
735 { 14,0x00},
736 { 15,0x43},
737 { 16,0x1C},
738 { 17,0x03},
739 { 18,0xC0},
740 { 19,0x35},
741 { 20,0x1C},
742 { 21,0x03},
743 { 22,0xC0},
744 { 23,0x24},
745 { 24,0x1C},
746 { 25,0x03},
747 { 26,0xE0},
748 { 27,0x1A},
749 { 28,0x1C},
750 { 29,0x03},
751 { 30,0xE0},
752 { 31,0x3F},
753 { 32,0x1C},
754 { 33,0x04},
755 { 34,0x00},
756 { 35,0x3A},
757 { 36,0x1C},
758 { 37,0x04},
759 { 38,0x00},
760 { 39,0x1F},
761 { 40,0x1C},
762 { 41,0x04},
763 { 42,0x20},
764 { 43,0x18},
765 { 44,0x1C},
766 { 45,0x04},
767 { 46,0x20},
768 { 47,0x41},
769 { 48,0x1C},
770 { 49,0x04},
771 { 50,0x40},
772 { 51,0x1C},
773 { 52,0x1C},
774 { 53,0x04},
775 { 54,0x40},
776 { 55,0x3D},
777 { 56,0x1C},
778 { 57,0x04},
779 { 58,0x60},
780 { 59,0x19},
781 { 60,0x1C},
782 { 61,0x04},
783 { 62,0x60},
784 { 63,0x40},
785 { 64,0x1C},
786 { 65,0x04},
787 { 66,0x80},
788 { 67,0x30},
789 { 68,0x1C},
790 { 69,0x04},
791 { 70,0x80},
792 { 71,0x29},
793 { 72,0x1C},
794 { 73,0x04},
795 { 74,0xA0},
796 { 75,0x15},
797 { 76,0x1C},
798 { 77,0x04},
799 { 78,0xA0},
800 { 79,0x44},
801 { 80,0x1C},
802 { 81,0x04},
803 { 82,0xC0},
804 { 83,0x3B},
805 { 84,0x1C},
806 { 85,0x04},
807 { 86,0xC0},
808 { 87,0x1E},
809 { 88,0x1C},
810 { 89,0x04},
811 { 90,0xE0},
812 { 91,0x34},
813 { 92,0x1C},
814 { 93,0x04},
815 { 94,0xE0},
816 { 95,0x25},
817 { 96,0x1C},
818 { 97,0x05},
819 { 98,0x00},
820 { 99,0x36},
821 {100,0x1C},
822 {101,0x05},
823 {102,0x00},
824 {103,0x23},
825 {104,0x1C},
826 {105,0x05},
827 {106,0x20},
828 {107,0x32},
829 {108,0x1C},
830 {109,0x05},
831 {110,0x20},
832 {111,0x27},
833 {112,0x1C},
834 {113,0x05},
835 {114,0x40},
836 {115,0x13},
837 {116,0x1C},
838 {117,0x05},
839 {118,0x40},
840 {119,0x46},
841 {120,0x1C},
842 {121,0x05},
843 {122,0x60},
844 {123,0x2E},
845 {124,0x1C},
846 {125,0x05},
847 {126,0x60},
848 {127,0x2B},
849 { 0,0x04},
850 { 8,0x1C},
851 { 9,0x05},
852 { 10,0x80},
853 { 11,0x10},
854 { 12,0x1C},
855 { 13,0x05},
856 { 14,0x80},
857 { 15,0x49},
858 { 16,0x1C},
859 { 17,0x05},
860 { 18,0xA0},
861 { 19,0x17},
862 { 20,0x1C},
863 { 21,0x05},
864 { 22,0xA0},
865 { 23,0x42},
866 { 24,0x1C},
867 { 25,0x05},
868 { 26,0xC0},
869 { 27,0x1D},
870 { 28,0x1C},
871 { 29,0x05},
872 { 30,0xC0},
873 { 31,0x3C},
874 { 32,0x1C},
875 { 33,0x05},
876 { 34,0xE0},
877 { 35,0x1B},
878 { 36,0x1C},
879 { 37,0x05},
880 { 38,0xE0},
881 { 39,0x3E},
882 { 40,0x1C},
883 { 41,0x06},
884 { 42,0x00},
885 { 43,0x39},
886 { 44,0x1C},
887 { 45,0x06},
888 { 46,0x00},
889 { 47,0x20},
890 { 48,0x00},
891 { 49,0x00},
892 { 50,0x00},
893 { 51,0x00},
894 { 52,0x5C},
895 { 53,0x90},
896 { 54,0x40},
897 { 55,0x00},
898 { 56,0x00},
899 { 57,0x00},
900 { 58,0x00},
901 { 59,0x00},
902 { 60,0x5C},
903 { 61,0x90},
904 { 62,0x20},
905 { 63,0x00},
906 { 64,0x00},
907 { 65,0x00},
908 { 66,0x00},
909 { 67,0x00},
910 { 68,0x00},
911 { 69,0x00},
912 { 70,0x00},
913 { 71,0x00},
914 { 72,0x00},
915 { 73,0x00},
916 { 74,0x00},
917 { 75,0x00},
918 { 76,0x10},
919 { 77,0x00},
920 { 78,0x00},
921 { 79,0x49},
922 { 80,0x18},
923 { 81,0x00},
924 { 82,0x60},
925 { 83,0x4A},
926 { 84,0x1C},
927 { 85,0x00},
928 { 86,0x80},
929 { 87,0x4C},
930 { 88,0x1C},
931 { 89,0x00},
932 { 90,0x40},
933 { 91,0x49},
934 { 92,0x30},
935 { 93,0x00},
936 { 94,0x00},
937 { 95,0x4C},
938 { 96,0x1C},
939 { 97,0x00},
940 { 98,0x20},
941 { 99,0x4E},
942 {100,0x00},
943 {101,0x00},
944 {102,0x00},
945 {103,0x00},
946 {104,0x10},
947 {105,0x30},
948 {106,0x00},
949 {107,0x4B},
950 {108,0x34},
951 {109,0x00},
952 {110,0x00},
953 {111,0x4B},
954 {112,0x5C},
955 {113,0x60},
956 {114,0xA0},
957 {115,0x4B},
958 {116,0x0C},
959 {117,0x00},
960 {118,0x40},
961 {119,0x00},
962 {120,0x00},
963 {121,0x00},
964 {122,0x00},
965 {123,0x00},
966 {124,0x10},
967 {125,0x30},
968 {126,0x00},
969 {127,0x4D},
970 { 0,0x05},
971 { 8,0x10},
972 { 9,0x13},
973 { 10,0xE0},
974 { 11,0x50},
975 { 12,0x18},
976 { 13,0x01},
977 { 14,0x00},
978 { 15,0x50},
979 { 16,0x18},
980 { 17,0x03},
981 { 18,0x60},
982 { 19,0x53},
983 { 20,0x6C},
984 { 21,0x03},
985 { 22,0x40},
986 { 23,0x52},
987 { 24,0x6C},
988 { 25,0x03},
989 { 26,0x80},
990 { 27,0x55},
991 { 28,0x10},
992 { 29,0x00},
993 { 30,0x20},
994 { 31,0x51},
995 { 32,0x1C},
996 { 33,0x03},
997 { 34,0x20},
998 { 35,0x51},
999 { 36,0x1C},
1000 { 37,0x03},
1001 { 38,0xA0},
1002 { 39,0x56},
1003 { 40,0x00},
1004 { 41,0x00},
1005 { 42,0x00},
1006 { 43,0x00},
1007 { 44,0x00},
1008 { 45,0x00},
1009 { 46,0x00},
1010 { 47,0x00},
1011 { 48,0x00},
1012 { 49,0x00},
1013 { 50,0x00},
1014 { 51,0x00},
1015 { 52,0x10},
1016 { 53,0x00},
1017 { 54,0x00},
1018 { 55,0x54},
1019 { 56,0x18},
1020 { 57,0x01},
1021 { 58,0x00},
1022 { 59,0x54},
1023 { 60,0x00},
1024 { 61,0x00},
1025 { 62,0x00},
1026 { 63,0x00},
1027 { 64,0x0C},
1028 { 65,0x00},
1029 { 66,0x00},
1030 { 67,0x03},
1031 { 68,0x00},
1032 { 69,0x00},
1033 { 70,0x00},
1034 { 71,0x00},
1035 { 72,0x00},
1036 { 73,0x00},
1037 { 74,0x00},
1038 { 75,0x00},
1039 { 76,0x00},
1040 { 77,0x00},
1041 { 78,0x00},
1042 { 79,0x00},
1043 { 80,0x02},
1044 { 81,0x00},
1045 { 82,0x00},
1046 { 83,0x00},
1047 { 84,0x00},
1048 { 85,0x00},
1049 { 86,0x00},
1050 { 87,0x00},
1051};
1052
1053
1054reg_value base_speaker_SRS_miniDSP_D_reg_values[] = {
1055 { 0,0x0},
1056 { 0x7F,0x50},
1057 { 0,0x01},
1058 { 8,0xFF},
1059 { 9,0xFF},
1060 { 10,0xFF},
1061 { 11,0x00},
1062 { 12,0x80},
1063 { 13,0x00},
1064 { 14,0x00},
1065 { 15,0x00},
1066 { 16,0x7F},
1067 { 17,0xF7},
1068 { 18,0x00},
1069 { 19,0x00},
1070 { 20,0x80},
1071 { 21,0x09},
1072 { 22,0x00},
1073 { 23,0x00},
1074 { 24,0x7F},
1075 { 25,0xEF},
1076 { 26,0x00},
1077 { 27,0x00},
1078 { 28,0x66},
1079 { 29,0x66},
1080 { 30,0x60},
1081 { 31,0x00},
1082 { 32,0x1B},
1083 { 33,0x33},
1084 { 34,0x20},
1085 { 35,0x00},
1086 { 36,0x66},
1087 { 37,0x66},
1088 { 38,0x60},
1089 { 39,0x00},
1090 { 40,0x33},
1091 { 41,0x33},
1092 { 42,0x30},
1093 { 43,0x00},
1094 { 44,0x4C},
1095 { 45,0xCC},
1096 { 46,0xCD},
1097 { 47,0x00},
1098 { 48,0x00},
1099 { 49,0x00},
1100 { 50,0x01},
1101 { 51,0x00},
1102 { 52,0x33},
1103 { 53,0x33},
1104 { 54,0x30},
1105 { 55,0x00},
1106 { 56,0x33},
1107 { 57,0x33},
1108 { 58,0x30},
1109 { 59,0x00},
1110 { 60,0x7F},
1111 { 61,0xFF},
1112 { 62,0xAC},
1113 { 63,0x00},
1114 { 64,0x80},
1115 { 65,0x00},
1116 { 66,0x00},
1117 { 67,0x00},
1118 { 68,0x40},
1119 { 69,0x00},
1120 { 70,0x00},
1121 { 71,0x00},
1122 { 72,0x40},
1123 { 73,0x00},
1124 { 74,0x00},
1125 { 75,0x00},
1126 { 76,0xC0},
1127 { 77,0x00},
1128 { 78,0x00},
1129 { 79,0x00},
1130 { 80,0x50},
1131 { 81,0xC3},
1132 { 82,0x36},
1133 { 83,0x00},
1134 { 84,0x02},
1135 { 85,0x8F},
1136 { 86,0x5C},
1137 { 87,0x00},
1138 { 88,0x02},
1139 { 89,0xD7},
1140 { 90,0x0A},
1141 { 91,0x00},
1142 { 92,0x00},
1143 { 93,0x00},
1144 { 94,0x00},
1145 { 95,0x00},
1146 { 96,0x00},
1147 { 97,0x00},
1148 { 98,0x00},
1149 { 99,0x00},
1150 {100,0x00},
1151 {101,0x00},
1152 {102,0x00},
1153 {103,0x00},
1154 {104,0x00},
1155 {105,0x00},
1156 {106,0x00},
1157 {107,0x00},
1158 {108,0x00},
1159 {109,0x00},
1160 {110,0x00},
1161 {111,0x00},
1162 {112,0x40},
1163 {113,0x00},
1164 {114,0x00},
1165 {115,0x00},
1166 {116,0xFF},
1167 {117,0xFF},
1168 {118,0xFF},
1169 {119,0x00},
1170 {120,0xFF},
1171 {121,0xFF},
1172 {122,0xFE},
1173 {123,0x00},
1174 {124,0xFF},
1175 {125,0xFF},
1176 {126,0xFD},
1177 {127,0x00},
1178 { 0,0x02},
1179 { 8,0xFF},
1180 { 9,0xFF},
1181 { 10,0xFC},
1182 { 11,0x00},
1183 { 12,0x00},
1184 { 13,0x00},
1185 { 14,0x00},
1186 { 15,0x00},
1187 { 16,0x73},
1188 { 17,0x56},
1189 { 18,0x6E},
1190 { 19,0x00},
1191 { 20,0x7F},
1192 { 21,0xF4},
1193 { 22,0xA0},
1194 { 23,0x00},
1195 { 24,0x00},
1196 { 25,0x80},
1197 { 26,0x2D},
1198 { 27,0x00},
1199 { 28,0x7E},
1200 { 29,0xFF},
1201 { 30,0xA5},
1202 { 31,0x00},
1203 { 32,0x00},
1204 { 33,0x2E},
1205 { 34,0x73},
1206 { 35,0x00},
1207 { 36,0xFF},
1208 { 37,0xD1},
1209 { 38,0x8D},
1210 { 39,0x00},
1211 { 40,0x7F},
1212 { 41,0xC1},
1213 { 42,0x2F},
1214 { 43,0x00},
1215 { 44,0x80},
1216 { 45,0x7B},
1217 { 46,0x94},
1218 { 47,0x00},
1219 { 48,0x01},
1220 { 49,0x50},
1221 { 50,0xC1},
1222 { 51,0x00},
1223 { 52,0xFE},
1224 { 53,0xAF},
1225 { 54,0x3F},
1226 { 55,0x00},
1227 { 56,0x7F},
1228 { 57,0x55},
1229 { 58,0xC1},
1230 { 59,0x00},
1231 { 60,0x81},
1232 { 61,0x4E},
1233 { 62,0x4E},
1234 { 63,0x00},
1235 { 64,0x7F},
1236 { 65,0xFF},
1237 { 66,0xFF},
1238 { 67,0x00},
1239 { 68,0x00},
1240 { 69,0x00},
1241 { 70,0x00},
1242 { 71,0x00},
1243 { 72,0xC7},
1244 { 73,0x2E},
1245 { 74,0x8D},
1246 { 75,0x00},
1247 { 76,0x31},
1248 { 77,0x91},
1249 { 78,0x54},
1250 { 79,0x00},
1251 { 80,0xD1},
1252 { 81,0xFC},
1253 { 82,0xF4},
1254 { 83,0x00},
1255 { 84,0x2A},
1256 { 85,0x09},
1257 { 86,0x1A},
1258 { 87,0x00},
1259 { 88,0xEA},
1260 { 89,0xD6},
1261 { 90,0x1C},
1262 { 91,0x00},
1263 { 92,0xC5},
1264 { 93,0x28},
1265 { 94,0xA2},
1266 { 95,0x00},
1267 { 96,0x32},
1268 { 97,0xD7},
1269 { 98,0x53},
1270 { 99,0x00},
1271 {100,0xD3},
1272 {101,0x74},
1273 {102,0x4B},
1274 {103,0x00},
1275 {104,0x15},
1276 {105,0x04},
1277 {106,0x8D},
1278 {107,0x00},
1279 {108,0xF5},
1280 {109,0x6B},
1281 {110,0x0E},
1282 {111,0x00},
1283 {112,0xC0},
1284 {113,0x0C},
1285 {114,0x47},
1286 {115,0x00},
1287 {116,0x3F},
1288 {117,0x99},
1289 {118,0x61},
1290 {119,0x00},
1291 {120,0x3E},
1292 {121,0xE2},
1293 {122,0x1D},
1294 {123,0x00},
1295 {124,0x3E},
1296 {125,0xE2},
1297 {126,0x1D},
1298 {127,0x00},
1299 { 0,0x03},
1300 { 8,0x0A},
1301 { 9,0x57},
1302 { 10,0x0D},
1303 { 11,0x00},
1304 { 12,0xF5},
1305 { 13,0xA8},
1306 { 14,0xF3},
1307 { 15,0x00},
1308 { 16,0x6E},
1309 { 17,0x1B},
1310 { 18,0xC0},
1311 { 19,0x00},
1312 { 20,0x89},
1313 { 21,0x90},
1314 { 22,0x65},
1315 { 23,0x00},
1316 { 24,0x1B},
1317 { 25,0x6E},
1318 { 26,0xFE},
1319 { 27,0x00},
1320 { 28,0xE4},
1321 { 29,0x91},
1322 { 30,0x02},
1323 { 31,0x00},
1324 { 32,0x5B},
1325 { 33,0x45},
1326 { 34,0x9C},
1327 { 35,0x00},
1328 { 36,0x99},
1329 { 37,0x5F},
1330 { 38,0xEC},
1331 { 39,0x00},
1332 { 40,0x15},
1333 { 41,0x3D},
1334 { 42,0xC9},
1335 { 43,0x00},
1336 { 44,0xEA},
1337 { 45,0xC2},
1338 { 46,0x37},
1339 { 47,0x00},
1340 { 48,0x40},
1341 { 49,0x53},
1342 { 50,0x16},
1343 { 51,0x00},
1344 { 52,0x93},
1345 { 53,0xA5},
1346 { 54,0xAE},
1347 { 55,0x00},
1348 { 56,0x9B},
1349 { 57,0x77},
1350 { 58,0x00},
1351 { 59,0x00},
1352 { 60,0x64},
1353 { 61,0x88},
1354 { 62,0xF0},
1355 { 63,0x00},
1356 { 64,0x45},
1357 { 65,0x84},
1358 { 66,0x40},
1359 { 67,0x00},
1360 { 68,0xBA},
1361 { 69,0x7B},
1362 { 70,0xB0},
1363 { 71,0x00},
1364 { 72,0xC3},
1365 { 73,0xE0},
1366 { 74,0x00},
1367 { 75,0x00},
1368 { 76,0x3C},
1369 { 77,0x1F},
1370 { 78,0xF0},
1371 { 79,0x00},
1372 { 80,0x68},
1373 { 81,0x76},
1374 { 82,0x1D},
1375 { 83,0x00},
1376 { 84,0x97},
1377 { 85,0x89},
1378 { 86,0xE3},
1379 { 87,0x00},
1380 { 88,0x67},
1381 { 89,0xEA},
1382 { 90,0x3A},
1383 { 91,0x00},
1384 { 92,0xAD},
1385 { 93,0xFC},
1386 { 94,0x02},
1387 { 95,0x00},
1388 { 96,0x79},
1389 { 97,0xEC},
1390 { 98,0x4D},
1391 { 99,0x00},
1392 {100,0x86},
1393 {101,0x13},
1394 {102,0xB3},
1395 {103,0x00},
1396 {104,0x3A},
1397 {105,0x36},
1398 {106,0x6A},
1399 {107,0x00},
1400 {108,0x7F},
1401 {109,0xFF},
1402 {110,0xFF},
1403 {111,0x00},
1404 {112,0x00},
1405 {113,0x00},
1406 {114,0x00},
1407 {115,0x00},
1408 {116,0x00},
1409 {117,0x00},
1410 {118,0x00},
1411 {119,0x00},
1412 {120,0x00},
1413 {121,0x00},
1414 {122,0x00},
1415 {123,0x00},
1416 {124,0x00},
1417 {125,0x00},
1418 {126,0x00},
1419 {127,0x00},
1420 { 0,0x04},
1421 { 8,0x7F},
1422 { 9,0xFF},
1423 { 10,0xFF},
1424 { 11,0x00},
1425 { 12,0x00},
1426 { 13,0x00},
1427 { 14,0x00},
1428 { 15,0x00},
1429 { 16,0x00},
1430 { 17,0x00},
1431 { 18,0x00},
1432 { 19,0x00},
1433 { 20,0x00},
1434 { 21,0x00},
1435 { 22,0x00},
1436 { 23,0x00},
1437 { 24,0x00},
1438 { 25,0x00},
1439 { 26,0x00},
1440 { 27,0x00},
1441 { 28,0x00},
1442 { 29,0x00},
1443 { 30,0x01},
1444 { 31,0x00},
1445 { 32,0xC0},
1446 { 33,0x00},
1447 { 34,0x00},
1448 { 35,0x00},
1449 { 36,0x00},
1450 { 37,0x00},
1451 { 38,0x01},
1452 { 39,0x00},
1453 { 40,0x00},
1454 { 41,0x00},
1455 { 42,0xAF},
1456 { 43,0x00},
1457 { 44,0x7F},
1458 { 45,0xFF},
1459 { 46,0x51},
1460 { 47,0x00},
1461 { 48,0x00},
1462 { 49,0x00},
1463 { 50,0x00},
1464 { 51,0x00},
1465 { 52,0xF0},
1466 { 53,0x00},
1467 { 54,0x00},
1468 { 55,0x00},
1469 { 56,0xE4},
1470 { 57,0x00},
1471 { 58,0x00},
1472 { 59,0x00},
1473 { 60,0x32},
1474 { 61,0x00},
1475 { 62,0x00},
1476 { 63,0x00},
1477 { 64,0x14},
1478 { 65,0x00},
1479 { 66,0x00},
1480 { 67,0x00},
1481 { 68,0xFF},
1482 { 69,0x00},
1483 { 70,0x00},
1484 { 71,0x00},
1485 { 72,0xF0},
1486 { 73,0x00},
1487 { 74,0x00},
1488 { 75,0x00},
1489 { 76,0x00},
1490 { 77,0x02},
1491 { 78,0xBB},
1492 { 79,0x00},
1493 { 80,0x7F},
1494 { 81,0xFD},
1495 { 82,0x45},
1496 { 83,0x00},
1497 { 84,0x00},
1498 { 85,0x00},
1499 { 86,0x57},
1500 { 87,0x00},
1501 { 88,0x7F},
1502 { 89,0xFF},
1503 { 90,0xA9},
1504 { 91,0x00},
1505 { 92,0x20},
1506 { 93,0x00},
1507 { 94,0x00},
1508 { 95,0x00},
1509 { 96,0x00},
1510 { 97,0x00},
1511 { 98,0x00},
1512 { 99,0x00},
1513 {100,0xD7},
1514 {101,0x41},
1515 {102,0xA0},
1516 {103,0x00},
1517 {104,0xFF},
1518 {105,0xF0},
1519 {106,0x00},
1520 {107,0x00},
1521 {108,0x88},
1522 {109,0x00},
1523 {110,0x00},
1524 {111,0x00},
1525 {112,0x18},
1526 {113,0x00},
1527 {114,0x00},
1528 {115,0x00},
1529 {116,0x00},
1530 {117,0x00},
1531 {118,0x00},
1532 {119,0x00},
1533 {120,0x0C},
1534 {121,0x00},
1535 {122,0x00},
1536 {123,0x00},
1537 {124,0xF4},
1538 {125,0x00},
1539 {126,0x00},
1540 {127,0x00},
1541 { 0,0x05},
1542 { 8,0x15},
1543 { 9,0x42},
1544 { 10,0xA6},
1545 { 11,0x00},
1546 { 12,0x7F},
1547 { 13,0xFF},
1548 { 14,0xFF},
1549 { 15,0x00},
1550 { 16,0x0B},
1551 { 17,0xF9},
1552 { 18,0x13},
1553 { 19,0x00},
1554 { 20,0x18},
1555 { 21,0xEC},
1556 { 22,0xF7},
1557 { 23,0x00},
1558 { 24,0x5B},
1559 { 25,0x9E},
1560 { 26,0xC4},
1561 { 27,0x00},
1562 { 28,0x7F},
1563 { 29,0x7B},
1564 { 30,0x30},
1565 { 31,0x00},
1566 { 32,0x00},
1567 { 33,0x00},
1568 { 34,0x00},
1569 { 35,0x00},
1570 { 36,0x00},
1571 { 37,0x00},
1572 { 38,0x00},
1573 { 39,0x00},
1574 { 40,0x00},
1575 { 41,0x00},
1576 { 42,0x00},
1577 { 43,0x00},
1578 { 44,0x00},
1579 { 45,0x0D},
1580 { 46,0x00},
1581 { 47,0x00},
1582 { 48,0x00},
1583 { 49,0x1C},
1584 { 50,0x00},
1585 { 51,0x00},
1586 { 52,0x00},
1587 { 53,0x3E},
1588 { 54,0x00},
1589 { 55,0x00},
1590 { 56,0x00},
1591 { 57,0x78},
1592 { 58,0x00},
1593 { 59,0x00},
1594 { 60,0x02},
1595 { 61,0x4C},
1596 { 62,0x00},
1597 { 63,0x00},
1598 { 64,0x00},
1599 { 65,0xD5},
1600 { 66,0x00},
1601 { 67,0x00},
1602 { 68,0x01},
1603 { 69,0x65},
1604 { 70,0x00},
1605 { 71,0x00},
1606 { 72,0x03},
1607 { 73,0xE9},
1608 { 74,0x00},
1609 { 75,0x00},
1610 { 76,0x07},
1611 { 77,0xCA},
1612 { 78,0x00},
1613 { 79,0x00},
1614 { 80,0xFF},
1615 { 81,0xEF},
1616 { 82,0x00},
1617 { 83,0x00},
1618 { 84,0xFE},
1619 { 85,0xEB},
1620 { 86,0x00},
1621 { 87,0x00},
1622 { 88,0xFF},
1623 { 89,0xA8},
1624 { 90,0x00},
1625 { 91,0x00},
1626 { 92,0xFD},
1627 { 93,0x08},
1628 { 94,0x00},
1629 { 95,0x00},
1630 { 96,0xFF},
1631 { 97,0x5E},
1632 { 98,0x00},
1633 { 99,0x00},
1634 {100,0xFF},
1635 {101,0xD5},
1636 {102,0x00},
1637 {103,0x00},
1638 {104,0xFE},
1639 {105,0x36},
1640 {106,0x00},
1641 {107,0x00},
1642 {108,0xFA},
1643 {109,0xAC},
1644 {110,0x00},
1645 {111,0x00},
1646 {112,0xF2},
1647 {113,0xA3},
1648 {114,0x00},
1649 {115,0x00},
1650 {116,0x28},
1651 {117,0xAB},
1652 {118,0x00},
1653 {119,0x00},
1654 {120,0x3F},
1655 {121,0xFF},
1656 {122,0x00},
1657 {123,0x00},
1658 {124,0xFF},
1659 {125,0x98},
1660 {126,0x00},
1661 {127,0x00},
1662 { 0,0x06},
1663 { 8,0xF6},
1664 { 9,0xF9},
1665 { 10,0x00},
1666 { 11,0x00},
1667 { 12,0x26},
1668 { 13,0xFB},
1669 { 14,0x00},
1670 { 15,0x00},
1671 { 16,0x02},
1672 { 17,0x72},
1673 { 18,0x00},
1674 { 19,0x00},
1675 { 20,0x40},
1676 { 21,0x02},
1677 { 22,0x00},
1678 { 23,0x00},
1679 { 24,0xFB},
1680 { 25,0xCB},
1681 { 26,0x00},
1682 { 27,0x00},
1683 { 28,0x20},
1684 { 29,0xA7},
1685 { 30,0x00},
1686 { 31,0x00},
1687 { 32,0xFF},
1688 { 33,0x6A},
1689 { 34,0x00},
1690 { 35,0x00},
1691 { 36,0x3A},
1692 { 37,0x0F},
1693 { 38,0x00},
1694 { 39,0x00},
1695 { 0,0x09},
1696 { 72,0xFF},
1697 { 73,0xFF},
1698 { 74,0xFF},
1699 { 75,0x00},
1700 { 76,0x80},
1701 { 77,0x00},
1702 { 78,0x00},
1703 { 79,0x00},
1704 { 80,0x7F},
1705 { 81,0xF7},
1706 { 82,0x00},
1707 { 83,0x00},
1708 { 84,0x80},
1709 { 85,0x09},
1710 { 86,0x00},
1711 { 87,0x00},
1712 { 88,0x7F},
1713 { 89,0xEF},
1714 { 90,0x00},
1715 { 91,0x00},
1716 { 92,0x66},
1717 { 93,0x66},
1718 { 94,0x60},
1719 { 95,0x00},
1720 { 96,0x1B},
1721 { 97,0x33},
1722 { 98,0x20},
1723 { 99,0x00},
1724 {100,0x66},
1725 {101,0x66},
1726 {102,0x60},
1727 {103,0x00},
1728 {104,0x33},
1729 {105,0x33},
1730 {106,0x30},
1731 {107,0x00},
1732 {108,0x4C},
1733 {109,0xCC},
1734 {110,0xCD},
1735 {111,0x00},
1736 {112,0x00},
1737 {113,0x00},
1738 {114,0x01},
1739 {115,0x00},
1740 {116,0x33},
1741 {117,0x33},
1742 {118,0x30},
1743 {119,0x00},
1744 {120,0x33},
1745 {121,0x33},
1746 {122,0x30},
1747 {123,0x00},
1748 {124,0x7F},
1749 {125,0xFF},
1750 {126,0xAC},
1751 {127,0x00},
1752 { 0,0x0A},
1753 { 8,0x80},
1754 { 9,0x00},
1755 { 10,0x00},
1756 { 11,0x00},
1757 { 12,0x40},
1758 { 13,0x00},
1759 { 14,0x00},
1760 { 15,0x00},
1761 { 16,0x40},
1762 { 17,0x00},
1763 { 18,0x00},
1764 { 19,0x00},
1765 { 20,0xC0},
1766 { 21,0x00},
1767 { 22,0x00},
1768 { 23,0x00},
1769 { 24,0x50},
1770 { 25,0xC3},
1771 { 26,0x36},
1772 { 27,0x00},
1773 { 28,0x02},
1774 { 29,0x8F},
1775 { 30,0x5C},
1776 { 31,0x00},
1777 { 32,0x02},
1778 { 33,0xD7},
1779 { 34,0x0A},
1780 { 35,0x00},
1781 { 36,0x00},
1782 { 37,0x00},
1783 { 38,0x00},
1784 { 39,0x00},
1785 { 40,0x00},
1786 { 41,0x00},
1787 { 42,0x00},
1788 { 43,0x00},
1789 { 44,0x00},
1790 { 45,0x00},
1791 { 46,0x00},
1792 { 47,0x00},
1793 { 48,0x00},
1794 { 49,0x00},
1795 { 50,0x00},
1796 { 51,0x00},
1797 { 52,0x00},
1798 { 53,0x00},
1799 { 54,0x00},
1800 { 55,0x00},
1801 { 56,0x40},
1802 { 57,0x00},
1803 { 58,0x00},
1804 { 59,0x00},
1805 { 60,0xFF},
1806 { 61,0xFF},
1807 { 62,0xFF},
1808 { 63,0x00},
1809 { 64,0xFF},
1810 { 65,0xFF},
1811 { 66,0xFE},
1812 { 67,0x00},
1813 { 68,0xFF},
1814 { 69,0xFF},
1815 { 70,0xFD},
1816 { 71,0x00},
1817 { 72,0xFF},
1818 { 73,0xFF},
1819 { 74,0xFC},
1820 { 75,0x00},
1821 { 76,0x00},
1822 { 77,0x00},
1823 { 78,0x00},
1824 { 79,0x00},
1825 { 80,0x73},
1826 { 81,0x56},
1827 { 82,0x6E},
1828 { 83,0x00},
1829 { 84,0x7F},
1830 { 85,0xF4},
1831 { 86,0xA0},
1832 { 87,0x00},
1833 { 88,0x00},
1834 { 89,0x80},
1835 { 90,0x2D},
1836 { 91,0x00},
1837 { 92,0x7E},
1838 { 93,0xFF},
1839 { 94,0xA5},
1840 { 95,0x00},
1841 { 96,0x00},
1842 { 97,0x2E},
1843 { 98,0x73},
1844 { 99,0x00},
1845 {100,0xFF},
1846 {101,0xD1},
1847 {102,0x8D},
1848 {103,0x00},
1849 {104,0x7F},
1850 {105,0xC1},
1851 {106,0x2F},
1852 {107,0x00},
1853 {108,0x80},
1854 {109,0x7B},
1855 {110,0x94},
1856 {111,0x00},
1857 {112,0x01},
1858 {113,0x50},
1859 {114,0xC1},
1860 {115,0x00},
1861 {116,0xFE},
1862 {117,0xAF},
1863 {118,0x3F},
1864 {119,0x00},
1865 {120,0x7F},
1866 {121,0x55},
1867 {122,0xC1},
1868 {123,0x00},
1869 {124,0x81},
1870 {125,0x4E},
1871 {126,0x4E},
1872 {127,0x00},
1873 { 0,0x0B},
1874 { 8,0x7F},
1875 { 9,0xFF},
1876 { 10,0xFF},
1877 { 11,0x00},
1878 { 12,0x00},
1879 { 13,0x00},
1880 { 14,0x00},
1881 { 15,0x00},
1882 { 16,0xC7},
1883 { 17,0x2E},
1884 { 18,0x8D},
1885 { 19,0x00},
1886 { 20,0x31},
1887 { 21,0x91},
1888 { 22,0x54},
1889 { 23,0x00},
1890 { 24,0xD1},
1891 { 25,0xFC},
1892 { 26,0xF4},
1893
1894 { 27,0x00},
1895 { 28,0x2A},
1896 { 29,0x09},
1897 { 30,0x1A},
1898 { 31,0x00},
1899 { 32,0xEA},
1900 { 33,0xD6},
1901 { 34,0x1C},
1902 { 35,0x00},
1903 { 36,0xC5},
1904 { 37,0x28},
1905 { 38,0xA2},
1906 { 39,0x00},
1907 { 40,0x32},
1908 { 41,0xD7},
1909 { 42,0x53},
1910 { 43,0x00},
1911 { 44,0xD3},
1912 { 45,0x74},
1913 { 46,0x4B},
1914 { 47,0x00},
1915 { 48,0x15},
1916 { 49,0x04},
1917 { 50,0x8D},
1918 { 51,0x00},
1919 { 52,0xF5},
1920 { 53,0x6B},
1921 { 54,0x0E},
1922 { 55,0x00},
1923 { 56,0xC0},
1924 { 57,0x0C},
1925 { 58,0x47},
1926 { 59,0x00},
1927 { 60,0x3F},
1928 { 61,0x99},
1929 { 62,0x61},
1930 { 63,0x00},
1931 { 64,0x3E},
1932 { 65,0xE2},
1933 { 66,0x1D},
1934 { 67,0x00},
1935 { 68,0x3E},
1936 { 69,0xE2},
1937 { 70,0x1D},
1938 { 71,0x00},
1939 { 72,0x0A},
1940 { 73,0x57},
1941 { 74,0x0D},
1942 { 75,0x00},
1943 { 76,0xF5},
1944 { 77,0xA8},
1945 { 78,0xF3},
1946 { 79,0x00},
1947 { 80,0x6E},
1948 { 81,0x1B},
1949 { 82,0xC0},
1950 { 83,0x00},
1951 { 84,0x89},
1952 { 85,0x90},
1953 { 86,0x65},
1954 { 87,0x00},
1955 { 88,0x1B},
1956 { 89,0x6E},
1957 { 90,0xFE},
1958 { 91,0x00},
1959 { 92,0xE4},
1960 { 93,0x91},
1961 { 94,0x02},
1962 { 95,0x00},
1963 { 96,0x5B},
1964 { 97,0x45},
1965 { 98,0x9C},
1966 { 99,0x00},
1967 {100,0x99},
1968 {101,0x5F},
1969 {102,0xEC},
1970 {103,0x00},
1971 {104,0x15},
1972 {105,0x3D},
1973 {106,0xC9},
1974 {107,0x00},
1975 {108,0xEA},
1976 {109,0xC2},
1977 {110,0x37},
1978 {111,0x00},
1979 {112,0x40},
1980 {113,0x53},
1981 {114,0x16},
1982 {115,0x00},
1983 {116,0x93},
1984 {117,0xA5},
1985 {118,0xAE},
1986 {119,0x00},
1987 {120,0x9B},
1988 {121,0x77},
1989 {122,0x00},
1990 {123,0x00},
1991 {124,0x64},
1992 {125,0x88},
1993 {126,0xF0},
1994 {127,0x00},
1995 { 0,0x0C},
1996 { 8,0x45},
1997 { 9,0x84},
1998 { 10,0x40},
1999 { 11,0x00},
2000 { 12,0xBA},
2001 { 13,0x7B},
2002 { 14,0xB0},
2003 { 15,0x00},
2004 { 16,0xC3},
2005 { 17,0xE0},
2006 { 18,0x00},
2007 { 19,0x00},
2008 { 20,0x3C},
2009 { 21,0x1F},
2010 { 22,0xF0},
2011 { 23,0x00},
2012 { 24,0x68},
2013 { 25,0x76},
2014 { 26,0x1D},
2015 { 27,0x00},
2016 { 28,0x97},
2017 { 29,0x89},
2018 { 30,0xE3},
2019 { 31,0x00},
2020 { 32,0x67},
2021 { 33,0xEA},
2022 { 34,0x3A},
2023 { 35,0x00},
2024 { 36,0xAD},
2025 { 37,0xFC},
2026 { 38,0x02},
2027 { 39,0x00},
2028 { 40,0x79},
2029 { 41,0xEC},
2030 { 42,0x4D},
2031 { 43,0x00},
2032 { 44,0x86},
2033 { 45,0x13},
2034 { 46,0xB3},
2035 { 47,0x00},
2036 { 48,0x3A},
2037 { 49,0x36},
2038 { 50,0x6A},
2039 { 51,0x00},
2040 { 52,0x7F},
2041 { 53,0xFF},
2042 { 54,0xFF},
2043 { 55,0x00},
2044 { 56,0x00},
2045 { 57,0x00},
2046 { 58,0x00},
2047 { 59,0x00},
2048 { 60,0x00},
2049 { 61,0x00},
2050 { 62,0x00},
2051 { 63,0x00},
2052 { 64,0x00},
2053 { 65,0x00},
2054 { 66,0x00},
2055 { 67,0x00},
2056 { 68,0x00},
2057 { 69,0x00},
2058 { 70,0x00},
2059 { 71,0x00},
2060 { 72,0x7F},
2061 { 73,0xFF},
2062 { 74,0xFF},
2063 { 75,0x00},
2064 { 76,0x00},
2065 { 77,0x00},
2066 { 78,0x00},
2067 { 79,0x00},
2068 { 80,0x00},
2069 { 81,0x00},
2070 { 82,0x00},
2071 { 83,0x00},
2072 { 84,0x00},
2073 { 85,0x00},
2074 { 86,0x00},
2075 { 87,0x00},
2076 { 88,0x00},
2077 { 89,0x00},
2078 { 90,0x00},
2079 { 91,0x00},
2080 { 92,0x00},
2081 { 93,0x00},
2082 { 94,0x01},
2083 { 95,0x00},
2084 { 96,0xC0},
2085 { 97,0x00},
2086 { 98,0x00},
2087 { 99,0x00},
2088 {100,0x00},
2089 {101,0x00},
2090 {102,0x01},
2091 {103,0x00},
2092 {104,0x00},
2093 {105,0x00},
2094 {106,0xAF},
2095 {107,0x00},
2096 {108,0x7F},
2097 {109,0xFF},
2098 {110,0x51},
2099 {111,0x00},
2100 {112,0x00},
2101 {113,0x00},
2102 {114,0x00},
2103 {115,0x00},
2104 {116,0xF0},
2105 {117,0x00},
2106 {118,0x00},
2107 {119,0x00},
2108 {120,0xE4},
2109 {121,0x00},
2110 {122,0x00},
2111 {123,0x00},
2112 {124,0x32},
2113 {125,0x00},
2114 {126,0x00},
2115 {127,0x00},
2116 { 0,0x0D},
2117 { 8,0x14},
2118 { 9,0x00},
2119 { 10,0x00},
2120 { 11,0x00},
2121 { 12,0xFF},
2122 { 13,0x00},
2123 { 14,0x00},
2124 { 15,0x00},
2125 { 16,0xF0},
2126 { 17,0x00},
2127 { 18,0x00},
2128 { 19,0x00},
2129 { 20,0x00},
2130 { 21,0x02},
2131 { 22,0xBB},
2132 { 23,0x00},
2133 { 24,0x7F},
2134 { 25,0xFD},
2135 { 26,0x45},
2136 { 27,0x00},
2137 { 28,0x00},
2138 { 29,0x00},
2139 { 30,0x57},
2140 { 31,0x00},
2141 { 32,0x7F},
2142 { 33,0xFF},
2143 { 34,0xA9},
2144 { 35,0x00},
2145 { 36,0x20},
2146 { 37,0x00},
2147 { 38,0x00},
2148 { 39,0x00},
2149 { 40,0x00},
2150 { 41,0x00},
2151 { 42,0x00},
2152 { 43,0x00},
2153 { 44,0xD7},
2154 { 45,0x41},
2155 { 46,0xA0},
2156 { 47,0x00},
2157 { 48,0xFF},
2158 { 49,0xF0},
2159 { 50,0x00},
2160 { 51,0x00},
2161 { 52,0x88},
2162 { 53,0x00},
2163 { 54,0x00},
2164 { 55,0x00},
2165 { 56,0x18},
2166 { 57,0x00},
2167 { 58,0x00},
2168 { 59,0x00},
2169 { 60,0x00},
2170 { 61,0x00},
2171 { 62,0x00},
2172 { 63,0x00},
2173 { 64,0x0C},
2174 { 65,0x00},
2175 { 66,0x00},
2176 { 67,0x00},
2177 { 68,0xF4},
2178 { 69,0x00},
2179 { 70,0x00},
2180 { 71,0x00},
2181 { 72,0x15},
2182 { 73,0x42},
2183 { 74,0xA6},
2184 { 75,0x00},
2185 { 76,0x7F},
2186 { 77,0xFF},
2187 { 78,0xFF},
2188 { 79,0x00},
2189 { 80,0x0B},
2190 { 81,0xF9},
2191 { 82,0x13},
2192 { 83,0x00},
2193 { 84,0x18},
2194 { 85,0xEC},
2195 { 86,0xF7},
2196 { 87,0x00},
2197 { 88,0x5B},
2198 { 89,0x9E},
2199 { 90,0xC4},
2200 { 91,0x00},
2201 { 92,0x7F},
2202 { 93,0x7B},
2203 { 94,0x30},
2204 { 95,0x00},
2205 { 96,0x00},
2206 { 97,0x00},
2207 { 98,0x00},
2208 { 99,0x00},
2209 {100,0x00},
2210 {101,0x00},
2211 {102,0x00},
2212 {103,0x00},
2213 {104,0x00},
2214 {105,0x00},
2215 {106,0x00},
2216 {107,0x00},
2217 {108,0x00},
2218 {109,0x0D},
2219 {110,0x00},
2220 {111,0x00},
2221 {112,0x00},
2222 {113,0x1C},
2223 {114,0x00},
2224 {115,0x00},
2225 {116,0x00},
2226 {117,0x3E},
2227 {118,0x00},
2228 {119,0x00},
2229 {120,0x00},
2230 {121,0x78},
2231 {122,0x00},
2232 {123,0x00},
2233 {124,0x02},
2234 {125,0x4C},
2235 {126,0x00},
2236 {127,0x00},
2237 { 0,0x0E},
2238 { 8,0x00},
2239 { 9,0xD5},
2240 { 10,0x00},
2241 { 11,0x00},
2242 { 12,0x01},
2243 { 13,0x65},
2244 { 14,0x00},
2245 { 15,0x00},
2246 { 16,0x03},
2247 { 17,0xE9},
2248 { 18,0x00},
2249 { 19,0x00},
2250 { 20,0x07},
2251 { 21,0xCA},
2252 { 22,0x00},
2253 { 23,0x00},
2254 { 24,0xFF},
2255 { 25,0xEF},
2256 { 26,0x00},
2257 { 27,0x00},
2258 { 28,0xFE},
2259 { 29,0xEB},
2260 { 30,0x00},
2261 { 31,0x00},
2262 { 32,0xFF},
2263 { 33,0xA8},
2264 { 34,0x00},
2265 { 35,0x00},
2266 { 36,0xFD},
2267 { 37,0x08},
2268 { 38,0x00},
2269 { 39,0x00},
2270 { 40,0xFF},
2271 { 41,0x5E},
2272 { 42,0x00},
2273 { 43,0x00},
2274 { 44,0xFF},
2275 { 45,0xD5},
2276 { 46,0x00},
2277 { 47,0x00},
2278 { 48,0xFE},
2279 { 49,0x36},
2280 { 50,0x00},
2281 { 51,0x00},
2282 { 52,0xFA},
2283 { 53,0xAC},
2284 { 54,0x00},
2285 { 55,0x00},
2286 { 56,0xF2},
2287 { 57,0xA3},
2288 { 58,0x00},
2289 { 59,0x00},
2290 { 60,0x28},
2291 { 61,0xAB},
2292 { 62,0x00},
2293 { 63,0x00},
2294 { 64,0x3F},
2295 { 65,0xFF},
2296 { 66,0x00},
2297 { 67,0x00},
2298 { 68,0xFF},
2299 { 69,0x98},
2300 { 70,0x00},
2301 { 71,0x00},
2302 { 72,0xF6},
2303 { 73,0xF9},
2304 { 74,0x00},
2305 { 75,0x00},
2306 { 76,0x26},
2307 { 77,0xFB},
2308 { 78,0x00},
2309 { 79,0x00},
2310 { 80,0x02},
2311 { 81,0x72},
2312 { 82,0x00},
2313 { 83,0x00},
2314 { 84,0x40},
2315 { 85,0x02},
2316 { 86,0x00},
2317 { 87,0x00},
2318 { 88,0xFB},
2319 { 89,0xCB},
2320 { 90,0x00},
2321 { 91,0x00},
2322 { 92,0x20},
2323 { 93,0xA7},
2324 { 94,0x00},
2325 { 95,0x00},
2326 { 96,0xFF},
2327 { 97,0x6A},
2328 { 98,0x00},
2329 { 99,0x00},
2330 {100,0x3A},
2331 {101,0x0F},
2332 {102,0x00},
2333 {103,0x00},
2334 { 0,0x0},
2335 { 0x7F,0x3C},
2336 { 0,0x01},
2337 { 8,0xC0},
2338 { 9,0x00},
2339 { 10,0x00},
2340 { 11,0x00},
2341 { 12,0xC0},
2342 { 13,0x00},
2343 { 14,0x00},
2344 { 15,0x00},
2345 { 0,0x0},
2346 { 0x7F,0x78},
2347 { 0,0x01},
2348 { 8,0x04},
2349 { 9,0x00},
2350 { 10,0x00},
2351 { 11,0x00},
2352 { 12,0x04},
2353 { 13,0x00},
2354 { 14,0x20},
2355 { 15,0x01},
2356 { 16,0x58},
2357 { 17,0x60},
2358 { 18,0x08},
2359 { 19,0x01},
2360 { 20,0x60},
2361 { 21,0x60},
2362 { 22,0x00},
2363 { 23,0x00},
2364 { 24,0x58},
2365 { 25,0x60},
2366 { 26,0x00},
2367 { 27,0x2D},
2368 { 28,0x00},
2369 { 29,0x00},
2370 { 30,0x00},
2371 { 31,0x00},
2372 { 32,0x44},
2373 { 33,0x00},
2374 { 34,0xC0},
2375 { 35,0x16},
2376 { 36,0x08},
2377 { 37,0x00},
2378 { 38,0x00},
2379 { 39,0xBE},
2380 { 40,0x08},
2381 { 41,0x00},
2382 { 42,0x20},
2383 { 43,0xFE},
2384 { 44,0x08},
2385 { 45,0x00},
2386 { 46,0x00},
2387 { 47,0xBD},
2388 { 48,0x08},
2389 { 49,0x00},
2390 { 50,0x20},
2391 { 51,0xFD},
2392 { 52,0x08},
2393 { 53,0x00},
2394 { 54,0x00},
2395 { 55,0xBC},
2396 { 56,0x08},
2397 { 57,0x00},
2398 { 58,0x20},
2399 { 59,0xFC},
2400 { 60,0x08},
2401 { 61,0x00},
2402 { 62,0x00},
2403 { 63,0xBB},
2404 { 64,0x08},
2405 { 65,0x00},
2406 { 66,0x20},
2407 { 67,0xFB},
2408 { 68,0x08},
2409 { 69,0x00},
2410 { 70,0x00},
2411 { 71,0xBA},
2412 { 72,0x08},
2413 { 73,0x00},
2414 { 74,0x20},
2415 { 75,0xFA},
2416 { 76,0x08},
2417 { 77,0x00},
2418 { 78,0x00},
2419 { 79,0xB9},
2420 { 80,0x08},
2421 { 81,0x00},
2422 { 82,0x20},
2423 { 83,0xF9},
2424 { 84,0x08},
2425 { 85,0x00},
2426 { 86,0x00},
2427 { 87,0xB8},
2428 { 88,0x08},
2429 { 89,0x00},
2430 { 90,0x20},
2431 { 91,0xF8},
2432 { 92,0x08},
2433 { 93,0x00},
2434 { 94,0x00},
2435 { 95,0xB7},
2436 { 96,0x08},
2437 { 97,0x00},
2438 { 98,0x20},
2439 { 99,0xF7},
2440 {100,0x00},
2441 {101,0x00},
2442 {102,0x00},
2443 {103,0x00},
2444 {104,0x00},
2445 {105,0x00},
2446 {106,0x00},
2447 {107,0x00},
2448 {108,0x00},
2449 {109,0x00},
2450 {110,0x00},
2451 {111,0x00},
2452 {112,0x00},
2453 {113,0x00},
2454 {114,0x00},
2455 {115,0x00},
2456 {116,0x00},
2457 {117,0x00},
2458 {118,0x00},
2459 {119,0x00},
2460 {120,0x44},
2461 {121,0x00},
2462 {122,0x00},
2463 {123,0x06},
2464 {124,0x21},
2465 {125,0x00},
2466 {126,0x20},
2467 {127,0x00},
2468 { 0,0x02},
2469 { 8,0x4B},
2470 { 9,0x00},
2471 { 10,0xC0},
2472 { 11,0x00},
2473 { 12,0x4B},
2474 { 13,0x00},
2475 { 14,0xE0},
2476 { 15,0x00},
2477 { 16,0x00},
2478 { 17,0x00},
2479 { 18,0x40},
2480 { 19,0x48},
2481 { 20,0x0C},
2482 { 21,0x00},
2483 { 22,0x00},
2484 { 23,0x00},
2485 { 24,0x0C},
2486 { 25,0x00},
2487 { 26,0x20},
2488 { 27,0x00},
2489 { 28,0x18},
2490 { 29,0x01},
2491 { 30,0xA0},
2492 { 31,0x00},
2493 { 32,0x18},
2494 { 33,0x01},
2495 { 34,0xA0},
2496 { 35,0x01},
2497 { 36,0x00},
2498 { 37,0x00},
2499 { 38,0x00},
2500 { 39,0x00},
2501 { 40,0x00},
2502 { 41,0x00},
2503 { 42,0x00},
2504 { 43,0x00},
2505 { 44,0x10},
2506 { 45,0x13},
2507 { 46,0xE0},
2508 { 47,0x04},
2509 { 48,0x10},
2510 { 49,0x13},
2511 { 50,0xE0},
2512 { 51,0x05},
2513 { 52,0x18},
2514 { 53,0x01},
2515 { 54,0xA0},
2516 { 55,0x04},
2517 { 56,0x1C},
2518 { 57,0x01},
2519 { 58,0xA0},
2520 { 59,0x05},
2521 { 60,0x00},
2522 { 61,0x00},
2523 { 62,0x00},
2524 { 63,0x00},
2525 { 64,0x00},
2526 { 65,0x00},
2527 { 66,0x00},
2528 { 67,0x00},
2529 { 68,0x00},
2530 { 69,0x00},
2531 { 70,0x00},
2532 { 71,0x00},
2533 { 72,0x10},
2534 { 73,0x00},
2535 { 74,0x00},
2536 { 75,0x08},
2537 { 76,0x18},
2538 { 77,0x04},
2539 { 78,0x40},
2540 { 79,0x08},
2541 { 80,0x1C},
2542 { 81,0x04},
2543 { 82,0x40},
2544 { 83,0x09},
2545 { 84,0x1C},
2546 { 85,0x04},
2547 { 86,0x60},
2548 { 87,0x0B},
2549 { 88,0x00},
2550 { 89,0x00},
2551 { 90,0x00},
2552 { 91,0x00},
2553 { 92,0x00},
2554 { 93,0x00},
2555 { 94,0x00},
2556 { 95,0x00},
2557 { 96,0x00},
2558 { 97,0x00},
2559 { 98,0x00},
2560 { 99,0x00},
2561 {100,0x10},
2562 {101,0x00},
2563 {102,0x00},
2564 {103,0x0A},
2565 {104,0x18},
2566 {105,0x01},
2567 {106,0xA0},
2568 {107,0x04},
2569 {108,0x1C},
2570 {109,0x01},
2571 {110,0xC0},
2572 {111,0x0A},
2573 {112,0x18},
2574 {113,0x01},
2575 {114,0xA0},
2576 {115,0x05},
2577 {116,0x1C},
2578 {117,0x01},
2579 {118,0xC0},
2580 {119,0x0A},
2581 {120,0x00},
2582 {121,0x00},
2583 {122,0x00},
2584 {123,0x00},
2585 {124,0x10},
2586 {125,0x00},
2587 {126,0x00},
2588 {127,0x04},
2589 { 0,0x03},
2590 { 8,0x00},
2591 { 9,0x00},
2592 { 10,0x00},
2593 { 11,0x00},
2594 { 12,0x10},
2595 { 13,0x00},
2596 { 14,0x00},
2597 { 15,0x05},
2598 { 16,0x18},
2599 { 17,0x04},
2600 { 18,0x40},
2601 { 19,0x0A},
2602 { 20,0x1C},
2603 { 21,0x04},
2604 { 22,0x40},
2605 { 23,0x0B},
2606 { 24,0x1C},
2607 { 25,0x04},
2608 { 26,0x60},
2609 { 27,0x0D},
2610 { 28,0x00},
2611 { 29,0x00},
2612 { 30,0x00},
2613 { 31,0x00},
2614 { 32,0x00},
2615 { 33,0x00},
2616 { 34,0x00},
2617 { 35,0x00},
2618 { 36,0x00},
2619 { 37,0x00},
2620 { 38,0x00},
2621 { 39,0x00},
2622 { 40,0x10},
2623 { 41,0x00},
2624 { 42,0x00},
2625 { 43,0x0C},
2626 { 44,0x18},
2627 { 45,0x04},
2628 { 46,0x80},
2629 { 47,0x0C},
2630 { 48,0x1C},
2631 { 49,0x04},
2632 { 50,0xA0},
2633 { 51,0x0E},
2634 { 52,0x6C},
2635 { 53,0x04},
2636 { 54,0xC0},
2637 { 55,0x10},
2638 { 56,0x1C},
2639 { 57,0x04},
2640 { 58,0xE0},
2641 { 59,0x11},
2642 { 60,0x00},
2643 { 61,0x00},
2644 { 62,0x00},
2645 { 63,0x00},
2646 { 64,0x00},
2647 { 65,0x00},
2648 { 66,0x00},
2649 { 67,0x00},
2650 { 68,0x00},
2651 { 69,0x00},
2652 { 70,0x00},
2653 { 71,0x00},
2654 { 72,0x10},
2655 { 73,0x00},
2656 { 74,0x00},
2657 { 75,0x0F},
2658 { 76,0x18},
2659 { 77,0x05},
2660 { 78,0x20},
2661 { 79,0x0E},
2662 { 80,0x1C},
2663 { 81,0x05},
2664 { 82,0x00},
2665 { 83,0x0C},
2666 { 84,0x6C},
2667 { 85,0x05},
2668 { 86,0x40},
2669 { 87,0x13},
2670 { 88,0x1C},
2671 { 89,0x05},
2672 { 90,0x60},
2673 { 91,0x14},
2674 { 92,0x00},
2675 { 93,0x00},
2676 { 94,0x00},
2677 { 95,0x00},
2678 { 96,0x00},
2679 { 97,0x00},
2680 { 98,0x00},
2681 { 99,0x00},
2682 {100,0x00},
2683 {101,0x00},
2684 {102,0x00},
2685 {103,0x00},
2686 {104,0x10},
2687 {105,0x00},
2688 {106,0x00},
2689 {107,0x12},
2690 {108,0x18},
2691 {109,0x01},
2692 {110,0xC0},
2693 {111,0x0F},
2694 {112,0x1C},
2695 {113,0x01},
2696 {114,0xC0},
2697 {115,0x12},
2698 {116,0x00},
2699 {117,0x00},
2700 {118,0x00},
2701 {119,0x00},
2702 {120,0x00},
2703 {121,0x00},
2704 {122,0x00},
2705 {123,0x00},
2706 {124,0x00},
2707 {125,0x00},
2708 {126,0x00},
2709 {127,0x00},
2710 { 0,0x04},
2711 { 8,0x10},
2712 { 9,0x00},
2713 { 10,0x00},
2714 { 11,0x16},
2715 { 12,0x30},
2716 { 13,0x01},
2717 { 14,0xA0},
2718 { 15,0x16},
2719 { 16,0x58},
2720 { 17,0x60},
2721 { 18,0x00},
2722 { 19,0x0E},
2723 { 20,0x00},
2724 { 21,0x00},
2725 { 22,0x00},
2726 { 23,0x00},
2727 { 24,0x00},
2728 { 25,0x00},
2729 { 26,0x00},
2730 { 27,0x00},
2731 { 28,0x20},
2732 { 29,0x02},
2733 { 30,0xE0},
2734 { 31,0x00},
2735 { 32,0x10},
2736 { 33,0x00},
2737 { 34,0x00},
2738 { 35,0x18},
2739 { 36,0x58},
2740 { 37,0x60},
2741 { 38,0x00},
2742 { 39,0x17},
2743 { 40,0x40},
2744 { 41,0x02},
2745 { 42,0xC0},
2746 { 43,0x18},
2747 { 44,0x00},
2748 { 45,0x00},
2749 { 46,0x00},
2750 { 47,0x00},
2751 { 48,0x00},
2752 { 49,0x00},
2753 { 50,0x00},
2754 { 51,0x00},
2755 { 52,0x00},
2756 { 53,0x00},
2757 { 54,0x00},
2758 { 55,0x00},
2759 { 56,0x44},
2760 { 57,0x00},
2761 { 58,0x40},
2762 { 59,0x10},
2763 { 60,0x44},
2764 { 61,0x00},
2765 { 62,0x80},
2766 { 63,0x10},
2767 { 64,0x58},
2768 { 65,0x60},
2769 { 66,0x00},
2770 { 67,0x17},
2771 { 68,0x1C},
2772 { 69,0x02},
2773 { 70,0xC0},
2774 { 71,0x18},
2775 { 72,0x00},
2776 { 73,0x00},
2777 { 74,0x00},
2778 { 75,0x00},
2779 { 76,0x24},
2780 { 77,0x04},
2781 { 78,0x00},
2782 { 79,0x02},
2783 { 80,0x00},
2784 { 81,0x00},
2785 { 82,0x00},
2786 { 83,0x00},
2787 { 84,0x00},
2788 { 85,0x00},
2789 { 86,0x00},
2790 { 87,0x00},
2791 { 88,0x00},
2792 { 89,0x00},
2793 { 90,0x00},
2794 { 91,0x00},
2795 { 92,0x20},
2796 { 93,0x03},
2797 { 94,0x20},
2798 { 95,0x00},
2799 { 96,0x58},
2800 { 97,0x60},
2801 { 98,0x00},
2802 { 99,0x17},
2803 {100,0x1C},
2804 {101,0x03},
2805 {102,0x20},
2806 {103,0x18},
2807 {104,0x00},
2808 {105,0x00},
2809 {106,0x00},
2810 {107,0x00},
2811 {108,0x00},
2812 {109,0x00},
2813 {110,0x00},
2814 {111,0x00},
2815 {112,0x00},
2816 {113,0x00},
2817 {114,0x00},
2818 {115,0x00},
2819 {116,0x20},
2820 {117,0x02},
2821 {118,0xC0},
2822 {119,0x02},
2823 {120,0x44},
2824 {121,0x00},
2825 {122,0x00},
2826 {123,0x10},
2827 {124,0x00},
2828 {125,0x00},
2829 {126,0x00},
2830 {127,0x00},
2831 { 0,0x05},
2832 { 8,0x00},
2833 { 9,0x00},
2834 { 10,0x00},
2835 { 11,0x00},
2836 { 12,0x58},
2837 { 13,0x60},
2838 { 14,0x00},
2839 { 15,0x16},
2840 { 16,0x1C},
2841 { 17,0x02},
2842 { 18,0xE0},
2843 { 19,0x18},
2844 { 20,0x00},
2845 { 21,0x00},
2846 { 22,0x00},
2847 { 23,0x00},
2848 { 24,0x24},
2849 { 25,0x04},
2850 { 26,0x20},
2851 { 27,0x02},
2852 { 28,0x00},
2853 { 29,0x00},
2854 { 30,0x00},
2855 { 31,0x00},
2856 { 32,0x00},
2857 { 33,0x00},
2858 { 34,0x00},
2859 { 35,0x00},
2860 { 36,0x00},
2861 { 37,0x00},
2862 { 38,0x00},
2863 { 39,0x00},
2864 { 40,0x20},
2865 { 41,0x03},
2866 { 42,0x20},
2867 { 43,0x00},
2868 { 44,0x58},
2869 { 45,0x60},
2870 { 46,0x00},
2871 { 47,0x17},
2872 { 48,0x58},
2873 { 49,0x70},
2874 { 50,0x00},
2875 { 51,0x19},
2876 { 52,0x00},
2877 { 53,0x00},
2878 { 54,0x00},
2879 { 55,0x00},
2880 { 56,0x00},
2881 { 57,0x00},
2882 { 58,0x00},
2883 { 59,0x00},
2884 { 60,0x00},
2885 { 61,0x00},
2886 { 62,0x00},
2887 { 63,0x00},
2888 { 64,0x20},
2889 { 65,0x02},
2890 { 66,0xC0},
2891 { 67,0x02},
2892 { 68,0x58},
2893 { 69,0x60},
2894 { 70,0x00},
2895 { 71,0x15},
2896 { 72,0x00},
2897 { 73,0x00},
2898 { 74,0x00},
2899 { 75,0x00},
2900 { 76,0x24},
2901 { 77,0x02},
2902 { 78,0xC0},
2903 { 79,0x02},
2904 { 80,0x00},
2905 { 81,0x00},
2906 { 82,0x00},
2907 { 83,0x00},
2908 { 84,0x00},
2909 { 85,0x00},
2910 { 86,0x00},
2911 { 87,0x00},
2912 { 88,0x00},
2913 { 89,0x00},
2914 { 90,0x00},
2915 { 91,0x00},
2916 { 92,0x20},
2917 { 93,0x03},
2918 { 94,0x00},
2919 { 95,0x00},
2920 { 96,0x24},
2921 { 97,0x03},
2922 { 98,0x00},
2923 { 99,0x00},
2924 {100,0x00},
2925 {101,0x00},
2926 {102,0x00},
2927 {103,0x00},
2928 {104,0x00},
2929 {105,0x00},
2930 {106,0x00},
2931 {107,0x00},
2932 {108,0x00},
2933 {109,0x00},
2934 {110,0x00},
2935 {111,0x00},
2936 {112,0x20},
2937 {113,0x03},
2938 {114,0x00},
2939 {115,0x05},
2940 {116,0x58},
2941 {117,0x60},
2942 {118,0x00},
2943 {119,0x15},
2944 {120,0x00},
2945 {121,0x00},
2946 {122,0x00},
2947 {123,0x00},
2948 {124,0x24},
2949 {125,0x03},
2950 {126,0x00},
2951 {127,0x02},
2952 { 0,0x06},
2953 { 8,0x00},
2954 { 9,0x00},
2955 { 10,0x00},
2956 { 11,0x00},
2957 { 12,0x00},
2958 { 13,0x00},
2959 { 14,0x00},
2960 { 15,0x00},
2961 { 16,0x00},
2962 { 17,0x00},
2963 { 18,0x00},
2964 { 19,0x00},
2965 { 20,0x20},
2966 { 21,0x03},
2967 { 22,0x00},
2968 { 23,0x05},
2969 { 24,0x58},
2970 { 25,0x60},
2971 { 26,0x00},
2972 { 27,0x14},
2973 { 28,0x1C},
2974 { 29,0x03},
2975 { 30,0x00},
2976 { 31,0x18},
2977 { 32,0x00},
2978 { 33,0x00},
2979 { 34,0x00},
2980 { 35,0x00},
2981 { 36,0x24},
2982 { 37,0x02},
2983 { 38,0x60},
2984 { 39,0x00},
2985 { 40,0x58},
2986 { 41,0x70},
2987 { 42,0x00},
2988 { 43,0x15},
2989 { 44,0x00},
2990 { 45,0x00},
2991 { 46,0x00},
2992 { 47,0x00},
2993 { 48,0x00},
2994 { 49,0x00},
2995 { 50,0x00},
2996 { 51,0x00},
2997 { 52,0x00},
2998 { 53,0x00},
2999 { 54,0x00},
3000 { 55,0x00},
3001 { 56,0x20},
3002 { 57,0x02},
3003 { 58,0xA0},
3004 { 59,0x02},
3005 { 60,0x58},
3006 { 61,0x60},
3007 { 62,0x00},
3008 { 63,0x15},
3009 { 64,0x40},
3010 { 65,0x00},
3011 { 66,0xC0},
3012 { 67,0x18},
3013 { 68,0x58},
3014 { 69,0x60},
3015 { 70,0x00},
3016 { 71,0x06},
3017 { 72,0x00},
3018 { 73,0x00},
3019 { 74,0x00},
3020 { 75,0x00},
3021 { 76,0x00},
3022 { 77,0x00},
3023 { 78,0x00},
3024 { 79,0x00},
3025 { 80,0x44},
3026 { 81,0x00},
3027 { 82,0x80},
3028 { 83,0x02},
3029 { 84,0x20},
3030 { 85,0x02},
3031 { 86,0xA0},
3032 { 87,0x02},
3033 { 88,0x44},
3034 { 89,0x00},
3035 { 90,0x00},
3036 { 91,0x02},
3037 { 92,0x00},
3038 { 93,0x00},
3039 { 94,0x00},
3040 { 95,0x00},
3041 { 96,0x00},
3042 { 97,0x00},
3043 { 98,0x00},
3044 { 99,0x00},
3045 {100,0x18},
3046 {101,0x02},
3047 {102,0xA0},
3048 {103,0x16},
3049 {104,0x18},
3050 {105,0x01},
3051 {106,0xE0},
3052 {107,0x0C},
3053 {108,0x00},
3054 {109,0x00},
3055 {110,0x00},
3056 {111,0x00},
3057 {112,0x00},
3058 {113,0x00},
3059 {114,0x00},
3060 {115,0x00},
3061 {116,0x10},
3062 {117,0x00},
3063 {118,0xA0},
3064 {119,0x15},
3065 {120,0x10},
3066 {121,0x00},
3067 {122,0x00},
3068 {123,0x17},
3069 {124,0x18},
3070 {125,0x01},
3071 {126,0xA0},
3072 {127,0x15},
3073 { 0,0x07},
3074 { 8,0x1C},
3075 { 9,0x01},
3076 { 10,0xA0},
3077 { 11,0x17},
3078 { 12,0x00},
3079 { 13,0x00},
3080 { 14,0x00},
3081 { 15,0x00},
3082 { 16,0x24},
3083 { 17,0x00},
3084 { 18,0xA0},
3085 { 19,0x00},
3086 { 20,0x00},
3087 { 21,0x00},
3088 { 22,0x00},
3089 { 23,0x00},
3090 { 24,0x00},
3091 { 25,0x00},
3092 { 26,0x00},
3093 { 27,0x00},
3094 { 28,0x00},
3095 { 29,0x00},
3096 { 30,0x00},
3097 { 31,0x00},
3098 { 32,0x10},
3099 { 33,0x00},
3100 { 34,0x00},
3101 { 35,0x19},
3102 { 36,0x58},
3103 { 37,0x60},
3104 { 38,0x00},
3105 { 39,0x0A},
3106 { 40,0x59},
3107 { 41,0x00},
3108 { 42,0x00},
3109 { 43,0x1E},
3110 { 44,0x58},
3111 { 45,0x60},
3112 { 46,0x00},
3113 { 47,0x0A},
3114 { 48,0x59},
3115 { 49,0x00},
3116 { 50,0x00},
3117 { 51,0x1B},
3118 { 52,0x00},
3119 { 53,0x00},
3120 { 54,0x00},
3121 { 55,0x00},
3122 { 56,0x44},
3123 { 57,0x00},
3124 { 58,0x40},
3125 { 59,0x3A},
3126 { 60,0x00},
3127 { 61,0x00},
3128 { 62,0x00},
3129 { 63,0x00},
3130 { 64,0x44},
3131 { 65,0x00},
3132 { 66,0x40},
3133 { 67,0x68},
3134 { 68,0x18},
3135 { 69,0x02},
3136 { 70,0x00},
3137 { 71,0x04},
3138 { 72,0x1C},
3139 { 73,0x02},
3140 { 74,0x20},
3141 { 75,0x05},
3142 { 76,0x00},
3143 { 77,0x00},
3144 { 78,0x00},
3145 { 79,0x00},
3146 { 80,0x58},
3147 { 81,0x60},
3148 { 82,0x00},
3149 { 83,0x0A},
3150 { 84,0x00},
3151 { 85,0x00},
3152 { 86,0x00},
3153 { 87,0x00},
3154 { 88,0x10},
3155 { 89,0x00},
3156 { 90,0x20},
3157 { 91,0x1A},
3158 { 92,0x10},
3159 { 93,0x00},
3160 { 94,0x20},
3161 { 95,0x1B},
3162 { 96,0x59},
3163 { 97,0x00},
3164 { 98,0x00},
3165 { 99,0x1C},
3166 {100,0x00},
3167 {101,0x00},
3168 {102,0x00},
3169 {103,0x00},
3170 {104,0x00},
3171 {105,0x00},
3172 {106,0x00},
3173 {107,0x00},
3174 {108,0x00},
3175 {109,0x00},
3176 {110,0x00},
3177 {111,0x00},
3178 {112,0x44},
3179 {113,0x00},
3180 {114,0x40},
3181 {115,0x0A},
3182 {116,0x18},
3183 {117,0x05},
3184 {118,0xC0},
3185 {119,0x1B},
3186 {120,0x6C},
3187 {121,0x05},
3188 {122,0xE0},
3189 {123,0x1C},
3190 {124,0x1C},
3191 {125,0x06},
3192 {126,0x00},
3193 {127,0x1D},
3194 { 0,0x08},
3195 { 8,0x6C},
3196 { 9,0x06},
3197 { 10,0x20},
3198 { 11,0x1F},
3199 { 12,0x1C},
3200 { 13,0x06},
3201 { 14,0x40},
3202 { 15,0x20},
3203 { 16,0x00},
3204 { 17,0x00},
3205 { 18,0x00},
3206 { 19,0x00},
3207 { 20,0x00},
3208 { 21,0x00},
3209 { 22,0x00},
3210 { 23,0x00},
3211 { 24,0x00},
3212 { 25,0x00},
3213 { 26,0x00},
3214 { 27,0x00},
3215 { 28,0x10},
3216 { 29,0x00},
3217 { 30,0x20},
3218 { 31,0x1E},
3219 { 32,0x44},
3220 { 33,0x00},
3221 { 34,0x00},
3222 { 35,0x0A},
3223 { 36,0x18},
3224 { 37,0x06},
3225 { 38,0x60},
3226 { 39,0x1B},
3227 { 40,0x6C},
3228 { 41,0x06},
3229 { 42,0x80},
3230 { 43,0x1C},
3231 { 44,0x1C},
3232 { 45,0x06},
3233 { 46,0xA0},
3234 { 47,0x1D},
3235 { 48,0x6C},
3236 { 49,0x06},
3237 { 50,0xC0},
3238 { 51,0x1F},
3239 { 52,0x1C},
3240 { 53,0x06},
3241 { 54,0xE0},
3242 { 55,0x20},
3243 { 56,0x00},
3244 { 57,0x00},
3245 { 58,0x00},
3246 { 59,0x00},
3247 { 60,0x00},
3248 { 61,0x00},
3249 { 62,0x00},
3250 { 63,0x00},
3251 { 64,0x00},
3252 { 65,0x00},
3253 { 66,0x00},
3254 { 67,0x00},
3255 { 68,0x10},
3256 { 69,0x00},
3257 { 70,0x40},
3258 { 71,0x1E},
3259 { 72,0x00},
3260 { 73,0x00},
3261 { 74,0x00},
3262 { 75,0x00},
3263 { 76,0x18},
3264 { 77,0x02},
3265 { 78,0x00},
3266 { 79,0x1F},
3267 { 80,0x1C},
3268 { 81,0x07},
3269 { 82,0x00},
3270 { 83,0x1E},
3271 { 84,0x1C},
3272 { 85,0x07},
3273 { 86,0x20},
3274 { 87,0x22},
3275 { 88,0x18},
3276 { 89,0x02},
3277 { 90,0x00},
3278 { 91,0x04},
3279 { 92,0x1C},
3280 { 93,0x02},
3281 { 94,0x00},
3282 { 95,0x05},
3283 { 96,0x00},
3284 { 97,0x00},
3285 { 98,0x00},
3286 { 99,0x00},
3287 {100,0x10},
3288 {101,0x00},
3289 {102,0x20},
3290 {103,0x21},
3291 {104,0x00},
3292 {105,0x00},
3293 {106,0x00},
3294 {107,0x00},
3295 {108,0x10},
3296 {109,0x00},
3297 {110,0x20},
3298 {111,0x23},
3299 {112,0x18},
3300 {113,0x00},
3301 {114,0xE0},
3302 {115,0x21},
3303 {116,0x1C},
3304 {117,0x01},
3305 {118,0x00},
3306 {119,0x23},
3307 {120,0x00},
3308 {121,0x00},
3309 {122,0x00},
3310 {123,0x00},
3311 {124,0x18},
3312 {125,0x00},
3313 {126,0xE0},
3314 {127,0x21},
3315 { 0,0x09},
3316 { 8,0x00},
3317 { 9,0x00},
3318 { 10,0x00},
3319 { 11,0x00},
3320 { 12,0x10},
3321 { 13,0x00},
3322 { 14,0x00},
3323 { 15,0x47},
3324 { 16,0x24},
3325 { 17,0x01},
3326 { 18,0xC0},
3327 { 19,0x00},
3328 { 20,0x00},
3329 { 21,0x00},
3330 { 22,0x00},
3331 { 23,0x00},
3332 { 24,0x1C},
3333 { 25,0x01},
3334 { 26,0x00},
3335 { 27,0x23},
3336 { 28,0x00},
3337 { 29,0x00},
3338 { 30,0x00},
3339 { 31,0x00},
3340 { 32,0x00},
3341 { 33,0x00},
3342 { 34,0x00},
3343 { 35,0x00},
3344 { 36,0x00},
3345 { 37,0x00},
3346 { 38,0x00},
3347 { 39,0x00},
3348 { 40,0x10},
3349 { 41,0x00},
3350 { 42,0x00},
3351 { 43,0x4D},
3352 { 44,0x00},
3353 { 45,0x00},
3354 { 46,0x00},
3355 { 47,0x00},
3356 { 48,0x44},
3357 { 49,0x00},
3358 { 50,0x00},
3359 { 51,0x5E},
3360 { 52,0x18},
3361 { 53,0x02},
3362 { 54,0x00},
3363 { 55,0x04},
3364 { 56,0x18},
3365 { 57,0x02},
3366 { 58,0x00},
3367 { 59,0x05},
3368 { 60,0x00},
3369 { 61,0x00},
3370 { 62,0x00},
3371 { 63,0x00},
3372 { 64,0x00},
3373 { 65,0x00},
3374 { 66,0x00},
3375 { 67,0x00},
3376 { 68,0x10},
3377 { 69,0x00},
3378 { 70,0x20},
3379 { 71,0x24},
3380 { 72,0x10},
3381 { 73,0x00},
3382 { 74,0x20},
3383 { 75,0x2A},
3384 { 76,0x18},
3385 { 77,0x09},
3386 { 78,0x00},
3387 { 79,0x24},
3388 { 80,0x1C},
3389 { 81,0x01},
3390 { 82,0xA0},
3391 { 83,0x25},
3392 { 84,0x1C},
3393 { 85,0x09},
3394 { 86,0x20},
3395 { 87,0x27},
3396 { 88,0x00},
3397 { 89,0x00},
3398 { 90,0x00},
3399 { 91,0x00},
3400 { 92,0x18},
3401 { 93,0x01},
3402 { 94,0xA0},
3403 { 95,0x27},
3404 { 96,0x00},
3405 { 97,0x00},
3406 { 98,0x00},
3407 { 99,0x00},
3408 {100,0x4C},
3409 {101,0x09},
3410 {102,0x40},
3411 {103,0x26},
3412 {104,0x1C},
3413 {105,0x09},
3414 {106,0x60},
3415 {107,0x29},
3416 {108,0x18},
3417 {109,0x09},
3418 {110,0x80},
3419 {111,0x2A},
3420 {112,0x1C},
3421 {113,0x01},
3422 {114,0xA0},
3423 {115,0x2B},
3424 {116,0x00},
3425 {117,0x00},
3426 {118,0x00},
3427 {119,0x00},
3428 {120,0x10},
3429 {121,0x00},
3430 {122,0x00},
3431 {123,0x28},
3432 {124,0x1C},
3433 {125,0x09},
3434 {126,0xA0},
3435 {127,0x2D},
3436 { 0,0x0A},
3437 { 8,0x00},
3438 { 9,0x00},
3439 { 10,0x00},
3440 { 11,0x00},
3441 { 12,0x18},
3442 { 13,0x01},
3443 { 14,0x20},
3444 { 15,0x28},
3445 { 16,0x00},
3446 { 17,0x00},
3447 { 18,0x00},
3448 { 19,0x00},
3449 { 20,0x10},
3450 { 21,0x00},
3451 { 22,0x00},
3452 { 23,0x2C},
3453 { 24,0x18},
3454 { 25,0x01},
3455 { 26,0x20},
3456 { 27,0x2C},
3457 { 28,0x10},
3458 { 29,0x00},
3459 { 30,0x00},
3460 { 31,0x44},
3461 { 32,0x00},
3462 { 33,0x00},
3463 { 34,0x00},
3464 { 35,0x00},
3465 { 36,0x00},
3466 { 37,0x00},
3467 { 38,0x00},
3468 { 39,0x00},
3469 { 40,0x10},
3470 { 41,0x00},
3471 { 42,0x00},
3472 { 43,0x45},
3473 { 44,0x18},
3474 { 45,0x02},
3475 { 46,0x00},
3476 { 47,0x44},
3477 { 48,0x1C},
3478 { 49,0x02},
3479 { 50,0x20},
3480 { 51,0x45},
3481 { 52,0x00},
3482 { 53,0x00},
3483 { 54,0x00},
3484 { 55,0x00},
3485 { 56,0x24},
3486 { 57,0x00},
3487 { 58,0xE0},
3488 { 59,0x01},
3489 { 60,0x00},
3490 { 61,0x00},
3491 { 62,0x00},
3492 { 63,0x00},
3493 { 64,0x24},
3494 { 65,0x02},
3495 { 66,0x40},
3496 { 67,0x00},
3497 { 68,0x00},
3498 { 69,0x00},
3499 { 70,0x00},
3500 { 71,0x00},
3501 { 72,0x00},
3502 { 73,0x00},
3503 { 74,0x00},
3504 { 75,0x00},
3505 { 76,0x00},
3506 { 77,0x00},
3507 { 78,0x00},
3508 { 79,0x00},
3509 { 80,0x10},
3510 { 81,0x00},
3511 { 82,0x40},
3512 { 83,0x46},
3513 { 84,0x18},
3514 { 85,0x02},
3515 { 86,0x00},
3516 { 87,0x44},
3517 { 88,0x1C},
3518 { 89,0x02},
3519 { 90,0x00},
3520 { 91,0x46},
3521 { 92,0x18},
3522 { 93,0x02},
3523 { 94,0x00},
3524 { 95,0x45},
3525 { 96,0x1C},
3526 { 97,0x02},
3527 { 98,0x20},
3528 { 99,0x46},
3529 {100,0x00},
3530 {101,0x00},
3531 {102,0x00},
3532 {103,0x00},
3533 {104,0x10},
3534 {105,0x00},
3535 {106,0x20},
3536 {107,0x47},
3537 {108,0x00},
3538 {109,0x00},
3539 {110,0x00},
3540 {111,0x00},
3541 {112,0x10},
3542 {113,0x00},
3543 {114,0x20},
3544 {115,0x4D},
3545 {116,0x00},
3546 {117,0x00},
3547 {118,0x00},
3548 {119,0x00},
3549 {120,0x44},
3550 {121,0x00},
3551 {122,0x00},
3552 {123,0x2E},
3553 {124,0x18},
3554 {125,0x02},
3555 {126,0x00},
3556 {127,0x04},
3557 { 0,0x0B},
3558 { 8,0x1C},
3559 { 9,0x02},
3560 { 10,0x00},
3561 { 11,0x05},
3562 { 12,0x18},
3563 { 13,0x02},
3564 { 14,0x00},
3565 { 15,0x04},
3566 { 16,0x1C},
3567 { 17,0x02},
3568 { 18,0x20},
3569 { 19,0x05},
3570 { 20,0x00},
3571 { 21,0x00},
3572 { 22,0x00},
3573 { 23,0x00},
3574 { 24,0x10},
3575 { 25,0x00},
3576 { 26,0x20},
3577 { 27,0x2E},
3578 { 28,0x00},
3579 { 29,0x00},
3580 { 30,0x00},
3581 { 31,0x00},
3582 { 32,0x10},
3583 { 33,0x00},
3584 { 34,0x20},
3585 { 35,0x32},
3586 { 36,0x00},
3587 { 37,0x00},
3588 { 38,0x00},
3589 { 39,0x00},
3590 { 40,0x10},
3591 { 41,0x00},
3592 { 42,0x20},
3593 { 43,0x38},
3594 { 44,0x10},
3595 { 45,0x00},
3596 { 46,0x20},
3597 { 47,0x3E},
3598 { 48,0x18},
3599 { 49,0x07},
3600 { 50,0x40},
3601 { 51,0x2E},
3602 { 52,0x1C},
3603 { 53,0x01},
3604 { 54,0xC0},
3605 { 55,0x2F},
3606 { 56,0x1C},
3607 { 57,0x07},
3608 { 58,0x60},
3609 { 59,0x31},
3610 { 60,0x18},
3611 { 61,0x07},
3612 { 62,0x80},
3613 { 63,0x32},
3614 { 64,0x1C},
3615 { 65,0x07},
3616 { 66,0xA0},
3617 { 67,0x34},
3618 { 68,0x00},
3619 { 69,0x00},
3620 { 70,0x00},
3621 { 71,0x00},
3622 { 72,0x10},
3623 { 73,0x00},
3624 { 74,0x00},
3625 { 75,0x30},
3626 { 76,0x6C},
3627 { 77,0x07},
3628 { 78,0xC0},
3629 { 79,0x36},
3630 { 80,0x1C},
3631 { 81,0x07},
3632 { 82,0xE0},
3633 { 83,0x37},
3634 { 84,0x18},
3635 { 85,0x08},
3636 { 86,0x00},
3637 { 87,0x38},
3638 { 88,0x1C},
3639 { 89,0x08},
3640 { 90,0x20},
3641 { 91,0x3A},
3642 { 92,0x00},
3643 { 93,0x00},
3644 { 94,0x00},
3645 { 95,0x00},
3646 { 96,0x10},
3647 { 97,0x00},
3648 { 98,0x00},
3649 { 99,0x35},
3650 {100,0x6C},
3651 {101,0x08},
3652 {102,0x40},
3653 {103,0x3C},
3654 {104,0x1C},
3655 {105,0x08},
3656 {106,0x60},
3657 {107,0x3D},
3658 {108,0x18},
3659 {109,0x08},
3660 {110,0x80},
3661 {111,0x3E},
3662 {112,0x1C},
3663 {113,0x08},
3664 {114,0xA0},
3665 {115,0x40},
3666 {116,0x00},
3667 {117,0x00},
3668 {118,0x00},
3669 {119,0x00},
3670 {120,0x10},
3671 {121,0x00},
3672 {122,0x00},
3673 {123,0x3B},
3674 {124,0x6C},
3675 {125,0x08},
3676 {126,0xC0},
3677 {127,0x42},
3678 { 0,0x0C},
3679 { 8,0x1C},
3680 { 9,0x08},
3681 { 10,0xE0},
3682 { 11,0x43},
3683 { 12,0x18},
3684 { 13,0x02},
3685 { 14,0x00},
3686 { 15,0x35},
3687 { 16,0x1C},
3688 { 17,0x02},
3689 { 18,0x00},
3690 { 19,0x3B},
3691 { 20,0x00},
3692 { 21,0x00},
3693 { 22,0x00},
3694 { 23,0x00},
3695 { 24,0x10},
3696 { 25,0x00},
3697 { 26,0x00},
3698 { 27,0x41},
3699 { 28,0x1C},
3700 { 29,0x02},
3701 { 30,0x00},
3702 { 31,0x41},
3703 { 32,0x00},
3704 { 33,0x00},
3705 { 34,0x00},
3706 { 35,0x00},
3707 { 36,0x24},
3708 { 37,0x00},
3709 { 38,0xE0},
3710 { 39,0x00},
3711 { 40,0x00},
3712 { 41,0x00},
3713 { 42,0x00},
3714 { 43,0x00},
3715 { 44,0x1C},
3716 { 45,0x02},
3717 { 46,0x00},
3718 { 47,0x30},
3719 { 48,0x00},
3720 { 49,0x00},
3721 { 50,0x00},
3722 { 51,0x00},
3723 { 52,0x00},
3724 { 53,0x00},
3725 { 54,0x00},
3726 { 55,0x00},
3727 { 56,0x00},
3728 { 57,0x00},
3729 { 58,0x00},
3730 { 59,0x00},
3731 { 60,0x10},
3732 { 61,0x00},
3733 { 62,0x20},
3734 { 63,0x47},
3735 { 64,0x10},
3736 { 65,0x00},
3737 { 66,0x20},
3738 { 67,0x4D},
3739 { 68,0x18},
3740 { 69,0x02},
3741 { 70,0x00},
3742 { 71,0x47},
3743 { 72,0x18},
3744 { 73,0x02},
3745 { 74,0x00},
3746 { 75,0x4D},
3747 { 76,0x00},
3748 { 77,0x00},
3749 { 78,0x00},
3750 { 79,0x00},
3751 { 80,0x00},
3752 { 81,0x00},
3753 { 82,0x00},
3754 { 83,0x00},
3755 { 84,0x10},
3756 { 85,0x00},
3757 { 86,0x20},
3758 { 87,0x55},
3759 { 88,0x10},
3760 { 89,0x00},
3761 { 90,0x20},
3762 { 91,0x59},
3763 { 92,0x58},
3764 { 93,0x60},
3765 { 94,0x00},
3766 { 95,0x0A},
3767 { 96,0x59},
3768 { 97,0x00},
3769 { 98,0x00},
3770 { 99,0x1B},
3771 {100,0x00},
3772 {101,0x00},
3773 {102,0x00},
3774 {103,0x00},
3775 {104,0x00},
3776 {105,0x00},
3777 {106,0x00},
3778 {107,0x00},
3779 {108,0x00},
3780 {109,0x00},
3781 {110,0x00},
3782 {111,0x00},
3783 {112,0x44},
3784 {113,0x00},
3785 {114,0x40},
3786 {115,0x07},
3787 {116,0x18},
3788 {117,0x02},
3789 {118,0x00},
3790 {119,0x47},
3791 {120,0x1C},
3792 {121,0x02},
3793 {122,0x00},
3794 {123,0x19},
3795 {124,0x18},
3796 {125,0x02},
3797 {126,0x00},
3798 {127,0x4D},
3799 { 0,0x0D},
3800 { 8,0x1C},
3801 { 9,0x02},
3802 { 10,0x00},
3803 { 11,0x19},
3804 { 12,0x00},
3805 { 13,0x00},
3806 { 14,0x00},
3807 { 15,0x00},
3808 { 16,0x10},
3809 { 17,0x00},
3810 { 18,0x20},
3811 { 19,0x02},
3812 { 20,0x44},
3813 { 21,0x00},
3814 { 22,0x00},
3815 { 23,0x07},
3816 { 24,0x18},
3817 { 25,0x02},
3818 { 26,0x00},
3819 { 27,0x19},
3820 { 28,0x1C},
3821 { 29,0x02},
3822 { 30,0x20},
3823 { 31,0x47},
3824 { 32,0x18},
3825 { 33,0x02},
3826 { 34,0x00},
3827 { 35,0x19},
3828 { 36,0x1C},
3829 { 37,0x02},
3830 { 38,0x20},
3831 { 39,0x4D},
3832 { 40,0x00},
3833 { 41,0x00},
3834 { 42,0x00},
3835 { 43,0x00},
3836 { 44,0x10},
3837 { 45,0x00},
3838 { 46,0x20},
3839 { 47,0x02},
3840 { 48,0x00},
3841 { 49,0x00},
3842 { 50,0x00},
3843 { 51,0x00},
3844 { 52,0x10},
3845 { 53,0x00},
3846 { 54,0x20},
3847 { 55,0x03},
3848 { 56,0x18},
3849 { 57,0x09},
3850 { 58,0xC0},
3851 { 59,0x47},
3852 { 60,0x6C},
3853 { 61,0x09},
3854 { 62,0xE0},
3855 { 63,0x48},
3856 { 64,0x1C},
3857 { 65,0x09},
3858 { 66,0xC0},
3859 { 67,0x49},
3860 { 68,0x6C},
3861 { 69,0x0A},
3862 { 70,0x00},
3863 { 71,0x4B},
3864 { 72,0x1C},
3865 { 73,0x0A},
3866 { 74,0x20},
3867 { 75,0x4C},
3868 { 76,0x18},
3869 { 77,0x09},
3870 { 78,0xC0},
3871 { 79,0x4D},
3872 { 80,0x6C},
3873 { 81,0x09},
3874 { 82,0xE0},
3875 { 83,0x4E},
3876 { 84,0x00},
3877 { 85,0x00},
3878 { 86,0x00},
3879 { 87,0x00},
3880 { 88,0x10},
3881 { 89,0x00},
3882 { 90,0x00},
3883 { 91,0x4A},
3884 { 92,0x1C},
3885 { 93,0x09},
3886 { 94,0xC0},
3887 { 95,0x4F},
3888 { 96,0x6C},
3889 { 97,0x0A},
3890 { 98,0x00},
3891 { 99,0x51},
3892 {100,0x1C},
3893 {101,0x0A},
3894 {102,0x20},
3895 {103,0x52},
3896 {104,0x58},
3897 {105,0x60},
3898 {106,0x00},
3899 {107,0x0B},
3900 {108,0x00},
3901 {109,0x00},
3902 {110,0x00},
3903 {111,0x00},
3904 {112,0x00},
3905 {113,0x00},
3906 {114,0x00},
3907 {115,0x00},
3908 {116,0x10},
3909 {117,0x00},
3910 {118,0x00},
3911 {119,0x50},
3912 {120,0x20},
3913 {121,0x03},
3914 {122,0xE0},
3915 {123,0x02},
3916 {124,0x00},
3917 {125,0x00},
3918 {126,0x00},
3919 {127,0x00},
3920 { 0,0x0E},
3921 { 8,0x18},
3922 { 9,0x03},
3923 { 10,0xE0},
3924 { 11,0x4A},
3925 { 12,0x18},
3926 { 13,0x03},
3927 { 14,0xE0},
3928 { 15,0x50},
3929 { 16,0x00},
3930 { 17,0x00},
3931 { 18,0x00},
3932 { 19,0x00},
3933 { 20,0x00},
3934 { 21,0x00},
3935 { 22,0x00},
3936 { 23,0x00},
3937 { 24,0x10},
3938 { 25,0x00},
3939 { 26,0x40},
3940 { 27,0x53},
3941 { 28,0x10},
3942 { 29,0x00},
3943 { 30,0x40},
3944 { 31,0x54},
3945 { 32,0x18},
3946 { 33,0x02},
3947 { 34,0x00},
3948 { 35,0x02},
3949 { 36,0x1C},
3950 { 37,0x02},
3951 { 38,0x00},
3952 { 39,0x53},
3953 { 40,0x18},
3954 { 41,0x02},
3955 { 42,0x00},
3956 { 43,0x03},
3957 { 44,0x1C},
3958 { 45,0x02},
3959 { 46,0x00},
3960 { 47,0x54},
3961 { 48,0x00},
3962 { 49,0x00},
3963 { 50,0x00},
3964 { 51,0x00},
3965 { 52,0x10},
3966 { 53,0x00},
3967 { 54,0x20},
3968 { 55,0x02},
3969 { 56,0x00},
3970 { 57,0x00},
3971 { 58,0x00},
3972 { 59,0x00},
3973 { 60,0x10},
3974 { 61,0x00},
3975 { 62,0x20},
3976 { 63,0x03},
3977 { 64,0x18},
3978 { 65,0x0A},
3979 { 66,0x40},
3980 { 67,0x55},
3981 { 68,0x1C},
3982 { 69,0x0A},
3983 { 70,0x60},
3984 { 71,0x56},
3985 { 72,0x1C},
3986 { 73,0x0A},
3987 { 74,0x80},
3988 { 75,0x58},
3989 { 76,0x18},
3990 { 77,0x0A},
3991 { 78,0x40},
3992 { 79,0x59},
3993 { 80,0x1C},
3994 { 81,0x0A},
3995 { 82,0x60},
3996 { 83,0x5A},
3997 { 84,0x00},
3998 { 85,0x00},
3999 { 86,0x00},
4000 { 87,0x00},
4001 { 88,0x10},
4002 { 89,0x00},
4003 { 90,0x20},
4004 { 91,0x57},
4005 { 92,0x1C},
4006 { 93,0x0A},
4007 { 94,0x80},
4008 { 95,0x5C},
4009 { 96,0x00},
4010 { 97,0x00},
4011 { 98,0x00},
4012 { 99,0x00},
4013 {100,0x00},
4014 {101,0x00},
4015 {102,0x00},
4016 {103,0x00},
4017 {104,0x00},
4018 {105,0x00},
4019 {106,0x00},
4020 {107,0x00},
4021 {108,0x10},
4022 {109,0x00},
4023 {110,0x20},
4024 {111,0x5B},
4025 {112,0x18},
4026 {113,0x01},
4027 {114,0x80},
4028 {115,0x57},
4029 {116,0x18},
4030 {117,0x01},
4031 {118,0x80},
4032 {119,0x5B},
4033 {120,0x00},
4034 {121,0x00},
4035 {122,0x00},
4036 {123,0x00},
4037 {124,0x00},
4038 {125,0x00},
4039 {126,0x00},
4040 {127,0x00},
4041 { 0,0x0F},
4042 { 8,0x10},
4043 { 9,0x00},
4044 { 10,0x00},
4045 { 11,0x5D},
4046 { 12,0x10},
4047 { 13,0x00},
4048 { 14,0x00},
4049 { 15,0x5E},
4050 { 16,0x18},
4051 { 17,0x02},
4052 { 18,0x00},
4053 { 19,0x02},
4054 { 20,0x1C},
4055 { 21,0x02},
4056 { 22,0x00},
4057 { 23,0x5D},
4058 { 24,0x18},
4059 { 25,0x02},
4060 { 26,0x00},
4061 { 27,0x03},
4062 { 28,0x1C},
4063 { 29,0x02},
4064 { 30,0x00},
4065 { 31,0x5E},
4066 { 32,0x00},
4067 { 33,0x00},
4068 { 34,0x00},
4069 { 35,0x00},
4070 { 36,0x10},
4071 { 37,0x00},
4072 { 38,0x20},
4073 { 39,0x02},
4074 { 40,0x00},
4075 { 41,0x00},
4076 { 42,0x00},
4077 { 43,0x00},
4078 { 44,0x10},
4079 { 45,0x00},
4080 { 46,0x20},
4081 { 47,0x03},
4082 { 48,0x58},
4083 { 49,0x60},
4084 { 50,0x00},
4085 { 51,0x00},
4086 { 52,0x59},
4087 { 53,0x00},
4088 { 54,0x00},
4089 { 55,0x61},
4090 { 56,0x58},
4091 { 57,0x70},
4092 { 58,0x00},
4093 { 59,0x00},
4094 { 60,0x59},
4095 { 61,0x00},
4096 { 62,0x00},
4097 { 63,0x61},
4098 { 64,0x00},
4099 { 65,0x00},
4100 { 66,0x00},
4101 { 67,0x00},
4102 { 68,0x44},
4103 { 69,0x00},
4104 { 70,0x40},
4105 { 71,0x05},
4106 { 72,0x00},
4107 { 73,0x00},
4108 { 74,0x00},
4109 { 75,0x00},
4110 { 76,0x44},
4111 { 77,0x00},
4112 { 78,0x40},
4113 { 79,0x08},
4114 { 80,0x58},
4115 { 81,0x60},
4116 { 82,0x00},
4117 { 83,0x2D},
4118 { 84,0x00},
4119 { 85,0x00},
4120 { 86,0x00},
4121 { 87,0x00},
4122 { 88,0x44},
4123 { 89,0x00},
4124 { 90,0x00},
4125 { 91,0x08},
4126 { 92,0x00},
4127 { 93,0x00},
4128 { 94,0x00},
4129 { 95,0x00},
4130 { 96,0x00},
4131 { 97,0x00},
4132 { 98,0x00},
4133 { 99,0x00},
4134 {100,0x18},
4135 {101,0x03},
4136 {102,0x40},
4137 {103,0x00},
4138 {104,0x18},
4139 {105,0x03},
4140 {106,0x40},
4141 {107,0x01},
4142 {108,0x44},
4143 {109,0x00},
4144 {110,0x00},
4145 {111,0x03},
4146 {112,0x18},
4147 {113,0x03},
4148 {114,0x40},
4149 {115,0x02},
4150 {116,0x18},
4151 {117,0x03},
4152 {118,0x40},
4153 {119,0x03},
4154 {120,0x44},
4155 {121,0x00},
4156 {122,0x00},
4157 {123,0x00},
4158 {124,0x00},
4159 {125,0x00},
4160 {126,0x00},
4161 {127,0x00},
4162 { 0,0x10},
4163 { 8,0x10},
4164 { 9,0x00},
4165 { 10,0x20},
4166 { 11,0x5F},
4167 { 12,0x10},
4168 { 13,0x00},
4169 { 14,0x20},
4170 { 15,0x60},
4171 { 16,0x18},
4172 { 17,0x03},
4173 { 18,0x40},
4174 { 19,0x5F},
4175 { 20,0x18},
4176 { 21,0x0A},
4177 { 22,0xE0},
4178 { 23,0x63},
4179 { 24,0x6C},
4180 { 25,0x0A},
4181 { 26,0xC0},
4182 { 27,0x62},
4183 { 28,0x6C},
4184 { 29,0x0B},
4185 { 30,0x00},
4186 { 31,0x65},
4187 { 32,0x10},
4188 { 33,0x00},
4189 { 34,0x20},
4190 { 35,0x61},
4191 { 36,0x1C},
4192 { 37,0x0A},
4193 { 38,0xA0},
4194 { 39,0x61},
4195 { 40,0x1C},
4196 { 41,0x0B},
4197 { 42,0x20},
4198 { 43,0x66},
4199 { 44,0x00},
4200 { 45,0x00},
4201 { 46,0x00},
4202 { 47,0x00},
4203 { 48,0x00},
4204 { 49,0x00},
4205 { 50,0x00},
4206 { 51,0x00},
4207 { 52,0x00},
4208 { 53,0x00},
4209 { 54,0x00},
4210 { 55,0x00},
4211 { 56,0x10},
4212 { 57,0x00},
4213 { 58,0x00},
4214 { 59,0x64},
4215 { 60,0x18},
4216 { 61,0x03},
4217 { 62,0x40},
4218 { 63,0x60},
4219 { 64,0x18},
4220 { 65,0x0B},
4221 { 66,0x80},
4222 { 67,0x69},
4223 { 68,0x6C},
4224 { 69,0x0B},
4225 { 70,0x60},
4226 { 71,0x68},
4227 { 72,0x6C},
4228 { 73,0x0B},
4229 { 74,0xA0},
4230 { 75,0x6B},
4231 { 76,0x10},
4232 { 77,0x00},
4233 { 78,0x20},
4234 { 79,0x67},
4235 { 80,0x1C},
4236 { 81,0x0B},
4237 { 82,0x40},
4238 { 83,0x67},
4239 { 84,0x1C},
4240 { 85,0x0B},
4241 { 86,0xC0},
4242 { 87,0x6C},
4243 { 88,0x00},
4244 { 89,0x00},
4245 { 90,0x00},
4246 { 91,0x00},
4247 { 92,0x00},
4248 { 93,0x00},
4249 { 94,0x00},
4250 { 95,0x00},
4251 { 96,0x00},
4252 { 97,0x00},
4253 { 98,0x00},
4254 { 99,0x00},
4255 {100,0x10},
4256 {101,0x00},
4257 {102,0x00},
4258 {103,0x6A},
4259 {104,0x30},
4260 {105,0x0C},
4261 {106,0x40},
4262 {107,0x64},
4263 {108,0x1C},
4264 {109,0x0C},
4265 {110,0x60},
4266 {111,0x70},
4267 {112,0x30},
4268 {113,0x0C},
4269 {114,0x40},
4270 {115,0x6A},
4271 {116,0x1C},
4272 {117,0x0C},
4273 {118,0x60},
4274 {119,0x72},
4275 {120,0x00},
4276 {121,0x00},
4277 {122,0x00},
4278 {123,0x00},
4279 {124,0x10},
4280 {125,0x00},
4281 {126,0x00},
4282 {127,0x6F},
4283 { 0,0x11},
4284 { 8,0x40},
4285 { 9,0x00},
4286 { 10,0x20},
4287 { 11,0x6F},
4288 { 12,0x10},
4289 { 13,0x00},
4290 { 14,0x00},
4291 { 15,0x71},
4292 { 16,0x00},
4293 { 17,0x00},
4294 { 18,0x00},
4295 { 19,0x00},
4296 { 20,0x18},
4297 { 21,0x03},
4298 { 22,0x40},
4299 { 23,0x6F},
4300 { 24,0x44},
4301 { 25,0x00},
4302 { 26,0x80},
4303 { 27,0x02},
4304 { 28,0x18},
4305 { 29,0x03},
4306 { 30,0x40},
4307 { 31,0x71},
4308 { 32,0x44},
4309 { 33,0x00},
4310 { 34,0x00},
4311 { 35,0x02},
4312 { 36,0x00},
4313 { 37,0x00},
4314 { 38,0x00},
4315 { 39,0x00},
4316 { 40,0x00},
4317 { 41,0x00},
4318 { 42,0x00},
4319 { 43,0x00},
4320 { 44,0x59},
4321 { 45,0x00},
4322 { 46,0x00},
4323 { 47,0x71},
4324 { 48,0x59},
4325 { 49,0x00},
4326 { 50,0x00},
4327 { 51,0x72},
4328 { 52,0x00},
4329 { 53,0x00},
4330 { 54,0x00},
4331 { 55,0x00},
4332 { 56,0x00},
4333 { 57,0x00},
4334 { 58,0x00},
4335 { 59,0x00},
4336 { 60,0x44},
4337 { 61,0x00},
4338 { 62,0x60},
4339 { 63,0x0B},
4340 { 64,0x44},
4341 { 65,0x00},
4342 { 66,0x80},
4343 { 67,0x05},
4344 { 68,0x0C},
4345 { 69,0x00},
4346 { 70,0x80},
4347 { 71,0x03},
4348 { 72,0x58},
4349 { 73,0x60},
4350 { 74,0x00},
4351 { 75,0x2D},
4352 { 76,0x06},
4353 { 77,0x00},
4354 { 78,0x80},
4355 { 79,0x70},
4356 { 80,0x58},
4357 { 81,0x70},
4358 { 82,0x00},
4359 { 83,0x70},
4360 { 84,0x44},
4361 { 85,0x00},
4362 { 86,0x00},
4363 { 87,0x0B},
4364 { 88,0x0C},
4365 { 89,0x00},
4366 { 90,0x80},
4367 { 91,0x0D},
4368 { 92,0x58},
4369 { 93,0x60},
4370 { 94,0x00},
4371 { 95,0x73},
4372 { 96,0x06},
4373 { 97,0x00},
4374 { 98,0x80},
4375 { 99,0x70},
4376 {100,0x58},
4377 {101,0x70},
4378 {102,0x00},
4379 {103,0x70},
4380 {104,0x44},
4381 {105,0x00},
4382 {106,0x00},
4383 {107,0x06},
4384 {108,0x00},
4385 {109,0x00},
4386 {110,0x00},
4387 {111,0x00},
4388 {112,0x0C},
4389 {113,0x00},
4390 {114,0x80},
4391 {115,0x01},
4392 {116,0x58},
4393 {117,0x60},
4394 {118,0x00},
4395 {119,0x74},
4396 {120,0x06},
4397 {121,0x00},
4398 {122,0x80},
4399 {123,0x70},
4400 {124,0x58},
4401 {125,0x70},
4402 {126,0x00},
4403 {127,0x70},
4404 { 0,0x12},
4405 { 8,0x00},
4406 { 9,0x00},
4407 { 10,0x00},
4408 { 11,0x00},
4409 { 12,0x00},
4410 { 13,0x00},
4411 { 14,0x00},
4412 { 15,0x00},
4413 { 16,0x00},
4414 { 17,0x00},
4415 { 18,0x00},
4416 { 19,0x00},
4417 { 20,0x20},
4418 { 21,0x0E},
4419 { 22,0x00},
4420 { 23,0x01},
4421 { 24,0x58},
4422 { 25,0x60},
4423 { 26,0x00},
4424 { 27,0x70},
4425 { 28,0x59},
4426 { 29,0x00},
4427 { 30,0x00},
4428 { 31,0x67},
4429 { 32,0x59},
4430 { 33,0x00},
4431 { 34,0x00},
4432 { 35,0x68},
4433 { 36,0x58},
4434 { 37,0x70},
4435 { 38,0x00},
4436 { 39,0x68},
4437 { 40,0x00},
4438 { 41,0x00},
4439 { 42,0x00},
4440 { 43,0x00},
4441 { 44,0x44},
4442 { 45,0x00},
4443 { 46,0x80},
4444 { 47,0x0B},
4445 { 48,0x44},
4446 { 49,0x00},
4447 { 50,0x80},
4448 { 51,0x05},
4449 { 52,0x20},
4450 { 53,0x0E},
4451 { 54,0xA0},
4452 { 55,0x02},
4453 { 56,0x58},
4454 { 57,0x60},
4455 { 58,0x00},
4456 { 59,0x6A},
4457 { 60,0x58},
4458 { 61,0x60},
4459 { 62,0x00},
4460 { 63,0x66},
4461 { 64,0x58},
4462 { 65,0x60},
4463 { 66,0x00},
4464 { 67,0x2D},
4465 { 68,0x44},
4466 { 69,0x00},
4467 { 70,0x00},
4468 { 71,0x0B},
4469 { 72,0x20},
4470 { 73,0x0E},
4471 { 74,0xA0},
4472 { 75,0x02},
4473 { 76,0x58},
4474 { 77,0x60},
4475 { 78,0x00},
4476 { 79,0x6A},
4477 { 80,0x58},
4478 { 81,0x60},
4479 { 82,0x00},
4480 { 83,0x65},
4481 { 84,0x58},
4482 { 85,0x60},
4483 { 86,0x00},
4484 { 87,0x2D},
4485 { 88,0x44},
4486 { 89,0x00},
4487 { 90,0x00},
4488 { 91,0x06},
4489 { 92,0x58},
4490 { 93,0x60},
4491 { 94,0x00},
4492 { 95,0x70},
4493 { 96,0x58},
4494 { 97,0x70},
4495 { 98,0x00},
4496 { 99,0x67},
4497 {100,0x58},
4498 {101,0x60},
4499 {102,0x00},
4500 {103,0x69},
4501 {104,0x58},
4502 {105,0x60},
4503 {106,0x00},
4504 {107,0x64},
4505 {108,0x58},
4506 {109,0x60},
4507 {110,0x00},
4508 {111,0x2D},
4509 {112,0x20},
4510 {113,0x0E},
4511 {114,0xA0},
4512 {115,0x02},
4513 {116,0x4C},
4514 {117,0x0D},
4515 {118,0xE0},
4516 {119,0x76},
4517 {120,0x4C},
4518 {121,0x0E},
4519 {122,0xA0},
4520 {123,0x73},
4521 {124,0x59},
4522 {125,0x00},
4523 {126,0x00},
4524 {127,0x77},
4525 { 0,0x13},
4526 { 8,0x59},
4527 { 9,0x00},
4528 { 10,0x00},
4529 { 11,0x76},
4530 { 12,0x58},
4531 { 13,0x60},
4532 { 14,0x00},
4533 { 15,0x77},
4534 { 16,0x10},
4535 { 17,0x00},
4536 { 18,0xA0},
4537 { 19,0x75},
4538 { 20,0x44},
4539 { 21,0x00},
4540 { 22,0x60},
4541 { 23,0x05},
4542 { 24,0x44},
4543 { 25,0x00},
4544 { 26,0x80},
4545 { 27,0x06},
4546 { 28,0x00},
4547 { 29,0x00},
4548 { 30,0x00},
4549 { 31,0x00},
4550 { 32,0x00},
4551 { 33,0x00},
4552 { 34,0x00},
4553 { 35,0x00},
4554 { 36,0x00},
4555 { 37,0x00},
4556 { 38,0x00},
4557 { 39,0x00},
4558 { 40,0x44},
4559 { 41,0x00},
4560 { 42,0x00},
4561 { 43,0x06},
4562 { 44,0x58},
4563 { 45,0x60},
4564 { 46,0x00},
4565 { 47,0x76},
4566 { 48,0x44},
4567 { 49,0x00},
4568 { 50,0x00},
4569 { 51,0x01},
4570 { 52,0x00},
4571 { 53,0x00},
4572 { 54,0x00},
4573 { 55,0x00},
4574 { 56,0x00},
4575 { 57,0x00},
4576 { 58,0x00},
4577 { 59,0x00},
4578 { 60,0x00},
4579 { 61,0x00},
4580 { 62,0x00},
4581 { 63,0x00},
4582 { 64,0x10},
4583 { 65,0x00},
4584 { 66,0xA0},
4585 { 67,0x75},
4586 { 68,0x18},
4587 { 69,0x0F},
4588 { 70,0x00},
4589 { 71,0x75},
4590 { 72,0x64},
4591 { 73,0x00},
4592 { 74,0xC0},
4593 { 75,0x00},
4594 { 76,0x0C},
4595 { 77,0x07},
4596 { 78,0x40},
4597 { 79,0x02},
4598 { 80,0x64},
4599 { 81,0x30},
4600 { 82,0x20},
4601 { 83,0x79},
4602 { 84,0x00},
4603 { 85,0x00},
4604 { 86,0x00},
4605 { 87,0x00},
4606 { 88,0x00},
4607 { 89,0x00},
4608 { 90,0x00},
4609 { 91,0x00},
4610 { 92,0x58},
4611 { 93,0x60},
4612 { 94,0x00},
4613 { 95,0x7A},
4614 { 96,0x20},
4615 { 97,0x0F},
4616 { 98,0xC0},
4617 { 99,0x00},
4618 {100,0x58},
4619 {101,0x60},
4620 {102,0x00},
4621 {103,0x7B},
4622 {104,0x38},
4623 {105,0x0F},
4624 {106,0xC0},
4625 {107,0x76},
4626 {108,0x58},
4627 {109,0x60},
4628 {110,0x00},
4629 {111,0x7C},
4630 {112,0x38},
4631 {113,0x0F},
4632 {114,0xC0},
4633 {115,0x76},
4634 {116,0x58},
4635 {117,0x60},
4636 {118,0x00},
4637 {119,0x7D},
4638 {120,0x38},
4639 {121,0x0F},
4640 {122,0xC0},
4641 {123,0x76},
4642 {124,0x64},
4643 {125,0x03},
4644 {126,0x40},
4645 {127,0x00},
4646 { 0,0x14},
4647 { 8,0x64},
4648 { 9,0x20},
4649 { 10,0x60},
4650 { 11,0x00},
4651 { 12,0x00},
4652 { 13,0x00},
4653 { 14,0x00},
4654 { 15,0x00},
4655 { 16,0x00},
4656 { 17,0x00},
4657 { 18,0x00},
4658 { 19,0x00},
4659 { 20,0x00},
4660 { 21,0x00},
4661 { 22,0x00},
4662 { 23,0x00},
4663 { 24,0x10},
4664 { 25,0x00},
4665 { 26,0x00},
4666 { 27,0x76},
4667 { 28,0x18},
4668 { 29,0x03},
4669 { 30,0x40},
4670 { 31,0x73},
4671 { 32,0x18},
4672 { 33,0x03},
4673 { 34,0x40},
4674 { 35,0x76},
4675 { 36,0x58},
4676 { 37,0x60},
4677 { 38,0x00},
4678 { 39,0x1A},
4679 { 40,0x18},
4680 { 41,0x0C},
4681 { 42,0x00},
4682 { 43,0x7A},
4683 { 44,0x44},
4684 { 45,0x00},
4685 { 46,0xC0},
4686 { 47,0x03},
4687 { 48,0x10},
4688 { 49,0x00},
4689 { 50,0x20},
4690 { 51,0x78},
4691 { 52,0x10},
4692 { 53,0x13},
4693 { 54,0x60},
4694 { 55,0x77},
4695 { 56,0x44},
4696 { 57,0x00},
4697 { 58,0x00},
4698 { 59,0x03},
4699 { 60,0x10},
4700 { 61,0x00},
4701 { 62,0x20},
4702 { 63,0x77},
4703 { 64,0x10},
4704 { 65,0x13},
4705 { 66,0x60},
4706 { 67,0x78},
4707 { 68,0x00},
4708 { 69,0x00},
4709 { 70,0x00},
4710 { 71,0x00},
4711 { 72,0x40},
4712 { 73,0x03},
4713 { 74,0x40},
4714 { 75,0x77},
4715 { 76,0x18},
4716 { 77,0x0D},
4717 { 78,0x80},
4718 { 79,0x7A},
4719 { 80,0x1C},
4720 { 81,0x0D},
4721 { 82,0x60},
4722 { 83,0x77},
4723 { 84,0x18},
4724 { 85,0x0D},
4725 { 86,0xC0},
4726 { 87,0x7A},
4727 { 88,0x1C},
4728 { 89,0x0D},
4729 { 90,0xA0},
4730 { 91,0x77},
4731 { 92,0x44},
4732 { 93,0x00},
4733 { 94,0x60},
4734 { 95,0x03},
4735 { 96,0x10},
4736 { 97,0x00},
4737 { 98,0x00},
4738 { 99,0x79},
4739 {100,0x18},
4740 {101,0x0C},
4741 {102,0x00},
4742 {103,0x7C},
4743 {104,0x44},
4744 {105,0x00},
4745 {106,0x00},
4746 {107,0x03},
4747 {108,0x00},
4748 {109,0x00},
4749 {110,0x00},
4750 {111,0x00},
4751 {112,0x18},
4752 {113,0x0C},
4753 {114,0x00},
4754 {115,0x7C},
4755 {116,0x10},
4756 {117,0x00},
4757 {118,0x00},
4758 {119,0x79},
4759 {120,0x40},
4760 {121,0x03},
4761 {122,0x40},
4762 {123,0x78},
4763 {124,0x64},
4764 {125,0x50},
4765 {126,0x00},
4766 {127,0x79},
4767 { 0,0x15},
4768 { 8,0x00},
4769 { 9,0x00},
4770 { 10,0x00},
4771 { 11,0x00},
4772 { 12,0x00},
4773 { 13,0x00},
4774 { 14,0x00},
4775 { 15,0x00},
4776 { 16,0x44},
4777 { 17,0x00},
4778 { 18,0x60},
4779 { 19,0x03},
4780 { 20,0x18},
4781 { 21,0x0D},
4782 { 22,0xC0},
4783 { 23,0x7C},
4784 { 24,0x1C},
4785 { 25,0x0D},
4786 { 26,0xA0},
4787 { 27,0x78},
4788 { 28,0x44},
4789 { 29,0x00},
4790 { 30,0x00},
4791 { 31,0x03},
4792 { 32,0x18},
4793 { 33,0x0D},
4794 { 34,0x80},
4795 { 35,0x7C},
4796 { 36,0x1C},
4797 { 37,0x0D},
4798 { 38,0x60},
4799 { 39,0x78},
4800 { 40,0x00},
4801 { 41,0x00},
4802 { 42,0x00},
4803 { 43,0x00},
4804 { 44,0x00},
4805 { 45,0x00},
4806 { 46,0x00},
4807 { 47,0x00},
4808 { 48,0x00},
4809 { 49,0x00},
4810 { 50,0x00},
4811 { 51,0x00},
4812 { 52,0x10},
4813 { 53,0x00},
4814 { 54,0x00},
4815 { 55,0x7B},
4816 { 56,0x20},
4817 { 57,0x10},
4818 { 58,0x00},
4819 { 59,0x00},
4820 { 60,0x64},
4821 { 61,0x40},
4822 { 62,0x80},
4823 { 63,0x64},
4824 { 64,0x64},
4825 { 65,0x40},
4826 { 66,0x80},
4827 { 67,0x6A},
4828 { 68,0x24},
4829 { 69,0x10},
4830 { 70,0x00},
4831 { 71,0x08},
4832 { 72,0x24},
4833 { 73,0x10},
4834 { 74,0x00},
4835 { 75,0x08},
4836 { 76,0x00},
4837 { 77,0x00},
4838 { 78,0x00},
4839 { 79,0x00},
4840 { 80,0x00},
4841 { 81,0x00},
4842 { 82,0x00},
4843 { 83,0x00},
4844 { 84,0x10},
4845 { 85,0x01},
4846 { 86,0x00},
4847 { 87,0x6D},
4848 { 88,0x10},
4849 { 89,0x01},
4850 { 90,0x00},
4851 { 91,0x6E},
4852 { 92,0x58},
4853 { 93,0x60},
4854 { 94,0x00},
4855 { 95,0x00},
4856 { 96,0x59},
4857 { 97,0x00},
4858 { 98,0x00},
4859 { 99,0x5F},
4860 {100,0x58},
4861 {101,0x70},
4862 {102,0x00},
4863 {103,0x00},
4864 {104,0x59},
4865 {105,0x00},
4866 {106,0x00},
4867 {107,0x5F},
4868 {108,0x00},
4869 {109,0x00},
4870 {110,0x00},
4871 {111,0x00},
4872 {112,0x44},
4873 {113,0x00},
4874 {114,0x40},
4875 {115,0x05},
4876 {116,0x00},
4877 {117,0x00},
4878 {118,0x00},
4879 {119,0x00},
4880 {120,0x44},
4881 {121,0x00},
4882 {122,0x40},
4883 {123,0x08},
4884 {124,0x58},
4885 {125,0x60},
4886 {126,0x00},
4887 {127,0x2D},
4888 { 0,0x16},
4889 { 8,0x00},
4890 { 9,0x00},
4891 { 10,0x00},
4892 { 11,0x00},
4893 { 12,0x44},
4894 { 13,0x00},
4895 { 14,0x00},
4896 { 15,0x08},
4897 { 16,0x00},
4898 { 17,0x00},
4899 { 18,0x00},
4900 { 19,0x00},
4901 { 20,0x00},
4902 { 21,0x00},
4903 { 22,0x00},
4904 { 23,0x00},
4905 { 24,0x18},
4906 { 25,0x03},
4907 { 26,0x40},
4908 { 27,0x5F},
4909 { 28,0x18},
4910 { 29,0x03},
4911 { 30,0x40},
4912 { 31,0x60},
4913 { 32,0x44},
4914 { 33,0x00},
4915 { 34,0x00},
4916 { 35,0x03},
4917 { 36,0x18},
4918 { 37,0x03},
4919 { 38,0x40},
4920 { 39,0x6D},
4921 { 40,0x18},
4922 { 41,0x03},
4923 { 42,0x40},
4924 { 43,0x6E},
4925 { 44,0x44},
4926 { 45,0x00},
4927 { 46,0x00},
4928 { 47,0x00},
4929 { 48,0x00},
4930 { 49,0x00},
4931 { 50,0x00},
4932 { 51,0x00},
4933 { 52,0x10},
4934 { 53,0x00},
4935 { 54,0x20},
4936 { 55,0x7D},
4937 { 56,0x10},
4938 { 57,0x00},
4939 { 58,0x20},
4940 { 59,0x7E},
4941 { 60,0x18},
4942 { 61,0x03},
4943 { 62,0x40},
4944 { 63,0x7D},
4945 { 64,0x18},
4946 { 65,0x03},
4947 { 66,0x40},
4948 { 67,0x7E},
4949 { 68,0x18},
4950 { 69,0x00},
4951 { 70,0x60},
4952 { 71,0x82},
4953 { 72,0x1C},
4954 { 73,0x00},
4955 { 74,0x80},
4956 { 75,0x84},
4957 { 76,0x10},
4958 { 77,0x00},
4959 { 78,0x20},
4960 { 79,0x81},
4961 { 80,0x10},
4962 { 81,0x00},
4963 { 82,0x20},
4964 { 83,0xBF},
4965 { 84,0x1C},
4966 { 85,0x00},
4967 { 86,0x40},
4968 { 87,0x81},
4969 { 88,0x18},
4970 { 89,0x00},
4971 { 90,0x60},
4972 { 91,0xC0},
4973 { 92,0x1C},
4974 { 93,0x00},
4975 { 94,0x80},
4976 { 95,0xC4},
4977 { 96,0x1C},
4978 { 97,0x00},
4979 { 98,0x40},
4980 { 99,0xBF},
4981 {100,0x10},
4982 {101,0x30},
4983 {102,0x00},
4984 {103,0x83},
4985 {104,0x00},
4986 {105,0x00},
4987 {106,0x00},
4988 {107,0x00},
4989 {108,0x00},
4990 {109,0x00},
4991 {110,0x00},
4992 {111,0x00},
4993 {112,0x10},
4994 {113,0x30},
4995 {114,0x00},
4996 {115,0xC3},
4997 {116,0x18},
4998 {117,0x10},
4999 {118,0x20},
5000 {119,0xA8},
5001 {120,0x1C},
5002 {121,0x10},
5003 {122,0x40},
5004 {123,0x85},
5005 {124,0x1C},
5006 {125,0x10},
5007 {126,0x20},
5008 {127,0x83},
5009 { 0,0x17},
5010 { 8,0x1C},
5011 { 9,0x10},
5012 { 10,0x40},
5013 { 11,0xA6},
5014 { 12,0x1C},
5015 { 13,0x10},
5016 { 14,0x60},
5017 { 15,0x87},
5018 { 16,0x1C},
5019 { 17,0x10},
5020 { 18,0x60},
5021 { 19,0xA4},
5022 { 20,0x1C},
5023 { 21,0x10},
5024 { 22,0x80},
5025 { 23,0x89},
5026 { 24,0x1C},
5027 { 25,0x10},
5028 { 26,0x80},
5029 { 27,0xA2},
5030 { 28,0x1C},
5031 { 29,0x10},
5032 { 30,0xA0},
5033 { 31,0x8F},
5034 { 32,0x1C},
5035 { 33,0x10},
5036 { 34,0xA0},
5037 { 35,0x9C},
5038 { 36,0x1C},
5039 { 37,0x10},
5040 { 38,0xC0},
5041 { 39,0x8B},
5042 { 40,0x1C},
5043 { 41,0x10},
5044 { 42,0xC0},
5045 { 43,0xA0},
5046 { 44,0x1C},
5047 { 45,0x10},
5048 { 46,0xE0},
5049 { 47,0x8D},
5050 { 48,0x1C},
5051 { 49,0x10},
5052 { 50,0xE0},
5053 { 51,0x9E},
5054 { 52,0x1C},
5055 { 53,0x11},
5056 { 54,0x00},
5057 { 55,0x91},
5058 { 56,0x1C},
5059 { 57,0x11},
5060 { 58,0x00},
5061 { 59,0x9A},
5062 { 60,0x1C},
5063 { 61,0x11},
5064 { 62,0x20},
5065 { 63,0x93},
5066 { 64,0x1C},
5067 { 65,0x11},
5068 { 66,0x20},
5069 { 67,0x98},
5070 { 68,0x1C},
5071 { 69,0x11},
5072 { 70,0x40},
5073 { 71,0x84},
5074 { 72,0x1C},
5075 { 73,0x11},
5076 { 74,0x40},
5077 { 75,0xA7},
5078 { 76,0x1C},
5079 { 77,0x11},
5080 { 78,0x60},
5081 { 79,0x8C},
5082 { 80,0x1C},
5083 { 81,0x11},
5084 { 82,0x60},
5085 { 83,0x9F},
5086 { 84,0x1C},
5087 { 85,0x11},
5088 { 86,0x80},
5089 { 87,0x88},
5090 { 88,0x1C},
5091 { 89,0x11},
5092 { 90,0x80},
5093 { 91,0xA3},
5094 { 92,0x1C},
5095 { 93,0x11},
5096 { 94,0xA0},
5097 { 95,0x90},
5098 { 96,0x1C},
5099 { 97,0x11},
5100 { 98,0xA0},
5101 { 99,0x9B},
5102 {100,0x1C},
5103 {101,0x11},
5104 {102,0xC0},
5105 {103,0x8A},
5106 {104,0x1C},
5107 {105,0x11},
5108 {106,0xC0},
5109 {107,0xA1},
5110 {108,0x1C},
5111 {109,0x11},
5112 {110,0xE0},
5113 {111,0x86},
5114 {112,0x1C},
5115 {113,0x11},
5116 {114,0xE0},
5117 {115,0xA5},
5118 {116,0x1C},
5119 {117,0x12},
5120 {118,0x00},
5121 {119,0x8E},
5122 {120,0x1C},
5123 {121,0x12},
5124 {122,0x00},
5125 {123,0x9D},
5126 {124,0x1C},
5127 {125,0x12},
5128 {126,0x20},
5129 {127,0x92},
5130 { 0,0x18},
5131 { 8,0x1C},
5132 { 9,0x12},
5133 { 10,0x20},
5134 { 11,0x99},
5135 { 12,0x1C},
5136 { 13,0x12},
5137 { 14,0x40},
5138 { 15,0x94},
5139 { 16,0x1C},
5140 { 17,0x12},
5141 { 18,0x40},
5142 { 19,0x97},
5143 { 20,0x1C},
5144 { 21,0x12},
5145 { 22,0x60},
5146 { 23,0x95},
5147 { 24,0x1C},
5148 { 25,0x12},
5149 { 26,0x60},
5150 { 27,0x96},
5151 { 28,0x00},
5152 { 29,0x00},
5153 { 30,0x00},
5154 { 31,0x00},
5155 { 32,0x00},
5156 { 33,0x00},
5157 { 34,0x00},
5158 { 35,0x00},
5159 { 36,0x00},
5160 { 37,0x00},
5161 { 38,0x00},
5162 { 39,0x00},
5163 { 40,0x10},
5164 { 41,0x00},
5165 { 42,0x00},
5166 { 43,0xAD},
5167 { 44,0x18},
5168 { 45,0x10},
5169 { 46,0x20},
5170 { 47,0xE8},
5171 { 48,0x1C},
5172 { 49,0x10},
5173 { 50,0x40},
5174 { 51,0xC5},
5175 { 52,0x1C},
5176 { 53,0x10},
5177 { 54,0x20},
5178 { 55,0xC3},
5179 { 56,0x1C},
5180 { 57,0x10},
5181 { 58,0x40},
5182 { 59,0xE6},
5183 { 60,0x1C},
5184 { 61,0x10},
5185 { 62,0x60},
5186 { 63,0xC7},
5187 { 64,0x1C},
5188 { 65,0x10},
5189 { 66,0x60},
5190 { 67,0xE4},
5191 { 68,0x1C},
5192 { 69,0x10},
5193 { 70,0x80},
5194 { 71,0xC9},
5195 { 72,0x1C},
5196 { 73,0x10},
5197 { 74,0x80},
5198 { 75,0xE2},
5199 { 76,0x1C},
5200 { 77,0x10},
5201 { 78,0xA0},
5202 { 79,0xCF},
5203 { 80,0x1C},
5204 { 81,0x10},
5205 { 82,0xA0},
5206 { 83,0xDC},
5207 { 84,0x1C},
5208 { 85,0x10},
5209 { 86,0xC0},
5210 { 87,0xCB},
5211 { 88,0x1C},
5212 { 89,0x10},
5213 { 90,0xC0},
5214 { 91,0xE0},
5215 { 92,0x1C},
5216 { 93,0x10},
5217 { 94,0xE0},
5218 { 95,0xCD},
5219 { 96,0x1C},
5220 { 97,0x10},
5221 { 98,0xE0},
5222 { 99,0xDE},
5223 {100,0x1C},
5224 {101,0x11},
5225 {102,0x00},
5226 {103,0xD1},
5227 {104,0x1C},
5228 {105,0x11},
5229 {106,0x00},
5230 {107,0xDA},
5231 {108,0x1C},
5232 {109,0x11},
5233 {110,0x20},
5234 {111,0xD3},
5235 {112,0x1C},
5236 {113,0x11},
5237 {114,0x20},
5238 {115,0xD8},
5239 {116,0x1C},
5240 {117,0x11},
5241 {118,0x40},
5242 {119,0xC4},
5243 {120,0x1C},
5244 {121,0x11},
5245 {122,0x40},
5246 {123,0xE7},
5247 {124,0x1C},
5248 {125,0x11},
5249 {126,0x60},
5250 {127,0xCC},
5251 { 0,0x19},
5252 { 8,0x1C},
5253 { 9,0x11},
5254 { 10,0x60},
5255 { 11,0xDF},
5256 { 12,0x1C},
5257 { 13,0x11},
5258 { 14,0x80},
5259 { 15,0xC8},
5260 { 16,0x1C},
5261 { 17,0x11},
5262 { 18,0x80},
5263 { 19,0xE3},
5264 { 20,0x1C},
5265 { 21,0x11},
5266 { 22,0xA0},
5267 { 23,0xD0},
5268 { 24,0x1C},
5269 { 25,0x11},
5270 { 26,0xA0},
5271 { 27,0xDB},
5272 { 28,0x1C},
5273 { 29,0x11},
5274 { 30,0xC0},
5275 { 31,0xCA},
5276 { 32,0x1C},
5277 { 33,0x11},
5278 { 34,0xC0},
5279 { 35,0xE1},
5280 { 36,0x1C},
5281 { 37,0x11},
5282 { 38,0xE0},
5283 { 39,0xC6},
5284 { 40,0x1C},
5285 { 41,0x11},
5286 { 42,0xE0},
5287 { 43,0xE5},
5288 { 44,0x1C},
5289 { 45,0x12},
5290 { 46,0x00},
5291 { 47,0xCE},
5292 { 48,0x1C},
5293 { 49,0x12},
5294 { 50,0x00},
5295 { 51,0xDD},
5296 { 52,0x1C},
5297 { 53,0x12},
5298 { 54,0x20},
5299 { 55,0xD2},
5300 { 56,0x1C},
5301 { 57,0x12},
5302 { 58,0x20},
5303 { 59,0xD9},
5304 { 60,0x1C},
5305 { 61,0x12},
5306 { 62,0x40},
5307 { 63,0xD4},
5308 { 64,0x1C},
5309 { 65,0x12},
5310 { 66,0x40},
5311 { 67,0xD7},
5312 { 68,0x1C},
5313 { 69,0x12},
5314 { 70,0x60},
5315 { 71,0xD5},
5316 { 72,0x1C},
5317 { 73,0x12},
5318 { 74,0x60},
5319 { 75,0xD6},
5320 { 76,0x00},
5321 { 77,0x00},
5322 { 78,0x00},
5323 { 79,0x00},
5324 { 80,0x00},
5325 { 81,0x00},
5326 { 82,0x00},
5327 { 83,0x00},
5328 { 84,0x00},
5329 { 85,0x00},
5330 { 86,0x00},
5331 { 87,0x00},
5332 { 88,0x10},
5333 { 89,0x00},
5334 { 90,0x00},
5335 { 91,0xED},
5336 { 92,0x18},
5337 { 93,0x12},
5338 { 94,0xA0},
5339 { 95,0xEC},
5340 { 96,0x1C},
5341 { 97,0x12},
5342 { 98,0xC0},
5343 { 99,0xEE},
5344 {100,0x1C},
5345 {101,0x12},
5346 {102,0xC0},
5347 {103,0xEB},
5348 {104,0x1C},
5349 {105,0x12},
5350 {106,0xA0},
5351 {107,0xED},
5352 {108,0x1C},
5353 {109,0x12},
5354 {110,0xE0},
5355 {111,0xEA},
5356 {112,0x1C},
5357 {113,0x12},
5358 {114,0xE0},
5359 {115,0xEF},
5360 {116,0x1C},
5361 {117,0x13},
5362 {118,0x00},
5363 {119,0xE9},
5364 {120,0x1C},
5365 {121,0x13},
5366 {122,0x00},
5367 {123,0xF0},
5368 {124,0x18},
5369 {125,0x13},
5370 {126,0x60},
5371 {127,0xF1},
5372 { 0,0x1A},
5373 { 8,0x1C},
5374 { 9,0x13},
5375 { 10,0x60},
5376 { 11,0xF3},
5377 { 12,0x1C},
5378 { 13,0x13},
5379 { 14,0x40},
5380 { 15,0xF6},
5381 { 16,0x4C},
5382 { 17,0x13},
5383 { 18,0x40},
5384 { 19,0xF4},
5385 { 20,0x00},
5386 { 21,0x00},
5387 { 22,0x00},
5388 { 23,0x00},
5389 { 24,0x5C},
5390 { 25,0x90},
5391 { 26,0x60},
5392 { 27,0x03},
5393 { 28,0x18},
5394 { 29,0x12},
5395 { 30,0xA0},
5396 { 31,0xAC},
5397 { 32,0x1C},
5398 { 33,0x12},
5399 { 34,0xA0},
5400 { 35,0xAD},
5401 { 36,0x1C},
5402 { 37,0x12},
5403 { 38,0xC0},
5404 { 39,0xAE},
5405 { 40,0x10},
5406 { 41,0x00},
5407 { 42,0x40},
5408 { 43,0xFD},
5409 { 44,0x1C},
5410 { 45,0x12},
5411 { 46,0xC0},
5412 { 47,0xAB},
5413 { 48,0x1C},
5414 { 49,0x12},
5415 { 50,0xE0},
5416 { 51,0xAA},
5417 { 52,0x1C},
5418 { 53,0x12},
5419 { 54,0xE0},
5420 { 55,0xAF},
5421 { 56,0x1C},
5422 { 57,0x13},
5423 { 58,0x00},
5424 { 59,0xA9},
5425 { 60,0x1C},
5426 { 61,0x13},
5427 { 62,0x00},
5428 { 63,0xB0},
5429 { 64,0x18},
5430 { 65,0x13},
5431 { 66,0x60},
5432 { 67,0xB1},
5433 { 68,0x1C},
5434 { 69,0x13},
5435 { 70,0x60},
5436 { 71,0xB3},
5437 { 72,0x1C},
5438 { 73,0x13},
5439 { 74,0x40},
5440 { 75,0xB6},
5441 { 76,0x4C},
5442 { 77,0x13},
5443 { 78,0x40},
5444 { 79,0xB4},
5445 { 80,0x00},
5446 { 81,0x00},
5447 { 82,0x00},
5448 { 83,0x00},
5449 { 84,0x5C},
5450 { 85,0x90},
5451 { 86,0x40},
5452 { 87,0x03},
5453 { 88,0x00},
5454 { 89,0x00},
5455 { 90,0x00},
5456 { 91,0x00},
5457 { 92,0x00},
5458 { 93,0x00},
5459 { 94,0x00},
5460 { 95,0x00},
5461 { 96,0x00},
5462 { 97,0x00},
5463 { 98,0x00},
5464 { 99,0x00},
5465 {100,0x10},
5466 {101,0x00},
5467 {102,0x40},
5468 {103,0xBD},
5469 {104,0x18},
5470 {105,0x13},
5471 {106,0x80},
5472 {107,0xF4},
5473 {108,0x1C},
5474 {109,0x13},
5475 {110,0x80},
5476 {111,0xF3},
5477 {112,0x1C},
5478 {113,0x13},
5479 {114,0xA0},
5480 {115,0xF1},
5481 {116,0x00},
5482 {117,0x00},
5483 {118,0x00},
5484 {119,0x00},
5485 {120,0x5C},
5486 {121,0x90},
5487 {122,0x60},
5488 {123,0x03},
5489 {124,0x18},
5490 {125,0x13},
5491 {126,0x80},
5492 {127,0xB4},
5493 { 0,0x1B},
5494 { 8,0x1C},
5495 { 9,0x13},
5496 { 10,0x80},
5497 { 11,0xB3},
5498 { 12,0x1C},
5499 { 13,0x13},
5500 { 14,0xA0},
5501 { 15,0xB1},
5502 { 16,0x10},
5503 { 17,0x00},
5504 { 18,0x40},
5505 { 19,0xFC},
5506 { 20,0x18},
5507 { 21,0x13},
5508 { 22,0x20},
5509 { 23,0xEA},
5510 { 24,0x5C},
5511 { 25,0x90},
5512 { 26,0x40},
5513 { 27,0x03},
5514 { 28,0x18},
5515 { 29,0x13},
5516 { 30,0x40},
5517 { 31,0xF3},
5518 { 32,0x1C},
5519 { 33,0x13},
5520 { 34,0x60},
5521 { 35,0xF4},
5522 { 36,0x4C},
5523 { 37,0x13},
5524 { 38,0x40},
5525 { 39,0xF5},
5526 { 40,0x10},
5527 { 41,0x00},
5528 { 42,0x40},
5529 { 43,0xBC},
5530 { 44,0x1C},
5531 { 45,0x13},
5532 { 46,0x60},
5533 { 47,0xF1},
5534 { 48,0x18},
5535 { 49,0x13},
5536 { 50,0x20},
5537 { 51,0xAA},
5538 { 52,0x5C},
5539 { 53,0x90},
5540 { 54,0x60},
5541 { 55,0x03},
5542 { 56,0x18},
5543 { 57,0x13},
5544 { 58,0x40},
5545 { 59,0xB3},
5546 { 60,0x1C},
5547 { 61,0x13},
5548 { 62,0x60},
5549 { 63,0xB4},
5550 { 64,0x4C},
5551 { 65,0x13},
5552 { 66,0x40},
5553 { 67,0xB5},
5554 { 68,0x10},
5555 { 69,0x00},
5556 { 70,0x40},
5557 { 71,0xFB},
5558 { 72,0x1C},
5559 { 73,0x13},
5560 { 74,0x60},
5561 { 75,0xB1},
5562 { 76,0x00},
5563 { 77,0x00},
5564 { 78,0x00},
5565 { 79,0x00},
5566 { 80,0x5C},
5567 { 81,0x90},
5568 { 82,0x40},
5569 { 83,0x03},
5570 { 84,0x18},
5571 { 85,0x13},
5572 { 86,0x80},
5573 { 87,0xF5},
5574 { 88,0x1C},
5575 { 89,0x13},
5576 { 90,0x80},
5577 { 91,0xF1},
5578 { 92,0x1C},
5579 { 93,0x13},
5580 { 94,0xA0},
5581 { 95,0xF4},
5582 { 96,0x10},
5583 { 97,0x00},
5584 { 98,0x40},
5585 { 99,0xBB},
5586 {100,0x5C},
5587 {101,0x90},
5588 {102,0x60},
5589 {103,0x03},
5590 {104,0x00},
5591 {105,0x00},
5592 {106,0x00},
5593 {107,0x00},
5594 {108,0x00},
5595 {109,0x00},
5596 {110,0x00},
5597 {111,0x00},
5598 {112,0x00},
5599 {113,0x00},
5600 {114,0x00},
5601 {115,0x00},
5602 {116,0x10},
5603 {117,0x00},
5604 {118,0x40},
5605 {119,0xFA},
5606 {120,0x18},
5607 {121,0x13},
5608 {122,0x80},
5609 {123,0xB5},
5610 {124,0x1C},
5611 {125,0x13},
5612 {126,0x80},
5613 {127,0xB1},
5614 { 0,0x1C},
5615 { 8,0x1C},
5616 { 9,0x13},
5617 { 10,0xA0},
5618 { 11,0xB4},
5619 { 12,0x18},
5620 { 13,0x12},
5621 { 14,0x80},
5622 { 15,0xD5},
5623 { 16,0x5C},
5624 { 17,0x90},
5625 { 18,0x40},
5626 { 19,0x03},
5627 { 20,0x18},
5628 { 21,0x12},
5629 { 22,0xA0},
5630 { 23,0xF0},
5631 { 24,0x1C},
5632 { 25,0x12},
5633 { 26,0xC0},
5634 { 27,0xE9},
5635 { 28,0x4C},
5636 { 29,0x12},
5637 { 30,0xA0},
5638 { 31,0xE8},
5639 { 32,0x10},
5640 { 33,0x00},
5641 { 34,0x40},
5642 { 35,0xBA},
5643 { 36,0x1C},
5644 { 37,0x12},
5645 { 38,0xC0},
5646 { 39,0xEF},
5647 { 40,0x1C},
5648 { 41,0x12},
5649 { 42,0xE0},
5650 { 43,0xEE},
5651 { 44,0x1C},
5652 { 45,0x12},
5653 { 46,0xE0},
5654 { 47,0xEA},
5655 { 48,0x1C},
5656 { 49,0x13},
5657 { 50,0x00},
5658 { 51,0xED},
5659 { 52,0x1C},
5660 { 53,0x13},
5661 { 54,0x00},
5662 { 55,0xEB},
5663 { 56,0x18},
5664 { 57,0x13},
5665 { 58,0x60},
5666 { 59,0xF5},
5667 { 60,0x1C},
5668 { 61,0x13},
5669 { 62,0x60},
5670 { 63,0xF4},
5671 { 64,0x1C},
5672 { 65,0x13},
5673 { 66,0x40},
5674 { 67,0xF1},
5675 { 68,0x4C},
5676 { 69,0x13},
5677 { 70,0x40},
5678 { 71,0xF2},
5679 { 72,0x18},
5680 { 73,0x12},
5681 { 74,0x80},
5682 { 75,0x95},
5683 { 76,0x5C},
5684 { 77,0x90},
5685 { 78,0x60},
5686 { 79,0x03},
5687 { 80,0x18},
5688 { 81,0x12},
5689 { 82,0xA0},
5690 { 83,0xB0},
5691 { 84,0x1C},
5692 { 85,0x12},
5693 { 86,0xC0},
5694 { 87,0xA9},
5695 { 88,0x4C},
5696 { 89,0x12},
5697 { 90,0xA0},
5698 { 91,0xA8},
5699 { 92,0x10},
5700 { 93,0x00},
5701 { 94,0x40},
5702 { 95,0xF9},
5703 { 96,0x1C},
5704 { 97,0x12},
5705 { 98,0xC0},
5706 { 99,0xAF},
5707 {100,0x1C},
5708 {101,0x12},
5709 {102,0xE0},
5710 {103,0xAE},
5711 {104,0x1C},
5712 {105,0x12},
5713 {106,0xE0},
5714 {107,0xAA},
5715 {108,0x1C},
5716 {109,0x13},
5717 {110,0x00},
5718 {111,0xAD},
5719 {112,0x1C},
5720 {113,0x13},
5721 {114,0x00},
5722 {115,0xAB},
5723 {116,0x18},
5724 {117,0x13},
5725 {118,0x60},
5726 {119,0xB5},
5727 {120,0x1C},
5728 {121,0x13},
5729 {122,0x60},
5730 {123,0xB4},
5731 {124,0x1C},
5732 {125,0x13},
5733 {126,0x40},
5734 {127,0xB1},
5735 { 0,0x1D},
5736 { 8,0x4C},
5737 { 9,0x13},
5738 { 10,0x40},
5739 { 11,0xB2},
5740 { 12,0x00},
5741 { 13,0x00},
5742 { 14,0x00},
5743 { 15,0x00},
5744 { 16,0x5C},
5745 { 17,0x90},
5746 { 18,0x40},
5747 { 19,0x03},
5748 { 20,0x00},
5749 { 21,0x00},
5750 { 22,0x00},
5751 { 23,0x00},
5752 { 24,0x00},
5753 { 25,0x00},
5754 { 26,0x00},
5755 { 27,0x00},
5756 { 28,0x00},
5757 { 29,0x00},
5758 { 30,0x00},
5759 { 31,0x00},
5760 { 32,0x10},
5761 { 33,0x00},
5762 { 34,0x40},
5763 { 35,0xB8},
5764 { 36,0x18},
5765 { 37,0x13},
5766 { 38,0x80},
5767 { 39,0xF2},
5768 { 40,0x1C},
5769 { 41,0x13},
5770 { 42,0x80},
5771 { 43,0xF4},
5772 { 44,0x1C},
5773 { 45,0x13},
5774 { 46,0xA0},
5775 { 47,0xF5},
5776 { 48,0x10},
5777 { 49,0x00},
5778 { 50,0x40},
5779 { 51,0xB9},
5780 { 52,0x00},
5781 { 53,0x00},
5782 { 54,0x00},
5783 { 55,0x00},
5784 { 56,0x5C},
5785 { 57,0x90},
5786 { 58,0x60},
5787 { 59,0x03},
5788 { 60,0x18},
5789 { 61,0x13},
5790 { 62,0x80},
5791 { 63,0xB2},
5792 { 64,0x1C},
5793 { 65,0x13},
5794 { 66,0x80},
5795 { 67,0xB4},
5796 { 68,0x1C},
5797 { 69,0x13},
5798 { 70,0xA0},
5799 { 71,0xB5},
5800 { 72,0x10},
5801 { 73,0x00},
5802 { 74,0x40},
5803 { 75,0xF8},
5804 { 76,0x18},
5805 { 77,0x13},
5806 { 78,0x20},
5807 { 79,0xEE},
5808 { 80,0x5C},
5809 { 81,0x90},
5810 { 82,0x40},
5811 { 83,0x03},
5812 { 84,0x18},
5813 { 85,0x13},
5814 { 86,0x40},
5815 { 87,0xF4},
5816 { 88,0x1C},
5817 { 89,0x13},
5818 { 90,0x60},
5819 { 91,0xF2},
5820 { 92,0x4C},
5821 { 93,0x13},
5822 { 94,0x40},
5823 { 95,0xF0},
5824 { 96,0x10},
5825 { 97,0x00},
5826 { 98,0x40},
5827 { 99,0xB8},
5828 {100,0x1C},
5829 {101,0x13},
5830 {102,0x60},
5831 {103,0xF5},
5832 {104,0x18},
5833 {105,0x13},
5834 {106,0x20},
5835 {107,0xAE},
5836 {108,0x5C},
5837 {109,0x90},
5838 {110,0x60},
5839 {111,0x03},
5840 {112,0x18},
5841 {113,0x13},
5842 {114,0x40},
5843 {115,0xB4},
5844 {116,0x1C},
5845 {117,0x13},
5846 {118,0x60},
5847 {119,0xB2},
5848 {120,0x4C},
5849 {121,0x13},
5850 {122,0x40},
5851 {123,0xB0},
5852 {124,0x10},
5853 {125,0x00},
5854 {126,0x40},
5855 {127,0xF7},
5856 { 0,0x1E},
5857 { 8,0x1C},
5858 { 9,0x13},
5859 { 10,0x60},
5860 { 11,0xB5},
5861 { 12,0x00},
5862 { 13,0x00},
5863 { 14,0x00},
5864 { 15,0x00},
5865 { 16,0x5C},
5866 { 17,0x90},
5867 { 18,0x40},
5868 { 19,0x03},
5869 { 20,0x18},
5870 { 21,0x13},
5871 { 22,0x80},
5872 { 23,0xF0},
5873 { 24,0x1C},
5874 { 25,0x13},
5875 { 26,0x80},
5876 { 27,0xF5},
5877 { 28,0x1C},
5878 { 29,0x13},
5879 { 30,0xA0},
5880 { 31,0xF2},
5881 { 32,0x10},
5882 { 33,0x00},
5883 { 34,0x40},
5884 { 35,0xB7},
5885 { 36,0x00},
5886 { 37,0x00},
5887 { 38,0x00},
5888 { 39,0x00},
5889 { 40,0x5C},
5890 { 41,0x90},
5891 { 42,0x60},
5892 { 43,0x03},
5893 { 44,0x18},
5894 { 45,0x13},
5895 { 46,0x80},
5896 { 47,0xB0},
5897 { 48,0x1C},
5898 { 49,0x13},
5899 { 50,0x80},
5900 { 51,0xB5},
5901 { 52,0x1C},
5902 { 53,0x13},
5903 { 54,0xA0},
5904 { 55,0xB2},
5905 { 56,0x10},
5906 { 57,0x00},
5907 { 58,0x40},
5908 { 59,0xF6},
5909 { 60,0x5C},
5910 { 61,0x90},
5911 { 62,0x40},
5912 { 63,0x03},
5913 { 64,0x00},
5914 { 65,0x00},
5915 { 66,0x00},
5916 { 67,0x00},
5917 { 68,0x00},
5918 { 69,0x00},
5919 { 70,0x00},
5920 { 71,0x00},
5921 { 72,0x00},
5922 { 73,0x00},
5923 { 74,0x00},
5924 { 75,0x00},
5925 { 76,0x10},
5926 { 77,0x00},
5927 { 78,0x40},
5928 { 79,0xB6},
5929 { 80,0x00},
5930 { 81,0x00},
5931 { 82,0x00},
5932 { 83,0x00},
5933 { 84,0x00},
5934 { 85,0x00},
5935 { 86,0x00},
5936 { 87,0x00},
5937 { 88,0x00},
5938 { 89,0x00},
5939 { 90,0x00},
5940 { 91,0x00},
5941 { 92,0x02},
5942 { 93,0x00},
5943 { 94,0x00},
5944 { 95,0x00},
5945 { 96,0x00},
5946 { 97,0x00},
5947 { 98,0x00},
5948 { 99,0x00},
5949};
5950
5951reg_value SRS_OFF_miniDSP_D_reg_values[] = {
5952 { 0,0x0},
5953 { 0x7F,0x50},
5954 { 0,0x04},
5955 { 36,0x00},
5956 { 37,0x00},
5957 { 38,0x01},
5958 { 39,0x00},
5959 { 0,0x0C},
5960 {100,0x00},
5961 {101,0x00},
5962 {102,0x01},
5963 {103,0x00},
5964};
5965
5966reg_value SRS_ON_miniDSP_D_reg_values[] = {
5967 { 0,0x0},
5968 { 0x7F,0x50},
5969 { 0,0x04},
5970 { 36,0x00},
5971 { 37,0x00},
5972 { 38,0x02},
5973 { 39,0x00},
5974 { 0,0x0C},
5975 {100,0x00},
5976 {101,0x00},
5977 {102,0x02},
5978 {103,0x00},
5979};
diff --git a/sound/soc/codecs/first_rate_pps_driver.h b/sound/soc/codecs/first_rate_pps_driver.h
new file mode 100644
index 00000000000..95d1996b742
--- /dev/null
+++ b/sound/soc/codecs/first_rate_pps_driver.h
@@ -0,0 +1,5959 @@
1static control main44_MUX_controls[] = {
2/*{4,28,1,0},
3{4,36,1,1},
4{4,112,1,2}*/
5};
6
7static char * main44_MUX_control_names[] = {
8/*"Stereo_Mux_1",
9"Stereo_Mux_3",
10"Stereo_Mux_4"*/
11};
12
13static control main44_VOLUME_controls[] = {
14};
15
16static char * main44_VOLUME_control_names[] = {
17};
18
19/*//INSTRUCTIONS & COEFFICIENTS
20typedef struct {
21 u8 reg_off;
22 u8 reg_val;
23} reg_value;*/
24
25static char * main44_REG_Section_names[] = {
26 "main44_miniDSP_A_reg_values",
27 "main44_miniDSP_D_reg_values",
28};
29
30reg_value main44_REG_Section_init_program[] = {
31 { 0,0x0},
32 { 0x7F,0x00},
33// # Set AutoINC
34 {121,0x01},
35 { 0x7F,0x78},
36// # reg[120][0][50] = 0x88 ; Interpolation Ratio is 8, FIFO = Enabled
37 { 50,0x88},
38 { 0x7F,0x64},
39// # reg[100][0][50] = 0xa4 ; Decimation Ratio is 4, CIC AutoNorm = Enabled, FIFO = Enabled
40 { 50,0xA4},
41 { 0x7F,0x78},
42// # reg[120][0][24]=0x80
43 { 24,0x80},
44};
45
46reg_value main44_REG_Section_post_program[] = {
47 { 0,0x0},
48 { 0x7F,0x28},
49// # reg[40][0][1] = 0x04 ; adaptive mode for ADC
50 { 1,0x04},
51 { 0x7F,0x50},
52// # reg[80][0][1] = 0x04 ; adaptive mode for DAC
53 { 1,0x04},
54 { 0x7F,0x64},
55// # reg[100][0][48] = 4
56 { 48,0x04},
57// # reg[100][0][49] = 0
58 { 49,0x00},
59 { 0x7F,0x78},
60// # reg[120][0][48] = 4
61 { 48,0x04},
62// # reg[120][0][49] = 0
63 { 49,0x00},
64 { 0x7F,0x64},
65// # reg[100][0][20] = 0x00 ; Disable ADC double buffer mode
66 { 20,0x00},
67 { 0x7F,0x78},
68// # reg[120][0][20] = 0x00 ; Disable DAC double buffer mode
69 { 20,0x00},
70
71};
72
73reg_value main44_miniDSP_A_reg_values[] = {
74 { 0,0x0},
75 { 0x7F,0x28},
76 { 0,0x01},
77 { 8,0x00},
78 { 9,0xA7},
79 { 10,0xF8},
80 { 11,0x00},
81 { 12,0x7E},
82 { 13,0xB0},
83 { 14,0x10},
84 { 15,0x00},
85 { 16,0x7F},
86 { 17,0xFF},
87 { 18,0xFF},
88 { 19,0x00},
89 { 20,0x00},
90 { 21,0x00},
91 { 22,0x00},
92 { 23,0x00},
93 { 24,0x00},
94 { 25,0x00},
95 { 26,0x00},
96 { 27,0x00},
97 { 28,0xFF},
98 { 29,0xFF},
99 { 30,0xFF},
100 { 31,0x00},
101 { 32,0x80},
102 { 33,0x00},
103 { 34,0x00},
104 { 35,0x00},
105 { 36,0x7F},
106 { 37,0xFF},
107 { 38,0xFF},
108 { 39,0x00},
109 { 40,0x40},
110 { 41,0x00},
111 { 42,0x00},
112 { 43,0x00},
113 { 44,0x00},
114 { 45,0x00},
115 { 46,0x00},
116 { 47,0x00},
117 { 48,0xFF},
118 { 49,0x9E},
119 { 50,0x00},
120 { 51,0x00},
121 { 52,0xF7},
122 { 53,0x10},
123 { 54,0x00},
124 { 55,0x00},
125 { 56,0x26},
126 { 57,0xF0},
127 { 58,0x00},
128 { 59,0x00},
129 { 60,0x02},
130 { 61,0x61},
131 { 62,0x00},
132 { 63,0x00},
133 { 64,0x40},
134 { 65,0x02},
135 { 66,0x00},
136 { 67,0x00},
137 { 68,0xFF},
138 { 69,0xFC},
139 { 70,0x00},
140 { 71,0x00},
141 { 72,0xFF},
142 { 73,0xFD},
143 { 74,0x00},
144 { 75,0x00},
145 { 76,0xFF},
146 { 77,0xE5},
147 { 78,0x00},
148 { 79,0x00},
149 { 80,0xFF},
150 { 81,0xA7},
151 { 82,0x00},
152 { 83,0x00},
153 { 84,0xFF},
154 { 85,0xC7},
155 { 86,0x00},
156 { 87,0x00},
157 { 88,0xFF},
158 { 89,0xCE},
159 { 90,0x00},
160 { 91,0x00},
161 { 92,0xFF},
162 { 93,0xFE},
163 { 94,0x00},
164 { 95,0x00},
165 { 96,0xFE},
166 { 97,0xF7},
167 { 98,0x00},
168 { 99,0x00},
169 {100,0xFF},
170 {101,0x46},
171 {102,0x00},
172 {103,0x00},
173 {104,0xFF},
174 {105,0x22},
175 {106,0x00},
176 {107,0x00},
177 {108,0x7F},
178 {109,0xFF},
179 {110,0xFF},
180 {111,0x00},
181 {112,0x00},
182 {113,0x00},
183 {114,0x00},
184 {115,0x00},
185 {116,0x00},
186 {117,0x00},
187 {118,0x00},
188 {119,0x00},
189 {120,0x00},
190 {121,0x00},
191 {122,0x00},
192 {123,0x00},
193 {124,0x00},
194 {125,0x00},
195 {126,0x00},
196 {127,0x00},
197 { 0,0x02},
198 { 8,0xFF},
199 { 9,0x0F},
200 { 10,0x00},
201 { 11,0x00},
202 { 12,0xFA},
203 { 13,0x8C},
204 { 14,0x00},
205 { 15,0x00},
206 { 16,0xF5},
207 { 17,0x08},
208 { 18,0x00},
209 { 19,0x00},
210 { 20,0xFD},
211 { 21,0x92},
212 { 22,0x00},
213 { 23,0x00},
214 { 24,0xF3},
215 { 25,0xA3},
216 { 26,0x00},
217 { 27,0x00},
218 { 28,0x03},
219 { 29,0xB3},
220 { 30,0x00},
221 { 31,0x00},
222 { 32,0x00},
223 { 33,0x33},
224 { 34,0x00},
225 { 35,0x00},
226 { 36,0x00},
227 { 37,0x71},
228 { 38,0x00},
229 { 39,0x00},
230 { 40,0x40},
231 { 41,0x60},
232 { 42,0x00},
233 { 43,0x00},
234 { 44,0x00},
235 { 45,0xE2},
236 { 46,0x00},
237 { 47,0x00},
238 { 48,0x00},
239 { 49,0xC6},
240 { 50,0x00},
241 { 51,0x00},
242 { 52,0x00},
243 { 53,0x87},
244 { 54,0x00},
245 { 55,0x00},
246 { 56,0x00},
247 { 57,0x0F},
248 { 58,0x00},
249 { 59,0x00},
250 { 60,0x00},
251 { 61,0x0A},
252 { 62,0x00},
253 { 63,0x00},
254 { 64,0x00},
255 { 65,0x02},
256 { 66,0x00},
257 { 67,0x00},
258 { 68,0x01},
259 { 69,0x81},
260 { 70,0x00},
261 { 71,0x00},
262 { 72,0x18},
263 { 73,0x89},
264 { 74,0x00},
265 { 75,0x00},
266 { 76,0x07},
267 { 77,0xFB},
268 { 78,0x00},
269 { 79,0x00},
270 { 80,0x03},
271 { 81,0xBE},
272 { 82,0x00},
273 { 83,0x00},
274 { 0,0x09},
275 { 72,0x00},
276 { 73,0xA7},
277 { 74,0xF8},
278 { 75,0x00},
279 { 76,0x7E},
280 { 77,0xB0},
281 { 78,0x10},
282 { 79,0x00},
283 { 80,0x7F},
284 { 81,0xFF},
285 { 82,0xFF},
286 { 83,0x00},
287 { 84,0x00},
288 { 85,0x00},
289 { 86,0x00},
290 { 87,0x00},
291 { 88,0x00},
292 { 89,0x00},
293 { 90,0x00},
294 { 91,0x00},
295 { 92,0xFF},
296 { 93,0xFF},
297 { 94,0xFF},
298 { 95,0x00},
299 { 96,0x80},
300 { 97,0x00},
301 { 98,0x00},
302 { 99,0x00},
303 {100,0x7F},
304 {101,0xFF},
305 {102,0xFF},
306 {103,0x00},
307 {104,0x40},
308 {105,0x00},
309 {106,0x00},
310 {107,0x00},
311 {108,0x00},
312 {109,0x00},
313 {110,0x00},
314 {111,0x00},
315 {112,0xFF},
316 {113,0x9E},
317 {114,0x00},
318 {115,0x00},
319 {116,0xF7},
320 {117,0x10},
321 {118,0x00},
322 {119,0x00},
323 {120,0x26},
324 {121,0xF0},
325 {122,0x00},
326 {123,0x00},
327 {124,0x02},
328 {125,0x61},
329 {126,0x00},
330 {127,0x00},
331 { 0,0x0A},
332 { 8,0x40},
333 { 9,0x02},
334 { 10,0x00},
335 { 11,0x00},
336 { 12,0xFF},
337 { 13,0xFC},
338 { 14,0x00},
339 { 15,0x00},
340 { 16,0xFF},
341 { 17,0xFD},
342 { 18,0x00},
343 { 19,0x00},
344 { 20,0xFF},
345 { 21,0xE5},
346 { 22,0x00},
347 { 23,0x00},
348 { 24,0xFF},
349 { 25,0xA7},
350 { 26,0x00},
351 { 27,0x00},
352 { 28,0xFF},
353 { 29,0xC7},
354 { 30,0x00},
355 { 31,0x00},
356 { 32,0xFF},
357 { 33,0xCE},
358 { 34,0x00},
359 { 35,0x00},
360 { 36,0xFF},
361 { 37,0xFE},
362 { 38,0x00},
363 { 39,0x00},
364 { 40,0xFE},
365 { 41,0xF7},
366 { 42,0x00},
367 { 43,0x00},
368 { 44,0xFF},
369 { 45,0x46},
370 { 46,0x00},
371 { 47,0x00},
372 { 48,0xFF},
373 { 49,0x22},
374 { 50,0x00},
375 { 51,0x00},
376 { 52,0x7F},
377 { 53,0xFF},
378 { 54,0xFF},
379 { 55,0x00},
380 { 56,0x00},
381 { 57,0x00},
382 { 58,0x00},
383 { 59,0x00},
384 { 60,0x00},
385 { 61,0x00},
386 { 62,0x00},
387 { 63,0x00},
388 { 64,0x00},
389 { 65,0x00},
390 { 66,0x00},
391 { 67,0x00},
392 { 68,0x00},
393 { 69,0x00},
394 { 70,0x00},
395 { 71,0x00},
396 { 72,0xFF},
397 { 73,0x0F},
398 { 74,0x00},
399 { 75,0x00},
400 { 76,0xFA},
401 { 77,0x8C},
402 { 78,0x00},
403 { 79,0x00},
404 { 80,0xF5},
405 { 81,0x08},
406 { 82,0x00},
407 { 83,0x00},
408 { 84,0xFD},
409 { 85,0x92},
410 { 86,0x00},
411 { 87,0x00},
412 { 88,0xF3},
413 { 89,0xA3},
414 { 90,0x00},
415 { 91,0x00},
416 { 92,0x03},
417 { 93,0xB3},
418 { 94,0x00},
419 { 95,0x00},
420 { 96,0x00},
421 { 97,0x33},
422 { 98,0x00},
423 { 99,0x00},
424 {100,0x00},
425 {101,0x71},
426 {102,0x00},
427 {103,0x00},
428 {104,0x40},
429 {105,0x60},
430 {106,0x00},
431 {107,0x00},
432 {108,0x00},
433 {109,0xE2},
434 {110,0x00},
435 {111,0x00},
436 {112,0x00},
437 {113,0xC6},
438 {114,0x00},
439 {115,0x00},
440 {116,0x00},
441 {117,0x87},
442 {118,0x00},
443 {119,0x00},
444 {120,0x00},
445 {121,0x0F},
446 {122,0x00},
447 {123,0x00},
448 {124,0x00},
449 {125,0x0A},
450 {126,0x00},
451 {127,0x00},
452 { 0,0x0B},
453 { 8,0x00},
454 { 9,0x02},
455 { 10,0x00},
456 { 11,0x00},
457 { 12,0x01},
458 { 13,0x81},
459 { 14,0x00},
460 { 15,0x00},
461 { 16,0x18},
462 { 17,0x89},
463 { 18,0x00},
464 { 19,0x00},
465 { 20,0x07},
466 { 21,0xFB},
467 { 22,0x00},
468 { 23,0x00},
469 { 24,0x03},
470 { 25,0xBE},
471 { 26,0x00},
472 { 27,0x00},
473 { 0,0x0},
474 { 0x7F,0x14},
475 { 0,0x01},
476 { 8,0xC0},
477 { 9,0x00},
478 { 10,0x00},
479 { 11,0x00},
480 { 12,0xC0},
481 { 13,0x00},
482 { 14,0x00},
483 { 15,0x00},
484 { 0,0x0},
485 { 0x7F,0x64},
486 { 0,0x01},
487 { 8,0x58},
488 { 9,0x60},
489 { 10,0x08},
490 { 11,0x01},
491 { 12,0x60},
492 { 13,0x60},
493 { 14,0x00},
494 { 15,0x00},
495 { 16,0x58},
496 { 17,0x60},
497 { 18,0x00},
498 { 19,0x09},
499 { 20,0x00},
500 { 21,0x00},
501 { 22,0x00},
502 { 23,0x00},
503 { 24,0x44},
504 { 25,0x00},
505 { 26,0xC0},
506 { 27,0x07},
507 { 28,0x04},
508 { 29,0x00},
509 { 30,0x00},
510 { 31,0x00},
511 { 32,0x04},
512 { 33,0x00},
513 { 34,0x00},
514 { 35,0x0D},
515 { 36,0x04},
516 { 37,0x00},
517 { 38,0x00},
518 { 39,0x08},
519 { 40,0x04},
520 { 41,0x00},
521 { 42,0x00},
522 { 43,0x04},
523 { 44,0x00},
524 { 45,0x00},
525 { 46,0x00},
526 { 47,0x00},
527 { 48,0x00},
528 { 49,0x00},
529 { 50,0x00},
530 { 51,0x00},
531 { 52,0x44},
532 { 53,0x00},
533 { 54,0x00},
534 { 55,0x07},
535 { 56,0x21},
536 { 57,0x00},
537 { 58,0x20},
538 { 59,0x00},
539 { 60,0x4B},
540 { 61,0x00},
541 { 62,0xC0},
542 { 63,0x00},
543 { 64,0x4B},
544 { 65,0x00},
545 { 66,0xE0},
546 { 67,0x00},
547 { 68,0x10},
548 { 69,0x00},
549 { 70,0x00},
550 { 71,0x00},
551 { 72,0x10},
552 { 73,0x00},
553 { 74,0x00},
554 { 75,0x0D},
555 { 76,0x10},
556 { 77,0x00},
557 { 78,0x00},
558 { 79,0x08},
559 { 80,0x10},
560 { 81,0x00},
561 { 82,0x00},
562 { 83,0x04},
563 { 84,0x18},
564 { 85,0x01},
565 { 86,0xC0},
566 { 87,0x0F},
567 { 88,0x1C},
568 { 89,0x01},
569 { 90,0xA0},
570 { 91,0x09},
571 { 92,0x1C},
572 { 93,0x01},
573 { 94,0xA0},
574 { 95,0x03},
575 { 96,0x1C},
576 { 97,0x01},
577 { 98,0x80},
578 { 99,0x0A},
579 {100,0x1C},
580 {101,0x01},
581 {102,0x80},
582 {103,0x02},
583 {104,0x1C},
584 {105,0x01},
585 {106,0x40},
586 {107,0x0C},
587 {108,0x1C},
588 {109,0x01},
589 {110,0x40},
590 {111,0x00},
591 {112,0x1C},
592 {113,0x01},
593 {114,0x60},
594 {115,0x01},
595 {116,0x1C},
596 {117,0x01},
597 {118,0x60},
598 {119,0x0B},
599 {120,0x18},
600 {121,0x01},
601 {122,0x40},
602 {123,0x03},
603 {124,0x1C},
604 {125,0x01},
605 {126,0x40},
606 {127,0x08},
607 { 0,0x02},
608 { 8,0x1C},
609 { 9,0x01},
610 { 10,0x60},
611 { 11,0x09},
612 { 12,0x10},
613 { 13,0x00},
614 { 14,0x00},
615 { 15,0x2D},
616 { 16,0x1C},
617 { 17,0x01},
618 { 18,0x60},
619 { 19,0x02},
620 { 20,0x1C},
621 { 21,0x01},
622 { 22,0x80},
623 { 23,0x01},
624 { 24,0x1C},
625 { 25,0x01},
626 { 26,0x80},
627 { 27,0x0A},
628 { 28,0x1C},
629 { 29,0x01},
630 { 30,0xA0},
631 { 31,0x00},
632 { 32,0x1C},
633 { 33,0x01},
634 { 34,0xA0},
635 { 35,0x0B},
636 { 36,0x1C},
637 { 37,0x01},
638 { 38,0xC0},
639 { 39,0x06},
640 { 40,0x00},
641 { 41,0x00},
642 { 42,0x00},
643 { 43,0x00},
644 { 44,0x00},
645 { 45,0x00},
646 { 46,0x00},
647 { 47,0x00},
648 { 48,0x00},
649 { 49,0x00},
650 { 50,0x00},
651 { 51,0x00},
652 { 52,0x10},
653 { 53,0x00},
654 { 54,0x00},
655 { 55,0x0F},
656 { 56,0x18},
657 { 57,0x01},
658 { 58,0xE0},
659 { 59,0x2C},
660 { 60,0x1C},
661 { 61,0x02},
662 { 62,0x00},
663 { 63,0x11},
664 { 64,0x1C},
665 { 65,0x02},
666 { 66,0x00},
667 { 67,0x48},
668 { 68,0x1C},
669 { 69,0x01},
670 { 70,0xE0},
671 { 71,0x2D},
672 { 72,0x1C},
673 { 73,0x02},
674 { 74,0x20},
675 { 75,0x2F},
676 { 76,0x1C},
677 { 77,0x02},
678 { 78,0x20},
679 { 79,0x2A},
680 { 80,0x1C},
681 { 81,0x02},
682 { 82,0x40},
683 { 83,0x31},
684 { 84,0x1C},
685 { 85,0x02},
686 { 86,0x40},
687 { 87,0x28},
688 { 88,0x1C},
689 { 89,0x02},
690 { 90,0x60},
691 { 91,0x37},
692 { 92,0x1C},
693 { 93,0x02},
694 { 94,0x60},
695 { 95,0x22},
696 { 96,0x1C},
697 { 97,0x02},
698 { 98,0x80},
699 { 99,0x14},
700 {100,0x1C},
701 {101,0x02},
702 {102,0x80},
703 {103,0x45},
704 {104,0x1C},
705 {105,0x02},
706 {106,0xA0},
707 {107,0x12},
708 {108,0x1C},
709 {109,0x02},
710 {110,0xA0},
711 {111,0x47},
712 {112,0x1C},
713 {113,0x02},
714 {114,0xC0},
715 {115,0x38},
716 {116,0x1C},
717 {117,0x02},
718 {118,0xC0},
719 {119,0x21},
720 {120,0x1C},
721 {121,0x02},
722 {122,0xE0},
723 {123,0x33},
724 {124,0x1C},
725 {125,0x02},
726 {126,0xE0},
727 {127,0x26},
728 { 0,0x03},
729 { 8,0x1C},
730 { 9,0x03},
731 { 10,0x00},
732 { 11,0x16},
733 { 12,0x1C},
734 { 13,0x03},
735 { 14,0x00},
736 { 15,0x43},
737 { 16,0x1C},
738 { 17,0x03},
739 { 18,0xC0},
740 { 19,0x35},
741 { 20,0x1C},
742 { 21,0x03},
743 { 22,0xC0},
744 { 23,0x24},
745 { 24,0x1C},
746 { 25,0x03},
747 { 26,0xE0},
748 { 27,0x1A},
749 { 28,0x1C},
750 { 29,0x03},
751 { 30,0xE0},
752 { 31,0x3F},
753 { 32,0x1C},
754 { 33,0x04},
755 { 34,0x00},
756 { 35,0x3A},
757 { 36,0x1C},
758 { 37,0x04},
759 { 38,0x00},
760 { 39,0x1F},
761 { 40,0x1C},
762 { 41,0x04},
763 { 42,0x20},
764 { 43,0x18},
765 { 44,0x1C},
766 { 45,0x04},
767 { 46,0x20},
768 { 47,0x41},
769 { 48,0x1C},
770 { 49,0x04},
771 { 50,0x40},
772 { 51,0x1C},
773 { 52,0x1C},
774 { 53,0x04},
775 { 54,0x40},
776 { 55,0x3D},
777 { 56,0x1C},
778 { 57,0x04},
779 { 58,0x60},
780 { 59,0x19},
781 { 60,0x1C},
782 { 61,0x04},
783 { 62,0x60},
784 { 63,0x40},
785 { 64,0x1C},
786 { 65,0x04},
787 { 66,0x80},
788 { 67,0x30},
789 { 68,0x1C},
790 { 69,0x04},
791 { 70,0x80},
792 { 71,0x29},
793 { 72,0x1C},
794 { 73,0x04},
795 { 74,0xA0},
796 { 75,0x15},
797 { 76,0x1C},
798 { 77,0x04},
799 { 78,0xA0},
800 { 79,0x44},
801 { 80,0x1C},
802 { 81,0x04},
803 { 82,0xC0},
804 { 83,0x3B},
805 { 84,0x1C},
806 { 85,0x04},
807 { 86,0xC0},
808 { 87,0x1E},
809 { 88,0x1C},
810 { 89,0x04},
811 { 90,0xE0},
812 { 91,0x34},
813 { 92,0x1C},
814 { 93,0x04},
815 { 94,0xE0},
816 { 95,0x25},
817 { 96,0x1C},
818 { 97,0x05},
819 { 98,0x00},
820 { 99,0x36},
821 {100,0x1C},
822 {101,0x05},
823 {102,0x00},
824 {103,0x23},
825 {104,0x1C},
826 {105,0x05},
827 {106,0x20},
828 {107,0x32},
829 {108,0x1C},
830 {109,0x05},
831 {110,0x20},
832 {111,0x27},
833 {112,0x1C},
834 {113,0x05},
835 {114,0x40},
836 {115,0x13},
837 {116,0x1C},
838 {117,0x05},
839 {118,0x40},
840 {119,0x46},
841 {120,0x1C},
842 {121,0x05},
843 {122,0x60},
844 {123,0x2E},
845 {124,0x1C},
846 {125,0x05},
847 {126,0x60},
848 {127,0x2B},
849 { 0,0x04},
850 { 8,0x1C},
851 { 9,0x05},
852 { 10,0x80},
853 { 11,0x10},
854 { 12,0x1C},
855 { 13,0x05},
856 { 14,0x80},
857 { 15,0x49},
858 { 16,0x1C},
859 { 17,0x05},
860 { 18,0xA0},
861 { 19,0x17},
862 { 20,0x1C},
863 { 21,0x05},
864 { 22,0xA0},
865 { 23,0x42},
866 { 24,0x1C},
867 { 25,0x05},
868 { 26,0xC0},
869 { 27,0x1D},
870 { 28,0x1C},
871 { 29,0x05},
872 { 30,0xC0},
873 { 31,0x3C},
874 { 32,0x1C},
875 { 33,0x05},
876 { 34,0xE0},
877 { 35,0x1B},
878 { 36,0x1C},
879 { 37,0x05},
880 { 38,0xE0},
881 { 39,0x3E},
882 { 40,0x1C},
883 { 41,0x06},
884 { 42,0x00},
885 { 43,0x39},
886 { 44,0x1C},
887 { 45,0x06},
888 { 46,0x00},
889 { 47,0x20},
890 { 48,0x00},
891 { 49,0x00},
892 { 50,0x00},
893 { 51,0x00},
894 { 52,0x5C},
895 { 53,0x90},
896 { 54,0x40},
897 { 55,0x00},
898 { 56,0x00},
899 { 57,0x00},
900 { 58,0x00},
901 { 59,0x00},
902 { 60,0x5C},
903 { 61,0x90},
904 { 62,0x20},
905 { 63,0x00},
906 { 64,0x00},
907 { 65,0x00},
908 { 66,0x00},
909 { 67,0x00},
910 { 68,0x00},
911 { 69,0x00},
912 { 70,0x00},
913 { 71,0x00},
914 { 72,0x00},
915 { 73,0x00},
916 { 74,0x00},
917 { 75,0x00},
918 { 76,0x10},
919 { 77,0x00},
920 { 78,0x00},
921 { 79,0x49},
922 { 80,0x18},
923 { 81,0x00},
924 { 82,0x60},
925 { 83,0x4A},
926 { 84,0x1C},
927 { 85,0x00},
928 { 86,0x80},
929 { 87,0x4C},
930 { 88,0x1C},
931 { 89,0x00},
932 { 90,0x40},
933 { 91,0x49},
934 { 92,0x30},
935 { 93,0x00},
936 { 94,0x00},
937 { 95,0x4C},
938 { 96,0x1C},
939 { 97,0x00},
940 { 98,0x20},
941 { 99,0x4E},
942 {100,0x00},
943 {101,0x00},
944 {102,0x00},
945 {103,0x00},
946 {104,0x10},
947 {105,0x30},
948 {106,0x00},
949 {107,0x4B},
950 {108,0x34},
951 {109,0x00},
952 {110,0x00},
953 {111,0x4B},
954 {112,0x5C},
955 {113,0x60},
956 {114,0xA0},
957 {115,0x4B},
958 {116,0x0C},
959 {117,0x00},
960 {118,0x40},
961 {119,0x00},
962 {120,0x00},
963 {121,0x00},
964 {122,0x00},
965 {123,0x00},
966 {124,0x10},
967 {125,0x30},
968 {126,0x00},
969 {127,0x4D},
970 { 0,0x05},
971 { 8,0x10},
972 { 9,0x13},
973 { 10,0xE0},
974 { 11,0x50},
975 { 12,0x18},
976 { 13,0x01},
977 { 14,0x00},
978 { 15,0x50},
979 { 16,0x18},
980 { 17,0x03},
981 { 18,0x60},
982 { 19,0x53},
983 { 20,0x6C},
984 { 21,0x03},
985 { 22,0x40},
986 { 23,0x52},
987 { 24,0x6C},
988 { 25,0x03},
989 { 26,0x80},
990 { 27,0x55},
991 { 28,0x10},
992 { 29,0x00},
993 { 30,0x20},
994 { 31,0x51},
995 { 32,0x1C},
996 { 33,0x03},
997 { 34,0x20},
998 { 35,0x51},
999 { 36,0x1C},
1000 { 37,0x03},
1001 { 38,0xA0},
1002 { 39,0x56},
1003 { 40,0x00},
1004 { 41,0x00},
1005 { 42,0x00},
1006 { 43,0x00},
1007 { 44,0x00},
1008 { 45,0x00},
1009 { 46,0x00},
1010 { 47,0x00},
1011 { 48,0x00},
1012 { 49,0x00},
1013 { 50,0x00},
1014 { 51,0x00},
1015 { 52,0x10},
1016 { 53,0x00},
1017 { 54,0x00},
1018 { 55,0x54},
1019 { 56,0x18},
1020 { 57,0x01},
1021 { 58,0x00},
1022 { 59,0x54},
1023 { 60,0x00},
1024 { 61,0x00},
1025 { 62,0x00},
1026 { 63,0x00},
1027 { 64,0x0C},
1028 { 65,0x00},
1029 { 66,0x00},
1030 { 67,0x03},
1031 { 68,0x00},
1032 { 69,0x00},
1033 { 70,0x00},
1034 { 71,0x00},
1035 { 72,0x00},
1036 { 73,0x00},
1037 { 74,0x00},
1038 { 75,0x00},
1039 { 76,0x00},
1040 { 77,0x00},
1041 { 78,0x00},
1042 { 79,0x00},
1043 { 80,0x02},
1044 { 81,0x00},
1045 { 82,0x00},
1046 { 83,0x00},
1047 { 84,0x00},
1048 { 85,0x00},
1049 { 86,0x00},
1050 { 87,0x00},
1051};
1052
1053
1054#define main44_miniDSP_A_reg_values_COEFF_START 0
1055#define main44_miniDSP_A_reg_values_COEFF_SIZE 958
1056#define main44_miniDSP_A_reg_values_INST_START 958
1057#define main44_miniDSP_A_reg_values_INST_SIZE 2160
1058
1059reg_value main44_miniDSP_D_reg_values[] = {
1060 { 0,0x0},
1061 { 0x7F,0x50},
1062 { 0,0x01},
1063 { 8,0xFF},
1064 { 9,0xFF},
1065 { 10,0xFF},
1066 { 11,0x00},
1067 { 12,0x80},
1068 { 13,0x00},
1069 { 14,0x00},
1070 { 15,0x00},
1071 { 16,0x7F},
1072 { 17,0xF7},
1073 { 18,0x00},
1074 { 19,0x00},
1075 { 20,0x80},
1076 { 21,0x09},
1077 { 22,0x00},
1078 { 23,0x00},
1079 { 24,0x7F},
1080 { 25,0xEF},
1081 { 26,0x00},
1082 { 27,0x00},
1083 { 28,0x66},
1084 { 29,0x66},
1085 { 30,0x60},
1086 { 31,0x00},
1087 { 32,0x1B},
1088 { 33,0x33},
1089 { 34,0x20},
1090 { 35,0x00},
1091 { 36,0x66},
1092 { 37,0x66},
1093 { 38,0x60},
1094 { 39,0x00},
1095 { 40,0x33},
1096 { 41,0x33},
1097 { 42,0x30},
1098 { 43,0x00},
1099 { 44,0x4C},
1100 { 45,0xCC},
1101 { 46,0xCD},
1102 { 47,0x00},
1103 { 48,0x00},
1104 { 49,0x00},
1105 { 50,0x01},
1106 { 51,0x00},
1107 { 52,0x33},
1108 { 53,0x33},
1109 { 54,0x30},
1110 { 55,0x00},
1111 { 56,0x33},
1112 { 57,0x33},
1113 { 58,0x30},
1114 { 59,0x00},
1115 { 60,0x7F},
1116 { 61,0xFF},
1117 { 62,0xAC},
1118 { 63,0x00},
1119 { 64,0x80},
1120 { 65,0x00},
1121 { 66,0x00},
1122 { 67,0x00},
1123 { 68,0x40},
1124 { 69,0x00},
1125 { 70,0x00},
1126 { 71,0x00},
1127 { 72,0x40},
1128 { 73,0x00},
1129 { 74,0x00},
1130 { 75,0x00},
1131 { 76,0xC0},
1132 { 77,0x00},
1133 { 78,0x00},
1134 { 79,0x00},
1135 { 80,0x50},
1136 { 81,0xC3},
1137 { 82,0x36},
1138 { 83,0x00},
1139 { 84,0x02},
1140 { 85,0x8F},
1141 { 86,0x5C},
1142 { 87,0x00},
1143 { 88,0x02},
1144 { 89,0xD7},
1145 { 90,0x0A},
1146 { 91,0x00},
1147 { 92,0x00},
1148 { 93,0x00},
1149 { 94,0x00},
1150 { 95,0x00},
1151 { 96,0x00},
1152 { 97,0x00},
1153 { 98,0x00},
1154 { 99,0x00},
1155 {100,0x00},
1156 {101,0x00},
1157 {102,0x00},
1158 {103,0x00},
1159 {104,0x00},
1160 {105,0x00},
1161 {106,0x00},
1162 {107,0x00},
1163 {108,0x00},
1164 {109,0x00},
1165 {110,0x00},
1166 {111,0x00},
1167 {112,0x40},
1168 {113,0x00},
1169 {114,0x00},
1170 {115,0x00},
1171 {116,0xFF},
1172 {117,0xFF},
1173 {118,0xFF},
1174 {119,0x00},
1175 {120,0xFF},
1176 {121,0xFF},
1177 {122,0xFE},
1178 {123,0x00},
1179 {124,0xFF},
1180 {125,0xFF},
1181 {126,0xFD},
1182 {127,0x00},
1183 { 0,0x02},
1184 { 8,0xFF},
1185 { 9,0xFF},
1186 { 10,0xFC},
1187 { 11,0x00},
1188 { 12,0x00},
1189 { 13,0x00},
1190 { 14,0x00},
1191 { 15,0x00},
1192 { 16,0x73},
1193 { 17,0x56},
1194 { 18,0x6E},
1195 { 19,0x00},
1196 { 20,0x7F},
1197 { 21,0xF4},
1198 { 22,0xA0},
1199 { 23,0x00},
1200 { 24,0x00},
1201 { 25,0x80},
1202 { 26,0x2D},
1203 { 27,0x00},
1204 { 28,0x7E},
1205 { 29,0xFF},
1206 { 30,0xA5},
1207 { 31,0x00},
1208 { 32,0x00},
1209 { 33,0x2E},
1210 { 34,0x73},
1211 { 35,0x00},
1212 { 36,0xFF},
1213 { 37,0xD1},
1214 { 38,0x8D},
1215 { 39,0x00},
1216 { 40,0x7F},
1217 { 41,0xC1},
1218 { 42,0x2F},
1219 { 43,0x00},
1220 { 44,0x80},
1221 { 45,0x7B},
1222 { 46,0x94},
1223 { 47,0x00},
1224 { 48,0x01},
1225 { 49,0x50},
1226 { 50,0xC1},
1227 { 51,0x00},
1228 { 52,0xFE},
1229 { 53,0xAF},
1230 { 54,0x3F},
1231 { 55,0x00},
1232 { 56,0x7F},
1233 { 57,0x55},
1234 { 58,0xC1},
1235 { 59,0x00},
1236 { 60,0x81},
1237 { 61,0x4E},
1238 { 62,0x4E},
1239 { 63,0x00},
1240 { 64,0x7F},
1241 { 65,0xFF},
1242 { 66,0xFF},
1243 { 67,0x00},
1244 { 68,0x00},
1245 { 69,0x00},
1246 { 70,0x00},
1247 { 71,0x00},
1248 { 72,0xC7},
1249 { 73,0x2E},
1250 { 74,0x8D},
1251 { 75,0x00},
1252 { 76,0x31},
1253 { 77,0x91},
1254 { 78,0x54},
1255 { 79,0x00},
1256 { 80,0xD1},
1257 { 81,0xFC},
1258 { 82,0xF4},
1259 { 83,0x00},
1260 { 84,0x2A},
1261 { 85,0x09},
1262 { 86,0x1A},
1263 { 87,0x00},
1264 { 88,0xEA},
1265 { 89,0xD6},
1266 { 90,0x1C},
1267 { 91,0x00},
1268 { 92,0xC5},
1269 { 93,0x28},
1270 { 94,0xA2},
1271 { 95,0x00},
1272 { 96,0x32},
1273 { 97,0xD7},
1274 { 98,0x53},
1275 { 99,0x00},
1276 {100,0xD3},
1277 {101,0x74},
1278 {102,0x4B},
1279 {103,0x00},
1280 {104,0x15},
1281 {105,0x04},
1282 {106,0x8D},
1283 {107,0x00},
1284 {108,0xF5},
1285 {109,0x6B},
1286 {110,0x0E},
1287 {111,0x00},
1288 {112,0xC0},
1289 {113,0x0C},
1290 {114,0x47},
1291 {115,0x00},
1292 {116,0x3F},
1293 {117,0x99},
1294 {118,0x61},
1295 {119,0x00},
1296 {120,0x3E},
1297 {121,0xE2},
1298 {122,0x1D},
1299 {123,0x00},
1300 {124,0x3E},
1301 {125,0xE2},
1302 {126,0x1D},
1303 {127,0x00},
1304 { 0,0x03},
1305 { 8,0x0A},
1306 { 9,0x57},
1307 { 10,0x0D},
1308 { 11,0x00},
1309 { 12,0xF5},
1310 { 13,0xA8},
1311 { 14,0xF3},
1312 { 15,0x00},
1313 { 16,0x6E},
1314 { 17,0x1B},
1315 { 18,0xC0},
1316 { 19,0x00},
1317 { 20,0x89},
1318 { 21,0x90},
1319 { 22,0x65},
1320 { 23,0x00},
1321 { 24,0x1B},
1322 { 25,0x6E},
1323 { 26,0xFE},
1324 { 27,0x00},
1325 { 28,0xE4},
1326 { 29,0x91},
1327 { 30,0x02},
1328 { 31,0x00},
1329 { 32,0x5B},
1330 { 33,0x45},
1331 { 34,0x9C},
1332 { 35,0x00},
1333 { 36,0x99},
1334 { 37,0x5F},
1335 { 38,0xEC},
1336 { 39,0x00},
1337 { 40,0x15},
1338 { 41,0x3D},
1339 { 42,0xC9},
1340 { 43,0x00},
1341 { 44,0xEA},
1342 { 45,0xC2},
1343 { 46,0x37},
1344 { 47,0x00},
1345 { 48,0x40},
1346 { 49,0x53},
1347 { 50,0x16},
1348 { 51,0x00},
1349 { 52,0x93},
1350 { 53,0xA5},
1351 { 54,0xAE},
1352 { 55,0x00},
1353 { 56,0x9B},
1354 { 57,0x77},
1355 { 58,0x00},
1356 { 59,0x00},
1357 { 60,0x64},
1358 { 61,0x88},
1359 { 62,0xF0},
1360 { 63,0x00},
1361 { 64,0x45},
1362 { 65,0x84},
1363 { 66,0x40},
1364 { 67,0x00},
1365 { 68,0xBA},
1366 { 69,0x7B},
1367 { 70,0xB0},
1368 { 71,0x00},
1369 { 72,0xC3},
1370 { 73,0xE0},
1371 { 74,0x00},
1372 { 75,0x00},
1373 { 76,0x3C},
1374 { 77,0x1F},
1375 { 78,0xF0},
1376 { 79,0x00},
1377 { 80,0x68},
1378 { 81,0x76},
1379 { 82,0x1D},
1380 { 83,0x00},
1381 { 84,0x97},
1382 { 85,0x89},
1383 { 86,0xE3},
1384 { 87,0x00},
1385 { 88,0x67},
1386 { 89,0xEA},
1387 { 90,0x3A},
1388 { 91,0x00},
1389 { 92,0xAD},
1390 { 93,0xFC},
1391 { 94,0x02},
1392 { 95,0x00},
1393 { 96,0x79},
1394 { 97,0xEC},
1395 { 98,0x4D},
1396 { 99,0x00},
1397 {100,0x86},
1398 {101,0x13},
1399 {102,0xB3},
1400 {103,0x00},
1401 {104,0x3A},
1402 {105,0x36},
1403 {106,0x6A},
1404 {107,0x00},
1405 {108,0x7F},
1406 {109,0xFF},
1407 {110,0xFF},
1408 {111,0x00},
1409 {112,0x00},
1410 {113,0x00},
1411 {114,0x00},
1412 {115,0x00},
1413 {116,0x00},
1414 {117,0x00},
1415 {118,0x00},
1416 {119,0x00},
1417 {120,0x00},
1418 {121,0x00},
1419 {122,0x00},
1420 {123,0x00},
1421 {124,0x00},
1422 {125,0x00},
1423 {126,0x00},
1424 {127,0x00},
1425 { 0,0x04},
1426 { 8,0x7F},
1427 { 9,0xFF},
1428 { 10,0xFF},
1429 { 11,0x00},
1430 { 12,0x00},
1431 { 13,0x00},
1432 { 14,0x00},
1433 { 15,0x00},
1434 { 16,0x00},
1435 { 17,0x00},
1436 { 18,0x00},
1437 { 19,0x00},
1438 { 20,0x00},
1439 { 21,0x00},
1440 { 22,0x00},
1441 { 23,0x00},
1442 { 24,0x00},
1443 { 25,0x00},
1444 { 26,0x00},
1445 { 27,0x00},
1446 { 28,0x00},
1447 { 29,0x00},
1448 { 30,0x01},
1449 { 31,0x00},
1450 { 32,0xC0},
1451 { 33,0x00},
1452 { 34,0x00},
1453 { 35,0x00},
1454 { 36,0x00},
1455 { 37,0x00},
1456 { 38,0x01},
1457 { 39,0x00},
1458 { 40,0x00},
1459 { 41,0x00},
1460 { 42,0xAF},
1461 { 43,0x00},
1462 { 44,0x7F},
1463 { 45,0xFF},
1464 { 46,0x51},
1465 { 47,0x00},
1466 { 48,0x00},
1467 { 49,0x00},
1468 { 50,0x00},
1469 { 51,0x00},
1470 { 52,0xF0},
1471 { 53,0x00},
1472 { 54,0x00},
1473 { 55,0x00},
1474 { 56,0xE4},
1475 { 57,0x00},
1476 { 58,0x00},
1477 { 59,0x00},
1478 { 60,0x32},
1479 { 61,0x00},
1480 { 62,0x00},
1481 { 63,0x00},
1482 { 64,0x14},
1483 { 65,0x00},
1484 { 66,0x00},
1485 { 67,0x00},
1486 { 68,0xFF},
1487 { 69,0x00},
1488 { 70,0x00},
1489 { 71,0x00},
1490 { 72,0xF0},
1491 { 73,0x00},
1492 { 74,0x00},
1493 { 75,0x00},
1494 { 76,0x00},
1495 { 77,0x02},
1496 { 78,0xBB},
1497 { 79,0x00},
1498 { 80,0x7F},
1499 { 81,0xFD},
1500 { 82,0x45},
1501 { 83,0x00},
1502 { 84,0x00},
1503 { 85,0x00},
1504 { 86,0x57},
1505 { 87,0x00},
1506 { 88,0x7F},
1507 { 89,0xFF},
1508 { 90,0xA9},
1509 { 91,0x00},
1510 { 92,0x20},
1511 { 93,0x00},
1512 { 94,0x00},
1513 { 95,0x00},
1514 { 96,0x00},
1515 { 97,0x00},
1516 { 98,0x00},
1517 { 99,0x00},
1518 {100,0xD7},
1519 {101,0x41},
1520 {102,0xA0},
1521 {103,0x00},
1522 {104,0xFF},
1523 {105,0xF0},
1524 {106,0x00},
1525 {107,0x00},
1526 {108,0x88},
1527 {109,0x00},
1528 {110,0x00},
1529 {111,0x00},
1530 {112,0x18},
1531 {113,0x00},
1532 {114,0x00},
1533 {115,0x00},
1534 {116,0x00},
1535 {117,0x00},
1536 {118,0x00},
1537 {119,0x00},
1538 {120,0x0C},
1539 {121,0x00},
1540 {122,0x00},
1541 {123,0x00},
1542 {124,0xF4},
1543 {125,0x00},
1544 {126,0x00},
1545 {127,0x00},
1546 { 0,0x05},
1547 { 8,0x15},
1548 { 9,0x42},
1549 { 10,0xA6},
1550 { 11,0x00},
1551 { 12,0x7F},
1552 { 13,0xFF},
1553 { 14,0xFF},
1554 { 15,0x00},
1555 { 16,0x0B},
1556 { 17,0xF9},
1557 { 18,0x13},
1558 { 19,0x00},
1559 { 20,0x18},
1560 { 21,0xEC},
1561 { 22,0xF7},
1562 { 23,0x00},
1563 { 24,0x5B},
1564 { 25,0x9E},
1565 { 26,0xC4},
1566 { 27,0x00},
1567 { 28,0x7F},
1568 { 29,0x7B},
1569 { 30,0x30},
1570 { 31,0x00},
1571 { 32,0x00},
1572 { 33,0x00},
1573 { 34,0x00},
1574 { 35,0x00},
1575 { 36,0x00},
1576 { 37,0x00},
1577 { 38,0x00},
1578 { 39,0x00},
1579 { 40,0x00},
1580 { 41,0x00},
1581 { 42,0x00},
1582 { 43,0x00},
1583 { 44,0x00},
1584 { 45,0x0D},
1585 { 46,0x00},
1586 { 47,0x00},
1587 { 48,0x00},
1588 { 49,0x1C},
1589 { 50,0x00},
1590 { 51,0x00},
1591 { 52,0x00},
1592 { 53,0x3E},
1593 { 54,0x00},
1594 { 55,0x00},
1595 { 56,0x00},
1596 { 57,0x78},
1597 { 58,0x00},
1598 { 59,0x00},
1599 { 60,0x02},
1600 { 61,0x4C},
1601 { 62,0x00},
1602 { 63,0x00},
1603 { 64,0x00},
1604 { 65,0xD5},
1605 { 66,0x00},
1606 { 67,0x00},
1607 { 68,0x01},
1608 { 69,0x65},
1609 { 70,0x00},
1610 { 71,0x00},
1611 { 72,0x03},
1612 { 73,0xE9},
1613 { 74,0x00},
1614 { 75,0x00},
1615 { 76,0x07},
1616 { 77,0xCA},
1617 { 78,0x00},
1618 { 79,0x00},
1619 { 80,0xFF},
1620 { 81,0xEF},
1621 { 82,0x00},
1622 { 83,0x00},
1623 { 84,0xFE},
1624 { 85,0xEB},
1625 { 86,0x00},
1626 { 87,0x00},
1627 { 88,0xFF},
1628 { 89,0xA8},
1629 { 90,0x00},
1630 { 91,0x00},
1631 { 92,0xFD},
1632 { 93,0x08},
1633 { 94,0x00},
1634 { 95,0x00},
1635 { 96,0xFF},
1636 { 97,0x5E},
1637 { 98,0x00},
1638 { 99,0x00},
1639 {100,0xFF},
1640 {101,0xD5},
1641 {102,0x00},
1642 {103,0x00},
1643 {104,0xFE},
1644 {105,0x36},
1645 {106,0x00},
1646 {107,0x00},
1647 {108,0xFA},
1648 {109,0xAC},
1649 {110,0x00},
1650 {111,0x00},
1651 {112,0xF2},
1652 {113,0xA3},
1653 {114,0x00},
1654 {115,0x00},
1655 {116,0x28},
1656 {117,0xAB},
1657 {118,0x00},
1658 {119,0x00},
1659 {120,0x3F},
1660 {121,0xFF},
1661 {122,0x00},
1662 {123,0x00},
1663 {124,0xFF},
1664 {125,0x98},
1665 {126,0x00},
1666 {127,0x00},
1667 { 0,0x06},
1668 { 8,0xF6},
1669 { 9,0xF9},
1670 { 10,0x00},
1671 { 11,0x00},
1672 { 12,0x26},
1673 { 13,0xFB},
1674 { 14,0x00},
1675 { 15,0x00},
1676 { 16,0x02},
1677 { 17,0x72},
1678 { 18,0x00},
1679 { 19,0x00},
1680 { 20,0x40},
1681 { 21,0x02},
1682 { 22,0x00},
1683 { 23,0x00},
1684 { 24,0xFB},
1685 { 25,0xCB},
1686 { 26,0x00},
1687 { 27,0x00},
1688 { 28,0x20},
1689 { 29,0xA7},
1690 { 30,0x00},
1691 { 31,0x00},
1692 { 32,0xFF},
1693 { 33,0x6A},
1694 { 34,0x00},
1695 { 35,0x00},
1696 { 36,0x3A},
1697 { 37,0x0F},
1698 { 38,0x00},
1699 { 39,0x00},
1700 { 0,0x09},
1701 { 72,0xFF},
1702 { 73,0xFF},
1703 { 74,0xFF},
1704 { 75,0x00},
1705 { 76,0x80},
1706 { 77,0x00},
1707 { 78,0x00},
1708 { 79,0x00},
1709 { 80,0x7F},
1710 { 81,0xF7},
1711 { 82,0x00},
1712 { 83,0x00},
1713 { 84,0x80},
1714 { 85,0x09},
1715 { 86,0x00},
1716 { 87,0x00},
1717 { 88,0x7F},
1718 { 89,0xEF},
1719 { 90,0x00},
1720 { 91,0x00},
1721 { 92,0x66},
1722 { 93,0x66},
1723 { 94,0x60},
1724 { 95,0x00},
1725 { 96,0x1B},
1726 { 97,0x33},
1727 { 98,0x20},
1728 { 99,0x00},
1729 {100,0x66},
1730 {101,0x66},
1731 {102,0x60},
1732 {103,0x00},
1733 {104,0x33},
1734 {105,0x33},
1735 {106,0x30},
1736 {107,0x00},
1737 {108,0x4C},
1738 {109,0xCC},
1739 {110,0xCD},
1740 {111,0x00},
1741 {112,0x00},
1742 {113,0x00},
1743 {114,0x01},
1744 {115,0x00},
1745 {116,0x33},
1746 {117,0x33},
1747 {118,0x30},
1748 {119,0x00},
1749 {120,0x33},
1750 {121,0x33},
1751 {122,0x30},
1752 {123,0x00},
1753 {124,0x7F},
1754 {125,0xFF},
1755 {126,0xAC},
1756 {127,0x00},
1757 { 0,0x0A},
1758 { 8,0x80},
1759 { 9,0x00},
1760 { 10,0x00},
1761 { 11,0x00},
1762 { 12,0x40},
1763 { 13,0x00},
1764 { 14,0x00},
1765 { 15,0x00},
1766 { 16,0x40},
1767 { 17,0x00},
1768 { 18,0x00},
1769 { 19,0x00},
1770 { 20,0xC0},
1771 { 21,0x00},
1772 { 22,0x00},
1773 { 23,0x00},
1774 { 24,0x50},
1775 { 25,0xC3},
1776 { 26,0x36},
1777 { 27,0x00},
1778 { 28,0x02},
1779 { 29,0x8F},
1780 { 30,0x5C},
1781 { 31,0x00},
1782 { 32,0x02},
1783 { 33,0xD7},
1784 { 34,0x0A},
1785 { 35,0x00},
1786 { 36,0x00},
1787 { 37,0x00},
1788 { 38,0x00},
1789 { 39,0x00},
1790 { 40,0x00},
1791 { 41,0x00},
1792 { 42,0x00},
1793 { 43,0x00},
1794 { 44,0x00},
1795 { 45,0x00},
1796 { 46,0x00},
1797 { 47,0x00},
1798 { 48,0x00},
1799 { 49,0x00},
1800 { 50,0x00},
1801 { 51,0x00},
1802 { 52,0x00},
1803 { 53,0x00},
1804 { 54,0x00},
1805 { 55,0x00},
1806 { 56,0x40},
1807 { 57,0x00},
1808 { 58,0x00},
1809 { 59,0x00},
1810 { 60,0xFF},
1811 { 61,0xFF},
1812 { 62,0xFF},
1813 { 63,0x00},
1814 { 64,0xFF},
1815 { 65,0xFF},
1816 { 66,0xFE},
1817 { 67,0x00},
1818 { 68,0xFF},
1819 { 69,0xFF},
1820 { 70,0xFD},
1821 { 71,0x00},
1822 { 72,0xFF},
1823 { 73,0xFF},
1824 { 74,0xFC},
1825 { 75,0x00},
1826 { 76,0x00},
1827 { 77,0x00},
1828 { 78,0x00},
1829 { 79,0x00},
1830 { 80,0x73},
1831 { 81,0x56},
1832 { 82,0x6E},
1833 { 83,0x00},
1834 { 84,0x7F},
1835 { 85,0xF4},
1836 { 86,0xA0},
1837 { 87,0x00},
1838 { 88,0x00},
1839 { 89,0x80},
1840 { 90,0x2D},
1841 { 91,0x00},
1842 { 92,0x7E},
1843 { 93,0xFF},
1844 { 94,0xA5},
1845 { 95,0x00},
1846 { 96,0x00},
1847 { 97,0x2E},
1848 { 98,0x73},
1849 { 99,0x00},
1850 {100,0xFF},
1851 {101,0xD1},
1852 {102,0x8D},
1853 {103,0x00},
1854 {104,0x7F},
1855 {105,0xC1},
1856 {106,0x2F},
1857 {107,0x00},
1858 {108,0x80},
1859 {109,0x7B},
1860 {110,0x94},
1861 {111,0x00},
1862 {112,0x01},
1863 {113,0x50},
1864 {114,0xC1},
1865 {115,0x00},
1866 {116,0xFE},
1867 {117,0xAF},
1868 {118,0x3F},
1869 {119,0x00},
1870 {120,0x7F},
1871 {121,0x55},
1872 {122,0xC1},
1873 {123,0x00},
1874 {124,0x81},
1875 {125,0x4E},
1876 {126,0x4E},
1877 {127,0x00},
1878 { 0,0x0B},
1879 { 8,0x7F},
1880 { 9,0xFF},
1881 { 10,0xFF},
1882 { 11,0x00},
1883 { 12,0x00},
1884 { 13,0x00},
1885 { 14,0x00},
1886 { 15,0x00},
1887 { 16,0xC7},
1888 { 17,0x2E},
1889 { 18,0x8D},
1890 { 19,0x00},
1891 { 20,0x31},
1892 { 21,0x91},
1893 { 22,0x54},
1894 { 23,0x00},
1895 { 24,0xD1},
1896 { 25,0xFC},
1897 { 26,0xF4},
1898 { 27,0x00},
1899 { 28,0x2A},
1900 { 29,0x09},
1901 { 30,0x1A},
1902 { 31,0x00},
1903 { 32,0xEA},
1904 { 33,0xD6},
1905 { 34,0x1C},
1906 { 35,0x00},
1907 { 36,0xC5},
1908 { 37,0x28},
1909 { 38,0xA2},
1910 { 39,0x00},
1911 { 40,0x32},
1912 { 41,0xD7},
1913 { 42,0x53},
1914 { 43,0x00},
1915 { 44,0xD3},
1916 { 45,0x74},
1917 { 46,0x4B},
1918 { 47,0x00},
1919 { 48,0x15},
1920 { 49,0x04},
1921 { 50,0x8D},
1922 { 51,0x00},
1923 { 52,0xF5},
1924 { 53,0x6B},
1925 { 54,0x0E},
1926 { 55,0x00},
1927 { 56,0xC0},
1928 { 57,0x0C},
1929 { 58,0x47},
1930 { 59,0x00},
1931 { 60,0x3F},
1932 { 61,0x99},
1933 { 62,0x61},
1934 { 63,0x00},
1935 { 64,0x3E},
1936 { 65,0xE2},
1937 { 66,0x1D},
1938 { 67,0x00},
1939 { 68,0x3E},
1940 { 69,0xE2},
1941 { 70,0x1D},
1942 { 71,0x00},
1943 { 72,0x0A},
1944 { 73,0x57},
1945 { 74,0x0D},
1946 { 75,0x00},
1947 { 76,0xF5},
1948 { 77,0xA8},
1949 { 78,0xF3},
1950 { 79,0x00},
1951 { 80,0x6E},
1952 { 81,0x1B},
1953 { 82,0xC0},
1954 { 83,0x00},
1955 { 84,0x89},
1956 { 85,0x90},
1957 { 86,0x65},
1958 { 87,0x00},
1959 { 88,0x1B},
1960 { 89,0x6E},
1961 { 90,0xFE},
1962 { 91,0x00},
1963 { 92,0xE4},
1964 { 93,0x91},
1965 { 94,0x02},
1966 { 95,0x00},
1967 { 96,0x5B},
1968 { 97,0x45},
1969 { 98,0x9C},
1970 { 99,0x00},
1971 {100,0x99},
1972 {101,0x5F},
1973 {102,0xEC},
1974 {103,0x00},
1975 {104,0x15},
1976 {105,0x3D},
1977 {106,0xC9},
1978 {107,0x00},
1979 {108,0xEA},
1980 {109,0xC2},
1981 {110,0x37},
1982 {111,0x00},
1983 {112,0x40},
1984 {113,0x53},
1985 {114,0x16},
1986 {115,0x00},
1987 {116,0x93},
1988 {117,0xA5},
1989 {118,0xAE},
1990 {119,0x00},
1991 {120,0x9B},
1992 {121,0x77},
1993 {122,0x00},
1994 {123,0x00},
1995 {124,0x64},
1996 {125,0x88},
1997 {126,0xF0},
1998 {127,0x00},
1999 { 0,0x0C},
2000 { 8,0x45},
2001 { 9,0x84},
2002 { 10,0x40},
2003 { 11,0x00},
2004 { 12,0xBA},
2005 { 13,0x7B},
2006 { 14,0xB0},
2007 { 15,0x00},
2008 { 16,0xC3},
2009 { 17,0xE0},
2010 { 18,0x00},
2011 { 19,0x00},
2012 { 20,0x3C},
2013 { 21,0x1F},
2014 { 22,0xF0},
2015 { 23,0x00},
2016 { 24,0x68},
2017 { 25,0x76},
2018 { 26,0x1D},
2019 { 27,0x00},
2020 { 28,0x97},
2021 { 29,0x89},
2022 { 30,0xE3},
2023 { 31,0x00},
2024 { 32,0x67},
2025 { 33,0xEA},
2026 { 34,0x3A},
2027 { 35,0x00},
2028 { 36,0xAD},
2029 { 37,0xFC},
2030 { 38,0x02},
2031 { 39,0x00},
2032 { 40,0x79},
2033 { 41,0xEC},
2034 { 42,0x4D},
2035 { 43,0x00},
2036 { 44,0x86},
2037 { 45,0x13},
2038 { 46,0xB3},
2039 { 47,0x00},
2040 { 48,0x3A},
2041 { 49,0x36},
2042 { 50,0x6A},
2043 { 51,0x00},
2044 { 52,0x7F},
2045 { 53,0xFF},
2046 { 54,0xFF},
2047 { 55,0x00},
2048 { 56,0x00},
2049 { 57,0x00},
2050 { 58,0x00},
2051 { 59,0x00},
2052 { 60,0x00},
2053 { 61,0x00},
2054 { 62,0x00},
2055 { 63,0x00},
2056 { 64,0x00},
2057 { 65,0x00},
2058 { 66,0x00},
2059 { 67,0x00},
2060 { 68,0x00},
2061 { 69,0x00},
2062 { 70,0x00},
2063 { 71,0x00},
2064 { 72,0x7F},
2065 { 73,0xFF},
2066 { 74,0xFF},
2067 { 75,0x00},
2068 { 76,0x00},
2069 { 77,0x00},
2070 { 78,0x00},
2071 { 79,0x00},
2072 { 80,0x00},
2073 { 81,0x00},
2074 { 82,0x00},
2075 { 83,0x00},
2076 { 84,0x00},
2077 { 85,0x00},
2078 { 86,0x00},
2079 { 87,0x00},
2080 { 88,0x00},
2081 { 89,0x00},
2082 { 90,0x00},
2083 { 91,0x00},
2084 { 92,0x00},
2085 { 93,0x00},
2086 { 94,0x01},
2087 { 95,0x00},
2088 { 96,0xC0},
2089 { 97,0x00},
2090 { 98,0x00},
2091 { 99,0x00},
2092 {100,0x00},
2093 {101,0x00},
2094 {102,0x01},
2095 {103,0x00},
2096 {104,0x00},
2097 {105,0x00},
2098 {106,0xAF},
2099 {107,0x00},
2100 {108,0x7F},
2101 {109,0xFF},
2102 {110,0x51},
2103 {111,0x00},
2104 {112,0x00},
2105 {113,0x00},
2106 {114,0x00},
2107 {115,0x00},
2108 {116,0xF0},
2109 {117,0x00},
2110 {118,0x00},
2111 {119,0x00},
2112 {120,0xE4},
2113 {121,0x00},
2114 {122,0x00},
2115 {123,0x00},
2116 {124,0x32},
2117 {125,0x00},
2118 {126,0x00},
2119 {127,0x00},
2120 { 0,0x0D},
2121 { 8,0x14},
2122 { 9,0x00},
2123 { 10,0x00},
2124 { 11,0x00},
2125 { 12,0xFF},
2126 { 13,0x00},
2127 { 14,0x00},
2128 { 15,0x00},
2129 { 16,0xF0},
2130 { 17,0x00},
2131 { 18,0x00},
2132 { 19,0x00},
2133 { 20,0x00},
2134 { 21,0x02},
2135 { 22,0xBB},
2136 { 23,0x00},
2137 { 24,0x7F},
2138 { 25,0xFD},
2139 { 26,0x45},
2140 { 27,0x00},
2141 { 28,0x00},
2142 { 29,0x00},
2143 { 30,0x57},
2144 { 31,0x00},
2145 { 32,0x7F},
2146 { 33,0xFF},
2147 { 34,0xA9},
2148 { 35,0x00},
2149 { 36,0x20},
2150 { 37,0x00},
2151 { 38,0x00},
2152 { 39,0x00},
2153 { 40,0x00},
2154 { 41,0x00},
2155 { 42,0x00},
2156 { 43,0x00},
2157 { 44,0xD7},
2158 { 45,0x41},
2159 { 46,0xA0},
2160 { 47,0x00},
2161 { 48,0xFF},
2162 { 49,0xF0},
2163 { 50,0x00},
2164 { 51,0x00},
2165 { 52,0x88},
2166 { 53,0x00},
2167 { 54,0x00},
2168 { 55,0x00},
2169 { 56,0x18},
2170 { 57,0x00},
2171 { 58,0x00},
2172 { 59,0x00},
2173 { 60,0x00},
2174 { 61,0x00},
2175 { 62,0x00},
2176 { 63,0x00},
2177 { 64,0x0C},
2178 { 65,0x00},
2179 { 66,0x00},
2180 { 67,0x00},
2181 { 68,0xF4},
2182 { 69,0x00},
2183 { 70,0x00},
2184 { 71,0x00},
2185 { 72,0x15},
2186 { 73,0x42},
2187 { 74,0xA6},
2188 { 75,0x00},
2189 { 76,0x7F},
2190 { 77,0xFF},
2191 { 78,0xFF},
2192 { 79,0x00},
2193 { 80,0x0B},
2194 { 81,0xF9},
2195 { 82,0x13},
2196 { 83,0x00},
2197 { 84,0x18},
2198 { 85,0xEC},
2199 { 86,0xF7},
2200 { 87,0x00},
2201 { 88,0x5B},
2202 { 89,0x9E},
2203 { 90,0xC4},
2204 { 91,0x00},
2205 { 92,0x7F},
2206 { 93,0x7B},
2207 { 94,0x30},
2208 { 95,0x00},
2209 { 96,0x00},
2210 { 97,0x00},
2211 { 98,0x00},
2212 { 99,0x00},
2213 {100,0x00},
2214 {101,0x00},
2215 {102,0x00},
2216 {103,0x00},
2217 {104,0x00},
2218 {105,0x00},
2219 {106,0x00},
2220 {107,0x00},
2221 {108,0x00},
2222 {109,0x0D},
2223 {110,0x00},
2224 {111,0x00},
2225 {112,0x00},
2226 {113,0x1C},
2227 {114,0x00},
2228 {115,0x00},
2229 {116,0x00},
2230 {117,0x3E},
2231 {118,0x00},
2232 {119,0x00},
2233 {120,0x00},
2234 {121,0x78},
2235 {122,0x00},
2236 {123,0x00},
2237 {124,0x02},
2238 {125,0x4C},
2239 {126,0x00},
2240 {127,0x00},
2241 { 0,0x0E},
2242 { 8,0x00},
2243 { 9,0xD5},
2244 { 10,0x00},
2245 { 11,0x00},
2246 { 12,0x01},
2247 { 13,0x65},
2248 { 14,0x00},
2249 { 15,0x00},
2250 { 16,0x03},
2251 { 17,0xE9},
2252 { 18,0x00},
2253 { 19,0x00},
2254 { 20,0x07},
2255 { 21,0xCA},
2256 { 22,0x00},
2257 { 23,0x00},
2258 { 24,0xFF},
2259 { 25,0xEF},
2260 { 26,0x00},
2261 { 27,0x00},
2262 { 28,0xFE},
2263 { 29,0xEB},
2264 { 30,0x00},
2265 { 31,0x00},
2266 { 32,0xFF},
2267 { 33,0xA8},
2268 { 34,0x00},
2269 { 35,0x00},
2270 { 36,0xFD},
2271 { 37,0x08},
2272 { 38,0x00},
2273 { 39,0x00},
2274 { 40,0xFF},
2275 { 41,0x5E},
2276 { 42,0x00},
2277 { 43,0x00},
2278 { 44,0xFF},
2279 { 45,0xD5},
2280 { 46,0x00},
2281 { 47,0x00},
2282 { 48,0xFE},
2283 { 49,0x36},
2284 { 50,0x00},
2285 { 51,0x00},
2286 { 52,0xFA},
2287 { 53,0xAC},
2288 { 54,0x00},
2289 { 55,0x00},
2290 { 56,0xF2},
2291 { 57,0xA3},
2292 { 58,0x00},
2293 { 59,0x00},
2294 { 60,0x28},
2295 { 61,0xAB},
2296 { 62,0x00},
2297 { 63,0x00},
2298 { 64,0x3F},
2299 { 65,0xFF},
2300 { 66,0x00},
2301 { 67,0x00},
2302 { 68,0xFF},
2303 { 69,0x98},
2304 { 70,0x00},
2305 { 71,0x00},
2306 { 72,0xF6},
2307 { 73,0xF9},
2308 { 74,0x00},
2309 { 75,0x00},
2310 { 76,0x26},
2311 { 77,0xFB},
2312 { 78,0x00},
2313 { 79,0x00},
2314 { 80,0x02},
2315 { 81,0x72},
2316 { 82,0x00},
2317 { 83,0x00},
2318 { 84,0x40},
2319 { 85,0x02},
2320 { 86,0x00},
2321 { 87,0x00},
2322 { 88,0xFB},
2323 { 89,0xCB},
2324 { 90,0x00},
2325 { 91,0x00},
2326 { 92,0x20},
2327 { 93,0xA7},
2328 { 94,0x00},
2329 { 95,0x00},
2330 { 96,0xFF},
2331 { 97,0x6A},
2332 { 98,0x00},
2333 { 99,0x00},
2334 {100,0x3A},
2335 {101,0x0F},
2336 {102,0x00},
2337 {103,0x00},
2338 { 0,0x0},
2339 { 0x7F,0x3C},
2340 { 0,0x01},
2341 { 8,0xC0},
2342 { 9,0x00},
2343 { 10,0x00},
2344 { 11,0x00},
2345 { 12,0xC0},
2346 { 13,0x00},
2347 { 14,0x00},
2348 { 15,0x00},
2349 { 0,0x0},
2350 { 0x7F,0x78},
2351 { 0,0x01},
2352 { 8,0x04},
2353 { 9,0x00},
2354 { 10,0x00},
2355 { 11,0x00},
2356 { 12,0x04},
2357 { 13,0x00},
2358 { 14,0x20},
2359 { 15,0x01},
2360 { 16,0x58},
2361 { 17,0x60},
2362 { 18,0x08},
2363 { 19,0x01},
2364 { 20,0x60},
2365 { 21,0x60},
2366 { 22,0x00},
2367 { 23,0x00},
2368 { 24,0x58},
2369 { 25,0x60},
2370 { 26,0x00},
2371 { 27,0x2D},
2372 { 28,0x00},
2373 { 29,0x00},
2374 { 30,0x00},
2375 { 31,0x00},
2376 { 32,0x44},
2377 { 33,0x00},
2378 { 34,0xC0},
2379 { 35,0x16},
2380 { 36,0x08},
2381 { 37,0x00},
2382 { 38,0x00},
2383 { 39,0xBE},
2384 { 40,0x08},
2385 { 41,0x00},
2386 { 42,0x20},
2387 { 43,0xFE},
2388 { 44,0x08},
2389 { 45,0x00},
2390 { 46,0x00},
2391 { 47,0xBD},
2392 { 48,0x08},
2393 { 49,0x00},
2394 { 50,0x20},
2395 { 51,0xFD},
2396 { 52,0x08},
2397 { 53,0x00},
2398 { 54,0x00},
2399 { 55,0xBC},
2400 { 56,0x08},
2401 { 57,0x00},
2402 { 58,0x20},
2403 { 59,0xFC},
2404 { 60,0x08},
2405 { 61,0x00},
2406 { 62,0x00},
2407 { 63,0xBB},
2408 { 64,0x08},
2409 { 65,0x00},
2410 { 66,0x20},
2411 { 67,0xFB},
2412 { 68,0x08},
2413 { 69,0x00},
2414 { 70,0x00},
2415 { 71,0xBA},
2416 { 72,0x08},
2417 { 73,0x00},
2418 { 74,0x20},
2419 { 75,0xFA},
2420 { 76,0x08},
2421 { 77,0x00},
2422 { 78,0x00},
2423 { 79,0xB9},
2424 { 80,0x08},
2425 { 81,0x00},
2426 { 82,0x20},
2427 { 83,0xF9},
2428 { 84,0x08},
2429 { 85,0x00},
2430 { 86,0x00},
2431 { 87,0xB8},
2432 { 88,0x08},
2433 { 89,0x00},
2434 { 90,0x20},
2435 { 91,0xF8},
2436 { 92,0x08},
2437 { 93,0x00},
2438 { 94,0x00},
2439 { 95,0xB7},
2440 { 96,0x08},
2441 { 97,0x00},
2442 { 98,0x20},
2443 { 99,0xF7},
2444 {100,0x00},
2445 {101,0x00},
2446 {102,0x00},
2447 {103,0x00},
2448 {104,0x00},
2449 {105,0x00},
2450 {106,0x00},
2451 {107,0x00},
2452 {108,0x00},
2453 {109,0x00},
2454 {110,0x00},
2455 {111,0x00},
2456 {112,0x00},
2457 {113,0x00},
2458 {114,0x00},
2459 {115,0x00},
2460 {116,0x00},
2461 {117,0x00},
2462 {118,0x00},
2463 {119,0x00},
2464 {120,0x44},
2465 {121,0x00},
2466 {122,0x00},
2467 {123,0x06},
2468 {124,0x21},
2469 {125,0x00},
2470 {126,0x20},
2471 {127,0x00},
2472 { 0,0x02},
2473 { 8,0x4B},
2474 { 9,0x00},
2475 { 10,0xC0},
2476 { 11,0x00},
2477 { 12,0x4B},
2478 { 13,0x00},
2479 { 14,0xE0},
2480 { 15,0x00},
2481 { 16,0x00},
2482 { 17,0x00},
2483 { 18,0x40},
2484 { 19,0x48},
2485 { 20,0x0C},
2486 { 21,0x00},
2487 { 22,0x00},
2488 { 23,0x00},
2489 { 24,0x0C},
2490 { 25,0x00},
2491 { 26,0x20},
2492 { 27,0x00},
2493 { 28,0x18},
2494 { 29,0x01},
2495 { 30,0xA0},
2496 { 31,0x00},
2497 { 32,0x18},
2498 { 33,0x01},
2499 { 34,0xA0},
2500 { 35,0x01},
2501 { 36,0x00},
2502 { 37,0x00},
2503 { 38,0x00},
2504 { 39,0x00},
2505 { 40,0x00},
2506 { 41,0x00},
2507 { 42,0x00},
2508 { 43,0x00},
2509 { 44,0x10},
2510 { 45,0x13},
2511 { 46,0xE0},
2512 { 47,0x04},
2513 { 48,0x10},
2514 { 49,0x13},
2515 { 50,0xE0},
2516 { 51,0x05},
2517 { 52,0x18},
2518 { 53,0x01},
2519 { 54,0xA0},
2520 { 55,0x04},
2521 { 56,0x1C},
2522 { 57,0x01},
2523 { 58,0xA0},
2524 { 59,0x05},
2525 { 60,0x00},
2526 { 61,0x00},
2527 { 62,0x00},
2528 { 63,0x00},
2529 { 64,0x00},
2530 { 65,0x00},
2531 { 66,0x00},
2532 { 67,0x00},
2533 { 68,0x00},
2534 { 69,0x00},
2535 { 70,0x00},
2536 { 71,0x00},
2537 { 72,0x10},
2538 { 73,0x00},
2539 { 74,0x00},
2540 { 75,0x08},
2541 { 76,0x18},
2542 { 77,0x04},
2543 { 78,0x40},
2544 { 79,0x08},
2545 { 80,0x1C},
2546 { 81,0x04},
2547 { 82,0x40},
2548 { 83,0x09},
2549 { 84,0x1C},
2550 { 85,0x04},
2551 { 86,0x60},
2552 { 87,0x0B},
2553 { 88,0x00},
2554 { 89,0x00},
2555 { 90,0x00},
2556 { 91,0x00},
2557 { 92,0x00},
2558 { 93,0x00},
2559 { 94,0x00},
2560 { 95,0x00},
2561 { 96,0x00},
2562 { 97,0x00},
2563 { 98,0x00},
2564 { 99,0x00},
2565 {100,0x10},
2566 {101,0x00},
2567 {102,0x00},
2568 {103,0x0A},
2569 {104,0x18},
2570 {105,0x01},
2571 {106,0xA0},
2572 {107,0x04},
2573 {108,0x1C},
2574 {109,0x01},
2575 {110,0xC0},
2576 {111,0x0A},
2577 {112,0x18},
2578 {113,0x01},
2579 {114,0xA0},
2580 {115,0x05},
2581 {116,0x1C},
2582 {117,0x01},
2583 {118,0xC0},
2584 {119,0x0A},
2585 {120,0x00},
2586 {121,0x00},
2587 {122,0x00},
2588 {123,0x00},
2589 {124,0x10},
2590 {125,0x00},
2591 {126,0x00},
2592 {127,0x04},
2593 { 0,0x03},
2594 { 8,0x00},
2595 { 9,0x00},
2596 { 10,0x00},
2597 { 11,0x00},
2598 { 12,0x10},
2599 { 13,0x00},
2600 { 14,0x00},
2601 { 15,0x05},
2602 { 16,0x18},
2603 { 17,0x04},
2604 { 18,0x40},
2605 { 19,0x0A},
2606 { 20,0x1C},
2607 { 21,0x04},
2608 { 22,0x40},
2609 { 23,0x0B},
2610 { 24,0x1C},
2611 { 25,0x04},
2612 { 26,0x60},
2613 { 27,0x0D},
2614 { 28,0x00},
2615 { 29,0x00},
2616 { 30,0x00},
2617 { 31,0x00},
2618 { 32,0x00},
2619 { 33,0x00},
2620 { 34,0x00},
2621 { 35,0x00},
2622 { 36,0x00},
2623 { 37,0x00},
2624 { 38,0x00},
2625 { 39,0x00},
2626 { 40,0x10},
2627 { 41,0x00},
2628 { 42,0x00},
2629 { 43,0x0C},
2630 { 44,0x18},
2631 { 45,0x04},
2632 { 46,0x80},
2633 { 47,0x0C},
2634 { 48,0x1C},
2635 { 49,0x04},
2636 { 50,0xA0},
2637 { 51,0x0E},
2638 { 52,0x6C},
2639 { 53,0x04},
2640 { 54,0xC0},
2641 { 55,0x10},
2642 { 56,0x1C},
2643 { 57,0x04},
2644 { 58,0xE0},
2645 { 59,0x11},
2646 { 60,0x00},
2647 { 61,0x00},
2648 { 62,0x00},
2649 { 63,0x00},
2650 { 64,0x00},
2651 { 65,0x00},
2652 { 66,0x00},
2653 { 67,0x00},
2654 { 68,0x00},
2655 { 69,0x00},
2656 { 70,0x00},
2657 { 71,0x00},
2658 { 72,0x10},
2659 { 73,0x00},
2660 { 74,0x00},
2661 { 75,0x0F},
2662 { 76,0x18},
2663 { 77,0x05},
2664 { 78,0x20},
2665 { 79,0x0E},
2666 { 80,0x1C},
2667 { 81,0x05},
2668 { 82,0x00},
2669 { 83,0x0C},
2670 { 84,0x6C},
2671 { 85,0x05},
2672 { 86,0x40},
2673 { 87,0x13},
2674 { 88,0x1C},
2675 { 89,0x05},
2676 { 90,0x60},
2677 { 91,0x14},
2678 { 92,0x00},
2679 { 93,0x00},
2680 { 94,0x00},
2681 { 95,0x00},
2682 { 96,0x00},
2683 { 97,0x00},
2684 { 98,0x00},
2685 { 99,0x00},
2686 {100,0x00},
2687 {101,0x00},
2688 {102,0x00},
2689 {103,0x00},
2690 {104,0x10},
2691 {105,0x00},
2692 {106,0x00},
2693 {107,0x12},
2694 {108,0x18},
2695 {109,0x01},
2696 {110,0xC0},
2697 {111,0x0F},
2698 {112,0x1C},
2699 {113,0x01},
2700 {114,0xC0},
2701 {115,0x12},
2702 {116,0x00},
2703 {117,0x00},
2704 {118,0x00},
2705 {119,0x00},
2706 {120,0x00},
2707 {121,0x00},
2708 {122,0x00},
2709 {123,0x00},
2710 {124,0x00},
2711 {125,0x00},
2712 {126,0x00},
2713 {127,0x00},
2714 { 0,0x04},
2715 { 8,0x10},
2716 { 9,0x00},
2717 { 10,0x00},
2718 { 11,0x16},
2719 { 12,0x30},
2720 { 13,0x01},
2721 { 14,0xA0},
2722 { 15,0x16},
2723 { 16,0x58},
2724 { 17,0x60},
2725 { 18,0x00},
2726 { 19,0x0E},
2727 { 20,0x00},
2728 { 21,0x00},
2729 { 22,0x00},
2730 { 23,0x00},
2731 { 24,0x00},
2732 { 25,0x00},
2733 { 26,0x00},
2734 { 27,0x00},
2735 { 28,0x20},
2736 { 29,0x02},
2737 { 30,0xE0},
2738 { 31,0x00},
2739 { 32,0x10},
2740 { 33,0x00},
2741 { 34,0x00},
2742 { 35,0x18},
2743 { 36,0x58},
2744 { 37,0x60},
2745 { 38,0x00},
2746 { 39,0x17},
2747 { 40,0x40},
2748 { 41,0x02},
2749 { 42,0xC0},
2750 { 43,0x18},
2751 { 44,0x00},
2752 { 45,0x00},
2753 { 46,0x00},
2754 { 47,0x00},
2755 { 48,0x00},
2756 { 49,0x00},
2757 { 50,0x00},
2758 { 51,0x00},
2759 { 52,0x00},
2760 { 53,0x00},
2761 { 54,0x00},
2762 { 55,0x00},
2763 { 56,0x44},
2764 { 57,0x00},
2765 { 58,0x40},
2766 { 59,0x10},
2767 { 60,0x44},
2768 { 61,0x00},
2769 { 62,0x80},
2770 { 63,0x10},
2771 { 64,0x58},
2772 { 65,0x60},
2773 { 66,0x00},
2774 { 67,0x17},
2775 { 68,0x1C},
2776 { 69,0x02},
2777 { 70,0xC0},
2778 { 71,0x18},
2779 { 72,0x00},
2780 { 73,0x00},
2781 { 74,0x00},
2782 { 75,0x00},
2783 { 76,0x24},
2784 { 77,0x04},
2785 { 78,0x00},
2786 { 79,0x02},
2787 { 80,0x00},
2788 { 81,0x00},
2789 { 82,0x00},
2790 { 83,0x00},
2791 { 84,0x00},
2792 { 85,0x00},
2793 { 86,0x00},
2794 { 87,0x00},
2795 { 88,0x00},
2796 { 89,0x00},
2797 { 90,0x00},
2798 { 91,0x00},
2799 { 92,0x20},
2800 { 93,0x03},
2801 { 94,0x20},
2802 { 95,0x00},
2803 { 96,0x58},
2804 { 97,0x60},
2805 { 98,0x00},
2806 { 99,0x17},
2807 {100,0x1C},
2808 {101,0x03},
2809 {102,0x20},
2810 {103,0x18},
2811 {104,0x00},
2812 {105,0x00},
2813 {106,0x00},
2814 {107,0x00},
2815 {108,0x00},
2816 {109,0x00},
2817 {110,0x00},
2818 {111,0x00},
2819 {112,0x00},
2820 {113,0x00},
2821 {114,0x00},
2822 {115,0x00},
2823 {116,0x20},
2824 {117,0x02},
2825 {118,0xC0},
2826 {119,0x02},
2827 {120,0x44},
2828 {121,0x00},
2829 {122,0x00},
2830 {123,0x10},
2831 {124,0x00},
2832 {125,0x00},
2833 {126,0x00},
2834 {127,0x00},
2835 { 0,0x05},
2836 { 8,0x00},
2837 { 9,0x00},
2838 { 10,0x00},
2839 { 11,0x00},
2840 { 12,0x58},
2841 { 13,0x60},
2842 { 14,0x00},
2843 { 15,0x16},
2844 { 16,0x1C},
2845 { 17,0x02},
2846 { 18,0xE0},
2847 { 19,0x18},
2848 { 20,0x00},
2849 { 21,0x00},
2850 { 22,0x00},
2851 { 23,0x00},
2852 { 24,0x24},
2853 { 25,0x04},
2854 { 26,0x20},
2855 { 27,0x02},
2856 { 28,0x00},
2857 { 29,0x00},
2858 { 30,0x00},
2859 { 31,0x00},
2860 { 32,0x00},
2861 { 33,0x00},
2862 { 34,0x00},
2863 { 35,0x00},
2864 { 36,0x00},
2865 { 37,0x00},
2866 { 38,0x00},
2867 { 39,0x00},
2868 { 40,0x20},
2869 { 41,0x03},
2870 { 42,0x20},
2871 { 43,0x00},
2872 { 44,0x58},
2873 { 45,0x60},
2874 { 46,0x00},
2875 { 47,0x17},
2876 { 48,0x58},
2877 { 49,0x70},
2878 { 50,0x00},
2879 { 51,0x19},
2880 { 52,0x00},
2881 { 53,0x00},
2882 { 54,0x00},
2883 { 55,0x00},
2884 { 56,0x00},
2885 { 57,0x00},
2886 { 58,0x00},
2887 { 59,0x00},
2888 { 60,0x00},
2889 { 61,0x00},
2890 { 62,0x00},
2891 { 63,0x00},
2892 { 64,0x20},
2893 { 65,0x02},
2894 { 66,0xC0},
2895 { 67,0x02},
2896 { 68,0x58},
2897 { 69,0x60},
2898 { 70,0x00},
2899 { 71,0x15},
2900 { 72,0x00},
2901 { 73,0x00},
2902 { 74,0x00},
2903 { 75,0x00},
2904 { 76,0x24},
2905 { 77,0x02},
2906 { 78,0xC0},
2907 { 79,0x02},
2908 { 80,0x00},
2909 { 81,0x00},
2910 { 82,0x00},
2911 { 83,0x00},
2912 { 84,0x00},
2913 { 85,0x00},
2914 { 86,0x00},
2915 { 87,0x00},
2916 { 88,0x00},
2917 { 89,0x00},
2918 { 90,0x00},
2919 { 91,0x00},
2920 { 92,0x20},
2921 { 93,0x03},
2922 { 94,0x00},
2923 { 95,0x00},
2924 { 96,0x24},
2925 { 97,0x03},
2926 { 98,0x00},
2927 { 99,0x00},
2928 {100,0x00},
2929 {101,0x00},
2930 {102,0x00},
2931 {103,0x00},
2932 {104,0x00},
2933 {105,0x00},
2934 {106,0x00},
2935 {107,0x00},
2936 {108,0x00},
2937 {109,0x00},
2938 {110,0x00},
2939 {111,0x00},
2940 {112,0x20},
2941 {113,0x03},
2942 {114,0x00},
2943 {115,0x05},
2944 {116,0x58},
2945 {117,0x60},
2946 {118,0x00},
2947 {119,0x15},
2948 {120,0x00},
2949 {121,0x00},
2950 {122,0x00},
2951 {123,0x00},
2952 {124,0x24},
2953 {125,0x03},
2954 {126,0x00},
2955 {127,0x02},
2956 { 0,0x06},
2957 { 8,0x00},
2958 { 9,0x00},
2959 { 10,0x00},
2960 { 11,0x00},
2961 { 12,0x00},
2962 { 13,0x00},
2963 { 14,0x00},
2964 { 15,0x00},
2965 { 16,0x00},
2966 { 17,0x00},
2967 { 18,0x00},
2968 { 19,0x00},
2969 { 20,0x20},
2970 { 21,0x03},
2971 { 22,0x00},
2972 { 23,0x05},
2973 { 24,0x58},
2974 { 25,0x60},
2975 { 26,0x00},
2976 { 27,0x14},
2977 { 28,0x1C},
2978 { 29,0x03},
2979 { 30,0x00},
2980 { 31,0x18},
2981 { 32,0x00},
2982 { 33,0x00},
2983 { 34,0x00},
2984 { 35,0x00},
2985 { 36,0x24},
2986 { 37,0x02},
2987 { 38,0x60},
2988 { 39,0x00},
2989 { 40,0x58},
2990 { 41,0x70},
2991 { 42,0x00},
2992 { 43,0x15},
2993 { 44,0x00},
2994 { 45,0x00},
2995 { 46,0x00},
2996 { 47,0x00},
2997 { 48,0x00},
2998 { 49,0x00},
2999 { 50,0x00},
3000 { 51,0x00},
3001 { 52,0x00},
3002 { 53,0x00},
3003 { 54,0x00},
3004 { 55,0x00},
3005 { 56,0x20},
3006 { 57,0x02},
3007 { 58,0xA0},
3008 { 59,0x02},
3009 { 60,0x58},
3010 { 61,0x60},
3011 { 62,0x00},
3012 { 63,0x15},
3013 { 64,0x40},
3014 { 65,0x00},
3015 { 66,0xC0},
3016 { 67,0x18},
3017 { 68,0x58},
3018 { 69,0x60},
3019 { 70,0x00},
3020 { 71,0x06},
3021 { 72,0x00},
3022 { 73,0x00},
3023 { 74,0x00},
3024 { 75,0x00},
3025 { 76,0x00},
3026 { 77,0x00},
3027 { 78,0x00},
3028 { 79,0x00},
3029 { 80,0x44},
3030 { 81,0x00},
3031 { 82,0x80},
3032 { 83,0x02},
3033 { 84,0x20},
3034 { 85,0x02},
3035 { 86,0xA0},
3036 { 87,0x02},
3037 { 88,0x44},
3038 { 89,0x00},
3039 { 90,0x00},
3040 { 91,0x02},
3041 { 92,0x00},
3042 { 93,0x00},
3043 { 94,0x00},
3044 { 95,0x00},
3045 { 96,0x00},
3046 { 97,0x00},
3047 { 98,0x00},
3048 { 99,0x00},
3049 {100,0x18},
3050 {101,0x02},
3051 {102,0xA0},
3052 {103,0x16},
3053 {104,0x18},
3054 {105,0x01},
3055 {106,0xE0},
3056 {107,0x0C},
3057 {108,0x00},
3058 {109,0x00},
3059 {110,0x00},
3060 {111,0x00},
3061 {112,0x00},
3062 {113,0x00},
3063 {114,0x00},
3064 {115,0x00},
3065 {116,0x10},
3066 {117,0x00},
3067 {118,0xA0},
3068 {119,0x15},
3069 {120,0x10},
3070 {121,0x00},
3071 {122,0x00},
3072 {123,0x17},
3073 {124,0x18},
3074 {125,0x01},
3075 {126,0xA0},
3076 {127,0x15},
3077 { 0,0x07},
3078 { 8,0x1C},
3079 { 9,0x01},
3080 { 10,0xA0},
3081 { 11,0x17},
3082 { 12,0x00},
3083 { 13,0x00},
3084 { 14,0x00},
3085 { 15,0x00},
3086 { 16,0x24},
3087 { 17,0x00},
3088 { 18,0xA0},
3089 { 19,0x00},
3090 { 20,0x00},
3091 { 21,0x00},
3092 { 22,0x00},
3093 { 23,0x00},
3094 { 24,0x00},
3095 { 25,0x00},
3096 { 26,0x00},
3097 { 27,0x00},
3098 { 28,0x00},
3099 { 29,0x00},
3100 { 30,0x00},
3101 { 31,0x00},
3102 { 32,0x10},
3103 { 33,0x00},
3104 { 34,0x00},
3105 { 35,0x19},
3106 { 36,0x58},
3107 { 37,0x60},
3108 { 38,0x00},
3109 { 39,0x0A},
3110 { 40,0x59},
3111 { 41,0x00},
3112 { 42,0x00},
3113 { 43,0x1E},
3114 { 44,0x58},
3115 { 45,0x60},
3116 { 46,0x00},
3117 { 47,0x0A},
3118 { 48,0x59},
3119 { 49,0x00},
3120 { 50,0x00},
3121 { 51,0x1B},
3122 { 52,0x00},
3123 { 53,0x00},
3124 { 54,0x00},
3125 { 55,0x00},
3126 { 56,0x44},
3127 { 57,0x00},
3128 { 58,0x40},
3129 { 59,0x3A},
3130 { 60,0x00},
3131 { 61,0x00},
3132 { 62,0x00},
3133 { 63,0x00},
3134 { 64,0x44},
3135 { 65,0x00},
3136 { 66,0x40},
3137 { 67,0x68},
3138 { 68,0x18},
3139 { 69,0x02},
3140 { 70,0x00},
3141 { 71,0x04},
3142 { 72,0x1C},
3143 { 73,0x02},
3144 { 74,0x20},
3145 { 75,0x05},
3146 { 76,0x00},
3147 { 77,0x00},
3148 { 78,0x00},
3149 { 79,0x00},
3150 { 80,0x58},
3151 { 81,0x60},
3152 { 82,0x00},
3153 { 83,0x0A},
3154 { 84,0x00},
3155 { 85,0x00},
3156 { 86,0x00},
3157 { 87,0x00},
3158 { 88,0x10},
3159 { 89,0x00},
3160 { 90,0x20},
3161 { 91,0x1A},
3162 { 92,0x10},
3163 { 93,0x00},
3164 { 94,0x20},
3165 { 95,0x1B},
3166 { 96,0x59},
3167 { 97,0x00},
3168 { 98,0x00},
3169 { 99,0x1C},
3170 {100,0x00},
3171 {101,0x00},
3172 {102,0x00},
3173 {103,0x00},
3174 {104,0x00},
3175 {105,0x00},
3176 {106,0x00},
3177 {107,0x00},
3178 {108,0x00},
3179 {109,0x00},
3180 {110,0x00},
3181 {111,0x00},
3182 {112,0x44},
3183 {113,0x00},
3184 {114,0x40},
3185 {115,0x0A},
3186 {116,0x18},
3187 {117,0x05},
3188 {118,0xC0},
3189 {119,0x1B},
3190 {120,0x6C},
3191 {121,0x05},
3192 {122,0xE0},
3193 {123,0x1C},
3194 {124,0x1C},
3195 {125,0x06},
3196 {126,0x00},
3197 {127,0x1D},
3198 { 0,0x08},
3199 { 8,0x6C},
3200 { 9,0x06},
3201 { 10,0x20},
3202 { 11,0x1F},
3203 { 12,0x1C},
3204 { 13,0x06},
3205 { 14,0x40},
3206 { 15,0x20},
3207 { 16,0x00},
3208 { 17,0x00},
3209 { 18,0x00},
3210 { 19,0x00},
3211 { 20,0x00},
3212 { 21,0x00},
3213 { 22,0x00},
3214 { 23,0x00},
3215 { 24,0x00},
3216 { 25,0x00},
3217 { 26,0x00},
3218 { 27,0x00},
3219 { 28,0x10},
3220 { 29,0x00},
3221 { 30,0x20},
3222 { 31,0x1E},
3223 { 32,0x44},
3224 { 33,0x00},
3225 { 34,0x00},
3226 { 35,0x0A},
3227 { 36,0x18},
3228 { 37,0x06},
3229 { 38,0x60},
3230 { 39,0x1B},
3231 { 40,0x6C},
3232 { 41,0x06},
3233 { 42,0x80},
3234 { 43,0x1C},
3235 { 44,0x1C},
3236 { 45,0x06},
3237 { 46,0xA0},
3238 { 47,0x1D},
3239 { 48,0x6C},
3240 { 49,0x06},
3241 { 50,0xC0},
3242 { 51,0x1F},
3243 { 52,0x1C},
3244 { 53,0x06},
3245 { 54,0xE0},
3246 { 55,0x20},
3247 { 56,0x00},
3248 { 57,0x00},
3249 { 58,0x00},
3250 { 59,0x00},
3251 { 60,0x00},
3252 { 61,0x00},
3253 { 62,0x00},
3254 { 63,0x00},
3255 { 64,0x00},
3256 { 65,0x00},
3257 { 66,0x00},
3258 { 67,0x00},
3259 { 68,0x10},
3260 { 69,0x00},
3261 { 70,0x40},
3262 { 71,0x1E},
3263 { 72,0x00},
3264 { 73,0x00},
3265 { 74,0x00},
3266 { 75,0x00},
3267 { 76,0x18},
3268 { 77,0x02},
3269 { 78,0x00},
3270 { 79,0x1F},
3271 { 80,0x1C},
3272 { 81,0x07},
3273 { 82,0x00},
3274 { 83,0x1E},
3275 { 84,0x1C},
3276 { 85,0x07},
3277 { 86,0x20},
3278 { 87,0x22},
3279 { 88,0x18},
3280 { 89,0x02},
3281 { 90,0x00},
3282 { 91,0x04},
3283 { 92,0x1C},
3284 { 93,0x02},
3285 { 94,0x00},
3286 { 95,0x05},
3287 { 96,0x00},
3288 { 97,0x00},
3289 { 98,0x00},
3290 { 99,0x00},
3291 {100,0x10},
3292 {101,0x00},
3293 {102,0x20},
3294 {103,0x21},
3295 {104,0x00},
3296 {105,0x00},
3297 {106,0x00},
3298 {107,0x00},
3299 {108,0x10},
3300 {109,0x00},
3301 {110,0x20},
3302 {111,0x23},
3303 {112,0x18},
3304 {113,0x00},
3305 {114,0xE0},
3306 {115,0x21},
3307 {116,0x1C},
3308 {117,0x01},
3309 {118,0x00},
3310 {119,0x23},
3311 {120,0x00},
3312 {121,0x00},
3313 {122,0x00},
3314 {123,0x00},
3315 {124,0x18},
3316 {125,0x00},
3317 {126,0xE0},
3318 {127,0x21},
3319 { 0,0x09},
3320 { 8,0x00},
3321 { 9,0x00},
3322 { 10,0x00},
3323 { 11,0x00},
3324 { 12,0x10},
3325 { 13,0x00},
3326 { 14,0x00},
3327 { 15,0x47},
3328 { 16,0x24},
3329 { 17,0x01},
3330 { 18,0xC0},
3331 { 19,0x00},
3332 { 20,0x00},
3333 { 21,0x00},
3334 { 22,0x00},
3335 { 23,0x00},
3336 { 24,0x1C},
3337 { 25,0x01},
3338 { 26,0x00},
3339 { 27,0x23},
3340 { 28,0x00},
3341 { 29,0x00},
3342 { 30,0x00},
3343 { 31,0x00},
3344 { 32,0x00},
3345 { 33,0x00},
3346 { 34,0x00},
3347 { 35,0x00},
3348 { 36,0x00},
3349 { 37,0x00},
3350 { 38,0x00},
3351 { 39,0x00},
3352 { 40,0x10},
3353 { 41,0x00},
3354 { 42,0x00},
3355 { 43,0x4D},
3356 { 44,0x00},
3357 { 45,0x00},
3358 { 46,0x00},
3359 { 47,0x00},
3360 { 48,0x44},
3361 { 49,0x00},
3362 { 50,0x00},
3363 { 51,0x5E},
3364 { 52,0x18},
3365 { 53,0x02},
3366 { 54,0x00},
3367 { 55,0x04},
3368 { 56,0x18},
3369 { 57,0x02},
3370 { 58,0x00},
3371 { 59,0x05},
3372 { 60,0x00},
3373 { 61,0x00},
3374 { 62,0x00},
3375 { 63,0x00},
3376 { 64,0x00},
3377 { 65,0x00},
3378 { 66,0x00},
3379 { 67,0x00},
3380 { 68,0x10},
3381 { 69,0x00},
3382 { 70,0x20},
3383 { 71,0x24},
3384 { 72,0x10},
3385 { 73,0x00},
3386 { 74,0x20},
3387 { 75,0x2A},
3388 { 76,0x18},
3389 { 77,0x09},
3390 { 78,0x00},
3391 { 79,0x24},
3392 { 80,0x1C},
3393 { 81,0x01},
3394 { 82,0xA0},
3395 { 83,0x25},
3396 { 84,0x1C},
3397 { 85,0x09},
3398 { 86,0x20},
3399 { 87,0x27},
3400 { 88,0x00},
3401 { 89,0x00},
3402 { 90,0x00},
3403 { 91,0x00},
3404 { 92,0x18},
3405 { 93,0x01},
3406 { 94,0xA0},
3407 { 95,0x27},
3408 { 96,0x00},
3409 { 97,0x00},
3410 { 98,0x00},
3411 { 99,0x00},
3412 {100,0x4C},
3413 {101,0x09},
3414 {102,0x40},
3415 {103,0x26},
3416 {104,0x1C},
3417 {105,0x09},
3418 {106,0x60},
3419 {107,0x29},
3420 {108,0x18},
3421 {109,0x09},
3422 {110,0x80},
3423 {111,0x2A},
3424 {112,0x1C},
3425 {113,0x01},
3426 {114,0xA0},
3427 {115,0x2B},
3428 {116,0x00},
3429 {117,0x00},
3430 {118,0x00},
3431 {119,0x00},
3432 {120,0x10},
3433 {121,0x00},
3434 {122,0x00},
3435 {123,0x28},
3436 {124,0x1C},
3437 {125,0x09},
3438 {126,0xA0},
3439 {127,0x2D},
3440 { 0,0x0A},
3441 { 8,0x00},
3442 { 9,0x00},
3443 { 10,0x00},
3444 { 11,0x00},
3445 { 12,0x18},
3446 { 13,0x01},
3447 { 14,0x20},
3448 { 15,0x28},
3449 { 16,0x00},
3450 { 17,0x00},
3451 { 18,0x00},
3452 { 19,0x00},
3453 { 20,0x10},
3454 { 21,0x00},
3455 { 22,0x00},
3456 { 23,0x2C},
3457 { 24,0x18},
3458 { 25,0x01},
3459 { 26,0x20},
3460 { 27,0x2C},
3461 { 28,0x10},
3462 { 29,0x00},
3463 { 30,0x00},
3464 { 31,0x44},
3465 { 32,0x00},
3466 { 33,0x00},
3467 { 34,0x00},
3468 { 35,0x00},
3469 { 36,0x00},
3470 { 37,0x00},
3471 { 38,0x00},
3472 { 39,0x00},
3473 { 40,0x10},
3474 { 41,0x00},
3475 { 42,0x00},
3476 { 43,0x45},
3477 { 44,0x18},
3478 { 45,0x02},
3479 { 46,0x00},
3480 { 47,0x44},
3481 { 48,0x1C},
3482 { 49,0x02},
3483 { 50,0x20},
3484 { 51,0x45},
3485 { 52,0x00},
3486 { 53,0x00},
3487 { 54,0x00},
3488 { 55,0x00},
3489 { 56,0x24},
3490 { 57,0x00},
3491 { 58,0xE0},
3492 { 59,0x01},
3493 { 60,0x00},
3494 { 61,0x00},
3495 { 62,0x00},
3496 { 63,0x00},
3497 { 64,0x24},
3498 { 65,0x02},
3499 { 66,0x40},
3500 { 67,0x00},
3501 { 68,0x00},
3502 { 69,0x00},
3503 { 70,0x00},
3504 { 71,0x00},
3505 { 72,0x00},
3506 { 73,0x00},
3507 { 74,0x00},
3508 { 75,0x00},
3509 { 76,0x00},
3510 { 77,0x00},
3511 { 78,0x00},
3512 { 79,0x00},
3513 { 80,0x10},
3514 { 81,0x00},
3515 { 82,0x40},
3516 { 83,0x46},
3517 { 84,0x18},
3518 { 85,0x02},
3519 { 86,0x00},
3520 { 87,0x44},
3521 { 88,0x1C},
3522 { 89,0x02},
3523 { 90,0x00},
3524 { 91,0x46},
3525 { 92,0x18},
3526 { 93,0x02},
3527 { 94,0x00},
3528 { 95,0x45},
3529 { 96,0x1C},
3530 { 97,0x02},
3531 { 98,0x20},
3532 { 99,0x46},
3533 {100,0x00},
3534 {101,0x00},
3535 {102,0x00},
3536 {103,0x00},
3537 {104,0x10},
3538 {105,0x00},
3539 {106,0x20},
3540 {107,0x47},
3541 {108,0x00},
3542 {109,0x00},
3543 {110,0x00},
3544 {111,0x00},
3545 {112,0x10},
3546 {113,0x00},
3547 {114,0x20},
3548 {115,0x4D},
3549 {116,0x00},
3550 {117,0x00},
3551 {118,0x00},
3552 {119,0x00},
3553 {120,0x44},
3554 {121,0x00},
3555 {122,0x00},
3556 {123,0x2E},
3557 {124,0x18},
3558 {125,0x02},
3559 {126,0x00},
3560 {127,0x04},
3561 { 0,0x0B},
3562 { 8,0x1C},
3563 { 9,0x02},
3564 { 10,0x00},
3565 { 11,0x05},
3566 { 12,0x18},
3567 { 13,0x02},
3568 { 14,0x00},
3569 { 15,0x04},
3570 { 16,0x1C},
3571 { 17,0x02},
3572 { 18,0x20},
3573 { 19,0x05},
3574 { 20,0x00},
3575 { 21,0x00},
3576 { 22,0x00},
3577 { 23,0x00},
3578 { 24,0x10},
3579 { 25,0x00},
3580 { 26,0x20},
3581 { 27,0x2E},
3582 { 28,0x00},
3583 { 29,0x00},
3584 { 30,0x00},
3585 { 31,0x00},
3586 { 32,0x10},
3587 { 33,0x00},
3588 { 34,0x20},
3589 { 35,0x32},
3590 { 36,0x00},
3591 { 37,0x00},
3592 { 38,0x00},
3593 { 39,0x00},
3594 { 40,0x10},
3595 { 41,0x00},
3596 { 42,0x20},
3597 { 43,0x38},
3598 { 44,0x10},
3599 { 45,0x00},
3600 { 46,0x20},
3601 { 47,0x3E},
3602 { 48,0x18},
3603 { 49,0x07},
3604 { 50,0x40},
3605 { 51,0x2E},
3606 { 52,0x1C},
3607 { 53,0x01},
3608 { 54,0xC0},
3609 { 55,0x2F},
3610 { 56,0x1C},
3611 { 57,0x07},
3612 { 58,0x60},
3613 { 59,0x31},
3614 { 60,0x18},
3615 { 61,0x07},
3616 { 62,0x80},
3617 { 63,0x32},
3618 { 64,0x1C},
3619 { 65,0x07},
3620 { 66,0xA0},
3621 { 67,0x34},
3622 { 68,0x00},
3623 { 69,0x00},
3624 { 70,0x00},
3625 { 71,0x00},
3626 { 72,0x10},
3627 { 73,0x00},
3628 { 74,0x00},
3629 { 75,0x30},
3630 { 76,0x6C},
3631 { 77,0x07},
3632 { 78,0xC0},
3633 { 79,0x36},
3634 { 80,0x1C},
3635 { 81,0x07},
3636 { 82,0xE0},
3637 { 83,0x37},
3638 { 84,0x18},
3639 { 85,0x08},
3640 { 86,0x00},
3641 { 87,0x38},
3642 { 88,0x1C},
3643 { 89,0x08},
3644 { 90,0x20},
3645 { 91,0x3A},
3646 { 92,0x00},
3647 { 93,0x00},
3648 { 94,0x00},
3649 { 95,0x00},
3650 { 96,0x10},
3651 { 97,0x00},
3652 { 98,0x00},
3653 { 99,0x35},
3654 {100,0x6C},
3655 {101,0x08},
3656 {102,0x40},
3657 {103,0x3C},
3658 {104,0x1C},
3659 {105,0x08},
3660 {106,0x60},
3661 {107,0x3D},
3662 {108,0x18},
3663 {109,0x08},
3664 {110,0x80},
3665 {111,0x3E},
3666 {112,0x1C},
3667 {113,0x08},
3668 {114,0xA0},
3669 {115,0x40},
3670 {116,0x00},
3671 {117,0x00},
3672 {118,0x00},
3673 {119,0x00},
3674 {120,0x10},
3675 {121,0x00},
3676 {122,0x00},
3677 {123,0x3B},
3678 {124,0x6C},
3679 {125,0x08},
3680 {126,0xC0},
3681 {127,0x42},
3682 { 0,0x0C},
3683 { 8,0x1C},
3684 { 9,0x08},
3685 { 10,0xE0},
3686 { 11,0x43},
3687 { 12,0x18},
3688 { 13,0x02},
3689 { 14,0x00},
3690 { 15,0x35},
3691 { 16,0x1C},
3692 { 17,0x02},
3693 { 18,0x00},
3694 { 19,0x3B},
3695 { 20,0x00},
3696 { 21,0x00},
3697 { 22,0x00},
3698 { 23,0x00},
3699 { 24,0x10},
3700 { 25,0x00},
3701 { 26,0x00},
3702 { 27,0x41},
3703 { 28,0x1C},
3704 { 29,0x02},
3705 { 30,0x00},
3706 { 31,0x41},
3707 { 32,0x00},
3708 { 33,0x00},
3709 { 34,0x00},
3710 { 35,0x00},
3711 { 36,0x24},
3712 { 37,0x00},
3713 { 38,0xE0},
3714 { 39,0x00},
3715 { 40,0x00},
3716 { 41,0x00},
3717 { 42,0x00},
3718 { 43,0x00},
3719 { 44,0x1C},
3720 { 45,0x02},
3721 { 46,0x00},
3722 { 47,0x30},
3723 { 48,0x00},
3724 { 49,0x00},
3725 { 50,0x00},
3726 { 51,0x00},
3727 { 52,0x00},
3728 { 53,0x00},
3729 { 54,0x00},
3730 { 55,0x00},
3731 { 56,0x00},
3732 { 57,0x00},
3733 { 58,0x00},
3734 { 59,0x00},
3735 { 60,0x10},
3736 { 61,0x00},
3737 { 62,0x20},
3738 { 63,0x47},
3739 { 64,0x10},
3740 { 65,0x00},
3741 { 66,0x20},
3742 { 67,0x4D},
3743 { 68,0x18},
3744 { 69,0x02},
3745 { 70,0x00},
3746 { 71,0x47},
3747 { 72,0x18},
3748 { 73,0x02},
3749 { 74,0x00},
3750 { 75,0x4D},
3751 { 76,0x00},
3752 { 77,0x00},
3753 { 78,0x00},
3754 { 79,0x00},
3755 { 80,0x00},
3756 { 81,0x00},
3757 { 82,0x00},
3758 { 83,0x00},
3759 { 84,0x10},
3760 { 85,0x00},
3761 { 86,0x20},
3762 { 87,0x55},
3763 { 88,0x10},
3764 { 89,0x00},
3765 { 90,0x20},
3766 { 91,0x59},
3767 { 92,0x58},
3768 { 93,0x60},
3769 { 94,0x00},
3770 { 95,0x0A},
3771 { 96,0x59},
3772 { 97,0x00},
3773 { 98,0x00},
3774 { 99,0x1B},
3775 {100,0x00},
3776 {101,0x00},
3777 {102,0x00},
3778 {103,0x00},
3779 {104,0x00},
3780 {105,0x00},
3781 {106,0x00},
3782 {107,0x00},
3783 {108,0x00},
3784 {109,0x00},
3785 {110,0x00},
3786 {111,0x00},
3787 {112,0x44},
3788 {113,0x00},
3789 {114,0x40},
3790 {115,0x07},
3791 {116,0x18},
3792 {117,0x02},
3793 {118,0x00},
3794 {119,0x47},
3795 {120,0x1C},
3796 {121,0x02},
3797 {122,0x00},
3798 {123,0x19},
3799 {124,0x18},
3800 {125,0x02},
3801 {126,0x00},
3802 {127,0x4D},
3803 { 0,0x0D},
3804 { 8,0x1C},
3805 { 9,0x02},
3806 { 10,0x00},
3807 { 11,0x19},
3808 { 12,0x00},
3809 { 13,0x00},
3810 { 14,0x00},
3811 { 15,0x00},
3812 { 16,0x10},
3813 { 17,0x00},
3814 { 18,0x20},
3815 { 19,0x02},
3816 { 20,0x44},
3817 { 21,0x00},
3818 { 22,0x00},
3819 { 23,0x07},
3820 { 24,0x18},
3821 { 25,0x02},
3822 { 26,0x00},
3823 { 27,0x19},
3824 { 28,0x1C},
3825 { 29,0x02},
3826 { 30,0x20},
3827 { 31,0x47},
3828 { 32,0x18},
3829 { 33,0x02},
3830 { 34,0x00},
3831 { 35,0x19},
3832 { 36,0x1C},
3833 { 37,0x02},
3834 { 38,0x20},
3835 { 39,0x4D},
3836 { 40,0x00},
3837 { 41,0x00},
3838 { 42,0x00},
3839 { 43,0x00},
3840 { 44,0x10},
3841 { 45,0x00},
3842 { 46,0x20},
3843 { 47,0x02},
3844 { 48,0x00},
3845 { 49,0x00},
3846 { 50,0x00},
3847 { 51,0x00},
3848 { 52,0x10},
3849 { 53,0x00},
3850 { 54,0x20},
3851 { 55,0x03},
3852 { 56,0x18},
3853 { 57,0x09},
3854 { 58,0xC0},
3855 { 59,0x47},
3856 { 60,0x6C},
3857 { 61,0x09},
3858 { 62,0xE0},
3859 { 63,0x48},
3860 { 64,0x1C},
3861 { 65,0x09},
3862 { 66,0xC0},
3863 { 67,0x49},
3864 { 68,0x6C},
3865 { 69,0x0A},
3866 { 70,0x00},
3867 { 71,0x4B},
3868 { 72,0x1C},
3869 { 73,0x0A},
3870 { 74,0x20},
3871 { 75,0x4C},
3872 { 76,0x18},
3873 { 77,0x09},
3874 { 78,0xC0},
3875 { 79,0x4D},
3876 { 80,0x6C},
3877 { 81,0x09},
3878 { 82,0xE0},
3879 { 83,0x4E},
3880 { 84,0x00},
3881 { 85,0x00},
3882 { 86,0x00},
3883 { 87,0x00},
3884 { 88,0x10},
3885 { 89,0x00},
3886 { 90,0x00},
3887 { 91,0x4A},
3888 { 92,0x1C},
3889 { 93,0x09},
3890 { 94,0xC0},
3891 { 95,0x4F},
3892 { 96,0x6C},
3893 { 97,0x0A},
3894 { 98,0x00},
3895 { 99,0x51},
3896 {100,0x1C},
3897 {101,0x0A},
3898 {102,0x20},
3899 {103,0x52},
3900 {104,0x58},
3901 {105,0x60},
3902 {106,0x00},
3903 {107,0x0B},
3904 {108,0x00},
3905 {109,0x00},
3906 {110,0x00},
3907 {111,0x00},
3908 {112,0x00},
3909 {113,0x00},
3910 {114,0x00},
3911 {115,0x00},
3912 {116,0x10},
3913 {117,0x00},
3914 {118,0x00},
3915 {119,0x50},
3916 {120,0x20},
3917 {121,0x03},
3918 {122,0xE0},
3919 {123,0x02},
3920 {124,0x00},
3921 {125,0x00},
3922 {126,0x00},
3923 {127,0x00},
3924 { 0,0x0E},
3925 { 8,0x18},
3926 { 9,0x03},
3927 { 10,0xE0},
3928 { 11,0x4A},
3929 { 12,0x18},
3930 { 13,0x03},
3931 { 14,0xE0},
3932 { 15,0x50},
3933 { 16,0x00},
3934 { 17,0x00},
3935 { 18,0x00},
3936 { 19,0x00},
3937 { 20,0x00},
3938 { 21,0x00},
3939 { 22,0x00},
3940 { 23,0x00},
3941 { 24,0x10},
3942 { 25,0x00},
3943 { 26,0x40},
3944 { 27,0x53},
3945 { 28,0x10},
3946 { 29,0x00},
3947 { 30,0x40},
3948 { 31,0x54},
3949 { 32,0x18},
3950 { 33,0x02},
3951 { 34,0x00},
3952 { 35,0x02},
3953 { 36,0x1C},
3954 { 37,0x02},
3955 { 38,0x00},
3956 { 39,0x53},
3957 { 40,0x18},
3958 { 41,0x02},
3959 { 42,0x00},
3960 { 43,0x03},
3961 { 44,0x1C},
3962 { 45,0x02},
3963 { 46,0x00},
3964 { 47,0x54},
3965 { 48,0x00},
3966 { 49,0x00},
3967 { 50,0x00},
3968 { 51,0x00},
3969 { 52,0x10},
3970 { 53,0x00},
3971 { 54,0x20},
3972 { 55,0x02},
3973 { 56,0x00},
3974 { 57,0x00},
3975 { 58,0x00},
3976 { 59,0x00},
3977 { 60,0x10},
3978 { 61,0x00},
3979 { 62,0x20},
3980 { 63,0x03},
3981 { 64,0x18},
3982 { 65,0x0A},
3983 { 66,0x40},
3984 { 67,0x55},
3985 { 68,0x1C},
3986 { 69,0x0A},
3987 { 70,0x60},
3988 { 71,0x56},
3989 { 72,0x1C},
3990 { 73,0x0A},
3991 { 74,0x80},
3992 { 75,0x58},
3993 { 76,0x18},
3994 { 77,0x0A},
3995 { 78,0x40},
3996 { 79,0x59},
3997 { 80,0x1C},
3998 { 81,0x0A},
3999 { 82,0x60},
4000 { 83,0x5A},
4001 { 84,0x00},
4002 { 85,0x00},
4003 { 86,0x00},
4004 { 87,0x00},
4005 { 88,0x10},
4006 { 89,0x00},
4007 { 90,0x20},
4008 { 91,0x57},
4009 { 92,0x1C},
4010 { 93,0x0A},
4011 { 94,0x80},
4012 { 95,0x5C},
4013 { 96,0x00},
4014 { 97,0x00},
4015 { 98,0x00},
4016 { 99,0x00},
4017 {100,0x00},
4018 {101,0x00},
4019 {102,0x00},
4020 {103,0x00},
4021 {104,0x00},
4022 {105,0x00},
4023 {106,0x00},
4024 {107,0x00},
4025 {108,0x10},
4026 {109,0x00},
4027 {110,0x20},
4028 {111,0x5B},
4029 {112,0x18},
4030 {113,0x01},
4031 {114,0x80},
4032 {115,0x57},
4033 {116,0x18},
4034 {117,0x01},
4035 {118,0x80},
4036 {119,0x5B},
4037 {120,0x00},
4038 {121,0x00},
4039 {122,0x00},
4040 {123,0x00},
4041 {124,0x00},
4042 {125,0x00},
4043 {126,0x00},
4044 {127,0x00},
4045 { 0,0x0F},
4046 { 8,0x10},
4047 { 9,0x00},
4048 { 10,0x00},
4049 { 11,0x5D},
4050 { 12,0x10},
4051 { 13,0x00},
4052 { 14,0x00},
4053 { 15,0x5E},
4054 { 16,0x18},
4055 { 17,0x02},
4056 { 18,0x00},
4057 { 19,0x02},
4058 { 20,0x1C},
4059 { 21,0x02},
4060 { 22,0x00},
4061 { 23,0x5D},
4062 { 24,0x18},
4063 { 25,0x02},
4064 { 26,0x00},
4065 { 27,0x03},
4066 { 28,0x1C},
4067 { 29,0x02},
4068 { 30,0x00},
4069 { 31,0x5E},
4070 { 32,0x00},
4071 { 33,0x00},
4072 { 34,0x00},
4073 { 35,0x00},
4074 { 36,0x10},
4075 { 37,0x00},
4076 { 38,0x20},
4077 { 39,0x02},
4078 { 40,0x00},
4079 { 41,0x00},
4080 { 42,0x00},
4081 { 43,0x00},
4082 { 44,0x10},
4083 { 45,0x00},
4084 { 46,0x20},
4085 { 47,0x03},
4086 { 48,0x58},
4087 { 49,0x60},
4088 { 50,0x00},
4089 { 51,0x00},
4090 { 52,0x59},
4091 { 53,0x00},
4092 { 54,0x00},
4093 { 55,0x61},
4094 { 56,0x58},
4095 { 57,0x70},
4096 { 58,0x00},
4097 { 59,0x00},
4098 { 60,0x59},
4099 { 61,0x00},
4100 { 62,0x00},
4101 { 63,0x61},
4102 { 64,0x00},
4103 { 65,0x00},
4104 { 66,0x00},
4105 { 67,0x00},
4106 { 68,0x44},
4107 { 69,0x00},
4108 { 70,0x40},
4109 { 71,0x05},
4110 { 72,0x00},
4111 { 73,0x00},
4112 { 74,0x00},
4113 { 75,0x00},
4114 { 76,0x44},
4115 { 77,0x00},
4116 { 78,0x40},
4117 { 79,0x08},
4118 { 80,0x58},
4119 { 81,0x60},
4120 { 82,0x00},
4121 { 83,0x2D},
4122 { 84,0x00},
4123 { 85,0x00},
4124 { 86,0x00},
4125 { 87,0x00},
4126 { 88,0x44},
4127 { 89,0x00},
4128 { 90,0x00},
4129 { 91,0x08},
4130 { 92,0x00},
4131 { 93,0x00},
4132 { 94,0x00},
4133 { 95,0x00},
4134 { 96,0x00},
4135 { 97,0x00},
4136 { 98,0x00},
4137 { 99,0x00},
4138 {100,0x18},
4139 {101,0x03},
4140 {102,0x40},
4141 {103,0x00},
4142 {104,0x18},
4143 {105,0x03},
4144 {106,0x40},
4145 {107,0x01},
4146 {108,0x44},
4147 {109,0x00},
4148 {110,0x00},
4149 {111,0x03},
4150 {112,0x18},
4151 {113,0x03},
4152 {114,0x40},
4153 {115,0x02},
4154 {116,0x18},
4155 {117,0x03},
4156 {118,0x40},
4157 {119,0x03},
4158 {120,0x44},
4159 {121,0x00},
4160 {122,0x00},
4161 {123,0x00},
4162 {124,0x00},
4163 {125,0x00},
4164 {126,0x00},
4165 {127,0x00},
4166 { 0,0x10},
4167 { 8,0x10},
4168 { 9,0x00},
4169 { 10,0x20},
4170 { 11,0x5F},
4171 { 12,0x10},
4172 { 13,0x00},
4173 { 14,0x20},
4174 { 15,0x60},
4175 { 16,0x18},
4176 { 17,0x03},
4177 { 18,0x40},
4178 { 19,0x5F},
4179 { 20,0x18},
4180 { 21,0x0A},
4181 { 22,0xE0},
4182 { 23,0x63},
4183 { 24,0x6C},
4184 { 25,0x0A},
4185 { 26,0xC0},
4186 { 27,0x62},
4187 { 28,0x6C},
4188 { 29,0x0B},
4189 { 30,0x00},
4190 { 31,0x65},
4191 { 32,0x10},
4192 { 33,0x00},
4193 { 34,0x20},
4194 { 35,0x61},
4195 { 36,0x1C},
4196 { 37,0x0A},
4197 { 38,0xA0},
4198 { 39,0x61},
4199 { 40,0x1C},
4200 { 41,0x0B},
4201 { 42,0x20},
4202 { 43,0x66},
4203 { 44,0x00},
4204 { 45,0x00},
4205 { 46,0x00},
4206 { 47,0x00},
4207 { 48,0x00},
4208 { 49,0x00},
4209 { 50,0x00},
4210 { 51,0x00},
4211 { 52,0x00},
4212 { 53,0x00},
4213 { 54,0x00},
4214 { 55,0x00},
4215 { 56,0x10},
4216 { 57,0x00},
4217 { 58,0x00},
4218 { 59,0x64},
4219 { 60,0x18},
4220 { 61,0x03},
4221 { 62,0x40},
4222 { 63,0x60},
4223 { 64,0x18},
4224 { 65,0x0B},
4225 { 66,0x80},
4226 { 67,0x69},
4227 { 68,0x6C},
4228 { 69,0x0B},
4229 { 70,0x60},
4230 { 71,0x68},
4231 { 72,0x6C},
4232 { 73,0x0B},
4233 { 74,0xA0},
4234 { 75,0x6B},
4235 { 76,0x10},
4236 { 77,0x00},
4237 { 78,0x20},
4238 { 79,0x67},
4239 { 80,0x1C},
4240 { 81,0x0B},
4241 { 82,0x40},
4242 { 83,0x67},
4243 { 84,0x1C},
4244 { 85,0x0B},
4245 { 86,0xC0},
4246 { 87,0x6C},
4247 { 88,0x00},
4248 { 89,0x00},
4249 { 90,0x00},
4250 { 91,0x00},
4251 { 92,0x00},
4252 { 93,0x00},
4253 { 94,0x00},
4254 { 95,0x00},
4255 { 96,0x00},
4256 { 97,0x00},
4257 { 98,0x00},
4258 { 99,0x00},
4259 {100,0x10},
4260 {101,0x00},
4261 {102,0x00},
4262 {103,0x6A},
4263 {104,0x30},
4264 {105,0x0C},
4265 {106,0x40},
4266 {107,0x64},
4267 {108,0x1C},
4268 {109,0x0C},
4269 {110,0x60},
4270 {111,0x70},
4271 {112,0x30},
4272 {113,0x0C},
4273 {114,0x40},
4274 {115,0x6A},
4275 {116,0x1C},
4276 {117,0x0C},
4277 {118,0x60},
4278 {119,0x72},
4279 {120,0x00},
4280 {121,0x00},
4281 {122,0x00},
4282 {123,0x00},
4283 {124,0x10},
4284 {125,0x00},
4285 {126,0x00},
4286 {127,0x6F},
4287 { 0,0x11},
4288 { 8,0x40},
4289 { 9,0x00},
4290 { 10,0x20},
4291 { 11,0x6F},
4292 { 12,0x10},
4293 { 13,0x00},
4294 { 14,0x00},
4295 { 15,0x71},
4296 { 16,0x00},
4297 { 17,0x00},
4298 { 18,0x00},
4299 { 19,0x00},
4300 { 20,0x18},
4301 { 21,0x03},
4302 { 22,0x40},
4303 { 23,0x6F},
4304 { 24,0x44},
4305 { 25,0x00},
4306 { 26,0x80},
4307 { 27,0x02},
4308 { 28,0x18},
4309 { 29,0x03},
4310 { 30,0x40},
4311 { 31,0x71},
4312 { 32,0x44},
4313 { 33,0x00},
4314 { 34,0x00},
4315 { 35,0x02},
4316 { 36,0x00},
4317 { 37,0x00},
4318 { 38,0x00},
4319 { 39,0x00},
4320 { 40,0x00},
4321 { 41,0x00},
4322 { 42,0x00},
4323 { 43,0x00},
4324 { 44,0x59},
4325 { 45,0x00},
4326 { 46,0x00},
4327 { 47,0x71},
4328 { 48,0x59},
4329 { 49,0x00},
4330 { 50,0x00},
4331 { 51,0x72},
4332 { 52,0x00},
4333 { 53,0x00},
4334 { 54,0x00},
4335 { 55,0x00},
4336 { 56,0x00},
4337 { 57,0x00},
4338 { 58,0x00},
4339 { 59,0x00},
4340 { 60,0x44},
4341 { 61,0x00},
4342 { 62,0x60},
4343 { 63,0x0B},
4344 { 64,0x44},
4345 { 65,0x00},
4346 { 66,0x80},
4347 { 67,0x05},
4348 { 68,0x0C},
4349 { 69,0x00},
4350 { 70,0x80},
4351 { 71,0x03},
4352 { 72,0x58},
4353 { 73,0x60},
4354 { 74,0x00},
4355 { 75,0x2D},
4356 { 76,0x06},
4357 { 77,0x00},
4358 { 78,0x80},
4359 { 79,0x70},
4360 { 80,0x58},
4361 { 81,0x70},
4362 { 82,0x00},
4363 { 83,0x70},
4364 { 84,0x44},
4365 { 85,0x00},
4366 { 86,0x00},
4367 { 87,0x0B},
4368 { 88,0x0C},
4369 { 89,0x00},
4370 { 90,0x80},
4371 { 91,0x0D},
4372 { 92,0x58},
4373 { 93,0x60},
4374 { 94,0x00},
4375 { 95,0x73},
4376 { 96,0x06},
4377 { 97,0x00},
4378 { 98,0x80},
4379 { 99,0x70},
4380 {100,0x58},
4381 {101,0x70},
4382 {102,0x00},
4383 {103,0x70},
4384 {104,0x44},
4385 {105,0x00},
4386 {106,0x00},
4387 {107,0x06},
4388 {108,0x00},
4389 {109,0x00},
4390 {110,0x00},
4391 {111,0x00},
4392 {112,0x0C},
4393 {113,0x00},
4394 {114,0x80},
4395 {115,0x01},
4396 {116,0x58},
4397 {117,0x60},
4398 {118,0x00},
4399 {119,0x74},
4400 {120,0x06},
4401 {121,0x00},
4402 {122,0x80},
4403 {123,0x70},
4404 {124,0x58},
4405 {125,0x70},
4406 {126,0x00},
4407 {127,0x70},
4408 { 0,0x12},
4409 { 8,0x00},
4410 { 9,0x00},
4411 { 10,0x00},
4412 { 11,0x00},
4413 { 12,0x00},
4414 { 13,0x00},
4415 { 14,0x00},
4416 { 15,0x00},
4417 { 16,0x00},
4418 { 17,0x00},
4419 { 18,0x00},
4420 { 19,0x00},
4421 { 20,0x20},
4422 { 21,0x0E},
4423 { 22,0x00},
4424 { 23,0x01},
4425 { 24,0x58},
4426 { 25,0x60},
4427 { 26,0x00},
4428 { 27,0x70},
4429 { 28,0x59},
4430 { 29,0x00},
4431 { 30,0x00},
4432 { 31,0x67},
4433 { 32,0x59},
4434 { 33,0x00},
4435 { 34,0x00},
4436 { 35,0x68},
4437 { 36,0x58},
4438 { 37,0x70},
4439 { 38,0x00},
4440 { 39,0x68},
4441 { 40,0x00},
4442 { 41,0x00},
4443 { 42,0x00},
4444 { 43,0x00},
4445 { 44,0x44},
4446 { 45,0x00},
4447 { 46,0x80},
4448 { 47,0x0B},
4449 { 48,0x44},
4450 { 49,0x00},
4451 { 50,0x80},
4452 { 51,0x05},
4453 { 52,0x20},
4454 { 53,0x0E},
4455 { 54,0xA0},
4456 { 55,0x02},
4457 { 56,0x58},
4458 { 57,0x60},
4459 { 58,0x00},
4460 { 59,0x6A},
4461 { 60,0x58},
4462 { 61,0x60},
4463 { 62,0x00},
4464 { 63,0x66},
4465 { 64,0x58},
4466 { 65,0x60},
4467 { 66,0x00},
4468 { 67,0x2D},
4469 { 68,0x44},
4470 { 69,0x00},
4471 { 70,0x00},
4472 { 71,0x0B},
4473 { 72,0x20},
4474 { 73,0x0E},
4475 { 74,0xA0},
4476 { 75,0x02},
4477 { 76,0x58},
4478 { 77,0x60},
4479 { 78,0x00},
4480 { 79,0x6A},
4481 { 80,0x58},
4482 { 81,0x60},
4483 { 82,0x00},
4484 { 83,0x65},
4485 { 84,0x58},
4486 { 85,0x60},
4487 { 86,0x00},
4488 { 87,0x2D},
4489 { 88,0x44},
4490 { 89,0x00},
4491 { 90,0x00},
4492 { 91,0x06},
4493 { 92,0x58},
4494 { 93,0x60},
4495 { 94,0x00},
4496 { 95,0x70},
4497 { 96,0x58},
4498 { 97,0x70},
4499 { 98,0x00},
4500 { 99,0x67},
4501 {100,0x58},
4502 {101,0x60},
4503 {102,0x00},
4504 {103,0x69},
4505 {104,0x58},
4506 {105,0x60},
4507 {106,0x00},
4508 {107,0x64},
4509 {108,0x58},
4510 {109,0x60},
4511 {110,0x00},
4512 {111,0x2D},
4513 {112,0x20},
4514 {113,0x0E},
4515 {114,0xA0},
4516 {115,0x02},
4517 {116,0x4C},
4518 {117,0x0D},
4519 {118,0xE0},
4520 {119,0x76},
4521 {120,0x4C},
4522 {121,0x0E},
4523 {122,0xA0},
4524 {123,0x73},
4525 {124,0x59},
4526 {125,0x00},
4527 {126,0x00},
4528 {127,0x77},
4529 { 0,0x13},
4530 { 8,0x59},
4531 { 9,0x00},
4532 { 10,0x00},
4533 { 11,0x76},
4534 { 12,0x58},
4535 { 13,0x60},
4536 { 14,0x00},
4537 { 15,0x77},
4538 { 16,0x10},
4539 { 17,0x00},
4540 { 18,0xA0},
4541 { 19,0x75},
4542 { 20,0x44},
4543 { 21,0x00},
4544 { 22,0x60},
4545 { 23,0x05},
4546 { 24,0x44},
4547 { 25,0x00},
4548 { 26,0x80},
4549 { 27,0x06},
4550 { 28,0x00},
4551 { 29,0x00},
4552 { 30,0x00},
4553 { 31,0x00},
4554 { 32,0x00},
4555 { 33,0x00},
4556 { 34,0x00},
4557 { 35,0x00},
4558 { 36,0x00},
4559 { 37,0x00},
4560 { 38,0x00},
4561 { 39,0x00},
4562 { 40,0x44},
4563 { 41,0x00},
4564 { 42,0x00},
4565 { 43,0x06},
4566 { 44,0x58},
4567 { 45,0x60},
4568 { 46,0x00},
4569 { 47,0x76},
4570 { 48,0x44},
4571 { 49,0x00},
4572 { 50,0x00},
4573 { 51,0x01},
4574 { 52,0x00},
4575 { 53,0x00},
4576 { 54,0x00},
4577 { 55,0x00},
4578 { 56,0x00},
4579 { 57,0x00},
4580 { 58,0x00},
4581 { 59,0x00},
4582 { 60,0x00},
4583 { 61,0x00},
4584 { 62,0x00},
4585 { 63,0x00},
4586 { 64,0x10},
4587 { 65,0x00},
4588 { 66,0xA0},
4589 { 67,0x75},
4590 { 68,0x18},
4591 { 69,0x0F},
4592 { 70,0x00},
4593 { 71,0x75},
4594 { 72,0x64},
4595 { 73,0x00},
4596 { 74,0xC0},
4597 { 75,0x00},
4598 { 76,0x0C},
4599 { 77,0x07},
4600 { 78,0x40},
4601 { 79,0x02},
4602 { 80,0x64},
4603 { 81,0x30},
4604 { 82,0x20},
4605 { 83,0x79},
4606 { 84,0x00},
4607 { 85,0x00},
4608 { 86,0x00},
4609 { 87,0x00},
4610 { 88,0x00},
4611 { 89,0x00},
4612 { 90,0x00},
4613 { 91,0x00},
4614 { 92,0x58},
4615 { 93,0x60},
4616 { 94,0x00},
4617 { 95,0x7A},
4618 { 96,0x20},
4619 { 97,0x0F},
4620 { 98,0xC0},
4621 { 99,0x00},
4622 {100,0x58},
4623 {101,0x60},
4624 {102,0x00},
4625 {103,0x7B},
4626 {104,0x38},
4627 {105,0x0F},
4628 {106,0xC0},
4629 {107,0x76},
4630 {108,0x58},
4631 {109,0x60},
4632 {110,0x00},
4633 {111,0x7C},
4634 {112,0x38},
4635 {113,0x0F},
4636 {114,0xC0},
4637 {115,0x76},
4638 {116,0x58},
4639 {117,0x60},
4640 {118,0x00},
4641 {119,0x7D},
4642 {120,0x38},
4643 {121,0x0F},
4644 {122,0xC0},
4645 {123,0x76},
4646 {124,0x64},
4647 {125,0x03},
4648 {126,0x40},
4649 {127,0x00},
4650 { 0,0x14},
4651 { 8,0x64},
4652 { 9,0x20},
4653 { 10,0x60},
4654 { 11,0x00},
4655 { 12,0x00},
4656 { 13,0x00},
4657 { 14,0x00},
4658 { 15,0x00},
4659 { 16,0x00},
4660 { 17,0x00},
4661 { 18,0x00},
4662 { 19,0x00},
4663 { 20,0x00},
4664 { 21,0x00},
4665 { 22,0x00},
4666 { 23,0x00},
4667 { 24,0x10},
4668 { 25,0x00},
4669 { 26,0x00},
4670 { 27,0x76},
4671 { 28,0x18},
4672 { 29,0x03},
4673 { 30,0x40},
4674 { 31,0x73},
4675 { 32,0x18},
4676 { 33,0x03},
4677 { 34,0x40},
4678 { 35,0x76},
4679 { 36,0x58},
4680 { 37,0x60},
4681 { 38,0x00},
4682 { 39,0x1A},
4683 { 40,0x18},
4684 { 41,0x0C},
4685 { 42,0x00},
4686 { 43,0x7A},
4687 { 44,0x44},
4688 { 45,0x00},
4689 { 46,0xC0},
4690 { 47,0x03},
4691 { 48,0x10},
4692 { 49,0x00},
4693 { 50,0x20},
4694 { 51,0x78},
4695 { 52,0x10},
4696 { 53,0x13},
4697 { 54,0x60},
4698 { 55,0x77},
4699 { 56,0x44},
4700 { 57,0x00},
4701 { 58,0x00},
4702 { 59,0x03},
4703 { 60,0x10},
4704 { 61,0x00},
4705 { 62,0x20},
4706 { 63,0x77},
4707 { 64,0x10},
4708 { 65,0x13},
4709 { 66,0x60},
4710 { 67,0x78},
4711 { 68,0x00},
4712 { 69,0x00},
4713 { 70,0x00},
4714 { 71,0x00},
4715 { 72,0x40},
4716 { 73,0x03},
4717 { 74,0x40},
4718 { 75,0x77},
4719 { 76,0x18},
4720 { 77,0x0D},
4721 { 78,0x80},
4722 { 79,0x7A},
4723 { 80,0x1C},
4724 { 81,0x0D},
4725 { 82,0x60},
4726 { 83,0x77},
4727 { 84,0x18},
4728 { 85,0x0D},
4729 { 86,0xC0},
4730 { 87,0x7A},
4731 { 88,0x1C},
4732 { 89,0x0D},
4733 { 90,0xA0},
4734 { 91,0x77},
4735 { 92,0x44},
4736 { 93,0x00},
4737 { 94,0x60},
4738 { 95,0x03},
4739 { 96,0x10},
4740 { 97,0x00},
4741 { 98,0x00},
4742 { 99,0x79},
4743 {100,0x18},
4744 {101,0x0C},
4745 {102,0x00},
4746 {103,0x7C},
4747 {104,0x44},
4748 {105,0x00},
4749 {106,0x00},
4750 {107,0x03},
4751 {108,0x00},
4752 {109,0x00},
4753 {110,0x00},
4754 {111,0x00},
4755 {112,0x18},
4756 {113,0x0C},
4757 {114,0x00},
4758 {115,0x7C},
4759 {116,0x10},
4760 {117,0x00},
4761 {118,0x00},
4762 {119,0x79},
4763 {120,0x40},
4764 {121,0x03},
4765 {122,0x40},
4766 {123,0x78},
4767 {124,0x64},
4768 {125,0x50},
4769 {126,0x00},
4770 {127,0x79},
4771 { 0,0x15},
4772 { 8,0x00},
4773 { 9,0x00},
4774 { 10,0x00},
4775 { 11,0x00},
4776 { 12,0x00},
4777 { 13,0x00},
4778 { 14,0x00},
4779 { 15,0x00},
4780 { 16,0x44},
4781 { 17,0x00},
4782 { 18,0x60},
4783 { 19,0x03},
4784 { 20,0x18},
4785 { 21,0x0D},
4786 { 22,0xC0},
4787 { 23,0x7C},
4788 { 24,0x1C},
4789 { 25,0x0D},
4790 { 26,0xA0},
4791 { 27,0x78},
4792 { 28,0x44},
4793 { 29,0x00},
4794 { 30,0x00},
4795 { 31,0x03},
4796 { 32,0x18},
4797 { 33,0x0D},
4798 { 34,0x80},
4799 { 35,0x7C},
4800 { 36,0x1C},
4801 { 37,0x0D},
4802 { 38,0x60},
4803 { 39,0x78},
4804 { 40,0x00},
4805 { 41,0x00},
4806 { 42,0x00},
4807 { 43,0x00},
4808 { 44,0x00},
4809 { 45,0x00},
4810 { 46,0x00},
4811 { 47,0x00},
4812 { 48,0x00},
4813 { 49,0x00},
4814 { 50,0x00},
4815 { 51,0x00},
4816 { 52,0x10},
4817 { 53,0x00},
4818 { 54,0x00},
4819 { 55,0x7B},
4820 { 56,0x20},
4821 { 57,0x10},
4822 { 58,0x00},
4823 { 59,0x00},
4824 { 60,0x64},
4825 { 61,0x40},
4826 { 62,0x80},
4827 { 63,0x64},
4828 { 64,0x64},
4829 { 65,0x40},
4830 { 66,0x80},
4831 { 67,0x6A},
4832 { 68,0x24},
4833 { 69,0x10},
4834 { 70,0x00},
4835 { 71,0x08},
4836 { 72,0x24},
4837 { 73,0x10},
4838 { 74,0x00},
4839 { 75,0x08},
4840 { 76,0x00},
4841 { 77,0x00},
4842 { 78,0x00},
4843 { 79,0x00},
4844 { 80,0x00},
4845 { 81,0x00},
4846 { 82,0x00},
4847 { 83,0x00},
4848 { 84,0x10},
4849 { 85,0x01},
4850 { 86,0x00},
4851 { 87,0x6D},
4852 { 88,0x10},
4853 { 89,0x01},
4854 { 90,0x00},
4855 { 91,0x6E},
4856 { 92,0x58},
4857 { 93,0x60},
4858 { 94,0x00},
4859 { 95,0x00},
4860 { 96,0x59},
4861 { 97,0x00},
4862 { 98,0x00},
4863 { 99,0x5F},
4864 {100,0x58},
4865 {101,0x70},
4866 {102,0x00},
4867 {103,0x00},
4868 {104,0x59},
4869 {105,0x00},
4870 {106,0x00},
4871 {107,0x5F},
4872 {108,0x00},
4873 {109,0x00},
4874 {110,0x00},
4875 {111,0x00},
4876 {112,0x44},
4877 {113,0x00},
4878 {114,0x40},
4879 {115,0x05},
4880 {116,0x00},
4881 {117,0x00},
4882 {118,0x00},
4883 {119,0x00},
4884 {120,0x44},
4885 {121,0x00},
4886 {122,0x40},
4887 {123,0x08},
4888 {124,0x58},
4889 {125,0x60},
4890 {126,0x00},
4891 {127,0x2D},
4892 { 0,0x16},
4893 { 8,0x00},
4894 { 9,0x00},
4895 { 10,0x00},
4896 { 11,0x00},
4897 { 12,0x44},
4898 { 13,0x00},
4899 { 14,0x00},
4900 { 15,0x08},
4901 { 16,0x00},
4902 { 17,0x00},
4903 { 18,0x00},
4904 { 19,0x00},
4905 { 20,0x00},
4906 { 21,0x00},
4907 { 22,0x00},
4908 { 23,0x00},
4909 { 24,0x18},
4910 { 25,0x03},
4911 { 26,0x40},
4912 { 27,0x5F},
4913 { 28,0x18},
4914 { 29,0x03},
4915 { 30,0x40},
4916 { 31,0x60},
4917 { 32,0x44},
4918 { 33,0x00},
4919 { 34,0x00},
4920 { 35,0x03},
4921 { 36,0x18},
4922 { 37,0x03},
4923 { 38,0x40},
4924 { 39,0x6D},
4925 { 40,0x18},
4926 { 41,0x03},
4927 { 42,0x40},
4928 { 43,0x6E},
4929 { 44,0x44},
4930 { 45,0x00},
4931 { 46,0x00},
4932 { 47,0x00},
4933 { 48,0x00},
4934 { 49,0x00},
4935 { 50,0x00},
4936 { 51,0x00},
4937 { 52,0x10},
4938 { 53,0x00},
4939 { 54,0x20},
4940 { 55,0x7D},
4941 { 56,0x10},
4942 { 57,0x00},
4943 { 58,0x20},
4944 { 59,0x7E},
4945 { 60,0x18},
4946 { 61,0x03},
4947 { 62,0x40},
4948 { 63,0x7D},
4949 { 64,0x18},
4950 { 65,0x03},
4951 { 66,0x40},
4952 { 67,0x7E},
4953 { 68,0x18},
4954 { 69,0x00},
4955 { 70,0x60},
4956 { 71,0x82},
4957 { 72,0x1C},
4958 { 73,0x00},
4959 { 74,0x80},
4960 { 75,0x84},
4961 { 76,0x10},
4962 { 77,0x00},
4963 { 78,0x20},
4964 { 79,0x81},
4965 { 80,0x10},
4966 { 81,0x00},
4967 { 82,0x20},
4968 { 83,0xBF},
4969 { 84,0x1C},
4970 { 85,0x00},
4971 { 86,0x40},
4972 { 87,0x81},
4973 { 88,0x18},
4974 { 89,0x00},
4975 { 90,0x60},
4976 { 91,0xC0},
4977 { 92,0x1C},
4978 { 93,0x00},
4979 { 94,0x80},
4980 { 95,0xC4},
4981 { 96,0x1C},
4982 { 97,0x00},
4983 { 98,0x40},
4984 { 99,0xBF},
4985 {100,0x10},
4986 {101,0x30},
4987 {102,0x00},
4988 {103,0x83},
4989 {104,0x00},
4990 {105,0x00},
4991 {106,0x00},
4992 {107,0x00},
4993 {108,0x00},
4994 {109,0x00},
4995 {110,0x00},
4996 {111,0x00},
4997 {112,0x10},
4998 {113,0x30},
4999 {114,0x00},
5000 {115,0xC3},
5001 {116,0x18},
5002 {117,0x10},
5003 {118,0x20},
5004 {119,0xA8},
5005 {120,0x1C},
5006 {121,0x10},
5007 {122,0x40},
5008 {123,0x85},
5009 {124,0x1C},
5010 {125,0x10},
5011 {126,0x20},
5012 {127,0x83},
5013 { 0,0x17},
5014 { 8,0x1C},
5015 { 9,0x10},
5016 { 10,0x40},
5017 { 11,0xA6},
5018 { 12,0x1C},
5019 { 13,0x10},
5020 { 14,0x60},
5021 { 15,0x87},
5022 { 16,0x1C},
5023 { 17,0x10},
5024 { 18,0x60},
5025 { 19,0xA4},
5026 { 20,0x1C},
5027 { 21,0x10},
5028 { 22,0x80},
5029 { 23,0x89},
5030 { 24,0x1C},
5031 { 25,0x10},
5032 { 26,0x80},
5033 { 27,0xA2},
5034 { 28,0x1C},
5035 { 29,0x10},
5036 { 30,0xA0},
5037 { 31,0x8F},
5038 { 32,0x1C},
5039 { 33,0x10},
5040 { 34,0xA0},
5041 { 35,0x9C},
5042 { 36,0x1C},
5043 { 37,0x10},
5044 { 38,0xC0},
5045 { 39,0x8B},
5046 { 40,0x1C},
5047 { 41,0x10},
5048 { 42,0xC0},
5049 { 43,0xA0},
5050 { 44,0x1C},
5051 { 45,0x10},
5052 { 46,0xE0},
5053 { 47,0x8D},
5054 { 48,0x1C},
5055 { 49,0x10},
5056 { 50,0xE0},
5057 { 51,0x9E},
5058 { 52,0x1C},
5059 { 53,0x11},
5060 { 54,0x00},
5061 { 55,0x91},
5062 { 56,0x1C},
5063 { 57,0x11},
5064 { 58,0x00},
5065 { 59,0x9A},
5066 { 60,0x1C},
5067 { 61,0x11},
5068 { 62,0x20},
5069 { 63,0x93},
5070 { 64,0x1C},
5071 { 65,0x11},
5072 { 66,0x20},
5073 { 67,0x98},
5074 { 68,0x1C},
5075 { 69,0x11},
5076 { 70,0x40},
5077 { 71,0x84},
5078 { 72,0x1C},
5079 { 73,0x11},
5080 { 74,0x40},
5081 { 75,0xA7},
5082 { 76,0x1C},
5083 { 77,0x11},
5084 { 78,0x60},
5085 { 79,0x8C},
5086 { 80,0x1C},
5087 { 81,0x11},
5088 { 82,0x60},
5089 { 83,0x9F},
5090 { 84,0x1C},
5091 { 85,0x11},
5092 { 86,0x80},
5093 { 87,0x88},
5094 { 88,0x1C},
5095 { 89,0x11},
5096 { 90,0x80},
5097 { 91,0xA3},
5098 { 92,0x1C},
5099 { 93,0x11},
5100 { 94,0xA0},
5101 { 95,0x90},
5102 { 96,0x1C},
5103 { 97,0x11},
5104 { 98,0xA0},
5105 { 99,0x9B},
5106 {100,0x1C},
5107 {101,0x11},
5108 {102,0xC0},
5109 {103,0x8A},
5110 {104,0x1C},
5111 {105,0x11},
5112 {106,0xC0},
5113 {107,0xA1},
5114 {108,0x1C},
5115 {109,0x11},
5116 {110,0xE0},
5117 {111,0x86},
5118 {112,0x1C},
5119 {113,0x11},
5120 {114,0xE0},
5121 {115,0xA5},
5122 {116,0x1C},
5123 {117,0x12},
5124 {118,0x00},
5125 {119,0x8E},
5126 {120,0x1C},
5127 {121,0x12},
5128 {122,0x00},
5129 {123,0x9D},
5130 {124,0x1C},
5131 {125,0x12},
5132 {126,0x20},
5133 {127,0x92},
5134 { 0,0x18},
5135 { 8,0x1C},
5136 { 9,0x12},
5137 { 10,0x20},
5138 { 11,0x99},
5139 { 12,0x1C},
5140 { 13,0x12},
5141 { 14,0x40},
5142 { 15,0x94},
5143 { 16,0x1C},
5144 { 17,0x12},
5145 { 18,0x40},
5146 { 19,0x97},
5147 { 20,0x1C},
5148 { 21,0x12},
5149 { 22,0x60},
5150 { 23,0x95},
5151 { 24,0x1C},
5152 { 25,0x12},
5153 { 26,0x60},
5154 { 27,0x96},
5155 { 28,0x00},
5156 { 29,0x00},
5157 { 30,0x00},
5158 { 31,0x00},
5159 { 32,0x00},
5160 { 33,0x00},
5161 { 34,0x00},
5162 { 35,0x00},
5163 { 36,0x00},
5164 { 37,0x00},
5165 { 38,0x00},
5166 { 39,0x00},
5167 { 40,0x10},
5168 { 41,0x00},
5169 { 42,0x00},
5170 { 43,0xAD},
5171 { 44,0x18},
5172 { 45,0x10},
5173 { 46,0x20},
5174 { 47,0xE8},
5175 { 48,0x1C},
5176 { 49,0x10},
5177 { 50,0x40},
5178 { 51,0xC5},
5179 { 52,0x1C},
5180 { 53,0x10},
5181 { 54,0x20},
5182 { 55,0xC3},
5183 { 56,0x1C},
5184 { 57,0x10},
5185 { 58,0x40},
5186 { 59,0xE6},
5187 { 60,0x1C},
5188 { 61,0x10},
5189 { 62,0x60},
5190 { 63,0xC7},
5191 { 64,0x1C},
5192 { 65,0x10},
5193 { 66,0x60},
5194 { 67,0xE4},
5195 { 68,0x1C},
5196 { 69,0x10},
5197 { 70,0x80},
5198 { 71,0xC9},
5199 { 72,0x1C},
5200 { 73,0x10},
5201 { 74,0x80},
5202 { 75,0xE2},
5203 { 76,0x1C},
5204 { 77,0x10},
5205 { 78,0xA0},
5206 { 79,0xCF},
5207 { 80,0x1C},
5208 { 81,0x10},
5209 { 82,0xA0},
5210 { 83,0xDC},
5211 { 84,0x1C},
5212 { 85,0x10},
5213 { 86,0xC0},
5214 { 87,0xCB},
5215 { 88,0x1C},
5216 { 89,0x10},
5217 { 90,0xC0},
5218 { 91,0xE0},
5219 { 92,0x1C},
5220 { 93,0x10},
5221 { 94,0xE0},
5222 { 95,0xCD},
5223 { 96,0x1C},
5224 { 97,0x10},
5225 { 98,0xE0},
5226 { 99,0xDE},
5227 {100,0x1C},
5228 {101,0x11},
5229 {102,0x00},
5230 {103,0xD1},
5231 {104,0x1C},
5232 {105,0x11},
5233 {106,0x00},
5234 {107,0xDA},
5235 {108,0x1C},
5236 {109,0x11},
5237 {110,0x20},
5238 {111,0xD3},
5239 {112,0x1C},
5240 {113,0x11},
5241 {114,0x20},
5242 {115,0xD8},
5243 {116,0x1C},
5244 {117,0x11},
5245 {118,0x40},
5246 {119,0xC4},
5247 {120,0x1C},
5248 {121,0x11},
5249 {122,0x40},
5250 {123,0xE7},
5251 {124,0x1C},
5252 {125,0x11},
5253 {126,0x60},
5254 {127,0xCC},
5255 { 0,0x19},
5256 { 8,0x1C},
5257 { 9,0x11},
5258 { 10,0x60},
5259 { 11,0xDF},
5260 { 12,0x1C},
5261 { 13,0x11},
5262 { 14,0x80},
5263 { 15,0xC8},
5264 { 16,0x1C},
5265 { 17,0x11},
5266 { 18,0x80},
5267 { 19,0xE3},
5268 { 20,0x1C},
5269 { 21,0x11},
5270 { 22,0xA0},
5271 { 23,0xD0},
5272 { 24,0x1C},
5273 { 25,0x11},
5274 { 26,0xA0},
5275 { 27,0xDB},
5276 { 28,0x1C},
5277 { 29,0x11},
5278 { 30,0xC0},
5279 { 31,0xCA},
5280 { 32,0x1C},
5281 { 33,0x11},
5282 { 34,0xC0},
5283 { 35,0xE1},
5284 { 36,0x1C},
5285 { 37,0x11},
5286 { 38,0xE0},
5287 { 39,0xC6},
5288 { 40,0x1C},
5289 { 41,0x11},
5290 { 42,0xE0},
5291 { 43,0xE5},
5292 { 44,0x1C},
5293 { 45,0x12},
5294 { 46,0x00},
5295 { 47,0xCE},
5296 { 48,0x1C},
5297 { 49,0x12},
5298 { 50,0x00},
5299 { 51,0xDD},
5300 { 52,0x1C},
5301 { 53,0x12},
5302 { 54,0x20},
5303 { 55,0xD2},
5304 { 56,0x1C},
5305 { 57,0x12},
5306 { 58,0x20},
5307 { 59,0xD9},
5308 { 60,0x1C},
5309 { 61,0x12},
5310 { 62,0x40},
5311 { 63,0xD4},
5312 { 64,0x1C},
5313 { 65,0x12},
5314 { 66,0x40},
5315 { 67,0xD7},
5316 { 68,0x1C},
5317 { 69,0x12},
5318 { 70,0x60},
5319 { 71,0xD5},
5320 { 72,0x1C},
5321 { 73,0x12},
5322 { 74,0x60},
5323 { 75,0xD6},
5324 { 76,0x00},
5325 { 77,0x00},
5326 { 78,0x00},
5327 { 79,0x00},
5328 { 80,0x00},
5329 { 81,0x00},
5330 { 82,0x00},
5331 { 83,0x00},
5332 { 84,0x00},
5333 { 85,0x00},
5334 { 86,0x00},
5335 { 87,0x00},
5336 { 88,0x10},
5337 { 89,0x00},
5338 { 90,0x00},
5339 { 91,0xED},
5340 { 92,0x18},
5341 { 93,0x12},
5342 { 94,0xA0},
5343 { 95,0xEC},
5344 { 96,0x1C},
5345 { 97,0x12},
5346 { 98,0xC0},
5347 { 99,0xEE},
5348 {100,0x1C},
5349 {101,0x12},
5350 {102,0xC0},
5351 {103,0xEB},
5352 {104,0x1C},
5353 {105,0x12},
5354 {106,0xA0},
5355 {107,0xED},
5356 {108,0x1C},
5357 {109,0x12},
5358 {110,0xE0},
5359 {111,0xEA},
5360 {112,0x1C},
5361 {113,0x12},
5362 {114,0xE0},
5363 {115,0xEF},
5364 {116,0x1C},
5365 {117,0x13},
5366 {118,0x00},
5367 {119,0xE9},
5368 {120,0x1C},
5369 {121,0x13},
5370 {122,0x00},
5371 {123,0xF0},
5372 {124,0x18},
5373 {125,0x13},
5374 {126,0x60},
5375 {127,0xF1},
5376 { 0,0x1A},
5377 { 8,0x1C},
5378 { 9,0x13},
5379 { 10,0x60},
5380 { 11,0xF3},
5381 { 12,0x1C},
5382 { 13,0x13},
5383 { 14,0x40},
5384 { 15,0xF6},
5385 { 16,0x4C},
5386 { 17,0x13},
5387 { 18,0x40},
5388 { 19,0xF4},
5389 { 20,0x00},
5390 { 21,0x00},
5391 { 22,0x00},
5392 { 23,0x00},
5393 { 24,0x5C},
5394 { 25,0x90},
5395 { 26,0x60},
5396 { 27,0x03},
5397 { 28,0x18},
5398 { 29,0x12},
5399 { 30,0xA0},
5400 { 31,0xAC},
5401 { 32,0x1C},
5402 { 33,0x12},
5403 { 34,0xA0},
5404 { 35,0xAD},
5405 { 36,0x1C},
5406 { 37,0x12},
5407 { 38,0xC0},
5408 { 39,0xAE},
5409 { 40,0x10},
5410 { 41,0x00},
5411 { 42,0x40},
5412 { 43,0xFD},
5413 { 44,0x1C},
5414 { 45,0x12},
5415 { 46,0xC0},
5416 { 47,0xAB},
5417 { 48,0x1C},
5418 { 49,0x12},
5419 { 50,0xE0},
5420 { 51,0xAA},
5421 { 52,0x1C},
5422 { 53,0x12},
5423 { 54,0xE0},
5424 { 55,0xAF},
5425 { 56,0x1C},
5426 { 57,0x13},
5427 { 58,0x00},
5428 { 59,0xA9},
5429 { 60,0x1C},
5430 { 61,0x13},
5431 { 62,0x00},
5432 { 63,0xB0},
5433 { 64,0x18},
5434 { 65,0x13},
5435 { 66,0x60},
5436 { 67,0xB1},
5437 { 68,0x1C},
5438 { 69,0x13},
5439 { 70,0x60},
5440 { 71,0xB3},
5441 { 72,0x1C},
5442 { 73,0x13},
5443 { 74,0x40},
5444 { 75,0xB6},
5445 { 76,0x4C},
5446 { 77,0x13},
5447 { 78,0x40},
5448 { 79,0xB4},
5449 { 80,0x00},
5450 { 81,0x00},
5451 { 82,0x00},
5452 { 83,0x00},
5453 { 84,0x5C},
5454 { 85,0x90},
5455 { 86,0x40},
5456 { 87,0x03},
5457 { 88,0x00},
5458 { 89,0x00},
5459 { 90,0x00},
5460 { 91,0x00},
5461 { 92,0x00},
5462 { 93,0x00},
5463 { 94,0x00},
5464 { 95,0x00},
5465 { 96,0x00},
5466 { 97,0x00},
5467 { 98,0x00},
5468 { 99,0x00},
5469 {100,0x10},
5470 {101,0x00},
5471 {102,0x40},
5472 {103,0xBD},
5473 {104,0x18},
5474 {105,0x13},
5475 {106,0x80},
5476 {107,0xF4},
5477 {108,0x1C},
5478 {109,0x13},
5479 {110,0x80},
5480 {111,0xF3},
5481 {112,0x1C},
5482 {113,0x13},
5483 {114,0xA0},
5484 {115,0xF1},
5485 {116,0x00},
5486 {117,0x00},
5487 {118,0x00},
5488 {119,0x00},
5489 {120,0x5C},
5490 {121,0x90},
5491 {122,0x60},
5492 {123,0x03},
5493 {124,0x18},
5494 {125,0x13},
5495 {126,0x80},
5496 {127,0xB4},
5497 { 0,0x1B},
5498 { 8,0x1C},
5499 { 9,0x13},
5500 { 10,0x80},
5501 { 11,0xB3},
5502 { 12,0x1C},
5503 { 13,0x13},
5504 { 14,0xA0},
5505 { 15,0xB1},
5506 { 16,0x10},
5507 { 17,0x00},
5508 { 18,0x40},
5509 { 19,0xFC},
5510 { 20,0x18},
5511 { 21,0x13},
5512 { 22,0x20},
5513 { 23,0xEA},
5514 { 24,0x5C},
5515 { 25,0x90},
5516 { 26,0x40},
5517 { 27,0x03},
5518 { 28,0x18},
5519 { 29,0x13},
5520 { 30,0x40},
5521 { 31,0xF3},
5522 { 32,0x1C},
5523 { 33,0x13},
5524 { 34,0x60},
5525 { 35,0xF4},
5526 { 36,0x4C},
5527 { 37,0x13},
5528 { 38,0x40},
5529 { 39,0xF5},
5530 { 40,0x10},
5531 { 41,0x00},
5532 { 42,0x40},
5533 { 43,0xBC},
5534 { 44,0x1C},
5535 { 45,0x13},
5536 { 46,0x60},
5537 { 47,0xF1},
5538 { 48,0x18},
5539 { 49,0x13},
5540 { 50,0x20},
5541 { 51,0xAA},
5542 { 52,0x5C},
5543 { 53,0x90},
5544 { 54,0x60},
5545 { 55,0x03},
5546 { 56,0x18},
5547 { 57,0x13},
5548 { 58,0x40},
5549 { 59,0xB3},
5550 { 60,0x1C},
5551 { 61,0x13},
5552 { 62,0x60},
5553 { 63,0xB4},
5554 { 64,0x4C},
5555 { 65,0x13},
5556 { 66,0x40},
5557 { 67,0xB5},
5558 { 68,0x10},
5559 { 69,0x00},
5560 { 70,0x40},
5561 { 71,0xFB},
5562 { 72,0x1C},
5563 { 73,0x13},
5564 { 74,0x60},
5565 { 75,0xB1},
5566 { 76,0x00},
5567 { 77,0x00},
5568 { 78,0x00},
5569 { 79,0x00},
5570 { 80,0x5C},
5571 { 81,0x90},
5572 { 82,0x40},
5573 { 83,0x03},
5574 { 84,0x18},
5575 { 85,0x13},
5576 { 86,0x80},
5577 { 87,0xF5},
5578 { 88,0x1C},
5579 { 89,0x13},
5580 { 90,0x80},
5581 { 91,0xF1},
5582 { 92,0x1C},
5583 { 93,0x13},
5584 { 94,0xA0},
5585 { 95,0xF4},
5586 { 96,0x10},
5587 { 97,0x00},
5588 { 98,0x40},
5589 { 99,0xBB},
5590 {100,0x5C},
5591 {101,0x90},
5592 {102,0x60},
5593 {103,0x03},
5594 {104,0x00},
5595 {105,0x00},
5596 {106,0x00},
5597 {107,0x00},
5598 {108,0x00},
5599 {109,0x00},
5600 {110,0x00},
5601 {111,0x00},
5602 {112,0x00},
5603 {113,0x00},
5604 {114,0x00},
5605 {115,0x00},
5606 {116,0x10},
5607 {117,0x00},
5608 {118,0x40},
5609 {119,0xFA},
5610 {120,0x18},
5611 {121,0x13},
5612 {122,0x80},
5613 {123,0xB5},
5614 {124,0x1C},
5615 {125,0x13},
5616 {126,0x80},
5617 {127,0xB1},
5618 { 0,0x1C},
5619 { 8,0x1C},
5620 { 9,0x13},
5621 { 10,0xA0},
5622 { 11,0xB4},
5623 { 12,0x18},
5624 { 13,0x12},
5625 { 14,0x80},
5626 { 15,0xD5},
5627 { 16,0x5C},
5628 { 17,0x90},
5629 { 18,0x40},
5630 { 19,0x03},
5631 { 20,0x18},
5632 { 21,0x12},
5633 { 22,0xA0},
5634 { 23,0xF0},
5635 { 24,0x1C},
5636 { 25,0x12},
5637 { 26,0xC0},
5638 { 27,0xE9},
5639 { 28,0x4C},
5640 { 29,0x12},
5641 { 30,0xA0},
5642 { 31,0xE8},
5643 { 32,0x10},
5644 { 33,0x00},
5645 { 34,0x40},
5646 { 35,0xBA},
5647 { 36,0x1C},
5648 { 37,0x12},
5649 { 38,0xC0},
5650 { 39,0xEF},
5651 { 40,0x1C},
5652 { 41,0x12},
5653 { 42,0xE0},
5654 { 43,0xEE},
5655 { 44,0x1C},
5656 { 45,0x12},
5657 { 46,0xE0},
5658 { 47,0xEA},
5659 { 48,0x1C},
5660 { 49,0x13},
5661 { 50,0x00},
5662 { 51,0xED},
5663 { 52,0x1C},
5664 { 53,0x13},
5665 { 54,0x00},
5666 { 55,0xEB},
5667 { 56,0x18},
5668 { 57,0x13},
5669 { 58,0x60},
5670 { 59,0xF5},
5671 { 60,0x1C},
5672 { 61,0x13},
5673 { 62,0x60},
5674 { 63,0xF4},
5675 { 64,0x1C},
5676 { 65,0x13},
5677 { 66,0x40},
5678 { 67,0xF1},
5679 { 68,0x4C},
5680 { 69,0x13},
5681 { 70,0x40},
5682 { 71,0xF2},
5683 { 72,0x18},
5684 { 73,0x12},
5685 { 74,0x80},
5686 { 75,0x95},
5687 { 76,0x5C},
5688 { 77,0x90},
5689 { 78,0x60},
5690 { 79,0x03},
5691 { 80,0x18},
5692 { 81,0x12},
5693 { 82,0xA0},
5694 { 83,0xB0},
5695 { 84,0x1C},
5696 { 85,0x12},
5697 { 86,0xC0},
5698 { 87,0xA9},
5699 { 88,0x4C},
5700 { 89,0x12},
5701 { 90,0xA0},
5702 { 91,0xA8},
5703 { 92,0x10},
5704 { 93,0x00},
5705 { 94,0x40},
5706 { 95,0xF9},
5707 { 96,0x1C},
5708 { 97,0x12},
5709 { 98,0xC0},
5710 { 99,0xAF},
5711 {100,0x1C},
5712 {101,0x12},
5713 {102,0xE0},
5714 {103,0xAE},
5715 {104,0x1C},
5716 {105,0x12},
5717 {106,0xE0},
5718 {107,0xAA},
5719 {108,0x1C},
5720 {109,0x13},
5721 {110,0x00},
5722 {111,0xAD},
5723 {112,0x1C},
5724 {113,0x13},
5725 {114,0x00},
5726 {115,0xAB},
5727 {116,0x18},
5728 {117,0x13},
5729 {118,0x60},
5730 {119,0xB5},
5731 {120,0x1C},
5732 {121,0x13},
5733 {122,0x60},
5734 {123,0xB4},
5735 {124,0x1C},
5736 {125,0x13},
5737 {126,0x40},
5738 {127,0xB1},
5739 { 0,0x1D},
5740 { 8,0x4C},
5741 { 9,0x13},
5742 { 10,0x40},
5743 { 11,0xB2},
5744 { 12,0x00},
5745 { 13,0x00},
5746 { 14,0x00},
5747 { 15,0x00},
5748 { 16,0x5C},
5749 { 17,0x90},
5750 { 18,0x40},
5751 { 19,0x03},
5752 { 20,0x00},
5753 { 21,0x00},
5754 { 22,0x00},
5755 { 23,0x00},
5756 { 24,0x00},
5757 { 25,0x00},
5758 { 26,0x00},
5759 { 27,0x00},
5760 { 28,0x00},
5761 { 29,0x00},
5762 { 30,0x00},
5763 { 31,0x00},
5764 { 32,0x10},
5765 { 33,0x00},
5766 { 34,0x40},
5767 { 35,0xB8},
5768 { 36,0x18},
5769 { 37,0x13},
5770 { 38,0x80},
5771 { 39,0xF2},
5772 { 40,0x1C},
5773 { 41,0x13},
5774 { 42,0x80},
5775 { 43,0xF4},
5776 { 44,0x1C},
5777 { 45,0x13},
5778 { 46,0xA0},
5779 { 47,0xF5},
5780 { 48,0x10},
5781 { 49,0x00},
5782 { 50,0x40},
5783 { 51,0xB9},
5784 { 52,0x00},
5785 { 53,0x00},
5786 { 54,0x00},
5787 { 55,0x00},
5788 { 56,0x5C},
5789 { 57,0x90},
5790 { 58,0x60},
5791 { 59,0x03},
5792 { 60,0x18},
5793 { 61,0x13},
5794 { 62,0x80},
5795 { 63,0xB2},
5796 { 64,0x1C},
5797 { 65,0x13},
5798 { 66,0x80},
5799 { 67,0xB4},
5800 { 68,0x1C},
5801 { 69,0x13},
5802 { 70,0xA0},
5803 { 71,0xB5},
5804 { 72,0x10},
5805 { 73,0x00},
5806 { 74,0x40},
5807 { 75,0xF8},
5808 { 76,0x18},
5809 { 77,0x13},
5810 { 78,0x20},
5811 { 79,0xEE},
5812 { 80,0x5C},
5813 { 81,0x90},
5814 { 82,0x40},
5815 { 83,0x03},
5816 { 84,0x18},
5817 { 85,0x13},
5818 { 86,0x40},
5819 { 87,0xF4},
5820 { 88,0x1C},
5821 { 89,0x13},
5822 { 90,0x60},
5823 { 91,0xF2},
5824 { 92,0x4C},
5825 { 93,0x13},
5826 { 94,0x40},
5827 { 95,0xF0},
5828 { 96,0x10},
5829 { 97,0x00},
5830 { 98,0x40},
5831 { 99,0xB8},
5832 {100,0x1C},
5833 {101,0x13},
5834 {102,0x60},
5835 {103,0xF5},
5836 {104,0x18},
5837 {105,0x13},
5838 {106,0x20},
5839 {107,0xAE},
5840 {108,0x5C},
5841 {109,0x90},
5842 {110,0x60},
5843 {111,0x03},
5844 {112,0x18},
5845 {113,0x13},
5846 {114,0x40},
5847 {115,0xB4},
5848 {116,0x1C},
5849 {117,0x13},
5850 {118,0x60},
5851 {119,0xB2},
5852 {120,0x4C},
5853 {121,0x13},
5854 {122,0x40},
5855 {123,0xB0},
5856 {124,0x10},
5857 {125,0x00},
5858 {126,0x40},
5859 {127,0xF7},
5860 { 0,0x1E},
5861 { 8,0x1C},
5862 { 9,0x13},
5863 { 10,0x60},
5864 { 11,0xB5},
5865 { 12,0x00},
5866 { 13,0x00},
5867 { 14,0x00},
5868 { 15,0x00},
5869 { 16,0x5C},
5870 { 17,0x90},
5871 { 18,0x40},
5872 { 19,0x03},
5873 { 20,0x18},
5874 { 21,0x13},
5875 { 22,0x80},
5876 { 23,0xF0},
5877 { 24,0x1C},
5878 { 25,0x13},
5879 { 26,0x80},
5880 { 27,0xF5},
5881 { 28,0x1C},
5882 { 29,0x13},
5883 { 30,0xA0},
5884 { 31,0xF2},
5885 { 32,0x10},
5886 { 33,0x00},
5887 { 34,0x40},
5888 { 35,0xB7},
5889 { 36,0x00},
5890 { 37,0x00},
5891 { 38,0x00},
5892 { 39,0x00},
5893 { 40,0x5C},
5894 { 41,0x90},
5895 { 42,0x60},
5896 { 43,0x03},
5897 { 44,0x18},
5898 { 45,0x13},
5899 { 46,0x80},
5900 { 47,0xB0},
5901 { 48,0x1C},
5902 { 49,0x13},
5903 { 50,0x80},
5904 { 51,0xB5},
5905 { 52,0x1C},
5906 { 53,0x13},
5907 { 54,0xA0},
5908 { 55,0xB2},
5909 { 56,0x10},
5910 { 57,0x00},
5911 { 58,0x40},
5912 { 59,0xF6},
5913 { 60,0x5C},
5914 { 61,0x90},
5915 { 62,0x40},
5916 { 63,0x03},
5917 { 64,0x00},
5918 { 65,0x00},
5919 { 66,0x00},
5920 { 67,0x00},
5921 { 68,0x00},
5922 { 69,0x00},
5923 { 70,0x00},
5924 { 71,0x00},
5925 { 72,0x00},
5926 { 73,0x00},
5927 { 74,0x00},
5928 { 75,0x00},
5929 { 76,0x10},
5930 { 77,0x00},
5931 { 78,0x40},
5932 { 79,0xB6},
5933 { 80,0x00},
5934 { 81,0x00},
5935 { 82,0x00},
5936 { 83,0x00},
5937 { 84,0x00},
5938 { 85,0x00},
5939 { 86,0x00},
5940 { 87,0x00},
5941 { 88,0x00},
5942 { 89,0x00},
5943 { 90,0x00},
5944 { 91,0x00},
5945 { 92,0x02},
5946 { 93,0x00},
5947 { 94,0x00},
5948 { 95,0x00},
5949 { 96,0x00},
5950 { 97,0x00},
5951 { 98,0x00},
5952 { 99,0x00},
5953};
5954
5955#define main44_miniDSP_D_reg_values_COEFF_START 0
5956#define main44_miniDSP_D_reg_values_COEFF_SIZE 672
5957#define main44_miniDSP_D_reg_values_INST_START 672
5958#define main44_miniDSP_D_reg_values_INST_SIZE 2124
5959
diff --git a/sound/soc/codecs/rt5639.c b/sound/soc/codecs/rt5639.c
new file mode 100644
index 00000000000..139503e0d32
--- /dev/null
+++ b/sound/soc/codecs/rt5639.c
@@ -0,0 +1,2444 @@
1/*
2 * rt5639.c -- RT5639 ALSA SoC audio codec driver
3 *
4 * Copyright 2011 Realtek Semiconductor Corp.
5 * Author: Johnny Hsu <johnnyhsu@realtek.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#include <linux/module.h>
13#include <linux/moduleparam.h>
14#include <linux/init.h>
15#include <linux/delay.h>
16#include <linux/pm.h>
17#include <linux/i2c.h>
18#include <linux/platform_device.h>
19#include <linux/spi/spi.h>
20#include <sound/core.h>
21#include <sound/pcm.h>
22#include <sound/pcm_params.h>
23#include <sound/soc.h>
24#include <sound/soc-dapm.h>
25#include <sound/initval.h>
26#include <sound/tlv.h>
27
28#include "rt5639.h"
29
30#define RT5639_DEMO 1
31#define RT5639_REG_RW 1
32#define RT5639_DET_EXT_MIC 0
33
34#ifdef RT5639_DEMO
35struct rt5639_init_reg {
36 u8 reg;
37 u16 val;
38};
39
40static struct rt5639_init_reg init_list[] = {
41 {RT5639_DUMMY1 , 0x3701},//fa[12:13] = 1'b;fa[8~10]=1;fa[0]=1
42 {RT5639_DEPOP_M1 , 0x0019},//8e[4:3] = 11'b; 8e[0] = 1'b
43 {RT5639_DEPOP_M2 , 0x3100},//8f[13] = 1'b
44 {RT5639_ADDA_CLK1 , 0x1114},//73[2] = 1'b
45 {RT5639_MICBIAS , 0x3030},//93[5:4] = 11'b
46 {RT5639_PRIV_INDEX , 0x003d},//PR3d[12] = 1'b
47 {RT5639_PRIV_DATA , 0x3600},
48 {RT5639_CLS_D_OUT , 0xa000},//8d[11] = 0'b
49 {RT5639_PRIV_INDEX , 0x001c},//PR1c = 0D21'h
50 {RT5639_PRIV_DATA , 0x0D21},
51
52 {RT5639_PRIV_INDEX , 0x001b},//PR1B = 0D21'h
53 {RT5639_PRIV_DATA , 0x0000},
54 {RT5639_PRIV_INDEX , 0x0012},//PR12 = 0aa8'h
55 {RT5639_PRIV_DATA , 0x0aa8},
56 {RT5639_PRIV_INDEX , 0x0014},//PR14 = 0aaa'h
57 {RT5639_PRIV_DATA , 0x0aaa},
58 {RT5639_PRIV_INDEX , 0x0020},//PR20 = 6110'h
59 {RT5639_PRIV_DATA , 0x6110},
60 {RT5639_PRIV_INDEX , 0x0021},//PR21 = e0e0'h
61 {RT5639_PRIV_DATA , 0xe0e0},
62 {RT5639_PRIV_INDEX , 0x0023},//PR23 = 1804'h
63 {RT5639_PRIV_DATA , 0x1804},
64 /*playback*/
65 {RT5639_STO_DAC_MIXER , 0x1414},//Dig inf 1 -> Sto DAC mixer -> DACL
66 {RT5639_OUT_L3_MIXER , 0x01fe},//DACL1 -> OUTMIXL
67 {RT5639_OUT_R3_MIXER , 0x01fe},//DACR1 -> OUTMIXR
68 {RT5639_HP_VOL , 0x8888},//OUTMIX -> HPVOL
69 {RT5639_HPO_MIXER , 0xc000},//HPVOL -> HPOLMIX
70// {RT5639_HPO_MIXER , 0xa000},//DAC1 -> HPOLMIX
71 {RT5639_SPK_L_MIXER , 0x0036},//DACL1 -> SPKMIXL
72 {RT5639_SPK_R_MIXER , 0x0036},//DACR1 -> SPKMIXR
73 {RT5639_SPK_VOL , 0x8888},//SPKMIX -> SPKVOL
74 {RT5639_SPO_L_MIXER , 0xe800},//SPKVOLL -> SPOLMIX
75 {RT5639_SPO_R_MIXER , 0x2800},//SPKVOLR -> SPORMIX
76// {RT5639_SPO_L_MIXER , 0xb800},//DAC -> SPOLMIX
77// {RT5639_SPO_R_MIXER , 0x1800},//DAC -> SPORMIX
78// {RT5639_I2S1_SDP , 0xD000},//change IIS1 and IIS2
79 /*record*/
80 {RT5639_IN1_IN2 , 0x5080},//IN1 boost 40db and differential mode
81 {RT5639_IN3_IN4 , 0x0500},//IN2 boost 40db and signal ended mode
82 {RT5639_REC_L2_MIXER , 0x007d},//Mic1 -> RECMIXL
83 {RT5639_REC_R2_MIXER , 0x007d},//Mic1 -> RECMIXR
84// {RT5639_REC_L2_MIXER , 0x006f},//Mic2 -> RECMIXL
85// {RT5639_REC_R2_MIXER , 0x006f},//Mic2 -> RECMIXR
86 {RT5639_STO_ADC_MIXER , 0x3020},//ADC -> Sto ADC mixer
87
88#if RT5639_DET_EXT_MIC
89 {RT5639_MICBIAS ,0x3800},//enable MICBIAS short current
90 {RT5639_GPIO_CTRL1 ,0x8400},//set GPIO1 to IRQ
91 {RT5639_GPIO_CTRL3 ,0x0004},//set GPIO1 output
92 {RT5639_IRQ_CTRL2 ,0x8000},//set MICBIAS short current to IRQ ( if sticky set regBE : 8800 )
93#endif
94};
95#define RT5639_INIT_REG_LEN ARRAY_SIZE(init_list)
96
97static int rt5639_reg_init(struct snd_soc_codec *codec)
98{
99 int i;
100
101 for (i = 0; i < RT5639_INIT_REG_LEN; i++)
102 snd_soc_write(codec, init_list[i].reg, init_list[i].val);
103
104 return 0;
105}
106#endif
107
108static const u16 rt5639_reg[RT5639_VENDOR_ID2 + 1] = {
109 [RT5639_RESET] = 0x0008,
110 [RT5639_SPK_VOL] = 0xc8c8,
111 [RT5639_HP_VOL] = 0xc8c8,
112 [RT5639_OUTPUT] = 0xc8c8,
113 [RT5639_MONO_OUT] = 0x8000,
114 [RT5639_INL_INR_VOL] = 0x0808,
115 [RT5639_DAC1_DIG_VOL] = 0xafaf,
116 [RT5639_DAC2_DIG_VOL] = 0xafaf,
117 [RT5639_ADC_DIG_VOL] = 0x2f2f,
118 [RT5639_ADC_DATA] = 0x2f2f,
119 [RT5639_STO_ADC_MIXER] = 0x7060,
120 [RT5639_MONO_ADC_MIXER] = 0x7070,
121 [RT5639_AD_DA_MIXER] = 0x8080,
122 [RT5639_STO_DAC_MIXER] = 0x5454,
123 [RT5639_MONO_DAC_MIXER] = 0x5454,
124 [RT5639_DIG_MIXER] = 0xaa00,
125 [RT5639_DSP_PATH2] = 0xa000,
126 [RT5639_REC_L2_MIXER] = 0x007f,
127 [RT5639_REC_R2_MIXER] = 0x007f,
128 [RT5639_HPO_MIXER] = 0xe000,
129 [RT5639_SPK_L_MIXER] = 0x003e,
130 [RT5639_SPK_R_MIXER] = 0x003e,
131 [RT5639_SPO_L_MIXER] = 0xf800,
132 [RT5639_SPO_R_MIXER] = 0x3800,
133 [RT5639_SPO_CLSD_RATIO] = 0x0004,
134 [RT5639_MONO_MIXER] = 0xfc00,
135 [RT5639_OUT_L3_MIXER] = 0x01ff,
136 [RT5639_OUT_R3_MIXER] = 0x01ff,
137 [RT5639_LOUT_MIXER] = 0xf000,
138 [RT5639_PWR_ANLG1] = 0x00c0,
139 [RT5639_I2S1_SDP] = 0x8000,
140 [RT5639_I2S2_SDP] = 0x8000,
141 [RT5639_I2S3_SDP] = 0x8000,
142 [RT5639_ADDA_CLK1] = 0x1110,
143 [RT5639_ADDA_CLK2] = 0x0c00,
144 [RT5639_DMIC] = 0x1d00,
145 [RT5639_ASRC_3] = 0x0008,
146 [RT5639_HP_OVCD] = 0x0600,
147 [RT5639_CLS_D_OVCD] = 0x0228,
148 [RT5639_CLS_D_OUT] = 0xa800,
149 [RT5639_DEPOP_M1] = 0x0004,
150 [RT5639_DEPOP_M2] = 0x1100,
151 [RT5639_DEPOP_M3] = 0x0646,
152 [RT5639_CHARGE_PUMP] = 0x0c00,
153 [RT5639_MICBIAS] = 0x3000,
154 [RT5639_EQ_CTRL1] = 0x2080,
155 [RT5639_DRC_AGC_1] = 0x2206,
156 [RT5639_DRC_AGC_2] = 0x1f00,
157 [RT5639_ANC_CTRL1] = 0x034b,
158 [RT5639_ANC_CTRL2] = 0x0066,
159 [RT5639_ANC_CTRL3] = 0x000b,
160 [RT5639_GPIO_CTRL1] = 0x0400,
161 [RT5639_DSP_CTRL3] = 0x2000,
162 [RT5639_BASE_BACK] = 0x0013,
163 [RT5639_MP3_PLUS1] = 0x0680,
164 [RT5639_MP3_PLUS2] = 0x1c17,
165 [RT5639_3D_HP] = 0x8c00,
166 [RT5639_ADJ_HPF] = 0x2a20,
167 [RT5639_HP_CALIB_AMP_DET] = 0x0400,
168 [RT5639_SV_ZCD1] = 0x0809,
169 [RT5639_VENDOR_ID1] = 0x10ec,
170 [RT5639_VENDOR_ID2] = 0x6231,
171};
172
173static int rt5639_reset(struct snd_soc_codec *codec)
174{
175 return snd_soc_write(codec, RT5639_RESET, 0);
176}
177
178/**
179 * rt5639_index_write - Write private register.
180 * @codec: SoC audio codec device.
181 * @reg: Private register index.
182 * @value: Private register Data.
183 *
184 * Modify private register for advanced setting. It can be written through
185 * private index (0x6a) and data (0x6c) register.
186 *
187 * Returns 0 for success or negative error code.
188 */
189static int rt5639_index_write(struct snd_soc_codec *codec,
190 unsigned int reg, unsigned int value)
191{
192 int ret;
193
194 ret = snd_soc_write(codec, RT5639_PRIV_INDEX, reg);
195 if (ret < 0) {
196 dev_err(codec->dev, "Failed to set private addr: %d\n", ret);
197 goto err;
198 }
199 ret = snd_soc_write(codec, RT5639_PRIV_DATA, value);
200 if (ret < 0) {
201 dev_err(codec->dev, "Failed to set private value: %d\n", ret);
202 goto err;
203 }
204 return 0;
205
206err:
207 return ret;
208}
209
210/**
211 * rt5639_index_read - Read private register.
212 * @codec: SoC audio codec device.
213 * @reg: Private register index.
214 *
215 * Read advanced setting from private register. It can be read through
216 * private index (0x6a) and data (0x6c) register.
217 *
218 * Returns private register value or negative error code.
219 */
220static unsigned int rt5639_index_read(
221 struct snd_soc_codec *codec, unsigned int reg)
222{
223 int ret;
224
225 ret = snd_soc_write(codec, RT5639_PRIV_INDEX, reg);
226 if (ret < 0) {
227 dev_err(codec->dev, "Failed to set private addr: %d\n", ret);
228 return ret;
229 }
230 return snd_soc_read(codec, RT5639_PRIV_DATA);
231}
232
233/**
234 * rt5639_index_update_bits - update private register bits
235 * @codec: audio codec
236 * @reg: Private register index.
237 * @mask: register mask
238 * @value: new value
239 *
240 * Writes new register value.
241 *
242 * Returns 1 for change, 0 for no change, or negative error code.
243 */
244static int rt5639_index_update_bits(struct snd_soc_codec *codec,
245 unsigned int reg, unsigned int mask, unsigned int value)
246{
247 unsigned int old, new;
248 int change, ret;
249
250 ret = rt5639_index_read(codec, reg);
251 if (ret < 0) {
252 dev_err(codec->dev, "Failed to read private reg: %d\n", ret);
253 goto err;
254 }
255
256 old = ret;
257 new = (old & ~mask) | (value & mask);
258 change = old != new;
259 if (change) {
260 ret = rt5639_index_write(codec, reg, new);
261 if (ret < 0) {
262 dev_err(codec->dev,
263 "Failed to write private reg: %d\n", ret);
264 goto err;
265 }
266 }
267 return change;
268
269err:
270 return ret;
271}
272
273static int rt5639_volatile_register(
274 struct snd_soc_codec *codec, unsigned int reg)
275{
276 switch (reg) {
277 case RT5639_RESET:
278 case RT5639_PRIV_DATA:
279 case RT5639_ASRC_5:
280 case RT5639_EQ_CTRL1:
281 case RT5639_DRC_AGC_1:
282 case RT5639_ANC_CTRL1:
283 case RT5639_IRQ_CTRL2:
284 case RT5639_INT_IRQ_ST:
285 case RT5639_DSP_CTRL2:
286 case RT5639_DSP_CTRL3:
287 case RT5639_PGM_REG_ARR1:
288 case RT5639_PGM_REG_ARR3:
289 return 1;
290 default:
291 return 0;
292 }
293}
294
295static int rt5639_readable_register(
296 struct snd_soc_codec *codec, unsigned int reg)
297{
298 switch (reg) {
299 case RT5639_RESET:
300 case RT5639_SPK_VOL:
301 case RT5639_HP_VOL:
302 case RT5639_OUTPUT:
303 case RT5639_MONO_OUT:
304 case RT5639_IN1_IN2:
305 case RT5639_IN3_IN4:
306 case RT5639_INL_INR_VOL:
307 case RT5639_DAC1_DIG_VOL:
308 case RT5639_DAC2_DIG_VOL:
309 case RT5639_DAC2_CTRL:
310 case RT5639_ADC_DIG_VOL:
311 case RT5639_ADC_DATA:
312 case RT5639_ADC_BST_VOL:
313 case RT5639_STO_ADC_MIXER:
314 case RT5639_MONO_ADC_MIXER:
315 case RT5639_AD_DA_MIXER:
316 case RT5639_STO_DAC_MIXER:
317 case RT5639_MONO_DAC_MIXER:
318 case RT5639_DIG_MIXER:
319 case RT5639_DSP_PATH1:
320 case RT5639_DSP_PATH2:
321 case RT5639_DIG_INF_DATA:
322 case RT5639_REC_L1_MIXER:
323 case RT5639_REC_L2_MIXER:
324 case RT5639_REC_R1_MIXER:
325 case RT5639_REC_R2_MIXER:
326 case RT5639_HPO_MIXER:
327 case RT5639_SPK_L_MIXER:
328 case RT5639_SPK_R_MIXER:
329 case RT5639_SPO_L_MIXER:
330 case RT5639_SPO_R_MIXER:
331 case RT5639_SPO_CLSD_RATIO:
332 case RT5639_MONO_MIXER:
333 case RT5639_OUT_L1_MIXER:
334 case RT5639_OUT_L2_MIXER:
335 case RT5639_OUT_L3_MIXER:
336 case RT5639_OUT_R1_MIXER:
337 case RT5639_OUT_R2_MIXER:
338 case RT5639_OUT_R3_MIXER:
339 case RT5639_LOUT_MIXER:
340 case RT5639_PWR_DIG1:
341 case RT5639_PWR_DIG2:
342 case RT5639_PWR_ANLG1:
343 case RT5639_PWR_ANLG2:
344 case RT5639_PWR_MIXER:
345 case RT5639_PWR_VOL:
346 case RT5639_PRIV_INDEX:
347 case RT5639_PRIV_DATA:
348 case RT5639_I2S1_SDP:
349 case RT5639_I2S2_SDP:
350 case RT5639_I2S3_SDP:
351 case RT5639_ADDA_CLK1:
352 case RT5639_ADDA_CLK2:
353 case RT5639_DMIC:
354 case RT5639_GLB_CLK:
355 case RT5639_PLL_CTRL1:
356 case RT5639_PLL_CTRL2:
357 case RT5639_ASRC_1:
358 case RT5639_ASRC_2:
359 case RT5639_ASRC_3:
360 case RT5639_ASRC_4:
361 case RT5639_ASRC_5:
362 case RT5639_HP_OVCD:
363 case RT5639_CLS_D_OVCD:
364 case RT5639_CLS_D_OUT:
365 case RT5639_DEPOP_M1:
366 case RT5639_DEPOP_M2:
367 case RT5639_DEPOP_M3:
368 case RT5639_CHARGE_PUMP:
369 case RT5639_PV_DET_SPK_G:
370 case RT5639_MICBIAS:
371 case RT5639_EQ_CTRL1:
372 case RT5639_EQ_CTRL2:
373 case RT5639_WIND_FILTER:
374 case RT5639_DRC_AGC_1:
375 case RT5639_DRC_AGC_2:
376 case RT5639_DRC_AGC_3:
377 case RT5639_SVOL_ZC:
378 case RT5639_ANC_CTRL1:
379 case RT5639_ANC_CTRL2:
380 case RT5639_ANC_CTRL3:
381 case RT5639_JD_CTRL:
382 case RT5639_ANC_JD:
383 case RT5639_IRQ_CTRL1:
384 case RT5639_IRQ_CTRL2:
385 case RT5639_INT_IRQ_ST:
386 case RT5639_GPIO_CTRL1:
387 case RT5639_GPIO_CTRL2:
388 case RT5639_GPIO_CTRL3:
389 case RT5639_DSP_CTRL1:
390 case RT5639_DSP_CTRL2:
391 case RT5639_DSP_CTRL3:
392 case RT5639_DSP_CTRL4:
393 case RT5639_PGM_REG_ARR1:
394 case RT5639_PGM_REG_ARR2:
395 case RT5639_PGM_REG_ARR3:
396 case RT5639_PGM_REG_ARR4:
397 case RT5639_PGM_REG_ARR5:
398 case RT5639_SCB_FUNC:
399 case RT5639_SCB_CTRL:
400 case RT5639_BASE_BACK:
401 case RT5639_MP3_PLUS1:
402 case RT5639_MP3_PLUS2:
403 case RT5639_3D_HP:
404 case RT5639_ADJ_HPF:
405 case RT5639_HP_CALIB_AMP_DET:
406 case RT5639_HP_CALIB2:
407 case RT5639_SV_ZCD1:
408 case RT5639_SV_ZCD2:
409 case RT5639_DUMMY1:
410 case RT5639_DUMMY2:
411 case RT5639_DUMMY3:
412 case RT5639_VENDOR_ID:
413 case RT5639_VENDOR_ID1:
414 case RT5639_VENDOR_ID2:
415 return 1;
416 default:
417 return 0;
418 }
419}
420
421int rt5639_headset_detect(struct snd_soc_codec *codec, int jack_insert)
422{
423 int jack_type;
424
425 if (jack_insert) {
426 snd_soc_update_bits(codec, RT5639_PWR_ANLG1,
427 RT5639_PWR_LDO2, RT5639_PWR_LDO2);
428 snd_soc_update_bits(codec, RT5639_PWR_ANLG2,
429 RT5639_PWR_MB1, RT5639_PWR_MB1);
430 snd_soc_update_bits(codec, RT5639_MICBIAS,
431 RT5639_MIC1_OVCD_MASK | RT5639_MIC1_OVTH_MASK |
432 RT5639_PWR_CLK25M_MASK | RT5639_PWR_MB_MASK,
433 RT5639_MIC1_OVCD_EN | RT5639_MIC1_OVTH_600UA |
434 RT5639_PWR_MB_PU | RT5639_PWR_CLK25M_PU);
435 snd_soc_update_bits(codec, RT5639_DUMMY1,
436 0x1, 0x1);
437 msleep(50);
438 if (snd_soc_read(codec, RT5639_IRQ_CTRL2) & 0x8)
439 jack_type = RT5639_HEADPHO_DET;
440 else
441 jack_type = RT5639_HEADSET_DET;
442 snd_soc_update_bits(codec, RT5639_IRQ_CTRL2,
443 RT5639_MB1_OC_CLR, 0);
444 } else {
445 snd_soc_update_bits(codec, RT5639_MICBIAS,
446 RT5639_MIC1_OVCD_MASK,
447 RT5639_MIC1_OVCD_DIS);
448
449 jack_type = RT5639_NO_JACK;
450 }
451
452 return jack_type;
453}
454EXPORT_SYMBOL(rt5639_headset_detect);
455
456static const DECLARE_TLV_DB_SCALE(out_vol_tlv, -4650, 150, 0);
457static const DECLARE_TLV_DB_SCALE(dac_vol_tlv, -65625, 375, 0);
458static const DECLARE_TLV_DB_SCALE(in_vol_tlv, -3450, 150, 0);
459static const DECLARE_TLV_DB_SCALE(adc_vol_tlv, -17625, 375, 0);
460static const DECLARE_TLV_DB_SCALE(adc_bst_tlv, 0, 1200, 0);
461
462/* {0, +20, +24, +30, +35, +40, +44, +50, +52} dB */
463static unsigned int bst_tlv[] = {
464 TLV_DB_RANGE_HEAD(7),
465 0, 0, TLV_DB_SCALE_ITEM(0, 0, 0),
466 1, 1, TLV_DB_SCALE_ITEM(2000, 0, 0),
467 2, 2, TLV_DB_SCALE_ITEM(2400, 0, 0),
468 3, 5, TLV_DB_SCALE_ITEM(3000, 500, 0),
469 6, 6, TLV_DB_SCALE_ITEM(4400, 0, 0),
470 7, 7, TLV_DB_SCALE_ITEM(5000, 0, 0),
471 8, 8, TLV_DB_SCALE_ITEM(5200, 0, 0),
472};
473
474static int rt5639_dmic_get(struct snd_kcontrol *kcontrol,
475 struct snd_ctl_elem_value *ucontrol)
476{
477 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
478 struct rt5639_priv *rt5639 = snd_soc_codec_get_drvdata(codec);
479
480 ucontrol->value.integer.value[0] = rt5639->dmic_en;
481
482 return 0;
483}
484
485static int rt5639_dmic_put(struct snd_kcontrol *kcontrol,
486 struct snd_ctl_elem_value *ucontrol)
487{
488 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
489 struct rt5639_priv *rt5639 = snd_soc_codec_get_drvdata(codec);
490
491 if (rt5639->dmic_en == ucontrol->value.integer.value[0])
492 return 0;
493
494 rt5639->dmic_en = ucontrol->value.integer.value[0];
495 switch (rt5639->dmic_en) {
496 case RT5639_DMIC_DIS:
497 snd_soc_update_bits(codec, RT5639_GPIO_CTRL1,
498 RT5639_GP2_PIN_MASK | RT5639_GP3_PIN_MASK |
499 RT5639_GP4_PIN_MASK,
500 RT5639_GP2_PIN_GPIO2 | RT5639_GP3_PIN_GPIO3 |
501 RT5639_GP4_PIN_GPIO4);
502 snd_soc_update_bits(codec, RT5639_DMIC,
503 RT5639_DMIC_1_DP_MASK | RT5639_DMIC_2_DP_MASK,
504 RT5639_DMIC_1_DP_GPIO3 | RT5639_DMIC_2_DP_GPIO4);
505 snd_soc_update_bits(codec, RT5639_DMIC,
506 RT5639_DMIC_1_EN_MASK | RT5639_DMIC_2_EN_MASK,
507 RT5639_DMIC_1_DIS | RT5639_DMIC_2_DIS);
508 break;
509
510 case RT5639_DMIC1:
511 snd_soc_update_bits(codec, RT5639_GPIO_CTRL1,
512 RT5639_GP2_PIN_MASK | RT5639_GP3_PIN_MASK,
513 RT5639_GP2_PIN_DMIC1_SCL | RT5639_GP3_PIN_DMIC1_SDA);
514 snd_soc_update_bits(codec, RT5639_DMIC,
515 RT5639_DMIC_1L_LH_MASK | RT5639_DMIC_1R_LH_MASK |
516 RT5639_DMIC_1_DP_MASK,
517 RT5639_DMIC_1L_LH_FALLING | RT5639_DMIC_1R_LH_RISING |
518 RT5639_DMIC_1_DP_IN1P);
519 snd_soc_update_bits(codec, RT5639_DMIC,
520 RT5639_DMIC_1_EN_MASK, RT5639_DMIC_1_EN);
521 break;
522
523 case RT5639_DMIC2:
524 snd_soc_update_bits(codec, RT5639_GPIO_CTRL1,
525 RT5639_GP2_PIN_MASK | RT5639_GP4_PIN_MASK,
526 RT5639_GP2_PIN_DMIC1_SCL | RT5639_GP4_PIN_DMIC2_SDA);
527 snd_soc_update_bits(codec, RT5639_DMIC,
528 RT5639_DMIC_2L_LH_MASK | RT5639_DMIC_2R_LH_MASK |
529 RT5639_DMIC_2_DP_MASK,
530 RT5639_DMIC_2L_LH_FALLING | RT5639_DMIC_2R_LH_RISING |
531 RT5639_DMIC_2_DP_IN1N);
532 snd_soc_update_bits(codec, RT5639_DMIC,
533 RT5639_DMIC_2_EN_MASK, RT5639_DMIC_2_EN);
534 break;
535
536 default:
537 return -EINVAL;
538 }
539
540 return 0;
541}
542
543
544/* IN1/IN2 Input Type */
545static const char *rt5639_input_mode[] = {
546 "Single ended", "Differential"};
547
548static const SOC_ENUM_SINGLE_DECL(
549 rt5639_in1_mode_enum, RT5639_IN1_IN2,
550 RT5639_IN_SFT1, rt5639_input_mode);
551
552static const SOC_ENUM_SINGLE_DECL(
553 rt5639_in2_mode_enum, RT5639_IN3_IN4,
554 RT5639_IN_SFT2, rt5639_input_mode);
555
556/* Interface data select */
557static const char *rt5639_data_select[] = {
558 "Normal", "left copy to right", "right copy to left", "Swap"};
559
560static const SOC_ENUM_SINGLE_DECL(rt5639_if1_dac_enum, RT5639_DIG_INF_DATA,
561 RT5639_IF1_DAC_SEL_SFT, rt5639_data_select);
562
563static const SOC_ENUM_SINGLE_DECL(rt5639_if1_adc_enum, RT5639_DIG_INF_DATA,
564 RT5639_IF1_ADC_SEL_SFT, rt5639_data_select);
565
566static const SOC_ENUM_SINGLE_DECL(rt5639_if2_dac_enum, RT5639_DIG_INF_DATA,
567 RT5639_IF2_DAC_SEL_SFT, rt5639_data_select);
568
569static const SOC_ENUM_SINGLE_DECL(rt5639_if2_adc_enum, RT5639_DIG_INF_DATA,
570 RT5639_IF2_ADC_SEL_SFT, rt5639_data_select);
571
572static const SOC_ENUM_SINGLE_DECL(rt5639_if3_dac_enum, RT5639_DIG_INF_DATA,
573 RT5639_IF3_DAC_SEL_SFT, rt5639_data_select);
574
575static const SOC_ENUM_SINGLE_DECL(rt5639_if3_adc_enum, RT5639_DIG_INF_DATA,
576 RT5639_IF3_ADC_SEL_SFT, rt5639_data_select);
577
578/* Class D speaker gain ratio */
579static const char *rt5639_clsd_spk_ratio[] = {"1.66x", "1.83x", "1.94x", "2x",
580 "2.11x", "2.22x", "2.33x", "2.44x", "2.55x", "2.66x", "2.77x"};
581
582static const SOC_ENUM_SINGLE_DECL(
583 rt5639_clsd_spk_ratio_enum, RT5639_CLS_D_OUT,
584 RT5639_CLSD_RATIO_SFT, rt5639_clsd_spk_ratio);
585
586/* DMIC */
587static const char *rt5639_dmic_mode[] = {"Disable", "DMIC1", "DMIC2"};
588
589static const SOC_ENUM_SINGLE_DECL(rt5639_dmic_enum, 0, 0, rt5639_dmic_mode);
590
591
592
593#ifdef RT5639_REG_RW
594#define REGVAL_MAX 0xffff
595static unsigned int regctl_addr;
596static int rt5639_regctl_info(struct snd_kcontrol *kcontrol,
597 struct snd_ctl_elem_info *uinfo)
598{
599 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
600 uinfo->count = 2;
601 uinfo->value.integer.min = 0;
602 uinfo->value.integer.max = REGVAL_MAX;
603 return 0;
604}
605
606static int rt5639_regctl_get(struct snd_kcontrol *kcontrol,
607 struct snd_ctl_elem_value *ucontrol)
608{
609 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
610 ucontrol->value.integer.value[0] = regctl_addr;
611 ucontrol->value.integer.value[1] = snd_soc_read(codec, regctl_addr);
612 return 0;
613}
614
615static int rt5639_regctl_put(struct snd_kcontrol *kcontrol,
616 struct snd_ctl_elem_value *ucontrol)
617{
618 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
619 regctl_addr = ucontrol->value.integer.value[0];
620 if(ucontrol->value.integer.value[1] <= REGVAL_MAX)
621 snd_soc_write(codec, regctl_addr, ucontrol->value.integer.value[1]);
622 return 0;
623}
624#endif
625
626
627static int rt5639_vol_rescale_get(struct snd_kcontrol *kcontrol,
628 struct snd_ctl_elem_value *ucontrol)
629{
630 struct soc_mixer_control *mc =
631 (struct soc_mixer_control *)kcontrol->private_value;
632 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
633 unsigned int val = snd_soc_read(codec, mc->reg);
634
635 ucontrol->value.integer.value[0] = RT5639_VOL_RSCL_MAX -
636 ((val & RT5639_L_VOL_MASK) >> mc->shift);
637 ucontrol->value.integer.value[1] = RT5639_VOL_RSCL_MAX -
638 (val & RT5639_R_VOL_MASK);
639
640 return 0;
641}
642
643static int rt5639_vol_rescale_put(struct snd_kcontrol *kcontrol,
644 struct snd_ctl_elem_value *ucontrol)
645{
646 struct soc_mixer_control *mc =
647 (struct soc_mixer_control *)kcontrol->private_value;
648 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
649 unsigned int val, val2;
650
651 val = RT5639_VOL_RSCL_MAX - ucontrol->value.integer.value[0];
652 val2 = RT5639_VOL_RSCL_MAX - ucontrol->value.integer.value[1];
653 return snd_soc_update_bits_locked(codec, mc->reg, RT5639_L_VOL_MASK |
654 RT5639_R_VOL_MASK, val << mc->shift | val2);
655}
656
657
658static const struct snd_kcontrol_new rt5639_snd_controls[] = {
659 /* Speaker Output Volume */
660 SOC_DOUBLE_EXT_TLV("Speaker Playback Volume", RT5639_SPK_VOL,
661 RT5639_L_VOL_SFT, RT5639_R_VOL_SFT, RT5639_VOL_RSCL_RANGE, 0,
662 rt5639_vol_rescale_get, rt5639_vol_rescale_put, out_vol_tlv),
663 /* Headphone Output Volume */
664 SOC_DOUBLE("HP Playback Switch", RT5639_HP_VOL,
665 RT5639_L_MUTE_SFT, RT5639_R_MUTE_SFT, 1, 1),
666 SOC_DOUBLE_EXT_TLV("HP Playback Volume", RT5639_HP_VOL,
667 RT5639_L_VOL_SFT, RT5639_R_VOL_SFT, RT5639_VOL_RSCL_RANGE, 0,
668 rt5639_vol_rescale_get, rt5639_vol_rescale_put, out_vol_tlv),
669 /* OUTPUT Control */
670 SOC_DOUBLE("OUT Playback Switch", RT5639_OUTPUT,
671 RT5639_L_MUTE_SFT, RT5639_R_MUTE_SFT, 1, 1),
672 SOC_DOUBLE("OUT Channel Switch", RT5639_OUTPUT,
673 RT5639_VOL_L_SFT, RT5639_VOL_R_SFT, 1, 1),
674 SOC_DOUBLE_TLV("OUT Playback Volume", RT5639_OUTPUT,
675 RT5639_L_VOL_SFT, RT5639_R_VOL_SFT, 39, 1, out_vol_tlv),
676 /* MONO Output Control */
677 SOC_SINGLE("Mono Playback Switch", RT5639_MONO_OUT,
678 RT5639_L_MUTE_SFT, 1, 1),
679 /* DAC Digital Volume */
680 SOC_DOUBLE("DAC2 Playback Switch", RT5639_DAC2_CTRL,
681 RT5639_M_DAC_L2_VOL_SFT, RT5639_M_DAC_R2_VOL_SFT, 1, 1),
682 SOC_DOUBLE_TLV("DAC1 Playback Volume", RT5639_DAC1_DIG_VOL,
683 RT5639_L_VOL_SFT, RT5639_R_VOL_SFT,
684 175, 0, dac_vol_tlv),
685 SOC_DOUBLE_TLV("Mono DAC Playback Volume", RT5639_DAC2_DIG_VOL,
686 RT5639_L_VOL_SFT, RT5639_R_VOL_SFT,
687 175, 0, dac_vol_tlv),
688 /* IN1/IN2 Control */
689 SOC_ENUM("IN1 Mode Control", rt5639_in1_mode_enum),
690 SOC_SINGLE_TLV("IN1 Boost", RT5639_IN1_IN2,
691 RT5639_BST_SFT1, 8, 0, bst_tlv),
692 SOC_ENUM("IN2 Mode Control", rt5639_in2_mode_enum),
693 SOC_SINGLE_TLV("IN2 Boost", RT5639_IN3_IN4,
694 RT5639_BST_SFT2, 8, 0, bst_tlv),
695 /* INL/INR Volume Control */
696 SOC_DOUBLE_TLV("IN Capture Volume", RT5639_INL_INR_VOL,
697 RT5639_INL_VOL_SFT, RT5639_INR_VOL_SFT,
698 31, 1, in_vol_tlv),
699 /* ADC Digital Volume Control */
700 SOC_DOUBLE("ADC Capture Switch", RT5639_ADC_DIG_VOL,
701 RT5639_L_MUTE_SFT, RT5639_R_MUTE_SFT, 1, 1),
702 SOC_DOUBLE_TLV("ADC Capture Volume", RT5639_ADC_DIG_VOL,
703 RT5639_L_VOL_SFT, RT5639_R_VOL_SFT,
704 127, 0, adc_vol_tlv),
705 SOC_DOUBLE_TLV("Mono ADC Capture Volume", RT5639_ADC_DATA,
706 RT5639_L_VOL_SFT, RT5639_R_VOL_SFT,
707 127, 0, adc_vol_tlv),
708 /* ADC Boost Volume Control */
709 SOC_DOUBLE_TLV("ADC Boost Gain", RT5639_ADC_BST_VOL,
710 RT5639_ADC_L_BST_SFT, RT5639_ADC_R_BST_SFT,
711 3, 0, adc_bst_tlv),
712 /* Class D speaker gain ratio */
713 SOC_ENUM("Class D SPK Ratio Control", rt5639_clsd_spk_ratio_enum),
714 /* DMIC */
715 SOC_ENUM_EXT("DMIC Switch", rt5639_dmic_enum,
716 rt5639_dmic_get, rt5639_dmic_put),
717
718#ifdef RT5639_REG_RW
719 {
720 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
721 .name = "Register Control",
722 .info = rt5639_regctl_info,
723 .get = rt5639_regctl_get,
724 .put = rt5639_regctl_put,
725 },
726#endif
727};
728
729/**
730 * set_dmic_clk - Set parameter of dmic.
731 *
732 * @w: DAPM widget.
733 * @kcontrol: The kcontrol of this widget.
734 * @event: Event id.
735 *
736 * Choose dmic clock between 1MHz and 3MHz.
737 * It is better for clock to approximate 3MHz.
738 */
739static int set_dmic_clk(struct snd_soc_dapm_widget *w,
740 struct snd_kcontrol *kcontrol, int event)
741{
742 struct snd_soc_codec *codec = w->codec;
743 struct rt5639_priv *rt5639 = snd_soc_codec_get_drvdata(codec);
744 int div[] = {2, 3, 4, 6, 12}, idx = -EINVAL, i, rate, red, bound, temp;
745
746 rate = rt5639->lrck[rt5639->aif_pu] << 8;
747 red = 3000000 * 12;
748 for (i = 0; i < ARRAY_SIZE(div); i++) {
749 bound = div[i] * 3000000;
750 if (rate > bound)
751 continue;
752 temp = bound - rate;
753 if (temp < red) {
754 red = temp;
755 idx = i;
756 }
757 }
758 if (idx < 0)
759 dev_err(codec->dev, "Failed to set DMIC clock\n");
760 else
761 snd_soc_update_bits(codec, RT5639_DMIC, RT5639_DMIC_CLK_MASK,
762 idx << RT5639_DMIC_CLK_SFT);
763 return idx;
764}
765
766static int check_sysclk1_source(struct snd_soc_dapm_widget *source,
767 struct snd_soc_dapm_widget *sink)
768{
769 unsigned int val;
770
771 val = snd_soc_read(source->codec, RT5639_GLB_CLK);
772 val &= RT5639_SCLK_SRC_MASK;
773 if (val == RT5639_SCLK_SRC_PLL1)
774 return 1;
775 else
776 return 0;
777}
778
779/* Digital Mixer */
780static const struct snd_kcontrol_new rt5639_sto_adc_l_mix[] = {
781 SOC_DAPM_SINGLE("ADC1 Switch", RT5639_STO_ADC_MIXER,
782 RT5639_M_ADC_L1_SFT, 1, 1),
783 SOC_DAPM_SINGLE("ADC2 Switch", RT5639_STO_ADC_MIXER,
784 RT5639_M_ADC_L2_SFT, 1, 1),
785};
786
787static const struct snd_kcontrol_new rt5639_sto_adc_r_mix[] = {
788 SOC_DAPM_SINGLE("ADC1 Switch", RT5639_STO_ADC_MIXER,
789 RT5639_M_ADC_R1_SFT, 1, 1),
790 SOC_DAPM_SINGLE("ADC2 Switch", RT5639_STO_ADC_MIXER,
791 RT5639_M_ADC_R2_SFT, 1, 1),
792};
793
794static const struct snd_kcontrol_new rt5639_mono_adc_l_mix[] = {
795 SOC_DAPM_SINGLE("ADC1 Switch", RT5639_MONO_ADC_MIXER,
796 RT5639_M_MONO_ADC_L1_SFT, 1, 1),
797 SOC_DAPM_SINGLE("ADC2 Switch", RT5639_MONO_ADC_MIXER,
798 RT5639_M_MONO_ADC_L2_SFT, 1, 1),
799};
800
801static const struct snd_kcontrol_new rt5639_mono_adc_r_mix[] = {
802 SOC_DAPM_SINGLE("ADC1 Switch", RT5639_MONO_ADC_MIXER,
803 RT5639_M_MONO_ADC_R1_SFT, 1, 1),
804 SOC_DAPM_SINGLE("ADC2 Switch", RT5639_MONO_ADC_MIXER,
805 RT5639_M_MONO_ADC_R2_SFT, 1, 1),
806};
807
808static const struct snd_kcontrol_new rt5639_dac_l_mix[] = {
809 SOC_DAPM_SINGLE("Stereo ADC Switch", RT5639_AD_DA_MIXER,
810 RT5639_M_ADCMIX_L_SFT, 1, 1),
811 SOC_DAPM_SINGLE("INF1 Switch", RT5639_AD_DA_MIXER,
812 RT5639_M_IF1_DAC_L_SFT, 1, 1),
813};
814
815static const struct snd_kcontrol_new rt5639_dac_r_mix[] = {
816 SOC_DAPM_SINGLE("Stereo ADC Switch", RT5639_AD_DA_MIXER,
817 RT5639_M_ADCMIX_R_SFT, 1, 1),
818 SOC_DAPM_SINGLE("INF1 Switch", RT5639_AD_DA_MIXER,
819 RT5639_M_IF1_DAC_R_SFT, 1, 1),
820};
821
822static const struct snd_kcontrol_new rt5639_sto_dac_l_mix[] = {
823 SOC_DAPM_SINGLE("DAC L1 Switch", RT5639_STO_DAC_MIXER,
824 RT5639_M_DAC_L1_SFT, 1, 1),
825 SOC_DAPM_SINGLE("DAC L2 Switch", RT5639_STO_DAC_MIXER,
826 RT5639_M_DAC_L2_SFT, 1, 1),
827 SOC_DAPM_SINGLE("ANC Switch", RT5639_STO_DAC_MIXER,
828 RT5639_M_ANC_DAC_L_SFT, 1, 1),
829};
830
831static const struct snd_kcontrol_new rt5639_sto_dac_r_mix[] = {
832 SOC_DAPM_SINGLE("DAC R1 Switch", RT5639_STO_DAC_MIXER,
833 RT5639_M_DAC_R1_SFT, 1, 1),
834 SOC_DAPM_SINGLE("DAC R2 Switch", RT5639_STO_DAC_MIXER,
835 RT5639_M_DAC_R2_SFT, 1, 1),
836 SOC_DAPM_SINGLE("ANC Switch", RT5639_STO_DAC_MIXER,
837 RT5639_M_ANC_DAC_R_SFT, 1, 1),
838};
839
840static const struct snd_kcontrol_new rt5639_mono_dac_l_mix[] = {
841 SOC_DAPM_SINGLE("DAC L1 Switch", RT5639_MONO_DAC_MIXER,
842 RT5639_M_DAC_L1_MONO_L_SFT, 1, 1),
843 SOC_DAPM_SINGLE("DAC L2 Switch", RT5639_MONO_DAC_MIXER,
844 RT5639_M_DAC_L2_MONO_L_SFT, 1, 1),
845 SOC_DAPM_SINGLE("DAC R2 Switch", RT5639_MONO_DAC_MIXER,
846 RT5639_M_DAC_R2_MONO_L_SFT, 1, 1),
847};
848
849static const struct snd_kcontrol_new rt5639_mono_dac_r_mix[] = {
850 SOC_DAPM_SINGLE("DAC R1 Switch", RT5639_MONO_DAC_MIXER,
851 RT5639_M_DAC_R1_MONO_R_SFT, 1, 1),
852 SOC_DAPM_SINGLE("DAC R2 Switch", RT5639_MONO_DAC_MIXER,
853 RT5639_M_DAC_R2_MONO_R_SFT, 1, 1),
854 SOC_DAPM_SINGLE("DAC L2 Switch", RT5639_MONO_DAC_MIXER,
855 RT5639_M_DAC_L2_MONO_R_SFT, 1, 1),
856};
857
858static const struct snd_kcontrol_new rt5639_dig_l_mix[] = {
859 SOC_DAPM_SINGLE("DAC L1 Switch", RT5639_DIG_MIXER,
860 RT5639_M_STO_L_DAC_L_SFT, 1, 1),
861 SOC_DAPM_SINGLE("DAC L2 Switch", RT5639_DIG_MIXER,
862 RT5639_M_DAC_L2_DAC_L_SFT, 1, 1),
863};
864
865static const struct snd_kcontrol_new rt5639_dig_r_mix[] = {
866 SOC_DAPM_SINGLE("DAC R1 Switch", RT5639_DIG_MIXER,
867 RT5639_M_STO_R_DAC_R_SFT, 1, 1),
868 SOC_DAPM_SINGLE("DAC R2 Switch", RT5639_DIG_MIXER,
869 RT5639_M_DAC_R2_DAC_R_SFT, 1, 1),
870};
871
872/* Analog Input Mixer */
873static const struct snd_kcontrol_new rt5639_rec_l_mix[] = {
874 SOC_DAPM_SINGLE("HPOL Switch", RT5639_REC_L2_MIXER,
875 RT5639_M_HP_L_RM_L_SFT, 1, 1),
876 SOC_DAPM_SINGLE("INL Switch", RT5639_REC_L2_MIXER,
877 RT5639_M_IN_L_RM_L_SFT, 1, 1),
878 SOC_DAPM_SINGLE("BST2 Switch", RT5639_REC_L2_MIXER,
879 RT5639_M_BST4_RM_L_SFT, 1, 1),
880 SOC_DAPM_SINGLE("BST1 Switch", RT5639_REC_L2_MIXER,
881 RT5639_M_BST1_RM_L_SFT, 1, 1),
882 SOC_DAPM_SINGLE("OUT MIXL Switch", RT5639_REC_L2_MIXER,
883 RT5639_M_OM_L_RM_L_SFT, 1, 1),
884};
885
886static const struct snd_kcontrol_new rt5639_rec_r_mix[] = {
887 SOC_DAPM_SINGLE("HPOR Switch", RT5639_REC_R2_MIXER,
888 RT5639_M_HP_R_RM_R_SFT, 1, 1),
889 SOC_DAPM_SINGLE("INR Switch", RT5639_REC_R2_MIXER,
890 RT5639_M_IN_R_RM_R_SFT, 1, 1),
891 SOC_DAPM_SINGLE("BST2 Switch", RT5639_REC_R2_MIXER,
892 RT5639_M_BST4_RM_R_SFT, 1, 1),
893 SOC_DAPM_SINGLE("BST1 Switch", RT5639_REC_R2_MIXER,
894 RT5639_M_BST1_RM_R_SFT, 1, 1),
895 SOC_DAPM_SINGLE("OUT MIXR Switch", RT5639_REC_R2_MIXER,
896 RT5639_M_OM_R_RM_R_SFT, 1, 1),
897};
898
899/* Analog Output Mixer */
900static const struct snd_kcontrol_new rt5639_spk_l_mix[] = {
901 SOC_DAPM_SINGLE("REC MIXL Switch", RT5639_SPK_L_MIXER,
902 RT5639_M_RM_L_SM_L_SFT, 1, 1),
903 SOC_DAPM_SINGLE("INL Switch", RT5639_SPK_L_MIXER,
904 RT5639_M_IN_L_SM_L_SFT, 1, 1),
905 SOC_DAPM_SINGLE("DAC L1 Switch", RT5639_SPK_L_MIXER,
906 RT5639_M_DAC_L1_SM_L_SFT, 1, 1),
907 SOC_DAPM_SINGLE("DAC L2 Switch", RT5639_SPK_L_MIXER,
908 RT5639_M_DAC_L2_SM_L_SFT, 1, 1),
909 SOC_DAPM_SINGLE("OUT MIXL Switch", RT5639_SPK_L_MIXER,
910 RT5639_M_OM_L_SM_L_SFT, 1, 1),
911};
912
913static const struct snd_kcontrol_new rt5639_spk_r_mix[] = {
914 SOC_DAPM_SINGLE("REC MIXR Switch", RT5639_SPK_R_MIXER,
915 RT5639_M_RM_R_SM_R_SFT, 1, 1),
916 SOC_DAPM_SINGLE("INR Switch", RT5639_SPK_R_MIXER,
917 RT5639_M_IN_R_SM_R_SFT, 1, 1),
918 SOC_DAPM_SINGLE("DAC R1 Switch", RT5639_SPK_R_MIXER,
919 RT5639_M_DAC_R1_SM_R_SFT, 1, 1),
920 SOC_DAPM_SINGLE("DAC R2 Switch", RT5639_SPK_R_MIXER,
921 RT5639_M_DAC_R2_SM_R_SFT, 1, 1),
922 SOC_DAPM_SINGLE("OUT MIXR Switch", RT5639_SPK_R_MIXER,
923 RT5639_M_OM_R_SM_R_SFT, 1, 1),
924};
925
926static const struct snd_kcontrol_new rt5639_out_l_mix[] = {
927 SOC_DAPM_SINGLE("SPK MIXL Switch", RT5639_OUT_L3_MIXER,
928 RT5639_M_SM_L_OM_L_SFT, 1, 1),
929 SOC_DAPM_SINGLE("BST1 Switch", RT5639_OUT_L3_MIXER,
930 RT5639_M_BST1_OM_L_SFT, 1, 1),
931 SOC_DAPM_SINGLE("INL Switch", RT5639_OUT_L3_MIXER,
932 RT5639_M_IN_L_OM_L_SFT, 1, 1),
933 SOC_DAPM_SINGLE("REC MIXL Switch", RT5639_OUT_L3_MIXER,
934 RT5639_M_RM_L_OM_L_SFT, 1, 1),
935 SOC_DAPM_SINGLE("DAC R2 Switch", RT5639_OUT_L3_MIXER,
936 RT5639_M_DAC_R2_OM_L_SFT, 1, 1),
937 SOC_DAPM_SINGLE("DAC L2 Switch", RT5639_OUT_L3_MIXER,
938 RT5639_M_DAC_L2_OM_L_SFT, 1, 1),
939 SOC_DAPM_SINGLE("DAC L1 Switch", RT5639_OUT_L3_MIXER,
940 RT5639_M_DAC_L1_OM_L_SFT, 1, 1),
941};
942
943static const struct snd_kcontrol_new rt5639_out_r_mix[] = {
944 SOC_DAPM_SINGLE("SPK MIXR Switch", RT5639_OUT_R3_MIXER,
945 RT5639_M_SM_L_OM_R_SFT, 1, 1),
946 SOC_DAPM_SINGLE("BST2 Switch", RT5639_OUT_R3_MIXER,
947 RT5639_M_BST4_OM_R_SFT, 1, 1),
948 SOC_DAPM_SINGLE("BST1 Switch", RT5639_OUT_R3_MIXER,
949 RT5639_M_BST1_OM_R_SFT, 1, 1),
950 SOC_DAPM_SINGLE("INR Switch", RT5639_OUT_R3_MIXER,
951 RT5639_M_IN_R_OM_R_SFT, 1, 1),
952 SOC_DAPM_SINGLE("REC MIXR Switch", RT5639_OUT_R3_MIXER,
953 RT5639_M_RM_R_OM_R_SFT, 1, 1),
954 SOC_DAPM_SINGLE("DAC L2 Switch", RT5639_OUT_R3_MIXER,
955 RT5639_M_DAC_L2_OM_R_SFT, 1, 1),
956 SOC_DAPM_SINGLE("DAC R2 Switch", RT5639_OUT_R3_MIXER,
957 RT5639_M_DAC_R2_OM_R_SFT, 1, 1),
958 SOC_DAPM_SINGLE("DAC R1 Switch", RT5639_OUT_R3_MIXER,
959 RT5639_M_DAC_R1_OM_R_SFT, 1, 1),
960};
961
962static const struct snd_kcontrol_new rt5639_spo_l_mix[] = {
963 SOC_DAPM_SINGLE("DAC R1 Switch", RT5639_SPO_L_MIXER,
964 RT5639_M_DAC_R1_SPM_L_SFT, 1, 1),
965 SOC_DAPM_SINGLE("DAC L1 Switch", RT5639_SPO_L_MIXER,
966 RT5639_M_DAC_L1_SPM_L_SFT, 1, 1),
967 SOC_DAPM_SINGLE("SPKVOL R Switch", RT5639_SPO_L_MIXER,
968 RT5639_M_SV_R_SPM_L_SFT, 1, 1),
969 SOC_DAPM_SINGLE("SPKVOL L Switch", RT5639_SPO_L_MIXER,
970 RT5639_M_SV_L_SPM_L_SFT, 1, 1),
971 SOC_DAPM_SINGLE("BST1 Switch", RT5639_SPO_L_MIXER,
972 RT5639_M_BST1_SPM_L_SFT, 1, 1),
973};
974
975static const struct snd_kcontrol_new rt5639_spo_r_mix[] = {
976 SOC_DAPM_SINGLE("DAC R1 Switch", RT5639_SPO_R_MIXER,
977 RT5639_M_DAC_R1_SPM_R_SFT, 1, 1),
978 SOC_DAPM_SINGLE("SPKVOL R Switch", RT5639_SPO_R_MIXER,
979 RT5639_M_SV_R_SPM_R_SFT, 1, 1),
980 SOC_DAPM_SINGLE("BST1 Switch", RT5639_SPO_R_MIXER,
981 RT5639_M_BST1_SPM_R_SFT, 1, 1),
982};
983
984static const struct snd_kcontrol_new rt5639_hpo_mix[] = {
985 SOC_DAPM_SINGLE("DAC2 Switch", RT5639_HPO_MIXER,
986 RT5639_M_DAC2_HM_SFT, 1, 1),
987 SOC_DAPM_SINGLE("DAC1 Switch", RT5639_HPO_MIXER,
988 RT5639_M_DAC1_HM_SFT, 1, 1),
989 SOC_DAPM_SINGLE("HPVOL Switch", RT5639_HPO_MIXER,
990 RT5639_M_HPVOL_HM_SFT, 1, 1),
991};
992
993static const struct snd_kcontrol_new rt5639_lout_mix[] = {
994 SOC_DAPM_SINGLE("DAC L1 Switch", RT5639_LOUT_MIXER,
995 RT5639_M_DAC_L1_LM_SFT, 1, 1),
996 SOC_DAPM_SINGLE("DAC R1 Switch", RT5639_LOUT_MIXER,
997 RT5639_M_DAC_R1_LM_SFT, 1, 1),
998 SOC_DAPM_SINGLE("OUTVOL L Switch", RT5639_LOUT_MIXER,
999 RT5639_M_OV_L_LM_SFT, 1, 1),
1000 SOC_DAPM_SINGLE("OUTVOL R Switch", RT5639_LOUT_MIXER,
1001 RT5639_M_OV_R_LM_SFT, 1, 1),
1002};
1003
1004static const struct snd_kcontrol_new rt5639_mono_mix[] = {
1005 SOC_DAPM_SINGLE("DAC R2 Switch", RT5639_MONO_MIXER,
1006 RT5639_M_DAC_R2_MM_SFT, 1, 1),
1007 SOC_DAPM_SINGLE("DAC L2 Switch", RT5639_MONO_MIXER,
1008 RT5639_M_DAC_L2_MM_SFT, 1, 1),
1009 SOC_DAPM_SINGLE("OUTVOL R Switch", RT5639_MONO_MIXER,
1010 RT5639_M_OV_R_MM_SFT, 1, 1),
1011 SOC_DAPM_SINGLE("OUTVOL L Switch", RT5639_MONO_MIXER,
1012 RT5639_M_OV_L_MM_SFT, 1, 1),
1013 SOC_DAPM_SINGLE("BST1 Switch", RT5639_MONO_MIXER,
1014 RT5639_M_BST1_MM_SFT, 1, 1),
1015};
1016
1017/* INL/R source */
1018static const char *rt5639_inl_src[] = {"IN2P", "MonoP"};
1019
1020static const SOC_ENUM_SINGLE_DECL(
1021 rt5639_inl_enum, RT5639_INL_INR_VOL,
1022 RT5639_INL_SEL_SFT, rt5639_inl_src);
1023
1024static const struct snd_kcontrol_new rt5639_inl_mux =
1025 SOC_DAPM_ENUM("INL source", rt5639_inl_enum);
1026
1027static const char *rt5639_inr_src[] = {"IN2N", "MonoN"};
1028
1029static const SOC_ENUM_SINGLE_DECL(
1030 rt5639_inr_enum, RT5639_INL_INR_VOL,
1031 RT5639_INR_SEL_SFT, rt5639_inr_src);
1032
1033static const struct snd_kcontrol_new rt5639_inr_mux =
1034 SOC_DAPM_ENUM("INR source", rt5639_inr_enum);
1035
1036/* Stereo ADC source */
1037static const char *rt5639_stereo_adc1_src[] = {"DIG MIX", "ADC"};
1038
1039static const SOC_ENUM_SINGLE_DECL(
1040 rt5639_stereo_adc1_enum, RT5639_STO_ADC_MIXER,
1041 RT5639_ADC_1_SRC_SFT, rt5639_stereo_adc1_src);
1042
1043static const struct snd_kcontrol_new rt5639_sto_adc_l1_mux =
1044 SOC_DAPM_ENUM("Stereo ADC L1 source", rt5639_stereo_adc1_enum);
1045
1046static const struct snd_kcontrol_new rt5639_sto_adc_r1_mux =
1047 SOC_DAPM_ENUM("Stereo ADC R1 source", rt5639_stereo_adc1_enum);
1048
1049static const char *rt5639_stereo_adc2_src[] = {"DMIC1", "DMIC2", "DIG MIX"};
1050
1051static const SOC_ENUM_SINGLE_DECL(
1052 rt5639_stereo_adc2_enum, RT5639_STO_ADC_MIXER,
1053 RT5639_ADC_2_SRC_SFT, rt5639_stereo_adc2_src);
1054
1055static const struct snd_kcontrol_new rt5639_sto_adc_l2_mux =
1056 SOC_DAPM_ENUM("Stereo ADC L2 source", rt5639_stereo_adc2_enum);
1057
1058static const struct snd_kcontrol_new rt5639_sto_adc_r2_mux =
1059 SOC_DAPM_ENUM("Stereo ADC R2 source", rt5639_stereo_adc2_enum);
1060
1061/* Mono ADC source */
1062static const char *rt5639_mono_adc_l1_src[] = {"Mono DAC MIXL", "ADCL"};
1063
1064static const SOC_ENUM_SINGLE_DECL(
1065 rt5639_mono_adc_l1_enum, RT5639_MONO_ADC_MIXER,
1066 RT5639_MONO_ADC_L1_SRC_SFT, rt5639_mono_adc_l1_src);
1067
1068static const struct snd_kcontrol_new rt5639_mono_adc_l1_mux =
1069 SOC_DAPM_ENUM("Mono ADC1 left source", rt5639_mono_adc_l1_enum);
1070
1071static const char *rt5639_mono_adc_l2_src[] =
1072 {"DMIC L1", "DMIC L2", "Mono DAC MIXL"};
1073
1074static const SOC_ENUM_SINGLE_DECL(
1075 rt5639_mono_adc_l2_enum, RT5639_MONO_ADC_MIXER,
1076 RT5639_MONO_ADC_L2_SRC_SFT, rt5639_mono_adc_l2_src);
1077
1078static const struct snd_kcontrol_new rt5639_mono_adc_l2_mux =
1079 SOC_DAPM_ENUM("Mono ADC2 left source", rt5639_mono_adc_l2_enum);
1080
1081static const char *rt5639_mono_adc_r1_src[] = {"Mono DAC MIXR", "ADCR"};
1082
1083static const SOC_ENUM_SINGLE_DECL(
1084 rt5639_mono_adc_r1_enum, RT5639_MONO_ADC_MIXER,
1085 RT5639_MONO_ADC_R1_SRC_SFT, rt5639_mono_adc_r1_src);
1086
1087static const struct snd_kcontrol_new rt5639_mono_adc_r1_mux =
1088 SOC_DAPM_ENUM("Mono ADC1 right source", rt5639_mono_adc_r1_enum);
1089
1090static const char *rt5639_mono_adc_r2_src[] =
1091 {"DMIC R1", "DMIC R2", "Mono DAC MIXR"};
1092
1093static const SOC_ENUM_SINGLE_DECL(
1094 rt5639_mono_adc_r2_enum, RT5639_MONO_ADC_MIXER,
1095 RT5639_MONO_ADC_R2_SRC_SFT, rt5639_mono_adc_r2_src);
1096
1097static const struct snd_kcontrol_new rt5639_mono_adc_r2_mux =
1098 SOC_DAPM_ENUM("Mono ADC2 right source", rt5639_mono_adc_r2_enum);
1099
1100/* DAC2 channel source */
1101static const char *rt5639_dac_l2_src[] = {"IF2", "IF3", "TxDC", "Base L/R"};
1102
1103static const SOC_ENUM_SINGLE_DECL(rt5639_dac_l2_enum, RT5639_DSP_PATH2,
1104 RT5639_DAC_L2_SEL_SFT, rt5639_dac_l2_src);
1105
1106static const struct snd_kcontrol_new rt5639_dac_l2_mux =
1107 SOC_DAPM_ENUM("DAC2 left channel source", rt5639_dac_l2_enum);
1108
1109static const char *rt5639_dac_r2_src[] = {"IF2", "IF3", "TxDC"};
1110
1111static const SOC_ENUM_SINGLE_DECL(
1112 rt5639_dac_r2_enum, RT5639_DSP_PATH2,
1113 RT5639_DAC_R2_SEL_SFT, rt5639_dac_r2_src);
1114
1115static const struct snd_kcontrol_new rt5639_dac_r2_mux =
1116 SOC_DAPM_ENUM("DAC2 right channel source", rt5639_dac_r2_enum);
1117
1118/* Interface 2 ADC channel source */
1119static const char *rt5639_if2_adc_l_src[] = {"TxDP", "Mono ADC MIXL"};
1120
1121static const SOC_ENUM_SINGLE_DECL(rt5639_if2_adc_l_enum, RT5639_DSP_PATH2,
1122 RT5639_IF2_ADC_L_SEL_SFT, rt5639_if2_adc_l_src);
1123
1124static const struct snd_kcontrol_new rt5639_if2_adc_l_mux =
1125 SOC_DAPM_ENUM("IF2 ADC left channel source", rt5639_if2_adc_l_enum);
1126
1127static const char *rt5639_if2_adc_r_src[] = {"TxDP", "Mono ADC MIXR"};
1128
1129static const SOC_ENUM_SINGLE_DECL(rt5639_if2_adc_r_enum, RT5639_DSP_PATH2,
1130 RT5639_IF2_ADC_R_SEL_SFT, rt5639_if2_adc_r_src);
1131
1132static const struct snd_kcontrol_new rt5639_if2_adc_r_mux =
1133 SOC_DAPM_ENUM("IF2 ADC right channel source", rt5639_if2_adc_r_enum);
1134
1135/* digital interface and iis interface map */
1136static const char *rt5639_dai_iis_map[] = {"1:1|2:2|3:3", "1:1|2:3|3:2",
1137 "1:3|2:1|3:2", "1:3|2:2|3:1", "1:2|2:3|3:1",
1138 "1:2|2:1|3:3", "1:1|2:1|3:3", "1:2|2:2|3:3"};
1139
1140static const SOC_ENUM_SINGLE_DECL(
1141 rt5639_dai_iis_map_enum, RT5639_I2S1_SDP,
1142 RT5639_I2S_IF_SFT, rt5639_dai_iis_map);
1143
1144static const struct snd_kcontrol_new rt5639_dai_mux =
1145 SOC_DAPM_ENUM("DAI select", rt5639_dai_iis_map_enum);
1146
1147/* SDI select */
1148static const char *rt5639_sdi_sel[] = {"IF1", "IF2"};
1149
1150static const SOC_ENUM_SINGLE_DECL(
1151 rt5639_sdi_sel_enum, RT5639_I2S2_SDP,
1152 RT5639_I2S2_SDI_SFT, rt5639_sdi_sel);
1153
1154static const struct snd_kcontrol_new rt5639_sdi_mux =
1155 SOC_DAPM_ENUM("SDI select", rt5639_sdi_sel_enum);
1156
1157static int spk_event(struct snd_soc_dapm_widget *w,
1158 struct snd_kcontrol *kcontrol, int event)
1159{
1160 struct snd_soc_codec *codec = w->codec;
1161
1162 switch (event) {
1163 case SND_SOC_DAPM_POST_PMU:
1164 printk("spk_event --SND_SOC_DAPM_POST_PMU\n");
1165 snd_soc_update_bits(codec, RT5639_PWR_DIG1,
1166 RT5639_PWR_CLS_D, RT5639_PWR_CLS_D);
1167 rt5639_index_update_bits(codec, 0x1c, 0xf000, 0xf000);
1168 //rt5639_index_write(codec,0x1c,0xfd21);
1169 break;
1170
1171 case SND_SOC_DAPM_PRE_PMD:
1172 printk("spk_event --SND_SOC_DAPM_POST_PMD\n");
1173 //rt5639_index_write(codec,0x1c,0xfd00);
1174 rt5639_index_update_bits(codec, 0x1c, 0xf000, 0x0000);
1175 snd_soc_update_bits(codec,RT5639_PWR_DIG1,
1176 RT5639_PWR_CLS_D, 0);
1177 break;
1178
1179 default:
1180 return 0;
1181 }
1182
1183 return 0;
1184}
1185
1186static int hp_event(struct snd_soc_dapm_widget *w,
1187 struct snd_kcontrol *kcontrol, int event)
1188{
1189 struct snd_soc_codec *codec = w->codec;
1190
1191 switch (event) {
1192 case SND_SOC_DAPM_POST_PMU:
1193 printk("hp_event --SND_SOC_DAPM_POST_PMU\n");
1194 break;
1195
1196 case SND_SOC_DAPM_PRE_PMD:
1197 printk("hp_event --SND_SOC_DAPM_POST_PMD\n");
1198 break;
1199
1200 default:
1201 return 0;
1202 }
1203
1204 return 0;
1205}
1206
1207static const struct snd_soc_dapm_widget rt5639_dapm_widgets[] = {
1208 SND_SOC_DAPM_SUPPLY("PLL1", RT5639_PWR_ANLG2,
1209 RT5639_PWR_PLL_BIT, 0, NULL, 0),
1210 /* Input Side */
1211 /* micbias */
1212 SND_SOC_DAPM_SUPPLY("LDO2", RT5639_PWR_ANLG1,
1213 RT5639_PWR_LDO2_BIT, 0, NULL, 0),
1214 SND_SOC_DAPM_MICBIAS("micbias1", RT5639_PWR_ANLG2,
1215 RT5639_PWR_MB1_BIT, 0),
1216 SND_SOC_DAPM_MICBIAS("micbias2", RT5639_PWR_ANLG2,
1217 RT5639_PWR_MB2_BIT, 0),
1218 /* Input Lines */
1219
1220 SND_SOC_DAPM_INPUT("MIC1"),
1221 SND_SOC_DAPM_INPUT("MIC2"),
1222 SND_SOC_DAPM_INPUT("DMIC1"),
1223 SND_SOC_DAPM_INPUT("DMIC2"),
1224
1225 SND_SOC_DAPM_INPUT("IN1P"),
1226 SND_SOC_DAPM_INPUT("IN1N"),
1227 SND_SOC_DAPM_INPUT("IN2P"),
1228 SND_SOC_DAPM_INPUT("IN2N"),
1229 SND_SOC_DAPM_INPUT("DMIC L1"),
1230 SND_SOC_DAPM_INPUT("DMIC R1"),
1231 SND_SOC_DAPM_INPUT("DMIC L2"),
1232 SND_SOC_DAPM_INPUT("DMIC R2"),
1233 SND_SOC_DAPM_SUPPLY("DMIC CLK", SND_SOC_NOPM, 0, 0,
1234 set_dmic_clk, SND_SOC_DAPM_PRE_PMU),
1235 /* Boost */
1236 SND_SOC_DAPM_PGA("BST1", RT5639_PWR_ANLG2,
1237 RT5639_PWR_BST1_BIT, 0, NULL, 0),
1238 SND_SOC_DAPM_PGA("BST2", RT5639_PWR_ANLG2,
1239 RT5639_PWR_BST4_BIT, 0, NULL, 0),
1240 /* Input Volume */
1241 SND_SOC_DAPM_PGA("INL VOL", RT5639_PWR_VOL,
1242 RT5639_PWR_IN_L_BIT, 0, NULL, 0),
1243 SND_SOC_DAPM_PGA("INR VOL", RT5639_PWR_VOL,
1244 RT5639_PWR_IN_R_BIT, 0, NULL, 0),
1245 /* IN Mux */
1246 SND_SOC_DAPM_MUX("INL Mux", SND_SOC_NOPM, 0, 0, &rt5639_inl_mux),
1247 SND_SOC_DAPM_MUX("INR Mux", SND_SOC_NOPM, 0, 0, &rt5639_inr_mux),
1248 /* REC Mixer */
1249 SND_SOC_DAPM_MIXER("RECMIXL", RT5639_PWR_MIXER, RT5639_PWR_RM_L_BIT, 0,
1250 rt5639_rec_l_mix, ARRAY_SIZE(rt5639_rec_l_mix)),
1251 SND_SOC_DAPM_MIXER("RECMIXR", RT5639_PWR_MIXER, RT5639_PWR_RM_R_BIT, 0,
1252 rt5639_rec_r_mix, ARRAY_SIZE(rt5639_rec_r_mix)),
1253 /* ADCs */
1254 SND_SOC_DAPM_ADC("ADC L", NULL, RT5639_PWR_DIG1,
1255 RT5639_PWR_ADC_L_BIT, 0),
1256 SND_SOC_DAPM_ADC("ADC R", NULL, RT5639_PWR_DIG1,
1257 RT5639_PWR_ADC_R_BIT, 0),
1258 /* ADC Mux */
1259 SND_SOC_DAPM_MUX("Stereo ADC L2 Mux", SND_SOC_NOPM, 0, 0,
1260 &rt5639_sto_adc_l2_mux),
1261 SND_SOC_DAPM_MUX("Stereo ADC R2 Mux", SND_SOC_NOPM, 0, 0,
1262 &rt5639_sto_adc_r2_mux),
1263 SND_SOC_DAPM_MUX("Stereo ADC L1 Mux", SND_SOC_NOPM, 0, 0,
1264 &rt5639_sto_adc_l1_mux),
1265 SND_SOC_DAPM_MUX("Stereo ADC R1 Mux", SND_SOC_NOPM, 0, 0,
1266 &rt5639_sto_adc_r1_mux),
1267 SND_SOC_DAPM_MUX("Mono ADC L2 Mux", SND_SOC_NOPM, 0, 0,
1268 &rt5639_mono_adc_l2_mux),
1269 SND_SOC_DAPM_MUX("Mono ADC L1 Mux", SND_SOC_NOPM, 0, 0,
1270 &rt5639_mono_adc_l1_mux),
1271 SND_SOC_DAPM_MUX("Mono ADC R1 Mux", SND_SOC_NOPM, 0, 0,
1272 &rt5639_mono_adc_r1_mux),
1273 SND_SOC_DAPM_MUX("Mono ADC R2 Mux", SND_SOC_NOPM, 0, 0,
1274 &rt5639_mono_adc_r2_mux),
1275 /* ADC Mixer */
1276 SND_SOC_DAPM_SUPPLY("stereo filter", RT5639_PWR_DIG2,
1277 RT5639_PWR_ADC_SF_BIT, 0, NULL, 0),
1278 SND_SOC_DAPM_MIXER("Stereo ADC MIXL", SND_SOC_NOPM, 0, 0,
1279 rt5639_sto_adc_l_mix, ARRAY_SIZE(rt5639_sto_adc_l_mix)),
1280 SND_SOC_DAPM_MIXER("Stereo ADC MIXR", SND_SOC_NOPM, 0, 0,
1281 rt5639_sto_adc_r_mix, ARRAY_SIZE(rt5639_sto_adc_r_mix)),
1282 SND_SOC_DAPM_SUPPLY("mono left filter", RT5639_PWR_DIG2,
1283 RT5639_PWR_ADC_MF_L_BIT, 0, NULL, 0),
1284 SND_SOC_DAPM_MIXER("Mono ADC MIXL", SND_SOC_NOPM, 0, 0,
1285 rt5639_mono_adc_l_mix, ARRAY_SIZE(rt5639_mono_adc_l_mix)),
1286 SND_SOC_DAPM_SUPPLY("mono right filter", RT5639_PWR_DIG2,
1287 RT5639_PWR_ADC_MF_R_BIT, 0, NULL, 0),
1288 SND_SOC_DAPM_MIXER("Mono ADC MIXR", SND_SOC_NOPM, 0, 0,
1289 rt5639_mono_adc_r_mix, ARRAY_SIZE(rt5639_mono_adc_r_mix)),
1290
1291 /* IF2 Mux */
1292 SND_SOC_DAPM_MUX("IF2 ADC L Mux", SND_SOC_NOPM, 0, 0,
1293 &rt5639_if2_adc_l_mux),
1294 SND_SOC_DAPM_MUX("IF2 ADC R Mux", SND_SOC_NOPM, 0, 0,
1295 &rt5639_if2_adc_r_mux),
1296
1297 /* Digital Interface */
1298 SND_SOC_DAPM_SUPPLY("I2S1", RT5639_PWR_DIG1,
1299 RT5639_PWR_I2S1_BIT, 0, NULL, 0),
1300 SND_SOC_DAPM_PGA("IF1 DAC", SND_SOC_NOPM, 0, 0, NULL, 0),
1301 SND_SOC_DAPM_PGA("IF1 DAC L", SND_SOC_NOPM, 0, 0, NULL, 0),
1302 SND_SOC_DAPM_PGA("IF1 DAC R", SND_SOC_NOPM, 0, 0, NULL, 0),
1303 SND_SOC_DAPM_PGA("IF1 ADC", SND_SOC_NOPM, 0, 0, NULL, 0),
1304 SND_SOC_DAPM_PGA("IF1 ADC L", SND_SOC_NOPM, 0, 0, NULL, 0),
1305 SND_SOC_DAPM_PGA("IF1 ADC R", SND_SOC_NOPM, 0, 0, NULL, 0),
1306 SND_SOC_DAPM_SUPPLY("I2S2", RT5639_PWR_DIG1,
1307 RT5639_PWR_I2S2_BIT, 0, NULL, 0),
1308 SND_SOC_DAPM_PGA("IF2 DAC", SND_SOC_NOPM, 0, 0, NULL, 0),
1309 SND_SOC_DAPM_PGA("IF2 DAC L", SND_SOC_NOPM, 0, 0, NULL, 0),
1310 SND_SOC_DAPM_PGA("IF2 DAC R", SND_SOC_NOPM, 0, 0, NULL, 0),
1311 SND_SOC_DAPM_PGA("IF2 ADC", SND_SOC_NOPM, 0, 0, NULL, 0),
1312 SND_SOC_DAPM_PGA("IF2 ADC L", SND_SOC_NOPM, 0, 0, NULL, 0),
1313 SND_SOC_DAPM_PGA("IF2 ADC R", SND_SOC_NOPM, 0, 0, NULL, 0),
1314 SND_SOC_DAPM_SUPPLY("I2S3", RT5639_PWR_DIG1,
1315 RT5639_PWR_I2S3_BIT, 0, NULL, 0),
1316 SND_SOC_DAPM_PGA("IF3 DAC", SND_SOC_NOPM, 0, 0, NULL, 0),
1317 SND_SOC_DAPM_PGA("IF3 DAC L", SND_SOC_NOPM, 0, 0, NULL, 0),
1318 SND_SOC_DAPM_PGA("IF3 DAC R", SND_SOC_NOPM, 0, 0, NULL, 0),
1319 SND_SOC_DAPM_PGA("IF3 ADC", SND_SOC_NOPM, 0, 0, NULL, 0),
1320 SND_SOC_DAPM_PGA("IF3 ADC L", SND_SOC_NOPM, 0, 0, NULL, 0),
1321 SND_SOC_DAPM_PGA("IF3 ADC R", SND_SOC_NOPM, 0, 0, NULL, 0),
1322
1323 /* Digital Interface Select */
1324 SND_SOC_DAPM_MUX("DAI1 RX Mux", SND_SOC_NOPM, 0, 0, &rt5639_dai_mux),
1325 SND_SOC_DAPM_MUX("DAI1 TX Mux", SND_SOC_NOPM, 0, 0, &rt5639_dai_mux),
1326 SND_SOC_DAPM_MUX("DAI1 IF1 Mux", SND_SOC_NOPM, 0, 0, &rt5639_dai_mux),
1327 SND_SOC_DAPM_MUX("DAI1 IF2 Mux", SND_SOC_NOPM, 0, 0, &rt5639_dai_mux),
1328 SND_SOC_DAPM_MUX("SDI1 TX Mux", SND_SOC_NOPM, 0, 0, &rt5639_sdi_mux),
1329
1330 SND_SOC_DAPM_MUX("DAI2 RX Mux", SND_SOC_NOPM, 0, 0, &rt5639_dai_mux),
1331 SND_SOC_DAPM_MUX("DAI2 TX Mux", SND_SOC_NOPM, 0, 0, &rt5639_dai_mux),
1332 SND_SOC_DAPM_MUX("DAI2 IF1 Mux", SND_SOC_NOPM, 0, 0, &rt5639_dai_mux),
1333 SND_SOC_DAPM_MUX("DAI2 IF2 Mux", SND_SOC_NOPM, 0, 0, &rt5639_dai_mux),
1334 SND_SOC_DAPM_MUX("SDI2 TX Mux", SND_SOC_NOPM, 0, 0, &rt5639_sdi_mux),
1335
1336 SND_SOC_DAPM_MUX("DAI3 RX Mux", SND_SOC_NOPM, 0, 0, &rt5639_dai_mux),
1337 SND_SOC_DAPM_MUX("DAI3 TX Mux", SND_SOC_NOPM, 0, 0, &rt5639_dai_mux),
1338
1339 /* Audio Interface */
1340 SND_SOC_DAPM_AIF_IN("AIF1RX", "AIF1 Playback", 0, SND_SOC_NOPM, 0, 0),
1341 SND_SOC_DAPM_AIF_OUT("AIF1TX", "AIF1 Capture", 0, SND_SOC_NOPM, 0, 0),
1342 SND_SOC_DAPM_AIF_IN("AIF2RX", "AIF2 Playback", 0, SND_SOC_NOPM, 0, 0),
1343 SND_SOC_DAPM_AIF_OUT("AIF2TX", "AIF2 Capture", 0, SND_SOC_NOPM, 0, 0),
1344 SND_SOC_DAPM_AIF_IN("AIF3RX", "AIF3 Playback", 0, SND_SOC_NOPM, 0, 0),
1345 SND_SOC_DAPM_AIF_OUT("AIF3TX", "AIF3 Capture", 0, SND_SOC_NOPM, 0, 0),
1346
1347 /* Audio DSP */
1348 SND_SOC_DAPM_PGA("Audio DSP", SND_SOC_NOPM, 0, 0, NULL, 0),
1349
1350 /* ANC */
1351 SND_SOC_DAPM_PGA("ANC", SND_SOC_NOPM, 0, 0, NULL, 0),
1352
1353 /* Output Side */
1354 /* DAC mixer before sound effect */
1355 SND_SOC_DAPM_MIXER("DAC MIXL", SND_SOC_NOPM, 0, 0,
1356 rt5639_dac_l_mix, ARRAY_SIZE(rt5639_dac_l_mix)),
1357 SND_SOC_DAPM_MIXER("DAC MIXR", SND_SOC_NOPM, 0, 0,
1358 rt5639_dac_r_mix, ARRAY_SIZE(rt5639_dac_r_mix)),
1359
1360 /* DAC2 channel Mux */
1361 SND_SOC_DAPM_MUX("DAC L2 Mux", SND_SOC_NOPM, 0, 0,
1362 &rt5639_dac_l2_mux),
1363 SND_SOC_DAPM_MUX("DAC R2 Mux", SND_SOC_NOPM, 0, 0,
1364 &rt5639_dac_r2_mux),
1365
1366 /* DAC Mixer */
1367 SND_SOC_DAPM_MIXER("Stereo DAC MIXL", SND_SOC_NOPM, 0, 0,
1368 rt5639_sto_dac_l_mix, ARRAY_SIZE(rt5639_sto_dac_l_mix)),
1369 SND_SOC_DAPM_MIXER("Stereo DAC MIXR", SND_SOC_NOPM, 0, 0,
1370 rt5639_sto_dac_r_mix, ARRAY_SIZE(rt5639_sto_dac_r_mix)),
1371 SND_SOC_DAPM_MIXER("Mono DAC MIXL", SND_SOC_NOPM, 0, 0,
1372 rt5639_mono_dac_l_mix, ARRAY_SIZE(rt5639_mono_dac_l_mix)),
1373 SND_SOC_DAPM_MIXER("Mono DAC MIXR", SND_SOC_NOPM, 0, 0,
1374 rt5639_mono_dac_r_mix, ARRAY_SIZE(rt5639_mono_dac_r_mix)),
1375 SND_SOC_DAPM_MIXER("DIG MIXL", SND_SOC_NOPM, 0, 0,
1376 rt5639_dig_l_mix, ARRAY_SIZE(rt5639_dig_l_mix)),
1377 SND_SOC_DAPM_MIXER("DIG MIXR", SND_SOC_NOPM, 0, 0,
1378 rt5639_dig_r_mix, ARRAY_SIZE(rt5639_dig_r_mix)),
1379 /* DACs */
1380 SND_SOC_DAPM_DAC("DAC L1", NULL, RT5639_PWR_DIG1,
1381 RT5639_PWR_DAC_L1_BIT, 0),
1382 SND_SOC_DAPM_DAC("DAC L2", NULL, RT5639_PWR_DIG1,
1383 RT5639_PWR_DAC_L2_BIT, 0),
1384 SND_SOC_DAPM_DAC("DAC R1", NULL, RT5639_PWR_DIG1,
1385 RT5639_PWR_DAC_R1_BIT, 0),
1386 SND_SOC_DAPM_DAC("DAC R2", NULL, RT5639_PWR_DIG1,
1387 RT5639_PWR_DAC_R2_BIT, 0),
1388 /* SPK/OUT Mixer */
1389 SND_SOC_DAPM_MIXER("SPK MIXL", RT5639_PWR_MIXER, RT5639_PWR_SM_L_BIT,
1390 0, rt5639_spk_l_mix, ARRAY_SIZE(rt5639_spk_l_mix)),
1391 SND_SOC_DAPM_MIXER("SPK MIXR", RT5639_PWR_MIXER, RT5639_PWR_SM_R_BIT,
1392 0, rt5639_spk_r_mix, ARRAY_SIZE(rt5639_spk_r_mix)),
1393 SND_SOC_DAPM_MIXER("OUT MIXL", RT5639_PWR_MIXER, RT5639_PWR_OM_L_BIT,
1394 0, rt5639_out_l_mix, ARRAY_SIZE(rt5639_out_l_mix)),
1395 SND_SOC_DAPM_MIXER("OUT MIXR", RT5639_PWR_MIXER, RT5639_PWR_OM_R_BIT,
1396 0, rt5639_out_r_mix, ARRAY_SIZE(rt5639_out_r_mix)),
1397 /* Ouput Volume */
1398 SND_SOC_DAPM_PGA("SPKVOL L", RT5639_PWR_VOL,
1399 RT5639_PWR_SV_L_BIT, 0, NULL, 0),
1400 SND_SOC_DAPM_PGA("SPKVOL R", RT5639_PWR_VOL,
1401 RT5639_PWR_SV_R_BIT, 0, NULL, 0),
1402 SND_SOC_DAPM_PGA("OUTVOL L", RT5639_PWR_VOL,
1403 RT5639_PWR_OV_L_BIT, 0, NULL, 0),
1404 SND_SOC_DAPM_PGA("OUTVOL R", RT5639_PWR_VOL,
1405 RT5639_PWR_OV_R_BIT, 0, NULL, 0),
1406 SND_SOC_DAPM_PGA("HPOVOL L", RT5639_PWR_VOL,
1407 RT5639_PWR_HV_L_BIT, 0, NULL, 0),
1408 SND_SOC_DAPM_PGA("HPOVOL R", RT5639_PWR_VOL,
1409 RT5639_PWR_HV_R_BIT, 0, NULL, 0),
1410 /* SPO/HPO/LOUT/Mono Mixer */
1411 SND_SOC_DAPM_MIXER("SPOL MIX",SND_SOC_NOPM, 0,
1412 0, rt5639_spo_l_mix, ARRAY_SIZE(rt5639_spo_l_mix)),
1413 SND_SOC_DAPM_MIXER("SPOR MIX", SND_SOC_NOPM, 0,
1414 0, rt5639_spo_r_mix, ARRAY_SIZE(rt5639_spo_r_mix)),
1415 SND_SOC_DAPM_MIXER("HPOL MIX", SND_SOC_NOPM, 0, 0,
1416 rt5639_hpo_mix, ARRAY_SIZE(rt5639_hpo_mix)),
1417 SND_SOC_DAPM_MIXER("HPOR MIX", SND_SOC_NOPM, 0, 0,
1418 rt5639_hpo_mix, ARRAY_SIZE(rt5639_hpo_mix)),
1419 SND_SOC_DAPM_MIXER("LOUT MIX", RT5639_PWR_ANLG1, RT5639_PWR_LM_BIT, 0,
1420 rt5639_lout_mix, ARRAY_SIZE(rt5639_lout_mix)),
1421 SND_SOC_DAPM_MIXER("Mono MIX", RT5639_PWR_ANLG1, RT5639_PWR_MM_BIT, 0,
1422 rt5639_mono_mix, ARRAY_SIZE(rt5639_mono_mix)),
1423
1424 SND_SOC_DAPM_SUPPLY("Improve mono amp drv", RT5639_PWR_ANLG1,
1425 RT5639_PWR_MA_BIT, 0, NULL, 0),
1426
1427 SND_SOC_DAPM_SUPPLY("Improve HP amp drv", RT5639_PWR_ANLG1,
1428 SND_SOC_NOPM, 0, hp_event,SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
1429
1430 SND_SOC_DAPM_PGA("HP L amp", RT5639_PWR_ANLG1,
1431 RT5639_PWR_HP_L_BIT, 0, NULL, 0),
1432
1433 SND_SOC_DAPM_PGA("HP R amp", RT5639_PWR_ANLG1,
1434 RT5639_PWR_HP_R_BIT, 0, NULL, 0),
1435
1436 SND_SOC_DAPM_SUPPLY("Improve SPK amp drv", SND_SOC_NOPM, 0, 0,
1437 spk_event, SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
1438
1439 /* Output Lines */
1440 SND_SOC_DAPM_OUTPUT("SPOLP"),
1441 SND_SOC_DAPM_OUTPUT("SPOLN"),
1442 SND_SOC_DAPM_OUTPUT("SPORP"),
1443 SND_SOC_DAPM_OUTPUT("SPORN"),
1444 SND_SOC_DAPM_OUTPUT("HPOL"),
1445 SND_SOC_DAPM_OUTPUT("HPOR"),
1446 SND_SOC_DAPM_OUTPUT("LOUTL"),
1447 SND_SOC_DAPM_OUTPUT("LOUTR"),
1448};
1449
1450static const struct snd_soc_dapm_route rt5639_dapm_routes[] = {
1451 {"IN1P", NULL, "LDO2"},
1452 {"IN2P", NULL, "LDO2"},
1453
1454 {"IN1P", NULL, "MIC1"},
1455 {"IN1N", NULL, "MIC1"},
1456 {"IN2P", NULL, "MIC2"},
1457 {"IN2N", NULL, "MIC2"},
1458
1459 {"DMIC L1", NULL, "DMIC1"},
1460 {"DMIC R1", NULL, "DMIC1"},
1461 {"DMIC L2", NULL, "DMIC2"},
1462 {"DMIC R2", NULL, "DMIC2"},
1463
1464 {"BST1", NULL, "IN1P"},
1465 {"BST1", NULL, "IN1N"},
1466 {"BST2", NULL, "IN2P"},
1467 {"BST2", NULL, "IN2N"},
1468
1469 {"INL VOL", NULL, "IN2P"},
1470 {"INR VOL", NULL, "IN2N"},
1471
1472 {"RECMIXL", "HPOL Switch", "HPOL"},
1473 {"RECMIXL", "INL Switch", "INL VOL"},
1474 {"RECMIXL", "BST2 Switch", "BST2"},
1475 {"RECMIXL", "BST1 Switch", "BST1"},
1476 {"RECMIXL", "OUT MIXL Switch", "OUT MIXL"},
1477
1478 {"RECMIXR", "HPOR Switch", "HPOR"},
1479 {"RECMIXR", "INR Switch", "INR VOL"},
1480 {"RECMIXR", "BST2 Switch", "BST2"},
1481 {"RECMIXR", "BST1 Switch", "BST1"},
1482 {"RECMIXR", "OUT MIXR Switch", "OUT MIXR"},
1483
1484 {"ADC L", NULL, "RECMIXL"},
1485 {"ADC R", NULL, "RECMIXR"},
1486
1487 {"DMIC L1", NULL, "DMIC CLK"},
1488 {"DMIC L2", NULL, "DMIC CLK"},
1489
1490 {"Stereo ADC L2 Mux", "DMIC1", "DMIC L1"},
1491 {"Stereo ADC L2 Mux", "DMIC2", "DMIC L2"},
1492 {"Stereo ADC L2 Mux", "DIG MIX", "DIG MIXL"},
1493 {"Stereo ADC L1 Mux", "ADC", "ADC L"},
1494 {"Stereo ADC L1 Mux", "DIG MIX", "DIG MIXL"},
1495
1496 {"Stereo ADC R1 Mux", "ADC", "ADC R"},
1497 {"Stereo ADC R1 Mux", "DIG MIX", "DIG MIXR"},
1498 {"Stereo ADC R2 Mux", "DMIC1", "DMIC R1"},
1499 {"Stereo ADC R2 Mux", "DMIC2", "DMIC R2"},
1500 {"Stereo ADC R2 Mux", "DIG MIX", "DIG MIXR"},
1501
1502 {"Mono ADC L2 Mux", "DMIC L1", "DMIC L1"},
1503 {"Mono ADC L2 Mux", "DMIC L2", "DMIC L2"},
1504 {"Mono ADC L2 Mux", "Mono DAC MIXL", "Mono DAC MIXL"},
1505 {"Mono ADC L1 Mux", "Mono DAC MIXL", "Mono DAC MIXL"},
1506 {"Mono ADC L1 Mux", "ADCL", "ADC L"},
1507
1508 {"Mono ADC R1 Mux", "Mono DAC MIXR", "Mono DAC MIXR"},
1509 {"Mono ADC R1 Mux", "ADCR", "ADC R"},
1510 {"Mono ADC R2 Mux", "DMIC R1", "DMIC R1"},
1511 {"Mono ADC R2 Mux", "DMIC R2", "DMIC R2"},
1512 {"Mono ADC R2 Mux", "Mono DAC MIXR", "Mono DAC MIXR"},
1513
1514 {"Stereo ADC MIXL", "ADC1 Switch", "Stereo ADC L1 Mux"},
1515 {"Stereo ADC MIXL", "ADC2 Switch", "Stereo ADC L2 Mux"},
1516 {"Stereo ADC MIXL", NULL, "stereo filter"},
1517 {"stereo filter", NULL, "PLL1", check_sysclk1_source},
1518
1519 {"Stereo ADC MIXR", "ADC1 Switch", "Stereo ADC R1 Mux"},
1520 {"Stereo ADC MIXR", "ADC2 Switch", "Stereo ADC R2 Mux"},
1521 {"Stereo ADC MIXR", NULL, "stereo filter"},
1522 {"stereo filter", NULL, "PLL1", check_sysclk1_source},
1523
1524 {"Mono ADC MIXL", "ADC1 Switch", "Mono ADC L1 Mux"},
1525 {"Mono ADC MIXL", "ADC2 Switch", "Mono ADC L2 Mux"},
1526 {"Mono ADC MIXL", NULL, "mono left filter"},
1527 {"mono left filter", NULL, "PLL1", check_sysclk1_source},
1528
1529 {"Mono ADC MIXR", "ADC1 Switch", "Mono ADC R1 Mux"},
1530 {"Mono ADC MIXR", "ADC2 Switch", "Mono ADC R2 Mux"},
1531 {"Mono ADC MIXR", NULL, "mono right filter"},
1532 {"mono right filter", NULL, "PLL1", check_sysclk1_source},
1533
1534 {"IF2 ADC L Mux", "Mono ADC MIXL", "Mono ADC MIXL"},
1535 {"IF2 ADC R Mux", "Mono ADC MIXR", "Mono ADC MIXR"},
1536
1537 {"IF2 ADC L", NULL, "IF2 ADC L Mux"},
1538 {"IF2 ADC R", NULL, "IF2 ADC R Mux"},
1539 {"IF3 ADC L", NULL, "Mono ADC MIXL"},
1540 {"IF3 ADC R", NULL, "Mono ADC MIXR"},
1541 {"IF1 ADC L", NULL, "Stereo ADC MIXL"},
1542 {"IF1 ADC R", NULL, "Stereo ADC MIXR"},
1543
1544 {"IF1 ADC", NULL, "I2S1"},
1545 {"IF1 ADC", NULL, "IF1 ADC L"},
1546 {"IF1 ADC", NULL, "IF1 ADC R"},
1547 {"IF2 ADC", NULL, "I2S2"},
1548 {"IF2 ADC", NULL, "IF2 ADC L"},
1549 {"IF2 ADC", NULL, "IF2 ADC R"},
1550 {"IF3 ADC", NULL, "I2S3"},
1551 {"IF3 ADC", NULL, "IF3 ADC L"},
1552 {"IF3 ADC", NULL, "IF3 ADC R"},
1553
1554 {"DAI1 TX Mux", "1:1|2:2|3:3", "IF1 ADC"},
1555 {"DAI1 TX Mux", "1:1|2:3|3:2", "IF1 ADC"},
1556 {"DAI1 TX Mux", "1:3|2:1|3:2", "IF2 ADC"},
1557 {"DAI1 TX Mux", "1:2|2:1|3:3", "IF2 ADC"},
1558 {"DAI1 TX Mux", "1:3|2:2|3:1", "IF3 ADC"},
1559 {"DAI1 TX Mux", "1:2|2:3|3:1", "IF3 ADC"},
1560 {"DAI1 IF1 Mux", "1:1|2:1|3:3", "IF1 ADC"},
1561 {"DAI1 IF2 Mux", "1:1|2:1|3:3", "IF2 ADC"},
1562 {"SDI1 TX Mux", "IF1", "DAI1 IF1 Mux"},
1563 {"SDI1 TX Mux", "IF2", "DAI1 IF2 Mux"},
1564
1565 {"DAI2 TX Mux", "1:2|2:3|3:1", "IF1 ADC"},
1566 {"DAI2 TX Mux", "1:2|2:1|3:3", "IF1 ADC"},
1567 {"DAI2 TX Mux", "1:1|2:2|3:3", "IF2 ADC"},
1568 {"DAI2 TX Mux", "1:3|2:2|3:1", "IF2 ADC"},
1569 {"DAI2 TX Mux", "1:1|2:3|3:2", "IF3 ADC"},
1570 {"DAI2 TX Mux", "1:3|2:1|3:2", "IF3 ADC"},
1571 {"DAI2 IF1 Mux", "1:2|2:2|3:3", "IF1 ADC"},
1572 {"DAI2 IF2 Mux", "1:2|2:2|3:3", "IF2 ADC"},
1573 {"SDI2 TX Mux", "IF1", "DAI2 IF1 Mux"},
1574 {"SDI2 TX Mux", "IF2", "DAI2 IF2 Mux"},
1575
1576 {"DAI3 TX Mux", "1:3|2:1|3:2", "IF1 ADC"},
1577 {"DAI3 TX Mux", "1:3|2:2|3:1", "IF1 ADC"},
1578 {"DAI3 TX Mux", "1:1|2:3|3:2", "IF2 ADC"},
1579 {"DAI3 TX Mux", "1:2|2:3|3:1", "IF2 ADC"},
1580 {"DAI3 TX Mux", "1:1|2:2|3:3", "IF3 ADC"},
1581 {"DAI3 TX Mux", "1:2|2:1|3:3", "IF3 ADC"},
1582 {"DAI3 TX Mux", "1:1|2:1|3:3", "IF3 ADC"},
1583 {"DAI3 TX Mux", "1:2|2:2|3:3", "IF3 ADC"},
1584
1585 {"AIF1TX", NULL, "DAI1 TX Mux"},
1586 {"AIF1TX", NULL, "SDI1 TX Mux"},
1587 {"AIF2TX", NULL, "DAI2 TX Mux"},
1588 {"AIF2TX", NULL, "SDI2 TX Mux"},
1589 {"AIF3TX", NULL, "DAI3 TX Mux"},
1590
1591 {"DAI1 RX Mux", "1:1|2:2|3:3", "AIF1RX"},
1592 {"DAI1 RX Mux", "1:1|2:3|3:2", "AIF1RX"},
1593 {"DAI1 RX Mux", "1:1|2:1|3:3", "AIF1RX"},
1594 {"DAI1 RX Mux", "1:2|2:3|3:1", "AIF2RX"},
1595 {"DAI1 RX Mux", "1:2|2:1|3:3", "AIF2RX"},
1596 {"DAI1 RX Mux", "1:2|2:2|3:3", "AIF2RX"},
1597 {"DAI1 RX Mux", "1:3|2:1|3:2", "AIF3RX"},
1598 {"DAI1 RX Mux", "1:3|2:2|3:1", "AIF3RX"},
1599
1600 {"DAI2 RX Mux", "1:3|2:1|3:2", "AIF1RX"},
1601 {"DAI2 RX Mux", "1:2|2:1|3:3", "AIF1RX"},
1602 {"DAI2 RX Mux", "1:1|2:1|3:3", "AIF1RX"},
1603 {"DAI2 RX Mux", "1:1|2:2|3:3", "AIF2RX"},
1604 {"DAI2 RX Mux", "1:3|2:2|3:1", "AIF2RX"},
1605 {"DAI2 RX Mux", "1:2|2:2|3:3", "AIF2RX"},
1606 {"DAI2 RX Mux", "1:1|2:3|3:2", "AIF3RX"},
1607 {"DAI2 RX Mux", "1:2|2:3|3:1", "AIF3RX"},
1608
1609 {"DAI3 RX Mux", "1:3|2:2|3:1", "AIF1RX"},
1610 {"DAI3 RX Mux", "1:2|2:3|3:1", "AIF1RX"},
1611 {"DAI3 RX Mux", "1:1|2:3|3:2", "AIF2RX"},
1612 {"DAI3 RX Mux", "1:3|2:1|3:2", "AIF2RX"},
1613 {"DAI3 RX Mux", "1:1|2:2|3:3", "AIF3RX"},
1614 {"DAI3 RX Mux", "1:2|2:1|3:3", "AIF3RX"},
1615 {"DAI3 RX Mux", "1:1|2:1|3:3", "AIF3RX"},
1616 {"DAI3 RX Mux", "1:2|2:2|3:3", "AIF3RX"},
1617
1618 {"IF1 DAC", NULL, "I2S1"},
1619 {"IF1 DAC", NULL, "DAI1 RX Mux"},
1620 {"IF2 DAC", NULL, "I2S2"},
1621 {"IF2 DAC", NULL, "DAI2 RX Mux"},
1622 {"IF3 DAC", NULL, "I2S3"},
1623 {"IF3 DAC", NULL, "DAI3 RX Mux"},
1624
1625 {"IF1 DAC L", NULL, "IF1 DAC"},
1626 {"IF1 DAC R", NULL, "IF1 DAC"},
1627 {"IF2 DAC L", NULL, "IF2 DAC"},
1628 {"IF2 DAC R", NULL, "IF2 DAC"},
1629 {"IF3 DAC L", NULL, "IF3 DAC"},
1630 {"IF3 DAC R", NULL, "IF3 DAC"},
1631
1632 {"DAC MIXL", "Stereo ADC Switch", "Stereo ADC MIXL"},
1633 {"DAC MIXL", "INF1 Switch", "IF1 DAC L"},
1634 {"DAC MIXR", "Stereo ADC Switch", "Stereo ADC MIXR"},
1635 {"DAC MIXR", "INF1 Switch", "IF1 DAC R"},
1636
1637 {"ANC", NULL, "Stereo ADC MIXL"},
1638 {"ANC", NULL, "Stereo ADC MIXR"},
1639
1640 {"Audio DSP", NULL, "DAC MIXL"},
1641 {"Audio DSP", NULL, "DAC MIXR"},
1642
1643 {"DAC L2 Mux", "IF2", "IF2 DAC L"},
1644 {"DAC L2 Mux", "IF3", "IF3 DAC L"},
1645 {"DAC L2 Mux", "Base L/R", "Audio DSP"},
1646
1647 {"DAC R2 Mux", "IF2", "IF2 DAC R"},
1648 {"DAC R2 Mux", "IF3", "IF3 DAC R"},
1649
1650 {"Stereo DAC MIXL", "DAC L1 Switch", "DAC MIXL"},
1651 {"Stereo DAC MIXL", "DAC L2 Switch", "DAC L2 Mux"},
1652 {"Stereo DAC MIXL", "ANC Switch", "ANC"},
1653 {"Stereo DAC MIXR", "DAC R1 Switch", "DAC MIXR"},
1654 {"Stereo DAC MIXR", "DAC R2 Switch", "DAC R2 Mux"},
1655 {"Stereo DAC MIXR", "ANC Switch", "ANC"},
1656
1657 {"Mono DAC MIXL", "DAC L1 Switch", "DAC MIXL"},
1658 {"Mono DAC MIXL", "DAC L2 Switch", "DAC L2 Mux"},
1659 {"Mono DAC MIXL", "DAC R2 Switch", "DAC R2 Mux"},
1660 {"Mono DAC MIXR", "DAC R1 Switch", "DAC MIXR"},
1661 {"Mono DAC MIXR", "DAC R2 Switch", "DAC R2 Mux"},
1662 {"Mono DAC MIXR", "DAC L2 Switch", "DAC L2 Mux"},
1663
1664 {"DIG MIXL", "DAC L1 Switch", "DAC MIXL"},
1665 {"DIG MIXL", "DAC L2 Switch", "DAC L2 Mux"},
1666 {"DIG MIXR", "DAC R1 Switch", "DAC MIXR"},
1667 {"DIG MIXR", "DAC R2 Switch", "DAC R2 Mux"},
1668
1669 {"DAC L1", NULL, "Stereo DAC MIXL"},
1670 {"DAC L1", NULL, "PLL1", check_sysclk1_source},
1671 {"DAC R1", NULL, "Stereo DAC MIXR"},
1672 {"DAC R1", NULL, "PLL1", check_sysclk1_source},
1673
1674 {"SPK MIXL", "REC MIXL Switch", "RECMIXL"},
1675 {"SPK MIXL", "INL Switch", "INL VOL"},
1676 {"SPK MIXL", "DAC L1 Switch", "DAC L1"},
1677 {"SPK MIXL", "DAC L2 Switch", "DAC L2"},
1678 {"SPK MIXL", "OUT MIXL Switch", "OUT MIXL"},
1679 {"SPK MIXR", "REC MIXR Switch", "RECMIXR"},
1680 {"SPK MIXR", "INR Switch", "INR VOL"},
1681 {"SPK MIXR", "DAC R1 Switch", "DAC R1"},
1682 {"SPK MIXR", "DAC R2 Switch", "DAC R2"},
1683 {"SPK MIXR", "OUT MIXR Switch", "OUT MIXR"},
1684
1685 {"OUT MIXL", "SPK MIXL Switch", "SPK MIXL"},
1686 {"OUT MIXL", "BST1 Switch", "BST1"},
1687 {"OUT MIXL", "INL Switch", "INL VOL"},
1688 {"OUT MIXL", "REC MIXL Switch", "RECMIXL"},
1689 {"OUT MIXL", "DAC R2 Switch", "DAC R2"},
1690 {"OUT MIXL", "DAC L2 Switch", "DAC L2"},
1691 {"OUT MIXL", "DAC L1 Switch", "DAC L1"},
1692
1693 {"OUT MIXR", "SPK MIXR Switch", "SPK MIXR"},
1694 {"OUT MIXR", "BST2 Switch", "BST2"},
1695 {"OUT MIXR", "BST1 Switch", "BST1"},
1696 {"OUT MIXR", "INR Switch", "INR VOL"},
1697 {"OUT MIXR", "REC MIXR Switch", "RECMIXR"},
1698 {"OUT MIXR", "DAC L2 Switch", "DAC L2"},
1699 {"OUT MIXR", "DAC R2 Switch", "DAC R2"},
1700 {"OUT MIXR", "DAC R1 Switch", "DAC R1"},
1701
1702 {"SPKVOL L", NULL, "SPK MIXL"},
1703 {"SPKVOL R", NULL, "SPK MIXR"},
1704 {"HPOVOL L", NULL, "OUT MIXL"},
1705 {"HPOVOL R", NULL, "OUT MIXR"},
1706 {"OUTVOL L", NULL, "OUT MIXL"},
1707 {"OUTVOL R", NULL, "OUT MIXR"},
1708
1709 {"SPOL MIX", "DAC R1 Switch", "DAC R1"},
1710 {"SPOL MIX", "DAC L1 Switch", "DAC L1"},
1711 {"SPOL MIX", "SPKVOL R Switch", "SPKVOL R"},
1712 {"SPOL MIX", "SPKVOL L Switch", "SPKVOL L"},
1713 {"SPOL MIX", "BST1 Switch", "BST1"},
1714 {"SPOR MIX", "DAC R1 Switch", "DAC R1"},
1715 {"SPOR MIX", "SPKVOL R Switch", "SPKVOL R"},
1716 {"SPOR MIX", "BST1 Switch", "BST1"},
1717
1718 {"HPOL MIX", "DAC2 Switch", "DAC L2"},
1719 {"HPOL MIX", "DAC1 Switch", "DAC L1"},
1720 {"HPOL MIX", "HPVOL Switch", "HPOVOL L"},
1721 {"HPOR MIX", "DAC2 Switch", "DAC R2"},
1722 {"HPOR MIX", "DAC1 Switch", "DAC R1"},
1723 {"HPOR MIX", "HPVOL Switch", "HPOVOL R"},
1724
1725 {"LOUT MIX", "DAC L1 Switch", "DAC L1"},
1726 {"LOUT MIX", "DAC R1 Switch", "DAC R1"},
1727 {"LOUT MIX", "OUTVOL L Switch", "OUTVOL L"},
1728 {"LOUT MIX", "OUTVOL R Switch", "OUTVOL R"},
1729
1730 {"Mono MIX", "DAC R2 Switch", "DAC R2"},
1731 {"Mono MIX", "DAC L2 Switch", "DAC L2"},
1732 {"Mono MIX", "OUTVOL R Switch", "OUTVOL R"},
1733 {"Mono MIX", "OUTVOL L Switch", "OUTVOL L"},
1734 {"Mono MIX", "BST1 Switch", "BST1"},
1735
1736 {"SPOLP", NULL, "Improve SPK amp drv"},
1737 {"SPOLN", NULL, "Improve SPK amp drv"},
1738 {"SPORP", NULL, "Improve SPK amp drv"},
1739 {"SPORN", NULL, "Improve SPK amp drv"},
1740 {"SPOLP", NULL, "SPOL MIX"},
1741 {"SPOLN", NULL, "SPOL MIX"},
1742 {"SPORP", NULL, "SPOR MIX"},
1743 {"SPORN", NULL, "SPOR MIX"},
1744
1745 {"HP L amp", NULL, "HPOL MIX"},
1746 {"HP R amp", NULL, "HPOR MIX"},
1747 {"HPOL", NULL, "Improve HP amp drv"},
1748 {"HPOR", NULL, "Improve HP amp drv"},
1749 {"HPOL", NULL, "HP L amp"},
1750 {"HPOR", NULL, "HP R amp"},
1751
1752 {"LOUTL", NULL, "LOUT MIX"},
1753 {"LOUTR", NULL, "LOUT MIX"},
1754};
1755
1756static int get_sdp_info(struct snd_soc_codec *codec, int dai_id)
1757{
1758 int ret = 0, val = snd_soc_read(codec, RT5639_I2S1_SDP);
1759
1760 if(codec == NULL)
1761 return -EINVAL;
1762
1763 val = (val & RT5639_I2S_IF_MASK) >> RT5639_I2S_IF_SFT;
1764 switch (dai_id) {
1765 case RT5639_AIF1:
1766 if (val == RT5639_IF_123 || val == RT5639_IF_132 ||
1767 val == RT5639_IF_113)
1768 ret |= RT5639_U_IF1;
1769 if (val == RT5639_IF_312 || val == RT5639_IF_213 ||
1770 val == RT5639_IF_113)
1771 ret |= RT5639_U_IF2;
1772 if (val == RT5639_IF_321 || val == RT5639_IF_231)
1773 ret |= RT5639_U_IF3;
1774 break;
1775
1776 case RT5639_AIF2:
1777 if (val == RT5639_IF_231 || val == RT5639_IF_213 ||
1778 val == RT5639_IF_223)
1779 ret |= RT5639_U_IF1;
1780 if (val == RT5639_IF_123 || val == RT5639_IF_321 ||
1781 val == RT5639_IF_223)
1782 ret |= RT5639_U_IF2;
1783 if (val == RT5639_IF_132 || val == RT5639_IF_312)
1784 ret |= RT5639_U_IF3;
1785 break;
1786
1787 default:
1788 ret = -EINVAL;
1789 break;
1790 }
1791
1792 return ret;
1793}
1794
1795static int get_clk_info(int sclk, int rate)
1796{
1797 int i, pd[] = {1, 2, 3, 4, 6, 8, 12, 16};
1798
1799 if(sclk <= 0 || rate <= 0)
1800 return -EINVAL;
1801
1802 rate = rate << 8;
1803 for (i = 0; i < ARRAY_SIZE(pd); i++)
1804 if (sclk == rate * pd[i])
1805 return i;
1806
1807 return -EINVAL;
1808}
1809
1810static int rt5639_hw_params(struct snd_pcm_substream *substream,
1811 struct snd_pcm_hw_params *params, struct snd_soc_dai *dai)
1812{
1813 struct snd_soc_pcm_runtime *rtd = substream->private_data;
1814 struct snd_soc_codec *codec = rtd->codec;
1815 struct rt5639_priv *rt5639 = snd_soc_codec_get_drvdata(codec);
1816 unsigned int val_len = 0, val_clk, mask_clk, dai_sel;
1817 int pre_div, bclk_ms, frame_size;
1818
1819 rt5639->lrck[dai->id] = params_rate(params);
1820 pre_div = get_clk_info(rt5639->sysclk, rt5639->lrck[dai->id]);
1821 if (pre_div < 0) {
1822 dev_err(codec->dev, "Unsupported clock setting\n");
1823 return -EINVAL;
1824 }
1825 frame_size = snd_soc_params_to_frame_size(params);
1826 if (frame_size < 0) {
1827 dev_err(codec->dev, "Unsupported frame size: %d\n", frame_size);
1828 return -EINVAL;
1829 }
1830 bclk_ms = frame_size > 32 ? 1 : 0;
1831 rt5639->bclk[dai->id] = rt5639->lrck[dai->id] * (32 << bclk_ms);
1832
1833 dev_dbg(dai->dev, "bclk is %dHz and lrck is %dHz\n",
1834 rt5639->bclk[dai->id], rt5639->lrck[dai->id]);
1835 dev_dbg(dai->dev, "bclk_ms is %d and pre_div is %d for iis %d\n",
1836 bclk_ms, pre_div, dai->id);
1837
1838 switch (params_format(params)) {
1839 case SNDRV_PCM_FORMAT_S16_LE:
1840 break;
1841 case SNDRV_PCM_FORMAT_S20_3LE:
1842 val_len |= RT5639_I2S_DL_20;
1843 break;
1844 case SNDRV_PCM_FORMAT_S24_LE:
1845 val_len |= RT5639_I2S_DL_24;
1846 break;
1847 case SNDRV_PCM_FORMAT_S8:
1848 val_len |= RT5639_I2S_DL_8;
1849 break;
1850 default:
1851 return -EINVAL;
1852 }
1853
1854 dai_sel = get_sdp_info(codec, dai->id);
1855 if (dai_sel < 0) {
1856 dev_err(codec->dev, "Failed to get sdp info: %d\n", dai_sel);
1857 return -EINVAL;
1858 }
1859 if (dai_sel & RT5639_U_IF1) {
1860 mask_clk = RT5639_I2S_BCLK_MS1_MASK | RT5639_I2S_PD1_MASK;
1861 val_clk = bclk_ms << RT5639_I2S_BCLK_MS1_SFT |
1862 pre_div << RT5639_I2S_PD1_SFT;
1863 snd_soc_update_bits(codec, RT5639_I2S1_SDP,
1864 RT5639_I2S_DL_MASK, val_len);
1865 snd_soc_update_bits(codec, RT5639_ADDA_CLK1, mask_clk, val_clk);
1866 }
1867 if (dai_sel & RT5639_U_IF2) {
1868 mask_clk = RT5639_I2S_BCLK_MS2_MASK | RT5639_I2S_PD2_MASK;
1869 val_clk = bclk_ms << RT5639_I2S_BCLK_MS2_SFT |
1870 pre_div << RT5639_I2S_PD2_SFT;
1871 snd_soc_update_bits(codec, RT5639_I2S2_SDP,
1872 RT5639_I2S_DL_MASK, val_len);
1873 snd_soc_update_bits(codec, RT5639_ADDA_CLK1, mask_clk, val_clk);
1874 }
1875
1876 return 0;
1877}
1878
1879static int rt5639_prepare(struct snd_pcm_substream *substream,
1880 struct snd_soc_dai *dai)
1881{
1882 struct snd_soc_pcm_runtime *rtd = substream->private_data;
1883 struct snd_soc_codec *codec = rtd->codec;
1884 struct rt5639_priv *rt5639 = snd_soc_codec_get_drvdata(codec);
1885
1886 rt5639->aif_pu = dai->id;
1887 return 0;
1888}
1889
1890static int rt5639_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt)
1891{
1892 struct snd_soc_codec *codec = dai->codec;
1893 struct rt5639_priv *rt5639 = snd_soc_codec_get_drvdata(codec);
1894 unsigned int reg_val = 0, dai_sel;
1895
1896 switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
1897 case SND_SOC_DAIFMT_CBM_CFM:
1898 rt5639->master[dai->id] = 1;
1899 break;
1900 case SND_SOC_DAIFMT_CBS_CFS:
1901 reg_val |= RT5639_I2S_MS_S;
1902 rt5639->master[dai->id] = 0;
1903 break;
1904 default:
1905 return -EINVAL;
1906 }
1907
1908 switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
1909 case SND_SOC_DAIFMT_NB_NF:
1910 break;
1911 case SND_SOC_DAIFMT_IB_NF:
1912 reg_val |= RT5639_I2S_BP_INV;
1913 break;
1914 default:
1915 return -EINVAL;
1916 }
1917
1918 switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
1919 case SND_SOC_DAIFMT_I2S:
1920 break;
1921 case SND_SOC_DAIFMT_LEFT_J:
1922 reg_val |= RT5639_I2S_DF_LEFT;
1923 break;
1924 case SND_SOC_DAIFMT_DSP_A:
1925 reg_val |= RT5639_I2S_DF_PCM_A;
1926 break;
1927 case SND_SOC_DAIFMT_DSP_B:
1928 reg_val |= RT5639_I2S_DF_PCM_B;
1929 break;
1930 default:
1931 return -EINVAL;
1932 }
1933
1934 dai_sel = get_sdp_info(codec, dai->id);
1935 if (dai_sel < 0) {
1936 dev_err(codec->dev, "Failed to get sdp info: %d\n", dai_sel);
1937 return -EINVAL;
1938 }
1939 if (dai_sel & RT5639_U_IF1) {
1940 snd_soc_update_bits(codec, RT5639_I2S1_SDP,
1941 RT5639_I2S_MS_MASK | RT5639_I2S_BP_MASK |
1942 RT5639_I2S_DF_MASK, reg_val);
1943 }
1944 if (dai_sel & RT5639_U_IF2) {
1945 snd_soc_update_bits(codec, RT5639_I2S2_SDP,
1946 RT5639_I2S_MS_MASK | RT5639_I2S_BP_MASK |
1947 RT5639_I2S_DF_MASK, reg_val);
1948 }
1949
1950 return 0;
1951}
1952
1953static int rt5639_set_dai_sysclk(struct snd_soc_dai *dai,
1954 int clk_id, unsigned int freq, int dir)
1955{
1956 struct snd_soc_codec *codec = dai->codec;
1957 struct rt5639_priv *rt5639 = snd_soc_codec_get_drvdata(codec);
1958 unsigned int reg_val = 0;
1959
1960 if (freq == rt5639->sysclk && clk_id == rt5639->sysclk_src)
1961 return 0;
1962
1963 switch (clk_id) {
1964 case RT5639_SCLK_S_MCLK:
1965 reg_val |= RT5639_SCLK_SRC_MCLK;
1966 break;
1967 case RT5639_SCLK_S_PLL1:
1968 reg_val |= RT5639_SCLK_SRC_PLL1;
1969 break;
1970 case RT5639_SCLK_S_RCCLK:
1971 reg_val |= RT5639_SCLK_SRC_RCCLK;
1972 break;
1973 default:
1974 dev_err(codec->dev, "Invalid clock id (%d)\n", clk_id);
1975 return -EINVAL;
1976 }
1977 snd_soc_update_bits(codec, RT5639_GLB_CLK,
1978 RT5639_SCLK_SRC_MASK, reg_val);
1979 rt5639->sysclk = freq;
1980 rt5639->sysclk_src = clk_id;
1981
1982 dev_dbg(dai->dev, "Sysclk is %dHz and clock id is %d\n", freq, clk_id);
1983
1984 return 0;
1985}
1986
1987/**
1988 * rt5639_pll_calc - Calcualte PLL M/N/K code.
1989 * @freq_in: external clock provided to codec.
1990 * @freq_out: target clock which codec works on.
1991 * @pll_code: Pointer to structure with M, N, K and bypass flag.
1992 *
1993 * Calcualte M/N/K code to configure PLL for codec. And K is assigned to 2
1994 * which make calculation more efficiently.
1995 *
1996 * Returns 0 for success or negative error code.
1997 */
1998static int rt5639_pll_calc(const unsigned int freq_in,
1999 const unsigned int freq_out, struct rt5639_pll_code *pll_code)
2000{
2001 int max_n = RT5639_PLL_N_MAX, max_m = RT5639_PLL_M_MAX;
2002 int n, m, red, n_t, m_t, in_t, out_t, red_t = abs(freq_out - freq_in);
2003 bool bypass = false;
2004
2005 if (RT5639_PLL_INP_MAX < freq_in || RT5639_PLL_INP_MIN > freq_in)
2006 return -EINVAL;
2007
2008 for (n_t = 0; n_t <= max_n; n_t++) {
2009 in_t = (freq_in >> 1) + (freq_in >> 2) * n_t;
2010 if (in_t < 0)
2011 continue;
2012 if (in_t == freq_out) {
2013 bypass = true;
2014 n = n_t;
2015 goto code_find;
2016 }
2017 for (m_t = 0; m_t <= max_m; m_t++) {
2018 out_t = in_t / (m_t + 2);
2019 red = abs(out_t - freq_out);
2020 if (red < red_t) {
2021 n = n_t;
2022 m = m_t;
2023 if(red == 0)
2024 goto code_find;
2025 red_t = red;
2026 }
2027 }
2028 }
2029 pr_debug("Only get approximation about PLL\n");
2030
2031code_find:
2032
2033 pll_code->m_bp = bypass;
2034 pll_code->m_code= m;
2035 pll_code->n_code = n;
2036 pll_code->k_code = 2;
2037 return 0;
2038}
2039
2040static int rt5639_set_dai_pll(struct snd_soc_dai *dai, int pll_id, int source,
2041 unsigned int freq_in, unsigned int freq_out)
2042{
2043 struct snd_soc_codec *codec = dai->codec;
2044 struct rt5639_priv *rt5639 = snd_soc_codec_get_drvdata(codec);
2045 struct rt5639_pll_code pll_code;
2046 int ret, dai_sel;
2047
2048 if (source == rt5639->pll_src && freq_in == rt5639->pll_in &&
2049 freq_out == rt5639->pll_out)
2050 return 0;
2051
2052 if (!freq_in || !freq_out) {
2053 dev_dbg(codec->dev, "PLL disabled\n");
2054
2055 rt5639->pll_in = 0;
2056 rt5639->pll_out = 0;
2057 snd_soc_update_bits(codec, RT5639_GLB_CLK,
2058 RT5639_SCLK_SRC_MASK, RT5639_SCLK_SRC_MCLK);
2059 return 0;
2060 }
2061
2062 switch (source) {
2063 case RT5639_PLL1_S_MCLK:
2064 snd_soc_update_bits(codec, RT5639_GLB_CLK,
2065 RT5639_PLL1_SRC_MASK, RT5639_PLL1_SRC_MCLK);
2066 break;
2067 case RT5639_PLL1_S_BCLK1:
2068 case RT5639_PLL1_S_BCLK2:
2069 dai_sel = get_sdp_info(codec, dai->id);
2070 if (dai_sel < 0) {
2071 dev_err(codec->dev,
2072 "Failed to get sdp info: %d\n", dai_sel);
2073 return -EINVAL;
2074 }
2075 if (dai_sel & RT5639_U_IF1) {
2076 snd_soc_update_bits(codec, RT5639_GLB_CLK,
2077 RT5639_PLL1_SRC_MASK, RT5639_PLL1_SRC_BCLK1);
2078 }
2079 if (dai_sel & RT5639_U_IF2) {
2080 snd_soc_update_bits(codec, RT5639_GLB_CLK,
2081 RT5639_PLL1_SRC_MASK, RT5639_PLL1_SRC_BCLK2);
2082 }
2083 if (dai_sel & RT5639_U_IF3) {
2084 snd_soc_update_bits(codec, RT5639_GLB_CLK,
2085 RT5639_PLL1_SRC_MASK, RT5639_PLL1_SRC_BCLK3);
2086 }
2087 break;
2088 default:
2089 dev_err(codec->dev, "Unknown PLL source %d\n", source);
2090 return -EINVAL;
2091 }
2092
2093 ret = rt5639_pll_calc(freq_in, freq_out, &pll_code);
2094 if (ret < 0) {
2095 dev_err(codec->dev, "Unsupport input clock %d\n", freq_in);
2096 return ret;
2097 }
2098
2099 dev_dbg(codec->dev, "bypass=%d m=%d n=%d k=2\n", pll_code.m_bp,
2100 (pll_code.m_bp ? 0 : pll_code.m_code), pll_code.n_code);
2101
2102 snd_soc_write(codec, RT5639_PLL_CTRL1,
2103 pll_code.n_code << RT5639_PLL_N_SFT | pll_code.k_code);
2104 snd_soc_write(codec, RT5639_PLL_CTRL2,
2105 (pll_code.m_bp ? 0 : pll_code.m_code) << RT5639_PLL_M_SFT |
2106 pll_code.m_bp << RT5639_PLL_M_BP_SFT);
2107
2108 rt5639->pll_in = freq_in;
2109 rt5639->pll_out = freq_out;
2110 rt5639->pll_src = source;
2111
2112 return 0;
2113}
2114
2115/**
2116 * rt5639_index_show - Dump private registers.
2117 * @dev: codec device.
2118 * @attr: device attribute.
2119 * @buf: buffer for display.
2120 *
2121 * To show non-zero values of all private registers.
2122 *
2123 * Returns buffer length.
2124 */
2125static ssize_t rt5639_index_show(struct device *dev,
2126 struct device_attribute *attr, char *buf)
2127{
2128 struct i2c_client *client = to_i2c_client(dev);
2129 struct rt5639_priv *rt5639 = i2c_get_clientdata(client);
2130 struct snd_soc_codec *codec = rt5639->codec;
2131 unsigned int val;
2132 int cnt = 0, i;
2133
2134 cnt += sprintf(buf, "RT5639 index register\n");
2135 for (i = 0; i < 0xb4; i++) {
2136 if (cnt + RT5639_REG_DISP_LEN >= PAGE_SIZE)
2137 break;
2138 val = rt5639_index_read(codec, i);
2139 if (!val)
2140 continue;
2141 cnt += snprintf(buf + cnt, RT5639_REG_DISP_LEN,
2142 "%02x: %04x\n", i, val);
2143 }
2144
2145 if (cnt >= PAGE_SIZE)
2146 cnt = PAGE_SIZE - 1;
2147
2148 return cnt;
2149}
2150static DEVICE_ATTR(index_reg, 0444, rt5639_index_show, NULL);
2151
2152static int rt5639_set_bias_level(struct snd_soc_codec *codec,
2153 enum snd_soc_bias_level level)
2154{
2155 switch (level) {
2156 case SND_SOC_BIAS_ON:
2157#ifdef RT5639_DEMO
2158 snd_soc_update_bits(codec, RT5639_SPK_VOL,
2159 RT5639_L_MUTE | RT5639_R_MUTE, 0);
2160 snd_soc_update_bits(codec, RT5639_HP_VOL,
2161 RT5639_L_MUTE | RT5639_R_MUTE, 0);
2162#endif
2163 break;
2164
2165 case SND_SOC_BIAS_PREPARE:
2166#ifdef RT5639_DEMO
2167 snd_soc_update_bits(codec, RT5639_PWR_ANLG1,
2168 RT5639_PWR_VREF1 | RT5639_PWR_MB |
2169 RT5639_PWR_BG | RT5639_PWR_VREF2,
2170 RT5639_PWR_VREF1 | RT5639_PWR_MB |
2171 RT5639_PWR_BG | RT5639_PWR_VREF2);
2172 msleep(100);
2173
2174 snd_soc_update_bits(codec, RT5639_PWR_ANLG1,
2175 RT5639_PWR_FV1 | RT5639_PWR_FV2,
2176 RT5639_PWR_FV1 | RT5639_PWR_FV2);
2177
2178 snd_soc_update_bits(codec, RT5639_PWR_ANLG2,
2179 RT5639_PWR_MB1 | RT5639_PWR_MB2,
2180 RT5639_PWR_MB1 | RT5639_PWR_MB2);
2181#endif
2182 break;
2183
2184 case SND_SOC_BIAS_STANDBY:
2185#ifdef RT5639_DEMO
2186 snd_soc_update_bits(codec, RT5639_SPK_VOL,
2187 RT5639_L_MUTE | RT5639_R_MUTE, RT5639_L_MUTE | RT5639_R_MUTE);
2188 snd_soc_update_bits(codec, RT5639_HP_VOL,
2189 RT5639_L_MUTE | RT5639_R_MUTE, RT5639_L_MUTE | RT5639_R_MUTE);
2190
2191 snd_soc_update_bits(codec, RT5639_PWR_ANLG2,
2192 RT5639_PWR_MB1 | RT5639_PWR_MB2,
2193 0);
2194#endif
2195 if (SND_SOC_BIAS_OFF == codec->dapm.bias_level) {
2196 snd_soc_update_bits(codec, RT5639_PWR_ANLG1,
2197 RT5639_PWR_VREF1 | RT5639_PWR_MB |
2198 RT5639_PWR_BG | RT5639_PWR_VREF2,
2199 RT5639_PWR_VREF1 | RT5639_PWR_MB |
2200 RT5639_PWR_BG | RT5639_PWR_VREF2);
2201 msleep(10);
2202 snd_soc_update_bits(codec, RT5639_PWR_ANLG1,
2203 RT5639_PWR_FV1 | RT5639_PWR_FV2,
2204 RT5639_PWR_FV1 | RT5639_PWR_FV2);
2205 codec->cache_only = false;
2206 snd_soc_cache_sync(codec);
2207 }
2208 break;
2209
2210 case SND_SOC_BIAS_OFF:
2211#ifdef RT5639_DEMO
2212 snd_soc_update_bits(codec, RT5639_SPK_VOL,
2213 RT5639_L_MUTE | RT5639_R_MUTE, RT5639_L_MUTE | RT5639_R_MUTE);
2214 snd_soc_update_bits(codec, RT5639_HP_VOL,
2215 RT5639_L_MUTE | RT5639_R_MUTE, RT5639_L_MUTE | RT5639_R_MUTE);
2216 snd_soc_update_bits(codec, RT5639_OUTPUT,
2217 RT5639_L_MUTE | RT5639_R_MUTE, RT5639_L_MUTE | RT5639_R_MUTE);
2218 snd_soc_update_bits(codec, RT5639_MONO_OUT,
2219 RT5639_L_MUTE, RT5639_L_MUTE);
2220#endif
2221 snd_soc_write(codec, RT5639_PWR_DIG1, 0x0000);
2222 snd_soc_write(codec, RT5639_PWR_DIG2, 0x0000);
2223 snd_soc_write(codec, RT5639_PWR_VOL, 0x0000);
2224 snd_soc_write(codec, RT5639_PWR_MIXER, 0x0000);
2225 snd_soc_write(codec, RT5639_PWR_ANLG1, 0x0000);
2226 snd_soc_write(codec, RT5639_PWR_ANLG2, 0x0000);
2227 break;
2228
2229 default:
2230 break;
2231 }
2232 codec->dapm.bias_level = level;
2233
2234 return 0;
2235}
2236
2237static int rt5639_probe(struct snd_soc_codec *codec)
2238{
2239 struct rt5639_priv *rt5639 = snd_soc_codec_get_drvdata(codec);
2240 int ret;
2241
2242 ret = snd_soc_codec_set_cache_io(codec, 8, 16, SND_SOC_I2C);
2243 if (ret != 0) {
2244 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
2245 return ret;
2246 }
2247
2248 rt5639_reset(codec);
2249 snd_soc_update_bits(codec, RT5639_PWR_ANLG1,
2250 RT5639_PWR_VREF1 | RT5639_PWR_MB |
2251 RT5639_PWR_BG | RT5639_PWR_VREF2,
2252 RT5639_PWR_VREF1 | RT5639_PWR_MB |
2253 RT5639_PWR_BG | RT5639_PWR_VREF2);
2254 msleep(100);
2255 snd_soc_update_bits(codec, RT5639_PWR_ANLG1,
2256 RT5639_PWR_FV1 | RT5639_PWR_FV2,
2257 RT5639_PWR_FV1 | RT5639_PWR_FV2);
2258 /* DMIC */
2259 if (rt5639->dmic_en == RT5639_DMIC1) {
2260 snd_soc_update_bits(codec, RT5639_GPIO_CTRL1,
2261 RT5639_GP2_PIN_MASK, RT5639_GP2_PIN_DMIC1_SCL);
2262 snd_soc_update_bits(codec, RT5639_DMIC,
2263 RT5639_DMIC_1L_LH_MASK | RT5639_DMIC_1R_LH_MASK,
2264 RT5639_DMIC_1L_LH_FALLING | RT5639_DMIC_1R_LH_RISING);
2265 } else if (rt5639->dmic_en == RT5639_DMIC2) {
2266 snd_soc_update_bits(codec, RT5639_GPIO_CTRL1,
2267 RT5639_GP2_PIN_MASK, RT5639_GP2_PIN_DMIC1_SCL);
2268 snd_soc_update_bits(codec, RT5639_DMIC,
2269 RT5639_DMIC_2L_LH_MASK | RT5639_DMIC_2R_LH_MASK,
2270 RT5639_DMIC_2L_LH_FALLING | RT5639_DMIC_2R_LH_RISING);
2271 }
2272
2273#ifdef RT5639_DEMO
2274 rt5639_reg_init(codec);
2275#endif
2276
2277 codec->dapm.bias_level = SND_SOC_BIAS_STANDBY;
2278
2279 snd_soc_add_controls(codec, rt5639_snd_controls,
2280 ARRAY_SIZE(rt5639_snd_controls));
2281
2282 rt5639->codec = codec;
2283 ret = device_create_file(codec->dev, &dev_attr_index_reg);
2284 if (ret != 0) {
2285 dev_err(codec->dev,
2286 "Failed to create index_reg sysfs files: %d\n", ret);
2287 return ret;
2288 }
2289
2290 return 0;
2291}
2292
2293static int rt5639_remove(struct snd_soc_codec *codec)
2294{
2295 rt5639_set_bias_level(codec, SND_SOC_BIAS_OFF);
2296 return 0;
2297}
2298
2299#ifdef CONFIG_PM
2300static int rt5639_suspend(struct snd_soc_codec *codec, pm_message_t state)
2301{
2302 rt5639_set_bias_level(codec, SND_SOC_BIAS_OFF);
2303 return 0;
2304}
2305
2306static int rt5639_resume(struct snd_soc_codec *codec)
2307{
2308 rt5639_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
2309 return 0;
2310}
2311#else
2312#define rt5639_suspend NULL
2313#define rt5639_resume NULL
2314#endif
2315
2316#define RT5639_STEREO_RATES SNDRV_PCM_RATE_8000_96000
2317#define RT5639_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE | \
2318 SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S8)
2319
2320struct snd_soc_dai_ops rt5639_aif_dai_ops = {
2321 .hw_params = rt5639_hw_params,
2322 .prepare = rt5639_prepare,
2323 .set_fmt = rt5639_set_dai_fmt,
2324 .set_sysclk = rt5639_set_dai_sysclk,
2325 .set_pll = rt5639_set_dai_pll,
2326};
2327
2328struct snd_soc_dai_driver rt5639_dai[] = {
2329 {
2330 .name = "rt5639-aif1",
2331 .id = RT5639_AIF1,
2332 .playback = {
2333 .stream_name = "AIF1 Playback",
2334 .channels_min = 1,
2335 .channels_max = 2,
2336 .rates = RT5639_STEREO_RATES,
2337 .formats = RT5639_FORMATS,
2338 },
2339 .capture = {
2340 .stream_name = "AIF1 Capture",
2341 .channels_min = 1,
2342 .channels_max = 2,
2343 .rates = RT5639_STEREO_RATES,
2344 .formats = RT5639_FORMATS,
2345 },
2346 .ops = &rt5639_aif_dai_ops,
2347 },
2348 {
2349 .name = "rt5639-aif2",
2350 .id = RT5639_AIF2,
2351 .playback = {
2352 .stream_name = "AIF2 Playback",
2353 .channels_min = 1,
2354 .channels_max = 2,
2355 .rates = RT5639_STEREO_RATES,
2356 .formats = RT5639_FORMATS,
2357 },
2358 .capture = {
2359 .stream_name = "AIF2 Capture",
2360 .channels_min = 1,
2361 .channels_max = 2,
2362 .rates = RT5639_STEREO_RATES,
2363 .formats = RT5639_FORMATS,
2364 },
2365 .ops = &rt5639_aif_dai_ops,
2366 },
2367};
2368
2369static struct snd_soc_codec_driver soc_codec_dev_rt5639 = {
2370 .probe = rt5639_probe,
2371 .remove = rt5639_remove,
2372 .suspend = rt5639_suspend,
2373 .resume = rt5639_resume,
2374 .set_bias_level = rt5639_set_bias_level,
2375 .reg_cache_size = RT5639_VENDOR_ID2 + 1,
2376 .reg_word_size = sizeof(u16),
2377 .reg_cache_default = rt5639_reg,
2378 .volatile_register = rt5639_volatile_register,
2379 .readable_register = rt5639_readable_register,
2380 .reg_cache_step = 1,
2381 .dapm_widgets = rt5639_dapm_widgets,
2382 .num_dapm_widgets = ARRAY_SIZE(rt5639_dapm_widgets),
2383 .dapm_routes = rt5639_dapm_routes,
2384 .num_dapm_routes = ARRAY_SIZE(rt5639_dapm_routes),
2385};
2386
2387static const struct i2c_device_id rt5639_i2c_id[] = {
2388 { "rt5639", 0 },
2389 { }
2390};
2391MODULE_DEVICE_TABLE(i2c, rt5639_i2c_id);
2392
2393static int rt5639_i2c_probe(struct i2c_client *i2c,
2394 const struct i2c_device_id *id)
2395{
2396 struct rt5639_priv *rt5639;
2397 int ret;
2398
2399 rt5639 = kzalloc(sizeof(struct rt5639_priv), GFP_KERNEL);
2400 if (NULL == rt5639)
2401 return -ENOMEM;
2402
2403 i2c_set_clientdata(i2c, rt5639);
2404
2405 ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_rt5639,
2406 rt5639_dai, ARRAY_SIZE(rt5639_dai));
2407 if (ret < 0)
2408 kfree(rt5639);
2409
2410 return ret;
2411}
2412
2413static __devexit int rt5639_i2c_remove(struct i2c_client *i2c)
2414{
2415 snd_soc_unregister_codec(&i2c->dev);
2416 kfree(i2c_get_clientdata(i2c));
2417 return 0;
2418}
2419
2420struct i2c_driver rt5639_i2c_driver = {
2421 .driver = {
2422 .name = "rt5639",
2423 .owner = THIS_MODULE,
2424 },
2425 .probe = rt5639_i2c_probe,
2426 .remove = __devexit_p(rt5639_i2c_remove),
2427 .id_table = rt5639_i2c_id,
2428};
2429
2430static int __init rt5639_modinit(void)
2431{
2432 return i2c_add_driver(&rt5639_i2c_driver);
2433}
2434module_init(rt5639_modinit);
2435
2436static void __exit rt5639_modexit(void)
2437{
2438 i2c_del_driver(&rt5639_i2c_driver);
2439}
2440module_exit(rt5639_modexit);
2441
2442MODULE_DESCRIPTION("ASoC RT5639 driver");
2443MODULE_AUTHOR("Johnny Hsu <johnnyhsu@realtek.com>");
2444MODULE_LICENSE("GPL");
diff --git a/sound/soc/codecs/rt5639.h b/sound/soc/codecs/rt5639.h
new file mode 100644
index 00000000000..f75ddad1aa0
--- /dev/null
+++ b/sound/soc/codecs/rt5639.h
@@ -0,0 +1,2104 @@
1/*
2 * rt5639.h -- RT5639 ALSA SoC audio driver
3 *
4 * Copyright 2011 Realtek Microelectronics
5 * Author: Johnny Hsu <johnnyhsu@realtek.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef __RT5639_H__
13#define __RT5639_H__
14
15/* Info */
16#define RT5639_RESET 0x00
17#define RT5639_VENDOR_ID 0xfd
18#define RT5639_VENDOR_ID1 0xfe
19#define RT5639_VENDOR_ID2 0xff
20/* I/O - Output */
21#define RT5639_SPK_VOL 0x01
22#define RT5639_HP_VOL 0x02
23#define RT5639_OUTPUT 0x03
24#define RT5639_MONO_OUT 0x04
25/* I/O - Input */
26#define RT5639_IN1_IN2 0x0d
27#define RT5639_IN3_IN4 0x0e
28#define RT5639_INL_INR_VOL 0x0f
29/* I/O - ADC/DAC/DMIC */
30#define RT5639_DAC1_DIG_VOL 0x19
31#define RT5639_DAC2_DIG_VOL 0x1a
32#define RT5639_DAC2_CTRL 0x1b
33#define RT5639_ADC_DIG_VOL 0x1c
34#define RT5639_ADC_DATA 0x1d
35#define RT5639_ADC_BST_VOL 0x1e
36/* Mixer - D-D */
37#define RT5639_STO_ADC_MIXER 0x27
38#define RT5639_MONO_ADC_MIXER 0x28
39#define RT5639_AD_DA_MIXER 0x29
40#define RT5639_STO_DAC_MIXER 0x2a
41#define RT5639_MONO_DAC_MIXER 0x2b
42#define RT5639_DIG_MIXER 0x2c
43#define RT5639_DSP_PATH1 0x2d
44#define RT5639_DSP_PATH2 0x2e
45#define RT5639_DIG_INF_DATA 0x2f
46/* Mixer - ADC */
47#define RT5639_REC_L1_MIXER 0x3b
48#define RT5639_REC_L2_MIXER 0x3c
49#define RT5639_REC_R1_MIXER 0x3d
50#define RT5639_REC_R2_MIXER 0x3e
51/* Mixer - DAC */
52#define RT5639_HPO_MIXER 0x45
53#define RT5639_SPK_L_MIXER 0x46
54#define RT5639_SPK_R_MIXER 0x47
55#define RT5639_SPO_L_MIXER 0x48
56#define RT5639_SPO_R_MIXER 0x49
57#define RT5639_SPO_CLSD_RATIO 0x4a
58#define RT5639_MONO_MIXER 0x4c
59#define RT5639_OUT_L1_MIXER 0x4d
60#define RT5639_OUT_L2_MIXER 0x4e
61#define RT5639_OUT_L3_MIXER 0x4f
62#define RT5639_OUT_R1_MIXER 0x50
63#define RT5639_OUT_R2_MIXER 0x51
64#define RT5639_OUT_R3_MIXER 0x52
65#define RT5639_LOUT_MIXER 0x53
66/* Power */
67#define RT5639_PWR_DIG1 0x61
68#define RT5639_PWR_DIG2 0x62
69#define RT5639_PWR_ANLG1 0x63
70#define RT5639_PWR_ANLG2 0x64
71#define RT5639_PWR_MIXER 0x65
72#define RT5639_PWR_VOL 0x66
73/* Private Register Control */
74#define RT5639_PRIV_INDEX 0x6a
75#define RT5639_PRIV_DATA 0x6c
76/* Format - ADC/DAC */
77#define RT5639_I2S1_SDP 0x70
78#define RT5639_I2S2_SDP 0x71
79#define RT5639_I2S3_SDP 0x72
80#define RT5639_ADDA_CLK1 0x73
81#define RT5639_ADDA_CLK2 0x74
82#define RT5639_DMIC 0x75
83/* Function - Analog */
84#define RT5639_GLB_CLK 0x80
85#define RT5639_PLL_CTRL1 0x81
86#define RT5639_PLL_CTRL2 0x82
87#define RT5639_ASRC_1 0x83
88#define RT5639_ASRC_2 0x84
89#define RT5639_ASRC_3 0x85
90#define RT5639_ASRC_4 0x89
91#define RT5639_ASRC_5 0x8a
92#define RT5639_HP_OVCD 0x8b
93#define RT5639_CLS_D_OVCD 0x8c
94#define RT5639_CLS_D_OUT 0x8d
95#define RT5639_DEPOP_M1 0x8e
96#define RT5639_DEPOP_M2 0x8f
97#define RT5639_DEPOP_M3 0x90
98#define RT5639_CHARGE_PUMP 0x91
99#define RT5639_PV_DET_SPK_G 0x92
100#define RT5639_MICBIAS 0x93
101/* Function - Digital */
102#define RT5639_EQ_CTRL1 0xb0
103#define RT5639_EQ_CTRL2 0xb1
104#define RT5639_WIND_FILTER 0xb2
105#define RT5639_DRC_AGC_1 0xb4
106#define RT5639_DRC_AGC_2 0xb5
107#define RT5639_DRC_AGC_3 0xb6
108#define RT5639_SVOL_ZC 0xb7
109#define RT5639_ANC_CTRL1 0xb8
110#define RT5639_ANC_CTRL2 0xb9
111#define RT5639_ANC_CTRL3 0xba
112#define RT5639_JD_CTRL 0xbb
113#define RT5639_ANC_JD 0xbc
114#define RT5639_IRQ_CTRL1 0xbd
115#define RT5639_IRQ_CTRL2 0xbe
116#define RT5639_INT_IRQ_ST 0xbf
117#define RT5639_GPIO_CTRL1 0xc0
118#define RT5639_GPIO_CTRL2 0xc1
119#define RT5639_GPIO_CTRL3 0xc2
120#define RT5639_DSP_CTRL1 0xc4
121#define RT5639_DSP_CTRL2 0xc5
122#define RT5639_DSP_CTRL3 0xc6
123#define RT5639_DSP_CTRL4 0xc7
124#define RT5639_PGM_REG_ARR1 0xc8
125#define RT5639_PGM_REG_ARR2 0xc9
126#define RT5639_PGM_REG_ARR3 0xca
127#define RT5639_PGM_REG_ARR4 0xcb
128#define RT5639_PGM_REG_ARR5 0xcc
129#define RT5639_SCB_FUNC 0xcd
130#define RT5639_SCB_CTRL 0xce
131#define RT5639_BASE_BACK 0xcf
132#define RT5639_MP3_PLUS1 0xd0
133#define RT5639_MP3_PLUS2 0xd1
134#define RT5639_3D_HP 0xd2
135#define RT5639_ADJ_HPF 0xd3
136#define RT5639_HP_CALIB_AMP_DET 0xd6
137#define RT5639_HP_CALIB2 0xd7
138#define RT5639_SV_ZCD1 0xd9
139#define RT5639_SV_ZCD2 0xda
140/* Dummy Register */
141#define RT5639_DUMMY1 0xfa
142#define RT5639_DUMMY2 0xfb
143#define RT5639_DUMMY3 0xfc
144
145
146/* Index of Codec Private Register definition */
147#define RT5639_3D_SPK 0x63
148#define RT5639_WND_1 0x6c
149#define RT5639_WND_2 0x6d
150#define RT5639_WND_3 0x6e
151#define RT5639_WND_4 0x6f
152#define RT5639_WND_5 0x70
153#define RT5639_WND_8 0x73
154#define RT5639_DIP_SPK_INF 0x75
155#define RT5639_EQ_BW_LOP 0xa0
156#define RT5639_EQ_GN_LOP 0xa1
157#define RT5639_EQ_FC_BP1 0xa2
158#define RT5639_EQ_BW_BP1 0xa3
159#define RT5639_EQ_GN_BP1 0xa4
160#define RT5639_EQ_FC_BP2 0xa5
161#define RT5639_EQ_BW_BP2 0xa6
162#define RT5639_EQ_GN_BP2 0xa7
163#define RT5639_EQ_FC_BP3 0xa8
164#define RT5639_EQ_BW_BP3 0xa9
165#define RT5639_EQ_GN_BP3 0xaa
166#define RT5639_EQ_FC_BP4 0xab
167#define RT5639_EQ_BW_BP4 0xac
168#define RT5639_EQ_GN_BP4 0xad
169#define RT5639_EQ_FC_HIP1 0xae
170#define RT5639_EQ_GN_HIP1 0xaf
171#define RT5639_EQ_FC_HIP2 0xb0
172#define RT5639_EQ_BW_HIP2 0xb1
173#define RT5639_EQ_GN_HIP2 0xb2
174#define RT5639_EQ_PRE_VOL 0xb3
175#define RT5639_EQ_PST_VOL 0xb4
176
177
178/* global definition */
179#define RT5639_L_MUTE (0x1 << 15)
180#define RT5639_L_MUTE_SFT 15
181#define RT5639_VOL_L_MUTE (0x1 << 14)
182#define RT5639_VOL_L_SFT 14
183#define RT5639_R_MUTE (0x1 << 7)
184#define RT5639_R_MUTE_SFT 7
185#define RT5639_VOL_R_MUTE (0x1 << 6)
186#define RT5639_VOL_R_SFT 6
187#define RT5639_L_VOL_MASK (0x3f << 8)
188#define RT5639_L_VOL_SFT 8
189#define RT5639_R_VOL_MASK (0x3f)
190#define RT5639_R_VOL_SFT 0
191
192/* IN1 and IN2 Control (0x0d) */
193/* IN3 and IN4 Control (0x0e) */
194#define RT5639_BST_SFT1 12
195#define RT5639_BST_SFT2 8
196#define RT5639_IN_DF1 (0x1 << 7)
197#define RT5639_IN_SFT1 7
198#define RT5639_IN_DF2 (0x1 << 6)
199#define RT5639_IN_SFT2 6
200
201/* INL and INR Volume Control (0x0f) */
202#define RT5639_INL_SEL_MASK (0x1 << 15)
203#define RT5639_INL_SEL_SFT 15
204#define RT5639_INL_SEL_IN4P (0x0 << 15)
205#define RT5639_INL_SEL_MONOP (0x1 << 15)
206#define RT5639_INL_VOL_MASK (0x1f << 8)
207#define RT5639_INL_VOL_SFT 8
208#define RT5639_INR_SEL_MASK (0x1 << 7)
209#define RT5639_INR_SEL_SFT 7
210#define RT5639_INR_SEL_IN4N (0x0 << 7)
211#define RT5639_INR_SEL_MONON (0x1 << 7)
212#define RT5639_INR_VOL_MASK (0x1f)
213#define RT5639_INR_VOL_SFT 0
214
215/* DAC1 Digital Volume (0x19) */
216#define RT5639_DAC_L1_VOL_MASK (0xff << 8)
217#define RT5639_DAC_L1_VOL_SFT 8
218#define RT5639_DAC_R1_VOL_MASK (0xff)
219#define RT5639_DAC_R1_VOL_SFT 0
220
221/* DAC2 Digital Volume (0x1a) */
222#define RT5639_DAC_L2_VOL_MASK (0xff << 8)
223#define RT5639_DAC_L2_VOL_SFT 8
224#define RT5639_DAC_R2_VOL_MASK (0xff)
225#define RT5639_DAC_R2_VOL_SFT 0
226
227/* DAC2 Control (0x1b) */
228#define RT5639_M_DAC_L2_VOL (0x1 << 13)
229#define RT5639_M_DAC_L2_VOL_SFT 13
230#define RT5639_M_DAC_R2_VOL (0x1 << 12)
231#define RT5639_M_DAC_R2_VOL_SFT 12
232
233/* ADC Digital Volume Control (0x1c) */
234#define RT5639_ADC_L_VOL_MASK (0x7f << 8)
235#define RT5639_ADC_L_VOL_SFT 8
236#define RT5639_ADC_R_VOL_MASK (0x7f)
237#define RT5639_ADC_R_VOL_SFT 0
238
239/* Mono ADC Digital Volume Control (0x1d) */
240#define RT5639_MONO_ADC_L_VOL_MASK (0x7f << 8)
241#define RT5639_MONO_ADC_L_VOL_SFT 8
242#define RT5639_MONO_ADC_R_VOL_MASK (0x7f)
243#define RT5639_MONO_ADC_R_VOL_SFT 0
244
245/* ADC Boost Volume Control (0x1e) */
246#define RT5639_ADC_L_BST_MASK (0x3 << 14)
247#define RT5639_ADC_L_BST_SFT 14
248#define RT5639_ADC_R_BST_MASK (0x3 << 12)
249#define RT5639_ADC_R_BST_SFT 12
250#define RT5639_ADC_COMP_MASK (0x3 << 10)
251#define RT5639_ADC_COMP_SFT 10
252
253/* Stereo ADC Mixer Control (0x27) */
254#define RT5639_M_ADC_L1 (0x1 << 14)
255#define RT5639_M_ADC_L1_SFT 14
256#define RT5639_M_ADC_L2 (0x1 << 13)
257#define RT5639_M_ADC_L2_SFT 13
258#define RT5639_ADC_1_SRC_MASK (0x1 << 12)
259#define RT5639_ADC_1_SRC_SFT 12
260#define RT5639_ADC_1_SRC_ADC (0x1 << 12)
261#define RT5639_ADC_1_SRC_DACMIX (0x0 << 12)
262#define RT5639_ADC_2_SRC_MASK (0x3 << 10)
263#define RT5639_ADC_2_SRC_SFT 10
264#define RT5639_ADC_2_SRC_DMIC1 (0x0 << 10)
265#define RT5639_ADC_2_SRC_DMIC2 (0x1 << 10)
266#define RT5639_ADC_2_SRC_DACMIX (0x2 << 10)
267#define RT5639_M_ADC_R1 (0x1 << 6)
268#define RT5639_M_ADC_R1_SFT 6
269#define RT5639_M_ADC_R2 (0x1 << 5)
270#define RT5639_M_ADC_R2_SFT 5
271
272/* Mono ADC Mixer Control (0x28) */
273#define RT5639_M_MONO_ADC_L1 (0x1 << 14)
274#define RT5639_M_MONO_ADC_L1_SFT 14
275#define RT5639_M_MONO_ADC_L2 (0x1 << 13)
276#define RT5639_M_MONO_ADC_L2_SFT 13
277#define RT5639_MONO_ADC_L1_SRC_MASK (0x1 << 12)
278#define RT5639_MONO_ADC_L1_SRC_SFT 12
279#define RT5639_MONO_ADC_L1_SRC_DACMIXL (0x0 << 12)
280#define RT5639_MONO_ADC_L1_SRC_ADCL (0x1 << 12)
281#define RT5639_MONO_ADC_L2_SRC_MASK (0x3 << 10)
282#define RT5639_MONO_ADC_L2_SRC_SFT 10
283#define RT5639_MONO_ADC_L2_SRC_DMIC_L1 (0x0 << 10)
284#define RT5639_MONO_ADC_L2_SRC_DMIC_L2 (0x1 << 10)
285#define RT5639_MONO_ADC_L2_SRC_DACMIXL (0x2 << 10)
286#define RT5639_M_MONO_ADC_R1 (0x1 << 6)
287#define RT5639_M_MONO_ADC_R1_SFT 6
288#define RT5639_M_MONO_ADC_R2 (0x1 << 5)
289#define RT5639_M_MONO_ADC_R2_SFT 5
290#define RT5639_MONO_ADC_R1_SRC_MASK (0x1 << 4)
291#define RT5639_MONO_ADC_R1_SRC_SFT 4
292#define RT5639_MONO_ADC_R1_SRC_ADCR (0x1 << 4)
293#define RT5639_MONO_ADC_R1_SRC_DACMIXR (0x0 << 4)
294#define RT5639_MONO_ADC_R2_SRC_MASK (0x3 << 2)
295#define RT5639_MONO_ADC_R2_SRC_SFT 2
296#define RT5639_MONO_ADC_R2_SRC_DMIC_R1 (0x0 << 2)
297#define RT5639_MONO_ADC_R2_SRC_DMIC_R2 (0x1 << 2)
298#define RT5639_MONO_ADC_R2_SRC_DACMIXR (0x2 << 2)
299
300/* ADC Mixer to DAC Mixer Control (0x29) */
301#define RT5639_M_ADCMIX_L (0x1 << 15)
302#define RT5639_M_ADCMIX_L_SFT 15
303#define RT5639_M_IF1_DAC_L (0x1 << 14)
304#define RT5639_M_IF1_DAC_L_SFT 14
305#define RT5639_M_ADCMIX_R (0x1 << 7)
306#define RT5639_M_ADCMIX_R_SFT 7
307#define RT5639_M_IF1_DAC_R (0x1 << 6)
308#define RT5639_M_IF1_DAC_R_SFT 6
309
310/* Stereo DAC Mixer Control (0x2a) */
311#define RT5639_M_DAC_L1 (0x1 << 14)
312#define RT5639_M_DAC_L1_SFT 14
313#define RT5639_DAC_L1_STO_L_VOL_MASK (0x1 << 13)
314#define RT5639_DAC_L1_STO_L_VOL_SFT 13
315#define RT5639_M_DAC_L2 (0x1 << 12)
316#define RT5639_M_DAC_L2_SFT 12
317#define RT5639_DAC_L2_STO_L_VOL_MASK (0x1 << 11)
318#define RT5639_DAC_L2_STO_L_VOL_SFT 11
319#define RT5639_M_ANC_DAC_L (0x1 << 10)
320#define RT5639_M_ANC_DAC_L_SFT 10
321#define RT5639_M_DAC_R1 (0x1 << 6)
322#define RT5639_M_DAC_R1_SFT 6
323#define RT5639_DAC_R1_STO_R_VOL_MASK (0x1 << 5)
324#define RT5639_DAC_R1_STO_R_VOL_SFT 5
325#define RT5639_M_DAC_R2 (0x1 << 4)
326#define RT5639_M_DAC_R2_SFT 4
327#define RT5639_DAC_R2_STO_R_VOL_MASK (0x1 << 3)
328#define RT5639_DAC_R2_STO_R_VOL_SFT 3
329#define RT5639_M_ANC_DAC_R (0x1 << 2)
330#define RT5639_M_ANC_DAC_R_SFT 2
331
332/* Mono DAC Mixer Control (0x2b) */
333#define RT5639_M_DAC_L1_MONO_L (0x1 << 14)
334#define RT5639_M_DAC_L1_MONO_L_SFT 14
335#define RT5639_DAC_L1_MONO_L_VOL_MASK (0x1 << 13)
336#define RT5639_DAC_L1_MONO_L_VOL_SFT 13
337#define RT5639_M_DAC_L2_MONO_L (0x1 << 12)
338#define RT5639_M_DAC_L2_MONO_L_SFT 12
339#define RT5639_DAC_L2_MONO_L_VOL_MASK (0x1 << 11)
340#define RT5639_DAC_L2_MONO_L_VOL_SFT 11
341#define RT5639_M_DAC_R2_MONO_L (0x1 << 10)
342#define RT5639_M_DAC_R2_MONO_L_SFT 10
343#define RT5639_DAC_R2_MONO_L_VOL_MASK (0x1 << 9)
344#define RT5639_DAC_R2_MONO_L_VOL_SFT 9
345#define RT5639_M_DAC_R1_MONO_R (0x1 << 6)
346#define RT5639_M_DAC_R1_MONO_R_SFT 6
347#define RT5639_DAC_R1_MONO_R_VOL_MASK (0x1 << 5)
348#define RT5639_DAC_R1_MONO_R_VOL_SFT 5
349#define RT5639_M_DAC_R2_MONO_R (0x1 << 4)
350#define RT5639_M_DAC_R2_MONO_R_SFT 4
351#define RT5639_DAC_R2_MONO_R_VOL_MASK (0x1 << 3)
352#define RT5639_DAC_R2_MONO_R_VOL_SFT 3
353#define RT5639_M_DAC_L2_MONO_R (0x1 << 2)
354#define RT5639_M_DAC_L2_MONO_R_SFT 2
355#define RT5639_DAC_L2_MONO_R_VOL_MASK (0x1 << 1)
356#define RT5639_DAC_L2_MONO_R_VOL_SFT 1
357
358/* Digital Mixer Control (0x2c) */
359#define RT5639_M_STO_L_DAC_L (0x1 << 15)
360#define RT5639_M_STO_L_DAC_L_SFT 15
361#define RT5639_STO_L_DAC_L_VOL_MASK (0x1 << 14)
362#define RT5639_STO_L_DAC_L_VOL_SFT 14
363#define RT5639_M_DAC_L2_DAC_L (0x1 << 13)
364#define RT5639_M_DAC_L2_DAC_L_SFT 13
365#define RT5639_DAC_L2_DAC_L_VOL_MASK (0x1 << 12)
366#define RT5639_DAC_L2_DAC_L_VOL_SFT 12
367#define RT5639_M_STO_R_DAC_R (0x1 << 11)
368#define RT5639_M_STO_R_DAC_R_SFT 11
369#define RT5639_STO_R_DAC_R_VOL_MASK (0x1 << 10)
370#define RT5639_STO_R_DAC_R_VOL_SFT 10
371#define RT5639_M_DAC_R2_DAC_R (0x1 << 9)
372#define RT5639_M_DAC_R2_DAC_R_SFT 9
373#define RT5639_DAC_R2_DAC_R_VOL_MASK (0x1 << 8)
374#define RT5639_DAC_R2_DAC_R_VOL_SFT 8
375
376/* DSP Path Control 1 (0x2d) */
377#define RT5639_RXDP_SRC_MASK (0x1 << 15)
378#define RT5639_RXDP_SRC_SFT 15
379#define RT5639_RXDP_SRC_NOR (0x0 << 15)
380#define RT5639_RXDP_SRC_DIV3 (0x1 << 15)
381#define RT5639_TXDP_SRC_MASK (0x1 << 14)
382#define RT5639_TXDP_SRC_SFT 14
383#define RT5639_TXDP_SRC_NOR (0x0 << 14)
384#define RT5639_TXDP_SRC_DIV3 (0x1 << 14)
385
386/* DSP Path Control 2 (0x2e) */
387#define RT5639_DAC_L2_SEL_MASK (0x3 << 14)
388#define RT5639_DAC_L2_SEL_SFT 14
389#define RT5639_DAC_L2_SEL_IF2 (0x0 << 14)
390#define RT5639_DAC_L2_SEL_IF3 (0x1 << 14)
391#define RT5639_DAC_L2_SEL_TXDC (0x2 << 14)
392#define RT5639_DAC_L2_SEL_BASS (0x3 << 14)
393#define RT5639_DAC_R2_SEL_MASK (0x3 << 12)
394#define RT5639_DAC_R2_SEL_SFT 12
395#define RT5639_DAC_R2_SEL_IF2 (0x0 << 12)
396#define RT5639_DAC_R2_SEL_IF3 (0x1 << 12)
397#define RT5639_DAC_R2_SEL_TXDC (0x2 << 12)
398#define RT5639_IF2_ADC_L_SEL_MASK (0x1 << 11)
399#define RT5639_IF2_ADC_L_SEL_SFT 11
400#define RT5639_IF2_ADC_L_SEL_TXDP (0x0 << 11)
401#define RT5639_IF2_ADC_L_SEL_PASS (0x1 << 11)
402#define RT5639_IF2_ADC_R_SEL_MASK (0x1 << 10)
403#define RT5639_IF2_ADC_R_SEL_SFT 10
404#define RT5639_IF2_ADC_R_SEL_TXDP (0x0 << 10)
405#define RT5639_IF2_ADC_R_SEL_PASS (0x1 << 10)
406#define RT5639_RXDC_SEL_MASK (0x3 << 8)
407#define RT5639_RXDC_SEL_SFT 8
408#define RT5639_RXDC_SEL_NOR (0x0 << 8)
409#define RT5639_RXDC_SEL_L2R (0x1 << 8)
410#define RT5639_RXDC_SEL_R2L (0x2 << 8)
411#define RT5639_RXDC_SEL_SWAP (0x3 << 8)
412#define RT5639_RXDP_SEL_MASK (0x3 << 6)
413#define RT5639_RXDP_SEL_SFT 6
414#define RT5639_RXDP_SEL_NOR (0x0 << 6)
415#define RT5639_RXDP_SEL_L2R (0x1 << 6)
416#define RT5639_RXDP_SEL_R2L (0x2 << 6)
417#define RT5639_RXDP_SEL_SWAP (0x3 << 6)
418#define RT5639_TXDC_SEL_MASK (0x3 << 4)
419#define RT5639_TXDC_SEL_SFT 4
420#define RT5639_TXDC_SEL_NOR (0x0 << 4)
421#define RT5639_TXDC_SEL_L2R (0x1 << 4)
422#define RT5639_TXDC_SEL_R2L (0x2 << 4)
423#define RT5639_TXDC_SEL_SWAP (0x3 << 4)
424#define RT5639_TXDP_SEL_MASK (0x3 << 2)
425#define RT5639_TXDP_SEL_SFT 2
426#define RT5639_TXDP_SEL_NOR (0x0 << 2)
427#define RT5639_TXDP_SEL_L2R (0x1 << 2)
428#define RT5639_TXDP_SEL_R2L (0x2 << 2)
429#define RT5639_TRXDP_SEL_SWAP (0x3 << 2)
430
431/* Digital Interface Data Control (0x2f) */
432#define RT5639_IF1_DAC_SEL_MASK (0x3 << 14)
433#define RT5639_IF1_DAC_SEL_SFT 14
434#define RT5639_IF1_DAC_SEL_NOR (0x0 << 14)
435#define RT5639_IF1_DAC_SEL_L2R (0x1 << 14)
436#define RT5639_IF1_DAC_SEL_R2L (0x2 << 14)
437#define RT5639_IF1_DAC_SEL_SWAP (0x3 << 14)
438#define RT5639_IF1_ADC_SEL_MASK (0x3 << 12)
439#define RT5639_IF1_ADC_SEL_SFT 12
440#define RT5639_IF1_ADC_SEL_NOR (0x0 << 12)
441#define RT5639_IF1_ADC_SEL_L2R (0x1 << 12)
442#define RT5639_IF1_ADC_SEL_R2L (0x2 << 12)
443#define RT5639_IF1_ADC_SEL_SWAP (0x3 << 12)
444#define RT5639_IF2_DAC_SEL_MASK (0x3 << 10)
445#define RT5639_IF2_DAC_SEL_SFT 10
446#define RT5639_IF2_DAC_SEL_NOR (0x0 << 10)
447#define RT5639_IF2_DAC_SEL_L2R (0x1 << 10)
448#define RT5639_IF2_DAC_SEL_R2L (0x2 << 10)
449#define RT5639_IF2_DAC_SEL_SWAP (0x3 << 10)
450#define RT5639_IF2_ADC_SEL_MASK (0x3 << 8)
451#define RT5639_IF2_ADC_SEL_SFT 8
452#define RT5639_IF2_ADC_SEL_NOR (0x0 << 8)
453#define RT5639_IF2_ADC_SEL_L2R (0x1 << 8)
454#define RT5639_IF2_ADC_SEL_R2L (0x2 << 8)
455#define RT5639_IF2_ADC_SEL_SWAP (0x3 << 8)
456#define RT5639_IF3_DAC_SEL_MASK (0x3 << 6)
457#define RT5639_IF3_DAC_SEL_SFT 6
458#define RT5639_IF3_DAC_SEL_NOR (0x0 << 6)
459#define RT5639_IF3_DAC_SEL_L2R (0x1 << 6)
460#define RT5639_IF3_DAC_SEL_R2L (0x2 << 6)
461#define RT5639_IF3_DAC_SEL_SWAP (0x3 << 6)
462#define RT5639_IF3_ADC_SEL_MASK (0x3 << 4)
463#define RT5639_IF3_ADC_SEL_SFT 4
464#define RT5639_IF3_ADC_SEL_NOR (0x0 << 4)
465#define RT5639_IF3_ADC_SEL_L2R (0x1 << 4)
466#define RT5639_IF3_ADC_SEL_R2L (0x2 << 4)
467#define RT5639_IF3_ADC_SEL_SWAP (0x3 << 4)
468
469/* REC Left Mixer Control 1 (0x3b) */
470#define RT5639_G_HP_L_RM_L_MASK (0x7 << 13)
471#define RT5639_G_HP_L_RM_L_SFT 13
472#define RT5639_G_IN_L_RM_L_MASK (0x7 << 10)
473#define RT5639_G_IN_L_RM_L_SFT 10
474#define RT5639_G_BST4_RM_L_MASK (0x7 << 7)
475#define RT5639_G_BST4_RM_L_SFT 7
476#define RT5639_G_BST3_RM_L_MASK (0x7 << 4)
477#define RT5639_G_BST3_RM_L_SFT 4
478#define RT5639_G_BST2_RM_L_MASK (0x7 << 1)
479#define RT5639_G_BST2_RM_L_SFT 1
480
481/* REC Left Mixer Control 2 (0x3c) */
482#define RT5639_G_BST1_RM_L_MASK (0x7 << 13)
483#define RT5639_G_BST1_RM_L_SFT 13
484#define RT5639_G_OM_L_RM_L_MASK (0x7 << 10)
485#define RT5639_G_OM_L_RM_L_SFT 10
486#define RT5639_M_HP_L_RM_L (0x1 << 6)
487#define RT5639_M_HP_L_RM_L_SFT 6
488#define RT5639_M_IN_L_RM_L (0x1 << 5)
489#define RT5639_M_IN_L_RM_L_SFT 5
490#define RT5639_M_BST4_RM_L (0x1 << 4)
491#define RT5639_M_BST4_RM_L_SFT 4
492#define RT5639_M_BST3_RM_L (0x1 << 3)
493#define RT5639_M_BST3_RM_L_SFT 3
494#define RT5639_M_BST2_RM_L (0x1 << 2)
495#define RT5639_M_BST2_RM_L_SFT 2
496#define RT5639_M_BST1_RM_L (0x1 << 1)
497#define RT5639_M_BST1_RM_L_SFT 1
498#define RT5639_M_OM_L_RM_L (0x1)
499#define RT5639_M_OM_L_RM_L_SFT 0
500
501/* REC Right Mixer Control 1 (0x3d) */
502#define RT5639_G_HP_R_RM_R_MASK (0x7 << 13)
503#define RT5639_G_HP_R_RM_R_SFT 13
504#define RT5639_G_IN_R_RM_R_MASK (0x7 << 10)
505#define RT5639_G_IN_R_RM_R_SFT 10
506#define RT5639_G_BST4_RM_R_MASK (0x7 << 7)
507#define RT5639_G_BST4_RM_R_SFT 7
508#define RT5639_G_BST3_RM_R_MASK (0x7 << 4)
509#define RT5639_G_BST3_RM_R_SFT 4
510#define RT5639_G_BST2_RM_R_MASK (0x7 << 1)
511#define RT5639_G_BST2_RM_R_SFT 1
512
513/* REC Right Mixer Control 2 (0x3e) */
514#define RT5639_G_BST1_RM_R_MASK (0x7 << 13)
515#define RT5639_G_BST1_RM_R_SFT 13
516#define RT5639_G_OM_R_RM_R_MASK (0x7 << 10)
517#define RT5639_G_OM_R_RM_R_SFT 10
518#define RT5639_M_HP_R_RM_R (0x1 << 6)
519#define RT5639_M_HP_R_RM_R_SFT 6
520#define RT5639_M_IN_R_RM_R (0x1 << 5)
521#define RT5639_M_IN_R_RM_R_SFT 5
522#define RT5639_M_BST4_RM_R (0x1 << 4)
523#define RT5639_M_BST4_RM_R_SFT 4
524#define RT5639_M_BST3_RM_R (0x1 << 3)
525#define RT5639_M_BST3_RM_R_SFT 3
526#define RT5639_M_BST2_RM_R (0x1 << 2)
527#define RT5639_M_BST2_RM_R_SFT 2
528#define RT5639_M_BST1_RM_R (0x1 << 1)
529#define RT5639_M_BST1_RM_R_SFT 1
530#define RT5639_M_OM_R_RM_R (0x1)
531#define RT5639_M_OM_R_RM_R_SFT 0
532
533/* HPMIX Control (0x45) */
534#define RT5639_M_DAC2_HM (0x1 << 15)
535#define RT5639_M_DAC2_HM_SFT 15
536#define RT5639_M_DAC1_HM (0x1 << 14)
537#define RT5639_M_DAC1_HM_SFT 14
538#define RT5639_M_HPVOL_HM (0x1 << 13)
539#define RT5639_M_HPVOL_HM_SFT 13
540#define RT5639_G_HPOMIX_MASK (0x1 << 12)
541#define RT5639_G_HPOMIX_SFT 12
542
543/* SPK Left Mixer Control (0x46) */
544#define RT5639_G_RM_L_SM_L_MASK (0x3 << 14)
545#define RT5639_G_RM_L_SM_L_SFT 14
546#define RT5639_G_IN_L_SM_L_MASK (0x3 << 12)
547#define RT5639_G_IN_L_SM_L_SFT 12
548#define RT5639_G_DAC_L1_SM_L_MASK (0x3 << 10)
549#define RT5639_G_DAC_L1_SM_L_SFT 10
550#define RT5639_G_DAC_L2_SM_L_MASK (0x3 << 8)
551#define RT5639_G_DAC_L2_SM_L_SFT 8
552#define RT5639_G_OM_L_SM_L_MASK (0x3 << 6)
553#define RT5639_G_OM_L_SM_L_SFT 6
554#define RT5639_M_RM_L_SM_L (0x1 << 5)
555#define RT5639_M_RM_L_SM_L_SFT 5
556#define RT5639_M_IN_L_SM_L (0x1 << 4)
557#define RT5639_M_IN_L_SM_L_SFT 4
558#define RT5639_M_DAC_L1_SM_L (0x1 << 3)
559#define RT5639_M_DAC_L1_SM_L_SFT 3
560#define RT5639_M_DAC_L2_SM_L (0x1 << 2)
561#define RT5639_M_DAC_L2_SM_L_SFT 2
562#define RT5639_M_OM_L_SM_L (0x1 << 1)
563#define RT5639_M_OM_L_SM_L_SFT 1
564
565/* SPK Right Mixer Control (0x47) */
566#define RT5639_G_RM_R_SM_R_MASK (0x3 << 14)
567#define RT5639_G_RM_R_SM_R_SFT 14
568#define RT5639_G_IN_R_SM_R_MASK (0x3 << 12)
569#define RT5639_G_IN_R_SM_R_SFT 12
570#define RT5639_G_DAC_R1_SM_R_MASK (0x3 << 10)
571#define RT5639_G_DAC_R1_SM_R_SFT 10
572#define RT5639_G_DAC_R2_SM_R_MASK (0x3 << 8)
573#define RT5639_G_DAC_R2_SM_R_SFT 8
574#define RT5639_G_OM_R_SM_R_MASK (0x3 << 6)
575#define RT5639_G_OM_R_SM_R_SFT 6
576#define RT5639_M_RM_R_SM_R (0x1 << 5)
577#define RT5639_M_RM_R_SM_R_SFT 5
578#define RT5639_M_IN_R_SM_R (0x1 << 4)
579#define RT5639_M_IN_R_SM_R_SFT 4
580#define RT5639_M_DAC_R1_SM_R (0x1 << 3)
581#define RT5639_M_DAC_R1_SM_R_SFT 3
582#define RT5639_M_DAC_R2_SM_R (0x1 << 2)
583#define RT5639_M_DAC_R2_SM_R_SFT 2
584#define RT5639_M_OM_R_SM_R (0x1 << 1)
585#define RT5639_M_OM_R_SM_R_SFT 1
586
587/* SPOLMIX Control (0x48) */
588#define RT5639_M_DAC_R1_SPM_L (0x1 << 15)
589#define RT5639_M_DAC_R1_SPM_L_SFT 15
590#define RT5639_M_DAC_L1_SPM_L (0x1 << 14)
591#define RT5639_M_DAC_L1_SPM_L_SFT 14
592#define RT5639_M_SV_R_SPM_L (0x1 << 13)
593#define RT5639_M_SV_R_SPM_L_SFT 13
594#define RT5639_M_SV_L_SPM_L (0x1 << 12)
595#define RT5639_M_SV_L_SPM_L_SFT 12
596#define RT5639_M_BST1_SPM_L (0x1 << 11)
597#define RT5639_M_BST1_SPM_L_SFT 11
598
599/* SPORMIX Control (0x49) */
600#define RT5639_M_DAC_R1_SPM_R (0x1 << 13)
601#define RT5639_M_DAC_R1_SPM_R_SFT 13
602#define RT5639_M_SV_R_SPM_R (0x1 << 12)
603#define RT5639_M_SV_R_SPM_R_SFT 12
604#define RT5639_M_BST1_SPM_R (0x1 << 11)
605#define RT5639_M_BST1_SPM_R_SFT 11
606
607/* SPOLMIX / SPORMIX Ratio Control (0x4a) */
608#define RT5639_SPO_CLSD_RATIO_MASK (0x7)
609#define RT5639_SPO_CLSD_RATIO_SFT 0
610
611/* Mono Output Mixer Control (0x4c) */
612#define RT5639_M_DAC_R2_MM (0x1 << 15)
613#define RT5639_M_DAC_R2_MM_SFT 15
614#define RT5639_M_DAC_L2_MM (0x1 << 14)
615#define RT5639_M_DAC_L2_MM_SFT 14
616#define RT5639_M_OV_R_MM (0x1 << 13)
617#define RT5639_M_OV_R_MM_SFT 13
618#define RT5639_M_OV_L_MM (0x1 << 12)
619#define RT5639_M_OV_L_MM_SFT 12
620#define RT5639_M_BST1_MM (0x1 << 11)
621#define RT5639_M_BST1_MM_SFT 11
622#define RT5639_G_MONOMIX_MASK (0x1 << 10)
623#define RT5639_G_MONOMIX_SFT 10
624
625/* Output Left Mixer Control 1 (0x4d) */
626#define RT5639_G_BST3_OM_L_MASK (0x7 << 13)
627#define RT5639_G_BST3_OM_L_SFT 13
628#define RT5639_G_BST2_OM_L_MASK (0x7 << 10)
629#define RT5639_G_BST2_OM_L_SFT 10
630#define RT5639_G_BST1_OM_L_MASK (0x7 << 7)
631#define RT5639_G_BST1_OM_L_SFT 7
632#define RT5639_G_IN_L_OM_L_MASK (0x7 << 4)
633#define RT5639_G_IN_L_OM_L_SFT 4
634#define RT5639_G_RM_L_OM_L_MASK (0x7 << 1)
635#define RT5639_G_RM_L_OM_L_SFT 1
636
637/* Output Left Mixer Control 2 (0x4e) */
638#define RT5639_G_DAC_R2_OM_L_MASK (0x7 << 13)
639#define RT5639_G_DAC_R2_OM_L_SFT 13
640#define RT5639_G_DAC_L2_OM_L_MASK (0x7 << 10)
641#define RT5639_G_DAC_L2_OM_L_SFT 10
642#define RT5639_G_DAC_L1_OM_L_MASK (0x7 << 7)
643#define RT5639_G_DAC_L1_OM_L_SFT 7
644
645/* Output Left Mixer Control 3 (0x4f) */
646#define RT5639_M_SM_L_OM_L (0x1 << 8)
647#define RT5639_M_SM_L_OM_L_SFT 8
648#define RT5639_M_BST3_OM_L (0x1 << 7)
649#define RT5639_M_BST3_OM_L_SFT 7
650#define RT5639_M_BST2_OM_L (0x1 << 6)
651#define RT5639_M_BST2_OM_L_SFT 6
652#define RT5639_M_BST1_OM_L (0x1 << 5)
653#define RT5639_M_BST1_OM_L_SFT 5
654#define RT5639_M_IN_L_OM_L (0x1 << 4)
655#define RT5639_M_IN_L_OM_L_SFT 4
656#define RT5639_M_RM_L_OM_L (0x1 << 3)
657#define RT5639_M_RM_L_OM_L_SFT 3
658#define RT5639_M_DAC_R2_OM_L (0x1 << 2)
659#define RT5639_M_DAC_R2_OM_L_SFT 2
660#define RT5639_M_DAC_L2_OM_L (0x1 << 1)
661#define RT5639_M_DAC_L2_OM_L_SFT 1
662#define RT5639_M_DAC_L1_OM_L (0x1)
663#define RT5639_M_DAC_L1_OM_L_SFT 0
664
665/* Output Right Mixer Control 1 (0x50) */
666#define RT5639_G_BST4_OM_R_MASK (0x7 << 13)
667#define RT5639_G_BST4_OM_R_SFT 13
668#define RT5639_G_BST2_OM_R_MASK (0x7 << 10)
669#define RT5639_G_BST2_OM_R_SFT 10
670#define RT5639_G_BST1_OM_R_MASK (0x7 << 7)
671#define RT5639_G_BST1_OM_R_SFT 7
672#define RT5639_G_IN_R_OM_R_MASK (0x7 << 4)
673#define RT5639_G_IN_R_OM_R_SFT 4
674#define RT5639_G_RM_R_OM_R_MASK (0x7 << 1)
675#define RT5639_G_RM_R_OM_R_SFT 1
676
677/* Output Right Mixer Control 2 (0x51) */
678#define RT5639_G_DAC_L2_OM_R_MASK (0x7 << 13)
679#define RT5639_G_DAC_L2_OM_R_SFT 13
680#define RT5639_G_DAC_R2_OM_R_MASK (0x7 << 10)
681#define RT5639_G_DAC_R2_OM_R_SFT 10
682#define RT5639_G_DAC_R1_OM_R_MASK (0x7 << 7)
683#define RT5639_G_DAC_R1_OM_R_SFT 7
684
685/* Output Right Mixer Control 3 (0x52) */
686#define RT5639_M_SM_L_OM_R (0x1 << 8)
687#define RT5639_M_SM_L_OM_R_SFT 8
688#define RT5639_M_BST4_OM_R (0x1 << 7)
689#define RT5639_M_BST4_OM_R_SFT 7
690#define RT5639_M_BST2_OM_R (0x1 << 6)
691#define RT5639_M_BST2_OM_R_SFT 6
692#define RT5639_M_BST1_OM_R (0x1 << 5)
693#define RT5639_M_BST1_OM_R_SFT 5
694#define RT5639_M_IN_R_OM_R (0x1 << 4)
695#define RT5639_M_IN_R_OM_R_SFT 4
696#define RT5639_M_RM_R_OM_R (0x1 << 3)
697#define RT5639_M_RM_R_OM_R_SFT 3
698#define RT5639_M_DAC_L2_OM_R (0x1 << 2)
699#define RT5639_M_DAC_L2_OM_R_SFT 2
700#define RT5639_M_DAC_R2_OM_R (0x1 << 1)
701#define RT5639_M_DAC_R2_OM_R_SFT 1
702#define RT5639_M_DAC_R1_OM_R (0x1)
703#define RT5639_M_DAC_R1_OM_R_SFT 0
704
705/* LOUT Mixer Control (0x53) */
706#define RT5639_M_DAC_L1_LM (0x1 << 15)
707#define RT5639_M_DAC_L1_LM_SFT 15
708#define RT5639_M_DAC_R1_LM (0x1 << 14)
709#define RT5639_M_DAC_R1_LM_SFT 14
710#define RT5639_M_OV_L_LM (0x1 << 13)
711#define RT5639_M_OV_L_LM_SFT 13
712#define RT5639_M_OV_R_LM (0x1 << 12)
713#define RT5639_M_OV_R_LM_SFT 12
714#define RT5639_G_LOUTMIX_MASK (0x1 << 11)
715#define RT5639_G_LOUTMIX_SFT 11
716
717/* Power Management for Digital 1 (0x61) */
718#define RT5639_PWR_I2S1 (0x1 << 15)
719#define RT5639_PWR_I2S1_BIT 15
720#define RT5639_PWR_I2S2 (0x1 << 14)
721#define RT5639_PWR_I2S2_BIT 14
722#define RT5639_PWR_I2S3 (0x1 << 13)
723#define RT5639_PWR_I2S3_BIT 13
724#define RT5639_PWR_DAC_L1 (0x1 << 12)
725#define RT5639_PWR_DAC_L1_BIT 12
726#define RT5639_PWR_DAC_R1 (0x1 << 11)
727#define RT5639_PWR_DAC_R1_BIT 11
728#define RT5639_PWR_DAC_L2 (0x1 << 7)
729#define RT5639_PWR_DAC_L2_BIT 7
730#define RT5639_PWR_DAC_R2 (0x1 << 6)
731#define RT5639_PWR_DAC_R2_BIT 6
732#define RT5639_PWR_ADC_L (0x1 << 2)
733#define RT5639_PWR_ADC_L_BIT 2
734#define RT5639_PWR_ADC_R (0x1 << 1)
735#define RT5639_PWR_ADC_R_BIT 1
736#define RT5639_PWR_CLS_D (0x1)
737#define RT5639_PWR_CLS_D_BIT 0
738
739/* Power Management for Digital 2 (0x62) */
740#define RT5639_PWR_ADC_SF (0x1 << 15)
741#define RT5639_PWR_ADC_SF_BIT 15
742#define RT5639_PWR_ADC_MF_L (0x1 << 14)
743#define RT5639_PWR_ADC_MF_L_BIT 14
744#define RT5639_PWR_ADC_MF_R (0x1 << 13)
745#define RT5639_PWR_ADC_MF_R_BIT 13
746#define RT5639_PWR_I2S_DSP (0x1 << 12)
747#define RT5639_PWR_I2S_DSP_BIT 12
748
749/* Power Management for Analog 1 (0x63) */
750#define RT5639_PWR_VREF1 (0x1 << 15)
751#define RT5639_PWR_VREF1_BIT 15
752#define RT5639_PWR_FV1 (0x1 << 14)
753#define RT5639_PWR_FV1_BIT 14
754#define RT5639_PWR_MB (0x1 << 13)
755#define RT5639_PWR_MB_BIT 13
756#define RT5639_PWR_LM (0x1 << 12)
757#define RT5639_PWR_LM_BIT 12
758#define RT5639_PWR_BG (0x1 << 11)
759#define RT5639_PWR_BG_BIT 11
760#define RT5639_PWR_MM (0x1 << 10)
761#define RT5639_PWR_MM_BIT 10
762#define RT5639_PWR_MA (0x1 << 8)
763#define RT5639_PWR_MA_BIT 8
764#define RT5639_PWR_HP_L (0x1 << 7)
765#define RT5639_PWR_HP_L_BIT 7
766#define RT5639_PWR_HP_R (0x1 << 6)
767#define RT5639_PWR_HP_R_BIT 6
768#define RT5639_PWR_HA (0x1 << 5)
769#define RT5639_PWR_HA_BIT 5
770#define RT5639_PWR_VREF2 (0x1 << 4)
771#define RT5639_PWR_VREF2_BIT 4
772#define RT5639_PWR_FV2 (0x1 << 3)
773#define RT5639_PWR_FV2_BIT 3
774#define RT5639_PWR_LDO2 (0x1 << 2)
775#define RT5639_PWR_LDO2_BIT 2
776
777/* Power Management for Analog 2 (0x64) */
778#define RT5639_PWR_BST1 (0x1 << 15)
779#define RT5639_PWR_BST1_BIT 15
780#define RT5639_PWR_BST2 (0x1 << 14)
781#define RT5639_PWR_BST2_BIT 14
782#define RT5639_PWR_BST3 (0x1 << 13)
783#define RT5639_PWR_BST3_BIT 13
784#define RT5639_PWR_BST4 (0x1 << 12)
785#define RT5639_PWR_BST4_BIT 12
786#define RT5639_PWR_MB1 (0x1 << 11)
787#define RT5639_PWR_MB1_BIT 11
788#define RT5639_PWR_MB2 (0x1 << 10)
789#define RT5639_PWR_MB2_BIT 10
790#define RT5639_PWR_PLL (0x1 << 9)
791#define RT5639_PWR_PLL_BIT 9
792
793/* Power Management for Mixer (0x65) */
794#define RT5639_PWR_OM_L (0x1 << 15)
795#define RT5639_PWR_OM_L_BIT 15
796#define RT5639_PWR_OM_R (0x1 << 14)
797#define RT5639_PWR_OM_R_BIT 14
798#define RT5639_PWR_SM_L (0x1 << 13)
799#define RT5639_PWR_SM_L_BIT 13
800#define RT5639_PWR_SM_R (0x1 << 12)
801#define RT5639_PWR_SM_R_BIT 12
802#define RT5639_PWR_RM_L (0x1 << 11)
803#define RT5639_PWR_RM_L_BIT 11
804#define RT5639_PWR_RM_R (0x1 << 10)
805#define RT5639_PWR_RM_R_BIT 10
806
807/* Power Management for Volume (0x66) */
808#define RT5639_PWR_SV_L (0x1 << 15)
809#define RT5639_PWR_SV_L_BIT 15
810#define RT5639_PWR_SV_R (0x1 << 14)
811#define RT5639_PWR_SV_R_BIT 14
812#define RT5639_PWR_OV_L (0x1 << 13)
813#define RT5639_PWR_OV_L_BIT 13
814#define RT5639_PWR_OV_R (0x1 << 12)
815#define RT5639_PWR_OV_R_BIT 12
816#define RT5639_PWR_HV_L (0x1 << 11)
817#define RT5639_PWR_HV_L_BIT 11
818#define RT5639_PWR_HV_R (0x1 << 10)
819#define RT5639_PWR_HV_R_BIT 10
820#define RT5639_PWR_IN_L (0x1 << 9)
821#define RT5639_PWR_IN_L_BIT 9
822#define RT5639_PWR_IN_R (0x1 << 8)
823#define RT5639_PWR_IN_R_BIT 8
824
825/* I2S1/2/3 Audio Serial Data Port Control (0x70 0x71 0x72) */
826#define RT5639_I2S_MS_MASK (0x1 << 15)
827#define RT5639_I2S_MS_SFT 15
828#define RT5639_I2S_MS_M (0x0 << 15)
829#define RT5639_I2S_MS_S (0x1 << 15)
830#define RT5639_I2S_IF_MASK (0x7 << 12)
831#define RT5639_I2S_IF_SFT 12
832#define RT5639_I2S_O_CP_MASK (0x3 << 10)
833#define RT5639_I2S_O_CP_SFT 10
834#define RT5639_I2S_O_CP_OFF (0x0 << 10)
835#define RT5639_I2S_O_CP_U_LAW (0x1 << 10)
836#define RT5639_I2S_O_CP_A_LAW (0x2 << 10)
837#define RT5639_I2S_I_CP_MASK (0x3 << 8)
838#define RT5639_I2S_I_CP_SFT 8
839#define RT5639_I2S_I_CP_OFF (0x0 << 8)
840#define RT5639_I2S_I_CP_U_LAW (0x1 << 8)
841#define RT5639_I2S_I_CP_A_LAW (0x2 << 8)
842#define RT5639_I2S_BP_MASK (0x1 << 7)
843#define RT5639_I2S_BP_SFT 7
844#define RT5639_I2S_BP_NOR (0x0 << 7)
845#define RT5639_I2S_BP_INV (0x1 << 7)
846#define RT5639_I2S_DL_MASK (0x3 << 2)
847#define RT5639_I2S_DL_SFT 2
848#define RT5639_I2S_DL_16 (0x0 << 2)
849#define RT5639_I2S_DL_20 (0x1 << 2)
850#define RT5639_I2S_DL_24 (0x2 << 2)
851#define RT5639_I2S_DL_8 (0x3 << 2)
852#define RT5639_I2S_DF_MASK (0x3)
853#define RT5639_I2S_DF_SFT 0
854#define RT5639_I2S_DF_I2S (0x0)
855#define RT5639_I2S_DF_LEFT (0x1)
856#define RT5639_I2S_DF_PCM_A (0x2)
857#define RT5639_I2S_DF_PCM_B (0x3)
858
859/* I2S2 Audio Serial Data Port Control (0x71) */
860#define RT5639_I2S2_SDI_MASK (0x1 << 6)
861#define RT5639_I2S2_SDI_SFT 6
862#define RT5639_I2S2_SDI_I2S1 (0x0 << 6)
863#define RT5639_I2S2_SDI_I2S2 (0x1 << 6)
864
865/* ADC/DAC Clock Control 1 (0x73) */
866#define RT5639_I2S_BCLK_MS1_MASK (0x1 << 15)
867#define RT5639_I2S_BCLK_MS1_SFT 15
868#define RT5639_I2S_BCLK_MS1_32 (0x0 << 15)
869#define RT5639_I2S_BCLK_MS1_64 (0x1 << 15)
870#define RT5639_I2S_PD1_MASK (0x7 << 12)
871#define RT5639_I2S_PD1_SFT 12
872#define RT5639_I2S_PD1_1 (0x0 << 12)
873#define RT5639_I2S_PD1_2 (0x1 << 12)
874#define RT5639_I2S_PD1_3 (0x2 << 12)
875#define RT5639_I2S_PD1_4 (0x3 << 12)
876#define RT5639_I2S_PD1_6 (0x4 << 12)
877#define RT5639_I2S_PD1_8 (0x5 << 12)
878#define RT5639_I2S_PD1_12 (0x6 << 12)
879#define RT5639_I2S_PD1_16 (0x7 << 12)
880#define RT5639_I2S_BCLK_MS2_MASK (0x1 << 11)
881#define RT5639_I2S_BCLK_MS2_SFT 11
882#define RT5639_I2S_BCLK_MS2_32 (0x0 << 11)
883#define RT5639_I2S_BCLK_MS2_64 (0x1 << 11)
884#define RT5639_I2S_PD2_MASK (0x7 << 8)
885#define RT5639_I2S_PD2_SFT 8
886#define RT5639_I2S_PD2_1 (0x0 << 8)
887#define RT5639_I2S_PD2_2 (0x1 << 8)
888#define RT5639_I2S_PD2_3 (0x2 << 8)
889#define RT5639_I2S_PD2_4 (0x3 << 8)
890#define RT5639_I2S_PD2_6 (0x4 << 8)
891#define RT5639_I2S_PD2_8 (0x5 << 8)
892#define RT5639_I2S_PD2_12 (0x6 << 8)
893#define RT5639_I2S_PD2_16 (0x7 << 8)
894#define RT5639_I2S_BCLK_MS3_MASK (0x1 << 7)
895#define RT5639_I2S_BCLK_MS3_SFT 7
896#define RT5639_I2S_BCLK_MS3_32 (0x0 << 7)
897#define RT5639_I2S_BCLK_MS3_64 (0x1 << 7)
898#define RT5639_I2S_PD3_MASK (0x7 << 4)
899#define RT5639_I2S_PD3_SFT 4
900#define RT5639_I2S_PD3_1 (0x0 << 4)
901#define RT5639_I2S_PD3_2 (0x1 << 4)
902#define RT5639_I2S_PD3_3 (0x2 << 4)
903#define RT5639_I2S_PD3_4 (0x3 << 4)
904#define RT5639_I2S_PD3_6 (0x4 << 4)
905#define RT5639_I2S_PD3_8 (0x5 << 4)
906#define RT5639_I2S_PD3_12 (0x6 << 4)
907#define RT5639_I2S_PD3_16 (0x7 << 4)
908#define RT5639_DAC_OSR_MASK (0x3 << 2)
909#define RT5639_DAC_OSR_SFT 2
910#define RT5639_DAC_OSR_128 (0x0 << 2)
911#define RT5639_DAC_OSR_64 (0x1 << 2)
912#define RT5639_DAC_OSR_32 (0x2 << 2)
913#define RT5639_DAC_OSR_16 (0x3 << 2)
914#define RT5639_ADC_OSR_MASK (0x3)
915#define RT5639_ADC_OSR_SFT 0
916#define RT5639_ADC_OSR_128 (0x0)
917#define RT5639_ADC_OSR_64 (0x1)
918#define RT5639_ADC_OSR_32 (0x2)
919#define RT5639_ADC_OSR_16 (0x3)
920
921/* ADC/DAC Clock Control 2 (0x74) */
922#define RT5639_DAC_L_OSR_MASK (0x3 << 14)
923#define RT5639_DAC_L_OSR_SFT 14
924#define RT5639_DAC_L_OSR_128 (0x0 << 14)
925#define RT5639_DAC_L_OSR_64 (0x1 << 14)
926#define RT5639_DAC_L_OSR_32 (0x2 << 14)
927#define RT5639_DAC_L_OSR_16 (0x3 << 14)
928#define RT5639_ADC_R_OSR_MASK (0x3 << 12)
929#define RT5639_ADC_R_OSR_SFT 12
930#define RT5639_ADC_R_OSR_128 (0x0 << 12)
931#define RT5639_ADC_R_OSR_64 (0x1 << 12)
932#define RT5639_ADC_R_OSR_32 (0x2 << 12)
933#define RT5639_ADC_R_OSR_16 (0x3 << 12)
934#define RT5639_DAHPF_EN (0x1 << 11)
935#define RT5639_DAHPF_EN_SFT 11
936#define RT5639_ADHPF_EN (0x1 << 10)
937#define RT5639_ADHPF_EN_SFT 10
938
939/* Digital Microphone Control (0x75) */
940#define RT5639_DMIC_1_EN_MASK (0x1 << 15)
941#define RT5639_DMIC_1_EN_SFT 15
942#define RT5639_DMIC_1_DIS (0x0 << 15)
943#define RT5639_DMIC_1_EN (0x1 << 15)
944#define RT5639_DMIC_2_EN_MASK (0x1 << 14)
945#define RT5639_DMIC_2_EN_SFT 14
946#define RT5639_DMIC_2_DIS (0x0 << 14)
947#define RT5639_DMIC_2_EN (0x1 << 14)
948#define RT5639_DMIC_1L_LH_MASK (0x1 << 13)
949#define RT5639_DMIC_1L_LH_SFT 13
950#define RT5639_DMIC_1L_LH_FALLING (0x0 << 13)
951#define RT5639_DMIC_1L_LH_RISING (0x1 << 13)
952#define RT5639_DMIC_1R_LH_MASK (0x1 << 12)
953#define RT5639_DMIC_1R_LH_SFT 12
954#define RT5639_DMIC_1R_LH_FALLING (0x0 << 12)
955#define RT5639_DMIC_1R_LH_RISING (0x1 << 12)
956#define RT5639_DMIC_1_DP_MASK (0x1 << 11)
957#define RT5639_DMIC_1_DP_SFT 11
958#define RT5639_DMIC_1_DP_GPIO3 (0x0 << 11)
959#define RT5639_DMIC_1_DP_IN1P (0x1 << 11)
960#define RT5639_DMIC_2_DP_MASK (0x1 << 10)
961#define RT5639_DMIC_2_DP_SFT 10
962#define RT5639_DMIC_2_DP_GPIO4 (0x0 << 10)
963#define RT5639_DMIC_2_DP_IN1N (0x1 << 10)
964#define RT5639_DMIC_2L_LH_MASK (0x1 << 9)
965#define RT5639_DMIC_2L_LH_SFT 9
966#define RT5639_DMIC_2L_LH_FALLING (0x0 << 9)
967#define RT5639_DMIC_2L_LH_RISING (0x1 << 9)
968#define RT5639_DMIC_2R_LH_MASK (0x1 << 8)
969#define RT5639_DMIC_2R_LH_SFT 8
970#define RT5639_DMIC_2R_LH_FALLING (0x0 << 8)
971#define RT5639_DMIC_2R_LH_RISING (0x1 << 8)
972#define RT5639_DMIC_CLK_MASK (0x7 << 5)
973#define RT5639_DMIC_CLK_SFT 5
974
975/* Global Clock Control (0x80) */
976#define RT5639_SCLK_SRC_MASK (0x3 << 14)
977#define RT5639_SCLK_SRC_SFT 14
978#define RT5639_SCLK_SRC_MCLK (0x0 << 14)
979#define RT5639_SCLK_SRC_PLL1 (0x1 << 14)
980#define RT5639_SCLK_SRC_RCCLK (0x2 << 14) /* 15MHz */
981#define RT5639_PLL1_SRC_MASK (0x3 << 12)
982#define RT5639_PLL1_SRC_SFT 12
983#define RT5639_PLL1_SRC_MCLK (0x0 << 12)
984#define RT5639_PLL1_SRC_BCLK1 (0x1 << 12)
985#define RT5639_PLL1_SRC_BCLK2 (0x2 << 12)
986#define RT5639_PLL1_SRC_BCLK3 (0x3 << 12)
987#define RT5639_PLL1_PD_MASK (0x1 << 3)
988#define RT5639_PLL1_PD_SFT 3
989#define RT5639_PLL1_PD_1 (0x0 << 3)
990#define RT5639_PLL1_PD_2 (0x1 << 3)
991
992#define RT5639_PLL_INP_MAX 40000000
993#define RT5639_PLL_INP_MIN 256000
994/* PLL M/N/K Code Control 1 (0x81) */
995#define RT5639_PLL_N_MAX 0x1ff
996#define RT5639_PLL_N_MASK (RT5639_PLL_N_MAX << 7)
997#define RT5639_PLL_N_SFT 7
998#define RT5639_PLL_K_MAX 0x1f
999#define RT5639_PLL_K_MASK (RT5639_PLL_K_MAX)
1000#define RT5639_PLL_K_SFT 0
1001
1002/* PLL M/N/K Code Control 2 (0x82) */
1003#define RT5639_PLL_M_MAX 0xf
1004#define RT5639_PLL_M_MASK (RT5639_PLL_M_MAX << 12)
1005#define RT5639_PLL_M_SFT 12
1006#define RT5639_PLL_M_BP (0x1 << 11)
1007#define RT5639_PLL_M_BP_SFT 11
1008
1009/* ASRC Control 1 (0x83) */
1010#define RT5639_STO_T_MASK (0x1 << 15)
1011#define RT5639_STO_T_SFT 15
1012#define RT5639_STO_T_SCLK (0x0 << 15)
1013#define RT5639_STO_T_LRCK1 (0x1 << 15)
1014#define RT5639_M1_T_MASK (0x1 << 14)
1015#define RT5639_M1_T_SFT 14
1016#define RT5639_M1_T_I2S2 (0x0 << 14)
1017#define RT5639_M1_T_I2S2_D3 (0x1 << 14)
1018#define RT5639_I2S2_F_MASK (0x1 << 12)
1019#define RT5639_I2S2_F_SFT 12
1020#define RT5639_I2S2_F_I2S2_D2 (0x0 << 12)
1021#define RT5639_I2S2_F_I2S1_TCLK (0x1 << 12)
1022#define RT5639_DMIC_1_M_MASK (0x1 << 9)
1023#define RT5639_DMIC_1_M_SFT 9
1024#define RT5639_DMIC_1_M_NOR (0x0 << 9)
1025#define RT5639_DMIC_1_M_ASYN (0x1 << 9)
1026#define RT5639_DMIC_2_M_MASK (0x1 << 8)
1027#define RT5639_DMIC_2_M_SFT 8
1028#define RT5639_DMIC_2_M_NOR (0x0 << 8)
1029#define RT5639_DMIC_2_M_ASYN (0x1 << 8)
1030
1031/* ASRC Control 2 (0x84) */
1032#define RT5639_MDA_L_M_MASK (0x1 << 15)
1033#define RT5639_MDA_L_M_SFT 15
1034#define RT5639_MDA_L_M_NOR (0x0 << 15)
1035#define RT5639_MDA_L_M_ASYN (0x1 << 15)
1036#define RT5639_MDA_R_M_MASK (0x1 << 14)
1037#define RT5639_MDA_R_M_SFT 14
1038#define RT5639_MDA_R_M_NOR (0x0 << 14)
1039#define RT5639_MDA_R_M_ASYN (0x1 << 14)
1040#define RT5639_MAD_L_M_MASK (0x1 << 13)
1041#define RT5639_MAD_L_M_SFT 13
1042#define RT5639_MAD_L_M_NOR (0x0 << 13)
1043#define RT5639_MAD_L_M_ASYN (0x1 << 13)
1044#define RT5639_MAD_R_M_MASK (0x1 << 12)
1045#define RT5639_MAD_R_M_SFT 12
1046#define RT5639_MAD_R_M_NOR (0x0 << 12)
1047#define RT5639_MAD_R_M_ASYN (0x1 << 12)
1048#define RT5639_ADC_M_MASK (0x1 << 11)
1049#define RT5639_ADC_M_SFT 11
1050#define RT5639_ADC_M_NOR (0x0 << 11)
1051#define RT5639_ADC_M_ASYN (0x1 << 11)
1052#define RT5639_STO_DAC_M_MASK (0x1 << 5)
1053#define RT5639_STO_DAC_M_SFT 5
1054#define RT5639_STO_DAC_M_NOR (0x0 << 5)
1055#define RT5639_STO_DAC_M_ASYN (0x1 << 5)
1056#define RT5639_I2S1_R_D_MASK (0x1 << 4)
1057#define RT5639_I2S1_R_D_SFT 4
1058#define RT5639_I2S1_R_D_DIS (0x0 << 4)
1059#define RT5639_I2S1_R_D_EN (0x1 << 4)
1060#define RT5639_I2S2_R_D_MASK (0x1 << 3)
1061#define RT5639_I2S2_R_D_SFT 3
1062#define RT5639_I2S2_R_D_DIS (0x0 << 3)
1063#define RT5639_I2S2_R_D_EN (0x1 << 3)
1064#define RT5639_PRE_SCLK_MASK (0x3)
1065#define RT5639_PRE_SCLK_SFT 0
1066#define RT5639_PRE_SCLK_512 (0x0)
1067#define RT5639_PRE_SCLK_1024 (0x1)
1068#define RT5639_PRE_SCLK_2048 (0x2)
1069
1070/* ASRC Control 3 (0x85) */
1071#define RT5639_I2S1_RATE_MASK (0xf << 12)
1072#define RT5639_I2S1_RATE_SFT 12
1073#define RT5639_I2S2_RATE_MASK (0xf << 8)
1074#define RT5639_I2S2_RATE_SFT 8
1075
1076/* ASRC Control 4 (0x89) */
1077#define RT5639_I2S1_PD_MASK (0x7 << 12)
1078#define RT5639_I2S1_PD_SFT 12
1079#define RT5639_I2S2_PD_MASK (0x7 << 8)
1080#define RT5639_I2S2_PD_SFT 8
1081
1082/* HPOUT Over Current Detection (0x8b) */
1083#define RT5639_HP_OVCD_MASK (0x1 << 10)
1084#define RT5639_HP_OVCD_SFT 10
1085#define RT5639_HP_OVCD_DIS (0x0 << 10)
1086#define RT5639_HP_OVCD_EN (0x1 << 10)
1087#define RT5639_HP_OC_TH_MASK (0x3 << 8)
1088#define RT5639_HP_OC_TH_SFT 8
1089#define RT5639_HP_OC_TH_90 (0x0 << 8)
1090#define RT5639_HP_OC_TH_105 (0x1 << 8)
1091#define RT5639_HP_OC_TH_120 (0x2 << 8)
1092#define RT5639_HP_OC_TH_135 (0x3 << 8)
1093
1094/* Class D Over Current Control (0x8c) */
1095#define RT5639_CLSD_OC_MASK (0x1 << 9)
1096#define RT5639_CLSD_OC_SFT 9
1097#define RT5639_CLSD_OC_PU (0x0 << 9)
1098#define RT5639_CLSD_OC_PD (0x1 << 9)
1099#define RT5639_AUTO_PD_MASK (0x1 << 8)
1100#define RT5639_AUTO_PD_SFT 8
1101#define RT5639_AUTO_PD_DIS (0x0 << 8)
1102#define RT5639_AUTO_PD_EN (0x1 << 8)
1103#define RT5639_CLSD_OC_TH_MASK (0x3f)
1104#define RT5639_CLSD_OC_TH_SFT 0
1105
1106/* Class D Output Control (0x8d) */
1107#define RT5639_CLSD_RATIO_MASK (0xf << 12)
1108#define RT5639_CLSD_RATIO_SFT 12
1109#define RT5639_CLSD_OM_MASK (0x1 << 11)
1110#define RT5639_CLSD_OM_SFT 11
1111#define RT5639_CLSD_OM_MONO (0x0 << 11)
1112#define RT5639_CLSD_OM_STO (0x1 << 11)
1113#define RT5639_CLSD_SCH_MASK (0x1 << 10)
1114#define RT5639_CLSD_SCH_SFT 10
1115#define RT5639_CLSD_SCH_L (0x0 << 10)
1116#define RT5639_CLSD_SCH_S (0x1 << 10)
1117
1118/* Depop Mode Control 1 (0x8e) */
1119#define RT5639_SMT_TRIG_MASK (0x1 << 15)
1120#define RT5639_SMT_TRIG_SFT 15
1121#define RT5639_SMT_TRIG_DIS (0x0 << 15)
1122#define RT5639_SMT_TRIG_EN (0x1 << 15)
1123#define RT5639_HP_L_SMT_MASK (0x1 << 9)
1124#define RT5639_HP_L_SMT_SFT 9
1125#define RT5639_HP_L_SMT_DIS (0x0 << 9)
1126#define RT5639_HP_L_SMT_EN (0x1 << 9)
1127#define RT5639_HP_R_SMT_MASK (0x1 << 8)
1128#define RT5639_HP_R_SMT_SFT 8
1129#define RT5639_HP_R_SMT_DIS (0x0 << 8)
1130#define RT5639_HP_R_SMT_EN (0x1 << 8)
1131#define RT5639_HP_CD_PD_MASK (0x1 << 7)
1132#define RT5639_HP_CD_PD_SFT 7
1133#define RT5639_HP_CD_PD_DIS (0x0 << 7)
1134#define RT5639_HP_CD_PD_EN (0x1 << 7)
1135#define RT5639_RSTN_MASK (0x1 << 6)
1136#define RT5639_RSTN_SFT 6
1137#define RT5639_RSTN_DIS (0x0 << 6)
1138#define RT5639_RSTN_EN (0x1 << 6)
1139#define RT5639_RSTP_MASK (0x1 << 5)
1140#define RT5639_RSTP_SFT 5
1141#define RT5639_RSTP_DIS (0x0 << 5)
1142#define RT5639_RSTP_EN (0x1 << 5)
1143#define RT5639_HP_CO_MASK (0x1 << 4)
1144#define RT5639_HP_CO_SFT 4
1145#define RT5639_HP_CO_DIS (0x0 << 4)
1146#define RT5639_HP_CO_EN (0x1 << 4)
1147#define RT5639_HP_CP_MASK (0x1 << 3)
1148#define RT5639_HP_CP_SFT 3
1149#define RT5639_HP_CP_PD (0x0 << 3)
1150#define RT5639_HP_CP_PU (0x1 << 3)
1151#define RT5639_HP_SG_MASK (0x1 << 2)
1152#define RT5639_HP_SG_SFT 2
1153#define RT5639_HP_SG_DIS (0x0 << 2)
1154#define RT5639_HP_SG_EN (0x1 << 2)
1155#define RT5639_HP_DP_MASK (0x1 << 1)
1156#define RT5639_HP_DP_SFT 1
1157#define RT5639_HP_DP_PD (0x0 << 1)
1158#define RT5639_HP_DP_PU (0x1 << 1)
1159#define RT5639_HP_CB_MASK (0x1)
1160#define RT5639_HP_CB_SFT 0
1161#define RT5639_HP_CB_PD (0x0)
1162#define RT5639_HP_CB_PU (0x1)
1163
1164/* Depop Mode Control 2 (0x8f) */
1165#define RT5639_DEPOP_MASK (0x1 << 13)
1166#define RT5639_DEPOP_SFT 13
1167#define RT5639_DEPOP_AUTO (0x0 << 13)
1168#define RT5639_DEPOP_MAN (0x1 << 13)
1169#define RT5639_RAMP_MASK (0x1 << 12)
1170#define RT5639_RAMP_SFT 12
1171#define RT5639_RAMP_DIS (0x0 << 12)
1172#define RT5639_RAMP_EN (0x1 << 12)
1173#define RT5639_BPS_MASK (0x1 << 11)
1174#define RT5639_BPS_SFT 11
1175#define RT5639_BPS_DIS (0x0 << 11)
1176#define RT5639_BPS_EN (0x1 << 11)
1177#define RT5639_FAST_UPDN_MASK (0x1 << 10)
1178#define RT5639_FAST_UPDN_SFT 10
1179#define RT5639_FAST_UPDN_DIS (0x0 << 10)
1180#define RT5639_FAST_UPDN_EN (0x1 << 10)
1181#define RT5639_MRES_MASK (0x3 << 8)
1182#define RT5639_MRES_SFT 8
1183#define RT5639_MRES_15MO (0x0 << 8)
1184#define RT5639_MRES_25MO (0x1 << 8)
1185#define RT5639_MRES_35MO (0x2 << 8)
1186#define RT5639_MRES_45MO (0x3 << 8)
1187#define RT5639_VLO_MASK (0x1 << 7)
1188#define RT5639_VLO_SFT 7
1189#define RT5639_VLO_3V (0x0 << 7)
1190#define RT5639_VLO_32V (0x1 << 7)
1191#define RT5639_DIG_DP_MASK (0x1 << 6)
1192#define RT5639_DIG_DP_SFT 6
1193#define RT5639_DIG_DP_DIS (0x0 << 6)
1194#define RT5639_DIG_DP_EN (0x1 << 6)
1195#define RT5639_DP_TH_MASK (0x3 << 4)
1196#define RT5639_DP_TH_SFT 4
1197
1198/* Depop Mode Control 3 (0x90) */
1199#define RT5639_CP_SYS_MASK (0x7 << 12)
1200#define RT5639_CP_SYS_SFT 12
1201#define RT5639_CP_FQ1_MASK (0x7 << 8)
1202#define RT5639_CP_FQ1_SFT 8
1203#define RT5639_CP_FQ2_MASK (0x7 << 4)
1204#define RT5639_CP_FQ2_SFT 4
1205#define RT5639_CP_FQ3_MASK (0x7)
1206#define RT5639_CP_FQ3_SFT 0
1207
1208/* HPOUT charge pump (0x91) */
1209#define RT5639_OSW_L_MASK (0x1 << 11)
1210#define RT5639_OSW_L_SFT 11
1211#define RT5639_OSW_L_DIS (0x0 << 11)
1212#define RT5639_OSW_L_EN (0x1 << 11)
1213#define RT5639_OSW_R_MASK (0x1 << 10)
1214#define RT5639_OSW_R_SFT 10
1215#define RT5639_OSW_R_DIS (0x0 << 10)
1216#define RT5639_OSW_R_EN (0x1 << 10)
1217#define RT5639_PM_HP_MASK (0x3 << 8)
1218#define RT5639_PM_HP_SFT 8
1219#define RT5639_PM_HP_LV (0x0 << 8)
1220#define RT5639_PM_HP_MV (0x1 << 8)
1221#define RT5639_PM_HP_HV (0x2 << 8)
1222#define RT5639_IB_HP_MASK (0x3 << 6)
1223#define RT5639_IB_HP_SFT 6
1224#define RT5639_IB_HP_125IL (0x0 << 6)
1225#define RT5639_IB_HP_25IL (0x1 << 6)
1226#define RT5639_IB_HP_5IL (0x2 << 6)
1227#define RT5639_IB_HP_1IL (0x3 << 6)
1228
1229/* PV detection and SPK gain control (0x92) */
1230#define RT5639_PVDD_DET_MASK (0x1 << 15)
1231#define RT5639_PVDD_DET_SFT 15
1232#define RT5639_PVDD_DET_DIS (0x0 << 15)
1233#define RT5639_PVDD_DET_EN (0x1 << 15)
1234#define RT5639_SPK_AG_MASK (0x1 << 14)
1235#define RT5639_SPK_AG_SFT 14
1236#define RT5639_SPK_AG_DIS (0x0 << 14)
1237#define RT5639_SPK_AG_EN (0x1 << 14)
1238
1239/* Micbias Control (0x93) */
1240#define RT5639_MIC1_BS_MASK (0x1 << 15)
1241#define RT5639_MIC1_BS_SFT 15
1242#define RT5639_MIC1_BS_9AV (0x0 << 15)
1243#define RT5639_MIC1_BS_75AV (0x1 << 15)
1244#define RT5639_MIC2_BS_MASK (0x1 << 14)
1245#define RT5639_MIC2_BS_SFT 14
1246#define RT5639_MIC2_BS_9AV (0x0 << 14)
1247#define RT5639_MIC2_BS_75AV (0x1 << 14)
1248#define RT5639_MIC1_CLK_MASK (0x1 << 13)
1249#define RT5639_MIC1_CLK_SFT 13
1250#define RT5639_MIC1_CLK_DIS (0x0 << 13)
1251#define RT5639_MIC1_CLK_EN (0x1 << 13)
1252#define RT5639_MIC2_CLK_MASK (0x1 << 12)
1253#define RT5639_MIC2_CLK_SFT 12
1254#define RT5639_MIC2_CLK_DIS (0x0 << 12)
1255#define RT5639_MIC2_CLK_EN (0x1 << 12)
1256#define RT5639_MIC1_OVCD_MASK (0x1 << 11)
1257#define RT5639_MIC1_OVCD_SFT 11
1258#define RT5639_MIC1_OVCD_DIS (0x0 << 11)
1259#define RT5639_MIC1_OVCD_EN (0x1 << 11)
1260#define RT5639_MIC1_OVTH_MASK (0x3 << 9)
1261#define RT5639_MIC1_OVTH_SFT 9
1262#define RT5639_MIC1_OVTH_600UA (0x0 << 9)
1263#define RT5639_MIC1_OVTH_1500UA (0x1 << 9)
1264#define RT5639_MIC1_OVTH_2000UA (0x2 << 9)
1265#define RT5639_MIC2_OVCD_MASK (0x1 << 8)
1266#define RT5639_MIC2_OVCD_SFT 8
1267#define RT5639_MIC2_OVCD_DIS (0x0 << 8)
1268#define RT5639_MIC2_OVCD_EN (0x1 << 8)
1269#define RT5639_MIC2_OVTH_MASK (0x3 << 6)
1270#define RT5639_MIC2_OVTH_SFT 6
1271#define RT5639_MIC2_OVTH_600UA (0x0 << 6)
1272#define RT5639_MIC2_OVTH_1500UA (0x1 << 6)
1273#define RT5639_MIC2_OVTH_2000UA (0x2 << 6)
1274#define RT5639_PWR_MB_MASK (0x1 << 5)
1275#define RT5639_PWR_MB_SFT 5
1276#define RT5639_PWR_MB_PD (0x0 << 5)
1277#define RT5639_PWR_MB_PU (0x1 << 5)
1278#define RT5639_PWR_CLK25M_MASK (0x1 << 4)
1279#define RT5639_PWR_CLK25M_SFT 4
1280#define RT5639_PWR_CLK25M_PD (0x0 << 4)
1281#define RT5639_PWR_CLK25M_PU (0x1 << 4)
1282
1283/* EQ Control 1 (0xb0) */
1284#define RT5639_EQ_SRC_MASK (0x1 << 15)
1285#define RT5639_EQ_SRC_SFT 15
1286#define RT5639_EQ_SRC_DAC (0x0 << 15)
1287#define RT5639_EQ_SRC_ADC (0x1 << 15)
1288#define RT5639_EQ_UPD (0x1 << 14)
1289#define RT5639_EQ_UPD_BIT 14
1290#define RT5639_EQ_CD_MASK (0x1 << 13)
1291#define RT5639_EQ_CD_SFT 13
1292#define RT5639_EQ_CD_DIS (0x0 << 13)
1293#define RT5639_EQ_CD_EN (0x1 << 13)
1294#define RT5639_EQ_DITH_MASK (0x3 << 8)
1295#define RT5639_EQ_DITH_SFT 8
1296#define RT5639_EQ_DITH_NOR (0x0 << 8)
1297#define RT5639_EQ_DITH_LSB (0x1 << 8)
1298#define RT5639_EQ_DITH_LSB_1 (0x2 << 8)
1299#define RT5639_EQ_DITH_LSB_2 (0x3 << 8)
1300
1301/* EQ Control 2 (0xb1) */
1302#define RT5639_EQ_HPF1_M_MASK (0x1 << 8)
1303#define RT5639_EQ_HPF1_M_SFT 8
1304#define RT5639_EQ_HPF1_M_HI (0x0 << 8)
1305#define RT5639_EQ_HPF1_M_1ST (0x1 << 8)
1306#define RT5639_EQ_LPF1_M_MASK (0x1 << 7)
1307#define RT5639_EQ_LPF1_M_SFT 7
1308#define RT5639_EQ_LPF1_M_LO (0x0 << 7)
1309#define RT5639_EQ_LPF1_M_1ST (0x1 << 7)
1310#define RT5639_EQ_HPF2_MASK (0x1 << 6)
1311#define RT5639_EQ_HPF2_SFT 6
1312#define RT5639_EQ_HPF2_DIS (0x0 << 6)
1313#define RT5639_EQ_HPF2_EN (0x1 << 6)
1314#define RT5639_EQ_HPF1_MASK (0x1 << 5)
1315#define RT5639_EQ_HPF1_SFT 5
1316#define RT5639_EQ_HPF1_DIS (0x0 << 5)
1317#define RT5639_EQ_HPF1_EN (0x1 << 5)
1318#define RT5639_EQ_BPF4_MASK (0x1 << 4)
1319#define RT5639_EQ_BPF4_SFT 4
1320#define RT5639_EQ_BPF4_DIS (0x0 << 4)
1321#define RT5639_EQ_BPF4_EN (0x1 << 4)
1322#define RT5639_EQ_BPF3_MASK (0x1 << 3)
1323#define RT5639_EQ_BPF3_SFT 3
1324#define RT5639_EQ_BPF3_DIS (0x0 << 3)
1325#define RT5639_EQ_BPF3_EN (0x1 << 3)
1326#define RT5639_EQ_BPF2_MASK (0x1 << 2)
1327#define RT5639_EQ_BPF2_SFT 2
1328#define RT5639_EQ_BPF2_DIS (0x0 << 2)
1329#define RT5639_EQ_BPF2_EN (0x1 << 2)
1330#define RT5639_EQ_BPF1_MASK (0x1 << 1)
1331#define RT5639_EQ_BPF1_SFT 1
1332#define RT5639_EQ_BPF1_DIS (0x0 << 1)
1333#define RT5639_EQ_BPF1_EN (0x1 << 1)
1334#define RT5639_EQ_LPF_MASK (0x1)
1335#define RT5639_EQ_LPF_SFT 0
1336#define RT5639_EQ_LPF_DIS (0x0)
1337#define RT5639_EQ_LPF_EN (0x1)
1338
1339/* Memory Test (0xb2) */
1340#define RT5639_MT_MASK (0x1 << 15)
1341#define RT5639_MT_SFT 15
1342#define RT5639_MT_DIS (0x0 << 15)
1343#define RT5639_MT_EN (0x1 << 15)
1344
1345/* DRC/AGC Control 1 (0xb4) */
1346#define RT5639_DRC_AGC_P_MASK (0x1 << 15)
1347#define RT5639_DRC_AGC_P_SFT 15
1348#define RT5639_DRC_AGC_P_DAC (0x0 << 15)
1349#define RT5639_DRC_AGC_P_ADC (0x1 << 15)
1350#define RT5639_DRC_AGC_MASK (0x1 << 14)
1351#define RT5639_DRC_AGC_SFT 14
1352#define RT5639_DRC_AGC_DIS (0x0 << 14)
1353#define RT5639_DRC_AGC_EN (0x1 << 14)
1354#define RT5639_DRC_AGC_UPD (0x1 << 13)
1355#define RT5639_DRC_AGC_UPD_BIT 13
1356#define RT5639_DRC_AGC_AR_MASK (0x1f << 8)
1357#define RT5639_DRC_AGC_AR_SFT 8
1358#define RT5639_DRC_AGC_R_MASK (0x7 << 5)
1359#define RT5639_DRC_AGC_R_SFT 5
1360#define RT5639_DRC_AGC_R_48K (0x1 << 5)
1361#define RT5639_DRC_AGC_R_96K (0x2 << 5)
1362#define RT5639_DRC_AGC_R_192K (0x3 << 5)
1363#define RT5639_DRC_AGC_R_441K (0x5 << 5)
1364#define RT5639_DRC_AGC_R_882K (0x6 << 5)
1365#define RT5639_DRC_AGC_R_1764K (0x7 << 5)
1366#define RT5639_DRC_AGC_RC_MASK (0x1f)
1367#define RT5639_DRC_AGC_RC_SFT 0
1368
1369/* DRC/AGC Control 2 (0xb5) */
1370#define RT5639_DRC_AGC_POB_MASK (0x3f << 8)
1371#define RT5639_DRC_AGC_POB_SFT 8
1372#define RT5639_DRC_AGC_CP_MASK (0x1 << 7)
1373#define RT5639_DRC_AGC_CP_SFT 7
1374#define RT5639_DRC_AGC_CP_DIS (0x0 << 7)
1375#define RT5639_DRC_AGC_CP_EN (0x1 << 7)
1376#define RT5639_DRC_AGC_CPR_MASK (0x3 << 5)
1377#define RT5639_DRC_AGC_CPR_SFT 5
1378#define RT5639_DRC_AGC_CPR_1_1 (0x0 << 5)
1379#define RT5639_DRC_AGC_CPR_1_2 (0x1 << 5)
1380#define RT5639_DRC_AGC_CPR_1_3 (0x2 << 5)
1381#define RT5639_DRC_AGC_CPR_1_4 (0x3 << 5)
1382#define RT5639_DRC_AGC_PRB_MASK (0x1f)
1383#define RT5639_DRC_AGC_PRB_SFT 0
1384
1385/* DRC/AGC Control 3 (0xb6) */
1386#define RT5639_DRC_AGC_NGB_MASK (0xf << 12)
1387#define RT5639_DRC_AGC_NGB_SFT 12
1388#define RT5639_DRC_AGC_TAR_MASK (0x1f << 7)
1389#define RT5639_DRC_AGC_TAR_SFT 7
1390#define RT5639_DRC_AGC_NG_MASK (0x1 << 6)
1391#define RT5639_DRC_AGC_NG_SFT 6
1392#define RT5639_DRC_AGC_NG_DIS (0x0 << 6)
1393#define RT5639_DRC_AGC_NG_EN (0x1 << 6)
1394#define RT5639_DRC_AGC_NGH_MASK (0x1 << 5)
1395#define RT5639_DRC_AGC_NGH_SFT 5
1396#define RT5639_DRC_AGC_NGH_DIS (0x0 << 5)
1397#define RT5639_DRC_AGC_NGH_EN (0x1 << 5)
1398#define RT5639_DRC_AGC_NGT_MASK (0x1f)
1399#define RT5639_DRC_AGC_NGT_SFT 0
1400
1401/* ANC Control 1 (0xb8) */
1402#define RT5639_ANC_M_MASK (0x1 << 15)
1403#define RT5639_ANC_M_SFT 15
1404#define RT5639_ANC_M_NOR (0x0 << 15)
1405#define RT5639_ANC_M_REV (0x1 << 15)
1406#define RT5639_ANC_MASK (0x1 << 14)
1407#define RT5639_ANC_SFT 14
1408#define RT5639_ANC_DIS (0x0 << 14)
1409#define RT5639_ANC_EN (0x1 << 14)
1410#define RT5639_ANC_MD_MASK (0x3 << 12)
1411#define RT5639_ANC_MD_SFT 12
1412#define RT5639_ANC_MD_DIS (0x0 << 12)
1413#define RT5639_ANC_MD_67MS (0x1 << 12)
1414#define RT5639_ANC_MD_267MS (0x2 << 12)
1415#define RT5639_ANC_MD_1067MS (0x3 << 12)
1416#define RT5639_ANC_SN_MASK (0x1 << 11)
1417#define RT5639_ANC_SN_SFT 11
1418#define RT5639_ANC_SN_DIS (0x0 << 11)
1419#define RT5639_ANC_SN_EN (0x1 << 11)
1420#define RT5639_ANC_CLK_MASK (0x1 << 10)
1421#define RT5639_ANC_CLK_SFT 10
1422#define RT5639_ANC_CLK_ANC (0x0 << 10)
1423#define RT5639_ANC_CLK_REG (0x1 << 10)
1424#define RT5639_ANC_ZCD_MASK (0x3 << 8)
1425#define RT5639_ANC_ZCD_SFT 8
1426#define RT5639_ANC_ZCD_DIS (0x0 << 8)
1427#define RT5639_ANC_ZCD_T1 (0x1 << 8)
1428#define RT5639_ANC_ZCD_T2 (0x2 << 8)
1429#define RT5639_ANC_ZCD_WT (0x3 << 8)
1430#define RT5639_ANC_CS_MASK (0x1 << 7)
1431#define RT5639_ANC_CS_SFT 7
1432#define RT5639_ANC_CS_DIS (0x0 << 7)
1433#define RT5639_ANC_CS_EN (0x1 << 7)
1434#define RT5639_ANC_SW_MASK (0x1 << 6)
1435#define RT5639_ANC_SW_SFT 6
1436#define RT5639_ANC_SW_NOR (0x0 << 6)
1437#define RT5639_ANC_SW_AUTO (0x1 << 6)
1438#define RT5639_ANC_CO_L_MASK (0x3f)
1439#define RT5639_ANC_CO_L_SFT 0
1440
1441/* ANC Control 2 (0xb6) */
1442#define RT5639_ANC_FG_R_MASK (0xf << 12)
1443#define RT5639_ANC_FG_R_SFT 12
1444#define RT5639_ANC_FG_L_MASK (0xf << 8)
1445#define RT5639_ANC_FG_L_SFT 8
1446#define RT5639_ANC_CG_R_MASK (0xf << 4)
1447#define RT5639_ANC_CG_R_SFT 4
1448#define RT5639_ANC_CG_L_MASK (0xf)
1449#define RT5639_ANC_CG_L_SFT 0
1450
1451/* ANC Control 3 (0xb6) */
1452#define RT5639_ANC_CD_MASK (0x1 << 6)
1453#define RT5639_ANC_CD_SFT 6
1454#define RT5639_ANC_CD_BOTH (0x0 << 6)
1455#define RT5639_ANC_CD_IND (0x1 << 6)
1456#define RT5639_ANC_CO_R_MASK (0x3f)
1457#define RT5639_ANC_CO_R_SFT 0
1458
1459/* Jack Detect Control (0xbb) */
1460#define RT5639_JD_MASK (0x7 << 13)
1461#define RT5639_JD_SFT 13
1462#define RT5639_JD_DIS (0x0 << 13)
1463#define RT5639_JD_GPIO1 (0x1 << 13)
1464#define RT5639_JD_JD1_IN4P (0x2 << 13)
1465#define RT5639_JD_JD2_IN4N (0x3 << 13)
1466#define RT5639_JD_GPIO2 (0x4 << 13)
1467#define RT5639_JD_GPIO3 (0x5 << 13)
1468#define RT5639_JD_GPIO4 (0x6 << 13)
1469#define RT5639_JD_HP_MASK (0x1 << 11)
1470#define RT5639_JD_HP_SFT 11
1471#define RT5639_JD_HP_DIS (0x0 << 11)
1472#define RT5639_JD_HP_EN (0x1 << 11)
1473#define RT5639_JD_HP_TRG_MASK (0x1 << 10)
1474#define RT5639_JD_HP_TRG_SFT 10
1475#define RT5639_JD_HP_TRG_LO (0x0 << 10)
1476#define RT5639_JD_HP_TRG_HI (0x1 << 10)
1477#define RT5639_JD_SPL_MASK (0x1 << 9)
1478#define RT5639_JD_SPL_SFT 9
1479#define RT5639_JD_SPL_DIS (0x0 << 9)
1480#define RT5639_JD_SPL_EN (0x1 << 9)
1481#define RT5639_JD_SPL_TRG_MASK (0x1 << 8)
1482#define RT5639_JD_SPL_TRG_SFT 8
1483#define RT5639_JD_SPL_TRG_LO (0x0 << 8)
1484#define RT5639_JD_SPL_TRG_HI (0x1 << 8)
1485#define RT5639_JD_SPR_MASK (0x1 << 7)
1486#define RT5639_JD_SPR_SFT 7
1487#define RT5639_JD_SPR_DIS (0x0 << 7)
1488#define RT5639_JD_SPR_EN (0x1 << 7)
1489#define RT5639_JD_SPR_TRG_MASK (0x1 << 6)
1490#define RT5639_JD_SPR_TRG_SFT 6
1491#define RT5639_JD_SPR_TRG_LO (0x0 << 6)
1492#define RT5639_JD_SPR_TRG_HI (0x1 << 6)
1493#define RT5639_JD_MO_MASK (0x1 << 5)
1494#define RT5639_JD_MO_SFT 5
1495#define RT5639_JD_MO_DIS (0x0 << 5)
1496#define RT5639_JD_MO_EN (0x1 << 5)
1497#define RT5639_JD_MO_TRG_MASK (0x1 << 4)
1498#define RT5639_JD_MO_TRG_SFT 4
1499#define RT5639_JD_MO_TRG_LO (0x0 << 4)
1500#define RT5639_JD_MO_TRG_HI (0x1 << 4)
1501#define RT5639_JD_LO_MASK (0x1 << 3)
1502#define RT5639_JD_LO_SFT 3
1503#define RT5639_JD_LO_DIS (0x0 << 3)
1504#define RT5639_JD_LO_EN (0x1 << 3)
1505#define RT5639_JD_LO_TRG_MASK (0x1 << 2)
1506#define RT5639_JD_LO_TRG_SFT 2
1507#define RT5639_JD_LO_TRG_LO (0x0 << 2)
1508#define RT5639_JD_LO_TRG_HI (0x1 << 2)
1509#define RT5639_JD1_IN4P_MASK (0x1 << 1)
1510#define RT5639_JD1_IN4P_SFT 1
1511#define RT5639_JD1_IN4P_DIS (0x0 << 1)
1512#define RT5639_JD1_IN4P_EN (0x1 << 1)
1513#define RT5639_JD2_IN4N_MASK (0x1)
1514#define RT5639_JD2_IN4N_SFT 0
1515#define RT5639_JD2_IN4N_DIS (0x0)
1516#define RT5639_JD2_IN4N_EN (0x1)
1517
1518/* Jack detect for ANC (0xbc) */
1519#define RT5639_ANC_DET_MASK (0x3 << 4)
1520#define RT5639_ANC_DET_SFT 4
1521#define RT5639_ANC_DET_DIS (0x0 << 4)
1522#define RT5639_ANC_DET_MB1 (0x1 << 4)
1523#define RT5639_ANC_DET_MB2 (0x2 << 4)
1524#define RT5639_ANC_DET_JD (0x3 << 4)
1525#define RT5639_AD_TRG_MASK (0x1 << 3)
1526#define RT5639_AD_TRG_SFT 3
1527#define RT5639_AD_TRG_LO (0x0 << 3)
1528#define RT5639_AD_TRG_HI (0x1 << 3)
1529#define RT5639_ANCM_DET_MASK (0x3 << 4)
1530#define RT5639_ANCM_DET_SFT 4
1531#define RT5639_ANCM_DET_DIS (0x0 << 4)
1532#define RT5639_ANCM_DET_MB1 (0x1 << 4)
1533#define RT5639_ANCM_DET_MB2 (0x2 << 4)
1534#define RT5639_ANCM_DET_JD (0x3 << 4)
1535#define RT5639_AMD_TRG_MASK (0x1 << 3)
1536#define RT5639_AMD_TRG_SFT 3
1537#define RT5639_AMD_TRG_LO (0x0 << 3)
1538#define RT5639_AMD_TRG_HI (0x1 << 3)
1539
1540/* IRQ Control 1 (0xbd) */
1541#define RT5639_IRQ_JD_MASK (0x1 << 15)
1542#define RT5639_IRQ_JD_SFT 15
1543#define RT5639_IRQ_JD_BP (0x0 << 15)
1544#define RT5639_IRQ_JD_NOR (0x1 << 15)
1545#define RT5639_IRQ_OT_MASK (0x1 << 14)
1546#define RT5639_IRQ_OT_SFT 14
1547#define RT5639_IRQ_OT_BP (0x0 << 14)
1548#define RT5639_IRQ_OT_NOR (0x1 << 14)
1549#define RT5639_JD_STKY_MASK (0x1 << 13)
1550#define RT5639_JD_STKY_SFT 13
1551#define RT5639_JD_STKY_DIS (0x0 << 13)
1552#define RT5639_JD_STKY_EN (0x1 << 13)
1553#define RT5639_OT_STKY_MASK (0x1 << 12)
1554#define RT5639_OT_STKY_SFT 12
1555#define RT5639_OT_STKY_DIS (0x0 << 12)
1556#define RT5639_OT_STKY_EN (0x1 << 12)
1557#define RT5639_JD_P_MASK (0x1 << 11)
1558#define RT5639_JD_P_SFT 11
1559#define RT5639_JD_P_NOR (0x0 << 11)
1560#define RT5639_JD_P_INV (0x1 << 11)
1561#define RT5639_OT_P_MASK (0x1 << 10)
1562#define RT5639_OT_P_SFT 10
1563#define RT5639_OT_P_NOR (0x0 << 10)
1564#define RT5639_OT_P_INV (0x1 << 10)
1565
1566/* IRQ Control 2 (0xbe) */
1567#define RT5639_IRQ_MB1_OC_MASK (0x1 << 15)
1568#define RT5639_IRQ_MB1_OC_SFT 15
1569#define RT5639_IRQ_MB1_OC_BP (0x0 << 15)
1570#define RT5639_IRQ_MB1_OC_NOR (0x1 << 15)
1571#define RT5639_IRQ_MB2_OC_MASK (0x1 << 14)
1572#define RT5639_IRQ_MB2_OC_SFT 14
1573#define RT5639_IRQ_MB2_OC_BP (0x0 << 14)
1574#define RT5639_IRQ_MB2_OC_NOR (0x1 << 14)
1575#define RT5639_MB1_OC_STKY_MASK (0x1 << 11)
1576#define RT5639_MB1_OC_STKY_SFT 11
1577#define RT5639_MB1_OC_STKY_DIS (0x0 << 11)
1578#define RT5639_MB1_OC_STKY_EN (0x1 << 11)
1579#define RT5639_MB2_OC_STKY_MASK (0x1 << 10)
1580#define RT5639_MB2_OC_STKY_SFT 10
1581#define RT5639_MB2_OC_STKY_DIS (0x0 << 10)
1582#define RT5639_MB2_OC_STKY_EN (0x1 << 10)
1583#define RT5639_MB1_OC_P_MASK (0x1 << 7)
1584#define RT5639_MB1_OC_P_SFT 7
1585#define RT5639_MB1_OC_P_NOR (0x0 << 7)
1586#define RT5639_MB1_OC_P_INV (0x1 << 7)
1587#define RT5639_MB2_OC_P_MASK (0x1 << 6)
1588#define RT5639_MB2_OC_P_SFT 6
1589#define RT5639_MB2_OC_P_NOR (0x0 << 6)
1590#define RT5639_MB2_OC_P_INV (0x1 << 6)
1591#define RT5639_MB1_OC_CLR (0x1 << 3)
1592#define RT5639_MB1_OC_CLR_SFT 3
1593#define RT5639_MB2_OC_CLR (0x1 << 2)
1594#define RT5639_MB2_OC_CLR_SFT 2
1595
1596/* GPIO Control 1 (0xc0) */
1597#define RT5639_GP1_PIN_MASK (0x1 << 15)
1598#define RT5639_GP1_PIN_SFT 15
1599#define RT5639_GP1_PIN_GPIO1 (0x0 << 15)
1600#define RT5639_GP1_PIN_IRQ (0x1 << 15)
1601#define RT5639_GP2_PIN_MASK (0x1 << 14)
1602#define RT5639_GP2_PIN_SFT 14
1603#define RT5639_GP2_PIN_GPIO2 (0x0 << 14)
1604#define RT5639_GP2_PIN_DMIC1_SCL (0x1 << 14)
1605#define RT5639_GP3_PIN_MASK (0x3 << 12)
1606#define RT5639_GP3_PIN_SFT 12
1607#define RT5639_GP3_PIN_GPIO3 (0x0 << 12)
1608#define RT5639_GP3_PIN_DMIC1_SDA (0x1 << 12)
1609#define RT5639_GP3_PIN_IRQ (0x2 << 12)
1610#define RT5639_GP4_PIN_MASK (0x1 << 11)
1611#define RT5639_GP4_PIN_SFT 11
1612#define RT5639_GP4_PIN_GPIO4 (0x0 << 11)
1613#define RT5639_GP4_PIN_DMIC2_SDA (0x1 << 11)
1614#define RT5639_DP_SIG_MASK (0x1 << 10)
1615#define RT5639_DP_SIG_SFT 10
1616#define RT5639_DP_SIG_TEST (0x0 << 10)
1617#define RT5639_DP_SIG_AP (0x1 << 10)
1618#define RT5639_GPIO_M_MASK (0x1 << 9)
1619#define RT5639_GPIO_M_SFT 9
1620#define RT5639_GPIO_M_FLT (0x0 << 9)
1621#define RT5639_GPIO_M_PH (0x1 << 9)
1622
1623/* GPIO Control 3 (0xc2) */
1624#define RT5639_GP4_PF_MASK (0x1 << 11)
1625#define RT5639_GP4_PF_SFT 11
1626#define RT5639_GP4_PF_IN (0x0 << 11)
1627#define RT5639_GP4_PF_OUT (0x1 << 11)
1628#define RT5639_GP4_OUT_MASK (0x1 << 10)
1629#define RT5639_GP4_OUT_SFT 10
1630#define RT5639_GP4_OUT_LO (0x0 << 10)
1631#define RT5639_GP4_OUT_HI (0x1 << 10)
1632#define RT5639_GP4_P_MASK (0x1 << 9)
1633#define RT5639_GP4_P_SFT 9
1634#define RT5639_GP4_P_NOR (0x0 << 9)
1635#define RT5639_GP4_P_INV (0x1 << 9)
1636#define RT5639_GP3_PF_MASK (0x1 << 8)
1637#define RT5639_GP3_PF_SFT 8
1638#define RT5639_GP3_PF_IN (0x0 << 8)
1639#define RT5639_GP3_PF_OUT (0x1 << 8)
1640#define RT5639_GP3_OUT_MASK (0x1 << 7)
1641#define RT5639_GP3_OUT_SFT 7
1642#define RT5639_GP3_OUT_LO (0x0 << 7)
1643#define RT5639_GP3_OUT_HI (0x1 << 7)
1644#define RT5639_GP3_P_MASK (0x1 << 6)
1645#define RT5639_GP3_P_SFT 6
1646#define RT5639_GP3_P_NOR (0x0 << 6)
1647#define RT5639_GP3_P_INV (0x1 << 6)
1648#define RT5639_GP2_PF_MASK (0x1 << 5)
1649#define RT5639_GP2_PF_SFT 5
1650#define RT5639_GP2_PF_IN (0x0 << 5)
1651#define RT5639_GP2_PF_OUT (0x1 << 5)
1652#define RT5639_GP2_OUT_MASK (0x1 << 4)
1653#define RT5639_GP2_OUT_SFT 4
1654#define RT5639_GP2_OUT_LO (0x0 << 4)
1655#define RT5639_GP2_OUT_HI (0x1 << 4)
1656#define RT5639_GP2_P_MASK (0x1 << 3)
1657#define RT5639_GP2_P_SFT 3
1658#define RT5639_GP2_P_NOR (0x0 << 3)
1659#define RT5639_GP2_P_INV (0x1 << 3)
1660#define RT5639_GP1_PF_MASK (0x1 << 2)
1661#define RT5639_GP1_PF_SFT 2
1662#define RT5639_GP1_PF_IN (0x0 << 2)
1663#define RT5639_GP1_PF_OUT (0x1 << 2)
1664#define RT5639_GP1_OUT_MASK (0x1 << 1)
1665#define RT5639_GP1_OUT_SFT 1
1666#define RT5639_GP1_OUT_LO (0x0 << 1)
1667#define RT5639_GP1_OUT_HI (0x1 << 1)
1668#define RT5639_GP1_P_MASK (0x1)
1669#define RT5639_GP1_P_SFT 0
1670#define RT5639_GP1_P_NOR (0x0)
1671#define RT5639_GP1_P_INV (0x1)
1672
1673/* FM34-500 Register Control 1 (0xc4) */
1674#define RT5639_DSP_ADD_SFT 0
1675
1676/* FM34-500 Register Control 2 (0xc5) */
1677#define RT5639_DSP_DAT_SFT 0
1678
1679/* FM34-500 Register Control 3 (0xc6) */
1680#define RT5639_DSP_BUSY_MASK (0x1 << 15)
1681#define RT5639_DSP_BUSY_BIT 15
1682#define RT5639_DSP_DS_MASK (0x1 << 14)
1683#define RT5639_DSP_DS_SFT 14
1684#define RT5639_DSP_DS_FM3010 (0x1 << 14)
1685#define RT5639_DSP_DS_TEMP (0x1 << 14)
1686#define RT5639_DSP_CLK_MASK (0x3 << 12)
1687#define RT5639_DSP_CLK_SFT 12
1688#define RT5639_DSP_CLK_384K (0x0 << 12)
1689#define RT5639_DSP_CLK_192K (0x1 << 12)
1690#define RT5639_DSP_CLK_96K (0x2 << 12)
1691#define RT5639_DSP_CLK_64K (0x3 << 12)
1692#define RT5639_DSP_PD_PIN_MASK (0x1 << 11)
1693#define RT5639_DSP_PD_PIN_SFT 11
1694#define RT5639_DSP_PD_PIN_LO (0x0 << 11)
1695#define RT5639_DSP_PD_PIN_HI (0x1 << 11)
1696#define RT5639_DSP_RST_PIN_MASK (0x1 << 10)
1697#define RT5639_DSP_RST_PIN_SFT 10
1698#define RT5639_DSP_RST_PIN_LO (0x0 << 10)
1699#define RT5639_DSP_RST_PIN_HI (0x1 << 10)
1700#define RT5639_DSP_R_EN (0x1 << 9)
1701#define RT5639_DSP_W_EN (0x1 << 8)
1702#define RT5639_DSP_CMD_MASK (0xff)
1703#define RT5639_DSP_CMD_MW (0x3b) /* Memory Write */
1704#define RT5639_DSP_CMD_MR (0x37) /* Memory Read */
1705#define RT5639_DSP_CMD_RR (0x60) /* Register Read */
1706#define RT5639_DSP_CMD_RW (0x68) /* Register Write */
1707#define RT5639_DSP_REG_DATHI (0x26) /* High Data Addr */
1708#define RT5639_DSP_REG_DATLO (0x25) /* Low Data Addr */
1709
1710/* Programmable Register Array Control 1 (0xc8) */
1711#define RT5639_REG_SEQ_MASK (0xf << 12)
1712#define RT5639_REG_SEQ_SFT 12
1713#define RT5639_SEQ1_ST_MASK (0x1 << 11) /*RO*/
1714#define RT5639_SEQ1_ST_SFT 11
1715#define RT5639_SEQ1_ST_RUN (0x0 << 11)
1716#define RT5639_SEQ1_ST_FIN (0x1 << 11)
1717#define RT5639_SEQ2_ST_MASK (0x1 << 10) /*RO*/
1718#define RT5639_SEQ2_ST_SFT 10
1719#define RT5639_SEQ2_ST_RUN (0x0 << 10)
1720#define RT5639_SEQ2_ST_FIN (0x1 << 10)
1721#define RT5639_REG_LV_MASK (0x1 << 9)
1722#define RT5639_REG_LV_SFT 9
1723#define RT5639_REG_LV_MX (0x0 << 9)
1724#define RT5639_REG_LV_PR (0x1 << 9)
1725#define RT5639_SEQ_2_PT_MASK (0x1 << 8)
1726#define RT5639_SEQ_2_PT_BIT 8
1727#define RT5639_REG_IDX_MASK (0xff)
1728#define RT5639_REG_IDX_SFT 0
1729
1730/* Programmable Register Array Control 2 (0xc9) */
1731#define RT5639_REG_DAT_MASK (0xffff)
1732#define RT5639_REG_DAT_SFT 0
1733
1734/* Programmable Register Array Control 3 (0xca) */
1735#define RT5639_SEQ_DLY_MASK (0xff << 8)
1736#define RT5639_SEQ_DLY_SFT 8
1737#define RT5639_PROG_MASK (0x1 << 7)
1738#define RT5639_PROG_SFT 7
1739#define RT5639_PROG_DIS (0x0 << 7)
1740#define RT5639_PROG_EN (0x1 << 7)
1741#define RT5639_SEQ1_PT_RUN (0x1 << 6)
1742#define RT5639_SEQ1_PT_RUN_BIT 6
1743#define RT5639_SEQ2_PT_RUN (0x1 << 5)
1744#define RT5639_SEQ2_PT_RUN_BIT 5
1745
1746/* Programmable Register Array Control 4 (0xcb) */
1747#define RT5639_SEQ1_START_MASK (0xf << 8)
1748#define RT5639_SEQ1_START_SFT 8
1749#define RT5639_SEQ1_END_MASK (0xf)
1750#define RT5639_SEQ1_END_SFT 0
1751
1752/* Programmable Register Array Control 5 (0xcc) */
1753#define RT5639_SEQ2_START_MASK (0xf << 8)
1754#define RT5639_SEQ2_START_SFT 8
1755#define RT5639_SEQ2_END_MASK (0xf)
1756#define RT5639_SEQ2_END_SFT 0
1757
1758/* Scramble Function (0xcd) */
1759#define RT5639_SCB_KEY_MASK (0xff)
1760#define RT5639_SCB_KEY_SFT 0
1761
1762/* Scramble Control (0xce) */
1763#define RT5639_SCB_SWAP_MASK (0x1 << 15)
1764#define RT5639_SCB_SWAP_SFT 15
1765#define RT5639_SCB_SWAP_DIS (0x0 << 15)
1766#define RT5639_SCB_SWAP_EN (0x1 << 15)
1767#define RT5639_SCB_MASK (0x1 << 14)
1768#define RT5639_SCB_SFT 14
1769#define RT5639_SCB_DIS (0x0 << 14)
1770#define RT5639_SCB_EN (0x1 << 14)
1771
1772/* Baseback Control (0xcf) */
1773#define RT5639_BB_MASK (0x1 << 15)
1774#define RT5639_BB_SFT 15
1775#define RT5639_BB_DIS (0x0 << 15)
1776#define RT5639_BB_EN (0x1 << 15)
1777#define RT5639_BB_CT_MASK (0x7 << 12)
1778#define RT5639_BB_CT_SFT 12
1779#define RT5639_BB_CT_A (0x0 << 12)
1780#define RT5639_BB_CT_B (0x1 << 12)
1781#define RT5639_BB_CT_C (0x2 << 12)
1782#define RT5639_BB_CT_D (0x3 << 12)
1783#define RT5639_M_BB_L_MASK (0x1 << 9)
1784#define RT5639_M_BB_L_SFT 9
1785#define RT5639_M_BB_R_MASK (0x1 << 8)
1786#define RT5639_M_BB_R_SFT 8
1787#define RT5639_M_BB_HPF_L_MASK (0x1 << 7)
1788#define RT5639_M_BB_HPF_L_SFT 7
1789#define RT5639_M_BB_HPF_R_MASK (0x1 << 6)
1790#define RT5639_M_BB_HPF_R_SFT 6
1791#define RT5639_G_BB_BST_MASK (0x3f)
1792#define RT5639_G_BB_BST_SFT 0
1793
1794/* MP3 Plus Control 1 (0xd0) */
1795#define RT5639_M_MP3_L_MASK (0x1 << 15)
1796#define RT5639_M_MP3_L_SFT 15
1797#define RT5639_M_MP3_R_MASK (0x1 << 14)
1798#define RT5639_M_MP3_R_SFT 14
1799#define RT5639_M_MP3_MASK (0x1 << 13)
1800#define RT5639_M_MP3_SFT 13
1801#define RT5639_M_MP3_DIS (0x0 << 13)
1802#define RT5639_M_MP3_EN (0x1 << 13)
1803#define RT5639_EG_MP3_MASK (0x1f << 8)
1804#define RT5639_EG_MP3_SFT 8
1805#define RT5639_MP3_HLP_MASK (0x1 << 7)
1806#define RT5639_MP3_HLP_SFT 7
1807#define RT5639_MP3_HLP_DIS (0x0 << 7)
1808#define RT5639_MP3_HLP_EN (0x1 << 7)
1809#define RT5639_M_MP3_ORG_L_MASK (0x1 << 6)
1810#define RT5639_M_MP3_ORG_L_SFT 6
1811#define RT5639_M_MP3_ORG_R_MASK (0x1 << 5)
1812#define RT5639_M_MP3_ORG_R_SFT 5
1813
1814/* MP3 Plus Control 2 (0xd1) */
1815#define RT5639_MP3_WT_MASK (0x1 << 13)
1816#define RT5639_MP3_WT_SFT 13
1817#define RT5639_MP3_WT_1_4 (0x0 << 13)
1818#define RT5639_MP3_WT_1_2 (0x1 << 13)
1819#define RT5639_OG_MP3_MASK (0x1f << 8)
1820#define RT5639_OG_MP3_SFT 8
1821#define RT5639_HG_MP3_MASK (0x3f)
1822#define RT5639_HG_MP3_SFT 0
1823
1824/* 3D HP Control 1 (0xd2) */
1825#define RT5639_3D_CF_MASK (0x1 << 15)
1826#define RT5639_3D_CF_SFT 15
1827#define RT5639_3D_CF_DIS (0x0 << 15)
1828#define RT5639_3D_CF_EN (0x1 << 15)
1829#define RT5639_3D_HP_MASK (0x1 << 14)
1830#define RT5639_3D_HP_SFT 14
1831#define RT5639_3D_HP_DIS (0x0 << 14)
1832#define RT5639_3D_HP_EN (0x1 << 14)
1833#define RT5639_3D_BT_MASK (0x1 << 13)
1834#define RT5639_3D_BT_SFT 13
1835#define RT5639_3D_BT_DIS (0x0 << 13)
1836#define RT5639_3D_BT_EN (0x1 << 13)
1837#define RT5639_3D_1F_MIX_MASK (0x3 << 11)
1838#define RT5639_3D_1F_MIX_SFT 11
1839#define RT5639_3D_HP_M_MASK (0x1 << 10)
1840#define RT5639_3D_HP_M_SFT 10
1841#define RT5639_3D_HP_M_SUR (0x0 << 10)
1842#define RT5639_3D_HP_M_FRO (0x1 << 10)
1843#define RT5639_M_3D_HRTF_MASK (0x1 << 9)
1844#define RT5639_M_3D_HRTF_SFT 9
1845#define RT5639_M_3D_D2H_MASK (0x1 << 8)
1846#define RT5639_M_3D_D2H_SFT 8
1847#define RT5639_M_3D_D2R_MASK (0x1 << 7)
1848#define RT5639_M_3D_D2R_SFT 7
1849#define RT5639_M_3D_REVB_MASK (0x1 << 6)
1850#define RT5639_M_3D_REVB_SFT 6
1851
1852/* Adjustable high pass filter control 1 (0xd3) */
1853#define RT5639_2ND_HPF_MASK (0x1 << 15)
1854#define RT5639_2ND_HPF_SFT 15
1855#define RT5639_2ND_HPF_DIS (0x0 << 15)
1856#define RT5639_2ND_HPF_EN (0x1 << 15)
1857#define RT5639_HPF_CF_L_MASK (0x7 << 12)
1858#define RT5639_HPF_CF_L_SFT 12
1859#define RT5639_1ST_HPF_MASK (0x1 << 11)
1860#define RT5639_1ST_HPF_SFT 11
1861#define RT5639_1ST_HPF_DIS (0x0 << 11)
1862#define RT5639_1ST_HPF_EN (0x1 << 11)
1863#define RT5639_HPF_CF_R_MASK (0x7 << 8)
1864#define RT5639_HPF_CF_R_SFT 8
1865#define RT5639_ZD_T_MASK (0x3 << 6)
1866#define RT5639_ZD_T_SFT 6
1867#define RT5639_ZD_F_MASK (0x3 << 4)
1868#define RT5639_ZD_F_SFT 4
1869#define RT5639_ZD_F_IM (0x0 << 4)
1870#define RT5639_ZD_F_ZC_IM (0x1 << 4)
1871#define RT5639_ZD_F_ZC_IOD (0x2 << 4)
1872#define RT5639_ZD_F_UN (0x3 << 4)
1873
1874/* HP calibration control and Amp detection (0xd6) */
1875#define RT5639_SI_DAC_MASK (0x1 << 11)
1876#define RT5639_SI_DAC_SFT 11
1877#define RT5639_SI_DAC_AUTO (0x0 << 11)
1878#define RT5639_SI_DAC_TEST (0x1 << 11)
1879#define RT5639_DC_CAL_M_MASK (0x1 << 10)
1880#define RT5639_DC_CAL_M_SFT 10
1881#define RT5639_DC_CAL_M_CAL (0x0 << 10)
1882#define RT5639_DC_CAL_M_NOR (0x1 << 10)
1883#define RT5639_DC_CAL_MASK (0x1 << 9)
1884#define RT5639_DC_CAL_SFT 9
1885#define RT5639_DC_CAL_DIS (0x0 << 9)
1886#define RT5639_DC_CAL_EN (0x1 << 9)
1887#define RT5639_HPD_RCV_MASK (0x7 << 6)
1888#define RT5639_HPD_RCV_SFT 6
1889#define RT5639_HPD_PS_MASK (0x1 << 5)
1890#define RT5639_HPD_PS_SFT 5
1891#define RT5639_HPD_PS_DIS (0x0 << 5)
1892#define RT5639_HPD_PS_EN (0x1 << 5)
1893#define RT5639_CAL_M_MASK (0x1 << 4)
1894#define RT5639_CAL_M_SFT 4
1895#define RT5639_CAL_M_DEP (0x0 << 4)
1896#define RT5639_CAL_M_CAL (0x1 << 4)
1897#define RT5639_CAL_MASK (0x1 << 3)
1898#define RT5639_CAL_SFT 3
1899#define RT5639_CAL_DIS (0x0 << 3)
1900#define RT5639_CAL_EN (0x1 << 3)
1901#define RT5639_CAL_TEST_MASK (0x1 << 2)
1902#define RT5639_CAL_TEST_SFT 2
1903#define RT5639_CAL_TEST_DIS (0x0 << 2)
1904#define RT5639_CAL_TEST_EN (0x1 << 2)
1905#define RT5639_CAL_P_MASK (0x3)
1906#define RT5639_CAL_P_SFT 0
1907#define RT5639_CAL_P_NONE (0x0)
1908#define RT5639_CAL_P_CAL (0x1)
1909#define RT5639_CAL_P_DAC_CAL (0x2)
1910
1911/* Soft volume and zero cross control 1 (0xd9) */
1912#define RT5639_SV_MASK (0x1 << 15)
1913#define RT5639_SV_SFT 15
1914#define RT5639_SV_DIS (0x0 << 15)
1915#define RT5639_SV_EN (0x1 << 15)
1916#define RT5639_SPO_SV_MASK (0x1 << 14)
1917#define RT5639_SPO_SV_SFT 14
1918#define RT5639_SPO_SV_DIS (0x0 << 14)
1919#define RT5639_SPO_SV_EN (0x1 << 14)
1920#define RT5639_OUT_SV_MASK (0x1 << 13)
1921#define RT5639_OUT_SV_SFT 13
1922#define RT5639_OUT_SV_DIS (0x0 << 13)
1923#define RT5639_OUT_SV_EN (0x1 << 13)
1924#define RT5639_HP_SV_MASK (0x1 << 12)
1925#define RT5639_HP_SV_SFT 12
1926#define RT5639_HP_SV_DIS (0x0 << 12)
1927#define RT5639_HP_SV_EN (0x1 << 12)
1928#define RT5639_ZCD_DIG_MASK (0x1 << 11)
1929#define RT5639_ZCD_DIG_SFT 11
1930#define RT5639_ZCD_DIG_DIS (0x0 << 11)
1931#define RT5639_ZCD_DIG_EN (0x1 << 11)
1932#define RT5639_ZCD_MASK (0x1 << 10)
1933#define RT5639_ZCD_SFT 10
1934#define RT5639_ZCD_PD (0x0 << 10)
1935#define RT5639_ZCD_PU (0x1 << 10)
1936#define RT5639_M_ZCD_MASK (0x3f << 4)
1937#define RT5639_M_ZCD_SFT 4
1938#define RT5639_M_ZCD_RM_L (0x1 << 9)
1939#define RT5639_M_ZCD_RM_R (0x1 << 8)
1940#define RT5639_M_ZCD_SM_L (0x1 << 7)
1941#define RT5639_M_ZCD_SM_R (0x1 << 6)
1942#define RT5639_M_ZCD_OM_L (0x1 << 5)
1943#define RT5639_M_ZCD_OM_R (0x1 << 4)
1944#define RT5639_SV_DLY_MASK (0xf)
1945#define RT5639_SV_DLY_SFT 0
1946
1947/* Soft volume and zero cross control 2 (0xda) */
1948#define RT5639_ZCD_HP_MASK (0x1 << 15)
1949#define RT5639_ZCD_HP_SFT 15
1950#define RT5639_ZCD_HP_DIS (0x0 << 15)
1951#define RT5639_ZCD_HP_EN (0x1 << 15)
1952
1953
1954/* Codec Private Register definition */
1955/* 3D Speaker Control (0x63) */
1956#define RT5639_3D_SPK_MASK (0x1 << 15)
1957#define RT5639_3D_SPK_SFT 15
1958#define RT5639_3D_SPK_DIS (0x0 << 15)
1959#define RT5639_3D_SPK_EN (0x1 << 15)
1960#define RT5639_3D_SPK_M_MASK (0x3 << 13)
1961#define RT5639_3D_SPK_M_SFT 13
1962#define RT5639_3D_SPK_CG_MASK (0x1f << 8)
1963#define RT5639_3D_SPK_CG_SFT 8
1964#define RT5639_3D_SPK_SG_MASK (0x1f)
1965#define RT5639_3D_SPK_SG_SFT 0
1966
1967/* Wind Noise Detection Control 1 (0x6c) */
1968#define RT5639_WND_MASK (0x1 << 15)
1969#define RT5639_WND_SFT 15
1970#define RT5639_WND_DIS (0x0 << 15)
1971#define RT5639_WND_EN (0x1 << 15)
1972
1973/* Wind Noise Detection Control 2 (0x6d) */
1974#define RT5639_WND_FC_NW_MASK (0x3f << 10)
1975#define RT5639_WND_FC_NW_SFT 10
1976#define RT5639_WND_FC_WK_MASK (0x3f << 4)
1977#define RT5639_WND_FC_WK_SFT 4
1978
1979/* Wind Noise Detection Control 3 (0x6e) */
1980#define RT5639_HPF_FC_MASK (0x3f << 6)
1981#define RT5639_HPF_FC_SFT 6
1982#define RT5639_WND_FC_ST_MASK (0x3f)
1983#define RT5639_WND_FC_ST_SFT 0
1984
1985/* Wind Noise Detection Control 4 (0x6f) */
1986#define RT5639_WND_TH_LO_MASK (0x3ff)
1987#define RT5639_WND_TH_LO_SFT 0
1988
1989/* Wind Noise Detection Control 5 (0x70) */
1990#define RT5639_WND_TH_HI_MASK (0x3ff)
1991#define RT5639_WND_TH_HI_SFT 0
1992
1993/* Wind Noise Detection Control 8 (0x73) */
1994#define RT5639_WND_WIND_MASK (0x1 << 13) /* Read-Only */
1995#define RT5639_WND_WIND_SFT 13
1996#define RT5639_WND_STRONG_MASK (0x1 << 12) /* Read-Only */
1997#define RT5639_WND_STRONG_SFT 12
1998enum {
1999 RT5639_NO_WIND,
2000 RT5639_BREEZE,
2001 RT5639_STORM,
2002};
2003
2004/* Dipole Speaker Interface (0x75) */
2005#define RT5639_DP_ATT_MASK (0x3 << 14)
2006#define RT5639_DP_ATT_SFT 14
2007#define RT5639_DP_SPK_MASK (0x1 << 10)
2008#define RT5639_DP_SPK_SFT 10
2009#define RT5639_DP_SPK_DIS (0x0 << 10)
2010#define RT5639_DP_SPK_EN (0x1 << 10)
2011
2012/* EQ Pre Volume Control (0xb3) */
2013#define RT5639_EQ_PRE_VOL_MASK (0xffff)
2014#define RT5639_EQ_PRE_VOL_SFT 0
2015
2016/* EQ Post Volume Control (0xb4) */
2017#define RT5639_EQ_PST_VOL_MASK (0xffff)
2018#define RT5639_EQ_PST_VOL_SFT 0
2019
2020
2021
2022/* Volume Rescale */
2023#define RT5639_VOL_RSCL_MAX 0x27
2024#define RT5639_VOL_RSCL_RANGE 0x1F
2025/* Debug String Length */
2026#define RT5639_REG_DISP_LEN 10
2027
2028#define RT5639_NO_JACK BIT(0)
2029#define RT5639_HEADSET_DET BIT(1)
2030#define RT5639_HEADPHO_DET BIT(2)
2031
2032int rt5639_headset_detect(struct snd_soc_codec *codec, int jack_insert);
2033
2034/* System Clock Source */
2035enum {
2036 RT5639_SCLK_S_MCLK,
2037 RT5639_SCLK_S_PLL1,
2038 RT5639_SCLK_S_RCCLK,
2039};
2040
2041/* PLL1 Source */
2042enum {
2043 RT5639_PLL1_S_MCLK,
2044 RT5639_PLL1_S_BCLK1,
2045 RT5639_PLL1_S_BCLK2,
2046 RT5639_PLL1_S_BCLK3,
2047};
2048
2049enum {
2050 RT5639_AIF1,
2051 RT5639_AIF2,
2052 RT5639_AIF3,
2053 RT5639_AIFS,
2054};
2055
2056#define RT5639_U_IF1 (0x1)
2057#define RT5639_U_IF2 (0x1 << 1)
2058#define RT5639_U_IF3 (0x1 << 2)
2059
2060enum {
2061 RT5639_IF_123,
2062 RT5639_IF_132,
2063 RT5639_IF_312,
2064 RT5639_IF_321,
2065 RT5639_IF_231,
2066 RT5639_IF_213,
2067 RT5639_IF_113,
2068 RT5639_IF_223,
2069 RT5639_IF_ALL,
2070};
2071
2072enum {
2073 RT5639_DMIC_DIS,
2074 RT5639_DMIC1,
2075 RT5639_DMIC2,
2076};
2077
2078struct rt5639_pll_code {
2079 bool m_bp; /* Indicates bypass m code or not. */
2080 int m_code;
2081 int n_code;
2082 int k_code;
2083};
2084
2085struct rt5639_priv {
2086 struct snd_soc_codec *codec;
2087
2088 int aif_pu;
2089 int sysclk;
2090 int sysclk_src;
2091 int lrck[RT5639_AIFS];
2092 int bclk[RT5639_AIFS];
2093 int master[RT5639_AIFS];
2094
2095 int pll_src;
2096 int pll_in;
2097 int pll_out;
2098
2099 int dmic_en;
2100 int dsp_sw;
2101};
2102
2103
2104#endif /* __RT5639_H__ */
diff --git a/sound/soc/codecs/rt5640.c b/sound/soc/codecs/rt5640.c
new file mode 100644
index 00000000000..e3d0af02e39
--- /dev/null
+++ b/sound/soc/codecs/rt5640.c
@@ -0,0 +1,2546 @@
1/*
2 * rt5640.c -- RT5640 ALSA SoC audio codec driver
3 *
4 * Copyright 2011 Realtek Semiconductor Corp.
5 * Author: Johnny Hsu <johnnyhsu@realtek.com>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#include <linux/module.h>
12#include <linux/moduleparam.h>
13#include <linux/init.h>
14#include <linux/delay.h>
15#include <linux/pm.h>
16#include <linux/i2c.h>
17#include <linux/platform_device.h>
18#include <linux/spi/spi.h>
19#include <sound/core.h>
20#include <sound/pcm.h>
21#include <sound/pcm_params.h>
22#include <sound/soc.h>
23#include <sound/soc-dapm.h>
24#include <sound/initval.h>
25#include <sound/tlv.h>
26
27#include "rt5640.h"
28#if (CONFIG_SND_SOC_RT5642_MODULE | CONFIG_SND_SOC_RT5642)
29#include "rt5640-dsp.h"
30#endif
31
32#define RT5640_DEMO 1
33#define RT5640_REG_RW 1
34#define RT5640_DET_EXT_MIC 0
35
36#ifdef RT5640_DEMO
37struct rt5640_init_reg {
38 u8 reg;
39 u16 val;
40};
41
42static struct rt5640_init_reg init_list[] = {
43 {RT5640_DUMMY1 , 0x3701},/*fa[12:13] = 1'b;fa[8~10]=1;fa[0]=1*/
44 {RT5640_DEPOP_M1 , 0x0019},/* 8e[4:3] = 11'b; 8e[0] = 1'b */
45 {RT5640_DEPOP_M2 , 0x3100},/* 8f[13] = 1'b */
46 {RT5640_ADDA_CLK1 , 0x1114},/* 73[2] = 1'b */
47 {RT5640_MICBIAS , 0x3030},/* 93[5:4] = 11'b */
48 {RT5640_PRIV_INDEX , 0x003d},/* PR3d[12] = 1'b */
49 {RT5640_PRIV_DATA , 0x3600},
50 {RT5640_CLS_D_OUT , 0xa000},/* 8d[11] = 0'b */
51 {RT5640_PRIV_INDEX , 0x001c},/* PR1c = 0D21'h */
52 {RT5640_PRIV_DATA , 0x0D21},
53 {RT5640_PRIV_INDEX , 0x001b},/* PR1B = 0D21'h */
54 {RT5640_PRIV_DATA , 0x0000},
55 {RT5640_PRIV_INDEX , 0x0012},/* PR12 = 0aa8'h */
56 {RT5640_PRIV_DATA , 0x0aa8},
57 {RT5640_PRIV_INDEX , 0x0014},/* PR14 = 0aaa'h */
58 {RT5640_PRIV_DATA , 0x0aaa},
59 {RT5640_PRIV_INDEX , 0x0020},/* PR20 = 6110'h */
60 {RT5640_PRIV_DATA , 0x6110},
61 {RT5640_PRIV_INDEX , 0x0021},/* PR21 = e0e0'h */
62 {RT5640_PRIV_DATA , 0xe0e0},
63 {RT5640_PRIV_INDEX , 0x0023},/* PR23 = 1804'h */
64 {RT5640_PRIV_DATA , 0x1804},
65 /*playback*/
66 {RT5640_STO_DAC_MIXER , 0x1414},/*Dig inf 1 -> Sto DAC mixer -> DACL*/
67 {RT5640_OUT_L3_MIXER , 0x01fe},/*DACL1 -> OUTMIXL*/
68 {RT5640_OUT_R3_MIXER , 0x01fe},/*DACR1 -> OUTMIXR */
69 {RT5640_HP_VOL , 0x8888},/* OUTMIX -> HPVOL */
70 {RT5640_HPO_MIXER , 0xc000},/* HPVOL -> HPOLMIX */
71/* {RT5640_HPO_MIXER , 0xa000},// DAC1 -> HPOLMIX */
72 {RT5640_SPK_L_MIXER , 0x0036},/* DACL1 -> SPKMIXL */
73 {RT5640_SPK_R_MIXER , 0x0036},/* DACR1 -> SPKMIXR */
74 {RT5640_SPK_VOL , 0x8888},/* SPKMIX -> SPKVOL */
75 {RT5640_SPO_L_MIXER , 0xe800},/* SPKVOLL -> SPOLMIX */
76 {RT5640_SPO_R_MIXER , 0x2800},/* SPKVOLR -> SPORMIX */
77/* {RT5640_SPO_L_MIXER , 0xb800},//DAC -> SPOLMIX */
78/* {RT5640_SPO_R_MIXER , 0x1800},//DAC -> SPORMIX */
79/* {RT5640_I2S1_SDP , 0xD000},//change IIS1 and IIS2 */
80 /*record*/
81 {RT5640_IN1_IN2 , 0x5080},/*IN1 boost 40db & differential mode*/
82 {RT5640_IN3_IN4 , 0x0500},/*IN2 boost 40db & signal ended mode*/
83 {RT5640_REC_L2_MIXER , 0x005f},/* enable Mic1 -> RECMIXL */
84 {RT5640_REC_R2_MIXER , 0x005f},/* enable Mic1 -> RECMIXR */
85/* {RT5640_REC_L2_MIXER , 0x006f},//Mic2 -> RECMIXL */
86/* {RT5640_REC_R2_MIXER , 0x006f},//Mic2 -> RECMIXR */
87 {RT5640_STO_ADC_MIXER , 0x3020},/* ADC -> Sto ADC mixer */
88
89#if RT5640_DET_EXT_MIC
90 {RT5640_MICBIAS , 0x3800},/* enable MICBIAS short current */
91 {RT5640_GPIO_CTRL1 , 0x8400},/* set GPIO1 to IRQ */
92 {RT5640_GPIO_CTRL3 , 0x0004},/* set GPIO1 output */
93 {RT5640_IRQ_CTRL2 , 0x8000},/*set MICBIAS short current to IRQ */
94 /*( if sticky set regBE : 8800 ) */
95#endif
96
97};
98#define RT5640_INIT_REG_LEN ARRAY_SIZE(init_list)
99
100static int rt5640_reg_init(struct snd_soc_codec *codec)
101{
102 int i;
103 for (i = 0; i < RT5640_INIT_REG_LEN; i++)
104 snd_soc_write(codec, init_list[i].reg, init_list[i].val);
105 return 0;
106}
107#endif
108
109static const u16 rt5640_reg[RT5640_VENDOR_ID2 + 1] = {
110 [RT5640_RESET] = 0x000c,
111 [RT5640_SPK_VOL] = 0xc8c8,
112 [RT5640_HP_VOL] = 0xc8c8,
113 [RT5640_OUTPUT] = 0xc8c8,
114 [RT5640_MONO_OUT] = 0x8000,
115 [RT5640_INL_INR_VOL] = 0x0808,
116 [RT5640_DAC1_DIG_VOL] = 0xafaf,
117 [RT5640_DAC2_DIG_VOL] = 0xafaf,
118 [RT5640_ADC_DIG_VOL] = 0x2f2f,
119 [RT5640_ADC_DATA] = 0x2f2f,
120 [RT5640_STO_ADC_MIXER] = 0x7060,
121 [RT5640_MONO_ADC_MIXER] = 0x7070,
122 [RT5640_AD_DA_MIXER] = 0x8080,
123 [RT5640_STO_DAC_MIXER] = 0x5454,
124 [RT5640_MONO_DAC_MIXER] = 0x5454,
125 [RT5640_DIG_MIXER] = 0xaa00,
126 [RT5640_DSP_PATH2] = 0xa000,
127 [RT5640_REC_L2_MIXER] = 0x007f,
128 [RT5640_REC_R2_MIXER] = 0x007f,
129 [RT5640_HPO_MIXER] = 0xe000,
130 [RT5640_SPK_L_MIXER] = 0x003e,
131 [RT5640_SPK_R_MIXER] = 0x003e,
132 [RT5640_SPO_L_MIXER] = 0xf800,
133 [RT5640_SPO_R_MIXER] = 0x3800,
134 [RT5640_SPO_CLSD_RATIO] = 0x0004,
135 [RT5640_MONO_MIXER] = 0xfc00,
136 [RT5640_OUT_L3_MIXER] = 0x01ff,
137 [RT5640_OUT_R3_MIXER] = 0x01ff,
138 [RT5640_LOUT_MIXER] = 0xf000,
139 [RT5640_PWR_ANLG1] = 0x00c0,
140 [RT5640_I2S1_SDP] = 0x8000,
141 [RT5640_I2S2_SDP] = 0x8000,
142 [RT5640_I2S3_SDP] = 0x8000,
143 [RT5640_ADDA_CLK1] = 0x1110,
144 [RT5640_ADDA_CLK2] = 0x0c00,
145 [RT5640_DMIC] = 0x1d00,
146 [RT5640_ASRC_3] = 0x0008,
147 [RT5640_HP_OVCD] = 0x0600,
148 [RT5640_CLS_D_OVCD] = 0x0228,
149 [RT5640_CLS_D_OUT] = 0xa800,
150 [RT5640_DEPOP_M1] = 0x0004,
151 [RT5640_DEPOP_M2] = 0x1100,
152 [RT5640_DEPOP_M3] = 0x0646,
153 [RT5640_CHARGE_PUMP] = 0x0c00,
154 [RT5640_MICBIAS] = 0x3000,
155 [RT5640_EQ_CTRL1] = 0x2080,
156 [RT5640_DRC_AGC_1] = 0x2206,
157 [RT5640_DRC_AGC_2] = 0x1f00,
158 [RT5640_ANC_CTRL1] = 0x034b,
159 [RT5640_ANC_CTRL2] = 0x0066,
160 [RT5640_ANC_CTRL3] = 0x000b,
161 [RT5640_GPIO_CTRL1] = 0x0400,
162 [RT5640_DSP_CTRL3] = 0x2000,
163 [RT5640_BASE_BACK] = 0x0013,
164 [RT5640_MP3_PLUS1] = 0x0680,
165 [RT5640_MP3_PLUS2] = 0x1c17,
166 [RT5640_3D_HP] = 0x8c00,
167 [RT5640_ADJ_HPF] = 0x2a20,
168 [RT5640_HP_CALIB_AMP_DET] = 0x0400,
169 [RT5640_SV_ZCD1] = 0x0809,
170 [RT5640_VENDOR_ID1] = 0x10ec,
171 [RT5640_VENDOR_ID2] = 0x6231,
172};
173
174static int rt5640_reset(struct snd_soc_codec *codec)
175{
176 return snd_soc_write(codec, RT5640_RESET, 0);
177}
178
179/**
180 * rt5640_index_write - Write private register.
181 * @codec: SoC audio codec device.
182 * @reg: Private register index.
183 * @value: Private register Data.
184 *
185 * Modify private register for advanced setting. It can be written through
186 * private index (0x6a) and data (0x6c) register.
187 *
188 * Returns 0 for success or negative error code.
189 */
190static int rt5640_index_write(struct snd_soc_codec *codec,
191 unsigned int reg, unsigned int value)
192{
193 int ret;
194
195 ret = snd_soc_write(codec, RT5640_PRIV_INDEX, reg);
196 if (ret < 0) {
197 dev_err(codec->dev, "Failed to set private addr: %d\n", ret);
198 goto err;
199 }
200 ret = snd_soc_write(codec, RT5640_PRIV_DATA, value);
201 if (ret < 0) {
202 dev_err(codec->dev, "Failed to set private value: %d\n", ret);
203 goto err;
204 }
205 return 0;
206
207err:
208 return ret;
209}
210
211/**
212 * rt5640_index_read - Read private register.
213 * @codec: SoC audio codec device.
214 * @reg: Private register index.
215 *
216 * Read advanced setting from private register. It can be read through
217 * private index (0x6a) and data (0x6c) register.
218 *
219 * Returns private register value or negative error code.
220 */
221static unsigned int rt5640_index_read(
222 struct snd_soc_codec *codec, unsigned int reg)
223{
224 int ret;
225
226 ret = snd_soc_write(codec, RT5640_PRIV_INDEX, reg);
227 if (ret < 0) {
228 dev_err(codec->dev, "Failed to set private addr: %d\n", ret);
229 return ret;
230 }
231 return snd_soc_read(codec, RT5640_PRIV_DATA);
232}
233
234/**
235 * rt5640_index_update_bits - update private register bits
236 * @codec: audio codec
237 * @reg: Private register index.
238 * @mask: register mask
239 * @value: new value
240 *
241 * Writes new register value.
242 *
243 * Returns 1 for change, 0 for no change, or negative error code.
244 */
245static int rt5640_index_update_bits(struct snd_soc_codec *codec,
246 unsigned int reg, unsigned int mask, unsigned int value)
247{
248 unsigned int old, new;
249 int change, ret;
250
251 ret = rt5640_index_read(codec, reg);
252 if (ret < 0) {
253 dev_err(codec->dev, "Failed to read private reg: %d\n", ret);
254 goto err;
255 }
256
257 old = ret;
258 new = (old & ~mask) | (value & mask);
259 change = old != new;
260 if (change) {
261 ret = rt5640_index_write(codec, reg, new);
262 if (ret < 0) {
263 dev_err(codec->dev,
264 "Failed to write private reg: %d\n", ret);
265 goto err;
266 }
267 }
268 return change;
269
270err:
271 return ret;
272}
273
274static int rt5640_volatile_register(
275 struct snd_soc_codec *codec, unsigned int reg)
276{
277 switch (reg) {
278 case RT5640_RESET:
279 case RT5640_PRIV_DATA:
280 case RT5640_ASRC_5:
281 case RT5640_EQ_CTRL1:
282 case RT5640_DRC_AGC_1:
283 case RT5640_ANC_CTRL1:
284 case RT5640_IRQ_CTRL2:
285 case RT5640_INT_IRQ_ST:
286 case RT5640_DSP_CTRL2:
287 case RT5640_DSP_CTRL3:
288 case RT5640_PGM_REG_ARR1:
289 case RT5640_PGM_REG_ARR3:
290 return 1;
291 default:
292 return 0;
293 }
294}
295
296static int rt5640_readable_register(
297 struct snd_soc_codec *codec, unsigned int reg)
298{
299 switch (reg) {
300 case RT5640_RESET:
301 case RT5640_SPK_VOL:
302 case RT5640_HP_VOL:
303 case RT5640_OUTPUT:
304 case RT5640_MONO_OUT:
305 case RT5640_IN1_IN2:
306 case RT5640_IN3_IN4:
307 case RT5640_INL_INR_VOL:
308 case RT5640_DAC1_DIG_VOL:
309 case RT5640_DAC2_DIG_VOL:
310 case RT5640_DAC2_CTRL:
311 case RT5640_ADC_DIG_VOL:
312 case RT5640_ADC_DATA:
313 case RT5640_ADC_BST_VOL:
314 case RT5640_STO_ADC_MIXER:
315 case RT5640_MONO_ADC_MIXER:
316 case RT5640_AD_DA_MIXER:
317 case RT5640_STO_DAC_MIXER:
318 case RT5640_MONO_DAC_MIXER:
319 case RT5640_DIG_MIXER:
320 case RT5640_DSP_PATH1:
321 case RT5640_DSP_PATH2:
322 case RT5640_DIG_INF_DATA:
323 case RT5640_REC_L1_MIXER:
324 case RT5640_REC_L2_MIXER:
325 case RT5640_REC_R1_MIXER:
326 case RT5640_REC_R2_MIXER:
327 case RT5640_HPO_MIXER:
328 case RT5640_SPK_L_MIXER:
329 case RT5640_SPK_R_MIXER:
330 case RT5640_SPO_L_MIXER:
331 case RT5640_SPO_R_MIXER:
332 case RT5640_SPO_CLSD_RATIO:
333 case RT5640_MONO_MIXER:
334 case RT5640_OUT_L1_MIXER:
335 case RT5640_OUT_L2_MIXER:
336 case RT5640_OUT_L3_MIXER:
337 case RT5640_OUT_R1_MIXER:
338 case RT5640_OUT_R2_MIXER:
339 case RT5640_OUT_R3_MIXER:
340 case RT5640_LOUT_MIXER:
341 case RT5640_PWR_DIG1:
342 case RT5640_PWR_DIG2:
343 case RT5640_PWR_ANLG1:
344 case RT5640_PWR_ANLG2:
345 case RT5640_PWR_MIXER:
346 case RT5640_PWR_VOL:
347 case RT5640_PRIV_INDEX:
348 case RT5640_PRIV_DATA:
349 case RT5640_I2S1_SDP:
350 case RT5640_I2S2_SDP:
351 case RT5640_I2S3_SDP:
352 case RT5640_ADDA_CLK1:
353 case RT5640_ADDA_CLK2:
354 case RT5640_DMIC:
355 case RT5640_GLB_CLK:
356 case RT5640_PLL_CTRL1:
357 case RT5640_PLL_CTRL2:
358 case RT5640_ASRC_1:
359 case RT5640_ASRC_2:
360 case RT5640_ASRC_3:
361 case RT5640_ASRC_4:
362 case RT5640_ASRC_5:
363 case RT5640_HP_OVCD:
364 case RT5640_CLS_D_OVCD:
365 case RT5640_CLS_D_OUT:
366 case RT5640_DEPOP_M1:
367 case RT5640_DEPOP_M2:
368 case RT5640_DEPOP_M3:
369 case RT5640_CHARGE_PUMP:
370 case RT5640_PV_DET_SPK_G:
371 case RT5640_MICBIAS:
372 case RT5640_EQ_CTRL1:
373 case RT5640_EQ_CTRL2:
374 case RT5640_WIND_FILTER:
375 case RT5640_DRC_AGC_1:
376 case RT5640_DRC_AGC_2:
377 case RT5640_DRC_AGC_3:
378 case RT5640_SVOL_ZC:
379 case RT5640_ANC_CTRL1:
380 case RT5640_ANC_CTRL2:
381 case RT5640_ANC_CTRL3:
382 case RT5640_JD_CTRL:
383 case RT5640_ANC_JD:
384 case RT5640_IRQ_CTRL1:
385 case RT5640_IRQ_CTRL2:
386 case RT5640_INT_IRQ_ST:
387 case RT5640_GPIO_CTRL1:
388 case RT5640_GPIO_CTRL2:
389 case RT5640_GPIO_CTRL3:
390 case RT5640_DSP_CTRL1:
391 case RT5640_DSP_CTRL2:
392 case RT5640_DSP_CTRL3:
393 case RT5640_DSP_CTRL4:
394 case RT5640_PGM_REG_ARR1:
395 case RT5640_PGM_REG_ARR2:
396 case RT5640_PGM_REG_ARR3:
397 case RT5640_PGM_REG_ARR4:
398 case RT5640_PGM_REG_ARR5:
399 case RT5640_SCB_FUNC:
400 case RT5640_SCB_CTRL:
401 case RT5640_BASE_BACK:
402 case RT5640_MP3_PLUS1:
403 case RT5640_MP3_PLUS2:
404 case RT5640_3D_HP:
405 case RT5640_ADJ_HPF:
406 case RT5640_HP_CALIB_AMP_DET:
407 case RT5640_HP_CALIB2:
408 case RT5640_SV_ZCD1:
409 case RT5640_SV_ZCD2:
410 case RT5640_DUMMY1:
411 case RT5640_DUMMY2:
412 case RT5640_DUMMY3:
413 case RT5640_VENDOR_ID:
414 case RT5640_VENDOR_ID1:
415 case RT5640_VENDOR_ID2:
416 return 1;
417 default:
418 return 0;
419 }
420}
421
422int rt5640_headset_detect(struct snd_soc_codec *codec, int jack_insert)
423{
424 int jack_type;
425
426 if (jack_insert) {
427 snd_soc_update_bits(codec, RT5640_PWR_ANLG1,
428 RT5640_PWR_LDO2, RT5640_PWR_LDO2);
429 snd_soc_update_bits(codec, RT5640_PWR_ANLG2,
430 RT5640_PWR_MB1, RT5640_PWR_MB1);
431 snd_soc_update_bits(codec, RT5640_MICBIAS,
432 RT5640_MIC1_OVCD_MASK | RT5640_MIC1_OVTH_MASK |
433 RT5640_PWR_CLK25M_MASK | RT5640_PWR_MB_MASK,
434 RT5640_MIC1_OVCD_EN | RT5640_MIC1_OVTH_600UA |
435 RT5640_PWR_MB_PU | RT5640_PWR_CLK25M_PU);
436 snd_soc_update_bits(codec, RT5640_DUMMY1,
437 0x1, 0x1);
438 msleep(50);
439 if (snd_soc_read(codec, RT5640_IRQ_CTRL2) & 0x8)
440 jack_type = RT5640_HEADPHO_DET;
441 else
442 jack_type = RT5640_HEADSET_DET;
443 snd_soc_update_bits(codec, RT5640_IRQ_CTRL2,
444 RT5640_MB1_OC_CLR, 0);
445 } else {
446 snd_soc_update_bits(codec, RT5640_MICBIAS,
447 RT5640_MIC1_OVCD_MASK,
448 RT5640_MIC1_OVCD_DIS);
449
450 jack_type = RT5640_NO_JACK;
451 }
452
453 return jack_type;
454}
455EXPORT_SYMBOL(rt5640_headset_detect);
456
457static const DECLARE_TLV_DB_SCALE(out_vol_tlv, -4650, 150, 0);
458static const DECLARE_TLV_DB_SCALE(dac_vol_tlv, -65625, 375, 0);
459static const DECLARE_TLV_DB_SCALE(in_vol_tlv, -3450, 150, 0);
460static const DECLARE_TLV_DB_SCALE(adc_vol_tlv, -17625, 375, 0);
461static const DECLARE_TLV_DB_SCALE(adc_bst_tlv, 0, 1200, 0);
462
463/* {0, +20, +24, +30, +35, +40, +44, +50, +52} dB */
464static unsigned int bst_tlv[] = {
465 TLV_DB_RANGE_HEAD(7),
466 0, 0, TLV_DB_SCALE_ITEM(0, 0, 0),
467 1, 1, TLV_DB_SCALE_ITEM(2000, 0, 0),
468 2, 2, TLV_DB_SCALE_ITEM(2400, 0, 0),
469 3, 5, TLV_DB_SCALE_ITEM(3000, 500, 0),
470 6, 6, TLV_DB_SCALE_ITEM(4400, 0, 0),
471 7, 7, TLV_DB_SCALE_ITEM(5000, 0, 0),
472 8, 8, TLV_DB_SCALE_ITEM(5200, 0, 0),
473};
474
475static int rt5640_dmic_get(struct snd_kcontrol *kcontrol,
476 struct snd_ctl_elem_value *ucontrol)
477{
478 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
479 struct rt5640_priv *rt5640 = snd_soc_codec_get_drvdata(codec);
480
481 ucontrol->value.integer.value[0] = rt5640->dmic_en;
482
483 return 0;
484}
485
486static int rt5640_dmic_put(struct snd_kcontrol *kcontrol,
487 struct snd_ctl_elem_value *ucontrol)
488{
489 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
490 struct rt5640_priv *rt5640 = snd_soc_codec_get_drvdata(codec);
491
492 if (rt5640->dmic_en == ucontrol->value.integer.value[0])
493 return 0;
494
495 rt5640->dmic_en = ucontrol->value.integer.value[0];
496 switch (rt5640->dmic_en) {
497 case RT5640_DMIC_DIS:
498 snd_soc_update_bits(codec, RT5640_GPIO_CTRL1,
499 RT5640_GP2_PIN_MASK | RT5640_GP3_PIN_MASK |
500 RT5640_GP4_PIN_MASK,
501 RT5640_GP2_PIN_GPIO2 | RT5640_GP3_PIN_GPIO3 |
502 RT5640_GP4_PIN_GPIO4);
503 snd_soc_update_bits(codec, RT5640_DMIC,
504 RT5640_DMIC_1_DP_MASK | RT5640_DMIC_2_DP_MASK,
505 RT5640_DMIC_1_DP_GPIO3 | RT5640_DMIC_2_DP_GPIO4);
506 snd_soc_update_bits(codec, RT5640_DMIC,
507 RT5640_DMIC_1_EN_MASK | RT5640_DMIC_2_EN_MASK,
508 RT5640_DMIC_1_DIS | RT5640_DMIC_2_DIS);
509 break;
510
511 case RT5640_DMIC1:
512 snd_soc_update_bits(codec, RT5640_GPIO_CTRL1,
513 RT5640_GP2_PIN_MASK | RT5640_GP3_PIN_MASK,
514 RT5640_GP2_PIN_DMIC1_SCL | RT5640_GP3_PIN_DMIC1_SDA);
515 snd_soc_update_bits(codec, RT5640_DMIC,
516 RT5640_DMIC_1L_LH_MASK | RT5640_DMIC_1R_LH_MASK |
517 RT5640_DMIC_1_DP_MASK,
518 RT5640_DMIC_1L_LH_FALLING | RT5640_DMIC_1R_LH_RISING |
519 RT5640_DMIC_1_DP_IN1P);
520 snd_soc_update_bits(codec, RT5640_DMIC,
521 RT5640_DMIC_1_EN_MASK, RT5640_DMIC_1_EN);
522 break;
523
524 case RT5640_DMIC2:
525 snd_soc_update_bits(codec, RT5640_GPIO_CTRL1,
526 RT5640_GP2_PIN_MASK | RT5640_GP4_PIN_MASK,
527 RT5640_GP2_PIN_DMIC1_SCL | RT5640_GP4_PIN_DMIC2_SDA);
528 snd_soc_update_bits(codec, RT5640_DMIC,
529 RT5640_DMIC_2L_LH_MASK | RT5640_DMIC_2R_LH_MASK |
530 RT5640_DMIC_2_DP_MASK,
531 RT5640_DMIC_2L_LH_FALLING | RT5640_DMIC_2R_LH_RISING |
532 RT5640_DMIC_2_DP_IN1N);
533 snd_soc_update_bits(codec, RT5640_DMIC,
534 RT5640_DMIC_2_EN_MASK, RT5640_DMIC_2_EN);
535 break;
536
537 default:
538 return -EINVAL;
539 }
540
541 return 0;
542}
543
544
545/* IN1/IN2 Input Type */
546static const char *rt5640_input_mode[] = {
547 "Single ended", "Differential"};
548
549static const SOC_ENUM_SINGLE_DECL(
550 rt5640_in1_mode_enum, RT5640_IN1_IN2,
551 RT5640_IN_SFT1, rt5640_input_mode);
552
553static const SOC_ENUM_SINGLE_DECL(
554 rt5640_in2_mode_enum, RT5640_IN3_IN4,
555 RT5640_IN_SFT2, rt5640_input_mode);
556
557/* Interface data select */
558static const char *rt5640_data_select[] = {
559 "Normal", "left copy to right", "right copy to left", "Swap"};
560
561static const SOC_ENUM_SINGLE_DECL(rt5640_if1_dac_enum, RT5640_DIG_INF_DATA,
562 RT5640_IF1_DAC_SEL_SFT, rt5640_data_select);
563
564static const SOC_ENUM_SINGLE_DECL(rt5640_if1_adc_enum, RT5640_DIG_INF_DATA,
565 RT5640_IF1_ADC_SEL_SFT, rt5640_data_select);
566
567static const SOC_ENUM_SINGLE_DECL(rt5640_if2_dac_enum, RT5640_DIG_INF_DATA,
568 RT5640_IF2_DAC_SEL_SFT, rt5640_data_select);
569
570static const SOC_ENUM_SINGLE_DECL(rt5640_if2_adc_enum, RT5640_DIG_INF_DATA,
571 RT5640_IF2_ADC_SEL_SFT, rt5640_data_select);
572
573static const SOC_ENUM_SINGLE_DECL(rt5640_if3_dac_enum, RT5640_DIG_INF_DATA,
574 RT5640_IF3_DAC_SEL_SFT, rt5640_data_select);
575
576static const SOC_ENUM_SINGLE_DECL(rt5640_if3_adc_enum, RT5640_DIG_INF_DATA,
577 RT5640_IF3_ADC_SEL_SFT, rt5640_data_select);
578
579/* Class D speaker gain ratio */
580static const char *rt5640_clsd_spk_ratio[] = {"1.66x", "1.83x", "1.94x", "2x",
581 "2.11x", "2.22x", "2.33x", "2.44x", "2.55x", "2.66x", "2.77x"};
582
583static const SOC_ENUM_SINGLE_DECL(
584 rt5640_clsd_spk_ratio_enum, RT5640_CLS_D_OUT,
585 RT5640_CLSD_RATIO_SFT, rt5640_clsd_spk_ratio);
586
587/* DMIC */
588static const char *rt5640_dmic_mode[] = {"Disable", "DMIC1", "DMIC2"};
589
590static const SOC_ENUM_SINGLE_DECL(rt5640_dmic_enum, 0, 0, rt5640_dmic_mode);
591
592
593
594#ifdef RT5640_REG_RW
595#define REGVAL_MAX 0xffff
596static unsigned int regctl_addr;
597static int rt5640_regctl_info(struct snd_kcontrol *kcontrol,
598 struct snd_ctl_elem_info *uinfo) {
599 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
600 uinfo->count = 2;
601 uinfo->value.integer.min = 0;
602 uinfo->value.integer.max = REGVAL_MAX;
603 return 0;
604}
605
606static int rt5640_regctl_get(struct snd_kcontrol *kcontrol,
607 struct snd_ctl_elem_value *ucontrol)
608{
609 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
610 ucontrol->value.integer.value[0] = regctl_addr;
611 ucontrol->value.integer.value[1] = snd_soc_read(codec, regctl_addr);
612 return 0;
613}
614
615static int rt5640_regctl_put(struct snd_kcontrol *kcontrol,
616 struct snd_ctl_elem_value *ucontrol)
617{
618 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
619 regctl_addr = ucontrol->value.integer.value[0];
620 if (ucontrol->value.integer.value[1] <= REGVAL_MAX)
621 snd_soc_write(codec, regctl_addr,
622 ucontrol->value.integer.value[1]);
623 return 0;
624}
625#endif
626
627
628#define VOL_RESCALE_MAX_VOL 0x27 /* 39 */
629#define VOL_RESCALE_MIX_RANGE 0x1F /* 31 */
630
631static int rt5640_vol_rescale_get(struct snd_kcontrol *kcontrol,
632 struct snd_ctl_elem_value *ucontrol)
633{
634 struct soc_mixer_control *mc =
635 (struct soc_mixer_control *)kcontrol->private_value;
636 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
637 unsigned int val = snd_soc_read(codec, mc->reg);
638
639 ucontrol->value.integer.value[0] = VOL_RESCALE_MAX_VOL -
640 ((val & RT5640_L_VOL_MASK) >> mc->shift);
641 ucontrol->value.integer.value[1] = VOL_RESCALE_MAX_VOL -
642 (val & RT5640_R_VOL_MASK);
643
644 return 0;
645}
646
647static int rt5640_vol_rescale_put(struct snd_kcontrol *kcontrol,
648 struct snd_ctl_elem_value *ucontrol)
649{
650 struct soc_mixer_control *mc =
651 (struct soc_mixer_control *)kcontrol->private_value;
652 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
653 unsigned int val, val2;
654
655 val = VOL_RESCALE_MAX_VOL - ucontrol->value.integer.value[0];
656 val2 = VOL_RESCALE_MAX_VOL - ucontrol->value.integer.value[1];
657 return snd_soc_update_bits_locked(codec, mc->reg, RT5640_L_VOL_MASK |
658 RT5640_R_VOL_MASK, val << mc->shift | val2);
659}
660
661
662static const struct snd_kcontrol_new rt5640_snd_controls[] = {
663 /* Speaker Output Volume */
664 SOC_DOUBLE_EXT_TLV("Speaker Playback Volume", RT5640_SPK_VOL,
665 RT5640_L_VOL_SFT, RT5640_R_VOL_SFT, VOL_RESCALE_MIX_RANGE, 0,
666 rt5640_vol_rescale_get, rt5640_vol_rescale_put, out_vol_tlv),
667
668 /* Headphone Output Volume */
669 SOC_DOUBLE("HP Playback Switch", RT5640_HP_VOL,
670 RT5640_L_MUTE_SFT, RT5640_R_MUTE_SFT, 1, 1),
671
672 SOC_DOUBLE_EXT_TLV("HP Playback Volume", RT5640_HP_VOL,
673 RT5640_L_VOL_SFT, RT5640_R_VOL_SFT, VOL_RESCALE_MIX_RANGE, 0,
674 rt5640_vol_rescale_get, rt5640_vol_rescale_put, out_vol_tlv),
675
676 /* OUTPUT Control */
677 SOC_DOUBLE("OUT Playback Switch", RT5640_OUTPUT,
678 RT5640_L_MUTE_SFT, RT5640_R_MUTE_SFT, 1, 1),
679 SOC_DOUBLE("OUT Channel Switch", RT5640_OUTPUT,
680 RT5640_VOL_L_SFT, RT5640_VOL_R_SFT, 1, 1),
681 SOC_DOUBLE_TLV("OUT Playback Volume", RT5640_OUTPUT,
682 RT5640_L_VOL_SFT, RT5640_R_VOL_SFT, 39, 1, out_vol_tlv),
683 /* MONO Output Control */
684 SOC_SINGLE("Mono Playback Switch", RT5640_MONO_OUT,
685 RT5640_L_MUTE_SFT, 1, 1),
686 /* DAC Digital Volume */
687 SOC_DOUBLE("DAC2 Playback Switch", RT5640_DAC2_CTRL,
688 RT5640_M_DAC_L2_VOL_SFT, RT5640_M_DAC_R2_VOL_SFT, 1, 1),
689 SOC_DOUBLE_TLV("DAC1 Playback Volume", RT5640_DAC1_DIG_VOL,
690 RT5640_L_VOL_SFT, RT5640_R_VOL_SFT,
691 175, 0, dac_vol_tlv),
692 SOC_DOUBLE_TLV("Mono DAC Playback Volume", RT5640_DAC2_DIG_VOL,
693 RT5640_L_VOL_SFT, RT5640_R_VOL_SFT,
694 175, 0, dac_vol_tlv),
695 /* IN1/IN2 Control */
696 SOC_ENUM("IN1 Mode Control", rt5640_in1_mode_enum),
697 SOC_SINGLE_TLV("IN1 Boost", RT5640_IN1_IN2,
698 RT5640_BST_SFT1, 8, 0, bst_tlv),
699 SOC_ENUM("IN2 Mode Control", rt5640_in2_mode_enum),
700 SOC_SINGLE_TLV("IN2 Boost", RT5640_IN3_IN4,
701 RT5640_BST_SFT2, 8, 0, bst_tlv),
702 /* INL/INR Volume Control */
703 SOC_DOUBLE_TLV("IN Capture Volume", RT5640_INL_INR_VOL,
704 RT5640_INL_VOL_SFT, RT5640_INR_VOL_SFT,
705 31, 1, in_vol_tlv),
706 /* ADC Digital Volume Control */
707 SOC_DOUBLE("ADC Capture Switch", RT5640_ADC_DIG_VOL,
708 RT5640_L_MUTE_SFT, RT5640_R_MUTE_SFT, 1, 1),
709 SOC_DOUBLE_TLV("ADC Capture Volume", RT5640_ADC_DIG_VOL,
710 RT5640_L_VOL_SFT, RT5640_R_VOL_SFT,
711 127, 0, adc_vol_tlv),
712 SOC_DOUBLE_TLV("Mono ADC Capture Volume", RT5640_ADC_DATA,
713 RT5640_L_VOL_SFT, RT5640_R_VOL_SFT,
714 127, 0, adc_vol_tlv),
715 /* ADC Boost Volume Control */
716 SOC_DOUBLE_TLV("ADC Boost Gain", RT5640_ADC_BST_VOL,
717 RT5640_ADC_L_BST_SFT, RT5640_ADC_R_BST_SFT,
718 3, 0, adc_bst_tlv),
719 /* Class D speaker gain ratio */
720 SOC_ENUM("Class D SPK Ratio Control", rt5640_clsd_spk_ratio_enum),
721 /* DMIC */
722 SOC_ENUM_EXT("DMIC Switch", rt5640_dmic_enum,
723 rt5640_dmic_get, rt5640_dmic_put),
724
725#ifdef RT5640_REG_RW
726 {
727 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
728 .name = "Register Control",
729 .info = rt5640_regctl_info,
730 .get = rt5640_regctl_get,
731 .put = rt5640_regctl_put,
732 },
733#endif
734};
735
736/**
737 * set_dmic_clk - Set parameter of dmic.
738 *
739 * @w: DAPM widget.
740 * @kcontrol: The kcontrol of this widget.
741 * @event: Event id.
742 *
743 * Choose dmic clock between 1MHz and 3MHz.
744 * It is better for clock to approximate 3MHz.
745 */
746static int set_dmic_clk(struct snd_soc_dapm_widget *w,
747 struct snd_kcontrol *kcontrol, int event)
748{
749 struct snd_soc_codec *codec = w->codec;
750 struct rt5640_priv *rt5640 = snd_soc_codec_get_drvdata(codec);
751 int div[] = {2, 3, 4, 6, 12}, idx = -EINVAL, i, rate, red, bound, temp;
752
753 rate = rt5640->lrck[rt5640->aif_pu] << 8;
754 red = 3000000 * 12;
755 for (i = 0; i < ARRAY_SIZE(div); i++) {
756 bound = div[i] * 3000000;
757 if (rate > bound)
758 continue;
759 temp = bound - rate;
760 if (temp < red) {
761 red = temp;
762 idx = i;
763 }
764 }
765 if (idx < 0)
766 dev_err(codec->dev, "Failed to set DMIC clock\n");
767 else
768 snd_soc_update_bits(codec, RT5640_DMIC, RT5640_DMIC_CLK_MASK,
769 idx << RT5640_DMIC_CLK_SFT);
770 return idx;
771}
772
773static int check_sysclk1_source(struct snd_soc_dapm_widget *source,
774 struct snd_soc_dapm_widget *sink)
775{
776 unsigned int val;
777
778 val = snd_soc_read(source->codec, RT5640_GLB_CLK);
779 val &= RT5640_SCLK_SRC_MASK;
780 if (val == RT5640_SCLK_SRC_PLL1 || val == RT5640_SCLK_SRC_PLL1T)
781 return 1;
782 else
783 return 0;
784}
785
786/* Digital Mixer */
787static const struct snd_kcontrol_new rt5640_sto_adc_l_mix[] = {
788 SOC_DAPM_SINGLE("ADC1 Switch", RT5640_STO_ADC_MIXER,
789 RT5640_M_ADC_L1_SFT, 1, 1),
790 SOC_DAPM_SINGLE("ADC2 Switch", RT5640_STO_ADC_MIXER,
791 RT5640_M_ADC_L2_SFT, 1, 1),
792};
793
794static const struct snd_kcontrol_new rt5640_sto_adc_r_mix[] = {
795 SOC_DAPM_SINGLE("ADC1 Switch", RT5640_STO_ADC_MIXER,
796 RT5640_M_ADC_R1_SFT, 1, 1),
797 SOC_DAPM_SINGLE("ADC2 Switch", RT5640_STO_ADC_MIXER,
798 RT5640_M_ADC_R2_SFT, 1, 1),
799};
800
801static const struct snd_kcontrol_new rt5640_mono_adc_l_mix[] = {
802 SOC_DAPM_SINGLE("ADC1 Switch", RT5640_MONO_ADC_MIXER,
803 RT5640_M_MONO_ADC_L1_SFT, 1, 1),
804 SOC_DAPM_SINGLE("ADC2 Switch", RT5640_MONO_ADC_MIXER,
805 RT5640_M_MONO_ADC_L2_SFT, 1, 1),
806};
807
808static const struct snd_kcontrol_new rt5640_mono_adc_r_mix[] = {
809 SOC_DAPM_SINGLE("ADC1 Switch", RT5640_MONO_ADC_MIXER,
810 RT5640_M_MONO_ADC_R1_SFT, 1, 1),
811 SOC_DAPM_SINGLE("ADC2 Switch", RT5640_MONO_ADC_MIXER,
812 RT5640_M_MONO_ADC_R2_SFT, 1, 1),
813};
814
815static const struct snd_kcontrol_new rt5640_dac_l_mix[] = {
816 SOC_DAPM_SINGLE("Stereo ADC Switch", RT5640_AD_DA_MIXER,
817 RT5640_M_ADCMIX_L_SFT, 1, 1),
818 SOC_DAPM_SINGLE("INF1 Switch", RT5640_AD_DA_MIXER,
819 RT5640_M_IF1_DAC_L_SFT, 1, 1),
820};
821
822static const struct snd_kcontrol_new rt5640_dac_r_mix[] = {
823 SOC_DAPM_SINGLE("Stereo ADC Switch", RT5640_AD_DA_MIXER,
824 RT5640_M_ADCMIX_R_SFT, 1, 1),
825 SOC_DAPM_SINGLE("INF1 Switch", RT5640_AD_DA_MIXER,
826 RT5640_M_IF1_DAC_R_SFT, 1, 1),
827};
828
829static const struct snd_kcontrol_new rt5640_sto_dac_l_mix[] = {
830 SOC_DAPM_SINGLE("DAC L1 Switch", RT5640_STO_DAC_MIXER,
831 RT5640_M_DAC_L1_SFT, 1, 1),
832 SOC_DAPM_SINGLE("DAC L2 Switch", RT5640_STO_DAC_MIXER,
833 RT5640_M_DAC_L2_SFT, 1, 1),
834 SOC_DAPM_SINGLE("ANC Switch", RT5640_STO_DAC_MIXER,
835 RT5640_M_ANC_DAC_L_SFT, 1, 1),
836};
837
838static const struct snd_kcontrol_new rt5640_sto_dac_r_mix[] = {
839 SOC_DAPM_SINGLE("DAC R1 Switch", RT5640_STO_DAC_MIXER,
840 RT5640_M_DAC_R1_SFT, 1, 1),
841 SOC_DAPM_SINGLE("DAC R2 Switch", RT5640_STO_DAC_MIXER,
842 RT5640_M_DAC_R2_SFT, 1, 1),
843 SOC_DAPM_SINGLE("ANC Switch", RT5640_STO_DAC_MIXER,
844 RT5640_M_ANC_DAC_R_SFT, 1, 1),
845};
846
847static const struct snd_kcontrol_new rt5640_mono_dac_l_mix[] = {
848 SOC_DAPM_SINGLE("DAC L1 Switch", RT5640_MONO_DAC_MIXER,
849 RT5640_M_DAC_L1_MONO_L_SFT, 1, 1),
850 SOC_DAPM_SINGLE("DAC L2 Switch", RT5640_MONO_DAC_MIXER,
851 RT5640_M_DAC_L2_MONO_L_SFT, 1, 1),
852 SOC_DAPM_SINGLE("DAC R2 Switch", RT5640_MONO_DAC_MIXER,
853 RT5640_M_DAC_R2_MONO_L_SFT, 1, 1),
854};
855
856static const struct snd_kcontrol_new rt5640_mono_dac_r_mix[] = {
857 SOC_DAPM_SINGLE("DAC R1 Switch", RT5640_MONO_DAC_MIXER,
858 RT5640_M_DAC_R1_MONO_R_SFT, 1, 1),
859 SOC_DAPM_SINGLE("DAC R2 Switch", RT5640_MONO_DAC_MIXER,
860 RT5640_M_DAC_R2_MONO_R_SFT, 1, 1),
861 SOC_DAPM_SINGLE("DAC L2 Switch", RT5640_MONO_DAC_MIXER,
862 RT5640_M_DAC_L2_MONO_R_SFT, 1, 1),
863};
864
865static const struct snd_kcontrol_new rt5640_dig_l_mix[] = {
866 SOC_DAPM_SINGLE("DAC L1 Switch", RT5640_DIG_MIXER,
867 RT5640_M_STO_L_DAC_L_SFT, 1, 1),
868 SOC_DAPM_SINGLE("DAC L2 Switch", RT5640_DIG_MIXER,
869 RT5640_M_DAC_L2_DAC_L_SFT, 1, 1),
870};
871
872static const struct snd_kcontrol_new rt5640_dig_r_mix[] = {
873 SOC_DAPM_SINGLE("DAC R1 Switch", RT5640_DIG_MIXER,
874 RT5640_M_STO_R_DAC_R_SFT, 1, 1),
875 SOC_DAPM_SINGLE("DAC R2 Switch", RT5640_DIG_MIXER,
876 RT5640_M_DAC_R2_DAC_R_SFT, 1, 1),
877};
878
879/* Analog Input Mixer */
880static const struct snd_kcontrol_new rt5640_rec_l_mix[] = {
881 SOC_DAPM_SINGLE("HPOL Switch", RT5640_REC_L2_MIXER,
882 RT5640_M_HP_L_RM_L_SFT, 1, 1),
883 SOC_DAPM_SINGLE("INL Switch", RT5640_REC_L2_MIXER,
884 RT5640_M_IN_L_RM_L_SFT, 1, 1),
885 SOC_DAPM_SINGLE("BST2 Switch", RT5640_REC_L2_MIXER,
886 RT5640_M_BST4_RM_L_SFT, 1, 1),
887 SOC_DAPM_SINGLE("BST1 Switch", RT5640_REC_L2_MIXER,
888 RT5640_M_BST1_RM_L_SFT, 1, 1),
889 SOC_DAPM_SINGLE("OUT MIXL Switch", RT5640_REC_L2_MIXER,
890 RT5640_M_OM_L_RM_L_SFT, 1, 1),
891};
892
893static const struct snd_kcontrol_new rt5640_rec_r_mix[] = {
894 SOC_DAPM_SINGLE("HPOR Switch", RT5640_REC_R2_MIXER,
895 RT5640_M_HP_R_RM_R_SFT, 1, 1),
896 SOC_DAPM_SINGLE("INR Switch", RT5640_REC_R2_MIXER,
897 RT5640_M_IN_R_RM_R_SFT, 1, 1),
898 SOC_DAPM_SINGLE("BST2 Switch", RT5640_REC_R2_MIXER,
899 RT5640_M_BST4_RM_R_SFT, 1, 1),
900 SOC_DAPM_SINGLE("BST1 Switch", RT5640_REC_R2_MIXER,
901 RT5640_M_BST1_RM_R_SFT, 1, 1),
902 SOC_DAPM_SINGLE("OUT MIXR Switch", RT5640_REC_R2_MIXER,
903 RT5640_M_OM_R_RM_R_SFT, 1, 1),
904};
905
906/* Analog Output Mixer */
907static const struct snd_kcontrol_new rt5640_spk_l_mix[] = {
908 SOC_DAPM_SINGLE("REC MIXL Switch", RT5640_SPK_L_MIXER,
909 RT5640_M_RM_L_SM_L_SFT, 1, 1),
910 SOC_DAPM_SINGLE("INL Switch", RT5640_SPK_L_MIXER,
911 RT5640_M_IN_L_SM_L_SFT, 1, 1),
912 SOC_DAPM_SINGLE("DAC L1 Switch", RT5640_SPK_L_MIXER,
913 RT5640_M_DAC_L1_SM_L_SFT, 1, 1),
914 SOC_DAPM_SINGLE("DAC L2 Switch", RT5640_SPK_L_MIXER,
915 RT5640_M_DAC_L2_SM_L_SFT, 1, 1),
916 SOC_DAPM_SINGLE("OUT MIXL Switch", RT5640_SPK_L_MIXER,
917 RT5640_M_OM_L_SM_L_SFT, 1, 1),
918};
919
920static const struct snd_kcontrol_new rt5640_spk_r_mix[] = {
921 SOC_DAPM_SINGLE("REC MIXR Switch", RT5640_SPK_R_MIXER,
922 RT5640_M_RM_R_SM_R_SFT, 1, 1),
923 SOC_DAPM_SINGLE("INR Switch", RT5640_SPK_R_MIXER,
924 RT5640_M_IN_R_SM_R_SFT, 1, 1),
925 SOC_DAPM_SINGLE("DAC R1 Switch", RT5640_SPK_R_MIXER,
926 RT5640_M_DAC_R1_SM_R_SFT, 1, 1),
927 SOC_DAPM_SINGLE("DAC R2 Switch", RT5640_SPK_R_MIXER,
928 RT5640_M_DAC_R2_SM_R_SFT, 1, 1),
929 SOC_DAPM_SINGLE("OUT MIXR Switch", RT5640_SPK_R_MIXER,
930 RT5640_M_OM_R_SM_R_SFT, 1, 1),
931};
932
933static const struct snd_kcontrol_new rt5640_out_l_mix[] = {
934 SOC_DAPM_SINGLE("SPK MIXL Switch", RT5640_OUT_L3_MIXER,
935 RT5640_M_SM_L_OM_L_SFT, 1, 1),
936 SOC_DAPM_SINGLE("BST1 Switch", RT5640_OUT_L3_MIXER,
937 RT5640_M_BST1_OM_L_SFT, 1, 1),
938 SOC_DAPM_SINGLE("INL Switch", RT5640_OUT_L3_MIXER,
939 RT5640_M_IN_L_OM_L_SFT, 1, 1),
940 SOC_DAPM_SINGLE("REC MIXL Switch", RT5640_OUT_L3_MIXER,
941 RT5640_M_RM_L_OM_L_SFT, 1, 1),
942 SOC_DAPM_SINGLE("DAC R2 Switch", RT5640_OUT_L3_MIXER,
943 RT5640_M_DAC_R2_OM_L_SFT, 1, 1),
944 SOC_DAPM_SINGLE("DAC L2 Switch", RT5640_OUT_L3_MIXER,
945 RT5640_M_DAC_L2_OM_L_SFT, 1, 1),
946 SOC_DAPM_SINGLE("DAC L1 Switch", RT5640_OUT_L3_MIXER,
947 RT5640_M_DAC_L1_OM_L_SFT, 1, 1),
948};
949
950static const struct snd_kcontrol_new rt5640_out_r_mix[] = {
951 SOC_DAPM_SINGLE("SPK MIXR Switch", RT5640_OUT_R3_MIXER,
952 RT5640_M_SM_L_OM_R_SFT, 1, 1),
953 SOC_DAPM_SINGLE("BST2 Switch", RT5640_OUT_R3_MIXER,
954 RT5640_M_BST4_OM_R_SFT, 1, 1),
955 SOC_DAPM_SINGLE("BST1 Switch", RT5640_OUT_R3_MIXER,
956 RT5640_M_BST1_OM_R_SFT, 1, 1),
957 SOC_DAPM_SINGLE("INR Switch", RT5640_OUT_R3_MIXER,
958 RT5640_M_IN_R_OM_R_SFT, 1, 1),
959 SOC_DAPM_SINGLE("REC MIXR Switch", RT5640_OUT_R3_MIXER,
960 RT5640_M_RM_R_OM_R_SFT, 1, 1),
961 SOC_DAPM_SINGLE("DAC L2 Switch", RT5640_OUT_R3_MIXER,
962 RT5640_M_DAC_L2_OM_R_SFT, 1, 1),
963 SOC_DAPM_SINGLE("DAC R2 Switch", RT5640_OUT_R3_MIXER,
964 RT5640_M_DAC_R2_OM_R_SFT, 1, 1),
965 SOC_DAPM_SINGLE("DAC R1 Switch", RT5640_OUT_R3_MIXER,
966 RT5640_M_DAC_R1_OM_R_SFT, 1, 1),
967};
968
969static const struct snd_kcontrol_new rt5640_spo_l_mix[] = {
970 SOC_DAPM_SINGLE("DAC R1 Switch", RT5640_SPO_L_MIXER,
971 RT5640_M_DAC_R1_SPM_L_SFT, 1, 1),
972 SOC_DAPM_SINGLE("DAC L1 Switch", RT5640_SPO_L_MIXER,
973 RT5640_M_DAC_L1_SPM_L_SFT, 1, 1),
974 SOC_DAPM_SINGLE("SPKVOL R Switch", RT5640_SPO_L_MIXER,
975 RT5640_M_SV_R_SPM_L_SFT, 1, 1),
976 SOC_DAPM_SINGLE("SPKVOL L Switch", RT5640_SPO_L_MIXER,
977 RT5640_M_SV_L_SPM_L_SFT, 1, 1),
978 SOC_DAPM_SINGLE("BST1 Switch", RT5640_SPO_L_MIXER,
979 RT5640_M_BST1_SPM_L_SFT, 1, 1),
980};
981
982static const struct snd_kcontrol_new rt5640_spo_r_mix[] = {
983 SOC_DAPM_SINGLE("DAC R1 Switch", RT5640_SPO_R_MIXER,
984 RT5640_M_DAC_R1_SPM_R_SFT, 1, 1),
985 SOC_DAPM_SINGLE("SPKVOL R Switch", RT5640_SPO_R_MIXER,
986 RT5640_M_SV_R_SPM_R_SFT, 1, 1),
987 SOC_DAPM_SINGLE("BST1 Switch", RT5640_SPO_R_MIXER,
988 RT5640_M_BST1_SPM_R_SFT, 1, 1),
989};
990
991static const struct snd_kcontrol_new rt5640_hpo_mix[] = {
992 SOC_DAPM_SINGLE("DAC2 Switch", RT5640_HPO_MIXER,
993 RT5640_M_DAC2_HM_SFT, 1, 1),
994 SOC_DAPM_SINGLE("DAC1 Switch", RT5640_HPO_MIXER,
995 RT5640_M_DAC1_HM_SFT, 1, 1),
996 SOC_DAPM_SINGLE("HPVOL Switch", RT5640_HPO_MIXER,
997 RT5640_M_HPVOL_HM_SFT, 1, 1),
998};
999
1000static const struct snd_kcontrol_new rt5640_lout_mix[] = {
1001 SOC_DAPM_SINGLE("DAC L1 Switch", RT5640_LOUT_MIXER,
1002 RT5640_M_DAC_L1_LM_SFT, 1, 1),
1003 SOC_DAPM_SINGLE("DAC R1 Switch", RT5640_LOUT_MIXER,
1004 RT5640_M_DAC_R1_LM_SFT, 1, 1),
1005 SOC_DAPM_SINGLE("OUTVOL L Switch", RT5640_LOUT_MIXER,
1006 RT5640_M_OV_L_LM_SFT, 1, 1),
1007 SOC_DAPM_SINGLE("OUTVOL R Switch", RT5640_LOUT_MIXER,
1008 RT5640_M_OV_R_LM_SFT, 1, 1),
1009};
1010
1011static const struct snd_kcontrol_new rt5640_mono_mix[] = {
1012 SOC_DAPM_SINGLE("DAC R2 Switch", RT5640_MONO_MIXER,
1013 RT5640_M_DAC_R2_MM_SFT, 1, 1),
1014 SOC_DAPM_SINGLE("DAC L2 Switch", RT5640_MONO_MIXER,
1015 RT5640_M_DAC_L2_MM_SFT, 1, 1),
1016 SOC_DAPM_SINGLE("OUTVOL R Switch", RT5640_MONO_MIXER,
1017 RT5640_M_OV_R_MM_SFT, 1, 1),
1018 SOC_DAPM_SINGLE("OUTVOL L Switch", RT5640_MONO_MIXER,
1019 RT5640_M_OV_L_MM_SFT, 1, 1),
1020 SOC_DAPM_SINGLE("BST1 Switch", RT5640_MONO_MIXER,
1021 RT5640_M_BST1_MM_SFT, 1, 1),
1022};
1023
1024/* INL/R source */
1025static const char *rt5640_inl_src[] = {"IN2P", "MonoP"};
1026
1027static const SOC_ENUM_SINGLE_DECL(
1028 rt5640_inl_enum, RT5640_INL_INR_VOL,
1029 RT5640_INL_SEL_SFT, rt5640_inl_src);
1030
1031static const struct snd_kcontrol_new rt5640_inl_mux =
1032 SOC_DAPM_ENUM("INL source", rt5640_inl_enum);
1033
1034static const char *rt5640_inr_src[] = {"IN2N", "MonoN"};
1035
1036static const SOC_ENUM_SINGLE_DECL(
1037 rt5640_inr_enum, RT5640_INL_INR_VOL,
1038 RT5640_INR_SEL_SFT, rt5640_inr_src);
1039
1040static const struct snd_kcontrol_new rt5640_inr_mux =
1041 SOC_DAPM_ENUM("INR source", rt5640_inr_enum);
1042
1043/* Stereo ADC source */
1044static const char *rt5640_stereo_adc1_src[] = {"DIG MIX", "ADC"};
1045
1046static const SOC_ENUM_SINGLE_DECL(
1047 rt5640_stereo_adc1_enum, RT5640_STO_ADC_MIXER,
1048 RT5640_ADC_1_SRC_SFT, rt5640_stereo_adc1_src);
1049
1050static const struct snd_kcontrol_new rt5640_sto_adc_l1_mux =
1051 SOC_DAPM_ENUM("Stereo ADC L1 source", rt5640_stereo_adc1_enum);
1052
1053static const struct snd_kcontrol_new rt5640_sto_adc_r1_mux =
1054 SOC_DAPM_ENUM("Stereo ADC R1 source", rt5640_stereo_adc1_enum);
1055
1056static const char *rt5640_stereo_adc2_src[] = {"DMIC1", "DMIC2", "DIG MIX"};
1057
1058static const SOC_ENUM_SINGLE_DECL(
1059 rt5640_stereo_adc2_enum, RT5640_STO_ADC_MIXER,
1060 RT5640_ADC_2_SRC_SFT, rt5640_stereo_adc2_src);
1061
1062static const struct snd_kcontrol_new rt5640_sto_adc_l2_mux =
1063 SOC_DAPM_ENUM("Stereo ADC L2 source", rt5640_stereo_adc2_enum);
1064
1065static const struct snd_kcontrol_new rt5640_sto_adc_r2_mux =
1066 SOC_DAPM_ENUM("Stereo ADC R2 source", rt5640_stereo_adc2_enum);
1067
1068/* Mono ADC source */
1069static const char *rt5640_mono_adc_l1_src[] = {"Mono DAC MIXL", "ADCL"};
1070
1071static const SOC_ENUM_SINGLE_DECL(
1072 rt5640_mono_adc_l1_enum, RT5640_MONO_ADC_MIXER,
1073 RT5640_MONO_ADC_L1_SRC_SFT, rt5640_mono_adc_l1_src);
1074
1075static const struct snd_kcontrol_new rt5640_mono_adc_l1_mux =
1076 SOC_DAPM_ENUM("Mono ADC1 left source", rt5640_mono_adc_l1_enum);
1077
1078static const char *rt5640_mono_adc_l2_src[] = {
1079 "DMIC L1", "DMIC L2", "Mono DAC MIXL"
1080};
1081
1082static const SOC_ENUM_SINGLE_DECL(
1083 rt5640_mono_adc_l2_enum, RT5640_MONO_ADC_MIXER,
1084 RT5640_MONO_ADC_L2_SRC_SFT, rt5640_mono_adc_l2_src);
1085
1086static const struct snd_kcontrol_new rt5640_mono_adc_l2_mux =
1087 SOC_DAPM_ENUM("Mono ADC2 left source", rt5640_mono_adc_l2_enum);
1088
1089static const char *rt5640_mono_adc_r1_src[] = {"Mono DAC MIXR", "ADCR"};
1090
1091static const SOC_ENUM_SINGLE_DECL(
1092 rt5640_mono_adc_r1_enum, RT5640_MONO_ADC_MIXER,
1093 RT5640_MONO_ADC_R1_SRC_SFT, rt5640_mono_adc_r1_src);
1094
1095static const struct snd_kcontrol_new rt5640_mono_adc_r1_mux =
1096 SOC_DAPM_ENUM("Mono ADC1 right source", rt5640_mono_adc_r1_enum);
1097
1098static const char *rt5640_mono_adc_r2_src[] = {
1099 "DMIC R1", "DMIC R2", "Mono DAC MIXR"
1100};
1101
1102static const SOC_ENUM_SINGLE_DECL(
1103 rt5640_mono_adc_r2_enum, RT5640_MONO_ADC_MIXER,
1104 RT5640_MONO_ADC_R2_SRC_SFT, rt5640_mono_adc_r2_src);
1105
1106static const struct snd_kcontrol_new rt5640_mono_adc_r2_mux =
1107 SOC_DAPM_ENUM("Mono ADC2 right source", rt5640_mono_adc_r2_enum);
1108
1109/* DAC2 channel source */
1110static const char *rt5640_dac_l2_src[] = {"IF2", "IF3", "TxDC", "Base L/R"};
1111
1112static const SOC_ENUM_SINGLE_DECL(rt5640_dac_l2_enum, RT5640_DSP_PATH2,
1113 RT5640_DAC_L2_SEL_SFT, rt5640_dac_l2_src);
1114
1115static const struct snd_kcontrol_new rt5640_dac_l2_mux =
1116 SOC_DAPM_ENUM("DAC2 left channel source", rt5640_dac_l2_enum);
1117
1118static const char *rt5640_dac_r2_src[] = {"IF2", "IF3", "TxDC"};
1119
1120static const SOC_ENUM_SINGLE_DECL(
1121 rt5640_dac_r2_enum, RT5640_DSP_PATH2,
1122 RT5640_DAC_R2_SEL_SFT, rt5640_dac_r2_src);
1123
1124static const struct snd_kcontrol_new rt5640_dac_r2_mux =
1125 SOC_DAPM_ENUM("DAC2 right channel source", rt5640_dac_r2_enum);
1126
1127/* Interface 2 ADC channel source */
1128static const char *rt5640_if2_adc_l_src[] = {"TxDP", "Mono ADC MIXL"};
1129
1130static const SOC_ENUM_SINGLE_DECL(rt5640_if2_adc_l_enum, RT5640_DSP_PATH2,
1131 RT5640_IF2_ADC_L_SEL_SFT, rt5640_if2_adc_l_src);
1132
1133static const struct snd_kcontrol_new rt5640_if2_adc_l_mux =
1134 SOC_DAPM_ENUM("IF2 ADC left channel source", rt5640_if2_adc_l_enum);
1135
1136static const char *rt5640_if2_adc_r_src[] = {"TxDP", "Mono ADC MIXR"};
1137
1138static const SOC_ENUM_SINGLE_DECL(rt5640_if2_adc_r_enum, RT5640_DSP_PATH2,
1139 RT5640_IF2_ADC_R_SEL_SFT, rt5640_if2_adc_r_src);
1140
1141static const struct snd_kcontrol_new rt5640_if2_adc_r_mux =
1142 SOC_DAPM_ENUM("IF2 ADC right channel source", rt5640_if2_adc_r_enum);
1143
1144/* digital interface and iis interface map */
1145static const char *rt5640_dai_iis_map[] = {"1:1|2:2|3:3", "1:1|2:3|3:2",
1146 "1:3|2:1|3:2", "1:3|2:2|3:1", "1:2|2:3|3:1",
1147 "1:2|2:1|3:3", "1:1|2:1|3:3", "1:2|2:2|3:3"};
1148
1149static const SOC_ENUM_SINGLE_DECL(
1150 rt5640_dai_iis_map_enum, RT5640_I2S1_SDP,
1151 RT5640_I2S_IF_SFT, rt5640_dai_iis_map);
1152
1153static const struct snd_kcontrol_new rt5640_dai_mux =
1154 SOC_DAPM_ENUM("DAI select", rt5640_dai_iis_map_enum);
1155
1156/* SDI select */
1157static const char *rt5640_sdi_sel[] = {"IF1", "IF2"};
1158
1159static const SOC_ENUM_SINGLE_DECL(
1160 rt5640_sdi_sel_enum, RT5640_I2S2_SDP,
1161 RT5640_I2S2_SDI_SFT, rt5640_sdi_sel);
1162
1163static const struct snd_kcontrol_new rt5640_sdi_mux =
1164 SOC_DAPM_ENUM("SDI select", rt5640_sdi_sel_enum);
1165
1166static int spk_event(struct snd_soc_dapm_widget *w,
1167 struct snd_kcontrol *kcontrol, int event)
1168{
1169 struct snd_soc_codec *codec = w->codec;
1170 static unsigned int spkl_out_enable;
1171 static unsigned int spkr_out_enable;
1172
1173 switch (event) {
1174 case SND_SOC_DAPM_POST_PMU:
1175 pr_info("spk_event --SND_SOC_DAPM_POST_PMU\n");
1176 snd_soc_update_bits(codec, RT5640_PWR_DIG1, 0x0001, 0x0001);
1177 rt5640_index_update_bits(codec, 0x1c, 0xf000, 0xf000);
1178 /* rt5640_index_write(codec, 0x1c, 0xfd21); */
1179 break;
1180
1181 case SND_SOC_DAPM_PRE_PMD:
1182 pr_info("spk_event --SND_SOC_DAPM_POST_PMD\n");
1183 /* rt5640_index_write(codec, 0x1c, 0xfd00); */
1184 rt5640_index_update_bits(codec, 0x1c, 0xf000, 0x0000);
1185 snd_soc_update_bits(codec, RT5640_PWR_DIG1, 0x0001, 0x0000);
1186 break;
1187
1188 default:
1189 return 0;
1190 }
1191 return 0;
1192}
1193
1194static int hp_event(struct snd_soc_dapm_widget *w,
1195 struct snd_kcontrol *kcontrol, int event)
1196{
1197 struct snd_soc_codec *codec = w->codec;
1198 static unsigned int hp_out_enable;
1199
1200 switch (event) {
1201 case SND_SOC_DAPM_POST_PMU:
1202 pr_info("hp_event --SND_SOC_DAPM_POST_PMU\n");
1203 break;
1204
1205 case SND_SOC_DAPM_PRE_PMD:
1206 pr_info("hp_event --SND_SOC_DAPM_POST_PMD\n");
1207 break;
1208
1209 default:
1210 return 0;
1211 }
1212 return 0;
1213}
1214
1215static const struct snd_soc_dapm_widget rt5640_dapm_widgets[] = {
1216 SND_SOC_DAPM_SUPPLY("PLL1", RT5640_PWR_ANLG2,
1217 RT5640_PWR_PLL_BIT, 0, NULL, 0),
1218 /* Input Side */
1219 /* micbias */
1220 SND_SOC_DAPM_SUPPLY("LDO2", RT5640_PWR_ANLG1,
1221 RT5640_PWR_LDO2_BIT, 0, NULL, 0),
1222 SND_SOC_DAPM_MICBIAS("micbias1", RT5640_PWR_ANLG2,
1223 RT5640_PWR_MB1_BIT, 0),
1224 SND_SOC_DAPM_MICBIAS("micbias2", RT5640_PWR_ANLG2,
1225 RT5640_PWR_MB2_BIT, 0),
1226 /* Input Lines */
1227
1228 SND_SOC_DAPM_INPUT("MIC1"),
1229 SND_SOC_DAPM_INPUT("MIC2"),
1230 SND_SOC_DAPM_INPUT("DMIC1"),
1231 SND_SOC_DAPM_INPUT("DMIC2"),
1232 SND_SOC_DAPM_INPUT("IN1P"),
1233 SND_SOC_DAPM_INPUT("IN1N"),
1234 SND_SOC_DAPM_INPUT("IN2P"),
1235 SND_SOC_DAPM_INPUT("IN2N"),
1236 SND_SOC_DAPM_INPUT("DMIC L1"),
1237 SND_SOC_DAPM_INPUT("DMIC R1"),
1238 SND_SOC_DAPM_INPUT("DMIC L2"),
1239 SND_SOC_DAPM_INPUT("DMIC R2"),
1240 SND_SOC_DAPM_SUPPLY("DMIC CLK", SND_SOC_NOPM, 0, 0,
1241 set_dmic_clk, SND_SOC_DAPM_PRE_PMU),
1242 /* Boost */
1243 SND_SOC_DAPM_PGA("BST1", RT5640_PWR_ANLG2,
1244 RT5640_PWR_BST1_BIT, 0, NULL, 0),
1245 SND_SOC_DAPM_PGA("BST2", RT5640_PWR_ANLG2,
1246 RT5640_PWR_BST4_BIT, 0, NULL, 0),
1247 /* Input Volume */
1248 SND_SOC_DAPM_PGA("INL VOL", RT5640_PWR_VOL,
1249 RT5640_PWR_IN_L_BIT, 0, NULL, 0),
1250 SND_SOC_DAPM_PGA("INR VOL", RT5640_PWR_VOL,
1251 RT5640_PWR_IN_R_BIT, 0, NULL, 0),
1252 /* IN Mux */
1253 SND_SOC_DAPM_MUX("INL Mux", SND_SOC_NOPM, 0, 0, &rt5640_inl_mux),
1254 SND_SOC_DAPM_MUX("INR Mux", SND_SOC_NOPM, 0, 0, &rt5640_inr_mux),
1255 /* REC Mixer */
1256 SND_SOC_DAPM_MIXER("RECMIXL", RT5640_PWR_MIXER, RT5640_PWR_RM_L_BIT, 0,
1257 rt5640_rec_l_mix, ARRAY_SIZE(rt5640_rec_l_mix)),
1258 SND_SOC_DAPM_MIXER("RECMIXR", RT5640_PWR_MIXER, RT5640_PWR_RM_R_BIT, 0,
1259 rt5640_rec_r_mix, ARRAY_SIZE(rt5640_rec_r_mix)),
1260 /* ADCs */
1261 SND_SOC_DAPM_ADC("ADC L", NULL, RT5640_PWR_DIG1,
1262 RT5640_PWR_ADC_L_BIT, 0),
1263 SND_SOC_DAPM_ADC("ADC R", NULL, RT5640_PWR_DIG1,
1264 RT5640_PWR_ADC_R_BIT, 0),
1265 /* ADC Mux */
1266 SND_SOC_DAPM_MUX("Stereo ADC L2 Mux", SND_SOC_NOPM, 0, 0,
1267 &rt5640_sto_adc_l2_mux),
1268 SND_SOC_DAPM_MUX("Stereo ADC R2 Mux", SND_SOC_NOPM, 0, 0,
1269 &rt5640_sto_adc_r2_mux),
1270 SND_SOC_DAPM_MUX("Stereo ADC L1 Mux", SND_SOC_NOPM, 0, 0,
1271 &rt5640_sto_adc_l1_mux),
1272 SND_SOC_DAPM_MUX("Stereo ADC R1 Mux", SND_SOC_NOPM, 0, 0,
1273 &rt5640_sto_adc_r1_mux),
1274 SND_SOC_DAPM_MUX("Mono ADC L2 Mux", SND_SOC_NOPM, 0, 0,
1275 &rt5640_mono_adc_l2_mux),
1276 SND_SOC_DAPM_MUX("Mono ADC L1 Mux", SND_SOC_NOPM, 0, 0,
1277 &rt5640_mono_adc_l1_mux),
1278 SND_SOC_DAPM_MUX("Mono ADC R1 Mux", SND_SOC_NOPM, 0, 0,
1279 &rt5640_mono_adc_r1_mux),
1280 SND_SOC_DAPM_MUX("Mono ADC R2 Mux", SND_SOC_NOPM, 0, 0,
1281 &rt5640_mono_adc_r2_mux),
1282 /* ADC Mixer */
1283 SND_SOC_DAPM_SUPPLY("stereo filter", RT5640_PWR_DIG2,
1284 RT5640_PWR_ADC_SF_BIT, 0, NULL, 0),
1285 SND_SOC_DAPM_MIXER("Stereo ADC MIXL", SND_SOC_NOPM, 0, 0,
1286 rt5640_sto_adc_l_mix, ARRAY_SIZE(rt5640_sto_adc_l_mix)),
1287 SND_SOC_DAPM_MIXER("Stereo ADC MIXR", SND_SOC_NOPM, 0, 0,
1288 rt5640_sto_adc_r_mix, ARRAY_SIZE(rt5640_sto_adc_r_mix)),
1289 SND_SOC_DAPM_SUPPLY("mono left filter", RT5640_PWR_DIG2,
1290 RT5640_PWR_ADC_MF_L_BIT, 0, NULL, 0),
1291 SND_SOC_DAPM_MIXER("Mono ADC MIXL", SND_SOC_NOPM, 0, 0,
1292 rt5640_mono_adc_l_mix, ARRAY_SIZE(rt5640_mono_adc_l_mix)),
1293 SND_SOC_DAPM_SUPPLY("mono right filter", RT5640_PWR_DIG2,
1294 RT5640_PWR_ADC_MF_R_BIT, 0, NULL, 0),
1295 SND_SOC_DAPM_MIXER("Mono ADC MIXR", SND_SOC_NOPM, 0, 0,
1296 rt5640_mono_adc_r_mix, ARRAY_SIZE(rt5640_mono_adc_r_mix)),
1297
1298 /* IF2 Mux */
1299 SND_SOC_DAPM_MUX("IF2 ADC L Mux", SND_SOC_NOPM, 0, 0,
1300 &rt5640_if2_adc_l_mux),
1301 SND_SOC_DAPM_MUX("IF2 ADC R Mux", SND_SOC_NOPM, 0, 0,
1302 &rt5640_if2_adc_r_mux),
1303
1304 /* Digital Interface */
1305 SND_SOC_DAPM_SUPPLY("I2S1", RT5640_PWR_DIG1,
1306 RT5640_PWR_I2S1_BIT, 0, NULL, 0),
1307 SND_SOC_DAPM_PGA("IF1 DAC", SND_SOC_NOPM, 0, 0, NULL, 0),
1308 SND_SOC_DAPM_PGA("IF1 DAC L", SND_SOC_NOPM, 0, 0, NULL, 0),
1309 SND_SOC_DAPM_PGA("IF1 DAC R", SND_SOC_NOPM, 0, 0, NULL, 0),
1310 SND_SOC_DAPM_PGA("IF1 ADC", SND_SOC_NOPM, 0, 0, NULL, 0),
1311 SND_SOC_DAPM_PGA("IF1 ADC L", SND_SOC_NOPM, 0, 0, NULL, 0),
1312 SND_SOC_DAPM_PGA("IF1 ADC R", SND_SOC_NOPM, 0, 0, NULL, 0),
1313 SND_SOC_DAPM_SUPPLY("I2S2", RT5640_PWR_DIG1,
1314 RT5640_PWR_I2S2_BIT, 0, NULL, 0),
1315 SND_SOC_DAPM_PGA("IF2 DAC", SND_SOC_NOPM, 0, 0, NULL, 0),
1316 SND_SOC_DAPM_PGA("IF2 DAC L", SND_SOC_NOPM, 0, 0, NULL, 0),
1317 SND_SOC_DAPM_PGA("IF2 DAC R", SND_SOC_NOPM, 0, 0, NULL, 0),
1318 SND_SOC_DAPM_PGA("IF2 ADC", SND_SOC_NOPM, 0, 0, NULL, 0),
1319 SND_SOC_DAPM_PGA("IF2 ADC L", SND_SOC_NOPM, 0, 0, NULL, 0),
1320 SND_SOC_DAPM_PGA("IF2 ADC R", SND_SOC_NOPM, 0, 0, NULL, 0),
1321 SND_SOC_DAPM_SUPPLY("I2S3", RT5640_PWR_DIG1,
1322 RT5640_PWR_I2S3_BIT, 0, NULL, 0),
1323 SND_SOC_DAPM_PGA("IF3 DAC", SND_SOC_NOPM, 0, 0, NULL, 0),
1324 SND_SOC_DAPM_PGA("IF3 DAC L", SND_SOC_NOPM, 0, 0, NULL, 0),
1325 SND_SOC_DAPM_PGA("IF3 DAC R", SND_SOC_NOPM, 0, 0, NULL, 0),
1326 SND_SOC_DAPM_PGA("IF3 ADC", SND_SOC_NOPM, 0, 0, NULL, 0),
1327 SND_SOC_DAPM_PGA("IF3 ADC L", SND_SOC_NOPM, 0, 0, NULL, 0),
1328 SND_SOC_DAPM_PGA("IF3 ADC R", SND_SOC_NOPM, 0, 0, NULL, 0),
1329
1330 /* Digital Interface Select */
1331 SND_SOC_DAPM_MUX("DAI1 RX Mux", SND_SOC_NOPM, 0, 0, &rt5640_dai_mux),
1332 SND_SOC_DAPM_MUX("DAI1 TX Mux", SND_SOC_NOPM, 0, 0, &rt5640_dai_mux),
1333 SND_SOC_DAPM_MUX("DAI1 IF1 Mux", SND_SOC_NOPM, 0, 0, &rt5640_dai_mux),
1334 SND_SOC_DAPM_MUX("DAI1 IF2 Mux", SND_SOC_NOPM, 0, 0, &rt5640_dai_mux),
1335 SND_SOC_DAPM_MUX("SDI1 TX Mux", SND_SOC_NOPM, 0, 0, &rt5640_sdi_mux),
1336
1337 SND_SOC_DAPM_MUX("DAI2 RX Mux", SND_SOC_NOPM, 0, 0, &rt5640_dai_mux),
1338 SND_SOC_DAPM_MUX("DAI2 TX Mux", SND_SOC_NOPM, 0, 0, &rt5640_dai_mux),
1339 SND_SOC_DAPM_MUX("DAI2 IF1 Mux", SND_SOC_NOPM, 0, 0, &rt5640_dai_mux),
1340 SND_SOC_DAPM_MUX("DAI2 IF2 Mux", SND_SOC_NOPM, 0, 0, &rt5640_dai_mux),
1341 SND_SOC_DAPM_MUX("SDI2 TX Mux", SND_SOC_NOPM, 0, 0, &rt5640_sdi_mux),
1342
1343 SND_SOC_DAPM_MUX("DAI3 RX Mux", SND_SOC_NOPM, 0, 0, &rt5640_dai_mux),
1344 SND_SOC_DAPM_MUX("DAI3 TX Mux", SND_SOC_NOPM, 0, 0, &rt5640_dai_mux),
1345
1346 /* Audio Interface */
1347 SND_SOC_DAPM_AIF_IN("AIF1RX", "AIF1 Playback", 0, SND_SOC_NOPM, 0, 0),
1348 SND_SOC_DAPM_AIF_OUT("AIF1TX", "AIF1 Capture", 0, SND_SOC_NOPM, 0, 0),
1349 SND_SOC_DAPM_AIF_IN("AIF2RX", "AIF2 Playback", 0, SND_SOC_NOPM, 0, 0),
1350 SND_SOC_DAPM_AIF_OUT("AIF2TX", "AIF2 Capture", 0, SND_SOC_NOPM, 0, 0),
1351 SND_SOC_DAPM_AIF_IN("AIF3RX", "AIF3 Playback", 0, SND_SOC_NOPM, 0, 0),
1352 SND_SOC_DAPM_AIF_OUT("AIF3TX", "AIF3 Capture", 0, SND_SOC_NOPM, 0, 0),
1353
1354 /* Audio DSP */
1355 SND_SOC_DAPM_PGA("Audio DSP", SND_SOC_NOPM, 0, 0, NULL, 0),
1356
1357 /* ANC */
1358 SND_SOC_DAPM_PGA("ANC", SND_SOC_NOPM, 0, 0, NULL, 0),
1359
1360 /* Output Side */
1361 /* DAC mixer before sound effect */
1362 SND_SOC_DAPM_MIXER("DAC MIXL", SND_SOC_NOPM, 0, 0,
1363 rt5640_dac_l_mix, ARRAY_SIZE(rt5640_dac_l_mix)),
1364 SND_SOC_DAPM_MIXER("DAC MIXR", SND_SOC_NOPM, 0, 0,
1365 rt5640_dac_r_mix, ARRAY_SIZE(rt5640_dac_r_mix)),
1366
1367 /* DAC2 channel Mux */
1368 SND_SOC_DAPM_MUX("DAC L2 Mux", SND_SOC_NOPM, 0, 0,
1369 &rt5640_dac_l2_mux),
1370 SND_SOC_DAPM_MUX("DAC R2 Mux", SND_SOC_NOPM, 0, 0,
1371 &rt5640_dac_r2_mux),
1372
1373 /* DAC Mixer */
1374 SND_SOC_DAPM_MIXER("Stereo DAC MIXL", SND_SOC_NOPM, 0, 0,
1375 rt5640_sto_dac_l_mix, ARRAY_SIZE(rt5640_sto_dac_l_mix)),
1376 SND_SOC_DAPM_MIXER("Stereo DAC MIXR", SND_SOC_NOPM, 0, 0,
1377 rt5640_sto_dac_r_mix, ARRAY_SIZE(rt5640_sto_dac_r_mix)),
1378 SND_SOC_DAPM_MIXER("Mono DAC MIXL", SND_SOC_NOPM, 0, 0,
1379 rt5640_mono_dac_l_mix, ARRAY_SIZE(rt5640_mono_dac_l_mix)),
1380 SND_SOC_DAPM_MIXER("Mono DAC MIXR", SND_SOC_NOPM, 0, 0,
1381 rt5640_mono_dac_r_mix, ARRAY_SIZE(rt5640_mono_dac_r_mix)),
1382 SND_SOC_DAPM_MIXER("DIG MIXL", SND_SOC_NOPM, 0, 0,
1383 rt5640_dig_l_mix, ARRAY_SIZE(rt5640_dig_l_mix)),
1384 SND_SOC_DAPM_MIXER("DIG MIXR", SND_SOC_NOPM, 0, 0,
1385 rt5640_dig_r_mix, ARRAY_SIZE(rt5640_dig_r_mix)),
1386 /* DACs */
1387 SND_SOC_DAPM_DAC("DAC L1", NULL, RT5640_PWR_DIG1,
1388 RT5640_PWR_DAC_L1_BIT, 0),
1389 SND_SOC_DAPM_DAC("DAC L2", NULL, RT5640_PWR_DIG1,
1390 RT5640_PWR_DAC_L2_BIT, 0),
1391 SND_SOC_DAPM_DAC("DAC R1", NULL, RT5640_PWR_DIG1,
1392 RT5640_PWR_DAC_R1_BIT, 0),
1393 SND_SOC_DAPM_DAC("DAC R2", NULL, RT5640_PWR_DIG1,
1394 RT5640_PWR_DAC_R2_BIT, 0),
1395 /* SPK/OUT Mixer */
1396 SND_SOC_DAPM_MIXER("SPK MIXL", RT5640_PWR_MIXER, RT5640_PWR_SM_L_BIT,
1397 0, rt5640_spk_l_mix, ARRAY_SIZE(rt5640_spk_l_mix)),
1398 SND_SOC_DAPM_MIXER("SPK MIXR", RT5640_PWR_MIXER, RT5640_PWR_SM_R_BIT,
1399 0, rt5640_spk_r_mix, ARRAY_SIZE(rt5640_spk_r_mix)),
1400 SND_SOC_DAPM_MIXER("OUT MIXL", RT5640_PWR_MIXER, RT5640_PWR_OM_L_BIT,
1401 0, rt5640_out_l_mix, ARRAY_SIZE(rt5640_out_l_mix)),
1402 SND_SOC_DAPM_MIXER("OUT MIXR", RT5640_PWR_MIXER, RT5640_PWR_OM_R_BIT,
1403 0, rt5640_out_r_mix, ARRAY_SIZE(rt5640_out_r_mix)),
1404 /* Ouput Volume */
1405 SND_SOC_DAPM_PGA("SPKVOL L", RT5640_PWR_VOL,
1406 RT5640_PWR_SV_L_BIT, 0, NULL, 0),
1407 SND_SOC_DAPM_PGA("SPKVOL R", RT5640_PWR_VOL,
1408 RT5640_PWR_SV_R_BIT, 0, NULL, 0),
1409 SND_SOC_DAPM_PGA("OUTVOL L", RT5640_PWR_VOL,
1410 RT5640_PWR_OV_L_BIT, 0, NULL, 0),
1411 SND_SOC_DAPM_PGA("OUTVOL R", RT5640_PWR_VOL,
1412 RT5640_PWR_OV_R_BIT, 0, NULL, 0),
1413 SND_SOC_DAPM_PGA("HPOVOL L", RT5640_PWR_VOL,
1414 RT5640_PWR_HV_L_BIT, 0, NULL, 0),
1415 SND_SOC_DAPM_PGA("HPOVOL R", RT5640_PWR_VOL,
1416 RT5640_PWR_HV_R_BIT, 0, NULL, 0),
1417 /* SPO/HPO/LOUT/Mono Mixer */
1418 SND_SOC_DAPM_MIXER("SPOL MIX", SND_SOC_NOPM, 0,
1419 0, rt5640_spo_l_mix, ARRAY_SIZE(rt5640_spo_l_mix)),
1420 SND_SOC_DAPM_MIXER("SPOR MIX", SND_SOC_NOPM, 0,
1421 0, rt5640_spo_r_mix, ARRAY_SIZE(rt5640_spo_r_mix)),
1422
1423 SND_SOC_DAPM_MIXER("HPOL MIX", SND_SOC_NOPM, 0, 0,
1424 rt5640_hpo_mix, ARRAY_SIZE(rt5640_hpo_mix)),
1425 SND_SOC_DAPM_MIXER("HPOR MIX", SND_SOC_NOPM, 0, 0,
1426 rt5640_hpo_mix, ARRAY_SIZE(rt5640_hpo_mix)),
1427 SND_SOC_DAPM_MIXER("LOUT MIX", RT5640_PWR_ANLG1, RT5640_PWR_LM_BIT, 0,
1428 rt5640_lout_mix, ARRAY_SIZE(rt5640_lout_mix)),
1429 SND_SOC_DAPM_MIXER("Mono MIX", RT5640_PWR_ANLG1, RT5640_PWR_MM_BIT, 0,
1430 rt5640_mono_mix, ARRAY_SIZE(rt5640_mono_mix)),
1431
1432 SND_SOC_DAPM_SUPPLY("Improve mono amp drv", RT5640_PWR_ANLG1,
1433 RT5640_PWR_MA_BIT, 0, NULL, 0),
1434
1435 SND_SOC_DAPM_SUPPLY("Improve HP amp drv", RT5640_PWR_ANLG1,
1436 SND_SOC_NOPM, 0, hp_event, SND_SOC_DAPM_PRE_PMD |
1437 SND_SOC_DAPM_POST_PMU),
1438
1439 SND_SOC_DAPM_PGA("HP L amp", RT5640_PWR_ANLG1,
1440 RT5640_PWR_HP_L_BIT, 0, NULL, 0),
1441
1442 SND_SOC_DAPM_PGA("HP R amp", RT5640_PWR_ANLG1,
1443 RT5640_PWR_HP_R_BIT, 0, NULL, 0),
1444
1445 SND_SOC_DAPM_SUPPLY("Improve SPK amp drv", RT5640_PWR_DIG1,
1446 SND_SOC_NOPM, 0, spk_event,
1447 SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
1448
1449 /* Output Lines */
1450 SND_SOC_DAPM_OUTPUT("SPOLP"),
1451 SND_SOC_DAPM_OUTPUT("SPOLN"),
1452 SND_SOC_DAPM_OUTPUT("SPORP"),
1453 SND_SOC_DAPM_OUTPUT("SPORN"),
1454 SND_SOC_DAPM_OUTPUT("HPOL"),
1455 SND_SOC_DAPM_OUTPUT("HPOR"),
1456 SND_SOC_DAPM_OUTPUT("LOUTL"),
1457 SND_SOC_DAPM_OUTPUT("LOUTR"),
1458 SND_SOC_DAPM_OUTPUT("MonoP"),
1459 SND_SOC_DAPM_OUTPUT("MonoN"),
1460};
1461
1462static const struct snd_soc_dapm_route rt5640_dapm_routes[] = {
1463 {"IN1P", NULL, "LDO2"},
1464 {"IN2P", NULL, "LDO2"},
1465
1466 {"IN1P", NULL, "MIC1"},
1467 {"IN1N", NULL, "MIC1"},
1468 {"IN2P", NULL, "MIC2"},
1469 {"IN2N", NULL, "MIC2"},
1470
1471 {"DMIC L1", NULL, "DMIC1"},
1472 {"DMIC R1", NULL, "DMIC1"},
1473 {"DMIC L2", NULL, "DMIC2"},
1474 {"DMIC R2", NULL, "DMIC2"},
1475
1476 {"BST1", NULL, "IN1P"},
1477 {"BST1", NULL, "IN1N"},
1478 {"BST2", NULL, "IN2P"},
1479 {"BST2", NULL, "IN2N"},
1480
1481 {"INL VOL", NULL, "IN2P"},
1482 {"INR VOL", NULL, "IN2N"},
1483
1484 {"RECMIXL", "HPOL Switch", "HPOL"},
1485 {"RECMIXL", "INL Switch", "INL VOL"},
1486 {"RECMIXL", "BST2 Switch", "BST2"},
1487 {"RECMIXL", "BST1 Switch", "BST1"},
1488 {"RECMIXL", "OUT MIXL Switch", "OUT MIXL"},
1489
1490 {"RECMIXR", "HPOR Switch", "HPOR"},
1491 {"RECMIXR", "INR Switch", "INR VOL"},
1492 {"RECMIXR", "BST2 Switch", "BST2"},
1493 {"RECMIXR", "BST1 Switch", "BST1"},
1494 {"RECMIXR", "OUT MIXR Switch", "OUT MIXR"},
1495
1496 {"ADC L", NULL, "RECMIXL"},
1497 {"ADC R", NULL, "RECMIXR"},
1498
1499 {"DMIC L1", NULL, "DMIC CLK"},
1500 {"DMIC L2", NULL, "DMIC CLK"},
1501
1502 {"Stereo ADC L2 Mux", "DMIC1", "DMIC L1"},
1503 {"Stereo ADC L2 Mux", "DMIC2", "DMIC L2"},
1504 {"Stereo ADC L2 Mux", "DIG MIX", "DIG MIXL"},
1505 {"Stereo ADC L1 Mux", "ADC", "ADC L"},
1506 {"Stereo ADC L1 Mux", "DIG MIX", "DIG MIXL"},
1507
1508 {"Stereo ADC R1 Mux", "ADC", "ADC R"},
1509 {"Stereo ADC R1 Mux", "DIG MIX", "DIG MIXR"},
1510 {"Stereo ADC R2 Mux", "DMIC1", "DMIC R1"},
1511 {"Stereo ADC R2 Mux", "DMIC2", "DMIC R2"},
1512 {"Stereo ADC R2 Mux", "DIG MIX", "DIG MIXR"},
1513
1514 {"Mono ADC L2 Mux", "DMIC L1", "DMIC L1"},
1515 {"Mono ADC L2 Mux", "DMIC L2", "DMIC L2"},
1516 {"Mono ADC L2 Mux", "Mono DAC MIXL", "Mono DAC MIXL"},
1517 {"Mono ADC L1 Mux", "Mono DAC MIXL", "Mono DAC MIXL"},
1518 {"Mono ADC L1 Mux", "ADCL", "ADC L"},
1519
1520 {"Mono ADC R1 Mux", "Mono DAC MIXR", "Mono DAC MIXR"},
1521 {"Mono ADC R1 Mux", "ADCR", "ADC R"},
1522 {"Mono ADC R2 Mux", "DMIC R1", "DMIC R1"},
1523 {"Mono ADC R2 Mux", "DMIC R2", "DMIC R2"},
1524 {"Mono ADC R2 Mux", "Mono DAC MIXR", "Mono DAC MIXR"},
1525
1526 {"Stereo ADC MIXL", "ADC1 Switch", "Stereo ADC L1 Mux"},
1527 {"Stereo ADC MIXL", "ADC2 Switch", "Stereo ADC L2 Mux"},
1528 {"Stereo ADC MIXL", NULL, "stereo filter"},
1529 {"stereo filter", NULL, "PLL1", check_sysclk1_source},
1530
1531 {"Stereo ADC MIXR", "ADC1 Switch", "Stereo ADC R1 Mux"},
1532 {"Stereo ADC MIXR", "ADC2 Switch", "Stereo ADC R2 Mux"},
1533 {"Stereo ADC MIXR", NULL, "stereo filter"},
1534 {"stereo filter", NULL, "PLL1", check_sysclk1_source},
1535
1536 {"Mono ADC MIXL", "ADC1 Switch", "Mono ADC L1 Mux"},
1537 {"Mono ADC MIXL", "ADC2 Switch", "Mono ADC L2 Mux"},
1538 {"Mono ADC MIXL", NULL, "mono left filter"},
1539 {"mono left filter", NULL, "PLL1", check_sysclk1_source},
1540
1541 {"Mono ADC MIXR", "ADC1 Switch", "Mono ADC R1 Mux"},
1542 {"Mono ADC MIXR", "ADC2 Switch", "Mono ADC R2 Mux"},
1543 {"Mono ADC MIXR", NULL, "mono right filter"},
1544 {"mono right filter", NULL, "PLL1", check_sysclk1_source},
1545
1546 {"IF2 ADC L Mux", "Mono ADC MIXL", "Mono ADC MIXL"},
1547 {"IF2 ADC R Mux", "Mono ADC MIXR", "Mono ADC MIXR"},
1548
1549 {"IF2 ADC L", NULL, "IF2 ADC L Mux"},
1550 {"IF2 ADC R", NULL, "IF2 ADC R Mux"},
1551 {"IF3 ADC L", NULL, "Mono ADC MIXL"},
1552 {"IF3 ADC R", NULL, "Mono ADC MIXR"},
1553 {"IF1 ADC L", NULL, "Stereo ADC MIXL"},
1554 {"IF1 ADC R", NULL, "Stereo ADC MIXR"},
1555
1556 {"IF1 ADC", NULL, "I2S1"},
1557 {"IF1 ADC", NULL, "IF1 ADC L"},
1558 {"IF1 ADC", NULL, "IF1 ADC R"},
1559 {"IF2 ADC", NULL, "I2S2"},
1560 {"IF2 ADC", NULL, "IF2 ADC L"},
1561 {"IF2 ADC", NULL, "IF2 ADC R"},
1562 {"IF3 ADC", NULL, "I2S3"},
1563 {"IF3 ADC", NULL, "IF3 ADC L"},
1564 {"IF3 ADC", NULL, "IF3 ADC R"},
1565
1566 {"DAI1 TX Mux", "1:1|2:2|3:3", "IF1 ADC"},
1567 {"DAI1 TX Mux", "1:1|2:3|3:2", "IF1 ADC"},
1568 {"DAI1 TX Mux", "1:3|2:1|3:2", "IF2 ADC"},
1569 {"DAI1 TX Mux", "1:2|2:1|3:3", "IF2 ADC"},
1570 {"DAI1 TX Mux", "1:3|2:2|3:1", "IF3 ADC"},
1571 {"DAI1 TX Mux", "1:2|2:3|3:1", "IF3 ADC"},
1572 {"DAI1 IF1 Mux", "1:1|2:1|3:3", "IF1 ADC"},
1573 {"DAI1 IF2 Mux", "1:1|2:1|3:3", "IF2 ADC"},
1574 {"SDI1 TX Mux", "IF1", "DAI1 IF1 Mux"},
1575 {"SDI1 TX Mux", "IF2", "DAI1 IF2 Mux"},
1576
1577 {"DAI2 TX Mux", "1:2|2:3|3:1", "IF1 ADC"},
1578 {"DAI2 TX Mux", "1:2|2:1|3:3", "IF1 ADC"},
1579 {"DAI2 TX Mux", "1:1|2:2|3:3", "IF2 ADC"},
1580 {"DAI2 TX Mux", "1:3|2:2|3:1", "IF2 ADC"},
1581 {"DAI2 TX Mux", "1:1|2:3|3:2", "IF3 ADC"},
1582 {"DAI2 TX Mux", "1:3|2:1|3:2", "IF3 ADC"},
1583 {"DAI2 IF1 Mux", "1:2|2:2|3:3", "IF1 ADC"},
1584 {"DAI2 IF2 Mux", "1:2|2:2|3:3", "IF2 ADC"},
1585 {"SDI2 TX Mux", "IF1", "DAI2 IF1 Mux"},
1586 {"SDI2 TX Mux", "IF2", "DAI2 IF2 Mux"},
1587
1588 {"DAI3 TX Mux", "1:3|2:1|3:2", "IF1 ADC"},
1589 {"DAI3 TX Mux", "1:3|2:2|3:1", "IF1 ADC"},
1590 {"DAI3 TX Mux", "1:1|2:3|3:2", "IF2 ADC"},
1591 {"DAI3 TX Mux", "1:2|2:3|3:1", "IF2 ADC"},
1592 {"DAI3 TX Mux", "1:1|2:2|3:3", "IF3 ADC"},
1593 {"DAI3 TX Mux", "1:2|2:1|3:3", "IF3 ADC"},
1594 {"DAI3 TX Mux", "1:1|2:1|3:3", "IF3 ADC"},
1595 {"DAI3 TX Mux", "1:2|2:2|3:3", "IF3 ADC"},
1596
1597 {"AIF1TX", NULL, "DAI1 TX Mux"},
1598 {"AIF1TX", NULL, "SDI1 TX Mux"},
1599 {"AIF2TX", NULL, "DAI2 TX Mux"},
1600 {"AIF2TX", NULL, "SDI2 TX Mux"},
1601 {"AIF3TX", NULL, "DAI3 TX Mux"},
1602
1603 {"DAI1 RX Mux", "1:1|2:2|3:3", "AIF1RX"},
1604 {"DAI1 RX Mux", "1:1|2:3|3:2", "AIF1RX"},
1605 {"DAI1 RX Mux", "1:1|2:1|3:3", "AIF1RX"},
1606 {"DAI1 RX Mux", "1:2|2:3|3:1", "AIF2RX"},
1607 {"DAI1 RX Mux", "1:2|2:1|3:3", "AIF2RX"},
1608 {"DAI1 RX Mux", "1:2|2:2|3:3", "AIF2RX"},
1609 {"DAI1 RX Mux", "1:3|2:1|3:2", "AIF3RX"},
1610 {"DAI1 RX Mux", "1:3|2:2|3:1", "AIF3RX"},
1611
1612 {"DAI2 RX Mux", "1:3|2:1|3:2", "AIF1RX"},
1613 {"DAI2 RX Mux", "1:2|2:1|3:3", "AIF1RX"},
1614 {"DAI2 RX Mux", "1:1|2:1|3:3", "AIF1RX"},
1615 {"DAI2 RX Mux", "1:1|2:2|3:3", "AIF2RX"},
1616 {"DAI2 RX Mux", "1:3|2:2|3:1", "AIF2RX"},
1617 {"DAI2 RX Mux", "1:2|2:2|3:3", "AIF2RX"},
1618 {"DAI2 RX Mux", "1:1|2:3|3:2", "AIF3RX"},
1619 {"DAI2 RX Mux", "1:2|2:3|3:1", "AIF3RX"},
1620
1621 {"DAI3 RX Mux", "1:3|2:2|3:1", "AIF1RX"},
1622 {"DAI3 RX Mux", "1:2|2:3|3:1", "AIF1RX"},
1623 {"DAI3 RX Mux", "1:1|2:3|3:2", "AIF2RX"},
1624 {"DAI3 RX Mux", "1:3|2:1|3:2", "AIF2RX"},
1625 {"DAI3 RX Mux", "1:1|2:2|3:3", "AIF3RX"},
1626 {"DAI3 RX Mux", "1:2|2:1|3:3", "AIF3RX"},
1627 {"DAI3 RX Mux", "1:1|2:1|3:3", "AIF3RX"},
1628 {"DAI3 RX Mux", "1:2|2:2|3:3", "AIF3RX"},
1629
1630 {"IF1 DAC", NULL, "I2S1"},
1631 {"IF1 DAC", NULL, "DAI1 RX Mux"},
1632 {"IF2 DAC", NULL, "I2S2"},
1633 {"IF2 DAC", NULL, "DAI2 RX Mux"},
1634 {"IF3 DAC", NULL, "I2S3"},
1635 {"IF3 DAC", NULL, "DAI3 RX Mux"},
1636
1637 {"IF1 DAC L", NULL, "IF1 DAC"},
1638 {"IF1 DAC R", NULL, "IF1 DAC"},
1639 {"IF2 DAC L", NULL, "IF2 DAC"},
1640 {"IF2 DAC R", NULL, "IF2 DAC"},
1641 {"IF3 DAC L", NULL, "IF3 DAC"},
1642 {"IF3 DAC R", NULL, "IF3 DAC"},
1643
1644 {"DAC MIXL", "Stereo ADC Switch", "Stereo ADC MIXL"},
1645 {"DAC MIXL", "INF1 Switch", "IF1 DAC L"},
1646 {"DAC MIXR", "Stereo ADC Switch", "Stereo ADC MIXR"},
1647 {"DAC MIXR", "INF1 Switch", "IF1 DAC R"},
1648
1649 {"ANC", NULL, "Stereo ADC MIXL"},
1650 {"ANC", NULL, "Stereo ADC MIXR"},
1651
1652 {"Audio DSP", NULL, "DAC MIXL"},
1653 {"Audio DSP", NULL, "DAC MIXR"},
1654
1655 {"DAC L2 Mux", "IF2", "IF2 DAC L"},
1656 {"DAC L2 Mux", "IF3", "IF3 DAC L"},
1657 {"DAC L2 Mux", "Base L/R", "Audio DSP"},
1658
1659 {"DAC R2 Mux", "IF2", "IF2 DAC R"},
1660 {"DAC R2 Mux", "IF3", "IF3 DAC R"},
1661
1662 {"Stereo DAC MIXL", "DAC L1 Switch", "DAC MIXL"},
1663 {"Stereo DAC MIXL", "DAC L2 Switch", "DAC L2 Mux"},
1664 {"Stereo DAC MIXL", "ANC Switch", "ANC"},
1665 {"Stereo DAC MIXR", "DAC R1 Switch", "DAC MIXR"},
1666 {"Stereo DAC MIXR", "DAC R2 Switch", "DAC R2 Mux"},
1667 {"Stereo DAC MIXR", "ANC Switch", "ANC"},
1668
1669 {"Mono DAC MIXL", "DAC L1 Switch", "DAC MIXL"},
1670 {"Mono DAC MIXL", "DAC L2 Switch", "DAC L2 Mux"},
1671 {"Mono DAC MIXL", "DAC R2 Switch", "DAC R2 Mux"},
1672 {"Mono DAC MIXR", "DAC R1 Switch", "DAC MIXR"},
1673 {"Mono DAC MIXR", "DAC R2 Switch", "DAC R2 Mux"},
1674 {"Mono DAC MIXR", "DAC L2 Switch", "DAC L2 Mux"},
1675
1676 {"DIG MIXL", "DAC L1 Switch", "DAC MIXL"},
1677 {"DIG MIXL", "DAC L2 Switch", "DAC L2 Mux"},
1678 {"DIG MIXR", "DAC R1 Switch", "DAC MIXR"},
1679 {"DIG MIXR", "DAC R2 Switch", "DAC R2 Mux"},
1680
1681 {"DAC L1", NULL, "Stereo DAC MIXL"},
1682 {"DAC L1", NULL, "PLL1", check_sysclk1_source},
1683 {"DAC R1", NULL, "Stereo DAC MIXR"},
1684 {"DAC R1", NULL, "PLL1", check_sysclk1_source},
1685 {"DAC L2", NULL, "Mono DAC MIXL"},
1686 {"DAC L2", NULL, "PLL1", check_sysclk1_source},
1687 {"DAC R2", NULL, "Mono DAC MIXR"},
1688 {"DAC R2", NULL, "PLL1", check_sysclk1_source},
1689
1690 {"SPK MIXL", "REC MIXL Switch", "RECMIXL"},
1691 {"SPK MIXL", "INL Switch", "INL VOL"},
1692 {"SPK MIXL", "DAC L1 Switch", "DAC L1"},
1693 {"SPK MIXL", "DAC L2 Switch", "DAC L2"},
1694 {"SPK MIXL", "OUT MIXL Switch", "OUT MIXL"},
1695 {"SPK MIXR", "REC MIXR Switch", "RECMIXR"},
1696 {"SPK MIXR", "INR Switch", "INR VOL"},
1697 {"SPK MIXR", "DAC R1 Switch", "DAC R1"},
1698 {"SPK MIXR", "DAC R2 Switch", "DAC R2"},
1699 {"SPK MIXR", "OUT MIXR Switch", "OUT MIXR"},
1700
1701 {"OUT MIXL", "SPK MIXL Switch", "SPK MIXL"},
1702 {"OUT MIXL", "BST1 Switch", "BST1"},
1703 {"OUT MIXL", "INL Switch", "INL VOL"},
1704 {"OUT MIXL", "REC MIXL Switch", "RECMIXL"},
1705 {"OUT MIXL", "DAC R2 Switch", "DAC R2"},
1706 {"OUT MIXL", "DAC L2 Switch", "DAC L2"},
1707 {"OUT MIXL", "DAC L1 Switch", "DAC L1"},
1708
1709 {"OUT MIXR", "SPK MIXR Switch", "SPK MIXR"},
1710 {"OUT MIXR", "BST2 Switch", "BST2"},
1711 {"OUT MIXR", "BST1 Switch", "BST1"},
1712 {"OUT MIXR", "INR Switch", "INR VOL"},
1713 {"OUT MIXR", "REC MIXR Switch", "RECMIXR"},
1714 {"OUT MIXR", "DAC L2 Switch", "DAC L2"},
1715 {"OUT MIXR", "DAC R2 Switch", "DAC R2"},
1716 {"OUT MIXR", "DAC R1 Switch", "DAC R1"},
1717
1718 {"SPKVOL L", NULL, "SPK MIXL"},
1719 {"SPKVOL R", NULL, "SPK MIXR"},
1720 {"HPOVOL L", NULL, "OUT MIXL"},
1721 {"HPOVOL R", NULL, "OUT MIXR"},
1722 {"OUTVOL L", NULL, "OUT MIXL"},
1723 {"OUTVOL R", NULL, "OUT MIXR"},
1724
1725 {"SPOL MIX", "DAC R1 Switch", "DAC R1"},
1726 {"SPOL MIX", "DAC L1 Switch", "DAC L1"},
1727 {"SPOL MIX", "SPKVOL R Switch", "SPKVOL R"},
1728 {"SPOL MIX", "SPKVOL L Switch", "SPKVOL L"},
1729 {"SPOL MIX", "BST1 Switch", "BST1"},
1730 {"SPOR MIX", "DAC R1 Switch", "DAC R1"},
1731 {"SPOR MIX", "SPKVOL R Switch", "SPKVOL R"},
1732 {"SPOR MIX", "BST1 Switch", "BST1"},
1733
1734 {"HPOL MIX", "DAC2 Switch", "DAC L2"},
1735 {"HPOL MIX", "DAC1 Switch", "DAC L1"},
1736 {"HPOL MIX", "HPVOL Switch", "HPOVOL L"},
1737 {"HPOR MIX", "DAC2 Switch", "DAC R2"},
1738 {"HPOR MIX", "DAC1 Switch", "DAC R1"},
1739 {"HPOR MIX", "HPVOL Switch", "HPOVOL R"},
1740
1741 {"LOUT MIX", "DAC L1 Switch", "DAC L1"},
1742 {"LOUT MIX", "DAC R1 Switch", "DAC R1"},
1743 {"LOUT MIX", "OUTVOL L Switch", "OUTVOL L"},
1744 {"LOUT MIX", "OUTVOL R Switch", "OUTVOL R"},
1745
1746 {"Mono MIX", "DAC R2 Switch", "DAC R2"},
1747 {"Mono MIX", "DAC L2 Switch", "DAC L2"},
1748 {"Mono MIX", "OUTVOL R Switch", "OUTVOL R"},
1749 {"Mono MIX", "OUTVOL L Switch", "OUTVOL L"},
1750 {"Mono MIX", "BST1 Switch", "BST1"},
1751
1752 {"HP L amp", NULL, "HPOL MIX"},
1753 {"HP R amp", NULL, "HPOR MIX"},
1754
1755/* {"HP L amp", NULL, "Improve HP amp drv"},
1756 {"HP R amp", NULL, "Improve HP amp drv"}, */
1757
1758 {"SPOLP", NULL, "SPOL MIX"},
1759 {"SPOLN", NULL, "SPOL MIX"},
1760 {"SPORP", NULL, "SPOR MIX"},
1761 {"SPORN", NULL, "SPOR MIX"},
1762
1763 {"SPOLP", NULL, "Improve SPK amp drv"},
1764 {"SPOLN", NULL, "Improve SPK amp drv"},
1765 {"SPORP", NULL, "Improve SPK amp drv"},
1766 {"SPORN", NULL, "Improve SPK amp drv"},
1767
1768 {"HPOL", NULL, "Improve HP amp drv"},
1769 {"HPOR", NULL, "Improve HP amp drv"},
1770
1771 {"HPOL", NULL, "HP L amp"},
1772 {"HPOR", NULL, "HP R amp"},
1773 {"LOUTL", NULL, "LOUT MIX"},
1774 {"LOUTR", NULL, "LOUT MIX"},
1775 {"MonoP", NULL, "Mono MIX"},
1776 {"MonoN", NULL, "Mono MIX"},
1777 {"MonoP", NULL, "Improve mono amp drv"},
1778};
1779
1780static int get_sdp_info(struct snd_soc_codec *codec, int dai_id)
1781{
1782 int ret = 0, val = snd_soc_read(codec, RT5640_I2S1_SDP);
1783
1784 if (codec == NULL)
1785 return -EINVAL;
1786
1787 val = (val & RT5640_I2S_IF_MASK) >> RT5640_I2S_IF_SFT;
1788 switch (dai_id) {
1789 case RT5640_AIF1:
1790 if (val == RT5640_IF_123 || val == RT5640_IF_132 ||
1791 val == RT5640_IF_113)
1792 ret |= RT5640_U_IF1;
1793 if (val == RT5640_IF_312 || val == RT5640_IF_213 ||
1794 val == RT5640_IF_113)
1795 ret |= RT5640_U_IF2;
1796 if (val == RT5640_IF_321 || val == RT5640_IF_231)
1797 ret |= RT5640_U_IF3;
1798 break;
1799
1800 case RT5640_AIF2:
1801 if (val == RT5640_IF_231 || val == RT5640_IF_213 ||
1802 val == RT5640_IF_223)
1803 ret |= RT5640_U_IF1;
1804 if (val == RT5640_IF_123 || val == RT5640_IF_321 ||
1805 val == RT5640_IF_223)
1806 ret |= RT5640_U_IF2;
1807 if (val == RT5640_IF_132 || val == RT5640_IF_312)
1808 ret |= RT5640_U_IF3;
1809 break;
1810
1811#if (CONFIG_SND_SOC_RT5643_MODULE | CONFIG_SND_SOC_RT5643 | \
1812 CONFIG_SND_SOC_RT5646_MODULE | CONFIG_SND_SOC_RT5646)
1813
1814 case RT5640_AIF3:
1815 if (val == RT5640_IF_312 || val == RT5640_IF_321)
1816 ret |= RT5640_U_IF1;
1817 if (val == RT5640_IF_132 || val == RT5640_IF_231)
1818 ret |= RT5640_U_IF2;
1819 if (val == RT5640_IF_123 || val == RT5640_IF_213 ||
1820 val == RT5640_IF_113 || val == RT5640_IF_223)
1821 ret |= RT5640_U_IF3;
1822 break;
1823#endif
1824
1825 default:
1826 ret = -EINVAL;
1827 break;
1828 }
1829
1830 return ret;
1831}
1832
1833static int get_clk_info(int sclk, int rate)
1834{
1835 int i, pd[] = {1, 2, 3, 4, 6, 8, 12, 16};
1836
1837 if (sclk <= 0 || rate <= 0)
1838 return -EINVAL;
1839
1840 rate = rate << 8;
1841 for (i = 0; i < ARRAY_SIZE(pd); i++)
1842 if (sclk == rate * pd[i])
1843 return i;
1844
1845 return -EINVAL;
1846}
1847
1848static int rt5640_hw_params(struct snd_pcm_substream *substream,
1849 struct snd_pcm_hw_params *params, struct snd_soc_dai *dai)
1850{
1851 struct snd_soc_pcm_runtime *rtd = substream->private_data;
1852 struct snd_soc_codec *codec = rtd->codec;
1853 struct rt5640_priv *rt5640 = snd_soc_codec_get_drvdata(codec);
1854 unsigned int val_len = 0, val_clk, mask_clk, dai_sel;
1855 int pre_div, bclk_ms, frame_size;
1856
1857 rt5640->lrck[dai->id] = params_rate(params);
1858 pre_div = get_clk_info(rt5640->sysclk, rt5640->lrck[dai->id]);
1859 if (pre_div < 0) {
1860 dev_err(codec->dev, "Unsupported clock setting\n");
1861 return -EINVAL;
1862 }
1863 frame_size = snd_soc_params_to_frame_size(params);
1864 if (frame_size < 0) {
1865 dev_err(codec->dev, "Unsupported frame size: %d\n", frame_size);
1866 return -EINVAL;
1867 }
1868 bclk_ms = frame_size > 32 ? 1 : 0;
1869 rt5640->bclk[dai->id] = rt5640->lrck[dai->id] * (32 << bclk_ms);
1870
1871 dev_dbg(dai->dev, "bclk is %dHz and lrck is %dHz\n",
1872 rt5640->bclk[dai->id], rt5640->lrck[dai->id]);
1873 dev_dbg(dai->dev, "bclk_ms is %d and pre_div is %d for iis %d\n",
1874 bclk_ms, pre_div, dai->id);
1875
1876 switch (params_format(params)) {
1877 case SNDRV_PCM_FORMAT_S16_LE:
1878 break;
1879 case SNDRV_PCM_FORMAT_S20_3LE:
1880 val_len |= RT5640_I2S_DL_20;
1881 break;
1882 case SNDRV_PCM_FORMAT_S24_LE:
1883 val_len |= RT5640_I2S_DL_24;
1884 break;
1885 case SNDRV_PCM_FORMAT_S8:
1886 val_len |= RT5640_I2S_DL_8;
1887 break;
1888 default:
1889 return -EINVAL;
1890 }
1891
1892 dai_sel = get_sdp_info(codec, dai->id);
1893 if (dai_sel < 0) {
1894 dev_err(codec->dev, "Failed to get sdp info: %d\n", dai_sel);
1895 return -EINVAL;
1896 }
1897 if (dai_sel & RT5640_U_IF1) {
1898 mask_clk = RT5640_I2S_BCLK_MS1_MASK | RT5640_I2S_PD1_MASK;
1899 val_clk = bclk_ms << RT5640_I2S_BCLK_MS1_SFT |
1900 pre_div << RT5640_I2S_PD1_SFT;
1901 snd_soc_update_bits(codec, RT5640_I2S1_SDP,
1902 RT5640_I2S_DL_MASK, val_len);
1903 snd_soc_update_bits(codec, RT5640_ADDA_CLK1, mask_clk, val_clk);
1904 }
1905 if (dai_sel & RT5640_U_IF2) {
1906 mask_clk = RT5640_I2S_BCLK_MS2_MASK | RT5640_I2S_PD2_MASK;
1907 val_clk = bclk_ms << RT5640_I2S_BCLK_MS2_SFT |
1908 pre_div << RT5640_I2S_PD2_SFT;
1909 snd_soc_update_bits(codec, RT5640_I2S2_SDP,
1910 RT5640_I2S_DL_MASK, val_len);
1911 snd_soc_update_bits(codec, RT5640_ADDA_CLK1, mask_clk, val_clk);
1912 }
1913#if (CONFIG_SND_SOC_RT5643_MODULE | CONFIG_SND_SOC_RT5643 | \
1914 CONFIG_SND_SOC_RT5646_MODULE | CONFIG_SND_SOC_RT5646)
1915 if (dai_sel & RT5640_U_IF3) {
1916 mask_clk = RT5640_I2S_BCLK_MS3_MASK | RT5640_I2S_PD3_MASK;
1917 val_clk = bclk_ms << RT5640_I2S_BCLK_MS3_SFT |
1918 pre_div << RT5640_I2S_PD3_SFT;
1919 snd_soc_update_bits(codec, RT5640_I2S3_SDP,
1920 RT5640_I2S_DL_MASK, val_len);
1921 snd_soc_update_bits(codec, RT5640_ADDA_CLK1, mask_clk, val_clk);
1922 }
1923#endif
1924 return 0;
1925}
1926
1927static int rt5640_prepare(struct snd_pcm_substream *substream,
1928 struct snd_soc_dai *dai)
1929{
1930 struct snd_soc_pcm_runtime *rtd = substream->private_data;
1931 struct snd_soc_codec *codec = rtd->codec;
1932 struct rt5640_priv *rt5640 = snd_soc_codec_get_drvdata(codec);
1933
1934 rt5640->aif_pu = dai->id;
1935 return 0;
1936}
1937
1938static int rt5640_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt)
1939{
1940 struct snd_soc_codec *codec = dai->codec;
1941 struct rt5640_priv *rt5640 = snd_soc_codec_get_drvdata(codec);
1942 unsigned int reg_val = 0, dai_sel;
1943
1944 switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
1945 case SND_SOC_DAIFMT_CBM_CFM:
1946 rt5640->master[dai->id] = 1;
1947 break;
1948 case SND_SOC_DAIFMT_CBS_CFS:
1949 reg_val |= RT5640_I2S_MS_S;
1950 rt5640->master[dai->id] = 0;
1951 break;
1952 default:
1953 return -EINVAL;
1954 }
1955
1956 switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
1957 case SND_SOC_DAIFMT_NB_NF:
1958 break;
1959 case SND_SOC_DAIFMT_IB_NF:
1960 reg_val |= RT5640_I2S_BP_INV;
1961 break;
1962 default:
1963 return -EINVAL;
1964 }
1965
1966 switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
1967 case SND_SOC_DAIFMT_I2S:
1968 break;
1969 case SND_SOC_DAIFMT_LEFT_J:
1970 reg_val |= RT5640_I2S_DF_LEFT;
1971 break;
1972 case SND_SOC_DAIFMT_DSP_A:
1973 reg_val |= RT5640_I2S_DF_PCM_A;
1974 break;
1975 case SND_SOC_DAIFMT_DSP_B:
1976 reg_val |= RT5640_I2S_DF_PCM_B;
1977 break;
1978 default:
1979 return -EINVAL;
1980 }
1981
1982 dai_sel = get_sdp_info(codec, dai->id);
1983 if (dai_sel < 0) {
1984 dev_err(codec->dev, "Failed to get sdp info: %d\n", dai_sel);
1985 return -EINVAL;
1986 }
1987 if (dai_sel & RT5640_U_IF1) {
1988 snd_soc_update_bits(codec, RT5640_I2S1_SDP,
1989 RT5640_I2S_MS_MASK | RT5640_I2S_BP_MASK |
1990 RT5640_I2S_DF_MASK, reg_val);
1991 }
1992 if (dai_sel & RT5640_U_IF2) {
1993 snd_soc_update_bits(codec, RT5640_I2S2_SDP,
1994 RT5640_I2S_MS_MASK | RT5640_I2S_BP_MASK |
1995 RT5640_I2S_DF_MASK, reg_val);
1996 }
1997#if (CONFIG_SND_SOC_RT5643_MODULE | CONFIG_SND_SOC_RT5643 | \
1998 CONFIG_SND_SOC_RT5646_MODULE | CONFIG_SND_SOC_RT5646)
1999 if (dai_sel & RT5640_U_IF3) {
2000 snd_soc_update_bits(codec, RT5640_I2S3_SDP,
2001 RT5640_I2S_MS_MASK | RT5640_I2S_BP_MASK |
2002 RT5640_I2S_DF_MASK, reg_val);
2003 }
2004#endif
2005 return 0;
2006}
2007
2008static int rt5640_set_dai_sysclk(struct snd_soc_dai *dai,
2009 int clk_id, unsigned int freq, int dir)
2010{
2011 struct snd_soc_codec *codec = dai->codec;
2012 struct rt5640_priv *rt5640 = snd_soc_codec_get_drvdata(codec);
2013 unsigned int reg_val = 0;
2014
2015 if (freq == rt5640->sysclk && clk_id == rt5640->sysclk_src)
2016 return 0;
2017
2018 switch (clk_id) {
2019 case RT5640_SCLK_S_MCLK:
2020 reg_val |= RT5640_SCLK_SRC_MCLK;
2021 break;
2022 case RT5640_SCLK_S_PLL1:
2023 reg_val |= RT5640_SCLK_SRC_PLL1;
2024 break;
2025 case RT5640_SCLK_S_PLL1_TK:
2026 reg_val |= RT5640_SCLK_SRC_PLL1T;
2027 break;
2028 case RT5640_SCLK_S_RCCLK:
2029 reg_val |= RT5640_SCLK_SRC_RCCLK;
2030 break;
2031 default:
2032 dev_err(codec->dev, "Invalid clock id (%d)\n", clk_id);
2033 return -EINVAL;
2034 }
2035 snd_soc_update_bits(codec, RT5640_GLB_CLK,
2036 RT5640_SCLK_SRC_MASK, reg_val);
2037 rt5640->sysclk = freq;
2038 rt5640->sysclk_src = clk_id;
2039
2040 dev_dbg(dai->dev, "Sysclk is %dHz and clock id is %d\n", freq, clk_id);
2041 return 0;
2042}
2043
2044/**
2045 * rt5640_pll_calc - Calcualte PLL M/N/K code.
2046 * @freq_in: external clock provided to codec.
2047 * @freq_out: target clock which codec works on.
2048 * @pll_code: Pointer to structure with M, N, K and bypass flag.
2049 *
2050 * Calcualte M/N/K code to configure PLL for codec. And K is assigned to 2
2051 * which make calculation more efficiently.
2052 *
2053 * Returns 0 for success or negative error code.
2054 */
2055static int rt5640_pll_calc(const unsigned int freq_in,
2056 const unsigned int freq_out, struct rt5640_pll_code *pll_code)
2057{
2058 int max_n = RT5640_PLL_N_MAX, max_m = RT5640_PLL_M_MAX;
2059 int n, m, red, n_t, m_t, in_t, out_t, red_t = abs(freq_out - freq_in);
2060 bool bypass = false;
2061
2062 if (RT5640_PLL_INP_MAX < freq_in || RT5640_PLL_INP_MIN > freq_in)
2063 return -EINVAL;
2064
2065 for (n_t = 0; n_t <= max_n; n_t++) {
2066 in_t = (freq_in >> 1) + (freq_in >> 2) * n_t;
2067 if (in_t < 0)
2068 continue;
2069 if (in_t == freq_out) {
2070 bypass = true;
2071 n = n_t;
2072 goto code_find;
2073 }
2074 for (m_t = 0; m_t <= max_m; m_t++) {
2075 out_t = in_t / (m_t + 2);
2076 red = abs(out_t - freq_out);
2077 if (red < red_t) {
2078 n = n_t;
2079 m = m_t;
2080 if (red == 0)
2081 goto code_find;
2082 red_t = red;
2083 }
2084 }
2085 }
2086 pr_debug("Only get approximation about PLL\n");
2087
2088code_find:
2089
2090 pll_code->m_bp = bypass;
2091 pll_code->m_code = m;
2092 pll_code->n_code = n;
2093 pll_code->k_code = 2;
2094 return 0;
2095}
2096
2097static int rt5640_set_dai_pll(struct snd_soc_dai *dai, int pll_id, int source,
2098 unsigned int freq_in, unsigned int freq_out)
2099{
2100 struct snd_soc_codec *codec = dai->codec;
2101 struct rt5640_priv *rt5640 = snd_soc_codec_get_drvdata(codec);
2102 struct rt5640_pll_code pll_code;
2103 int ret, dai_sel;
2104
2105 if (source == rt5640->pll_src && freq_in == rt5640->pll_in &&
2106 freq_out == rt5640->pll_out)
2107 return 0;
2108
2109 if (!freq_in || !freq_out) {
2110 dev_dbg(codec->dev, "PLL disabled\n");
2111
2112 rt5640->pll_in = 0;
2113 rt5640->pll_out = 0;
2114 snd_soc_update_bits(codec, RT5640_GLB_CLK,
2115 RT5640_SCLK_SRC_MASK, RT5640_SCLK_SRC_MCLK);
2116 return 0;
2117 }
2118
2119 switch (source) {
2120 case RT5640_PLL1_S_MCLK:
2121 snd_soc_update_bits(codec, RT5640_GLB_CLK,
2122 RT5640_PLL1_SRC_MASK, RT5640_PLL1_SRC_MCLK);
2123 break;
2124 case RT5640_PLL1_S_BCLK1:
2125 case RT5640_PLL1_S_BCLK2:
2126
2127#if (CONFIG_SND_SOC_RT5643_MODULE | CONFIG_SND_SOC_RT5643 | \
2128 CONFIG_SND_SOC_RT5646_MODULE | CONFIG_SND_SOC_RT5646)
2129
2130 case RT5640_PLL1_S_BCLK3:
2131
2132#endif
2133 dai_sel = get_sdp_info(codec, dai->id);
2134 if (dai_sel < 0) {
2135 dev_err(codec->dev,
2136 "Failed to get sdp info: %d\n", dai_sel);
2137 return -EINVAL;
2138 }
2139 if (dai_sel & RT5640_U_IF1) {
2140 snd_soc_update_bits(codec, RT5640_GLB_CLK,
2141 RT5640_PLL1_SRC_MASK, RT5640_PLL1_SRC_BCLK1);
2142 }
2143 if (dai_sel & RT5640_U_IF2) {
2144 snd_soc_update_bits(codec, RT5640_GLB_CLK,
2145 RT5640_PLL1_SRC_MASK, RT5640_PLL1_SRC_BCLK2);
2146 }
2147 if (dai_sel & RT5640_U_IF3) {
2148 snd_soc_update_bits(codec, RT5640_GLB_CLK,
2149 RT5640_PLL1_SRC_MASK, RT5640_PLL1_SRC_BCLK3);
2150 }
2151 break;
2152 default:
2153 dev_err(codec->dev, "Unknown PLL source %d\n", source);
2154 return -EINVAL;
2155 }
2156
2157 ret = rt5640_pll_calc(freq_in, freq_out, &pll_code);
2158 if (ret < 0) {
2159 dev_err(codec->dev, "Unsupport input clock %d\n", freq_in);
2160 return ret;
2161 }
2162
2163 dev_dbg(codec->dev, "bypass=%d m=%d n=%d k=2\n", pll_code.m_bp,
2164 (pll_code.m_bp ? 0 : pll_code.m_code), pll_code.n_code);
2165
2166 snd_soc_write(codec, RT5640_PLL_CTRL1,
2167 pll_code.n_code << RT5640_PLL_N_SFT | pll_code.k_code);
2168 snd_soc_write(codec, RT5640_PLL_CTRL2,
2169 (pll_code.m_bp ? 0 : pll_code.m_code) << RT5640_PLL_M_SFT |
2170 pll_code.m_bp << RT5640_PLL_M_BP_SFT);
2171
2172 rt5640->pll_in = freq_in;
2173 rt5640->pll_out = freq_out;
2174 rt5640->pll_src = source;
2175
2176 return 0;
2177}
2178
2179/**
2180 * rt5640_index_show - Dump private registers.
2181 * @dev: codec device.
2182 * @attr: device attribute.
2183 * @buf: buffer for display.
2184 *
2185 * To show non-zero values of all private registers.
2186 *
2187 * Returns buffer length.
2188 */
2189static ssize_t rt5640_index_show(struct device *dev,
2190 struct device_attribute *attr, char *buf)
2191{
2192 struct i2c_client *client = to_i2c_client(dev);
2193 struct rt5640_priv *rt5640 = i2c_get_clientdata(client);
2194 struct snd_soc_codec *codec = rt5640->codec;
2195 unsigned int val;
2196 int cnt = 0, i;
2197
2198 cnt += sprintf(buf, "RT5640 index register\n");
2199 for (i = 0; i < 0xb4; i++) {
2200 if (cnt + 9 >= PAGE_SIZE - 1)
2201 break;
2202 val = rt5640_index_read(codec, i);
2203 if (!val)
2204 continue;
2205 cnt += snprintf(buf + cnt, 10, "%02x: %04x\n", i, val);
2206 }
2207
2208 if (cnt >= PAGE_SIZE)
2209 cnt = PAGE_SIZE - 1;
2210
2211 return cnt;
2212}
2213static DEVICE_ATTR(index_reg, 0444, rt5640_index_show, NULL);
2214
2215static int rt5640_set_bias_level(struct snd_soc_codec *codec,
2216 enum snd_soc_bias_level level)
2217{
2218 switch (level) {
2219 case SND_SOC_BIAS_ON:
2220#ifdef RT5640_DEMO
2221 snd_soc_update_bits(codec, RT5640_SPK_VOL,
2222 RT5640_L_MUTE | RT5640_R_MUTE, 0);
2223 snd_soc_update_bits(codec, RT5640_HP_VOL,
2224 RT5640_L_MUTE | RT5640_R_MUTE, 0);
2225 break;
2226#endif
2227 case SND_SOC_BIAS_PREPARE:
2228#ifdef RT5640_DEMO
2229 snd_soc_update_bits(codec, RT5640_PWR_ANLG1,
2230 RT5640_PWR_VREF1 | RT5640_PWR_MB |
2231 RT5640_PWR_BG | RT5640_PWR_VREF2,
2232 RT5640_PWR_VREF1 | RT5640_PWR_MB |
2233 RT5640_PWR_BG | RT5640_PWR_VREF2);
2234 msleep(100);
2235
2236 snd_soc_update_bits(codec, RT5640_PWR_ANLG1,
2237 RT5640_PWR_FV1 | RT5640_PWR_FV2,
2238 RT5640_PWR_FV1 | RT5640_PWR_FV2);
2239
2240 snd_soc_update_bits(codec, RT5640_PWR_ANLG2,
2241 RT5640_PWR_MB1 | RT5640_PWR_MB2,
2242 RT5640_PWR_MB1 | RT5640_PWR_MB2);
2243#endif
2244 break;
2245
2246 case SND_SOC_BIAS_STANDBY:
2247#ifdef RT5640_DEMO
2248 snd_soc_update_bits(codec, RT5640_SPK_VOL, RT5640_L_MUTE |
2249 RT5640_R_MUTE, RT5640_L_MUTE | RT5640_R_MUTE);
2250 snd_soc_update_bits(codec, RT5640_HP_VOL, RT5640_L_MUTE |
2251 RT5640_R_MUTE, RT5640_L_MUTE | RT5640_R_MUTE);
2252
2253 snd_soc_update_bits(codec, RT5640_PWR_ANLG2,
2254 RT5640_PWR_MB1 | RT5640_PWR_MB2,
2255 0);
2256#endif
2257 if (SND_SOC_BIAS_OFF == codec->dapm.bias_level) {
2258 snd_soc_update_bits(codec, RT5640_PWR_ANLG1,
2259 RT5640_PWR_VREF1 | RT5640_PWR_MB |
2260 RT5640_PWR_BG | RT5640_PWR_VREF2,
2261 RT5640_PWR_VREF1 | RT5640_PWR_MB |
2262 RT5640_PWR_BG | RT5640_PWR_VREF2);
2263 msleep(10);
2264 snd_soc_update_bits(codec, RT5640_PWR_ANLG1,
2265 RT5640_PWR_FV1 | RT5640_PWR_FV2,
2266 RT5640_PWR_FV1 | RT5640_PWR_FV2);
2267 codec->cache_only = false;
2268 snd_soc_cache_sync(codec);
2269 }
2270 break;
2271
2272 case SND_SOC_BIAS_OFF:
2273#ifdef RT5640_DEMO
2274 snd_soc_update_bits(codec, RT5640_SPK_VOL, RT5640_L_MUTE |
2275 RT5640_R_MUTE, RT5640_L_MUTE | RT5640_R_MUTE);
2276 snd_soc_update_bits(codec, RT5640_HP_VOL, RT5640_L_MUTE |
2277 RT5640_R_MUTE, RT5640_L_MUTE | RT5640_R_MUTE);
2278 snd_soc_update_bits(codec, RT5640_OUTPUT, RT5640_L_MUTE |
2279 RT5640_R_MUTE, RT5640_L_MUTE | RT5640_R_MUTE);
2280 snd_soc_update_bits(codec, RT5640_MONO_OUT,
2281 RT5640_L_MUTE, RT5640_L_MUTE);
2282#endif
2283 snd_soc_write(codec, RT5640_PWR_DIG1, 0x0000);
2284 snd_soc_write(codec, RT5640_PWR_DIG2, 0x0000);
2285 snd_soc_write(codec, RT5640_PWR_VOL, 0x0000);
2286 snd_soc_write(codec, RT5640_PWR_MIXER, 0x0000);
2287 snd_soc_write(codec, RT5640_PWR_ANLG1, 0x0000);
2288 snd_soc_write(codec, RT5640_PWR_ANLG2, 0x0000);
2289 break;
2290
2291 default:
2292 break;
2293 }
2294 codec->dapm.bias_level = level;
2295
2296 return 0;
2297}
2298
2299static int rt5640_probe(struct snd_soc_codec *codec)
2300{
2301 struct rt5640_priv *rt5640 = snd_soc_codec_get_drvdata(codec);
2302 int ret;
2303 u16 val;
2304
2305 ret = snd_soc_codec_set_cache_io(codec, 8, 16, SND_SOC_I2C);
2306 if (ret != 0) {
2307 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
2308 return ret;
2309 }
2310
2311 val = snd_soc_read(codec, RT5640_RESET);
2312 if (val != rt5640_reg[RT5640_RESET]) {
2313 dev_err(codec->dev,
2314 "Device with ID register %x is not a rt5640\n", val);
2315 return -ENODEV;
2316 }
2317
2318 rt5640_reset(codec);
2319 snd_soc_update_bits(codec, RT5640_PWR_ANLG1,
2320 RT5640_PWR_VREF1 | RT5640_PWR_MB |
2321 RT5640_PWR_BG | RT5640_PWR_VREF2,
2322 RT5640_PWR_VREF1 | RT5640_PWR_MB |
2323 RT5640_PWR_BG | RT5640_PWR_VREF2);
2324 msleep(100);
2325 snd_soc_update_bits(codec, RT5640_PWR_ANLG1,
2326 RT5640_PWR_FV1 | RT5640_PWR_FV2,
2327 RT5640_PWR_FV1 | RT5640_PWR_FV2);
2328 /* DMIC */
2329 if (rt5640->dmic_en == RT5640_DMIC1) {
2330 snd_soc_update_bits(codec, RT5640_GPIO_CTRL1,
2331 RT5640_GP2_PIN_MASK, RT5640_GP2_PIN_DMIC1_SCL);
2332 snd_soc_update_bits(codec, RT5640_DMIC,
2333 RT5640_DMIC_1L_LH_MASK | RT5640_DMIC_1R_LH_MASK,
2334 RT5640_DMIC_1L_LH_FALLING | RT5640_DMIC_1R_LH_RISING);
2335 } else if (rt5640->dmic_en == RT5640_DMIC2) {
2336 snd_soc_update_bits(codec, RT5640_GPIO_CTRL1,
2337 RT5640_GP2_PIN_MASK, RT5640_GP2_PIN_DMIC1_SCL);
2338 snd_soc_update_bits(codec, RT5640_DMIC,
2339 RT5640_DMIC_2L_LH_MASK | RT5640_DMIC_2R_LH_MASK,
2340 RT5640_DMIC_2L_LH_FALLING | RT5640_DMIC_2R_LH_RISING);
2341 }
2342
2343#ifdef RT5640_DEMO
2344 rt5640_reg_init(codec);
2345#endif
2346
2347
2348#if (CONFIG_SND_SOC_RT5642_MODULE | CONFIG_SND_SOC_RT5642)
2349 rt5640_register_dsp(codec);
2350#endif
2351
2352 codec->dapm.bias_level = SND_SOC_BIAS_STANDBY;
2353
2354 snd_soc_add_controls(codec, rt5640_snd_controls,
2355 ARRAY_SIZE(rt5640_snd_controls));
2356
2357 rt5640->codec = codec;
2358 ret = device_create_file(codec->dev, &dev_attr_index_reg);
2359 if (ret != 0) {
2360 dev_err(codec->dev,
2361 "Failed to create index_reg sysfs files: %d\n", ret);
2362 return ret;
2363 }
2364
2365 return 0;
2366}
2367
2368static int rt5640_remove(struct snd_soc_codec *codec)
2369{
2370 rt5640_set_bias_level(codec, SND_SOC_BIAS_OFF);
2371 rt5640_reset(codec);
2372 snd_soc_write(codec, RT5640_PWR_ANLG1, 0);
2373
2374 return 0;
2375}
2376#ifdef CONFIG_PM
2377static int rt5640_suspend(struct snd_soc_codec *codec, pm_message_t state)
2378{
2379 rt5640_set_bias_level(codec, SND_SOC_BIAS_OFF);
2380 snd_soc_write(codec, RT5640_PWR_ANLG1, 0);
2381
2382 return 0;
2383}
2384
2385static int rt5640_resume(struct snd_soc_codec *codec)
2386{
2387 rt5640_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
2388
2389 return 0;
2390}
2391#else
2392#define rt5640_suspend NULL
2393#define rt5640_resume NULL
2394#endif
2395
2396#define RT5640_STEREO_RATES SNDRV_PCM_RATE_8000_96000
2397#define RT5640_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE | \
2398 SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S8)
2399
2400struct snd_soc_dai_ops rt5640_aif_dai_ops = {
2401 .hw_params = rt5640_hw_params,
2402 .prepare = rt5640_prepare,
2403 .set_fmt = rt5640_set_dai_fmt,
2404 .set_sysclk = rt5640_set_dai_sysclk,
2405 .set_pll = rt5640_set_dai_pll,
2406};
2407
2408struct snd_soc_dai_driver rt5640_dai[] = {
2409 {
2410 .name = "rt5640-aif1",
2411 .id = RT5640_AIF1,
2412 .playback = {
2413 .stream_name = "AIF1 Playback",
2414 .channels_min = 1,
2415 .channels_max = 2,
2416 .rates = RT5640_STEREO_RATES,
2417 .formats = RT5640_FORMATS,
2418 },
2419 .capture = {
2420 .stream_name = "AIF1 Capture",
2421 .channels_min = 1,
2422 .channels_max = 2,
2423 .rates = RT5640_STEREO_RATES,
2424 .formats = RT5640_FORMATS,
2425 },
2426 .ops = &rt5640_aif_dai_ops,
2427 },
2428 {
2429 .name = "rt5640-aif2",
2430 .id = RT5640_AIF2,
2431 .playback = {
2432 .stream_name = "AIF2 Playback",
2433 .channels_min = 1,
2434 .channels_max = 2,
2435 .rates = RT5640_STEREO_RATES,
2436 .formats = RT5640_FORMATS,
2437 },
2438 .capture = {
2439 .stream_name = "AIF2 Capture",
2440 .channels_min = 1,
2441 .channels_max = 2,
2442 .rates = RT5640_STEREO_RATES,
2443 .formats = RT5640_FORMATS,
2444 },
2445 .ops = &rt5640_aif_dai_ops,
2446 },
2447#if (CONFIG_SND_SOC_RT5643_MODULE | CONFIG_SND_SOC_RT5643 | \
2448 CONFIG_SND_SOC_RT5646_MODULE | CONFIG_SND_SOC_RT5646)
2449 {
2450 .name = "rt5640-aif3",
2451 .id = RT5640_AIF3,
2452 .playback = {
2453 .stream_name = "AIF3 Playback",
2454 .channels_min = 1,
2455 .channels_max = 2,
2456 .rates = RT5640_STEREO_RATES,
2457 .formats = RT5640_FORMATS,
2458 },
2459 .capture = {
2460 .stream_name = "AIF3 Capture",
2461 .channels_min = 1,
2462 .channels_max = 2,
2463 .rates = RT5640_STEREO_RATES,
2464 .formats = RT5640_FORMATS,
2465 },
2466 .ops = &rt5640_aif_dai_ops,
2467 },
2468#endif
2469};
2470
2471static struct snd_soc_codec_driver soc_codec_dev_rt5640 = {
2472 .probe = rt5640_probe,
2473 .remove = rt5640_remove,
2474 .suspend = rt5640_suspend,
2475 .resume = rt5640_resume,
2476 .set_bias_level = rt5640_set_bias_level,
2477 .reg_cache_size = RT5640_VENDOR_ID2 + 1,
2478 .reg_word_size = sizeof(u16),
2479 .reg_cache_default = rt5640_reg,
2480 .volatile_register = rt5640_volatile_register,
2481 .readable_register = rt5640_readable_register,
2482 .reg_cache_step = 1,
2483 .dapm_widgets = rt5640_dapm_widgets,
2484 .num_dapm_widgets = ARRAY_SIZE(rt5640_dapm_widgets),
2485 .dapm_routes = rt5640_dapm_routes,
2486 .num_dapm_routes = ARRAY_SIZE(rt5640_dapm_routes),
2487};
2488
2489static const struct i2c_device_id rt5640_i2c_id[] = {
2490 { "rt5640", 0 },
2491 { }
2492};
2493MODULE_DEVICE_TABLE(i2c, rt5640_i2c_id);
2494
2495static int rt5640_i2c_probe(struct i2c_client *i2c,
2496 const struct i2c_device_id *id)
2497{
2498 struct rt5640_priv *rt5640;
2499 int ret;
2500
2501 rt5640 = kzalloc(sizeof(struct rt5640_priv), GFP_KERNEL);
2502 if (NULL == rt5640)
2503 return -ENOMEM;
2504
2505 i2c_set_clientdata(i2c, rt5640);
2506
2507 ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_rt5640,
2508 rt5640_dai, ARRAY_SIZE(rt5640_dai));
2509 if (ret < 0)
2510 kfree(rt5640);
2511
2512 return ret;
2513}
2514
2515static __devexit int rt5640_i2c_remove(struct i2c_client *i2c)
2516{
2517 snd_soc_unregister_codec(&i2c->dev);
2518 kfree(i2c_get_clientdata(i2c));
2519 return 0;
2520}
2521
2522struct i2c_driver rt5640_i2c_driver = {
2523 .driver = {
2524 .name = "rt5640",
2525 .owner = THIS_MODULE,
2526 },
2527 .probe = rt5640_i2c_probe,
2528 .remove = __devexit_p(rt5640_i2c_remove),
2529 .id_table = rt5640_i2c_id,
2530};
2531
2532static int __init rt5640_modinit(void)
2533{
2534 return i2c_add_driver(&rt5640_i2c_driver);
2535}
2536module_init(rt5640_modinit);
2537
2538static void __exit rt5640_modexit(void)
2539{
2540 i2c_del_driver(&rt5640_i2c_driver);
2541}
2542module_exit(rt5640_modexit);
2543
2544MODULE_DESCRIPTION("ASoC RT5640 driver");
2545MODULE_AUTHOR("Johnny Hsu <johnnyhsu@realtek.com>");
2546MODULE_LICENSE("GPL");
diff --git a/sound/soc/codecs/rt5640.h b/sound/soc/codecs/rt5640.h
new file mode 100644
index 00000000000..d6920f00e08
--- /dev/null
+++ b/sound/soc/codecs/rt5640.h
@@ -0,0 +1,2098 @@
1/*
2 * rt5640.h -- RT5640 ALSA SoC audio driver
3 *
4 * Copyright 2011 Realtek Microelectronics
5 * Author: Johnny Hsu <johnnyhsu@realtek.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef __RT5640_H__
13#define __RT5640_H__
14
15/* Info */
16#define RT5640_RESET 0x00
17#define RT5640_VENDOR_ID 0xfd
18#define RT5640_VENDOR_ID1 0xfe
19#define RT5640_VENDOR_ID2 0xff
20/* I/O - Output */
21#define RT5640_SPK_VOL 0x01
22#define RT5640_HP_VOL 0x02
23#define RT5640_OUTPUT 0x03
24#define RT5640_MONO_OUT 0x04
25/* I/O - Input */
26#define RT5640_IN1_IN2 0x0d
27#define RT5640_IN3_IN4 0x0e
28#define RT5640_INL_INR_VOL 0x0f
29/* I/O - ADC/DAC/DMIC */
30#define RT5640_DAC1_DIG_VOL 0x19
31#define RT5640_DAC2_DIG_VOL 0x1a
32#define RT5640_DAC2_CTRL 0x1b
33#define RT5640_ADC_DIG_VOL 0x1c
34#define RT5640_ADC_DATA 0x1d
35#define RT5640_ADC_BST_VOL 0x1e
36/* Mixer - D-D */
37#define RT5640_STO_ADC_MIXER 0x27
38#define RT5640_MONO_ADC_MIXER 0x28
39#define RT5640_AD_DA_MIXER 0x29
40#define RT5640_STO_DAC_MIXER 0x2a
41#define RT5640_MONO_DAC_MIXER 0x2b
42#define RT5640_DIG_MIXER 0x2c
43#define RT5640_DSP_PATH1 0x2d
44#define RT5640_DSP_PATH2 0x2e
45#define RT5640_DIG_INF_DATA 0x2f
46/* Mixer - ADC */
47#define RT5640_REC_L1_MIXER 0x3b
48#define RT5640_REC_L2_MIXER 0x3c
49#define RT5640_REC_R1_MIXER 0x3d
50#define RT5640_REC_R2_MIXER 0x3e
51/* Mixer - DAC */
52#define RT5640_HPO_MIXER 0x45
53#define RT5640_SPK_L_MIXER 0x46
54#define RT5640_SPK_R_MIXER 0x47
55#define RT5640_SPO_L_MIXER 0x48
56#define RT5640_SPO_R_MIXER 0x49
57#define RT5640_SPO_CLSD_RATIO 0x4a
58#define RT5640_MONO_MIXER 0x4c
59#define RT5640_OUT_L1_MIXER 0x4d
60#define RT5640_OUT_L2_MIXER 0x4e
61#define RT5640_OUT_L3_MIXER 0x4f
62#define RT5640_OUT_R1_MIXER 0x50
63#define RT5640_OUT_R2_MIXER 0x51
64#define RT5640_OUT_R3_MIXER 0x52
65#define RT5640_LOUT_MIXER 0x53
66/* Power */
67#define RT5640_PWR_DIG1 0x61
68#define RT5640_PWR_DIG2 0x62
69#define RT5640_PWR_ANLG1 0x63
70#define RT5640_PWR_ANLG2 0x64
71#define RT5640_PWR_MIXER 0x65
72#define RT5640_PWR_VOL 0x66
73/* Private Register Control */
74#define RT5640_PRIV_INDEX 0x6a
75#define RT5640_PRIV_DATA 0x6c
76/* Format - ADC/DAC */
77#define RT5640_I2S1_SDP 0x70
78#define RT5640_I2S2_SDP 0x71
79#define RT5640_I2S3_SDP 0x72
80#define RT5640_ADDA_CLK1 0x73
81#define RT5640_ADDA_CLK2 0x74
82#define RT5640_DMIC 0x75
83/* Function - Analog */
84#define RT5640_GLB_CLK 0x80
85#define RT5640_PLL_CTRL1 0x81
86#define RT5640_PLL_CTRL2 0x82
87#define RT5640_ASRC_1 0x83
88#define RT5640_ASRC_2 0x84
89#define RT5640_ASRC_3 0x85
90#define RT5640_ASRC_4 0x89
91#define RT5640_ASRC_5 0x8a
92#define RT5640_HP_OVCD 0x8b
93#define RT5640_CLS_D_OVCD 0x8c
94#define RT5640_CLS_D_OUT 0x8d
95#define RT5640_DEPOP_M1 0x8e
96#define RT5640_DEPOP_M2 0x8f
97#define RT5640_DEPOP_M3 0x90
98#define RT5640_CHARGE_PUMP 0x91
99#define RT5640_PV_DET_SPK_G 0x92
100#define RT5640_MICBIAS 0x93
101/* Function - Digital */
102#define RT5640_EQ_CTRL1 0xb0
103#define RT5640_EQ_CTRL2 0xb1
104#define RT5640_WIND_FILTER 0xb2
105#define RT5640_DRC_AGC_1 0xb4
106#define RT5640_DRC_AGC_2 0xb5
107#define RT5640_DRC_AGC_3 0xb6
108#define RT5640_SVOL_ZC 0xb7
109#define RT5640_ANC_CTRL1 0xb8
110#define RT5640_ANC_CTRL2 0xb9
111#define RT5640_ANC_CTRL3 0xba
112#define RT5640_JD_CTRL 0xbb
113#define RT5640_ANC_JD 0xbc
114#define RT5640_IRQ_CTRL1 0xbd
115#define RT5640_IRQ_CTRL2 0xbe
116#define RT5640_INT_IRQ_ST 0xbf
117#define RT5640_GPIO_CTRL1 0xc0
118#define RT5640_GPIO_CTRL2 0xc1
119#define RT5640_GPIO_CTRL3 0xc2
120#define RT5640_DSP_CTRL1 0xc4
121#define RT5640_DSP_CTRL2 0xc5
122#define RT5640_DSP_CTRL3 0xc6
123#define RT5640_DSP_CTRL4 0xc7
124#define RT5640_PGM_REG_ARR1 0xc8
125#define RT5640_PGM_REG_ARR2 0xc9
126#define RT5640_PGM_REG_ARR3 0xca
127#define RT5640_PGM_REG_ARR4 0xcb
128#define RT5640_PGM_REG_ARR5 0xcc
129#define RT5640_SCB_FUNC 0xcd
130#define RT5640_SCB_CTRL 0xce
131#define RT5640_BASE_BACK 0xcf
132#define RT5640_MP3_PLUS1 0xd0
133#define RT5640_MP3_PLUS2 0xd1
134#define RT5640_3D_HP 0xd2
135#define RT5640_ADJ_HPF 0xd3
136#define RT5640_HP_CALIB_AMP_DET 0xd6
137#define RT5640_HP_CALIB2 0xd7
138#define RT5640_SV_ZCD1 0xd9
139#define RT5640_SV_ZCD2 0xda
140/* Dummy Register */
141#define RT5640_DUMMY1 0xfa
142#define RT5640_DUMMY2 0xfb
143#define RT5640_DUMMY3 0xfc
144
145
146/* Index of Codec Private Register definition */
147#define RT5640_3D_SPK 0x63
148#define RT5640_WND_1 0x6c
149#define RT5640_WND_2 0x6d
150#define RT5640_WND_3 0x6e
151#define RT5640_WND_4 0x6f
152#define RT5640_WND_5 0x70
153#define RT5640_WND_8 0x73
154#define RT5640_DIP_SPK_INF 0x75
155#define RT5640_EQ_BW_LOP 0xa0
156#define RT5640_EQ_GN_LOP 0xa1
157#define RT5640_EQ_FC_BP1 0xa2
158#define RT5640_EQ_BW_BP1 0xa3
159#define RT5640_EQ_GN_BP1 0xa4
160#define RT5640_EQ_FC_BP2 0xa5
161#define RT5640_EQ_BW_BP2 0xa6
162#define RT5640_EQ_GN_BP2 0xa7
163#define RT5640_EQ_FC_BP3 0xa8
164#define RT5640_EQ_BW_BP3 0xa9
165#define RT5640_EQ_GN_BP3 0xaa
166#define RT5640_EQ_FC_BP4 0xab
167#define RT5640_EQ_BW_BP4 0xac
168#define RT5640_EQ_GN_BP4 0xad
169#define RT5640_EQ_FC_HIP1 0xae
170#define RT5640_EQ_GN_HIP1 0xaf
171#define RT5640_EQ_FC_HIP2 0xb0
172#define RT5640_EQ_BW_HIP2 0xb1
173#define RT5640_EQ_GN_HIP2 0xb2
174#define RT5640_EQ_PRE_VOL 0xb3
175#define RT5640_EQ_PST_VOL 0xb4
176
177
178/* global definition */
179#define RT5640_L_MUTE (0x1 << 15)
180#define RT5640_L_MUTE_SFT 15
181#define RT5640_VOL_L_MUTE (0x1 << 14)
182#define RT5640_VOL_L_SFT 14
183#define RT5640_R_MUTE (0x1 << 7)
184#define RT5640_R_MUTE_SFT 7
185#define RT5640_VOL_R_MUTE (0x1 << 6)
186#define RT5640_VOL_R_SFT 6
187#define RT5640_L_VOL_MASK (0x3f << 8)
188#define RT5640_L_VOL_SFT 8
189#define RT5640_R_VOL_MASK (0x3f)
190#define RT5640_R_VOL_SFT 0
191
192/* IN1 and IN2 Control (0x0d) */
193/* IN3 and IN4 Control (0x0e) */
194#define RT5640_BST_SFT1 12
195#define RT5640_BST_SFT2 8
196#define RT5640_IN_DF1 (0x1 << 7)
197#define RT5640_IN_SFT1 7
198#define RT5640_IN_DF2 (0x1 << 6)
199#define RT5640_IN_SFT2 6
200
201/* INL and INR Volume Control (0x0f) */
202#define RT5640_INL_SEL_MASK (0x1 << 15)
203#define RT5640_INL_SEL_SFT 15
204#define RT5640_INL_SEL_IN4P (0x0 << 15)
205#define RT5640_INL_SEL_MONOP (0x1 << 15)
206#define RT5640_INL_VOL_MASK (0x1f << 8)
207#define RT5640_INL_VOL_SFT 8
208#define RT5640_INR_SEL_MASK (0x1 << 7)
209#define RT5640_INR_SEL_SFT 7
210#define RT5640_INR_SEL_IN4N (0x0 << 7)
211#define RT5640_INR_SEL_MONON (0x1 << 7)
212#define RT5640_INR_VOL_MASK (0x1f)
213#define RT5640_INR_VOL_SFT 0
214
215/* DAC1 Digital Volume (0x19) */
216#define RT5640_DAC_L1_VOL_MASK (0xff << 8)
217#define RT5640_DAC_L1_VOL_SFT 8
218#define RT5640_DAC_R1_VOL_MASK (0xff)
219#define RT5640_DAC_R1_VOL_SFT 0
220
221/* DAC2 Digital Volume (0x1a) */
222#define RT5640_DAC_L2_VOL_MASK (0xff << 8)
223#define RT5640_DAC_L2_VOL_SFT 8
224#define RT5640_DAC_R2_VOL_MASK (0xff)
225#define RT5640_DAC_R2_VOL_SFT 0
226
227/* DAC2 Control (0x1b) */
228#define RT5640_M_DAC_L2_VOL (0x1 << 13)
229#define RT5640_M_DAC_L2_VOL_SFT 13
230#define RT5640_M_DAC_R2_VOL (0x1 << 12)
231#define RT5640_M_DAC_R2_VOL_SFT 12
232
233/* ADC Digital Volume Control (0x1c) */
234#define RT5640_ADC_L_VOL_MASK (0x7f << 8)
235#define RT5640_ADC_L_VOL_SFT 8
236#define RT5640_ADC_R_VOL_MASK (0x7f)
237#define RT5640_ADC_R_VOL_SFT 0
238
239/* Mono ADC Digital Volume Control (0x1d) */
240#define RT5640_MONO_ADC_L_VOL_MASK (0x7f << 8)
241#define RT5640_MONO_ADC_L_VOL_SFT 8
242#define RT5640_MONO_ADC_R_VOL_MASK (0x7f)
243#define RT5640_MONO_ADC_R_VOL_SFT 0
244
245/* ADC Boost Volume Control (0x1e) */
246#define RT5640_ADC_L_BST_MASK (0x3 << 14)
247#define RT5640_ADC_L_BST_SFT 14
248#define RT5640_ADC_R_BST_MASK (0x3 << 12)
249#define RT5640_ADC_R_BST_SFT 12
250#define RT5640_ADC_COMP_MASK (0x3 << 10)
251#define RT5640_ADC_COMP_SFT 10
252
253/* Stereo ADC Mixer Control (0x27) */
254#define RT5640_M_ADC_L1 (0x1 << 14)
255#define RT5640_M_ADC_L1_SFT 14
256#define RT5640_M_ADC_L2 (0x1 << 13)
257#define RT5640_M_ADC_L2_SFT 13
258#define RT5640_ADC_1_SRC_MASK (0x1 << 12)
259#define RT5640_ADC_1_SRC_SFT 12
260#define RT5640_ADC_1_SRC_ADC (0x1 << 12)
261#define RT5640_ADC_1_SRC_DACMIX (0x0 << 12)
262#define RT5640_ADC_2_SRC_MASK (0x3 << 10)
263#define RT5640_ADC_2_SRC_SFT 10
264#define RT5640_ADC_2_SRC_DMIC1 (0x0 << 10)
265#define RT5640_ADC_2_SRC_DMIC2 (0x1 << 10)
266#define RT5640_ADC_2_SRC_DACMIX (0x2 << 10)
267#define RT5640_M_ADC_R1 (0x1 << 6)
268#define RT5640_M_ADC_R1_SFT 6
269#define RT5640_M_ADC_R2 (0x1 << 5)
270#define RT5640_M_ADC_R2_SFT 5
271
272/* Mono ADC Mixer Control (0x28) */
273#define RT5640_M_MONO_ADC_L1 (0x1 << 14)
274#define RT5640_M_MONO_ADC_L1_SFT 14
275#define RT5640_M_MONO_ADC_L2 (0x1 << 13)
276#define RT5640_M_MONO_ADC_L2_SFT 13
277#define RT5640_MONO_ADC_L1_SRC_MASK (0x1 << 12)
278#define RT5640_MONO_ADC_L1_SRC_SFT 12
279#define RT5640_MONO_ADC_L1_SRC_DACMIXL (0x0 << 12)
280#define RT5640_MONO_ADC_L1_SRC_ADCL (0x1 << 12)
281#define RT5640_MONO_ADC_L2_SRC_MASK (0x3 << 10)
282#define RT5640_MONO_ADC_L2_SRC_SFT 10
283#define RT5640_MONO_ADC_L2_SRC_DMIC_L1 (0x0 << 10)
284#define RT5640_MONO_ADC_L2_SRC_DMIC_L2 (0x1 << 10)
285#define RT5640_MONO_ADC_L2_SRC_DACMIXL (0x2 << 10)
286#define RT5640_M_MONO_ADC_R1 (0x1 << 6)
287#define RT5640_M_MONO_ADC_R1_SFT 6
288#define RT5640_M_MONO_ADC_R2 (0x1 << 5)
289#define RT5640_M_MONO_ADC_R2_SFT 5
290#define RT5640_MONO_ADC_R1_SRC_MASK (0x1 << 4)
291#define RT5640_MONO_ADC_R1_SRC_SFT 4
292#define RT5640_MONO_ADC_R1_SRC_ADCR (0x1 << 4)
293#define RT5640_MONO_ADC_R1_SRC_DACMIXR (0x0 << 4)
294#define RT5640_MONO_ADC_R2_SRC_MASK (0x3 << 2)
295#define RT5640_MONO_ADC_R2_SRC_SFT 2
296#define RT5640_MONO_ADC_R2_SRC_DMIC_R1 (0x0 << 2)
297#define RT5640_MONO_ADC_R2_SRC_DMIC_R2 (0x1 << 2)
298#define RT5640_MONO_ADC_R2_SRC_DACMIXR (0x2 << 2)
299
300/* ADC Mixer to DAC Mixer Control (0x29) */
301#define RT5640_M_ADCMIX_L (0x1 << 15)
302#define RT5640_M_ADCMIX_L_SFT 15
303#define RT5640_M_IF1_DAC_L (0x1 << 14)
304#define RT5640_M_IF1_DAC_L_SFT 14
305#define RT5640_M_ADCMIX_R (0x1 << 7)
306#define RT5640_M_ADCMIX_R_SFT 7
307#define RT5640_M_IF1_DAC_R (0x1 << 6)
308#define RT5640_M_IF1_DAC_R_SFT 6
309
310/* Stereo DAC Mixer Control (0x2a) */
311#define RT5640_M_DAC_L1 (0x1 << 14)
312#define RT5640_M_DAC_L1_SFT 14
313#define RT5640_DAC_L1_STO_L_VOL_MASK (0x1 << 13)
314#define RT5640_DAC_L1_STO_L_VOL_SFT 13
315#define RT5640_M_DAC_L2 (0x1 << 12)
316#define RT5640_M_DAC_L2_SFT 12
317#define RT5640_DAC_L2_STO_L_VOL_MASK (0x1 << 11)
318#define RT5640_DAC_L2_STO_L_VOL_SFT 11
319#define RT5640_M_ANC_DAC_L (0x1 << 10)
320#define RT5640_M_ANC_DAC_L_SFT 10
321#define RT5640_M_DAC_R1 (0x1 << 6)
322#define RT5640_M_DAC_R1_SFT 6
323#define RT5640_DAC_R1_STO_R_VOL_MASK (0x1 << 5)
324#define RT5640_DAC_R1_STO_R_VOL_SFT 5
325#define RT5640_M_DAC_R2 (0x1 << 4)
326#define RT5640_M_DAC_R2_SFT 4
327#define RT5640_DAC_R2_STO_R_VOL_MASK (0x1 << 3)
328#define RT5640_DAC_R2_STO_R_VOL_SFT 3
329#define RT5640_M_ANC_DAC_R (0x1 << 2)
330#define RT5640_M_ANC_DAC_R_SFT 2
331
332/* Mono DAC Mixer Control (0x2b) */
333#define RT5640_M_DAC_L1_MONO_L (0x1 << 14)
334#define RT5640_M_DAC_L1_MONO_L_SFT 14
335#define RT5640_DAC_L1_MONO_L_VOL_MASK (0x1 << 13)
336#define RT5640_DAC_L1_MONO_L_VOL_SFT 13
337#define RT5640_M_DAC_L2_MONO_L (0x1 << 12)
338#define RT5640_M_DAC_L2_MONO_L_SFT 12
339#define RT5640_DAC_L2_MONO_L_VOL_MASK (0x1 << 11)
340#define RT5640_DAC_L2_MONO_L_VOL_SFT 11
341#define RT5640_M_DAC_R2_MONO_L (0x1 << 10)
342#define RT5640_M_DAC_R2_MONO_L_SFT 10
343#define RT5640_DAC_R2_MONO_L_VOL_MASK (0x1 << 9)
344#define RT5640_DAC_R2_MONO_L_VOL_SFT 9
345#define RT5640_M_DAC_R1_MONO_R (0x1 << 6)
346#define RT5640_M_DAC_R1_MONO_R_SFT 6
347#define RT5640_DAC_R1_MONO_R_VOL_MASK (0x1 << 5)
348#define RT5640_DAC_R1_MONO_R_VOL_SFT 5
349#define RT5640_M_DAC_R2_MONO_R (0x1 << 4)
350#define RT5640_M_DAC_R2_MONO_R_SFT 4
351#define RT5640_DAC_R2_MONO_R_VOL_MASK (0x1 << 3)
352#define RT5640_DAC_R2_MONO_R_VOL_SFT 3
353#define RT5640_M_DAC_L2_MONO_R (0x1 << 2)
354#define RT5640_M_DAC_L2_MONO_R_SFT 2
355#define RT5640_DAC_L2_MONO_R_VOL_MASK (0x1 << 1)
356#define RT5640_DAC_L2_MONO_R_VOL_SFT 1
357
358/* Digital Mixer Control (0x2c) */
359#define RT5640_M_STO_L_DAC_L (0x1 << 15)
360#define RT5640_M_STO_L_DAC_L_SFT 15
361#define RT5640_STO_L_DAC_L_VOL_MASK (0x1 << 14)
362#define RT5640_STO_L_DAC_L_VOL_SFT 14
363#define RT5640_M_DAC_L2_DAC_L (0x1 << 13)
364#define RT5640_M_DAC_L2_DAC_L_SFT 13
365#define RT5640_DAC_L2_DAC_L_VOL_MASK (0x1 << 12)
366#define RT5640_DAC_L2_DAC_L_VOL_SFT 12
367#define RT5640_M_STO_R_DAC_R (0x1 << 11)
368#define RT5640_M_STO_R_DAC_R_SFT 11
369#define RT5640_STO_R_DAC_R_VOL_MASK (0x1 << 10)
370#define RT5640_STO_R_DAC_R_VOL_SFT 10
371#define RT5640_M_DAC_R2_DAC_R (0x1 << 9)
372#define RT5640_M_DAC_R2_DAC_R_SFT 9
373#define RT5640_DAC_R2_DAC_R_VOL_MASK (0x1 << 8)
374#define RT5640_DAC_R2_DAC_R_VOL_SFT 8
375
376/* DSP Path Control 1 (0x2d) */
377#define RT5640_RXDP_SRC_MASK (0x1 << 15)
378#define RT5640_RXDP_SRC_SFT 15
379#define RT5640_RXDP_SRC_NOR (0x0 << 15)
380#define RT5640_RXDP_SRC_DIV3 (0x1 << 15)
381#define RT5640_TXDP_SRC_MASK (0x1 << 14)
382#define RT5640_TXDP_SRC_SFT 14
383#define RT5640_TXDP_SRC_NOR (0x0 << 14)
384#define RT5640_TXDP_SRC_DIV3 (0x1 << 14)
385
386/* DSP Path Control 2 (0x2e) */
387#define RT5640_DAC_L2_SEL_MASK (0x3 << 14)
388#define RT5640_DAC_L2_SEL_SFT 14
389#define RT5640_DAC_L2_SEL_IF2 (0x0 << 14)
390#define RT5640_DAC_L2_SEL_IF3 (0x1 << 14)
391#define RT5640_DAC_L2_SEL_TXDC (0x2 << 14)
392#define RT5640_DAC_L2_SEL_BASS (0x3 << 14)
393#define RT5640_DAC_R2_SEL_MASK (0x3 << 12)
394#define RT5640_DAC_R2_SEL_SFT 12
395#define RT5640_DAC_R2_SEL_IF2 (0x0 << 12)
396#define RT5640_DAC_R2_SEL_IF3 (0x1 << 12)
397#define RT5640_DAC_R2_SEL_TXDC (0x2 << 12)
398#define RT5640_IF2_ADC_L_SEL_MASK (0x1 << 11)
399#define RT5640_IF2_ADC_L_SEL_SFT 11
400#define RT5640_IF2_ADC_L_SEL_TXDP (0x0 << 11)
401#define RT5640_IF2_ADC_L_SEL_PASS (0x1 << 11)
402#define RT5640_IF2_ADC_R_SEL_MASK (0x1 << 10)
403#define RT5640_IF2_ADC_R_SEL_SFT 10
404#define RT5640_IF2_ADC_R_SEL_TXDP (0x0 << 10)
405#define RT5640_IF2_ADC_R_SEL_PASS (0x1 << 10)
406#define RT5640_RXDC_SEL_MASK (0x3 << 8)
407#define RT5640_RXDC_SEL_SFT 8
408#define RT5640_RXDC_SEL_NOR (0x0 << 8)
409#define RT5640_RXDC_SEL_L2R (0x1 << 8)
410#define RT5640_RXDC_SEL_R2L (0x2 << 8)
411#define RT5640_RXDC_SEL_SWAP (0x3 << 8)
412#define RT5640_RXDP_SEL_MASK (0x3 << 6)
413#define RT5640_RXDP_SEL_SFT 6
414#define RT5640_RXDP_SEL_NOR (0x0 << 6)
415#define RT5640_RXDP_SEL_L2R (0x1 << 6)
416#define RT5640_RXDP_SEL_R2L (0x2 << 6)
417#define RT5640_RXDP_SEL_SWAP (0x3 << 6)
418#define RT5640_TXDC_SEL_MASK (0x3 << 4)
419#define RT5640_TXDC_SEL_SFT 4
420#define RT5640_TXDC_SEL_NOR (0x0 << 4)
421#define RT5640_TXDC_SEL_L2R (0x1 << 4)
422#define RT5640_TXDC_SEL_R2L (0x2 << 4)
423#define RT5640_TXDC_SEL_SWAP (0x3 << 4)
424#define RT5640_TXDP_SEL_MASK (0x3 << 2)
425#define RT5640_TXDP_SEL_SFT 2
426#define RT5640_TXDP_SEL_NOR (0x0 << 2)
427#define RT5640_TXDP_SEL_L2R (0x1 << 2)
428#define RT5640_TXDP_SEL_R2L (0x2 << 2)
429#define RT5640_TRXDP_SEL_SWAP (0x3 << 2)
430
431/* Digital Interface Data Control (0x2f) */
432#define RT5640_IF1_DAC_SEL_MASK (0x3 << 14)
433#define RT5640_IF1_DAC_SEL_SFT 14
434#define RT5640_IF1_DAC_SEL_NOR (0x0 << 14)
435#define RT5640_IF1_DAC_SEL_L2R (0x1 << 14)
436#define RT5640_IF1_DAC_SEL_R2L (0x2 << 14)
437#define RT5640_IF1_DAC_SEL_SWAP (0x3 << 14)
438#define RT5640_IF1_ADC_SEL_MASK (0x3 << 12)
439#define RT5640_IF1_ADC_SEL_SFT 12
440#define RT5640_IF1_ADC_SEL_NOR (0x0 << 12)
441#define RT5640_IF1_ADC_SEL_L2R (0x1 << 12)
442#define RT5640_IF1_ADC_SEL_R2L (0x2 << 12)
443#define RT5640_IF1_ADC_SEL_SWAP (0x3 << 12)
444#define RT5640_IF2_DAC_SEL_MASK (0x3 << 10)
445#define RT5640_IF2_DAC_SEL_SFT 10
446#define RT5640_IF2_DAC_SEL_NOR (0x0 << 10)
447#define RT5640_IF2_DAC_SEL_L2R (0x1 << 10)
448#define RT5640_IF2_DAC_SEL_R2L (0x2 << 10)
449#define RT5640_IF2_DAC_SEL_SWAP (0x3 << 10)
450#define RT5640_IF2_ADC_SEL_MASK (0x3 << 8)
451#define RT5640_IF2_ADC_SEL_SFT 8
452#define RT5640_IF2_ADC_SEL_NOR (0x0 << 8)
453#define RT5640_IF2_ADC_SEL_L2R (0x1 << 8)
454#define RT5640_IF2_ADC_SEL_R2L (0x2 << 8)
455#define RT5640_IF2_ADC_SEL_SWAP (0x3 << 8)
456#define RT5640_IF3_DAC_SEL_MASK (0x3 << 6)
457#define RT5640_IF3_DAC_SEL_SFT 6
458#define RT5640_IF3_DAC_SEL_NOR (0x0 << 6)
459#define RT5640_IF3_DAC_SEL_L2R (0x1 << 6)
460#define RT5640_IF3_DAC_SEL_R2L (0x2 << 6)
461#define RT5640_IF3_DAC_SEL_SWAP (0x3 << 6)
462#define RT5640_IF3_ADC_SEL_MASK (0x3 << 4)
463#define RT5640_IF3_ADC_SEL_SFT 4
464#define RT5640_IF3_ADC_SEL_NOR (0x0 << 4)
465#define RT5640_IF3_ADC_SEL_L2R (0x1 << 4)
466#define RT5640_IF3_ADC_SEL_R2L (0x2 << 4)
467#define RT5640_IF3_ADC_SEL_SWAP (0x3 << 4)
468
469/* REC Left Mixer Control 1 (0x3b) */
470#define RT5640_G_HP_L_RM_L_MASK (0x7 << 13)
471#define RT5640_G_HP_L_RM_L_SFT 13
472#define RT5640_G_IN_L_RM_L_MASK (0x7 << 10)
473#define RT5640_G_IN_L_RM_L_SFT 10
474#define RT5640_G_BST4_RM_L_MASK (0x7 << 7)
475#define RT5640_G_BST4_RM_L_SFT 7
476#define RT5640_G_BST3_RM_L_MASK (0x7 << 4)
477#define RT5640_G_BST3_RM_L_SFT 4
478#define RT5640_G_BST2_RM_L_MASK (0x7 << 1)
479#define RT5640_G_BST2_RM_L_SFT 1
480
481/* REC Left Mixer Control 2 (0x3c) */
482#define RT5640_G_BST1_RM_L_MASK (0x7 << 13)
483#define RT5640_G_BST1_RM_L_SFT 13
484#define RT5640_G_OM_L_RM_L_MASK (0x7 << 10)
485#define RT5640_G_OM_L_RM_L_SFT 10
486#define RT5640_M_HP_L_RM_L (0x1 << 6)
487#define RT5640_M_HP_L_RM_L_SFT 6
488#define RT5640_M_IN_L_RM_L (0x1 << 5)
489#define RT5640_M_IN_L_RM_L_SFT 5
490#define RT5640_M_BST4_RM_L (0x1 << 4)
491#define RT5640_M_BST4_RM_L_SFT 4
492#define RT5640_M_BST3_RM_L (0x1 << 3)
493#define RT5640_M_BST3_RM_L_SFT 3
494#define RT5640_M_BST2_RM_L (0x1 << 2)
495#define RT5640_M_BST2_RM_L_SFT 2
496#define RT5640_M_BST1_RM_L (0x1 << 1)
497#define RT5640_M_BST1_RM_L_SFT 1
498#define RT5640_M_OM_L_RM_L (0x1)
499#define RT5640_M_OM_L_RM_L_SFT 0
500
501/* REC Right Mixer Control 1 (0x3d) */
502#define RT5640_G_HP_R_RM_R_MASK (0x7 << 13)
503#define RT5640_G_HP_R_RM_R_SFT 13
504#define RT5640_G_IN_R_RM_R_MASK (0x7 << 10)
505#define RT5640_G_IN_R_RM_R_SFT 10
506#define RT5640_G_BST4_RM_R_MASK (0x7 << 7)
507#define RT5640_G_BST4_RM_R_SFT 7
508#define RT5640_G_BST3_RM_R_MASK (0x7 << 4)
509#define RT5640_G_BST3_RM_R_SFT 4
510#define RT5640_G_BST2_RM_R_MASK (0x7 << 1)
511#define RT5640_G_BST2_RM_R_SFT 1
512
513/* REC Right Mixer Control 2 (0x3e) */
514#define RT5640_G_BST1_RM_R_MASK (0x7 << 13)
515#define RT5640_G_BST1_RM_R_SFT 13
516#define RT5640_G_OM_R_RM_R_MASK (0x7 << 10)
517#define RT5640_G_OM_R_RM_R_SFT 10
518#define RT5640_M_HP_R_RM_R (0x1 << 6)
519#define RT5640_M_HP_R_RM_R_SFT 6
520#define RT5640_M_IN_R_RM_R (0x1 << 5)
521#define RT5640_M_IN_R_RM_R_SFT 5
522#define RT5640_M_BST4_RM_R (0x1 << 4)
523#define RT5640_M_BST4_RM_R_SFT 4
524#define RT5640_M_BST3_RM_R (0x1 << 3)
525#define RT5640_M_BST3_RM_R_SFT 3
526#define RT5640_M_BST2_RM_R (0x1 << 2)
527#define RT5640_M_BST2_RM_R_SFT 2
528#define RT5640_M_BST1_RM_R (0x1 << 1)
529#define RT5640_M_BST1_RM_R_SFT 1
530#define RT5640_M_OM_R_RM_R (0x1)
531#define RT5640_M_OM_R_RM_R_SFT 0
532
533/* HPMIX Control (0x45) */
534#define RT5640_M_DAC2_HM (0x1 << 15)
535#define RT5640_M_DAC2_HM_SFT 15
536#define RT5640_M_DAC1_HM (0x1 << 14)
537#define RT5640_M_DAC1_HM_SFT 14
538#define RT5640_M_HPVOL_HM (0x1 << 13)
539#define RT5640_M_HPVOL_HM_SFT 13
540#define RT5640_G_HPOMIX_MASK (0x1 << 12)
541#define RT5640_G_HPOMIX_SFT 12
542
543/* SPK Left Mixer Control (0x46) */
544#define RT5640_G_RM_L_SM_L_MASK (0x3 << 14)
545#define RT5640_G_RM_L_SM_L_SFT 14
546#define RT5640_G_IN_L_SM_L_MASK (0x3 << 12)
547#define RT5640_G_IN_L_SM_L_SFT 12
548#define RT5640_G_DAC_L1_SM_L_MASK (0x3 << 10)
549#define RT5640_G_DAC_L1_SM_L_SFT 10
550#define RT5640_G_DAC_L2_SM_L_MASK (0x3 << 8)
551#define RT5640_G_DAC_L2_SM_L_SFT 8
552#define RT5640_G_OM_L_SM_L_MASK (0x3 << 6)
553#define RT5640_G_OM_L_SM_L_SFT 6
554#define RT5640_M_RM_L_SM_L (0x1 << 5)
555#define RT5640_M_RM_L_SM_L_SFT 5
556#define RT5640_M_IN_L_SM_L (0x1 << 4)
557#define RT5640_M_IN_L_SM_L_SFT 4
558#define RT5640_M_DAC_L1_SM_L (0x1 << 3)
559#define RT5640_M_DAC_L1_SM_L_SFT 3
560#define RT5640_M_DAC_L2_SM_L (0x1 << 2)
561#define RT5640_M_DAC_L2_SM_L_SFT 2
562#define RT5640_M_OM_L_SM_L (0x1 << 1)
563#define RT5640_M_OM_L_SM_L_SFT 1
564
565/* SPK Right Mixer Control (0x47) */
566#define RT5640_G_RM_R_SM_R_MASK (0x3 << 14)
567#define RT5640_G_RM_R_SM_R_SFT 14
568#define RT5640_G_IN_R_SM_R_MASK (0x3 << 12)
569#define RT5640_G_IN_R_SM_R_SFT 12
570#define RT5640_G_DAC_R1_SM_R_MASK (0x3 << 10)
571#define RT5640_G_DAC_R1_SM_R_SFT 10
572#define RT5640_G_DAC_R2_SM_R_MASK (0x3 << 8)
573#define RT5640_G_DAC_R2_SM_R_SFT 8
574#define RT5640_G_OM_R_SM_R_MASK (0x3 << 6)
575#define RT5640_G_OM_R_SM_R_SFT 6
576#define RT5640_M_RM_R_SM_R (0x1 << 5)
577#define RT5640_M_RM_R_SM_R_SFT 5
578#define RT5640_M_IN_R_SM_R (0x1 << 4)
579#define RT5640_M_IN_R_SM_R_SFT 4
580#define RT5640_M_DAC_R1_SM_R (0x1 << 3)
581#define RT5640_M_DAC_R1_SM_R_SFT 3
582#define RT5640_M_DAC_R2_SM_R (0x1 << 2)
583#define RT5640_M_DAC_R2_SM_R_SFT 2
584#define RT5640_M_OM_R_SM_R (0x1 << 1)
585#define RT5640_M_OM_R_SM_R_SFT 1
586
587/* SPOLMIX Control (0x48) */
588#define RT5640_M_DAC_R1_SPM_L (0x1 << 15)
589#define RT5640_M_DAC_R1_SPM_L_SFT 15
590#define RT5640_M_DAC_L1_SPM_L (0x1 << 14)
591#define RT5640_M_DAC_L1_SPM_L_SFT 14
592#define RT5640_M_SV_R_SPM_L (0x1 << 13)
593#define RT5640_M_SV_R_SPM_L_SFT 13
594#define RT5640_M_SV_L_SPM_L (0x1 << 12)
595#define RT5640_M_SV_L_SPM_L_SFT 12
596#define RT5640_M_BST1_SPM_L (0x1 << 11)
597#define RT5640_M_BST1_SPM_L_SFT 11
598
599/* SPORMIX Control (0x49) */
600#define RT5640_M_DAC_R1_SPM_R (0x1 << 13)
601#define RT5640_M_DAC_R1_SPM_R_SFT 13
602#define RT5640_M_SV_R_SPM_R (0x1 << 12)
603#define RT5640_M_SV_R_SPM_R_SFT 12
604#define RT5640_M_BST1_SPM_R (0x1 << 11)
605#define RT5640_M_BST1_SPM_R_SFT 11
606
607/* SPOLMIX / SPORMIX Ratio Control (0x4a) */
608#define RT5640_SPO_CLSD_RATIO_MASK (0x7)
609#define RT5640_SPO_CLSD_RATIO_SFT 0
610
611/* Mono Output Mixer Control (0x4c) */
612#define RT5640_M_DAC_R2_MM (0x1 << 15)
613#define RT5640_M_DAC_R2_MM_SFT 15
614#define RT5640_M_DAC_L2_MM (0x1 << 14)
615#define RT5640_M_DAC_L2_MM_SFT 14
616#define RT5640_M_OV_R_MM (0x1 << 13)
617#define RT5640_M_OV_R_MM_SFT 13
618#define RT5640_M_OV_L_MM (0x1 << 12)
619#define RT5640_M_OV_L_MM_SFT 12
620#define RT5640_M_BST1_MM (0x1 << 11)
621#define RT5640_M_BST1_MM_SFT 11
622#define RT5640_G_MONOMIX_MASK (0x1 << 10)
623#define RT5640_G_MONOMIX_SFT 10
624
625/* Output Left Mixer Control 1 (0x4d) */
626#define RT5640_G_BST3_OM_L_MASK (0x7 << 13)
627#define RT5640_G_BST3_OM_L_SFT 13
628#define RT5640_G_BST2_OM_L_MASK (0x7 << 10)
629#define RT5640_G_BST2_OM_L_SFT 10
630#define RT5640_G_BST1_OM_L_MASK (0x7 << 7)
631#define RT5640_G_BST1_OM_L_SFT 7
632#define RT5640_G_IN_L_OM_L_MASK (0x7 << 4)
633#define RT5640_G_IN_L_OM_L_SFT 4
634#define RT5640_G_RM_L_OM_L_MASK (0x7 << 1)
635#define RT5640_G_RM_L_OM_L_SFT 1
636
637/* Output Left Mixer Control 2 (0x4e) */
638#define RT5640_G_DAC_R2_OM_L_MASK (0x7 << 13)
639#define RT5640_G_DAC_R2_OM_L_SFT 13
640#define RT5640_G_DAC_L2_OM_L_MASK (0x7 << 10)
641#define RT5640_G_DAC_L2_OM_L_SFT 10
642#define RT5640_G_DAC_L1_OM_L_MASK (0x7 << 7)
643#define RT5640_G_DAC_L1_OM_L_SFT 7
644
645/* Output Left Mixer Control 3 (0x4f) */
646#define RT5640_M_SM_L_OM_L (0x1 << 8)
647#define RT5640_M_SM_L_OM_L_SFT 8
648#define RT5640_M_BST3_OM_L (0x1 << 7)
649#define RT5640_M_BST3_OM_L_SFT 7
650#define RT5640_M_BST2_OM_L (0x1 << 6)
651#define RT5640_M_BST2_OM_L_SFT 6
652#define RT5640_M_BST1_OM_L (0x1 << 5)
653#define RT5640_M_BST1_OM_L_SFT 5
654#define RT5640_M_IN_L_OM_L (0x1 << 4)
655#define RT5640_M_IN_L_OM_L_SFT 4
656#define RT5640_M_RM_L_OM_L (0x1 << 3)
657#define RT5640_M_RM_L_OM_L_SFT 3
658#define RT5640_M_DAC_R2_OM_L (0x1 << 2)
659#define RT5640_M_DAC_R2_OM_L_SFT 2
660#define RT5640_M_DAC_L2_OM_L (0x1 << 1)
661#define RT5640_M_DAC_L2_OM_L_SFT 1
662#define RT5640_M_DAC_L1_OM_L (0x1)
663#define RT5640_M_DAC_L1_OM_L_SFT 0
664
665/* Output Right Mixer Control 1 (0x50) */
666#define RT5640_G_BST4_OM_R_MASK (0x7 << 13)
667#define RT5640_G_BST4_OM_R_SFT 13
668#define RT5640_G_BST2_OM_R_MASK (0x7 << 10)
669#define RT5640_G_BST2_OM_R_SFT 10
670#define RT5640_G_BST1_OM_R_MASK (0x7 << 7)
671#define RT5640_G_BST1_OM_R_SFT 7
672#define RT5640_G_IN_R_OM_R_MASK (0x7 << 4)
673#define RT5640_G_IN_R_OM_R_SFT 4
674#define RT5640_G_RM_R_OM_R_MASK (0x7 << 1)
675#define RT5640_G_RM_R_OM_R_SFT 1
676
677/* Output Right Mixer Control 2 (0x51) */
678#define RT5640_G_DAC_L2_OM_R_MASK (0x7 << 13)
679#define RT5640_G_DAC_L2_OM_R_SFT 13
680#define RT5640_G_DAC_R2_OM_R_MASK (0x7 << 10)
681#define RT5640_G_DAC_R2_OM_R_SFT 10
682#define RT5640_G_DAC_R1_OM_R_MASK (0x7 << 7)
683#define RT5640_G_DAC_R1_OM_R_SFT 7
684
685/* Output Right Mixer Control 3 (0x52) */
686#define RT5640_M_SM_L_OM_R (0x1 << 8)
687#define RT5640_M_SM_L_OM_R_SFT 8
688#define RT5640_M_BST4_OM_R (0x1 << 7)
689#define RT5640_M_BST4_OM_R_SFT 7
690#define RT5640_M_BST2_OM_R (0x1 << 6)
691#define RT5640_M_BST2_OM_R_SFT 6
692#define RT5640_M_BST1_OM_R (0x1 << 5)
693#define RT5640_M_BST1_OM_R_SFT 5
694#define RT5640_M_IN_R_OM_R (0x1 << 4)
695#define RT5640_M_IN_R_OM_R_SFT 4
696#define RT5640_M_RM_R_OM_R (0x1 << 3)
697#define RT5640_M_RM_R_OM_R_SFT 3
698#define RT5640_M_DAC_L2_OM_R (0x1 << 2)
699#define RT5640_M_DAC_L2_OM_R_SFT 2
700#define RT5640_M_DAC_R2_OM_R (0x1 << 1)
701#define RT5640_M_DAC_R2_OM_R_SFT 1
702#define RT5640_M_DAC_R1_OM_R (0x1)
703#define RT5640_M_DAC_R1_OM_R_SFT 0
704
705/* LOUT Mixer Control (0x53) */
706#define RT5640_M_DAC_L1_LM (0x1 << 15)
707#define RT5640_M_DAC_L1_LM_SFT 15
708#define RT5640_M_DAC_R1_LM (0x1 << 14)
709#define RT5640_M_DAC_R1_LM_SFT 14
710#define RT5640_M_OV_L_LM (0x1 << 13)
711#define RT5640_M_OV_L_LM_SFT 13
712#define RT5640_M_OV_R_LM (0x1 << 12)
713#define RT5640_M_OV_R_LM_SFT 12
714#define RT5640_G_LOUTMIX_MASK (0x1 << 11)
715#define RT5640_G_LOUTMIX_SFT 11
716
717/* Power Management for Digital 1 (0x61) */
718#define RT5640_PWR_I2S1 (0x1 << 15)
719#define RT5640_PWR_I2S1_BIT 15
720#define RT5640_PWR_I2S2 (0x1 << 14)
721#define RT5640_PWR_I2S2_BIT 14
722#define RT5640_PWR_I2S3 (0x1 << 13)
723#define RT5640_PWR_I2S3_BIT 13
724#define RT5640_PWR_DAC_L1 (0x1 << 12)
725#define RT5640_PWR_DAC_L1_BIT 12
726#define RT5640_PWR_DAC_R1 (0x1 << 11)
727#define RT5640_PWR_DAC_R1_BIT 11
728#define RT5640_PWR_DAC_L2 (0x1 << 7)
729#define RT5640_PWR_DAC_L2_BIT 7
730#define RT5640_PWR_DAC_R2 (0x1 << 6)
731#define RT5640_PWR_DAC_R2_BIT 6
732#define RT5640_PWR_ADC_L (0x1 << 2)
733#define RT5640_PWR_ADC_L_BIT 2
734#define RT5640_PWR_ADC_R (0x1 << 1)
735#define RT5640_PWR_ADC_R_BIT 1
736#define RT5640_PWR_CLS_D (0x1)
737#define RT5640_PWR_CLS_D_BIT 0
738
739/* Power Management for Digital 2 (0x62) */
740#define RT5640_PWR_ADC_SF (0x1 << 15)
741#define RT5640_PWR_ADC_SF_BIT 15
742#define RT5640_PWR_ADC_MF_L (0x1 << 14)
743#define RT5640_PWR_ADC_MF_L_BIT 14
744#define RT5640_PWR_ADC_MF_R (0x1 << 13)
745#define RT5640_PWR_ADC_MF_R_BIT 13
746#define RT5640_PWR_I2S_DSP (0x1 << 12)
747#define RT5640_PWR_I2S_DSP_BIT 12
748
749/* Power Management for Analog 1 (0x63) */
750#define RT5640_PWR_VREF1 (0x1 << 15)
751#define RT5640_PWR_VREF1_BIT 15
752#define RT5640_PWR_FV1 (0x1 << 14)
753#define RT5640_PWR_FV1_BIT 14
754#define RT5640_PWR_MB (0x1 << 13)
755#define RT5640_PWR_MB_BIT 13
756#define RT5640_PWR_LM (0x1 << 12)
757#define RT5640_PWR_LM_BIT 12
758#define RT5640_PWR_BG (0x1 << 11)
759#define RT5640_PWR_BG_BIT 11
760#define RT5640_PWR_MM (0x1 << 10)
761#define RT5640_PWR_MM_BIT 10
762#define RT5640_PWR_MA (0x1 << 8)
763#define RT5640_PWR_MA_BIT 8
764#define RT5640_PWR_HP_L (0x1 << 7)
765#define RT5640_PWR_HP_L_BIT 7
766#define RT5640_PWR_HP_R (0x1 << 6)
767#define RT5640_PWR_HP_R_BIT 6
768#define RT5640_PWR_HA (0x1 << 5)
769#define RT5640_PWR_HA_BIT 5
770#define RT5640_PWR_VREF2 (0x1 << 4)
771#define RT5640_PWR_VREF2_BIT 4
772#define RT5640_PWR_FV2 (0x1 << 3)
773#define RT5640_PWR_FV2_BIT 3
774#define RT5640_PWR_LDO2 (0x1 << 2)
775#define RT5640_PWR_LDO2_BIT 2
776
777/* Power Management for Analog 2 (0x64) */
778#define RT5640_PWR_BST1 (0x1 << 15)
779#define RT5640_PWR_BST1_BIT 15
780#define RT5640_PWR_BST2 (0x1 << 14)
781#define RT5640_PWR_BST2_BIT 14
782#define RT5640_PWR_BST3 (0x1 << 13)
783#define RT5640_PWR_BST3_BIT 13
784#define RT5640_PWR_BST4 (0x1 << 12)
785#define RT5640_PWR_BST4_BIT 12
786#define RT5640_PWR_MB1 (0x1 << 11)
787#define RT5640_PWR_MB1_BIT 11
788#define RT5640_PWR_MB2 (0x1 << 10)
789#define RT5640_PWR_MB2_BIT 10
790#define RT5640_PWR_PLL (0x1 << 9)
791#define RT5640_PWR_PLL_BIT 9
792
793/* Power Management for Mixer (0x65) */
794#define RT5640_PWR_OM_L (0x1 << 15)
795#define RT5640_PWR_OM_L_BIT 15
796#define RT5640_PWR_OM_R (0x1 << 14)
797#define RT5640_PWR_OM_R_BIT 14
798#define RT5640_PWR_SM_L (0x1 << 13)
799#define RT5640_PWR_SM_L_BIT 13
800#define RT5640_PWR_SM_R (0x1 << 12)
801#define RT5640_PWR_SM_R_BIT 12
802#define RT5640_PWR_RM_L (0x1 << 11)
803#define RT5640_PWR_RM_L_BIT 11
804#define RT5640_PWR_RM_R (0x1 << 10)
805#define RT5640_PWR_RM_R_BIT 10
806
807/* Power Management for Volume (0x66) */
808#define RT5640_PWR_SV_L (0x1 << 15)
809#define RT5640_PWR_SV_L_BIT 15
810#define RT5640_PWR_SV_R (0x1 << 14)
811#define RT5640_PWR_SV_R_BIT 14
812#define RT5640_PWR_OV_L (0x1 << 13)
813#define RT5640_PWR_OV_L_BIT 13
814#define RT5640_PWR_OV_R (0x1 << 12)
815#define RT5640_PWR_OV_R_BIT 12
816#define RT5640_PWR_HV_L (0x1 << 11)
817#define RT5640_PWR_HV_L_BIT 11
818#define RT5640_PWR_HV_R (0x1 << 10)
819#define RT5640_PWR_HV_R_BIT 10
820#define RT5640_PWR_IN_L (0x1 << 9)
821#define RT5640_PWR_IN_L_BIT 9
822#define RT5640_PWR_IN_R (0x1 << 8)
823#define RT5640_PWR_IN_R_BIT 8
824
825/* I2S1/2/3 Audio Serial Data Port Control (0x70 0x71 0x72) */
826#define RT5640_I2S_MS_MASK (0x1 << 15)
827#define RT5640_I2S_MS_SFT 15
828#define RT5640_I2S_MS_M (0x0 << 15)
829#define RT5640_I2S_MS_S (0x1 << 15)
830#define RT5640_I2S_IF_MASK (0x7 << 12)
831#define RT5640_I2S_IF_SFT 12
832#define RT5640_I2S_O_CP_MASK (0x3 << 10)
833#define RT5640_I2S_O_CP_SFT 10
834#define RT5640_I2S_O_CP_OFF (0x0 << 10)
835#define RT5640_I2S_O_CP_U_LAW (0x1 << 10)
836#define RT5640_I2S_O_CP_A_LAW (0x2 << 10)
837#define RT5640_I2S_I_CP_MASK (0x3 << 8)
838#define RT5640_I2S_I_CP_SFT 8
839#define RT5640_I2S_I_CP_OFF (0x0 << 8)
840#define RT5640_I2S_I_CP_U_LAW (0x1 << 8)
841#define RT5640_I2S_I_CP_A_LAW (0x2 << 8)
842#define RT5640_I2S_BP_MASK (0x1 << 7)
843#define RT5640_I2S_BP_SFT 7
844#define RT5640_I2S_BP_NOR (0x0 << 7)
845#define RT5640_I2S_BP_INV (0x1 << 7)
846#define RT5640_I2S_DL_MASK (0x3 << 2)
847#define RT5640_I2S_DL_SFT 2
848#define RT5640_I2S_DL_16 (0x0 << 2)
849#define RT5640_I2S_DL_20 (0x1 << 2)
850#define RT5640_I2S_DL_24 (0x2 << 2)
851#define RT5640_I2S_DL_8 (0x3 << 2)
852#define RT5640_I2S_DF_MASK (0x3)
853#define RT5640_I2S_DF_SFT 0
854#define RT5640_I2S_DF_I2S (0x0)
855#define RT5640_I2S_DF_LEFT (0x1)
856#define RT5640_I2S_DF_PCM_A (0x2)
857#define RT5640_I2S_DF_PCM_B (0x3)
858
859/* I2S2 Audio Serial Data Port Control (0x71) */
860#define RT5640_I2S2_SDI_MASK (0x1 << 6)
861#define RT5640_I2S2_SDI_SFT 6
862#define RT5640_I2S2_SDI_I2S1 (0x0 << 6)
863#define RT5640_I2S2_SDI_I2S2 (0x1 << 6)
864
865/* ADC/DAC Clock Control 1 (0x73) */
866#define RT5640_I2S_BCLK_MS1_MASK (0x1 << 15)
867#define RT5640_I2S_BCLK_MS1_SFT 15
868#define RT5640_I2S_BCLK_MS1_32 (0x0 << 15)
869#define RT5640_I2S_BCLK_MS1_64 (0x1 << 15)
870#define RT5640_I2S_PD1_MASK (0x7 << 12)
871#define RT5640_I2S_PD1_SFT 12
872#define RT5640_I2S_PD1_1 (0x0 << 12)
873#define RT5640_I2S_PD1_2 (0x1 << 12)
874#define RT5640_I2S_PD1_3 (0x2 << 12)
875#define RT5640_I2S_PD1_4 (0x3 << 12)
876#define RT5640_I2S_PD1_6 (0x4 << 12)
877#define RT5640_I2S_PD1_8 (0x5 << 12)
878#define RT5640_I2S_PD1_12 (0x6 << 12)
879#define RT5640_I2S_PD1_16 (0x7 << 12)
880#define RT5640_I2S_BCLK_MS2_MASK (0x1 << 11)
881#define RT5640_I2S_BCLK_MS2_SFT 11
882#define RT5640_I2S_BCLK_MS2_32 (0x0 << 11)
883#define RT5640_I2S_BCLK_MS2_64 (0x1 << 11)
884#define RT5640_I2S_PD2_MASK (0x7 << 8)
885#define RT5640_I2S_PD2_SFT 8
886#define RT5640_I2S_PD2_1 (0x0 << 8)
887#define RT5640_I2S_PD2_2 (0x1 << 8)
888#define RT5640_I2S_PD2_3 (0x2 << 8)
889#define RT5640_I2S_PD2_4 (0x3 << 8)
890#define RT5640_I2S_PD2_6 (0x4 << 8)
891#define RT5640_I2S_PD2_8 (0x5 << 8)
892#define RT5640_I2S_PD2_12 (0x6 << 8)
893#define RT5640_I2S_PD2_16 (0x7 << 8)
894#define RT5640_I2S_BCLK_MS3_MASK (0x1 << 7)
895#define RT5640_I2S_BCLK_MS3_SFT 7
896#define RT5640_I2S_BCLK_MS3_32 (0x0 << 7)
897#define RT5640_I2S_BCLK_MS3_64 (0x1 << 7)
898#define RT5640_I2S_PD3_MASK (0x7 << 4)
899#define RT5640_I2S_PD3_SFT 4
900#define RT5640_I2S_PD3_1 (0x0 << 4)
901#define RT5640_I2S_PD3_2 (0x1 << 4)
902#define RT5640_I2S_PD3_3 (0x2 << 4)
903#define RT5640_I2S_PD3_4 (0x3 << 4)
904#define RT5640_I2S_PD3_6 (0x4 << 4)
905#define RT5640_I2S_PD3_8 (0x5 << 4)
906#define RT5640_I2S_PD3_12 (0x6 << 4)
907#define RT5640_I2S_PD3_16 (0x7 << 4)
908#define RT5640_DAC_OSR_MASK (0x3 << 2)
909#define RT5640_DAC_OSR_SFT 2
910#define RT5640_DAC_OSR_128 (0x0 << 2)
911#define RT5640_DAC_OSR_64 (0x1 << 2)
912#define RT5640_DAC_OSR_32 (0x2 << 2)
913#define RT5640_DAC_OSR_16 (0x3 << 2)
914#define RT5640_ADC_OSR_MASK (0x3)
915#define RT5640_ADC_OSR_SFT 0
916#define RT5640_ADC_OSR_128 (0x0)
917#define RT5640_ADC_OSR_64 (0x1)
918#define RT5640_ADC_OSR_32 (0x2)
919#define RT5640_ADC_OSR_16 (0x3)
920
921/* ADC/DAC Clock Control 2 (0x74) */
922#define RT5640_DAC_L_OSR_MASK (0x3 << 14)
923#define RT5640_DAC_L_OSR_SFT 14
924#define RT5640_DAC_L_OSR_128 (0x0 << 14)
925#define RT5640_DAC_L_OSR_64 (0x1 << 14)
926#define RT5640_DAC_L_OSR_32 (0x2 << 14)
927#define RT5640_DAC_L_OSR_16 (0x3 << 14)
928#define RT5640_ADC_R_OSR_MASK (0x3 << 12)
929#define RT5640_ADC_R_OSR_SFT 12
930#define RT5640_ADC_R_OSR_128 (0x0 << 12)
931#define RT5640_ADC_R_OSR_64 (0x1 << 12)
932#define RT5640_ADC_R_OSR_32 (0x2 << 12)
933#define RT5640_ADC_R_OSR_16 (0x3 << 12)
934#define RT5640_DAHPF_EN (0x1 << 11)
935#define RT5640_DAHPF_EN_SFT 11
936#define RT5640_ADHPF_EN (0x1 << 10)
937#define RT5640_ADHPF_EN_SFT 10
938
939/* Digital Microphone Control (0x75) */
940#define RT5640_DMIC_1_EN_MASK (0x1 << 15)
941#define RT5640_DMIC_1_EN_SFT 15
942#define RT5640_DMIC_1_DIS (0x0 << 15)
943#define RT5640_DMIC_1_EN (0x1 << 15)
944#define RT5640_DMIC_2_EN_MASK (0x1 << 14)
945#define RT5640_DMIC_2_EN_SFT 14
946#define RT5640_DMIC_2_DIS (0x0 << 14)
947#define RT5640_DMIC_2_EN (0x1 << 14)
948#define RT5640_DMIC_1L_LH_MASK (0x1 << 13)
949#define RT5640_DMIC_1L_LH_SFT 13
950#define RT5640_DMIC_1L_LH_FALLING (0x0 << 13)
951#define RT5640_DMIC_1L_LH_RISING (0x1 << 13)
952#define RT5640_DMIC_1R_LH_MASK (0x1 << 12)
953#define RT5640_DMIC_1R_LH_SFT 12
954#define RT5640_DMIC_1R_LH_FALLING (0x0 << 12)
955#define RT5640_DMIC_1R_LH_RISING (0x1 << 12)
956#define RT5640_DMIC_1_DP_MASK (0x1 << 11)
957#define RT5640_DMIC_1_DP_SFT 11
958#define RT5640_DMIC_1_DP_GPIO3 (0x0 << 11)
959#define RT5640_DMIC_1_DP_IN1P (0x1 << 11)
960#define RT5640_DMIC_2_DP_MASK (0x1 << 10)
961#define RT5640_DMIC_2_DP_SFT 10
962#define RT5640_DMIC_2_DP_GPIO4 (0x0 << 10)
963#define RT5640_DMIC_2_DP_IN1N (0x1 << 10)
964#define RT5640_DMIC_2L_LH_MASK (0x1 << 9)
965#define RT5640_DMIC_2L_LH_SFT 9
966#define RT5640_DMIC_2L_LH_FALLING (0x0 << 9)
967#define RT5640_DMIC_2L_LH_RISING (0x1 << 9)
968#define RT5640_DMIC_2R_LH_MASK (0x1 << 8)
969#define RT5640_DMIC_2R_LH_SFT 8
970#define RT5640_DMIC_2R_LH_FALLING (0x0 << 8)
971#define RT5640_DMIC_2R_LH_RISING (0x1 << 8)
972#define RT5640_DMIC_CLK_MASK (0x7 << 5)
973#define RT5640_DMIC_CLK_SFT 5
974
975/* Global Clock Control (0x80) */
976#define RT5640_SCLK_SRC_MASK (0x3 << 14)
977#define RT5640_SCLK_SRC_SFT 14
978#define RT5640_SCLK_SRC_MCLK (0x0 << 14)
979#define RT5640_SCLK_SRC_PLL1 (0x1 << 14)
980#define RT5640_SCLK_SRC_PLL1T (0x2 << 14)
981#define RT5640_SCLK_SRC_RCCLK (0x3 << 14) /* 15MHz */
982#define RT5640_PLL1_SRC_MASK (0x3 << 12)
983#define RT5640_PLL1_SRC_SFT 12
984#define RT5640_PLL1_SRC_MCLK (0x0 << 12)
985#define RT5640_PLL1_SRC_BCLK1 (0x1 << 12)
986#define RT5640_PLL1_SRC_BCLK2 (0x2 << 12)
987#define RT5640_PLL1_SRC_BCLK3 (0x3 << 12)
988#define RT5640_PLL1_PD_MASK (0x1 << 3)
989#define RT5640_PLL1_PD_SFT 3
990#define RT5640_PLL1_PD_1 (0x0 << 3)
991#define RT5640_PLL1_PD_2 (0x1 << 3)
992
993#define RT5640_PLL_INP_MAX 40000000
994#define RT5640_PLL_INP_MIN 256000
995/* PLL M/N/K Code Control 1 (0x81) */
996#define RT5640_PLL_N_MAX 0x1ff
997#define RT5640_PLL_N_MASK (RT5640_PLL_N_MAX << 7)
998#define RT5640_PLL_N_SFT 7
999#define RT5640_PLL_K_MAX 0x1f
1000#define RT5640_PLL_K_MASK (RT5640_PLL_K_MAX)
1001#define RT5640_PLL_K_SFT 0
1002
1003/* PLL M/N/K Code Control 2 (0x82) */
1004#define RT5640_PLL_M_MAX 0xf
1005#define RT5640_PLL_M_MASK (RT5640_PLL_M_MAX << 12)
1006#define RT5640_PLL_M_SFT 12
1007#define RT5640_PLL_M_BP (0x1 << 11)
1008#define RT5640_PLL_M_BP_SFT 11
1009
1010/* ASRC Control 1 (0x83) */
1011#define RT5640_STO_T_MASK (0x1 << 15)
1012#define RT5640_STO_T_SFT 15
1013#define RT5640_STO_T_SCLK (0x0 << 15)
1014#define RT5640_STO_T_LRCK1 (0x1 << 15)
1015#define RT5640_M1_T_MASK (0x1 << 14)
1016#define RT5640_M1_T_SFT 14
1017#define RT5640_M1_T_I2S2 (0x0 << 14)
1018#define RT5640_M1_T_I2S2_D3 (0x1 << 14)
1019#define RT5640_I2S2_F_MASK (0x1 << 12)
1020#define RT5640_I2S2_F_SFT 12
1021#define RT5640_I2S2_F_I2S2_D2 (0x0 << 12)
1022#define RT5640_I2S2_F_I2S1_TCLK (0x1 << 12)
1023#define RT5640_DMIC_1_M_MASK (0x1 << 9)
1024#define RT5640_DMIC_1_M_SFT 9
1025#define RT5640_DMIC_1_M_NOR (0x0 << 9)
1026#define RT5640_DMIC_1_M_ASYN (0x1 << 9)
1027#define RT5640_DMIC_2_M_MASK (0x1 << 8)
1028#define RT5640_DMIC_2_M_SFT 8
1029#define RT5640_DMIC_2_M_NOR (0x0 << 8)
1030#define RT5640_DMIC_2_M_ASYN (0x1 << 8)
1031
1032/* ASRC Control 2 (0x84) */
1033#define RT5640_MDA_L_M_MASK (0x1 << 15)
1034#define RT5640_MDA_L_M_SFT 15
1035#define RT5640_MDA_L_M_NOR (0x0 << 15)
1036#define RT5640_MDA_L_M_ASYN (0x1 << 15)
1037#define RT5640_MDA_R_M_MASK (0x1 << 14)
1038#define RT5640_MDA_R_M_SFT 14
1039#define RT5640_MDA_R_M_NOR (0x0 << 14)
1040#define RT5640_MDA_R_M_ASYN (0x1 << 14)
1041#define RT5640_MAD_L_M_MASK (0x1 << 13)
1042#define RT5640_MAD_L_M_SFT 13
1043#define RT5640_MAD_L_M_NOR (0x0 << 13)
1044#define RT5640_MAD_L_M_ASYN (0x1 << 13)
1045#define RT5640_MAD_R_M_MASK (0x1 << 12)
1046#define RT5640_MAD_R_M_SFT 12
1047#define RT5640_MAD_R_M_NOR (0x0 << 12)
1048#define RT5640_MAD_R_M_ASYN (0x1 << 12)
1049#define RT5640_ADC_M_MASK (0x1 << 11)
1050#define RT5640_ADC_M_SFT 11
1051#define RT5640_ADC_M_NOR (0x0 << 11)
1052#define RT5640_ADC_M_ASYN (0x1 << 11)
1053#define RT5640_STO_DAC_M_MASK (0x1 << 5)
1054#define RT5640_STO_DAC_M_SFT 5
1055#define RT5640_STO_DAC_M_NOR (0x0 << 5)
1056#define RT5640_STO_DAC_M_ASYN (0x1 << 5)
1057#define RT5640_I2S1_R_D_MASK (0x1 << 4)
1058#define RT5640_I2S1_R_D_SFT 4
1059#define RT5640_I2S1_R_D_DIS (0x0 << 4)
1060#define RT5640_I2S1_R_D_EN (0x1 << 4)
1061#define RT5640_I2S2_R_D_MASK (0x1 << 3)
1062#define RT5640_I2S2_R_D_SFT 3
1063#define RT5640_I2S2_R_D_DIS (0x0 << 3)
1064#define RT5640_I2S2_R_D_EN (0x1 << 3)
1065#define RT5640_PRE_SCLK_MASK (0x3)
1066#define RT5640_PRE_SCLK_SFT 0
1067#define RT5640_PRE_SCLK_512 (0x0)
1068#define RT5640_PRE_SCLK_1024 (0x1)
1069#define RT5640_PRE_SCLK_2048 (0x2)
1070
1071/* ASRC Control 3 (0x85) */
1072#define RT5640_I2S1_RATE_MASK (0xf << 12)
1073#define RT5640_I2S1_RATE_SFT 12
1074#define RT5640_I2S2_RATE_MASK (0xf << 8)
1075#define RT5640_I2S2_RATE_SFT 8
1076
1077/* ASRC Control 4 (0x89) */
1078#define RT5640_I2S1_PD_MASK (0x7 << 12)
1079#define RT5640_I2S1_PD_SFT 12
1080#define RT5640_I2S2_PD_MASK (0x7 << 8)
1081#define RT5640_I2S2_PD_SFT 8
1082
1083/* HPOUT Over Current Detection (0x8b) */
1084#define RT5640_HP_OVCD_MASK (0x1 << 10)
1085#define RT5640_HP_OVCD_SFT 10
1086#define RT5640_HP_OVCD_DIS (0x0 << 10)
1087#define RT5640_HP_OVCD_EN (0x1 << 10)
1088#define RT5640_HP_OC_TH_MASK (0x3 << 8)
1089#define RT5640_HP_OC_TH_SFT 8
1090#define RT5640_HP_OC_TH_90 (0x0 << 8)
1091#define RT5640_HP_OC_TH_105 (0x1 << 8)
1092#define RT5640_HP_OC_TH_120 (0x2 << 8)
1093#define RT5640_HP_OC_TH_135 (0x3 << 8)
1094
1095/* Class D Over Current Control (0x8c) */
1096#define RT5640_CLSD_OC_MASK (0x1 << 9)
1097#define RT5640_CLSD_OC_SFT 9
1098#define RT5640_CLSD_OC_PU (0x0 << 9)
1099#define RT5640_CLSD_OC_PD (0x1 << 9)
1100#define RT5640_AUTO_PD_MASK (0x1 << 8)
1101#define RT5640_AUTO_PD_SFT 8
1102#define RT5640_AUTO_PD_DIS (0x0 << 8)
1103#define RT5640_AUTO_PD_EN (0x1 << 8)
1104#define RT5640_CLSD_OC_TH_MASK (0x3f)
1105#define RT5640_CLSD_OC_TH_SFT 0
1106
1107/* Class D Output Control (0x8d) */
1108#define RT5640_CLSD_RATIO_MASK (0xf << 12)
1109#define RT5640_CLSD_RATIO_SFT 12
1110#define RT5640_CLSD_OM_MASK (0x1 << 11)
1111#define RT5640_CLSD_OM_SFT 11
1112#define RT5640_CLSD_OM_MONO (0x0 << 11)
1113#define RT5640_CLSD_OM_STO (0x1 << 11)
1114#define RT5640_CLSD_SCH_MASK (0x1 << 10)
1115#define RT5640_CLSD_SCH_SFT 10
1116#define RT5640_CLSD_SCH_L (0x0 << 10)
1117#define RT5640_CLSD_SCH_S (0x1 << 10)
1118
1119/* Depop Mode Control 1 (0x8e) */
1120#define RT5640_SMT_TRIG_MASK (0x1 << 15)
1121#define RT5640_SMT_TRIG_SFT 15
1122#define RT5640_SMT_TRIG_DIS (0x0 << 15)
1123#define RT5640_SMT_TRIG_EN (0x1 << 15)
1124#define RT5640_HP_L_SMT_MASK (0x1 << 9)
1125#define RT5640_HP_L_SMT_SFT 9
1126#define RT5640_HP_L_SMT_DIS (0x0 << 9)
1127#define RT5640_HP_L_SMT_EN (0x1 << 9)
1128#define RT5640_HP_R_SMT_MASK (0x1 << 8)
1129#define RT5640_HP_R_SMT_SFT 8
1130#define RT5640_HP_R_SMT_DIS (0x0 << 8)
1131#define RT5640_HP_R_SMT_EN (0x1 << 8)
1132#define RT5640_HP_CD_PD_MASK (0x1 << 7)
1133#define RT5640_HP_CD_PD_SFT 7
1134#define RT5640_HP_CD_PD_DIS (0x0 << 7)
1135#define RT5640_HP_CD_PD_EN (0x1 << 7)
1136#define RT5640_RSTN_MASK (0x1 << 6)
1137#define RT5640_RSTN_SFT 6
1138#define RT5640_RSTN_DIS (0x0 << 6)
1139#define RT5640_RSTN_EN (0x1 << 6)
1140#define RT5640_RSTP_MASK (0x1 << 5)
1141#define RT5640_RSTP_SFT 5
1142#define RT5640_RSTP_DIS (0x0 << 5)
1143#define RT5640_RSTP_EN (0x1 << 5)
1144#define RT5640_HP_CO_MASK (0x1 << 4)
1145#define RT5640_HP_CO_SFT 4
1146#define RT5640_HP_CO_DIS (0x0 << 4)
1147#define RT5640_HP_CO_EN (0x1 << 4)
1148#define RT5640_HP_CP_MASK (0x1 << 3)
1149#define RT5640_HP_CP_SFT 3
1150#define RT5640_HP_CP_PD (0x0 << 3)
1151#define RT5640_HP_CP_PU (0x1 << 3)
1152#define RT5640_HP_SG_MASK (0x1 << 2)
1153#define RT5640_HP_SG_SFT 2
1154#define RT5640_HP_SG_DIS (0x0 << 2)
1155#define RT5640_HP_SG_EN (0x1 << 2)
1156#define RT5640_HP_DP_MASK (0x1 << 1)
1157#define RT5640_HP_DP_SFT 1
1158#define RT5640_HP_DP_PD (0x0 << 1)
1159#define RT5640_HP_DP_PU (0x1 << 1)
1160#define RT5640_HP_CB_MASK (0x1)
1161#define RT5640_HP_CB_SFT 0
1162#define RT5640_HP_CB_PD (0x0)
1163#define RT5640_HP_CB_PU (0x1)
1164
1165/* Depop Mode Control 2 (0x8f) */
1166#define RT5640_DEPOP_MASK (0x1 << 13)
1167#define RT5640_DEPOP_SFT 13
1168#define RT5640_DEPOP_AUTO (0x0 << 13)
1169#define RT5640_DEPOP_MAN (0x1 << 13)
1170#define RT5640_RAMP_MASK (0x1 << 12)
1171#define RT5640_RAMP_SFT 12
1172#define RT5640_RAMP_DIS (0x0 << 12)
1173#define RT5640_RAMP_EN (0x1 << 12)
1174#define RT5640_BPS_MASK (0x1 << 11)
1175#define RT5640_BPS_SFT 11
1176#define RT5640_BPS_DIS (0x0 << 11)
1177#define RT5640_BPS_EN (0x1 << 11)
1178#define RT5640_FAST_UPDN_MASK (0x1 << 10)
1179#define RT5640_FAST_UPDN_SFT 10
1180#define RT5640_FAST_UPDN_DIS (0x0 << 10)
1181#define RT5640_FAST_UPDN_EN (0x1 << 10)
1182#define RT5640_MRES_MASK (0x3 << 8)
1183#define RT5640_MRES_SFT 8
1184#define RT5640_MRES_15MO (0x0 << 8)
1185#define RT5640_MRES_25MO (0x1 << 8)
1186#define RT5640_MRES_35MO (0x2 << 8)
1187#define RT5640_MRES_45MO (0x3 << 8)
1188#define RT5640_VLO_MASK (0x1 << 7)
1189#define RT5640_VLO_SFT 7
1190#define RT5640_VLO_3V (0x0 << 7)
1191#define RT5640_VLO_32V (0x1 << 7)
1192#define RT5640_DIG_DP_MASK (0x1 << 6)
1193#define RT5640_DIG_DP_SFT 6
1194#define RT5640_DIG_DP_DIS (0x0 << 6)
1195#define RT5640_DIG_DP_EN (0x1 << 6)
1196#define RT5640_DP_TH_MASK (0x3 << 4)
1197#define RT5640_DP_TH_SFT 4
1198
1199/* Depop Mode Control 3 (0x90) */
1200#define RT5640_CP_SYS_MASK (0x7 << 12)
1201#define RT5640_CP_SYS_SFT 12
1202#define RT5640_CP_FQ1_MASK (0x7 << 8)
1203#define RT5640_CP_FQ1_SFT 8
1204#define RT5640_CP_FQ2_MASK (0x7 << 4)
1205#define RT5640_CP_FQ2_SFT 4
1206#define RT5640_CP_FQ3_MASK (0x7)
1207#define RT5640_CP_FQ3_SFT 0
1208
1209/* HPOUT charge pump (0x91) */
1210#define RT5640_OSW_L_MASK (0x1 << 11)
1211#define RT5640_OSW_L_SFT 11
1212#define RT5640_OSW_L_DIS (0x0 << 11)
1213#define RT5640_OSW_L_EN (0x1 << 11)
1214#define RT5640_OSW_R_MASK (0x1 << 10)
1215#define RT5640_OSW_R_SFT 10
1216#define RT5640_OSW_R_DIS (0x0 << 10)
1217#define RT5640_OSW_R_EN (0x1 << 10)
1218#define RT5640_PM_HP_MASK (0x3 << 8)
1219#define RT5640_PM_HP_SFT 8
1220#define RT5640_PM_HP_LV (0x0 << 8)
1221#define RT5640_PM_HP_MV (0x1 << 8)
1222#define RT5640_PM_HP_HV (0x2 << 8)
1223#define RT5640_IB_HP_MASK (0x3 << 6)
1224#define RT5640_IB_HP_SFT 6
1225#define RT5640_IB_HP_125IL (0x0 << 6)
1226#define RT5640_IB_HP_25IL (0x1 << 6)
1227#define RT5640_IB_HP_5IL (0x2 << 6)
1228#define RT5640_IB_HP_1IL (0x3 << 6)
1229
1230/* PV detection and SPK gain control (0x92) */
1231#define RT5640_PVDD_DET_MASK (0x1 << 15)
1232#define RT5640_PVDD_DET_SFT 15
1233#define RT5640_PVDD_DET_DIS (0x0 << 15)
1234#define RT5640_PVDD_DET_EN (0x1 << 15)
1235#define RT5640_SPK_AG_MASK (0x1 << 14)
1236#define RT5640_SPK_AG_SFT 14
1237#define RT5640_SPK_AG_DIS (0x0 << 14)
1238#define RT5640_SPK_AG_EN (0x1 << 14)
1239
1240/* Micbias Control (0x93) */
1241#define RT5640_MIC1_BS_MASK (0x1 << 15)
1242#define RT5640_MIC1_BS_SFT 15
1243#define RT5640_MIC1_BS_9AV (0x0 << 15)
1244#define RT5640_MIC1_BS_75AV (0x1 << 15)
1245#define RT5640_MIC2_BS_MASK (0x1 << 14)
1246#define RT5640_MIC2_BS_SFT 14
1247#define RT5640_MIC2_BS_9AV (0x0 << 14)
1248#define RT5640_MIC2_BS_75AV (0x1 << 14)
1249#define RT5640_MIC1_CLK_MASK (0x1 << 13)
1250#define RT5640_MIC1_CLK_SFT 13
1251#define RT5640_MIC1_CLK_DIS (0x0 << 13)
1252#define RT5640_MIC1_CLK_EN (0x1 << 13)
1253#define RT5640_MIC2_CLK_MASK (0x1 << 12)
1254#define RT5640_MIC2_CLK_SFT 12
1255#define RT5640_MIC2_CLK_DIS (0x0 << 12)
1256#define RT5640_MIC2_CLK_EN (0x1 << 12)
1257#define RT5640_MIC1_OVCD_MASK (0x1 << 11)
1258#define RT5640_MIC1_OVCD_SFT 11
1259#define RT5640_MIC1_OVCD_DIS (0x0 << 11)
1260#define RT5640_MIC1_OVCD_EN (0x1 << 11)
1261#define RT5640_MIC1_OVTH_MASK (0x3 << 9)
1262#define RT5640_MIC1_OVTH_SFT 9
1263#define RT5640_MIC1_OVTH_600UA (0x0 << 9)
1264#define RT5640_MIC1_OVTH_1500UA (0x1 << 9)
1265#define RT5640_MIC1_OVTH_2000UA (0x2 << 9)
1266#define RT5640_MIC2_OVCD_MASK (0x1 << 8)
1267#define RT5640_MIC2_OVCD_SFT 8
1268#define RT5640_MIC2_OVCD_DIS (0x0 << 8)
1269#define RT5640_MIC2_OVCD_EN (0x1 << 8)
1270#define RT5640_MIC2_OVTH_MASK (0x3 << 6)
1271#define RT5640_MIC2_OVTH_SFT 6
1272#define RT5640_MIC2_OVTH_600UA (0x0 << 6)
1273#define RT5640_MIC2_OVTH_1500UA (0x1 << 6)
1274#define RT5640_MIC2_OVTH_2000UA (0x2 << 6)
1275#define RT5640_PWR_MB_MASK (0x1 << 5)
1276#define RT5640_PWR_MB_SFT 5
1277#define RT5640_PWR_MB_PD (0x0 << 5)
1278#define RT5640_PWR_MB_PU (0x1 << 5)
1279#define RT5640_PWR_CLK25M_MASK (0x1 << 4)
1280#define RT5640_PWR_CLK25M_SFT 4
1281#define RT5640_PWR_CLK25M_PD (0x0 << 4)
1282#define RT5640_PWR_CLK25M_PU (0x1 << 4)
1283
1284/* EQ Control 1 (0xb0) */
1285#define RT5640_EQ_SRC_MASK (0x1 << 15)
1286#define RT5640_EQ_SRC_SFT 15
1287#define RT5640_EQ_SRC_DAC (0x0 << 15)
1288#define RT5640_EQ_SRC_ADC (0x1 << 15)
1289#define RT5640_EQ_UPD (0x1 << 14)
1290#define RT5640_EQ_UPD_BIT 14
1291#define RT5640_EQ_CD_MASK (0x1 << 13)
1292#define RT5640_EQ_CD_SFT 13
1293#define RT5640_EQ_CD_DIS (0x0 << 13)
1294#define RT5640_EQ_CD_EN (0x1 << 13)
1295#define RT5640_EQ_DITH_MASK (0x3 << 8)
1296#define RT5640_EQ_DITH_SFT 8
1297#define RT5640_EQ_DITH_NOR (0x0 << 8)
1298#define RT5640_EQ_DITH_LSB (0x1 << 8)
1299#define RT5640_EQ_DITH_LSB_1 (0x2 << 8)
1300#define RT5640_EQ_DITH_LSB_2 (0x3 << 8)
1301
1302/* EQ Control 2 (0xb1) */
1303#define RT5640_EQ_HPF1_M_MASK (0x1 << 8)
1304#define RT5640_EQ_HPF1_M_SFT 8
1305#define RT5640_EQ_HPF1_M_HI (0x0 << 8)
1306#define RT5640_EQ_HPF1_M_1ST (0x1 << 8)
1307#define RT5640_EQ_LPF1_M_MASK (0x1 << 7)
1308#define RT5640_EQ_LPF1_M_SFT 7
1309#define RT5640_EQ_LPF1_M_LO (0x0 << 7)
1310#define RT5640_EQ_LPF1_M_1ST (0x1 << 7)
1311#define RT5640_EQ_HPF2_MASK (0x1 << 6)
1312#define RT5640_EQ_HPF2_SFT 6
1313#define RT5640_EQ_HPF2_DIS (0x0 << 6)
1314#define RT5640_EQ_HPF2_EN (0x1 << 6)
1315#define RT5640_EQ_HPF1_MASK (0x1 << 5)
1316#define RT5640_EQ_HPF1_SFT 5
1317#define RT5640_EQ_HPF1_DIS (0x0 << 5)
1318#define RT5640_EQ_HPF1_EN (0x1 << 5)
1319#define RT5640_EQ_BPF4_MASK (0x1 << 4)
1320#define RT5640_EQ_BPF4_SFT 4
1321#define RT5640_EQ_BPF4_DIS (0x0 << 4)
1322#define RT5640_EQ_BPF4_EN (0x1 << 4)
1323#define RT5640_EQ_BPF3_MASK (0x1 << 3)
1324#define RT5640_EQ_BPF3_SFT 3
1325#define RT5640_EQ_BPF3_DIS (0x0 << 3)
1326#define RT5640_EQ_BPF3_EN (0x1 << 3)
1327#define RT5640_EQ_BPF2_MASK (0x1 << 2)
1328#define RT5640_EQ_BPF2_SFT 2
1329#define RT5640_EQ_BPF2_DIS (0x0 << 2)
1330#define RT5640_EQ_BPF2_EN (0x1 << 2)
1331#define RT5640_EQ_BPF1_MASK (0x1 << 1)
1332#define RT5640_EQ_BPF1_SFT 1
1333#define RT5640_EQ_BPF1_DIS (0x0 << 1)
1334#define RT5640_EQ_BPF1_EN (0x1 << 1)
1335#define RT5640_EQ_LPF_MASK (0x1)
1336#define RT5640_EQ_LPF_SFT 0
1337#define RT5640_EQ_LPF_DIS (0x0)
1338#define RT5640_EQ_LPF_EN (0x1)
1339
1340/* Memory Test (0xb2) */
1341#define RT5640_MT_MASK (0x1 << 15)
1342#define RT5640_MT_SFT 15
1343#define RT5640_MT_DIS (0x0 << 15)
1344#define RT5640_MT_EN (0x1 << 15)
1345
1346/* DRC/AGC Control 1 (0xb4) */
1347#define RT5640_DRC_AGC_P_MASK (0x1 << 15)
1348#define RT5640_DRC_AGC_P_SFT 15
1349#define RT5640_DRC_AGC_P_DAC (0x0 << 15)
1350#define RT5640_DRC_AGC_P_ADC (0x1 << 15)
1351#define RT5640_DRC_AGC_MASK (0x1 << 14)
1352#define RT5640_DRC_AGC_SFT 14
1353#define RT5640_DRC_AGC_DIS (0x0 << 14)
1354#define RT5640_DRC_AGC_EN (0x1 << 14)
1355#define RT5640_DRC_AGC_UPD (0x1 << 13)
1356#define RT5640_DRC_AGC_UPD_BIT 13
1357#define RT5640_DRC_AGC_AR_MASK (0x1f << 8)
1358#define RT5640_DRC_AGC_AR_SFT 8
1359#define RT5640_DRC_AGC_R_MASK (0x7 << 5)
1360#define RT5640_DRC_AGC_R_SFT 5
1361#define RT5640_DRC_AGC_R_48K (0x1 << 5)
1362#define RT5640_DRC_AGC_R_96K (0x2 << 5)
1363#define RT5640_DRC_AGC_R_192K (0x3 << 5)
1364#define RT5640_DRC_AGC_R_441K (0x5 << 5)
1365#define RT5640_DRC_AGC_R_882K (0x6 << 5)
1366#define RT5640_DRC_AGC_R_1764K (0x7 << 5)
1367#define RT5640_DRC_AGC_RC_MASK (0x1f)
1368#define RT5640_DRC_AGC_RC_SFT 0
1369
1370/* DRC/AGC Control 2 (0xb5) */
1371#define RT5640_DRC_AGC_POB_MASK (0x3f << 8)
1372#define RT5640_DRC_AGC_POB_SFT 8
1373#define RT5640_DRC_AGC_CP_MASK (0x1 << 7)
1374#define RT5640_DRC_AGC_CP_SFT 7
1375#define RT5640_DRC_AGC_CP_DIS (0x0 << 7)
1376#define RT5640_DRC_AGC_CP_EN (0x1 << 7)
1377#define RT5640_DRC_AGC_CPR_MASK (0x3 << 5)
1378#define RT5640_DRC_AGC_CPR_SFT 5
1379#define RT5640_DRC_AGC_CPR_1_1 (0x0 << 5)
1380#define RT5640_DRC_AGC_CPR_1_2 (0x1 << 5)
1381#define RT5640_DRC_AGC_CPR_1_3 (0x2 << 5)
1382#define RT5640_DRC_AGC_CPR_1_4 (0x3 << 5)
1383#define RT5640_DRC_AGC_PRB_MASK (0x1f)
1384#define RT5640_DRC_AGC_PRB_SFT 0
1385
1386/* DRC/AGC Control 3 (0xb6) */
1387#define RT5640_DRC_AGC_NGB_MASK (0xf << 12)
1388#define RT5640_DRC_AGC_NGB_SFT 12
1389#define RT5640_DRC_AGC_TAR_MASK (0x1f << 7)
1390#define RT5640_DRC_AGC_TAR_SFT 7
1391#define RT5640_DRC_AGC_NG_MASK (0x1 << 6)
1392#define RT5640_DRC_AGC_NG_SFT 6
1393#define RT5640_DRC_AGC_NG_DIS (0x0 << 6)
1394#define RT5640_DRC_AGC_NG_EN (0x1 << 6)
1395#define RT5640_DRC_AGC_NGH_MASK (0x1 << 5)
1396#define RT5640_DRC_AGC_NGH_SFT 5
1397#define RT5640_DRC_AGC_NGH_DIS (0x0 << 5)
1398#define RT5640_DRC_AGC_NGH_EN (0x1 << 5)
1399#define RT5640_DRC_AGC_NGT_MASK (0x1f)
1400#define RT5640_DRC_AGC_NGT_SFT 0
1401
1402/* ANC Control 1 (0xb8) */
1403#define RT5640_ANC_M_MASK (0x1 << 15)
1404#define RT5640_ANC_M_SFT 15
1405#define RT5640_ANC_M_NOR (0x0 << 15)
1406#define RT5640_ANC_M_REV (0x1 << 15)
1407#define RT5640_ANC_MASK (0x1 << 14)
1408#define RT5640_ANC_SFT 14
1409#define RT5640_ANC_DIS (0x0 << 14)
1410#define RT5640_ANC_EN (0x1 << 14)
1411#define RT5640_ANC_MD_MASK (0x3 << 12)
1412#define RT5640_ANC_MD_SFT 12
1413#define RT5640_ANC_MD_DIS (0x0 << 12)
1414#define RT5640_ANC_MD_67MS (0x1 << 12)
1415#define RT5640_ANC_MD_267MS (0x2 << 12)
1416#define RT5640_ANC_MD_1067MS (0x3 << 12)
1417#define RT5640_ANC_SN_MASK (0x1 << 11)
1418#define RT5640_ANC_SN_SFT 11
1419#define RT5640_ANC_SN_DIS (0x0 << 11)
1420#define RT5640_ANC_SN_EN (0x1 << 11)
1421#define RT5640_ANC_CLK_MASK (0x1 << 10)
1422#define RT5640_ANC_CLK_SFT 10
1423#define RT5640_ANC_CLK_ANC (0x0 << 10)
1424#define RT5640_ANC_CLK_REG (0x1 << 10)
1425#define RT5640_ANC_ZCD_MASK (0x3 << 8)
1426#define RT5640_ANC_ZCD_SFT 8
1427#define RT5640_ANC_ZCD_DIS (0x0 << 8)
1428#define RT5640_ANC_ZCD_T1 (0x1 << 8)
1429#define RT5640_ANC_ZCD_T2 (0x2 << 8)
1430#define RT5640_ANC_ZCD_WT (0x3 << 8)
1431#define RT5640_ANC_CS_MASK (0x1 << 7)
1432#define RT5640_ANC_CS_SFT 7
1433#define RT5640_ANC_CS_DIS (0x0 << 7)
1434#define RT5640_ANC_CS_EN (0x1 << 7)
1435#define RT5640_ANC_SW_MASK (0x1 << 6)
1436#define RT5640_ANC_SW_SFT 6
1437#define RT5640_ANC_SW_NOR (0x0 << 6)
1438#define RT5640_ANC_SW_AUTO (0x1 << 6)
1439#define RT5640_ANC_CO_L_MASK (0x3f)
1440#define RT5640_ANC_CO_L_SFT 0
1441
1442/* ANC Control 2 (0xb6) */
1443#define RT5640_ANC_FG_R_MASK (0xf << 12)
1444#define RT5640_ANC_FG_R_SFT 12
1445#define RT5640_ANC_FG_L_MASK (0xf << 8)
1446#define RT5640_ANC_FG_L_SFT 8
1447#define RT5640_ANC_CG_R_MASK (0xf << 4)
1448#define RT5640_ANC_CG_R_SFT 4
1449#define RT5640_ANC_CG_L_MASK (0xf)
1450#define RT5640_ANC_CG_L_SFT 0
1451
1452/* ANC Control 3 (0xb6) */
1453#define RT5640_ANC_CD_MASK (0x1 << 6)
1454#define RT5640_ANC_CD_SFT 6
1455#define RT5640_ANC_CD_BOTH (0x0 << 6)
1456#define RT5640_ANC_CD_IND (0x1 << 6)
1457#define RT5640_ANC_CO_R_MASK (0x3f)
1458#define RT5640_ANC_CO_R_SFT 0
1459
1460/* Jack Detect Control (0xbb) */
1461#define RT5640_JD_MASK (0x7 << 13)
1462#define RT5640_JD_SFT 13
1463#define RT5640_JD_DIS (0x0 << 13)
1464#define RT5640_JD_GPIO1 (0x1 << 13)
1465#define RT5640_JD_JD1_IN4P (0x2 << 13)
1466#define RT5640_JD_JD2_IN4N (0x3 << 13)
1467#define RT5640_JD_GPIO2 (0x4 << 13)
1468#define RT5640_JD_GPIO3 (0x5 << 13)
1469#define RT5640_JD_GPIO4 (0x6 << 13)
1470#define RT5640_JD_HP_MASK (0x1 << 11)
1471#define RT5640_JD_HP_SFT 11
1472#define RT5640_JD_HP_DIS (0x0 << 11)
1473#define RT5640_JD_HP_EN (0x1 << 11)
1474#define RT5640_JD_HP_TRG_MASK (0x1 << 10)
1475#define RT5640_JD_HP_TRG_SFT 10
1476#define RT5640_JD_HP_TRG_LO (0x0 << 10)
1477#define RT5640_JD_HP_TRG_HI (0x1 << 10)
1478#define RT5640_JD_SPL_MASK (0x1 << 9)
1479#define RT5640_JD_SPL_SFT 9
1480#define RT5640_JD_SPL_DIS (0x0 << 9)
1481#define RT5640_JD_SPL_EN (0x1 << 9)
1482#define RT5640_JD_SPL_TRG_MASK (0x1 << 8)
1483#define RT5640_JD_SPL_TRG_SFT 8
1484#define RT5640_JD_SPL_TRG_LO (0x0 << 8)
1485#define RT5640_JD_SPL_TRG_HI (0x1 << 8)
1486#define RT5640_JD_SPR_MASK (0x1 << 7)
1487#define RT5640_JD_SPR_SFT 7
1488#define RT5640_JD_SPR_DIS (0x0 << 7)
1489#define RT5640_JD_SPR_EN (0x1 << 7)
1490#define RT5640_JD_SPR_TRG_MASK (0x1 << 6)
1491#define RT5640_JD_SPR_TRG_SFT 6
1492#define RT5640_JD_SPR_TRG_LO (0x0 << 6)
1493#define RT5640_JD_SPR_TRG_HI (0x1 << 6)
1494#define RT5640_JD_MO_MASK (0x1 << 5)
1495#define RT5640_JD_MO_SFT 5
1496#define RT5640_JD_MO_DIS (0x0 << 5)
1497#define RT5640_JD_MO_EN (0x1 << 5)
1498#define RT5640_JD_MO_TRG_MASK (0x1 << 4)
1499#define RT5640_JD_MO_TRG_SFT 4
1500#define RT5640_JD_MO_TRG_LO (0x0 << 4)
1501#define RT5640_JD_MO_TRG_HI (0x1 << 4)
1502#define RT5640_JD_LO_MASK (0x1 << 3)
1503#define RT5640_JD_LO_SFT 3
1504#define RT5640_JD_LO_DIS (0x0 << 3)
1505#define RT5640_JD_LO_EN (0x1 << 3)
1506#define RT5640_JD_LO_TRG_MASK (0x1 << 2)
1507#define RT5640_JD_LO_TRG_SFT 2
1508#define RT5640_JD_LO_TRG_LO (0x0 << 2)
1509#define RT5640_JD_LO_TRG_HI (0x1 << 2)
1510#define RT5640_JD1_IN4P_MASK (0x1 << 1)
1511#define RT5640_JD1_IN4P_SFT 1
1512#define RT5640_JD1_IN4P_DIS (0x0 << 1)
1513#define RT5640_JD1_IN4P_EN (0x1 << 1)
1514#define RT5640_JD2_IN4N_MASK (0x1)
1515#define RT5640_JD2_IN4N_SFT 0
1516#define RT5640_JD2_IN4N_DIS (0x0)
1517#define RT5640_JD2_IN4N_EN (0x1)
1518
1519/* Jack detect for ANC (0xbc) */
1520#define RT5640_ANC_DET_MASK (0x3 << 4)
1521#define RT5640_ANC_DET_SFT 4
1522#define RT5640_ANC_DET_DIS (0x0 << 4)
1523#define RT5640_ANC_DET_MB1 (0x1 << 4)
1524#define RT5640_ANC_DET_MB2 (0x2 << 4)
1525#define RT5640_ANC_DET_JD (0x3 << 4)
1526#define RT5640_AD_TRG_MASK (0x1 << 3)
1527#define RT5640_AD_TRG_SFT 3
1528#define RT5640_AD_TRG_LO (0x0 << 3)
1529#define RT5640_AD_TRG_HI (0x1 << 3)
1530#define RT5640_ANCM_DET_MASK (0x3 << 4)
1531#define RT5640_ANCM_DET_SFT 4
1532#define RT5640_ANCM_DET_DIS (0x0 << 4)
1533#define RT5640_ANCM_DET_MB1 (0x1 << 4)
1534#define RT5640_ANCM_DET_MB2 (0x2 << 4)
1535#define RT5640_ANCM_DET_JD (0x3 << 4)
1536#define RT5640_AMD_TRG_MASK (0x1 << 3)
1537#define RT5640_AMD_TRG_SFT 3
1538#define RT5640_AMD_TRG_LO (0x0 << 3)
1539#define RT5640_AMD_TRG_HI (0x1 << 3)
1540
1541/* IRQ Control 1 (0xbd) */
1542#define RT5640_IRQ_JD_MASK (0x1 << 15)
1543#define RT5640_IRQ_JD_SFT 15
1544#define RT5640_IRQ_JD_BP (0x0 << 15)
1545#define RT5640_IRQ_JD_NOR (0x1 << 15)
1546#define RT5640_IRQ_OT_MASK (0x1 << 14)
1547#define RT5640_IRQ_OT_SFT 14
1548#define RT5640_IRQ_OT_BP (0x0 << 14)
1549#define RT5640_IRQ_OT_NOR (0x1 << 14)
1550#define RT5640_JD_STKY_MASK (0x1 << 13)
1551#define RT5640_JD_STKY_SFT 13
1552#define RT5640_JD_STKY_DIS (0x0 << 13)
1553#define RT5640_JD_STKY_EN (0x1 << 13)
1554#define RT5640_OT_STKY_MASK (0x1 << 12)
1555#define RT5640_OT_STKY_SFT 12
1556#define RT5640_OT_STKY_DIS (0x0 << 12)
1557#define RT5640_OT_STKY_EN (0x1 << 12)
1558#define RT5640_JD_P_MASK (0x1 << 11)
1559#define RT5640_JD_P_SFT 11
1560#define RT5640_JD_P_NOR (0x0 << 11)
1561#define RT5640_JD_P_INV (0x1 << 11)
1562#define RT5640_OT_P_MASK (0x1 << 10)
1563#define RT5640_OT_P_SFT 10
1564#define RT5640_OT_P_NOR (0x0 << 10)
1565#define RT5640_OT_P_INV (0x1 << 10)
1566
1567/* IRQ Control 2 (0xbe) */
1568#define RT5640_IRQ_MB1_OC_MASK (0x1 << 15)
1569#define RT5640_IRQ_MB1_OC_SFT 15
1570#define RT5640_IRQ_MB1_OC_BP (0x0 << 15)
1571#define RT5640_IRQ_MB1_OC_NOR (0x1 << 15)
1572#define RT5640_IRQ_MB2_OC_MASK (0x1 << 14)
1573#define RT5640_IRQ_MB2_OC_SFT 14
1574#define RT5640_IRQ_MB2_OC_BP (0x0 << 14)
1575#define RT5640_IRQ_MB2_OC_NOR (0x1 << 14)
1576#define RT5640_MB1_OC_STKY_MASK (0x1 << 11)
1577#define RT5640_MB1_OC_STKY_SFT 11
1578#define RT5640_MB1_OC_STKY_DIS (0x0 << 11)
1579#define RT5640_MB1_OC_STKY_EN (0x1 << 11)
1580#define RT5640_MB2_OC_STKY_MASK (0x1 << 10)
1581#define RT5640_MB2_OC_STKY_SFT 10
1582#define RT5640_MB2_OC_STKY_DIS (0x0 << 10)
1583#define RT5640_MB2_OC_STKY_EN (0x1 << 10)
1584#define RT5640_MB1_OC_P_MASK (0x1 << 7)
1585#define RT5640_MB1_OC_P_SFT 7
1586#define RT5640_MB1_OC_P_NOR (0x0 << 7)
1587#define RT5640_MB1_OC_P_INV (0x1 << 7)
1588#define RT5640_MB2_OC_P_MASK (0x1 << 6)
1589#define RT5640_MB2_OC_P_SFT 6
1590#define RT5640_MB2_OC_P_NOR (0x0 << 6)
1591#define RT5640_MB2_OC_P_INV (0x1 << 6)
1592#define RT5640_MB1_OC_CLR (0x1 << 3)
1593#define RT5640_MB1_OC_CLR_SFT 3
1594#define RT5640_MB2_OC_CLR (0x1 << 2)
1595#define RT5640_MB2_OC_CLR_SFT 2
1596
1597/* GPIO Control 1 (0xc0) */
1598#define RT5640_GP1_PIN_MASK (0x1 << 15)
1599#define RT5640_GP1_PIN_SFT 15
1600#define RT5640_GP1_PIN_GPIO1 (0x0 << 15)
1601#define RT5640_GP1_PIN_IRQ (0x1 << 15)
1602#define RT5640_GP2_PIN_MASK (0x1 << 14)
1603#define RT5640_GP2_PIN_SFT 14
1604#define RT5640_GP2_PIN_GPIO2 (0x0 << 14)
1605#define RT5640_GP2_PIN_DMIC1_SCL (0x1 << 14)
1606#define RT5640_GP3_PIN_MASK (0x3 << 12)
1607#define RT5640_GP3_PIN_SFT 12
1608#define RT5640_GP3_PIN_GPIO3 (0x0 << 12)
1609#define RT5640_GP3_PIN_DMIC1_SDA (0x1 << 12)
1610#define RT5640_GP3_PIN_IRQ (0x2 << 12)
1611#define RT5640_GP4_PIN_MASK (0x1 << 11)
1612#define RT5640_GP4_PIN_SFT 11
1613#define RT5640_GP4_PIN_GPIO4 (0x0 << 11)
1614#define RT5640_GP4_PIN_DMIC2_SDA (0x1 << 11)
1615#define RT5640_DP_SIG_MASK (0x1 << 10)
1616#define RT5640_DP_SIG_SFT 10
1617#define RT5640_DP_SIG_TEST (0x0 << 10)
1618#define RT5640_DP_SIG_AP (0x1 << 10)
1619#define RT5640_GPIO_M_MASK (0x1 << 9)
1620#define RT5640_GPIO_M_SFT 9
1621#define RT5640_GPIO_M_FLT (0x0 << 9)
1622#define RT5640_GPIO_M_PH (0x1 << 9)
1623
1624/* GPIO Control 3 (0xc2) */
1625#define RT5640_GP4_PF_MASK (0x1 << 11)
1626#define RT5640_GP4_PF_SFT 11
1627#define RT5640_GP4_PF_IN (0x0 << 11)
1628#define RT5640_GP4_PF_OUT (0x1 << 11)
1629#define RT5640_GP4_OUT_MASK (0x1 << 10)
1630#define RT5640_GP4_OUT_SFT 10
1631#define RT5640_GP4_OUT_LO (0x0 << 10)
1632#define RT5640_GP4_OUT_HI (0x1 << 10)
1633#define RT5640_GP4_P_MASK (0x1 << 9)
1634#define RT5640_GP4_P_SFT 9
1635#define RT5640_GP4_P_NOR (0x0 << 9)
1636#define RT5640_GP4_P_INV (0x1 << 9)
1637#define RT5640_GP3_PF_MASK (0x1 << 8)
1638#define RT5640_GP3_PF_SFT 8
1639#define RT5640_GP3_PF_IN (0x0 << 8)
1640#define RT5640_GP3_PF_OUT (0x1 << 8)
1641#define RT5640_GP3_OUT_MASK (0x1 << 7)
1642#define RT5640_GP3_OUT_SFT 7
1643#define RT5640_GP3_OUT_LO (0x0 << 7)
1644#define RT5640_GP3_OUT_HI (0x1 << 7)
1645#define RT5640_GP3_P_MASK (0x1 << 6)
1646#define RT5640_GP3_P_SFT 6
1647#define RT5640_GP3_P_NOR (0x0 << 6)
1648#define RT5640_GP3_P_INV (0x1 << 6)
1649#define RT5640_GP2_PF_MASK (0x1 << 5)
1650#define RT5640_GP2_PF_SFT 5
1651#define RT5640_GP2_PF_IN (0x0 << 5)
1652#define RT5640_GP2_PF_OUT (0x1 << 5)
1653#define RT5640_GP2_OUT_MASK (0x1 << 4)
1654#define RT5640_GP2_OUT_SFT 4
1655#define RT5640_GP2_OUT_LO (0x0 << 4)
1656#define RT5640_GP2_OUT_HI (0x1 << 4)
1657#define RT5640_GP2_P_MASK (0x1 << 3)
1658#define RT5640_GP2_P_SFT 3
1659#define RT5640_GP2_P_NOR (0x0 << 3)
1660#define RT5640_GP2_P_INV (0x1 << 3)
1661#define RT5640_GP1_PF_MASK (0x1 << 2)
1662#define RT5640_GP1_PF_SFT 2
1663#define RT5640_GP1_PF_IN (0x0 << 2)
1664#define RT5640_GP1_PF_OUT (0x1 << 2)
1665#define RT5640_GP1_OUT_MASK (0x1 << 1)
1666#define RT5640_GP1_OUT_SFT 1
1667#define RT5640_GP1_OUT_LO (0x0 << 1)
1668#define RT5640_GP1_OUT_HI (0x1 << 1)
1669#define RT5640_GP1_P_MASK (0x1)
1670#define RT5640_GP1_P_SFT 0
1671#define RT5640_GP1_P_NOR (0x0)
1672#define RT5640_GP1_P_INV (0x1)
1673
1674/* FM34-500 Register Control 1 (0xc4) */
1675#define RT5640_DSP_ADD_SFT 0
1676
1677/* FM34-500 Register Control 2 (0xc5) */
1678#define RT5640_DSP_DAT_SFT 0
1679
1680/* FM34-500 Register Control 3 (0xc6) */
1681#define RT5640_DSP_BUSY_MASK (0x1 << 15)
1682#define RT5640_DSP_BUSY_BIT 15
1683#define RT5640_DSP_DS_MASK (0x1 << 14)
1684#define RT5640_DSP_DS_SFT 14
1685#define RT5640_DSP_DS_FM3010 (0x1 << 14)
1686#define RT5640_DSP_DS_TEMP (0x1 << 14)
1687#define RT5640_DSP_CLK_MASK (0x3 << 12)
1688#define RT5640_DSP_CLK_SFT 12
1689#define RT5640_DSP_CLK_384K (0x0 << 12)
1690#define RT5640_DSP_CLK_192K (0x1 << 12)
1691#define RT5640_DSP_CLK_96K (0x2 << 12)
1692#define RT5640_DSP_CLK_64K (0x3 << 12)
1693#define RT5640_DSP_PD_PIN_MASK (0x1 << 11)
1694#define RT5640_DSP_PD_PIN_SFT 11
1695#define RT5640_DSP_PD_PIN_LO (0x0 << 11)
1696#define RT5640_DSP_PD_PIN_HI (0x1 << 11)
1697#define RT5640_DSP_RST_PIN_MASK (0x1 << 10)
1698#define RT5640_DSP_RST_PIN_SFT 10
1699#define RT5640_DSP_RST_PIN_LO (0x0 << 10)
1700#define RT5640_DSP_RST_PIN_HI (0x1 << 10)
1701#define RT5640_DSP_R_EN (0x1 << 9)
1702#define RT5640_DSP_R_EN_BIT 9
1703#define RT5640_DSP_W_EN (0x1 << 8)
1704#define RT5640_DSP_W_EN_BIT 8
1705#define RT5640_DSP_CMD_MASK (0xff)
1706#define RT5640_DSP_CMD_SFT 0
1707#define RT5640_DSP_CMD_MW (0x3B) /* Memory Write */
1708#define RT5640_DSP_CMD_MR (0x37) /* Memory Read */
1709#define RT5640_DSP_CMD_RR (0x60) /* Register Read */
1710#define RT5640_DSP_CMD_RW (0x68) /* Register Write */
1711
1712/* Programmable Register Array Control 1 (0xc8) */
1713#define RT5640_REG_SEQ_MASK (0xf << 12)
1714#define RT5640_REG_SEQ_SFT 12
1715#define RT5640_SEQ1_ST_MASK (0x1 << 11) /*RO*/
1716#define RT5640_SEQ1_ST_SFT 11
1717#define RT5640_SEQ1_ST_RUN (0x0 << 11)
1718#define RT5640_SEQ1_ST_FIN (0x1 << 11)
1719#define RT5640_SEQ2_ST_MASK (0x1 << 10) /*RO*/
1720#define RT5640_SEQ2_ST_SFT 10
1721#define RT5640_SEQ2_ST_RUN (0x0 << 10)
1722#define RT5640_SEQ2_ST_FIN (0x1 << 10)
1723#define RT5640_REG_LV_MASK (0x1 << 9)
1724#define RT5640_REG_LV_SFT 9
1725#define RT5640_REG_LV_MX (0x0 << 9)
1726#define RT5640_REG_LV_PR (0x1 << 9)
1727#define RT5640_SEQ_2_PT_MASK (0x1 << 8)
1728#define RT5640_SEQ_2_PT_BIT 8
1729#define RT5640_REG_IDX_MASK (0xff)
1730#define RT5640_REG_IDX_SFT 0
1731
1732/* Programmable Register Array Control 2 (0xc9) */
1733#define RT5640_REG_DAT_MASK (0xffff)
1734#define RT5640_REG_DAT_SFT 0
1735
1736/* Programmable Register Array Control 3 (0xca) */
1737#define RT5640_SEQ_DLY_MASK (0xff << 8)
1738#define RT5640_SEQ_DLY_SFT 8
1739#define RT5640_PROG_MASK (0x1 << 7)
1740#define RT5640_PROG_SFT 7
1741#define RT5640_PROG_DIS (0x0 << 7)
1742#define RT5640_PROG_EN (0x1 << 7)
1743#define RT5640_SEQ1_PT_RUN (0x1 << 6)
1744#define RT5640_SEQ1_PT_RUN_BIT 6
1745#define RT5640_SEQ2_PT_RUN (0x1 << 5)
1746#define RT5640_SEQ2_PT_RUN_BIT 5
1747
1748/* Programmable Register Array Control 4 (0xcb) */
1749#define RT5640_SEQ1_START_MASK (0xf << 8)
1750#define RT5640_SEQ1_START_SFT 8
1751#define RT5640_SEQ1_END_MASK (0xf)
1752#define RT5640_SEQ1_END_SFT 0
1753
1754/* Programmable Register Array Control 5 (0xcc) */
1755#define RT5640_SEQ2_START_MASK (0xf << 8)
1756#define RT5640_SEQ2_START_SFT 8
1757#define RT5640_SEQ2_END_MASK (0xf)
1758#define RT5640_SEQ2_END_SFT 0
1759
1760/* Scramble Function (0xcd) */
1761#define RT5640_SCB_KEY_MASK (0xff)
1762#define RT5640_SCB_KEY_SFT 0
1763
1764/* Scramble Control (0xce) */
1765#define RT5640_SCB_SWAP_MASK (0x1 << 15)
1766#define RT5640_SCB_SWAP_SFT 15
1767#define RT5640_SCB_SWAP_DIS (0x0 << 15)
1768#define RT5640_SCB_SWAP_EN (0x1 << 15)
1769#define RT5640_SCB_MASK (0x1 << 14)
1770#define RT5640_SCB_SFT 14
1771#define RT5640_SCB_DIS (0x0 << 14)
1772#define RT5640_SCB_EN (0x1 << 14)
1773
1774/* Baseback Control (0xcf) */
1775#define RT5640_BB_MASK (0x1 << 15)
1776#define RT5640_BB_SFT 15
1777#define RT5640_BB_DIS (0x0 << 15)
1778#define RT5640_BB_EN (0x1 << 15)
1779#define RT5640_BB_CT_MASK (0x7 << 12)
1780#define RT5640_BB_CT_SFT 12
1781#define RT5640_BB_CT_A (0x0 << 12)
1782#define RT5640_BB_CT_B (0x1 << 12)
1783#define RT5640_BB_CT_C (0x2 << 12)
1784#define RT5640_BB_CT_D (0x3 << 12)
1785#define RT5640_M_BB_L_MASK (0x1 << 9)
1786#define RT5640_M_BB_L_SFT 9
1787#define RT5640_M_BB_R_MASK (0x1 << 8)
1788#define RT5640_M_BB_R_SFT 8
1789#define RT5640_M_BB_HPF_L_MASK (0x1 << 7)
1790#define RT5640_M_BB_HPF_L_SFT 7
1791#define RT5640_M_BB_HPF_R_MASK (0x1 << 6)
1792#define RT5640_M_BB_HPF_R_SFT 6
1793#define RT5640_G_BB_BST_MASK (0x3f)
1794#define RT5640_G_BB_BST_SFT 0
1795
1796/* MP3 Plus Control 1 (0xd0) */
1797#define RT5640_M_MP3_L_MASK (0x1 << 15)
1798#define RT5640_M_MP3_L_SFT 15
1799#define RT5640_M_MP3_R_MASK (0x1 << 14)
1800#define RT5640_M_MP3_R_SFT 14
1801#define RT5640_M_MP3_MASK (0x1 << 13)
1802#define RT5640_M_MP3_SFT 13
1803#define RT5640_M_MP3_DIS (0x0 << 13)
1804#define RT5640_M_MP3_EN (0x1 << 13)
1805#define RT5640_EG_MP3_MASK (0x1f << 8)
1806#define RT5640_EG_MP3_SFT 8
1807#define RT5640_MP3_HLP_MASK (0x1 << 7)
1808#define RT5640_MP3_HLP_SFT 7
1809#define RT5640_MP3_HLP_DIS (0x0 << 7)
1810#define RT5640_MP3_HLP_EN (0x1 << 7)
1811#define RT5640_M_MP3_ORG_L_MASK (0x1 << 6)
1812#define RT5640_M_MP3_ORG_L_SFT 6
1813#define RT5640_M_MP3_ORG_R_MASK (0x1 << 5)
1814#define RT5640_M_MP3_ORG_R_SFT 5
1815
1816/* MP3 Plus Control 2 (0xd1) */
1817#define RT5640_MP3_WT_MASK (0x1 << 13)
1818#define RT5640_MP3_WT_SFT 13
1819#define RT5640_MP3_WT_1_4 (0x0 << 13)
1820#define RT5640_MP3_WT_1_2 (0x1 << 13)
1821#define RT5640_OG_MP3_MASK (0x1f << 8)
1822#define RT5640_OG_MP3_SFT 8
1823#define RT5640_HG_MP3_MASK (0x3f)
1824#define RT5640_HG_MP3_SFT 0
1825
1826/* 3D HP Control 1 (0xd2) */
1827#define RT5640_3D_CF_MASK (0x1 << 15)
1828#define RT5640_3D_CF_SFT 15
1829#define RT5640_3D_CF_DIS (0x0 << 15)
1830#define RT5640_3D_CF_EN (0x1 << 15)
1831#define RT5640_3D_HP_MASK (0x1 << 14)
1832#define RT5640_3D_HP_SFT 14
1833#define RT5640_3D_HP_DIS (0x0 << 14)
1834#define RT5640_3D_HP_EN (0x1 << 14)
1835#define RT5640_3D_BT_MASK (0x1 << 13)
1836#define RT5640_3D_BT_SFT 13
1837#define RT5640_3D_BT_DIS (0x0 << 13)
1838#define RT5640_3D_BT_EN (0x1 << 13)
1839#define RT5640_3D_1F_MIX_MASK (0x3 << 11)
1840#define RT5640_3D_1F_MIX_SFT 11
1841#define RT5640_3D_HP_M_MASK (0x1 << 10)
1842#define RT5640_3D_HP_M_SFT 10
1843#define RT5640_3D_HP_M_SUR (0x0 << 10)
1844#define RT5640_3D_HP_M_FRO (0x1 << 10)
1845#define RT5640_M_3D_HRTF_MASK (0x1 << 9)
1846#define RT5640_M_3D_HRTF_SFT 9
1847#define RT5640_M_3D_D2H_MASK (0x1 << 8)
1848#define RT5640_M_3D_D2H_SFT 8
1849#define RT5640_M_3D_D2R_MASK (0x1 << 7)
1850#define RT5640_M_3D_D2R_SFT 7
1851#define RT5640_M_3D_REVB_MASK (0x1 << 6)
1852#define RT5640_M_3D_REVB_SFT 6
1853
1854/* Adjustable high pass filter control 1 (0xd3) */
1855#define RT5640_2ND_HPF_MASK (0x1 << 15)
1856#define RT5640_2ND_HPF_SFT 15
1857#define RT5640_2ND_HPF_DIS (0x0 << 15)
1858#define RT5640_2ND_HPF_EN (0x1 << 15)
1859#define RT5640_HPF_CF_L_MASK (0x7 << 12)
1860#define RT5640_HPF_CF_L_SFT 12
1861#define RT5640_1ST_HPF_MASK (0x1 << 11)
1862#define RT5640_1ST_HPF_SFT 11
1863#define RT5640_1ST_HPF_DIS (0x0 << 11)
1864#define RT5640_1ST_HPF_EN (0x1 << 11)
1865#define RT5640_HPF_CF_R_MASK (0x7 << 8)
1866#define RT5640_HPF_CF_R_SFT 8
1867#define RT5640_ZD_T_MASK (0x3 << 6)
1868#define RT5640_ZD_T_SFT 6
1869#define RT5640_ZD_F_MASK (0x3 << 4)
1870#define RT5640_ZD_F_SFT 4
1871#define RT5640_ZD_F_IM (0x0 << 4)
1872#define RT5640_ZD_F_ZC_IM (0x1 << 4)
1873#define RT5640_ZD_F_ZC_IOD (0x2 << 4)
1874#define RT5640_ZD_F_UN (0x3 << 4)
1875
1876/* HP calibration control and Amp detection (0xd6) */
1877#define RT5640_SI_DAC_MASK (0x1 << 11)
1878#define RT5640_SI_DAC_SFT 11
1879#define RT5640_SI_DAC_AUTO (0x0 << 11)
1880#define RT5640_SI_DAC_TEST (0x1 << 11)
1881#define RT5640_DC_CAL_M_MASK (0x1 << 10)
1882#define RT5640_DC_CAL_M_SFT 10
1883#define RT5640_DC_CAL_M_CAL (0x0 << 10)
1884#define RT5640_DC_CAL_M_NOR (0x1 << 10)
1885#define RT5640_DC_CAL_MASK (0x1 << 9)
1886#define RT5640_DC_CAL_SFT 9
1887#define RT5640_DC_CAL_DIS (0x0 << 9)
1888#define RT5640_DC_CAL_EN (0x1 << 9)
1889#define RT5640_HPD_RCV_MASK (0x7 << 6)
1890#define RT5640_HPD_RCV_SFT 6
1891#define RT5640_HPD_PS_MASK (0x1 << 5)
1892#define RT5640_HPD_PS_SFT 5
1893#define RT5640_HPD_PS_DIS (0x0 << 5)
1894#define RT5640_HPD_PS_EN (0x1 << 5)
1895#define RT5640_CAL_M_MASK (0x1 << 4)
1896#define RT5640_CAL_M_SFT 4
1897#define RT5640_CAL_M_DEP (0x0 << 4)
1898#define RT5640_CAL_M_CAL (0x1 << 4)
1899#define RT5640_CAL_MASK (0x1 << 3)
1900#define RT5640_CAL_SFT 3
1901#define RT5640_CAL_DIS (0x0 << 3)
1902#define RT5640_CAL_EN (0x1 << 3)
1903#define RT5640_CAL_TEST_MASK (0x1 << 2)
1904#define RT5640_CAL_TEST_SFT 2
1905#define RT5640_CAL_TEST_DIS (0x0 << 2)
1906#define RT5640_CAL_TEST_EN (0x1 << 2)
1907#define RT5640_CAL_P_MASK (0x3)
1908#define RT5640_CAL_P_SFT 0
1909#define RT5640_CAL_P_NONE (0x0)
1910#define RT5640_CAL_P_CAL (0x1)
1911#define RT5640_CAL_P_DAC_CAL (0x2)
1912
1913/* Soft volume and zero cross control 1 (0xd9) */
1914#define RT5640_SV_MASK (0x1 << 15)
1915#define RT5640_SV_SFT 15
1916#define RT5640_SV_DIS (0x0 << 15)
1917#define RT5640_SV_EN (0x1 << 15)
1918#define RT5640_SPO_SV_MASK (0x1 << 14)
1919#define RT5640_SPO_SV_SFT 14
1920#define RT5640_SPO_SV_DIS (0x0 << 14)
1921#define RT5640_SPO_SV_EN (0x1 << 14)
1922#define RT5640_OUT_SV_MASK (0x1 << 13)
1923#define RT5640_OUT_SV_SFT 13
1924#define RT5640_OUT_SV_DIS (0x0 << 13)
1925#define RT5640_OUT_SV_EN (0x1 << 13)
1926#define RT5640_HP_SV_MASK (0x1 << 12)
1927#define RT5640_HP_SV_SFT 12
1928#define RT5640_HP_SV_DIS (0x0 << 12)
1929#define RT5640_HP_SV_EN (0x1 << 12)
1930#define RT5640_ZCD_DIG_MASK (0x1 << 11)
1931#define RT5640_ZCD_DIG_SFT 11
1932#define RT5640_ZCD_DIG_DIS (0x0 << 11)
1933#define RT5640_ZCD_DIG_EN (0x1 << 11)
1934#define RT5640_ZCD_MASK (0x1 << 10)
1935#define RT5640_ZCD_SFT 10
1936#define RT5640_ZCD_PD (0x0 << 10)
1937#define RT5640_ZCD_PU (0x1 << 10)
1938#define RT5640_M_ZCD_MASK (0x3f << 4)
1939#define RT5640_M_ZCD_SFT 4
1940#define RT5640_M_ZCD_RM_L (0x1 << 9)
1941#define RT5640_M_ZCD_RM_R (0x1 << 8)
1942#define RT5640_M_ZCD_SM_L (0x1 << 7)
1943#define RT5640_M_ZCD_SM_R (0x1 << 6)
1944#define RT5640_M_ZCD_OM_L (0x1 << 5)
1945#define RT5640_M_ZCD_OM_R (0x1 << 4)
1946#define RT5640_SV_DLY_MASK (0xf)
1947#define RT5640_SV_DLY_SFT 0
1948
1949/* Soft volume and zero cross control 2 (0xda) */
1950#define RT5640_ZCD_HP_MASK (0x1 << 15)
1951#define RT5640_ZCD_HP_SFT 15
1952#define RT5640_ZCD_HP_DIS (0x0 << 15)
1953#define RT5640_ZCD_HP_EN (0x1 << 15)
1954
1955
1956/* Codec Private Register definition */
1957/* 3D Speaker Control (0x63) */
1958#define RT5640_3D_SPK_MASK (0x1 << 15)
1959#define RT5640_3D_SPK_SFT 15
1960#define RT5640_3D_SPK_DIS (0x0 << 15)
1961#define RT5640_3D_SPK_EN (0x1 << 15)
1962#define RT5640_3D_SPK_M_MASK (0x3 << 13)
1963#define RT5640_3D_SPK_M_SFT 13
1964#define RT5640_3D_SPK_CG_MASK (0x1f << 8)
1965#define RT5640_3D_SPK_CG_SFT 8
1966#define RT5640_3D_SPK_SG_MASK (0x1f)
1967#define RT5640_3D_SPK_SG_SFT 0
1968
1969/* Wind Noise Detection Control 1 (0x6c) */
1970#define RT5640_WND_MASK (0x1 << 15)
1971#define RT5640_WND_SFT 15
1972#define RT5640_WND_DIS (0x0 << 15)
1973#define RT5640_WND_EN (0x1 << 15)
1974
1975/* Wind Noise Detection Control 2 (0x6d) */
1976#define RT5640_WND_FC_NW_MASK (0x3f << 10)
1977#define RT5640_WND_FC_NW_SFT 10
1978#define RT5640_WND_FC_WK_MASK (0x3f << 4)
1979#define RT5640_WND_FC_WK_SFT 4
1980
1981/* Wind Noise Detection Control 3 (0x6e) */
1982#define RT5640_HPF_FC_MASK (0x3f << 6)
1983#define RT5640_HPF_FC_SFT 6
1984#define RT5640_WND_FC_ST_MASK (0x3f)
1985#define RT5640_WND_FC_ST_SFT 0
1986
1987/* Wind Noise Detection Control 4 (0x6f) */
1988#define RT5640_WND_TH_LO_MASK (0x3ff)
1989#define RT5640_WND_TH_LO_SFT 0
1990
1991/* Wind Noise Detection Control 5 (0x70) */
1992#define RT5640_WND_TH_HI_MASK (0x3ff)
1993#define RT5640_WND_TH_HI_SFT 0
1994
1995/* Wind Noise Detection Control 8 (0x73) */
1996#define RT5640_WND_WIND_MASK (0x1 << 13) /* Read-Only */
1997#define RT5640_WND_WIND_SFT 13
1998#define RT5640_WND_STRONG_MASK (0x1 << 12) /* Read-Only */
1999#define RT5640_WND_STRONG_SFT 12
2000enum {
2001 RT5640_NO_WIND,
2002 RT5640_BREEZE,
2003 RT5640_STORM,
2004};
2005
2006/* Dipole Speaker Interface (0x75) */
2007#define RT5640_DP_ATT_MASK (0x3 << 14)
2008#define RT5640_DP_ATT_SFT 14
2009#define RT5640_DP_SPK_MASK (0x1 << 10)
2010#define RT5640_DP_SPK_SFT 10
2011#define RT5640_DP_SPK_DIS (0x0 << 10)
2012#define RT5640_DP_SPK_EN (0x1 << 10)
2013
2014/* EQ Pre Volume Control (0xb3) */
2015#define RT5640_EQ_PRE_VOL_MASK (0xffff)
2016#define RT5640_EQ_PRE_VOL_SFT 0
2017
2018/* EQ Post Volume Control (0xb4) */
2019#define RT5640_EQ_PST_VOL_MASK (0xffff)
2020#define RT5640_EQ_PST_VOL_SFT 0
2021
2022#define RT5640_NO_JACK BIT(0)
2023#define RT5640_HEADSET_DET BIT(1)
2024#define RT5640_HEADPHO_DET BIT(2)
2025
2026int rt5640_headset_detect(struct snd_soc_codec *codec, int jack_insert);
2027
2028/* System Clock Source */
2029#define RT5640_SCLK_S_MCLK 0
2030#define RT5640_SCLK_S_PLL1 1
2031#define RT5640_SCLK_S_PLL1_TK 2
2032#define RT5640_SCLK_S_RCCLK 3
2033
2034/* PLL1 Source */
2035#define RT5640_PLL1_S_MCLK 0
2036#define RT5640_PLL1_S_BCLK1 1
2037#define RT5640_PLL1_S_BCLK2 2
2038#define RT5640_PLL1_S_BCLK3 3
2039
2040
2041enum {
2042 RT5640_AIF1,
2043 RT5640_AIF2,
2044 RT5640_AIF3,
2045 RT5640_AIFS,
2046};
2047
2048enum {
2049 RT5640_U_IF1 = 0x1,
2050 RT5640_U_IF2 = 0x2,
2051 RT5640_U_IF3 = 0x4,
2052};
2053
2054enum {
2055 RT5640_IF_123,
2056 RT5640_IF_132,
2057 RT5640_IF_312,
2058 RT5640_IF_321,
2059 RT5640_IF_231,
2060 RT5640_IF_213,
2061 RT5640_IF_113,
2062 RT5640_IF_223,
2063 RT5640_IF_ALL,
2064};
2065
2066enum {
2067 RT5640_DMIC_DIS,
2068 RT5640_DMIC1,
2069 RT5640_DMIC2,
2070};
2071
2072struct rt5640_pll_code {
2073 bool m_bp; /* Indicates bypass m code or not. */
2074 int m_code;
2075 int n_code;
2076 int k_code;
2077};
2078
2079struct rt5640_priv {
2080 struct snd_soc_codec *codec;
2081
2082 int aif_pu;
2083 int sysclk;
2084 int sysclk_src;
2085 int lrck[RT5640_AIFS];
2086 int bclk[RT5640_AIFS];
2087 int master[RT5640_AIFS];
2088
2089 int pll_src;
2090 int pll_in;
2091 int pll_out;
2092
2093 int dmic_en;
2094 int dsp_sw;
2095};
2096
2097
2098#endif /* __RT5640_H__ */
diff --git a/sound/soc/codecs/second_rate_pps_driver.h b/sound/soc/codecs/second_rate_pps_driver.h
new file mode 100644
index 00000000000..c6c128a027d
--- /dev/null
+++ b/sound/soc/codecs/second_rate_pps_driver.h
@@ -0,0 +1,3626 @@
1//CONTROL LOCATIONS
2
3
4
5static control main44_MUX_controls[] = {
6};
7
8static char *main44_MUX_control_names[] = {
9};
10
11static control main44_VOLUME_controls[] = {
12};
13
14static char *main44_VOLUME_control_names[] = {
15};
16
17
18
19static char *main44_REG_Section_names[] = {
20 "miniDSP_A_reg_values",
21 "miniDSP_D_reg_values",
22};
23
24reg_value main44_REG_Section_init_program[] = {
25 { 0,0x0},
26 { 0x7F,0x00},
27// # Set AutoINC
28 {121,0x01},
29 { 0x7F,0x78},
30// # reg[120][0][50] = 0x88 ; Interpolation Ratio is 8, FIFO = Enabled
31 { 50,0x88},
32 { 0x7F,0x64},
33// # reg[100][0][50] = 0xa4 ; Decimation Ratio is 4, CIC AutoNorm = Enabled, FIFO = Enabled
34 { 50,0x84},
35 { 0x7F,0x78},
36// # reg[120][0][24]=0x80
37 { 24,0x80},
38 {255,0x00},
39};
40reg_value main44_REG_Section_post_program[] = {
41 { 0,0x0},
42 { 0x7F,0x28},
43// # reg[40][0][1] = 0x04 ; adaptive mode for ADC
44 { 1,0x04},
45 { 0x7F,0x50},
46// # reg[80][0][1] = 0x04 ; adaptive mode for DAC
47 { 1,0x04},
48 { 0x7F,0x64},
49// # reg[100][0][48] = 4;IDAC = 256 ; MDAC*DOSR;IADC = 256 ; MADC*AOSR;IDAC = 512 ; MDAC*DOSR;IADC = 512 ; MADC*AOSR;IDAC = 1024 ; MDAC*DOSR;IADC = 1024 ; MADC*AOSR;IDAC = 1536 ; MDAC*DOSR;IADC = 1536 ; MADC*AOSR;IDAC = 2048 ; MDAC*DOSR;IADC = 2048 ; MADC*AOSR;IDAC = 3072 ; MDAC*DOSR;IADC = 3072 ; MADC*AOSR;IDAC = 4096 ; MDAC*DOSR;IADC = 4096 ; MADC*AOSR;IDAC = 6144 ; MDAC*DOSR;IADC = 6144 ; MADC*AOSR
50 { 48,0x04},
51// # reg[100][0][49] = 0
52 { 49,0x00},
53 { 0x7F,0x78},
54// # reg[120][0][48] = 4
55 { 48,0x04},
56// # reg[120][0][49] = 0
57 { 49,0x00},
58 { 0,0x0},
59 { 0x7F,0x64},
60// # reg[100][0][20] = 0x80 ; Disable ADC double buffer mode; Disable DAC double buffer mode; Enable ADC double buffer mode
61 { 20,0x80},
62 { 0x7F,0x78},
63// # reg[120][0][20] = 0x80 ; Enable DAC double buffer mode
64 { 20,0x80},
65};
66
67reg_value main44_miniDSP_A_reg_values[] = {
68 { 0,0x0},
69 { 0x7F,0x28},
70 { 0,0x01},
71 { 8,0x01},
72 { 9,0xF0},
73 { 10,0x18},
74 { 11,0x00},
75 { 12,0x7C},
76 { 13,0x1F},
77 { 14,0xD0},
78 { 15,0x00},
79 { 16,0x7F},
80 { 17,0xFF},
81 { 18,0xFF},
82 { 19,0x00},
83 { 20,0x00},
84 { 21,0x00},
85 { 22,0x00},
86 { 23,0x00},
87 { 24,0x00},
88 { 25,0x00},
89 { 26,0x00},
90 { 27,0x00},
91 { 28,0x60},
92 { 29,0x00},
93 { 30,0x00},
94 { 31,0x00},
95 { 32,0x60},
96 { 33,0x00},
97 { 34,0x00},
98 { 35,0x00},
99 { 36,0xFF},
100 { 37,0xFF},
101 { 38,0xFF},
102 { 39,0x00},
103 { 40,0x80},
104 { 41,0x00},
105 { 42,0x00},
106 { 43,0x00},
107 { 44,0x7F},
108 { 45,0xFF},
109 { 46,0xFF},
110 { 47,0x00},
111 { 48,0x60},
112 { 49,0x00},
113 { 50,0x00},
114 { 51,0x00},
115 { 52,0x60},
116 { 53,0x00},
117 { 54,0x00},
118 { 55,0x00},
119 { 56,0x40},
120 { 57,0x00},
121 { 58,0x00},
122 { 59,0x00},
123 { 60,0x00},
124 { 61,0x00},
125 { 62,0x00},
126 { 63,0x00},
127 { 64,0xFF},
128 { 65,0x9E},
129 { 66,0x00},
130 { 67,0x00},
131 { 68,0x00},
132 { 69,0x00},
133 { 70,0x00},
134 { 71,0x00},
135 { 72,0x7F},
136 { 73,0xFF},
137 { 74,0xFF},
138 { 75,0x00},
139 { 76,0xF7},
140 { 77,0x10},
141 { 78,0x00},
142 { 79,0x00},
143 { 80,0x26},
144 { 81,0xF0},
145 { 82,0x00},
146 { 83,0x00},
147 { 84,0x02},
148 { 85,0x61},
149 { 86,0x00},
150 { 87,0x00},
151 { 88,0x40},
152 { 89,0x02},
153 { 90,0x00},
154 { 91,0x00},
155 { 92,0xFF},
156 { 93,0xFC},
157 { 94,0x00},
158 { 95,0x00},
159 { 96,0xFF},
160 { 97,0xFD},
161 { 98,0x00},
162 { 99,0x00},
163 {100,0xFF},
164 {101,0xE5},
165 {102,0x00},
166 {103,0x00},
167 {104,0xFF},
168 {105,0xA7},
169 {106,0x00},
170 {107,0x00},
171 {108,0xFF},
172 {109,0xC7},
173 {110,0x00},
174 {111,0x00},
175 {112,0xFF},
176 {113,0xCE},
177 {114,0x00},
178 {115,0x00},
179 {116,0xFF},
180 {117,0xFE},
181 {118,0x00},
182 {119,0x00},
183 {120,0xFE},
184 {121,0xF7},
185 {122,0x00},
186 {123,0x00},
187 {124,0xFF},
188 {125,0x46},
189 {126,0x00},
190 {127,0x00},
191 { 0,0x02},
192 { 8,0xFF},
193 { 9,0x22},
194 { 10,0x00},
195 { 11,0x00},
196 { 12,0xFF},
197 { 13,0x0F},
198 { 14,0x00},
199 { 15,0x00},
200 { 16,0xFA},
201 { 17,0x8C},
202 { 18,0x00},
203 { 19,0x00},
204 { 20,0xF5},
205 { 21,0x08},
206 { 22,0x00},
207 { 23,0x00},
208 { 24,0xFD},
209 { 25,0x92},
210 { 26,0x00},
211 { 27,0x00},
212 { 28,0xF3},
213 { 29,0xA3},
214 { 30,0x00},
215 { 31,0x00},
216 { 32,0x03},
217 { 33,0xB3},
218 { 34,0x00},
219 { 35,0x00},
220 { 36,0x00},
221 { 37,0x33},
222 { 38,0x00},
223 { 39,0x00},
224 { 40,0x00},
225 { 41,0x71},
226 { 42,0x00},
227 { 43,0x00},
228 { 44,0x40},
229 { 45,0x60},
230 { 46,0x00},
231 { 47,0x00},
232 { 48,0x00},
233 { 49,0xE2},
234 { 50,0x00},
235 { 51,0x00},
236 { 52,0x00},
237 { 53,0xC6},
238 { 54,0x00},
239 { 55,0x00},
240 { 56,0x00},
241 { 57,0x87},
242 { 58,0x00},
243 { 59,0x00},
244 { 60,0x00},
245 { 61,0x0F},
246 { 62,0x00},
247 { 63,0x00},
248 { 64,0x00},
249 { 65,0x0A},
250 { 66,0x00},
251 { 67,0x00},
252 { 68,0x00},
253 { 69,0x02},
254 { 70,0x00},
255 { 71,0x00},
256 { 72,0x01},
257 { 73,0x81},
258 { 74,0x00},
259 { 75,0x00},
260 { 76,0x18},
261 { 77,0x89},
262 { 78,0x00},
263 { 79,0x00},
264 { 80,0x07},
265 { 81,0xFB},
266 { 82,0x00},
267 { 83,0x00},
268 { 84,0x03},
269 { 85,0xBE},
270 { 86,0x00},
271 { 87,0x00},
272 { 88,0x00},
273 { 89,0x49},
274 { 90,0x00},
275 { 91,0x00},
276 { 92,0xFF},
277 { 93,0xF2},
278 { 94,0x00},
279 { 95,0x00},
280 { 96,0xF9},
281 { 97,0xBA},
282 { 98,0x00},
283 { 99,0x00},
284 {100,0xF9},
285 {101,0x00},
286 {102,0x00},
287 {103,0x00},
288 {104,0xFF},
289 {105,0x68},
290 {106,0x00},
291 {107,0x00},
292 {108,0xFE},
293 {109,0x2C},
294 {110,0x00},
295 {111,0x00},
296 {112,0xEB},
297 {113,0x8D},
298 {114,0x00},
299 {115,0x00},
300 {116,0x03},
301 {117,0x83},
302 {118,0x00},
303 {119,0x00},
304 {120,0x01},
305 {121,0xC3},
306 {122,0x00},
307 {123,0x00},
308 {124,0x00},
309 {125,0xD3},
310 {126,0x00},
311 {127,0x00},
312 { 0,0x03},
313 { 8,0x00},
314 { 9,0x33},
315 { 10,0x00},
316 { 11,0x00},
317 { 12,0x00},
318 { 13,0x02},
319 { 14,0x00},
320 { 15,0x00},
321 { 16,0x32},
322 { 17,0x08},
323 { 18,0x00},
324 { 19,0x00},
325 { 20,0x0A},
326 { 21,0xFA},
327 { 22,0x00},
328 { 23,0x00},
329 { 24,0x54},
330 { 25,0x7B},
331 { 26,0x00},
332 { 27,0x00},
333 { 28,0xFF},
334 { 29,0x6B},
335 { 30,0x00},
336 { 31,0x00},
337 { 32,0xFF},
338 { 33,0x03},
339 { 34,0x00},
340 { 35,0x00},
341 { 36,0xFC},
342 { 37,0xC6},
343 { 38,0x00},
344 { 39,0x00},
345 { 40,0xF5},
346 { 41,0x54},
347 { 42,0x00},
348 { 43,0x00},
349 { 44,0xF9},
350 { 45,0x64},
351 { 46,0x00},
352 { 47,0x00},
353 { 48,0x39},
354 { 49,0x80},
355 { 50,0x00},
356 { 51,0x00},
357 { 52,0x03},
358 { 53,0x1C},
359 { 54,0x00},
360 { 55,0x00},
361 { 56,0x03},
362 { 57,0x2F},
363 { 58,0x00},
364 { 59,0x00},
365 { 60,0x00},
366 { 61,0x67},
367 { 62,0x00},
368 { 63,0x00},
369 { 64,0x0F},
370 { 65,0x73},
371 { 66,0x00},
372 { 67,0x00},
373 { 68,0x2C},
374 { 69,0x2B},
375 { 70,0x00},
376 { 71,0x00},
377 { 0,0x09},
378 { 72,0x01},
379 { 73,0xF0},
380 { 74,0x18},
381 { 75,0x00},
382 { 76,0x7C},
383 { 77,0x1F},
384 { 78,0xD0},
385 { 79,0x00},
386 { 80,0x7F},
387 { 81,0xFF},
388 { 82,0xFF},
389 { 83,0x00},
390 { 84,0x00},
391 { 85,0x00},
392 { 86,0x00},
393 { 87,0x00},
394 { 88,0x00},
395 { 89,0x00},
396 { 90,0x00},
397 { 91,0x00},
398 { 92,0x60},
399 { 93,0x00},
400 { 94,0x00},
401 { 95,0x00},
402 { 96,0x60},
403 { 97,0x00},
404 { 98,0x00},
405 { 99,0x00},
406 {100,0xFF},
407 {101,0xFF},
408 {102,0xFF},
409 {103,0x00},
410 {104,0x80},
411 {105,0x00},
412 {106,0x00},
413 {107,0x00},
414 {108,0x7F},
415 {109,0xFF},
416 {110,0xFF},
417 {111,0x00},
418 {112,0x60},
419 {113,0x00},
420 {114,0x00},
421 {115,0x00},
422 {116,0x60},
423 {117,0x00},
424 {118,0x00},
425 {119,0x00},
426 {120,0x40},
427 {121,0x00},
428 {122,0x00},
429 {123,0x00},
430 {124,0x00},
431 {125,0x00},
432 {126,0x00},
433 {127,0x00},
434 { 0,0x0A},
435 { 8,0xFF},
436 { 9,0x9E},
437 { 10,0x00},
438 { 11,0x00},
439 { 12,0x00},
440 { 13,0x00},
441 { 14,0x00},
442 { 15,0x00},
443 { 16,0x7F},
444 { 17,0xFF},
445 { 18,0xFF},
446 { 19,0x00},
447 { 20,0xF7},
448 { 21,0x10},
449 { 22,0x00},
450 { 23,0x00},
451 { 24,0x26},
452 { 25,0xF0},
453 { 26,0x00},
454 { 27,0x00},
455 { 28,0x02},
456 { 29,0x61},
457 { 30,0x00},
458 { 31,0x00},
459 { 32,0x40},
460 { 33,0x02},
461 { 34,0x00},
462 { 35,0x00},
463 { 36,0xFF},
464 { 37,0xFC},
465 { 38,0x00},
466 { 39,0x00},
467 { 40,0xFF},
468 { 41,0xFD},
469 { 42,0x00},
470 { 43,0x00},
471 { 44,0xFF},
472 { 45,0xE5},
473 { 46,0x00},
474 { 47,0x00},
475 { 48,0xFF},
476 { 49,0xA7},
477 { 50,0x00},
478 { 51,0x00},
479 { 52,0xFF},
480 { 53,0xC7},
481 { 54,0x00},
482 { 55,0x00},
483 { 56,0xFF},
484 { 57,0xCE},
485 { 58,0x00},
486 { 59,0x00},
487 { 60,0xFF},
488 { 61,0xFE},
489 { 62,0x00},
490 { 63,0x00},
491 { 64,0xFE},
492 { 65,0xF7},
493 { 66,0x00},
494 { 67,0x00},
495 { 68,0xFF},
496 { 69,0x46},
497 { 70,0x00},
498 { 71,0x00},
499 { 72,0xFF},
500 { 73,0x22},
501 { 74,0x00},
502 { 75,0x00},
503 { 76,0xFF},
504 { 77,0x0F},
505 { 78,0x00},
506 { 79,0x00},
507 { 80,0xFA},
508 { 81,0x8C},
509 { 82,0x00},
510 { 83,0x00},
511 { 84,0xF5},
512 { 85,0x08},
513 { 86,0x00},
514 { 87,0x00},
515 { 88,0xFD},
516 { 89,0x92},
517 { 90,0x00},
518 { 91,0x00},
519 { 92,0xF3},
520 { 93,0xA3},
521 { 94,0x00},
522 { 95,0x00},
523 { 96,0x03},
524 { 97,0xB3},
525 { 98,0x00},
526 { 99,0x00},
527 {100,0x00},
528 {101,0x33},
529 {102,0x00},
530 {103,0x00},
531 {104,0x00},
532 {105,0x71},
533 {106,0x00},
534 {107,0x00},
535 {108,0x40},
536 {109,0x60},
537 {110,0x00},
538 {111,0x00},
539 {112,0x00},
540 {113,0xE2},
541 {114,0x00},
542 {115,0x00},
543 {116,0x00},
544 {117,0xC6},
545 {118,0x00},
546 {119,0x00},
547 {120,0x00},
548 {121,0x87},
549 {122,0x00},
550 {123,0x00},
551 {124,0x00},
552 {125,0x0F},
553 {126,0x00},
554 {127,0x00},
555 { 0,0x0B},
556 { 8,0x00},
557 { 9,0x0A},
558 { 10,0x00},
559 { 11,0x00},
560 { 12,0x00},
561 { 13,0x02},
562 { 14,0x00},
563 { 15,0x00},
564 { 16,0x01},
565 { 17,0x81},
566 { 18,0x00},
567 { 19,0x00},
568 { 20,0x18},
569 { 21,0x89},
570 { 22,0x00},
571 { 23,0x00},
572 { 24,0x07},
573 { 25,0xFB},
574 { 26,0x00},
575 { 27,0x00},
576 { 28,0x03},
577 { 29,0xBE},
578 { 30,0x00},
579 { 31,0x00},
580 { 32,0x00},
581 { 33,0x49},
582 { 34,0x00},
583 { 35,0x00},
584 { 36,0xFF},
585 { 37,0xF2},
586 { 38,0x00},
587 { 39,0x00},
588 { 40,0xF9},
589 { 41,0xBA},
590 { 42,0x00},
591 { 43,0x00},
592 { 44,0xF9},
593 { 45,0x00},
594 { 46,0x00},
595 { 47,0x00},
596 { 48,0xFF},
597 { 49,0x68},
598 { 50,0x00},
599 { 51,0x00},
600 { 52,0xFE},
601 { 53,0x2C},
602 { 54,0x00},
603 { 55,0x00},
604 { 56,0xEB},
605 { 57,0x8D},
606 { 58,0x00},
607 { 59,0x00},
608 { 60,0x03},
609 { 61,0x83},
610 { 62,0x00},
611 { 63,0x00},
612 { 64,0x01},
613 { 65,0xC3},
614 { 66,0x00},
615 { 67,0x00},
616 { 68,0x00},
617 { 69,0xD3},
618 { 70,0x00},
619 { 71,0x00},
620 { 72,0x00},
621 { 73,0x33},
622 { 74,0x00},
623 { 75,0x00},
624 { 76,0x00},
625 { 77,0x02},
626 { 78,0x00},
627 { 79,0x00},
628 { 80,0x32},
629 { 81,0x08},
630 { 82,0x00},
631 { 83,0x00},
632 { 84,0x0A},
633 { 85,0xFA},
634 { 86,0x00},
635 { 87,0x00},
636 { 88,0x54},
637 { 89,0x7B},
638 { 90,0x00},
639 { 91,0x00},
640 { 92,0xFF},
641 { 93,0x6B},
642 { 94,0x00},
643 { 95,0x00},
644 { 96,0xFF},
645 { 97,0x03},
646 { 98,0x00},
647 { 99,0x00},
648 {100,0xFC},
649 {101,0xC6},
650 {102,0x00},
651 {103,0x00},
652 {104,0xF5},
653 {105,0x54},
654 {106,0x00},
655 {107,0x00},
656 {108,0xF9},
657 {109,0x64},
658 {110,0x00},
659 {111,0x00},
660 {112,0x39},
661 {113,0x80},
662 {114,0x00},
663 {115,0x00},
664 {116,0x03},
665 {117,0x1C},
666 {118,0x00},
667 {119,0x00},
668 {120,0x03},
669 {121,0x2F},
670 {122,0x00},
671 {123,0x00},
672 {124,0x00},
673 {125,0x67},
674 {126,0x00},
675 {127,0x00},
676 { 0,0x0C},
677 { 8,0x0F},
678 { 9,0x73},
679 { 10,0x00},
680 { 11,0x00},
681 { 12,0x2C},
682 { 13,0x2B},
683 { 14,0x00},
684 { 15,0x00},
685 { 0,0x0},
686 { 0x7F,0x14},
687 { 0,0x01},
688 { 8,0xC0},
689 { 9,0x00},
690 { 10,0x00},
691 { 11,0x00},
692 { 12,0xC0},
693 { 13,0x00},
694 { 14,0x00},
695 { 15,0x00},
696 { 0,0x0},
697 { 0x7F,0x64},
698 { 0,0x01},
699 { 8,0x00},
700 { 9,0x00},
701 { 10,0x00},
702 { 11,0x00},
703 { 12,0x00},
704 { 13,0x00},
705 { 14,0x00},
706 { 15,0x00},
707 { 16,0x48},
708 { 17,0x02},
709 { 18,0x20},
710 { 19,0x00},
711 { 20,0x48},
712 { 21,0x02},
713 { 22,0x00},
714 { 23,0x00},
715 { 24,0x58},
716 { 25,0x60},
717 { 26,0x08},
718 { 27,0x00},
719 { 28,0x60},
720 { 29,0x60},
721 { 30,0x00},
722 { 31,0x00},
723 { 32,0x00},
724 { 33,0x00},
725 { 34,0x00},
726 { 35,0x00},
727 { 36,0x00},
728 { 37,0x00},
729 { 38,0x00},
730 { 39,0x00},
731 { 40,0x44},
732 { 41,0x00},
733 { 42,0xC0},
734 { 43,0x03},
735 { 44,0x00},
736 { 45,0x00},
737 { 46,0x00},
738 { 47,0x00},
739 { 48,0x00},
740 { 49,0x00},
741 { 50,0x00},
742 { 51,0x00},
743 { 52,0x44},
744 { 53,0x00},
745 { 54,0x00},
746 { 55,0x03},
747 { 56,0x21},
748 { 57,0x00},
749 { 58,0x00},
750 { 59,0x00},
751 { 60,0x03},
752 { 61,0x80},
753 { 62,0x00},
754 { 63,0x20},
755 { 64,0x00},
756 { 65,0x00},
757 { 66,0x00},
758 { 67,0x00},
759 { 68,0x45},
760 { 69,0x02},
761 { 70,0xA0},
762 { 71,0x00},
763 { 72,0x48},
764 { 73,0x05},
765 { 74,0x00},
766 { 75,0x00},
767 { 76,0x00},
768 { 77,0x00},
769 { 78,0x00},
770 { 79,0x00},
771 { 80,0x01},
772 { 81,0x00},
773 { 82,0xA0},
774 { 83,0x10},
775 { 84,0x00},
776 { 85,0x00},
777 { 86,0x00},
778 { 87,0x00},
779 { 88,0x45},
780 { 89,0x02},
781 { 90,0x80},
782 { 91,0x00},
783 { 92,0x58},
784 { 93,0x60},
785 { 94,0x08},
786 { 95,0x01},
787 { 96,0x60},
788 { 97,0x60},
789 { 98,0x00},
790 { 99,0x00},
791 {100,0x58},
792 {101,0x60},
793 {102,0x00},
794 {103,0x0D},
795 {104,0x00},
796 {105,0x00},
797 {106,0x00},
798 {107,0x00},
799 {108,0x44},
800 {109,0x00},
801 {110,0xC0},
802 {111,0x0B},
803 {112,0x04},
804 {113,0x00},
805 {114,0x00},
806 {115,0x00},
807 {116,0x04},
808 {117,0x00},
809 {118,0x20},
810 {119,0x51},
811 {120,0x04},
812 {121,0x00},
813 {122,0x00},
814 {123,0x0D},
815 {124,0x04},
816 {125,0x00},
817 {126,0x20},
818 {127,0x5E},
819 { 0,0x02},
820 { 8,0x04},
821 { 9,0x00},
822 { 10,0x00},
823 { 11,0x08},
824 { 12,0x04},
825 { 13,0x00},
826 { 14,0x20},
827 { 15,0x59},
828 { 16,0x04},
829 { 17,0x00},
830 { 18,0x00},
831 { 19,0x04},
832 { 20,0x04},
833 { 21,0x00},
834 { 22,0x20},
835 { 23,0x55},
836 { 24,0x00},
837 { 25,0x00},
838 { 26,0x00},
839 { 27,0x00},
840 { 28,0x00},
841 { 29,0x00},
842 { 30,0x00},
843 { 31,0x00},
844 { 32,0x44},
845 { 33,0x00},
846 { 34,0x00},
847 { 35,0x0B},
848 { 36,0x21},
849 { 37,0x00},
850 { 38,0x20},
851 { 39,0x00},
852 { 40,0x4B},
853 { 41,0x00},
854 { 42,0xC0},
855 { 43,0x00},
856 { 44,0x4B},
857 { 45,0x00},
858 { 46,0xE0},
859 { 47,0x00},
860 { 48,0x10},
861 { 49,0x00},
862 { 50,0x00},
863 { 51,0x00},
864 { 52,0x10},
865 { 53,0x00},
866 { 54,0x00},
867 { 55,0x51},
868 { 56,0x10},
869 { 57,0x00},
870 { 58,0x00},
871 { 59,0x0D},
872 { 60,0x10},
873 { 61,0x00},
874 { 62,0x00},
875 { 63,0x5E},
876 { 64,0x10},
877 { 65,0x00},
878 { 66,0x00},
879 { 67,0x08},
880 { 68,0x10},
881 { 69,0x00},
882 { 70,0x00},
883 { 71,0x59},
884 { 72,0x10},
885 { 73,0x00},
886 { 74,0x00},
887 { 75,0x04},
888 { 76,0x10},
889 { 77,0x00},
890 { 78,0x00},
891 { 79,0x55},
892 { 80,0x18},
893 { 81,0x02},
894 { 82,0x80},
895 { 83,0x0F},
896 { 84,0x1C},
897 { 85,0x02},
898 { 86,0x60},
899 { 87,0x09},
900 { 88,0x1C},
901 { 89,0x02},
902 { 90,0x60},
903 { 91,0x03},
904 { 92,0x1C},
905 { 93,0x02},
906 { 94,0x40},
907 { 95,0x0A},
908 { 96,0x1C},
909 { 97,0x02},
910 { 98,0x40},
911 { 99,0x02},
912 {100,0x1C},
913 {101,0x02},
914 {102,0x20},
915 {103,0x01},
916 {104,0x1C},
917 {105,0x02},
918 {106,0x20},
919 {107,0x0B},
920 {108,0x1C},
921 {109,0x01},
922 {110,0xC0},
923 {111,0x0C},
924 {112,0x1C},
925 {113,0x01},
926 {114,0xC0},
927 {115,0x00},
928 {116,0x18},
929 {117,0x01},
930 {118,0xC0},
931 {119,0x5D},
932 {120,0x1C},
933 {121,0x01},
934 {122,0xC0},
935 {123,0x51},
936 {124,0x1C},
937 {125,0x02},
938 {126,0x20},
939 {127,0x52},
940 { 0,0x03},
941 { 8,0x10},
942 { 9,0x00},
943 { 10,0x00},
944 { 11,0x2D},
945 { 12,0x1C},
946 { 13,0x02},
947 { 14,0x20},
948 { 15,0x5C},
949 { 16,0x1C},
950 { 17,0x02},
951 { 18,0x40},
952 { 19,0x5B},
953 { 20,0x1C},
954 { 21,0x02},
955 { 22,0x40},
956 { 23,0x53},
957 { 24,0x1C},
958 { 25,0x02},
959 { 26,0x60},
960 { 27,0x5A},
961 { 28,0x1C},
962 { 29,0x02},
963 { 30,0x60},
964 { 31,0x54},
965 { 32,0x1C},
966 { 33,0x02},
967 { 34,0x80},
968 { 35,0x60},
969 { 36,0x00},
970 { 37,0x00},
971 { 38,0x00},
972 { 39,0x00},
973 { 40,0x00},
974 { 41,0x00},
975 { 42,0x00},
976 { 43,0x00},
977 { 44,0x00},
978 { 45,0x00},
979 { 46,0x00},
980 { 47,0x00},
981 { 48,0x10},
982 { 49,0x00},
983 { 50,0x00},
984 { 51,0x7E},
985 { 52,0x18},
986 { 53,0x02},
987 { 54,0xA0},
988 { 55,0x2C},
989 { 56,0x1C},
990 { 57,0x02},
991 { 58,0xA0},
992 { 59,0x2D},
993 { 60,0x1C},
994 { 61,0x02},
995 { 62,0xC0},
996 { 63,0x11},
997 { 64,0x1C},
998 { 65,0x02},
999 { 66,0xC0},
1000 { 67,0x48},
1001 { 68,0x1C},
1002 { 69,0x02},
1003 { 70,0xE0},
1004 { 71,0x2F},
1005 { 72,0x1C},
1006 { 73,0x02},
1007 { 74,0xE0},
1008 { 75,0x2A},
1009 { 76,0x1C},
1010 { 77,0x03},
1011 { 78,0x00},
1012 { 79,0x31},
1013 { 80,0x1C},
1014 { 81,0x03},
1015 { 82,0x00},
1016 { 83,0x28},
1017 { 84,0x1C},
1018 { 85,0x03},
1019 { 86,0x20},
1020 { 87,0x37},
1021 { 88,0x1C},
1022 { 89,0x03},
1023 { 90,0x20},
1024 { 91,0x22},
1025 { 92,0x1C},
1026 { 93,0x03},
1027 { 94,0x40},
1028 { 95,0x14},
1029 { 96,0x1C},
1030 { 97,0x03},
1031 { 98,0x40},
1032 { 99,0x45},
1033 {100,0x1C},
1034 {101,0x03},
1035 {102,0x60},
1036 {103,0x12},
1037 {104,0x1C},
1038 {105,0x03},
1039 {106,0x60},
1040 {107,0x47},
1041 {108,0x1C},
1042 {109,0x03},
1043 {110,0x80},
1044 {111,0x38},
1045 {112,0x1C},
1046 {113,0x03},
1047 {114,0x80},
1048 {115,0x21},
1049 {116,0x1C},
1050 {117,0x03},
1051 {118,0xA0},
1052 {119,0x33},
1053 {120,0x1C},
1054 {121,0x03},
1055 {122,0xA0},
1056 {123,0x26},
1057 {124,0x1C},
1058 {125,0x03},
1059 {126,0xC0},
1060 {127,0x16},
1061 { 0,0x04},
1062 { 8,0x1C},
1063 { 9,0x03},
1064 { 10,0xC0},
1065 { 11,0x43},
1066 { 12,0x1C},
1067 { 13,0x03},
1068 { 14,0xE0},
1069 { 15,0x35},
1070 { 16,0x1C},
1071 { 17,0x03},
1072 { 18,0xE0},
1073 { 19,0x24},
1074 { 20,0x1C},
1075 { 21,0x04},
1076 { 22,0x00},
1077 { 23,0x1A},
1078 { 24,0x1C},
1079 { 25,0x04},
1080 { 26,0x00},
1081 { 27,0x3F},
1082 { 28,0x1C},
1083 { 29,0x04},
1084 { 30,0x20},
1085 { 31,0x3A},
1086 { 32,0x1C},
1087 { 33,0x04},
1088 { 34,0x20},
1089 { 35,0x1F},
1090 { 36,0x1C},
1091 { 37,0x04},
1092 { 38,0x40},
1093 { 39,0x18},
1094 { 40,0x1C},
1095 { 41,0x04},
1096 { 42,0x40},
1097 { 43,0x41},
1098 { 44,0x1C},
1099 { 45,0x04},
1100 { 46,0x60},
1101 { 47,0x1C},
1102 { 48,0x1C},
1103 { 49,0x04},
1104 { 50,0x60},
1105 { 51,0x3D},
1106 { 52,0x1C},
1107 { 53,0x04},
1108 { 54,0x80},
1109 { 55,0x19},
1110 { 56,0x1C},
1111 { 57,0x04},
1112 { 58,0x80},
1113 { 59,0x40},
1114 { 60,0x1C},
1115 { 61,0x04},
1116 { 62,0xA0},
1117 { 63,0x30},
1118 { 64,0x1C},
1119 { 65,0x04},
1120 { 66,0xA0},
1121 { 67,0x29},
1122 { 68,0x1C},
1123 { 69,0x04},
1124 { 70,0xC0},
1125 { 71,0x15},
1126 { 72,0x1C},
1127 { 73,0x04},
1128 { 74,0xC0},
1129 { 75,0x44},
1130 { 76,0x1C},
1131 { 77,0x04},
1132 { 78,0xE0},
1133 { 79,0x3B},
1134 { 80,0x1C},
1135 { 81,0x04},
1136 { 82,0xE0},
1137 { 83,0x1E},
1138 { 84,0x1C},
1139 { 85,0x05},
1140 { 86,0x00},
1141 { 87,0x34},
1142 { 88,0x1C},
1143 { 89,0x05},
1144 { 90,0x00},
1145 { 91,0x25},
1146 { 92,0x1C},
1147 { 93,0x05},
1148 { 94,0x20},
1149 { 95,0x36},
1150 { 96,0x1C},
1151 { 97,0x05},
1152 { 98,0x20},
1153 { 99,0x23},
1154 {100,0x1C},
1155 {101,0x05},
1156 {102,0x40},
1157 {103,0x32},
1158 {104,0x1C},
1159 {105,0x05},
1160 {106,0x40},
1161 {107,0x27},
1162 {108,0x1C},
1163 {109,0x05},
1164 {110,0x60},
1165 {111,0x13},
1166 {112,0x1C},
1167 {113,0x05},
1168 {114,0x60},
1169 {115,0x46},
1170 {116,0x1C},
1171 {117,0x05},
1172 {118,0x80},
1173 {119,0x2E},
1174 {120,0x1C},
1175 {121,0x05},
1176 {122,0x80},
1177 {123,0x2B},
1178 {124,0x1C},
1179 {125,0x05},
1180 {126,0xA0},
1181 {127,0x10},
1182 { 0,0x05},
1183 { 8,0x1C},
1184 { 9,0x05},
1185 { 10,0xA0},
1186 { 11,0x49},
1187 { 12,0x1C},
1188 { 13,0x05},
1189 { 14,0xC0},
1190 { 15,0x17},
1191 { 16,0x1C},
1192 { 17,0x05},
1193 { 18,0xC0},
1194 { 19,0x42},
1195 { 20,0x1C},
1196 { 21,0x05},
1197 { 22,0xE0},
1198 { 23,0x1D},
1199 { 24,0x1C},
1200 { 25,0x05},
1201 { 26,0xE0},
1202 { 27,0x3C},
1203 { 28,0x1C},
1204 { 29,0x06},
1205 { 30,0x00},
1206 { 31,0x1B},
1207 { 32,0x1C},
1208 { 33,0x06},
1209 { 34,0x00},
1210 { 35,0x3E},
1211 { 36,0x1C},
1212 { 37,0x06},
1213 { 38,0x20},
1214 { 39,0x39},
1215 { 40,0x1C},
1216 { 41,0x06},
1217 { 42,0x20},
1218 { 43,0x20},
1219 { 44,0x00},
1220 { 45,0x00},
1221 { 46,0x00},
1222 { 47,0x00},
1223 { 48,0x5C},
1224 { 49,0x90},
1225 { 50,0x40},
1226 { 51,0x00},
1227 { 52,0x00},
1228 { 53,0x00},
1229 { 54,0x00},
1230 { 55,0x00},
1231 { 56,0x5C},
1232 { 57,0x90},
1233 { 58,0x20},
1234 { 59,0x00},
1235 { 60,0x00},
1236 { 61,0x00},
1237 { 62,0x00},
1238 { 63,0x00},
1239 { 64,0x00},
1240 { 65,0x00},
1241 { 66,0x00},
1242 { 67,0x00},
1243 { 68,0x00},
1244 { 69,0x00},
1245 { 70,0x00},
1246 { 71,0x00},
1247 { 72,0x10},
1248 { 73,0x00},
1249 { 74,0x00},
1250 { 75,0x49},
1251 { 76,0x18},
1252 { 77,0x02},
1253 { 78,0x80},
1254 { 79,0x57},
1255 { 80,0x1C},
1256 { 81,0x02},
1257 { 82,0x60},
1258 { 83,0x51},
1259 { 84,0x1C},
1260 { 85,0x02},
1261 { 86,0x60},
1262 { 87,0x5C},
1263 { 88,0x1C},
1264 { 89,0x02},
1265 { 90,0x40},
1266 { 91,0x52},
1267 { 92,0x1C},
1268 { 93,0x02},
1269 { 94,0x40},
1270 { 95,0x5B},
1271 { 96,0x1C},
1272 { 97,0x02},
1273 { 98,0x20},
1274 { 99,0x5A},
1275 {100,0x1C},
1276 {101,0x02},
1277 {102,0x20},
1278 {103,0x53},
1279 {104,0x1C},
1280 {105,0x01},
1281 {106,0xC0},
1282 {107,0x54},
1283 {108,0x1C},
1284 {109,0x01},
1285 {110,0xC0},
1286 {111,0x59},
1287 {112,0x18},
1288 {113,0x01},
1289 {114,0xC0},
1290 {115,0x03},
1291 {116,0x1C},
1292 {117,0x01},
1293 {118,0xC0},
1294 {119,0x08},
1295 {120,0x1C},
1296 {121,0x02},
1297 {122,0x20},
1298 {123,0x09},
1299 {124,0x10},
1300 {125,0x00},
1301 {126,0x00},
1302 {127,0x60},
1303 { 0,0x06},
1304 { 8,0x1C},
1305 { 9,0x02},
1306 { 10,0x20},
1307 { 11,0x02},
1308 { 12,0x1C},
1309 { 13,0x02},
1310 { 14,0x40},
1311 { 15,0x01},
1312 { 16,0x1C},
1313 { 17,0x02},
1314 { 18,0x40},
1315 { 19,0x0A},
1316 { 20,0x1C},
1317 { 21,0x02},
1318 { 22,0x60},
1319 { 23,0x00},
1320 { 24,0x1C},
1321 { 25,0x02},
1322 { 26,0x60},
1323 { 27,0x0B},
1324 { 28,0x1C},
1325 { 29,0x02},
1326 { 30,0x80},
1327 { 31,0x06},
1328 { 32,0x00},
1329 { 33,0x00},
1330 { 34,0x00},
1331 { 35,0x00},
1332 { 36,0x00},
1333 { 37,0x00},
1334 { 38,0x00},
1335 { 39,0x00},
1336 { 40,0x00},
1337 { 41,0x00},
1338 { 42,0x00},
1339 { 43,0x00},
1340 { 44,0x10},
1341 { 45,0x00},
1342 { 46,0x00},
1343 { 47,0x0F},
1344 { 48,0x18},
1345 { 49,0x02},
1346 { 50,0xA0},
1347 { 51,0x7D},
1348 { 52,0x1C},
1349 { 53,0x02},
1350 { 54,0xA0},
1351 { 55,0x7E},
1352 { 56,0x1C},
1353 { 57,0x02},
1354 { 58,0xC0},
1355 { 59,0x62},
1356 { 60,0x1C},
1357 { 61,0x02},
1358 { 62,0xC0},
1359 { 63,0x99},
1360 { 64,0x1C},
1361 { 65,0x02},
1362 { 66,0xE0},
1363 { 67,0x80},
1364 { 68,0x1C},
1365 { 69,0x02},
1366 { 70,0xE0},
1367 { 71,0x7B},
1368 { 72,0x1C},
1369 { 73,0x03},
1370 { 74,0x00},
1371 { 75,0x82},
1372 { 76,0x1C},
1373 { 77,0x03},
1374 { 78,0x00},
1375 { 79,0x79},
1376 { 80,0x1C},
1377 { 81,0x03},
1378 { 82,0x20},
1379 { 83,0x88},
1380 { 84,0x1C},
1381 { 85,0x03},
1382 { 86,0x20},
1383 { 87,0x73},
1384 { 88,0x1C},
1385 { 89,0x03},
1386 { 90,0x40},
1387 { 91,0x65},
1388 { 92,0x1C},
1389 { 93,0x03},
1390 { 94,0x40},
1391 { 95,0x96},
1392 { 96,0x1C},
1393 { 97,0x03},
1394 { 98,0x60},
1395 { 99,0x63},
1396 {100,0x1C},
1397 {101,0x03},
1398 {102,0x60},
1399 {103,0x98},
1400 {104,0x1C},
1401 {105,0x03},
1402 {106,0x80},
1403 {107,0x89},
1404 {108,0x1C},
1405 {109,0x03},
1406 {110,0x80},
1407 {111,0x72},
1408 {112,0x1C},
1409 {113,0x03},
1410 {114,0xA0},
1411 {115,0x84},
1412 {116,0x1C},
1413 {117,0x03},
1414 {118,0xA0},
1415 {119,0x77},
1416 {120,0x1C},
1417 {121,0x03},
1418 {122,0xC0},
1419 {123,0x67},
1420 {124,0x1C},
1421 {125,0x03},
1422 {126,0xC0},
1423 {127,0x94},
1424 { 0,0x07},
1425 { 8,0x1C},
1426 { 9,0x03},
1427 { 10,0xE0},
1428 { 11,0x86},
1429 { 12,0x1C},
1430 { 13,0x03},
1431 { 14,0xE0},
1432 { 15,0x75},
1433 { 16,0x1C},
1434 { 17,0x04},
1435 { 18,0x00},
1436 { 19,0x6B},
1437 { 20,0x1C},
1438 { 21,0x04},
1439 { 22,0x00},
1440 { 23,0x90},
1441 { 24,0x1C},
1442 { 25,0x04},
1443 { 26,0x20},
1444 { 27,0x8B},
1445 { 28,0x1C},
1446 { 29,0x04},
1447 { 30,0x20},
1448 { 31,0x70},
1449 { 32,0x1C},
1450 { 33,0x04},
1451 { 34,0x40},
1452 { 35,0x69},
1453 { 36,0x1C},
1454 { 37,0x04},
1455 { 38,0x40},
1456 { 39,0x92},
1457 { 40,0x1C},
1458 { 41,0x04},
1459 { 42,0x60},
1460 { 43,0x6D},
1461 { 44,0x1C},
1462 { 45,0x04},
1463 { 46,0x60},
1464 { 47,0x8E},
1465 { 48,0x1C},
1466 { 49,0x04},
1467 { 50,0x80},
1468 { 51,0x6A},
1469 { 52,0x1C},
1470 { 53,0x04},
1471 { 54,0x80},
1472 { 55,0x91},
1473 { 56,0x1C},
1474 { 57,0x04},
1475 { 58,0xA0},
1476 { 59,0x81},
1477 { 60,0x1C},
1478 { 61,0x04},
1479 { 62,0xA0},
1480 { 63,0x7A},
1481 { 64,0x1C},
1482 { 65,0x04},
1483 { 66,0xC0},
1484 { 67,0x66},
1485 { 68,0x1C},
1486 { 69,0x04},
1487 { 70,0xC0},
1488 { 71,0x95},
1489 { 72,0x1C},
1490 { 73,0x04},
1491 { 74,0xE0},
1492 { 75,0x8C},
1493 { 76,0x1C},
1494 { 77,0x04},
1495 { 78,0xE0},
1496 { 79,0x6F},
1497 { 80,0x1C},
1498 { 81,0x05},
1499 { 82,0x00},
1500 { 83,0x85},
1501 { 84,0x1C},
1502 { 85,0x05},
1503 { 86,0x00},
1504 { 87,0x76},
1505 { 88,0x1C},
1506 { 89,0x05},
1507 { 90,0x20},
1508 { 91,0x87},
1509 { 92,0x1C},
1510 { 93,0x05},
1511 { 94,0x20},
1512 { 95,0x74},
1513 { 96,0x1C},
1514 { 97,0x05},
1515 { 98,0x40},
1516 { 99,0x83},
1517 {100,0x1C},
1518 {101,0x05},
1519 {102,0x40},
1520 {103,0x78},
1521 {104,0x1C},
1522 {105,0x05},
1523 {106,0x60},
1524 {107,0x64},
1525 {108,0x1C},
1526 {109,0x05},
1527 {110,0x60},
1528 {111,0x97},
1529 {112,0x1C},
1530 {113,0x05},
1531 {114,0x80},
1532 {115,0x7F},
1533 {116,0x1C},
1534 {117,0x05},
1535 {118,0x80},
1536 {119,0x7C},
1537 {120,0x1C},
1538 {121,0x05},
1539 {122,0xA0},
1540 {123,0x61},
1541 {124,0x1C},
1542 {125,0x05},
1543 {126,0xA0},
1544 {127,0x9A},
1545 { 0,0x08},
1546 { 8,0x1C},
1547 { 9,0x05},
1548 { 10,0xC0},
1549 { 11,0x68},
1550 { 12,0x1C},
1551 { 13,0x05},
1552 { 14,0xC0},
1553 { 15,0x93},
1554 { 16,0x1C},
1555 { 17,0x05},
1556 { 18,0xE0},
1557 { 19,0x6E},
1558 { 20,0x1C},
1559 { 21,0x05},
1560 { 22,0xE0},
1561 { 23,0x8D},
1562 { 24,0x1C},
1563 { 25,0x06},
1564 { 26,0x00},
1565 { 27,0x6C},
1566 { 28,0x1C},
1567 { 29,0x06},
1568 { 30,0x00},
1569 { 31,0x8F},
1570 { 32,0x1C},
1571 { 33,0x06},
1572 { 34,0x20},
1573 { 35,0x8A},
1574 { 36,0x1C},
1575 { 37,0x06},
1576 { 38,0x20},
1577 { 39,0x71},
1578 { 40,0x00},
1579 { 41,0x00},
1580 { 42,0x00},
1581 { 43,0x00},
1582 { 44,0x5C},
1583 { 45,0x90},
1584 { 46,0x80},
1585 { 47,0x00},
1586 { 48,0x00},
1587 { 49,0x00},
1588 { 50,0x00},
1589 { 51,0x00},
1590 { 52,0x5C},
1591 { 53,0x90},
1592 { 54,0x60},
1593 { 55,0x00},
1594 { 56,0x00},
1595 { 57,0x00},
1596 { 58,0x00},
1597 { 59,0x00},
1598 { 60,0x00},
1599 { 61,0x00},
1600 { 62,0x00},
1601 { 63,0x00},
1602 { 64,0x00},
1603 { 65,0x00},
1604 { 66,0x00},
1605 { 67,0x00},
1606 { 68,0x10},
1607 { 69,0x00},
1608 { 70,0x00},
1609 { 71,0x9A},
1610 { 72,0x18},
1611 { 73,0x00},
1612 { 74,0x60},
1613 { 75,0x4A},
1614 { 76,0x1C},
1615 { 77,0x00},
1616 { 78,0x80},
1617 { 79,0x4C},
1618 { 80,0x1C},
1619 { 81,0x00},
1620 { 82,0x40},
1621 { 83,0x49},
1622 { 84,0x30},
1623 { 85,0x00},
1624 { 86,0x00},
1625 { 87,0x4C},
1626 { 88,0x1C},
1627 { 89,0x00},
1628 { 90,0x20},
1629 { 91,0x4E},
1630 { 92,0x00},
1631 { 93,0x00},
1632 { 94,0x00},
1633 { 95,0x00},
1634 { 96,0x10},
1635 { 97,0x30},
1636 { 98,0x00},
1637 { 99,0x4B},
1638 {100,0x34},
1639 {101,0x00},
1640 {102,0x00},
1641 {103,0x4B},
1642 {104,0x18},
1643 {105,0x00},
1644 {106,0x60},
1645 {107,0x9B},
1646 {108,0x0C},
1647 {109,0x00},
1648 {110,0x40},
1649 {111,0x00},
1650 {112,0x1C},
1651 {113,0x00},
1652 {114,0x80},
1653 {115,0x9D},
1654 {116,0x10},
1655 {117,0x30},
1656 {118,0x00},
1657 {119,0x4D},
1658 {120,0x1C},
1659 {121,0x00},
1660 {122,0x40},
1661 {123,0x9A},
1662 {124,0x30},
1663 {125,0x00},
1664 {126,0x00},
1665 {127,0x9D},
1666 { 0,0x09},
1667 { 8,0x1C},
1668 { 9,0x00},
1669 { 10,0x20},
1670 { 11,0x9F},
1671 { 12,0x00},
1672 { 13,0x00},
1673 { 14,0x00},
1674 { 15,0x00},
1675 { 16,0x10},
1676 { 17,0x30},
1677 { 18,0x00},
1678 { 19,0x9C},
1679 { 20,0x34},
1680 { 21,0x00},
1681 { 22,0x00},
1682 { 23,0x9C},
1683 { 24,0x5C},
1684 { 25,0x60},
1685 { 26,0xC0},
1686 { 27,0x9C},
1687 { 28,0x0C},
1688 { 29,0x00},
1689 { 30,0x60},
1690 { 31,0x00},
1691 { 32,0x5C},
1692 { 33,0x60},
1693 { 34,0xA0},
1694 { 35,0x4B},
1695 { 36,0x10},
1696 { 37,0x30},
1697 { 38,0x00},
1698 { 39,0x9E},
1699 { 40,0x10},
1700 { 41,0x13},
1701 { 42,0xE0},
1702 { 43,0xA1},
1703 { 44,0x00},
1704 { 45,0x00},
1705 { 46,0x00},
1706 { 47,0x00},
1707 { 48,0x10},
1708 { 49,0x13},
1709 { 50,0xE0},
1710 { 51,0x50},
1711 { 52,0x18},
1712 { 53,0x00},
1713 { 54,0xA0},
1714 { 55,0x50},
1715 { 56,0x1C},
1716 { 57,0x00},
1717 { 58,0xC0},
1718 { 59,0xA1},
1719 { 60,0x00},
1720 { 61,0x00},
1721 { 62,0x00},
1722 { 63,0x00},
1723 { 64,0x00},
1724 { 65,0x00},
1725 { 66,0x00},
1726 { 67,0x00},
1727 { 68,0x00},
1728 { 69,0x00},
1729 { 70,0x00},
1730 { 71,0x00},
1731 { 72,0x10},
1732 { 73,0x00},
1733 { 74,0x00},
1734 { 75,0xA2},
1735 { 76,0x05},
1736 { 77,0x00},
1737 { 78,0x00},
1738 { 79,0xA3},
1739 { 80,0x05},
1740 { 81,0x00},
1741 { 82,0x20},
1742 { 83,0xA4},
1743 { 84,0x18},
1744 { 85,0x01},
1745 { 86,0x40},
1746 { 87,0xA4},
1747 { 88,0x1C},
1748 { 89,0x01},
1749 { 90,0x60},
1750 { 91,0xA2},
1751 { 92,0x00},
1752 { 93,0x00},
1753 { 94,0x00},
1754 { 95,0x00},
1755 { 96,0x00},
1756 { 97,0x00},
1757 { 98,0x00},
1758 { 99,0x00},
1759 {100,0x00},
1760 {101,0x00},
1761 {102,0x00},
1762 {103,0x00},
1763 {104,0x10},
1764 {105,0x00},
1765 {106,0x00},
1766 {107,0xA5},
1767 {108,0x18},
1768 {109,0x01},
1769 {110,0x80},
1770 {111,0xA5},
1771 {112,0x18},
1772 {113,0x01},
1773 {114,0x80},
1774 {115,0xA5},
1775 {116,0x0C},
1776 {117,0x00},
1777 {118,0x00},
1778 {119,0x03},
1779 {120,0x0C},
1780 {121,0x00},
1781 {122,0x20},
1782 {123,0x03},
1783 {124,0x18},
1784 {125,0x01},
1785 {126,0xE0},
1786 {127,0xA3},
1787 { 0,0x0A},
1788 { 8,0x1C},
1789 { 9,0x02},
1790 { 10,0x00},
1791 { 11,0xA2},
1792 { 12,0x00},
1793 { 13,0x00},
1794 { 14,0x00},
1795 { 15,0x00},
1796 { 16,0x00},
1797 { 17,0x00},
1798 { 18,0x00},
1799 { 19,0x00},
1800 { 20,0x00},
1801 { 21,0x00},
1802 { 22,0x00},
1803 { 23,0x00},
1804 { 24,0x10},
1805 { 25,0x00},
1806 { 26,0x00},
1807 { 27,0xA6},
1808 { 28,0x18},
1809 { 29,0x01},
1810 { 30,0x80},
1811 { 31,0xA6},
1812 { 32,0x18},
1813 { 33,0x01},
1814 { 34,0x80},
1815 { 35,0xA6},
1816 { 36,0x0C},
1817 { 37,0x02},
1818 { 38,0x00},
1819 { 39,0x03},
1820 { 40,0x0C},
1821 { 41,0x02},
1822 { 42,0x20},
1823 { 43,0x03},
1824 { 44,0x00},
1825 { 45,0x00},
1826 { 46,0x00},
1827 { 47,0x00},
1828 { 48,0x00},
1829 { 49,0x00},
1830 { 50,0x00},
1831 { 51,0x00},
1832 { 52,0x00},
1833 { 53,0x00},
1834 { 54,0x00},
1835 { 55,0x00},
1836 { 56,0x02},
1837 { 57,0x00},
1838 { 58,0x00},
1839 { 59,0x00},
1840 { 60,0x00},
1841 { 61,0x00},
1842 { 62,0x00},
1843 { 63,0x00},
1844};
1845#define main44_miniDSP_A_reg_values_COEFF_START 0
1846#define main44_miniDSP_A_reg_values_COEFF_SIZE 628
1847#define main44_miniDSP_A_reg_values_INST_START 628
1848#define main44_miniDSP_A_reg_values_INST_SIZE 1148
1849
1850reg_value main44_miniDSP_D_reg_values[] = {
1851 { 0,0x0},
1852 { 0x7F,0x50},
1853 { 0,0x01},
1854 { 8,0xFF},
1855 { 9,0xFF},
1856 { 10,0xFF},
1857 { 11,0x00},
1858 { 12,0x80},
1859 { 13,0x00},
1860 { 14,0x00},
1861 { 15,0x00},
1862 { 16,0x7F},
1863 { 17,0xF7},
1864 { 18,0x00},
1865 { 19,0x00},
1866 { 20,0x80},
1867 { 21,0x09},
1868 { 22,0x00},
1869 { 23,0x00},
1870 { 24,0x7F},
1871 { 25,0xEF},
1872 { 26,0x00},
1873 { 27,0x00},
1874 { 28,0x60},
1875 { 29,0x00},
1876 { 30,0x00},
1877 { 31,0x00},
1878 { 32,0x60},
1879 { 33,0x00},
1880 { 34,0x00},
1881 { 35,0x00},
1882 { 36,0x40},
1883 { 37,0x00},
1884 { 38,0x00},
1885 { 39,0x00},
1886 { 40,0x7F},
1887 { 41,0xFF},
1888 { 42,0xFF},
1889 { 43,0x00},
1890 { 44,0x00},
1891 { 45,0x00},
1892 { 46,0x00},
1893 { 47,0x00},
1894 { 48,0x60},
1895 { 49,0x00},
1896 { 50,0x00},
1897 { 51,0x00},
1898 { 52,0x60},
1899 { 53,0x00},
1900 { 54,0x00},
1901 { 55,0x00},
1902 { 56,0x00},
1903 { 57,0x0D},
1904 { 58,0x00},
1905 { 59,0x00},
1906 { 60,0x00},
1907 { 61,0x1C},
1908 { 62,0x00},
1909 { 63,0x00},
1910 { 64,0x00},
1911 { 65,0x3E},
1912 { 66,0x00},
1913 { 67,0x00},
1914 { 68,0x40},
1915 { 69,0x00},
1916 { 70,0x00},
1917 { 71,0x00},
1918 { 72,0x60},
1919 { 73,0x00},
1920 { 74,0x00},
1921 { 75,0x00},
1922 { 76,0x00},
1923 { 77,0x78},
1924 { 78,0x00},
1925 { 79,0x00},
1926 { 80,0x02},
1927 { 81,0x4C},
1928 { 82,0x00},
1929 { 83,0x00},
1930 { 84,0x00},
1931 { 85,0xD5},
1932 { 86,0x00},
1933 { 87,0x00},
1934 { 88,0x01},
1935 { 89,0x65},
1936 { 90,0x00},
1937 { 91,0x00},
1938 { 92,0x03},
1939 { 93,0xE9},
1940 { 94,0x00},
1941 { 95,0x00},
1942 { 96,0x07},
1943 { 97,0xCA},
1944 { 98,0x00},
1945 { 99,0x00},
1946 {100,0xFF},
1947 {101,0xEF},
1948 {102,0x00},
1949 {103,0x00},
1950 {104,0xFE},
1951 {105,0xEB},
1952 {106,0x00},
1953 {107,0x00},
1954 {108,0xFF},
1955 {109,0xA8},
1956 {110,0x00},
1957 {111,0x00},
1958 {112,0xFD},
1959 {113,0x08},
1960 {114,0x00},
1961 {115,0x00},
1962 {116,0xFF},
1963 {117,0x5E},
1964 {118,0x00},
1965 {119,0x00},
1966 {120,0xFF},
1967 {121,0xD5},
1968 {122,0x00},
1969 {123,0x00},
1970 {124,0xFE},
1971 {125,0x36},
1972 {126,0x00},
1973 {127,0x00},
1974 { 0,0x02},
1975 { 8,0xFA},
1976 { 9,0xAC},
1977 { 10,0x00},
1978 { 11,0x00},
1979 { 12,0xF2},
1980 { 13,0xA3},
1981 { 14,0x00},
1982 { 15,0x00},
1983 { 16,0x28},
1984 { 17,0xAB},
1985 { 18,0x00},
1986 { 19,0x00},
1987 { 20,0x3F},
1988 { 21,0xFF},
1989 { 22,0x00},
1990 { 23,0x00},
1991 { 24,0xFF},
1992 { 25,0x98},
1993 { 26,0x00},
1994 { 27,0x00},
1995 { 28,0xF6},
1996 { 29,0xF9},
1997 { 30,0x00},
1998 { 31,0x00},
1999 { 32,0x26},
2000 { 33,0xFB},
2001 { 34,0x00},
2002 { 35,0x00},
2003 { 36,0x02},
2004 { 37,0x72},
2005 { 38,0x00},
2006 { 39,0x00},
2007 { 40,0x40},
2008 { 41,0x02},
2009 { 42,0x00},
2010 { 43,0x00},
2011 { 44,0xFB},
2012 { 45,0xCB},
2013 { 46,0x00},
2014 { 47,0x00},
2015 { 48,0x20},
2016 { 49,0xA7},
2017 { 50,0x00},
2018 { 51,0x00},
2019 { 52,0xFF},
2020 { 53,0x6A},
2021 { 54,0x00},
2022 { 55,0x00},
2023 { 56,0x3A},
2024 { 57,0x0F},
2025 { 58,0x00},
2026 { 59,0x00},
2027 { 0,0x09},
2028 { 72,0xFF},
2029 { 73,0xFF},
2030 { 74,0xFF},
2031 { 75,0x00},
2032 { 76,0x80},
2033 { 77,0x00},
2034 { 78,0x00},
2035 { 79,0x00},
2036 { 80,0x7F},
2037 { 81,0xF7},
2038 { 82,0x00},
2039 { 83,0x00},
2040 { 84,0x80},
2041 { 85,0x09},
2042 { 86,0x00},
2043 { 87,0x00},
2044 { 88,0x7F},
2045 { 89,0xEF},
2046 { 90,0x00},
2047 { 91,0x00},
2048 { 92,0x60},
2049 { 93,0x00},
2050 { 94,0x00},
2051 { 95,0x00},
2052 { 96,0x60},
2053 { 97,0x00},
2054 { 98,0x00},
2055 { 99,0x00},
2056 {100,0x40},
2057 {101,0x00},
2058 {102,0x00},
2059 {103,0x00},
2060 {104,0x7F},
2061 {105,0xFF},
2062 {106,0xFF},
2063 {107,0x00},
2064 {108,0x00},
2065 {109,0x00},
2066 {110,0x00},
2067 {111,0x00},
2068 {112,0x60},
2069 {113,0x00},
2070 {114,0x00},
2071 {115,0x00},
2072 {116,0x60},
2073 {117,0x00},
2074 {118,0x00},
2075 {119,0x00},
2076 {120,0x00},
2077 {121,0x0D},
2078 {122,0x00},
2079 {123,0x00},
2080 {124,0x00},
2081 {125,0x1C},
2082 {126,0x00},
2083 {127,0x00},
2084 { 0,0x0A},
2085 { 8,0x00},
2086 { 9,0x3E},
2087 { 10,0x00},
2088 { 11,0x00},
2089 { 12,0x40},
2090 { 13,0x00},
2091 { 14,0x00},
2092 { 15,0x00},
2093 { 16,0x60},
2094 { 17,0x00},
2095 { 18,0x00},
2096 { 19,0x00},
2097 { 20,0x00},
2098 { 21,0x78},
2099 { 22,0x00},
2100 { 23,0x00},
2101 { 24,0x02},
2102 { 25,0x4C},
2103 { 26,0x00},
2104 { 27,0x00},
2105 { 28,0x00},
2106 { 29,0xD5},
2107 { 30,0x00},
2108 { 31,0x00},
2109 { 32,0x01},
2110 { 33,0x65},
2111 { 34,0x00},
2112 { 35,0x00},
2113 { 36,0x03},
2114 { 37,0xE9},
2115 { 38,0x00},
2116 { 39,0x00},
2117 { 40,0x07},
2118 { 41,0xCA},
2119 { 42,0x00},
2120 { 43,0x00},
2121 { 44,0xFF},
2122 { 45,0xEF},
2123 { 46,0x00},
2124 { 47,0x00},
2125 { 48,0xFE},
2126 { 49,0xEB},
2127 { 50,0x00},
2128 { 51,0x00},
2129 { 52,0xFF},
2130 { 53,0xA8},
2131 { 54,0x00},
2132 { 55,0x00},
2133 { 56,0xFD},
2134 { 57,0x08},
2135 { 58,0x00},
2136 { 59,0x00},
2137 { 60,0xFF},
2138 { 61,0x5E},
2139 { 62,0x00},
2140 { 63,0x00},
2141 { 64,0xFF},
2142 { 65,0xD5},
2143 { 66,0x00},
2144 { 67,0x00},
2145 { 68,0xFE},
2146 { 69,0x36},
2147 { 70,0x00},
2148 { 71,0x00},
2149 { 72,0xFA},
2150 { 73,0xAC},
2151 { 74,0x00},
2152 { 75,0x00},
2153 { 76,0xF2},
2154 { 77,0xA3},
2155 { 78,0x00},
2156 { 79,0x00},
2157 { 80,0x28},
2158 { 81,0xAB},
2159 { 82,0x00},
2160 { 83,0x00},
2161 { 84,0x3F},
2162 { 85,0xFF},
2163 { 86,0x00},
2164 { 87,0x00},
2165 { 88,0xFF},
2166 { 89,0x98},
2167 { 90,0x00},
2168 { 91,0x00},
2169 { 92,0xF6},
2170 { 93,0xF9},
2171 { 94,0x00},
2172 { 95,0x00},
2173 { 96,0x26},
2174 { 97,0xFB},
2175 { 98,0x00},
2176 { 99,0x00},
2177 {100,0x02},
2178 {101,0x72},
2179 {102,0x00},
2180 {103,0x00},
2181 {104,0x40},
2182 {105,0x02},
2183 {106,0x00},
2184 {107,0x00},
2185 {108,0xFB},
2186 {109,0xCB},
2187 {110,0x00},
2188 {111,0x00},
2189 {112,0x20},
2190 {113,0xA7},
2191 {114,0x00},
2192 {115,0x00},
2193 {116,0xFF},
2194 {117,0x6A},
2195 {118,0x00},
2196 {119,0x00},
2197 {120,0x3A},
2198 {121,0x0F},
2199 {122,0x00},
2200 {123,0x00},
2201 { 0,0x0},
2202 { 0x7F,0x3C},
2203 { 0,0x01},
2204 { 8,0xC0},
2205 { 9,0x00},
2206 { 10,0x00},
2207 { 11,0x00},
2208 { 12,0xC0},
2209 { 13,0x00},
2210 { 14,0x00},
2211 { 15,0x00},
2212 { 0,0x0},
2213 { 0x7F,0x78},
2214 { 0,0x01},
2215 { 8,0x04},
2216 { 9,0x00},
2217 { 10,0x00},
2218 { 11,0x03},
2219 { 12,0x04},
2220 { 13,0x00},
2221 { 14,0x20},
2222 { 15,0x04},
2223 { 16,0x48},
2224 { 17,0x02},
2225 { 18,0x00},
2226 { 19,0x00},
2227 { 20,0x48},
2228 { 21,0x02},
2229 { 22,0x20},
2230 { 23,0x00},
2231 { 24,0x48},
2232 { 25,0x05},
2233 { 26,0x00},
2234 { 27,0x00},
2235 { 28,0x01},
2236 { 29,0x00},
2237 { 30,0x60},
2238 { 31,0x10},
2239 { 32,0x00},
2240 { 33,0x00},
2241 { 34,0x00},
2242 { 35,0x00},
2243 { 36,0x58},
2244 { 37,0x60},
2245 { 38,0x08},
2246 { 39,0x00},
2247 { 40,0x60},
2248 { 41,0x60},
2249 { 42,0x00},
2250 { 43,0x00},
2251 { 44,0x00},
2252 { 45,0x00},
2253 { 46,0x00},
2254 { 47,0x00},
2255 { 48,0x00},
2256 { 49,0x00},
2257 { 50,0x00},
2258 { 51,0x00},
2259 { 52,0x44},
2260 { 53,0x00},
2261 { 54,0xC0},
2262 { 55,0x03},
2263 { 56,0x00},
2264 { 57,0x00},
2265 { 58,0x00},
2266 { 59,0x00},
2267 { 60,0x00},
2268 { 61,0x00},
2269 { 62,0x00},
2270 { 63,0x00},
2271 { 64,0x44},
2272 { 65,0x00},
2273 { 66,0x00},
2274 { 67,0x03},
2275 { 68,0x21},
2276 { 69,0x00},
2277 { 70,0x00},
2278 { 71,0x00},
2279 { 72,0x03},
2280 { 73,0x80},
2281 { 74,0x00},
2282 { 75,0x10},
2283 { 76,0x00},
2284 { 77,0x00},
2285 { 78,0x00},
2286 { 79,0x00},
2287 { 80,0x45},
2288 { 81,0x02},
2289 { 82,0x80},
2290 { 83,0x00},
2291 { 84,0x45},
2292 { 85,0x02},
2293 { 86,0xA0},
2294 { 87,0x00},
2295 { 88,0x58},
2296 { 89,0x60},
2297 { 90,0x08},
2298 { 91,0x01},
2299 { 92,0x60},
2300 { 93,0x60},
2301 { 94,0x00},
2302 { 95,0x00},
2303 { 96,0x58},
2304 { 97,0x60},
2305 { 98,0x00},
2306 { 99,0x09},
2307 {100,0x00},
2308 {101,0x00},
2309 {102,0x00},
2310 {103,0x00},
2311 {104,0x44},
2312 {105,0x00},
2313 {106,0xC0},
2314 {107,0x16},
2315 {108,0x08},
2316 {109,0x00},
2317 {110,0x00},
2318 {111,0x46},
2319 {112,0x08},
2320 {113,0x00},
2321 {114,0x20},
2322 {115,0x86},
2323 {116,0x08},
2324 {117,0x00},
2325 {118,0x00},
2326 {119,0x45},
2327 {120,0x08},
2328 {121,0x00},
2329 {122,0x20},
2330 {123,0x85},
2331 {124,0x08},
2332 {125,0x00},
2333 {126,0x00},
2334 {127,0x44},
2335 { 0,0x02},
2336 { 8,0x08},
2337 { 9,0x00},
2338 { 10,0x20},
2339 { 11,0x84},
2340 { 12,0x08},
2341 { 13,0x00},
2342 { 14,0x00},
2343 { 15,0x43},
2344 { 16,0x08},
2345 { 17,0x00},
2346 { 18,0x20},
2347 { 19,0x83},
2348 { 20,0x08},
2349 { 21,0x00},
2350 { 22,0x00},
2351 { 23,0x42},
2352 { 24,0x08},
2353 { 25,0x00},
2354 { 26,0x20},
2355 { 27,0x82},
2356 { 28,0x08},
2357 { 29,0x00},
2358 { 30,0x00},
2359 { 31,0x41},
2360 { 32,0x08},
2361 { 33,0x00},
2362 { 34,0x20},
2363 { 35,0x81},
2364 { 36,0x08},
2365 { 37,0x00},
2366 { 38,0x00},
2367 { 39,0x40},
2368 { 40,0x08},
2369 { 41,0x00},
2370 { 42,0x20},
2371 { 43,0x80},
2372 { 44,0x08},
2373 { 45,0x00},
2374 { 46,0x00},
2375 { 47,0x3F},
2376 { 48,0x08},
2377 { 49,0x00},
2378 { 50,0x20},
2379 { 51,0x7F},
2380 { 52,0x00},
2381 { 53,0x00},
2382 { 54,0x00},
2383 { 55,0x00},
2384 { 56,0x00},
2385 { 57,0x00},
2386 { 58,0x00},
2387 { 59,0x00},
2388 { 60,0x00},
2389 { 61,0x00},
2390 { 62,0x00},
2391 { 63,0x00},
2392 { 64,0x00},
2393 { 65,0x00},
2394 { 66,0x00},
2395 { 67,0x00},
2396 { 68,0x00},
2397 { 69,0x00},
2398 { 70,0x00},
2399 { 71,0x00},
2400 { 72,0x44},
2401 { 73,0x00},
2402 { 74,0x00},
2403 { 75,0x06},
2404 { 76,0x21},
2405 { 77,0x00},
2406 { 78,0x20},
2407 { 79,0x00},
2408 { 80,0x4B},
2409 { 81,0x00},
2410 { 82,0xC0},
2411 { 83,0x00},
2412 { 84,0x4B},
2413 { 85,0x00},
2414 { 86,0xE0},
2415 { 87,0x00},
2416 { 88,0x00},
2417 { 89,0x00},
2418 { 90,0x40},
2419 { 91,0x48},
2420 { 92,0x0C},
2421 { 93,0x00},
2422 { 94,0x00},
2423 { 95,0x00},
2424 { 96,0x0C},
2425 { 97,0x00},
2426 { 98,0x20},
2427 { 99,0x00},
2428 {100,0x04},
2429 {101,0x02},
2430 {102,0xC0},
2431 {103,0x00},
2432 {104,0x04},
2433 {105,0x02},
2434 {106,0xE0},
2435 {107,0x01},
2436 {108,0x18},
2437 {109,0x01},
2438 {110,0x40},
2439 {111,0x00},
2440 {112,0x1C},
2441 {113,0x01},
2442 {114,0x60},
2443 {115,0x01},
2444 {116,0x00},
2445 {117,0x00},
2446 {118,0x00},
2447 {119,0x00},
2448 {120,0x00},
2449 {121,0x00},
2450 {122,0x00},
2451 {123,0x00},
2452 {124,0x00},
2453 {125,0x00},
2454 {126,0x00},
2455 {127,0x00},
2456 { 0,0x03},
2457 { 8,0x10},
2458 { 9,0x00},
2459 { 10,0x00},
2460 { 11,0x02},
2461 { 12,0x18},
2462 { 13,0x00},
2463 { 14,0xA0},
2464 { 15,0x03},
2465 { 16,0x1C},
2466 { 17,0x00},
2467 { 18,0xC0},
2468 { 19,0x04},
2469 { 20,0x00},
2470 { 21,0x00},
2471 { 22,0x00},
2472 { 23,0x00},
2473 { 24,0x00},
2474 { 25,0x00},
2475 { 26,0x00},
2476 { 27,0x00},
2477 { 28,0x00},
2478 { 29,0x00},
2479 { 30,0x00},
2480 { 31,0x00},
2481 { 32,0x10},
2482 { 33,0x00},
2483 { 34,0x00},
2484 { 35,0x05},
2485 { 36,0x18},
2486 { 37,0x01},
2487 { 38,0xE0},
2488 { 39,0x05},
2489 { 40,0x1C},
2490 { 41,0x02},
2491 { 42,0x00},
2492 { 43,0x02},
2493 { 44,0x00},
2494 { 45,0x00},
2495 { 46,0x00},
2496 { 47,0x00},
2497 { 48,0x00},
2498 { 49,0x00},
2499 { 50,0x00},
2500 { 51,0x00},
2501 { 52,0x00},
2502 { 53,0x00},
2503 { 54,0x00},
2504 { 55,0x00},
2505 { 56,0x10},
2506 { 57,0x00},
2507 { 58,0x00},
2508 { 59,0x06},
2509 { 60,0x18},
2510 { 61,0x00},
2511 { 62,0xE0},
2512 { 63,0x06},
2513 { 64,0x18},
2514 { 65,0x00},
2515 { 66,0xE0},
2516 { 67,0x06},
2517 { 68,0x18},
2518 { 69,0x00},
2519 { 70,0x60},
2520 { 71,0x0A},
2521 { 72,0x1C},
2522 { 73,0x00},
2523 { 74,0x80},
2524 { 75,0x0C},
2525 { 76,0x10},
2526 { 77,0x00},
2527 { 78,0x20},
2528 { 79,0x09},
2529 { 80,0x10},
2530 { 81,0x00},
2531 { 82,0x20},
2532 { 83,0x47},
2533 { 84,0x1C},
2534 { 85,0x00},
2535 { 86,0x40},
2536 { 87,0x09},
2537 { 88,0x18},
2538 { 89,0x00},
2539 { 90,0x60},
2540 { 91,0x48},
2541 { 92,0x1C},
2542 { 93,0x00},
2543 { 94,0x80},
2544 { 95,0x4C},
2545 { 96,0x1C},
2546 { 97,0x00},
2547 { 98,0x40},
2548 { 99,0x47},
2549 {100,0x10},
2550 {101,0x30},
2551 {102,0x00},
2552 {103,0x0B},
2553 {104,0x00},
2554 {105,0x00},
2555 {106,0x00},
2556 {107,0x00},
2557 {108,0x00},
2558 {109,0x00},
2559 {110,0x00},
2560 {111,0x00},
2561 {112,0x10},
2562 {113,0x30},
2563 {114,0x00},
2564 {115,0x4B},
2565 {116,0x18},
2566 {117,0x01},
2567 {118,0x80},
2568 {119,0x30},
2569 {120,0x1C},
2570 {121,0x01},
2571 {122,0xA0},
2572 {123,0x0D},
2573 {124,0x1C},
2574 {125,0x01},
2575 {126,0x80},
2576 {127,0x0B},
2577 { 0,0x04},
2578 { 8,0x1C},
2579 { 9,0x01},
2580 { 10,0xA0},
2581 { 11,0x2E},
2582 { 12,0x1C},
2583 { 13,0x01},
2584 { 14,0xC0},
2585 { 15,0x0F},
2586 { 16,0x1C},
2587 { 17,0x01},
2588 { 18,0xC0},
2589 { 19,0x2C},
2590 { 20,0x1C},
2591 { 21,0x02},
2592 { 22,0x20},
2593 { 23,0x11},
2594 { 24,0x1C},
2595 { 25,0x02},
2596 { 26,0x20},
2597 { 27,0x2A},
2598 { 28,0x1C},
2599 { 29,0x02},
2600 { 30,0x40},
2601 { 31,0x17},
2602 { 32,0x1C},
2603 { 33,0x02},
2604 { 34,0x40},
2605 { 35,0x24},
2606 { 36,0x1C},
2607 { 37,0x02},
2608 { 38,0x60},
2609 { 39,0x13},
2610 { 40,0x1C},
2611 { 41,0x02},
2612 { 42,0x60},
2613 { 43,0x28},
2614 { 44,0x1C},
2615 { 45,0x02},
2616 { 46,0x80},
2617 { 47,0x15},
2618 { 48,0x1C},
2619 { 49,0x02},
2620 { 50,0x80},
2621 { 51,0x26},
2622 { 52,0x1C},
2623 { 53,0x02},
2624 { 54,0xA0},
2625 { 55,0x19},
2626 { 56,0x1C},
2627 { 57,0x02},
2628 { 58,0xA0},
2629 { 59,0x22},
2630 { 60,0x1C},
2631 { 61,0x02},
2632 { 62,0xC0},
2633 { 63,0x1B},
2634 { 64,0x1C},
2635 { 65,0x02},
2636 { 66,0xC0},
2637 { 67,0x20},
2638 { 68,0x1C},
2639 { 69,0x02},
2640 { 70,0xE0},
2641 { 71,0x0C},
2642 { 72,0x1C},
2643 { 73,0x02},
2644 { 74,0xE0},
2645 { 75,0x2F},
2646 { 76,0x1C},
2647 { 77,0x03},
2648 { 78,0x00},
2649 { 79,0x14},
2650 { 80,0x1C},
2651 { 81,0x03},
2652 { 82,0x00},
2653 { 83,0x27},
2654 { 84,0x1C},
2655 { 85,0x03},
2656 { 86,0x20},
2657 { 87,0x10},
2658 { 88,0x1C},
2659 { 89,0x03},
2660 { 90,0x20},
2661 { 91,0x2B},
2662 { 92,0x1C},
2663 { 93,0x03},
2664 { 94,0x40},
2665 { 95,0x18},
2666 { 96,0x1C},
2667 { 97,0x03},
2668 { 98,0x40},
2669 { 99,0x23},
2670 {100,0x1C},
2671 {101,0x03},
2672 {102,0x60},
2673 {103,0x12},
2674 {104,0x1C},
2675 {105,0x03},
2676 {106,0x60},
2677 {107,0x29},
2678 {108,0x1C},
2679 {109,0x03},
2680 {110,0x80},
2681 {111,0x0E},
2682 {112,0x1C},
2683 {113,0x03},
2684 {114,0x80},
2685 {115,0x2D},
2686 {116,0x1C},
2687 {117,0x03},
2688 {118,0xA0},
2689 {119,0x16},
2690 {120,0x1C},
2691 {121,0x03},
2692 {122,0xA0},
2693 {123,0x25},
2694 {124,0x1C},
2695 {125,0x03},
2696 {126,0xC0},
2697 {127,0x1A},
2698 { 0,0x05},
2699 { 8,0x1C},
2700 { 9,0x03},
2701 { 10,0xC0},
2702 { 11,0x21},
2703 { 12,0x1C},
2704 { 13,0x03},
2705 { 14,0xE0},
2706 { 15,0x1C},
2707 { 16,0x1C},
2708 { 17,0x03},
2709 { 18,0xE0},
2710 { 19,0x1F},
2711 { 20,0x1C},
2712 { 21,0x04},
2713 { 22,0x00},
2714 { 23,0x1D},
2715 { 24,0x1C},
2716 { 25,0x04},
2717 { 26,0x00},
2718 { 27,0x1E},
2719 { 28,0x00},
2720 { 29,0x00},
2721 { 30,0x00},
2722 { 31,0x00},
2723 { 32,0x00},
2724 { 33,0x00},
2725 { 34,0x00},
2726 { 35,0x00},
2727 { 36,0x00},
2728 { 37,0x00},
2729 { 38,0x00},
2730 { 39,0x00},
2731 { 40,0x10},
2732 { 41,0x00},
2733 { 42,0x00},
2734 { 43,0x35},
2735 { 44,0x18},
2736 { 45,0x01},
2737 { 46,0x80},
2738 { 47,0x70},
2739 { 48,0x1C},
2740 { 49,0x01},
2741 { 50,0xA0},
2742 { 51,0x4D},
2743 { 52,0x1C},
2744 { 53,0x01},
2745 { 54,0x80},
2746 { 55,0x4B},
2747 { 56,0x1C},
2748 { 57,0x01},
2749 { 58,0xA0},
2750 { 59,0x6E},
2751 { 60,0x1C},
2752 { 61,0x01},
2753 { 62,0xC0},
2754 { 63,0x4F},
2755 { 64,0x1C},
2756 { 65,0x01},
2757 { 66,0xC0},
2758 { 67,0x6C},
2759 { 68,0x1C},
2760 { 69,0x02},
2761 { 70,0x20},
2762 { 71,0x51},
2763 { 72,0x1C},
2764 { 73,0x02},
2765 { 74,0x20},
2766 { 75,0x6A},
2767 { 76,0x1C},
2768 { 77,0x02},
2769 { 78,0x40},
2770 { 79,0x57},
2771 { 80,0x1C},
2772 { 81,0x02},
2773 { 82,0x40},
2774 { 83,0x64},
2775 { 84,0x1C},
2776 { 85,0x02},
2777 { 86,0x60},
2778 { 87,0x53},
2779 { 88,0x1C},
2780 { 89,0x02},
2781 { 90,0x60},
2782 { 91,0x68},
2783 { 92,0x1C},
2784 { 93,0x02},
2785 { 94,0x80},
2786 { 95,0x55},
2787 { 96,0x1C},
2788 { 97,0x02},
2789 { 98,0x80},
2790 { 99,0x66},
2791 {100,0x1C},
2792 {101,0x02},
2793 {102,0xA0},
2794 {103,0x59},
2795 {104,0x1C},
2796 {105,0x02},
2797 {106,0xA0},
2798 {107,0x62},
2799 {108,0x1C},
2800 {109,0x02},
2801 {110,0xC0},
2802 {111,0x5B},
2803 {112,0x1C},
2804 {113,0x02},
2805 {114,0xC0},
2806 {115,0x60},
2807 {116,0x1C},
2808 {117,0x02},
2809 {118,0xE0},
2810 {119,0x4C},
2811 {120,0x1C},
2812 {121,0x02},
2813 {122,0xE0},
2814 {123,0x6F},
2815 {124,0x1C},
2816 {125,0x03},
2817 {126,0x00},
2818 {127,0x54},
2819 { 0,0x06},
2820 { 8,0x1C},
2821 { 9,0x03},
2822 { 10,0x00},
2823 { 11,0x67},
2824 { 12,0x1C},
2825
2826 { 13,0x03},
2827 { 14,0x20},
2828 { 15,0x50},
2829 { 16,0x1C},
2830 { 17,0x03},
2831 { 18,0x20},
2832 { 19,0x6B},
2833 { 20,0x1C},
2834 { 21,0x03},
2835 { 22,0x40},
2836 { 23,0x58},
2837 { 24,0x1C},
2838 { 25,0x03},
2839 { 26,0x40},
2840 { 27,0x63},
2841 { 28,0x1C},
2842 { 29,0x03},
2843 { 30,0x60},
2844 { 31,0x52},
2845 { 32,0x1C},
2846 { 33,0x03},
2847 { 34,0x60},
2848 { 35,0x69},
2849 { 36,0x1C},
2850 { 37,0x03},
2851 { 38,0x80},
2852 { 39,0x4E},
2853 { 40,0x1C},
2854 { 41,0x03},
2855 { 42,0x80},
2856 { 43,0x6D},
2857 { 44,0x1C},
2858 { 45,0x03},
2859 { 46,0xA0},
2860 { 47,0x56},
2861 { 48,0x1C},
2862 { 49,0x03},
2863 { 50,0xA0},
2864 { 51,0x65},
2865 { 52,0x1C},
2866 { 53,0x03},
2867 { 54,0xC0},
2868 { 55,0x5A},
2869 { 56,0x1C},
2870 { 57,0x03},
2871 { 58,0xC0},
2872 { 59,0x61},
2873 { 60,0x1C},
2874 { 61,0x03},
2875 { 62,0xE0},
2876 { 63,0x5C},
2877 { 64,0x1C},
2878 { 65,0x03},
2879 { 66,0xE0},
2880 { 67,0x5F},
2881 { 68,0x1C},
2882 { 69,0x04},
2883 { 70,0x00},
2884 { 71,0x5D},
2885 { 72,0x1C},
2886 { 73,0x04},
2887 { 74,0x00},
2888 { 75,0x5E},
2889 { 76,0x00},
2890 { 77,0x00},
2891 { 78,0x00},
2892 { 79,0x00},
2893 { 80,0x00},
2894 { 81,0x00},
2895 { 82,0x00},
2896 { 83,0x00},
2897 { 84,0x00},
2898 { 85,0x00},
2899 { 86,0x00},
2900 { 87,0x00},
2901 { 88,0x10},
2902 { 89,0x00},
2903 { 90,0x00},
2904 { 91,0x75},
2905 { 92,0x18},
2906 { 93,0x04},
2907 { 94,0x40},
2908 { 95,0x74},
2909 { 96,0x1C},
2910 { 97,0x04},
2911 { 98,0x60},
2912 { 99,0x76},
2913 {100,0x1C},
2914 {101,0x04},
2915 {102,0x60},
2916 {103,0x73},
2917 {104,0x1C},
2918 {105,0x04},
2919 {106,0x40},
2920 {107,0x75},
2921 {108,0x1C},
2922 {109,0x04},
2923 {110,0x80},
2924 {111,0x72},
2925 {112,0x1C},
2926 {113,0x04},
2927 {114,0x80},
2928 {115,0x77},
2929 {116,0x1C},
2930 {117,0x04},
2931 {118,0xA0},
2932 {119,0x71},
2933 {120,0x1C},
2934 {121,0x04},
2935 {122,0xA0},
2936 {123,0x78},
2937 {124,0x18},
2938 {125,0x05},
2939 {126,0x00},
2940 {127,0x79},
2941 { 0,0x07},
2942 { 8,0x1C},
2943 { 9,0x05},
2944 { 10,0x00},
2945 { 11,0x7B},
2946 { 12,0x1C},
2947 { 13,0x04},
2948 { 14,0xE0},
2949 { 15,0x7E},
2950 { 16,0x4C},
2951 { 17,0x04},
2952 { 18,0xE0},
2953 { 19,0x7C},
2954 { 20,0x00},
2955 { 21,0x00},
2956 { 22,0x00},
2957 { 23,0x00},
2958 { 24,0x5C},
2959 { 25,0x90},
2960 { 26,0x60},
2961 { 27,0x03},
2962 { 28,0x18},
2963 { 29,0x04},
2964 { 30,0x40},
2965 { 31,0x34},
2966 { 32,0x1C},
2967 { 33,0x04},
2968 { 34,0x40},
2969 { 35,0x35},
2970 { 36,0x1C},
2971 { 37,0x04},
2972 { 38,0x60},
2973 { 39,0x36},
2974 { 40,0x10},
2975 { 41,0x00},
2976 { 42,0x40},
2977 { 43,0x85},
2978 { 44,0x1C},
2979 { 45,0x04},
2980 { 46,0x60},
2981 { 47,0x33},
2982 { 48,0x1C},
2983 { 49,0x04},
2984 { 50,0x80},
2985 { 51,0x32},
2986 { 52,0x1C},
2987 { 53,0x04},
2988 { 54,0x80},
2989 { 55,0x37},
2990 { 56,0x1C},
2991 { 57,0x04},
2992 { 58,0xA0},
2993 { 59,0x31},
2994 { 60,0x1C},
2995 { 61,0x04},
2996 { 62,0xA0},
2997 { 63,0x38},
2998 { 64,0x18},
2999 { 65,0x05},
3000 { 66,0x00},
3001 { 67,0x39},
3002 { 68,0x1C},
3003 { 69,0x05},
3004 { 70,0x00},
3005 { 71,0x3B},
3006 { 72,0x1C},
3007 { 73,0x04},
3008 { 74,0xE0},
3009 { 75,0x3E},
3010 { 76,0x4C},
3011 { 77,0x04},
3012 { 78,0xE0},
3013 { 79,0x3C},
3014 { 80,0x00},
3015 { 81,0x00},
3016 { 82,0x00},
3017 { 83,0x00},
3018 { 84,0x5C},
3019 { 85,0x90},
3020 { 86,0x40},
3021 { 87,0x03},
3022 { 88,0x00},
3023 { 89,0x00},
3024 { 90,0x00},
3025 { 91,0x00},
3026 { 92,0x00},
3027 { 93,0x00},
3028 { 94,0x00},
3029 { 95,0x00},
3030 { 96,0x00},
3031 { 97,0x00},
3032 { 98,0x00},
3033 { 99,0x00},
3034 {100,0x10},
3035 {101,0x00},
3036 {102,0x40},
3037 {103,0x45},
3038 {104,0x18},
3039 {105,0x05},
3040 {106,0x20},
3041 {107,0x7C},
3042 {108,0x1C},
3043 {109,0x05},
3044 {110,0x20},
3045 {111,0x7B},
3046 {112,0x1C},
3047 {113,0x05},
3048 {114,0x40},
3049 {115,0x79},
3050 {116,0x00},
3051 {117,0x00},
3052 {118,0x00},
3053 {119,0x00},
3054 {120,0x5C},
3055 {121,0x90},
3056 {122,0x60},
3057 {123,0x03},
3058 {124,0x18},
3059 {125,0x05},
3060 {126,0x20},
3061 {127,0x3C},
3062 { 0,0x08},
3063 { 8,0x1C},
3064 { 9,0x05},
3065 { 10,0x20},
3066 { 11,0x3B},
3067 { 12,0x1C},
3068 { 13,0x05},
3069 { 14,0x40},
3070 { 15,0x39},
3071 { 16,0x10},
3072 { 17,0x00},
3073 { 18,0x40},
3074 { 19,0x84},
3075 { 20,0x18},
3076 { 21,0x04},
3077 { 22,0xC0},
3078 { 23,0x72},
3079 { 24,0x5C},
3080 { 25,0x90},
3081 { 26,0x40},
3082 { 27,0x03},
3083 { 28,0x18},
3084 { 29,0x04},
3085 { 30,0xE0},
3086 { 31,0x7B},
3087 { 32,0x1C},
3088 { 33,0x05},
3089 { 34,0x00},
3090 { 35,0x7C},
3091 { 36,0x4C},
3092 { 37,0x04},
3093 { 38,0xE0},
3094 { 39,0x7D},
3095 { 40,0x10},
3096 { 41,0x00},
3097 { 42,0x40},
3098 { 43,0x44},
3099 { 44,0x1C},
3100 { 45,0x05},
3101 { 46,0x00},
3102 { 47,0x79},
3103 { 48,0x18},
3104 { 49,0x04},
3105 { 50,0xC0},
3106 { 51,0x32},
3107 { 52,0x5C},
3108 { 53,0x90},
3109 { 54,0x60},
3110 { 55,0x03},
3111 { 56,0x18},
3112 { 57,0x04},
3113 { 58,0xE0},
3114 { 59,0x3B},
3115 { 60,0x1C},
3116 { 61,0x05},
3117 { 62,0x00},
3118 { 63,0x3C},
3119 { 64,0x4C},
3120 { 65,0x04},
3121 { 66,0xE0},
3122 { 67,0x3D},
3123 { 68,0x10},
3124 { 69,0x00},
3125 { 70,0x40},
3126 { 71,0x83},
3127 { 72,0x1C},
3128 { 73,0x05},
3129 { 74,0x00},
3130 { 75,0x39},
3131 { 76,0x00},
3132 { 77,0x00},
3133 { 78,0x00},
3134 { 79,0x00},
3135 { 80,0x5C},
3136 { 81,0x90},
3137 { 82,0x40},
3138 { 83,0x03},
3139 { 84,0x18},
3140 { 85,0x05},
3141 { 86,0x20},
3142 { 87,0x7D},
3143 { 88,0x1C},
3144 { 89,0x05},
3145 { 90,0x20},
3146 { 91,0x79},
3147 { 92,0x1C},
3148 { 93,0x05},
3149 { 94,0x40},
3150 { 95,0x7C},
3151 { 96,0x10},
3152 { 97,0x00},
3153 { 98,0x40},
3154 { 99,0x43},
3155 {100,0x5C},
3156 {101,0x90},
3157 {102,0x60},
3158 {103,0x03},
3159 {104,0x00},
3160 {105,0x00},
3161 {106,0x00},
3162 {107,0x00},
3163 {108,0x00},
3164 {109,0x00},
3165 {110,0x00},
3166 {111,0x00},
3167 {112,0x00},
3168 {113,0x00},
3169 {114,0x00},
3170 {115,0x00},
3171 {116,0x10},
3172 {117,0x00},
3173 {118,0x40},
3174 {119,0x82},
3175 {120,0x18},
3176 {121,0x05},
3177 {122,0x20},
3178 {123,0x3D},
3179 {124,0x1C},
3180 {125,0x05},
3181 {126,0x20},
3182 {127,0x39},
3183 { 0,0x09},
3184 { 8,0x1C},
3185 { 9,0x05},
3186 { 10,0x40},
3187 { 11,0x3C},
3188 { 12,0x18},
3189 { 13,0x04},
3190 { 14,0x20},
3191 { 15,0x5D},
3192 { 16,0x5C},
3193 { 17,0x90},
3194 { 18,0x40},
3195 { 19,0x03},
3196 { 20,0x18},
3197 { 21,0x04},
3198 { 22,0x40},
3199 { 23,0x78},
3200 { 24,0x1C},
3201 { 25,0x04},
3202 { 26,0x60},
3203 { 27,0x71},
3204 { 28,0x4C},
3205 { 29,0x04},
3206 { 30,0x40},
3207 { 31,0x70},
3208 { 32,0x10},
3209 { 33,0x00},
3210 { 34,0x40},
3211 { 35,0x42},
3212 { 36,0x1C},
3213 { 37,0x04},
3214 { 38,0x60},
3215 { 39,0x77},
3216 { 40,0x1C},
3217 { 41,0x04},
3218 { 42,0x80},
3219 { 43,0x76},
3220 { 44,0x1C},
3221 { 45,0x04},
3222 { 46,0x80},
3223 { 47,0x72},
3224 { 48,0x1C},
3225 { 49,0x04},
3226 { 50,0xA0},
3227 { 51,0x75},
3228 { 52,0x1C},
3229 { 53,0x04},
3230 { 54,0xA0},
3231 { 55,0x73},
3232 { 56,0x18},
3233 { 57,0x05},
3234 { 58,0x00},
3235 { 59,0x7D},
3236 { 60,0x1C},
3237 { 61,0x05},
3238 { 62,0x00},
3239 { 63,0x7C},
3240 { 64,0x1C},
3241 { 65,0x04},
3242 { 66,0xE0},
3243 { 67,0x79},
3244 { 68,0x4C},
3245 { 69,0x04},
3246 { 70,0xE0},
3247 { 71,0x7A},
3248 { 72,0x18},
3249 { 73,0x04},
3250 { 74,0x20},
3251 { 75,0x1D},
3252 { 76,0x5C},
3253 { 77,0x90},
3254 { 78,0x60},
3255 { 79,0x03},
3256 { 80,0x18},
3257 { 81,0x04},
3258 { 82,0x40},
3259 { 83,0x38},
3260 { 84,0x1C},
3261 { 85,0x04},
3262 { 86,0x60},
3263 { 87,0x31},
3264 { 88,0x4C},
3265 { 89,0x04},
3266 { 90,0x40},
3267 { 91,0x30},
3268 { 92,0x10},
3269 { 93,0x00},
3270 { 94,0x40},
3271 { 95,0x81},
3272 { 96,0x1C},
3273 { 97,0x04},
3274 { 98,0x60},
3275 { 99,0x37},
3276 {100,0x1C},
3277 {101,0x04},
3278 {102,0x80},
3279 {103,0x36},
3280 {104,0x1C},
3281 {105,0x04},
3282 {106,0x80},
3283 {107,0x32},
3284 {108,0x1C},
3285 {109,0x04},
3286 {110,0xA0},
3287 {111,0x35},
3288 {112,0x1C},
3289 {113,0x04},
3290 {114,0xA0},
3291 {115,0x33},
3292 {116,0x18},
3293 {117,0x05},
3294 {118,0x00},
3295 {119,0x3D},
3296 {120,0x1C},
3297 {121,0x05},
3298 {122,0x00},
3299 {123,0x3C},
3300 {124,0x1C},
3301 {125,0x04},
3302 {126,0xE0},
3303 {127,0x39},
3304 { 0,0x0A},
3305 { 8,0x4C},
3306 { 9,0x04},
3307 { 10,0xE0},
3308 { 11,0x3A},
3309 { 12,0x00},
3310 { 13,0x00},
3311 { 14,0x00},
3312 { 15,0x00},
3313 { 16,0x5C},
3314 { 17,0x90},
3315 { 18,0x40},
3316 { 19,0x03},
3317 { 20,0x00},
3318 { 21,0x00},
3319 { 22,0x00},
3320 { 23,0x00},
3321 { 24,0x00},
3322 { 25,0x00},
3323 { 26,0x00},
3324 { 27,0x00},
3325 { 28,0x00},
3326 { 29,0x00},
3327 { 30,0x00},
3328 { 31,0x00},
3329 { 32,0x10},
3330 { 33,0x00},
3331 { 34,0x40},
3332 { 35,0x40},
3333 { 36,0x18},
3334 { 37,0x05},
3335 { 38,0x20},
3336 { 39,0x7A},
3337 { 40,0x1C},
3338 { 41,0x05},
3339 { 42,0x20},
3340 { 43,0x7C},
3341 { 44,0x1C},
3342 { 45,0x05},
3343 { 46,0x40},
3344 { 47,0x7D},
3345 { 48,0x10},
3346 { 49,0x00},
3347 { 50,0x40},
3348 { 51,0x41},
3349 { 52,0x00},
3350 { 53,0x00},
3351 { 54,0x00},
3352 { 55,0x00},
3353 { 56,0x5C},
3354 { 57,0x90},
3355 { 58,0x60},
3356 { 59,0x03},
3357 { 60,0x18},
3358 { 61,0x05},
3359 { 62,0x20},
3360 { 63,0x3A},
3361 { 64,0x1C},
3362 { 65,0x05},
3363 { 66,0x20},
3364 { 67,0x3C},
3365 { 68,0x1C},
3366 { 69,0x05},
3367 { 70,0x40},
3368 { 71,0x3D},
3369 { 72,0x10},
3370 { 73,0x00},
3371 { 74,0x40},
3372 { 75,0x80},
3373 { 76,0x18},
3374 { 77,0x04},
3375 { 78,0xC0},
3376 { 79,0x76},
3377 { 80,0x5C},
3378 { 81,0x90},
3379 { 82,0x40},
3380 { 83,0x03},
3381 { 84,0x18},
3382 { 85,0x04},
3383 { 86,0xE0},
3384 { 87,0x7C},
3385 { 88,0x1C},
3386 { 89,0x05},
3387 { 90,0x00},
3388 { 91,0x7A},
3389 { 92,0x4C},
3390 { 93,0x04},
3391 { 94,0xE0},
3392 { 95,0x78},
3393 { 96,0x10},
3394 { 97,0x00},
3395 { 98,0x40},
3396 { 99,0x40},
3397 {100,0x1C},
3398 {101,0x05},
3399 {102,0x00},
3400 {103,0x7D},
3401 {104,0x18},
3402 {105,0x04},
3403 {106,0xC0},
3404 {107,0x36},
3405 {108,0x5C},
3406 {109,0x90},
3407 {110,0x60},
3408 {111,0x03},
3409 {112,0x18},
3410 {113,0x04},
3411 {114,0xE0},
3412 {115,0x3C},
3413 {116,0x1C},
3414 {117,0x05},
3415 {118,0x00},
3416 {119,0x3A},
3417 {120,0x4C},
3418 {121,0x04},
3419 {122,0xE0},
3420 {123,0x38},
3421 {124,0x10},
3422 {125,0x00},
3423 {126,0x40},
3424 {127,0x7F},
3425 { 0,0x0B},
3426 { 8,0x1C},
3427 { 9,0x05},
3428 { 10,0x00},
3429 { 11,0x3D},
3430 { 12,0x00},
3431 { 13,0x00},
3432 { 14,0x00},
3433 { 15,0x00},
3434 { 16,0x5C},
3435 { 17,0x90},
3436 { 18,0x40},
3437 { 19,0x03},
3438 { 20,0x18},
3439 { 21,0x05},
3440 { 22,0x20},
3441 { 23,0x78},
3442 { 24,0x1C},
3443 { 25,0x05},
3444 { 26,0x20},
3445 { 27,0x7D},
3446 { 28,0x1C},
3447 { 29,0x05},
3448 { 30,0x40},
3449 { 31,0x7A},
3450 { 32,0x10},
3451 { 33,0x00},
3452 { 34,0x40},
3453 { 35,0x3F},
3454 { 36,0x00},
3455 { 37,0x00},
3456 { 38,0x00},
3457 { 39,0x00},
3458 { 40,0x5C},
3459 { 41,0x90},
3460 { 42,0x60},
3461 { 43,0x03},
3462 { 44,0x18},
3463 { 45,0x05},
3464 { 46,0x20},
3465 { 47,0x38},
3466 { 48,0x1C},
3467 { 49,0x05},
3468 { 50,0x20},
3469 { 51,0x3D},
3470 { 52,0x1C},
3471 { 53,0x05},
3472 { 54,0x40},
3473 { 55,0x3A},
3474 { 56,0x10},
3475 { 57,0x00},
3476 { 58,0x40},
3477 { 59,0x7E},
3478 { 60,0x5C},
3479 { 61,0x90},
3480 { 62,0x40},
3481 { 63,0x03},
3482 { 64,0x00},
3483 { 65,0x00},
3484 { 66,0x00},
3485 { 67,0x00},
3486 { 68,0x00},
3487 { 69,0x00},
3488 { 70,0x00},
3489 { 71,0x00},
3490 { 72,0x00},
3491 { 73,0x00},
3492 { 74,0x00},
3493 { 75,0x00},
3494 { 76,0x10},
3495 { 77,0x00},
3496 { 78,0x40},
3497 { 79,0x3E},
3498 { 80,0x09},
3499 { 81,0x00},
3500 { 82,0x00},
3501 { 83,0x05},
3502 { 84,0x09},
3503 { 85,0x00},
3504 { 86,0x20},
3505 { 87,0x02},
3506 { 88,0x00},
3507 { 89,0x00},
3508 { 90,0x00},
3509 { 91,0x00},
3510 { 92,0x00},
3511 { 93,0x00},
3512 { 94,0x00},
3513 { 95,0x00},
3514 { 96,0x00},
3515 { 97,0x00},
3516 { 98,0x00},
3517 { 99,0x00},
3518 {100,0x02},
3519 {101,0x00},
3520 {102,0x00},
3521 {103,0x00},
3522 {104,0x00},
3523 {105,0x00},
3524 {106,0x00},
3525 {107,0x00},
3526};
3527#define main44_miniDSP_D_reg_values_COEFF_START 0
3528#define main44_miniDSP_D_reg_values_COEFF_SIZE 361
3529#define main44_miniDSP_D_reg_values_INST_START 361
3530#define main44_miniDSP_D_reg_values_INST_SIZE 1313
3531
3532/* Dummy patches*/
3533
3534reg_value handset_miniDSP_D_reg_values[] = {
3535 { 0,0x0},
3536 { 0x7F,0x50},
3537 { 0,0x06},
3538 { 60,0xBE},
3539 { 61,0xEF},
3540 { 62,0x01},
3541 { 63,0x00},
3542 {104,0x00},
3543 {105,0x80},
3544 {106,0x00},
3545 {107,0x00},
3546 {116,0x04},
3547 {117,0x0B},
3548 {118,0x78},
3549 {119,0x00},
3550 { 0,0x0E},
3551 {124,0xBE},
3552 {125,0xEF},
3553 {126,0x01},
3554 {127,0x00},
3555 { 0,0x0F},
3556 { 48,0x00},
3557 { 49,0x80},
3558 { 50,0x00},
3559 { 51,0x00},
3560 { 60,0x04},
3561 { 61,0x0B},
3562 { 62,0x78},
3563 { 63,0x00},
3564};
3565reg_value handphone_miniDSP_D_reg_values[] = {
3566 { 0,0x0},
3567 { 0x7F,0x50},
3568 { 0,0x06},
3569 { 60,0xBE},
3570 { 61,0xEF},
3571 { 62,0x01},
3572 { 63,0x00},
3573 {104,0x00},
3574 {105,0x80},
3575 {106,0x00},
3576 {107,0x00},
3577 {116,0x04},
3578 {117,0x0B},
3579 {118,0x78},
3580 {119,0x00},
3581 { 0,0x0E},
3582 {124,0xBE},
3583 {125,0xEF},
3584 {126,0x01},
3585 {127,0x00},
3586 { 0,0x0F},
3587 { 48,0x00},
3588 { 49,0x80},
3589 { 50,0x00},
3590 { 51,0x00},
3591 { 60,0x04},
3592 { 61,0x0B},
3593 { 62,0x78},
3594 { 63,0x00},
3595};
3596reg_value speaker_miniDSP_D_reg_values[] = {
3597 { 0,0x0},
3598 { 0x7F,0x50},
3599 { 0,0x06},
3600 { 60,0xBE},
3601 { 61,0xEF},
3602 { 62,0x01},
3603 { 63,0x00},
3604 {104,0x78},
3605 {105,0x00},
3606 {106,0x00},
3607 {107,0x00},
3608 {116,0x04},
3609 {117,0x08},
3610 {118,0x31},
3611 {119,0x00},
3612 { 0,0x0E},
3613 {124,0xBE},
3614 {125,0xEF},
3615 {126,0x01},
3616 {127,0x00},
3617 { 0,0x0F},
3618 { 48,0x78},
3619 { 49,0x00},
3620 { 50,0x00},
3621 { 51,0x00},
3622 { 60,0x04},
3623 { 61,0x08},
3624 { 62,0x31},
3625 { 63,0x00},
3626};
diff --git a/sound/soc/codecs/tlv320aic326x.c b/sound/soc/codecs/tlv320aic326x.c
new file mode 100644
index 00000000000..8bbd295a332
--- /dev/null
+++ b/sound/soc/codecs/tlv320aic326x.c
@@ -0,0 +1,4528 @@
1/*
2* linux/sound/soc/codecs/tlv320aic3262.c
3*
4* Copyright (C) 2012 Texas Instruments, Inc.
5*
6* Based on sound/soc/codecs/tlv320aic3262.c
7*
8* This package is free software; you can redistribute it and/or modify
9* it under the terms of the GNU General Public License version 2 as
10* published by the Free Software Foundation.
11*
12* THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
13* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
14* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
15*
16* The TLV320AIC3262 is a flexible, low-power, low-voltage stereo audio
17* codec with digital microphone inputs and programmable outputs.
18*
19* History:
20*
21* Rev 0.1 ASoC driver support 20-01-2011
22*
23* The AIC325x ASoC driver is ported for the codec AIC3262.
24* Rev 0.2 ASoC driver support 21-03-2011
25* The AIC326x ASoC driver is updated abe changes.
26*
27* Rev 0.3 ASoC driver support 12.09.2011
28* fixed the compilation issues for Whistler support
29*
30* Rev 0.4 ASoC driver support 27.09.2011
31* The AIC326x driver ported for Nvidia cardhu.
32*
33* Rev 0.5 Modified to support Multiple ASI Ports 08-Nov-2011
34* Driver updated to support ASI Ports of AIC3262
35*
36* Modified by Nvidia 23-Nov-2011 for K39 ASoC changes.
37*/
38
39/*
40 *****************************************************************************
41 * INCLUDES
42 *****************************************************************************
43 */
44#include <linux/module.h>
45#include <linux/moduleparam.h>
46#include <linux/kernel.h>
47#include <linux/init.h>
48#include <linux/delay.h>
49#include <linux/pm.h>
50#include <linux/i2c.h>
51#include <linux/platform_device.h>
52#include <linux/slab.h>
53#include <sound/core.h>
54#include <sound/pcm.h>
55#include <sound/pcm_params.h>
56#include <sound/soc.h>
57#include <sound/soc-dapm.h>
58#include <sound/initval.h>
59#include <sound/tlv.h>
60#include <asm/div64.h>
61#include <sound/tlv320aic326x.h>
62#include <sound/jack.h>
63#include <linux/spi/spi.h>
64
65#include "tlv320aic326x.h"
66#include <linux/gpio.h>
67/*
68 *****************************************************************************
69 * Global Variable
70 *****************************************************************************
71 */
72static u8 aic3262_reg_ctl;
73
74#ifdef AIC3262_TiLoad
75 extern int aic3262_driver_init(struct snd_soc_codec *codec);
76#endif
77
78
79
80/* whenever aplay/arecord is run, aic3262_hw_params() function gets called.
81 * This function reprograms the clock dividers etc. this flag can be used to
82 * disable this when the clock dividers are programmed by pps config file
83 */
84static int soc_static_freq_config = 1;
85static struct aic3262_priv *aic3262_priv_data;
86static struct i2c_client *i2c_pdev;
87static struct snd_soc_codec *aic3262_codec;
88
89/*
90 *****************************************************************************
91 * Macros
92 *****************************************************************************
93 */
94
95/* ASoC Widget Control definition for a single Register based Control */
96#define SOC_SINGLE_AIC3262(xname) \
97{\
98 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
99 .info = __new_control_info, .get = __new_control_get,\
100 .put = __new_control_put, \
101 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
102}
103#define SOC_SINGLE_N(xname, xreg, xshift, xmax, xinvert) \
104{\
105 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
106 .info = n_control_info, .get = n_control_get,\
107 .put = n_control_put, \
108 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
109 .private_value = ((unsigned long)&(struct soc_mixer_control)) \
110 {.reg = xreg, .shift = xshift, .rshift = xshift, .max = xmax, \
111 .invert = xinvert} }
112
113/* ASoC Widget Control definition for a Double Register based Control */
114
115#define SOC_DOUBLE_R_N(xname, reg_left, reg_right, xshift, xmax, xinvert) \
116{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
117 .info = snd_soc_info_volsw_2r_n, \
118 .get = snd_soc_get_volsw_2r_n, .put = snd_soc_put_volsw_2r_n, \
119 .private_value = (unsigned long)&(struct soc_mixer_control) \
120 {.reg = reg_left, .rreg = reg_right, .shift = xshift, \
121 .max = xmax, .invert = xinvert} }
122
123#define SND_SOC_DAPM_SWITCH_N(wname, wreg, wshift, winvert) \
124{ .id = snd_soc_dapm_switch, .name = wname, .reg = wreg, .shift = wshift,\
125 .invert = winvert, .kcontrols = NULL, .num_kcontrols = 0}
126/*
127 *****************************************************************************
128 * Function Prototype
129 *****************************************************************************
130 */
131static int aic3262_set_bias_level(struct snd_soc_codec *codec,
132 enum snd_soc_bias_level level);
133
134static int __new_control_info(struct snd_kcontrol *kcontrol,
135 struct snd_ctl_elem_info *uinfo);
136
137static int __new_control_get(struct snd_kcontrol *kcontrol,
138 struct snd_ctl_elem_value *ucontrol);
139
140static int __new_control_put(struct snd_kcontrol *kcontrol,
141 struct snd_ctl_elem_value *ucontrol);
142
143static inline int aic3262_get_divs(int mclk, int rate);
144
145static int aic3262_multi_i2s_hw_params(struct snd_pcm_substream *substream,
146 struct snd_pcm_hw_params *params,
147 struct snd_soc_dai *dai);
148
149static int aic3262_multi_i2s_set_dai_sysclk(struct snd_soc_dai *codec_dai,
150 int clk_id, unsigned int freq, int dir);
151static int aic3262_multi_i2s_set_dai_pll(struct snd_soc_dai *codec_dai,
152 int pll_id, int source, unsigned int freq_in,
153 unsigned int freq_out);
154
155static int aic3262_multi_i2s_asi1_set_dai_fmt(struct snd_soc_dai *codec_dai,
156 unsigned int fmt);
157
158static int aic3262_multi_i2s_asi2_set_dai_fmt(struct snd_soc_dai *codec_dai,
159 unsigned int fmt);
160
161static int aic3262_multi_i2s_asi3_set_dai_fmt(struct snd_soc_dai *codec_dai,
162 unsigned int fmt);
163
164static int aic3262_multi_i2s_asi1_mute(struct snd_soc_dai *dai, int mute);
165
166static int aic3262_multi_i2s_asi2_mute(struct snd_soc_dai *dai, int mute);
167
168static int aic3262_multi_i2s_asi3_mute(struct snd_soc_dai *dai, int mute);
169
170#if 0
171static const char *wclk1_pincontrol[] = {
172 "ASI1 Word Clock Input/Output", "CLKOUT output"};
173static const char *dout1_pincontrol[] = {
174 "disabled", "ASI1 data output", "gpio", "clock out",
175 "INT1", "INT2", "SAR ADC interrupt"};
176
177static const char *din1_pincontrol[] = {"disabled", "enabled"};
178
179static const char *wclk2_pincontrol[] = {
180 "diabled", "ASI1 secondary wclk", "general purpose input",
181 "general purpose output", "clkout", "INT1 interrupt",
182 "IN2 interrupt", "output digital microphone",
183 "SAR ADC interrupt", "data output for ASI1"};
184
185static const char *bclk2_pincontrol[] = {
186 "diabled", "ASI1 secondary wclk", "general purpose input",
187 "general purpose output", "clkout", "INT1 interrupt",
188 "IN2 interrupt", "output digital microphone",
189 "SAR ADC interrupt", "data output for ASI1"};
190
191static const char *dout2_pincontrol[] = {
192 "disabled", "ASI2 Data Output", "General Purpose Output",
193 "INT1 Interrupt", "INT2 Interrupt", "SAR ADC interrupt",
194 "Output for digital microphone", "Data Output for ASI1"};
195
196static const char *din2_pincontrol[] = {"disabled", "enabled"};
197
198static const char *wclk3_pincontrol[] = {
199 "Disabled", "ASI3 WCLK", "General Purpose Input",
200 "General Purpose output", "Data Output for ASI1"};
201
202static const char *bclk3_pincontrol[] = {
203 "Disabled", "ASI3 BCLK", "General Purpose Input",
204 "General Purpose output", "Data Output for ASI1"};
205
206static const char *dout3_pincontrol[] = {
207 "disabled", "ASI3 data ooutput", "General Purpose Output",
208 "ASI1 Word Clock Output", "Data Output for ASI1"};
209
210static const char *din3_pincontrol[] = {"disabled", "enabled"};
211
212static const char *clkin[] = {
213 "mclk1", "bclk1", "gpio1", "pll_clk", "bclk2", "gpi1",
214 "hf_ref_clk", "hf_osc_clk", "mclk2", "gpio2", "gpi2"};
215
216#endif
217#ifdef DAC_INDEPENDENT_VOL
218/*
219 *----------------------------------------------------------------------------
220 * Function : n_control_info
221 * Purpose : This function is to initialize data for new control required to
222 * program the AIC3262 registers.
223 *
224 *----------------------------------------------------------------------------
225 */
226static int n_control_info(struct snd_kcontrol *kcontrol,
227 struct snd_ctl_elem_info *uinfo)
228{
229 struct soc_mixer_control *mc =
230 (struct soc_mixer_control *)kcontrol->private_value;
231 int max = mc->max;
232 unsigned int shift = mc->shift;
233 unsigned int rshift = mc->rshift;
234
235 if (max == 1)
236 uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
237 else
238 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
239
240 uinfo->count = shift == rshift ? 1 : 2;
241 uinfo->value.integer.min = 0;
242 uinfo->value.integer.max = max;
243 return 0;
244}
245
246/*
247 *----------------------------------------------------------------------------
248 * Function : n_control_get
249 * Purpose : This function is to read data of new control for
250 * program the AIC3262 registers.
251 *
252 *----------------------------------------------------------------------------
253 */
254static int n_control_get(struct snd_kcontrol *kcontrol,
255 struct snd_ctl_elem_value *ucontrol)
256{
257 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
258 u32 val;
259 unsigned short mask, shift;
260 struct soc_mixer_control *mc =
261 (struct soc_mixer_control *)kcontrol->private_value;
262 if (!strcmp(kcontrol->id.name, "Left DAC Volume")) {
263 mask = AIC3262_8BITS_MASK;
264 shift = 0;
265 val = snd_soc_read(codec, mc->reg);
266 ucontrol->value.integer.value[0] =
267 (val <= 48) ? (val + 127) : (val - 129);
268 }
269 if (!strcmp(kcontrol->id.name, "Right DAC Volume")) {
270 mask = AIC3262_8BITS_MASK;
271 shift = 0;
272 val = snd_soc_read(codec, mc->reg);
273 ucontrol->value.integer.value[0] =
274 (val <= 48) ? (val + 127) : (val - 129);
275 }
276
277 return 0;
278}
279
280/*
281 *----------------------------------------------------------------------------
282 * Function : __new_control_put
283 * Purpose : new_control_put is called to pass data from user/application to
284 * the driver.
285 *
286 *----------------------------------------------------------------------------
287 */
288static int n_control_put(struct snd_kcontrol *kcontrol,
289 struct snd_ctl_elem_value *ucontrol)
290{
291 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
292 struct soc_mixer_control *mc =
293 (struct soc_mixer_control *)kcontrol->private_value;
294 u8 val, val_mask;
295 int reg, err;
296 unsigned int invert = mc->invert;
297 int max = mc->max;
298 DBG("n_control_put\n");
299 reg = mc->reg;
300 val = ucontrol->value.integer.value[0];
301 if (invert)
302 val = max - val;
303 if (!strcmp(kcontrol->id.name, "Left DAC Volume")) {
304 DBG("LDAC\n");
305 val = (val >= 127) ? (val - 127) : (val + 129);
306 val_mask = AIC3262_8BITS_MASK;
307 }
308 if (!strcmp(kcontrol->id.name, "Right DAC Volume")) {
309 DBG("RDAC\n");
310 val = (val >= 127) ? (val - 127) : (val + 129);
311 val_mask = AIC3262_8BITS_MASK;
312 }
313
314 err = snd_soc_update_bits_locked(codec, reg, val_mask, val);
315 if (err < 0) {
316 printk(KERN_ERR "Error while updating bits\n");
317 return err;
318 }
319
320 return 0;
321}
322#endif /*#ifdef DAC_INDEPENDENT_VOL*/
323/*
324 *------------------------------------------------------------------------------
325 * snd_soc_info_volsw_2r_n - double mixer info callback
326 * @kcontrol: mixer control
327 * @uinfo: control element information
328 *
329 * Callback to provide information about a double mixer control that
330 * spans 2 codec registers.
331 *
332 * Returns 0 for success.
333 *------------------------------------------------------------------------------
334 */
335int snd_soc_info_volsw_2r_n(struct snd_kcontrol *kcontrol,
336 struct snd_ctl_elem_info *uinfo)
337{
338 struct soc_mixer_control *mc =
339 (struct soc_mixer_control *)kcontrol->private_value;
340 int max = mc->max;
341
342 if (max == 1)
343 uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
344 else
345 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
346
347 uinfo->count = 2;
348 uinfo->value.integer.min = 0;
349 uinfo->value.integer.max = max;
350 return 0;
351}
352
353/*
354 *------------------------------------------------------------------------------
355 * snd_soc_get_volsw_2r_n - double mixer get callback
356 * @kcontrol: mixer control
357 * @ucontrol: control element information
358 *
359 * Callback to get the value of a double mixer control that spans 2 registers.
360 *
361 * Returns 0 for success.
362 *------------------------------------------------------------------------------
363 */
364int snd_soc_get_volsw_2r_n(struct snd_kcontrol *kcontrol,
365 struct snd_ctl_elem_value *ucontrol)
366{
367 struct soc_mixer_control *mc =
368 (struct soc_mixer_control *)kcontrol->private_value;
369 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
370 unsigned int reg = mc->reg;
371 unsigned int reg2 = mc->rreg;
372 unsigned int shift = mc->shift;
373 int max = mc->max;
374 unsigned int mask;
375 unsigned int invert = mc->invert;
376 unsigned short val, val2;
377
378 if (!strcmp(kcontrol->id.name, "PCM Playback Volume")) {
379 mask = AIC3262_8BITS_MASK;
380 shift = 0;
381 } else if (!strcmp(kcontrol->id.name, "HP Driver Gain")) {
382 mask = 0x3F;
383 shift = 0;
384 } else if (!strcmp(kcontrol->id.name, "PGA Capture Volume")) {
385 mask = 0x7F;
386 shift = 0;
387 } else if (!strcmp(kcontrol->id.name, "REC Driver Volume")) {
388 mask = 0x3F;
389 shift = 0;
390 } else if (!strcmp(kcontrol->id.name, "LO to HP Volume")) {
391 mask = 0x7F;
392 shift = 0;
393 } else if (!strcmp(kcontrol->id.name, "MA Volume")) {
394 mask = 0x7F;
395 shift = 0;
396 } else {
397 printk(KERN_ERR "Invalid kcontrol name\n");
398 return -1;
399 }
400
401 /* Read, update the corresponding Registers */
402 val = (snd_soc_read(codec, reg) >> shift) & mask;
403 val2 = (snd_soc_read(codec, reg2) >> shift) & mask;
404
405 if (!strcmp(kcontrol->id.name, "PCM Playback Volume")) {
406 ucontrol->value.integer.value[0] =
407 (val <= 48) ? (val + 127) : (val - 129);
408 ucontrol->value.integer.value[1] =
409 (val2 <= 48) ? (val2 + 127) : (val2 - 129);
410 } else if (!strcmp(kcontrol->id.name, "HP Driver Gain")) {
411 ucontrol->value.integer.value[0] =
412 (val >= 57) ? (val - 57) : (val + 7);
413 ucontrol->value.integer.value[1] =
414 (val2 >= 57) ? (val2 - 57) : (val2 + 7);
415 } else if (!strcmp(kcontrol->id.name, "PGA Capture Volume")) {
416 ucontrol->value.integer.value[0] =
417 (val <= 40) ? (val + 24) : (val - 104);
418 ucontrol->value.integer.value[1] =
419 (val2 <= 40) ? (val2 + 24) : (val2 - 104);
420 } else if (!strcmp(kcontrol->id.name, "REC Driver Volume")) {
421 ucontrol->value.integer.value[0] = ((val >= 0) & (val <= 29)) ?
422 (val + 7) : (val - 57);
423 ucontrol->value.integer.value[1] = ((val2 >= 0) &
424 (val2 <= 29)) ? (val2 + 7) : (val2 - 57);
425
426 } else if (!strcmp(kcontrol->id.name, "LO to HP Volume")) {
427 ucontrol->value.integer.value[0] = ((val >= 0) & (val <= 116)) ?
428 (val + 1) : ((val == 127) ? (0) : (117));
429 ucontrol->value.integer.value[1] = ((val2 >= 0) & (val2 <= 116))
430 ? (val2 + 1) : ((val2 == 127) ? (0) : (117));
431
432 } else if (!strcmp(kcontrol->id.name, "MA Volume")) {
433 ucontrol->value.integer.value[0] = (val <= 40) ?
434 (41 - val) : (val = 0);
435 ucontrol->value.integer.value[1] = (val2 <= 40) ?
436 (41 - val2) : (val2 = 0);
437 }
438
439 if (invert) {
440 ucontrol->value.integer.value[0] =
441 max - ucontrol->value.integer.value[0];
442 ucontrol->value.integer.value[1] =
443 max - ucontrol->value.integer.value[1];
444 }
445
446 return 0;
447}
448/*
449*-------------------------------------------------------------------------------
450* snd_soc_put_volsw_2r_n - double mixer set callback
451* @kcontrol: mixer control
452* @ucontrol: control element information
453*
454* Callback to set the value of a double mixer control that spans 2 registers.
455*
456* Returns 0 for success.
457*-------------------------------------------------------------------------------
458*/
459int snd_soc_put_volsw_2r_n(struct snd_kcontrol *kcontrol,
460 struct snd_ctl_elem_value *ucontrol)
461{
462 struct soc_mixer_control *mc =
463 (struct soc_mixer_control *)kcontrol->private_value;
464 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
465 unsigned int reg = mc->reg;
466 unsigned int reg2 = mc->rreg;
467 unsigned int shift = mc->shift;
468 int max = mc->max;
469 unsigned int mask;
470 unsigned int invert = mc->invert;
471 int err;
472 unsigned short val, val2, val_mask;
473
474 mask = 0x00FF;
475
476 val = (ucontrol->value.integer.value[0] & mask);
477 val2 = (ucontrol->value.integer.value[1] & mask);
478 if (invert) {
479 val = max - val;
480 val2 = max - val2;
481 }
482
483 /* Check for the string name of the kcontrol */
484 if (!strcmp(kcontrol->id.name, "PCM Playback Volume")) {
485 val = (val >= 127) ? (val - 127) : (val + 129);
486 val2 = (val2 >= 127) ? (val2 - 127) : (val2 + 129);
487 val_mask = AIC3262_8BITS_MASK; /* 8 bits */
488 } else if ((!strcmp(kcontrol->id.name, "HP Driver Gain")) ||
489 (!strcmp(kcontrol->id.name, "LO Driver Gain"))) {
490 val = (val <= 6) ? (val + 57) : (val - 7);
491 val2 = (val2 <= 6) ? (val2 + 57) : (val2 - 7);
492 val_mask = 0x3F; /* 6 bits */
493 DBG("val=%d, val2=%d", val, val2);
494 } else if (!strcmp(kcontrol->id.name, "PGA Capture Volume")) {
495 val = (val >= 24) ? ((val <= 64) ?
496 (val-24) : (40)) : (val + 104);
497 val2 = (val2 >= 24) ?
498 ((val2 <= 64) ? (val2 - 24) : (40)) : (val2 + 104);
499 val_mask = 0x7F; /* 7 bits */
500 } else if (!strcmp(kcontrol->id.name, "LO to REC Volume")) {
501
502 val = (val <= 116) ?
503 (val % 116) : ((val == 117) ? (127) : (117));
504 val2 = (val2 <= 116) ?
505 (val2 % 116) : ((val2 == 117) ? (127) : (117));
506 val_mask = 0x7F;
507 } else if (!strcmp(kcontrol->id.name, "REC Driver Volume")) {
508
509 val = (val <= 7) ? (val + 57) : ((val < 36) ? (val - 7) : (29));
510 val2 = (val2 <= 7) ?
511 (val2 + 57) : ((val2 < 36) ? (val2 - 7) : (29));
512 val_mask = 0x3F;
513 } else if (!strcmp(kcontrol->id.name, "LO to HP Volume")) {
514
515 val = ((val > 0) & (val <= 117)) ?
516 (val - 1) : ((val == 0) ? (127) : (116));
517 val2 = ((val2 > 0) & (val2 <= 117)) ?
518 (val2 - 1) : ((val2 == 0) ? (127) : (116));
519 val_mask = 0x7F;
520 } else if (!strcmp(kcontrol->id.name, "MA Volume")) {
521
522 val = ((val <= 41) & (val > 0)) ?
523 (41 - val) : ((val > 41) ? (val = 41) : (63));
524 val2 = ((val2 <= 41) & (val2 > 0)) ?
525 (41 - val2) : ((val2 > 41) ? (val2 = 41) : (63));
526 val_mask = 0x7F;
527 } else {
528 printk(KERN_ERR "Invalid control name\n");
529 return -1;
530 }
531
532 val = val << shift;
533 val2 = val2 << shift;
534
535 err = snd_soc_update_bits_locked(codec, reg, val_mask, val);
536 if (err < 0)
537 return err;
538
539 err = snd_soc_update_bits_locked(codec, reg2, val_mask, val2);
540 return err;
541}
542
543static int __new_control_info(struct snd_kcontrol *kcontrol,
544 struct snd_ctl_elem_info *uinfo)
545{
546 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
547 uinfo->count = 1;
548 uinfo->value.integer.min = 0;
549 uinfo->value.integer.max = 65535;
550
551 return 0;
552}
553
554/*
555 *----------------------------------------------------------------------------
556 * Function : __new_control_get
557 * Purpose : This function is to read data of new control for
558 * program the AIC3262 registers.
559 *
560 *----------------------------------------------------------------------------
561 */
562static int __new_control_get(struct snd_kcontrol *kcontrol,
563 struct snd_ctl_elem_value *ucontrol)
564{
565 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
566 u32 val;
567 val = snd_soc_read(codec, aic3262_reg_ctl);
568 ucontrol->value.integer.value[0] = val;
569 return 0;
570}
571
572/*
573 *----------------------------------------------------------------------------
574 * Function : __new_control_put
575 * Purpose : new_control_put is called to pass data from user/application to
576 * the driver.
577 *
578 *----------------------------------------------------------------------------
579 */
580static int __new_control_put(struct snd_kcontrol *kcontrol,
581 struct snd_ctl_elem_value *ucontrol)
582{
583 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
584 struct aic3262_priv *aic3262 = snd_soc_codec_get_drvdata(codec);
585 u8 data[2];
586 int ret = 0;
587
588 u32 data_from_user = ucontrol->value.integer.value[0];
589
590 aic3262_change_book(codec, 0);
591 aic3262_reg_ctl = data[0] = (u8) ((data_from_user & 0xFF00) >> 8);
592 data[1] = (u8) ((data_from_user & 0x00FF));
593
594 if (!data[0])
595 aic3262->page_no = data[1];
596
597 DBG("reg = %d val = %x\n", data[0], data[1]);
598#if defined(LOCAL_REG_ACCESS)
599 if (codec->hw_write(codec->control_data, data, 2) != 2)
600 ret = -EIO;
601#else
602 ret = snd_soc_write(codec, data[0], data[1]);
603#endif
604 if (ret)
605 printk(KERN_ERR "Error in i2c write\n");
606
607 return ret;
608}
609
610
611/*
612 *****************************************************************************
613 * Structure Initialization
614 *****************************************************************************
615 */
616static const DECLARE_TLV_DB_SCALE(dac_vol_tlv, -6350, 50, 0);
617static const DECLARE_TLV_DB_SCALE(adc_vol_tlv, -1200, 50, 0);
618static const DECLARE_TLV_DB_SCALE(spk_gain_tlv, 600, 600, 0);
619static const DECLARE_TLV_DB_SCALE(output_gain_tlv, -600, 100, 0);
620static const DECLARE_TLV_DB_SCALE(micpga_gain_tlv, 0, 50, 0);
621static const DECLARE_TLV_DB_SCALE(adc_fine_gain_tlv, -40, 10, 0);
622static const DECLARE_TLV_DB_SCALE(beep_gen_volume_tlv, -6300, 100, 0);
623
624/* Chip-level Input and Output CM Mode Controls */
625static const char *input_common_mode_text[] = {
626 "0.9v", "0.75v" };
627
628static const char *output_common_mode_text[] = {
629 "Input CM", "1.25v", "1.5v", "1.65v" };
630
631static const struct soc_enum input_cm_mode =
632 SOC_ENUM_SINGLE(CM_REG, 2, 2, input_common_mode_text);
633
634static const struct soc_enum output_cm_mode =
635 SOC_ENUM_SINGLE(CM_REG, 0, 4, output_common_mode_text);
636
637/*
638 *****************************************************************************
639 * Structure Initialization
640 *****************************************************************************
641 */
642static const struct snd_kcontrol_new aic3262_snd_controls[] = {
643 /* Output */
644#ifndef DAC_INDEPENDENT_VOL
645 /* sound new kcontrol for PCM Playback volume control */
646
647 SOC_DOUBLE_R_SX_TLV("PCM Playback Volume",
648 DAC_LVOL, DAC_RVOL, 8,0xffffff81, 0x30, dac_vol_tlv),
649#endif
650 /*HP Driver Gain Control*/
651 SOC_DOUBLE_R_SX_TLV("HeadPhone Driver Amplifier Volume",
652 HPL_VOL, HPR_VOL, 6, 0xfffffffa, 0xe, output_gain_tlv),
653
654 /*LO Driver Gain Control*/
655 SOC_DOUBLE_TLV("Speaker Amplifier Volume",
656 SPK_AMP_CNTL_R4, 4, 0, 5, 0, spk_gain_tlv),
657
658 SOC_DOUBLE_R_SX_TLV("Receiver Amplifier Volume",
659 REC_AMP_CNTL_R5, RAMPR_VOL, 6, 0xfffffffa, 0x1d, output_gain_tlv),
660
661 SOC_DOUBLE_R_SX_TLV("PCM Capture Volume",
662 LADC_VOL, RADC_VOL, 7,0xffffff68, 0x24, adc_vol_tlv),
663
664
665 SOC_DOUBLE_R_TLV ("MicPGA Volume Control",
666 MICL_PGA, MICR_PGA, 0, 0x5F, 0, micpga_gain_tlv),
667 SOC_DOUBLE_TLV("PCM Capture Fine Gain Volume",
668 ADC_FINE_GAIN, 4, 0, 5, 1, adc_fine_gain_tlv),
669
670 SOC_DOUBLE("ADC channel mute", ADC_FINE_GAIN, 7, 3, 1, 0),
671
672 SOC_DOUBLE("DAC MUTE", DAC_MVOL_CONF, 2, 3, 1, 1),
673
674 /* sound new kcontrol for Programming the registers from user space */
675 SOC_SINGLE_AIC3262("Program Registers"),
676
677 SOC_SINGLE("RESET", RESET_REG, 0,1,0),
678
679 SOC_SINGLE("DAC VOL SOFT STEPPING", DAC_MVOL_CONF, 0, 2, 0),
680
681#ifdef DAC_INDEPENDENT_VOL
682 /*SOC_SINGLE_N("Left DAC Volume", DAC_LVOL, 0, 0xAF, 0),
683 SOC_SINGLE_N("Right DAC Volume", DAC_RVOL, 0, 0xAF, 0),*/
684#endif
685
686 SOC_SINGLE("DAC AUTO MUTE CONTROL", DAC_MVOL_CONF, 4, 7, 0),
687 SOC_SINGLE("RIGHT MODULATOR SETUP", DAC_MVOL_CONF, 7, 1, 0),
688
689 SOC_SINGLE("ADC Volume soft stepping", ADC_CHANNEL_POW, 0, 3, 0),
690
691 SOC_DOUBLE_R("MICPGA enable/disable",MICL_PGA,MICR_PGA,7, 1, 0),
692
693 SOC_SINGLE("Mic Bias ext independent enable", MIC_BIAS_CNTL, 7, 1, 0),
694 SOC_SINGLE("MICBIAS_EXT ON", MIC_BIAS_CNTL, 6, 1, 0),
695 SOC_SINGLE("MICBIAS EXT Power Level", MIC_BIAS_CNTL, 4, 3, 0),
696
697 SOC_SINGLE("MICBIAS_INT ON", MIC_BIAS_CNTL, 2, 1, 0),
698 SOC_SINGLE("MICBIAS INT Power Level", MIC_BIAS_CNTL, 0, 3, 0),
699
700 SOC_DOUBLE("DRC_EN_CTL", DRC_CNTL_R1, 6, 5, 1, 0),
701 SOC_SINGLE("DRC_THRESHOLD_LEVEL", DRC_CNTL_R1, 2, 7, 1),
702 SOC_SINGLE("DRC_HYSTERISIS_LEVEL", DRC_CNTL_R1, 0, 7, 0),
703
704 SOC_SINGLE("DRC_HOLD_LEVEL", DRC_CNTL_R2, 3, 0x0F, 0),
705 SOC_SINGLE("DRC_GAIN_RATE", DRC_CNTL_R2, 0, 4, 0),
706 SOC_SINGLE("DRC_ATTACK_RATE", DRC_CNTL_R3, 4, 0x0F, 1),
707 SOC_SINGLE("DRC_DECAY_RATE", DRC_CNTL_R3, 0, 0x0F, 1),
708
709 SOC_SINGLE("BEEP_GEN_EN", BEEP_CNTL_R1, 7, 1, 0),
710 SOC_DOUBLE_R("BEEP_VOL_CNTL", BEEP_CNTL_R1, BEEP_CNTL_R2, 0, 0x0F, 1),
711 SOC_SINGLE("BEEP_MAS_VOL", BEEP_CNTL_R2, 6, 3, 0),
712
713 SOC_DOUBLE_R("AGC_EN", LAGC_CNTL, RAGC_CNTL, 7, 1, 0),
714 SOC_DOUBLE_R("AGC_TARGET_LEVEL", LAGC_CNTL, RAGC_CNTL, 4, 7, 1),
715
716 SOC_DOUBLE_R("AGC_GAIN_HYSTERESIS", LAGC_CNTL, RAGC_CNTL, 0, 3, 0),
717 SOC_DOUBLE_R("AGC_HYSTERESIS", LAGC_CNTL_R2, RAGC_CNTL_R2, 6, 3, 0),
718 SOC_DOUBLE_R("AGC_NOISE_THRESHOLD", LAGC_CNTL_R2,
719 RAGC_CNTL_R2, 1, 31, 1),
720
721 SOC_DOUBLE_R("AGC_MAX_GAIN", LAGC_CNTL_R3, RAGC_CNTL_R3, 0, 116, 0),
722 SOC_DOUBLE_R("AGC_ATCK_TIME", LAGC_CNTL_R4, RAGC_CNTL_R4, 3, 31, 0),
723 SOC_DOUBLE_R("AGC_ATCK_SCALE_FACTOR",
724 LAGC_CNTL_R4, RAGC_CNTL_R4, 0, 7, 0),
725
726 SOC_DOUBLE_R("AGC_DECAY_TIME", LAGC_CNTL_R5, RAGC_CNTL_R5, 3, 31, 0),
727 SOC_DOUBLE_R("AGC_DECAY_SCALE_FACTOR",
728 LAGC_CNTL_R5, RAGC_CNTL_R5, 0, 7, 0),
729 SOC_DOUBLE_R("AGC_NOISE_DEB_TIME", LAGC_CNTL_R6,
730 RAGC_CNTL_R6, 0, 31, 0),
731
732 SOC_DOUBLE_R("AGC_SGL_DEB_TIME", LAGC_CNTL_R7,
733 RAGC_CNTL_R7, 0, 0x0F, 0),
734
735 SOC_SINGLE("DAC PRB Selection",DAC_PRB, 0, 25, 0),
736 SOC_SINGLE("HP_DEPOP", HP_DEPOP, 0, 255,0),
737 SOC_DOUBLE("IN1 LO BYPASS VOLUME" , LINE_AMP_CNTL_R2, 3, 0, 3, 1),
738 SOC_ENUM("Input CM mode", input_cm_mode),
739 SOC_ENUM("Output CM mode", output_cm_mode),
740};
741
742
743/* the sturcture contains the different values for mclk */
744static const struct aic3262_rate_divs aic3262_divs[] = {
745/*
746 * mclk, rate, p_val, pll_j, pll_d, dosr, ndac, mdac, aosr, nadc, madc, blck_N,
747 * codec_speficic_initializations
748 */
749 /* 8k rate */
750#ifdef CONFIG_MINI_DSP
751 {12000000, 8000, 1, 8, 1920, 768, 8, 2, 128, 8, 12, 4,
752 {{0, 60, 0}, {0, 61, 0} } },
753#else
754 {12000000, 8000, 1, 8, 1920, 128, 12, 8, 128, 8, 6, 4,
755 {{0, 60, 1}, {0, 61, 1} } },
756 {12288000, 8000, 1, 1, 3333, 128, 12, 8, 128, 8, 6, 4,
757 {{0, 60, 1}, {0, 61, 1} } },
758 {24000000, 8000, 1, 4, 96, 128, 12, 8, 128, 12, 8, 4,
759 {{0, 60, 1}, {0, 61, 1} } },
760#endif
761 /* 11.025k rate */
762 {12000000, 11025, 1, 1, 8816, 1024, 8, 2, 128, 8, 2, 48,
763 {{0, 60, 1}, {0, 61, 1} } },
764 {12288000, 11025, 1, 1, 8375, 1024, 8, 2, 128, 8, 2, 48,
765 {{0, 60, 1}, {0, 61, 1} } },
766 {24000000, 11025, 1, 3, 7632, 128, 8, 8, 128, 8, 8, 4,
767 {{0, 60, 1}, {0, 61, 1} } },
768
769 /* 16k rate */
770#ifdef CONFIG_MINI_DSP
771 {12000000, 16000, 1, 8, 1920, 384, 4, 4, 128, 4, 12, 12,
772 {{0, 60, 0}, {0, 61, 0} } },
773 {12288000, 16000, 1, 9, 0, 216, 2, 16, 72, 2, 48, 27,
774 {{0, 60, 0}, {0, 61, 0} } },
775#else
776 {12000000, 16000, 1, 8, 1920, 128, 8, 6, 128, 8, 6, 4,
777 {{0, 60, 1}, {0, 61, 1} } },
778 {12288000, 16000, 1, 2, 6667, 128, 8, 6, 128, 8, 6, 4,
779 {{0, 60, 1}, {0, 61, 1} } },
780 {24000000, 16000, 1, 4, 96, 128, 8, 6, 128, 8, 6, 4,
781 {{0, 60, 1}, {0, 61, 1} } },
782#endif
783 /* 22.05k rate */
784 {12000000, 22050, 1, 3, 7632, 128, 8, 2, 128, 8, 2, 4,
785 {{0, 60, 1}, {0, 61, 1} } },
786 {12288000, 22050, 1, 3, 675, 128, 8, 2, 128, 8, 2, 4,
787 {{0, 60, 1}, {0, 61, 1} } },
788 {24000000, 22050, 1, 3, 7632, 128, 8, 3, 128, 8, 3, 4,
789 {{0, 60, 1}, {0, 61, 1} } },
790 /* 32k rate */
791 {12000000, 32000, 1, 5, 4613, 128, 8, 2, 128, 8, 2, 4,
792 {{0, 60, 1}, {0, 61, 1} } },
793 {12288000, 32000, 1, 5, 3333, 128, 8, 2, 128, 8, 2, 4,
794 {{0, 60, 1}, {0, 61, 1} } },
795 {24000000, 32000, 1, 4, 96, 128, 6, 4, 128, 6, 4, 4,
796 {{0, 60, 1}, {0, 61, 1} } },
797
798#ifdef CONFIG_MINI_DSP
799 {12000000, 44100, 1, 7, 5264, 128, 2, 8, 128, 2, 8, 4,
800 {{0, 60, 0}, {0, 61, 0} } },
801 {12288000, 44100, 1, 7, 3548, 128, 2, 8, 128, 8, 2, 4,
802 {{0, 60, 0}, {0, 61, 0} } },
803#else
804 /* 44.1k rate */
805 {12000000, 44100, 1, 7, 5264, 128, 8, 2, 128, 8, 2, 4,
806 {{0, 60, 1}, {0, 61, 1} } },
807 {12288000, 44100, 1, 7, 3548, 128, 8, 2, 128, 8, 2, 4,
808 {{0, 60, 1}, {0, 61, 1} } },
809 {24000000, 44100, 1, 3, 7632, 128, 4, 4, 64, 4, 4, 4,
810 {{0, 60, 1}, {0, 61, 1} } },
811#endif
812
813#ifdef CONFIG_MINI_DSP
814 {12288000, 48000, 1, 8, 52, 128, 2, 8, 128, 2, 8, 4,
815 {{0, 60, 0}, {0, 61, 0} } },
816 {12000000, 48000, 1, 8, 1920, 128, 2, 8, 128, 2, 8, 4,
817 {{0, 60, 0}, {0, 61, 0}}},
818#else
819 /* 48k rate */
820 {12000000, 48000, 1, 8, 1920, 128, 8, 2, 128, 8, 2, 4,
821 {{0, 60, 1}, {0, 61, 1} } },
822 {12288000, 48000, 1, 8, 52, 128, 8, 2, 128, 8, 2, 4,
823 {{0, 60, 1}, {0, 61, 1} } },
824 {24000000, 48000, 1, 4, 960, 128, 4, 4, 128, 4, 4, 4,
825 {{0, 60, 1}, {0, 61, 1} } },
826#endif
827
828 /*96k rate */
829 {12000000, 96000, 1, 16, 3840, 128, 8, 2, 128, 8, 2 , 4,
830 {{0, 60, 7}, {0, 61, 7} } },
831 {24000000, 96000, 1, 4, 960, 128, 4, 2, 128, 4, 2, 2,
832 {{0, 60, 7}, {0, 61, 7} } },
833 /*192k */
834 {12000000, 192000, 1, 32, 7680, 128, 8, 2, 128, 8, 2, 4,
835 {{0, 60, 17}, {0, 61, 13} } },
836 {24000000, 192000, 1, 4, 960, 128, 2, 2, 128, 2, 2, 4,
837 {{0, 60, 17}, {0, 61, 13} } },
838};
839
840
841
842/*
843*----------------------------------------------------------------------------
844* Function : aic3262_multi_i2s_dump_regs
845* Purpose : This function is to mute or unmute the left and right DAC
846*
847*----------------------------------------------------------------------------
848*/
849static void aic3262_multi_i2s_dump_regs(struct snd_soc_dai *dai)
850{
851 struct snd_soc_codec *codec = dai->codec;
852 struct aic3262_priv *aic3262 = snd_soc_codec_get_drvdata(codec);
853 unsigned int counter;
854
855 DBG(KERN_INFO "#%s: Dai Active %d ASI%d REGS DUMP\n",
856 __func__, aic3262->active_count, dai->id);
857
858 aic3262_change_page(codec, 0);
859 aic3262_change_book(codec, 0);
860
861 DBG(KERN_INFO "#Page0 REGS..\n");
862 for (counter = 0; counter < 85; counter++) {
863 DBG(KERN_INFO "#%2d -> 0x%x\n", counter,
864 snd_soc_read(codec, counter));
865 }
866
867 DBG(KERN_INFO "#Page1 REGS..\n");
868 for (counter = 128; counter < 176; counter++) {
869 DBG(KERN_INFO "#%2d -> 0x%x\n", (counter % 128),
870 snd_soc_read(codec, counter));
871 }
872
873 DBG(KERN_INFO "#Page4 REGS..\n");
874 for (counter = 512; counter < 631; counter++) {
875 DBG(KERN_INFO "#%2d -> 0x%x\n",
876 (counter % 128), snd_soc_read(codec, counter));
877 }
878
879 for (counter = 0; counter < MAX_ASI_COUNT; counter++) {
880 DBG(KERN_INFO "#ASI%d Frame %s @ %dHz Playback %d Record %d\n",
881 (counter + 1),
882 (aic3262->asiCtxt[counter].master == 1) ? "Master" : "Slave",
883 aic3262->asiCtxt[counter].sampling_rate,
884 aic3262->asiCtxt[counter].playback_mode,
885 aic3262->asiCtxt[counter].capture_mode);
886 DBG(KERN_INFO "#DAC Option [%d,%d] ADC Option %d WLEN %d\n\n",
887 aic3262->asiCtxt[counter].left_dac_output,
888 aic3262->asiCtxt[counter].right_dac_output,
889 aic3262->asiCtxt[counter].adc_input,
890 aic3262->asiCtxt[counter].word_len);
891 }
892 return;
893}
894
895/*
896 *----------------------------------------------------------------------------
897 * Function : aic3262_multi_i2s_mute
898 * Purpose : This function is to mute or unmute the left and right DAC
899 *
900 *----------------------------------------------------------------------------
901 */
902static int aic3262_multi_i2s_mute(struct snd_soc_dai *dai, int mute)
903{
904 struct snd_soc_codec *codec = dai->codec;
905 struct aic3262_priv *aic3262 = snd_soc_codec_get_drvdata(codec);
906
907 DBG(KERN_INFO "#%s : mute entered with %d\n", __func__, mute);
908
909 /* If we are doing both Recording and Playback on this DAI interface,
910 * do not MUTE the Codec.
911 */
912 if (mute && (aic3262->asiCtxt[dai->id - 1].asi_active > 1)) {
913 DBG("#%s Cannot Mute the ASI%d Now..\n",
914 __func__, dai->id);
915 } else {
916 switch (dai->id) {
917 case 1:
918 aic3262_multi_i2s_asi1_mute(dai, mute);
919 break;
920 case 2:
921 aic3262_multi_i2s_asi2_mute(dai, mute);
922 break;
923 case 3:
924 aic3262_multi_i2s_asi3_mute(dai, mute);
925 break;
926 default:
927 printk(KERN_ERR "#%s: Invalid DAI id\n", __func__);
928 return -EINVAL;
929 }
930 }
931 DBG(KERN_INFO "#%s : mute ended\n", __func__);
932 return 0;
933}
934
935
936/*
937*----------------------------------------------------------------------------
938* Function : aic3262_multi_i2s_asi1_mute
939* Purpose : This function is to mute or unmute the left and right DAC
940*
941*----------------------------------------------------------------------------
942*/
943static int aic3262_multi_i2s_asi1_mute(struct snd_soc_dai *dai, int mute)
944{
945 struct snd_soc_codec *codec = dai->codec;
946 struct aic3262_priv *aic3262 = snd_soc_codec_get_drvdata(codec);
947
948 DBG(KERN_INFO "#%s : mute %d started\n", __func__, mute);
949
950 if (mute && !aic3262->asiCtxt[0].port_muted ) {
951 DBG(KERN_INFO "Mute if part\n");
952
953
954 snd_soc_update_bits(codec, DAC_MVOL_CONF, DAC_LR_MUTE_MASK,DAC_LR_MUTE);
955
956 /* First check if both Playback and Recording is going on
957 * this interface.
958 */
959 if (aic3262->asiCtxt[0].asi_active > 1) {
960 DBG("#%s Cannot Mute the ASI Now..\n", __func__);
961 } else if (!(aic3262->asiCtxt[1].playback_mode) &&
962 !(aic3262->asiCtxt[2].playback_mode)) {
963 /* Before Muting, please check if any other
964 * ASI is active. if so, we cannot simply mute the
965 * DAC and ADC Registers.
966 */
967 DBG("#%s None of the ASI's are active now..\n", __func__);
968 snd_soc_write(codec, DAC_MVOL_CONF,
969 ((aic3262->dac_reg & 0xF3) | 0x0C));
970 snd_soc_write(codec, ADC_FINE_GAIN,
971 ((aic3262->adc_gain & 0x77) | 0x88));
972 snd_soc_write(codec, HPL_VOL, 0xB9);
973 snd_soc_write(codec, HPR_VOL, 0xB9);
974 snd_soc_write(codec, REC_AMP_CNTL_R5, 0x39);
975 snd_soc_write(codec, RAMPR_VOL, 0x39);
976 snd_soc_write(codec, SPK_AMP_CNTL_R4, 0x00);
977 aic3262->asiCtxt[0].port_muted = 1;
978 }
979 } else {
980 DBG(KERN_INFO "Mute else part\n");
981 snd_soc_update_bits(codec, DAC_MVOL_CONF,
982 DAC_LR_MUTE_MASK, 0x0);
983 snd_soc_write(codec, ADC_FINE_GAIN,(0X00 & 0x77) | 0x0);
984 aic3262_multi_i2s_dump_regs(dai);
985 }
986
987 DBG(KERN_INFO "#%s : mute %d ended\n", __func__, mute);
988
989 return 0;
990}
991
992/*
993*----------------------------------------------------------------------------
994* Function : aic3262_multi_i2s_asi2_maic3262_asi3_clk_configute
995* Purpose : This function is to mute or unmute the left and right DAC
996*
997*----------------------------------------------------------------------------
998*/
999static int aic3262_multi_i2s_asi2_mute(struct snd_soc_dai *dai, int mute)
1000{
1001 struct snd_soc_codec *codec = dai->codec;
1002 struct aic3262_priv *aic3262 = snd_soc_codec_get_drvdata(codec);
1003
1004 DBG(KERN_INFO "#%s : mute %d started\n", __func__, mute);
1005
1006 if (mute && !aic3262->asiCtxt[1].port_muted ) {
1007 DBG(KERN_INFO "Mute if part\n");
1008 snd_soc_update_bits(codec, DAC_MVOL_CONF, DAC_LR_MUTE_MASK,DAC_LR_MUTE);
1009
1010 /* First check if both Playback and Recording is going on
1011 * this interface.
1012 */
1013 if (aic3262->asiCtxt[1].asi_active > 1) {
1014 DBG("#%s Cannot Mute the ASI Now..\n", __func__);
1015 } else if (!(aic3262->asiCtxt[0].playback_mode) &&
1016 !(aic3262->asiCtxt[2].playback_mode)) {
1017 /* Before Muting, please check if any other
1018 * ASI is active. if so, we cannot simply mute the
1019 * DAC and ADC Registers.
1020 */
1021 snd_soc_write(codec, DAC_MVOL_CONF,
1022 ((aic3262->dac_reg & 0xF3) | 0x0C));
1023 snd_soc_write(codec, ADC_FINE_GAIN,
1024 ((aic3262->adc_gain & 0x77) | 0x88));
1025 snd_soc_write(codec, HPL_VOL, 0xB9);
1026 snd_soc_write(codec, HPR_VOL, 0xB9);
1027 snd_soc_write(codec, REC_AMP_CNTL_R5, 0x39);
1028 snd_soc_write(codec, RAMPR_VOL, 0x39);
1029 snd_soc_write(codec, SPK_AMP_CNTL_R4, 0x00);
1030 aic3262->asiCtxt[1].port_muted = 1;
1031 }
1032 } else {
1033 DBG(KERN_INFO "Mute else part\n");
1034 snd_soc_update_bits(codec, DAC_MVOL_CONF,
1035 DAC_LR_MUTE_MASK, 0x0);
1036
1037 /*aic3262_multi_i2s_dump_regs(dai);*/
1038 }
1039
1040 DBG(KERN_INFO "#%s : mute %d ended\n", __func__, mute);
1041
1042 return 0;
1043}
1044
1045/*
1046*----------------------------------------------------------------------------
1047* Function : aic3262_multi_i2s_asi3_mute
1048* Purpose : This function is to mute or unmute the left and right DAC
1049*
1050*----------------------------------------------------------------------------
1051*/
1052static int aic3262_multi_i2s_asi3_mute(struct snd_soc_dai *dai, int mute)
1053{
1054 struct snd_soc_codec *codec = dai->codec;
1055 struct aic3262_priv *aic3262 = snd_soc_codec_get_drvdata(codec);
1056
1057 DBG(KERN_INFO "#%s : mute %d started\n", __func__, mute);
1058
1059 if (mute && !aic3262->asiCtxt[2].port_muted) {
1060 DBG("Mute if part\n");
1061 snd_soc_update_bits(codec, DAC_MVOL_CONF, DAC_LR_MUTE_MASK,DAC_LR_MUTE);
1062
1063 /* First check if both Playback and Recording is going on
1064 * this interface.
1065 */
1066 if (aic3262->asiCtxt[2].asi_active > 1) {
1067 DBG("#%s Cannot Mute the ASI Now..\n", __func__);
1068 } else if (!(aic3262->asiCtxt[0].playback_mode) &&
1069 !(aic3262->asiCtxt[1].playback_mode)) {
1070 /* Before Muting, please check if any other
1071 * ASI is active. if so, we cannot simply mute the
1072 * DAC and ADC Registers.
1073 */
1074 snd_soc_write(codec, DAC_MVOL_CONF,
1075 ((aic3262->dac_reg & 0xF3) | 0x0C));
1076 snd_soc_write(codec, ADC_FINE_GAIN,
1077 ((aic3262->adc_gain & 0x77) | 0x88));
1078 snd_soc_write(codec, HPL_VOL, 0xB9);
1079 snd_soc_write(codec, HPR_VOL, 0xB9);
1080 snd_soc_write(codec, REC_AMP_CNTL_R5, 0x39);
1081 snd_soc_write(codec, RAMPR_VOL, 0x39);
1082 snd_soc_write(codec, SPK_AMP_CNTL_R4, 0x00);
1083 aic3262->asiCtxt[2].port_muted = 1;
1084 }
1085 } else {
1086 DBG("Mute else part\n");
1087 snd_soc_update_bits(codec, DAC_MVOL_CONF,
1088 DAC_LR_MUTE_MASK, 0x0);
1089
1090 /*aic3262_multi_i2s_dump_regs(dai);*/
1091
1092 }
1093
1094 DBG(KERN_INFO "#%s : mute %d ended\n", __func__, mute);
1095
1096 return 0;
1097}
1098
1099/*
1100 *----------------------------------------------------------------------------
1101 * Function : aic3262_multi_i2s_set_dai_fmt
1102 * Purpose : This function is to set the DAI format
1103 *
1104 *----------------------------------------------------------------------------
1105 */
1106static int aic3262_multi_i2s_set_dai_fmt(struct snd_soc_dai *codec_dai,
1107 unsigned int fmt)
1108{
1109 /* Check the DAI Id and based on that switch the configuration for
1110 * the Individual ASI Port.
1111 */
1112 switch (codec_dai->id) {
1113 case 1:
1114 aic3262_multi_i2s_asi1_set_dai_fmt(codec_dai, fmt);
1115 break;
1116 case 2:
1117 aic3262_multi_i2s_asi2_set_dai_fmt(codec_dai, fmt);
1118 break;
1119 case 3:
1120 aic3262_multi_i2s_asi3_set_dai_fmt(codec_dai, fmt);
1121 break;
1122 default:
1123 printk(KERN_ERR
1124 "#%s: Invalid DAI interface format\n", __func__);
1125 return -EINVAL;
1126 }
1127 return 0;
1128}
1129
1130
1131
1132/*
1133*----------------------------------------------------------------------------
1134* Function : aic3262_multi_i2s_asi1_set_dai_fmt
1135* Purpose : This function is to set the DAI format for ASI1 Port
1136*
1137*----------------------------------------------------------------------------
1138*/
1139static int aic3262_multi_i2s_asi1_set_dai_fmt(struct snd_soc_dai *codec_dai,
1140 unsigned int fmt)
1141{
1142 struct snd_soc_codec *codec = codec_dai->codec;
1143 struct aic3262_priv *aic3262 = snd_soc_codec_get_drvdata(codec);
1144 u8 iface_reg, clk_reg;
1145 u8 regvalue;
1146
1147 DBG(KERN_INFO "%s: DAI_ID %d fmt %d\n",
1148 __func__, codec_dai->id, fmt);
1149
1150 /* Read the B0_P4_R4 and B0_P4_R10 Registers to configure the
1151 * ASI1 Bus and Clock Formats depending on the PCM Format.
1152 */
1153 iface_reg = snd_soc_read(codec, ASI1_BUS_FMT);
1154 clk_reg = snd_soc_read(codec, ASI1_BWCLK_CNTL_REG);
1155
1156 /* set master/slave audio interface */
1157 switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
1158 case SND_SOC_DAIFMT_CBM_CFM:
1159 DBG(KERN_INFO "#%s: Configuring ASI%d as Frame Master..\n",
1160 __func__, codec_dai->id);
1161 aic3262->asiCtxt[0].master = 1;
1162 clk_reg |= (BIT5 | BIT2); /* Codec Interface as Master */
1163 break;
1164 case SND_SOC_DAIFMT_CBS_CFS:
1165 DBG(KERN_INFO "#%s: Configuring ASI%d as Frame Slave..\n",
1166 __func__, codec_dai->id);
1167 clk_reg &= ~0xFC; /* Reset bits D[7:5] and D[4:2] to zero */
1168 aic3262->asiCtxt[0].master = 0;
1169 break;
1170 case SND_SOC_DAIFMT_CBS_CFM:
1171 /* new case..just for debugging */
1172 DBG(KERN_INFO "%s: SND_SOC_DAIFMT_CBS_CFM\n", __func__);
1173 aic3262->asiCtxt[0].master = 0;
1174 clk_reg |= BIT5; /* Only WCLK1 Output from Codec */
1175 clk_reg &= ~0x1C; /* BCLK1 Input to Codec */
1176 break;
1177 default:
1178 printk(KERN_ERR "#%s: Invalid DAI master/slave interface\n",
1179 __func__);
1180 return -EINVAL;
1181 }
1182 aic3262->asiCtxt[0].pcm_format = (fmt & SND_SOC_DAIFMT_FORMAT_MASK);
1183 /* interface format */
1184 switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
1185 case SND_SOC_DAIFMT_I2S:
1186 DBG(KERN_INFO "#%s: Configuring ASI%d for I2s Mode..\n",
1187 __func__, codec_dai->id);
1188 iface_reg = (iface_reg & 0x1f);
1189 break;
1190 case SND_SOC_DAIFMT_DSP_A:
1191 DBG(KERN_INFO "#%s: Configuring ASI%d for DSP_A Mode..\n",
1192 __func__, codec_dai->id);
1193 iface_reg = (iface_reg & 0x1f) | 0x20;
1194 break;
1195 case SND_SOC_DAIFMT_RIGHT_J:
1196 iface_reg = (iface_reg & 0x1f) | 0x40;
1197 break;
1198 case SND_SOC_DAIFMT_LEFT_J:
1199 iface_reg = (iface_reg & 0x1f) | 0x60;
1200 break;
1201 case SND_SOC_DAIFMT_DSP_B:
1202 DBG(KERN_INFO "#%s: Configuring ASI%d for DSP_B Mode..\n",
1203 __func__, codec_dai->id);
1204 iface_reg = (iface_reg & 0x1f) | 0x80;
1205 /* voice call need data offset in 1 bitclock */
1206 snd_soc_write(codec, ASI1_LCH_OFFSET, 1);
1207 break;
1208 default:
1209 printk(KERN_ERR
1210 "#%s: Invalid DAI interface format\n", __func__);
1211 return -EINVAL;
1212 }
1213 /* Also Configure the Pin Control Registers before writing into
1214 * the ASI specific Clock Control and Format Registers
1215 */
1216
1217 /* Configure B0_P4_R65_D[5:2] to 001 This configures the
1218 * WCLK1 Pin to ASI1
1219 */
1220 regvalue = snd_soc_read(codec, WCLK1_PIN_CNTL_REG);
1221 snd_soc_write(codec, WCLK1_PIN_CNTL_REG, (regvalue | BIT2));
1222
1223 /* Configure B0_P4_R68_d[6:5] = 01 and B0_P4_R67_D[4:1] to 0001
1224 * to ensure that the DIN1 and DOUT1 Pins are configured
1225 * correctly
1226 */
1227 regvalue = snd_soc_read(codec, DIN1_PIN_CNTL_REG);
1228 snd_soc_write(codec, DIN1_PIN_CNTL_REG, (regvalue | BIT5));
1229 regvalue = snd_soc_read(codec, DOUT1_PIN_CNTL_REG);
1230 snd_soc_write(codec, DOUT1_PIN_CNTL_REG, (regvalue | BIT1));
1231
1232 snd_soc_write(codec, ASI1_BWCLK_CNTL_REG, clk_reg);
1233
1234 snd_soc_write(codec, ASI1_BUS_FMT, iface_reg);
1235
1236 return 0;
1237}
1238
1239
1240/*
1241*----------------------------------------------------------------------------
1242* Function : aic3262_multi_i2s_asi2_set_dai_fmt
1243* Purpose : This function is to set the DAI format for ASI2 Port
1244*
1245*----------------------------------------------------------------------------
1246*/
1247static int aic3262_multi_i2s_asi2_set_dai_fmt(struct snd_soc_dai *codec_dai,
1248 unsigned int fmt)
1249{
1250 struct snd_soc_codec *codec = codec_dai->codec;
1251 struct aic3262_priv *aic3262 = snd_soc_codec_get_drvdata(codec);
1252 u8 iface_reg, clk_reg;
1253 u8 regvalue;
1254
1255 DBG(KERN_INFO "%s: DAI_ID %d fmt %d\n",
1256 __func__, codec_dai->id, fmt);
1257
1258 /* Read the B0_P4_R17 and B0_P4_R26 Registers to configure the
1259 * ASI1 Bus and Clock Formats depending on the PCM Format.
1260 */
1261 iface_reg = snd_soc_read(codec, ASI2_BUS_FMT);
1262 clk_reg = snd_soc_read(codec, ASI2_BWCLK_CNTL_REG);
1263
1264 /* set master/slave audio interface */
1265 switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
1266 case SND_SOC_DAIFMT_CBM_CFM:
1267 DBG(KERN_INFO "#%s: Configuring ASI%d as Frame Master..\n",
1268 __func__, codec_dai->id);
1269 aic3262->asiCtxt[1].master = 1;
1270 clk_reg |= (BIT5 | BIT2);
1271 break;
1272 case SND_SOC_DAIFMT_CBS_CFS:
1273 DBG(KERN_INFO "#%s: Configuring ASI%d as Frame Slave..\n",
1274 __func__, codec_dai->id);
1275
1276 clk_reg &= ~0xFC;
1277 aic3262->asiCtxt[1].master = 0;
1278 break;
1279 case SND_SOC_DAIFMT_CBS_CFM:
1280 /*new case..just for debugging */
1281 DBG(KERN_INFO "%s: SND_SOC_DAIFMT_CBS_CFM\n", __func__);
1282 aic3262->asiCtxt[1].master = 0;
1283 clk_reg |= BIT5;
1284 clk_reg &= ~0x1C;
1285 break;
1286 default:
1287 printk(KERN_ERR "#%s:Invalid DAI master/slave interface\n",
1288 __func__);
1289 return -EINVAL;
1290 }
1291 aic3262->asiCtxt[1].pcm_format = (fmt & SND_SOC_DAIFMT_FORMAT_MASK);
1292 /* interface format */
1293 switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
1294 case SND_SOC_DAIFMT_I2S:
1295 DBG(KERN_INFO "#%s: Configuring ASI%d for I2S Mode..\n",
1296 __func__, codec_dai->id);
1297 iface_reg = (iface_reg & 0x1f);
1298 break;
1299 case SND_SOC_DAIFMT_DSP_A:
1300 DBG(KERN_INFO "#%s: Configuring ASI%d for DSP_A Mode..\n",
1301 __func__, codec_dai->id);
1302 iface_reg = (iface_reg & 0x1f) | 0x20;
1303 break;
1304 case SND_SOC_DAIFMT_RIGHT_J:
1305 iface_reg = (iface_reg & 0x1f) | 0x40;
1306 break;
1307 case SND_SOC_DAIFMT_LEFT_J:
1308 iface_reg = (iface_reg & 0x1f) | 0x60;
1309 break;
1310 case SND_SOC_DAIFMT_DSP_B:
1311 DBG(KERN_INFO "#%s: Configuring ASI%d for DSP Mode..\n",
1312 __func__, codec_dai->id);
1313 iface_reg = (iface_reg & 0x1f) | 0x80;
1314 /* voice call need data offset in 1 bitclock */
1315 snd_soc_write(codec, ASI2_LCH_OFFSET, 1);
1316 break;
1317 default:
1318 printk(KERN_ERR "#%s:Invalid DAI interface format\n", __func__);
1319 return -EINVAL;
1320 }
1321
1322 /* Also Configure the Pin Control Registers before writing into
1323 * the ASI2 specific Clock Control and Format Registers
1324 */
1325
1326 /* Configure B0_P4_R69_D[5:2] to 001 This configures the
1327 * WCLK2 Pin to ASI2
1328 */
1329
1330 regvalue = snd_soc_read(codec, WCLK2_PIN_CNTL_REG);
1331 snd_soc_write(codec, WCLK2_PIN_CNTL_REG, (regvalue | BIT2));
1332
1333 regvalue = snd_soc_read(codec, BCLK2_PIN_CNTL_REG);
1334 snd_soc_write(codec, BCLK2_PIN_CNTL_REG, (regvalue | BIT2));
1335
1336 /* Configure B0_P4_R72_d[6:5] = 01 and B0_P4_R71_D[4:1] to 0001
1337 * to ensure that the DIN2 and DOUT2 Pins are configured
1338 * correctly
1339 */
1340 regvalue = snd_soc_read(codec, DIN2_PIN_CNTL_REG);
1341 snd_soc_write(codec, DIN2_PIN_CNTL_REG, (regvalue | BIT5));
1342
1343 regvalue = snd_soc_read(codec, DOUT2_PIN_CNTL_REG);
1344 snd_soc_write(codec, DOUT2_PIN_CNTL_REG, (regvalue | BIT5 | BIT1));
1345
1346 snd_soc_write(codec, ASI2_BWCLK_CNTL_REG, clk_reg);
1347
1348 snd_soc_write(codec, ASI2_BUS_FMT, iface_reg);
1349
1350 return 0;
1351}
1352
1353/*
1354*----------------------------------------------------------------------------
1355* Function : aic3262_multi_i2s_asi3_set_dai_fmt
1356* Purpose : This function is to set the DAI format for ASI3 Port
1357*
1358*----------------------------------------------------------------------------
1359*/
1360static int aic3262_multi_i2s_asi3_set_dai_fmt(struct snd_soc_dai *codec_dai,
1361 unsigned int fmt)
1362{
1363 struct snd_soc_codec *codec = codec_dai->codec;
1364 struct aic3262_priv *aic3262 = snd_soc_codec_get_drvdata(codec);
1365 u8 iface_reg, clk_reg;
1366 u8 regvalue;
1367
1368 DBG(KERN_INFO "%s: DAI_ID %d fmt %d\n",
1369 __func__, codec_dai->id, fmt);
1370
1371 /* Read the B0_P4_R33 and B0_P4_R42 Registers to configure the
1372 * ASI1 Bus and Clock Formats depending on the PCM Format.
1373 */
1374 iface_reg = snd_soc_read(codec, ASI3_BUS_FMT);
1375 clk_reg = snd_soc_read(codec, ASI3_BWCLK_CNTL_REG);
1376
1377 /* set master/slave audio interface */
1378 switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
1379 case SND_SOC_DAIFMT_CBM_CFM:
1380 DBG(KERN_INFO "#%s: Configuring ASI%d as Frame Master..\n",
1381 __func__, codec_dai->id);
1382 aic3262->asiCtxt[2].master = 1;
1383 clk_reg |= (BIT5 | BIT2);
1384 break;
1385 case SND_SOC_DAIFMT_CBS_CFS:
1386 DBG(KERN_INFO "#%s: Configuring ASI%d as Frame Slave..\n",
1387 __func__, codec_dai->id);
1388 clk_reg &= ~0xFC;
1389 aic3262->asiCtxt[2].master = 0;
1390 break;
1391 case SND_SOC_DAIFMT_CBS_CFM:
1392 /* new case..just for debugging */
1393 DBG(KERN_INFO "%s: SND_SOC_DAIFMT_CBS_CFM\n", __func__);
1394 aic3262->asiCtxt[2].master = 0;
1395 clk_reg |= BIT5;
1396 clk_reg &= ~0x1C;
1397 break;
1398 default:
1399 printk(KERN_ERR "Invalid DAI master/slave interface\n");
1400 return -EINVAL;
1401 }
1402 aic3262->asiCtxt[2].pcm_format = (fmt & SND_SOC_DAIFMT_FORMAT_MASK);
1403 /* interface format */
1404 switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
1405 case SND_SOC_DAIFMT_I2S:
1406 DBG(KERN_INFO "#%s: Configuring ASI%d for I2S Mode..\n",
1407 __func__, codec_dai->id);
1408 iface_reg = (iface_reg & 0x1f);
1409 break;
1410 case SND_SOC_DAIFMT_DSP_A:
1411 DBG(KERN_INFO "#%s: Configuring ASI%d for DSP_A Mode..\n",
1412 __func__, codec_dai->id);
1413 iface_reg = (iface_reg & 0x1f) | 0x20;
1414 break;
1415 case SND_SOC_DAIFMT_RIGHT_J:
1416 iface_reg = (iface_reg & 0x1f) | 0x40;
1417 break;
1418 case SND_SOC_DAIFMT_LEFT_J:
1419 iface_reg = (iface_reg & 0x1f) | 0x60;
1420 break;
1421 case SND_SOC_DAIFMT_DSP_B:
1422 DBG(KERN_INFO "#%s: Configuring ASI%d for DSP Mode..\n",
1423 __func__, codec_dai->id);
1424 iface_reg = (iface_reg & 0x1f) | 0x80;
1425 /* voice call need data offset in 1 bitclock */
1426 snd_soc_write(codec, ASI3_LCH_OFFSET, 1);
1427 break;
1428 default:
1429 printk(KERN_ERR
1430 "#%s: Invalid DAI interface format\n", __func__);
1431 return -EINVAL;
1432 }
1433
1434 /* Also Configure the Pin Control Registers before writing into
1435 * the ASI specific Clock Control and Format Registers
1436 */
1437 /* Configure B0_P4_R73_D[5:2] to 0001 This configures the
1438 * WCLK1 Pin to ASI1
1439 */
1440 regvalue = snd_soc_read(codec, WCLK3_PIN_CNTL_REG);
1441 snd_soc_write(codec, WCLK3_PIN_CNTL_REG, (regvalue | BIT2));
1442
1443 regvalue = snd_soc_read(codec, BCLK3_PIN_CNTL_REG);
1444 snd_soc_write(codec, BCLK3_PIN_CNTL_REG, (regvalue | BIT2));
1445
1446 /* Configure B0_P4_R76_d[6:5] = 01 and B0_P4_R75_D[4:1] to 0001
1447 * to ensure that the DIN1 and DOUT1 Pins are configured
1448 * correctly
1449 */
1450 regvalue = snd_soc_read(codec, DIN3_PIN_CNTL_REG);
1451 snd_soc_write(codec, DIN3_PIN_CNTL_REG, (regvalue | BIT5));
1452 regvalue = snd_soc_read(codec, DOUT3_PIN_CNTL_REG);
1453 snd_soc_write(codec, DOUT3_PIN_CNTL_REG, (regvalue | BIT1));
1454
1455 snd_soc_write(codec, ASI3_BWCLK_CNTL_REG, clk_reg);
1456
1457 snd_soc_write(codec, ASI3_BUS_FMT, iface_reg);
1458
1459 return 0;
1460}
1461
1462/*
1463 * Clock after PLL and dividers
1464 */
1465static int aic3262_multi_i2s_set_dai_sysclk(struct snd_soc_dai *codec_dai,
1466 int clk_id, unsigned int freq, int dir)
1467{
1468 struct snd_soc_codec *codec = codec_dai->codec;
1469 struct aic3262_priv *aic3262 = snd_soc_codec_get_drvdata(codec);
1470
1471 DBG(KERN_INFO "#%s: DAI ID %d Freq %d Direction %d\n",
1472 __func__, codec_dai->id, freq, dir);
1473 switch (freq) {
1474 case AIC3262_FREQ_12000000:
1475 case AIC3262_FREQ_12288000:
1476 case AIC3262_FREQ_24000000:
1477 aic3262->sysclk = freq;
1478 return 0;
1479 break;
1480 }
1481 printk(KERN_ERR "Invalid frequency to set DAI system clock\n");
1482 return -EINVAL;
1483}
1484
1485/*
1486* aic3262_multi_i2s_set_pll
1487*
1488* This function is invoked as part of the PLL call-back
1489* handler from the ALSA layer.
1490*/
1491static int aic3262_multi_i2s_set_dai_pll(struct snd_soc_dai *codec_dai,
1492 int pll_id, int source, unsigned int freq_in,
1493 unsigned int freq_out)
1494{
1495
1496 printk(KERN_INFO "%s: DAI ID %d PLL_ID %d InFreq %d OutFreq %d\n",
1497 __func__, pll_id, codec_dai->id, freq_in, freq_out);
1498
1499 return 0;
1500}
1501
1502/*
1503* aic3262_asi1_clk_config
1504*
1505* This function is used to configure the BCLK1, WCLK1 pins which
1506* are specific to ASI1 Interface. This function just enables the
1507* BCLk and WCLK along with the miniDSP Port Control Registers.
1508* However, depending on the user requirement, this function can also be
1509* extended to configure the sourc for the BCLK and WCLK on a ASI basis.
1510*/
1511static int aic3262_asi1_clk_config(struct snd_soc_codec *codec,
1512 struct snd_pcm_hw_params *params)
1513{
1514 u8 bclk_N_value, wclk_N_value;
1515 u8 minidspD_data, minidspA_data;
1516 u8 regval;
1517
1518 struct aic3262_priv *aic3262 = snd_soc_codec_get_drvdata(codec);
1519
1520 DBG(KERN_INFO "%s: Invoked\n", __func__);
1521
1522 /* Configure the BCLK and WCLK Output Mux Options */
1523 regval = snd_soc_read(codec, ASI1_BWCLK_OUT_CNTL);
1524 regval &= ~(AIC3262_ASI_BCLK_MUX_MASK | AIC3262_ASI_WCLK_MUX_MASK);
1525
1526 regval |= (aic3262->asiCtxt[0].bclk_output <<
1527 AIC3262_ASI_BCLK_MUX_SHIFT);
1528 regval |= aic3262->asiCtxt[0].wclk_output;
1529 snd_soc_write(codec, ASI1_BWCLK_OUT_CNTL, regval);
1530
1531 /* Configure the corresponding miniDSP Data Ports */
1532 minidspD_data = snd_soc_read(codec, MINIDSP_PORT_CNTL_REG);
1533 minidspD_data &= ~(BIT5 | BIT4);
1534 snd_soc_write(codec, MINIDSP_PORT_CNTL_REG, minidspD_data);
1535
1536 minidspA_data = snd_soc_read(codec, ASI1_ADC_INPUT_CNTL);
1537 minidspA_data &= ~(BIT2 | BIT1 | BIT0);
1538 minidspA_data |= aic3262->asiCtxt[0].adc_input;
1539 snd_soc_write(codec, ASI1_ADC_INPUT_CNTL, minidspA_data);
1540
1541
1542 if (aic3262->asiCtxt[0].master == 1) {
1543 DBG(KERN_INFO
1544 "#%s: Codec Master on ASI1 Port. Enabling BCLK WCLK Divider.\n",
1545 __func__);
1546 bclk_N_value = aic3262->asiCtxt[0].bclk_div;
1547 snd_soc_write(codec, ASI1_BCLK_N, (bclk_N_value | 0x80));
1548
1549 wclk_N_value = snd_soc_read(codec, ASI1_WCLK_N);
1550 snd_soc_write(codec, ASI1_WCLK_N, (wclk_N_value | 0xA0));
1551 }
1552 return 0;
1553
1554}
1555
1556/*
1557* aic3262_asi2_clk_config
1558*
1559* This function is used to configure the BCLK2, WCLK2 pins which
1560* are specific to ASI2 Interface. This function just enables the
1561* BCLk and WCLK along with the miniDSP Port Control Registers.
1562* However, depending on the user requirement, this function can also be
1563* extended to configure the sourc for the BCLK and WCLK on a ASI basis.
1564*/
1565static int aic3262_asi2_clk_config(struct snd_soc_codec *codec,
1566 struct snd_pcm_hw_params *params)
1567{
1568 u8 bclk_N_value, wclk_N_value, minidspD_data, minidspA_data;
1569 u8 regval;
1570
1571 struct aic3262_priv *aic3262 = snd_soc_codec_get_drvdata(codec);
1572
1573 DBG(KERN_INFO "%s: Invoked\n", __func__);
1574
1575
1576 /* Configure the BCLK and WCLK Output Mux Options */
1577 regval = snd_soc_read(codec, ASI2_BWCLK_OUT_CNTL);
1578 regval &= ~(AIC3262_ASI_BCLK_MUX_MASK | AIC3262_ASI_WCLK_MUX_MASK);
1579 regval |= (aic3262->asiCtxt[1].bclk_output <<
1580 AIC3262_ASI_BCLK_MUX_SHIFT);
1581 regval |= aic3262->asiCtxt[1].wclk_output;
1582
1583 snd_soc_write(codec, ASI2_BWCLK_OUT_CNTL, regval);
1584 /* Configure the corresponding miniDSP Data Ports */
1585 minidspD_data = snd_soc_read(codec, MINIDSP_PORT_CNTL_REG);
1586 minidspD_data |= (BIT2);
1587 snd_soc_write(codec, MINIDSP_PORT_CNTL_REG, minidspD_data);
1588
1589 minidspA_data = snd_soc_read(codec, ASI2_ADC_INPUT_CNTL);
1590 minidspA_data &= ~(BIT2 | BIT1 | BIT0);
1591 minidspA_data |= aic3262->asiCtxt[1].adc_input;
1592 snd_soc_write(codec, ASI2_ADC_INPUT_CNTL, minidspA_data);
1593
1594 /* NO Manual configuration of WCLK and BCLK for Master Mode.
1595 * DAPM Handles all the required modifications.
1596 */
1597 if (aic3262->asiCtxt[1].master == 1) {
1598 DBG(KERN_INFO
1599 "#%s: Codec Master on ASI2 Port. Enabling BCLK WCLK Divider.\n",
1600 __func__);
1601 bclk_N_value = aic3262->asiCtxt[1].bclk_div;
1602 snd_soc_write(codec, ASI2_BCLK_N, (bclk_N_value | 0x80));
1603
1604 wclk_N_value = snd_soc_read(codec, ASI2_WCLK_N);
1605 snd_soc_write(codec, ASI2_WCLK_N, (wclk_N_value | 0xA0));
1606 }
1607
1608 return 0;
1609
1610}
1611
1612/*
1613* aic3262_asi3_clk_config
1614*
1615* This function is used to configure the BCLK3, WCLK3 pins which
1616* are specific to ASI3 Interface. This function just enables the
1617* BCLk and WCLK along with the miniDSP Port Control Registers.
1618* However, depending on the user requirement, this function can also be
1619* extended to configure the sourc for the BCLK and WCLK on a ASI basis.
1620*/
1621static int aic3262_asi3_clk_config(struct snd_soc_codec *codec,
1622 struct snd_pcm_hw_params *params)
1623{
1624 u8 bclk_N_value, wclk_N_value, minidspD_data, minidspA_data;
1625 u8 regval;
1626
1627 struct aic3262_priv *aic3262 = snd_soc_codec_get_drvdata(codec);
1628
1629 DBG(KERN_INFO "%s:\n", __func__);
1630
1631
1632 /* Configure the BCLK and WCLK Output Mux Options */
1633 regval = snd_soc_read(codec, ASI3_BWCLK_OUT_CNTL);
1634 regval &= ~(AIC3262_ASI_BCLK_MUX_MASK | AIC3262_ASI_WCLK_MUX_MASK);
1635 regval |= (aic3262->asiCtxt[2].bclk_output <<
1636 AIC3262_ASI_BCLK_MUX_SHIFT);
1637 regval |= aic3262->asiCtxt[2].wclk_output;
1638 snd_soc_write(codec, ASI3_BWCLK_OUT_CNTL, regval);
1639
1640 minidspD_data = snd_soc_read(codec, MINIDSP_PORT_CNTL_REG);
1641 minidspD_data |= (BIT1);
1642 snd_soc_write(codec, MINIDSP_PORT_CNTL_REG, minidspD_data);
1643
1644 minidspA_data = snd_soc_read(codec, ASI3_ADC_INPUT_CNTL);
1645 minidspA_data &= ~(BIT2 | BIT1 | BIT0);
1646 minidspA_data |= aic3262->asiCtxt[2].adc_input;
1647 snd_soc_write(codec, ASI3_ADC_INPUT_CNTL, minidspA_data);
1648
1649 if (aic3262->asiCtxt[2].master == 1) {
1650 DBG(KERN_INFO
1651 "#%s: Codec Master on ASI3 Port. Enabling BCLK WCLK Divider.\n",
1652 __func__);
1653 bclk_N_value = aic3262->asiCtxt[2].bclk_div;
1654 snd_soc_write(codec, ASI2_BCLK_N, (bclk_N_value | 0x80));
1655
1656 wclk_N_value = snd_soc_read(codec, ASI3_WCLK_N);
1657 snd_soc_write(codec, ASI3_WCLK_N, (wclk_N_value | 0xA0));
1658 }
1659 return 0;
1660
1661}
1662
1663/*
1664* aic3262_multi_i2s_hw_params
1665*
1666* This function is used to configure the individual ASI port registers
1667* depending on the configuration passed on by the snd_pcm_hw_params
1668* structure.
1669* This function internally configures the ASI specific pins and clock
1670* Control Registers.
1671*/
1672static int aic3262_multi_i2s_hw_params(struct snd_pcm_substream *substream,
1673 struct snd_pcm_hw_params *params,
1674 struct snd_soc_dai *dai)
1675{
1676 int i, j;
1677 u8 data;
1678 u16 regoffset = 0;
1679 u8 dacpath = 0;
1680 u8 adcpath = 0;
1681 struct snd_soc_pcm_runtime *rtd = substream->private_data;
1682 struct snd_soc_codec *codec = rtd->codec;
1683 struct aic3262_priv *aic3262 = snd_soc_codec_get_drvdata(codec);
1684
1685 DBG(KERN_INFO "#%s: Invoked for ASI%d Port for %s Mode\n",
1686 __func__, dai->id,
1687 (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
1688 ? "Playback" : "Record");
1689
1690 i = aic3262_get_divs(aic3262->sysclk, params_rate(params));
1691
1692 i2c_verify_book0(codec);
1693
1694 if (i < 0) {
1695 printk(KERN_ERR "#%s: Sampling rate %d not supported\n",
1696 __func__, params_rate(params));
1697 return i;
1698 }
1699
1700 aic3262_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
1701
1702 /* Configure the PLL J, R D values only if none of the ASI
1703 * Interfaces are Active.
1704 */
1705
1706 if (1) {
1707 DBG(KERN_INFO "#%s: None of the ASIs active yet...\n",
1708 __func__);
1709 /*We will fix R value to 1 and make P & J=K.D as variable */
1710 /* Setting P & R values are set to 1 and 1 at init*/
1711
1712 /* J value */
1713 snd_soc_write(codec, PLL_J_REG, aic3262_divs[i].pll_j);
1714
1715 /* MSB & LSB for D value */
1716
1717 snd_soc_write(codec, PLL_D_MSB, (aic3262_divs[i].pll_d >> 8));
1718 snd_soc_write(codec, PLL_D_LSB,
1719 (aic3262_divs[i].pll_d & AIC3262_8BITS_MASK));
1720
1721 /* NDAC divider value */
1722 data = snd_soc_read(codec, NDAC_DIV_POW_REG);
1723 DBG(KERN_INFO "# reading NDAC = %d , NDAC_DIV_POW_REG = %x\n",
1724 aic3262_divs[i].ndac, data);
1725 snd_soc_write(codec, NDAC_DIV_POW_REG,
1726 ((data & 0x80)|(aic3262_divs[i].ndac)));
1727 DBG(KERN_INFO "# writing NDAC = %d , NDAC_DIV_POW_REG = %x\n",
1728 aic3262_divs[i].ndac,
1729 ((data & 0x80)|(aic3262_divs[i].ndac)));
1730
1731 /* MDAC divider value */
1732 data = snd_soc_read(codec, MDAC_DIV_POW_REG);
1733 DBG(KERN_INFO "# reading MDAC = %d , MDAC_DIV_POW_REG = %x\n",
1734 aic3262_divs[i].mdac, data);
1735 snd_soc_write(codec, MDAC_DIV_POW_REG,
1736 ((data & 0x80)|(aic3262_divs[i].mdac)));
1737 DBG(KERN_INFO "# writing MDAC = %d , MDAC_DIV_POW_REG = %x\n",
1738 aic3262_divs[i].mdac, ((data & 0x80)|(aic3262_divs[i].mdac)));
1739
1740 /* DOSR MSB & LSB values */
1741 snd_soc_write(codec, DOSR_MSB_REG, aic3262_divs[i].dosr >> 8);
1742 DBG(KERN_INFO "# writing DOSR_MSB_REG = %d\n",
1743 (aic3262_divs[i].dosr >> 8));
1744 snd_soc_write(codec, DOSR_LSB_REG,
1745 aic3262_divs[i].dosr & AIC3262_8BITS_MASK);
1746 DBG(KERN_INFO "# writing DOSR_LSB_REG = %d\n",
1747 (aic3262_divs[i].dosr & AIC3262_8BITS_MASK));
1748
1749 /* NADC divider value */
1750 data = snd_soc_read(codec, NADC_DIV_POW_REG);
1751 snd_soc_write(codec, NADC_DIV_POW_REG,
1752 ((data & 0x80)|(aic3262_divs[i].nadc)));
1753 DBG(KERN_INFO "# writing NADC_DIV_POW_REG = %d\n",
1754 aic3262_divs[i].nadc);
1755
1756 /* MADC divider value */
1757 data = snd_soc_read(codec, MADC_DIV_POW_REG);
1758 snd_soc_write(codec, MADC_DIV_POW_REG,
1759 ((data & 0x80)|(aic3262_divs[i].madc)));
1760 DBG(KERN_INFO "# writing MADC_DIV_POW_REG = %d\n",
1761 aic3262_divs[i].madc);
1762
1763 /* AOSR value */
1764 snd_soc_write(codec, AOSR_REG, aic3262_divs[i].aosr);
1765 DBG(KERN_INFO "# writing AOSR = %d\n", aic3262_divs[i].aosr);
1766 } else {
1767 DBG(KERN_INFO "#Atleast 1 ASI Active. Cannot Program PLL..\n");
1768 }
1769 /* Check for the DAI ID to know which ASI needs
1770 * Configuration.
1771 */
1772 switch (dai->id) {
1773 case 1:
1774 regoffset = ASI1_BUS_FMT;
1775
1776 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
1777 DBG(KERN_INFO "#%s: ASI1 DAC Inputs enabled..\n",
1778 __func__);
1779 /* Read the DAC Control Register and configure it
1780 * as per the ASIContext Structure Settings.
1781 */
1782 dacpath = snd_soc_read(codec, ASI1_DAC_OUT_CNTL);
1783 dacpath &= ~(AIC3262_ASI_LDAC_PATH_MASK |
1784 AIC3262_ASI_RDAC_PATH_MASK);
1785 dacpath |= (aic3262->asiCtxt[0].left_dac_output
1786 << AIC3262_ASI_LDAC_PATH_SHIFT);
1787
1788 dacpath |= (aic3262->asiCtxt[0].right_dac_output
1789 << AIC3262_ASI_RDAC_PATH_SHIFT);
1790 snd_soc_write(codec, ASI1_DAC_OUT_CNTL, dacpath);
1791
1792 aic3262->asiCtxt[0].playback_mode = 1;
1793 aic3262->asiCtxt[0].bclk_div =
1794 aic3262_divs[i].blck_N;
1795 } else {
1796 /* For Recording, Configure the DOUT Pin as per
1797 * ASIContext Structure Settings.
1798 */
1799 adcpath = snd_soc_read(codec, ASI1_DATA_OUT);
1800 adcpath &= ~(AIC3262_ASI_DOUT_MASK);
1801
1802 adcpath |= aic3262->asiCtxt[0].dout_option;
1803 snd_soc_write(codec, ASI1_DATA_OUT, adcpath);
1804
1805 aic3262->asiCtxt[0].capture_mode = 1;
1806 }
1807 break;
1808 case 2:
1809 regoffset = ASI2_BUS_FMT;
1810
1811 /* Since we are configuring ASI2, please check if Playback
1812 * is expected. If so, enable ASI2 Inputs to Left and
1813 * Right DACs
1814 */
1815 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
1816 DBG(KERN_INFO "#%s: ASI2 DAC Inputs enabled..\n",
1817 __func__);
1818 /* Read the DAC Control Register and configure it
1819 * as per theASIContext Structure Settings.
1820 */
1821 dacpath = snd_soc_read(codec, ASI2_DAC_OUT_CNTL);
1822 dacpath &= ~(AIC3262_ASI_LDAC_PATH_MASK |
1823 AIC3262_ASI_RDAC_PATH_MASK);
1824 dacpath |= (aic3262->asiCtxt[1].left_dac_output
1825 << AIC3262_ASI_LDAC_PATH_SHIFT);
1826
1827 dacpath |= (aic3262->asiCtxt[1].right_dac_output
1828 << AIC3262_ASI_RDAC_PATH_SHIFT);
1829 snd_soc_write(codec, ASI2_DAC_OUT_CNTL, dacpath);
1830 aic3262->asiCtxt[1].playback_mode = 1;
1831
1832 aic3262->asiCtxt[1].bclk_div =
1833 aic3262_divs[i].blck_N;
1834 } else {
1835 /* For Recording, Configure the DOUT Pin as per
1836 * ASIContext Structure Settings.
1837 */
1838 adcpath = snd_soc_read(codec, ASI2_DATA_OUT);
1839 adcpath &= ~(AIC3262_ASI_DOUT_MASK);
1840 adcpath |= aic3262->asiCtxt[1].dout_option;
1841 snd_soc_write(codec, ASI2_DATA_OUT, adcpath);
1842
1843 aic3262->asiCtxt[1].capture_mode = 1;
1844 }
1845 break;
1846 case 3:
1847 regoffset = ASI3_BUS_FMT;
1848 /* Since we are configuring ASI3, please check if Playback
1849 * is expected. If so, enable ASI3 Inputs to Left and
1850 * Right DACs
1851 */
1852 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
1853 DBG(KERN_INFO "#%s:ASI3 DAC Inputs enabled.\n",
1854 __func__);
1855 /* Read the DAC Control Register and configure
1856 * it as per the ASIContext Structure Settings.
1857 */
1858 dacpath = snd_soc_read(codec, ASI3_DAC_OUT_CNTL);
1859 dacpath &= ~(AIC3262_ASI_LDAC_PATH_MASK |
1860 AIC3262_ASI_RDAC_PATH_MASK);
1861 dacpath |= (aic3262->asiCtxt[2].left_dac_output
1862 << AIC3262_ASI_LDAC_PATH_SHIFT);
1863 dacpath |= (aic3262->asiCtxt[2].right_dac_output
1864 << AIC3262_ASI_RDAC_PATH_SHIFT);
1865 snd_soc_write(codec,
1866 ASI3_DAC_OUT_CNTL, dacpath);
1867
1868 aic3262->asiCtxt[2].playback_mode = 1;
1869
1870 aic3262->asiCtxt[2].bclk_div =
1871 aic3262_divs[i].blck_N;
1872 } else {
1873 /* For Recording, Configure the DOUT Pin as per
1874 * ASIContext Structure Settings.
1875 */
1876 adcpath &= ~(AIC3262_ASI_DOUT_MASK);
1877 adcpath |= aic3262->asiCtxt[2].dout_option;
1878 snd_soc_write(codec, ASI3_DATA_OUT, adcpath);
1879
1880 aic3262->asiCtxt[2].capture_mode = 1;
1881 }
1882 break;
1883 default:
1884 printk(KERN_ERR "Invalid Dai ID %d in %s",
1885 dai->id, __func__);
1886 break;
1887 }
1888 DBG(KERN_INFO "#%s: Reading Pg %d Reg %d for Bus Format Control.\n",
1889 __func__, (regoffset/128), (regoffset % 128));
1890
1891 /* Read the correspondig ASI DAI Interface Register */
1892 data = snd_soc_read(codec, regoffset);
1893
1894 data = data & 0xe7;
1895
1896 switch (params_format(params)) {
1897 case SNDRV_PCM_FORMAT_S16_LE:
1898 DBG(KERN_INFO "#%s: Configuring ASI%d S16_LE Fmt..\n",
1899 __func__, dai->id);
1900 data = data | 0x00;
1901 aic3262->asiCtxt[dai->id - 1].word_len = 16;
1902 break;
1903 case SNDRV_PCM_FORMAT_S20_3LE:
1904 data |= (0x08);
1905 aic3262->asiCtxt[dai->id - 1].word_len = 20;
1906 break;
1907 case SNDRV_PCM_FORMAT_S24_LE:
1908 DBG(KERN_INFO "#%s: Configuring ASI%d S24_LE Fmt..\n",
1909 __func__, dai->id);
1910 data |= (0x10);
1911 aic3262->asiCtxt[dai->id - 1].word_len = 24;
1912 break;
1913 case SNDRV_PCM_FORMAT_S32_LE:
1914 DBG(KERN_INFO "#%s: Configuring ASI%d S32_LE Fmt..\n",
1915 __func__, dai->id);
1916 data |= (0x18);
1917 aic3262->asiCtxt[dai->id - 1].word_len = 32;
1918 break;
1919 }
1920
1921 /* configure the respective Registers for the above configuration */
1922 snd_soc_write(codec, regoffset, data);
1923
1924 for (j = 0; j < NO_FEATURE_REGS; j++) {
1925 snd_soc_write(codec,
1926 aic3262_divs[i].codec_specific_regs[j].reg_offset,
1927 aic3262_divs[i].codec_specific_regs[j].reg_val);
1928 }
1929
1930 /* Enable the PLL, MDAC, NDAC, NADC, MADC and BCLK Dividers */
1931 aic3262_set_bias_level(codec, SND_SOC_BIAS_ON);
1932
1933 /* Based on the DAI ID we enable the corresponding pins related to the
1934 * ASI Port.
1935 */
1936 switch (dai->id) {
1937 case 1:
1938 aic3262_asi1_clk_config(codec, params);
1939 break;
1940 case 2:
1941 aic3262_asi2_clk_config(codec, params);
1942 break;
1943 case 3:
1944 aic3262_asi3_clk_config(codec, params);
1945 break;
1946 default:
1947 printk(KERN_ERR "Invalid Dai ID %d in %s",
1948 dai->id, __func__);
1949 break;
1950 }
1951 /* Depending on the DAI->ID update the local Flags */
1952 aic3262->asiCtxt[dai->id - 1].asi_active++;
1953 aic3262->asiCtxt[dai->id - 1].sampling_rate = params_rate(params);
1954 /* Update the active_count flag */
1955 aic3262->active_count++;
1956
1957 return 0;
1958}
1959
1960/*
1961*
1962* aic3262_multi_i2s_hw_free
1963*
1964* This function is used to configure the Codec after the usage is completed.
1965* We can use this function to disable the DAC and ADC specific inputs from the
1966* individual ASI Ports of the Audio Codec.
1967*/
1968static int aic3262_multi_i2s_shutdown(struct snd_pcm_substream *substream,
1969 struct snd_soc_dai *dai)
1970{
1971 struct snd_soc_pcm_runtime *rtd = substream->private_data;
1972 struct snd_soc_codec *codec = rtd->codec;
1973 struct aic3262_priv *aic3262 = snd_soc_codec_get_drvdata(codec);
1974
1975 u8 value;
1976 u8 dacpath;
1977 u8 adcpath;
1978 u16 dacregoffset = 0;
1979 u16 adcregoffset = 0;
1980
1981 DBG(KERN_INFO "#%s: ASI%d Port for %s Mode\n",
1982 __func__, dai->id,
1983 (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ?
1984 "Playback" : "Record");
1985
1986 /* Check if this function was already executed earlier for the same
1987 * ASI Port
1988 */
1989 if ((substream->stream == SNDRV_PCM_STREAM_PLAYBACK) &&
1990 (aic3262->asiCtxt[dai->id - 1].playback_mode == 0)) {
1991 DBG(KERN_INFO "#%s: Function Already Executed. Exiting..\n",
1992 __func__);
1993 goto err;
1994 } else if ((substream->stream != SNDRV_PCM_STREAM_PLAYBACK) &&
1995 (aic3262->asiCtxt[dai->id - 1].capture_mode == 0)) {
1996 DBG(KERN_INFO "#%s: Function Already Executed. Exiting..\n",
1997 __func__);
1998 goto err;
1999 }
2000
2001 switch (dai->id) {
2002 case 1:
2003 /* In case we are Frame Master on this Interface, Switch off
2004 * the Bit Clock Divider and Word Clock Dividers
2005 */
2006 if (aic3262->asiCtxt[0].master == 1) {
2007 /* Also check if either Playback or Recording is still
2008 * going on this ASI Interface
2009 */
2010
2011 value = snd_soc_read(codec, ASI1_BCLK_N);
2012 snd_soc_write(codec, ASI1_BCLK_N, (value & 0x7f));
2013
2014 value = snd_soc_read(codec, ASI1_WCLK_N);
2015 snd_soc_write(codec, ASI1_WCLK_N, (value & 0x7f));
2016 }
2017
2018 dacregoffset = ASI1_DAC_OUT_CNTL;
2019 adcregoffset = ASI1_ADC_INPUT_CNTL;
2020 break;
2021 case 2:
2022 /* In case we are Frame Master on this Interface, Switch off
2023 * the Bit Clock Divider and Word Clock Dividers
2024 */
2025 if (aic3262->asiCtxt[1].master == 1) {
2026 value = snd_soc_read(codec, ASI2_BCLK_N);
2027 snd_soc_write(codec, ASI2_BCLK_N, (value & 0x7f));
2028
2029 value = snd_soc_read(codec, ASI2_WCLK_N);
2030 snd_soc_write(codec, ASI2_WCLK_N, (value & 0x7f));
2031 }
2032 dacregoffset = ASI2_DAC_OUT_CNTL;
2033 adcregoffset = ASI2_ADC_INPUT_CNTL;
2034 break;
2035 case 3:
2036 /* In case we are Frame Master on this Interface, Switch off
2037 * the Bit Clock Divider and Word Clock Dividers
2038 */
2039 if (aic3262->asiCtxt[2].master == 1) {
2040 value = snd_soc_read(codec, ASI3_BCLK_N);
2041 snd_soc_write(codec, ASI3_BCLK_N, (value & 0x7f));
2042
2043 value = snd_soc_read(codec, ASI3_WCLK_N);
2044 snd_soc_write(codec, ASI3_WCLK_N, (value & 0x7f));
2045 }
2046 dacregoffset = ASI3_DAC_OUT_CNTL;
2047 adcregoffset = ASI3_ADC_INPUT_CNTL;
2048 break;
2049 default:
2050 printk(KERN_ERR "#%s: Invalid dai id\n", __func__);
2051 }
2052 /* If this was a Playback Stream Stop, then only
2053 * switch off the DAC Inputs
2054 */
2055 if ((substream->stream == SNDRV_PCM_STREAM_PLAYBACK) &&
2056 (dacregoffset != 0)) {
2057 DBG(KERN_INFO "#%s: Disabling Pg %d Reg %d DAC Inputs ..\n",
2058 __func__, (dacregoffset/128), (dacregoffset % 128));
2059
2060 dacpath = snd_soc_read(codec, dacregoffset);
2061 snd_soc_write(codec, dacregoffset, (dacpath & ~(BIT6 | BIT4)));
2062
2063 aic3262->asiCtxt[dai->id - 1].playback_mode = 0;
2064 } else {
2065 /* Switch off the ADC Input Control Registers here */
2066 DBG(KERN_INFO "#%s: Disabling Pg %d Reg %d for ADC Inputs..\n",
2067 __func__, (adcregoffset/128), (adcregoffset % 128));
2068
2069 adcpath = snd_soc_read(codec, adcregoffset);
2070 snd_soc_write(codec, adcregoffset,
2071 (adcpath & ~(BIT2 | BIT1 | BIT0)));
2072
2073 aic3262->asiCtxt[dai->id - 1].capture_mode = 0;
2074 }
2075
2076 /* If we were configured in mono PCM Mode earlier, then reset the
2077 * Left Channel and Right Channel offset Registers here.
2078 */
2079 switch (dai->id) {
2080 case 1:
2081 if (aic3262->asiCtxt[0].pcm_format == SND_SOC_DAIFMT_DSP_B) {
2082 snd_soc_write(codec, ASI1_LCH_OFFSET, 0x00);
2083 snd_soc_write(codec, ASI1_RCH_OFFSET, 0x00);
2084 }
2085 break;
2086 case 2:
2087 if (aic3262->asiCtxt[1].pcm_format == SND_SOC_DAIFMT_DSP_B) {
2088 snd_soc_write(codec, ASI2_LCH_OFFSET, 0x00);
2089 snd_soc_write(codec, ASI2_RCH_OFFSET, 0x00);
2090 }
2091
2092 break;
2093 case 3:
2094 if (aic3262->asiCtxt[2].pcm_format == SND_SOC_DAIFMT_DSP_B) {
2095 snd_soc_write(codec, ASI3_LCH_OFFSET, 0x00);
2096 snd_soc_write(codec, ASI3_RCH_OFFSET, 0x00);
2097 }
2098 break;
2099 }
2100 /* Depending on the DAI->ID update the asi_active Flags */
2101 if (aic3262->asiCtxt[dai->id - 1].asi_active) {
2102 aic3262->asiCtxt[dai->id - 1].asi_active--;
2103
2104 /* Update the active_count flag */
2105 if (aic3262->active_count)
2106 aic3262->active_count--;
2107 }
2108err:
2109 return 0;
2110}
2111
2112
2113/*
2114*
2115* aic3262_multi_i2s_set_clkdiv
2116*
2117*/
2118static int aic3262_multi_i2s_set_clkdiv(struct snd_soc_dai *codec_dai, int div_id, int div)
2119{
2120 int value;
2121 struct snd_soc_codec *codec = codec_dai->codec;
2122 struct aic3262_priv *aic3262 = snd_soc_codec_get_drvdata(codec);
2123
2124
2125 value = snd_soc_read(codec, div_id);
2126 snd_soc_write(codec, div_id, (value | div));
2127
2128 printk(KERN_INFO "#%s: DAI ID %d Page %d Register %d Divider_Val %d Final_Value 0x%x\n",
2129 __func__, codec_dai->id, (div_id /128), (div_id%128), div,
2130 (value | div));
2131
2132 /* Store the Clock Divider inside the Private Structure */
2133 switch(codec_dai->id) {
2134 case 1:
2135 if (div_id == ASI1_BCLK_N)
2136 aic3262->asiCtxt[0].bclk_div = div;
2137 if (div_id == ASI1_WCLK_N)
2138 aic3262->asiCtxt[0].wclk_div = div;
2139 break;
2140 case 2:
2141 if (div_id == ASI2_BCLK_N)
2142 aic3262->asiCtxt[1].bclk_div = div;
2143 if (div_id == ASI2_WCLK_N)
2144 aic3262->asiCtxt[1].wclk_div = div;
2145 break;
2146 case 3:
2147 if (div_id == ASI3_BCLK_N)
2148 aic3262->asiCtxt[2].bclk_div = div;
2149 if (div_id == ASI3_WCLK_N)
2150 aic3262->asiCtxt[2].wclk_div = div;
2151 break;
2152 }
2153 return 0;
2154}
2155
2156
2157/*
2158 *----------------------------------------------------------------------------
2159 * @struct snd_soc_codec_dai |
2160 * It is SoC Codec DAI structure which has DAI capabilities viz.,
2161 * playback and capture, DAI runtime information viz. state of DAI
2162 * and pop wait state, and DAI private data.
2163 * The AIC3262 rates ranges from 8k to 192k
2164 * The PCM bit format supported are 16, 20, 24 and 32 bits
2165 *----------------------------------------------------------------------------
2166 */
2167struct snd_soc_dai_ops aic3262_multi_i2s_dai_ops = {
2168 .hw_params = aic3262_multi_i2s_hw_params,
2169 .digital_mute = aic3262_multi_i2s_mute,
2170 .set_fmt = aic3262_multi_i2s_set_dai_fmt,
2171 .set_pll = aic3262_multi_i2s_set_dai_pll,
2172 .set_sysclk = aic3262_multi_i2s_set_dai_sysclk,
2173 .shutdown = aic3262_multi_i2s_shutdown,
2174 .set_clkdiv = aic3262_multi_i2s_set_clkdiv,
2175};
2176
2177
2178static struct snd_soc_dai_driver tlv320aic3262_dai[] = {
2179/* AIC3262 ASI1 DAI */
2180{
2181 .name = "aic3262-asi1",
2182 .id = 1,
2183 .playback = {
2184 .stream_name = "ASI1 Playback",
2185 .channels_min = 1,
2186 .channels_max = 2,
2187 .rates = AIC3262_RATES,
2188 .formats = AIC3262_FORMATS},
2189 .capture = { /* dummy for fast DAI switching */
2190 .stream_name = "ASI1 Capture",
2191 .channels_min = 1,
2192 .channels_max = 2,
2193 .rates = AIC3262_RATES,
2194 .formats = AIC3262_FORMATS},
2195 .ops = &aic3262_multi_i2s_dai_ops,
2196},
2197/* AIC3262 ASI2 DAI */
2198{
2199 .name = "aic3262-asi2",
2200 .id = 2,
2201 .playback = {
2202 .stream_name = "ASI2 Playback",
2203 .channels_min = 1,
2204 .channels_max = 2,
2205 .rates = AIC3262_RATES,
2206 .formats = AIC3262_FORMATS,},
2207 .capture = {
2208 .stream_name = "ASI2 Capture",
2209 .channels_min = 1,
2210 .channels_max = 2,
2211 .rates = AIC3262_RATES,
2212 .formats = AIC3262_FORMATS,},
2213 .ops = &aic3262_multi_i2s_dai_ops,
2214
2215},
2216/* AIC3262 ASI3 DAI */
2217{
2218 .name = "aic3262-asi3",
2219 .id = 3,
2220 .playback = {
2221 .stream_name = "ASI3 Playback",
2222 .channels_min = 1,
2223 .channels_max = 2,
2224 .rates = AIC3262_RATES,
2225 .formats = AIC3262_FORMATS, },
2226 .capture = {
2227 .stream_name = "ASI3 Capture",
2228 .channels_min = 1,
2229 .channels_max = 2,
2230 .rates = AIC3262_RATES,
2231 .formats = AIC3262_FORMATS, },
2232 .ops = &aic3262_multi_i2s_dai_ops,
2233
2234},
2235};
2236
2237/*
2238 *****************************************************************************
2239 * Initializations
2240 *****************************************************************************
2241 */
2242/*
2243 * AIC3262 register cache
2244 * We are caching the registers here.
2245 * There is no point in caching the reset register.
2246 *
2247 * NOTE: In AIC3262, there are 127 registers supported in both page0 and page1
2248 * The following table contains the page0 and page 1 and page 3
2249 * registers values.
2250 */
2251static const u8 aic3262_reg[AIC3262_CACHEREGNUM] = {
2252 0x00, 0x00, 0x10, 0x00, /* 0 */
2253 0x03, 0x40, 0x11, 0x08, /* 4 */
2254 0x00, 0x00, 0x00, 0x82, /* 8 */
2255 0x88, 0x00, 0x80, 0x02, /* 12 */
2256 0x00, 0x08, 0x01, 0x01, /* 16 */
2257 0x80, 0x01, 0x00, 0x04, /* 20 */
2258 0x00, 0x00, 0x01, 0x00, /* 24 */
2259 0x00, 0x00, 0x01, 0x00, /* 28 */
2260 0x00, 0x00, 0x00, 0x00, /* 32 */
2261 0x00, 0x00, 0x00, 0x00, /* 36 */
2262 0x00, 0x00, 0x00, 0x00, /* 40 */
2263 0x00, 0x00, 0x00, 0x00, /* 44 */
2264 0x00, 0x00, 0x00, 0x00, /* 48 */
2265 0x00, 0x42, 0x02, 0x02, /* 52 */
2266 0x42, 0x02, 0x02, 0x02, /* 56 */
2267 0x00, 0x00, 0x00, 0x01, /* 60 */
2268 0x01, 0x00, 0x14, 0x00, /* 64 */
2269 0x0C, 0x00, 0x00, 0x00, /* 68 */
2270 0x00, 0x00, 0x00, 0xEE, /* 72 */
2271 0x10, 0xD8, 0x10, 0xD8, /* 76 */
2272 0x00, 0x00, 0x88, 0x00, /* 80 */
2273 0x00, 0x00, 0x00, 0x00, /* 84 */
2274 0x7F, 0x00, 0x00, 0x00, /* 88 */
2275 0x00, 0x00, 0x00, 0x00, /* 92 */
2276 0x7F, 0x00, 0x00, 0x00, /* 96 */
2277 0x00, 0x00, 0x00, 0x00, /* 100 */
2278 0x00, 0x00, 0x00, 0x00, /* 104 */
2279 0x00, 0x00, 0x00, 0x00, /* 108 */
2280 0x00, 0x00, 0x00, 0x00, /* 112 */
2281 0x00, 0x00, 0x00, 0x00, /* 116 */
2282 0x00, 0x00, 0x00, 0x00, /* 120 */
2283 0x00, 0x00, 0x00, 0x00, /* 124 - PAGE0 Registers(127) ends here */
2284 0x01, 0x00, 0x08, 0x00, /* 128, PAGE1-0 */
2285 0x00, 0x00, 0x00, 0x00, /* 132, PAGE1-4 */
2286 0x00, 0x00, 0x00, 0x10, /* 136, PAGE1-8 */
2287 0x00, 0x00, 0x00, 0x00, /* 140, PAGE1-12 */
2288 0x40, 0x40, 0x40, 0x40, /* 144, PAGE1-16 */
2289 0x00, 0x00, 0x00, 0x00, /* 148, PAGE1-20 */
2290 0x00, 0x00, 0x00, 0x00, /* 152, PAGE1-24 */
2291 0x00, 0x00, 0x00, 0x00, /* 156, PAGE1-28 */
2292 0x00, 0x00, 0x00, 0x00, /* 160, PAGE1-32 */
2293 0x00, 0x00, 0x00, 0x00, /* 164, PAGE1-36 */
2294 0x00, 0x00, 0x00, 0x00, /* 168, PAGE1-40 */
2295 0x00, 0x00, 0x00, 0x00, /* 172, PAGE1-44 */
2296 0x00, 0x00, 0x00, 0x00, /* 176, PAGE1-48 */
2297 0x00, 0x00, 0x00, 0x00, /* 180, PAGE1-52 */
2298 0x00, 0x00, 0x00, 0x80, /* 184, PAGE1-56 */
2299 0x80, 0x00, 0x00, 0x00, /* 188, PAGE1-60 */
2300 0x00, 0x00, 0x00, 0x00, /* 192, PAGE1-64 */
2301 0x00, 0x00, 0x00, 0x00, /* 196, PAGE1-68 */
2302 0x00, 0x00, 0x00, 0x00, /* 200, PAGE1-72 */
2303 0x00, 0x00, 0x00, 0x00, /* 204, PAGE1-76 */
2304 0x00, 0x00, 0x00, 0x00, /* 208, PAGE1-80 */
2305 0x00, 0x00, 0x00, 0x00, /* 212, PAGE1-84 */
2306 0x00, 0x00, 0x00, 0x00, /* 216, PAGE1-88 */
2307 0x00, 0x00, 0x00, 0x00, /* 220, PAGE1-92 */
2308 0x00, 0x00, 0x00, 0x00, /* 224, PAGE1-96 */
2309 0x00, 0x00, 0x00, 0x00, /* 228, PAGE1-100 */
2310 0x00, 0x00, 0x00, 0x00, /* 232, PAGE1-104 */
2311 0x00, 0x00, 0x00, 0x00, /* 236, PAGE1-108 */
2312 0x00, 0x00, 0x00, 0x00, /* 240, PAGE1-112 */
2313 0x00, 0x00, 0x00, 0x00, /* 244, PAGE1-116 */
2314 0x00, 0x00, 0x00, 0x00, /* 248, PAGE1-120 */
2315 0x00, 0x00, 0x00, 0x00, /* 252, PAGE1-124 Page 1 Registers Ends Here */
2316 0x00, 0x00, 0x00, 0x00, /* 256, PAGE2-0 */
2317 0x00, 0x00, 0x00, 0x00, /* 260, PAGE2-4 */
2318 0x00, 0x00, 0x00, 0x00, /* 264, PAGE2-8 */
2319 0x00, 0x00, 0x00, 0x00, /* 268, PAGE2-12 */
2320 0x00, 0x00, 0x00, 0x00, /* 272, PAGE2-16 */
2321 0x00, 0x00, 0x00, 0x00, /* 276, PAGE2-20 */
2322 0x00, 0x00, 0x00, 0x00, /* 280, PAGE2-24 */
2323 0x00, 0x00, 0x00, 0x00, /* 284, PAGE2-28 */
2324 0x00, 0x00, 0x00, 0x00, /* 288, PAGE2-32 */
2325 0x00, 0x00, 0x00, 0x00, /* 292, PAGE2-36 */
2326 0x00, 0x00, 0x00, 0x00, /* 296, PAGE2-40 */
2327 0x00, 0x00, 0x00, 0x00, /* 300, PAGE2-44 */
2328 0x00, 0x00, 0x00, 0x00, /* 304, PAGE2-48 */
2329 0x00, 0x00, 0x00, 0x00, /* 308, PAGE2-52 */
2330 0x00, 0x00, 0x00, 0x00, /* 312, PAGE2-56 */
2331 0x00, 0x00, 0x00, 0x00, /* 316, PAGE2-60 */
2332 0x00, 0x00, 0x00, 0x00, /* 320, PAGE2-64 */
2333 0x00, 0x00, 0x00, 0x00, /* 324, PAGE2-68 */
2334 0x00, 0x00, 0x00, 0x00, /* 328, PAGE2-72 */
2335 0x00, 0x00, 0x00, 0x00, /* 332, PAGE2-76 */
2336 0x00, 0x00, 0x00, 0x00, /* 336, PAGE2-80 */
2337 0x00, 0x00, 0x00, 0x00, /* 340, PAGE2-84 */
2338 0x00, 0x00, 0x00, 0x00, /* 344, PAGE2-88 */
2339 0x00, 0x00, 0x00, 0x00, /* 348, PAGE2-92 */
2340 0x00, 0x00, 0x00, 0x00, /* 352, PAGE2-96 */
2341 0x00, 0x00, 0x00, 0x00, /* 356, PAGE2-100 */
2342 0x00, 0x00, 0x00, 0x00, /* 360, PAGE2-104 */
2343 0x00, 0x00, 0x00, 0x00, /* 364, PAGE2-108 */
2344 0x00, 0x00, 0x00, 0x00, /* 368, PAGE2-112*/
2345 0x00, 0x00, 0x00, 0x00, /* 372, PAGE2-116*/
2346 0x00, 0x00, 0x00, 0x00, /* 376, PAGE2-120*/
2347 0x00, 0x00, 0x00, 0x00, /* 380, PAGE2-124 Page 2 Registers Ends Here */
2348 0x00, 0x00, 0x00, 0x00, /* 384, PAGE3-0 */
2349 0x00, 0x00, 0x00, 0x00, /* 388, PAGE3-4 */
2350 0x00, 0x00, 0x00, 0x00, /* 392, PAGE3-8 */
2351 0x00, 0x00, 0x00, 0x00, /* 392, PAGE3-12 */
2352 0x00, 0x00, 0x00, 0x00, /* 392, PAGE3-16 */
2353 0x00, 0x00, 0x00, 0x00, /* 392, PAGE3-20 */
2354 0x00, 0x00, 0x00, 0x00, /* 392, PAGE3-24 */
2355 0x00, 0x00, 0x00, 0x00, /* 392, PAGE3-28 */
2356 0x00, 0x00, 0x00, 0x00, /* 392, PAGE3-32 */
2357 0x00, 0x00, 0x00, 0x00, /* 392, PAGE3-36 */
2358 0x00, 0x00, 0x00, 0x00, /* 392, PAGE3-40 */
2359 0x00, 0x00, 0x00, 0x00, /* 392, PAGE3-44 */
2360 0x00, 0x00, 0x00, 0x00, /* 392, PAGE3-48 */
2361 0x00, 0x00, 0x00, 0x00, /* 392, PAGE3-52 */
2362 0x00, 0x00, 0x00, 0x00, /* 392, PAGE3-56 */
2363 0x00, 0x00, 0x00, 0x00, /* 392, PAGE3-60 */
2364 0x00, 0x00, 0x00, 0x00, /* 392, PAGE3-64 */
2365 0x00, 0x00, 0x00, 0x00, /* 392, PAGE3-68 */
2366 0x00, 0x00, 0x00, 0x00, /* 328, PAGE3-72 */
2367 0x00, 0x00, 0x00, 0x00, /* 332, PAGE3-76 */
2368 0x00, 0x00, 0x00, 0x00, /* 336, PAGE3-80 */
2369 0x00, 0x00, 0x00, 0x00, /* 340, PAGE3-84 */
2370 0x00, 0x00, 0x00, 0x00, /* 344, PAGE3-88 */
2371 0x00, 0x00, 0x00, 0x00, /* 348, PAGE3-92 */
2372 0x00, 0x00, 0x00, 0x00, /* 352, PAGE3-96 */
2373 0x00, 0x00, 0x00, 0x00, /* 356, PAGE3-100 */
2374 0x00, 0x00, 0x00, 0x00, /* 360, PAGE3-104 */
2375 0x00, 0x00, 0x00, 0x00, /* 364, PAGE3-108 */
2376 0x00, 0x00, 0x00, 0x00, /* 368, PAGE3-112*/
2377 0x00, 0x00, 0x00, 0x00, /* 372, PAGE3-116*/
2378 0x00, 0x00, 0x00, 0x00, /* 376, PAGE3-120*/
2379 0x00, 0x00, 0x00, 0x00, /* 380, PAGE3-124 Page 3 Registers Ends Here */
2380 0x00, 0x00, 0x00, 0x00, /* 384, PAGE4-0 */
2381 0x00, 0x00, 0x00, 0x00, /* 388, PAGE4-4 */
2382 0x00, 0x00, 0x00, 0x00, /* 392, PAGE4-8 */
2383 0x00, 0x00, 0x00, 0x00, /* 392, PAGE4-12 */
2384 0x00, 0x00, 0x00, 0x00, /* 392, PAGE4-16 */
2385 0x00, 0x00, 0x00, 0x00, /* 392, PAGE4-20 */
2386 0x00, 0x00, 0x00, 0x00, /* 392, PAGE4-24 */
2387 0x00, 0x00, 0x00, 0x00, /* 392, PAGE4-28 */
2388 0x00, 0x00, 0x00, 0x00, /* 392, PAGE4-32 */
2389 0x00, 0x00, 0x00, 0x00, /* 392, PAGE4-36 */
2390 0x00, 0x00, 0x00, 0x00, /* 392, PAGE4-40 */
2391 0x00, 0x00, 0x00, 0x00, /* 392, PAGE4-44 */
2392 0x00, 0x00, 0x00, 0x00, /* 392, PAGE4-48 */
2393 0x00, 0x00, 0x00, 0x00, /* 392, PAGE4-52 */
2394 0x00, 0x00, 0x00, 0x00, /* 392, PAGE4-56 */
2395 0x00, 0x00, 0x00, 0x00, /* 392, PAGE4-60 */
2396 0x00, 0x00, 0x00, 0x00, /* 392, PAGE4-64 */
2397 0x00, 0x00, 0x00, 0x00, /* 392, PAGE4-68 */
2398 0x00, 0x00, 0x00, 0x00, /* 328, PAGE4-72 */
2399 0x00, 0x00, 0x00, 0x00, /* 332, PAGE4-76 */
2400 0x00, 0x00, 0x00, 0x00, /* 336, PAGE4-80 */
2401 0x00, 0x00, 0x00, 0x00, /* 340, PAGE4-84 */
2402 0x00, 0x00, 0x00, 0x00, /* 344, PAGE4-88 */
2403 0x00, 0x00, 0x00, 0x00, /* 348, PAGE4-92 */
2404 0x00, 0x00, 0x00, 0x00, /* 352, PAGE4-96 */
2405 0x00, 0x00, 0x00, 0x00, /* 356, PAGE4-100 */
2406 0x00, 0x00, 0x00, 0x00, /* 360, PAGE4-104 */
2407 0x00, 0x00, 0x00, 0x00, /* 364, PAGE4-108 */
2408 0x00, 0x00, 0x00, 0x00, /* 368, PAGE4-112*/
2409 0x00, 0x00, 0x00, 0x00, /* 372, PAGE4-116*/
2410 0x00, 0x00, 0x00, 0x00, /* 376, PAGE4-120*/
2411 0x00, 0x00, 0x00, 0x00, /* 380, PAGE4-124 Page 2 Registers Ends Here */
2412
2413};
2414
2415/*
2416 *------------------------------------------------------------------------------
2417 * aic3262 initialization data
2418 * This structure initialization contains the initialization required for
2419 * AIC326x.
2420 * These registers values (reg_val) are written into the respective AIC3262
2421 * register offset (reg_offset) to initialize AIC326x.
2422 * These values are used in aic3262_init() function only.
2423 *------------------------------------------------------------------------------
2424 */
2425static const struct aic3262_configs aic3262_reg_init[] = {
2426 /* CLOCKING */
2427
2428 {0, RESET_REG, 1},
2429 {0, RESET_REG, 0},
2430
2431 {0, PASI_DAC_DP_SETUP, 0xc0}, /*DAC */
2432 {0, DAC_MVOL_CONF, 0x00}, /*DAC un-muted*/
2433 /* set default volumes */
2434 {0, DAC_LVOL, 0x01},
2435 {0, DAC_RVOL, 0x01},
2436 {0, HPL_VOL, 0x80},
2437 {0, HPR_VOL, 0x80},
2438 {0, SPK_AMP_CNTL_R2, 0x14},
2439 {0, SPK_AMP_CNTL_R3, 0x14},
2440 {0, SPK_AMP_CNTL_R4, 0x33},
2441 {0, REC_AMP_CNTL_R5, 0x82},
2442 {0, RAMPR_VOL, 20},
2443 {0, RAMP_CNTL_R1, 70},
2444 {0, RAMP_CNTL_R2, 70},
2445
2446 /* DRC Defaults */
2447 {0, DRC_CNTL_R1, 0x6c},
2448 {0, DRC_CNTL_R2, 16},
2449
2450 /* DEPOP SETTINGS */
2451 {0, HP_DEPOP, 0x14},
2452 {0, RECV_DEPOP, 0x14},
2453
2454 {0, POWER_CONF, 0x00}, /* Disconnecting AVDD-DVD weak link*/
2455 {0, REF_PWR_DLY, 0x01},
2456 {0, CM_REG, 0x00}, /*CM - default*/
2457 {0, LDAC_PTM, 0}, /*LDAC_PTM - default*/
2458 {0, RDAC_PTM, 0}, /*RDAC_PTM - default*/
2459 {0, HP_CTL, 0x30}, /*HP output percentage - at 75%*/
2460 {0, LADC_VOL, 0x01}, /*LADC volume*/
2461 {0, RADC_VOL, 0x01}, /*RADC volume*/
2462
2463 {0, DAC_ADC_CLKIN_REG, 0x33}, /*DAC ADC CLKIN*/
2464 {0, PLL_CLKIN_REG, 0x00}, /*PLL CLKIN*/
2465 {0, PLL_PR_POW_REG, 0x11}, /*PLL Power=0-down, P=1, R=1 vals*/
2466 {0, 0x3d, 1},
2467
2468 {0, LMIC_PGA_PIN, 0x0}, /*IN1_L select - - 10k -LMICPGA_P*/
2469 {0, LMIC_PGA_MIN, 0x40}, /*CM to LMICPGA-M*/
2470 {0, RMIC_PGA_PIN, 0x0}, /*IN1_R select - - 10k -RMIC_PGA_P*/
2471 {0, RMIC_PGA_MIN, 0x0}, /*CM to RMICPGA_M*/
2472 {0, MIC_PWR_DLY , 33}, /*LMIC-PGA-POWERUP-DELAY - default*/
2473 {0, REF_PWR_DLY, 1}, /*FIXMELATER*/
2474
2475
2476 {0, ADC_CHANNEL_POW, 0x0}, /*ladc, radc ON , SOFT STEP disabled*/
2477 {0, ADC_FINE_GAIN, 0x00}, /*ladc - unmute, radc - unmute*/
2478 {0, MICL_PGA, 0x3f},
2479 {0, MICR_PGA, 0x3f},
2480 /*controls MicBias ext power based on B0_P1_R51_D6*/
2481 {0, MIC_BIAS_CNTL, 0x80},
2482 /* ASI1 Configuration */
2483 {0, ASI1_BUS_FMT, 0},
2484 {0, ASI1_BWCLK_CNTL_REG, 0x00}, /* originaly 0x24*/
2485 {0, ASI1_BCLK_N_CNTL, 1},
2486 {0, ASI1_BCLK_N, 0x04},
2487
2488 {0, MA_CNTL, 0}, /* Mixer Amp disabled */
2489 {0, LINE_AMP_CNTL_R2, 0x00}, /* Line Amp Cntl disabled */
2490
2491 /* ASI2 Configuration */
2492 {0, ASI2_BUS_FMT, 0},
2493 {0, ASI2_BCLK_N_CNTL, 0x01},
2494 {0, ASI2_BCLK_N, 0x04},
2495 {0, ASI2_BWCLK_OUT_CNTL, 0x20},
2496
2497 {0, BEEP_CNTL_R1, 0x05},
2498 {0, BEEP_CNTL_R2, 0x04},
2499
2500 /* Interrupt config for headset detection */
2501 {0,HEADSET_TUNING1_REG,0x7f},
2502 {0, INT1_CNTL, 0x40},
2503 /*{0, TIMER_REG, 0x8c},*/
2504 {0, INT_FMT, 0x40},
2505 {0, GPIO1_IO_CNTL, 0x14},
2506 {0, HP_DETECT, 0x96},
2507
2508#if defined(CONFIG_MINI_DSP)
2509 {0, 60, 0},
2510 {0, 61, 0},
2511 /* Added the below set of values after consulting the miniDSP
2512 * Program Section Array
2513 */
2514 {0, MINIDSP_ACCESS_CTRL, 0x00},
2515#endif
2516
2517
2518};
2519
2520static int reg_init_size =
2521 sizeof(aic3262_reg_init) / sizeof(struct aic3262_configs);
2522
2523static const unsigned int adc_ma_tlv[] = {
2524TLV_DB_RANGE_HEAD(4),
2525 0, 29, TLV_DB_SCALE_ITEM(-1450, 500, 0),
2526 30, 35, TLV_DB_SCALE_ITEM(-2060, 1000, 0),
2527 36, 38, TLV_DB_SCALE_ITEM(-2660, 2000, 0),
2528 39, 40, TLV_DB_SCALE_ITEM(-3610, 5000, 0),
2529};
2530static const DECLARE_TLV_DB_SCALE(lo_hp_tlv, -7830, 50, 0);
2531
2532static const struct snd_kcontrol_new mal_pga_mixer_controls[] = {
2533 SOC_DAPM_SINGLE("IN1L Switch", MA_CNTL, 5, 1, 0),
2534 SOC_DAPM_SINGLE_TLV("Left MicPGA Volume", LADC_PGA_MAL_VOL, 0,
2535 0x3f, 1, adc_ma_tlv),
2536
2537};
2538
2539static const struct snd_kcontrol_new mar_pga_mixer_controls[] = {
2540 SOC_DAPM_SINGLE("IN1R Switch", MA_CNTL, 4, 1, 0),
2541 SOC_DAPM_SINGLE_TLV("Right MicPGA Volume", RADC_PGA_MAR_VOL, 0,
2542 0x3f, 1, adc_ma_tlv),
2543};
2544
2545/* Left HPL Mixer */
2546static const struct snd_kcontrol_new hpl_output_mixer_controls[] = {
2547 SOC_DAPM_SINGLE("MAL Switch", HP_AMP_CNTL_R1, 7, 1, 0),
2548 SOC_DAPM_SINGLE("LDAC Switch", HP_AMP_CNTL_R1, 5, 1, 0),
2549 SOC_DAPM_SINGLE_TLV("LOL-B1 Volume", HP_AMP_CNTL_R2, 0,
2550 0x7f, 1, lo_hp_tlv),
2551};
2552
2553/* Right HPR Mixer */
2554static const struct snd_kcontrol_new hpr_output_mixer_controls[] = {
2555 SOC_DAPM_SINGLE_TLV("LOR-B1 Volume", HP_AMP_CNTL_R3, 0,
2556 0x7f, 1, lo_hp_tlv),
2557 SOC_DAPM_SINGLE("LDAC Switch", HP_AMP_CNTL_R1, 2, 1, 0),
2558 SOC_DAPM_SINGLE("RDAC Switch", HP_AMP_CNTL_R1, 4, 1, 0),
2559 SOC_DAPM_SINGLE("MAR Switch", HP_AMP_CNTL_R1, 6, 1, 0),
2560};
2561
2562/* Left LOL Mixer */
2563static const struct snd_kcontrol_new lol_output_mixer_controls[] = {
2564 SOC_DAPM_SINGLE("MAL Switch", LINE_AMP_CNTL_R2, 7, 1, 0),
2565 SOC_DAPM_SINGLE("IN1L-B Switch", LINE_AMP_CNTL_R2, 3, 1,0),
2566 SOC_DAPM_SINGLE("LDAC Switch", LINE_AMP_CNTL_R1, 7, 1, 0),
2567 SOC_DAPM_SINGLE("RDAC Switch", LINE_AMP_CNTL_R1, 5, 1, 0),
2568};
2569
2570/* Right LOR Mixer */
2571static const struct snd_kcontrol_new lor_output_mixer_controls[] = {
2572 SOC_DAPM_SINGLE("LOL Switch", LINE_AMP_CNTL_R1, 2, 1, 0),
2573 SOC_DAPM_SINGLE("RDAC Switch", LINE_AMP_CNTL_R1, 6, 1, 0),
2574 SOC_DAPM_SINGLE("MAR Switch", LINE_AMP_CNTL_R2, 6, 1, 0),
2575 SOC_DAPM_SINGLE("IN1R-B Switch", LINE_AMP_CNTL_R2, 0, 1,0),
2576};
2577
2578/* Left SPKL Mixer */
2579static const struct snd_kcontrol_new spkl_output_mixer_controls[] = {
2580 SOC_DAPM_SINGLE("MAL Switch", SPK_AMP_CNTL_R1, 7, 1, 0),
2581 SOC_DAPM_SINGLE_TLV("LOL Volume", SPK_AMP_CNTL_R2, 0, 0x7f,0,
2582 lo_hp_tlv),
2583 SOC_DAPM_SINGLE("SPR_IN Switch", SPK_AMP_CNTL_R1, 2, 1, 0),
2584};
2585
2586/* Right SPKR Mixer */
2587static const struct snd_kcontrol_new spkr_output_mixer_controls[] = {
2588 SOC_DAPM_SINGLE_TLV("LOR Volume", SPK_AMP_CNTL_R3, 0, 0x7f, 0,
2589 lo_hp_tlv),
2590 SOC_DAPM_SINGLE("MAR Switch", SPK_AMP_CNTL_R1, 6, 1, 0),
2591};
2592
2593/* REC Mixer */
2594static const struct snd_kcontrol_new rec_output_mixer_controls[] = {
2595 SOC_DAPM_SINGLE_TLV("LOL-B2 Volume", RAMP_CNTL_R1, 0, 0x7f,0,
2596 lo_hp_tlv),
2597 SOC_DAPM_SINGLE_TLV("IN1L Volume", IN1L_SEL_RM, 0, 0x7f, 1, lo_hp_tlv),
2598 SOC_DAPM_SINGLE_TLV("IN1R Volume", IN1R_SEL_RM, 0, 0x7f, 1, lo_hp_tlv),
2599 SOC_DAPM_SINGLE_TLV("LOR-B2 Volume", RAMP_CNTL_R2, 0,0x7f, 0,lo_hp_tlv),
2600};
2601
2602/* Left Input Mixer */
2603static const struct snd_kcontrol_new left_input_mixer_controls[] = {
2604 SOC_DAPM_SINGLE("IN1L Switch", LMIC_PGA_PIN, 6, 1, 0),
2605 SOC_DAPM_SINGLE("IN2L Switch", LMIC_PGA_PIN, 4, 1, 0),
2606 SOC_DAPM_SINGLE("IN3L Switch", LMIC_PGA_PIN, 2, 1, 0),
2607 SOC_DAPM_SINGLE("IN4L Switch", LMIC_PGA_PM_IN4, 5, 1, 0),
2608 SOC_DAPM_SINGLE("IN1R Switch", LMIC_PGA_PIN, 0, 1, 0),
2609 SOC_DAPM_SINGLE("IN2R Switch", LMIC_PGA_MIN, 4, 1, 0),
2610 SOC_DAPM_SINGLE("IN3R Switch", LMIC_PGA_MIN, 2, 1, 0),
2611 SOC_DAPM_SINGLE("IN4R Switch", LMIC_PGA_PM_IN4, 4, 1, 0),
2612 SOC_DAPM_SINGLE("CM2L Switch", LMIC_PGA_MIN, 0, 1, 0),
2613 SOC_DAPM_SINGLE("CM1L Switch", LMIC_PGA_MIN, 6, 1, 0),
2614};
2615
2616/* Right Input Mixer */
2617static const struct snd_kcontrol_new right_input_mixer_controls[] = {
2618 SOC_DAPM_SINGLE("IN1R Switch", RMIC_PGA_PIN, 6, 1, 0),
2619 SOC_DAPM_SINGLE("IN2R Switch", RMIC_PGA_PIN, 4, 1, 0),
2620 SOC_DAPM_SINGLE("IN3R Switch", RMIC_PGA_PIN, 2, 1, 0),
2621 SOC_DAPM_SINGLE("IN4R Switch", RMIC_PGA_PM_IN4, 5, 1, 0),
2622 SOC_DAPM_SINGLE("IN2L Switch", RMIC_PGA_PIN, 0, 1, 0),
2623 SOC_DAPM_SINGLE("IN1L Switch", RMIC_PGA_MIN, 4, 1, 0),
2624 SOC_DAPM_SINGLE("IN3L Switch", RMIC_PGA_MIN, 2, 1, 0),
2625 SOC_DAPM_SINGLE("IN4L Switch", RMIC_PGA_PM_IN4, 4, 1, 0),
2626 SOC_DAPM_SINGLE("CM1R Switch", RMIC_PGA_MIN, 6, 1, 0),
2627 SOC_DAPM_SINGLE("CM2R Switch", RMIC_PGA_MIN, 0, 1, 0),
2628};
2629
2630
2631static const char *asi1lin_text[] = {
2632 "Off", "ASI1 Left In","ASI1 Right In","ASI1 MonoMix In"
2633};
2634
2635SOC_ENUM_SINGLE_DECL(asi1lin_enum, ASI1_DAC_OUT_CNTL, 6, asi1lin_text);
2636
2637static const struct snd_kcontrol_new asi1lin_control =
2638 SOC_DAPM_ENUM("ASI1LIN Route", asi1lin_enum);
2639
2640
2641static const char *asi1rin_text[] = {
2642 "Off", "ASI1 Right In","ASI1 Left In","ASI1 MonoMix In"
2643};
2644
2645SOC_ENUM_SINGLE_DECL(asi1rin_enum, ASI1_DAC_OUT_CNTL, 4, asi1rin_text);
2646
2647static const struct snd_kcontrol_new asi1rin_control =
2648 SOC_DAPM_ENUM("ASI1RIN Route", asi1rin_enum);
2649
2650static const char *asi2lin_text[] = {
2651 "Off", "ASI2 Left In","ASI2 Right In","ASI2 MonoMix In"
2652};
2653
2654SOC_ENUM_SINGLE_DECL(asi2lin_enum, ASI2_DAC_OUT_CNTL, 6, asi2lin_text);
2655static const struct snd_kcontrol_new asi2lin_control =
2656 SOC_DAPM_ENUM("ASI2LIN Route", asi2lin_enum);
2657
2658static const char *asi2rin_text[] = {
2659 "Off", "ASI2 Right In","ASI2 Left In","ASI2 MonoMix In"
2660};
2661
2662
2663SOC_ENUM_SINGLE_DECL(asi2rin_enum, ASI2_DAC_OUT_CNTL, 4, asi2rin_text);
2664
2665static const struct snd_kcontrol_new asi2rin_control =
2666 SOC_DAPM_ENUM("ASI2RIN Route", asi2rin_enum);
2667
2668static const char *asi3lin_text[] = {
2669 "Off", "ASI3 Left In","ASI3 Right In","ASI3 MonoMix In"
2670};
2671
2672
2673SOC_ENUM_SINGLE_DECL(asi3lin_enum, ASI3_DAC_OUT_CNTL, 6, asi3lin_text);
2674static const struct snd_kcontrol_new asi3lin_control =
2675 SOC_DAPM_ENUM("ASI3LIN Route", asi3lin_enum);
2676
2677
2678static const char *asi3rin_text[] = {
2679 "Off", "ASI3 Right In","ASI3 Left In","ASI3 MonoMix In"
2680};
2681
2682
2683SOC_ENUM_SINGLE_DECL(asi3rin_enum, ASI3_DAC_OUT_CNTL, 4, asi3rin_text);
2684static const struct snd_kcontrol_new asi3rin_control =
2685 SOC_DAPM_ENUM("ASI3RIN Route", asi3rin_enum);
2686
2687
2688static const char *dacminidspin1_text[] = {
2689 "ASI1 In", "ASI2 In","ASI3 In","ADC MiniDSP Out"
2690};
2691
2692SOC_ENUM_SINGLE_DECL(dacminidspin1_enum, MINIDSP_PORT_CNTL_REG, 4, dacminidspin1_text);
2693static const struct snd_kcontrol_new dacminidspin1_control =
2694 SOC_DAPM_ENUM("DAC MiniDSP IN1 Route", dacminidspin1_enum);
2695
2696static const char *dacminidspin2_text[] = {
2697 "ASI1 In", "ASI2 In","ASI3 In"
2698};
2699
2700//static const struct soc_enum dacminidspin1_enum =
2701// SOC_ENUM_SINGLE(MINIDSP_DATA_PORT_CNTL, 5, 2, dacminidspin1_text);
2702SOC_ENUM_SINGLE_DECL(dacminidspin2_enum, MINIDSP_PORT_CNTL_REG, 2, dacminidspin2_text);
2703
2704static const struct snd_kcontrol_new dacminidspin2_control =
2705 SOC_DAPM_ENUM("DAC MiniDSP IN2 Route", dacminidspin2_enum);
2706
2707static const char *dacminidspin3_text[] = {
2708 "ASI1 In", "ASI2 In","ASI3 In"
2709};
2710
2711//static const struct soc_enum dacminidspin1_enum =
2712// SOC_ENUM_SINGLE(MINIDSP_DATA_PORT_CNTL, 5, 2, dacminidspin1_text);
2713SOC_ENUM_SINGLE_DECL(dacminidspin3_enum, MINIDSP_PORT_CNTL_REG, 0, dacminidspin3_text);
2714
2715static const struct snd_kcontrol_new dacminidspin3_control =
2716SOC_DAPM_ENUM("DAC MiniDSP IN3 Route", dacminidspin3_enum);
2717
2718static const char *asi1out_text[] = {
2719 "Off",
2720 "ASI1 Out",
2721 "ASI1In Bypass",
2722 "ASI2In Bypass",
2723 "ASI3In Bypass",
2724};
2725SOC_ENUM_SINGLE_DECL(asi1out_enum, ASI1_ADC_INPUT_CNTL, 0, asi1out_text);
2726static const struct snd_kcontrol_new asi1out_control =
2727 SOC_DAPM_ENUM("ASI1OUT Route", asi1out_enum);
2728
2729static const char *asi2out_text[] = {
2730 "Off",
2731 "ASI1 Out",
2732 "ASI1In Bypass",
2733 "ASI2In Bypass",
2734 "ASI3In Bypass",
2735 "ASI2 Out",
2736};
2737SOC_ENUM_SINGLE_DECL(asi2out_enum, ASI2_ADC_INPUT_CNTL, 0, asi2out_text);
2738static const struct snd_kcontrol_new asi2out_control =
2739 SOC_DAPM_ENUM("ASI2OUT Route", asi2out_enum);
2740static const char *asi3out_text[] = {
2741 "Off",
2742 "ASI1 Out",
2743 "ASI1In Bypass",
2744 "ASI2In Bypass",
2745 "ASI3In Bypass",
2746 "ASI3 Out",
2747};
2748SOC_ENUM_SINGLE_DECL(asi3out_enum, ASI3_ADC_INPUT_CNTL, 0, asi3out_text);
2749static const struct snd_kcontrol_new asi3out_control =
2750 SOC_DAPM_ENUM("ASI3OUT Route", asi3out_enum);
2751
2752static const char *asi1bclk_text[] = {
2753 "DAC_CLK",
2754 "DAC_MOD_CLK",
2755 "ADC_CLK",
2756 "ADC_MOD_CLK",
2757};
2758
2759SOC_ENUM_SINGLE_DECL(asi1bclk_enum, ASI1_BCLK_N_CNTL, 0, asi1bclk_text);
2760static const struct snd_kcontrol_new asi1bclk_control =
2761 SOC_DAPM_ENUM("ASI1_BCLK Route", asi1bclk_enum);
2762
2763static const char *asi2bclk_text[] = {
2764 "DAC_CLK",
2765 "DAC_MOD_CLK",
2766 "ADC_CLK",
2767 "ADC_MOD_CLK",
2768};
2769SOC_ENUM_SINGLE_DECL(asi2bclk_enum, ASI2_BCLK_N_CNTL, 0, asi2bclk_text);
2770static const struct snd_kcontrol_new asi2bclk_control =
2771 SOC_DAPM_ENUM("ASI2_BCLK Route", asi2bclk_enum);
2772static const char *asi3bclk_text[] = {
2773 "DAC_CLK",
2774 "DAC_MOD_CLK",
2775 "ADC_CLK",
2776 "ADC_MOD_CLK",
2777};
2778SOC_ENUM_SINGLE_DECL(asi3bclk_enum, ASI3_BCLK_N_CNTL, 0, asi3bclk_text);
2779static const struct snd_kcontrol_new asi3bclk_control =
2780 SOC_DAPM_ENUM("ASI3_BCLK Route", asi3bclk_enum);
2781
2782static int aic326x_hp_event(struct snd_soc_dapm_widget *w,
2783 struct snd_kcontrol *kcontrol, int event)
2784{
2785 return 0;
2786}
2787static int pll_power_on_event(struct snd_soc_dapm_widget *w,
2788 struct snd_kcontrol *kcontrol, int event)
2789{
2790 if (event == SND_SOC_DAPM_POST_PMU)
2791 {
2792 mdelay(10);
2793 }
2794 return 0;
2795}
2796
2797static int polling_loop(struct snd_soc_codec *codec, unsigned int reg,
2798 int mask, int on_off)
2799{
2800 unsigned int counter, status;
2801
2802 counter = 0;
2803 switch(on_off) {
2804 case 0: /*off*/
2805 do {
2806 status = snd_soc_read(codec, reg);
2807 counter++;
2808 } while ((counter < 500) && ((status & mask) == mask));
2809 break;
2810 case 1: /*on*/
2811 do {
2812 status = snd_soc_read(codec, reg);
2813 counter++;
2814 } while ((counter < 500) && ((status & mask) != mask));
2815 break;
2816 default:
2817 printk("%s: unknown arguement\n", __func__);
2818 break;
2819 }
2820
2821 printk("%s: exiting with count value %d \n", __func__, counter);
2822 if(counter >= 500)
2823 return -1;
2824 return 0;
2825}
2826
2827int poll_dac(struct snd_soc_codec *codec, int left_right, int on_off)
2828{
2829 int ret = 0;
2830
2831 aic3262_change_page(codec, 0);
2832 aic3262_change_book(codec, 0);
2833
2834 switch(on_off) {
2835
2836 case 0:/*power off polling*/
2837 /*DAC power polling logic*/
2838 switch(left_right) {
2839 case 0: /*left dac polling*/
2840 ret = polling_loop(codec, DAC_FLAG_R1, LDAC_POW_FLAG_MASK, 0);
2841 break;
2842 case 1:/*right dac polling*/
2843 ret = polling_loop(codec, DAC_FLAG_R1, RDAC_POW_FLAG_MASK, 0);
2844 break;
2845 }
2846 break;
2847 case 1:/*power on polling*/
2848 /*DAC power polling logic*/
2849 switch(left_right) {
2850 case 0: /*left dac polling*/
2851 ret = polling_loop(codec, DAC_FLAG_R1, LDAC_POW_FLAG_MASK, 1);
2852 break;
2853 case 1:/*right dac polling*/
2854 ret = polling_loop(codec, DAC_FLAG_R1, RDAC_POW_FLAG_MASK, 1);
2855 break;
2856 }
2857 break;
2858 default:
2859 printk("%s:unknown arguement\n", __func__);
2860 break;
2861 }
2862 if(ret)
2863 printk("%s: power %s %s failure", __func__, left_right?"right":"left", on_off?"on":"off");
2864 return ret;
2865}
2866
2867int poll_adc(struct snd_soc_codec *codec, int left_right, int on_off)
2868{
2869 int ret = 0;
2870
2871 aic3262_change_page(codec, 0);
2872 aic3262_change_book(codec, 0);
2873
2874 switch(on_off) {
2875
2876 case 0:/*power off polling*/
2877 /*DAC power polling logic*/
2878 switch(left_right) {
2879 case 0: /*left dac polling*/
2880 ret = polling_loop(codec, ADC_FLAG_R1, LADC_POW_FLAG_MASK, 0);
2881 break;
2882 case 1:/*right dac polling*/
2883 ret = polling_loop(codec, ADC_FLAG_R1, RADC_POW_FLAG_MASK, 0);
2884 break;
2885 }
2886 break;
2887 case 1:/*power on polling*/
2888 /*DAC power polling logic*/
2889 switch(left_right) {
2890 case 0: /*left dac polling*/
2891 ret = polling_loop(codec, ADC_FLAG_R1, LADC_POW_FLAG_MASK, 1);
2892 break;
2893 case 1:/*right dac polling*/
2894 ret = polling_loop(codec, ADC_FLAG_R1, RADC_POW_FLAG_MASK, 1);
2895 break;
2896 }
2897 break;
2898 default:
2899 printk("%s:unknown arguement\n", __func__);
2900 break;
2901 }
2902
2903 if(ret)
2904 printk("%s: power %s %s failure", __func__, left_right?"right":"left", on_off?"on":"off");
2905 return ret;
2906}
2907
2908static int slave_dac_event(struct snd_soc_dapm_widget *w,
2909 struct snd_kcontrol *kcontrol, int event)
2910
2911{
2912 struct snd_soc_codec *codec = w->codec;
2913
2914 if (event & SND_SOC_DAPM_POST_PMU) {
2915 /* Poll for DAC Power-up first */
2916 poll_dac(codec, 0, 1);
2917 poll_dac(codec, 1, 1);
2918 }
2919
2920 if (event & SND_SOC_DAPM_POST_PMD) {
2921 poll_dac(codec, 0, 0);
2922 poll_dac(codec, 1, 0);
2923 }
2924 return 0;
2925}
2926
2927
2928static int slave_adc_event(struct snd_soc_dapm_widget *w,
2929 struct snd_kcontrol *kcontrol, int event)
2930
2931{
2932 struct snd_soc_codec *codec = w->codec;
2933
2934 if (event & SND_SOC_DAPM_POST_PMU) {
2935
2936 /* Poll for ADC Power-up first */
2937 poll_adc(codec, 0, 1);
2938 poll_adc(codec, 1, 1);
2939 }
2940
2941
2942 if (event & SND_SOC_DAPM_POST_PMD) {
2943 poll_adc(codec, 0, 0);
2944 poll_adc(codec, 1, 0);
2945 }
2946
2947 return 0;
2948}
2949
2950static const struct snd_soc_dapm_widget aic3262_dapm_widgets[] = {
2951 /* TODO: Can we switch these off ? */
2952 SND_SOC_DAPM_AIF_IN("ASI1IN", "ASI1 Playback", 0, SND_SOC_NOPM, 0, 0),
2953 SND_SOC_DAPM_AIF_IN("ASI2IN", "ASI2 Playback", 0, SND_SOC_NOPM, 0, 0),
2954 SND_SOC_DAPM_AIF_IN("ASI3IN", "ASI3 Playback", 0, SND_SOC_NOPM, 0, 0),
2955
2956
2957 SND_SOC_DAPM_DAC_E("Left DAC", NULL, PASI_DAC_DP_SETUP, 7, 0,
2958 slave_dac_event, SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD |
2959 SND_SOC_DAPM_PRE_PMD),
2960 SND_SOC_DAPM_DAC_E("Right DAC", NULL, PASI_DAC_DP_SETUP, 6, 0,
2961 slave_dac_event, SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD |
2962 SND_SOC_DAPM_PRE_PMD),
2963
2964 /* dapm widget (path domain) for HPL Output Mixer */
2965 SND_SOC_DAPM_MIXER("HPL Output Mixer", SND_SOC_NOPM, 0, 0,
2966 &hpl_output_mixer_controls[0],
2967 ARRAY_SIZE(hpl_output_mixer_controls)),
2968
2969 /* dapm widget (path domain) for HPR Output Mixer */
2970 SND_SOC_DAPM_MIXER("HPR Output Mixer", SND_SOC_NOPM, 0, 0,
2971 &hpr_output_mixer_controls[0],
2972 ARRAY_SIZE(hpr_output_mixer_controls)),
2973
2974
2975 SND_SOC_DAPM_PGA_E("HPL Driver", HP_AMP_CNTL_R1, 1, 0, NULL, 0,
2976 aic326x_hp_event, SND_SOC_DAPM_POST_PMU),
2977 SND_SOC_DAPM_PGA_E("HPR Driver", HP_AMP_CNTL_R1, 0, 0, NULL, 0,
2978 aic326x_hp_event, SND_SOC_DAPM_POST_PMU),
2979
2980
2981 /* dapm widget (path domain) for LOL Output Mixer */
2982 SND_SOC_DAPM_MIXER("LOL Output Mixer", SND_SOC_NOPM, 0, 0,
2983 &lol_output_mixer_controls[0],
2984 ARRAY_SIZE(lol_output_mixer_controls)),
2985
2986 /* dapm widget (path domain) for LOR Output Mixer mixer */
2987 SND_SOC_DAPM_MIXER("LOR Output Mixer", SND_SOC_NOPM, 0, 0,
2988 &lor_output_mixer_controls[0],
2989 ARRAY_SIZE(lor_output_mixer_controls)),
2990
2991 SND_SOC_DAPM_PGA("LOL Driver", LINE_AMP_CNTL_R1, 1, 0, NULL, 0),
2992 SND_SOC_DAPM_PGA("LOR Driver", LINE_AMP_CNTL_R1, 0, 0, NULL, 0),
2993
2994
2995 /* dapm widget (path domain) for SPKL Output Mixer */
2996 SND_SOC_DAPM_MIXER("SPKL Output Mixer", SND_SOC_NOPM, 0, 0,
2997 &spkl_output_mixer_controls[0],
2998 ARRAY_SIZE(spkl_output_mixer_controls)),
2999
3000 /* dapm widget (path domain) for SPKR Output Mixer */
3001 SND_SOC_DAPM_MIXER("SPKR Output Mixer", SND_SOC_NOPM, 0, 0,
3002 &spkr_output_mixer_controls[0],
3003 ARRAY_SIZE(spkr_output_mixer_controls)),
3004
3005 SND_SOC_DAPM_PGA("SPKL Driver", SPK_AMP_CNTL_R1, 1, 0, NULL, 0),
3006 SND_SOC_DAPM_PGA("SPKR Driver", SPK_AMP_CNTL_R1, 0, 0, NULL, 0),
3007
3008
3009 /* dapm widget (path domain) for SPKR Output Mixer */
3010 SND_SOC_DAPM_MIXER("REC Output Mixer", SND_SOC_NOPM, 0, 0,
3011 &rec_output_mixer_controls[0],
3012 ARRAY_SIZE(rec_output_mixer_controls)),
3013
3014 SND_SOC_DAPM_PGA("RECP Driver", REC_AMP_CNTL_R5, 7, 0, NULL, 0),
3015 SND_SOC_DAPM_PGA("RECM Driver", REC_AMP_CNTL_R5, 6, 0, NULL, 0),
3016
3017
3018 SND_SOC_DAPM_MUX("ASI1LIN Route",
3019 SND_SOC_NOPM, 0, 0, &asi1lin_control),
3020 SND_SOC_DAPM_MUX("ASI1RIN Route",
3021 SND_SOC_NOPM, 0, 0, &asi1rin_control),
3022 SND_SOC_DAPM_MUX("ASI2LIN Route",
3023 SND_SOC_NOPM, 0, 0, &asi2lin_control),
3024 SND_SOC_DAPM_MUX("ASI2RIN Route",
3025 SND_SOC_NOPM, 0, 0, &asi2rin_control),
3026 SND_SOC_DAPM_MUX("ASI3LIN Route",
3027 SND_SOC_NOPM, 0, 0, &asi3lin_control),
3028 SND_SOC_DAPM_MUX("ASI3RIN Route",
3029 SND_SOC_NOPM, 0, 0, &asi3rin_control),
3030
3031 SND_SOC_DAPM_PGA("ASI1LIN", SND_SOC_NOPM, 0, 0, NULL, 0),
3032 SND_SOC_DAPM_PGA("ASI1RIN", SND_SOC_NOPM, 0, 0, NULL, 0),
3033 SND_SOC_DAPM_PGA("ASI2LIN", SND_SOC_NOPM, 0, 0, NULL, 0),
3034 SND_SOC_DAPM_PGA("ASI2RIN", SND_SOC_NOPM, 0, 0, NULL, 0),
3035 SND_SOC_DAPM_PGA("ASI3LIN", SND_SOC_NOPM, 0, 0, NULL, 0),
3036 SND_SOC_DAPM_PGA("ASI3RIN", SND_SOC_NOPM, 0, 0, NULL, 0),
3037
3038 SND_SOC_DAPM_PGA("ASI1LOUT", SND_SOC_NOPM, 0, 0, NULL, 0),
3039 SND_SOC_DAPM_PGA("ASI1ROUT", SND_SOC_NOPM, 0, 0, NULL, 0),
3040 SND_SOC_DAPM_PGA("ASI2LOUT", SND_SOC_NOPM, 0, 0, NULL, 0),
3041 SND_SOC_DAPM_PGA("ASI2ROUT", SND_SOC_NOPM, 0, 0, NULL, 0),
3042 SND_SOC_DAPM_PGA("ASI3LOUT", SND_SOC_NOPM, 0, 0, NULL, 0),
3043 SND_SOC_DAPM_PGA("ASI3ROUT", SND_SOC_NOPM, 0, 0, NULL, 0),
3044
3045 SND_SOC_DAPM_PGA("ASI1MonoMixIN", SND_SOC_NOPM, 0, 0, NULL, 0),
3046 SND_SOC_DAPM_PGA("ASI2MonoMixIN", SND_SOC_NOPM, 0, 0, NULL, 0),
3047 SND_SOC_DAPM_PGA("ASI3MonoMixIN", SND_SOC_NOPM, 0, 0, NULL, 0),
3048 /* TODO: Can we switch the ASIxIN off? */
3049 SND_SOC_DAPM_PGA("ASI1IN Port", SND_SOC_NOPM, 0, 0, NULL, 0),
3050 SND_SOC_DAPM_PGA("ASI2IN Port", SND_SOC_NOPM, 0, 0, NULL, 0),
3051 SND_SOC_DAPM_PGA("ASI3IN Port", SND_SOC_NOPM, 0, 0, NULL, 0),
3052
3053
3054 SND_SOC_DAPM_MUX("DAC MiniDSP IN1 Route",
3055 SND_SOC_NOPM, 0, 0, &dacminidspin1_control),
3056SND_SOC_DAPM_MUX("DAC MiniDSP IN2 Route",
3057 SND_SOC_NOPM, 0, 0, &dacminidspin2_control),
3058 SND_SOC_DAPM_MUX("DAC MiniDSP IN3 Route",
3059 SND_SOC_NOPM, 0, 0, &dacminidspin3_control),
3060
3061 SND_SOC_DAPM_PGA("CM", SND_SOC_NOPM, 0, 0, NULL, 0),
3062 SND_SOC_DAPM_PGA("CM1L", SND_SOC_NOPM, 0, 0, NULL, 0),
3063 SND_SOC_DAPM_PGA("CM2L", SND_SOC_NOPM, 0, 0, NULL, 0),
3064 SND_SOC_DAPM_PGA("CM1R", SND_SOC_NOPM, 0, 0, NULL, 0),
3065 SND_SOC_DAPM_PGA("CM2R", SND_SOC_NOPM, 0, 0, NULL, 0),
3066
3067 /* TODO: Can we switch these off ? */
3068 SND_SOC_DAPM_AIF_OUT("ASI1OUT","ASI1 Capture", 0, SND_SOC_NOPM, 0, 0),
3069 SND_SOC_DAPM_AIF_OUT("ASI2OUT", "ASI2 Capture",0, SND_SOC_NOPM, 0, 0),
3070 SND_SOC_DAPM_AIF_OUT("ASI3OUT", "ASI3 Capture",0, SND_SOC_NOPM, 0, 0),
3071
3072 SND_SOC_DAPM_MUX("ASI1OUT Route",
3073 SND_SOC_NOPM, 0, 0, &asi1out_control),
3074 SND_SOC_DAPM_MUX("ASI2OUT Route",
3075 SND_SOC_NOPM, 0, 0, &asi2out_control),
3076 SND_SOC_DAPM_MUX("ASI3OUT Route",
3077 SND_SOC_NOPM, 0, 0, &asi3out_control),
3078
3079 /* TODO: Will be used during MINIDSP programming */
3080 /* TODO: Can we switch them off? */
3081 SND_SOC_DAPM_PGA("ADC MiniDSP OUT1", SND_SOC_NOPM, 0, 0, NULL, 0),
3082 SND_SOC_DAPM_PGA("ADC MiniDSP OUT2", SND_SOC_NOPM, 0, 0, NULL, 0),
3083 SND_SOC_DAPM_PGA("ADC MiniDSP OUT3", SND_SOC_NOPM, 0, 0, NULL, 0),
3084
3085
3086
3087 SND_SOC_DAPM_ADC_E("Left ADC", NULL, ADC_CHANNEL_POW, 7, 0,
3088 slave_adc_event, SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD |
3089 SND_SOC_DAPM_PRE_PMD),
3090 SND_SOC_DAPM_ADC_E("Right ADC", NULL, ADC_CHANNEL_POW, 6, 0,
3091 slave_adc_event, SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD |
3092 SND_SOC_DAPM_PRE_PMD),
3093
3094 SND_SOC_DAPM_PGA("Left MicPGA",MICL_PGA, 7, 1, NULL, 0),
3095 SND_SOC_DAPM_PGA("Right MicPGA",MICR_PGA, 7, 1, NULL, 0),
3096
3097 SND_SOC_DAPM_PGA("MAL PGA", MA_CNTL, 3, 0, NULL, 0),
3098 SND_SOC_DAPM_PGA("MAR PGA", MA_CNTL, 2, 0, NULL, 0),
3099
3100
3101 /* dapm widget for MAL PGA Mixer*/
3102 SND_SOC_DAPM_MIXER("MAL PGA Mixer", SND_SOC_NOPM, 0, 0,
3103 &mal_pga_mixer_controls[0],
3104 ARRAY_SIZE(mal_pga_mixer_controls)),
3105
3106 /* dapm widget for MAR PGA Mixer*/
3107 SND_SOC_DAPM_MIXER("MAR PGA Mixer", SND_SOC_NOPM, 0, 0,
3108 &mar_pga_mixer_controls[0],
3109 ARRAY_SIZE(mar_pga_mixer_controls)),
3110
3111 /* dapm widget for Left Input Mixer*/
3112 SND_SOC_DAPM_MIXER("Left Input Mixer", SND_SOC_NOPM, 0, 0,
3113 &left_input_mixer_controls[0],
3114 ARRAY_SIZE(left_input_mixer_controls)),
3115
3116 /* dapm widget for Right Input Mixer*/
3117 SND_SOC_DAPM_MIXER("Right Input Mixer", SND_SOC_NOPM, 0, 0,
3118 &right_input_mixer_controls[0],
3119 ARRAY_SIZE(right_input_mixer_controls)),
3120
3121
3122 SND_SOC_DAPM_OUTPUT("HPL"),
3123 SND_SOC_DAPM_OUTPUT("HPR"),
3124 SND_SOC_DAPM_OUTPUT("LOL"),
3125 SND_SOC_DAPM_OUTPUT("LOR"),
3126 SND_SOC_DAPM_OUTPUT("SPKL"),
3127 SND_SOC_DAPM_OUTPUT("SPKR"),
3128 SND_SOC_DAPM_OUTPUT("RECP"),
3129 SND_SOC_DAPM_OUTPUT("RECM"),
3130
3131 SND_SOC_DAPM_INPUT("IN1L"),
3132 SND_SOC_DAPM_INPUT("IN2L"),
3133 SND_SOC_DAPM_INPUT("IN3L"),
3134 SND_SOC_DAPM_INPUT("IN4L"),
3135 SND_SOC_DAPM_INPUT("IN1R"),
3136 SND_SOC_DAPM_INPUT("IN2R"),
3137 SND_SOC_DAPM_INPUT("IN3R"),
3138 SND_SOC_DAPM_INPUT("IN4R"),
3139
3140
3141 SND_SOC_DAPM_MICBIAS("Mic Bias Ext", MIC_BIAS_CNTL, 6, 0),
3142 SND_SOC_DAPM_MICBIAS("Mic Bias Int", MIC_BIAS_CNTL, 2, 0),
3143
3144 SND_SOC_DAPM_SUPPLY("PLLCLK",PLL_PR_POW_REG,7,0,pll_power_on_event,
3145 SND_SOC_DAPM_POST_PMU),
3146 SND_SOC_DAPM_SUPPLY("DACCLK",NDAC_DIV_POW_REG,7,0, NULL, 0),
3147 SND_SOC_DAPM_SUPPLY("CODEC_CLK_IN",SND_SOC_NOPM,0,0, NULL, 0),
3148 SND_SOC_DAPM_SUPPLY("DAC_MOD_CLK",MDAC_DIV_POW_REG,7,0, NULL, 0),
3149 SND_SOC_DAPM_SUPPLY("ADCCLK",NADC_DIV_POW_REG,7,0, NULL, 0),
3150 SND_SOC_DAPM_SUPPLY("ADC_MOD_CLK",MADC_DIV_POW_REG,7,0, NULL, 0),
3151 SND_SOC_DAPM_SUPPLY("ASI1_BCLK",ASI1_BCLK_N,7,0, NULL, 0),
3152 SND_SOC_DAPM_SUPPLY("ASI1_WCLK",ASI1_WCLK_N,7,0, NULL, 0),
3153 SND_SOC_DAPM_SUPPLY("ASI2_BCLK",ASI2_BCLK_N,7,0, NULL, 0),
3154 SND_SOC_DAPM_SUPPLY("ASI2_WCLK",ASI2_WCLK_N,7,0, NULL, 0),
3155 SND_SOC_DAPM_SUPPLY("ASI3_BCLK",ASI3_BCLK_N,7,0, NULL, 0),
3156 SND_SOC_DAPM_SUPPLY("ASI3_WCLK",ASI3_WCLK_N,7,0, NULL, 0),
3157 SND_SOC_DAPM_MUX("ASI1_BCLK Route",
3158 SND_SOC_NOPM, 0, 0, &asi1bclk_control),
3159 SND_SOC_DAPM_MUX("ASI2_BCLK Route", SND_SOC_NOPM, 0, 0, &asi2bclk_control),
3160 SND_SOC_DAPM_MUX("ASI3_BCLK Route", SND_SOC_NOPM, 0, 0, &asi3bclk_control),
3161};
3162
3163static const struct snd_soc_dapm_route aic3262_dapm_routes[] ={
3164 /* TODO: Do we need only DACCLK for ASIIN's and ADCCLK for ASIOUT??? */
3165 /* Clock portion */
3166 {"CODEC_CLK_IN", NULL, "PLLCLK"},
3167 {"DACCLK", NULL, "CODEC_CLK_IN"},
3168 {"ADCCLK", NULL, "CODEC_CLK_IN"},
3169 {"DAC_MOD_CLK", NULL, "DACCLK"},
3170#ifdef AIC3262_SYNC_MODE
3171 {"ADC_MOD_CLK", NULL,"DACCLK"},
3172#else
3173 {"ADC_MOD_CLK", NULL, "ADCCLK"},
3174#endif
3175
3176 {"ASI1_BCLK Route","DAC_CLK","DACCLK"},
3177 {"ASI1_BCLK Route","DAC_MOD_CLK","DAC_MOD_CLK"},
3178 {"ASI1_BCLK Route","ADC_CLK","ADCCLK"},
3179 {"ASI1_BCLK Route","ADC_MOD_CLK","ADC_MOD_CLK"},
3180
3181 {"ASI2_BCLK Route","DAC_CLK","DACCLK"},
3182 {"ASI2_BCLK Route","DAC_MOD_CLK","DAC_MOD_CLK"},
3183 {"ASI2_BCLK Route","ADC_CLK","ADCCLK"},
3184 {"ASI2_BCLK Route","ADC_MOD_CLK","ADC_MOD_CLK"},
3185
3186 {"ASI3_BCLK Route","DAC_CLK","DACCLK"},
3187 {"ASI3_BCLK Route","DAC_MOD_CLK","DAC_MOD_CLK"},
3188 {"ASI3_BCLK Route","ADC_CLK","ADCCLK"},
3189 {"ASI3_BCLK Route","ADC_MOD_CLK","ADC_MOD_CLK"},
3190
3191 {"ASI1_BCLK", NULL, "ASI1_BCLK Route"},
3192 {"ASI2_BCLK", NULL, "ASI2_BCLK Route"},
3193 {"ASI3_BCLK", NULL, "ASI3_BCLK Route"},
3194
3195
3196 {"ASI1IN", NULL , "PLLCLK"},
3197 {"ASI1IN", NULL , "DACCLK"},
3198 {"ASI1IN", NULL , "ADCCLK"},
3199 {"ASI1IN", NULL , "DAC_MOD_CLK"},
3200 {"ASI1IN", NULL , "ADC_MOD_CLK"},
3201
3202 {"ASI1OUT", NULL , "PLLCLK"},
3203 {"ASI1OUT", NULL , "DACCLK"},
3204 {"ASI1OUT", NULL , "ADCCLK"},
3205 {"ASI1OUT", NULL , "DAC_MOD_CLK"},
3206 {"ASI1OUT", NULL , "ADC_MOD_CLK"},
3207#ifdef AIC3262_ASI1_MASTER
3208 {"ASI1IN", NULL , "ASI1_BCLK"},
3209 {"ASI1OUT", NULL , "ASI1_BCLK"},
3210 {"ASI1IN", NULL , "ASI1_WCLK"},
3211 {"ASI1OUT", NULL , "ASI1_WCLK"},
3212#else
3213
3214#endif
3215
3216 {"ASI2IN", NULL , "PLLCLK"},
3217 {"ASI2IN", NULL , "DACCLK"},
3218 {"ASI2IN", NULL , "ADCCLK"},
3219 {"ASI2IN", NULL , "DAC_MOD_CLK"},
3220 {"ASI2IN", NULL , "ADC_MOD_CLK"},
3221
3222 {"ASI2OUT", NULL , "PLLCLK"},
3223 {"ASI2OUT", NULL , "DACCLK"},
3224 {"ASI2OUT", NULL , "ADCCLK"},
3225 {"ASI2OUT", NULL , "DAC_MOD_CLK"},
3226 {"ASI2OUT", NULL , "ADC_MOD_CLK"},
3227
3228#ifdef AIC3262_ASI2_MASTER
3229 {"ASI2IN", NULL , "ASI2_BCLK"},
3230 {"ASI2OUT", NULL , "ASI2_BCLK"},
3231 {"ASI2IN", NULL , "ASI2_WCLK"},
3232 {"ASI2OUT", NULL , "ASI2_WCLK"},
3233#else
3234
3235#endif
3236 {"ASI3IN", NULL , "PLLCLK"},
3237 {"ASI3IN", NULL , "DACCLK"},
3238 {"ASI3IN", NULL , "ADCCLK"},
3239 {"ASI3IN", NULL , "DAC_MOD_CLK"},
3240 {"ASI3IN", NULL , "ADC_MOD_CLK"},
3241
3242
3243 {"ASI3OUT", NULL , "PLLCLK"},
3244 {"ASI3OUT", NULL , "DACCLK"},
3245 {"ASI3OUT", NULL , "ADCCLK"},
3246 {"ASI3OUT", NULL , "DAC_MOD_CLK"},
3247 {"ASI3OUT", NULL , "ADC_MOD_CLK"},
3248
3249#ifdef AIC3262_ASI3_MASTER
3250 {"ASI3IN", NULL , "ASI3_BCLK"},
3251 {"ASI3OUT", NULL , "ASI3_BCLK"},
3252 {"ASI3IN", NULL , "ASI3_WCLK"},
3253 {"ASI3OUT", NULL , "ASI3_WCLK"},
3254#else
3255#endif
3256
3257/* Playback (DAC) Portion */
3258 {"HPL Output Mixer","LDAC Switch","Left DAC"},
3259 {"HPL Output Mixer","MAL Switch","MAL PGA"},
3260 {"HPL Output Mixer","LOL-B1 Volume","LOL"},
3261
3262 {"HPR Output Mixer","LOR-B1 Volume","LOR"},
3263 {"HPR Output Mixer","LDAC Switch","Left DAC"},
3264 {"HPR Output Mixer","RDAC Switch","Right DAC"},
3265 {"HPR Output Mixer","MAR Switch","MAR PGA"},
3266
3267 {"HPL Driver",NULL,"HPL Output Mixer"},
3268 {"HPR Driver",NULL,"HPR Output Mixer"},
3269
3270 {"HPL",NULL,"HPL Driver"},
3271 {"HPR",NULL,"HPR Driver"},
3272
3273 {"LOL Output Mixer","MAL Switch","MAL PGA"},
3274 {"LOL Output Mixer","IN1L-B Switch","IN1L"},
3275 {"LOL Output Mixer","LDAC Switch","Left DAC"},
3276 {"LOL Output Mixer","RDAC Switch","Right DAC"},
3277
3278 {"LOR Output Mixer","LOL Switch","LOL"},
3279 {"LOR Output Mixer","RDAC Switch","Right DAC"},
3280 {"LOR Output Mixer","MAR Switch","MAR PGA"},
3281 {"LOR Output Mixer","IN1R-B Switch","IN1R"},
3282
3283 {"LOL Driver",NULL,"LOL Output Mixer"},
3284 {"LOR Driver",NULL,"LOR Output Mixer"},
3285
3286 {"LOL",NULL,"LOL Driver"},
3287 {"LOR",NULL,"LOR Driver"},
3288
3289 {"REC Output Mixer","LOL-B2 Volume","LOL"},
3290 {"REC Output Mixer","IN1L Volume","IN1L"},
3291 {"REC Output Mixer","IN1R Volume","IN1R"},
3292 {"REC Output Mixer","LOR-B2 Volume","LOR"},
3293
3294 {"RECP Driver",NULL,"REC Output Mixer"},
3295 {"RECM Driver",NULL,"REC Output Mixer"},
3296
3297 {"RECP",NULL,"RECP Driver"},
3298 {"RECM",NULL,"RECM Driver"},
3299
3300 {"SPKL Output Mixer","MAL Switch","MAL PGA"},
3301 {"SPKL Output Mixer","LOL Volume","LOL"},
3302 {"SPKL Output Mixer","SPR_IN Switch","SPKR Output Mixer"},
3303
3304 {"SPKR Output Mixer", "LOR Volume","LOR"},
3305 {"SPKR Output Mixer", "MAR Switch","MAR PGA"},
3306
3307
3308 {"SPKL Driver",NULL,"SPKL Output Mixer"},
3309 {"SPKR Driver",NULL,"SPKR Output Mixer"},
3310
3311 {"SPKL",NULL,"SPKL Driver"},
3312 {"SPKR",NULL,"SPKR Driver"},
3313/* ASI Input routing */
3314 {"ASI1LIN", NULL, "ASI1IN"},
3315 {"ASI1RIN", NULL, "ASI1IN"},
3316 {"ASI2LIN", NULL, "ASI2IN"},
3317 {"ASI2RIN", NULL, "ASI2IN"},
3318 {"ASI3LIN", NULL, "ASI3IN"},
3319 {"ASI3RIN", NULL, "ASI3IN"},
3320
3321 {"ASI1MonoMixIN", NULL, "ASI1IN"},
3322 {"ASI2MonoMixIN", NULL, "ASI2IN"},
3323 {"ASI3MonoMixIN", NULL, "ASI3IN"},
3324
3325 {"ASI1LIN Route","ASI1 Left In","ASI1LIN"},
3326 {"ASI1LIN Route","ASI1 Right In","ASI1RIN"},
3327 {"ASI1LIN Route","ASI1 MonoMix In","ASI1MonoMixIN"},
3328
3329 {"ASI1RIN Route", "ASI1 Right In","ASI1RIN"},
3330 {"ASI1RIN Route","ASI1 Left In","ASI1LIN"},
3331 {"ASI1RIN Route","ASI1 MonoMix In","ASI1MonoMixIN"},
3332
3333
3334 {"ASI2LIN Route","ASI2 Left In","ASI2LIN"},
3335 {"ASI2LIN Route","ASI2 Right In","ASI2RIN"},
3336 {"ASI2LIN Route","ASI2 MonoMix In","ASI2MonoMixIN"},
3337
3338 {"ASI2RIN Route","ASI2 Right In","ASI2RIN"},
3339 {"ASI2RIN Route","ASI2 Left In","ASI2LIN"},
3340 {"ASI2RIN Route","ASI2 MonoMix In","ASI2MonoMixIN"},
3341
3342
3343 {"ASI3LIN Route","ASI3 Left In","ASI3LIN"},
3344 {"ASI3LIN Route","ASI3 Right In","ASI3RIN"},
3345 {"ASI3LIN Route","ASI3 MonoMix In","ASI3MonoMixIN"},
3346
3347 {"ASI3RIN Route","ASI3 Right In","ASI3RIN"},
3348 {"ASI3RIN Route","ASI3 Left In","ASI3LIN"},
3349 {"ASI3RIN Route","ASI3 MonoMix In","ASI3MonoMixIN"},
3350
3351 {"ASI1IN Port", NULL, "ASI1LIN Route"},
3352 {"ASI1IN Port", NULL, "ASI1RIN Route"},
3353 {"ASI2IN Port", NULL, "ASI2LIN Route"},
3354 {"ASI2IN Port", NULL, "ASI2RIN Route"},
3355 {"ASI3IN Port", NULL, "ASI3LIN Route"},
3356 {"ASI3IN Port", NULL, "ASI3RIN Route"},
3357
3358 {"DAC MiniDSP IN1 Route", "ASI1 In","ASI1IN Port"},
3359 {"DAC MiniDSP IN1 Route","ASI2 In","ASI2IN Port"},
3360 {"DAC MiniDSP IN1 Route","ASI3 In","ASI3IN Port"},
3361 {"DAC MiniDSP IN1 Route","ADC MiniDSP Out","ADC MiniDSP OUT1"},
3362
3363 {"DAC MiniDSP IN2 Route","ASI1 In","ASI1IN Port"},
3364 {"DAC MiniDSP IN2 Route","ASI2 In","ASI2IN Port"},
3365 {"DAC MiniDSP IN2 Route","ASI3 In","ASI3IN Port"},
3366
3367 {"DAC MiniDSP IN3 Route","ASI1 In","ASI1IN Port"},
3368 {"DAC MiniDSP IN3 Route","ASI2 In","ASI2IN Port"},
3369 {"DAC MiniDSP IN3 Route","ASI3 In","ASI3IN Port"},
3370
3371 {"Left DAC", "NULL", "DAC MiniDSP IN1 Route"},
3372 {"Right DAC", "NULL", "DAC MiniDSP IN1 Route"},
3373
3374 {"Left DAC", "NULL","DAC MiniDSP IN2 Route"},
3375 {"Right DAC", "NULL","DAC MiniDSP IN2 Route"},
3376
3377 {"Left DAC", "NULL","DAC MiniDSP IN3 Route"},
3378 {"Right DAC", "NULL","DAC MiniDSP IN3 Route"},
3379
3380
3381/* Mixer Amplifier */
3382
3383 {"MAL PGA Mixer", "IN1L Switch","IN1L"},
3384 {"MAL PGA Mixer", "Left MicPGA Volume","Left MicPGA"},
3385
3386 {"MAL PGA", NULL, "MAL PGA Mixer"},
3387
3388
3389 {"MAR PGA Mixer", "IN1R Switch","IN1R"},
3390 {"MAR PGA Mixer", "Right MicPGA Volume","Right MicPGA"},
3391
3392 {"MAR PGA", NULL, "MAR PGA Mixer"},
3393
3394
3395/* Capture (ADC) portions */
3396 /* Left Positive PGA input */
3397 {"Left Input Mixer","IN1L Switch","IN1L"},
3398 {"Left Input Mixer","IN2L Switch","IN2L"},
3399 {"Left Input Mixer","IN3L Switch","IN3L"},
3400 {"Left Input Mixer","IN4L Switch","IN4L"},
3401 {"Left Input Mixer","IN1R Switch","IN1R"},
3402 /* Left Negative PGA input */
3403 {"Left Input Mixer","IN2R Switch","IN2R"},
3404 {"Left Input Mixer","IN3R Switch","IN3R"},
3405 {"Left Input Mixer","IN4R Switch","IN4R"},
3406 {"Left Input Mixer","CM2L Switch","CM2L"},
3407 {"Left Input Mixer","CM1L Switch","CM1L"},
3408
3409 /* Right Positive PGA Input */
3410 {"Right Input Mixer","IN1R Switch","IN1R"},
3411 {"Right Input Mixer","IN2R Switch","IN2R"},
3412 {"Right Input Mixer","IN3R Switch","IN3R"},
3413 {"Right Input Mixer","IN4R Switch","IN4R"},
3414 {"Right Input Mixer","IN2L Switch","IN2L"},
3415
3416 /* Right Negative PGA Input */
3417 {"Right Input Mixer","IN1L Switch","IN1L"},
3418 {"Right Input Mixer","IN3L Switch","IN3L"},
3419 {"Right Input Mixer","IN4L Switch","IN4L"},
3420 {"Right Input Mixer","CM1R Switch","CM1R"},
3421 {"Right Input Mixer","CM2R Switch","CM2R"},
3422
3423 {"CM1L", NULL, "CM"},
3424 {"CM2L", NULL, "CM"},
3425 {"CM1R", NULL, "CM"},
3426 {"CM2R", NULL, "CM"},
3427
3428 {"Left MicPGA",NULL,"Left Input Mixer"},
3429 {"Right MicPGA",NULL,"Right Input Mixer"},
3430
3431 {"Left ADC", NULL, "Left MicPGA"},
3432 {"Right ADC", NULL, "Right MicPGA"},
3433
3434/* ASI Output Routing */
3435 {"ADC MiniDSP OUT1", NULL, "Left ADC"},
3436 {"ADC MiniDSP OUT1", NULL, "Right ADC"},
3437 {"ADC MiniDSP OUT2", NULL, "Left ADC"},
3438 {"ADC MiniDSP OUT2", NULL, "Right ADC"},
3439 {"ADC MiniDSP OUT3", NULL, "Left ADC"},
3440 {"ADC MiniDSP OUT3", NULL, "Right ADC"},
3441
3442 {"ASI1OUT Route", "ASI1 Out","ADC MiniDSP OUT1"},// Port 1
3443 {"ASI1OUT Route", "ASI1In Bypass","ASI1IN Port"},
3444 {"ASI1OUT Route", "ASI2In Bypass","ASI2IN Port"},
3445 {"ASI1OUT Route", "ASI3In Bypass","ASI3IN Port"},
3446
3447 {"ASI2OUT Route", "ASI1 Out","ADC MiniDSP OUT1"},// Port 1
3448 {"ASI2OUT Route", "ASI1In Bypass","ASI1IN Port"},
3449 {"ASI2OUT Route", "ASI2In Bypass","ASI2IN Port"},
3450 {"ASI2OUT Route", "ASI3In Bypass","ASI3IN Port"},
3451 {"ASI2OUT Route", "ASI2 Out","ADC MiniDSP OUT2"},// Port 2
3452
3453 {"ASI3OUT Route", "ASI1 Out","ADC MiniDSP OUT1"},// Port 1
3454 {"ASI3OUT Route", "ASI1In Bypass","ASI1IN Port"},
3455 {"ASI3OUT Route", "ASI2In Bypass","ASI2IN Port"},
3456 {"ASI3OUT Route", "ASI3In Bypass","ASI3IN Port"},
3457 {"ASI3OUT Route", "ASI3 Out","ADC MiniDSP OUT3"},// Port 3
3458
3459 {"ASI1OUT",NULL,"ASI1OUT Route"},
3460 {"ASI2OUT",NULL,"ASI2OUT Route"},
3461 {"ASI3OUT",NULL,"ASI3OUT Route"},
3462
3463};
3464
3465
3466#define AIC3262_DAPM_ROUTE_NUM (sizeof(aic3262_dapm_routes)/sizeof(struct snd_soc_dapm_route))
3467
3468/*
3469 *****************************************************************************
3470 * Function Definitions
3471 *****************************************************************************
3472 */
3473
3474
3475/*
3476 *----------------------------------------------------------------------------
3477 * Function : aic3262_change_page
3478 * Purpose : This function is to switch between page 0 and page 1.
3479 *
3480 *----------------------------------------------------------------------------
3481 */
3482int aic3262_change_page(struct snd_soc_codec *codec, u8 new_page)
3483{
3484 struct aic3262_priv *aic3262 = snd_soc_codec_get_drvdata(codec);
3485 u8 data[2];
3486 int ret = 0;
3487
3488 data[0] = 0;
3489 data[1] = new_page;
3490 aic3262->page_no = new_page;
3491
3492#if defined(LOCAL_REG_ACCESS)
3493 if (codec->hw_write(codec->control_data, data, 2) != 2)
3494 ret = -EIO;
3495#else
3496 ret = snd_soc_write(codec, data[0], data[1]);
3497#endif
3498 if (ret)
3499 printk(KERN_ERR "Error in changing page to %d\n", new_page);
3500
3501 /*DBG("# Changing page to %d\r\n", new_page);*/
3502
3503 return ret;
3504}
3505/*
3506 *----------------------------------------------------------------------------
3507 * Function : aic3262_change_book
3508 * Purpose : This function is to switch between books
3509 *
3510 *----------------------------------------------------------------------------
3511 */
3512int aic3262_change_book(struct snd_soc_codec *codec, u8 new_book)
3513{
3514 struct aic3262_priv *aic3262 = snd_soc_codec_get_drvdata(codec);
3515 u8 data[2];
3516 int ret = 0;
3517
3518 data[0] = 0x7F;
3519 data[1] = new_book;
3520 aic3262->book_no = new_book;
3521
3522 ret = aic3262_change_page(codec, 0);
3523 if (ret)
3524 return ret;
3525
3526#if defined(LOCAL_REG_ACCESS)
3527 if (codec->hw_write(codec->control_data, data, 2) != 2)
3528 ret = -EIO;
3529#else
3530 ret = snd_soc_write(codec, data[0], data[1]);
3531#endif
3532 if (ret)
3533 printk(KERN_ERR "Error in changing Book\n");
3534
3535 /*DBG("# Changing book to %d\r\n", new_book);*/
3536
3537 return ret;
3538}
3539/*
3540 *----------------------------------------------------------------------------
3541 * Function : aic3262_write_reg_cache
3542 * Purpose : This function is to write aic3262 register cache
3543 *
3544 *----------------------------------------------------------------------------
3545 */
3546void aic3262_write_reg_cache(struct snd_soc_codec *codec,
3547 u16 reg, u8 value)
3548{
3549#if defined(EN_REG_CACHE)
3550 u8 *cache = codec->reg_cache;
3551
3552 if (reg >= AIC3262_CACHEREGNUM)
3553 return;
3554
3555 if (cache)
3556 cache[reg] = value;
3557#endif
3558}
3559
3560/*
3561 *----------------------------------------------------------------------------
3562 * Function : aic3262_read
3563 * Purpose : This function is to read the aic3262 register space.
3564 *
3565 *----------------------------------------------------------------------------
3566 */
3567
3568u8 aic3262_read(struct snd_soc_codec *codec, u16 reg)
3569{
3570 struct aic3262_priv *aic3262 = snd_soc_codec_get_drvdata(codec);
3571 u8 value;
3572 u8 page = reg / 128;
3573 u16 *cache = codec->reg_cache;
3574 u16 cmd;
3575 u8 buffer[2];
3576 int rc;
3577 reg = reg % 128;
3578
3579 if (reg >= AIC3262_CACHEREGNUM) {
3580 return 0;
3581 }
3582
3583 if (aic3262->control_type == SND_SOC_I2C) {
3584 if (aic3262->page_no != page) {
3585 aic3262_change_page(codec, page);
3586 }
3587 i2c_master_send(codec->control_data, (char *)&reg, 1);
3588 i2c_master_recv(codec->control_data, &value, 1);
3589 /*DBG("r %2x %02x\r\n", reg, value); */
3590 } else if (aic3262->control_type == SND_SOC_SPI) {
3591 u16 value;
3592
3593 /* Do SPI transfer; first 16bits are command; remaining is
3594 * register contents */
3595 cmd = AIC3262_READ_COMMAND_WORD(reg);
3596 buffer[0] = (cmd >> 8) & 0xff;
3597 buffer[1] = cmd & 0xff;
3598 //rc = spi_write_then_read(aic3262->spi, buffer, 2, buffer, 2);
3599
3600 if (rc) {
3601 dev_err(&aic3262->spi->dev, "AIC26 reg read error\n");
3602 return -EIO;
3603 }
3604 value = (buffer[0] << 8) | buffer[1];
3605 } else {
3606 printk(KERN_ERR "Unknown Interface Type in aic3262_read\n");
3607 }
3608
3609 /* Update the cache before returning with the value */
3610 cache[reg] = value;
3611 return value;
3612
3613}
3614
3615/*
3616 *----------------------------------------------------------------------------
3617 * Function : aic3262_write
3618 * Purpose : This function is to write to the aic3262 register space.
3619 *
3620 *----------------------------------------------------------------------------
3621 */
3622int aic3262_write(struct snd_soc_codec *codec, u16 reg, u8 value)
3623{
3624 struct aic3262_priv *aic3262 = snd_soc_codec_get_drvdata(codec);
3625 u8 data[2];
3626 u8 page;
3627 int ret = 0;
3628
3629 page = reg / 128;
3630 data[AIC3262_REG_OFFSET_INDEX] = reg % 128;
3631 if (aic3262->page_no != page)
3632 aic3262_change_page(codec, page);
3633
3634 /* data is
3635 * D15..D8 aic3262 register offset
3636 * D7...D0 register data
3637 */
3638 data[AIC3262_REG_DATA_INDEX] = value & AIC3262_8BITS_MASK;
3639#if defined(EN_REG_CACHE)
3640 if ((page >= 0) & (page <= 4))
3641 aic3262_write_reg_cache(codec, reg, value);
3642
3643#endif
3644 if (!data[AIC3262_REG_OFFSET_INDEX]) {
3645 /* if the write is to reg0 update aic3262->page_no */
3646 aic3262->page_no = value;
3647 }
3648
3649 /*DBG("w %2x %02x\r\n",
3650 data[AIC3262_REG_OFFSET_INDEX], data[AIC3262_REG_DATA_INDEX]);*/
3651
3652#if defined(LOCAL_REG_ACCESS)
3653 if (codec->hw_write(codec->control_data, data, 2) != 2)
3654 ret = -EIO;
3655#else
3656 ret = snd_soc_write(codec, data[AIC3262_REG_OFFSET_INDEX],
3657 data[AIC3262_REG_DATA_INDEX]);
3658#endif
3659 if (ret)
3660 printk(KERN_ERR "Error in i2c write\n");
3661
3662 return ret;
3663}
3664
3665/*
3666 *------------------------------------------------------------------------------
3667 * Function : aic3262_write__
3668 * Purpose : This function is to write to the aic3262 register space.
3669 * (low level).
3670 *------------------------------------------------------------------------------
3671 */
3672
3673int aic3262_write__(struct i2c_client *client, const char *buf, int count)
3674{
3675 u8 data[3];
3676 int ret;
3677 data[0] = *buf;
3678 data[1] = *(buf+1);
3679 data[2] = *(buf+2);
3680 /*DBG("w %2x %02x\r\n",
3681 data[AIC3262_REG_OFFSET_INDEX], data[AIC3262_REG_DATA_INDEX]);*/
3682 ret = i2c_master_send(client, data, 2);
3683 if (ret < 2) {
3684 printk(
3685 KERN_ERR "I2C write Error : bytes written = %d\n\n", ret);
3686 return -EIO;
3687 }
3688
3689 return ret;
3690}
3691/*
3692 *----------------------------------------------------------------------------
3693 * Function : aic3262_reset_cache
3694 * Purpose : This function is to reset the cache.
3695 *----------------------------------------------------------------------------
3696 */
3697int aic3262_reset_cache(struct snd_soc_codec *codec)
3698{
3699#if defined(EN_REG_CACHE)
3700 if (codec->reg_cache) {
3701 memcpy(codec->reg_cache, aic3262_reg, sizeof(aic3262_reg));
3702 return 0;
3703 }
3704
3705 codec->reg_cache = kmemdup(aic3262_reg,
3706 sizeof(aic3262_reg), GFP_KERNEL);
3707 if (!codec->reg_cache) {
3708 printk(KERN_ERR "aic32x4: kmemdup failed\n");
3709 return -ENOMEM;
3710 }
3711#endif
3712 return 0;
3713}
3714
3715/*
3716 *----------------------------------------------------------------------------
3717 * Function : aic3262_get_divs
3718 * Purpose : This function is to get required divisor from the "aic3262_divs"
3719 * table.
3720 *
3721 *----------------------------------------------------------------------------
3722 */
3723static inline int aic3262_get_divs(int mclk, int rate)
3724{
3725 int i;
3726
3727 for (i = 0; i < ARRAY_SIZE(aic3262_divs); i++) {
3728 if ((aic3262_divs[i].rate == rate)
3729 && (aic3262_divs[i].mclk == mclk)) {
3730 DBG(KERN_INFO "#%s: Found Entry %d in Clock_Array\n",
3731 __func__, i);
3732 return i;
3733 }
3734 }
3735 printk(KERN_ERR "Master clock and sample rate is not supported\n");
3736 return -EINVAL;
3737}
3738
3739/*
3740 *----------------------------------------------------------------------------
3741 * Function : aic3262_add_widgets
3742 * Purpose : This function is to add the dapm widgets
3743 * The following are the main widgets supported
3744 * # Left DAC to Left Outputs
3745 * # Right DAC to Right Outputs
3746 * # Left Inputs to Left ADC
3747 * # Right Inputs to Right ADC
3748 *
3749 *----------------------------------------------------------------------------
3750 */
3751static int aic3262_add_widgets(struct snd_soc_codec *codec)
3752{
3753 int ret;
3754 struct snd_soc_dapm_context *dapm = &codec->dapm;
3755#ifndef AIC3262_MULTI_I2S
3756 int i;
3757 for (i = 0; i < ARRAY_SIZE(aic3262_dapm_widgets); i++)
3758 ret = snd_soc_dapm_new_control(dapm, &aic3262_dapm_widgets[i]);
3759#else
3760 ret = snd_soc_dapm_new_controls(dapm, aic3262_dapm_widgets,
3761 ARRAY_SIZE(aic3262_dapm_widgets));
3762 if (ret != 0) {
3763 printk(KERN_ERR "#%s: Unable to add DAPM Controls. Err %d\n",
3764 __func__, ret);
3765 }
3766#endif
3767 /* set up audio path interconnects */
3768 DBG("#Completed adding new dapm widget controls size=%d\n",
3769 ARRAY_SIZE(aic3262_dapm_widgets));
3770 snd_soc_dapm_add_routes(dapm, aic3262_dapm_routes,
3771 ARRAY_SIZE(aic3262_dapm_routes));
3772 DBG("#Completed adding DAPM routes\n");
3773 snd_soc_dapm_new_widgets(dapm);
3774 DBG("#Completed updating dapm\n");
3775 return 0;
3776}
3777/*
3778 *----------------------------------------------------------------------------
3779 * Function : reg_def_conf
3780 * Purpose : This function is to reset the codec book 0 registers
3781 *
3782 *----------------------------------------------------------------------------
3783 */
3784int reg_def_conf(struct snd_soc_codec *codec)
3785{
3786 int i = 0, ret;
3787 DBG(KERN_INFO "#%s: Invoked..\n", __func__);
3788
3789 ret = aic3262_change_page(codec, 0);
3790 if (ret != 0)
3791 return ret;
3792
3793 ret = aic3262_change_book(codec, 0);
3794 if (ret != 0)
3795 return ret;
3796
3797 /* Configure the Codec with the default Initialization Values */
3798 for (i = 0; i < reg_init_size; i++) {
3799 ret = snd_soc_write(codec, aic3262_reg_init[i].reg_offset,
3800 aic3262_reg_init[i].reg_val);
3801 if (ret)
3802 break;
3803 }
3804 DBG(KERN_INFO "#%s: Done..\n", __func__);
3805 return ret;
3806}
3807
3808/*
3809 * i2c_verify_book0
3810 *
3811 * This function is used to dump the values of the Book 0 Pages.
3812 */
3813int i2c_verify_book0(struct snd_soc_codec *codec)
3814{
3815 int i, j, k = 0;
3816 u8 val1;
3817
3818 DBG("starting i2c_verify\n");
3819 DBG("Resetting page to 0\n");
3820 aic3262_change_book(codec, 0);
3821 for (j = 0; j < 3; j++) {
3822 if (j == 0) {
3823 aic3262_change_page(codec, 0);
3824 k = 0;
3825 }
3826 if (j == 1) {
3827 aic3262_change_page(codec, 1);
3828 k = 1;
3829 }
3830 /*
3831 if (j == 2) {
3832 aic3262_change_page(codec, 4);
3833 k = 4;
3834 }*/
3835 for (i = 0; i <= 127; i++) {
3836#if defined(LOCAL_REG_ACCESS)
3837 val1 = i2c_smbus_read_byte_data(codec->control_data, i);
3838#else
3839 val1 = snd_soc_read(codec, i);
3840#endif
3841 /* printk("[%d][%d]=[0x%2x]\n",k,i,val1); */
3842 }
3843 }
3844 return 0;
3845}
3846
3847/*
3848 *----------------------------------------------------------------------------
3849 * Function : aic3262_set_bias_level
3850 * Purpose : This function is to get triggered when dapm events occurs.
3851 *
3852 *----------------------------------------------------------------------------
3853 */
3854
3855static int aic3262_set_bias_level(struct snd_soc_codec *codec,
3856 enum snd_soc_bias_level level)
3857{
3858 struct aic3262_priv *aic3262 = snd_soc_codec_get_drvdata(codec);
3859 u8 value;
3860 switch (level) {
3861 /* full On */
3862 case SND_SOC_BIAS_ON:
3863
3864 /* all power is driven by DAPM system */
3865 dev_dbg(codec->dev, "set_bias_on\n");
3866 break;
3867
3868 /* partial On */
3869 case SND_SOC_BIAS_PREPARE:
3870
3871 dev_dbg(codec->dev, "set_bias_prepare\n");
3872
3873 break;
3874
3875 /* Off, with power */
3876 case SND_SOC_BIAS_STANDBY:
3877 /*
3878 * all power is driven by DAPM system,
3879 * so output power is safe if bypass was set
3880 */
3881 dev_dbg(codec->dev, "set_bias_stby\n");
3882
3883 break;
3884 /* Off, without power */
3885 case SND_SOC_BIAS_OFF:
3886 dev_dbg(codec->dev, "set_bias_off\n");
3887
3888 break;
3889 }
3890 codec->dapm.bias_level=level;
3891
3892 return 0;
3893}
3894
3895
3896/*
3897 *----------------------------------------------------------------------------
3898 * Function : aic3262_suspend
3899 * Purpose : This function is to suspend the AIC3262 driver.
3900 *
3901 *----------------------------------------------------------------------------
3902 */
3903static int aic3262_suspend(struct snd_soc_codec *codec, pm_message_t state)
3904{
3905 struct aic3262_priv *aic3262 = snd_soc_codec_get_drvdata(codec);
3906 DBG(KERN_INFO "#%s: Invoked..\n", __func__);
3907 if (aic3262)
3908 disable_irq(aic3262->irq);
3909
3910 aic3262_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
3911
3912 return 0;
3913}
3914
3915/*
3916 *----------------------------------------------------------------------------
3917 * Function : aic3262_resume
3918 * Purpose : This function is to resume the AIC3262 driver
3919 *
3920 *----------------------------------------------------------------------------
3921 */
3922static int aic3262_resume(struct snd_soc_codec *codec)
3923{
3924 int i;
3925 u8 data[2];
3926 int ret = 0;
3927 struct aic3262_priv *aic3262 = snd_soc_codec_get_drvdata(codec);
3928 u8 *cache = codec->reg_cache;
3929 DBG(KERN_INFO "#%s: Invoked..\n", __func__);
3930
3931 ret = aic3262_change_page(codec, 0);
3932 if (ret)
3933 return ret;
3934#if defined(EN_REG_CACHE)
3935 /* Sync reg_cache with the hardware */
3936 for (i = 0; i < ARRAY_SIZE(aic3262_reg); i++) {
3937 data[0] = i % 128;
3938 data[1] = cache[i];
3939#if defined(LOCAL_REG_ACCESS)
3940 codec->hw_write(codec->control_data, data, 2);
3941#else
3942 ret = snd_soc_write(codec, data[0], data[1]);
3943 if (ret)
3944 break;
3945#endif
3946 }
3947#endif
3948 if (!ret) {
3949 aic3262_change_page(codec, 0);
3950 aic3262_set_bias_level(codec, SND_SOC_BIAS_ON);
3951
3952 if (aic3262)
3953 enable_irq(aic3262->irq);
3954 }
3955 return ret;
3956}
3957/*
3958 *----------------------------------------------------------------------------
3959 * Function : aic3262_hw_read
3960 * Purpose : This is a low level harware read function.
3961 *
3962 *----------------------------------------------------------------------------
3963 */
3964unsigned int aic3262_hw_read(struct snd_soc_codec *codec, unsigned int count)
3965{
3966 struct i2c_client *client = codec->control_data;
3967 unsigned int buf;
3968
3969 if (count > (sizeof(unsigned int)))
3970 return 0;
3971
3972 i2c_master_recv(client, (char *)&buf, count);
3973 return buf;
3974}
3975
3976/*
3977* aic3262_jack_handler
3978*
3979* This function is called from the Interrupt Handler
3980* to check the status of the AIC3262 Registers related to Headset Detection
3981*/
3982static irqreturn_t aic3262_jack_handler(int irq, void *data)
3983{
3984 struct snd_soc_codec *codec = data;
3985 struct aic3262_priv *aic3262 = snd_soc_codec_get_drvdata(codec);
3986 unsigned int value;
3987 unsigned int micbits, hsbits = 0;
3988 DBG(KERN_INFO "%s++\n", __func__);
3989
3990 aic3262_change_page(codec, 0);
3991
3992 /* Read the Jack Status Register*/
3993 value = snd_soc_read(codec, STICKY_FLAG2);
3994 DBG(KERN_INFO "reg44 0x%x\n", value);
3995
3996
3997 value = snd_soc_read(codec, INT_FLAG2);
3998 DBG(KERN_INFO "reg46 0x%x\n", value);
3999
4000 value = snd_soc_read(codec, DAC_FLAG_R1);
4001 DBG(KERN_INFO "reg37 0x%x\n", value);
4002
4003 micbits = value & DAC_FLAG_MIC_MASKBITS;
4004 DBG(KERN_INFO "micbits 0x%x\n", micbits);
4005
4006 hsbits = value & DAC_FLAG_HS_MASKBITS;
4007 DBG(KERN_INFO "hsbits 0x%x\n", hsbits);
4008
4009
4010 /* No Headphone or Headset*/
4011 if (!micbits && !hsbits) {
4012 DBG(KERN_INFO "no headset/headphone\n");
4013 snd_soc_jack_report(aic3262->headset_jack,
4014 0, SND_JACK_HEADSET);
4015 }
4016
4017 /* Headphone Detected */
4018 if ((micbits == DAC_FLAG_R1_NOMIC) || (hsbits)) {
4019 DBG(KERN_INFO "headphone\n");
4020 snd_soc_jack_report(aic3262->headset_jack,
4021 SND_JACK_HEADPHONE, SND_JACK_HEADSET);
4022 }
4023
4024 /* Headset Detected - only with capless */
4025 if (micbits == DAC_FLAG_R1_MIC) {
4026 DBG(KERN_INFO "headset\n");
4027 snd_soc_jack_report(aic3262->headset_jack,
4028 SND_JACK_HEADSET, SND_JACK_HEADSET);
4029 }
4030 DBG(KERN_INFO "%s--\n", __func__);
4031 return IRQ_HANDLED;
4032}
4033
4034/*
4035* aic326x_headset_detect
4036*
4037* Call-back function called to check the status of Headset Pin.
4038*/
4039int aic326x_headset_detect(struct snd_soc_codec *codec,
4040 struct snd_soc_jack *jack, int jack_type)
4041{
4042 struct aic3262_priv *aic3262 = snd_soc_codec_get_drvdata(codec);
4043
4044 aic3262->headset_jack = jack;
4045 /*Enable the Headset Interrupts*/
4046 snd_soc_write(codec, INT1_CNTL, 0x80);
4047
4048 return 0;
4049}
4050EXPORT_SYMBOL_GPL(aic326x_headset_detect);
4051
4052int aic326x_headset_button_init(struct snd_soc_codec *codec,
4053 struct snd_soc_jack *jack, int jack_type)
4054{
4055 struct aic3262_priv *aic3262 = snd_soc_codec_get_drvdata(codec);
4056
4057 aic3262->button_dev = input_allocate_device();
4058 aic3262->button_dev->name = "aic326x_headset_button";
4059 aic3262->button_dev->phys = "codec/input0";
4060 aic3262->button_dev->dev.parent = snd_card_get_device_link(codec->card->snd_card);
4061 input_set_capability(aic3262->button_dev, EV_KEY, KEY_MEDIA);
4062
4063 if (input_register_device(aic3262->button_dev))
4064 {
4065 printk( "Unable to register input device headset button");
4066 }
4067
4068 aic3262_jack_handler(aic3262->irq, codec);
4069 return 0;
4070}
4071#ifdef AIC3262_MULTI_I2S
4072/*
4073* aic3262_asi_default_config
4074*
4075* This function is used to perform the default pin configurations for
4076* the functionalities which are specific to each ASI Port of the AIC3262
4077* Audio Codec Chipset. The user is encouraged to change these values
4078* if required on their platforms.
4079*/
4080static void aic3262_asi_default_config(struct snd_soc_codec *codec)
4081{
4082 struct aic3262_priv *aic3262 = snd_soc_codec_get_drvdata(codec);
4083 u16 counter;
4084
4085 DBG(KERN_INFO
4086 "#%s: Invoked. Will Config ASI Registers to Defaults..\n",
4087 __func__);
4088 for (counter = 0; counter < MAX_ASI_COUNT; counter++) {
4089 aic3262->asiCtxt[counter].asi_active = 0;
4090 aic3262->asiCtxt[counter].bclk_div = 1;
4091 aic3262->asiCtxt[counter].wclk_div = 1;
4092 aic3262->asiCtxt[counter].port_muted = 1;
4093 aic3262->asiCtxt[counter].bclk_div_option =
4094 BDIV_CLKIN_DAC_MOD_CLK;
4095 aic3262->asiCtxt[counter].offset1 = 0;
4096 aic3262->asiCtxt[counter].offset2 = 0;
4097 }
4098 /* ASI1 Defaults */
4099 aic3262->asiCtxt[0].bclk_output = ASI1_BCLK_DIVIDER_OUTPUT;
4100 aic3262->asiCtxt[0].wclk_output = GENERATED_DAC_FS;
4101 aic3262->asiCtxt[0].left_dac_output = DAC_PATH_LEFT;
4102 aic3262->asiCtxt[0].right_dac_output = DAC_PATH_LEFT;
4103 aic3262->asiCtxt[0].adc_input = ADC_PATH_MINIDSP_1;
4104 aic3262->asiCtxt[0].dout_option = ASI_OUTPUT;
4105
4106 /* ASI2 Defaults */
4107 aic3262->asiCtxt[1].bclk_output = ASI2_BCLK_DIVIDER_OUTPUT;
4108 aic3262->asiCtxt[1].wclk_output = GENERATED_DAC_FS;
4109 aic3262->asiCtxt[1].left_dac_output = DAC_PATH_LEFT;
4110 aic3262->asiCtxt[1].right_dac_output = DAC_PATH_LEFT;
4111 aic3262->asiCtxt[1].adc_input = ADC_PATH_MINIDSP_2;
4112 aic3262->asiCtxt[1].dout_option = ASI_OUTPUT;
4113
4114 /* ASI3 Defaults */
4115 aic3262->asiCtxt[2].bclk_output = ASI3_BCLK_DIVIDER_OUTPUT;
4116 aic3262->asiCtxt[2].wclk_output = GENERATED_DAC_FS;
4117 aic3262->asiCtxt[2].left_dac_output = DAC_PATH_LEFT;
4118 aic3262->asiCtxt[2].right_dac_output = DAC_PATH_LEFT;
4119 aic3262->asiCtxt[2].adc_input = ADC_PATH_MINIDSP_3;
4120 aic3262->asiCtxt[2].dout_option = ASI2_INPUT;
4121 return;
4122}
4123
4124#endif /* #ifdef AIC3262_MULTI_I2S */
4125
4126/*
4127 *----------------------------------------------------------------------------
4128 * Function : aic3262_probe
4129 * Purpose : This is first driver function called by the SoC core driver.
4130 *
4131 *----------------------------------------------------------------------------
4132 */
4133
4134static int aic3262_probe(struct snd_soc_codec *codec)
4135{
4136 struct aic3262_priv *aic3262 = snd_soc_codec_get_drvdata(codec);
4137 int ret = 0;
4138
4139 DBG(KERN_INFO "#%s: Invoked..\n", __func__);
4140
4141#if defined(EN_REG_CACHE)
4142 codec->reg_cache =
4143 kmemdup(aic3262_reg, sizeof(aic3262_reg), GFP_KERNEL);
4144
4145 if (!codec->reg_cache) {
4146 printk(KERN_ERR "aic3262: kmemdup failed\n");
4147 return -ENOMEM;
4148 }
4149#else
4150 /* Setting cache bypass - not to overwrite the cache registers,
4151 Codec registers have 4 pages which is not handled in the common
4152 cache code properly - bypass it in write value and save it
4153 using separate call*/
4154 codec->cache_bypass = 1;
4155#endif
4156
4157#if defined(LOCAL_REG_ACCESS)
4158 codec->control_data = aic3262->control_data;
4159 codec->hw_write = (hw_write_t) aic3262_write__;
4160 codec->hw_read = aic3262_hw_read;
4161#else
4162 ret = snd_soc_codec_set_cache_io(codec, 8, 8, SND_SOC_I2C);
4163 if (ret != 0) {
4164 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
4165 return ret;
4166 }
4167#endif
4168 ret = reg_def_conf(codec);
4169 if (ret != 0) {
4170 printk(KERN_ERR "Failed to init TI codec: %d\n", ret);
4171 return ret;
4172 }
4173
4174 if (aic3262->irq) {
4175 /* audio interrupt */
4176 ret = request_threaded_irq(aic3262->irq, NULL,
4177 aic3262_jack_handler,
4178 IRQF_TRIGGER_FALLING,
4179 "tlv320aic3262", codec);
4180 if (ret) {
4181 printk(KERN_INFO "#%s: IRQ Registration failed..[%d]",
4182 __func__, ret);
4183 dev_err(codec->dev, "Failed to request IRQ: %d\n", ret);
4184 return ret;
4185 } else
4186 DBG(KERN_INFO
4187 "#%s: irq Registration for IRQ %d done..\n",
4188 __func__, aic3262->irq);
4189 } else {
4190 DBG(KERN_INFO "#%s: I2C IRQ Configuration is Wrong. \
4191 Please check it..\n", __func__);
4192 }
4193
4194 aic3262_asi_default_config(codec);
4195
4196 /* off, with power on */
4197 aic3262_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
4198
4199 ret = snd_soc_add_controls(codec, aic3262_snd_controls,
4200 ARRAY_SIZE(aic3262_snd_controls));
4201 if(ret)
4202 {
4203 printk(KERN_INFO "%s failed\n", __func__);
4204 }
4205
4206 aic3262_add_widgets(codec);
4207 /*TODO*/
4208 snd_soc_write(codec, MIC_BIAS_CNTL, 0x66);
4209
4210#ifdef AIC3262_TiLoad
4211 ret = aic3262_driver_init(codec);
4212 if (ret < 0)
4213 printk(KERN_ERR
4214 "\nAIC3262 CODEC: aic3262_probe :TiLoad Initialization failed\n");
4215#endif
4216
4217
4218#ifdef CONFIG_MINI_DSP
4219 /* Program MINI DSP for ADC and DAC */
4220 aic3262_minidsp_program(codec);
4221 aic3262_add_minidsp_controls(codec);
4222 aic3262_change_book(codec, 0x0);
4223#endif
4224
4225#ifdef MULTIBYTE_CONFIG_SUPPORT
4226 aic3262_add_multiconfig_controls(codec);
4227#endif
4228
4229 DBG(KERN_INFO "#%s: done..\n", __func__);
4230 return ret;
4231}
4232
4233
4234
4235/*
4236 *----------------------------------------------------------------------------
4237 * Function : aic3262_remove
4238 * Purpose : to remove aic3262 soc device
4239 *
4240 *----------------------------------------------------------------------------
4241 */
4242static int aic3262_remove(struct snd_soc_codec *codec)
4243{
4244
4245 /* power down chip */
4246 aic3262_set_bias_level(codec, SND_SOC_BIAS_OFF);
4247
4248 return 0;
4249}
4250
4251
4252/*
4253 *----------------------------------------------------------------------------
4254 * @struct snd_soc_codec_device |
4255 * This structure is soc audio codec device sturecute which pointer
4256 * to basic functions aic3262_probe(), aic3262_remove(),
4257 * aic3262_suspend() and aic3262_resume()
4258 *----------------------------------------------------------------------------
4259 */
4260static struct snd_soc_codec_driver soc_codec_dev_aic3262 = {
4261 .probe = aic3262_probe,
4262 .remove = aic3262_remove,
4263 .suspend = aic3262_suspend,
4264 .resume = aic3262_resume,
4265 .set_bias_level = aic3262_set_bias_level,
4266#if defined(LOCAL_REG_ACCESS)
4267 .read = aic3262_read,
4268 .write = aic3262_write,
4269#endif
4270#if !defined(EN_REG_CACHE)
4271 .reg_cache_size = ARRAY_SIZE(aic3262_reg),
4272 .reg_word_size = sizeof(u8),
4273 .reg_cache_default = aic3262_reg,
4274#endif
4275};
4276
4277
4278#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
4279/*
4280 *----------------------------------------------------------------------------
4281 * Function : aic3262_codec_probe
4282 * Purpose : This function attaches the i2c client and initializes
4283 * AIC3262 CODEC.
4284 * NOTE:
4285 * This function is called from i2c core when the I2C address is
4286 * valid.
4287 * If the i2c layer weren't so broken, we could pass this kind of
4288 * data around
4289 *
4290 *----------------------------------------------------------------------------
4291 */
4292static __devinit int aic3262_codec_probe(struct i2c_client *i2c,
4293 const struct i2c_device_id *id)
4294{
4295 int ret;
4296
4297 struct aic3262_priv *aic3262;
4298
4299 DBG(KERN_INFO "#%s: Entered\n", __func__);
4300
4301 aic3262 = kzalloc(sizeof(struct aic3262_priv), GFP_KERNEL);
4302
4303 if (!aic3262) {
4304 printk(KERN_ERR "#%s: Unable to Allocate Priv struct..\n",
4305 __func__);
4306 return -ENOMEM;
4307 }
4308
4309 i2c_set_clientdata(i2c, aic3262);
4310#if defined(LOCAL_REG_ACCESS)
4311 aic3262->control_data = i2c;
4312#endif
4313 aic3262->control_type = SND_SOC_I2C;
4314 aic3262->irq = i2c->irq;
4315 aic3262->pdata = i2c->dev.platform_data;
4316
4317 /* The Configuration Support will be by default to 3 which
4318 * holds the MAIN Patch Configuration.
4319 */
4320 aic3262->current_dac_config[0] = -1;
4321 aic3262->current_dac_config[1] = -1;
4322 aic3262->current_adc_config[0] = -1;
4323 aic3262->current_adc_config[1] = -1;
4324
4325 aic3262->mute_codec = 1;
4326
4327 aic3262->page_no = 0;
4328 aic3262->book_no = 0;
4329 aic3262->active_count = 0;
4330 aic3262->dac_clkin_option = 3;
4331 aic3262->adc_clkin_option = 3;
4332
4333 ret = snd_soc_register_codec(&i2c->dev,
4334 &soc_codec_dev_aic3262,
4335 tlv320aic3262_dai, ARRAY_SIZE(tlv320aic3262_dai));
4336
4337 if (ret < 0)
4338 kfree(aic3262);
4339 DBG(KERN_INFO "#%s: Done ret %d\n", __func__, ret);
4340 return ret;
4341}
4342
4343/*
4344 *----------------------------------------------------------------------------
4345 * Function : aic3262_i2c_remove
4346 * Purpose : This function removes the i2c client and uninitializes
4347 * AIC3262 CODEC.
4348 * NOTE:
4349 * This function is called from i2c core
4350 * If the i2c layer weren't so broken, we could pass this kind of
4351 * data around
4352 *
4353 *----------------------------------------------------------------------------
4354 */
4355static __devexit int aic3262_i2c_remove(struct i2c_client *i2c)
4356{
4357 snd_soc_unregister_codec(&i2c->dev);
4358 kfree(i2c_get_clientdata(i2c));
4359 return 0;
4360}
4361
4362static const struct i2c_device_id tlv320aic3262_id[] = {
4363 {"aic3262-codec", 0},
4364 {}
4365};
4366MODULE_DEVICE_TABLE(i2c, tlv320aic3262_id);
4367
4368static struct i2c_driver tlv320aic3262_i2c_driver = {
4369 .driver = {
4370 .name = "aic3262-codec",
4371 .owner = THIS_MODULE,
4372 },
4373 .probe = aic3262_codec_probe,
4374 .remove = __devexit_p(aic3262_i2c_remove),
4375 .id_table = tlv320aic3262_id,
4376};
4377#endif /*#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)*/
4378
4379#if defined(CONFIG_SPI_MASTER)
4380static int aic3262_spi_write(struct spi_device *spi, const char *data, int len)
4381{
4382 struct spi_transfer t;
4383 struct spi_message m;
4384 u8 msg[2];
4385
4386 if (len <= 0)
4387 return 0;
4388
4389 msg[0] = data[0];
4390 msg[1] = data[1];
4391
4392 spi_message_init(&m);
4393 memset(&t, 0, (sizeof t));
4394 t.tx_buf = &msg[0];
4395 t.len = len;
4396
4397 spi_message_add_tail(&t, &m);
4398 spi_sync(spi, &m);
4399
4400 return len;
4401}
4402
4403/*
4404 * This function forces any delayed work to be queued and run.
4405 */
4406static int run_delayed_work(struct delayed_work *dwork)
4407{
4408 int ret;
4409
4410 /* cancel any work waiting to be queued. */
4411 ret = cancel_delayed_work(dwork);
4412
4413 /* if there was any work waiting then we run it now and
4414 * wait for it's completion */
4415 if (ret) {
4416 schedule_delayed_work(dwork, 0);
4417 flush_scheduled_work();
4418 }
4419 return ret;
4420}
4421static int __devinit aic3262_spi_probe(struct spi_device *spi)
4422{
4423 int ret;
4424 struct snd_soc_codec *codec;
4425 struct aic3262_priv *aic3262;
4426 printk(KERN_INFO "%s entering\n",__func__);
4427 aic3262 = kzalloc(sizeof(struct aic3262_priv), GFP_KERNEL);
4428
4429 if (!aic3262) {
4430 printk(KERN_ERR "#%s: Unable to Allocate Priv struct..\n",
4431 __func__);
4432 return -ENOMEM;
4433 }
4434 codec = &aic3262->codec;
4435 codec->control_data = spi;
4436 aic3262->control_type = SND_SOC_SPI;
4437 codec->hw_write = (hw_write_t)aic3262_spi_write;
4438 codec->dev = &spi->dev;
4439
4440 aic3262->pdata = spi->dev.platform_data;
4441
4442 /* The Configuration Support will be by default to 3 which
4443 * holds the MAIN Patch Configuration.
4444 */
4445 aic3262->current_dac_config[0] = -1;
4446 aic3262->current_dac_config[1] = -1;
4447 aic3262->current_adc_config[0] = -1;
4448 aic3262->current_adc_config[1] = -1;
4449
4450 aic3262->mute_codec = 1;
4451
4452 aic3262->page_no = 0;
4453 aic3262->book_no = 0;
4454 aic3262->active_count = 0;
4455 aic3262->dac_clkin_option = 3;
4456 aic3262->adc_clkin_option = 3;
4457 dev_set_drvdata(&spi->dev, aic3262);
4458 spi_set_drvdata(spi, aic3262);
4459 ret = snd_soc_register_codec(&spi->dev,
4460 &soc_codec_dev_aic3262,
4461 tlv320aic3262_dai, ARRAY_SIZE(tlv320aic3262_dai));
4462
4463 if (ret < 0) {
4464 printk(KERN_INFO "%s codec registeration failed\n",__func__);
4465 kfree(aic3262);
4466 }
4467 else {
4468 printk(KERN_INFO "%s registered\n",__func__);
4469 }
4470 printk(KERN_INFO "#%s: Done ret %d\n", __func__, ret);
4471 return ret;
4472}
4473
4474static int __devexit aic3262_spi_remove(struct spi_device *spi)
4475{
4476 struct aic3262_priv *aic3262 = dev_get_drvdata(&spi->dev);
4477 aic3262_set_bias_level(&aic3262->codec, SND_SOC_BIAS_OFF);
4478 snd_soc_unregister_codec(&spi->dev);
4479 kfree(aic3262);
4480 aic3262_codec = NULL;
4481 return 0;
4482
4483}
4484
4485static struct spi_driver aic3262_spi_driver = {
4486 .driver = {
4487 .name = "aic3262-codec",
4488 .bus = &spi_bus_type,
4489 .owner = THIS_MODULE,
4490 },
4491 .probe = aic3262_spi_probe,
4492 .remove = __devexit_p(aic3262_spi_remove),
4493};
4494#endif
4495static int __init tlv320aic3262_modinit(void)
4496{
4497 int ret = 0;
4498 printk(KERN_INFO "In %s\n",__func__);
4499#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
4500 ret = i2c_add_driver(&tlv320aic3262_i2c_driver);
4501 if (ret != 0)
4502 printk(KERN_ERR "Failed to register aic326x i2c driver %d\n",
4503 ret);
4504#endif
4505#if defined(CONFIG_SPI_MASTER)
4506 printk(KERN_INFO "Inside config_spi_master\n");
4507 ret = spi_register_driver(&aic3262_spi_driver);
4508 if (ret != 0)
4509 printk(KERN_ERR "Failed to register aic3262 SPI driver: %d\n", ret);
4510#endif
4511 return ret;
4512
4513}
4514
4515module_init(tlv320aic3262_modinit);
4516
4517static void __exit tlv320aic3262_exit(void)
4518{
4519#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
4520 i2c_del_driver(&tlv320aic3262_i2c_driver);
4521#endif
4522}
4523module_exit(tlv320aic3262_exit);
4524
4525MODULE_DESCRIPTION("ASoC TLV320AIC3262 codec driver");
4526MODULE_AUTHOR("Barani Prashanth<gvbarani@mistralsolutions.com>");
4527MODULE_AUTHOR("Ravindra<ravindra@mistralsolutions.com>");
4528MODULE_LICENSE("GPL");
diff --git a/sound/soc/codecs/tlv320aic326x.h b/sound/soc/codecs/tlv320aic326x.h
new file mode 100644
index 00000000000..a31cc9eca5c
--- /dev/null
+++ b/sound/soc/codecs/tlv320aic326x.h
@@ -0,0 +1,684 @@
1/*
2 * linux/sound/soc/codecs/tlv320aic3262.h
3 *
4 *
5 * Copyright (C) 2012 Texas Instruments, Inc.
6 *
7 * This package is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
12 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
13 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
14 *
15 * History:
16 * Rev 0.1 ASoC driver support 20-01-2011
17 *
18 * The AIC3262 ASoC driver is ported for the codec AIC3262.
19 *
20 */
21
22#ifndef _TLV320AIC3262_H
23#define _TLV320AIC3262_H
24#include <linux/input.h>
25#define AUDIO_NAME "aic3262"
26#define AIC3262_VERSION "1.1"
27
28//#define AIC3262_ASI2_MASTER 1
29
30/* Enable this macro allow for different ASI formats */
31/*#define ASI_MULTI_FMT*/
32#undef ASI_MULTI_FMT
33
34#define INT_FLAG2_BUTTN_PRESSBIT 0x20
35
36/* Enable register caching on write */
37#define EN_REG_CACHE 1
38
39#define MULTIBYTE_CONFIG_SUPPORT
40
41/*Setting all codec reg/write locally*/
42/* This definition is added as the snd_ direct call are
43result some issue with cache. Common code doesnot support
44page, so fix that before commenting this line*/
45#define LOCAL_REG_ACCESS 1
46
47/* Macro to enable the inclusion of tiload kernel driver */
48#define AIC3262_TiLoad
49
50
51/* Macro enables or disables support for miniDSP in the driver */
52/* Enable the AIC3262_TiLoad macro first before enabling these macros */
53#define CONFIG_MINI_DSP
54/*#undef CONFIG_MINI_DSP*/
55
56/* Enable or disable controls to have Input routing*/
57/*#define FULL_IN_CNTL */
58#undef FULL_IN_CNTL
59/* AIC3262 supported sample rate are 8k to 192k */
60#define AIC3262_RATES SNDRV_PCM_RATE_8000_192000
61
62/* AIC3262 supports the word formats 16bits, 20bits, 24bits and 32 bits */
63#define AIC3262_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE \
64 | SNDRV_PCM_FMTBIT_S24_3LE | SNDRV_PCM_FMTBIT_S32_LE)
65
66#define AIC3262_FREQ_12000000 12000000
67#define AIC3262_FREQ_12288000 12288000
68#define AIC3262_FREQ_24000000 24000000
69
70/* Macro for enabling the Multi_I2S Support in Driver */
71#define AIC3262_MULTI_I2S 1
72
73/* Driver Debug Messages Enabled */
74//#define DEBUG
75
76#ifdef DEBUG
77 #define DBG(x...) printk(x)
78#else
79 #define DBG(x...)
80#endif
81
82/*Select the below macro to decide on the DAC master volume controls.
83 *2 independent or one combined
84 */
85/*#define DAC_INDEPENDENT_VOL*/
86#undef DAC_INDEPENDENT_VOL
87
88/* Audio data word length = 16-bits (default setting) */
89#define AIC3262_WORD_LEN_16BITS 0x00
90#define AIC3262_WORD_LEN_20BITS 0x01
91#define AIC3262_WORD_LEN_24BITS 0x02
92#define AIC3262_WORD_LEN_32BITS 0x03
93
94/* sink: name of target widget */
95#define AIC3262_WIDGET_NAME 0
96/* control: mixer control name */
97#define AIC3262_CONTROL_NAME
98/* source: name of source name */
99#define AIC3262_SOURCE_NAME 2
100
101/* D15..D8 aic3262 register offset */
102#define AIC3262_REG_OFFSET_INDEX 0
103/* D7...D0 register data */
104#define AIC3262_REG_DATA_INDEX 1
105
106/* Serial data bus uses I2S mode (Default mode) */
107#define AIC3262_I2S_MODE 0x00
108#define AIC3262_DSP_MODE 0x01
109#define AIC3262_RIGHT_JUSTIFIED_MODE 0x02
110#define AIC3262_LEFT_JUSTIFIED_MODE 0x03
111
112/* 8 bit mask value */
113#define AIC3262_8BITS_MASK 0xFF
114
115/* shift value for CLK_REG_3 register */
116#define CLK_REG_3_SHIFT 6
117/* shift value for DAC_OSR_MSB register */
118#define DAC_OSR_MSB_SHIFT 4
119
120/* number of codec specific register for configuration */
121#define NO_FEATURE_REGS 2
122
123/* Total number of ASI Ports */
124#define MAX_ASI_COUNT 3
125
126
127/* AIC3262 register space */
128/* Updated from 256 to support Page 3 registers */
129#define AIC3262_CACHEREGNUM 1024
130#define BIT7 (0x01 << 7)
131#define BIT6 (0x01 << 6)
132#define BIT5 (0x01 << 5)
133#define BIT4 (0x01 << 4)
134#define BIT3 (0x01 << 3)
135#define BIT2 (0x01 << 2)
136#define BIT1 (0x01 << 1)
137#define BIT0 (0x01 << 0)
138
139#define DAC_FLAG_MIC_MASKBITS 0x30
140#define DAC_FLAG_HS_MASKBITS 0x03
141#define DAC_FLAG_R1_NOJACK 0
142#define DAC_FLAG_R1_NOMIC (0x1 << 4)
143#define DAC_FLAG_R1_MIC (0x3 << 4)
144#define DAC_FLAG_R1_NOHS 0
145#define DAC_FLAG_R1_MONOHS 1
146#define DAC_FLAG_R1_STEREOHS 2
147
148/*mask patterns for DAC and ADC polling logic*/
149#define LDAC_POW_FLAG_MASK 0x80
150#define RDAC_POW_FLAG_MASK 0x08
151#define LADC_POW_FLAG_MASK 0x40
152#define RADC_POW_FLAG_MASK 0x04
153
154/* ****************** Book 0 Registers **************************************/
155
156/* ****************** Page 0 Registers **************************************/
157
158#define PAGE_SEL_REG 0
159#define RESET_REG 1
160#define DAC_ADC_CLKIN_REG 4
161#define PLL_CLKIN_REG 5
162#define PLL_CLK_RANGE_REG 5
163#define PLL_PR_POW_REG 6
164#define PLL_J_REG 7
165#define PLL_D_MSB 8
166#define PLL_D_LSB 9
167#define PLL_CKIN_DIV 10
168
169#define NDAC_DIV_POW_REG 11
170#define MDAC_DIV_POW_REG 12
171#define DOSR_MSB_REG 13
172#define DOSR_LSB_REG 14
173
174#define NADC_DIV_POW_REG 18
175#define MADC_DIV_POW_REG 19
176#define AOSR_REG 20
177#define CLKOUT_MUX 21
178#define CLKOUT_MDIV_VAL 22
179#define TIMER_REG 23
180
181#define LF_CLK_CNTL 24
182#define HF_CLK_CNTL_R1 25
183#define HF_CLK_CNTL_R2 26
184#define HF_CLK_CNTL_R3 27
185#define HF_CLK_CNTL_R4 28
186#define HF_CLK_TRIM_R1 29
187#define HF_CLK_TRIM_R2 30
188#define HF_CLK_TRIM_R3 31
189#define HF_CLK_TRIM_R4 32
190#define ADC_FLAG_R1 36
191#define DAC_FLAG_R1 37
192#define DAC_FLAG_R2 38
193
194#define STICKY_FLAG1 42
195#define INT_FLAG1 43
196#define STICKY_FLAG2 44
197#define STICKY_FLAG3 45
198#define INT_FLAG2 46
199#define INT1_CNTL 48
200#define INT2_CNTL 49
201#define INT_FMT 51
202
203#define DAC_PRB 60
204#define ADC_PRB 61
205#define PASI_DAC_DP_SETUP 63
206#define DAC_MVOL_CONF 64
207#define DAC_LVOL 65
208#define DAC_RVOL 66
209#define HP_DETECT 67
210#define DRC_CNTL_R1 68
211#define DRC_CNTL_R2 69
212#define DRC_CNTL_R3 70
213#define BEEP_CNTL_R1 71
214#define BEEP_CNTL_R2 72
215
216#define ADC_CHANNEL_POW 81
217#define ADC_FINE_GAIN 82
218#define LADC_VOL 83
219#define RADC_VOL 84
220#define ADC_PHASE 85
221
222#define LAGC_CNTL 86
223#define LAGC_CNTL_R2 87
224#define LAGC_CNTL_R3 88
225#define LAGC_CNTL_R4 89
226#define LAGC_CNTL_R5 90
227#define LAGC_CNTL_R6 91
228#define LAGC_CNTL_R7 92
229#define LAGC_CNTL_R8 93
230
231#define RAGC_CNTL 94
232#define RAGC_CNTL_R2 95
233#define RAGC_CNTL_R3 96
234#define RAGC_CNTL_R4 97
235#define RAGC_CNTL_R5 98
236#define RAGC_CNTL_R6 99
237#define RAGC_CNTL_R7 100
238#define RAGC_CNTL_R8 101
239#define MINIDSP_ACCESS_CTRL 121
240/* ****************** Page 1 Registers **************************************/
241#define PAGE_1 128
242
243#define POWER_CONF (PAGE_1 + 1)
244#define LDAC_PTM (PAGE_1 + 3)
245#define RDAC_PTM (PAGE_1 + 4)
246#define CM_REG (PAGE_1 + 8)
247#define HP_CTL (PAGE_1 + 9)
248#define HP_DEPOP (PAGE_1 + 11)
249#define RECV_DEPOP (PAGE_1 + 12)
250#define MA_CNTL (PAGE_1 + 17)
251#define LADC_PGA_MAL_VOL (PAGE_1 + 18)
252#define RADC_PGA_MAR_VOL (PAGE_1 + 19)
253
254
255#define LINE_AMP_CNTL_R1 (PAGE_1 + 22)
256#define LINE_AMP_CNTL_R2 (PAGE_1 + 23)
257
258#define HP_AMP_CNTL_R1 (PAGE_1 + 27)
259#define HP_AMP_CNTL_R2 (PAGE_1 + 28)
260#define HP_AMP_CNTL_R3 (PAGE_1 + 29)
261
262#define HPL_VOL (PAGE_1 + 31)
263#define HPR_VOL (PAGE_1 + 32)
264#define INT1_SEL_L (PAGE_1 + 34)
265#define RAMP_CNTL_R1 (PAGE_1 + 36)
266#define RAMP_CNTL_R2 (PAGE_1 + 37)
267//#define INT1_SEL_RM (PAGE_1 + 39)
268#define IN1L_SEL_RM (PAGE_1 + 39)
269#define IN1R_SEL_RM (PAGE_1 + 39)
270
271#define REC_AMP_CNTL_R5 (PAGE_1 + 40)
272#define RAMPR_VOL (PAGE_1 + 41)
273#define RAMP_TIME_CNTL (PAGE_1 + 42)
274#define SPK_AMP_CNTL_R1 (PAGE_1 + 45)
275#define SPK_AMP_CNTL_R2 (PAGE_1 + 46)
276#define SPK_AMP_CNTL_R3 (PAGE_1 + 47)
277#define SPK_AMP_CNTL_R4 (PAGE_1 + 48)
278#define MIC_BIAS_CNTL (PAGE_1 + 51)
279
280#define LMIC_PGA_PIN (PAGE_1 + 52)
281#define LMIC_PGA_PM_IN4 (PAGE_1 + 53)
282#define LMIC_PGA_MIN (PAGE_1 + 54)
283#define RMIC_PGA_PIN (PAGE_1 + 55)
284#define RMIC_PGA_PM_IN4 (PAGE_1 + 56)
285#define RMIC_PGA_MIN (PAGE_1 + 57)
286/* MIC PGA Gain Registers */
287#define MICL_PGA (PAGE_1 + 59)
288#define MICR_PGA (PAGE_1 + 60)
289#define HEADSET_TUNING1_REG (PAGE_1 + 119)
290#define HEADSET_TUNING2_REG (PAGE_1 + 120)
291#define MIC_PWR_DLY (PAGE_1 + 121)
292#define REF_PWR_DLY (PAGE_1 + 122)
293
294/* ****************** Page 4 Registers **************************************/
295#define PAGE_4 512
296#define ASI1_BUS_FMT (PAGE_4 + 1)
297#define ASI1_LCH_OFFSET (PAGE_4 + 2)
298#define ASI1_RCH_OFFSET (PAGE_4 + 3)
299#define ASI1_CHNL_SETUP (PAGE_4 + 4)
300#define ASI1_MULTI_CH_SETUP_R1 (PAGE_4 + 5)
301#define ASI1_MULTI_CH_SETUP_R2 (PAGE_4 + 6)
302#define ASI1_ADC_INPUT_CNTL (PAGE_4 + 7)
303#define ASI1_DAC_OUT_CNTL (PAGE_4 + 8)
304#define ASI1_ADC_OUT_TRISTATE (PAGE_4 + 9)
305#define ASI1_BWCLK_CNTL_REG (PAGE_4 + 10)
306#define ASI1_BCLK_N_CNTL (PAGE_4 + 11)
307#define ASI1_BCLK_N (PAGE_4 + 12)
308#define ASI1_WCLK_N (PAGE_4 + 13)
309#define ASI1_BWCLK_OUT_CNTL (PAGE_4 + 14)
310#define ASI1_DATA_OUT (PAGE_4 + 15)
311#define ASI2_BUS_FMT (PAGE_4 + 17)
312#define ASI2_LCH_OFFSET (PAGE_4 + 18)
313#define ASI2_RCH_OFFSET (PAGE_4 + 19)
314#define ASI2_ADC_INPUT_CNTL (PAGE_4 + 23)
315#define ASI2_DAC_OUT_CNTL (PAGE_4 + 24)
316#define ASI2_BWCLK_CNTL_REG (PAGE_4 + 26)
317#define ASI2_BCLK_N_CNTL (PAGE_4 + 27)
318#define ASI2_BCLK_N (PAGE_4 + 28)
319#define ASI2_WCLK_N (PAGE_4 + 29)
320#define ASI2_BWCLK_OUT_CNTL (PAGE_4 + 30)
321#define ASI2_DATA_OUT (PAGE_4 + 31)
322#define ASI3_BUS_FMT (PAGE_4 + 33)
323#define ASI3_LCH_OFFSET (PAGE_4 + 34)
324#define ASI3_RCH_OFFSET (PAGE_4 + 35)
325#define ASI3_ADC_INPUT_CNTL (PAGE_4 + 39)
326#define ASI3_DAC_OUT_CNTL (PAGE_4 + 40)
327#define ASI3_BWCLK_CNTL_REG (PAGE_4 + 42)
328#define ASI3_BCLK_N_CNTL (PAGE_4 + 43)
329#define ASI3_BCLK_N (PAGE_4 + 44)
330#define ASI3_WCLK_N (PAGE_4 + 45)
331#define ASI3_BWCLK_OUT_CNTL (PAGE_4 + 46)
332#define ASI3_DATA_OUT (PAGE_4 + 47)
333#define WCLK1_PIN_CNTL_REG (PAGE_4 + 65)
334#define DOUT1_PIN_CNTL_REG (PAGE_4 + 67)
335#define DIN1_PIN_CNTL_REG (PAGE_4 + 68)
336#define WCLK2_PIN_CNTL_REG (PAGE_4 + 69)
337#define BCLK2_PIN_CNTL_REG (PAGE_4 + 70)
338#define DOUT2_PIN_CNTL_REG (PAGE_4 + 71)
339#define DIN2_PIN_CNTL_REG (PAGE_4 + 72)
340#define WCLK3_PIN_CNTL_REG (PAGE_4 + 73)
341#define BCLK3_PIN_CNTL_REG (PAGE_4 + 74)
342#define DOUT3_PIN_CNTL_REG (PAGE_4 + 75)
343#define DIN3_PIN_CNTL_REG (PAGE_4 + 76)
344#define MCLK2_PIN_CNTL_REG (PAGE_4 + 82)
345#define GPIO1_IO_CNTL (PAGE_4 + 86)
346#define GPIO2_IO_CNTL (PAGE_4 + 87)
347#define GPI1_EN (PAGE_4 + 91)
348#define GPO2_EN (PAGE_4 + 92)
349#define GPO1_PIN_CNTL (PAGE_4 + 96)
350#define MINIDSP_PORT_CNTL_REG (PAGE_4 + 118)
351
352/****************************************************************************
353* Mixer control related #defines
354***************************************************************************
355*/
356#define WCLK1_ENUM 0
357#define DOUT1_ENUM 1
358#define DIN1_ENUM 2
359#define WCLK2_ENUM 3
360#define BCLK2_ENUM 4
361#define DOUT2_ENUM 5
362#define DIN2_ENUM 6
363#define WCLK3_ENUM 7
364#define BCLK3_ENUM 8
365#define DOUT3_ENUM 9
366#define DIN3_ENUM 10
367#define CLKIN_ENUM 11
368/*
369*****************************************************************************
370* Enumeration Definitions
371*****************************************************************************
372*/
373/* The below enumeration lists down all the possible inputs to the
374* the PLL of the AIC3262. The Private structure will hold a member
375* of this Enumeration Type.
376*/
377enum AIC3262_PLL_OPTION {
378 PLL_CLKIN_MCLK1 = 0, /* 0000: (Device Pin) */
379 PLL_CLKIN_BLKC1, /* 0001: (Device Pin) */
380 PLL_CLKIN_GPIO1, /* 0010: (Device Pin)*/
381 PLL_CLKIN_DIN1, /* 0011: (Device Pin)*/
382 PLL_CLKIN_BCLK2, /* 0100: (Device Pin)*/
383 PLL_CLKIN_GPI1, /* 0101: (Device Pin)*/
384 PLL_CLKIN_HF_REF_CLK, /* 0110: (Device Pin)*/
385 PLL_CLKIN_GPIO2, /* 0111: (Device Pin)*/
386 PLL_CLKIN_GPI2, /* 1000: (Device Pin)*/
387 PLL_CLKIN_MCLK2 /* 1001: (Device Pin)*/
388};
389
390/* ASI Specific Bit Clock Divider Input Options.
391* Please refer to Page 4 Reg 11, Reg 27 and Reg 43
392*/
393enum ASI_BDIV_CLKIN_OPTION {
394 BDIV_CLKIN_DAC_CLK = 0, /* 00 DAC_CLK */
395 BDIV_CLKIN_DAC_MOD_CLK, /* 01 DAC_MOD_CLK */
396 BDIV_CLKIN_ADC_CLK, /* 02 ADC_CLK */
397 BDIV_CLKIN_ADC_MOD_CLK /* 03 ADC_MOD_CLK */
398};
399
400/* ASI Specific Bit Clock Output Mux Options.
401* Please refer to Page 4 Reg 14, Reg 30 and Reg 46
402* Please note that we are not handling the Reserved
403* cases here.
404*/
405enum ASI_BCLK_OPTION {
406 ASI1_BCLK_DIVIDER_OUTPUT = 0, /* 00 ASI1 Bit Clock Divider Output */
407 ASI1_BCLK_INPUT, /* 01 ASI1 Bit Clock Input */
408 ASI2_BCLK_DIVIDER_OUTPUT, /* 02 ASI2 Bit Clock Divider Output */
409 ASI2_BCLK_INPUT, /* 03 ASI2 Bit Clock Input */
410 ASI3_BCLK_DIVIDER_OUTPUT, /* 04 ASI3 Bit Clock Divider Output */
411 ASI3_BBCLK_INPUT /* 05 ASi3 Bit Clock Input */
412};
413
414/* Above bits are to be configured after Shifting 4 bits */
415#define AIC3262_ASI_BCLK_MUX_SHIFT 4
416#define AIC3262_ASI_BCLK_MUX_MASK (BIT6 | BIT5 | BIT4)
417#define AIC3262_ASI_WCLK_MUX_MASK (BIT2 | BIT1 | BIT0)
418
419/* ASI Specific Word Clock Output Mux Options */
420enum ASI_WCLK_OPTION {
421 GENERATED_DAC_FS = 0, /* 00 WCLK = DAC_FS */
422 GENERATED_ADC_FS = 1, /* 01 WCLK = ADC_FS */
423 ASI1_WCLK_DIV_OUTPUT = 2, /* 02 WCLK = ASI1 WCLK_DIV_OUT */
424 ASI1_WCLK_INPUT = 3, /* 03 WCLK = ASI1 WCLK Input */
425 ASI2_WCLK_DIV_OUTPUT = 4, /* 04 WCLK = ASI2 WCLK_DIV_OUT */
426 ASI2_WCLK_INPUT = 5, /* 05 WCLK = ASI2 WCLK Input */
427 ASI3_WCLK_DIV_OUTPUT = 6, /* 06 WCLK = ASI3 WCLK_DIV_OUT */
428 ASI3_WCLK_INPUT = 7 /* 07 WCLK = ASI3 WCLK Input */
429};
430
431/* ASI DAC Output Control Options */
432enum ASI_DAC_OUTPUT_OPTION {
433 DAC_PATH_OFF = 0, /* 00 DAC Datapath Off */
434 DAC_PATH_LEFT, /* 01 DAC Datapath left Data */
435 DAC_PATH_RIGHT, /* 02 DAC Datapath Right Data */
436};
437
438#define AIC3262_READ_COMMAND_WORD(addr) ((1 << 15) | (addr << 5))
439#define AIC3262_WRITE_COMMAND_WORD(addr) ((0 << 15) | (addr << 5))
440
441/* Shift the above options by so many bits */
442#define AIC3262_ASI_LDAC_PATH_SHIFT 6
443#define AIC3262_ASI_LDAC_PATH_MASK (BIT5 | BIT4)
444#define AIC3262_ASI_RDAC_PATH_SHIFT 4
445#define AIC3262_ASI_RDAC_PATH_MASK (BIT7 | BIT6)
446
447
448#define DAC_LR_MUTE_MASK 0xc
449#define DAC_LR_MUTE 0xc
450#define ENABLE_CLK_MASK 0x80
451#define ENABLE_CLK 0x80
452
453/* ASI specific ADC Input Control Options */
454enum ASI_ADC_INPUT_OPTION {
455 ADC_PATH_OFF = 0, /* 00 ASI Digital Output Disabled */
456 ADC_PATH_MINIDSP_1, /* 01 ASI Digital O/P from miniDSP_A(L1,R1) */
457 ADC_PATH_ASI1, /* 02 ASI Digital Output from ASI1 */
458 ADC_PATH_ASI2, /* 03 ASI Digital Output from ASI2 */
459 ADC_PATH_ASI3, /* 04 ASI Digital Output from ASI3 */
460 ADC_PATH_MINIDSP_2, /* 05 ASI Digital O/P from miniDSP_A(L2,R2) */
461 ADC_PATH_MINIDSP_3 /* 05 ASI Digital O/P from miniDSP_A(L3,R3) */
462};
463
464/* ASI Specific DOUT Pin Options */
465enum ASI_DOUT_OPTION {
466 ASI_OUTPUT = 0, /* 00 Default ASI Output */
467 ASI1_INPUT, /* 01 ASI1 Data Input */
468 ASI2_INPUT, /* 02 ASI2 Data Input */
469 ASI3_INPUT /* 03 ASI3 Data Input */
470};
471
472#define AIC3262_ASI_DOUT_MASK (BIT1 | BIT0)
473
474/*
475 *****************************************************************************
476 * Structures Definitions
477 *****************************************************************************
478 */
479#define AIC3262_MULTI_ASI_ACTIVE(x) (((x)->asiCtxt[0].asi_active) || \
480 ((x)->asiCtxt[1].asi_active) || \
481 ((x)->asiCtxt[2].asi_active))
482
483/*
484*----------------------------------------------------------------------------
485* @struct aic3262_setup_data |
486* i2c specific data setup for AIC3262.
487* @field unsigned short |i2c_address |
488* Unsigned short for i2c address.
489*----------------------------------------------------------------------------
490*/
491 struct aic3262_setup_data {
492 unsigned short i2c_address;
493};
494
495/*
496*----------------------------------------------------------------------------
497* @struct aic3262_asi_data
498* ASI specific data stored for each ASI Interface
499*
500*
501*---------------------------------------------------------------------------
502*/
503struct aic3262_asi_data {
504 u8 asi_active; /* ASI Active Flag */
505 u8 master; /* Frame Master */
506 u32 sampling_rate; /* Sampling Rate */
507 enum ASI_BDIV_CLKIN_OPTION bclk_div_option; /* BCLK DIV Mux Option*/
508 enum ASI_BCLK_OPTION bclk_output; /* BCLK Output Option*/
509 enum ASI_WCLK_OPTION wclk_output; /* WCLK Output Option*/
510 u8 bclk_div; /* BCLK Divider */
511 u8 wclk_div; /* WCLK Divider */
512 enum ASI_DAC_OUTPUT_OPTION left_dac_output; /* LDAC Path */
513 enum ASI_DAC_OUTPUT_OPTION right_dac_output; /* RDAC Path */
514 enum ASI_ADC_INPUT_OPTION adc_input; /* ADC Input Control */
515 enum ASI_DOUT_OPTION dout_option; /* DOUT Option */
516 u8 playback_mode; /* Playback Selected */
517 u8 capture_mode; /* Record Selected */
518 u8 port_muted; /* ASI Muted */
519 u8 pcm_format; /* PCM Format */
520 u8 word_len; /* Word Length */
521 u8 offset1; /* Left Ch offset */
522 u8 offset2; /* Right Ch Offset */
523};
524
525/*
526*----------------------------------------------------------------------------
527* @struct aic3262_priv |
528* AIC3262 priviate data structure to set the system clock, mode and
529* page number.
530* @field u32 | sysclk |
531* system clock
532* @field s32 | master |
533* master/slave mode setting for AIC3262
534* @field u8 | book_no |
535* book number.
536* @field u8 | page_no |
537* page number. Here, page 0 and page 1 are used.
538*----------------------------------------------------------------------------
539*/
540struct aic3262_priv {
541 enum snd_soc_control_type control_type;
542 struct aic326x_pdata *pdata;
543 struct snd_soc_codec codec;
544 u32 sysclk;
545 s32 master;
546 u8 book_no;
547 u8 page_no;
548 u8 process_flow;
549 u8 mute_codec;
550 u8 stream_status;
551 u32 active_count;
552 int current_dac_config[MAX_ASI_COUNT];
553 int current_adc_config[MAX_ASI_COUNT];
554 int current_config;
555 struct aic3262_asi_data asiCtxt[MAX_ASI_COUNT];
556 enum AIC3262_PLL_OPTION aic3262_pllclkin_option;
557 u8 dac_clkin_option;
558 u8 adc_clkin_option;
559 int irq;
560 u8 dac_reg;
561 u8 adc_gain;
562 u8 hpl;
563 u8 hpr;
564 u8 rec_amp;
565 u8 rampr;
566 u8 spk_amp;
567 struct spi_device *spi;
568 struct snd_soc_jack *headset_jack;
569 struct input_dev *button_dev;
570 int codec_audio_mode;
571#if defined(LOCAL_REG_ACCESS)
572 void *control_data;
573#endif
574};
575
576/*
577 *----------------------------------------------------------------------------
578 * @struct aic3262_configs |
579 * AIC3262 initialization data which has register offset and register
580 * value.
581 * @field u8 | book_no |
582 * AIC3262 Book Number Offsets required for initialization..
583 * @field u16 | reg_offset |
584 * AIC3262 Register offsets required for initialization..
585 * @field u8 | reg_val |
586 * value to set the AIC3262 register to initialize the AIC3262.
587 *----------------------------------------------------------------------------
588 */
589struct aic3262_configs {
590 u8 book_no;
591 u16 reg_offset;
592 u8 reg_val;
593};
594
595/*
596 *----------------------------------------------------------------------------
597 * @struct aic3262_rate_divs |
598 * Setting up the values to get different freqencies
599 * @field u32 | mclk |
600 * Master clock
601 * @field u32 | rate |
602 * sample rate
603 * @field u8 | p_val |
604 * value of p in PLL
605 * @field u32 | pll_j |
606 * value for pll_j
607 * @field u32 | pll_d |
608 * value for pll_d
609 * @field u32 | dosr |
610 * value to store dosr
611 * @field u32 | ndac |
612 * value for ndac
613 * @field u32 | mdac |
614 * value for mdac
615 * @field u32 | aosr |
616 * value for aosr
617 * @field u32 | nadc |
618 * value for nadc
619 * @field u32 | madc |
620 * value for madc
621 * @field u32 | blck_N |
622 * value for block N
623 * @field u32 | aic3262_configs |
624 * configurations for aic3262 register value
625 *----------------------------------------------------------------------------
626 */
627struct aic3262_rate_divs {
628 u32 mclk;
629 u32 rate;
630 u8 p_val;
631 u8 pll_j;
632 u16 pll_d;
633 u16 dosr;
634 u8 ndac;
635 u8 mdac;
636 u8 aosr;
637 u8 nadc;
638 u8 madc;
639 u8 blck_N;
640 struct aic3262_configs codec_specific_regs[NO_FEATURE_REGS];
641};
642
643/*
644*****************************************************************************
645* EXTERN DECLARATIONS
646*****************************************************************************
647*/
648/*
649 *----------------------------------------------------------------------------
650 * @func aic326x_headset_detect
651 * This function help to setup the needed registers to
652 * enable the headset detection
653 *
654 */
655extern int aic326x_headset_detect(struct snd_soc_codec *codec,
656 struct snd_soc_jack *jack, int jack_type);
657extern int aic326x_headset_button_init(struct snd_soc_codec *codec,
658 struct snd_soc_jack *jack, int jack_type);
659
660extern u8 aic3262_read(struct snd_soc_codec *codec, u16 reg);
661extern u16 aic3262_read_2byte(struct snd_soc_codec *codec, u16 reg);
662extern int aic3262_reset_cache(struct snd_soc_codec *codec);
663extern int aic3262_change_page(struct snd_soc_codec *codec, u8 new_page);
664extern int aic3262_write(struct snd_soc_codec *codec, u16 reg, u8 value);
665extern void aic3262_write_reg_cache(struct snd_soc_codec *codec,
666 u16 reg, u8 value);
667extern int aic3262_change_book(struct snd_soc_codec *codec, u8 new_book);
668extern int reg_def_conf(struct snd_soc_codec *codec);
669extern int i2c_verify_book0(struct snd_soc_codec *codec);
670extern int poll_dac(struct snd_soc_codec *codec, int left_right, int on_off);
671extern int poll_adc(struct snd_soc_codec *codec, int left_right, int on_off);
672
673#ifdef CONFIG_MINI_DSP
674extern int aic3262_minidsp_program(struct snd_soc_codec *codec);
675extern int aic3262_add_minidsp_controls(struct snd_soc_codec *codec);
676#endif
677
678
679#ifdef MULTIBYTE_CONFIG_SUPPORT
680extern int aic3262_add_multiconfig_controls(struct snd_soc_codec *codec);
681#endif
682
683#endif /* _TLV320AIC3262_H */
684
diff --git a/sound/soc/codecs/tlv320aic326x_mini-dsp.c b/sound/soc/codecs/tlv320aic326x_mini-dsp.c
new file mode 100644
index 00000000000..6d55abb4dac
--- /dev/null
+++ b/sound/soc/codecs/tlv320aic326x_mini-dsp.c
@@ -0,0 +1,1796 @@
1/*
2 * linux/sound/soc/codecs/tlv320aic326x_mini-dsp.c
3 *
4 * Copyright (C) 2012 Texas Instruments, Inc.
5 *
6 * This package is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
11 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
12 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13 *
14 * The TLV320AIC3262 is a flexible, low-power, low-voltage stereo audio
15 * codec with digital microphone inputs and programmable outputs.
16 *
17 * History:
18 *
19 * Rev 0.1 Added the miniDSP Support 01-03-2011
20 *
21 * Rev 0.2 Updated the code-base for miniDSP switching and
22 * mux control update. 21-03-2011
23 *
24 * Rev 0.3 Updated the code-base to support Multi-Configuration feature
25 * of PPS GDE
26 */
27
28/*
29 *****************************************************************************
30 * INCLUDES
31 *****************************************************************************
32 */
33#include <linux/module.h>
34#include <linux/moduleparam.h>
35#include <linux/init.h>
36#include <linux/kernel.h>
37#include <linux/fs.h>
38#include <linux/types.h>
39#include <linux/kdev_t.h>
40#include <linux/cdev.h>
41#include <linux/device.h>
42#include <linux/io.h>
43#include <linux/delay.h>
44#include <linux/i2c.h>
45#include <linux/platform_device.h>
46#include <sound/soc.h>
47#include <sound/core.h>
48#include <sound/soc-dapm.h>
49#include <sound/control.h>
50#include <linux/time.h> /* For timing computations */
51#include "tlv320aic326x.h"
52#include "tlv320aic326x_mini-dsp.h"
53
54#include "base_main_Rate48_pps_driver.h"
55#include "second_rate_pps_driver.h"
56//#include "one_mic_aec_nc_latest.h"
57#ifdef CONFIG_MINI_DSP
58
59#ifdef REG_DUMP_MINIDSP
60static void aic3262_dump_page(struct i2c_client *i2c, u8 page);
61#endif
62
63/*
64 *****************************************************************************
65 * LOCAL STATIC DECLARATIONS
66 *****************************************************************************
67 */
68static int m_control_info(struct snd_kcontrol *kcontrol,
69 struct snd_ctl_elem_info *uinfo);
70static int m_control_get(struct snd_kcontrol *kcontrol,
71 struct snd_ctl_elem_value *ucontrol);
72static int m_control_put(struct snd_kcontrol *kcontrol,
73 struct snd_ctl_elem_value *ucontrol);
74
75/*
76 *****************************************************************************
77 * MINIDSP RELATED GLOBALS
78 *****************************************************************************
79 */
80/* The below variable is used to maintain the I2C Transactions
81 * to be carried out during miniDSP switching.
82 */
83 #if 1
84minidsp_parser_data dsp_parse_data[MINIDSP_PARSER_ARRAY_SIZE*2];
85
86struct i2c_msg i2c_transaction[MINIDSP_PARSER_ARRAY_SIZE * 2];
87/* Total count of I2C Messages are stored in the i2c_count */
88int i2c_count;
89
90/* The below array is used to store the burst array for I2C Multibyte
91 * Operations
92 */
93minidsp_i2c_page i2c_page_array[MINIDSP_PARSER_ARRAY_SIZE];
94int i2c_page_count;
95#else
96minidsp_parser_data dsp_parse_data;
97
98struct i2c_msg i2c_transaction;
99/* Total count of I2C Messages are stored in the i2c_count */
100int i2c_count;
101
102/* The below array is used to store the burst array for I2C Multibyte
103 * Operations
104 */
105minidsp_i2c_page i2c_page_array;
106int i2c_page_count;
107#endif
108
109/* kcontrol structure used to register with ALSA Core layer */
110static struct snd_kcontrol_new snd_mux_controls[MAX_MUX_CONTROLS];
111
112/* mode variables */
113static int amode;
114static int dmode;
115
116/* k-control macros used for miniDSP related Kcontrols */
117#define SOC_SINGLE_VALUE_M(xmax, xinvert) \
118 ((unsigned long)&(struct soc_mixer_control) \
119 {.max = xmax, \
120 .invert = xinvert})
121#define SOC_SINGLE_M(xname, max, invert) \
122{\
123 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
124 .info = m_control_info, .get = m_control_get,\
125 .put = m_control_put, \
126 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
127 .private_value = SOC_SINGLE_VALUE_M(max, invert) }
128#define SOC_SINGLE_AIC3262_M(xname) \
129{\
130 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
131 .info = m_control_info, .get = m_control_get,\
132 .put = m_control_put, \
133 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
134}
135
136/*
137 * aic3262_minidsp_controls
138 *
139 * Contains the list of the Kcontrol macros required for modifying the
140 * miniDSP behavior at run-time.
141 */
142static const struct snd_kcontrol_new aic3262_minidsp_controls[] = {
143 SOC_SINGLE_AIC3262_M("Minidsp mode") ,
144 SOC_SINGLE_AIC3262_M("ADC Adaptive mode Enable") ,
145 SOC_SINGLE_AIC3262_M("DAC Adaptive mode Enable") ,
146 SOC_SINGLE_AIC3262_M("Dump Regs Book0") ,
147 SOC_SINGLE_AIC3262_M("Verify minidsp program") ,
148};
149
150#ifdef REG_DUMP_MINIDSP
151/*
152 *----------------------------------------------------------------------------
153 * Function : aic3262_dump_page
154 * Purpose : Read and display one codec register page, for debugging purpose
155 *----------------------------------------------------------------------------
156 */
157static void aic3262_dump_page(struct i2c_client *i2c, u8 page)
158{
159 int i;
160 u8 data;
161 u8 test_page_array[256];
162
163 aic3262_change_page(codec, page);
164
165 data = 0x0;
166
167 i2c_master_send(i2c, data, 1);
168 i2c_master_recv(i2c, test_page_array, 128);
169
170 DBG("\n------- MINI_DSP PAGE %d DUMP --------\n", page);
171 for (i = 0; i < 128; i++)
172 DBG(KERN_INFO " [ %d ] = 0x%x\n", i, test_page_array[i]);
173
174}
175#endif
176
177/*
178 *----------------------------------------------------------------------------
179 * Function : update_kcontrols
180 * Purpose : Given the miniDSP process flow, this function reads the
181 * corresponding Page Numbers and then performs I2C Read for those
182 * Pages.
183 *----------------------------------------------------------------------------
184 */
185void update_kcontrols(struct snd_soc_codec *codec, int process_flow)
186{
187 int i, val1, array_size;
188 char **knames;
189 control *cntl;
190
191#if 0
192 if (process_flow == 1) {
193 knames = Second_Rate_MUX_control_names;
194 cntl = Second_Rate_MUX_controls;
195 array_size = ARRAY_SIZE(Second_Rate_MUX_controls);
196 } else {
197#endif
198 knames = main44_MUX_control_names;
199 cntl = main44_MUX_controls;
200 array_size = ARRAY_SIZE(main44_MUX_controls);
201// }
202
203 DBG(KERN_INFO "%s: ARRAY_SIZE = %d\tmode=%d\n", __func__,
204 array_size, process_flow);
205 for (i = 0; i < array_size; i++) {
206 aic3262_change_book(codec, cntl[i].control_book);
207 aic3262_change_page(codec, cntl[i].control_page);
208 val1 = i2c_smbus_read_byte_data(codec->control_data,
209 cntl[i].control_base);
210 snd_mux_controls[i].private_value = 0;
211 }
212}
213
214/*
215 *----------------------------------------------------------------------------
216 * Function : byte_i2c_array_transfer
217 * Purpose : Function used only for debugging purpose. This function will
218 * be used while switching miniDSP Modes register by register.
219 * This needs to be used only during development.
220 *-----------------------------------------------------------------------------
221 */
222 #if 1
223int byte_i2c_array_transfer(struct snd_soc_codec *codec,
224 reg_value *program_ptr,
225 int size)
226{
227 int j;
228 u8 buf[3];
229
230 for (j = 0; j < size; j++) {
231 /* Check if current Reg offset is zero */
232 if (program_ptr[j].reg_off == 0) {
233 /* Check for the Book Change Request */
234 if ((j < (size - 1)) &&
235 (program_ptr[j+1].reg_off == 127)) {
236 aic3262_change_book(codec,
237 program_ptr[j+1].reg_val);
238 /* Increment for loop counter across Book Change */
239 j++;
240 continue;
241 }
242 /* Check for the Page Change Request in Current book */
243 aic3262_change_page(codec, program_ptr[j].reg_val);
244 continue;
245 }
246
247 buf[AIC3262_REG_OFFSET_INDEX] = program_ptr[j].reg_off % 128;
248 buf[AIC3262_REG_DATA_INDEX] =
249 program_ptr[j].reg_val & AIC3262_8BITS_MASK;
250
251 if (codec->hw_write(codec->control_data, buf, 2) != 2) {
252 printk(KERN_ERR "Error in i2c write\n");
253 return -EIO;
254 }
255 }
256 aic3262_change_book(codec, 0);
257 return 0;
258}
259
260#else
261int byte_i2c_array_transfer(struct snd_soc_codec *codec,
262 reg_value *program_ptr,
263 int size)
264{
265 int j;
266 u8 buf[3];
267 printk(KERN_INFO "%s: started with array size %d\n", __func__, size);
268 for (j = 0; j < size; j++) {
269 /* Check if current Reg offset is zero */
270 buf[AIC3262_REG_OFFSET_INDEX] = program_ptr[j].reg_off % 128;
271 buf[AIC3262_REG_DATA_INDEX] =
272 program_ptr[j].reg_val & AIC3262_8BITS_MASK;
273
274 if (codec->hw_write(codec->control_data, buf, 2) != 2) {
275 printk(KERN_ERR "Error in i2c write\n");
276 return -EIO;
277 }
278 }
279 printk(KERN_INFO "%s: ended\n", __func__);
280 return 0;
281}
282#endif
283/*
284 *----------------------------------------------------------------------------
285 * Function : byte_i2c_array_read
286 * Purpose : This function is used to perform Byte I2C Read. This is used
287 * only for debugging purposes to read back the Codec Page
288 * Registers after miniDSP Configuration.
289 *----------------------------------------------------------------------------
290 */
291int byte_i2c_array_read(struct snd_soc_codec *codec,
292 reg_value *program_ptr, int size)
293{
294 int j;
295 u8 val1;
296 u8 cur_page = 0;
297 u8 cur_book = 0;
298 for (j = 0; j < size; j++) {
299 /* Check if current Reg offset is zero */
300 if (program_ptr[j].reg_off == 0) {
301 /* Check for the Book Change Request */
302 if ((j < (size - 1)) &&
303 (program_ptr[j+1].reg_off == 127)) {
304 aic3262_change_book(codec,
305 program_ptr[j+1].reg_val);
306 cur_book = program_ptr[j+1].reg_val;
307 /* Increment for loop counter across Book Change */
308 j++;
309 continue;
310 }
311 /* Check for the Page Change Request in Current book */
312 aic3262_change_page(codec, program_ptr[j].reg_val);
313 cur_page = program_ptr[j].reg_val;
314 continue;
315 }
316
317 val1 = i2c_smbus_read_byte_data(codec->control_data,
318 program_ptr[j].reg_off);
319 if (val1 < 0)
320 printk(KERN_ERR "Error in smbus read\n");
321
322 if(val1 != program_ptr[j].reg_val)
323 /*printk(KERN_INFO "mismatch [%d][%d][%d] = %x %x\n",
324 cur_book, cur_page, program_ptr[j].reg_off, val1, program_ptr[j].reg_val);*/
325 DBG(KERN_INFO "[%d][%d][%d]= %x\n",
326 cur_book, cur_page, program_ptr[j].reg_off, val1);
327 }
328 aic3262_change_book(codec, 0);
329 return 0;
330}
331
332/*
333 *----------------------------------------------------------------------------
334 * Function : minidsp_get_burst
335 * Purpose : Format one I2C burst for transfer from mini dsp program array.
336 * This function will parse the program array and get next burst
337 * data for doing an I2C bulk transfer.
338 *----------------------------------------------------------------------------
339 */
340static void
341minidsp_get_burst(reg_value *program_ptr,
342 int program_size,
343 minidsp_parser_data *parse_data)
344{
345 int index = parse_data->current_loc;
346 int burst_write_count = 0;
347
348 /*DBG("GET_BURST: start\n");*/
349 /* check if first location is page register, and populate page addr */
350 if (program_ptr[index].reg_off == 0) {
351 if ((index < (program_size - 1)) &&
352 (program_ptr[index+1].reg_off == 127)) {
353 parse_data->book_change = 1;
354 parse_data->book_no = program_ptr[index+1].reg_val;
355 index += 2;
356 goto finish_out;
357
358 }
359 parse_data->page_num = program_ptr[index].reg_val;
360 parse_data->burst_array[burst_write_count++] =
361 program_ptr[index].reg_off;
362 parse_data->burst_array[burst_write_count++] =
363 program_ptr[index].reg_val;
364 index++;
365 goto finish_out;
366 }
367
368 parse_data->burst_array[burst_write_count++] =
369 program_ptr[index].reg_off;
370 parse_data->burst_array[burst_write_count++] =
371 program_ptr[index].reg_val;
372 index++;
373
374 for (; index < program_size; index++) {
375 if (program_ptr[index].reg_off !=
376 (program_ptr[index - 1].reg_off + 1))
377 break;
378 else
379 parse_data->burst_array[burst_write_count++] =
380 program_ptr[index].reg_val;
381
382 }
383finish_out:
384 parse_data->burst_size = burst_write_count;
385 if (index == program_size)
386 /* parsing completed */
387 parse_data->current_loc = MINIDSP_PARSING_END;
388 else
389 parse_data->current_loc = index;
390 /*DBG("GET_BURST: end\n");*/
391}
392/*
393 *----------------------------------------------------------------------------
394 * Function : minidsp_i2c_multibyte_transfer
395 * Purpose : Function used to perform multi-byte I2C Writes. Used to configure
396 * the miniDSP Pages.
397 *----------------------------------------------------------------------------
398 */
399 #if 1
400int
401minidsp_i2c_multibyte_transfer(struct snd_soc_codec *codec,
402 reg_value *program_ptr,
403 int program_size)
404{
405 struct i2c_client *client = codec->control_data;
406
407 minidsp_parser_data parse_data;
408 int count = 0;
409
410#ifdef DEBUG_MINIDSP_LOADING
411 int i = 0, j = 0;
412#endif
413 /* point the current location to start of program array */
414 parse_data.current_loc = 0;
415 parse_data.page_num = 0;
416 parse_data.book_change = 0;
417 parse_data.book_no = 0;
418
419 DBG(KERN_INFO "size is : %d", program_size);
420 do {
421 do {
422 /* Get first burst data */
423 minidsp_get_burst(program_ptr, program_size,
424 &parse_data);
425 if (parse_data.book_change == 1)
426 break;
427 dsp_parse_data[count] = parse_data;
428
429 i2c_transaction[count].addr = client->addr;
430 i2c_transaction[count].flags =
431 client->flags & I2C_M_TEN;
432 i2c_transaction[count].len =
433 dsp_parse_data[count].burst_size;
434 i2c_transaction[count].buf =
435 dsp_parse_data[count].burst_array;
436
437#ifdef DEBUG_MINIDSP_LOADING
438 DBG(KERN_INFO
439 "i: %d\taddr: %d\tflags: %d\tlen: %d\tbuf:",
440 i, client->addr, client->flags & I2C_M_TEN,
441 dsp_parse_data[count].burst_size);
442
443 for (j = 0; j <= dsp_parse_data[count].burst_size; j++)
444 DBG(KERN_INFO "%x ",
445 dsp_parse_data[i].burst_array[j]);
446
447 DBG(KERN_INFO "\n\n");
448 i++;
449#endif
450
451 count++;
452 /* Proceed to the next burst reg_addr_incruence */
453 } while (parse_data.current_loc != MINIDSP_PARSING_END);
454
455 if (count > 0) {
456 if (i2c_transfer(client->adapter,
457 i2c_transaction, count) != count) {
458 printk(KERN_ERR "Write burst i2c data error!\n");
459 }
460 }
461 if (parse_data.book_change == 1) {
462 aic3262_change_book(codec, parse_data.book_no);
463 parse_data.book_change = 0;
464 }
465 } while (parse_data.current_loc != MINIDSP_PARSING_END);
466 aic3262_change_book(codec, 0);
467 return 0;
468}
469#else
470int
471minidsp_i2c_multibyte_transfer(struct snd_soc_codec *codec,
472 reg_value *program_ptr,
473 int program_size)
474{
475 struct i2c_client *client = codec->control_data;
476
477 minidsp_parser_data parse_data;
478 int count = 1;
479
480#ifdef DEBUG_MINIDSP_LOADING
481 int i = 0, j = 0;
482#endif
483 /* point the current location to start of program array */
484 parse_data.current_loc = 0;
485 parse_data.page_num = 0;
486 parse_data.book_change = 0;
487 parse_data.book_no = 0;
488
489 DBG(KERN_INFO "size is : %d", program_size);
490
491 do {
492 /* Get first burst data */
493 minidsp_get_burst(program_ptr, program_size,
494 &parse_data);
495
496 dsp_parse_data = parse_data;
497
498 i2c_transaction.addr = client->addr;
499 i2c_transaction.flags =
500 client->flags & I2C_M_TEN;
501 i2c_transaction.len =
502 dsp_parse_data.burst_size;
503 i2c_transaction.buf =
504 dsp_parse_data.burst_array;
505
506#ifdef DEBUG_MINIDSP_LOADING
507 DBG(KERN_INFO
508 "i: %d\taddr: %d\tflags: %d\tlen: %d\tbuf:",
509 i, client->addr, client->flags & I2C_M_TEN,
510 dsp_parse_data.burst_size);
511
512 for (j = 0; j <= dsp_parse_data.burst_size; j++)
513 printk( "%x ",
514 dsp_parse_data.burst_array[j]);
515
516 DBG(KERN_INFO "\n\n");
517 i++;
518#endif
519
520 if (i2c_transfer(client->adapter,
521 &i2c_transaction, count) != count) {
522 printk(KERN_ERR "Write burst i2c data error!\n");
523 }
524 if (parse_data.book_change == 1) {
525 aic3262_change_book(codec, parse_data.book_no);
526 parse_data.book_change = 0;
527 }
528 /* Proceed to the next burst reg_addr_incruence */
529 } while (parse_data.current_loc != MINIDSP_PARSING_END);
530
531 return 0;
532}
533#endif
534/*
535* Process_Flow Structure
536* Structure used to maintain the mapping of each PFW like the miniDSP_A
537* miniDSP_D array values and sizes. It also contains information about
538* the patches required for each patch.
539*/
540struct process_flow{
541 int init_size;
542 reg_value *miniDSP_init;
543 int A_size;
544 reg_value *miniDSP_A_values;
545 int D_size;
546 reg_value *miniDSP_D_values;
547 int post_size;
548 reg_value *miniDSP_post;
549 struct minidsp_config {
550 int a_patch_size;
551 reg_value *a_patch;
552 int d_patch_size;
553 reg_value *d_patch;
554 } configs[MAXCONFIG];
555
556} miniDSP_programs[] = {
557 {
558 ARRAY_SIZE(main44_REG_Section_init_program), main44_REG_Section_init_program,
559 ARRAY_SIZE(main44_miniDSP_A_reg_values),main44_miniDSP_A_reg_values,
560 ARRAY_SIZE(main44_miniDSP_D_reg_values),main44_miniDSP_D_reg_values,
561 ARRAY_SIZE(main44_REG_Section_post_program),main44_REG_Section_post_program,
562 {
563
564 { 0, 0, 0, 0},
565 { 0, 0, 0, 0},
566 { 0, 0, 0, 0},
567 { 0, 0, 0, 0},
568
569
570 },
571},
572 {
573 ARRAY_SIZE(base_speaker_SRS_REG_init_Section_program),base_speaker_SRS_REG_init_Section_program,
574 ARRAY_SIZE(base_speaker_SRS_miniDSP_A_reg_values),base_speaker_SRS_miniDSP_A_reg_values,
575 ARRAY_SIZE(base_speaker_SRS_miniDSP_D_reg_values),base_speaker_SRS_miniDSP_D_reg_values,
576 ARRAY_SIZE(base_speaker_SRS_REG_post_Section_program),base_speaker_SRS_REG_post_Section_program,
577
578 {
579 {0, 0, ARRAY_SIZE(SRS_ON_miniDSP_D_reg_values), SRS_ON_miniDSP_D_reg_values},
580 {0, 0, ARRAY_SIZE(SRS_OFF_miniDSP_D_reg_values),SRS_OFF_miniDSP_D_reg_values},
581 {0, 0, 0, 0},
582 {0, 0, 0, 0},
583 },
584},
585#if 0
586 {ARRAY_SIZE(spkr_srs_REG_Section_init_program),spkr_srs_REG_Section_init_program,
587 ARRAY_SIZE(spkr_srs_miniDSP_A_reg_values),spkr_srs_miniDSP_A_reg_values,
588 ARRAY_SIZE(spkr_srs_miniDSP_D_reg_values),spkr_srs_miniDSP_D_reg_values,
589 ARRAY_SIZE(spkr_srs_REG_Section_post_program),spkr_srs_REG_Section_post_program,
590 {
591 { 0, 0, 0, 0},
592 { 0, 0, 0, 0},
593 { 0, 0, 0, 0},
594 { 0, 0, 0, 0},
595
596 },
597},
598#endif
599};
600
601int
602set_minidsp_mode(struct snd_soc_codec *codec, int new_mode, int new_config)
603{
604
605 if (codec == NULL) {
606 printk(KERN_INFO "%s codec is NULL\n",__func__);
607 }
608 struct aic3262_priv *aic326x = snd_soc_codec_get_drvdata(codec);
609 struct snd_soc_dapm_context *dapm = &codec->dapm;
610 struct process_flow * pflows = &miniDSP_programs[new_mode];
611 u8 reg63, reg81, pll_pow, ndac_pow, mdac_pow, nadc_pow, madc_pow;
612
613 u8 adc_status,dac_status;
614 u8 reg, val;
615 u8 shift;
616 volatile u16 counter;
617
618 int (*ptransfer)(struct snd_soc_codec *codec,
619 reg_value *program_ptr,
620 int size);
621
622 printk("%s:New Switch mode = %d New Config= %d\n", __func__, new_mode,new_config);
623 if (new_mode >= ARRAY_SIZE(miniDSP_programs))
624 return 0; // error condition
625 if (new_config > MAXCONFIG)
626 return 0;
627#ifndef MULTIBYTE_I2C
628 ptransfer = byte_i2c_array_transfer;
629#else
630 ptransfer = minidsp_i2c_multibyte_transfer;
631#endif
632 if (new_mode != aic326x->process_flow) {
633
634 printk("== From PFW %d to PFW %d==\n", aic326x->process_flow , new_mode);
635
636 /* Change to book 0 page 0 and turn off the DAC and snd_soc_dapm_disable_piADC,
637 * while turning them down, poll for the power down completion.
638 */
639 aic3262_change_page(codec, 0);
640 aic3262_change_book(codec, 0);
641
642#if 0
643 reg63 = aic3262_read(codec, PASI_DAC_DP_SETUP);
644 aic3262_write(codec, PASI_DAC_DP_SETUP, (reg63 & ~0xC0));/*dac power down*/
645 mdelay (5);
646 counter = 0;
647 reg = DAC_FLAG_R1;
648
649 dac_status = aic3262_read(codec, reg);
650
651 do {
652 dac_status = snd_soc_read(codec, reg);
653 counter++;struct snd_soc_dapm_context *dapm
654 mdelay(5);
655 } while ((counter < 200) && ((dac_status & 0x88) == 1));
656 printk (KERN_INFO "#%s: Polled Register %d Bits set 0x%X counter %d\n",
657 __func__, reg, dac_status, counter);snd_soc_dapm_disable_pi
658 struct snd_soc_dapm_context *dapm
659 reg81= aic3262_read(codec, ADC_CHANNEL_POW);
660 aic3262_write(codec, ADC_CHANNEL_POW, (reg81 & ~0xC0));/*adc power down*/
661 mdelay (5);
662
663 adc_status=aic3262_read(codec,ADC_FLAG_R1);
664 counter = 0;
665 reg = ADC_FLAG_R1;
666 do {
667 adc_status = snd_soc_read(codec, reg);
668 counter++;
669 mdelay(5);
670 } while ((counter < 200) && ((adc_status & 0x44) == 1));
671
672 printk (KERN_INFO "#%s: Polled Register %d Bits set 0x%X counter %d\n",
673 __func__, reg, adc_status, counter);
674
675 dac_status = snd_soc_read(codec, DAC_FLAG_R1);
676 adc_status = snd_soc_read (codec, ADC_FLAG_R1);
677
678 printk (KERN_INFO "#%s: Initial DAC_STATUS 0x%x ADC_STATUS 0x%X\n",
679 __func__, dac_status, adc_status);
680
681#endif
682 /* Instead of hard-coding the switching off DAC and ADC, we will use the DAPM
683 * to switch off the Playback Paths and the ADC
684 */
685 snd_soc_dapm_disable_pin( dapm, "Headphone Jack");
686 snd_soc_dapm_disable_pin( dapm, "EarPiece");
687 snd_soc_dapm_disable_pin( dapm, "Int Spk");
688 snd_soc_dapm_disable_pin( dapm, "SPK out");
689 snd_soc_dapm_disable_pin( dapm, "Line Out");
690
691 snd_soc_dapm_disable_pin( dapm, "Mic Jack");
692 snd_soc_dapm_disable_pin( dapm, "Linein");
693 snd_soc_dapm_disable_pin( dapm, "Int Mic");
694
695 //snd_soc_dapm_disable_pin (codec, "Left DAC");
696 //snd_soc_dapm_disable_pin (codec, "Right DAC");
697 //snd_soc_dapm_disable_pin (codec, "Left ADC");
698 //snd_soc_dapm_disable_pin (codec, "Right ADC");
699 snd_soc_dapm_sync(dapm);
700 mdelay(10);
701
702 mdac_pow = aic3262_read(codec, MDAC_DIV_POW_REG);
703 aic3262_write(codec, MDAC_DIV_POW_REG, (mdac_pow & ~0x80));/*mdac power down*/
704 mdelay(5);
705 nadc_pow = aic3262_read(codec, MADC_DIV_POW_REG);
706 aic3262_write(codec, MADC_DIV_POW_REG, (nadc_pow & ~0x80));/*madc power down*/
707 mdelay(5);
708 pll_pow = aic3262_read(codec, PLL_PR_POW_REG);
709 aic3262_write(codec, PLL_PR_POW_REG, (pll_pow & ~0x80));/*pll power down*/
710 mdelay(5);
711 ndac_pow = aic3262_read(codec, NDAC_DIV_POW_REG);
712 aic3262_write(codec, NDAC_DIV_POW_REG, (ndac_pow & ~0x80)); /*ndac power down*/
713 mdelay(5);
714
715 dac_status = snd_soc_read(codec, DAC_FLAG_R1);
716 adc_status = snd_soc_read (codec, ADC_FLAG_R1);
717
718 printk (KERN_INFO "#%s: Before Switching DAC_STATUS 0x%x ADC_STATUS 0x%X\n",
719 __func__, dac_status, adc_status);
720
721 mdelay (10);
722 ptransfer(codec, pflows->miniDSP_init, pflows->init_size);
723 ptransfer(codec, pflows->miniDSP_A_values, pflows->A_size);
724 ptransfer(codec, pflows->miniDSP_D_values, pflows->D_size);
725 ptransfer(codec, pflows->miniDSP_post, pflows->post_size);
726
727
728 aic326x->process_flow = new_mode;
729
730 aic3262_change_page(codec, 0);
731 aic3262_change_book(codec, 0);
732#if 0
733
734 /* After the miniDSP Programming is completed, power up the DAC and ADC
735 * and poll for its power up operation.
736 */
737
738 aic3262_write(codec, PASI_DAC_DP_SETUP, reg63);/*reverting the old DAC values */
739 mdelay(5);
740
741 /* Poll for DAC Power-up first */
742 /* For DAC Power-up and Power-down event, we will poll for
743 * Book0 Page0 Register 37
744 */
745 reg = DAC_FLAG_R1;
746 counter = 0;
747 do {
748 dac_status = snd_soc_read(codec, reg);
749 counter++;
750 mdelay(5);
751 } while ((counter < 200) && ((dac_status & 0x88) == 0));
752
753 printk (KERN_INFO "#%s: Polled Register %d Bits set 0x%X counter %d\n",
754 __func__, reg, dac_status, counter);
755
756 aic3262_write(codec, ADC_CHANNEL_POW, reg81);/*reverting the old ADC values*/
757 mdelay (5);
758 /* For ADC Power-up and Power-down event, we will poll for
759 * Book0 Page0 Register 36
760 */
761 reg = ADC_FLAG_R1;
762 counter = 0;
763 do {
764 adc_status = snd_soc_read(codec, reg);
765 counter++;
766 mdelay(5);
767 } while ((counter < 200) && ((adc_status & 0x44) == 0));
768
769 printk (KERN_INFO "#%s: Polled Register %d Bits set 0x%X counter %d\n",
770 __func__, reg, adc_status, counter);
771 aic3262_write(codec, PLL_PR_POW_REG, pll_pow);/*reverting the old pll values*/
772 mdelay(10);
773
774 aic3262_write(codec, MDAC_DIV_POW_REG, mdac_pow);/*reverting the old mdac values*/
775 mdelay(5);
776 aic3262_write(codec, MADC_DIV_POW_REG, madc_pow);/*reverting the old madc values*/
777 mdelay(5);
778 aic3262_write(codec, NDAC_DIV_POW_REG, ndac_pow);/*reverting the old ndac values*/
779 mdelay(5);
780
781 /*if (new_config == 0) {
782 aic326x->current_config = 0;
783 return 0;
784 }
785 aic326x->current_config = -1;*/
786
787 //aic3262_change_book(codec, 0);
788 //aic3262_change_page(codec, 0);
789#endif
790 }
791
792#ifdef MULTICONFIG_SUPPORT
793 if (new_config < 0 )
794 return 0; // No configs supported in this pfw
795 if (new_config == aic326x->current_config)
796 return 0;
797 if (pflows->configs[new_config].a_patch_size || pflows->configs[new_config].d_patch_size)
798 minidsp_multiconfig(codec,
799 pflows->configs[new_config].a_patch, pflows->configs[new_config].a_patch_size,
800 pflows->configs[new_config].d_patch, pflows->configs[new_config].d_patch_size);
801#endif
802
803 aic326x->current_config = new_config;
804 aic3262_change_book( codec, 0);
805
806 DBG(KERN_INFO "%s: switch mode finished\n", __func__);
807 return 0;
808}
809
810/*
811 * i2c_verify
812 *
813 * Function used to validate the contents written into the miniDSP
814 * pages after miniDSP Configuration.
815*/
816int i2c_verify(struct snd_soc_codec *codec)
817{
818
819 DBG(KERN_INFO "#%s: Invoked.. Resetting to page 0\n", __func__);
820
821 aic3262_change_book(codec, 0);
822 DBG(KERN_INFO "#Reading reg_section_init_program\n");
823
824 byte_i2c_array_read(codec, main44_REG_Section_init_program,
825 ARRAY_SIZE(main44_REG_Section_init_program));
826
827 DBG(KERN_INFO "#Reading minidsp_A_reg_values\n");
828 byte_i2c_array_read(codec, main44_miniDSP_A_reg_values,
829 (main44_miniDSP_A_reg_values_COEFF_SIZE +
830 main44_miniDSP_A_reg_values_INST_SIZE));
831
832 DBG(KERN_INFO "#Reading minidsp_D_reg_values\n");
833 byte_i2c_array_read(codec, main44_miniDSP_D_reg_values,
834 (main44_miniDSP_D_reg_values_COEFF_SIZE +
835 main44_miniDSP_D_reg_values_INST_SIZE));
836
837 DBG(KERN_INFO "#Reading reg_section_post_program\n");
838 byte_i2c_array_read(codec, main44_REG_Section_post_program,
839 ARRAY_SIZE(main44_REG_Section_post_program));
840
841 aic3262_change_book(codec, 0);
842
843 DBG(KERN_INFO "i2c_verify completed\n");
844 return 0;
845}
846
847
848int change_codec_power_status(struct snd_soc_codec * codec, int off_restore, int power_mask)
849{
850 int minidsp_power_mask;
851 u8 dac_status;
852 u8 adc_status;
853
854 minidsp_power_mask = 0;
855
856 aic3262_change_page (codec, 0);
857 aic3262_change_book (codec, 0);
858
859
860 switch (off_restore) {
861
862 case 0: /* Power-off the Codec */
863 dac_status = snd_soc_read (codec, DAC_FLAG_R1);
864
865 if(dac_status & 0x88) {
866 minidsp_power_mask |= 0x1;
867 snd_soc_update_bits(codec, PASI_DAC_DP_SETUP, 0xC0, 0x0);
868
869 poll_dac(codec, 0x0, 0x0);
870 poll_dac(codec, 0x1, 0x0);
871 }
872
873 adc_status = snd_soc_read (codec, ADC_FLAG_R1);
874
875 if(adc_status & 0x44) {
876 minidsp_power_mask |= 0x2;
877 snd_soc_update_bits(codec, ADC_CHANNEL_POW, 0xC0, 0x0);
878
879 poll_adc(codec, 0x0, 0x0);
880 poll_adc(codec, 0x1, 0x0);
881 }
882 break;
883 case 1: /* For Restoring Codec to Previous Power State */
884
885 if(power_mask & 0x1) {
886
887 snd_soc_update_bits(codec, PASI_DAC_DP_SETUP, 0xC0, 0xC0);
888
889 poll_dac(codec, 0x0, 0x1);
890 poll_dac(codec, 0x1, 0x1);
891 }
892
893 if(power_mask & 0x2) {
894
895 snd_soc_update_bits(codec, ADC_CHANNEL_POW, 0xC0, 0xC0);
896
897 poll_adc(codec, 0x0, 0x1);
898 poll_adc(codec, 0x1, 0x1);
899 }
900 break;
901 default:
902 printk(KERN_ERR "#%s: Unknown Power State Requested..\n",
903 __func__);
904 }
905
906 return minidsp_power_mask;
907
908}
909
910/*
911 *----------------------------------------------------------------------------
912 * Function : boot_minidsp
913 * Purpose : for laoding the default minidsp mode for the first time .
914 *----------------------------------------------------------------------------
915 */
916int
917boot_minidsp(struct snd_soc_codec *codec, int new_mode)
918{
919 struct aic3262_priv *aic326x = snd_soc_codec_get_drvdata(codec);
920 struct process_flow * pflows = &miniDSP_programs[new_mode];
921 int minidsp_stat;
922
923 int (*ptransfer)(struct snd_soc_codec *codec,
924 reg_value *program_ptr,
925 int size);
926
927 DBG("%s: switch mode start\n", __func__);
928 if (new_mode >= ARRAY_SIZE(miniDSP_programs))
929 return 0; // error condition
930 if (new_mode == aic326x->process_flow)
931 return 0;
932
933
934#ifndef MULTIBYTE_I2C
935 ptransfer = byte_i2c_array_transfer;
936#else
937 ptransfer = minidsp_i2c_multibyte_transfer;
938#endif
939
940 minidsp_stat = change_codec_power_status (codec, 0x0, 0x3);
941
942 ptransfer(codec, pflows->miniDSP_init, pflows->init_size);
943 ptransfer(codec, pflows->miniDSP_A_values, pflows->A_size);
944 ptransfer(codec, pflows->miniDSP_D_values, pflows->D_size);
945 ptransfer(codec, pflows->miniDSP_post, pflows->post_size);
946
947 aic326x->process_flow = new_mode;
948
949 change_codec_power_status(codec, 1, minidsp_stat);
950
951 aic3262_change_page( codec,0);
952 aic3262_change_book( codec,0);
953
954 return 0;
955}
956
957/*
958 *----------------------------------------------------------------------------
959 * Function : aic3262_minidsp_program
960 * Purpose : Program mini dsp for AIC3262 codec chip. This routine is
961 * called from the aic3262 codec driver, if mini dsp programming
962 * is enabled.
963 *----------------------------------------------------------------------------
964 */
965int aic3262_minidsp_program(struct snd_soc_codec *codec)
966{
967 struct aic3262_priv *aic326x = snd_soc_codec_get_drvdata(codec);
968 DBG(KERN_INFO "#AIC3262: programming mini dsp\n");
969
970#if defined(PROGRAM_MINI_DSP_first)
971 #ifdef DEBUG
972 DBG("#Verifying book 0\n");
973 i2c_verify_book0(codec);
974#endif
975 aic3262_change_book(codec, 0);
976 boot_minidsp(codec, 1);
977 aic326x->process_flow = 0;
978 aic3262_change_book(codec, 0);
979#ifdef DEBUG
980 DBG("#verifying book 0\n");
981 i2c_verify_book0(codec);
982#endif
983#endif
984#if defined(PROGRAM_MINI_DSP_second)
985#ifdef DEBUG
986 DBG("#Verifying book 0\n");
987 aic3262_change_book(codec, 0);
988#endif
989 boot_minidsp(codec, 0);
990 aic326x->process_flow = 1;
991#ifdef DEBUG
992 DBG("#verifying book 0\n");
993 aic3262_change_book(codec, 0);
994#endif
995#endif
996 return 0;
997}
998/*
999 *----------------------------------------------------------------------------
1000 * Function : m_control_info
1001 * Purpose : This function is to initialize data for new control required to
1002 * program the AIC3262 registers.
1003 *
1004 *----------------------------------------------------------------------------
1005 */
1006static int m_control_info(struct snd_kcontrol *kcontrol,
1007 struct snd_ctl_elem_info *uinfo)
1008{
1009 uinfo->count = 1;
1010 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
1011 uinfo->value.integer.min = 0;
1012 uinfo->value.integer.max = 1;
1013 return 0;
1014}
1015
1016/*
1017 *----------------------------------------------------------------------------
1018 * Function : m_control_get
1019 * Purpose : This function is to read data of new control for
1020 * program the AIC3262 registers.
1021 *
1022 *----------------------------------------------------------------------------
1023 */
1024static int m_control_get(struct snd_kcontrol *kcontrol,
1025 struct snd_ctl_elem_value *ucontrol)
1026{
1027 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
1028 struct aic3262_priv *aic3262 = snd_soc_codec_get_drvdata(codec);
1029 u32 val;
1030 u8 val1;
1031
1032 if (!strcmp(kcontrol->id.name, "Minidsp mode")) {
1033 val = aic3262->process_flow;
1034 ucontrol->value.integer.value[0] = val;
1035 DBG(KERN_INFO "control get : mode=%d\n", aic3262->process_flow);
1036 }
1037 if (!strcmp(kcontrol->id.name, "DAC Adaptive mode Enable")) {
1038 aic3262_change_book(codec, 80);
1039 val1 = i2c_smbus_read_byte_data(codec->control_data, 1);
1040 ucontrol->value.integer.value[0] = ((val1>>1)&0x01);
1041 DBG(KERN_INFO "control get : mode=%d\n", aic3262->process_flow);
1042 aic3262_change_book(codec,0);
1043 }
1044 if (!strcmp(kcontrol->id.name, "ADC Adaptive mode Enable")) {
1045 aic3262_change_book(codec, 40);
1046 val1 = i2c_smbus_read_byte_data(codec->control_data, 1);
1047 ucontrol->value.integer.value[0] = ((val1>>1)&0x01);
1048 DBG(KERN_INFO "control get : mode=%d\n", dmode);
1049 aic3262_change_book(codec,0);
1050 }
1051
1052 return 0;
1053}
1054
1055/*
1056 *----------------------------------------------------------------------------
1057 * Function : m_new_control_put
1058 * Purpose : new_control_put is called to pass data from user/application to
1059 * the driver.
1060 *
1061 *----------------------------------------------------------------------------
1062 */
1063static int m_control_put(struct snd_kcontrol *kcontrol,
1064 struct snd_ctl_elem_value *ucontrol)
1065{
1066 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
1067 struct aic3262_priv *aic3262 = snd_soc_codec_get_drvdata(codec);
1068
1069 u32 val;
1070 u8 val1;
1071 int mode = aic3262->process_flow;
1072
1073 DBG("n_control_put\n");
1074 val = ucontrol->value.integer.value[0];
1075 if (!strcmp(kcontrol->id.name, "Minidsp mode")) {
1076 DBG(KERN_INFO "\nMini dsp put\n mode = %d, val=%d\n",
1077 aic3262->process_flow, val);
1078 if (val != mode) {
1079 if (aic3262->mute_codec == 1) {
1080 i2c_verify_book0(codec);
1081 aic3262_change_book(codec, 0);
1082 boot_minidsp(codec, val);
1083
1084 aic3262_change_book(codec, 0);
1085 i2c_verify_book0(codec);
1086 /* update_kcontrols(codec, val);*/
1087 } else {
1088 printk(KERN_ERR
1089 " Cant Switch Processflows, Playback in progress");
1090 }
1091 }
1092 }
1093
1094 if (!strcmp(kcontrol->id.name, "DAC Adaptive mode Enable")) {
1095 DBG(KERN_INFO "\nMini dsp put\n mode = %d, val=%d\n",
1096 aic3262->process_flow, val);
1097 if (val != amode) {
1098 aic3262_change_book(codec, 80);
1099 val1 = i2c_smbus_read_byte_data(codec->control_data, 1);
1100 aic3262_write(codec, 1, (val1&0xfb)|(val<<1));
1101 aic3262_change_book(codec,0);
1102 }
1103 amode = val;
1104 }
1105
1106 if (!strcmp(kcontrol->id.name, "ADC Adaptive mode Enable")) {
1107 DBG(KERN_INFO "\nMini dsp put\n mode = %d, val=%d\n",
1108 aic3262->process_flow, val);
1109 if (val != dmode) {
1110 aic3262_change_book(codec, 40);
1111 val1 = i2c_smbus_read_byte_data(codec->control_data, 1);
1112 aic3262_write(codec, 1, (val1&0xfb)|(val<<1));
1113 aic3262_change_book(codec,0);
1114 }
1115 dmode = val;
1116 }
1117
1118 if (!strcmp(kcontrol->id.name, "Dump Regs Book0"))
1119 i2c_verify_book0(codec);
1120
1121#if 0
1122 if (!strcmp(kcontrol->id.name, "Verify minidsp program")) {
1123
1124 if (mode == 0) {
1125 DBG("Current mod=%d\nVerifying minidsp_D_regs", mode);
1126 byte_i2c_array_read(codec, main44_miniDSP_D_reg_values,
1127 (main44_miniDSP_D_reg_values_COEFF_SIZE +
1128 main44_miniDSP_D_reg_values_INST_SIZE));
1129 } else {
1130 byte_i2c_array_read(codec,
1131 Second_Rate_miniDSP_A_reg_values,
1132 (Second_Rate_miniDSP_A_reg_values_COEFF_SIZE +
1133 Second_Rate_miniDSP_A_reg_values_INST_SIZE));
1134 byte_i2c_array_read(codec,
1135 Second_Rate_miniDSP_D_reg_values,
1136 (Second_Rate_miniDSP_D_reg_values_COEFF_SIZE +
1137 Second_Rate_miniDSP_D_reg_values_INST_SIZE));
1138 }
1139 }
1140#endif
1141 DBG("\nmode = %d\n", mode);
1142 return mode;
1143}
1144
1145/************************** MUX CONTROL section *****************************/
1146/*
1147 *----------------------------------------------------------------------------
1148 * Function : __new_control_info_minidsp_mux
1149 * Purpose : info routine for mini dsp mux control amixer kcontrols
1150 *----------------------------------------------------------------------------
1151 */
1152static int __new_control_info_minidsp_mux(struct snd_kcontrol *kcontrol,
1153 struct snd_ctl_elem_info *uinfo)
1154{
1155 int index,index2;
1156 int ret_val = -1;
1157
1158
1159 for (index = 0; index < ARRAY_SIZE(main44_MUX_controls); index++) {
1160 if (strstr(kcontrol->id.name, main44_MUX_control_names[index]))
1161 break;
1162 }
1163 if (index < ARRAY_SIZE(main44_MUX_controls))
1164 {
1165 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
1166 uinfo->count = 1;
1167 uinfo->value.integer.min = MIN_MUX_CTRL;
1168 uinfo->value.integer.max = MAX_MUX_CTRL;
1169 ret_val = 0;
1170 }
1171
1172 #if 1
1173 else{
1174 printk(" The second rate kcontrol id name is====== %s\n",kcontrol->id.name);
1175
1176
1177 for (index2 = 0; index < ARRAY_SIZE(base_speaker_SRS_MUX_controls); index2++) {
1178 if (strstr(kcontrol->id.name, base_speaker_SRS_MUX_control_names[index2]))
1179 break;
1180 }
1181 if (index < ARRAY_SIZE(base_speaker_SRS_MUX_controls))
1182 {
1183 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
1184 uinfo->count = 1;
1185 uinfo->value.integer.min = MIN_MUX_CTRL;
1186 uinfo->value.integer.max = MAX_MUX_CTRL;
1187 ret_val = 0;
1188 }
1189 }
1190
1191 #endif
1192
1193 return ret_val;
1194}
1195
1196/*
1197 *----------------------------------------------------------------------------
1198 * Function : __new_control_get_minidsp_mux
1199 *
1200 * Purpose : get routine for mux control amixer kcontrols,
1201 * read current register values to user.
1202 * Used for for mini dsp 'MUX control' amixer controls.
1203 *----------------------------------------------------------------------------
1204 */
1205static int __new_control_get_minidsp_mux(struct snd_kcontrol *kcontrol,
1206 struct snd_ctl_elem_value *ucontrol)
1207{
1208
1209 ucontrol->value.integer.value[0] = kcontrol->private_value;
1210 return 0;
1211}
1212
1213/*
1214 *----------------------------------------------------------------------------
1215 * Function : __new_control_put_minidsp_mux
1216 *
1217 * Purpose : put routine for amixer kcontrols, write user values to registers
1218 * values. Used for for mini dsp 'MUX control' amixer controls.
1219 *----------------------------------------------------------------------------
1220 */
1221static int __new_control_put_minidsp_mux(struct snd_kcontrol *kcontrol,
1222 struct snd_ctl_elem_value *ucontrol)
1223{
1224 u8 data[MUX_CTRL_REG_SIZE + 1];
1225 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
1226 int index = 1;
1227 int user_value = ucontrol->value.integer.value[0];
1228 struct i2c_client *i2c;
1229 u8 value[2], swap_reg_pre, swap_reg_post;
1230 u8 page;
1231 int ret_val = -1, array_size;
1232 control *array;
1233 char **array_names;
1234 char *control_name, *control_name1, *control_name2;
1235 struct aic3262_priv *aic326x = snd_soc_codec_get_drvdata(codec);
1236 i2c = codec->control_data;
1237
1238
1239
1240 if (aic326x->process_flow == 0) {
1241 DBG("#the current process flow is %d", aic326x->process_flow);
1242 array = main44_MUX_controls;
1243 array_size = ARRAY_SIZE(main44_MUX_controls);
1244 array_names = main44_MUX_control_names;
1245 control_name = "Stereo_Mux_TwoToOne_1";
1246 control_name1 = "Mono_Mux_1_1";
1247 }
1248
1249#if 0
1250
1251 /* Configure only for process flow 1 controls */
1252 if (strcmp(kcontrol->id.name, control_name) &&
1253 strcmp(kcontrol->id.name, control_name1))
1254 return 0;
1255 } else {
1256 array = Second_Rate_MUX_controls;
1257 array_size = ARRAY_SIZE(Second_Rate_MUX_controls);
1258 array_names = Second_Rate_MUX_control_names;
1259 control_name = "Stereo_Mux_TwoToOne_1_Second";
1260 control_name1 = "Mono_Mux_1_Second";
1261 control_name2 = "Mono_Mux_4_Second";
1262
1263 /* Configure only for process flow 2 controls */
1264 if (strcmp(kcontrol->id.name, control_name1) &&
1265 strcmp(kcontrol->id.name, control_name2))
1266 return 0;
1267 }
1268
1269#endif
1270
1271 page = array[index].control_page;
1272
1273 DBG("#user value = 0x%x\n", user_value);
1274 for (index = 0; index < array_size; index++) {
1275 if (strstr(kcontrol->id.name, array_names[index]))
1276 break;
1277 }
1278 if (index < array_size) {
1279 DBG(KERN_INFO "#Index %d Changing to Page %d\n", index,
1280 array[index].control_page);
1281
1282 aic3262_change_book(codec,
1283 array[index].control_book);
1284 aic3262_change_page(codec,
1285 array[index].control_page);
1286
1287 if (!strcmp(array_names[index], control_name)) {
1288 if (user_value > 0) {
1289 data[1] = 0x00;
1290 data[2] = 0x00;
1291 data[3] = 0x00;
1292 } else {
1293 data[1] = 0xFF;
1294 data[2] = 0xFf;
1295 data[3] = 0xFF;
1296 }
1297 } else {
1298 if (user_value > 0) {
1299 data[1] =
1300 (u8) ((user_value >> 16) &
1301 AIC3262_8BITS_MASK);
1302 data[2] =
1303 (u8) ((user_value >> 8) &
1304 AIC3262_8BITS_MASK);
1305 data[3] =
1306 (u8)((user_value) & AIC3262_8BITS_MASK);
1307 }
1308 }
1309 /* start register address */
1310 data[0] = array[index].control_base;
1311
1312 DBG(KERN_INFO
1313 "#Writing %d %d %d \r\n", data[0], data[1], data[2]);
1314
1315 ret_val = i2c_master_send(i2c, data, MUX_CTRL_REG_SIZE + 1);
1316
1317 if (ret_val != MUX_CTRL_REG_SIZE + 1)
1318 printk(KERN_ERR "i2c_master_send transfer failed\n");
1319 else {
1320 /* store the current level */
1321 kcontrol->private_value = user_value;
1322 ret_val = 0;
1323 /* Enable adaptive filtering for ADC/DAC */
1324 }
1325
1326 /* Perform a BUFFER SWAP Command. Check if we are currently not
1327 * in Page 8, if so, swap to Page 8 first
1328 */
1329
1330 value[0] = 1;
1331
1332 if (i2c_master_send(i2c, value, 1) != 1)
1333 printk(KERN_ERR "Can not write register address\n");
1334
1335 /* Read the Value of the Page 8 Register 1 which controls the
1336 Adaptive Switching Mode */
1337 if (i2c_master_recv(i2c, value, 1) != 1)
1338 printk(KERN_ERR "Can not read codec registers\n");
1339
1340 swap_reg_pre = value[0];
1341 /* Write the Register bit updates */
1342 value[1] = value[0] | 1;
1343 value[0] = 1;
1344
1345 if (i2c_master_send(i2c, value, 2) != 2)
1346 printk(KERN_ERR "Can not write register address\n");
1347
1348 value[0] = 1;
1349 /* verify buffer swap */
1350 if (i2c_master_send(i2c, value, 1) != 1)
1351 printk(KERN_ERR "Can not write register address\n");
1352
1353 /* Read the Value of the Page 8 Register 1 which controls the
1354 Adaptive Switching Mode */
1355 if (i2c_master_recv(i2c, &swap_reg_post, 1) != 1)
1356 printk(KERN_ERR "Can not read codec registers\n");
1357
1358 if ((swap_reg_pre == 4 && swap_reg_post == 6)
1359 || (swap_reg_pre == 6 && swap_reg_post == 4))
1360 DBG("Buffer swap success\n");
1361 else
1362 printk(KERN_ERR
1363 "Buffer swap...FAILED\nswap_reg_pre=%x, \
1364 swap_reg_post=%x\n", swap_reg_pre, swap_reg_post);
1365
1366 }
1367 /* update the new buffer value in the old, just swapped out buffer */
1368 aic3262_change_book(codec, array[index].control_book);
1369 aic3262_change_page(codec, array[index].control_page);
1370 ret_val = i2c_master_send(i2c, data, MUX_CTRL_REG_SIZE + 1);
1371 ret_val = 0;
1372
1373 aic3262_change_book(codec, 0);
1374 return ret_val;
1375}
1376
1377/*
1378 *----------------------------------------------------------------------------
1379 * Function : minidsp_mux_ctrl_mixer_controls
1380 *
1381 * Purpose : Add amixer kcontrols for mini dsp mux controls,
1382 *----------------------------------------------------------------------------
1383 */
1384static int minidsp_mux_ctrl_mixer_controls(struct snd_soc_codec *codec,
1385 int size, control *cntl,
1386 char **name)
1387{
1388 int i, err;
1389 int val1;
1390
1391 printk("%d mixer controls for mini dsp MUX\n", size);
1392 if (size) {
1393 for (i = 0; i < size; i++) {
1394
1395 snd_mux_controls[i].name = name[i];
1396 snd_mux_controls[i].iface = SNDRV_CTL_ELEM_IFACE_MIXER;
1397 snd_mux_controls[i].access =
1398 SNDRV_CTL_ELEM_ACCESS_READWRITE;
1399 snd_mux_controls[i].info =
1400 __new_control_info_minidsp_mux;
1401 snd_mux_controls[i].get = __new_control_get_minidsp_mux;
1402 snd_mux_controls[i].put = __new_control_put_minidsp_mux;
1403 /*
1404 * TBD: read volume reg and update the index number
1405 */
1406 aic3262_change_book(codec, cntl[i].control_book);
1407 aic3262_change_page(codec, cntl[i].control_page);
1408 val1 = i2c_smbus_read_byte_data(codec->control_data,
1409 cntl[i].control_base);
1410 DBG(KERN_INFO "Control data %x\n", val1);
1411 /*
1412 if( val1 >= 0 )
1413 snd_mux_controls[i].private_value = val1;
1414 else
1415 snd_mux_controls[i].private_value = 0;
1416 */
1417 DBG(KERN_INFO
1418 "the value of amixer control mux=%d", val1);
1419 if (val1 >= 0 && val1 != 255)
1420 snd_mux_controls[i].private_value = val1;
1421 else
1422 snd_mux_controls[i].private_value = 0;
1423
1424 snd_mux_controls[i].count = 0;
1425
1426 err = snd_ctl_add(codec->card->snd_card,
1427 snd_ctl_new1(&snd_mux_controls[i],
1428 codec));
1429 if (err < 0)
1430 printk(KERN_ERR
1431 "%s:Invalid control %s\n", __FILE__,
1432 snd_mux_controls[i].name);
1433 }
1434 }
1435 return 0;
1436}
1437
1438/*------------------------- Volume Controls -----------------------*/
1439static int volume_lite_table[] = {
1440
1441 0x00000D, 0x00000E, 0x00000E, 0x00000F,
1442 0x000010, 0x000011, 0x000012, 0x000013,
1443 0x000015, 0x000016, 0x000017, 0x000018,
1444 0x00001A, 0x00001C, 0x00001D, 0x00001F,
1445 0x000021, 0x000023, 0x000025, 0x000027,
1446 0x000029, 0x00002C, 0x00002F, 0x000031,
1447 0x000034, 0x000037, 0x00003B, 0x00003E,
1448 0x000042, 0x000046, 0x00004A, 0x00004F,
1449 0x000053, 0x000058, 0x00005D, 0x000063,
1450 0x000069, 0x00006F, 0x000076, 0x00007D,
1451 0x000084, 0x00008C, 0x000094, 0x00009D,
1452 0x0000A6, 0x0000B0, 0x0000BB, 0x0000C6,
1453 0x0000D2, 0x0000DE, 0x0000EB, 0x0000F9,
1454 0x000108, 0x000118, 0x000128, 0x00013A,
1455 0x00014D, 0x000160, 0x000175, 0x00018B,
1456 0x0001A3, 0x0001BC, 0x0001D6, 0x0001F2,
1457 0x000210, 0x00022F, 0x000250, 0x000273,
1458 0x000298, 0x0002C0, 0x0002E9, 0x000316,
1459 0x000344, 0x000376, 0x0003AA, 0x0003E2,
1460 0x00041D, 0x00045B, 0x00049E, 0x0004E4,
1461 0x00052E, 0x00057C, 0x0005D0, 0x000628,
1462 0x000685, 0x0006E8, 0x000751, 0x0007C0,
1463 0x000836, 0x0008B2, 0x000936, 0x0009C2,
1464 0x000A56, 0x000AF3, 0x000B99, 0x000C49,
1465 0x000D03, 0x000DC9, 0x000E9A, 0x000F77,
1466 0x001062, 0x00115A, 0x001262, 0x001378,
1467 0x0014A0, 0x0015D9, 0x001724, 0x001883,
1468 0x0019F7, 0x001B81, 0x001D22, 0x001EDC,
1469 0x0020B0, 0x0022A0, 0x0024AD, 0x0026DA,
1470 0x002927, 0x002B97, 0x002E2D, 0x0030E9,
1471 0x0033CF, 0x0036E1, 0x003A21, 0x003D93,
1472 0x004139, 0x004517, 0x00492F, 0x004D85,
1473 0x00521D, 0x0056FA, 0x005C22, 0x006197,
1474 0x006760, 0x006D80, 0x0073FD, 0x007ADC,
1475 0x008224, 0x0089DA, 0x009205, 0x009AAC,
1476 0x00A3D7, 0x00B7D4, 0x00AD8C, 0x00C2B9,
1477 0x00CE43, 0x00DA7B, 0x00E76E, 0x00F524,
1478 0x0103AB, 0x01130E, 0x01235A, 0x01349D,
1479 0x0146E7, 0x015A46, 0x016ECA, 0x018486,
1480 0x019B8C, 0x01B3EE, 0x01CDC3, 0x01E920,
1481 0x02061B, 0x0224CE, 0x024553, 0x0267C5,
1482 0x028C42, 0x02B2E8, 0x02DBD8, 0x030736,
1483 0x033525, 0x0365CD, 0x039957, 0x03CFEE,
1484 0x0409C2, 0x044703, 0x0487E5, 0x04CCA0,
1485 0x05156D, 0x05628A, 0x05B439, 0x060ABF,
1486 0x066666, 0x06C77B, 0x072E50, 0x079B3D,
1487 0x080E9F, 0x0888D7, 0x090A4D, 0x09936E,
1488 0x0A24B0, 0x0ABE8D, 0x0B6188, 0x0C0E2B,
1489 0x0CC509, 0x0D86BD, 0x0E53EB, 0x0F2D42,
1490 0x101379, 0x110754, 0x1209A3, 0x131B40,
1491 0x143D13, 0x157012, 0x16B543, 0x180DB8,
1492 0x197A96, 0x1AFD13, 0x1C9676, 0x1E481C,
1493 0x201373, 0x21FA02, 0x23FD66, 0x261F54,
1494 0x28619A, 0x2AC625, 0x2D4EFB, 0x2FFE44,
1495 0x32D646, 0x35D96B, 0x390A41, 0x3C6B7E,
1496 0x400000, 0x43CAD0, 0x47CF26, 0x4C106B,
1497 0x50923B, 0x55586A, 0x5A6703, 0x5FC253,
1498 0x656EE3, 0x6B7186, 0x71CF54, 0x788DB4,
1499 0x7FB260,
1500};
1501
1502static struct snd_kcontrol_new snd_vol_controls[MAX_VOLUME_CONTROLS];
1503/*
1504 *----------------------------------------------------------------------------
1505 * Function : __new_control_info_main44_minidsp_volume
1506 * Purpose : info routine for volumeLite amixer kcontrols
1507 *----------------------------------------------------------------------------
1508 */
1509
1510static int
1511__new_control_info_minidsp_volume(struct snd_kcontrol *kcontrol,
1512 struct snd_ctl_elem_info *uinfo)
1513{
1514 int index, index8;
1515 int ret_val = -1;
1516
1517 for (index = 0; index < ARRAY_SIZE(main44_VOLUME_controls); index++) {
1518 if (strstr
1519 (kcontrol->id.name, main44_VOLUME_control_names[index]))
1520 break;
1521 }
1522
1523 for (index8 = 0; index8 < ARRAY_SIZE(base_speaker_SRS_VOLUME_controls);
1524 index8++) {
1525 if (strstr
1526 (kcontrol->id.name,
1527 base_speaker_SRS_VOLUME_control_names[index]))
1528 break;
1529 }
1530
1531 if ((index < ARRAY_SIZE(main44_VOLUME_controls))
1532
1533 || (index8 < ARRAY_SIZE(base_speaker_SRS_VOLUME_controls))) {
1534 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
1535 uinfo->count = 1;
1536 uinfo->value.integer.min = MIN_VOLUME;
1537 uinfo->value.integer.max = MAX_VOLUME;
1538 ret_val = 0;
1539 }
1540 return ret_val;
1541}
1542
1543/*
1544 *----------------------------------------------------------------------------
1545 * Function : __new_control_get_main44_minidsp_vol
1546 * Purpose : get routine for amixer kcontrols, read current register
1547 * values. Used for for mini dsp 'VolumeLite' amixer controls.
1548 *----------------------------------------------------------------------------
1549 */
1550static int
1551__new_control_get_minidsp_volume(struct snd_kcontrol *kcontrol,
1552 struct snd_ctl_elem_value *ucontrol)
1553{
1554 ucontrol->value.integer.value[0] = kcontrol->private_value;
1555 return 0;
1556}
1557
1558/*
1559 *----------------------------------------------------------------------------
1560 * Function : __new_control_put_main44_minidsp_volume
1561 * Purpose : put routine for amixer kcontrols, write user values to registers
1562 * values. Used for for mini dsp 'VolumeLite' amixer controls.
1563 *----------------------------------------------------------------------------
1564 */
1565static int
1566__new_control_put_minidsp_volume(struct snd_kcontrol *kcontrol,
1567 struct snd_ctl_elem_value *ucontrol)
1568{
1569 u8 data[4];
1570 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
1571 int user_value = ucontrol->value.integer.value[0];
1572 struct i2c_client *i2c = codec->control_data;
1573 int ret_val = -1;
1574 int coeff;
1575 u8 value[2], swap_reg_pre, swap_reg_post;
1576 struct aic3262_priv *aic3262 = snd_soc_codec_get_drvdata(codec);
1577
1578 control *volume_controls = NULL;
1579 printk(KERN_INFO "user value = 0x%x\n", user_value);
1580
1581 if (aic3262->process_flow == 0)
1582 volume_controls = main44_VOLUME_controls;
1583
1584 else
1585 volume_controls = base_speaker_SRS_VOLUME_controls;
1586
1587
1588 aic3262_change_book(codec, volume_controls->control_book);
1589 aic3262_change_page(codec, volume_controls->control_page);
1590
1591 coeff = volume_lite_table[user_value << 1];
1592
1593 data[1] = (u8) ((coeff >> 16) & AIC3262_8BITS_MASK);
1594 data[2] = (u8) ((coeff >> 8) & AIC3262_8BITS_MASK);
1595 data[3] = (u8) ((coeff) & AIC3262_8BITS_MASK);
1596
1597 /* Start register address */
1598 data[0] = volume_controls->control_base;
1599 ret_val = i2c_master_send(i2c, data, VOLUME_REG_SIZE + 1);
1600 if (ret_val != VOLUME_REG_SIZE + 1)
1601 printk(KERN_ERR "i2c_master_send transfer failed\n");
1602 else {
1603 /* store the current level */
1604 kcontrol->private_value = user_value;
1605 ret_val = 0;
1606 }
1607 /* Initiate buffer swap */
1608 value[0] = 1;
1609
1610 if (i2c_master_send(i2c, value, 1) != 1)
1611 printk(KERN_ERR "Can not write register address\n");
1612
1613 /* Read the Value of the Page 8 Register 1 which controls the
1614 Adaptive Switching Mode */
1615 if (i2c_master_recv(i2c, value, 1) != 1)
1616 printk(KERN_ERR "Can not read codec registers\n");
1617
1618 swap_reg_pre = value[0];
1619 /* Write the Register bit updates */
1620 value[1] = value[0] | 1;
1621 value[0] = 1;
1622 if (i2c_master_send(i2c, value, 2) != 2)
1623 printk(KERN_ERR "Can not write register address\n");
1624
1625 value[0] = 1;
1626 /* verify buffer swap */
1627 if (i2c_master_send(i2c, value, 1) != 1)
1628 printk(KERN_ERR "Can not write register address\n");
1629
1630 /* Read the Value of the Page 8 Register 1 which controls the
1631 Adaptive Switching Mode */
1632 if (i2c_master_recv(i2c, &swap_reg_post, 1) != 1)
1633 printk(KERN_ERR "Can not read codec registers\n");
1634
1635 if ((swap_reg_pre == 4 && swap_reg_post == 6)
1636 || (swap_reg_pre == 6 && swap_reg_post == 4))
1637 DBG("Buffer swap success\n");
1638 else
1639 DBG("Buffer swap...FAILED\nswap_reg_pre=%x, swap_reg_post=%x\n",
1640 swap_reg_pre, swap_reg_post);
1641
1642 /* update the new buffer value in the old, just swapped out buffer */
1643 aic3262_change_book(codec, volume_controls->control_book);
1644 aic3262_change_page(codec, volume_controls->control_page);
1645 i2c_master_send(i2c, data, MUX_CTRL_REG_SIZE + 1);
1646
1647 aic3262_change_book(codec, 0);
1648
1649 return 0;
1650}
1651
1652/*
1653 *----------------------------------------------------------------------------
1654 * Function : minidsp_volume_main44_mixer_controls
1655 * Purpose : Add amixer kcontrols for mini dsp volume Lite controls,
1656 *----------------------------------------------------------------------------
1657 */
1658static int minidsp_volume_mixer_controls(struct snd_soc_codec *codec)
1659{
1660 int i, err, no_volume_controls;
1661 static char volume_control_name[MAX_VOLUME_CONTROLS][40];
1662
1663 /* ADD first process volume controls */
1664 no_volume_controls = ARRAY_SIZE(main44_VOLUME_controls);
1665
1666 printk(KERN_INFO " %d mixer controls for mini dsp 'volumeLite'\n",
1667 no_volume_controls);
1668
1669 if (no_volume_controls) {
1670
1671 for (i = 0; i < no_volume_controls; i++) {
1672 strcpy(volume_control_name[i],
1673 main44_VOLUME_control_names[i]);
1674 strcat(volume_control_name[i], VOLUME_KCONTROL_NAME);
1675
1676 printk(KERN_ERR "Volume controls: %s\n",
1677 volume_control_name[i]);
1678
1679 snd_vol_controls[i].name = volume_control_name[i];
1680 snd_vol_controls[i].iface = SNDRV_CTL_ELEM_IFACE_MIXER;
1681 snd_vol_controls[i].access =
1682 SNDRV_CTL_ELEM_ACCESS_READWRITE;
1683 snd_vol_controls[i].info =
1684 __new_control_info_minidsp_volume;
1685 snd_vol_controls[i].get =
1686 __new_control_get_minidsp_volume;
1687 snd_vol_controls[i].put =
1688 __new_control_put_minidsp_volume;
1689 /*
1690 * TBD: read volume reg and update the index number
1691 */
1692 snd_vol_controls[i].private_value = 0;
1693 snd_vol_controls[i].count = 0;
1694
1695 err = snd_ctl_add(codec->card->snd_card,
1696 snd_ctl_new1(&snd_vol_controls[i],
1697 codec));
1698 if (err < 0) {
1699 printk(KERN_ERR
1700 "%s:Invalid control %s\n", __FILE__,
1701 snd_vol_controls[i].name);
1702 }
1703 }
1704 }
1705
1706
1707 /* ADD second process volume controls */
1708 no_volume_controls = ARRAY_SIZE(base_speaker_SRS_VOLUME_controls);
1709
1710 printk(KERN_ERR " %d mixer controls for mini dsp 'volumeLite'\n",
1711 no_volume_controls);
1712
1713 if (no_volume_controls) {
1714
1715 for (i = 0; i < no_volume_controls; i++) {
1716 strcpy(volume_control_name[i],
1717 base_speaker_SRS_VOLUME_control_names[i]);
1718 strcat(volume_control_name[i], VOLUME_KCONTROL_NAME);
1719
1720 printk(KERN_ERR "Volume controls: %s\n",
1721 volume_control_name[i]);
1722
1723 snd_vol_controls[i].name = volume_control_name[i];
1724 snd_vol_controls[i].iface = SNDRV_CTL_ELEM_IFACE_MIXER;
1725 snd_vol_controls[i].access =
1726 SNDRV_CTL_ELEM_ACCESS_READWRITE;
1727 snd_vol_controls[i].info =
1728 __new_control_info_minidsp_volume;
1729 snd_vol_controls[i].get =
1730 __new_control_get_minidsp_volume;
1731 snd_vol_controls[i].put =
1732 __new_control_put_minidsp_volume;
1733 /*
1734 * TBD: read volume reg and update the index number
1735 */
1736 snd_vol_controls[i].private_value = 0;
1737 snd_vol_controls[i].count = 0;
1738
1739 err = snd_ctl_add(codec->card->snd_card,
1740 snd_ctl_new1(&snd_vol_controls[i],
1741 codec));
1742 if (err < 0) {
1743 printk(KERN_ERR
1744 "%s:Invalid control %s\n", __FILE__,
1745 snd_vol_controls[i].name);
1746 }
1747 }
1748 }
1749
1750 return 0;
1751}
1752
1753/*
1754 *--------------------------------------------------------------------------
1755 * Function : aic3262_add_minidsp_controls
1756 * Purpose : Configures the AMIXER Control Interfaces that can be exercised by
1757 * the user at run-time. Utilizes the the snd_adaptive_controls[]
1758 * array to specify two run-time controls.
1759 *---------------------------------------------------------------------------
1760 */
1761int aic3262_add_minidsp_controls(struct snd_soc_codec *codec)
1762{
1763#ifdef ADD_MINI_DSP_CONTROLS
1764 int i, err, no_mux_controls,no_mux_controls1;
1765 /* add mode k control */
1766 for (i = 0; i < ARRAY_SIZE(aic3262_minidsp_controls); i++) {
1767 err = snd_ctl_add(codec->card->snd_card,
1768 snd_ctl_new1(&aic3262_minidsp_controls[i], codec));
1769 if (err < 0) {
1770 printk(KERN_ERR "Invalid control\n");
1771 return err;
1772 }
1773 }
1774
1775
1776 /* add mux controls */
1777 no_mux_controls = ARRAY_SIZE(main44_MUX_controls);
1778 minidsp_mux_ctrl_mixer_controls(codec, no_mux_controls,
1779 main44_MUX_controls, main44_MUX_control_names);
1780
1781
1782 no_mux_controls1 = ARRAY_SIZE(base_speaker_SRS_MUX_controls);
1783 minidsp_mux_ctrl_mixer_controls(codec, no_mux_controls1,
1784 base_speaker_SRS_MUX_controls, base_speaker_SRS_MUX_control_names);
1785
1786
1787 /* add volume controls*/
1788 minidsp_volume_mixer_controls(codec);
1789#endif /* ADD_MINI_DSP_CONTROLS */
1790 return 0;
1791}
1792
1793MODULE_DESCRIPTION("ASoC TLV320AIC3262 miniDSP driver");
1794MODULE_AUTHOR("Y Preetam Sashank Reddy <preetam@mistralsolutions.com>");
1795MODULE_LICENSE("GPL");
1796#endif /* End of CONFIG_MINI_DSP */
diff --git a/sound/soc/codecs/tlv320aic326x_mini-dsp.h b/sound/soc/codecs/tlv320aic326x_mini-dsp.h
new file mode 100644
index 00000000000..bebb12fa680
--- /dev/null
+++ b/sound/soc/codecs/tlv320aic326x_mini-dsp.h
@@ -0,0 +1,128 @@
1/*
2 * linux/sound/soc/codecs/tlv320aic3262_mini-dsp.h
3 *
4 *
5 * Copyright (C) 2011 Texas Instruments, Inc.
6 *
7 *
8 * This package is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
13 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
14 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
15 *
16 * History:
17 * Rev 0.1 Added the multiconfig support 17-08-2011
18 *
19 * Rev 0.2 Migrated for aic3262 nVidia
20 * 21-10-2011
21 */
22
23#ifndef _TLV320AIC3262_MINI_DSP_H
24#define _TLV320AIC3262_MINI_DSP_H
25
26/* defines */
27
28#define MAXCONFIG 4
29
30//#define DEBUG_MINIDSP_LOADING
31
32/* Select the functionalities to be used in mini dsp module */
33#define PROGRAM_MINI_DSP_first
34//#define PROGRAM_MINI_DSP_second
35#define PROGRAM_CODEC_REG_SECTIONS
36#define ADD_MINI_DSP_CONTROLS
37
38/* use the following macros to select between burst and byte mode of i2c
39 * Byte mode uses standard read & write as provides debugging information if enabled
40 * if enabled.
41 * Multibyte should be used for production codes where performance is priority
42 */
43//#define MULTIBYTE_I2C
44#undef MULTIBYTE_I2C
45
46typedef struct {
47 u8 reg_off;
48 u8 reg_val;
49} reg_value;
50
51/*CONTROL LOCATIONS*/
52typedef struct {
53 u8 control_book; /*coefficient book location*/
54 u8 control_page; /*coefficient page location*/
55 u8 control_base; /*coefficient base address within page*/
56 u8 control_mute_flag; /*non-zero means muting required*/
57 u8 control_string_index; /*string table index*/
58} control;
59
60/* volume ranges from -110db to 6db
61 * amixer controls does not accept negative values
62 * Therefore we are normalizing values to start from value 0
63 * value 0 corresponds to -110db and 116 to 6db
64 */
65#define MAX_VOLUME_CONTROLS 2
66#define MIN_VOLUME 0
67#define MAX_VOLUME 116
68#define VOLUME_REG_SIZE 3 /* 3 bytes */
69#define VOLUME_KCONTROL_NAME "(0=-110dB, 116=+6dB)"
70
71#define FILT_CTL_NAME_ADC "ADC adaptive filter(0=Disable, 1=Enable)"
72#define FILT_CTL_NAME_DAC "DAC adaptive filter(0=Disable, 1=Enable)"
73#define COEFF_CTL_NAME_ADC "ADC coeff Buffer(0=Buffer A, 1=Buffer B)"
74#define COEFF_CTL_NAME_DAC "DAC coeff Buffer(0=Buffer A, 1=Buffer B)"
75
76#define BUFFER_PAGE_ADC 0x8
77#define BUFFER_PAGE_DAC 0x2c
78
79#define ADAPTIVE_MAX_CONTROLS 4
80
81/*
82 * MUX controls, 3 bytes of control data.
83 */
84#define MAX_MUX_CONTROLS 2
85#define MIN_MUX_CTRL 0
86#define MAX_MUX_CTRL 2
87#define MUX_CTRL_REG_SIZE 3 /* 3 bytes */
88
89#define MINIDSP_PARSING_START 0
90#define MINIDSP_PARSING_END (-1)
91
92#define CODEC_REG_DONT_IGNORE 0
93#define CODEC_REG_IGNORE 1
94
95#define CODEC_REG_PRE_INIT 0
96#define CODEC_REG_POST_INIT 1
97#define INIT_SEQ_DELIMITER 255 /* Delimiter register */
98#define DELIMITER_COUNT 2 /* 2 delimiter entries */
99
100/* Parser info structure */
101typedef struct {
102 char page_num;
103 char burst_array[129];
104 int burst_size;
105 int current_loc;
106 int book_change;CONFIG_MINI_DSP
107 u8 book_no;
108} minidsp_parser_data;
109
110/* I2c Page Change Structure */
111typedef struct {
112 char burst_array[4];
113} minidsp_i2c_page;
114
115/* This macro defines the total size of the miniDSP parser arrays
116 * that the driver will maintain as a data backup.
117 * The total memory requirement will be around
118 * sizeof(minidsp_parser_data) * 48 = 138 * 32 = 4416 bytes
119 */
120#define MINIDSP_PARSER_ARRAY_SIZE 200
121
122extern int
123minidsp_i2c_multibyte_transfer(struct snd_soc_codec *, reg_value *, int);
124extern int byte_i2c_array_transfer(struct snd_soc_codec *, reg_value *, int);
125extern void minidsp_multiconfig(struct snd_soc_codec *,reg_value *, int ,reg_value *, int );
126extern int reg_def_conf(struct snd_soc_codec *);
127
128#endif
diff --git a/sound/soc/codecs/tlv320aic326x_minidsp_config.c b/sound/soc/codecs/tlv320aic326x_minidsp_config.c
new file mode 100644
index 00000000000..e34ffbe2ca8
--- /dev/null
+++ b/sound/soc/codecs/tlv320aic326x_minidsp_config.c
@@ -0,0 +1,495 @@
1/*
2 * linux/sound/soc/codecs/tlv320aic326x_minidsp_config.c
3 *
4 * Copyright (C) 2012 Texas Instruments, Inc.
5 *
6 * This package is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
11 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
12 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13 *
14 * The TLV320AIC3262 is a flexible, low-power, low-voltage stereo audio
15 * codec with digital microphone inputs and programmable outputs.
16 *
17 * History:
18 *
19 * Rev 0.1 Added the multiconfig support 17-08-2011
20 *
21 * Rev 0.2 Migrated for aic3262 nVidia
22 * 21-10-2011
23 */
24
25/*
26 *****************************************************************************
27 * INCLUDES
28 *****************************************************************************
29 */
30#include <linux/module.h>
31#include <linux/moduleparam.h>
32#include <linux/init.h>
33#include <linux/kernel.h>
34#include <linux/fs.h>
35#include <linux/types.h>
36#include <linux/kdev_t.h>
37#include <linux/cdev.h>
38#include <linux/device.h>
39#include <linux/io.h>
40#include <linux/delay.h>
41#include <linux/i2c.h>
42#include <linux/platform_device.h>
43#include <sound/soc.h>
44#include <sound/core.h>
45#include <sound/soc-dapm.h>
46#include <sound/control.h>
47#include <linux/time.h> /* For timing computations */
48#include "tlv320aic326x.h"
49#include "tlv320aic326x_mini-dsp.h"
50
51#if 0
52#include "Patch_base_jazz_Rate48_pps_driver.h"
53#include "Patch_base_main_Rate48_pps_driver.h"
54#include "Patch_base_pop_Rate48_pps_driver.h"
55#include "Patch_base_rock_Rate48_pps_driver.h"
56#endif
57
58#ifdef CONFIG_MINI_DSP
59
60#define MAX_CONFIG_D_ARRAYS 4
61#define MAX_CONFIG_A_ARRAYS 0
62#define MAX_CONFIG_ARRAYS 4
63#define MINIDSP_DMODE 0
64#define MINIDSP_AMODE 1
65
66/*
67 *****************************************************************************
68 * LOCAL STATIC DECLARATIONS
69 *****************************************************************************
70 */
71static int multibyte_coeff_change(struct snd_soc_codec *codec, int);
72
73static int m_control_get(struct snd_kcontrol *kcontrol,
74 struct snd_ctl_elem_value *ucontrol);
75static int m_control_put(struct snd_kcontrol *kcontrol,
76 struct snd_ctl_elem_value *ucontrol);
77
78/* k-control macros used for miniDSP related Kcontrols */
79#define SOC_SINGLE_VALUE_M(xmax, xinvert) \
80 ((unsigned long)&(struct soc_mixer_control) \
81 {.max = xmax, \
82 .invert = xinvert})
83#define SOC_SINGLE_M(xname, max, invert) \
84{\
85 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
86 .info = m_control_info, .get = m_control_get,\
87 .put = m_control_put, \
88 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
89 .private_value = SOC_SINGLE_VALUE_M(max, invert) }
90#define SOC_SINGLE_AIC3262_M(xname) \
91{\
92 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
93 .info = m_control_info, .get = m_control_get,\
94 .put = m_control_put, \
95 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
96}
97
98
99/* The Multi-Configurations generated through PPS GDE has been
100 * named as Rock, Pop, Jazz and Main. These were the Configurations
101 * that were used while testing this AUdio Driver. If the user
102 * creates Process-flow with different names, it is advised to
103 * modify the names present in the below array.
104 */
105static const char *multi_config_support_DAC[] = {
106 "ROCK",
107 "POP",
108 "JAZZ",
109 "MAIN",
110};
111
112/* SOC_ENUM Declaration and kControl for switching Configurations
113 * at run-time.
114 */
115static const struct soc_enum aic3262_enum =
116 SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(multi_config_support_DAC),
117 multi_config_support_DAC);
118
119static const struct snd_kcontrol_new aic3262_minidsp_controls1[] = {
120
121 SOC_ENUM_EXT("Multiconfig support for DAC",
122 aic3262_enum, m_control_get, m_control_put),
123
124};
125
126
127/*
128 * multibyte_config
129 *
130 * This structure has been devised to maintain information about each
131 * configuration provided with the PPS GDE Processflow. For each
132 * configuration, the Driver needs to know where the starting offset
133 * of the Coefficient change, Total Size of Coefficients being affected,
134 * and the Instruction Sizes.
135 * This has to be replicated for both miniDSP_A and miniDSP_D
136 */
137
138#if 0
139struct multibyte_config {
140 reg_value *regs;
141 unsigned int d_coeff_start;
142 unsigned int d_coeff_size;
143 unsigned int d_inst_start;
144 unsigned int d_inst_size;
145 unsigned int a_coeff_start;
146 unsigned int a_coeff_size;
147 unsigned int a_inst_start;
148 unsigned int a_inst_size;
149} config_array[][2][MAX_CONFIG_ARRAYS] = {
150 /* Process flow 1 */
151 {
152 {
153 /* DAC */
154 {rock_D_reg_values, 0, 67, 67, 0, 0, 0, 0, 0},
155 {pop_D_reg_values, 0, 67, 67, 0, 0, 0, 0, 0},
156 {jazz_D_reg_values, 0, 67, 67, 0, 0, 0, 0, 0},
157 {main_D_reg_values, 0, 67, 67, 0, 0, 0, 0, 0},
158 },
159 /* ADC */
160 {},
161 },
162
163 /* Process flow 2 */
164 {
165#if 0
166 {
167 {main, 0, 0, 0, 0, 0, 0, 0, 0},
168 {pop, 0, 0, 0, 0, 0, 0, 0, 0},
169 {jazz, 0, 0, 0, 0, 0, 0, 0, 0},
170 {rock, 0, 0, 0, 0, 0, 0, 0, 0},
171 },
172 /* ADC */
173 {},
174#endif
175 },
176};
177
178#else
179struct multibyte_config {
180 reg_value *regs;
181 unsigned int d_coeff_start;
182 unsigned int d_coeff_size;
183 unsigned int d_inst_start;
184 unsigned int d_inst_size;
185 unsigned int a_coeff_start;
186 unsigned int a_coeff_size;
187 unsigned int a_inst_start;
188 unsigned int a_inst_size;
189} config_array[][2][MAX_CONFIG_ARRAYS] = {
190 /* Process flow 1 */
191 {
192 {
193 /* DAC */
194 {},
195 },
196 /* ADC */
197 {},
198 },
199
200 /* Process flow 2 */
201 {
202#if 0
203 {
204 {main, 0, 0, 0, 0, 0, 0, 0, 0},
205 {pop, 0, 0, 0, 0, 0, 0, 0, 0},
206 {jazz, 0, 0, 0, 0, 0, 0, 0, 0},
207 {rock, 0, 0, 0, 0, 0, 0, 0, 0},
208 },
209 /* ADC */
210 {},
211#endif
212 },
213};
214#endif
215
216/*
217 *----------------------------------------------------------------------------
218 * Function : m_control_get
219 * Purpose : This function is to read data of new control for
220 * program the AIC3262 registers.
221 *
222 *----------------------------------------------------------------------------
223 */
224static int m_control_get(struct snd_kcontrol *kcontrol,
225 struct snd_ctl_elem_value *ucontrol)
226{
227
228 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
229 struct aic3262_priv *aic326x = snd_soc_codec_get_drvdata(codec);
230 u32 val = 0;
231 u32 mode = aic326x->process_flow;
232
233
234 if (!strcmp(kcontrol->id.name, "Multiconfig support for DAC"))
235 val = aic326x->current_dac_config[mode];
236 else if (!strcmp(kcontrol->id.name, "Multiconfig support for ADC"))
237 val = aic326x->current_adc_config[mode];
238
239
240 ucontrol->value.integer.value[0] = val;
241 return 0;
242}
243
244/*
245 *----------------------------------------------------------------------------
246 * Function : m_new_control_put
247 * Purpose : new_control_put is called to pass data from user/application to
248 * the driver.
249 *
250 *----------------------------------------------------------------------------
251 */
252static int m_control_put(struct snd_kcontrol *kcontrol,
253 struct snd_ctl_elem_value *ucontrol)
254{
255 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
256 struct aic3262_priv *aic326x = snd_soc_codec_get_drvdata(codec);
257 u32 val;
258 u8 value;
259 int pf = aic326x->process_flow;
260 struct multibyte_config *array;
261
262 val = ucontrol->value.integer.value[0];
263 if (!strcmp(kcontrol->id.name, "Multiconfig support for DAC")) {
264 if (aic326x->process_flow == MINIDSP_DMODE) {
265 if (val > MAX_CONFIG_D_ARRAYS) {
266 dev_err(codec->dev, "Value not in range\n");
267 return -1;
268 }
269
270 value = aic3262_read(codec, ADC_CHANNEL_POW);
271 value = aic3262_read(codec, PASI_DAC_DP_SETUP);
272
273 array = &config_array[pf][MINIDSP_DMODE][val];
274 minidsp_i2c_multibyte_transfer(codec,
275 array->regs,
276 (array->d_inst_size + array->d_coeff_size));
277
278
279 /*coefficent buffer change*/
280 multibyte_coeff_change(codec, 0x50);
281
282 minidsp_i2c_multibyte_transfer(codec,
283 array->regs,
284 (array->d_inst_size + array->d_coeff_size));
285
286
287
288 value = aic3262_read(codec, ADC_CHANNEL_POW);
289 value = aic3262_read(codec, PASI_DAC_DP_SETUP);
290 }
291 aic326x->current_dac_config[pf] = val;
292
293 } else {
294 if (aic326x->process_flow == MINIDSP_AMODE) {
295 if (val > MAX_CONFIG_A_ARRAYS) {
296 dev_err(codec->dev, "Value not in range\n");
297 return -1;
298 }
299 array = &config_array[pf][MINIDSP_AMODE][val];
300 minidsp_i2c_multibyte_transfer(codec,
301 array->regs,
302 (array->a_inst_size + array->a_coeff_size));
303 }
304 aic326x->current_adc_config[pf] = val;
305 }
306 return val;
307}
308
309
310/*
311 *--------------------------------------------------------------------------
312 * Function : aic3262_add_multiconfig_controls
313 * Purpose : Configures the AMIXER Control Interfaces that can be exercised by
314 * the user at run-time. Utilizes the the snd_adaptive_controls[]
315 * array to specify two run-time controls.
316 *---------------------------------------------------------------------------
317 */
318int aic3262_add_multiconfig_controls(struct snd_soc_codec *codec)
319{
320 int i, err;
321
322 DBG(KERN_INFO
323 "#%s: Invoked to add controls for Multi-Configuration\n",
324 __func__);
325
326 /* add mode k control */
327 for (i = 0; i < ARRAY_SIZE(aic3262_minidsp_controls1); i++) {
328 err = snd_ctl_add(codec->card->snd_card,
329 snd_ctl_new1(&aic3262_minidsp_controls1[i],
330 codec));
331 if (err < 0) {
332 printk(KERN_ERR
333 "Cannot add controls for mulibyte configuration\n");
334 return err;
335 }
336 }
337 DBG(KERN_INFO "#%s: Completed control addition.\n", __func__);
338 return 0;
339}
340
341/*
342 *--------------------------------------------------------------------------
343 * Function : minidsp_multiconfig
344 * Purpose : Function which is invoked when user changes the configuration
345 * at run-time. Internally configures/switches both
346 * miniDSP_D and miniDSP_A Coefficient arrays.
347 *---------------------------------------------------------------------------
348 */
349void minidsp_multiconfig(struct snd_soc_codec *codec,
350 reg_value *a_patch, int a_size,
351 reg_value *d_patch, int d_size)
352{
353 struct aic3262_priv *aic326x = snd_soc_codec_get_drvdata(codec);
354 int val1,val2;
355 int adc_status,dac_status;
356 int (*ptransfer)(struct snd_soc_codec *codec,
357 reg_value *program_ptr,
358 int size);
359
360printk("======in the config_multiconfiguration function==== \n");
361#ifndef MULTIBYTE_I2C
362 ptransfer = byte_i2c_array_transfer;
363#else
364 ptransfer = minidsp_i2c_multibyte_transfer;
365#endif
366 //DBG(KERN_INFO "#%s: Invoked for miniDSP Mode %d\n", __func__, mode);
367
368 adc_status=aic3262_read(codec,ADC_FLAG_R1);
369 printk("ADC STATUS = %x", adc_status);
370
371 dac_status=aic3262_read(codec,DAC_FLAG_R1);
372 printk("DAC STATUS = %x", dac_status);
373
374 #if 0
375 /* Switching off the adaptive filtering for loading the patch file*/
376 aic3262_change_book(codec, 40);
377 val1 = i2c_smbus_read_byte_data(codec->control_data, 1);
378 aic3262_write(codec, 1, (val1&0xfb));
379
380 aic3262_change_book(codec, 80);
381 val2 = i2c_smbus_read_byte_data(codec->control_data, 1);
382 aic3262_write(codec, 1, (val2&0xfb));
383
384 #endif
385
386 /*apply patches to both pages (mirrored coeffs). this works when DSP are stopped*/
387 /* to apply patches when DSPs are runnig, the 'buffer swap' has to be executed, which is
388 done in the buffer swap section below*/
389
390 if (a_size)
391 ptransfer (codec, a_patch, a_size);
392 if (d_size)
393 ptransfer (codec, d_patch, d_size);
394
395
396 /*swap buffers for both a&d only if DSPs are running*/
397 if((dac_status & 0x80) || (dac_status & 0x8))
398 {
399 multibyte_coeff_change(codec, 0x50);/*swap DSP D Buffer*/
400 if (d_size)
401 ptransfer(codec, d_patch, d_size); /*apply patch after swapping buffer*/
402 }
403
404 if((adc_status & 0x40) || (adc_status & 0x4))
405 {
406 multibyte_coeff_change(codec, 0x28);/*swap DSP A Buffer*/
407 if (a_size)
408 ptransfer(codec, a_patch, a_size); /*apply patch after swapping buffer*/
409 }
410
411 #if 0
412 if (a_size)
413 ptransfer (codec, a_patch, a_size);
414 if (d_size)
415 ptransfer (codec, d_patch, d_size);
416 #endif
417
418
419 return ;
420}
421
422/*
423 *--------------------------------------------------------------------------
424 * Function : config_multibyte_for_mode
425 * Purpose : Function which is invoked when user changes the configuration
426 * at run-time. Internally configures/switches both
427 * miniDSP_D and miniDSP_A Coefficient arrays.
428 *---------------------------------------------------------------------------
429 */
430static int multibyte_coeff_change(struct snd_soc_codec *codec, int bk)
431{
432
433 u8 value[2], swap_reg_pre, swap_reg_post;
434 struct i2c_client *i2c;
435 i2c = codec->control_data;
436
437 aic3262_change_book(codec, bk);
438 aic3262_change_page(codec, 0);
439
440 value[0] = 1;
441
442 if (i2c_master_send(i2c, value, 1) != 1)
443 printk(KERN_ERR "Can not write register address\n");
444 else {
445 /* Read the Value of the Page 8 Register 1 which controls the
446 Adaptive Switching Mode */
447 if (i2c_master_recv(i2c, value, 1) != 1) {
448 printk(KERN_ERR "Can not read codec registers\n");
449 goto err;
450 }
451 swap_reg_pre = value[0];
452
453 /* Write the Register bit updates */
454 value[1] = value[0] | 1;
455 value[0] = 1;
456
457 if (i2c_master_send(i2c, value, 2) != 2) {
458 printk(KERN_ERR "Can not write register address\n");
459 goto err;
460 }
461 /*before verifying for buffer_swap, make sure we give one
462 frame delay, because the buffer swap happens at the end of the frame */
463 mdelay(5);
464 value[0] = 1;
465 /* verify buffer swap */
466 if (i2c_master_send(i2c, value, 1) != 1)
467 printk(KERN_ERR "Can not write register address\n");
468
469 /* Read the Value of the Page 8 Register 1 which controls the
470 Adaptive Switching Mode */
471 if (i2c_master_recv(i2c, &swap_reg_post, 1) != 1)
472 printk(KERN_ERR "Can not read codec registers\n");
473
474 if ((swap_reg_pre == 4 && swap_reg_post == 6)
475 || (swap_reg_pre == 6 && swap_reg_post == 4))
476 printk(KERN_INFO "Buffer swap success\n");
477 else
478 printk(KERN_ERR
479 "Buffer swap...FAILED\nswap_reg_pre=%x, swap_reg_post=%x\n",
480 swap_reg_pre, swap_reg_post);
481
482 aic3262_change_book(codec, 0x00);
483 }
484
485err:
486 return 0;
487}
488
489
490
491#endif
492
493MODULE_DESCRIPTION("ASoC AIC3262 miniDSP multi-configuration");
494MODULE_AUTHOR("Barani Prashanth <gvbarani@mistralsolutions.com>");
495MODULE_LICENSE("GPL");
diff --git a/sound/soc/codecs/wm8994-tables.c b/sound/soc/codecs/wm8994-tables.c
new file mode 100644
index 00000000000..a87adbd05ee
--- /dev/null
+++ b/sound/soc/codecs/wm8994-tables.c
@@ -0,0 +1,3147 @@
1#include "wm8994.h"
2
3const struct wm8994_access_mask wm8994_access_masks[WM8994_CACHE_SIZE] = {
4 { 0xFFFF, 0xFFFF }, /* R0 - Software Reset */
5 { 0x3B37, 0x3B37 }, /* R1 - Power Management (1) */
6 { 0x6BF0, 0x6BF0 }, /* R2 - Power Management (2) */
7 { 0x3FF0, 0x3FF0 }, /* R3 - Power Management (3) */
8 { 0x3F3F, 0x3F3F }, /* R4 - Power Management (4) */
9 { 0x3F0F, 0x3F0F }, /* R5 - Power Management (5) */
10 { 0x003F, 0x003F }, /* R6 - Power Management (6) */
11 { 0x0000, 0x0000 }, /* R7 */
12 { 0x0000, 0x0000 }, /* R8 */
13 { 0x0000, 0x0000 }, /* R9 */
14 { 0x0000, 0x0000 }, /* R10 */
15 { 0x0000, 0x0000 }, /* R11 */
16 { 0x0000, 0x0000 }, /* R12 */
17 { 0x0000, 0x0000 }, /* R13 */
18 { 0x0000, 0x0000 }, /* R14 */
19 { 0x0000, 0x0000 }, /* R15 */
20 { 0x0000, 0x0000 }, /* R16 */
21 { 0x0000, 0x0000 }, /* R17 */
22 { 0x0000, 0x0000 }, /* R18 */
23 { 0x0000, 0x0000 }, /* R19 */
24 { 0x0000, 0x0000 }, /* R20 */
25 { 0x01C0, 0x01C0 }, /* R21 - Input Mixer (1) */
26 { 0x0000, 0x0000 }, /* R22 */
27 { 0x0000, 0x0000 }, /* R23 */
28 { 0x00DF, 0x01DF }, /* R24 - Left Line Input 1&2 Volume */
29 { 0x00DF, 0x01DF }, /* R25 - Left Line Input 3&4 Volume */
30 { 0x00DF, 0x01DF }, /* R26 - Right Line Input 1&2 Volume */
31 { 0x00DF, 0x01DF }, /* R27 - Right Line Input 3&4 Volume */
32 { 0x00FF, 0x01FF }, /* R28 - Left Output Volume */
33 { 0x00FF, 0x01FF }, /* R29 - Right Output Volume */
34 { 0x0077, 0x0077 }, /* R30 - Line Outputs Volume */
35 { 0x0030, 0x0030 }, /* R31 - HPOUT2 Volume */
36 { 0x00FF, 0x01FF }, /* R32 - Left OPGA Volume */
37 { 0x00FF, 0x01FF }, /* R33 - Right OPGA Volume */
38 { 0x007F, 0x007F }, /* R34 - SPKMIXL Attenuation */
39 { 0x017F, 0x017F }, /* R35 - SPKMIXR Attenuation */
40 { 0x003F, 0x003F }, /* R36 - SPKOUT Mixers */
41 { 0x003F, 0x003F }, /* R37 - ClassD */
42 { 0x00FF, 0x01FF }, /* R38 - Speaker Volume Left */
43 { 0x00FF, 0x01FF }, /* R39 - Speaker Volume Right */
44 { 0x00FF, 0x00FF }, /* R40 - Input Mixer (2) */
45 { 0x01B7, 0x01B7 }, /* R41 - Input Mixer (3) */
46 { 0x01B7, 0x01B7 }, /* R42 - Input Mixer (4) */
47 { 0x01C7, 0x01C7 }, /* R43 - Input Mixer (5) */
48 { 0x01C7, 0x01C7 }, /* R44 - Input Mixer (6) */
49 { 0x01FF, 0x01FF }, /* R45 - Output Mixer (1) */
50 { 0x01FF, 0x01FF }, /* R46 - Output Mixer (2) */
51 { 0x0FFF, 0x0FFF }, /* R47 - Output Mixer (3) */
52 { 0x0FFF, 0x0FFF }, /* R48 - Output Mixer (4) */
53 { 0x0FFF, 0x0FFF }, /* R49 - Output Mixer (5) */
54 { 0x0FFF, 0x0FFF }, /* R50 - Output Mixer (6) */
55 { 0x0038, 0x0038 }, /* R51 - HPOUT2 Mixer */
56 { 0x0077, 0x0077 }, /* R52 - Line Mixer (1) */
57 { 0x0077, 0x0077 }, /* R53 - Line Mixer (2) */
58 { 0x03FF, 0x03FF }, /* R54 - Speaker Mixer */
59 { 0x00C1, 0x00C1 }, /* R55 - Additional Control */
60 { 0x00F0, 0x00F0 }, /* R56 - AntiPOP (1) */
61 { 0x01EF, 0x01EF }, /* R57 - AntiPOP (2) */
62 { 0x00FF, 0x00FF }, /* R58 - MICBIAS */
63 { 0x000F, 0x000F }, /* R59 - LDO 1 */
64 { 0x0007, 0x0007 }, /* R60 - LDO 2 */
65 { 0xFFFF, 0xFFFF }, /* R61 */
66 { 0xFFFF, 0xFFFF }, /* R62 */
67 { 0x0000, 0x0000 }, /* R63 */
68 { 0x0000, 0x0000 }, /* R64 */
69 { 0x0000, 0x0000 }, /* R65 */
70 { 0x0000, 0x0000 }, /* R66 */
71 { 0x0000, 0x0000 }, /* R67 */
72 { 0x0000, 0x0000 }, /* R68 */
73 { 0x0000, 0x0000 }, /* R69 */
74 { 0x0000, 0x0000 }, /* R70 */
75 { 0x0000, 0x0000 }, /* R71 */
76 { 0x0000, 0x0000 }, /* R72 */
77 { 0x0000, 0x0000 }, /* R73 */
78 { 0x0000, 0x0000 }, /* R74 */
79 { 0x0000, 0x0000 }, /* R75 */
80 { 0x8000, 0x8000 }, /* R76 - Charge Pump (1) */
81 { 0x0000, 0x0000 }, /* R77 */
82 { 0x0000, 0x0000 }, /* R78 */
83 { 0x0000, 0x0000 }, /* R79 */
84 { 0x0000, 0x0000 }, /* R80 */
85 { 0x0301, 0x0301 }, /* R81 - Class W (1) */
86 { 0x0000, 0x0000 }, /* R82 */
87 { 0x0000, 0x0000 }, /* R83 */
88 { 0x333F, 0x333F }, /* R84 - DC Servo (1) */
89 { 0x0FEF, 0x0FEF }, /* R85 - DC Servo (2) */
90 { 0x0000, 0x0000 }, /* R86 */
91 { 0xFFFF, 0xFFFF }, /* R87 - DC Servo (4) */
92 { 0x0333, 0x0000 }, /* R88 - DC Servo Readback */
93 { 0x0000, 0x0000 }, /* R89 */
94 { 0x0000, 0x0000 }, /* R90 */
95 { 0x0000, 0x0000 }, /* R91 */
96 { 0x0000, 0x0000 }, /* R92 */
97 { 0x0000, 0x0000 }, /* R93 */
98 { 0x0000, 0x0000 }, /* R94 */
99 { 0x0000, 0x0000 }, /* R95 */
100 { 0x00EE, 0x00EE }, /* R96 - Analogue HP (1) */
101 { 0x0000, 0x0000 }, /* R97 */
102 { 0x0000, 0x0000 }, /* R98 */
103 { 0x0000, 0x0000 }, /* R99 */
104 { 0x0000, 0x0000 }, /* R100 */
105 { 0x0000, 0x0000 }, /* R101 */
106 { 0x0000, 0x0000 }, /* R102 */
107 { 0x0000, 0x0000 }, /* R103 */
108 { 0x0000, 0x0000 }, /* R104 */
109 { 0x0000, 0x0000 }, /* R105 */
110 { 0x0000, 0x0000 }, /* R106 */
111 { 0x0000, 0x0000 }, /* R107 */
112 { 0x0000, 0x0000 }, /* R108 */
113 { 0x0000, 0x0000 }, /* R109 */
114 { 0x0000, 0x0000 }, /* R110 */
115 { 0x0000, 0x0000 }, /* R111 */
116 { 0x0000, 0x0000 }, /* R112 */
117 { 0x0000, 0x0000 }, /* R113 */
118 { 0x0000, 0x0000 }, /* R114 */
119 { 0x0000, 0x0000 }, /* R115 */
120 { 0x0000, 0x0000 }, /* R116 */
121 { 0x0000, 0x0000 }, /* R117 */
122 { 0x0000, 0x0000 }, /* R118 */
123 { 0x0000, 0x0000 }, /* R119 */
124 { 0x0000, 0x0000 }, /* R120 */
125 { 0x0000, 0x0000 }, /* R121 */
126 { 0x0000, 0x0000 }, /* R122 */
127 { 0x0000, 0x0000 }, /* R123 */
128 { 0x0000, 0x0000 }, /* R124 */
129 { 0x0000, 0x0000 }, /* R125 */
130 { 0x0000, 0x0000 }, /* R126 */
131 { 0x0000, 0x0000 }, /* R127 */
132 { 0x0000, 0x0000 }, /* R128 */
133 { 0x0000, 0x0000 }, /* R129 */
134 { 0x0000, 0x0000 }, /* R130 */
135 { 0x0000, 0x0000 }, /* R131 */
136 { 0x0000, 0x0000 }, /* R132 */
137 { 0x0000, 0x0000 }, /* R133 */
138 { 0x0000, 0x0000 }, /* R134 */
139 { 0x0000, 0x0000 }, /* R135 */
140 { 0x0000, 0x0000 }, /* R136 */
141 { 0x0000, 0x0000 }, /* R137 */
142 { 0x0000, 0x0000 }, /* R138 */
143 { 0x0000, 0x0000 }, /* R139 */
144 { 0x0000, 0x0000 }, /* R140 */
145 { 0x0000, 0x0000 }, /* R141 */
146 { 0x0000, 0x0000 }, /* R142 */
147 { 0x0000, 0x0000 }, /* R143 */
148 { 0x0000, 0x0000 }, /* R144 */
149 { 0x0000, 0x0000 }, /* R145 */
150 { 0x0000, 0x0000 }, /* R146 */
151 { 0x0000, 0x0000 }, /* R147 */
152 { 0x0000, 0x0000 }, /* R148 */
153 { 0x0000, 0x0000 }, /* R149 */
154 { 0x0000, 0x0000 }, /* R150 */
155 { 0x0000, 0x0000 }, /* R151 */
156 { 0x0000, 0x0000 }, /* R152 */
157 { 0x0000, 0x0000 }, /* R153 */
158 { 0x0000, 0x0000 }, /* R154 */
159 { 0x0000, 0x0000 }, /* R155 */
160 { 0x0000, 0x0000 }, /* R156 */
161 { 0x0000, 0x0000 }, /* R157 */
162 { 0x0000, 0x0000 }, /* R158 */
163 { 0x0000, 0x0000 }, /* R159 */
164 { 0x0000, 0x0000 }, /* R160 */
165 { 0x0000, 0x0000 }, /* R161 */
166 { 0x0000, 0x0000 }, /* R162 */
167 { 0x0000, 0x0000 }, /* R163 */
168 { 0x0000, 0x0000 }, /* R164 */
169 { 0x0000, 0x0000 }, /* R165 */
170 { 0x0000, 0x0000 }, /* R166 */
171 { 0x0000, 0x0000 }, /* R167 */
172 { 0x0000, 0x0000 }, /* R168 */
173 { 0x0000, 0x0000 }, /* R169 */
174 { 0x0000, 0x0000 }, /* R170 */
175 { 0x0000, 0x0000 }, /* R171 */
176 { 0x0000, 0x0000 }, /* R172 */
177 { 0x0000, 0x0000 }, /* R173 */
178 { 0x0000, 0x0000 }, /* R174 */
179 { 0x0000, 0x0000 }, /* R175 */
180 { 0x0000, 0x0000 }, /* R176 */
181 { 0x0000, 0x0000 }, /* R177 */
182 { 0x0000, 0x0000 }, /* R178 */
183 { 0x0000, 0x0000 }, /* R179 */
184 { 0x0000, 0x0000 }, /* R180 */
185 { 0x0000, 0x0000 }, /* R181 */
186 { 0x0000, 0x0000 }, /* R182 */
187 { 0x0000, 0x0000 }, /* R183 */
188 { 0x0000, 0x0000 }, /* R184 */
189 { 0x0000, 0x0000 }, /* R185 */
190 { 0x0000, 0x0000 }, /* R186 */
191 { 0x0000, 0x0000 }, /* R187 */
192 { 0x0000, 0x0000 }, /* R188 */
193 { 0x0000, 0x0000 }, /* R189 */
194 { 0x0000, 0x0000 }, /* R190 */
195 { 0x0000, 0x0000 }, /* R191 */
196 { 0x0000, 0x0000 }, /* R192 */
197 { 0x0000, 0x0000 }, /* R193 */
198 { 0x0000, 0x0000 }, /* R194 */
199 { 0x0000, 0x0000 }, /* R195 */
200 { 0x0000, 0x0000 }, /* R196 */
201 { 0x0000, 0x0000 }, /* R197 */
202 { 0x0000, 0x0000 }, /* R198 */
203 { 0x0000, 0x0000 }, /* R199 */
204 { 0x0000, 0x0000 }, /* R200 */
205 { 0x0000, 0x0000 }, /* R201 */
206 { 0x0000, 0x0000 }, /* R202 */
207 { 0x0000, 0x0000 }, /* R203 */
208 { 0x0000, 0x0000 }, /* R204 */
209 { 0x0000, 0x0000 }, /* R205 */
210 { 0x0000, 0x0000 }, /* R206 */
211 { 0x0000, 0x0000 }, /* R207 */
212 { 0xFFFF, 0xFFFF }, /* R208 */
213 { 0xFFFF, 0xFFFF }, /* R209 */
214 { 0xFFFF, 0xFFFF }, /* R210 */
215 { 0x0000, 0x0000 }, /* R211 */
216 { 0x0000, 0x0000 }, /* R212 */
217 { 0x0000, 0x0000 }, /* R213 */
218 { 0x0000, 0x0000 }, /* R214 */
219 { 0x0000, 0x0000 }, /* R215 */
220 { 0x0000, 0x0000 }, /* R216 */
221 { 0x0000, 0x0000 }, /* R217 */
222 { 0x0000, 0x0000 }, /* R218 */
223 { 0x0000, 0x0000 }, /* R219 */
224 { 0x0000, 0x0000 }, /* R220 */
225 { 0x0000, 0x0000 }, /* R221 */
226 { 0x0000, 0x0000 }, /* R222 */
227 { 0x0000, 0x0000 }, /* R223 */
228 { 0x0000, 0x0000 }, /* R224 */
229 { 0x0000, 0x0000 }, /* R225 */
230 { 0x0000, 0x0000 }, /* R226 */
231 { 0x0000, 0x0000 }, /* R227 */
232 { 0x0000, 0x0000 }, /* R228 */
233 { 0x0000, 0x0000 }, /* R229 */
234 { 0x0000, 0x0000 }, /* R230 */
235 { 0x0000, 0x0000 }, /* R231 */
236 { 0x0000, 0x0000 }, /* R232 */
237 { 0x0000, 0x0000 }, /* R233 */
238 { 0x0000, 0x0000 }, /* R234 */
239 { 0x0000, 0x0000 }, /* R235 */
240 { 0x0000, 0x0000 }, /* R236 */
241 { 0x0000, 0x0000 }, /* R237 */
242 { 0x0000, 0x0000 }, /* R238 */
243 { 0x0000, 0x0000 }, /* R239 */
244 { 0x0000, 0x0000 }, /* R240 */
245 { 0x0000, 0x0000 }, /* R241 */
246 { 0x0000, 0x0000 }, /* R242 */
247 { 0x0000, 0x0000 }, /* R243 */
248 { 0x0000, 0x0000 }, /* R244 */
249 { 0x0000, 0x0000 }, /* R245 */
250 { 0x0000, 0x0000 }, /* R246 */
251 { 0x0000, 0x0000 }, /* R247 */
252 { 0x0000, 0x0000 }, /* R248 */
253 { 0x0000, 0x0000 }, /* R249 */
254 { 0x0000, 0x0000 }, /* R250 */
255 { 0x0000, 0x0000 }, /* R251 */
256 { 0x0000, 0x0000 }, /* R252 */
257 { 0x0000, 0x0000 }, /* R253 */
258 { 0x0000, 0x0000 }, /* R254 */
259 { 0x0000, 0x0000 }, /* R255 */
260 { 0x000F, 0x0000 }, /* R256 - Chip Revision */
261 { 0x0074, 0x0074 }, /* R257 - Control Interface */
262 { 0x0000, 0x0000 }, /* R258 */
263 { 0x0000, 0x0000 }, /* R259 */
264 { 0x0000, 0x0000 }, /* R260 */
265 { 0x0000, 0x0000 }, /* R261 */
266 { 0x0000, 0x0000 }, /* R262 */
267 { 0x0000, 0x0000 }, /* R263 */
268 { 0x0000, 0x0000 }, /* R264 */
269 { 0x0000, 0x0000 }, /* R265 */
270 { 0x0000, 0x0000 }, /* R266 */
271 { 0x0000, 0x0000 }, /* R267 */
272 { 0x0000, 0x0000 }, /* R268 */
273 { 0x0000, 0x0000 }, /* R269 */
274 { 0x0000, 0x0000 }, /* R270 */
275 { 0x0000, 0x0000 }, /* R271 */
276 { 0x807F, 0x837F }, /* R272 - Write Sequencer Ctrl (1) */
277 { 0x017F, 0x0000 }, /* R273 - Write Sequencer Ctrl (2) */
278 { 0x0000, 0x0000 }, /* R274 */
279 { 0x0000, 0x0000 }, /* R275 */
280 { 0x0000, 0x0000 }, /* R276 */
281 { 0x0000, 0x0000 }, /* R277 */
282 { 0x0000, 0x0000 }, /* R278 */
283 { 0x0000, 0x0000 }, /* R279 */
284 { 0x0000, 0x0000 }, /* R280 */
285 { 0x0000, 0x0000 }, /* R281 */
286 { 0x0000, 0x0000 }, /* R282 */
287 { 0x0000, 0x0000 }, /* R283 */
288 { 0x0000, 0x0000 }, /* R284 */
289 { 0x0000, 0x0000 }, /* R285 */
290 { 0x0000, 0x0000 }, /* R286 */
291 { 0x0000, 0x0000 }, /* R287 */
292 { 0x0000, 0x0000 }, /* R288 */
293 { 0x0000, 0x0000 }, /* R289 */
294 { 0x0000, 0x0000 }, /* R290 */
295 { 0x0000, 0x0000 }, /* R291 */
296 { 0x0000, 0x0000 }, /* R292 */
297 { 0x0000, 0x0000 }, /* R293 */
298 { 0x0000, 0x0000 }, /* R294 */
299 { 0x0000, 0x0000 }, /* R295 */
300 { 0x0000, 0x0000 }, /* R296 */
301 { 0x0000, 0x0000 }, /* R297 */
302 { 0x0000, 0x0000 }, /* R298 */
303 { 0x0000, 0x0000 }, /* R299 */
304 { 0x0000, 0x0000 }, /* R300 */
305 { 0x0000, 0x0000 }, /* R301 */
306 { 0x0000, 0x0000 }, /* R302 */
307 { 0x0000, 0x0000 }, /* R303 */
308 { 0x0000, 0x0000 }, /* R304 */
309 { 0x0000, 0x0000 }, /* R305 */
310 { 0x0000, 0x0000 }, /* R306 */
311 { 0x0000, 0x0000 }, /* R307 */
312 { 0x0000, 0x0000 }, /* R308 */
313 { 0x0000, 0x0000 }, /* R309 */
314 { 0x0000, 0x0000 }, /* R310 */
315 { 0x0000, 0x0000 }, /* R311 */
316 { 0x0000, 0x0000 }, /* R312 */
317 { 0x0000, 0x0000 }, /* R313 */
318 { 0x0000, 0x0000 }, /* R314 */
319 { 0x0000, 0x0000 }, /* R315 */
320 { 0x0000, 0x0000 }, /* R316 */
321 { 0x0000, 0x0000 }, /* R317 */
322 { 0x0000, 0x0000 }, /* R318 */
323 { 0x0000, 0x0000 }, /* R319 */
324 { 0x0000, 0x0000 }, /* R320 */
325 { 0x0000, 0x0000 }, /* R321 */
326 { 0x0000, 0x0000 }, /* R322 */
327 { 0x0000, 0x0000 }, /* R323 */
328 { 0x0000, 0x0000 }, /* R324 */
329 { 0x0000, 0x0000 }, /* R325 */
330 { 0x0000, 0x0000 }, /* R326 */
331 { 0x0000, 0x0000 }, /* R327 */
332 { 0x0000, 0x0000 }, /* R328 */
333 { 0x0000, 0x0000 }, /* R329 */
334 { 0x0000, 0x0000 }, /* R330 */
335 { 0x0000, 0x0000 }, /* R331 */
336 { 0x0000, 0x0000 }, /* R332 */
337 { 0x0000, 0x0000 }, /* R333 */
338 { 0x0000, 0x0000 }, /* R334 */
339 { 0x0000, 0x0000 }, /* R335 */
340 { 0x0000, 0x0000 }, /* R336 */
341 { 0x0000, 0x0000 }, /* R337 */
342 { 0x0000, 0x0000 }, /* R338 */
343 { 0x0000, 0x0000 }, /* R339 */
344 { 0x0000, 0x0000 }, /* R340 */
345 { 0x0000, 0x0000 }, /* R341 */
346 { 0x0000, 0x0000 }, /* R342 */
347 { 0x0000, 0x0000 }, /* R343 */
348 { 0x0000, 0x0000 }, /* R344 */
349 { 0x0000, 0x0000 }, /* R345 */
350 { 0x0000, 0x0000 }, /* R346 */
351 { 0x0000, 0x0000 }, /* R347 */
352 { 0x0000, 0x0000 }, /* R348 */
353 { 0x0000, 0x0000 }, /* R349 */
354 { 0x0000, 0x0000 }, /* R350 */
355 { 0x0000, 0x0000 }, /* R351 */
356 { 0x0000, 0x0000 }, /* R352 */
357 { 0x0000, 0x0000 }, /* R353 */
358 { 0x0000, 0x0000 }, /* R354 */
359 { 0x0000, 0x0000 }, /* R355 */
360 { 0x0000, 0x0000 }, /* R356 */
361 { 0x0000, 0x0000 }, /* R357 */
362 { 0x0000, 0x0000 }, /* R358 */
363 { 0x0000, 0x0000 }, /* R359 */
364 { 0x0000, 0x0000 }, /* R360 */
365 { 0x0000, 0x0000 }, /* R361 */
366 { 0x0000, 0x0000 }, /* R362 */
367 { 0x0000, 0x0000 }, /* R363 */
368 { 0x0000, 0x0000 }, /* R364 */
369 { 0x0000, 0x0000 }, /* R365 */
370 { 0x0000, 0x0000 }, /* R366 */
371 { 0x0000, 0x0000 }, /* R367 */
372 { 0x0000, 0x0000 }, /* R368 */
373 { 0x0000, 0x0000 }, /* R369 */
374 { 0x0000, 0x0000 }, /* R370 */
375 { 0x0000, 0x0000 }, /* R371 */
376 { 0x0000, 0x0000 }, /* R372 */
377 { 0x0000, 0x0000 }, /* R373 */
378 { 0x0000, 0x0000 }, /* R374 */
379 { 0x0000, 0x0000 }, /* R375 */
380 { 0x0000, 0x0000 }, /* R376 */
381 { 0x0000, 0x0000 }, /* R377 */
382 { 0x0000, 0x0000 }, /* R378 */
383 { 0x0000, 0x0000 }, /* R379 */
384 { 0x0000, 0x0000 }, /* R380 */
385 { 0x0000, 0x0000 }, /* R381 */
386 { 0x0000, 0x0000 }, /* R382 */
387 { 0x0000, 0x0000 }, /* R383 */
388 { 0x0000, 0x0000 }, /* R384 */
389 { 0x0000, 0x0000 }, /* R385 */
390 { 0x0000, 0x0000 }, /* R386 */
391 { 0x0000, 0x0000 }, /* R387 */
392 { 0x0000, 0x0000 }, /* R388 */
393 { 0x0000, 0x0000 }, /* R389 */
394 { 0x0000, 0x0000 }, /* R390 */
395 { 0x0000, 0x0000 }, /* R391 */
396 { 0x0000, 0x0000 }, /* R392 */
397 { 0x0000, 0x0000 }, /* R393 */
398 { 0x0000, 0x0000 }, /* R394 */
399 { 0x0000, 0x0000 }, /* R395 */
400 { 0x0000, 0x0000 }, /* R396 */
401 { 0x0000, 0x0000 }, /* R397 */
402 { 0x0000, 0x0000 }, /* R398 */
403 { 0x0000, 0x0000 }, /* R399 */
404 { 0x0000, 0x0000 }, /* R400 */
405 { 0x0000, 0x0000 }, /* R401 */
406 { 0x0000, 0x0000 }, /* R402 */
407 { 0x0000, 0x0000 }, /* R403 */
408 { 0x0000, 0x0000 }, /* R404 */
409 { 0x0000, 0x0000 }, /* R405 */
410 { 0x0000, 0x0000 }, /* R406 */
411 { 0x0000, 0x0000 }, /* R407 */
412 { 0x0000, 0x0000 }, /* R408 */
413 { 0x0000, 0x0000 }, /* R409 */
414 { 0x0000, 0x0000 }, /* R410 */
415 { 0x0000, 0x0000 }, /* R411 */
416 { 0x0000, 0x0000 }, /* R412 */
417 { 0x0000, 0x0000 }, /* R413 */
418 { 0x0000, 0x0000 }, /* R414 */
419 { 0x0000, 0x0000 }, /* R415 */
420 { 0x0000, 0x0000 }, /* R416 */
421 { 0x0000, 0x0000 }, /* R417 */
422 { 0x0000, 0x0000 }, /* R418 */
423 { 0x0000, 0x0000 }, /* R419 */
424 { 0x0000, 0x0000 }, /* R420 */
425 { 0x0000, 0x0000 }, /* R421 */
426 { 0x0000, 0x0000 }, /* R422 */
427 { 0x0000, 0x0000 }, /* R423 */
428 { 0x0000, 0x0000 }, /* R424 */
429 { 0x0000, 0x0000 }, /* R425 */
430 { 0x0000, 0x0000 }, /* R426 */
431 { 0x0000, 0x0000 }, /* R427 */
432 { 0x0000, 0x0000 }, /* R428 */
433 { 0x0000, 0x0000 }, /* R429 */
434 { 0x0000, 0x0000 }, /* R430 */
435 { 0x0000, 0x0000 }, /* R431 */
436 { 0x0000, 0x0000 }, /* R432 */
437 { 0x0000, 0x0000 }, /* R433 */
438 { 0x0000, 0x0000 }, /* R434 */
439 { 0x0000, 0x0000 }, /* R435 */
440 { 0x0000, 0x0000 }, /* R436 */
441 { 0x0000, 0x0000 }, /* R437 */
442 { 0x0000, 0x0000 }, /* R438 */
443 { 0x0000, 0x0000 }, /* R439 */
444 { 0x0000, 0x0000 }, /* R440 */
445 { 0x0000, 0x0000 }, /* R441 */
446 { 0x0000, 0x0000 }, /* R442 */
447 { 0x0000, 0x0000 }, /* R443 */
448 { 0x0000, 0x0000 }, /* R444 */
449 { 0x0000, 0x0000 }, /* R445 */
450 { 0x0000, 0x0000 }, /* R446 */
451 { 0x0000, 0x0000 }, /* R447 */
452 { 0x0000, 0x0000 }, /* R448 */
453 { 0x0000, 0x0000 }, /* R449 */
454 { 0x0000, 0x0000 }, /* R450 */
455 { 0x0000, 0x0000 }, /* R451 */
456 { 0x0000, 0x0000 }, /* R452 */
457 { 0x0000, 0x0000 }, /* R453 */
458 { 0x0000, 0x0000 }, /* R454 */
459 { 0x0000, 0x0000 }, /* R455 */
460 { 0x0000, 0x0000 }, /* R456 */
461 { 0x0000, 0x0000 }, /* R457 */
462 { 0x0000, 0x0000 }, /* R458 */
463 { 0x0000, 0x0000 }, /* R459 */
464 { 0x0000, 0x0000 }, /* R460 */
465 { 0x0000, 0x0000 }, /* R461 */
466 { 0x0000, 0x0000 }, /* R462 */
467 { 0x0000, 0x0000 }, /* R463 */
468 { 0x0000, 0x0000 }, /* R464 */
469 { 0x0000, 0x0000 }, /* R465 */
470 { 0x0000, 0x0000 }, /* R466 */
471 { 0x0000, 0x0000 }, /* R467 */
472 { 0x0000, 0x0000 }, /* R468 */
473 { 0x0000, 0x0000 }, /* R469 */
474 { 0x0000, 0x0000 }, /* R470 */
475 { 0x0000, 0x0000 }, /* R471 */
476 { 0x0000, 0x0000 }, /* R472 */
477 { 0x0000, 0x0000 }, /* R473 */
478 { 0x0000, 0x0000 }, /* R474 */
479 { 0x0000, 0x0000 }, /* R475 */
480 { 0x0000, 0x0000 }, /* R476 */
481 { 0x0000, 0x0000 }, /* R477 */
482 { 0x0000, 0x0000 }, /* R478 */
483 { 0x0000, 0x0000 }, /* R479 */
484 { 0x0000, 0x0000 }, /* R480 */
485 { 0x0000, 0x0000 }, /* R481 */
486 { 0x0000, 0x0000 }, /* R482 */
487 { 0x0000, 0x0000 }, /* R483 */
488 { 0x0000, 0x0000 }, /* R484 */
489 { 0x0000, 0x0000 }, /* R485 */
490 { 0x0000, 0x0000 }, /* R486 */
491 { 0x0000, 0x0000 }, /* R487 */
492 { 0x0000, 0x0000 }, /* R488 */
493 { 0x0000, 0x0000 }, /* R489 */
494 { 0x0000, 0x0000 }, /* R490 */
495 { 0x0000, 0x0000 }, /* R491 */
496 { 0x0000, 0x0000 }, /* R492 */
497 { 0x0000, 0x0000 }, /* R493 */
498 { 0x0000, 0x0000 }, /* R494 */
499 { 0x0000, 0x0000 }, /* R495 */
500 { 0x0000, 0x0000 }, /* R496 */
501 { 0x0000, 0x0000 }, /* R497 */
502 { 0x0000, 0x0000 }, /* R498 */
503 { 0x0000, 0x0000 }, /* R499 */
504 { 0x0000, 0x0000 }, /* R500 */
505 { 0x0000, 0x0000 }, /* R501 */
506 { 0x0000, 0x0000 }, /* R502 */
507 { 0x0000, 0x0000 }, /* R503 */
508 { 0x0000, 0x0000 }, /* R504 */
509 { 0x0000, 0x0000 }, /* R505 */
510 { 0x0000, 0x0000 }, /* R506 */
511 { 0x0000, 0x0000 }, /* R507 */
512 { 0x0000, 0x0000 }, /* R508 */
513 { 0x0000, 0x0000 }, /* R509 */
514 { 0x0000, 0x0000 }, /* R510 */
515 { 0x0000, 0x0000 }, /* R511 */
516 { 0x001F, 0x001F }, /* R512 - AIF1 Clocking (1) */
517 { 0x003F, 0x003F }, /* R513 - AIF1 Clocking (2) */
518 { 0x0000, 0x0000 }, /* R514 */
519 { 0x0000, 0x0000 }, /* R515 */
520 { 0x001F, 0x001F }, /* R516 - AIF2 Clocking (1) */
521 { 0x003F, 0x003F }, /* R517 - AIF2 Clocking (2) */
522 { 0x0000, 0x0000 }, /* R518 */
523 { 0x0000, 0x0000 }, /* R519 */
524 { 0x001F, 0x001F }, /* R520 - Clocking (1) */
525 { 0x0777, 0x0777 }, /* R521 - Clocking (2) */
526 { 0x0000, 0x0000 }, /* R522 */
527 { 0x0000, 0x0000 }, /* R523 */
528 { 0x0000, 0x0000 }, /* R524 */
529 { 0x0000, 0x0000 }, /* R525 */
530 { 0x0000, 0x0000 }, /* R526 */
531 { 0x0000, 0x0000 }, /* R527 */
532 { 0x00FF, 0x00FF }, /* R528 - AIF1 Rate */
533 { 0x00FF, 0x00FF }, /* R529 - AIF2 Rate */
534 { 0x000F, 0x0000 }, /* R530 - Rate Status */
535 { 0x0000, 0x0000 }, /* R531 */
536 { 0x0000, 0x0000 }, /* R532 */
537 { 0x0000, 0x0000 }, /* R533 */
538 { 0x0000, 0x0000 }, /* R534 */
539 { 0x0000, 0x0000 }, /* R535 */
540 { 0x0000, 0x0000 }, /* R536 */
541 { 0x0000, 0x0000 }, /* R537 */
542 { 0x0000, 0x0000 }, /* R538 */
543 { 0x0000, 0x0000 }, /* R539 */
544 { 0x0000, 0x0000 }, /* R540 */
545 { 0x0000, 0x0000 }, /* R541 */
546 { 0x0000, 0x0000 }, /* R542 */
547 { 0x0000, 0x0000 }, /* R543 */
548 { 0x0007, 0x0007 }, /* R544 - FLL1 Control (1) */
549 { 0x3F77, 0x3F77 }, /* R545 - FLL1 Control (2) */
550 { 0xFFFF, 0xFFFF }, /* R546 - FLL1 Control (3) */
551 { 0x7FEF, 0x7FEF }, /* R547 - FLL1 Control (4) */
552 { 0x1FDB, 0x1FDB }, /* R548 - FLL1 Control (5) */
553 { 0x0000, 0x0000 }, /* R549 */
554 { 0x0000, 0x0000 }, /* R550 */
555 { 0x0000, 0x0000 }, /* R551 */
556 { 0x0000, 0x0000 }, /* R552 */
557 { 0x0000, 0x0000 }, /* R553 */
558 { 0x0000, 0x0000 }, /* R554 */
559 { 0x0000, 0x0000 }, /* R555 */
560 { 0x0000, 0x0000 }, /* R556 */
561 { 0x0000, 0x0000 }, /* R557 */
562 { 0x0000, 0x0000 }, /* R558 */
563 { 0x0000, 0x0000 }, /* R559 */
564 { 0x0000, 0x0000 }, /* R560 */
565 { 0x0000, 0x0000 }, /* R561 */
566 { 0x0000, 0x0000 }, /* R562 */
567 { 0x0000, 0x0000 }, /* R563 */
568 { 0x0000, 0x0000 }, /* R564 */
569 { 0x0000, 0x0000 }, /* R565 */
570 { 0x0000, 0x0000 }, /* R566 */
571 { 0x0000, 0x0000 }, /* R567 */
572 { 0x0000, 0x0000 }, /* R568 */
573 { 0x0000, 0x0000 }, /* R569 */
574 { 0x0000, 0x0000 }, /* R570 */
575 { 0x0000, 0x0000 }, /* R571 */
576 { 0x0000, 0x0000 }, /* R572 */
577 { 0x0000, 0x0000 }, /* R573 */
578 { 0x0000, 0x0000 }, /* R574 */
579 { 0x0000, 0x0000 }, /* R575 */
580 { 0x0007, 0x0007 }, /* R576 - FLL2 Control (1) */
581 { 0x3F77, 0x3F77 }, /* R577 - FLL2 Control (2) */
582 { 0xFFFF, 0xFFFF }, /* R578 - FLL2 Control (3) */
583 { 0x7FEF, 0x7FEF }, /* R579 - FLL2 Control (4) */
584 { 0x1FDB, 0x1FDB }, /* R580 - FLL2 Control (5) */
585 { 0x0000, 0x0000 }, /* R581 */
586 { 0x0000, 0x0000 }, /* R582 */
587 { 0x0000, 0x0000 }, /* R583 */
588 { 0x0000, 0x0000 }, /* R584 */
589 { 0x0000, 0x0000 }, /* R585 */
590 { 0x0000, 0x0000 }, /* R586 */
591 { 0x0000, 0x0000 }, /* R587 */
592 { 0x0000, 0x0000 }, /* R588 */
593 { 0x0000, 0x0000 }, /* R589 */
594 { 0x0000, 0x0000 }, /* R590 */
595 { 0x0000, 0x0000 }, /* R591 */
596 { 0x0000, 0x0000 }, /* R592 */
597 { 0x0000, 0x0000 }, /* R593 */
598 { 0x0000, 0x0000 }, /* R594 */
599 { 0x0000, 0x0000 }, /* R595 */
600 { 0x0000, 0x0000 }, /* R596 */
601 { 0x0000, 0x0000 }, /* R597 */
602 { 0x0000, 0x0000 }, /* R598 */
603 { 0x0000, 0x0000 }, /* R599 */
604 { 0x0000, 0x0000 }, /* R600 */
605 { 0x0000, 0x0000 }, /* R601 */
606 { 0x0000, 0x0000 }, /* R602 */
607 { 0x0000, 0x0000 }, /* R603 */
608 { 0x0000, 0x0000 }, /* R604 */
609 { 0x0000, 0x0000 }, /* R605 */
610 { 0x0000, 0x0000 }, /* R606 */
611 { 0x0000, 0x0000 }, /* R607 */
612 { 0x0000, 0x0000 }, /* R608 */
613 { 0x0000, 0x0000 }, /* R609 */
614 { 0x0000, 0x0000 }, /* R610 */
615 { 0x0000, 0x0000 }, /* R611 */
616 { 0x0000, 0x0000 }, /* R612 */
617 { 0x0000, 0x0000 }, /* R613 */
618 { 0x0000, 0x0000 }, /* R614 */
619 { 0x0000, 0x0000 }, /* R615 */
620 { 0x0000, 0x0000 }, /* R616 */
621 { 0x0000, 0x0000 }, /* R617 */
622 { 0x0000, 0x0000 }, /* R618 */
623 { 0x0000, 0x0000 }, /* R619 */
624 { 0x0000, 0x0000 }, /* R620 */
625 { 0x0000, 0x0000 }, /* R621 */
626 { 0x0000, 0x0000 }, /* R622 */
627 { 0x0000, 0x0000 }, /* R623 */
628 { 0x0000, 0x0000 }, /* R624 */
629 { 0x0000, 0x0000 }, /* R625 */
630 { 0x0000, 0x0000 }, /* R626 */
631 { 0x0000, 0x0000 }, /* R627 */
632 { 0x0000, 0x0000 }, /* R628 */
633 { 0x0000, 0x0000 }, /* R629 */
634 { 0x0000, 0x0000 }, /* R630 */
635 { 0x0000, 0x0000 }, /* R631 */
636 { 0x0000, 0x0000 }, /* R632 */
637 { 0x0000, 0x0000 }, /* R633 */
638 { 0x0000, 0x0000 }, /* R634 */
639 { 0x0000, 0x0000 }, /* R635 */
640 { 0x0000, 0x0000 }, /* R636 */
641 { 0x0000, 0x0000 }, /* R637 */
642 { 0x0000, 0x0000 }, /* R638 */
643 { 0x0000, 0x0000 }, /* R639 */
644 { 0x0000, 0x0000 }, /* R640 */
645 { 0x0000, 0x0000 }, /* R641 */
646 { 0x0000, 0x0000 }, /* R642 */
647 { 0x0000, 0x0000 }, /* R643 */
648 { 0x0000, 0x0000 }, /* R644 */
649 { 0x0000, 0x0000 }, /* R645 */
650 { 0x0000, 0x0000 }, /* R646 */
651 { 0x0000, 0x0000 }, /* R647 */
652 { 0x0000, 0x0000 }, /* R648 */
653 { 0x0000, 0x0000 }, /* R649 */
654 { 0x0000, 0x0000 }, /* R650 */
655 { 0x0000, 0x0000 }, /* R651 */
656 { 0x0000, 0x0000 }, /* R652 */
657 { 0x0000, 0x0000 }, /* R653 */
658 { 0x0000, 0x0000 }, /* R654 */
659 { 0x0000, 0x0000 }, /* R655 */
660 { 0x0000, 0x0000 }, /* R656 */
661 { 0x0000, 0x0000 }, /* R657 */
662 { 0x0000, 0x0000 }, /* R658 */
663 { 0x0000, 0x0000 }, /* R659 */
664 { 0x0000, 0x0000 }, /* R660 */
665 { 0x0000, 0x0000 }, /* R661 */
666 { 0x0000, 0x0000 }, /* R662 */
667 { 0x0000, 0x0000 }, /* R663 */
668 { 0x0000, 0x0000 }, /* R664 */
669 { 0x0000, 0x0000 }, /* R665 */
670 { 0x0000, 0x0000 }, /* R666 */
671 { 0x0000, 0x0000 }, /* R667 */
672 { 0x0000, 0x0000 }, /* R668 */
673 { 0x0000, 0x0000 }, /* R669 */
674 { 0x0000, 0x0000 }, /* R670 */
675 { 0x0000, 0x0000 }, /* R671 */
676 { 0x0000, 0x0000 }, /* R672 */
677 { 0x0000, 0x0000 }, /* R673 */
678 { 0x0000, 0x0000 }, /* R674 */
679 { 0x0000, 0x0000 }, /* R675 */
680 { 0x0000, 0x0000 }, /* R676 */
681 { 0x0000, 0x0000 }, /* R677 */
682 { 0x0000, 0x0000 }, /* R678 */
683 { 0x0000, 0x0000 }, /* R679 */
684 { 0x0000, 0x0000 }, /* R680 */
685 { 0x0000, 0x0000 }, /* R681 */
686 { 0x0000, 0x0000 }, /* R682 */
687 { 0x0000, 0x0000 }, /* R683 */
688 { 0x0000, 0x0000 }, /* R684 */
689 { 0x0000, 0x0000 }, /* R685 */
690 { 0x0000, 0x0000 }, /* R686 */
691 { 0x0000, 0x0000 }, /* R687 */
692 { 0x0000, 0x0000 }, /* R688 */
693 { 0x0000, 0x0000 }, /* R689 */
694 { 0x0000, 0x0000 }, /* R690 */
695 { 0x0000, 0x0000 }, /* R691 */
696 { 0x0000, 0x0000 }, /* R692 */
697 { 0x0000, 0x0000 }, /* R693 */
698 { 0x0000, 0x0000 }, /* R694 */
699 { 0x0000, 0x0000 }, /* R695 */
700 { 0x0000, 0x0000 }, /* R696 */
701 { 0x0000, 0x0000 }, /* R697 */
702 { 0x0000, 0x0000 }, /* R698 */
703 { 0x0000, 0x0000 }, /* R699 */
704 { 0x0000, 0x0000 }, /* R700 */
705 { 0x0000, 0x0000 }, /* R701 */
706 { 0x0000, 0x0000 }, /* R702 */
707 { 0x0000, 0x0000 }, /* R703 */
708 { 0x0000, 0x0000 }, /* R704 */
709 { 0x0000, 0x0000 }, /* R705 */
710 { 0x0000, 0x0000 }, /* R706 */
711 { 0x0000, 0x0000 }, /* R707 */
712 { 0x0000, 0x0000 }, /* R708 */
713 { 0x0000, 0x0000 }, /* R709 */
714 { 0x0000, 0x0000 }, /* R710 */
715 { 0x0000, 0x0000 }, /* R711 */
716 { 0x0000, 0x0000 }, /* R712 */
717 { 0x0000, 0x0000 }, /* R713 */
718 { 0x0000, 0x0000 }, /* R714 */
719 { 0x0000, 0x0000 }, /* R715 */
720 { 0x0000, 0x0000 }, /* R716 */
721 { 0x0000, 0x0000 }, /* R717 */
722 { 0x0000, 0x0000 }, /* R718 */
723 { 0x0000, 0x0000 }, /* R719 */
724 { 0x0000, 0x0000 }, /* R720 */
725 { 0x0000, 0x0000 }, /* R721 */
726 { 0x0000, 0x0000 }, /* R722 */
727 { 0x0000, 0x0000 }, /* R723 */
728 { 0x0000, 0x0000 }, /* R724 */
729 { 0x0000, 0x0000 }, /* R725 */
730 { 0x0000, 0x0000 }, /* R726 */
731 { 0x0000, 0x0000 }, /* R727 */
732 { 0x0000, 0x0000 }, /* R728 */
733 { 0x0000, 0x0000 }, /* R729 */
734 { 0x0000, 0x0000 }, /* R730 */
735 { 0x0000, 0x0000 }, /* R731 */
736 { 0x0000, 0x0000 }, /* R732 */
737 { 0x0000, 0x0000 }, /* R733 */
738 { 0x0000, 0x0000 }, /* R734 */
739 { 0x0000, 0x0000 }, /* R735 */
740 { 0x0000, 0x0000 }, /* R736 */
741 { 0x0000, 0x0000 }, /* R737 */
742 { 0x0000, 0x0000 }, /* R738 */
743 { 0x0000, 0x0000 }, /* R739 */
744 { 0x0000, 0x0000 }, /* R740 */
745 { 0x0000, 0x0000 }, /* R741 */
746 { 0x0000, 0x0000 }, /* R742 */
747 { 0x0000, 0x0000 }, /* R743 */
748 { 0x0000, 0x0000 }, /* R744 */
749 { 0x0000, 0x0000 }, /* R745 */
750 { 0x0000, 0x0000 }, /* R746 */
751 { 0x0000, 0x0000 }, /* R747 */
752 { 0x0000, 0x0000 }, /* R748 */
753 { 0x0000, 0x0000 }, /* R749 */
754 { 0x0000, 0x0000 }, /* R750 */
755 { 0x0000, 0x0000 }, /* R751 */
756 { 0x0000, 0x0000 }, /* R752 */
757 { 0x0000, 0x0000 }, /* R753 */
758 { 0x0000, 0x0000 }, /* R754 */
759 { 0x0000, 0x0000 }, /* R755 */
760 { 0x0000, 0x0000 }, /* R756 */
761 { 0x0000, 0x0000 }, /* R757 */
762 { 0x0000, 0x0000 }, /* R758 */
763 { 0x0000, 0x0000 }, /* R759 */
764 { 0x0000, 0x0000 }, /* R760 */
765 { 0x0000, 0x0000 }, /* R761 */
766 { 0x0000, 0x0000 }, /* R762 */
767 { 0x0000, 0x0000 }, /* R763 */
768 { 0x0000, 0x0000 }, /* R764 */
769 { 0x0000, 0x0000 }, /* R765 */
770 { 0x0000, 0x0000 }, /* R766 */
771 { 0x0000, 0x0000 }, /* R767 */
772 { 0xE1F8, 0xE1F8 }, /* R768 - AIF1 Control (1) */
773 { 0xCD1F, 0xCD1F }, /* R769 - AIF1 Control (2) */
774 { 0xF000, 0xF000 }, /* R770 - AIF1 Master/Slave */
775 { 0x01F0, 0x01F0 }, /* R771 - AIF1 BCLK */
776 { 0x0FFF, 0x0FFF }, /* R772 - AIF1ADC LRCLK */
777 { 0x0FFF, 0x0FFF }, /* R773 - AIF1DAC LRCLK */
778 { 0x0003, 0x0003 }, /* R774 - AIF1DAC Data */
779 { 0x0003, 0x0003 }, /* R775 - AIF1ADC Data */
780 { 0x0000, 0x0000 }, /* R776 */
781 { 0x0000, 0x0000 }, /* R777 */
782 { 0x0000, 0x0000 }, /* R778 */
783 { 0x0000, 0x0000 }, /* R779 */
784 { 0x0000, 0x0000 }, /* R780 */
785 { 0x0000, 0x0000 }, /* R781 */
786 { 0x0000, 0x0000 }, /* R782 */
787 { 0x0000, 0x0000 }, /* R783 */
788 { 0xF1F8, 0xF1F8 }, /* R784 - AIF2 Control (1) */
789 { 0xFD1F, 0xFD1F }, /* R785 - AIF2 Control (2) */
790 { 0xF000, 0xF000 }, /* R786 - AIF2 Master/Slave */
791 { 0x01F0, 0x01F0 }, /* R787 - AIF2 BCLK */
792 { 0x0FFF, 0x0FFF }, /* R788 - AIF2ADC LRCLK */
793 { 0x0FFF, 0x0FFF }, /* R789 - AIF2DAC LRCLK */
794 { 0x0003, 0x0003 }, /* R790 - AIF2DAC Data */
795 { 0x0003, 0x0003 }, /* R791 - AIF2ADC Data */
796 { 0x0000, 0x0000 }, /* R792 */
797 { 0x0000, 0x0000 }, /* R793 */
798 { 0x0000, 0x0000 }, /* R794 */
799 { 0x0000, 0x0000 }, /* R795 */
800 { 0x0000, 0x0000 }, /* R796 */
801 { 0x0000, 0x0000 }, /* R797 */
802 { 0x0000, 0x0000 }, /* R798 */
803 { 0x0000, 0x0000 }, /* R799 */
804 { 0x0000, 0x0000 }, /* R800 */
805 { 0x0000, 0x0000 }, /* R801 */
806 { 0x0000, 0x0000 }, /* R802 */
807 { 0x0000, 0x0000 }, /* R803 */
808 { 0x0000, 0x0000 }, /* R804 */
809 { 0x0000, 0x0000 }, /* R805 */
810 { 0x0000, 0x0000 }, /* R806 */
811 { 0x0000, 0x0000 }, /* R807 */
812 { 0x0000, 0x0000 }, /* R808 */
813 { 0x0000, 0x0000 }, /* R809 */
814 { 0x0000, 0x0000 }, /* R810 */
815 { 0x0000, 0x0000 }, /* R811 */
816 { 0x0000, 0x0000 }, /* R812 */
817 { 0x0000, 0x0000 }, /* R813 */
818 { 0x0000, 0x0000 }, /* R814 */
819 { 0x0000, 0x0000 }, /* R815 */
820 { 0x0000, 0x0000 }, /* R816 */
821 { 0x0000, 0x0000 }, /* R817 */
822 { 0x0000, 0x0000 }, /* R818 */
823 { 0x0000, 0x0000 }, /* R819 */
824 { 0x0000, 0x0000 }, /* R820 */
825 { 0x0000, 0x0000 }, /* R821 */
826 { 0x0000, 0x0000 }, /* R822 */
827 { 0x0000, 0x0000 }, /* R823 */
828 { 0x0000, 0x0000 }, /* R824 */
829 { 0x0000, 0x0000 }, /* R825 */
830 { 0x0000, 0x0000 }, /* R826 */
831 { 0x0000, 0x0000 }, /* R827 */
832 { 0x0000, 0x0000 }, /* R828 */
833 { 0x0000, 0x0000 }, /* R829 */
834 { 0x0000, 0x0000 }, /* R830 */
835 { 0x0000, 0x0000 }, /* R831 */
836 { 0x0000, 0x0000 }, /* R832 */
837 { 0x0000, 0x0000 }, /* R833 */
838 { 0x0000, 0x0000 }, /* R834 */
839 { 0x0000, 0x0000 }, /* R835 */
840 { 0x0000, 0x0000 }, /* R836 */
841 { 0x0000, 0x0000 }, /* R837 */
842 { 0x0000, 0x0000 }, /* R838 */
843 { 0x0000, 0x0000 }, /* R839 */
844 { 0x0000, 0x0000 }, /* R840 */
845 { 0x0000, 0x0000 }, /* R841 */
846 { 0x0000, 0x0000 }, /* R842 */
847 { 0x0000, 0x0000 }, /* R843 */
848 { 0x0000, 0x0000 }, /* R844 */
849 { 0x0000, 0x0000 }, /* R845 */
850 { 0x0000, 0x0000 }, /* R846 */
851 { 0x0000, 0x0000 }, /* R847 */
852 { 0x0000, 0x0000 }, /* R848 */
853 { 0x0000, 0x0000 }, /* R849 */
854 { 0x0000, 0x0000 }, /* R850 */
855 { 0x0000, 0x0000 }, /* R851 */
856 { 0x0000, 0x0000 }, /* R852 */
857 { 0x0000, 0x0000 }, /* R853 */
858 { 0x0000, 0x0000 }, /* R854 */
859 { 0x0000, 0x0000 }, /* R855 */
860 { 0x0000, 0x0000 }, /* R856 */
861 { 0x0000, 0x0000 }, /* R857 */
862 { 0x0000, 0x0000 }, /* R858 */
863 { 0x0000, 0x0000 }, /* R859 */
864 { 0x0000, 0x0000 }, /* R860 */
865 { 0x0000, 0x0000 }, /* R861 */
866 { 0x0000, 0x0000 }, /* R862 */
867 { 0x0000, 0x0000 }, /* R863 */
868 { 0x0000, 0x0000 }, /* R864 */
869 { 0x0000, 0x0000 }, /* R865 */
870 { 0x0000, 0x0000 }, /* R866 */
871 { 0x0000, 0x0000 }, /* R867 */
872 { 0x0000, 0x0000 }, /* R868 */
873 { 0x0000, 0x0000 }, /* R869 */
874 { 0x0000, 0x0000 }, /* R870 */
875 { 0x0000, 0x0000 }, /* R871 */
876 { 0x0000, 0x0000 }, /* R872 */
877 { 0x0000, 0x0000 }, /* R873 */
878 { 0x0000, 0x0000 }, /* R874 */
879 { 0x0000, 0x0000 }, /* R875 */
880 { 0x0000, 0x0000 }, /* R876 */
881 { 0x0000, 0x0000 }, /* R877 */
882 { 0x0000, 0x0000 }, /* R878 */
883 { 0x0000, 0x0000 }, /* R879 */
884 { 0x0000, 0x0000 }, /* R880 */
885 { 0x0000, 0x0000 }, /* R881 */
886 { 0x0000, 0x0000 }, /* R882 */
887 { 0x0000, 0x0000 }, /* R883 */
888 { 0x0000, 0x0000 }, /* R884 */
889 { 0x0000, 0x0000 }, /* R885 */
890 { 0x0000, 0x0000 }, /* R886 */
891 { 0x0000, 0x0000 }, /* R887 */
892 { 0x0000, 0x0000 }, /* R888 */
893 { 0x0000, 0x0000 }, /* R889 */
894 { 0x0000, 0x0000 }, /* R890 */
895 { 0x0000, 0x0000 }, /* R891 */
896 { 0x0000, 0x0000 }, /* R892 */
897 { 0x0000, 0x0000 }, /* R893 */
898 { 0x0000, 0x0000 }, /* R894 */
899 { 0x0000, 0x0000 }, /* R895 */
900 { 0x0000, 0x0000 }, /* R896 */
901 { 0x0000, 0x0000 }, /* R897 */
902 { 0x0000, 0x0000 }, /* R898 */
903 { 0x0000, 0x0000 }, /* R899 */
904 { 0x0000, 0x0000 }, /* R900 */
905 { 0x0000, 0x0000 }, /* R901 */
906 { 0x0000, 0x0000 }, /* R902 */
907 { 0x0000, 0x0000 }, /* R903 */
908 { 0x0000, 0x0000 }, /* R904 */
909 { 0x0000, 0x0000 }, /* R905 */
910 { 0x0000, 0x0000 }, /* R906 */
911 { 0x0000, 0x0000 }, /* R907 */
912 { 0x0000, 0x0000 }, /* R908 */
913 { 0x0000, 0x0000 }, /* R909 */
914 { 0x0000, 0x0000 }, /* R910 */
915 { 0x0000, 0x0000 }, /* R911 */
916 { 0x0000, 0x0000 }, /* R912 */
917 { 0x0000, 0x0000 }, /* R913 */
918 { 0x0000, 0x0000 }, /* R914 */
919 { 0x0000, 0x0000 }, /* R915 */
920 { 0x0000, 0x0000 }, /* R916 */
921 { 0x0000, 0x0000 }, /* R917 */
922 { 0x0000, 0x0000 }, /* R918 */
923 { 0x0000, 0x0000 }, /* R919 */
924 { 0x0000, 0x0000 }, /* R920 */
925 { 0x0000, 0x0000 }, /* R921 */
926 { 0x0000, 0x0000 }, /* R922 */
927 { 0x0000, 0x0000 }, /* R923 */
928 { 0x0000, 0x0000 }, /* R924 */
929 { 0x0000, 0x0000 }, /* R925 */
930 { 0x0000, 0x0000 }, /* R926 */
931 { 0x0000, 0x0000 }, /* R927 */
932 { 0x0000, 0x0000 }, /* R928 */
933 { 0x0000, 0x0000 }, /* R929 */
934 { 0x0000, 0x0000 }, /* R930 */
935 { 0x0000, 0x0000 }, /* R931 */
936 { 0x0000, 0x0000 }, /* R932 */
937 { 0x0000, 0x0000 }, /* R933 */
938 { 0x0000, 0x0000 }, /* R934 */
939 { 0x0000, 0x0000 }, /* R935 */
940 { 0x0000, 0x0000 }, /* R936 */
941 { 0x0000, 0x0000 }, /* R937 */
942 { 0x0000, 0x0000 }, /* R938 */
943 { 0x0000, 0x0000 }, /* R939 */
944 { 0x0000, 0x0000 }, /* R940 */
945 { 0x0000, 0x0000 }, /* R941 */
946 { 0x0000, 0x0000 }, /* R942 */
947 { 0x0000, 0x0000 }, /* R943 */
948 { 0x0000, 0x0000 }, /* R944 */
949 { 0x0000, 0x0000 }, /* R945 */
950 { 0x0000, 0x0000 }, /* R946 */
951 { 0x0000, 0x0000 }, /* R947 */
952 { 0x0000, 0x0000 }, /* R948 */
953 { 0x0000, 0x0000 }, /* R949 */
954 { 0x0000, 0x0000 }, /* R950 */
955 { 0x0000, 0x0000 }, /* R951 */
956 { 0x0000, 0x0000 }, /* R952 */
957 { 0x0000, 0x0000 }, /* R953 */
958 { 0x0000, 0x0000 }, /* R954 */
959 { 0x0000, 0x0000 }, /* R955 */
960 { 0x0000, 0x0000 }, /* R956 */
961 { 0x0000, 0x0000 }, /* R957 */
962 { 0x0000, 0x0000 }, /* R958 */
963 { 0x0000, 0x0000 }, /* R959 */
964 { 0x0000, 0x0000 }, /* R960 */
965 { 0x0000, 0x0000 }, /* R961 */
966 { 0x0000, 0x0000 }, /* R962 */
967 { 0x0000, 0x0000 }, /* R963 */
968 { 0x0000, 0x0000 }, /* R964 */
969 { 0x0000, 0x0000 }, /* R965 */
970 { 0x0000, 0x0000 }, /* R966 */
971 { 0x0000, 0x0000 }, /* R967 */
972 { 0x0000, 0x0000 }, /* R968 */
973 { 0x0000, 0x0000 }, /* R969 */
974 { 0x0000, 0x0000 }, /* R970 */
975 { 0x0000, 0x0000 }, /* R971 */
976 { 0x0000, 0x0000 }, /* R972 */
977 { 0x0000, 0x0000 }, /* R973 */
978 { 0x0000, 0x0000 }, /* R974 */
979 { 0x0000, 0x0000 }, /* R975 */
980 { 0x0000, 0x0000 }, /* R976 */
981 { 0x0000, 0x0000 }, /* R977 */
982 { 0x0000, 0x0000 }, /* R978 */
983 { 0x0000, 0x0000 }, /* R979 */
984 { 0x0000, 0x0000 }, /* R980 */
985 { 0x0000, 0x0000 }, /* R981 */
986 { 0x0000, 0x0000 }, /* R982 */
987 { 0x0000, 0x0000 }, /* R983 */
988 { 0x0000, 0x0000 }, /* R984 */
989 { 0x0000, 0x0000 }, /* R985 */
990 { 0x0000, 0x0000 }, /* R986 */
991 { 0x0000, 0x0000 }, /* R987 */
992 { 0x0000, 0x0000 }, /* R988 */
993 { 0x0000, 0x0000 }, /* R989 */
994 { 0x0000, 0x0000 }, /* R990 */
995 { 0x0000, 0x0000 }, /* R991 */
996 { 0x0000, 0x0000 }, /* R992 */
997 { 0x0000, 0x0000 }, /* R993 */
998 { 0x0000, 0x0000 }, /* R994 */
999 { 0x0000, 0x0000 }, /* R995 */
1000 { 0x0000, 0x0000 }, /* R996 */
1001 { 0x0000, 0x0000 }, /* R997 */
1002 { 0x0000, 0x0000 }, /* R998 */
1003 { 0x0000, 0x0000 }, /* R999 */
1004 { 0x0000, 0x0000 }, /* R1000 */
1005 { 0x0000, 0x0000 }, /* R1001 */
1006 { 0x0000, 0x0000 }, /* R1002 */
1007 { 0x0000, 0x0000 }, /* R1003 */
1008 { 0x0000, 0x0000 }, /* R1004 */
1009 { 0x0000, 0x0000 }, /* R1005 */
1010 { 0x0000, 0x0000 }, /* R1006 */
1011 { 0x0000, 0x0000 }, /* R1007 */
1012 { 0x0000, 0x0000 }, /* R1008 */
1013 { 0x0000, 0x0000 }, /* R1009 */
1014 { 0x0000, 0x0000 }, /* R1010 */
1015 { 0x0000, 0x0000 }, /* R1011 */
1016 { 0x0000, 0x0000 }, /* R1012 */
1017 { 0x0000, 0x0000 }, /* R1013 */
1018 { 0x0000, 0x0000 }, /* R1014 */
1019 { 0x0000, 0x0000 }, /* R1015 */
1020 { 0x0000, 0x0000 }, /* R1016 */
1021 { 0x0000, 0x0000 }, /* R1017 */
1022 { 0x0000, 0x0000 }, /* R1018 */
1023 { 0x0000, 0x0000 }, /* R1019 */
1024 { 0x0000, 0x0000 }, /* R1020 */
1025 { 0x0000, 0x0000 }, /* R1021 */
1026 { 0x0000, 0x0000 }, /* R1022 */
1027 { 0x0000, 0x0000 }, /* R1023 */
1028 { 0x00FF, 0x01FF }, /* R1024 - AIF1 ADC1 Left Volume */
1029 { 0x00FF, 0x01FF }, /* R1025 - AIF1 ADC1 Right Volume */
1030 { 0x00FF, 0x01FF }, /* R1026 - AIF1 DAC1 Left Volume */
1031 { 0x00FF, 0x01FF }, /* R1027 - AIF1 DAC1 Right Volume */
1032 { 0x00FF, 0x01FF }, /* R1028 - AIF1 ADC2 Left Volume */
1033 { 0x00FF, 0x01FF }, /* R1029 - AIF1 ADC2 Right Volume */
1034 { 0x00FF, 0x01FF }, /* R1030 - AIF1 DAC2 Left Volume */
1035 { 0x00FF, 0x01FF }, /* R1031 - AIF1 DAC2 Right Volume */
1036 { 0x0000, 0x0000 }, /* R1032 */
1037 { 0x0000, 0x0000 }, /* R1033 */
1038 { 0x0000, 0x0000 }, /* R1034 */
1039 { 0x0000, 0x0000 }, /* R1035 */
1040 { 0x0000, 0x0000 }, /* R1036 */
1041 { 0x0000, 0x0000 }, /* R1037 */
1042 { 0x0000, 0x0000 }, /* R1038 */
1043 { 0x0000, 0x0000 }, /* R1039 */
1044 { 0xF800, 0xF800 }, /* R1040 - AIF1 ADC1 Filters */
1045 { 0x7800, 0x7800 }, /* R1041 - AIF1 ADC2 Filters */
1046 { 0x0000, 0x0000 }, /* R1042 */
1047 { 0x0000, 0x0000 }, /* R1043 */
1048 { 0x0000, 0x0000 }, /* R1044 */
1049 { 0x0000, 0x0000 }, /* R1045 */
1050 { 0x0000, 0x0000 }, /* R1046 */
1051 { 0x0000, 0x0000 }, /* R1047 */
1052 { 0x0000, 0x0000 }, /* R1048 */
1053 { 0x0000, 0x0000 }, /* R1049 */
1054 { 0x0000, 0x0000 }, /* R1050 */
1055 { 0x0000, 0x0000 }, /* R1051 */
1056 { 0x0000, 0x0000 }, /* R1052 */
1057 { 0x0000, 0x0000 }, /* R1053 */
1058 { 0x0000, 0x0000 }, /* R1054 */
1059 { 0x0000, 0x0000 }, /* R1055 */
1060 { 0x02B6, 0x02B6 }, /* R1056 - AIF1 DAC1 Filters (1) */
1061 { 0x3F00, 0x3F00 }, /* R1057 - AIF1 DAC1 Filters (2) */
1062 { 0x02B6, 0x02B6 }, /* R1058 - AIF1 DAC2 Filters (1) */
1063 { 0x3F00, 0x3F00 }, /* R1059 - AIF1 DAC2 Filters (2) */
1064 { 0x0000, 0x0000 }, /* R1060 */
1065 { 0x0000, 0x0000 }, /* R1061 */
1066 { 0x0000, 0x0000 }, /* R1062 */
1067 { 0x0000, 0x0000 }, /* R1063 */
1068 { 0x0000, 0x0000 }, /* R1064 */
1069 { 0x0000, 0x0000 }, /* R1065 */
1070 { 0x0000, 0x0000 }, /* R1066 */
1071 { 0x0000, 0x0000 }, /* R1067 */
1072 { 0x0000, 0x0000 }, /* R1068 */
1073 { 0x0000, 0x0000 }, /* R1069 */
1074 { 0x0000, 0x0000 }, /* R1070 */
1075 { 0x0000, 0x0000 }, /* R1071 */
1076 { 0x0000, 0x0000 }, /* R1072 */
1077 { 0x0000, 0x0000 }, /* R1073 */
1078 { 0x0000, 0x0000 }, /* R1074 */
1079 { 0x0000, 0x0000 }, /* R1075 */
1080 { 0x0000, 0x0000 }, /* R1076 */
1081 { 0x0000, 0x0000 }, /* R1077 */
1082 { 0x0000, 0x0000 }, /* R1078 */
1083 { 0x0000, 0x0000 }, /* R1079 */
1084 { 0x0000, 0x0000 }, /* R1080 */
1085 { 0x0000, 0x0000 }, /* R1081 */
1086 { 0x0000, 0x0000 }, /* R1082 */
1087 { 0x0000, 0x0000 }, /* R1083 */
1088 { 0x0000, 0x0000 }, /* R1084 */
1089 { 0x0000, 0x0000 }, /* R1085 */
1090 { 0x0000, 0x0000 }, /* R1086 */
1091 { 0x0000, 0x0000 }, /* R1087 */
1092 { 0xFFFF, 0xFFFF }, /* R1088 - AIF1 DRC1 (1) */
1093 { 0x1FFF, 0x1FFF }, /* R1089 - AIF1 DRC1 (2) */
1094 { 0xFFFF, 0xFFFF }, /* R1090 - AIF1 DRC1 (3) */
1095 { 0x07FF, 0x07FF }, /* R1091 - AIF1 DRC1 (4) */
1096 { 0x03FF, 0x03FF }, /* R1092 - AIF1 DRC1 (5) */
1097 { 0x0000, 0x0000 }, /* R1093 */
1098 { 0x0000, 0x0000 }, /* R1094 */
1099 { 0x0000, 0x0000 }, /* R1095 */
1100 { 0x0000, 0x0000 }, /* R1096 */
1101 { 0x0000, 0x0000 }, /* R1097 */
1102 { 0x0000, 0x0000 }, /* R1098 */
1103 { 0x0000, 0x0000 }, /* R1099 */
1104 { 0x0000, 0x0000 }, /* R1100 */
1105 { 0x0000, 0x0000 }, /* R1101 */
1106 { 0x0000, 0x0000 }, /* R1102 */
1107 { 0x0000, 0x0000 }, /* R1103 */
1108 { 0xFFFF, 0xFFFF }, /* R1104 - AIF1 DRC2 (1) */
1109 { 0x1FFF, 0x1FFF }, /* R1105 - AIF1 DRC2 (2) */
1110 { 0xFFFF, 0xFFFF }, /* R1106 - AIF1 DRC2 (3) */
1111 { 0x07FF, 0x07FF }, /* R1107 - AIF1 DRC2 (4) */
1112 { 0x03FF, 0x03FF }, /* R1108 - AIF1 DRC2 (5) */
1113 { 0x0000, 0x0000 }, /* R1109 */
1114 { 0x0000, 0x0000 }, /* R1110 */
1115 { 0x0000, 0x0000 }, /* R1111 */
1116 { 0x0000, 0x0000 }, /* R1112 */
1117 { 0x0000, 0x0000 }, /* R1113 */
1118 { 0x0000, 0x0000 }, /* R1114 */
1119 { 0x0000, 0x0000 }, /* R1115 */
1120 { 0x0000, 0x0000 }, /* R1116 */
1121 { 0x0000, 0x0000 }, /* R1117 */
1122 { 0x0000, 0x0000 }, /* R1118 */
1123 { 0x0000, 0x0000 }, /* R1119 */
1124 { 0x0000, 0x0000 }, /* R1120 */
1125 { 0x0000, 0x0000 }, /* R1121 */
1126 { 0x0000, 0x0000 }, /* R1122 */
1127 { 0x0000, 0x0000 }, /* R1123 */
1128 { 0x0000, 0x0000 }, /* R1124 */
1129 { 0x0000, 0x0000 }, /* R1125 */
1130 { 0x0000, 0x0000 }, /* R1126 */
1131 { 0x0000, 0x0000 }, /* R1127 */
1132 { 0x0000, 0x0000 }, /* R1128 */
1133 { 0x0000, 0x0000 }, /* R1129 */
1134 { 0x0000, 0x0000 }, /* R1130 */
1135 { 0x0000, 0x0000 }, /* R1131 */
1136 { 0x0000, 0x0000 }, /* R1132 */
1137 { 0x0000, 0x0000 }, /* R1133 */
1138 { 0x0000, 0x0000 }, /* R1134 */
1139 { 0x0000, 0x0000 }, /* R1135 */
1140 { 0x0000, 0x0000 }, /* R1136 */
1141 { 0x0000, 0x0000 }, /* R1137 */
1142 { 0x0000, 0x0000 }, /* R1138 */
1143 { 0x0000, 0x0000 }, /* R1139 */
1144 { 0x0000, 0x0000 }, /* R1140 */
1145 { 0x0000, 0x0000 }, /* R1141 */
1146 { 0x0000, 0x0000 }, /* R1142 */
1147 { 0x0000, 0x0000 }, /* R1143 */
1148 { 0x0000, 0x0000 }, /* R1144 */
1149 { 0x0000, 0x0000 }, /* R1145 */
1150 { 0x0000, 0x0000 }, /* R1146 */
1151 { 0x0000, 0x0000 }, /* R1147 */
1152 { 0x0000, 0x0000 }, /* R1148 */
1153 { 0x0000, 0x0000 }, /* R1149 */
1154 { 0x0000, 0x0000 }, /* R1150 */
1155 { 0x0000, 0x0000 }, /* R1151 */
1156 { 0xFFFF, 0xFFFF }, /* R1152 - AIF1 DAC1 EQ Gains (1) */
1157 { 0xFFC0, 0xFFC0 }, /* R1153 - AIF1 DAC1 EQ Gains (2) */
1158 { 0xFFFF, 0xFFFF }, /* R1154 - AIF1 DAC1 EQ Band 1 A */
1159 { 0xFFFF, 0xFFFF }, /* R1155 - AIF1 DAC1 EQ Band 1 B */
1160 { 0xFFFF, 0xFFFF }, /* R1156 - AIF1 DAC1 EQ Band 1 PG */
1161 { 0xFFFF, 0xFFFF }, /* R1157 - AIF1 DAC1 EQ Band 2 A */
1162 { 0xFFFF, 0xFFFF }, /* R1158 - AIF1 DAC1 EQ Band 2 B */
1163 { 0xFFFF, 0xFFFF }, /* R1159 - AIF1 DAC1 EQ Band 2 C */
1164 { 0xFFFF, 0xFFFF }, /* R1160 - AIF1 DAC1 EQ Band 2 PG */
1165 { 0xFFFF, 0xFFFF }, /* R1161 - AIF1 DAC1 EQ Band 3 A */
1166 { 0xFFFF, 0xFFFF }, /* R1162 - AIF1 DAC1 EQ Band 3 B */
1167 { 0xFFFF, 0xFFFF }, /* R1163 - AIF1 DAC1 EQ Band 3 C */
1168 { 0xFFFF, 0xFFFF }, /* R1164 - AIF1 DAC1 EQ Band 3 PG */
1169 { 0xFFFF, 0xFFFF }, /* R1165 - AIF1 DAC1 EQ Band 4 A */
1170 { 0xFFFF, 0xFFFF }, /* R1166 - AIF1 DAC1 EQ Band 4 B */
1171 { 0xFFFF, 0xFFFF }, /* R1167 - AIF1 DAC1 EQ Band 4 C */
1172 { 0xFFFF, 0xFFFF }, /* R1168 - AIF1 DAC1 EQ Band 4 PG */
1173 { 0xFFFF, 0xFFFF }, /* R1169 - AIF1 DAC1 EQ Band 5 A */
1174 { 0xFFFF, 0xFFFF }, /* R1170 - AIF1 DAC1 EQ Band 5 B */
1175 { 0xFFFF, 0xFFFF }, /* R1171 - AIF1 DAC1 EQ Band 5 PG */
1176 { 0x0000, 0x0000 }, /* R1172 */
1177 { 0x0000, 0x0000 }, /* R1173 */
1178 { 0x0000, 0x0000 }, /* R1174 */
1179 { 0x0000, 0x0000 }, /* R1175 */
1180 { 0x0000, 0x0000 }, /* R1176 */
1181 { 0x0000, 0x0000 }, /* R1177 */
1182 { 0x0000, 0x0000 }, /* R1178 */
1183 { 0x0000, 0x0000 }, /* R1179 */
1184 { 0x0000, 0x0000 }, /* R1180 */
1185 { 0x0000, 0x0000 }, /* R1181 */
1186 { 0x0000, 0x0000 }, /* R1182 */
1187 { 0x0000, 0x0000 }, /* R1183 */
1188 { 0xFFFF, 0xFFFF }, /* R1184 - AIF1 DAC2 EQ Gains (1) */
1189 { 0xFFC0, 0xFFC0 }, /* R1185 - AIF1 DAC2 EQ Gains (2) */
1190 { 0xFFFF, 0xFFFF }, /* R1186 - AIF1 DAC2 EQ Band 1 A */
1191 { 0xFFFF, 0xFFFF }, /* R1187 - AIF1 DAC2 EQ Band 1 B */
1192 { 0xFFFF, 0xFFFF }, /* R1188 - AIF1 DAC2 EQ Band 1 PG */
1193 { 0xFFFF, 0xFFFF }, /* R1189 - AIF1 DAC2 EQ Band 2 A */
1194 { 0xFFFF, 0xFFFF }, /* R1190 - AIF1 DAC2 EQ Band 2 B */
1195 { 0xFFFF, 0xFFFF }, /* R1191 - AIF1 DAC2 EQ Band 2 C */
1196 { 0xFFFF, 0xFFFF }, /* R1192 - AIF1 DAC2 EQ Band 2 PG */
1197 { 0xFFFF, 0xFFFF }, /* R1193 - AIF1 DAC2 EQ Band 3 A */
1198 { 0xFFFF, 0xFFFF }, /* R1194 - AIF1 DAC2 EQ Band 3 B */
1199 { 0xFFFF, 0xFFFF }, /* R1195 - AIF1 DAC2 EQ Band 3 C */
1200 { 0xFFFF, 0xFFFF }, /* R1196 - AIF1 DAC2 EQ Band 3 PG */
1201 { 0xFFFF, 0xFFFF }, /* R1197 - AIF1 DAC2 EQ Band 4 A */
1202 { 0xFFFF, 0xFFFF }, /* R1198 - AIF1 DAC2 EQ Band 4 B */
1203 { 0xFFFF, 0xFFFF }, /* R1199 - AIF1 DAC2 EQ Band 4 C */
1204 { 0xFFFF, 0xFFFF }, /* R1200 - AIF1 DAC2 EQ Band 4 PG */
1205 { 0xFFFF, 0xFFFF }, /* R1201 - AIF1 DAC2 EQ Band 5 A */
1206 { 0xFFFF, 0xFFFF }, /* R1202 - AIF1 DAC2 EQ Band 5 B */
1207 { 0xFFFF, 0xFFFF }, /* R1203 - AIF1 DAC2 EQ Band 5 PG */
1208 { 0x0000, 0x0000 }, /* R1204 */
1209 { 0x0000, 0x0000 }, /* R1205 */
1210 { 0x0000, 0x0000 }, /* R1206 */
1211 { 0x0000, 0x0000 }, /* R1207 */
1212 { 0x0000, 0x0000 }, /* R1208 */
1213 { 0x0000, 0x0000 }, /* R1209 */
1214 { 0x0000, 0x0000 }, /* R1210 */
1215 { 0x0000, 0x0000 }, /* R1211 */
1216 { 0x0000, 0x0000 }, /* R1212 */
1217 { 0x0000, 0x0000 }, /* R1213 */
1218 { 0x0000, 0x0000 }, /* R1214 */
1219 { 0x0000, 0x0000 }, /* R1215 */
1220 { 0x0000, 0x0000 }, /* R1216 */
1221 { 0x0000, 0x0000 }, /* R1217 */
1222 { 0x0000, 0x0000 }, /* R1218 */
1223 { 0x0000, 0x0000 }, /* R1219 */
1224 { 0x0000, 0x0000 }, /* R1220 */
1225 { 0x0000, 0x0000 }, /* R1221 */
1226 { 0x0000, 0x0000 }, /* R1222 */
1227 { 0x0000, 0x0000 }, /* R1223 */
1228 { 0x0000, 0x0000 }, /* R1224 */
1229 { 0x0000, 0x0000 }, /* R1225 */
1230 { 0x0000, 0x0000 }, /* R1226 */
1231 { 0x0000, 0x0000 }, /* R1227 */
1232 { 0x0000, 0x0000 }, /* R1228 */
1233 { 0x0000, 0x0000 }, /* R1229 */
1234 { 0x0000, 0x0000 }, /* R1230 */
1235 { 0x0000, 0x0000 }, /* R1231 */
1236 { 0x0000, 0x0000 }, /* R1232 */
1237 { 0x0000, 0x0000 }, /* R1233 */
1238 { 0x0000, 0x0000 }, /* R1234 */
1239 { 0x0000, 0x0000 }, /* R1235 */
1240 { 0x0000, 0x0000 }, /* R1236 */
1241 { 0x0000, 0x0000 }, /* R1237 */
1242 { 0x0000, 0x0000 }, /* R1238 */
1243 { 0x0000, 0x0000 }, /* R1239 */
1244 { 0x0000, 0x0000 }, /* R1240 */
1245 { 0x0000, 0x0000 }, /* R1241 */
1246 { 0x0000, 0x0000 }, /* R1242 */
1247 { 0x0000, 0x0000 }, /* R1243 */
1248 { 0x0000, 0x0000 }, /* R1244 */
1249 { 0x0000, 0x0000 }, /* R1245 */
1250 { 0x0000, 0x0000 }, /* R1246 */
1251 { 0x0000, 0x0000 }, /* R1247 */
1252 { 0x0000, 0x0000 }, /* R1248 */
1253 { 0x0000, 0x0000 }, /* R1249 */
1254 { 0x0000, 0x0000 }, /* R1250 */
1255 { 0x0000, 0x0000 }, /* R1251 */
1256 { 0x0000, 0x0000 }, /* R1252 */
1257 { 0x0000, 0x0000 }, /* R1253 */
1258 { 0x0000, 0x0000 }, /* R1254 */
1259 { 0x0000, 0x0000 }, /* R1255 */
1260 { 0x0000, 0x0000 }, /* R1256 */
1261 { 0x0000, 0x0000 }, /* R1257 */
1262 { 0x0000, 0x0000 }, /* R1258 */
1263 { 0x0000, 0x0000 }, /* R1259 */
1264 { 0x0000, 0x0000 }, /* R1260 */
1265 { 0x0000, 0x0000 }, /* R1261 */
1266 { 0x0000, 0x0000 }, /* R1262 */
1267 { 0x0000, 0x0000 }, /* R1263 */
1268 { 0x0000, 0x0000 }, /* R1264 */
1269 { 0x0000, 0x0000 }, /* R1265 */
1270 { 0x0000, 0x0000 }, /* R1266 */
1271 { 0x0000, 0x0000 }, /* R1267 */
1272 { 0x0000, 0x0000 }, /* R1268 */
1273 { 0x0000, 0x0000 }, /* R1269 */
1274 { 0x0000, 0x0000 }, /* R1270 */
1275 { 0x0000, 0x0000 }, /* R1271 */
1276 { 0x0000, 0x0000 }, /* R1272 */
1277 { 0x0000, 0x0000 }, /* R1273 */
1278 { 0x0000, 0x0000 }, /* R1274 */
1279 { 0x0000, 0x0000 }, /* R1275 */
1280 { 0x0000, 0x0000 }, /* R1276 */
1281 { 0x0000, 0x0000 }, /* R1277 */
1282 { 0x0000, 0x0000 }, /* R1278 */
1283 { 0x0000, 0x0000 }, /* R1279 */
1284 { 0x00FF, 0x01FF }, /* R1280 - AIF2 ADC Left Volume */
1285 { 0x00FF, 0x01FF }, /* R1281 - AIF2 ADC Right Volume */
1286 { 0x00FF, 0x01FF }, /* R1282 - AIF2 DAC Left Volume */
1287 { 0x00FF, 0x01FF }, /* R1283 - AIF2 DAC Right Volume */
1288 { 0x0000, 0x0000 }, /* R1284 */
1289 { 0x0000, 0x0000 }, /* R1285 */
1290 { 0x0000, 0x0000 }, /* R1286 */
1291 { 0x0000, 0x0000 }, /* R1287 */
1292 { 0x0000, 0x0000 }, /* R1288 */
1293 { 0x0000, 0x0000 }, /* R1289 */
1294 { 0x0000, 0x0000 }, /* R1290 */
1295 { 0x0000, 0x0000 }, /* R1291 */
1296 { 0x0000, 0x0000 }, /* R1292 */
1297 { 0x0000, 0x0000 }, /* R1293 */
1298 { 0x0000, 0x0000 }, /* R1294 */
1299 { 0x0000, 0x0000 }, /* R1295 */
1300 { 0xF800, 0xF800 }, /* R1296 - AIF2 ADC Filters */
1301 { 0x0000, 0x0000 }, /* R1297 */
1302 { 0x0000, 0x0000 }, /* R1298 */
1303 { 0x0000, 0x0000 }, /* R1299 */
1304 { 0x0000, 0x0000 }, /* R1300 */
1305 { 0x0000, 0x0000 }, /* R1301 */
1306 { 0x0000, 0x0000 }, /* R1302 */
1307 { 0x0000, 0x0000 }, /* R1303 */
1308 { 0x0000, 0x0000 }, /* R1304 */
1309 { 0x0000, 0x0000 }, /* R1305 */
1310 { 0x0000, 0x0000 }, /* R1306 */
1311 { 0x0000, 0x0000 }, /* R1307 */
1312 { 0x0000, 0x0000 }, /* R1308 */
1313 { 0x0000, 0x0000 }, /* R1309 */
1314 { 0x0000, 0x0000 }, /* R1310 */
1315 { 0x0000, 0x0000 }, /* R1311 */
1316 { 0x02B6, 0x02B6 }, /* R1312 - AIF2 DAC Filters (1) */
1317 { 0x3F00, 0x3F00 }, /* R1313 - AIF2 DAC Filters (2) */
1318 { 0x0000, 0x0000 }, /* R1314 */
1319 { 0x0000, 0x0000 }, /* R1315 */
1320 { 0x0000, 0x0000 }, /* R1316 */
1321 { 0x0000, 0x0000 }, /* R1317 */
1322 { 0x0000, 0x0000 }, /* R1318 */
1323 { 0x0000, 0x0000 }, /* R1319 */
1324 { 0x0000, 0x0000 }, /* R1320 */
1325 { 0x0000, 0x0000 }, /* R1321 */
1326 { 0x0000, 0x0000 }, /* R1322 */
1327 { 0x0000, 0x0000 }, /* R1323 */
1328 { 0x0000, 0x0000 }, /* R1324 */
1329 { 0x0000, 0x0000 }, /* R1325 */
1330 { 0x0000, 0x0000 }, /* R1326 */
1331 { 0x0000, 0x0000 }, /* R1327 */
1332 { 0x0000, 0x0000 }, /* R1328 */
1333 { 0x0000, 0x0000 }, /* R1329 */
1334 { 0x0000, 0x0000 }, /* R1330 */
1335 { 0x0000, 0x0000 }, /* R1331 */
1336 { 0x0000, 0x0000 }, /* R1332 */
1337 { 0x0000, 0x0000 }, /* R1333 */
1338 { 0x0000, 0x0000 }, /* R1334 */
1339 { 0x0000, 0x0000 }, /* R1335 */
1340 { 0x0000, 0x0000 }, /* R1336 */
1341 { 0x0000, 0x0000 }, /* R1337 */
1342 { 0x0000, 0x0000 }, /* R1338 */
1343 { 0x0000, 0x0000 }, /* R1339 */
1344 { 0x0000, 0x0000 }, /* R1340 */
1345 { 0x0000, 0x0000 }, /* R1341 */
1346 { 0x0000, 0x0000 }, /* R1342 */
1347 { 0x0000, 0x0000 }, /* R1343 */
1348 { 0xFFFF, 0xFFFF }, /* R1344 - AIF2 DRC (1) */
1349 { 0x1FFF, 0x1FFF }, /* R1345 - AIF2 DRC (2) */
1350 { 0xFFFF, 0xFFFF }, /* R1346 - AIF2 DRC (3) */
1351 { 0x07FF, 0x07FF }, /* R1347 - AIF2 DRC (4) */
1352 { 0x03FF, 0x03FF }, /* R1348 - AIF2 DRC (5) */
1353 { 0x0000, 0x0000 }, /* R1349 */
1354 { 0x0000, 0x0000 }, /* R1350 */
1355 { 0x0000, 0x0000 }, /* R1351 */
1356 { 0x0000, 0x0000 }, /* R1352 */
1357 { 0x0000, 0x0000 }, /* R1353 */
1358 { 0x0000, 0x0000 }, /* R1354 */
1359 { 0x0000, 0x0000 }, /* R1355 */
1360 { 0x0000, 0x0000 }, /* R1356 */
1361 { 0x0000, 0x0000 }, /* R1357 */
1362 { 0x0000, 0x0000 }, /* R1358 */
1363 { 0x0000, 0x0000 }, /* R1359 */
1364 { 0x0000, 0x0000 }, /* R1360 */
1365 { 0x0000, 0x0000 }, /* R1361 */
1366 { 0x0000, 0x0000 }, /* R1362 */
1367 { 0x0000, 0x0000 }, /* R1363 */
1368 { 0x0000, 0x0000 }, /* R1364 */
1369 { 0x0000, 0x0000 }, /* R1365 */
1370 { 0x0000, 0x0000 }, /* R1366 */
1371 { 0x0000, 0x0000 }, /* R1367 */
1372 { 0x0000, 0x0000 }, /* R1368 */
1373 { 0x0000, 0x0000 }, /* R1369 */
1374 { 0x0000, 0x0000 }, /* R1370 */
1375 { 0x0000, 0x0000 }, /* R1371 */
1376 { 0x0000, 0x0000 }, /* R1372 */
1377 { 0x0000, 0x0000 }, /* R1373 */
1378 { 0x0000, 0x0000 }, /* R1374 */
1379 { 0x0000, 0x0000 }, /* R1375 */
1380 { 0x0000, 0x0000 }, /* R1376 */
1381 { 0x0000, 0x0000 }, /* R1377 */
1382 { 0x0000, 0x0000 }, /* R1378 */
1383 { 0x0000, 0x0000 }, /* R1379 */
1384 { 0x0000, 0x0000 }, /* R1380 */
1385 { 0x0000, 0x0000 }, /* R1381 */
1386 { 0x0000, 0x0000 }, /* R1382 */
1387 { 0x0000, 0x0000 }, /* R1383 */
1388 { 0x0000, 0x0000 }, /* R1384 */
1389 { 0x0000, 0x0000 }, /* R1385 */
1390 { 0x0000, 0x0000 }, /* R1386 */
1391 { 0x0000, 0x0000 }, /* R1387 */
1392 { 0x0000, 0x0000 }, /* R1388 */
1393 { 0x0000, 0x0000 }, /* R1389 */
1394 { 0x0000, 0x0000 }, /* R1390 */
1395 { 0x0000, 0x0000 }, /* R1391 */
1396 { 0x0000, 0x0000 }, /* R1392 */
1397 { 0x0000, 0x0000 }, /* R1393 */
1398 { 0x0000, 0x0000 }, /* R1394 */
1399 { 0x0000, 0x0000 }, /* R1395 */
1400 { 0x0000, 0x0000 }, /* R1396 */
1401 { 0x0000, 0x0000 }, /* R1397 */
1402 { 0x0000, 0x0000 }, /* R1398 */
1403 { 0x0000, 0x0000 }, /* R1399 */
1404 { 0x0000, 0x0000 }, /* R1400 */
1405 { 0x0000, 0x0000 }, /* R1401 */
1406 { 0x0000, 0x0000 }, /* R1402 */
1407 { 0x0000, 0x0000 }, /* R1403 */
1408 { 0x0000, 0x0000 }, /* R1404 */
1409 { 0x0000, 0x0000 }, /* R1405 */
1410 { 0x0000, 0x0000 }, /* R1406 */
1411 { 0x0000, 0x0000 }, /* R1407 */
1412 { 0xFFFF, 0xFFFF }, /* R1408 - AIF2 EQ Gains (1) */
1413 { 0xFFC0, 0xFFC0 }, /* R1409 - AIF2 EQ Gains (2) */
1414 { 0xFFFF, 0xFFFF }, /* R1410 - AIF2 EQ Band 1 A */
1415 { 0xFFFF, 0xFFFF }, /* R1411 - AIF2 EQ Band 1 B */
1416 { 0xFFFF, 0xFFFF }, /* R1412 - AIF2 EQ Band 1 PG */
1417 { 0xFFFF, 0xFFFF }, /* R1413 - AIF2 EQ Band 2 A */
1418 { 0xFFFF, 0xFFFF }, /* R1414 - AIF2 EQ Band 2 B */
1419 { 0xFFFF, 0xFFFF }, /* R1415 - AIF2 EQ Band 2 C */
1420 { 0xFFFF, 0xFFFF }, /* R1416 - AIF2 EQ Band 2 PG */
1421 { 0xFFFF, 0xFFFF }, /* R1417 - AIF2 EQ Band 3 A */
1422 { 0xFFFF, 0xFFFF }, /* R1418 - AIF2 EQ Band 3 B */
1423 { 0xFFFF, 0xFFFF }, /* R1419 - AIF2 EQ Band 3 C */
1424 { 0xFFFF, 0xFFFF }, /* R1420 - AIF2 EQ Band 3 PG */
1425 { 0xFFFF, 0xFFFF }, /* R1421 - AIF2 EQ Band 4 A */
1426 { 0xFFFF, 0xFFFF }, /* R1422 - AIF2 EQ Band 4 B */
1427 { 0xFFFF, 0xFFFF }, /* R1423 - AIF2 EQ Band 4 C */
1428 { 0xFFFF, 0xFFFF }, /* R1424 - AIF2 EQ Band 4 PG */
1429 { 0xFFFF, 0xFFFF }, /* R1425 - AIF2 EQ Band 5 A */
1430 { 0xFFFF, 0xFFFF }, /* R1426 - AIF2 EQ Band 5 B */
1431 { 0xFFFF, 0xFFFF }, /* R1427 - AIF2 EQ Band 5 PG */
1432 { 0x0000, 0x0000 }, /* R1428 */
1433 { 0x0000, 0x0000 }, /* R1429 */
1434 { 0x0000, 0x0000 }, /* R1430 */
1435 { 0x0000, 0x0000 }, /* R1431 */
1436 { 0x0000, 0x0000 }, /* R1432 */
1437 { 0x0000, 0x0000 }, /* R1433 */
1438 { 0x0000, 0x0000 }, /* R1434 */
1439 { 0x0000, 0x0000 }, /* R1435 */
1440 { 0x0000, 0x0000 }, /* R1436 */
1441 { 0x0000, 0x0000 }, /* R1437 */
1442 { 0x0000, 0x0000 }, /* R1438 */
1443 { 0x0000, 0x0000 }, /* R1439 */
1444 { 0x0000, 0x0000 }, /* R1440 */
1445 { 0x0000, 0x0000 }, /* R1441 */
1446 { 0x0000, 0x0000 }, /* R1442 */
1447 { 0x0000, 0x0000 }, /* R1443 */
1448 { 0x0000, 0x0000 }, /* R1444 */
1449 { 0x0000, 0x0000 }, /* R1445 */
1450 { 0x0000, 0x0000 }, /* R1446 */
1451 { 0x0000, 0x0000 }, /* R1447 */
1452 { 0x0000, 0x0000 }, /* R1448 */
1453 { 0x0000, 0x0000 }, /* R1449 */
1454 { 0x0000, 0x0000 }, /* R1450 */
1455 { 0x0000, 0x0000 }, /* R1451 */
1456 { 0x0000, 0x0000 }, /* R1452 */
1457 { 0x0000, 0x0000 }, /* R1453 */
1458 { 0x0000, 0x0000 }, /* R1454 */
1459 { 0x0000, 0x0000 }, /* R1455 */
1460 { 0x0000, 0x0000 }, /* R1456 */
1461 { 0x0000, 0x0000 }, /* R1457 */
1462 { 0x0000, 0x0000 }, /* R1458 */
1463 { 0x0000, 0x0000 }, /* R1459 */
1464 { 0x0000, 0x0000 }, /* R1460 */
1465 { 0x0000, 0x0000 }, /* R1461 */
1466 { 0x0000, 0x0000 }, /* R1462 */
1467 { 0x0000, 0x0000 }, /* R1463 */
1468 { 0x0000, 0x0000 }, /* R1464 */
1469 { 0x0000, 0x0000 }, /* R1465 */
1470 { 0x0000, 0x0000 }, /* R1466 */
1471 { 0x0000, 0x0000 }, /* R1467 */
1472 { 0x0000, 0x0000 }, /* R1468 */
1473 { 0x0000, 0x0000 }, /* R1469 */
1474 { 0x0000, 0x0000 }, /* R1470 */
1475 { 0x0000, 0x0000 }, /* R1471 */
1476 { 0x0000, 0x0000 }, /* R1472 */
1477 { 0x0000, 0x0000 }, /* R1473 */
1478 { 0x0000, 0x0000 }, /* R1474 */
1479 { 0x0000, 0x0000 }, /* R1475 */
1480 { 0x0000, 0x0000 }, /* R1476 */
1481 { 0x0000, 0x0000 }, /* R1477 */
1482 { 0x0000, 0x0000 }, /* R1478 */
1483 { 0x0000, 0x0000 }, /* R1479 */
1484 { 0x0000, 0x0000 }, /* R1480 */
1485 { 0x0000, 0x0000 }, /* R1481 */
1486 { 0x0000, 0x0000 }, /* R1482 */
1487 { 0x0000, 0x0000 }, /* R1483 */
1488 { 0x0000, 0x0000 }, /* R1484 */
1489 { 0x0000, 0x0000 }, /* R1485 */
1490 { 0x0000, 0x0000 }, /* R1486 */
1491 { 0x0000, 0x0000 }, /* R1487 */
1492 { 0x0000, 0x0000 }, /* R1488 */
1493 { 0x0000, 0x0000 }, /* R1489 */
1494 { 0x0000, 0x0000 }, /* R1490 */
1495 { 0x0000, 0x0000 }, /* R1491 */
1496 { 0x0000, 0x0000 }, /* R1492 */
1497 { 0x0000, 0x0000 }, /* R1493 */
1498 { 0x0000, 0x0000 }, /* R1494 */
1499 { 0x0000, 0x0000 }, /* R1495 */
1500 { 0x0000, 0x0000 }, /* R1496 */
1501 { 0x0000, 0x0000 }, /* R1497 */
1502 { 0x0000, 0x0000 }, /* R1498 */
1503 { 0x0000, 0x0000 }, /* R1499 */
1504 { 0x0000, 0x0000 }, /* R1500 */
1505 { 0x0000, 0x0000 }, /* R1501 */
1506 { 0x0000, 0x0000 }, /* R1502 */
1507 { 0x0000, 0x0000 }, /* R1503 */
1508 { 0x0000, 0x0000 }, /* R1504 */
1509 { 0x0000, 0x0000 }, /* R1505 */
1510 { 0x0000, 0x0000 }, /* R1506 */
1511 { 0x0000, 0x0000 }, /* R1507 */
1512 { 0x0000, 0x0000 }, /* R1508 */
1513 { 0x0000, 0x0000 }, /* R1509 */
1514 { 0x0000, 0x0000 }, /* R1510 */
1515 { 0x0000, 0x0000 }, /* R1511 */
1516 { 0x0000, 0x0000 }, /* R1512 */
1517 { 0x0000, 0x0000 }, /* R1513 */
1518 { 0x0000, 0x0000 }, /* R1514 */
1519 { 0x0000, 0x0000 }, /* R1515 */
1520 { 0x0000, 0x0000 }, /* R1516 */
1521 { 0x0000, 0x0000 }, /* R1517 */
1522 { 0x0000, 0x0000 }, /* R1518 */
1523 { 0x0000, 0x0000 }, /* R1519 */
1524 { 0x0000, 0x0000 }, /* R1520 */
1525 { 0x0000, 0x0000 }, /* R1521 */
1526 { 0x0000, 0x0000 }, /* R1522 */
1527 { 0x0000, 0x0000 }, /* R1523 */
1528 { 0x0000, 0x0000 }, /* R1524 */
1529 { 0x0000, 0x0000 }, /* R1525 */
1530 { 0x0000, 0x0000 }, /* R1526 */
1531 { 0x0000, 0x0000 }, /* R1527 */
1532 { 0x0000, 0x0000 }, /* R1528 */
1533 { 0x0000, 0x0000 }, /* R1529 */
1534 { 0x0000, 0x0000 }, /* R1530 */
1535 { 0x0000, 0x0000 }, /* R1531 */
1536 { 0x0000, 0x0000 }, /* R1532 */
1537 { 0x0000, 0x0000 }, /* R1533 */
1538 { 0x0000, 0x0000 }, /* R1534 */
1539 { 0x0000, 0x0000 }, /* R1535 */
1540 { 0x01EF, 0x01EF }, /* R1536 - DAC1 Mixer Volumes */
1541 { 0x0037, 0x0037 }, /* R1537 - DAC1 Left Mixer Routing */
1542 { 0x0037, 0x0037 }, /* R1538 - DAC1 Right Mixer Routing */
1543 { 0x01EF, 0x01EF }, /* R1539 - DAC2 Mixer Volumes */
1544 { 0x0037, 0x0037 }, /* R1540 - DAC2 Left Mixer Routing */
1545 { 0x0037, 0x0037 }, /* R1541 - DAC2 Right Mixer Routing */
1546 { 0x0003, 0x0003 }, /* R1542 - AIF1 ADC1 Left Mixer Routing */
1547 { 0x0003, 0x0003 }, /* R1543 - AIF1 ADC1 Right Mixer Routing */
1548 { 0x0003, 0x0003 }, /* R1544 - AIF1 ADC2 Left Mixer Routing */
1549 { 0x0003, 0x0003 }, /* R1545 - AIF1 ADC2 Right mixer Routing */
1550 { 0x0000, 0x0000 }, /* R1546 */
1551 { 0x0000, 0x0000 }, /* R1547 */
1552 { 0x0000, 0x0000 }, /* R1548 */
1553 { 0x0000, 0x0000 }, /* R1549 */
1554 { 0x0000, 0x0000 }, /* R1550 */
1555 { 0x0000, 0x0000 }, /* R1551 */
1556 { 0x02FF, 0x03FF }, /* R1552 - DAC1 Left Volume */
1557 { 0x02FF, 0x03FF }, /* R1553 - DAC1 Right Volume */
1558 { 0x02FF, 0x03FF }, /* R1554 - DAC2 Left Volume */
1559 { 0x02FF, 0x03FF }, /* R1555 - DAC2 Right Volume */
1560 { 0x0003, 0x0003 }, /* R1556 - DAC Softmute */
1561 { 0x0000, 0x0000 }, /* R1557 */
1562 { 0x0000, 0x0000 }, /* R1558 */
1563 { 0x0000, 0x0000 }, /* R1559 */
1564 { 0x0000, 0x0000 }, /* R1560 */
1565 { 0x0000, 0x0000 }, /* R1561 */
1566 { 0x0000, 0x0000 }, /* R1562 */
1567 { 0x0000, 0x0000 }, /* R1563 */
1568 { 0x0000, 0x0000 }, /* R1564 */
1569 { 0x0000, 0x0000 }, /* R1565 */
1570 { 0x0000, 0x0000 }, /* R1566 */
1571 { 0x0000, 0x0000 }, /* R1567 */
1572 { 0x0003, 0x0003 }, /* R1568 - Oversampling */
1573 { 0x03C3, 0x03C3 }, /* R1569 - Sidetone */
1574};
1575
1576const u16 wm8994_reg_defaults[WM8994_CACHE_SIZE] = {
1577 0x8994, /* R0 - Software Reset */
1578 0x0000, /* R1 - Power Management (1) */
1579 0x6000, /* R2 - Power Management (2) */
1580 0x0000, /* R3 - Power Management (3) */
1581 0x0000, /* R4 - Power Management (4) */
1582 0x0000, /* R5 - Power Management (5) */
1583 0x0000, /* R6 - Power Management (6) */
1584 0x0000, /* R7 */
1585 0x0000, /* R8 */
1586 0x0000, /* R9 */
1587 0x0000, /* R10 */
1588 0x0000, /* R11 */
1589 0x0000, /* R12 */
1590 0x0000, /* R13 */
1591 0x0000, /* R14 */
1592 0x0000, /* R15 */
1593 0x0000, /* R16 */
1594 0x0000, /* R17 */
1595 0x0000, /* R18 */
1596 0x0000, /* R19 */
1597 0x0000, /* R20 */
1598 0x0000, /* R21 - Input Mixer (1) */
1599 0x0000, /* R22 */
1600 0x0000, /* R23 */
1601 0x008B, /* R24 - Left Line Input 1&2 Volume */
1602 0x008B, /* R25 - Left Line Input 3&4 Volume */
1603 0x008B, /* R26 - Right Line Input 1&2 Volume */
1604 0x008B, /* R27 - Right Line Input 3&4 Volume */
1605 0x006D, /* R28 - Left Output Volume */
1606 0x006D, /* R29 - Right Output Volume */
1607 0x0066, /* R30 - Line Outputs Volume */
1608 0x0020, /* R31 - HPOUT2 Volume */
1609 0x0079, /* R32 - Left OPGA Volume */
1610 0x0079, /* R33 - Right OPGA Volume */
1611 0x0003, /* R34 - SPKMIXL Attenuation */
1612 0x0003, /* R35 - SPKMIXR Attenuation */
1613 0x0011, /* R36 - SPKOUT Mixers */
1614 0x0140, /* R37 - ClassD */
1615 0x0079, /* R38 - Speaker Volume Left */
1616 0x0079, /* R39 - Speaker Volume Right */
1617 0x0000, /* R40 - Input Mixer (2) */
1618 0x0000, /* R41 - Input Mixer (3) */
1619 0x0000, /* R42 - Input Mixer (4) */
1620 0x0000, /* R43 - Input Mixer (5) */
1621 0x0000, /* R44 - Input Mixer (6) */
1622 0x0000, /* R45 - Output Mixer (1) */
1623 0x0000, /* R46 - Output Mixer (2) */
1624 0x0000, /* R47 - Output Mixer (3) */
1625 0x0000, /* R48 - Output Mixer (4) */
1626 0x0000, /* R49 - Output Mixer (5) */
1627 0x0000, /* R50 - Output Mixer (6) */
1628 0x0000, /* R51 - HPOUT2 Mixer */
1629 0x0000, /* R52 - Line Mixer (1) */
1630 0x0000, /* R53 - Line Mixer (2) */
1631 0x0000, /* R54 - Speaker Mixer */
1632 0x0000, /* R55 - Additional Control */
1633 0x0000, /* R56 - AntiPOP (1) */
1634 0x0000, /* R57 - AntiPOP (2) */
1635 0x0000, /* R58 - MICBIAS */
1636 0x000D, /* R59 - LDO 1 */
1637 0x0003, /* R60 - LDO 2 */
1638 0x0000, /* R61 */
1639 0x0000, /* R62 */
1640 0x0000, /* R63 */
1641 0x0000, /* R64 */
1642 0x0000, /* R65 */
1643 0x0000, /* R66 */
1644 0x0000, /* R67 */
1645 0x0000, /* R68 */
1646 0x0000, /* R69 */
1647 0x0000, /* R70 */
1648 0x0000, /* R71 */
1649 0x0000, /* R72 */
1650 0x0000, /* R73 */
1651 0x0000, /* R74 */
1652 0x0000, /* R75 */
1653 0x1F25, /* R76 - Charge Pump (1) */
1654 0x0000, /* R77 */
1655 0x0000, /* R78 */
1656 0x0000, /* R79 */
1657 0x0000, /* R80 */
1658 0x0004, /* R81 - Class W (1) */
1659 0x0000, /* R82 */
1660 0x0000, /* R83 */
1661 0x0000, /* R84 - DC Servo (1) */
1662 0x054A, /* R85 - DC Servo (2) */
1663 0x0000, /* R86 */
1664 0x0000, /* R87 - DC Servo (4) */
1665 0x0000, /* R88 - DC Servo Readback */
1666 0x0000, /* R89 */
1667 0x0000, /* R90 */
1668 0x0000, /* R91 */
1669 0x0000, /* R92 */
1670 0x0000, /* R93 */
1671 0x0000, /* R94 */
1672 0x0000, /* R95 */
1673 0x0000, /* R96 - Analogue HP (1) */
1674 0x0000, /* R97 */
1675 0x0000, /* R98 */
1676 0x0000, /* R99 */
1677 0x0000, /* R100 */
1678 0x0000, /* R101 */
1679 0x0000, /* R102 */
1680 0x0000, /* R103 */
1681 0x0000, /* R104 */
1682 0x0000, /* R105 */
1683 0x0000, /* R106 */
1684 0x0000, /* R107 */
1685 0x0000, /* R108 */
1686 0x0000, /* R109 */
1687 0x0000, /* R110 */
1688 0x0000, /* R111 */
1689 0x0000, /* R112 */
1690 0x0000, /* R113 */
1691 0x0000, /* R114 */
1692 0x0000, /* R115 */
1693 0x0000, /* R116 */
1694 0x0000, /* R117 */
1695 0x0000, /* R118 */
1696 0x0000, /* R119 */
1697 0x0000, /* R120 */
1698 0x0000, /* R121 */
1699 0x0000, /* R122 */
1700 0x0000, /* R123 */
1701 0x0000, /* R124 */
1702 0x0000, /* R125 */
1703 0x0000, /* R126 */
1704 0x0000, /* R127 */
1705 0x0000, /* R128 */
1706 0x0000, /* R129 */
1707 0x0000, /* R130 */
1708 0x0000, /* R131 */
1709 0x0000, /* R132 */
1710 0x0000, /* R133 */
1711 0x0000, /* R134 */
1712 0x0000, /* R135 */
1713 0x0000, /* R136 */
1714 0x0000, /* R137 */
1715 0x0000, /* R138 */
1716 0x0000, /* R139 */
1717 0x0000, /* R140 */
1718 0x0000, /* R141 */
1719 0x0000, /* R142 */
1720 0x0000, /* R143 */
1721 0x0000, /* R144 */
1722 0x0000, /* R145 */
1723 0x0000, /* R146 */
1724 0x0000, /* R147 */
1725 0x0000, /* R148 */
1726 0x0000, /* R149 */
1727 0x0000, /* R150 */
1728 0x0000, /* R151 */
1729 0x0000, /* R152 */
1730 0x0000, /* R153 */
1731 0x0000, /* R154 */
1732 0x0000, /* R155 */
1733 0x0000, /* R156 */
1734 0x0000, /* R157 */
1735 0x0000, /* R158 */
1736 0x0000, /* R159 */
1737 0x0000, /* R160 */
1738 0x0000, /* R161 */
1739 0x0000, /* R162 */
1740 0x0000, /* R163 */
1741 0x0000, /* R164 */
1742 0x0000, /* R165 */
1743 0x0000, /* R166 */
1744 0x0000, /* R167 */
1745 0x0000, /* R168 */
1746 0x0000, /* R169 */
1747 0x0000, /* R170 */
1748 0x0000, /* R171 */
1749 0x0000, /* R172 */
1750 0x0000, /* R173 */
1751 0x0000, /* R174 */
1752 0x0000, /* R175 */
1753 0x0000, /* R176 */
1754 0x0000, /* R177 */
1755 0x0000, /* R178 */
1756 0x0000, /* R179 */
1757 0x0000, /* R180 */
1758 0x0000, /* R181 */
1759 0x0000, /* R182 */
1760 0x0000, /* R183 */
1761 0x0000, /* R184 */
1762 0x0000, /* R185 */
1763 0x0000, /* R186 */
1764 0x0000, /* R187 */
1765 0x0000, /* R188 */
1766 0x0000, /* R189 */
1767 0x0000, /* R190 */
1768 0x0000, /* R191 */
1769 0x0000, /* R192 */
1770 0x0000, /* R193 */
1771 0x0000, /* R194 */
1772 0x0000, /* R195 */
1773 0x0000, /* R196 */
1774 0x0000, /* R197 */
1775 0x0000, /* R198 */
1776 0x0000, /* R199 */
1777 0x0000, /* R200 */
1778 0x0000, /* R201 */
1779 0x0000, /* R202 */
1780 0x0000, /* R203 */
1781 0x0000, /* R204 */
1782 0x0000, /* R205 */
1783 0x0000, /* R206 */
1784 0x0000, /* R207 */
1785 0x0000, /* R208 */
1786 0x0000, /* R209 */
1787 0x0000, /* R210 */
1788 0x0000, /* R211 */
1789 0x0000, /* R212 */
1790 0x0000, /* R213 */
1791 0x0000, /* R214 */
1792 0x0000, /* R215 */
1793 0x0000, /* R216 */
1794 0x0000, /* R217 */
1795 0x0000, /* R218 */
1796 0x0000, /* R219 */
1797 0x0000, /* R220 */
1798 0x0000, /* R221 */
1799 0x0000, /* R222 */
1800 0x0000, /* R223 */
1801 0x0000, /* R224 */
1802 0x0000, /* R225 */
1803 0x0000, /* R226 */
1804 0x0000, /* R227 */
1805 0x0000, /* R228 */
1806 0x0000, /* R229 */
1807 0x0000, /* R230 */
1808 0x0000, /* R231 */
1809 0x0000, /* R232 */
1810 0x0000, /* R233 */
1811 0x0000, /* R234 */
1812 0x0000, /* R235 */
1813 0x0000, /* R236 */
1814 0x0000, /* R237 */
1815 0x0000, /* R238 */
1816 0x0000, /* R239 */
1817 0x0000, /* R240 */
1818 0x0000, /* R241 */
1819 0x0000, /* R242 */
1820 0x0000, /* R243 */
1821 0x0000, /* R244 */
1822 0x0000, /* R245 */
1823 0x0000, /* R246 */
1824 0x0000, /* R247 */
1825 0x0000, /* R248 */
1826 0x0000, /* R249 */
1827 0x0000, /* R250 */
1828 0x0000, /* R251 */
1829 0x0000, /* R252 */
1830 0x0000, /* R253 */
1831 0x0000, /* R254 */
1832 0x0000, /* R255 */
1833 0x0003, /* R256 - Chip Revision */
1834 0x8004, /* R257 - Control Interface */
1835 0x0000, /* R258 */
1836 0x0000, /* R259 */
1837 0x0000, /* R260 */
1838 0x0000, /* R261 */
1839 0x0000, /* R262 */
1840 0x0000, /* R263 */
1841 0x0000, /* R264 */
1842 0x0000, /* R265 */
1843 0x0000, /* R266 */
1844 0x0000, /* R267 */
1845 0x0000, /* R268 */
1846 0x0000, /* R269 */
1847 0x0000, /* R270 */
1848 0x0000, /* R271 */
1849 0x0000, /* R272 - Write Sequencer Ctrl (1) */
1850 0x0000, /* R273 - Write Sequencer Ctrl (2) */
1851 0x0000, /* R274 */
1852 0x0000, /* R275 */
1853 0x0000, /* R276 */
1854 0x0000, /* R277 */
1855 0x0000, /* R278 */
1856 0x0000, /* R279 */
1857 0x0000, /* R280 */
1858 0x0000, /* R281 */
1859 0x0000, /* R282 */
1860 0x0000, /* R283 */
1861 0x0000, /* R284 */
1862 0x0000, /* R285 */
1863 0x0000, /* R286 */
1864 0x0000, /* R287 */
1865 0x0000, /* R288 */
1866 0x0000, /* R289 */
1867 0x0000, /* R290 */
1868 0x0000, /* R291 */
1869 0x0000, /* R292 */
1870 0x0000, /* R293 */
1871 0x0000, /* R294 */
1872 0x0000, /* R295 */
1873 0x0000, /* R296 */
1874 0x0000, /* R297 */
1875 0x0000, /* R298 */
1876 0x0000, /* R299 */
1877 0x0000, /* R300 */
1878 0x0000, /* R301 */
1879 0x0000, /* R302 */
1880 0x0000, /* R303 */
1881 0x0000, /* R304 */
1882 0x0000, /* R305 */
1883 0x0000, /* R306 */
1884 0x0000, /* R307 */
1885 0x0000, /* R308 */
1886 0x0000, /* R309 */
1887 0x0000, /* R310 */
1888 0x0000, /* R311 */
1889 0x0000, /* R312 */
1890 0x0000, /* R313 */
1891 0x0000, /* R314 */
1892 0x0000, /* R315 */
1893 0x0000, /* R316 */
1894 0x0000, /* R317 */
1895 0x0000, /* R318 */
1896 0x0000, /* R319 */
1897 0x0000, /* R320 */
1898 0x0000, /* R321 */
1899 0x0000, /* R322 */
1900 0x0000, /* R323 */
1901 0x0000, /* R324 */
1902 0x0000, /* R325 */
1903 0x0000, /* R326 */
1904 0x0000, /* R327 */
1905 0x0000, /* R328 */
1906 0x0000, /* R329 */
1907 0x0000, /* R330 */
1908 0x0000, /* R331 */
1909 0x0000, /* R332 */
1910 0x0000, /* R333 */
1911 0x0000, /* R334 */
1912 0x0000, /* R335 */
1913 0x0000, /* R336 */
1914 0x0000, /* R337 */
1915 0x0000, /* R338 */
1916 0x0000, /* R339 */
1917 0x0000, /* R340 */
1918 0x0000, /* R341 */
1919 0x0000, /* R342 */
1920 0x0000, /* R343 */
1921 0x0000, /* R344 */
1922 0x0000, /* R345 */
1923 0x0000, /* R346 */
1924 0x0000, /* R347 */
1925 0x0000, /* R348 */
1926 0x0000, /* R349 */
1927 0x0000, /* R350 */
1928 0x0000, /* R351 */
1929 0x0000, /* R352 */
1930 0x0000, /* R353 */
1931 0x0000, /* R354 */
1932 0x0000, /* R355 */
1933 0x0000, /* R356 */
1934 0x0000, /* R357 */
1935 0x0000, /* R358 */
1936 0x0000, /* R359 */
1937 0x0000, /* R360 */
1938 0x0000, /* R361 */
1939 0x0000, /* R362 */
1940 0x0000, /* R363 */
1941 0x0000, /* R364 */
1942 0x0000, /* R365 */
1943 0x0000, /* R366 */
1944 0x0000, /* R367 */
1945 0x0000, /* R368 */
1946 0x0000, /* R369 */
1947 0x0000, /* R370 */
1948 0x0000, /* R371 */
1949 0x0000, /* R372 */
1950 0x0000, /* R373 */
1951 0x0000, /* R374 */
1952 0x0000, /* R375 */
1953 0x0000, /* R376 */
1954 0x0000, /* R377 */
1955 0x0000, /* R378 */
1956 0x0000, /* R379 */
1957 0x0000, /* R380 */
1958 0x0000, /* R381 */
1959 0x0000, /* R382 */
1960 0x0000, /* R383 */
1961 0x0000, /* R384 */
1962 0x0000, /* R385 */
1963 0x0000, /* R386 */
1964 0x0000, /* R387 */
1965 0x0000, /* R388 */
1966 0x0000, /* R389 */
1967 0x0000, /* R390 */
1968 0x0000, /* R391 */
1969 0x0000, /* R392 */
1970 0x0000, /* R393 */
1971 0x0000, /* R394 */
1972 0x0000, /* R395 */
1973 0x0000, /* R396 */
1974 0x0000, /* R397 */
1975 0x0000, /* R398 */
1976 0x0000, /* R399 */
1977 0x0000, /* R400 */
1978 0x0000, /* R401 */
1979 0x0000, /* R402 */
1980 0x0000, /* R403 */
1981 0x0000, /* R404 */
1982 0x0000, /* R405 */
1983 0x0000, /* R406 */
1984 0x0000, /* R407 */
1985 0x0000, /* R408 */
1986 0x0000, /* R409 */
1987 0x0000, /* R410 */
1988 0x0000, /* R411 */
1989 0x0000, /* R412 */
1990 0x0000, /* R413 */
1991 0x0000, /* R414 */
1992 0x0000, /* R415 */
1993 0x0000, /* R416 */
1994 0x0000, /* R417 */
1995 0x0000, /* R418 */
1996 0x0000, /* R419 */
1997 0x0000, /* R420 */
1998 0x0000, /* R421 */
1999 0x0000, /* R422 */
2000 0x0000, /* R423 */
2001 0x0000, /* R424 */
2002 0x0000, /* R425 */
2003 0x0000, /* R426 */
2004 0x0000, /* R427 */
2005 0x0000, /* R428 */
2006 0x0000, /* R429 */
2007 0x0000, /* R430 */
2008 0x0000, /* R431 */
2009 0x0000, /* R432 */
2010 0x0000, /* R433 */
2011 0x0000, /* R434 */
2012 0x0000, /* R435 */
2013 0x0000, /* R436 */
2014 0x0000, /* R437 */
2015 0x0000, /* R438 */
2016 0x0000, /* R439 */
2017 0x0000, /* R440 */
2018 0x0000, /* R441 */
2019 0x0000, /* R442 */
2020 0x0000, /* R443 */
2021 0x0000, /* R444 */
2022 0x0000, /* R445 */
2023 0x0000, /* R446 */
2024 0x0000, /* R447 */
2025 0x0000, /* R448 */
2026 0x0000, /* R449 */
2027 0x0000, /* R450 */
2028 0x0000, /* R451 */
2029 0x0000, /* R452 */
2030 0x0000, /* R453 */
2031 0x0000, /* R454 */
2032 0x0000, /* R455 */
2033 0x0000, /* R456 */
2034 0x0000, /* R457 */
2035 0x0000, /* R458 */
2036 0x0000, /* R459 */
2037 0x0000, /* R460 */
2038 0x0000, /* R461 */
2039 0x0000, /* R462 */
2040 0x0000, /* R463 */
2041 0x0000, /* R464 */
2042 0x0000, /* R465 */
2043 0x0000, /* R466 */
2044 0x0000, /* R467 */
2045 0x0000, /* R468 */
2046 0x0000, /* R469 */
2047 0x0000, /* R470 */
2048 0x0000, /* R471 */
2049 0x0000, /* R472 */
2050 0x0000, /* R473 */
2051 0x0000, /* R474 */
2052 0x0000, /* R475 */
2053 0x0000, /* R476 */
2054 0x0000, /* R477 */
2055 0x0000, /* R478 */
2056 0x0000, /* R479 */
2057 0x0000, /* R480 */
2058 0x0000, /* R481 */
2059 0x0000, /* R482 */
2060 0x0000, /* R483 */
2061 0x0000, /* R484 */
2062 0x0000, /* R485 */
2063 0x0000, /* R486 */
2064 0x0000, /* R487 */
2065 0x0000, /* R488 */
2066 0x0000, /* R489 */
2067 0x0000, /* R490 */
2068 0x0000, /* R491 */
2069 0x0000, /* R492 */
2070 0x0000, /* R493 */
2071 0x0000, /* R494 */
2072 0x0000, /* R495 */
2073 0x0000, /* R496 */
2074 0x0000, /* R497 */
2075 0x0000, /* R498 */
2076 0x0000, /* R499 */
2077 0x0000, /* R500 */
2078 0x0000, /* R501 */
2079 0x0000, /* R502 */
2080 0x0000, /* R503 */
2081 0x0000, /* R504 */
2082 0x0000, /* R505 */
2083 0x0000, /* R506 */
2084 0x0000, /* R507 */
2085 0x0000, /* R508 */
2086 0x0000, /* R509 */
2087 0x0000, /* R510 */
2088 0x0000, /* R511 */
2089 0x0000, /* R512 - AIF1 Clocking (1) */
2090 0x0000, /* R513 - AIF1 Clocking (2) */
2091 0x0000, /* R514 */
2092 0x0000, /* R515 */
2093 0x0000, /* R516 - AIF2 Clocking (1) */
2094 0x0000, /* R517 - AIF2 Clocking (2) */
2095 0x0000, /* R518 */
2096 0x0000, /* R519 */
2097 0x0000, /* R520 - Clocking (1) */
2098 0x0000, /* R521 - Clocking (2) */
2099 0x0000, /* R522 */
2100 0x0000, /* R523 */
2101 0x0000, /* R524 */
2102 0x0000, /* R525 */
2103 0x0000, /* R526 */
2104 0x0000, /* R527 */
2105 0x0083, /* R528 - AIF1 Rate */
2106 0x0083, /* R529 - AIF2 Rate */
2107 0x0000, /* R530 - Rate Status */
2108 0x0000, /* R531 */
2109 0x0000, /* R532 */
2110 0x0000, /* R533 */
2111 0x0000, /* R534 */
2112 0x0000, /* R535 */
2113 0x0000, /* R536 */
2114 0x0000, /* R537 */
2115 0x0000, /* R538 */
2116 0x0000, /* R539 */
2117 0x0000, /* R540 */
2118 0x0000, /* R541 */
2119 0x0000, /* R542 */
2120 0x0000, /* R543 */
2121 0x0000, /* R544 - FLL1 Control (1) */
2122 0x0000, /* R545 - FLL1 Control (2) */
2123 0x0000, /* R546 - FLL1 Control (3) */
2124 0x0000, /* R547 - FLL1 Control (4) */
2125 0x0C80, /* R548 - FLL1 Control (5) */
2126 0x0000, /* R549 */
2127 0x0000, /* R550 */
2128 0x0000, /* R551 */
2129 0x0000, /* R552 */
2130 0x0000, /* R553 */
2131 0x0000, /* R554 */
2132 0x0000, /* R555 */
2133 0x0000, /* R556 */
2134 0x0000, /* R557 */
2135 0x0000, /* R558 */
2136 0x0000, /* R559 */
2137 0x0000, /* R560 */
2138 0x0000, /* R561 */
2139 0x0000, /* R562 */
2140 0x0000, /* R563 */
2141 0x0000, /* R564 */
2142 0x0000, /* R565 */
2143 0x0000, /* R566 */
2144 0x0000, /* R567 */
2145 0x0000, /* R568 */
2146 0x0000, /* R569 */
2147 0x0000, /* R570 */
2148 0x0000, /* R571 */
2149 0x0000, /* R572 */
2150 0x0000, /* R573 */
2151 0x0000, /* R574 */
2152 0x0000, /* R575 */
2153 0x0000, /* R576 - FLL2 Control (1) */
2154 0x0000, /* R577 - FLL2 Control (2) */
2155 0x0000, /* R578 - FLL2 Control (3) */
2156 0x0000, /* R579 - FLL2 Control (4) */
2157 0x0C80, /* R580 - FLL2 Control (5) */
2158 0x0000, /* R581 */
2159 0x0000, /* R582 */
2160 0x0000, /* R583 */
2161 0x0000, /* R584 */
2162 0x0000, /* R585 */
2163 0x0000, /* R586 */
2164 0x0000, /* R587 */
2165 0x0000, /* R588 */
2166 0x0000, /* R589 */
2167 0x0000, /* R590 */
2168 0x0000, /* R591 */
2169 0x0000, /* R592 */
2170 0x0000, /* R593 */
2171 0x0000, /* R594 */
2172 0x0000, /* R595 */
2173 0x0000, /* R596 */
2174 0x0000, /* R597 */
2175 0x0000, /* R598 */
2176 0x0000, /* R599 */
2177 0x0000, /* R600 */
2178 0x0000, /* R601 */
2179 0x0000, /* R602 */
2180 0x0000, /* R603 */
2181 0x0000, /* R604 */
2182 0x0000, /* R605 */
2183 0x0000, /* R606 */
2184 0x0000, /* R607 */
2185 0x0000, /* R608 */
2186 0x0000, /* R609 */
2187 0x0000, /* R610 */
2188 0x0000, /* R611 */
2189 0x0000, /* R612 */
2190 0x0000, /* R613 */
2191 0x0000, /* R614 */
2192 0x0000, /* R615 */
2193 0x0000, /* R616 */
2194 0x0000, /* R617 */
2195 0x0000, /* R618 */
2196 0x0000, /* R619 */
2197 0x0000, /* R620 */
2198 0x0000, /* R621 */
2199 0x0000, /* R622 */
2200 0x0000, /* R623 */
2201 0x0000, /* R624 */
2202 0x0000, /* R625 */
2203 0x0000, /* R626 */
2204 0x0000, /* R627 */
2205 0x0000, /* R628 */
2206 0x0000, /* R629 */
2207 0x0000, /* R630 */
2208 0x0000, /* R631 */
2209 0x0000, /* R632 */
2210 0x0000, /* R633 */
2211 0x0000, /* R634 */
2212 0x0000, /* R635 */
2213 0x0000, /* R636 */
2214 0x0000, /* R637 */
2215 0x0000, /* R638 */
2216 0x0000, /* R639 */
2217 0x0000, /* R640 */
2218 0x0000, /* R641 */
2219 0x0000, /* R642 */
2220 0x0000, /* R643 */
2221 0x0000, /* R644 */
2222 0x0000, /* R645 */
2223 0x0000, /* R646 */
2224 0x0000, /* R647 */
2225 0x0000, /* R648 */
2226 0x0000, /* R649 */
2227 0x0000, /* R650 */
2228 0x0000, /* R651 */
2229 0x0000, /* R652 */
2230 0x0000, /* R653 */
2231 0x0000, /* R654 */
2232 0x0000, /* R655 */
2233 0x0000, /* R656 */
2234 0x0000, /* R657 */
2235 0x0000, /* R658 */
2236 0x0000, /* R659 */
2237 0x0000, /* R660 */
2238 0x0000, /* R661 */
2239 0x0000, /* R662 */
2240 0x0000, /* R663 */
2241 0x0000, /* R664 */
2242 0x0000, /* R665 */
2243 0x0000, /* R666 */
2244 0x0000, /* R667 */
2245 0x0000, /* R668 */
2246 0x0000, /* R669 */
2247 0x0000, /* R670 */
2248 0x0000, /* R671 */
2249 0x0000, /* R672 */
2250 0x0000, /* R673 */
2251 0x0000, /* R674 */
2252 0x0000, /* R675 */
2253 0x0000, /* R676 */
2254 0x0000, /* R677 */
2255 0x0000, /* R678 */
2256 0x0000, /* R679 */
2257 0x0000, /* R680 */
2258 0x0000, /* R681 */
2259 0x0000, /* R682 */
2260 0x0000, /* R683 */
2261 0x0000, /* R684 */
2262 0x0000, /* R685 */
2263 0x0000, /* R686 */
2264 0x0000, /* R687 */
2265 0x0000, /* R688 */
2266 0x0000, /* R689 */
2267 0x0000, /* R690 */
2268 0x0000, /* R691 */
2269 0x0000, /* R692 */
2270 0x0000, /* R693 */
2271 0x0000, /* R694 */
2272 0x0000, /* R695 */
2273 0x0000, /* R696 */
2274 0x0000, /* R697 */
2275 0x0000, /* R698 */
2276 0x0000, /* R699 */
2277 0x0000, /* R700 */
2278 0x0000, /* R701 */
2279 0x0000, /* R702 */
2280 0x0000, /* R703 */
2281 0x0000, /* R704 */
2282 0x0000, /* R705 */
2283 0x0000, /* R706 */
2284 0x0000, /* R707 */
2285 0x0000, /* R708 */
2286 0x0000, /* R709 */
2287 0x0000, /* R710 */
2288 0x0000, /* R711 */
2289 0x0000, /* R712 */
2290 0x0000, /* R713 */
2291 0x0000, /* R714 */
2292 0x0000, /* R715 */
2293 0x0000, /* R716 */
2294 0x0000, /* R717 */
2295 0x0000, /* R718 */
2296 0x0000, /* R719 */
2297 0x0000, /* R720 */
2298 0x0000, /* R721 */
2299 0x0000, /* R722 */
2300 0x0000, /* R723 */
2301 0x0000, /* R724 */
2302 0x0000, /* R725 */
2303 0x0000, /* R726 */
2304 0x0000, /* R727 */
2305 0x0000, /* R728 */
2306 0x0000, /* R729 */
2307 0x0000, /* R730 */
2308 0x0000, /* R731 */
2309 0x0000, /* R732 */
2310 0x0000, /* R733 */
2311 0x0000, /* R734 */
2312 0x0000, /* R735 */
2313 0x0000, /* R736 */
2314 0x0000, /* R737 */
2315 0x0000, /* R738 */
2316 0x0000, /* R739 */
2317 0x0000, /* R740 */
2318 0x0000, /* R741 */
2319 0x0000, /* R742 */
2320 0x0000, /* R743 */
2321 0x0000, /* R744 */
2322 0x0000, /* R745 */
2323 0x0000, /* R746 */
2324 0x0000, /* R747 */
2325 0x0000, /* R748 */
2326 0x0000, /* R749 */
2327 0x0000, /* R750 */
2328 0x0000, /* R751 */
2329 0x0000, /* R752 */
2330 0x0000, /* R753 */
2331 0x0000, /* R754 */
2332 0x0000, /* R755 */
2333 0x0000, /* R756 */
2334 0x0000, /* R757 */
2335 0x0000, /* R758 */
2336 0x0000, /* R759 */
2337 0x0000, /* R760 */
2338 0x0000, /* R761 */
2339 0x0000, /* R762 */
2340 0x0000, /* R763 */
2341 0x0000, /* R764 */
2342 0x0000, /* R765 */
2343 0x0000, /* R766 */
2344 0x0000, /* R767 */
2345 0x4050, /* R768 - AIF1 Control (1) */
2346 0x4000, /* R769 - AIF1 Control (2) */
2347 0x0000, /* R770 - AIF1 Master/Slave */
2348 0x0040, /* R771 - AIF1 BCLK */
2349 0x0040, /* R772 - AIF1ADC LRCLK */
2350 0x0040, /* R773 - AIF1DAC LRCLK */
2351 0x0004, /* R774 - AIF1DAC Data */
2352 0x0100, /* R775 - AIF1ADC Data */
2353 0x0000, /* R776 */
2354 0x0000, /* R777 */
2355 0x0000, /* R778 */
2356 0x0000, /* R779 */
2357 0x0000, /* R780 */
2358 0x0000, /* R781 */
2359 0x0000, /* R782 */
2360 0x0000, /* R783 */
2361 0x4050, /* R784 - AIF2 Control (1) */
2362 0x4000, /* R785 - AIF2 Control (2) */
2363 0x0000, /* R786 - AIF2 Master/Slave */
2364 0x0040, /* R787 - AIF2 BCLK */
2365 0x0040, /* R788 - AIF2ADC LRCLK */
2366 0x0040, /* R789 - AIF2DAC LRCLK */
2367 0x0000, /* R790 - AIF2DAC Data */
2368 0x0000, /* R791 - AIF2ADC Data */
2369 0x0000, /* R792 */
2370 0x0000, /* R793 */
2371 0x0000, /* R794 */
2372 0x0000, /* R795 */
2373 0x0000, /* R796 */
2374 0x0000, /* R797 */
2375 0x0000, /* R798 */
2376 0x0000, /* R799 */
2377 0x0000, /* R800 */
2378 0x0000, /* R801 */
2379 0x0000, /* R802 */
2380 0x0000, /* R803 */
2381 0x0000, /* R804 */
2382 0x0000, /* R805 */
2383 0x0000, /* R806 */
2384 0x0000, /* R807 */
2385 0x0000, /* R808 */
2386 0x0000, /* R809 */
2387 0x0000, /* R810 */
2388 0x0000, /* R811 */
2389 0x0000, /* R812 */
2390 0x0000, /* R813 */
2391 0x0000, /* R814 */
2392 0x0000, /* R815 */
2393 0x0000, /* R816 */
2394 0x0000, /* R817 */
2395 0x0000, /* R818 */
2396 0x0000, /* R819 */
2397 0x0000, /* R820 */
2398 0x0000, /* R821 */
2399 0x0000, /* R822 */
2400 0x0000, /* R823 */
2401 0x0000, /* R824 */
2402 0x0000, /* R825 */
2403 0x0000, /* R826 */
2404 0x0000, /* R827 */
2405 0x0000, /* R828 */
2406 0x0000, /* R829 */
2407 0x0000, /* R830 */
2408 0x0000, /* R831 */
2409 0x0000, /* R832 */
2410 0x0000, /* R833 */
2411 0x0000, /* R834 */
2412 0x0000, /* R835 */
2413 0x0000, /* R836 */
2414 0x0000, /* R837 */
2415 0x0000, /* R838 */
2416 0x0000, /* R839 */
2417 0x0000, /* R840 */
2418 0x0000, /* R841 */
2419 0x0000, /* R842 */
2420 0x0000, /* R843 */
2421 0x0000, /* R844 */
2422 0x0000, /* R845 */
2423 0x0000, /* R846 */
2424 0x0000, /* R847 */
2425 0x0000, /* R848 */
2426 0x0000, /* R849 */
2427 0x0000, /* R850 */
2428 0x0000, /* R851 */
2429 0x0000, /* R852 */
2430 0x0000, /* R853 */
2431 0x0000, /* R854 */
2432 0x0000, /* R855 */
2433 0x0000, /* R856 */
2434 0x0000, /* R857 */
2435 0x0000, /* R858 */
2436 0x0000, /* R859 */
2437 0x0000, /* R860 */
2438 0x0000, /* R861 */
2439 0x0000, /* R862 */
2440 0x0000, /* R863 */
2441 0x0000, /* R864 */
2442 0x0000, /* R865 */
2443 0x0000, /* R866 */
2444 0x0000, /* R867 */
2445 0x0000, /* R868 */
2446 0x0000, /* R869 */
2447 0x0000, /* R870 */
2448 0x0000, /* R871 */
2449 0x0000, /* R872 */
2450 0x0000, /* R873 */
2451 0x0000, /* R874 */
2452 0x0000, /* R875 */
2453 0x0000, /* R876 */
2454 0x0000, /* R877 */
2455 0x0000, /* R878 */
2456 0x0000, /* R879 */
2457 0x0000, /* R880 */
2458 0x0000, /* R881 */
2459 0x0000, /* R882 */
2460 0x0000, /* R883 */
2461 0x0000, /* R884 */
2462 0x0000, /* R885 */
2463 0x0000, /* R886 */
2464 0x0000, /* R887 */
2465 0x0000, /* R888 */
2466 0x0000, /* R889 */
2467 0x0000, /* R890 */
2468 0x0000, /* R891 */
2469 0x0000, /* R892 */
2470 0x0000, /* R893 */
2471 0x0000, /* R894 */
2472 0x0000, /* R895 */
2473 0x0000, /* R896 */
2474 0x0000, /* R897 */
2475 0x0000, /* R898 */
2476 0x0000, /* R899 */
2477 0x0000, /* R900 */
2478 0x0000, /* R901 */
2479 0x0000, /* R902 */
2480 0x0000, /* R903 */
2481 0x0000, /* R904 */
2482 0x0000, /* R905 */
2483 0x0000, /* R906 */
2484 0x0000, /* R907 */
2485 0x0000, /* R908 */
2486 0x0000, /* R909 */
2487 0x0000, /* R910 */
2488 0x0000, /* R911 */
2489 0x0000, /* R912 */
2490 0x0000, /* R913 */
2491 0x0000, /* R914 */
2492 0x0000, /* R915 */
2493 0x0000, /* R916 */
2494 0x0000, /* R917 */
2495 0x0000, /* R918 */
2496 0x0000, /* R919 */
2497 0x0000, /* R920 */
2498 0x0000, /* R921 */
2499 0x0000, /* R922 */
2500 0x0000, /* R923 */
2501 0x0000, /* R924 */
2502 0x0000, /* R925 */
2503 0x0000, /* R926 */
2504 0x0000, /* R927 */
2505 0x0000, /* R928 */
2506 0x0000, /* R929 */
2507 0x0000, /* R930 */
2508 0x0000, /* R931 */
2509 0x0000, /* R932 */
2510 0x0000, /* R933 */
2511 0x0000, /* R934 */
2512 0x0000, /* R935 */
2513 0x0000, /* R936 */
2514 0x0000, /* R937 */
2515 0x0000, /* R938 */
2516 0x0000, /* R939 */
2517 0x0000, /* R940 */
2518 0x0000, /* R941 */
2519 0x0000, /* R942 */
2520 0x0000, /* R943 */
2521 0x0000, /* R944 */
2522 0x0000, /* R945 */
2523 0x0000, /* R946 */
2524 0x0000, /* R947 */
2525 0x0000, /* R948 */
2526 0x0000, /* R949 */
2527 0x0000, /* R950 */
2528 0x0000, /* R951 */
2529 0x0000, /* R952 */
2530 0x0000, /* R953 */
2531 0x0000, /* R954 */
2532 0x0000, /* R955 */
2533 0x0000, /* R956 */
2534 0x0000, /* R957 */
2535 0x0000, /* R958 */
2536 0x0000, /* R959 */
2537 0x0000, /* R960 */
2538 0x0000, /* R961 */
2539 0x0000, /* R962 */
2540 0x0000, /* R963 */
2541 0x0000, /* R964 */
2542 0x0000, /* R965 */
2543 0x0000, /* R966 */
2544 0x0000, /* R967 */
2545 0x0000, /* R968 */
2546 0x0000, /* R969 */
2547 0x0000, /* R970 */
2548 0x0000, /* R971 */
2549 0x0000, /* R972 */
2550 0x0000, /* R973 */
2551 0x0000, /* R974 */
2552 0x0000, /* R975 */
2553 0x0000, /* R976 */
2554 0x0000, /* R977 */
2555 0x0000, /* R978 */
2556 0x0000, /* R979 */
2557 0x0000, /* R980 */
2558 0x0000, /* R981 */
2559 0x0000, /* R982 */
2560 0x0000, /* R983 */
2561 0x0000, /* R984 */
2562 0x0000, /* R985 */
2563 0x0000, /* R986 */
2564 0x0000, /* R987 */
2565 0x0000, /* R988 */
2566 0x0000, /* R989 */
2567 0x0000, /* R990 */
2568 0x0000, /* R991 */
2569 0x0000, /* R992 */
2570 0x0000, /* R993 */
2571 0x0000, /* R994 */
2572 0x0000, /* R995 */
2573 0x0000, /* R996 */
2574 0x0000, /* R997 */
2575 0x0000, /* R998 */
2576 0x0000, /* R999 */
2577 0x0000, /* R1000 */
2578 0x0000, /* R1001 */
2579 0x0000, /* R1002 */
2580 0x0000, /* R1003 */
2581 0x0000, /* R1004 */
2582 0x0000, /* R1005 */
2583 0x0000, /* R1006 */
2584 0x0000, /* R1007 */
2585 0x0000, /* R1008 */
2586 0x0000, /* R1009 */
2587 0x0000, /* R1010 */
2588 0x0000, /* R1011 */
2589 0x0000, /* R1012 */
2590 0x0000, /* R1013 */
2591 0x0000, /* R1014 */
2592 0x0000, /* R1015 */
2593 0x0000, /* R1016 */
2594 0x0000, /* R1017 */
2595 0x0000, /* R1018 */
2596 0x0000, /* R1019 */
2597 0x0000, /* R1020 */
2598 0x0000, /* R1021 */
2599 0x0000, /* R1022 */
2600 0x0000, /* R1023 */
2601 0x00C0, /* R1024 - AIF1 ADC1 Left Volume */
2602 0x00C0, /* R1025 - AIF1 ADC1 Right Volume */
2603 0x00C0, /* R1026 - AIF1 DAC1 Left Volume */
2604 0x00C0, /* R1027 - AIF1 DAC1 Right Volume */
2605 0x00C0, /* R1028 - AIF1 ADC2 Left Volume */
2606 0x00C0, /* R1029 - AIF1 ADC2 Right Volume */
2607 0x00C0, /* R1030 - AIF1 DAC2 Left Volume */
2608 0x00C0, /* R1031 - AIF1 DAC2 Right Volume */
2609 0x0000, /* R1032 */
2610 0x0000, /* R1033 */
2611 0x0000, /* R1034 */
2612 0x0000, /* R1035 */
2613 0x0000, /* R1036 */
2614 0x0000, /* R1037 */
2615 0x0000, /* R1038 */
2616 0x0000, /* R1039 */
2617 0x0000, /* R1040 - AIF1 ADC1 Filters */
2618 0x0000, /* R1041 - AIF1 ADC2 Filters */
2619 0x0000, /* R1042 */
2620 0x0000, /* R1043 */
2621 0x0000, /* R1044 */
2622 0x0000, /* R1045 */
2623 0x0000, /* R1046 */
2624 0x0000, /* R1047 */
2625 0x0000, /* R1048 */
2626 0x0000, /* R1049 */
2627 0x0000, /* R1050 */
2628 0x0000, /* R1051 */
2629 0x0000, /* R1052 */
2630 0x0000, /* R1053 */
2631 0x0000, /* R1054 */
2632 0x0000, /* R1055 */
2633 0x0200, /* R1056 - AIF1 DAC1 Filters (1) */
2634 0x0010, /* R1057 - AIF1 DAC1 Filters (2) */
2635 0x0200, /* R1058 - AIF1 DAC2 Filters (1) */
2636 0x0010, /* R1059 - AIF1 DAC2 Filters (2) */
2637 0x0000, /* R1060 */
2638 0x0000, /* R1061 */
2639 0x0000, /* R1062 */
2640 0x0000, /* R1063 */
2641 0x0000, /* R1064 */
2642 0x0000, /* R1065 */
2643 0x0000, /* R1066 */
2644 0x0000, /* R1067 */
2645 0x0000, /* R1068 */
2646 0x0000, /* R1069 */
2647 0x0000, /* R1070 */
2648 0x0000, /* R1071 */
2649 0x0000, /* R1072 */
2650 0x0000, /* R1073 */
2651 0x0000, /* R1074 */
2652 0x0000, /* R1075 */
2653 0x0000, /* R1076 */
2654 0x0000, /* R1077 */
2655 0x0000, /* R1078 */
2656 0x0000, /* R1079 */
2657 0x0000, /* R1080 */
2658 0x0000, /* R1081 */
2659 0x0000, /* R1082 */
2660 0x0000, /* R1083 */
2661 0x0000, /* R1084 */
2662 0x0000, /* R1085 */
2663 0x0000, /* R1086 */
2664 0x0000, /* R1087 */
2665 0x0098, /* R1088 - AIF1 DRC1 (1) */
2666 0x0845, /* R1089 - AIF1 DRC1 (2) */
2667 0x0000, /* R1090 - AIF1 DRC1 (3) */
2668 0x0000, /* R1091 - AIF1 DRC1 (4) */
2669 0x0000, /* R1092 - AIF1 DRC1 (5) */
2670 0x0000, /* R1093 */
2671 0x0000, /* R1094 */
2672 0x0000, /* R1095 */
2673 0x0000, /* R1096 */
2674 0x0000, /* R1097 */
2675 0x0000, /* R1098 */
2676 0x0000, /* R1099 */
2677 0x0000, /* R1100 */
2678 0x0000, /* R1101 */
2679 0x0000, /* R1102 */
2680 0x0000, /* R1103 */
2681 0x0098, /* R1104 - AIF1 DRC2 (1) */
2682 0x0845, /* R1105 - AIF1 DRC2 (2) */
2683 0x0000, /* R1106 - AIF1 DRC2 (3) */
2684 0x0000, /* R1107 - AIF1 DRC2 (4) */
2685 0x0000, /* R1108 - AIF1 DRC2 (5) */
2686 0x0000, /* R1109 */
2687 0x0000, /* R1110 */
2688 0x0000, /* R1111 */
2689 0x0000, /* R1112 */
2690 0x0000, /* R1113 */
2691 0x0000, /* R1114 */
2692 0x0000, /* R1115 */
2693 0x0000, /* R1116 */
2694 0x0000, /* R1117 */
2695 0x0000, /* R1118 */
2696 0x0000, /* R1119 */
2697 0x0000, /* R1120 */
2698 0x0000, /* R1121 */
2699 0x0000, /* R1122 */
2700 0x0000, /* R1123 */
2701 0x0000, /* R1124 */
2702 0x0000, /* R1125 */
2703 0x0000, /* R1126 */
2704 0x0000, /* R1127 */
2705 0x0000, /* R1128 */
2706 0x0000, /* R1129 */
2707 0x0000, /* R1130 */
2708 0x0000, /* R1131 */
2709 0x0000, /* R1132 */
2710 0x0000, /* R1133 */
2711 0x0000, /* R1134 */
2712 0x0000, /* R1135 */
2713 0x0000, /* R1136 */
2714 0x0000, /* R1137 */
2715 0x0000, /* R1138 */
2716 0x0000, /* R1139 */
2717 0x0000, /* R1140 */
2718 0x0000, /* R1141 */
2719 0x0000, /* R1142 */
2720 0x0000, /* R1143 */
2721 0x0000, /* R1144 */
2722 0x0000, /* R1145 */
2723 0x0000, /* R1146 */
2724 0x0000, /* R1147 */
2725 0x0000, /* R1148 */
2726 0x0000, /* R1149 */
2727 0x0000, /* R1150 */
2728 0x0000, /* R1151 */
2729 0x6318, /* R1152 - AIF1 DAC1 EQ Gains (1) */
2730 0x6300, /* R1153 - AIF1 DAC1 EQ Gains (2) */
2731 0x0FCA, /* R1154 - AIF1 DAC1 EQ Band 1 A */
2732 0x0400, /* R1155 - AIF1 DAC1 EQ Band 1 B */
2733 0x00D8, /* R1156 - AIF1 DAC1 EQ Band 1 PG */
2734 0x1EB5, /* R1157 - AIF1 DAC1 EQ Band 2 A */
2735 0xF145, /* R1158 - AIF1 DAC1 EQ Band 2 B */
2736 0x0B75, /* R1159 - AIF1 DAC1 EQ Band 2 C */
2737 0x01C5, /* R1160 - AIF1 DAC1 EQ Band 2 PG */
2738 0x1C58, /* R1161 - AIF1 DAC1 EQ Band 3 A */
2739 0xF373, /* R1162 - AIF1 DAC1 EQ Band 3 B */
2740 0x0A54, /* R1163 - AIF1 DAC1 EQ Band 3 C */
2741 0x0558, /* R1164 - AIF1 DAC1 EQ Band 3 PG */
2742 0x168E, /* R1165 - AIF1 DAC1 EQ Band 4 A */
2743 0xF829, /* R1166 - AIF1 DAC1 EQ Band 4 B */
2744 0x07AD, /* R1167 - AIF1 DAC1 EQ Band 4 C */
2745 0x1103, /* R1168 - AIF1 DAC1 EQ Band 4 PG */
2746 0x0564, /* R1169 - AIF1 DAC1 EQ Band 5 A */
2747 0x0559, /* R1170 - AIF1 DAC1 EQ Band 5 B */
2748 0x4000, /* R1171 - AIF1 DAC1 EQ Band 5 PG */
2749 0x0000, /* R1172 */
2750 0x0000, /* R1173 */
2751 0x0000, /* R1174 */
2752 0x0000, /* R1175 */
2753 0x0000, /* R1176 */
2754 0x0000, /* R1177 */
2755 0x0000, /* R1178 */
2756 0x0000, /* R1179 */
2757 0x0000, /* R1180 */
2758 0x0000, /* R1181 */
2759 0x0000, /* R1182 */
2760 0x0000, /* R1183 */
2761 0x6318, /* R1184 - AIF1 DAC2 EQ Gains (1) */
2762 0x6300, /* R1185 - AIF1 DAC2 EQ Gains (2) */
2763 0x0FCA, /* R1186 - AIF1 DAC2 EQ Band 1 A */
2764 0x0400, /* R1187 - AIF1 DAC2 EQ Band 1 B */
2765 0x00D8, /* R1188 - AIF1 DAC2 EQ Band 1 PG */
2766 0x1EB5, /* R1189 - AIF1 DAC2 EQ Band 2 A */
2767 0xF145, /* R1190 - AIF1 DAC2 EQ Band 2 B */
2768 0x0B75, /* R1191 - AIF1 DAC2 EQ Band 2 C */
2769 0x01C5, /* R1192 - AIF1 DAC2 EQ Band 2 PG */
2770 0x1C58, /* R1193 - AIF1 DAC2 EQ Band 3 A */
2771 0xF373, /* R1194 - AIF1 DAC2 EQ Band 3 B */
2772 0x0A54, /* R1195 - AIF1 DAC2 EQ Band 3 C */
2773 0x0558, /* R1196 - AIF1 DAC2 EQ Band 3 PG */
2774 0x168E, /* R1197 - AIF1 DAC2 EQ Band 4 A */
2775 0xF829, /* R1198 - AIF1 DAC2 EQ Band 4 B */
2776 0x07AD, /* R1199 - AIF1 DAC2 EQ Band 4 C */
2777 0x1103, /* R1200 - AIF1 DAC2 EQ Band 4 PG */
2778 0x0564, /* R1201 - AIF1 DAC2 EQ Band 5 A */
2779 0x0559, /* R1202 - AIF1 DAC2 EQ Band 5 B */
2780 0x4000, /* R1203 - AIF1 DAC2 EQ Band 5 PG */
2781 0x0000, /* R1204 */
2782 0x0000, /* R1205 */
2783 0x0000, /* R1206 */
2784 0x0000, /* R1207 */
2785 0x0000, /* R1208 */
2786 0x0000, /* R1209 */
2787 0x0000, /* R1210 */
2788 0x0000, /* R1211 */
2789 0x0000, /* R1212 */
2790 0x0000, /* R1213 */
2791 0x0000, /* R1214 */
2792 0x0000, /* R1215 */
2793 0x0000, /* R1216 */
2794 0x0000, /* R1217 */
2795 0x0000, /* R1218 */
2796 0x0000, /* R1219 */
2797 0x0000, /* R1220 */
2798 0x0000, /* R1221 */
2799 0x0000, /* R1222 */
2800 0x0000, /* R1223 */
2801 0x0000, /* R1224 */
2802 0x0000, /* R1225 */
2803 0x0000, /* R1226 */
2804 0x0000, /* R1227 */
2805 0x0000, /* R1228 */
2806 0x0000, /* R1229 */
2807 0x0000, /* R1230 */
2808 0x0000, /* R1231 */
2809 0x0000, /* R1232 */
2810 0x0000, /* R1233 */
2811 0x0000, /* R1234 */
2812 0x0000, /* R1235 */
2813 0x0000, /* R1236 */
2814 0x0000, /* R1237 */
2815 0x0000, /* R1238 */
2816 0x0000, /* R1239 */
2817 0x0000, /* R1240 */
2818 0x0000, /* R1241 */
2819 0x0000, /* R1242 */
2820 0x0000, /* R1243 */
2821 0x0000, /* R1244 */
2822 0x0000, /* R1245 */
2823 0x0000, /* R1246 */
2824 0x0000, /* R1247 */
2825 0x0000, /* R1248 */
2826 0x0000, /* R1249 */
2827 0x0000, /* R1250 */
2828 0x0000, /* R1251 */
2829 0x0000, /* R1252 */
2830 0x0000, /* R1253 */
2831 0x0000, /* R1254 */
2832 0x0000, /* R1255 */
2833 0x0000, /* R1256 */
2834 0x0000, /* R1257 */
2835 0x0000, /* R1258 */
2836 0x0000, /* R1259 */
2837 0x0000, /* R1260 */
2838 0x0000, /* R1261 */
2839 0x0000, /* R1262 */
2840 0x0000, /* R1263 */
2841 0x0000, /* R1264 */
2842 0x0000, /* R1265 */
2843 0x0000, /* R1266 */
2844 0x0000, /* R1267 */
2845 0x0000, /* R1268 */
2846 0x0000, /* R1269 */
2847 0x0000, /* R1270 */
2848 0x0000, /* R1271 */
2849 0x0000, /* R1272 */
2850 0x0000, /* R1273 */
2851 0x0000, /* R1274 */
2852 0x0000, /* R1275 */
2853 0x0000, /* R1276 */
2854 0x0000, /* R1277 */
2855 0x0000, /* R1278 */
2856 0x0000, /* R1279 */
2857 0x00C0, /* R1280 - AIF2 ADC Left Volume */
2858 0x00C0, /* R1281 - AIF2 ADC Right Volume */
2859 0x00C0, /* R1282 - AIF2 DAC Left Volume */
2860 0x00C0, /* R1283 - AIF2 DAC Right Volume */
2861 0x0000, /* R1284 */
2862 0x0000, /* R1285 */
2863 0x0000, /* R1286 */
2864 0x0000, /* R1287 */
2865 0x0000, /* R1288 */
2866 0x0000, /* R1289 */
2867 0x0000, /* R1290 */
2868 0x0000, /* R1291 */
2869 0x0000, /* R1292 */
2870 0x0000, /* R1293 */
2871 0x0000, /* R1294 */
2872 0x0000, /* R1295 */
2873 0x0000, /* R1296 - AIF2 ADC Filters */
2874 0x0000, /* R1297 */
2875 0x0000, /* R1298 */
2876 0x0000, /* R1299 */
2877 0x0000, /* R1300 */
2878 0x0000, /* R1301 */
2879 0x0000, /* R1302 */
2880 0x0000, /* R1303 */
2881 0x0000, /* R1304 */
2882 0x0000, /* R1305 */
2883 0x0000, /* R1306 */
2884 0x0000, /* R1307 */
2885 0x0000, /* R1308 */
2886 0x0000, /* R1309 */
2887 0x0000, /* R1310 */
2888 0x0000, /* R1311 */
2889 0x0200, /* R1312 - AIF2 DAC Filters (1) */
2890 0x0010, /* R1313 - AIF2 DAC Filters (2) */
2891 0x0000, /* R1314 */
2892 0x0000, /* R1315 */
2893 0x0000, /* R1316 */
2894 0x0000, /* R1317 */
2895 0x0000, /* R1318 */
2896 0x0000, /* R1319 */
2897 0x0000, /* R1320 */
2898 0x0000, /* R1321 */
2899 0x0000, /* R1322 */
2900 0x0000, /* R1323 */
2901 0x0000, /* R1324 */
2902 0x0000, /* R1325 */
2903 0x0000, /* R1326 */
2904 0x0000, /* R1327 */
2905 0x0000, /* R1328 */
2906 0x0000, /* R1329 */
2907 0x0000, /* R1330 */
2908 0x0000, /* R1331 */
2909 0x0000, /* R1332 */
2910 0x0000, /* R1333 */
2911 0x0000, /* R1334 */
2912 0x0000, /* R1335 */
2913 0x0000, /* R1336 */
2914 0x0000, /* R1337 */
2915 0x0000, /* R1338 */
2916 0x0000, /* R1339 */
2917 0x0000, /* R1340 */
2918 0x0000, /* R1341 */
2919 0x0000, /* R1342 */
2920 0x0000, /* R1343 */
2921 0x0098, /* R1344 - AIF2 DRC (1) */
2922 0x0845, /* R1345 - AIF2 DRC (2) */
2923 0x0000, /* R1346 - AIF2 DRC (3) */
2924 0x0000, /* R1347 - AIF2 DRC (4) */
2925 0x0000, /* R1348 - AIF2 DRC (5) */
2926 0x0000, /* R1349 */
2927 0x0000, /* R1350 */
2928 0x0000, /* R1351 */
2929 0x0000, /* R1352 */
2930 0x0000, /* R1353 */
2931 0x0000, /* R1354 */
2932 0x0000, /* R1355 */
2933 0x0000, /* R1356 */
2934 0x0000, /* R1357 */
2935 0x0000, /* R1358 */
2936 0x0000, /* R1359 */
2937 0x0000, /* R1360 */
2938 0x0000, /* R1361 */
2939 0x0000, /* R1362 */
2940 0x0000, /* R1363 */
2941 0x0000, /* R1364 */
2942 0x0000, /* R1365 */
2943 0x0000, /* R1366 */
2944 0x0000, /* R1367 */
2945 0x0000, /* R1368 */
2946 0x0000, /* R1369 */
2947 0x0000, /* R1370 */
2948 0x0000, /* R1371 */
2949 0x0000, /* R1372 */
2950 0x0000, /* R1373 */
2951 0x0000, /* R1374 */
2952 0x0000, /* R1375 */
2953 0x0000, /* R1376 */
2954 0x0000, /* R1377 */
2955 0x0000, /* R1378 */
2956 0x0000, /* R1379 */
2957 0x0000, /* R1380 */
2958 0x0000, /* R1381 */
2959 0x0000, /* R1382 */
2960 0x0000, /* R1383 */
2961 0x0000, /* R1384 */
2962 0x0000, /* R1385 */
2963 0x0000, /* R1386 */
2964 0x0000, /* R1387 */
2965 0x0000, /* R1388 */
2966 0x0000, /* R1389 */
2967 0x0000, /* R1390 */
2968 0x0000, /* R1391 */
2969 0x0000, /* R1392 */
2970 0x0000, /* R1393 */
2971 0x0000, /* R1394 */
2972 0x0000, /* R1395 */
2973 0x0000, /* R1396 */
2974 0x0000, /* R1397 */
2975 0x0000, /* R1398 */
2976 0x0000, /* R1399 */
2977 0x0000, /* R1400 */
2978 0x0000, /* R1401 */
2979 0x0000, /* R1402 */
2980 0x0000, /* R1403 */
2981 0x0000, /* R1404 */
2982 0x0000, /* R1405 */
2983 0x0000, /* R1406 */
2984 0x0000, /* R1407 */
2985 0x6318, /* R1408 - AIF2 EQ Gains (1) */
2986 0x6300, /* R1409 - AIF2 EQ Gains (2) */
2987 0x0FCA, /* R1410 - AIF2 EQ Band 1 A */
2988 0x0400, /* R1411 - AIF2 EQ Band 1 B */
2989 0x00D8, /* R1412 - AIF2 EQ Band 1 PG */
2990 0x1EB5, /* R1413 - AIF2 EQ Band 2 A */
2991 0xF145, /* R1414 - AIF2 EQ Band 2 B */
2992 0x0B75, /* R1415 - AIF2 EQ Band 2 C */
2993 0x01C5, /* R1416 - AIF2 EQ Band 2 PG */
2994 0x1C58, /* R1417 - AIF2 EQ Band 3 A */
2995 0xF373, /* R1418 - AIF2 EQ Band 3 B */
2996 0x0A54, /* R1419 - AIF2 EQ Band 3 C */
2997 0x0558, /* R1420 - AIF2 EQ Band 3 PG */
2998 0x168E, /* R1421 - AIF2 EQ Band 4 A */
2999 0xF829, /* R1422 - AIF2 EQ Band 4 B */
3000 0x07AD, /* R1423 - AIF2 EQ Band 4 C */
3001 0x1103, /* R1424 - AIF2 EQ Band 4 PG */
3002 0x0564, /* R1425 - AIF2 EQ Band 5 A */
3003 0x0559, /* R1426 - AIF2 EQ Band 5 B */
3004 0x4000, /* R1427 - AIF2 EQ Band 5 PG */
3005 0x0000, /* R1428 */
3006 0x0000, /* R1429 */
3007 0x0000, /* R1430 */
3008 0x0000, /* R1431 */
3009 0x0000, /* R1432 */
3010 0x0000, /* R1433 */
3011 0x0000, /* R1434 */
3012 0x0000, /* R1435 */
3013 0x0000, /* R1436 */
3014 0x0000, /* R1437 */
3015 0x0000, /* R1438 */
3016 0x0000, /* R1439 */
3017 0x0000, /* R1440 */
3018 0x0000, /* R1441 */
3019 0x0000, /* R1442 */
3020 0x0000, /* R1443 */
3021 0x0000, /* R1444 */
3022 0x0000, /* R1445 */
3023 0x0000, /* R1446 */
3024 0x0000, /* R1447 */
3025 0x0000, /* R1448 */
3026 0x0000, /* R1449 */
3027 0x0000, /* R1450 */
3028 0x0000, /* R1451 */
3029 0x0000, /* R1452 */
3030 0x0000, /* R1453 */
3031 0x0000, /* R1454 */
3032 0x0000, /* R1455 */
3033 0x0000, /* R1456 */
3034 0x0000, /* R1457 */
3035 0x0000, /* R1458 */
3036 0x0000, /* R1459 */
3037 0x0000, /* R1460 */
3038 0x0000, /* R1461 */
3039 0x0000, /* R1462 */
3040 0x0000, /* R1463 */
3041 0x0000, /* R1464 */
3042 0x0000, /* R1465 */
3043 0x0000, /* R1466 */
3044 0x0000, /* R1467 */
3045 0x0000, /* R1468 */
3046 0x0000, /* R1469 */
3047 0x0000, /* R1470 */
3048 0x0000, /* R1471 */
3049 0x0000, /* R1472 */
3050 0x0000, /* R1473 */
3051 0x0000, /* R1474 */
3052 0x0000, /* R1475 */
3053 0x0000, /* R1476 */
3054 0x0000, /* R1477 */
3055 0x0000, /* R1478 */
3056 0x0000, /* R1479 */
3057 0x0000, /* R1480 */
3058 0x0000, /* R1481 */
3059 0x0000, /* R1482 */
3060 0x0000, /* R1483 */
3061 0x0000, /* R1484 */
3062 0x0000, /* R1485 */
3063 0x0000, /* R1486 */
3064 0x0000, /* R1487 */
3065 0x0000, /* R1488 */
3066 0x0000, /* R1489 */
3067 0x0000, /* R1490 */
3068 0x0000, /* R1491 */
3069 0x0000, /* R1492 */
3070 0x0000, /* R1493 */
3071 0x0000, /* R1494 */
3072 0x0000, /* R1495 */
3073 0x0000, /* R1496 */
3074 0x0000, /* R1497 */
3075 0x0000, /* R1498 */
3076 0x0000, /* R1499 */
3077 0x0000, /* R1500 */
3078 0x0000, /* R1501 */
3079 0x0000, /* R1502 */
3080 0x0000, /* R1503 */
3081 0x0000, /* R1504 */
3082 0x0000, /* R1505 */
3083 0x0000, /* R1506 */
3084 0x0000, /* R1507 */
3085 0x0000, /* R1508 */
3086 0x0000, /* R1509 */
3087 0x0000, /* R1510 */
3088 0x0000, /* R1511 */
3089 0x0000, /* R1512 */
3090 0x0000, /* R1513 */
3091 0x0000, /* R1514 */
3092 0x0000, /* R1515 */
3093 0x0000, /* R1516 */
3094 0x0000, /* R1517 */
3095 0x0000, /* R1518 */
3096 0x0000, /* R1519 */
3097 0x0000, /* R1520 */
3098 0x0000, /* R1521 */
3099 0x0000, /* R1522 */
3100 0x0000, /* R1523 */
3101 0x0000, /* R1524 */
3102 0x0000, /* R1525 */
3103 0x0000, /* R1526 */
3104 0x0000, /* R1527 */
3105 0x0000, /* R1528 */
3106 0x0000, /* R1529 */
3107 0x0000, /* R1530 */
3108 0x0000, /* R1531 */
3109 0x0000, /* R1532 */
3110 0x0000, /* R1533 */
3111 0x0000, /* R1534 */
3112 0x0000, /* R1535 */
3113 0x0000, /* R1536 - DAC1 Mixer Volumes */
3114 0x0000, /* R1537 - DAC1 Left Mixer Routing */
3115 0x0000, /* R1538 - DAC1 Right Mixer Routing */
3116 0x0000, /* R1539 - DAC2 Mixer Volumes */
3117 0x0000, /* R1540 - DAC2 Left Mixer Routing */
3118 0x0000, /* R1541 - DAC2 Right Mixer Routing */
3119 0x0000, /* R1542 - AIF1 ADC1 Left Mixer Routing */
3120 0x0000, /* R1543 - AIF1 ADC1 Right Mixer Routing */
3121 0x0000, /* R1544 - AIF1 ADC2 Left Mixer Routing */
3122 0x0000, /* R1545 - AIF1 ADC2 Right mixer Routing */
3123 0x0000, /* R1546 */
3124 0x0000, /* R1547 */
3125 0x0000, /* R1548 */
3126 0x0000, /* R1549 */
3127 0x0000, /* R1550 */
3128 0x0000, /* R1551 */
3129 0x02C0, /* R1552 - DAC1 Left Volume */
3130 0x02C0, /* R1553 - DAC1 Right Volume */
3131 0x02C0, /* R1554 - DAC2 Left Volume */
3132 0x02C0, /* R1555 - DAC2 Right Volume */
3133 0x0000, /* R1556 - DAC Softmute */
3134 0x0000, /* R1557 */
3135 0x0000, /* R1558 */
3136 0x0000, /* R1559 */
3137 0x0000, /* R1560 */
3138 0x0000, /* R1561 */
3139 0x0000, /* R1562 */
3140 0x0000, /* R1563 */
3141 0x0000, /* R1564 */
3142 0x0000, /* R1565 */
3143 0x0000, /* R1566 */
3144 0x0000, /* R1567 */
3145 0x0002, /* R1568 - Oversampling */
3146 0x0000, /* R1569 - Sidetone */
3147};
diff --git a/sound/soc/ep93xx/Kconfig b/sound/soc/ep93xx/Kconfig
new file mode 100644
index 00000000000..91a28de9410
--- /dev/null
+++ b/sound/soc/ep93xx/Kconfig
@@ -0,0 +1,41 @@
1config SND_EP93XX_SOC
2 tristate "SoC Audio support for the Cirrus Logic EP93xx series"
3 depends on ARCH_EP93XX && SND_SOC
4 help
5 Say Y or M if you want to add support for codecs attached to
6 the EP93xx I2S or AC97 interfaces.
7
8config SND_EP93XX_SOC_I2S
9 tristate
10
11config SND_EP93XX_SOC_AC97
12 tristate
13 select AC97_BUS
14 select SND_SOC_AC97_BUS
15
16config SND_EP93XX_SOC_SNAPPERCL15
17 tristate "SoC Audio support for Bluewater Systems Snapper CL15 module"
18 depends on SND_EP93XX_SOC && MACH_SNAPPER_CL15
19 select SND_EP93XX_SOC_I2S
20 select SND_SOC_TLV320AIC23
21 help
22 Say Y or M here if you want to add support for I2S audio on the
23 Bluewater Systems Snapper CL15 module.
24
25config SND_EP93XX_SOC_SIMONE
26 tristate "SoC Audio support for Simplemachines Sim.One board"
27 depends on SND_EP93XX_SOC && MACH_SIM_ONE
28 select SND_EP93XX_SOC_AC97
29 select SND_SOC_AC97_CODEC
30 help
31 Say Y or M here if you want to add support for AC97 audio on the
32 Simplemachines Sim.One board.
33
34config SND_EP93XX_SOC_EDB93XX
35 tristate "SoC Audio support for Cirrus Logic EDB93xx boards"
36 depends on SND_EP93XX_SOC && (MACH_EDB9301 || MACH_EDB9302 || MACH_EDB9302A || MACH_EDB9307A || MACH_EDB9315A)
37 select SND_EP93XX_SOC_I2S
38 select SND_SOC_CS4271
39 help
40 Say Y or M here if you want to add support for I2S audio on the
41 Cirrus Logic EDB93xx boards.
diff --git a/sound/soc/ep93xx/Makefile b/sound/soc/ep93xx/Makefile
new file mode 100644
index 00000000000..5514146cbdf
--- /dev/null
+++ b/sound/soc/ep93xx/Makefile
@@ -0,0 +1,17 @@
1# EP93xx Platform Support
2snd-soc-ep93xx-objs := ep93xx-pcm.o
3snd-soc-ep93xx-i2s-objs := ep93xx-i2s.o
4snd-soc-ep93xx-ac97-objs := ep93xx-ac97.o
5
6obj-$(CONFIG_SND_EP93XX_SOC) += snd-soc-ep93xx.o
7obj-$(CONFIG_SND_EP93XX_SOC_I2S) += snd-soc-ep93xx-i2s.o
8obj-$(CONFIG_SND_EP93XX_SOC_AC97) += snd-soc-ep93xx-ac97.o
9
10# EP93XX Machine Support
11snd-soc-snappercl15-objs := snappercl15.o
12snd-soc-simone-objs := simone.o
13snd-soc-edb93xx-objs := edb93xx.o
14
15obj-$(CONFIG_SND_EP93XX_SOC_SNAPPERCL15) += snd-soc-snappercl15.o
16obj-$(CONFIG_SND_EP93XX_SOC_SIMONE) += snd-soc-simone.o
17obj-$(CONFIG_SND_EP93XX_SOC_EDB93XX) += snd-soc-edb93xx.o
diff --git a/sound/soc/ep93xx/edb93xx.c b/sound/soc/ep93xx/edb93xx.c
new file mode 100644
index 00000000000..d3aa15119d2
--- /dev/null
+++ b/sound/soc/ep93xx/edb93xx.c
@@ -0,0 +1,142 @@
1/*
2 * SoC audio for EDB93xx
3 *
4 * Copyright (c) 2010 Alexander Sverdlin <subaparts@yandex.ru>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * This driver support CS4271 codec being master or slave, working
17 * in control port mode, connected either via SPI or I2C.
18 * The data format accepted is I2S or left-justified.
19 * DAPM support not implemented.
20 */
21
22#include <linux/platform_device.h>
23#include <linux/gpio.h>
24#include <sound/core.h>
25#include <sound/pcm.h>
26#include <sound/soc.h>
27#include <asm/mach-types.h>
28#include <mach/hardware.h>
29#include "ep93xx-pcm.h"
30
31#define edb93xx_has_audio() (machine_is_edb9301() || \
32 machine_is_edb9302() || \
33 machine_is_edb9302a() || \
34 machine_is_edb9307a() || \
35 machine_is_edb9315a())
36
37static int edb93xx_hw_params(struct snd_pcm_substream *substream,
38 struct snd_pcm_hw_params *params)
39{
40 struct snd_soc_pcm_runtime *rtd = substream->private_data;
41 struct snd_soc_dai *codec_dai = rtd->codec_dai;
42 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
43 int err;
44 unsigned int mclk_rate;
45 unsigned int rate = params_rate(params);
46
47 /*
48 * According to CS4271 datasheet we use MCLK/LRCK=256 for
49 * rates below 50kHz and 128 for higher sample rates
50 */
51 if (rate < 50000)
52 mclk_rate = rate * 64 * 4;
53 else
54 mclk_rate = rate * 64 * 2;
55
56 err = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S |
57 SND_SOC_DAIFMT_NB_IF |
58 SND_SOC_DAIFMT_CBS_CFS);
59 if (err)
60 return err;
61
62 err = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S |
63 SND_SOC_DAIFMT_NB_IF |
64 SND_SOC_DAIFMT_CBS_CFS);
65 if (err)
66 return err;
67
68 err = snd_soc_dai_set_sysclk(codec_dai, 0, mclk_rate,
69 SND_SOC_CLOCK_IN);
70 if (err)
71 return err;
72
73 return snd_soc_dai_set_sysclk(cpu_dai, 0, mclk_rate,
74 SND_SOC_CLOCK_OUT);
75}
76
77static struct snd_soc_ops edb93xx_ops = {
78 .hw_params = edb93xx_hw_params,
79};
80
81static struct snd_soc_dai_link edb93xx_dai = {
82 .name = "CS4271",
83 .stream_name = "CS4271 HiFi",
84 .platform_name = "ep93xx-pcm-audio",
85 .cpu_dai_name = "ep93xx-i2s",
86 .codec_name = "spi0.0",
87 .codec_dai_name = "cs4271-hifi",
88 .ops = &edb93xx_ops,
89};
90
91static struct snd_soc_card snd_soc_edb93xx = {
92 .name = "EDB93XX",
93 .dai_link = &edb93xx_dai,
94 .num_links = 1,
95};
96
97static struct platform_device *edb93xx_snd_device;
98
99static int __init edb93xx_init(void)
100{
101 int ret;
102
103 if (!edb93xx_has_audio())
104 return -ENODEV;
105
106 ret = ep93xx_i2s_acquire(EP93XX_SYSCON_DEVCFG_I2SONAC97,
107 EP93XX_SYSCON_I2SCLKDIV_ORIDE |
108 EP93XX_SYSCON_I2SCLKDIV_SPOL);
109 if (ret)
110 return ret;
111
112 edb93xx_snd_device = platform_device_alloc("soc-audio", -1);
113 if (!edb93xx_snd_device) {
114 ret = -ENOMEM;
115 goto free_i2s;
116 }
117
118 platform_set_drvdata(edb93xx_snd_device, &snd_soc_edb93xx);
119 ret = platform_device_add(edb93xx_snd_device);
120 if (ret)
121 goto device_put;
122
123 return 0;
124
125device_put:
126 platform_device_put(edb93xx_snd_device);
127free_i2s:
128 ep93xx_i2s_release();
129 return ret;
130}
131module_init(edb93xx_init);
132
133static void __exit edb93xx_exit(void)
134{
135 platform_device_unregister(edb93xx_snd_device);
136 ep93xx_i2s_release();
137}
138module_exit(edb93xx_exit);
139
140MODULE_AUTHOR("Alexander Sverdlin <subaparts@yandex.ru>");
141MODULE_DESCRIPTION("ALSA SoC EDB93xx");
142MODULE_LICENSE("GPL");
diff --git a/sound/soc/ep93xx/ep93xx-ac97.c b/sound/soc/ep93xx/ep93xx-ac97.c
new file mode 100644
index 00000000000..c7417c76552
--- /dev/null
+++ b/sound/soc/ep93xx/ep93xx-ac97.c
@@ -0,0 +1,467 @@
1/*
2 * ASoC driver for Cirrus Logic EP93xx AC97 controller.
3 *
4 * Copyright (c) 2010 Mika Westerberg
5 *
6 * Based on s3c-ac97 ASoC driver by Jaswinder Singh.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#include <linux/delay.h>
14#include <linux/io.h>
15#include <linux/init.h>
16#include <linux/module.h>
17#include <linux/platform_device.h>
18#include <linux/slab.h>
19
20#include <sound/core.h>
21#include <sound/ac97_codec.h>
22#include <sound/soc.h>
23
24#include <mach/dma.h>
25#include "ep93xx-pcm.h"
26
27/*
28 * Per channel (1-4) registers.
29 */
30#define AC97CH(n) (((n) - 1) * 0x20)
31
32#define AC97DR(n) (AC97CH(n) + 0x0000)
33
34#define AC97RXCR(n) (AC97CH(n) + 0x0004)
35#define AC97RXCR_REN BIT(0)
36#define AC97RXCR_RX3 BIT(3)
37#define AC97RXCR_RX4 BIT(4)
38#define AC97RXCR_CM BIT(15)
39
40#define AC97TXCR(n) (AC97CH(n) + 0x0008)
41#define AC97TXCR_TEN BIT(0)
42#define AC97TXCR_TX3 BIT(3)
43#define AC97TXCR_TX4 BIT(4)
44#define AC97TXCR_CM BIT(15)
45
46#define AC97SR(n) (AC97CH(n) + 0x000c)
47#define AC97SR_TXFE BIT(1)
48#define AC97SR_TXUE BIT(6)
49
50#define AC97RISR(n) (AC97CH(n) + 0x0010)
51#define AC97ISR(n) (AC97CH(n) + 0x0014)
52#define AC97IE(n) (AC97CH(n) + 0x0018)
53
54/*
55 * Global AC97 controller registers.
56 */
57#define AC97S1DATA 0x0080
58#define AC97S2DATA 0x0084
59#define AC97S12DATA 0x0088
60
61#define AC97RGIS 0x008c
62#define AC97GIS 0x0090
63#define AC97IM 0x0094
64/*
65 * Common bits for RGIS, GIS and IM registers.
66 */
67#define AC97_SLOT2RXVALID BIT(1)
68#define AC97_CODECREADY BIT(5)
69#define AC97_SLOT2TXCOMPLETE BIT(6)
70
71#define AC97EOI 0x0098
72#define AC97EOI_WINT BIT(0)
73#define AC97EOI_CODECREADY BIT(1)
74
75#define AC97GCR 0x009c
76#define AC97GCR_AC97IFE BIT(0)
77
78#define AC97RESET 0x00a0
79#define AC97RESET_TIMEDRESET BIT(0)
80
81#define AC97SYNC 0x00a4
82#define AC97SYNC_TIMEDSYNC BIT(0)
83
84#define AC97_TIMEOUT msecs_to_jiffies(5)
85
86/**
87 * struct ep93xx_ac97_info - EP93xx AC97 controller info structure
88 * @lock: mutex serializing access to the bus (slot 1 & 2 ops)
89 * @dev: pointer to the platform device dev structure
90 * @mem: physical memory resource for the registers
91 * @regs: mapped AC97 controller registers
92 * @irq: AC97 interrupt number
93 * @done: bus ops wait here for an interrupt
94 */
95struct ep93xx_ac97_info {
96 struct mutex lock;
97 struct device *dev;
98 struct resource *mem;
99 void __iomem *regs;
100 int irq;
101 struct completion done;
102};
103
104/* currently ALSA only supports a single AC97 device */
105static struct ep93xx_ac97_info *ep93xx_ac97_info;
106
107static struct ep93xx_pcm_dma_params ep93xx_ac97_pcm_out = {
108 .name = "ac97-pcm-out",
109 .dma_port = EP93XX_DMA_AAC1,
110};
111
112static struct ep93xx_pcm_dma_params ep93xx_ac97_pcm_in = {
113 .name = "ac97-pcm-in",
114 .dma_port = EP93XX_DMA_AAC1,
115};
116
117static inline unsigned ep93xx_ac97_read_reg(struct ep93xx_ac97_info *info,
118 unsigned reg)
119{
120 return __raw_readl(info->regs + reg);
121}
122
123static inline void ep93xx_ac97_write_reg(struct ep93xx_ac97_info *info,
124 unsigned reg, unsigned val)
125{
126 __raw_writel(val, info->regs + reg);
127}
128
129static unsigned short ep93xx_ac97_read(struct snd_ac97 *ac97,
130 unsigned short reg)
131{
132 struct ep93xx_ac97_info *info = ep93xx_ac97_info;
133 unsigned short val;
134
135 mutex_lock(&info->lock);
136
137 ep93xx_ac97_write_reg(info, AC97S1DATA, reg);
138 ep93xx_ac97_write_reg(info, AC97IM, AC97_SLOT2RXVALID);
139 if (!wait_for_completion_timeout(&info->done, AC97_TIMEOUT)) {
140 dev_warn(info->dev, "timeout reading register %x\n", reg);
141 mutex_unlock(&info->lock);
142 return -ETIMEDOUT;
143 }
144 val = (unsigned short)ep93xx_ac97_read_reg(info, AC97S2DATA);
145
146 mutex_unlock(&info->lock);
147 return val;
148}
149
150static void ep93xx_ac97_write(struct snd_ac97 *ac97,
151 unsigned short reg,
152 unsigned short val)
153{
154 struct ep93xx_ac97_info *info = ep93xx_ac97_info;
155
156 mutex_lock(&info->lock);
157
158 /*
159 * Writes to the codec need to be done so that slot 2 is filled in
160 * before slot 1.
161 */
162 ep93xx_ac97_write_reg(info, AC97S2DATA, val);
163 ep93xx_ac97_write_reg(info, AC97S1DATA, reg);
164
165 ep93xx_ac97_write_reg(info, AC97IM, AC97_SLOT2TXCOMPLETE);
166 if (!wait_for_completion_timeout(&info->done, AC97_TIMEOUT))
167 dev_warn(info->dev, "timeout writing register %x\n", reg);
168
169 mutex_unlock(&info->lock);
170}
171
172static void ep93xx_ac97_warm_reset(struct snd_ac97 *ac97)
173{
174 struct ep93xx_ac97_info *info = ep93xx_ac97_info;
175
176 mutex_lock(&info->lock);
177
178 /*
179 * We are assuming that before this functions gets called, the codec
180 * BIT_CLK is stopped by forcing the codec into powerdown mode. We can
181 * control the SYNC signal directly via AC97SYNC register. Using
182 * TIMEDSYNC the controller will keep the SYNC high > 1us.
183 */
184 ep93xx_ac97_write_reg(info, AC97SYNC, AC97SYNC_TIMEDSYNC);
185 ep93xx_ac97_write_reg(info, AC97IM, AC97_CODECREADY);
186 if (!wait_for_completion_timeout(&info->done, AC97_TIMEOUT))
187 dev_warn(info->dev, "codec warm reset timeout\n");
188
189 mutex_unlock(&info->lock);
190}
191
192static void ep93xx_ac97_cold_reset(struct snd_ac97 *ac97)
193{
194 struct ep93xx_ac97_info *info = ep93xx_ac97_info;
195
196 mutex_lock(&info->lock);
197
198 /*
199 * For doing cold reset, we disable the AC97 controller interface, clear
200 * WINT and CODECREADY bits, and finally enable the interface again.
201 */
202 ep93xx_ac97_write_reg(info, AC97GCR, 0);
203 ep93xx_ac97_write_reg(info, AC97EOI, AC97EOI_CODECREADY | AC97EOI_WINT);
204 ep93xx_ac97_write_reg(info, AC97GCR, AC97GCR_AC97IFE);
205
206 /*
207 * Now, assert the reset and wait for the codec to become ready.
208 */
209 ep93xx_ac97_write_reg(info, AC97RESET, AC97RESET_TIMEDRESET);
210 ep93xx_ac97_write_reg(info, AC97IM, AC97_CODECREADY);
211 if (!wait_for_completion_timeout(&info->done, AC97_TIMEOUT))
212 dev_warn(info->dev, "codec cold reset timeout\n");
213
214 /*
215 * Give the codec some time to come fully out from the reset. This way
216 * we ensure that the subsequent reads/writes will work.
217 */
218 usleep_range(15000, 20000);
219
220 mutex_unlock(&info->lock);
221}
222
223static irqreturn_t ep93xx_ac97_interrupt(int irq, void *dev_id)
224{
225 struct ep93xx_ac97_info *info = dev_id;
226 unsigned status, mask;
227
228 /*
229 * Just mask out the interrupt and wake up the waiting thread.
230 * Interrupts are cleared via reading/writing to slot 1 & 2 registers by
231 * the waiting thread.
232 */
233 status = ep93xx_ac97_read_reg(info, AC97GIS);
234 mask = ep93xx_ac97_read_reg(info, AC97IM);
235 mask &= ~status;
236 ep93xx_ac97_write_reg(info, AC97IM, mask);
237
238 complete(&info->done);
239 return IRQ_HANDLED;
240}
241
242struct snd_ac97_bus_ops soc_ac97_ops = {
243 .read = ep93xx_ac97_read,
244 .write = ep93xx_ac97_write,
245 .reset = ep93xx_ac97_cold_reset,
246 .warm_reset = ep93xx_ac97_warm_reset,
247};
248EXPORT_SYMBOL_GPL(soc_ac97_ops);
249
250static int ep93xx_ac97_trigger(struct snd_pcm_substream *substream,
251 int cmd, struct snd_soc_dai *dai)
252{
253 struct ep93xx_ac97_info *info = snd_soc_dai_get_drvdata(dai);
254 unsigned v = 0;
255
256 switch (cmd) {
257 case SNDRV_PCM_TRIGGER_START:
258 case SNDRV_PCM_TRIGGER_RESUME:
259 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
260 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
261 /*
262 * Enable compact mode, TX slots 3 & 4, and the TX FIFO
263 * itself.
264 */
265 v |= AC97TXCR_CM;
266 v |= AC97TXCR_TX3 | AC97TXCR_TX4;
267 v |= AC97TXCR_TEN;
268 ep93xx_ac97_write_reg(info, AC97TXCR(1), v);
269 } else {
270 /*
271 * Enable compact mode, RX slots 3 & 4, and the RX FIFO
272 * itself.
273 */
274 v |= AC97RXCR_CM;
275 v |= AC97RXCR_RX3 | AC97RXCR_RX4;
276 v |= AC97RXCR_REN;
277 ep93xx_ac97_write_reg(info, AC97RXCR(1), v);
278 }
279 break;
280
281 case SNDRV_PCM_TRIGGER_STOP:
282 case SNDRV_PCM_TRIGGER_SUSPEND:
283 case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
284 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
285 /*
286 * As per Cirrus EP93xx errata described below:
287 *
288 * http://www.cirrus.com/en/pubs/errata/ER667E2B.pdf
289 *
290 * we will wait for the TX FIFO to be empty before
291 * clearing the TEN bit.
292 */
293 unsigned long timeout = jiffies + AC97_TIMEOUT;
294
295 do {
296 v = ep93xx_ac97_read_reg(info, AC97SR(1));
297 if (time_after(jiffies, timeout)) {
298 dev_warn(info->dev, "TX timeout\n");
299 break;
300 }
301 } while (!(v & (AC97SR_TXFE | AC97SR_TXUE)));
302
303 /* disable the TX FIFO */
304 ep93xx_ac97_write_reg(info, AC97TXCR(1), 0);
305 } else {
306 /* disable the RX FIFO */
307 ep93xx_ac97_write_reg(info, AC97RXCR(1), 0);
308 }
309 break;
310
311 default:
312 dev_warn(info->dev, "unknown command %d\n", cmd);
313 return -EINVAL;
314 }
315
316 return 0;
317}
318
319static int ep93xx_ac97_startup(struct snd_pcm_substream *substream,
320 struct snd_soc_dai *dai)
321{
322 struct ep93xx_pcm_dma_params *dma_data;
323
324 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
325 dma_data = &ep93xx_ac97_pcm_out;
326 else
327 dma_data = &ep93xx_ac97_pcm_in;
328
329 snd_soc_dai_set_dma_data(dai, substream, dma_data);
330 return 0;
331}
332
333static struct snd_soc_dai_ops ep93xx_ac97_dai_ops = {
334 .startup = ep93xx_ac97_startup,
335 .trigger = ep93xx_ac97_trigger,
336};
337
338struct snd_soc_dai_driver ep93xx_ac97_dai = {
339 .name = "ep93xx-ac97",
340 .id = 0,
341 .ac97_control = 1,
342 .playback = {
343 .stream_name = "AC97 Playback",
344 .channels_min = 2,
345 .channels_max = 2,
346 .rates = SNDRV_PCM_RATE_8000_48000,
347 .formats = SNDRV_PCM_FMTBIT_S16_LE,
348 },
349 .capture = {
350 .stream_name = "AC97 Capture",
351 .channels_min = 2,
352 .channels_max = 2,
353 .rates = SNDRV_PCM_RATE_8000_48000,
354 .formats = SNDRV_PCM_FMTBIT_S16_LE,
355 },
356 .ops = &ep93xx_ac97_dai_ops,
357};
358
359static int __devinit ep93xx_ac97_probe(struct platform_device *pdev)
360{
361 struct ep93xx_ac97_info *info;
362 int ret;
363
364 info = kzalloc(sizeof(struct ep93xx_ac97_info), GFP_KERNEL);
365 if (!info)
366 return -ENOMEM;
367
368 dev_set_drvdata(&pdev->dev, info);
369
370 mutex_init(&info->lock);
371 init_completion(&info->done);
372 info->dev = &pdev->dev;
373
374 info->mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
375 if (!info->mem) {
376 ret = -ENXIO;
377 goto fail_free_info;
378 }
379
380 info->irq = platform_get_irq(pdev, 0);
381 if (!info->irq) {
382 ret = -ENXIO;
383 goto fail_free_info;
384 }
385
386 if (!request_mem_region(info->mem->start, resource_size(info->mem),
387 pdev->name)) {
388 ret = -EBUSY;
389 goto fail_free_info;
390 }
391
392 info->regs = ioremap(info->mem->start, resource_size(info->mem));
393 if (!info->regs) {
394 ret = -ENOMEM;
395 goto fail_release_mem;
396 }
397
398 ret = request_irq(info->irq, ep93xx_ac97_interrupt, IRQF_TRIGGER_HIGH,
399 pdev->name, info);
400 if (ret)
401 goto fail_unmap_mem;
402
403 ep93xx_ac97_info = info;
404 platform_set_drvdata(pdev, info);
405
406 ret = snd_soc_register_dai(&pdev->dev, &ep93xx_ac97_dai);
407 if (ret)
408 goto fail_free_irq;
409
410 return 0;
411
412fail_free_irq:
413 platform_set_drvdata(pdev, NULL);
414 free_irq(info->irq, info);
415fail_unmap_mem:
416 iounmap(info->regs);
417fail_release_mem:
418 release_mem_region(info->mem->start, resource_size(info->mem));
419fail_free_info:
420 kfree(info);
421
422 return ret;
423}
424
425static int __devexit ep93xx_ac97_remove(struct platform_device *pdev)
426{
427 struct ep93xx_ac97_info *info = platform_get_drvdata(pdev);
428
429 snd_soc_unregister_dai(&pdev->dev);
430
431 /* disable the AC97 controller */
432 ep93xx_ac97_write_reg(info, AC97GCR, 0);
433
434 free_irq(info->irq, info);
435 iounmap(info->regs);
436 release_mem_region(info->mem->start, resource_size(info->mem));
437 platform_set_drvdata(pdev, NULL);
438 kfree(info);
439
440 return 0;
441}
442
443static struct platform_driver ep93xx_ac97_driver = {
444 .probe = ep93xx_ac97_probe,
445 .remove = __devexit_p(ep93xx_ac97_remove),
446 .driver = {
447 .name = "ep93xx-ac97",
448 .owner = THIS_MODULE,
449 },
450};
451
452static int __init ep93xx_ac97_init(void)
453{
454 return platform_driver_register(&ep93xx_ac97_driver);
455}
456module_init(ep93xx_ac97_init);
457
458static void __exit ep93xx_ac97_exit(void)
459{
460 platform_driver_unregister(&ep93xx_ac97_driver);
461}
462module_exit(ep93xx_ac97_exit);
463
464MODULE_DESCRIPTION("EP93xx AC97 ASoC Driver");
465MODULE_AUTHOR("Mika Westerberg <mika.westerberg@iki.fi>");
466MODULE_LICENSE("GPL");
467MODULE_ALIAS("platform:ep93xx-ac97");
diff --git a/sound/soc/ep93xx/ep93xx-i2s.c b/sound/soc/ep93xx/ep93xx-i2s.c
new file mode 100644
index 00000000000..099614e1665
--- /dev/null
+++ b/sound/soc/ep93xx/ep93xx-i2s.c
@@ -0,0 +1,483 @@
1/*
2 * linux/sound/soc/ep93xx-i2s.c
3 * EP93xx I2S driver
4 *
5 * Copyright (C) 2010 Ryan Mallon
6 *
7 * Based on the original driver by:
8 * Copyright (C) 2007 Chase Douglas <chasedouglas@gmail>
9 * Copyright (C) 2006 Lennert Buytenhek <buytenh@wantstofly.org>
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
14 *
15 */
16
17#include <linux/module.h>
18#include <linux/init.h>
19#include <linux/slab.h>
20#include <linux/clk.h>
21#include <linux/io.h>
22
23#include <sound/core.h>
24#include <sound/pcm.h>
25#include <sound/pcm_params.h>
26#include <sound/initval.h>
27#include <sound/soc.h>
28
29#include <mach/hardware.h>
30#include <mach/ep93xx-regs.h>
31#include <mach/dma.h>
32
33#include "ep93xx-pcm.h"
34
35#define EP93XX_I2S_TXCLKCFG 0x00
36#define EP93XX_I2S_RXCLKCFG 0x04
37#define EP93XX_I2S_GLCTRL 0x0C
38
39#define EP93XX_I2S_TXLINCTRLDATA 0x28
40#define EP93XX_I2S_TXCTRL 0x2C
41#define EP93XX_I2S_TXWRDLEN 0x30
42#define EP93XX_I2S_TX0EN 0x34
43
44#define EP93XX_I2S_RXLINCTRLDATA 0x58
45#define EP93XX_I2S_RXCTRL 0x5C
46#define EP93XX_I2S_RXWRDLEN 0x60
47#define EP93XX_I2S_RX0EN 0x64
48
49#define EP93XX_I2S_WRDLEN_16 (0 << 0)
50#define EP93XX_I2S_WRDLEN_24 (1 << 0)
51#define EP93XX_I2S_WRDLEN_32 (2 << 0)
52
53#define EP93XX_I2S_LINCTRLDATA_R_JUST (1 << 2) /* Right justify */
54
55#define EP93XX_I2S_CLKCFG_LRS (1 << 0) /* lrclk polarity */
56#define EP93XX_I2S_CLKCFG_CKP (1 << 1) /* Bit clock polarity */
57#define EP93XX_I2S_CLKCFG_REL (1 << 2) /* First bit transition */
58#define EP93XX_I2S_CLKCFG_MASTER (1 << 3) /* Master mode */
59#define EP93XX_I2S_CLKCFG_NBCG (1 << 4) /* Not bit clock gating */
60
61struct ep93xx_i2s_info {
62 struct clk *mclk;
63 struct clk *sclk;
64 struct clk *lrclk;
65 struct ep93xx_pcm_dma_params *dma_params;
66 struct resource *mem;
67 void __iomem *regs;
68};
69
70struct ep93xx_pcm_dma_params ep93xx_i2s_dma_params[] = {
71 [SNDRV_PCM_STREAM_PLAYBACK] = {
72 .name = "i2s-pcm-out",
73 .dma_port = EP93XX_DMA_I2S1,
74 },
75 [SNDRV_PCM_STREAM_CAPTURE] = {
76 .name = "i2s-pcm-in",
77 .dma_port = EP93XX_DMA_I2S1,
78 },
79};
80
81static inline void ep93xx_i2s_write_reg(struct ep93xx_i2s_info *info,
82 unsigned reg, unsigned val)
83{
84 __raw_writel(val, info->regs + reg);
85}
86
87static inline unsigned ep93xx_i2s_read_reg(struct ep93xx_i2s_info *info,
88 unsigned reg)
89{
90 return __raw_readl(info->regs + reg);
91}
92
93static void ep93xx_i2s_enable(struct ep93xx_i2s_info *info, int stream)
94{
95 unsigned base_reg;
96 int i;
97
98 if ((ep93xx_i2s_read_reg(info, EP93XX_I2S_TX0EN) & 0x1) == 0 &&
99 (ep93xx_i2s_read_reg(info, EP93XX_I2S_RX0EN) & 0x1) == 0) {
100 /* Enable clocks */
101 clk_enable(info->mclk);
102 clk_enable(info->sclk);
103 clk_enable(info->lrclk);
104
105 /* Enable i2s */
106 ep93xx_i2s_write_reg(info, EP93XX_I2S_GLCTRL, 1);
107 }
108
109 /* Enable fifos */
110 if (stream == SNDRV_PCM_STREAM_PLAYBACK)
111 base_reg = EP93XX_I2S_TX0EN;
112 else
113 base_reg = EP93XX_I2S_RX0EN;
114 for (i = 0; i < 3; i++)
115 ep93xx_i2s_write_reg(info, base_reg + (i * 4), 1);
116}
117
118static void ep93xx_i2s_disable(struct ep93xx_i2s_info *info, int stream)
119{
120 unsigned base_reg;
121 int i;
122
123 /* Disable fifos */
124 if (stream == SNDRV_PCM_STREAM_PLAYBACK)
125 base_reg = EP93XX_I2S_TX0EN;
126 else
127 base_reg = EP93XX_I2S_RX0EN;
128 for (i = 0; i < 3; i++)
129 ep93xx_i2s_write_reg(info, base_reg + (i * 4), 0);
130
131 if ((ep93xx_i2s_read_reg(info, EP93XX_I2S_TX0EN) & 0x1) == 0 &&
132 (ep93xx_i2s_read_reg(info, EP93XX_I2S_RX0EN) & 0x1) == 0) {
133 /* Disable i2s */
134 ep93xx_i2s_write_reg(info, EP93XX_I2S_GLCTRL, 0);
135
136 /* Disable clocks */
137 clk_disable(info->lrclk);
138 clk_disable(info->sclk);
139 clk_disable(info->mclk);
140 }
141}
142
143static int ep93xx_i2s_startup(struct snd_pcm_substream *substream,
144 struct snd_soc_dai *dai)
145{
146 struct snd_soc_pcm_runtime *rtd = substream->private_data;
147 struct ep93xx_i2s_info *info = snd_soc_dai_get_drvdata(dai);
148 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
149
150 snd_soc_dai_set_dma_data(cpu_dai, substream,
151 &info->dma_params[substream->stream]);
152 return 0;
153}
154
155static void ep93xx_i2s_shutdown(struct snd_pcm_substream *substream,
156 struct snd_soc_dai *dai)
157{
158 struct ep93xx_i2s_info *info = snd_soc_dai_get_drvdata(dai);
159
160 ep93xx_i2s_disable(info, substream->stream);
161}
162
163static int ep93xx_i2s_set_dai_fmt(struct snd_soc_dai *cpu_dai,
164 unsigned int fmt)
165{
166 struct ep93xx_i2s_info *info = snd_soc_dai_get_drvdata(cpu_dai);
167 unsigned int clk_cfg, lin_ctrl;
168
169 clk_cfg = ep93xx_i2s_read_reg(info, EP93XX_I2S_RXCLKCFG);
170 lin_ctrl = ep93xx_i2s_read_reg(info, EP93XX_I2S_RXLINCTRLDATA);
171
172 switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
173 case SND_SOC_DAIFMT_I2S:
174 clk_cfg |= EP93XX_I2S_CLKCFG_REL;
175 lin_ctrl &= ~EP93XX_I2S_LINCTRLDATA_R_JUST;
176 break;
177
178 case SND_SOC_DAIFMT_LEFT_J:
179 clk_cfg &= ~EP93XX_I2S_CLKCFG_REL;
180 lin_ctrl &= ~EP93XX_I2S_LINCTRLDATA_R_JUST;
181 break;
182
183 case SND_SOC_DAIFMT_RIGHT_J:
184 clk_cfg &= ~EP93XX_I2S_CLKCFG_REL;
185 lin_ctrl |= EP93XX_I2S_LINCTRLDATA_R_JUST;
186 break;
187
188 default:
189 return -EINVAL;
190 }
191
192 switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
193 case SND_SOC_DAIFMT_CBS_CFS:
194 /* CPU is master */
195 clk_cfg |= EP93XX_I2S_CLKCFG_MASTER;
196 break;
197
198 case SND_SOC_DAIFMT_CBM_CFM:
199 /* Codec is master */
200 clk_cfg &= ~EP93XX_I2S_CLKCFG_MASTER;
201 break;
202
203 default:
204 return -EINVAL;
205 }
206
207 switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
208 case SND_SOC_DAIFMT_NB_NF:
209 /* Negative bit clock, lrclk low on left word */
210 clk_cfg &= ~(EP93XX_I2S_CLKCFG_CKP | EP93XX_I2S_CLKCFG_REL);
211 break;
212
213 case SND_SOC_DAIFMT_NB_IF:
214 /* Negative bit clock, lrclk low on right word */
215 clk_cfg &= ~EP93XX_I2S_CLKCFG_CKP;
216 clk_cfg |= EP93XX_I2S_CLKCFG_REL;
217 break;
218
219 case SND_SOC_DAIFMT_IB_NF:
220 /* Positive bit clock, lrclk low on left word */
221 clk_cfg |= EP93XX_I2S_CLKCFG_CKP;
222 clk_cfg &= ~EP93XX_I2S_CLKCFG_REL;
223 break;
224
225 case SND_SOC_DAIFMT_IB_IF:
226 /* Positive bit clock, lrclk low on right word */
227 clk_cfg |= EP93XX_I2S_CLKCFG_CKP | EP93XX_I2S_CLKCFG_REL;
228 break;
229 }
230
231 /* Write new register values */
232 ep93xx_i2s_write_reg(info, EP93XX_I2S_RXCLKCFG, clk_cfg);
233 ep93xx_i2s_write_reg(info, EP93XX_I2S_TXCLKCFG, clk_cfg);
234 ep93xx_i2s_write_reg(info, EP93XX_I2S_RXLINCTRLDATA, lin_ctrl);
235 ep93xx_i2s_write_reg(info, EP93XX_I2S_TXLINCTRLDATA, lin_ctrl);
236 return 0;
237}
238
239static int ep93xx_i2s_hw_params(struct snd_pcm_substream *substream,
240 struct snd_pcm_hw_params *params,
241 struct snd_soc_dai *dai)
242{
243 struct ep93xx_i2s_info *info = snd_soc_dai_get_drvdata(dai);
244 unsigned word_len, div, sdiv, lrdiv;
245 int err;
246
247 switch (params_format(params)) {
248 case SNDRV_PCM_FORMAT_S16_LE:
249 word_len = EP93XX_I2S_WRDLEN_16;
250 break;
251
252 case SNDRV_PCM_FORMAT_S24_LE:
253 word_len = EP93XX_I2S_WRDLEN_24;
254 break;
255
256 case SNDRV_PCM_FORMAT_S32_LE:
257 word_len = EP93XX_I2S_WRDLEN_32;
258 break;
259
260 default:
261 return -EINVAL;
262 }
263
264 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
265 ep93xx_i2s_write_reg(info, EP93XX_I2S_TXWRDLEN, word_len);
266 else
267 ep93xx_i2s_write_reg(info, EP93XX_I2S_RXWRDLEN, word_len);
268
269 /*
270 * EP93xx I2S module can be setup so SCLK / LRCLK value can be
271 * 32, 64, 128. MCLK / SCLK value can be 2 and 4.
272 * We set LRCLK equal to `rate' and minimum SCLK / LRCLK
273 * value is 64, because our sample size is 32 bit * 2 channels.
274 * I2S standard permits us to transmit more bits than
275 * the codec uses.
276 */
277 div = clk_get_rate(info->mclk) / params_rate(params);
278 sdiv = 4;
279 if (div > (256 + 512) / 2) {
280 lrdiv = 128;
281 } else {
282 lrdiv = 64;
283 if (div < (128 + 256) / 2)
284 sdiv = 2;
285 }
286
287 err = clk_set_rate(info->sclk, clk_get_rate(info->mclk) / sdiv);
288 if (err)
289 return err;
290
291 err = clk_set_rate(info->lrclk, clk_get_rate(info->sclk) / lrdiv);
292 if (err)
293 return err;
294
295 ep93xx_i2s_enable(info, substream->stream);
296 return 0;
297}
298
299static int ep93xx_i2s_set_sysclk(struct snd_soc_dai *cpu_dai, int clk_id,
300 unsigned int freq, int dir)
301{
302 struct ep93xx_i2s_info *info = snd_soc_dai_get_drvdata(cpu_dai);
303
304 if (dir == SND_SOC_CLOCK_IN || clk_id != 0)
305 return -EINVAL;
306
307 return clk_set_rate(info->mclk, freq);
308}
309
310#ifdef CONFIG_PM
311static int ep93xx_i2s_suspend(struct snd_soc_dai *dai)
312{
313 struct ep93xx_i2s_info *info = snd_soc_dai_get_drvdata(dai);
314
315 if (!dai->active)
316 return 0;
317
318 ep93xx_i2s_disable(info, SNDRV_PCM_STREAM_PLAYBACK);
319 ep93xx_i2s_disable(info, SNDRV_PCM_STREAM_CAPTURE);
320
321 return 0;
322}
323
324static int ep93xx_i2s_resume(struct snd_soc_dai *dai)
325{
326 struct ep93xx_i2s_info *info = snd_soc_dai_get_drvdata(dai);
327
328 if (!dai->active)
329 return 0;
330
331 ep93xx_i2s_enable(info, SNDRV_PCM_STREAM_PLAYBACK);
332 ep93xx_i2s_enable(info, SNDRV_PCM_STREAM_CAPTURE);
333
334 return 0;
335}
336#else
337#define ep93xx_i2s_suspend NULL
338#define ep93xx_i2s_resume NULL
339#endif
340
341static struct snd_soc_dai_ops ep93xx_i2s_dai_ops = {
342 .startup = ep93xx_i2s_startup,
343 .shutdown = ep93xx_i2s_shutdown,
344 .hw_params = ep93xx_i2s_hw_params,
345 .set_sysclk = ep93xx_i2s_set_sysclk,
346 .set_fmt = ep93xx_i2s_set_dai_fmt,
347};
348
349#define EP93XX_I2S_FORMATS (SNDRV_PCM_FMTBIT_S32_LE)
350
351static struct snd_soc_dai_driver ep93xx_i2s_dai = {
352 .symmetric_rates= 1,
353 .suspend = ep93xx_i2s_suspend,
354 .resume = ep93xx_i2s_resume,
355 .playback = {
356 .channels_min = 2,
357 .channels_max = 2,
358 .rates = SNDRV_PCM_RATE_8000_192000,
359 .formats = EP93XX_I2S_FORMATS,
360 },
361 .capture = {
362 .channels_min = 2,
363 .channels_max = 2,
364 .rates = SNDRV_PCM_RATE_8000_192000,
365 .formats = EP93XX_I2S_FORMATS,
366 },
367 .ops = &ep93xx_i2s_dai_ops,
368};
369
370static int ep93xx_i2s_probe(struct platform_device *pdev)
371{
372 struct ep93xx_i2s_info *info;
373 struct resource *res;
374 int err;
375
376 info = kzalloc(sizeof(struct ep93xx_i2s_info), GFP_KERNEL);
377 if (!info) {
378 err = -ENOMEM;
379 goto fail;
380 }
381
382 dev_set_drvdata(&pdev->dev, info);
383 info->dma_params = ep93xx_i2s_dma_params;
384
385 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
386 if (!res) {
387 err = -ENODEV;
388 goto fail_free_info;
389 }
390
391 info->mem = request_mem_region(res->start, resource_size(res),
392 pdev->name);
393 if (!info->mem) {
394 err = -EBUSY;
395 goto fail_free_info;
396 }
397
398 info->regs = ioremap(info->mem->start, resource_size(info->mem));
399 if (!info->regs) {
400 err = -ENXIO;
401 goto fail_release_mem;
402 }
403
404 info->mclk = clk_get(&pdev->dev, "mclk");
405 if (IS_ERR(info->mclk)) {
406 err = PTR_ERR(info->mclk);
407 goto fail_unmap_mem;
408 }
409
410 info->sclk = clk_get(&pdev->dev, "sclk");
411 if (IS_ERR(info->sclk)) {
412 err = PTR_ERR(info->sclk);
413 goto fail_put_mclk;
414 }
415
416 info->lrclk = clk_get(&pdev->dev, "lrclk");
417 if (IS_ERR(info->lrclk)) {
418 err = PTR_ERR(info->lrclk);
419 goto fail_put_sclk;
420 }
421
422 err = snd_soc_register_dai(&pdev->dev, &ep93xx_i2s_dai);
423 if (err)
424 goto fail_put_lrclk;
425
426 return 0;
427
428fail_put_lrclk:
429 clk_put(info->lrclk);
430fail_put_sclk:
431 clk_put(info->sclk);
432fail_put_mclk:
433 clk_put(info->mclk);
434fail_unmap_mem:
435 iounmap(info->regs);
436fail_release_mem:
437 release_mem_region(info->mem->start, resource_size(info->mem));
438fail_free_info:
439 kfree(info);
440fail:
441 return err;
442}
443
444static int __devexit ep93xx_i2s_remove(struct platform_device *pdev)
445{
446 struct ep93xx_i2s_info *info = dev_get_drvdata(&pdev->dev);
447
448 snd_soc_unregister_dai(&pdev->dev);
449 clk_put(info->lrclk);
450 clk_put(info->sclk);
451 clk_put(info->mclk);
452 iounmap(info->regs);
453 release_mem_region(info->mem->start, resource_size(info->mem));
454 kfree(info);
455 return 0;
456}
457
458static struct platform_driver ep93xx_i2s_driver = {
459 .probe = ep93xx_i2s_probe,
460 .remove = __devexit_p(ep93xx_i2s_remove),
461 .driver = {
462 .name = "ep93xx-i2s",
463 .owner = THIS_MODULE,
464 },
465};
466
467static int __init ep93xx_i2s_init(void)
468{
469 return platform_driver_register(&ep93xx_i2s_driver);
470}
471
472static void __exit ep93xx_i2s_exit(void)
473{
474 platform_driver_unregister(&ep93xx_i2s_driver);
475}
476
477module_init(ep93xx_i2s_init);
478module_exit(ep93xx_i2s_exit);
479
480MODULE_ALIAS("platform:ep93xx-i2s");
481MODULE_AUTHOR("Ryan Mallon");
482MODULE_DESCRIPTION("EP93XX I2S driver");
483MODULE_LICENSE("GPL");
diff --git a/sound/soc/ep93xx/ep93xx-pcm.c b/sound/soc/ep93xx/ep93xx-pcm.c
new file mode 100644
index 00000000000..8dfd3ad84b1
--- /dev/null
+++ b/sound/soc/ep93xx/ep93xx-pcm.c
@@ -0,0 +1,357 @@
1/*
2 * linux/sound/arm/ep93xx-pcm.c - EP93xx ALSA PCM interface
3 *
4 * Copyright (C) 2006 Lennert Buytenhek <buytenh@wantstofly.org>
5 * Copyright (C) 2006 Applied Data Systems
6 *
7 * Rewritten for the SoC audio subsystem (Based on PXA2xx code):
8 * Copyright (c) 2008 Ryan Mallon
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 */
14
15#include <linux/module.h>
16#include <linux/init.h>
17#include <linux/device.h>
18#include <linux/slab.h>
19#include <linux/dmaengine.h>
20#include <linux/dma-mapping.h>
21
22#include <sound/core.h>
23#include <sound/pcm.h>
24#include <sound/pcm_params.h>
25#include <sound/soc.h>
26
27#include <mach/dma.h>
28#include <mach/hardware.h>
29#include <mach/ep93xx-regs.h>
30
31#include "ep93xx-pcm.h"
32
33static const struct snd_pcm_hardware ep93xx_pcm_hardware = {
34 .info = (SNDRV_PCM_INFO_MMAP |
35 SNDRV_PCM_INFO_MMAP_VALID |
36 SNDRV_PCM_INFO_INTERLEAVED |
37 SNDRV_PCM_INFO_BLOCK_TRANSFER),
38
39 .rates = SNDRV_PCM_RATE_8000_192000,
40 .rate_min = SNDRV_PCM_RATE_8000,
41 .rate_max = SNDRV_PCM_RATE_192000,
42
43 .formats = (SNDRV_PCM_FMTBIT_S16_LE |
44 SNDRV_PCM_FMTBIT_S24_LE |
45 SNDRV_PCM_FMTBIT_S32_LE),
46
47 .buffer_bytes_max = 131072,
48 .period_bytes_min = 32,
49 .period_bytes_max = 32768,
50 .periods_min = 1,
51 .periods_max = 32,
52 .fifo_size = 32,
53};
54
55struct ep93xx_runtime_data
56{
57 int pointer_bytes;
58 int periods;
59 int period_bytes;
60 struct dma_chan *dma_chan;
61 struct ep93xx_dma_data dma_data;
62};
63
64static void ep93xx_pcm_dma_callback(void *data)
65{
66 struct snd_pcm_substream *substream = data;
67 struct ep93xx_runtime_data *rtd = substream->runtime->private_data;
68
69 rtd->pointer_bytes += rtd->period_bytes;
70 rtd->pointer_bytes %= rtd->period_bytes * rtd->periods;
71
72 snd_pcm_period_elapsed(substream);
73}
74
75static bool ep93xx_pcm_dma_filter(struct dma_chan *chan, void *filter_param)
76{
77 struct ep93xx_dma_data *data = filter_param;
78
79 if (data->direction == ep93xx_dma_chan_direction(chan)) {
80 chan->private = data;
81 return true;
82 }
83
84 return false;
85}
86
87static int ep93xx_pcm_open(struct snd_pcm_substream *substream)
88{
89 struct snd_soc_pcm_runtime *soc_rtd = substream->private_data;
90 struct snd_soc_dai *cpu_dai = soc_rtd->cpu_dai;
91 struct ep93xx_pcm_dma_params *dma_params;
92 struct ep93xx_runtime_data *rtd;
93 dma_cap_mask_t mask;
94 int ret;
95
96 ret = snd_pcm_hw_constraint_integer(substream->runtime,
97 SNDRV_PCM_HW_PARAM_PERIODS);
98 if (ret < 0)
99 return ret;
100
101 snd_soc_set_runtime_hwparams(substream, &ep93xx_pcm_hardware);
102
103 rtd = kmalloc(sizeof(*rtd), GFP_KERNEL);
104 if (!rtd)
105 return -ENOMEM;
106
107 dma_cap_zero(mask);
108 dma_cap_set(DMA_SLAVE, mask);
109 dma_cap_set(DMA_CYCLIC, mask);
110
111 dma_params = snd_soc_dai_get_dma_data(cpu_dai, substream);
112 rtd->dma_data.port = dma_params->dma_port;
113 rtd->dma_data.name = dma_params->name;
114
115 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
116 rtd->dma_data.direction = DMA_TO_DEVICE;
117 else
118 rtd->dma_data.direction = DMA_FROM_DEVICE;
119
120 rtd->dma_chan = dma_request_channel(mask, ep93xx_pcm_dma_filter,
121 &rtd->dma_data);
122 if (!rtd->dma_chan) {
123 kfree(rtd);
124 return -EINVAL;
125 }
126
127 substream->runtime->private_data = rtd;
128 return 0;
129}
130
131static int ep93xx_pcm_close(struct snd_pcm_substream *substream)
132{
133 struct ep93xx_runtime_data *rtd = substream->runtime->private_data;
134
135 dma_release_channel(rtd->dma_chan);
136 kfree(rtd);
137 return 0;
138}
139
140static int ep93xx_pcm_dma_submit(struct snd_pcm_substream *substream)
141{
142 struct snd_pcm_runtime *runtime = substream->runtime;
143 struct ep93xx_runtime_data *rtd = runtime->private_data;
144 struct dma_chan *chan = rtd->dma_chan;
145 struct dma_device *dma_dev = chan->device;
146 struct dma_async_tx_descriptor *desc;
147
148 rtd->pointer_bytes = 0;
149 desc = dma_dev->device_prep_dma_cyclic(chan, runtime->dma_addr,
150 rtd->period_bytes * rtd->periods,
151 rtd->period_bytes,
152 rtd->dma_data.direction);
153 if (!desc)
154 return -EINVAL;
155
156 desc->callback = ep93xx_pcm_dma_callback;
157 desc->callback_param = substream;
158
159 dmaengine_submit(desc);
160 return 0;
161}
162
163static void ep93xx_pcm_dma_flush(struct snd_pcm_substream *substream)
164{
165 struct snd_pcm_runtime *runtime = substream->runtime;
166 struct ep93xx_runtime_data *rtd = runtime->private_data;
167
168 dmaengine_terminate_all(rtd->dma_chan);
169}
170
171static int ep93xx_pcm_hw_params(struct snd_pcm_substream *substream,
172 struct snd_pcm_hw_params *params)
173{
174 struct snd_pcm_runtime *runtime = substream->runtime;
175 struct ep93xx_runtime_data *rtd = runtime->private_data;
176
177 snd_pcm_set_runtime_buffer(substream, &substream->dma_buffer);
178
179 rtd->periods = params_periods(params);
180 rtd->period_bytes = params_period_bytes(params);
181 return 0;
182}
183
184static int ep93xx_pcm_hw_free(struct snd_pcm_substream *substream)
185{
186 snd_pcm_set_runtime_buffer(substream, NULL);
187 return 0;
188}
189
190static int ep93xx_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
191{
192 int ret;
193
194 ret = 0;
195 switch (cmd) {
196 case SNDRV_PCM_TRIGGER_START:
197 case SNDRV_PCM_TRIGGER_RESUME:
198 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
199 ret = ep93xx_pcm_dma_submit(substream);
200 break;
201
202 case SNDRV_PCM_TRIGGER_STOP:
203 case SNDRV_PCM_TRIGGER_SUSPEND:
204 case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
205 ep93xx_pcm_dma_flush(substream);
206 break;
207
208 default:
209 ret = -EINVAL;
210 break;
211 }
212
213 return ret;
214}
215
216static snd_pcm_uframes_t ep93xx_pcm_pointer(struct snd_pcm_substream *substream)
217{
218 struct snd_pcm_runtime *runtime = substream->runtime;
219 struct ep93xx_runtime_data *rtd = substream->runtime->private_data;
220
221 /* FIXME: implement this with sub-period granularity */
222 return bytes_to_frames(runtime, rtd->pointer_bytes);
223}
224
225static int ep93xx_pcm_mmap(struct snd_pcm_substream *substream,
226 struct vm_area_struct *vma)
227{
228 struct snd_pcm_runtime *runtime = substream->runtime;
229
230 return dma_mmap_writecombine(substream->pcm->card->dev, vma,
231 runtime->dma_area,
232 runtime->dma_addr,
233 runtime->dma_bytes);
234}
235
236static struct snd_pcm_ops ep93xx_pcm_ops = {
237 .open = ep93xx_pcm_open,
238 .close = ep93xx_pcm_close,
239 .ioctl = snd_pcm_lib_ioctl,
240 .hw_params = ep93xx_pcm_hw_params,
241 .hw_free = ep93xx_pcm_hw_free,
242 .trigger = ep93xx_pcm_trigger,
243 .pointer = ep93xx_pcm_pointer,
244 .mmap = ep93xx_pcm_mmap,
245};
246
247static int ep93xx_pcm_preallocate_dma_buffer(struct snd_pcm *pcm, int stream)
248{
249 struct snd_pcm_substream *substream = pcm->streams[stream].substream;
250 struct snd_dma_buffer *buf = &substream->dma_buffer;
251 size_t size = ep93xx_pcm_hardware.buffer_bytes_max;
252
253 buf->dev.type = SNDRV_DMA_TYPE_DEV;
254 buf->dev.dev = pcm->card->dev;
255 buf->private_data = NULL;
256 buf->area = dma_alloc_writecombine(pcm->card->dev, size,
257 &buf->addr, GFP_KERNEL);
258 buf->bytes = size;
259
260 return (buf->area == NULL) ? -ENOMEM : 0;
261}
262
263static void ep93xx_pcm_free_dma_buffers(struct snd_pcm *pcm)
264{
265 struct snd_pcm_substream *substream;
266 struct snd_dma_buffer *buf;
267 int stream;
268
269 for (stream = 0; stream < 2; stream++) {
270 substream = pcm->streams[stream].substream;
271 if (!substream)
272 continue;
273
274 buf = &substream->dma_buffer;
275 if (!buf->area)
276 continue;
277
278 dma_free_writecombine(pcm->card->dev, buf->bytes, buf->area,
279 buf->addr);
280 buf->area = NULL;
281 }
282}
283
284static u64 ep93xx_pcm_dmamask = 0xffffffff;
285
286static int ep93xx_pcm_new(struct snd_soc_pcm_runtime *rtd)
287{
288 struct snd_card *card = rtd->card->snd_card;
289 struct snd_soc_dai *dai = rtd->cpu_dai;
290 struct snd_pcm *pcm = rtd->pcm;
291 int ret = 0;
292
293 if (!card->dev->dma_mask)
294 card->dev->dma_mask = &ep93xx_pcm_dmamask;
295 if (!card->dev->coherent_dma_mask)
296 card->dev->coherent_dma_mask = 0xffffffff;
297
298 if (dai->driver->playback.channels_min) {
299 ret = ep93xx_pcm_preallocate_dma_buffer(pcm,
300 SNDRV_PCM_STREAM_PLAYBACK);
301 if (ret)
302 return ret;
303 }
304
305 if (dai->driver->capture.channels_min) {
306 ret = ep93xx_pcm_preallocate_dma_buffer(pcm,
307 SNDRV_PCM_STREAM_CAPTURE);
308 if (ret)
309 return ret;
310 }
311
312 return 0;
313}
314
315static struct snd_soc_platform_driver ep93xx_soc_platform = {
316 .ops = &ep93xx_pcm_ops,
317 .pcm_new = &ep93xx_pcm_new,
318 .pcm_free = &ep93xx_pcm_free_dma_buffers,
319};
320
321static int __devinit ep93xx_soc_platform_probe(struct platform_device *pdev)
322{
323 return snd_soc_register_platform(&pdev->dev, &ep93xx_soc_platform);
324}
325
326static int __devexit ep93xx_soc_platform_remove(struct platform_device *pdev)
327{
328 snd_soc_unregister_platform(&pdev->dev);
329 return 0;
330}
331
332static struct platform_driver ep93xx_pcm_driver = {
333 .driver = {
334 .name = "ep93xx-pcm-audio",
335 .owner = THIS_MODULE,
336 },
337
338 .probe = ep93xx_soc_platform_probe,
339 .remove = __devexit_p(ep93xx_soc_platform_remove),
340};
341
342static int __init ep93xx_soc_platform_init(void)
343{
344 return platform_driver_register(&ep93xx_pcm_driver);
345}
346
347static void __exit ep93xx_soc_platform_exit(void)
348{
349 platform_driver_unregister(&ep93xx_pcm_driver);
350}
351
352module_init(ep93xx_soc_platform_init);
353module_exit(ep93xx_soc_platform_exit);
354
355MODULE_AUTHOR("Ryan Mallon");
356MODULE_DESCRIPTION("EP93xx ALSA PCM interface");
357MODULE_LICENSE("GPL");
diff --git a/sound/soc/ep93xx/ep93xx-pcm.h b/sound/soc/ep93xx/ep93xx-pcm.h
new file mode 100644
index 00000000000..111e1121ecb
--- /dev/null
+++ b/sound/soc/ep93xx/ep93xx-pcm.h
@@ -0,0 +1,20 @@
1/*
2 * sound/soc/ep93xx/ep93xx-pcm.h - EP93xx ALSA PCM interface
3 *
4 * Copyright (C) 2006 Lennert Buytenhek <buytenh@wantstofly.org>
5 * Copyright (C) 2006 Applied Data Systems
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef _EP93XX_SND_SOC_PCM_H
13#define _EP93XX_SND_SOC_PCM_H
14
15struct ep93xx_pcm_dma_params {
16 char *name;
17 int dma_port;
18};
19
20#endif /* _EP93XX_SND_SOC_PCM_H */
diff --git a/sound/soc/ep93xx/simone.c b/sound/soc/ep93xx/simone.c
new file mode 100644
index 00000000000..286817946c5
--- /dev/null
+++ b/sound/soc/ep93xx/simone.c
@@ -0,0 +1,91 @@
1/*
2 * simone.c -- ASoC audio for Simplemachines Sim.One board
3 *
4 * Copyright (c) 2010 Mika Westerberg
5 *
6 * Based on snappercl15 machine driver by Ryan Mallon.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#include <linux/init.h>
14#include <linux/module.h>
15#include <linux/platform_device.h>
16
17#include <sound/core.h>
18#include <sound/pcm.h>
19#include <sound/soc.h>
20
21#include <asm/mach-types.h>
22#include <mach/hardware.h>
23
24#include "ep93xx-pcm.h"
25
26static struct snd_soc_dai_link simone_dai = {
27 .name = "AC97",
28 .stream_name = "AC97 HiFi",
29 .cpu_dai_name = "ep93xx-ac97",
30 .codec_dai_name = "ac97-hifi",
31 .codec_name = "ac97-codec",
32 .platform_name = "ep93xx-pcm-audio",
33};
34
35static struct snd_soc_card snd_soc_simone = {
36 .name = "Sim.One",
37 .dai_link = &simone_dai,
38 .num_links = 1,
39};
40
41static struct platform_device *simone_snd_ac97_device;
42static struct platform_device *simone_snd_device;
43
44static int __init simone_init(void)
45{
46 int ret;
47
48 if (!machine_is_sim_one())
49 return -ENODEV;
50
51 simone_snd_ac97_device = platform_device_alloc("ac97-codec", -1);
52 if (!simone_snd_ac97_device)
53 return -ENOMEM;
54
55 ret = platform_device_add(simone_snd_ac97_device);
56 if (ret)
57 goto fail1;
58
59 simone_snd_device = platform_device_alloc("soc-audio", -1);
60 if (!simone_snd_device) {
61 ret = -ENOMEM;
62 goto fail2;
63 }
64
65 platform_set_drvdata(simone_snd_device, &snd_soc_simone);
66 ret = platform_device_add(simone_snd_device);
67 if (ret)
68 goto fail3;
69
70 return 0;
71
72fail3:
73 platform_device_put(simone_snd_device);
74fail2:
75 platform_device_del(simone_snd_ac97_device);
76fail1:
77 platform_device_put(simone_snd_ac97_device);
78 return ret;
79}
80module_init(simone_init);
81
82static void __exit simone_exit(void)
83{
84 platform_device_unregister(simone_snd_device);
85 platform_device_unregister(simone_snd_ac97_device);
86}
87module_exit(simone_exit);
88
89MODULE_DESCRIPTION("ALSA SoC Simplemachines Sim.One");
90MODULE_AUTHOR("Mika Westerberg <mika.westerberg@iki.fi>");
91MODULE_LICENSE("GPL");
diff --git a/sound/soc/ep93xx/snappercl15.c b/sound/soc/ep93xx/snappercl15.c
new file mode 100644
index 00000000000..c8aa8a5003c
--- /dev/null
+++ b/sound/soc/ep93xx/snappercl15.c
@@ -0,0 +1,146 @@
1/*
2 * snappercl15.c -- SoC audio for Bluewater Systems Snapper CL15 module
3 *
4 * Copyright (C) 2008 Bluewater Systems Ltd
5 * Author: Ryan Mallon
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 *
12 */
13
14#include <linux/platform_device.h>
15#include <sound/core.h>
16#include <sound/pcm.h>
17#include <sound/soc.h>
18
19#include <asm/mach-types.h>
20#include <mach/hardware.h>
21
22#include "../codecs/tlv320aic23.h"
23#include "ep93xx-pcm.h"
24
25#define CODEC_CLOCK 5644800
26
27static int snappercl15_hw_params(struct snd_pcm_substream *substream,
28 struct snd_pcm_hw_params *params)
29{
30 struct snd_soc_pcm_runtime *rtd = substream->private_data;
31 struct snd_soc_dai *codec_dai = rtd->codec_dai;
32 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
33 int err;
34
35 err = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S |
36 SND_SOC_DAIFMT_NB_IF |
37 SND_SOC_DAIFMT_CBS_CFS);
38
39 err = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S |
40 SND_SOC_DAIFMT_NB_IF |
41 SND_SOC_DAIFMT_CBS_CFS);
42 if (err)
43 return err;
44
45 err = snd_soc_dai_set_sysclk(codec_dai, 0, CODEC_CLOCK,
46 SND_SOC_CLOCK_IN);
47 if (err)
48 return err;
49
50 err = snd_soc_dai_set_sysclk(cpu_dai, 0, CODEC_CLOCK,
51 SND_SOC_CLOCK_OUT);
52 if (err)
53 return err;
54
55 return 0;
56}
57
58static struct snd_soc_ops snappercl15_ops = {
59 .hw_params = snappercl15_hw_params,
60};
61
62static const struct snd_soc_dapm_widget tlv320aic23_dapm_widgets[] = {
63 SND_SOC_DAPM_HP("Headphone Jack", NULL),
64 SND_SOC_DAPM_LINE("Line In", NULL),
65 SND_SOC_DAPM_MIC("Mic Jack", NULL),
66};
67
68static const struct snd_soc_dapm_route audio_map[] = {
69 {"Headphone Jack", NULL, "LHPOUT"},
70 {"Headphone Jack", NULL, "RHPOUT"},
71
72 {"LLINEIN", NULL, "Line In"},
73 {"RLINEIN", NULL, "Line In"},
74
75 {"MICIN", NULL, "Mic Jack"},
76};
77
78static int snappercl15_tlv320aic23_init(struct snd_soc_pcm_runtime *rtd)
79{
80 struct snd_soc_codec *codec = rtd->codec;
81 struct snd_soc_dapm_context *dapm = &codec->dapm;
82
83 snd_soc_dapm_new_controls(dapm, tlv320aic23_dapm_widgets,
84 ARRAY_SIZE(tlv320aic23_dapm_widgets));
85
86 snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
87 return 0;
88}
89
90static struct snd_soc_dai_link snappercl15_dai = {
91 .name = "tlv320aic23",
92 .stream_name = "AIC23",
93 .cpu_dai_name = "ep93xx-i2s",
94 .codec_dai_name = "tlv320aic23-hifi",
95 .codec_name = "tlv320aic23-codec.0-001a",
96 .platform_name = "ep93xx-pcm-audio",
97 .init = snappercl15_tlv320aic23_init,
98 .ops = &snappercl15_ops,
99};
100
101static struct snd_soc_card snd_soc_snappercl15 = {
102 .name = "Snapper CL15",
103 .dai_link = &snappercl15_dai,
104 .num_links = 1,
105};
106
107static struct platform_device *snappercl15_snd_device;
108
109static int __init snappercl15_init(void)
110{
111 int ret;
112
113 if (!machine_is_snapper_cl15())
114 return -ENODEV;
115
116 ret = ep93xx_i2s_acquire(EP93XX_SYSCON_DEVCFG_I2SONAC97,
117 EP93XX_SYSCON_I2SCLKDIV_ORIDE |
118 EP93XX_SYSCON_I2SCLKDIV_SPOL);
119 if (ret)
120 return ret;
121
122 snappercl15_snd_device = platform_device_alloc("soc-audio", -1);
123 if (!snappercl15_snd_device)
124 return -ENOMEM;
125
126 platform_set_drvdata(snappercl15_snd_device, &snd_soc_snappercl15);
127 ret = platform_device_add(snappercl15_snd_device);
128 if (ret)
129 platform_device_put(snappercl15_snd_device);
130
131 return ret;
132}
133
134static void __exit snappercl15_exit(void)
135{
136 platform_device_unregister(snappercl15_snd_device);
137 ep93xx_i2s_release();
138}
139
140module_init(snappercl15_init);
141module_exit(snappercl15_exit);
142
143MODULE_AUTHOR("Ryan Mallon");
144MODULE_DESCRIPTION("ALSA SoC Snapper CL15");
145MODULE_LICENSE("GPL");
146
diff --git a/sound/soc/imx/Kconfig b/sound/soc/imx/Kconfig
new file mode 100644
index 00000000000..bb699bb55a5
--- /dev/null
+++ b/sound/soc/imx/Kconfig
@@ -0,0 +1,59 @@
1menuconfig SND_IMX_SOC
2 tristate "SoC Audio for Freescale i.MX CPUs"
3 depends on ARCH_MXC
4 select SND_PCM
5 select FIQ
6 select SND_SOC_AC97_BUS
7 help
8 Say Y or M if you want to add support for codecs attached to
9 the i.MX SSI interface.
10
11
12if SND_IMX_SOC
13
14config SND_MXC_SOC_FIQ
15 tristate
16
17config SND_MXC_SOC_MX2
18 tristate
19
20config SND_MXC_SOC_WM1133_EV1
21 tristate "Audio on the the i.MX31ADS with WM1133-EV1 fitted"
22 depends on MACH_MX31ADS_WM1133_EV1 && EXPERIMENTAL
23 select SND_SOC_WM8350
24 select SND_MXC_SOC_FIQ
25 help
26 Enable support for audio on the i.MX31ADS with the WM1133-EV1
27 PMIC board with WM8835x fitted.
28
29config SND_SOC_MX27VIS_AIC32X4
30 tristate "SoC audio support for Visstrim M10 boards"
31 depends on MACH_IMX27_VISSTRIM_M10
32 select SND_SOC_TVL320AIC32X4
33 select SND_MXC_SOC_MX2
34 help
35 Say Y if you want to add support for SoC audio on Visstrim SM10
36 board with TLV320AIC32X4 codec.
37
38config SND_SOC_PHYCORE_AC97
39 tristate "SoC Audio support for Phytec phyCORE (and phyCARD) boards"
40 depends on MACH_PCM043 || MACH_PCA100
41 select SND_SOC_WM9712
42 select SND_MXC_SOC_FIQ
43 help
44 Say Y if you want to add support for SoC audio on Phytec phyCORE
45 and phyCARD boards in AC97 mode
46
47config SND_SOC_EUKREA_TLV320
48 tristate "Eukrea TLV320"
49 depends on MACH_EUKREA_MBIMX27_BASEBOARD \
50 || MACH_EUKREA_MBIMXSD25_BASEBOARD \
51 || MACH_EUKREA_MBIMXSD35_BASEBOARD \
52 || MACH_EUKREA_MBIMXSD51_BASEBOARD
53 select SND_SOC_TLV320AIC23
54 select SND_MXC_SOC_FIQ
55 help
56 Enable I2S based access to the TLV320AIC23B codec attached
57 to the SSI interface
58
59endif # SND_IMX_SOC
diff --git a/sound/soc/imx/Makefile b/sound/soc/imx/Makefile
new file mode 100644
index 00000000000..d6d609ba7e2
--- /dev/null
+++ b/sound/soc/imx/Makefile
@@ -0,0 +1,19 @@
1# i.MX Platform Support
2snd-soc-imx-objs := imx-ssi.o
3snd-soc-imx-fiq-objs := imx-pcm-fiq.o
4snd-soc-imx-mx2-objs := imx-pcm-dma-mx2.o
5
6obj-$(CONFIG_SND_IMX_SOC) += snd-soc-imx.o
7obj-$(CONFIG_SND_MXC_SOC_FIQ) += snd-soc-imx-fiq.o
8obj-$(CONFIG_SND_MXC_SOC_MX2) += snd-soc-imx-mx2.o
9
10# i.MX Machine Support
11snd-soc-eukrea-tlv320-objs := eukrea-tlv320.o
12snd-soc-phycore-ac97-objs := phycore-ac97.o
13snd-soc-mx27vis-aic32x4-objs := mx27vis-aic32x4.o
14snd-soc-wm1133-ev1-objs := wm1133-ev1.o
15
16obj-$(CONFIG_SND_SOC_EUKREA_TLV320) += snd-soc-eukrea-tlv320.o
17obj-$(CONFIG_SND_SOC_PHYCORE_AC97) += snd-soc-phycore-ac97.o
18obj-$(CONFIG_SND_SOC_MX27VIS_AIC32X4) += snd-soc-mx27vis-aic32x4.o
19obj-$(CONFIG_SND_MXC_SOC_WM1133_EV1) += snd-soc-wm1133-ev1.o
diff --git a/sound/soc/imx/eukrea-tlv320.c b/sound/soc/imx/eukrea-tlv320.c
new file mode 100644
index 00000000000..75fb4b83548
--- /dev/null
+++ b/sound/soc/imx/eukrea-tlv320.c
@@ -0,0 +1,131 @@
1/*
2 * eukrea-tlv320.c -- SoC audio for eukrea_cpuimxXX in I2S mode
3 *
4 * Copyright 2010 Eric Bénard, Eukréa Electromatique <eric@eukrea.com>
5 *
6 * based on sound/soc/s3c24xx/s3c24xx_simtec_tlv320aic23.c
7 * which is Copyright 2009 Simtec Electronics
8 * and on sound/soc/imx/phycore-ac97.c which is
9 * Copyright 2009 Sascha Hauer, Pengutronix <s.hauer@pengutronix.de>
10 *
11 * This program is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License as published by the
13 * Free Software Foundation; either version 2 of the License, or (at your
14 * option) any later version.
15 *
16 */
17
18#include <linux/module.h>
19#include <linux/moduleparam.h>
20#include <linux/device.h>
21#include <linux/i2c.h>
22#include <sound/core.h>
23#include <sound/pcm.h>
24#include <sound/soc.h>
25#include <asm/mach-types.h>
26
27#include "../codecs/tlv320aic23.h"
28#include "imx-ssi.h"
29
30#define CODEC_CLOCK 12000000
31
32static int eukrea_tlv320_hw_params(struct snd_pcm_substream *substream,
33 struct snd_pcm_hw_params *params)
34{
35 struct snd_soc_pcm_runtime *rtd = substream->private_data;
36 struct snd_soc_dai *codec_dai = rtd->codec_dai;
37 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
38 int ret;
39
40 ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S |
41 SND_SOC_DAIFMT_NB_NF |
42 SND_SOC_DAIFMT_CBM_CFM);
43 if (ret) {
44 pr_err("%s: failed set cpu dai format\n", __func__);
45 return ret;
46 }
47
48 ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S |
49 SND_SOC_DAIFMT_NB_NF |
50 SND_SOC_DAIFMT_CBM_CFM);
51 if (ret) {
52 pr_err("%s: failed set codec dai format\n", __func__);
53 return ret;
54 }
55
56 ret = snd_soc_dai_set_sysclk(codec_dai, 0,
57 CODEC_CLOCK, SND_SOC_CLOCK_OUT);
58 if (ret) {
59 pr_err("%s: failed setting codec sysclk\n", __func__);
60 return ret;
61 }
62 snd_soc_dai_set_tdm_slot(cpu_dai, 0xffffffc, 0xffffffc, 2, 0);
63
64 ret = snd_soc_dai_set_sysclk(cpu_dai, IMX_SSP_SYS_CLK, 0,
65 SND_SOC_CLOCK_IN);
66 if (ret) {
67 pr_err("can't set CPU system clock IMX_SSP_SYS_CLK\n");
68 return ret;
69 }
70
71 return 0;
72}
73
74static struct snd_soc_ops eukrea_tlv320_snd_ops = {
75 .hw_params = eukrea_tlv320_hw_params,
76};
77
78static struct snd_soc_dai_link eukrea_tlv320_dai = {
79 .name = "tlv320aic23",
80 .stream_name = "TLV320AIC23",
81 .codec_dai_name = "tlv320aic23-hifi",
82 .platform_name = "imx-fiq-pcm-audio.0",
83 .codec_name = "tlv320aic23-codec.0-001a",
84 .cpu_dai_name = "imx-ssi.0",
85 .ops = &eukrea_tlv320_snd_ops,
86};
87
88static struct snd_soc_card eukrea_tlv320 = {
89 .name = "cpuimx-audio",
90 .dai_link = &eukrea_tlv320_dai,
91 .num_links = 1,
92};
93
94static struct platform_device *eukrea_tlv320_snd_device;
95
96static int __init eukrea_tlv320_init(void)
97{
98 int ret;
99
100 if (!machine_is_eukrea_cpuimx27() && !machine_is_eukrea_cpuimx25sd()
101 && !machine_is_eukrea_cpuimx35sd()
102 && !machine_is_eukrea_cpuimx51sd())
103 /* return happy. We might run on a totally different machine */
104 return 0;
105
106 eukrea_tlv320_snd_device = platform_device_alloc("soc-audio", -1);
107 if (!eukrea_tlv320_snd_device)
108 return -ENOMEM;
109
110 platform_set_drvdata(eukrea_tlv320_snd_device, &eukrea_tlv320);
111 ret = platform_device_add(eukrea_tlv320_snd_device);
112
113 if (ret) {
114 printk(KERN_ERR "ASoC: Platform device allocation failed\n");
115 platform_device_put(eukrea_tlv320_snd_device);
116 }
117
118 return ret;
119}
120
121static void __exit eukrea_tlv320_exit(void)
122{
123 platform_device_unregister(eukrea_tlv320_snd_device);
124}
125
126module_init(eukrea_tlv320_init);
127module_exit(eukrea_tlv320_exit);
128
129MODULE_AUTHOR("Eric Bénard <eric@eukrea.com>");
130MODULE_DESCRIPTION("CPUIMX ALSA SoC driver");
131MODULE_LICENSE("GPL");
diff --git a/sound/soc/imx/imx-pcm-dma-mx2.c b/sound/soc/imx/imx-pcm-dma-mx2.c
new file mode 100644
index 00000000000..43fdc24f7e8
--- /dev/null
+++ b/sound/soc/imx/imx-pcm-dma-mx2.c
@@ -0,0 +1,341 @@
1/*
2 * imx-pcm-dma-mx2.c -- ALSA Soc Audio Layer
3 *
4 * Copyright 2009 Sascha Hauer <s.hauer@pengutronix.de>
5 *
6 * This code is based on code copyrighted by Freescale,
7 * Liam Girdwood, Javier Martin and probably others.
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version.
13 */
14#include <linux/clk.h>
15#include <linux/delay.h>
16#include <linux/device.h>
17#include <linux/dma-mapping.h>
18#include <linux/init.h>
19#include <linux/interrupt.h>
20#include <linux/module.h>
21#include <linux/platform_device.h>
22#include <linux/slab.h>
23#include <linux/dmaengine.h>
24
25#include <sound/core.h>
26#include <sound/initval.h>
27#include <sound/pcm.h>
28#include <sound/pcm_params.h>
29#include <sound/soc.h>
30
31#include <mach/dma.h>
32
33#include "imx-ssi.h"
34
35struct imx_pcm_runtime_data {
36 int period_bytes;
37 int periods;
38 int dma;
39 unsigned long offset;
40 unsigned long size;
41 void *buf;
42 int period_time;
43 struct dma_async_tx_descriptor *desc;
44 struct dma_chan *dma_chan;
45 struct imx_dma_data dma_data;
46};
47
48static void audio_dma_irq(void *data)
49{
50 struct snd_pcm_substream *substream = (struct snd_pcm_substream *)data;
51 struct snd_pcm_runtime *runtime = substream->runtime;
52 struct imx_pcm_runtime_data *iprtd = runtime->private_data;
53
54 iprtd->offset += iprtd->period_bytes;
55 iprtd->offset %= iprtd->period_bytes * iprtd->periods;
56
57 snd_pcm_period_elapsed(substream);
58}
59
60static bool filter(struct dma_chan *chan, void *param)
61{
62 struct imx_pcm_runtime_data *iprtd = param;
63
64 if (!imx_dma_is_general_purpose(chan))
65 return false;
66
67 chan->private = &iprtd->dma_data;
68
69 return true;
70}
71
72static int imx_ssi_dma_alloc(struct snd_pcm_substream *substream,
73 struct snd_pcm_hw_params *params)
74{
75 struct snd_soc_pcm_runtime *rtd = substream->private_data;
76 struct imx_pcm_dma_params *dma_params;
77 struct snd_pcm_runtime *runtime = substream->runtime;
78 struct imx_pcm_runtime_data *iprtd = runtime->private_data;
79 struct dma_slave_config slave_config;
80 dma_cap_mask_t mask;
81 enum dma_slave_buswidth buswidth;
82 int ret;
83
84 dma_params = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream);
85
86 iprtd->dma_data.peripheral_type = IMX_DMATYPE_SSI;
87 iprtd->dma_data.priority = DMA_PRIO_HIGH;
88 iprtd->dma_data.dma_request = dma_params->dma;
89
90 /* Try to grab a DMA channel */
91 dma_cap_zero(mask);
92 dma_cap_set(DMA_SLAVE, mask);
93 iprtd->dma_chan = dma_request_channel(mask, filter, iprtd);
94 if (!iprtd->dma_chan)
95 return -EINVAL;
96
97 switch (params_format(params)) {
98 case SNDRV_PCM_FORMAT_S16_LE:
99 buswidth = DMA_SLAVE_BUSWIDTH_2_BYTES;
100 break;
101 case SNDRV_PCM_FORMAT_S20_3LE:
102 case SNDRV_PCM_FORMAT_S24_LE:
103 buswidth = DMA_SLAVE_BUSWIDTH_4_BYTES;
104 break;
105 default:
106 return 0;
107 }
108
109 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
110 slave_config.direction = DMA_TO_DEVICE;
111 slave_config.dst_addr = dma_params->dma_addr;
112 slave_config.dst_addr_width = buswidth;
113 slave_config.dst_maxburst = dma_params->burstsize;
114 } else {
115 slave_config.direction = DMA_FROM_DEVICE;
116 slave_config.src_addr = dma_params->dma_addr;
117 slave_config.src_addr_width = buswidth;
118 slave_config.src_maxburst = dma_params->burstsize;
119 }
120
121 ret = dmaengine_slave_config(iprtd->dma_chan, &slave_config);
122 if (ret)
123 return ret;
124
125 return 0;
126}
127
128static int snd_imx_pcm_hw_params(struct snd_pcm_substream *substream,
129 struct snd_pcm_hw_params *params)
130{
131 struct snd_soc_pcm_runtime *rtd = substream->private_data;
132 struct snd_pcm_runtime *runtime = substream->runtime;
133 struct imx_pcm_runtime_data *iprtd = runtime->private_data;
134 unsigned long dma_addr;
135 struct dma_chan *chan;
136 struct imx_pcm_dma_params *dma_params;
137 int ret;
138
139 dma_params = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream);
140 ret = imx_ssi_dma_alloc(substream, params);
141 if (ret)
142 return ret;
143 chan = iprtd->dma_chan;
144
145 iprtd->size = params_buffer_bytes(params);
146 iprtd->periods = params_periods(params);
147 iprtd->period_bytes = params_period_bytes(params);
148 iprtd->offset = 0;
149 iprtd->period_time = HZ / (params_rate(params) /
150 params_period_size(params));
151
152 snd_pcm_set_runtime_buffer(substream, &substream->dma_buffer);
153
154 dma_addr = runtime->dma_addr;
155
156 iprtd->buf = (unsigned int *)substream->dma_buffer.area;
157
158 iprtd->desc = chan->device->device_prep_dma_cyclic(chan, dma_addr,
159 iprtd->period_bytes * iprtd->periods,
160 iprtd->period_bytes,
161 substream->stream == SNDRV_PCM_STREAM_PLAYBACK ?
162 DMA_TO_DEVICE : DMA_FROM_DEVICE);
163 if (!iprtd->desc) {
164 dev_err(&chan->dev->device, "cannot prepare slave dma\n");
165 return -EINVAL;
166 }
167
168 iprtd->desc->callback = audio_dma_irq;
169 iprtd->desc->callback_param = substream;
170
171 return 0;
172}
173
174static int snd_imx_pcm_hw_free(struct snd_pcm_substream *substream)
175{
176 struct snd_pcm_runtime *runtime = substream->runtime;
177 struct imx_pcm_runtime_data *iprtd = runtime->private_data;
178
179 if (iprtd->dma_chan) {
180 dma_release_channel(iprtd->dma_chan);
181 iprtd->dma_chan = NULL;
182 }
183
184 return 0;
185}
186
187static int snd_imx_pcm_prepare(struct snd_pcm_substream *substream)
188{
189 struct snd_soc_pcm_runtime *rtd = substream->private_data;
190 struct imx_pcm_dma_params *dma_params;
191
192 dma_params = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream);
193
194 return 0;
195}
196
197static int snd_imx_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
198{
199 struct snd_pcm_runtime *runtime = substream->runtime;
200 struct imx_pcm_runtime_data *iprtd = runtime->private_data;
201
202 switch (cmd) {
203 case SNDRV_PCM_TRIGGER_START:
204 case SNDRV_PCM_TRIGGER_RESUME:
205 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
206 dmaengine_submit(iprtd->desc);
207
208 break;
209
210 case SNDRV_PCM_TRIGGER_STOP:
211 case SNDRV_PCM_TRIGGER_SUSPEND:
212 case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
213 dmaengine_terminate_all(iprtd->dma_chan);
214
215 break;
216 default:
217 return -EINVAL;
218 }
219
220 return 0;
221}
222
223static snd_pcm_uframes_t snd_imx_pcm_pointer(struct snd_pcm_substream *substream)
224{
225 struct snd_pcm_runtime *runtime = substream->runtime;
226 struct imx_pcm_runtime_data *iprtd = runtime->private_data;
227
228 pr_debug("%s: %ld %ld\n", __func__, iprtd->offset,
229 bytes_to_frames(substream->runtime, iprtd->offset));
230
231 return bytes_to_frames(substream->runtime, iprtd->offset);
232}
233
234static struct snd_pcm_hardware snd_imx_hardware = {
235 .info = SNDRV_PCM_INFO_INTERLEAVED |
236 SNDRV_PCM_INFO_BLOCK_TRANSFER |
237 SNDRV_PCM_INFO_MMAP |
238 SNDRV_PCM_INFO_MMAP_VALID |
239 SNDRV_PCM_INFO_PAUSE |
240 SNDRV_PCM_INFO_RESUME,
241 .formats = SNDRV_PCM_FMTBIT_S16_LE,
242 .rate_min = 8000,
243 .channels_min = 2,
244 .channels_max = 2,
245 .buffer_bytes_max = IMX_SSI_DMABUF_SIZE,
246 .period_bytes_min = 128,
247 .period_bytes_max = 65535, /* Limited by SDMA engine */
248 .periods_min = 2,
249 .periods_max = 255,
250 .fifo_size = 0,
251};
252
253static int snd_imx_open(struct snd_pcm_substream *substream)
254{
255 struct snd_pcm_runtime *runtime = substream->runtime;
256 struct imx_pcm_runtime_data *iprtd;
257 int ret;
258
259 iprtd = kzalloc(sizeof(*iprtd), GFP_KERNEL);
260 if (iprtd == NULL)
261 return -ENOMEM;
262 runtime->private_data = iprtd;
263
264 ret = snd_pcm_hw_constraint_integer(substream->runtime,
265 SNDRV_PCM_HW_PARAM_PERIODS);
266 if (ret < 0) {
267 kfree(iprtd);
268 return ret;
269 }
270
271 snd_soc_set_runtime_hwparams(substream, &snd_imx_hardware);
272
273 return 0;
274}
275
276static int snd_imx_close(struct snd_pcm_substream *substream)
277{
278 struct snd_pcm_runtime *runtime = substream->runtime;
279 struct imx_pcm_runtime_data *iprtd = runtime->private_data;
280
281 kfree(iprtd);
282
283 return 0;
284}
285
286static struct snd_pcm_ops imx_pcm_ops = {
287 .open = snd_imx_open,
288 .close = snd_imx_close,
289 .ioctl = snd_pcm_lib_ioctl,
290 .hw_params = snd_imx_pcm_hw_params,
291 .hw_free = snd_imx_pcm_hw_free,
292 .prepare = snd_imx_pcm_prepare,
293 .trigger = snd_imx_pcm_trigger,
294 .pointer = snd_imx_pcm_pointer,
295 .mmap = snd_imx_pcm_mmap,
296};
297
298static struct snd_soc_platform_driver imx_soc_platform_mx2 = {
299 .ops = &imx_pcm_ops,
300 .pcm_new = imx_pcm_new,
301 .pcm_free = imx_pcm_free,
302};
303
304static int __devinit imx_soc_platform_probe(struct platform_device *pdev)
305{
306 struct imx_ssi *ssi = platform_get_drvdata(pdev);
307
308 ssi->dma_params_tx.burstsize = 6;
309 ssi->dma_params_rx.burstsize = 4;
310
311 return snd_soc_register_platform(&pdev->dev, &imx_soc_platform_mx2);
312}
313
314static int __devexit imx_soc_platform_remove(struct platform_device *pdev)
315{
316 snd_soc_unregister_platform(&pdev->dev);
317 return 0;
318}
319
320static struct platform_driver imx_pcm_driver = {
321 .driver = {
322 .name = "imx-pcm-audio",
323 .owner = THIS_MODULE,
324 },
325 .probe = imx_soc_platform_probe,
326 .remove = __devexit_p(imx_soc_platform_remove),
327};
328
329static int __init snd_imx_pcm_init(void)
330{
331 return platform_driver_register(&imx_pcm_driver);
332}
333module_init(snd_imx_pcm_init);
334
335static void __exit snd_imx_pcm_exit(void)
336{
337 platform_driver_unregister(&imx_pcm_driver);
338}
339module_exit(snd_imx_pcm_exit);
340MODULE_LICENSE("GPL");
341MODULE_ALIAS("platform:imx-pcm-audio");
diff --git a/sound/soc/imx/imx-pcm-fiq.c b/sound/soc/imx/imx-pcm-fiq.c
new file mode 100644
index 00000000000..7945625e0e0
--- /dev/null
+++ b/sound/soc/imx/imx-pcm-fiq.c
@@ -0,0 +1,346 @@
1/*
2 * imx-pcm-fiq.c -- ALSA Soc Audio Layer
3 *
4 * Copyright 2009 Sascha Hauer <s.hauer@pengutronix.de>
5 *
6 * This code is based on code copyrighted by Freescale,
7 * Liam Girdwood, Javier Martin and probably others.
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version.
13 */
14#include <linux/clk.h>
15#include <linux/delay.h>
16#include <linux/device.h>
17#include <linux/dma-mapping.h>
18#include <linux/init.h>
19#include <linux/interrupt.h>
20#include <linux/module.h>
21#include <linux/platform_device.h>
22#include <linux/slab.h>
23
24#include <sound/core.h>
25#include <sound/initval.h>
26#include <sound/pcm.h>
27#include <sound/pcm_params.h>
28#include <sound/soc.h>
29
30#include <asm/fiq.h>
31
32#include <mach/ssi.h>
33
34#include "imx-ssi.h"
35
36struct imx_pcm_runtime_data {
37 int period;
38 int periods;
39 unsigned long offset;
40 unsigned long last_offset;
41 unsigned long size;
42 struct hrtimer hrt;
43 int poll_time_ns;
44 struct snd_pcm_substream *substream;
45 atomic_t running;
46};
47
48static enum hrtimer_restart snd_hrtimer_callback(struct hrtimer *hrt)
49{
50 struct imx_pcm_runtime_data *iprtd =
51 container_of(hrt, struct imx_pcm_runtime_data, hrt);
52 struct snd_pcm_substream *substream = iprtd->substream;
53 struct snd_pcm_runtime *runtime = substream->runtime;
54 struct pt_regs regs;
55 unsigned long delta;
56
57 if (!atomic_read(&iprtd->running))
58 return HRTIMER_NORESTART;
59
60 get_fiq_regs(&regs);
61
62 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
63 iprtd->offset = regs.ARM_r8 & 0xffff;
64 else
65 iprtd->offset = regs.ARM_r9 & 0xffff;
66
67 /* How much data have we transferred since the last period report? */
68 if (iprtd->offset >= iprtd->last_offset)
69 delta = iprtd->offset - iprtd->last_offset;
70 else
71 delta = runtime->buffer_size + iprtd->offset
72 - iprtd->last_offset;
73
74 /* If we've transferred at least a period then report it and
75 * reset our poll time */
76 if (delta >= iprtd->period) {
77 snd_pcm_period_elapsed(substream);
78 iprtd->last_offset = iprtd->offset;
79 }
80
81 hrtimer_forward_now(hrt, ns_to_ktime(iprtd->poll_time_ns));
82
83 return HRTIMER_RESTART;
84}
85
86static struct fiq_handler fh = {
87 .name = DRV_NAME,
88};
89
90static int snd_imx_pcm_hw_params(struct snd_pcm_substream *substream,
91 struct snd_pcm_hw_params *params)
92{
93 struct snd_pcm_runtime *runtime = substream->runtime;
94 struct imx_pcm_runtime_data *iprtd = runtime->private_data;
95
96 iprtd->size = params_buffer_bytes(params);
97 iprtd->periods = params_periods(params);
98 iprtd->period = params_period_bytes(params) ;
99 iprtd->offset = 0;
100 iprtd->last_offset = 0;
101 iprtd->poll_time_ns = 1000000000 / params_rate(params) *
102 params_period_size(params);
103 snd_pcm_set_runtime_buffer(substream, &substream->dma_buffer);
104
105 return 0;
106}
107
108static int snd_imx_pcm_prepare(struct snd_pcm_substream *substream)
109{
110 struct snd_pcm_runtime *runtime = substream->runtime;
111 struct imx_pcm_runtime_data *iprtd = runtime->private_data;
112 struct pt_regs regs;
113
114 get_fiq_regs(&regs);
115 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
116 regs.ARM_r8 = (iprtd->period * iprtd->periods - 1) << 16;
117 else
118 regs.ARM_r9 = (iprtd->period * iprtd->periods - 1) << 16;
119
120 set_fiq_regs(&regs);
121
122 return 0;
123}
124
125static int fiq_enable;
126static int imx_pcm_fiq;
127
128static int snd_imx_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
129{
130 struct snd_pcm_runtime *runtime = substream->runtime;
131 struct imx_pcm_runtime_data *iprtd = runtime->private_data;
132
133 switch (cmd) {
134 case SNDRV_PCM_TRIGGER_START:
135 case SNDRV_PCM_TRIGGER_RESUME:
136 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
137 atomic_set(&iprtd->running, 1);
138 hrtimer_start(&iprtd->hrt, ns_to_ktime(iprtd->poll_time_ns),
139 HRTIMER_MODE_REL);
140 if (++fiq_enable == 1)
141 enable_fiq(imx_pcm_fiq);
142
143 break;
144
145 case SNDRV_PCM_TRIGGER_STOP:
146 case SNDRV_PCM_TRIGGER_SUSPEND:
147 case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
148 atomic_set(&iprtd->running, 0);
149
150 if (--fiq_enable == 0)
151 disable_fiq(imx_pcm_fiq);
152
153 break;
154 default:
155 return -EINVAL;
156 }
157
158 return 0;
159}
160
161static snd_pcm_uframes_t snd_imx_pcm_pointer(struct snd_pcm_substream *substream)
162{
163 struct snd_pcm_runtime *runtime = substream->runtime;
164 struct imx_pcm_runtime_data *iprtd = runtime->private_data;
165
166 return bytes_to_frames(substream->runtime, iprtd->offset);
167}
168
169static struct snd_pcm_hardware snd_imx_hardware = {
170 .info = SNDRV_PCM_INFO_INTERLEAVED |
171 SNDRV_PCM_INFO_BLOCK_TRANSFER |
172 SNDRV_PCM_INFO_MMAP |
173 SNDRV_PCM_INFO_MMAP_VALID |
174 SNDRV_PCM_INFO_PAUSE |
175 SNDRV_PCM_INFO_RESUME,
176 .formats = SNDRV_PCM_FMTBIT_S16_LE,
177 .rate_min = 8000,
178 .channels_min = 2,
179 .channels_max = 2,
180 .buffer_bytes_max = IMX_SSI_DMABUF_SIZE,
181 .period_bytes_min = 128,
182 .period_bytes_max = 16 * 1024,
183 .periods_min = 4,
184 .periods_max = 255,
185 .fifo_size = 0,
186};
187
188static int snd_imx_open(struct snd_pcm_substream *substream)
189{
190 struct snd_pcm_runtime *runtime = substream->runtime;
191 struct imx_pcm_runtime_data *iprtd;
192 int ret;
193
194 iprtd = kzalloc(sizeof(*iprtd), GFP_KERNEL);
195 if (iprtd == NULL)
196 return -ENOMEM;
197 runtime->private_data = iprtd;
198
199 iprtd->substream = substream;
200
201 atomic_set(&iprtd->running, 0);
202 hrtimer_init(&iprtd->hrt, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
203 iprtd->hrt.function = snd_hrtimer_callback;
204
205 ret = snd_pcm_hw_constraint_integer(substream->runtime,
206 SNDRV_PCM_HW_PARAM_PERIODS);
207 if (ret < 0) {
208 kfree(iprtd);
209 return ret;
210 }
211
212 snd_soc_set_runtime_hwparams(substream, &snd_imx_hardware);
213 return 0;
214}
215
216static int snd_imx_close(struct snd_pcm_substream *substream)
217{
218 struct snd_pcm_runtime *runtime = substream->runtime;
219 struct imx_pcm_runtime_data *iprtd = runtime->private_data;
220
221 hrtimer_cancel(&iprtd->hrt);
222
223 kfree(iprtd);
224
225 return 0;
226}
227
228static struct snd_pcm_ops imx_pcm_ops = {
229 .open = snd_imx_open,
230 .close = snd_imx_close,
231 .ioctl = snd_pcm_lib_ioctl,
232 .hw_params = snd_imx_pcm_hw_params,
233 .prepare = snd_imx_pcm_prepare,
234 .trigger = snd_imx_pcm_trigger,
235 .pointer = snd_imx_pcm_pointer,
236 .mmap = snd_imx_pcm_mmap,
237};
238
239static int ssi_irq = 0;
240
241static int imx_pcm_fiq_new(struct snd_soc_pcm_runtime *rtd)
242{
243 struct snd_soc_dai *dai = rtd->cpu_dai;
244 struct snd_pcm *pcm = rtd->pcm;
245 int ret;
246
247 ret = imx_pcm_new(rtd);
248 if (ret)
249 return ret;
250
251 if (dai->driver->playback.channels_min) {
252 struct snd_pcm_substream *substream =
253 pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream;
254 struct snd_dma_buffer *buf = &substream->dma_buffer;
255
256 imx_ssi_fiq_tx_buffer = (unsigned long)buf->area;
257 }
258
259 if (dai->driver->capture.channels_min) {
260 struct snd_pcm_substream *substream =
261 pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream;
262 struct snd_dma_buffer *buf = &substream->dma_buffer;
263
264 imx_ssi_fiq_rx_buffer = (unsigned long)buf->area;
265 }
266
267 set_fiq_handler(&imx_ssi_fiq_start,
268 &imx_ssi_fiq_end - &imx_ssi_fiq_start);
269
270 return 0;
271}
272
273static void imx_pcm_fiq_free(struct snd_pcm *pcm)
274{
275 mxc_set_irq_fiq(ssi_irq, 0);
276 release_fiq(&fh);
277 imx_pcm_free(pcm);
278}
279
280static struct snd_soc_platform_driver imx_soc_platform_fiq = {
281 .ops = &imx_pcm_ops,
282 .pcm_new = imx_pcm_fiq_new,
283 .pcm_free = imx_pcm_fiq_free,
284};
285
286static int __devinit imx_soc_platform_probe(struct platform_device *pdev)
287{
288 struct imx_ssi *ssi = platform_get_drvdata(pdev);
289 int ret;
290
291 ret = claim_fiq(&fh);
292 if (ret) {
293 dev_err(&pdev->dev, "failed to claim fiq: %d", ret);
294 return ret;
295 }
296
297 mxc_set_irq_fiq(ssi->irq, 1);
298 ssi_irq = ssi->irq;
299
300 imx_pcm_fiq = ssi->irq;
301
302 imx_ssi_fiq_base = (unsigned long)ssi->base;
303
304 ssi->dma_params_tx.burstsize = 4;
305 ssi->dma_params_rx.burstsize = 6;
306
307 ret = snd_soc_register_platform(&pdev->dev, &imx_soc_platform_fiq);
308 if (ret)
309 goto failed_register;
310
311 return 0;
312
313failed_register:
314 mxc_set_irq_fiq(ssi_irq, 0);
315 release_fiq(&fh);
316
317 return ret;
318}
319
320static int __devexit imx_soc_platform_remove(struct platform_device *pdev)
321{
322 snd_soc_unregister_platform(&pdev->dev);
323 return 0;
324}
325
326static struct platform_driver imx_pcm_driver = {
327 .driver = {
328 .name = "imx-fiq-pcm-audio",
329 .owner = THIS_MODULE,
330 },
331
332 .probe = imx_soc_platform_probe,
333 .remove = __devexit_p(imx_soc_platform_remove),
334};
335
336static int __init snd_imx_pcm_init(void)
337{
338 return platform_driver_register(&imx_pcm_driver);
339}
340module_init(snd_imx_pcm_init);
341
342static void __exit snd_imx_pcm_exit(void)
343{
344 platform_driver_unregister(&imx_pcm_driver);
345}
346module_exit(snd_imx_pcm_exit);
diff --git a/sound/soc/imx/imx-ssi.c b/sound/soc/imx/imx-ssi.c
new file mode 100644
index 00000000000..10a8e278375
--- /dev/null
+++ b/sound/soc/imx/imx-ssi.c
@@ -0,0 +1,778 @@
1/*
2 * imx-ssi.c -- ALSA Soc Audio Layer
3 *
4 * Copyright 2009 Sascha Hauer <s.hauer@pengutronix.de>
5 *
6 * This code is based on code copyrighted by Freescale,
7 * Liam Girdwood, Javier Martin and probably others.
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version.
13 *
14 *
15 * The i.MX SSI core has some nasty limitations in AC97 mode. While most
16 * sane processor vendors have a FIFO per AC97 slot, the i.MX has only
17 * one FIFO which combines all valid receive slots. We cannot even select
18 * which slots we want to receive. The WM9712 with which this driver
19 * was developed with always sends GPIO status data in slot 12 which
20 * we receive in our (PCM-) data stream. The only chance we have is to
21 * manually skip this data in the FIQ handler. With sampling rates different
22 * from 48000Hz not every frame has valid receive data, so the ratio
23 * between pcm data and GPIO status data changes. Our FIQ handler is not
24 * able to handle this, hence this driver only works with 48000Hz sampling
25 * rate.
26 * Reading and writing AC97 registers is another challenge. The core
27 * provides us status bits when the read register is updated with *another*
28 * value. When we read the same register two times (and the register still
29 * contains the same value) these status bits are not set. We work
30 * around this by not polling these bits but only wait a fixed delay.
31 *
32 */
33
34#include <linux/clk.h>
35#include <linux/delay.h>
36#include <linux/device.h>
37#include <linux/dma-mapping.h>
38#include <linux/init.h>
39#include <linux/interrupt.h>
40#include <linux/module.h>
41#include <linux/platform_device.h>
42#include <linux/slab.h>
43
44#include <sound/core.h>
45#include <sound/initval.h>
46#include <sound/pcm.h>
47#include <sound/pcm_params.h>
48#include <sound/soc.h>
49
50#include <mach/ssi.h>
51#include <mach/hardware.h>
52
53#include "imx-ssi.h"
54
55#define SSI_SACNT_DEFAULT (SSI_SACNT_AC97EN | SSI_SACNT_FV)
56
57/*
58 * SSI Network Mode or TDM slots configuration.
59 * Should only be called when port is inactive (i.e. SSIEN = 0).
60 */
61static int imx_ssi_set_dai_tdm_slot(struct snd_soc_dai *cpu_dai,
62 unsigned int tx_mask, unsigned int rx_mask, int slots, int slot_width)
63{
64 struct imx_ssi *ssi = snd_soc_dai_get_drvdata(cpu_dai);
65 u32 sccr;
66
67 sccr = readl(ssi->base + SSI_STCCR);
68 sccr &= ~SSI_STCCR_DC_MASK;
69 sccr |= SSI_STCCR_DC(slots - 1);
70 writel(sccr, ssi->base + SSI_STCCR);
71
72 sccr = readl(ssi->base + SSI_SRCCR);
73 sccr &= ~SSI_STCCR_DC_MASK;
74 sccr |= SSI_STCCR_DC(slots - 1);
75 writel(sccr, ssi->base + SSI_SRCCR);
76
77 writel(tx_mask, ssi->base + SSI_STMSK);
78 writel(rx_mask, ssi->base + SSI_SRMSK);
79
80 return 0;
81}
82
83/*
84 * SSI DAI format configuration.
85 * Should only be called when port is inactive (i.e. SSIEN = 0).
86 */
87static int imx_ssi_set_dai_fmt(struct snd_soc_dai *cpu_dai, unsigned int fmt)
88{
89 struct imx_ssi *ssi = snd_soc_dai_get_drvdata(cpu_dai);
90 u32 strcr = 0, scr;
91
92 scr = readl(ssi->base + SSI_SCR) & ~(SSI_SCR_SYN | SSI_SCR_NET);
93
94 /* DAI mode */
95 switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
96 case SND_SOC_DAIFMT_I2S:
97 /* data on rising edge of bclk, frame low 1clk before data */
98 strcr |= SSI_STCR_TFSI | SSI_STCR_TEFS | SSI_STCR_TXBIT0;
99 scr |= SSI_SCR_NET;
100 if (ssi->flags & IMX_SSI_USE_I2S_SLAVE) {
101 scr &= ~SSI_I2S_MODE_MASK;
102 scr |= SSI_SCR_I2S_MODE_SLAVE;
103 }
104 break;
105 case SND_SOC_DAIFMT_LEFT_J:
106 /* data on rising edge of bclk, frame high with data */
107 strcr |= SSI_STCR_TXBIT0;
108 break;
109 case SND_SOC_DAIFMT_DSP_B:
110 /* data on rising edge of bclk, frame high with data */
111 strcr |= SSI_STCR_TFSL | SSI_STCR_TXBIT0;
112 break;
113 case SND_SOC_DAIFMT_DSP_A:
114 /* data on rising edge of bclk, frame high 1clk before data */
115 strcr |= SSI_STCR_TFSL | SSI_STCR_TEFS;
116 break;
117 }
118
119 /* DAI clock inversion */
120 switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
121 case SND_SOC_DAIFMT_IB_IF:
122 strcr |= SSI_STCR_TFSI;
123 strcr &= ~SSI_STCR_TSCKP;
124 break;
125 case SND_SOC_DAIFMT_IB_NF:
126 strcr &= ~(SSI_STCR_TSCKP | SSI_STCR_TFSI);
127 break;
128 case SND_SOC_DAIFMT_NB_IF:
129 strcr |= SSI_STCR_TFSI | SSI_STCR_TSCKP;
130 break;
131 case SND_SOC_DAIFMT_NB_NF:
132 strcr &= ~SSI_STCR_TFSI;
133 strcr |= SSI_STCR_TSCKP;
134 break;
135 }
136
137 /* DAI clock master masks */
138 switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
139 case SND_SOC_DAIFMT_CBM_CFM:
140 break;
141 default:
142 /* Master mode not implemented, needs handling of clocks. */
143 return -EINVAL;
144 }
145
146 strcr |= SSI_STCR_TFEN0;
147
148 if (ssi->flags & IMX_SSI_NET)
149 scr |= SSI_SCR_NET;
150 if (ssi->flags & IMX_SSI_SYN)
151 scr |= SSI_SCR_SYN;
152
153 writel(strcr, ssi->base + SSI_STCR);
154 writel(strcr, ssi->base + SSI_SRCR);
155 writel(scr, ssi->base + SSI_SCR);
156
157 return 0;
158}
159
160/*
161 * SSI system clock configuration.
162 * Should only be called when port is inactive (i.e. SSIEN = 0).
163 */
164static int imx_ssi_set_dai_sysclk(struct snd_soc_dai *cpu_dai,
165 int clk_id, unsigned int freq, int dir)
166{
167 struct imx_ssi *ssi = snd_soc_dai_get_drvdata(cpu_dai);
168 u32 scr;
169
170 scr = readl(ssi->base + SSI_SCR);
171
172 switch (clk_id) {
173 case IMX_SSP_SYS_CLK:
174 if (dir == SND_SOC_CLOCK_OUT)
175 scr |= SSI_SCR_SYS_CLK_EN;
176 else
177 scr &= ~SSI_SCR_SYS_CLK_EN;
178 break;
179 default:
180 return -EINVAL;
181 }
182
183 writel(scr, ssi->base + SSI_SCR);
184
185 return 0;
186}
187
188/*
189 * SSI Clock dividers
190 * Should only be called when port is inactive (i.e. SSIEN = 0).
191 */
192static int imx_ssi_set_dai_clkdiv(struct snd_soc_dai *cpu_dai,
193 int div_id, int div)
194{
195 struct imx_ssi *ssi = snd_soc_dai_get_drvdata(cpu_dai);
196 u32 stccr, srccr;
197
198 stccr = readl(ssi->base + SSI_STCCR);
199 srccr = readl(ssi->base + SSI_SRCCR);
200
201 switch (div_id) {
202 case IMX_SSI_TX_DIV_2:
203 stccr &= ~SSI_STCCR_DIV2;
204 stccr |= div;
205 break;
206 case IMX_SSI_TX_DIV_PSR:
207 stccr &= ~SSI_STCCR_PSR;
208 stccr |= div;
209 break;
210 case IMX_SSI_TX_DIV_PM:
211 stccr &= ~0xff;
212 stccr |= SSI_STCCR_PM(div);
213 break;
214 case IMX_SSI_RX_DIV_2:
215 stccr &= ~SSI_STCCR_DIV2;
216 stccr |= div;
217 break;
218 case IMX_SSI_RX_DIV_PSR:
219 stccr &= ~SSI_STCCR_PSR;
220 stccr |= div;
221 break;
222 case IMX_SSI_RX_DIV_PM:
223 stccr &= ~0xff;
224 stccr |= SSI_STCCR_PM(div);
225 break;
226 default:
227 return -EINVAL;
228 }
229
230 writel(stccr, ssi->base + SSI_STCCR);
231 writel(srccr, ssi->base + SSI_SRCCR);
232
233 return 0;
234}
235
236/*
237 * Should only be called when port is inactive (i.e. SSIEN = 0),
238 * although can be called multiple times by upper layers.
239 */
240static int imx_ssi_hw_params(struct snd_pcm_substream *substream,
241 struct snd_pcm_hw_params *params,
242 struct snd_soc_dai *cpu_dai)
243{
244 struct imx_ssi *ssi = snd_soc_dai_get_drvdata(cpu_dai);
245 struct imx_pcm_dma_params *dma_data;
246 u32 reg, sccr;
247
248 /* Tx/Rx config */
249 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
250 reg = SSI_STCCR;
251 dma_data = &ssi->dma_params_tx;
252 } else {
253 reg = SSI_SRCCR;
254 dma_data = &ssi->dma_params_rx;
255 }
256
257 if (ssi->flags & IMX_SSI_SYN)
258 reg = SSI_STCCR;
259
260 snd_soc_dai_set_dma_data(cpu_dai, substream, dma_data);
261
262 sccr = readl(ssi->base + reg) & ~SSI_STCCR_WL_MASK;
263
264 /* DAI data (word) size */
265 switch (params_format(params)) {
266 case SNDRV_PCM_FORMAT_S16_LE:
267 sccr |= SSI_SRCCR_WL(16);
268 break;
269 case SNDRV_PCM_FORMAT_S20_3LE:
270 sccr |= SSI_SRCCR_WL(20);
271 break;
272 case SNDRV_PCM_FORMAT_S24_LE:
273 sccr |= SSI_SRCCR_WL(24);
274 break;
275 }
276
277 writel(sccr, ssi->base + reg);
278
279 return 0;
280}
281
282static int imx_ssi_trigger(struct snd_pcm_substream *substream, int cmd,
283 struct snd_soc_dai *dai)
284{
285 struct imx_ssi *ssi = snd_soc_dai_get_drvdata(dai);
286 unsigned int sier_bits, sier;
287 unsigned int scr;
288
289 scr = readl(ssi->base + SSI_SCR);
290 sier = readl(ssi->base + SSI_SIER);
291
292 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
293 if (ssi->flags & IMX_SSI_DMA)
294 sier_bits = SSI_SIER_TDMAE;
295 else
296 sier_bits = SSI_SIER_TIE | SSI_SIER_TFE0_EN;
297 } else {
298 if (ssi->flags & IMX_SSI_DMA)
299 sier_bits = SSI_SIER_RDMAE;
300 else
301 sier_bits = SSI_SIER_RIE | SSI_SIER_RFF0_EN;
302 }
303
304 switch (cmd) {
305 case SNDRV_PCM_TRIGGER_START:
306 case SNDRV_PCM_TRIGGER_RESUME:
307 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
308 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
309 scr |= SSI_SCR_TE;
310 else
311 scr |= SSI_SCR_RE;
312 sier |= sier_bits;
313
314 if (++ssi->enabled == 1)
315 scr |= SSI_SCR_SSIEN;
316
317 break;
318
319 case SNDRV_PCM_TRIGGER_STOP:
320 case SNDRV_PCM_TRIGGER_SUSPEND:
321 case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
322 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
323 scr &= ~SSI_SCR_TE;
324 else
325 scr &= ~SSI_SCR_RE;
326 sier &= ~sier_bits;
327
328 if (--ssi->enabled == 0)
329 scr &= ~SSI_SCR_SSIEN;
330
331 break;
332 default:
333 return -EINVAL;
334 }
335
336 if (!(ssi->flags & IMX_SSI_USE_AC97))
337 /* rx/tx are always enabled to access ac97 registers */
338 writel(scr, ssi->base + SSI_SCR);
339
340 writel(sier, ssi->base + SSI_SIER);
341
342 return 0;
343}
344
345static struct snd_soc_dai_ops imx_ssi_pcm_dai_ops = {
346 .hw_params = imx_ssi_hw_params,
347 .set_fmt = imx_ssi_set_dai_fmt,
348 .set_clkdiv = imx_ssi_set_dai_clkdiv,
349 .set_sysclk = imx_ssi_set_dai_sysclk,
350 .set_tdm_slot = imx_ssi_set_dai_tdm_slot,
351 .trigger = imx_ssi_trigger,
352};
353
354int snd_imx_pcm_mmap(struct snd_pcm_substream *substream,
355 struct vm_area_struct *vma)
356{
357 struct snd_pcm_runtime *runtime = substream->runtime;
358 int ret;
359
360 ret = dma_mmap_coherent(NULL, vma, runtime->dma_area,
361 runtime->dma_addr, runtime->dma_bytes);
362
363 pr_debug("%s: ret: %d %p 0x%08x 0x%08x\n", __func__, ret,
364 runtime->dma_area,
365 runtime->dma_addr,
366 runtime->dma_bytes);
367 return ret;
368}
369EXPORT_SYMBOL_GPL(snd_imx_pcm_mmap);
370
371static int imx_pcm_preallocate_dma_buffer(struct snd_pcm *pcm, int stream)
372{
373 struct snd_pcm_substream *substream = pcm->streams[stream].substream;
374 struct snd_dma_buffer *buf = &substream->dma_buffer;
375 size_t size = IMX_SSI_DMABUF_SIZE;
376
377 buf->dev.type = SNDRV_DMA_TYPE_DEV;
378 buf->dev.dev = pcm->card->dev;
379 buf->private_data = NULL;
380 buf->area = dma_alloc_writecombine(pcm->card->dev, size,
381 &buf->addr, GFP_KERNEL);
382 if (!buf->area)
383 return -ENOMEM;
384 buf->bytes = size;
385
386 return 0;
387}
388
389static u64 imx_pcm_dmamask = DMA_BIT_MASK(32);
390
391int imx_pcm_new(struct snd_soc_pcm_runtime *rtd)
392{
393 struct snd_card *card = rtd->card->snd_card;
394 struct snd_soc_dai *dai = rtd->cpu_dai;
395 struct snd_pcm *pcm = rtd->pcm;
396 int ret = 0;
397
398 if (!card->dev->dma_mask)
399 card->dev->dma_mask = &imx_pcm_dmamask;
400 if (!card->dev->coherent_dma_mask)
401 card->dev->coherent_dma_mask = DMA_BIT_MASK(32);
402 if (dai->driver->playback.channels_min) {
403 ret = imx_pcm_preallocate_dma_buffer(pcm,
404 SNDRV_PCM_STREAM_PLAYBACK);
405 if (ret)
406 goto out;
407 }
408
409 if (dai->driver->capture.channels_min) {
410 ret = imx_pcm_preallocate_dma_buffer(pcm,
411 SNDRV_PCM_STREAM_CAPTURE);
412 if (ret)
413 goto out;
414 }
415
416out:
417 return ret;
418}
419EXPORT_SYMBOL_GPL(imx_pcm_new);
420
421void imx_pcm_free(struct snd_pcm *pcm)
422{
423 struct snd_pcm_substream *substream;
424 struct snd_dma_buffer *buf;
425 int stream;
426
427 for (stream = 0; stream < 2; stream++) {
428 substream = pcm->streams[stream].substream;
429 if (!substream)
430 continue;
431
432 buf = &substream->dma_buffer;
433 if (!buf->area)
434 continue;
435
436 dma_free_writecombine(pcm->card->dev, buf->bytes,
437 buf->area, buf->addr);
438 buf->area = NULL;
439 }
440}
441EXPORT_SYMBOL_GPL(imx_pcm_free);
442
443static int imx_ssi_dai_probe(struct snd_soc_dai *dai)
444{
445 struct imx_ssi *ssi = dev_get_drvdata(dai->dev);
446 uint32_t val;
447
448 snd_soc_dai_set_drvdata(dai, ssi);
449
450 val = SSI_SFCSR_TFWM0(ssi->dma_params_tx.burstsize) |
451 SSI_SFCSR_RFWM0(ssi->dma_params_rx.burstsize);
452 writel(val, ssi->base + SSI_SFCSR);
453
454 return 0;
455}
456
457static struct snd_soc_dai_driver imx_ssi_dai = {
458 .probe = imx_ssi_dai_probe,
459 .playback = {
460 .channels_min = 1,
461 .channels_max = 2,
462 .rates = SNDRV_PCM_RATE_8000_96000,
463 .formats = SNDRV_PCM_FMTBIT_S16_LE,
464 },
465 .capture = {
466 .channels_min = 1,
467 .channels_max = 2,
468 .rates = SNDRV_PCM_RATE_8000_96000,
469 .formats = SNDRV_PCM_FMTBIT_S16_LE,
470 },
471 .ops = &imx_ssi_pcm_dai_ops,
472};
473
474static struct snd_soc_dai_driver imx_ac97_dai = {
475 .probe = imx_ssi_dai_probe,
476 .ac97_control = 1,
477 .playback = {
478 .stream_name = "AC97 Playback",
479 .channels_min = 2,
480 .channels_max = 2,
481 .rates = SNDRV_PCM_RATE_48000,
482 .formats = SNDRV_PCM_FMTBIT_S16_LE,
483 },
484 .capture = {
485 .stream_name = "AC97 Capture",
486 .channels_min = 2,
487 .channels_max = 2,
488 .rates = SNDRV_PCM_RATE_48000,
489 .formats = SNDRV_PCM_FMTBIT_S16_LE,
490 },
491 .ops = &imx_ssi_pcm_dai_ops,
492};
493
494static void setup_channel_to_ac97(struct imx_ssi *imx_ssi)
495{
496 void __iomem *base = imx_ssi->base;
497
498 writel(0x0, base + SSI_SCR);
499 writel(0x0, base + SSI_STCR);
500 writel(0x0, base + SSI_SRCR);
501
502 writel(SSI_SCR_SYN | SSI_SCR_NET, base + SSI_SCR);
503
504 writel(SSI_SFCSR_RFWM0(8) |
505 SSI_SFCSR_TFWM0(8) |
506 SSI_SFCSR_RFWM1(8) |
507 SSI_SFCSR_TFWM1(8), base + SSI_SFCSR);
508
509 writel(SSI_STCCR_WL(16) | SSI_STCCR_DC(12), base + SSI_STCCR);
510 writel(SSI_STCCR_WL(16) | SSI_STCCR_DC(12), base + SSI_SRCCR);
511
512 writel(SSI_SCR_SYN | SSI_SCR_NET | SSI_SCR_SSIEN, base + SSI_SCR);
513 writel(SSI_SOR_WAIT(3), base + SSI_SOR);
514
515 writel(SSI_SCR_SYN | SSI_SCR_NET | SSI_SCR_SSIEN |
516 SSI_SCR_TE | SSI_SCR_RE,
517 base + SSI_SCR);
518
519 writel(SSI_SACNT_DEFAULT, base + SSI_SACNT);
520 writel(0xff, base + SSI_SACCDIS);
521 writel(0x300, base + SSI_SACCEN);
522}
523
524static struct imx_ssi *ac97_ssi;
525
526static void imx_ssi_ac97_write(struct snd_ac97 *ac97, unsigned short reg,
527 unsigned short val)
528{
529 struct imx_ssi *imx_ssi = ac97_ssi;
530 void __iomem *base = imx_ssi->base;
531 unsigned int lreg;
532 unsigned int lval;
533
534 if (reg > 0x7f)
535 return;
536
537 pr_debug("%s: 0x%02x 0x%04x\n", __func__, reg, val);
538
539 lreg = reg << 12;
540 writel(lreg, base + SSI_SACADD);
541
542 lval = val << 4;
543 writel(lval , base + SSI_SACDAT);
544
545 writel(SSI_SACNT_DEFAULT | SSI_SACNT_WR, base + SSI_SACNT);
546 udelay(100);
547}
548
549static unsigned short imx_ssi_ac97_read(struct snd_ac97 *ac97,
550 unsigned short reg)
551{
552 struct imx_ssi *imx_ssi = ac97_ssi;
553 void __iomem *base = imx_ssi->base;
554
555 unsigned short val = -1;
556 unsigned int lreg;
557
558 lreg = (reg & 0x7f) << 12 ;
559 writel(lreg, base + SSI_SACADD);
560 writel(SSI_SACNT_DEFAULT | SSI_SACNT_RD, base + SSI_SACNT);
561
562 udelay(100);
563
564 val = (readl(base + SSI_SACDAT) >> 4) & 0xffff;
565
566 pr_debug("%s: 0x%02x 0x%04x\n", __func__, reg, val);
567
568 return val;
569}
570
571static void imx_ssi_ac97_reset(struct snd_ac97 *ac97)
572{
573 struct imx_ssi *imx_ssi = ac97_ssi;
574
575 if (imx_ssi->ac97_reset)
576 imx_ssi->ac97_reset(ac97);
577}
578
579static void imx_ssi_ac97_warm_reset(struct snd_ac97 *ac97)
580{
581 struct imx_ssi *imx_ssi = ac97_ssi;
582
583 if (imx_ssi->ac97_warm_reset)
584 imx_ssi->ac97_warm_reset(ac97);
585}
586
587struct snd_ac97_bus_ops soc_ac97_ops = {
588 .read = imx_ssi_ac97_read,
589 .write = imx_ssi_ac97_write,
590 .reset = imx_ssi_ac97_reset,
591 .warm_reset = imx_ssi_ac97_warm_reset
592};
593EXPORT_SYMBOL_GPL(soc_ac97_ops);
594
595static int imx_ssi_probe(struct platform_device *pdev)
596{
597 struct resource *res;
598 struct imx_ssi *ssi;
599 struct imx_ssi_platform_data *pdata = pdev->dev.platform_data;
600 int ret = 0;
601 struct snd_soc_dai_driver *dai;
602
603 ssi = kzalloc(sizeof(*ssi), GFP_KERNEL);
604 if (!ssi)
605 return -ENOMEM;
606 dev_set_drvdata(&pdev->dev, ssi);
607
608 if (pdata) {
609 ssi->ac97_reset = pdata->ac97_reset;
610 ssi->ac97_warm_reset = pdata->ac97_warm_reset;
611 ssi->flags = pdata->flags;
612 }
613
614 ssi->irq = platform_get_irq(pdev, 0);
615
616 ssi->clk = clk_get(&pdev->dev, NULL);
617 if (IS_ERR(ssi->clk)) {
618 ret = PTR_ERR(ssi->clk);
619 dev_err(&pdev->dev, "Cannot get the clock: %d\n",
620 ret);
621 goto failed_clk;
622 }
623 clk_enable(ssi->clk);
624
625 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
626 if (!res) {
627 ret = -ENODEV;
628 goto failed_get_resource;
629 }
630
631 if (!request_mem_region(res->start, resource_size(res), DRV_NAME)) {
632 dev_err(&pdev->dev, "request_mem_region failed\n");
633 ret = -EBUSY;
634 goto failed_get_resource;
635 }
636
637 ssi->base = ioremap(res->start, resource_size(res));
638 if (!ssi->base) {
639 dev_err(&pdev->dev, "ioremap failed\n");
640 ret = -ENODEV;
641 goto failed_ioremap;
642 }
643
644 if (ssi->flags & IMX_SSI_USE_AC97) {
645 if (ac97_ssi) {
646 ret = -EBUSY;
647 goto failed_ac97;
648 }
649 ac97_ssi = ssi;
650 setup_channel_to_ac97(ssi);
651 dai = &imx_ac97_dai;
652 } else
653 dai = &imx_ssi_dai;
654
655 writel(0x0, ssi->base + SSI_SIER);
656
657 ssi->dma_params_rx.dma_addr = res->start + SSI_SRX0;
658 ssi->dma_params_tx.dma_addr = res->start + SSI_STX0;
659
660 ssi->dma_params_tx.burstsize = 4;
661 ssi->dma_params_rx.burstsize = 4;
662
663 res = platform_get_resource_byname(pdev, IORESOURCE_DMA, "tx0");
664 if (res)
665 ssi->dma_params_tx.dma = res->start;
666
667 res = platform_get_resource_byname(pdev, IORESOURCE_DMA, "rx0");
668 if (res)
669 ssi->dma_params_rx.dma = res->start;
670
671 platform_set_drvdata(pdev, ssi);
672
673 ret = snd_soc_register_dai(&pdev->dev, dai);
674 if (ret) {
675 dev_err(&pdev->dev, "register DAI failed\n");
676 goto failed_register;
677 }
678
679 ssi->soc_platform_pdev_fiq = platform_device_alloc("imx-fiq-pcm-audio", pdev->id);
680 if (!ssi->soc_platform_pdev_fiq) {
681 ret = -ENOMEM;
682 goto failed_pdev_fiq_alloc;
683 }
684
685 platform_set_drvdata(ssi->soc_platform_pdev_fiq, ssi);
686 ret = platform_device_add(ssi->soc_platform_pdev_fiq);
687 if (ret) {
688 dev_err(&pdev->dev, "failed to add platform device\n");
689 goto failed_pdev_fiq_add;
690 }
691
692 ssi->soc_platform_pdev = platform_device_alloc("imx-pcm-audio", pdev->id);
693 if (!ssi->soc_platform_pdev) {
694 ret = -ENOMEM;
695 goto failed_pdev_alloc;
696 }
697
698 platform_set_drvdata(ssi->soc_platform_pdev, ssi);
699 ret = platform_device_add(ssi->soc_platform_pdev);
700 if (ret) {
701 dev_err(&pdev->dev, "failed to add platform device\n");
702 goto failed_pdev_add;
703 }
704
705 return 0;
706
707failed_pdev_add:
708 platform_device_put(ssi->soc_platform_pdev);
709failed_pdev_alloc:
710 platform_device_del(ssi->soc_platform_pdev_fiq);
711failed_pdev_fiq_add:
712 platform_device_put(ssi->soc_platform_pdev_fiq);
713failed_pdev_fiq_alloc:
714 snd_soc_unregister_dai(&pdev->dev);
715failed_register:
716failed_ac97:
717 iounmap(ssi->base);
718failed_ioremap:
719 release_mem_region(res->start, resource_size(res));
720failed_get_resource:
721 clk_disable(ssi->clk);
722 clk_put(ssi->clk);
723failed_clk:
724 kfree(ssi);
725
726 return ret;
727}
728
729static int __devexit imx_ssi_remove(struct platform_device *pdev)
730{
731 struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
732 struct imx_ssi *ssi = platform_get_drvdata(pdev);
733
734 platform_device_unregister(ssi->soc_platform_pdev);
735 platform_device_unregister(ssi->soc_platform_pdev_fiq);
736
737 snd_soc_unregister_dai(&pdev->dev);
738
739 if (ssi->flags & IMX_SSI_USE_AC97)
740 ac97_ssi = NULL;
741
742 iounmap(ssi->base);
743 release_mem_region(res->start, resource_size(res));
744 clk_disable(ssi->clk);
745 clk_put(ssi->clk);
746 kfree(ssi);
747
748 return 0;
749}
750
751static struct platform_driver imx_ssi_driver = {
752 .probe = imx_ssi_probe,
753 .remove = __devexit_p(imx_ssi_remove),
754
755 .driver = {
756 .name = "imx-ssi",
757 .owner = THIS_MODULE,
758 },
759};
760
761static int __init imx_ssi_init(void)
762{
763 return platform_driver_register(&imx_ssi_driver);
764}
765
766static void __exit imx_ssi_exit(void)
767{
768 platform_driver_unregister(&imx_ssi_driver);
769}
770
771module_init(imx_ssi_init);
772module_exit(imx_ssi_exit);
773
774/* Module information */
775MODULE_AUTHOR("Sascha Hauer, <s.hauer@pengutronix.de>");
776MODULE_DESCRIPTION("i.MX I2S/ac97 SoC Interface");
777MODULE_LICENSE("GPL");
778MODULE_ALIAS("platform:imx-ssi");
diff --git a/sound/soc/imx/imx-ssi.h b/sound/soc/imx/imx-ssi.h
new file mode 100644
index 00000000000..0a84cec3599
--- /dev/null
+++ b/sound/soc/imx/imx-ssi.h
@@ -0,0 +1,236 @@
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License version 2 as
4 * published by the Free Software Foundation.
5 */
6
7#ifndef _IMX_SSI_H
8#define _IMX_SSI_H
9
10#define SSI_STX0 0x00
11#define SSI_STX1 0x04
12#define SSI_SRX0 0x08
13#define SSI_SRX1 0x0c
14
15#define SSI_SCR 0x10
16#define SSI_SCR_CLK_IST (1 << 9)
17#define SSI_SCR_CLK_IST_SHIFT 9
18#define SSI_SCR_TCH_EN (1 << 8)
19#define SSI_SCR_SYS_CLK_EN (1 << 7)
20#define SSI_SCR_I2S_MODE_NORM (0 << 5)
21#define SSI_SCR_I2S_MODE_MSTR (1 << 5)
22#define SSI_SCR_I2S_MODE_SLAVE (2 << 5)
23#define SSI_I2S_MODE_MASK (3 << 5)
24#define SSI_SCR_SYN (1 << 4)
25#define SSI_SCR_NET (1 << 3)
26#define SSI_SCR_RE (1 << 2)
27#define SSI_SCR_TE (1 << 1)
28#define SSI_SCR_SSIEN (1 << 0)
29
30#define SSI_SISR 0x14
31#define SSI_SISR_MASK ((1 << 19) - 1)
32#define SSI_SISR_CMDAU (1 << 18)
33#define SSI_SISR_CMDDU (1 << 17)
34#define SSI_SISR_RXT (1 << 16)
35#define SSI_SISR_RDR1 (1 << 15)
36#define SSI_SISR_RDR0 (1 << 14)
37#define SSI_SISR_TDE1 (1 << 13)
38#define SSI_SISR_TDE0 (1 << 12)
39#define SSI_SISR_ROE1 (1 << 11)
40#define SSI_SISR_ROE0 (1 << 10)
41#define SSI_SISR_TUE1 (1 << 9)
42#define SSI_SISR_TUE0 (1 << 8)
43#define SSI_SISR_TFS (1 << 7)
44#define SSI_SISR_RFS (1 << 6)
45#define SSI_SISR_TLS (1 << 5)
46#define SSI_SISR_RLS (1 << 4)
47#define SSI_SISR_RFF1 (1 << 3)
48#define SSI_SISR_RFF0 (1 << 2)
49#define SSI_SISR_TFE1 (1 << 1)
50#define SSI_SISR_TFE0 (1 << 0)
51
52#define SSI_SIER 0x18
53#define SSI_SIER_RDMAE (1 << 22)
54#define SSI_SIER_RIE (1 << 21)
55#define SSI_SIER_TDMAE (1 << 20)
56#define SSI_SIER_TIE (1 << 19)
57#define SSI_SIER_CMDAU_EN (1 << 18)
58#define SSI_SIER_CMDDU_EN (1 << 17)
59#define SSI_SIER_RXT_EN (1 << 16)
60#define SSI_SIER_RDR1_EN (1 << 15)
61#define SSI_SIER_RDR0_EN (1 << 14)
62#define SSI_SIER_TDE1_EN (1 << 13)
63#define SSI_SIER_TDE0_EN (1 << 12)
64#define SSI_SIER_ROE1_EN (1 << 11)
65#define SSI_SIER_ROE0_EN (1 << 10)
66#define SSI_SIER_TUE1_EN (1 << 9)
67#define SSI_SIER_TUE0_EN (1 << 8)
68#define SSI_SIER_TFS_EN (1 << 7)
69#define SSI_SIER_RFS_EN (1 << 6)
70#define SSI_SIER_TLS_EN (1 << 5)
71#define SSI_SIER_RLS_EN (1 << 4)
72#define SSI_SIER_RFF1_EN (1 << 3)
73#define SSI_SIER_RFF0_EN (1 << 2)
74#define SSI_SIER_TFE1_EN (1 << 1)
75#define SSI_SIER_TFE0_EN (1 << 0)
76
77#define SSI_STCR 0x1c
78#define SSI_STCR_TXBIT0 (1 << 9)
79#define SSI_STCR_TFEN1 (1 << 8)
80#define SSI_STCR_TFEN0 (1 << 7)
81#define SSI_FIFO_ENABLE_0_SHIFT 7
82#define SSI_STCR_TFDIR (1 << 6)
83#define SSI_STCR_TXDIR (1 << 5)
84#define SSI_STCR_TSHFD (1 << 4)
85#define SSI_STCR_TSCKP (1 << 3)
86#define SSI_STCR_TFSI (1 << 2)
87#define SSI_STCR_TFSL (1 << 1)
88#define SSI_STCR_TEFS (1 << 0)
89
90#define SSI_SRCR 0x20
91#define SSI_SRCR_RXBIT0 (1 << 9)
92#define SSI_SRCR_RFEN1 (1 << 8)
93#define SSI_SRCR_RFEN0 (1 << 7)
94#define SSI_FIFO_ENABLE_0_SHIFT 7
95#define SSI_SRCR_RFDIR (1 << 6)
96#define SSI_SRCR_RXDIR (1 << 5)
97#define SSI_SRCR_RSHFD (1 << 4)
98#define SSI_SRCR_RSCKP (1 << 3)
99#define SSI_SRCR_RFSI (1 << 2)
100#define SSI_SRCR_RFSL (1 << 1)
101#define SSI_SRCR_REFS (1 << 0)
102
103#define SSI_SRCCR 0x28
104#define SSI_SRCCR_DIV2 (1 << 18)
105#define SSI_SRCCR_PSR (1 << 17)
106#define SSI_SRCCR_WL(x) ((((x) - 2) >> 1) << 13)
107#define SSI_SRCCR_DC(x) (((x) & 0x1f) << 8)
108#define SSI_SRCCR_PM(x) (((x) & 0xff) << 0)
109#define SSI_SRCCR_WL_MASK (0xf << 13)
110#define SSI_SRCCR_DC_MASK (0x1f << 8)
111#define SSI_SRCCR_PM_MASK (0xff << 0)
112
113#define SSI_STCCR 0x24
114#define SSI_STCCR_DIV2 (1 << 18)
115#define SSI_STCCR_PSR (1 << 17)
116#define SSI_STCCR_WL(x) ((((x) - 2) >> 1) << 13)
117#define SSI_STCCR_DC(x) (((x) & 0x1f) << 8)
118#define SSI_STCCR_PM(x) (((x) & 0xff) << 0)
119#define SSI_STCCR_WL_MASK (0xf << 13)
120#define SSI_STCCR_DC_MASK (0x1f << 8)
121#define SSI_STCCR_PM_MASK (0xff << 0)
122
123#define SSI_SFCSR 0x2c
124#define SSI_SFCSR_RFCNT1(x) (((x) & 0xf) << 28)
125#define SSI_RX_FIFO_1_COUNT_SHIFT 28
126#define SSI_SFCSR_TFCNT1(x) (((x) & 0xf) << 24)
127#define SSI_TX_FIFO_1_COUNT_SHIFT 24
128#define SSI_SFCSR_RFWM1(x) (((x) & 0xf) << 20)
129#define SSI_SFCSR_TFWM1(x) (((x) & 0xf) << 16)
130#define SSI_SFCSR_RFCNT0(x) (((x) & 0xf) << 12)
131#define SSI_RX_FIFO_0_COUNT_SHIFT 12
132#define SSI_SFCSR_TFCNT0(x) (((x) & 0xf) << 8)
133#define SSI_TX_FIFO_0_COUNT_SHIFT 8
134#define SSI_SFCSR_RFWM0(x) (((x) & 0xf) << 4)
135#define SSI_SFCSR_TFWM0(x) (((x) & 0xf) << 0)
136#define SSI_SFCSR_RFWM0_MASK (0xf << 4)
137#define SSI_SFCSR_TFWM0_MASK (0xf << 0)
138
139#define SSI_STR 0x30
140#define SSI_STR_TEST (1 << 15)
141#define SSI_STR_RCK2TCK (1 << 14)
142#define SSI_STR_RFS2TFS (1 << 13)
143#define SSI_STR_RXSTATE(x) (((x) & 0xf) << 8)
144#define SSI_STR_TXD2RXD (1 << 7)
145#define SSI_STR_TCK2RCK (1 << 6)
146#define SSI_STR_TFS2RFS (1 << 5)
147#define SSI_STR_TXSTATE(x) (((x) & 0xf) << 0)
148
149#define SSI_SOR 0x34
150#define SSI_SOR_CLKOFF (1 << 6)
151#define SSI_SOR_RX_CLR (1 << 5)
152#define SSI_SOR_TX_CLR (1 << 4)
153#define SSI_SOR_INIT (1 << 3)
154#define SSI_SOR_WAIT(x) (((x) & 0x3) << 1)
155#define SSI_SOR_WAIT_MASK (0x3 << 1)
156#define SSI_SOR_SYNRST (1 << 0)
157
158#define SSI_SACNT 0x38
159#define SSI_SACNT_FRDIV(x) (((x) & 0x3f) << 5)
160#define SSI_SACNT_WR (1 << 4)
161#define SSI_SACNT_RD (1 << 3)
162#define SSI_SACNT_TIF (1 << 2)
163#define SSI_SACNT_FV (1 << 1)
164#define SSI_SACNT_AC97EN (1 << 0)
165
166#define SSI_SACADD 0x3c
167#define SSI_SACDAT 0x40
168#define SSI_SATAG 0x44
169#define SSI_STMSK 0x48
170#define SSI_SRMSK 0x4c
171#define SSI_SACCST 0x50
172#define SSI_SACCEN 0x54
173#define SSI_SACCDIS 0x58
174
175/* SSI clock sources */
176#define IMX_SSP_SYS_CLK 0
177
178/* SSI audio dividers */
179#define IMX_SSI_TX_DIV_2 0
180#define IMX_SSI_TX_DIV_PSR 1
181#define IMX_SSI_TX_DIV_PM 2
182#define IMX_SSI_RX_DIV_2 3
183#define IMX_SSI_RX_DIV_PSR 4
184#define IMX_SSI_RX_DIV_PM 5
185
186#define DRV_NAME "imx-ssi"
187
188#include <linux/dmaengine.h>
189#include <mach/dma.h>
190
191struct imx_pcm_dma_params {
192 int dma;
193 unsigned long dma_addr;
194 int burstsize;
195};
196
197struct imx_ssi {
198 struct platform_device *ac97_dev;
199
200 struct snd_soc_dai *imx_ac97;
201 struct clk *clk;
202 void __iomem *base;
203 int irq;
204 int fiq_enable;
205 unsigned int offset;
206
207 unsigned int flags;
208
209 void (*ac97_reset) (struct snd_ac97 *ac97);
210 void (*ac97_warm_reset)(struct snd_ac97 *ac97);
211
212 struct imx_pcm_dma_params dma_params_rx;
213 struct imx_pcm_dma_params dma_params_tx;
214
215 int enabled;
216
217 struct platform_device *soc_platform_pdev;
218 struct platform_device *soc_platform_pdev_fiq;
219};
220
221struct snd_soc_platform *imx_ssi_fiq_init(struct platform_device *pdev,
222 struct imx_ssi *ssi);
223void imx_ssi_fiq_exit(struct platform_device *pdev, struct imx_ssi *ssi);
224struct snd_soc_platform *imx_ssi_dma_mx2_init(struct platform_device *pdev,
225 struct imx_ssi *ssi);
226
227int snd_imx_pcm_mmap(struct snd_pcm_substream *substream, struct vm_area_struct *vma);
228int imx_pcm_new(struct snd_soc_pcm_runtime *rtd);
229void imx_pcm_free(struct snd_pcm *pcm);
230
231/*
232 * Do not change this as the FIQ handler depends on this size
233 */
234#define IMX_SSI_DMABUF_SIZE (64 * 1024)
235
236#endif /* _IMX_SSI_H */
diff --git a/sound/soc/imx/mx27vis-aic32x4.c b/sound/soc/imx/mx27vis-aic32x4.c
new file mode 100644
index 00000000000..054110b91d4
--- /dev/null
+++ b/sound/soc/imx/mx27vis-aic32x4.c
@@ -0,0 +1,137 @@
1/*
2 * mx27vis-aic32x4.c
3 *
4 * Copyright 2011 Vista Silicon S.L.
5 *
6 * Author: Javier Martin <javier.martin@vista-silicon.com>
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
21 * MA 02110-1301, USA.
22 */
23
24#include <linux/module.h>
25#include <linux/moduleparam.h>
26#include <linux/device.h>
27#include <linux/i2c.h>
28#include <sound/core.h>
29#include <sound/pcm.h>
30#include <sound/soc.h>
31#include <sound/soc-dapm.h>
32#include <asm/mach-types.h>
33#include <mach/audmux.h>
34
35#include "../codecs/tlv320aic32x4.h"
36#include "imx-ssi.h"
37
38static int mx27vis_aic32x4_hw_params(struct snd_pcm_substream *substream,
39 struct snd_pcm_hw_params *params)
40{
41 struct snd_soc_pcm_runtime *rtd = substream->private_data;
42 struct snd_soc_dai *codec_dai = rtd->codec_dai;
43 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
44 int ret;
45 u32 dai_format;
46
47 dai_format = SND_SOC_DAIFMT_DSP_B | SND_SOC_DAIFMT_NB_NF |
48 SND_SOC_DAIFMT_CBM_CFM;
49
50 /* set codec DAI configuration */
51 snd_soc_dai_set_fmt(codec_dai, dai_format);
52
53 /* set cpu DAI configuration */
54 snd_soc_dai_set_fmt(cpu_dai, dai_format);
55
56 ret = snd_soc_dai_set_sysclk(codec_dai, 0,
57 25000000, SND_SOC_CLOCK_OUT);
58 if (ret) {
59 pr_err("%s: failed setting codec sysclk\n", __func__);
60 return ret;
61 }
62
63 ret = snd_soc_dai_set_sysclk(cpu_dai, IMX_SSP_SYS_CLK, 0,
64 SND_SOC_CLOCK_IN);
65 if (ret) {
66 pr_err("can't set CPU system clock IMX_SSP_SYS_CLK\n");
67 return ret;
68 }
69
70 return 0;
71}
72
73static struct snd_soc_ops mx27vis_aic32x4_snd_ops = {
74 .hw_params = mx27vis_aic32x4_hw_params,
75};
76
77static struct snd_soc_dai_link mx27vis_aic32x4_dai = {
78 .name = "tlv320aic32x4",
79 .stream_name = "TLV320AIC32X4",
80 .codec_dai_name = "tlv320aic32x4-hifi",
81 .platform_name = "imx-pcm-audio.0",
82 .codec_name = "tlv320aic32x4.0-0018",
83 .cpu_dai_name = "imx-ssi.0",
84 .ops = &mx27vis_aic32x4_snd_ops,
85};
86
87static struct snd_soc_card mx27vis_aic32x4 = {
88 .name = "visstrim_m10-audio",
89 .dai_link = &mx27vis_aic32x4_dai,
90 .num_links = 1,
91};
92
93static struct platform_device *mx27vis_aic32x4_snd_device;
94
95static int __init mx27vis_aic32x4_init(void)
96{
97 int ret;
98
99 mx27vis_aic32x4_snd_device = platform_device_alloc("soc-audio", -1);
100 if (!mx27vis_aic32x4_snd_device)
101 return -ENOMEM;
102
103 platform_set_drvdata(mx27vis_aic32x4_snd_device, &mx27vis_aic32x4);
104 ret = platform_device_add(mx27vis_aic32x4_snd_device);
105
106 if (ret) {
107 printk(KERN_ERR "ASoC: Platform device allocation failed\n");
108 platform_device_put(mx27vis_aic32x4_snd_device);
109 }
110
111 /* Connect SSI0 as clock slave to SSI1 external pins */
112 mxc_audmux_v1_configure_port(MX27_AUDMUX_HPCR1_SSI0,
113 MXC_AUDMUX_V1_PCR_SYN |
114 MXC_AUDMUX_V1_PCR_TFSDIR |
115 MXC_AUDMUX_V1_PCR_TCLKDIR |
116 MXC_AUDMUX_V1_PCR_TFCSEL(MX27_AUDMUX_PPCR1_SSI_PINS_1) |
117 MXC_AUDMUX_V1_PCR_RXDSEL(MX27_AUDMUX_PPCR1_SSI_PINS_1)
118 );
119 mxc_audmux_v1_configure_port(MX27_AUDMUX_PPCR1_SSI_PINS_1,
120 MXC_AUDMUX_V1_PCR_SYN |
121 MXC_AUDMUX_V1_PCR_RXDSEL(MX27_AUDMUX_HPCR1_SSI0)
122 );
123
124 return ret;
125}
126
127static void __exit mx27vis_aic32x4_exit(void)
128{
129 platform_device_unregister(mx27vis_aic32x4_snd_device);
130}
131
132module_init(mx27vis_aic32x4_init);
133module_exit(mx27vis_aic32x4_exit);
134
135MODULE_AUTHOR("Javier Martin <javier.martin@vista-silicon.com>");
136MODULE_DESCRIPTION("ALSA SoC AIC32X4 mx27 visstrim");
137MODULE_LICENSE("GPL");
diff --git a/sound/soc/imx/phycore-ac97.c b/sound/soc/imx/phycore-ac97.c
new file mode 100644
index 00000000000..a7deb5cb243
--- /dev/null
+++ b/sound/soc/imx/phycore-ac97.c
@@ -0,0 +1,99 @@
1/*
2 * phycore-ac97.c -- SoC audio for imx_phycore in AC97 mode
3 *
4 * Copyright 2009 Sascha Hauer, Pengutronix <s.hauer@pengutronix.de>
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 *
11 */
12
13#include <linux/module.h>
14#include <linux/moduleparam.h>
15#include <linux/device.h>
16#include <linux/i2c.h>
17#include <sound/core.h>
18#include <sound/pcm.h>
19#include <sound/soc.h>
20#include <asm/mach-types.h>
21
22static struct snd_soc_card imx_phycore;
23
24static struct snd_soc_ops imx_phycore_hifi_ops = {
25};
26
27static struct snd_soc_dai_link imx_phycore_dai_ac97[] = {
28 {
29 .name = "HiFi",
30 .stream_name = "HiFi",
31 .codec_dai_name = "wm9712-hifi",
32 .codec_name = "wm9712-codec",
33 .cpu_dai_name = "imx-ssi.0",
34 .platform_name = "imx-fiq-pcm-audio.0",
35 .ops = &imx_phycore_hifi_ops,
36 },
37};
38
39static struct snd_soc_card imx_phycore = {
40 .name = "PhyCORE-ac97-audio",
41 .dai_link = imx_phycore_dai_ac97,
42 .num_links = ARRAY_SIZE(imx_phycore_dai_ac97),
43};
44
45static struct platform_device *imx_phycore_snd_ac97_device;
46static struct platform_device *imx_phycore_snd_device;
47
48static int __init imx_phycore_init(void)
49{
50 int ret;
51
52 if (!machine_is_pcm043() && !machine_is_pca100())
53 /* return happy. We might run on a totally different machine */
54 return 0;
55
56 imx_phycore_snd_ac97_device = platform_device_alloc("soc-audio", -1);
57 if (!imx_phycore_snd_ac97_device)
58 return -ENOMEM;
59
60 platform_set_drvdata(imx_phycore_snd_ac97_device, &imx_phycore);
61 ret = platform_device_add(imx_phycore_snd_ac97_device);
62 if (ret)
63 goto fail1;
64
65 imx_phycore_snd_device = platform_device_alloc("wm9712-codec", -1);
66 if (!imx_phycore_snd_device) {
67 ret = -ENOMEM;
68 goto fail2;
69 }
70 ret = platform_device_add(imx_phycore_snd_device);
71
72 if (ret) {
73 printk(KERN_ERR "ASoC: Platform device allocation failed\n");
74 goto fail3;
75 }
76
77 return 0;
78
79fail3:
80 platform_device_put(imx_phycore_snd_device);
81fail2:
82 platform_device_del(imx_phycore_snd_ac97_device);
83fail1:
84 platform_device_put(imx_phycore_snd_ac97_device);
85 return ret;
86}
87
88static void __exit imx_phycore_exit(void)
89{
90 platform_device_unregister(imx_phycore_snd_device);
91 platform_device_unregister(imx_phycore_snd_ac97_device);
92}
93
94late_initcall(imx_phycore_init);
95module_exit(imx_phycore_exit);
96
97MODULE_AUTHOR("Sascha Hauer <s.hauer@pengutronix.de>");
98MODULE_DESCRIPTION("PhyCORE ALSA SoC driver");
99MODULE_LICENSE("GPL");
diff --git a/sound/soc/imx/wm1133-ev1.c b/sound/soc/imx/wm1133-ev1.c
new file mode 100644
index 00000000000..75b4c72787e
--- /dev/null
+++ b/sound/soc/imx/wm1133-ev1.c
@@ -0,0 +1,303 @@
1/*
2 * wm1133-ev1.c - Audio for WM1133-EV1 on i.MX31ADS
3 *
4 * Copyright (c) 2010 Wolfson Microelectronics plc
5 * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
6 *
7 * Based on an earlier driver for the same hardware by Liam Girdwood.
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version.
13 */
14
15#include <linux/platform_device.h>
16#include <linux/clk.h>
17#include <sound/core.h>
18#include <sound/jack.h>
19#include <sound/pcm.h>
20#include <sound/pcm_params.h>
21#include <sound/soc.h>
22
23#include <mach/audmux.h>
24
25#include "imx-ssi.h"
26#include "../codecs/wm8350.h"
27
28/* There is a silicon mic on the board optionally connected via a solder pad
29 * SP1. Define this to enable it.
30 */
31#undef USE_SIMIC
32
33struct _wm8350_audio {
34 unsigned int channels;
35 snd_pcm_format_t format;
36 unsigned int rate;
37 unsigned int sysclk;
38 unsigned int bclkdiv;
39 unsigned int clkdiv;
40 unsigned int lr_rate;
41};
42
43/* in order of power consumption per rate (lowest first) */
44static const struct _wm8350_audio wm8350_audio[] = {
45 /* 16bit mono modes */
46 {1, SNDRV_PCM_FORMAT_S16_LE, 8000, 12288000 >> 1,
47 WM8350_BCLK_DIV_48, WM8350_DACDIV_3, 16,},
48
49 /* 16 bit stereo modes */
50 {2, SNDRV_PCM_FORMAT_S16_LE, 8000, 12288000,
51 WM8350_BCLK_DIV_48, WM8350_DACDIV_6, 32,},
52 {2, SNDRV_PCM_FORMAT_S16_LE, 16000, 12288000,
53 WM8350_BCLK_DIV_24, WM8350_DACDIV_3, 32,},
54 {2, SNDRV_PCM_FORMAT_S16_LE, 32000, 12288000,
55 WM8350_BCLK_DIV_12, WM8350_DACDIV_1_5, 32,},
56 {2, SNDRV_PCM_FORMAT_S16_LE, 48000, 12288000,
57 WM8350_BCLK_DIV_8, WM8350_DACDIV_1, 32,},
58 {2, SNDRV_PCM_FORMAT_S16_LE, 96000, 24576000,
59 WM8350_BCLK_DIV_8, WM8350_DACDIV_1, 32,},
60 {2, SNDRV_PCM_FORMAT_S16_LE, 11025, 11289600,
61 WM8350_BCLK_DIV_32, WM8350_DACDIV_4, 32,},
62 {2, SNDRV_PCM_FORMAT_S16_LE, 22050, 11289600,
63 WM8350_BCLK_DIV_16, WM8350_DACDIV_2, 32,},
64 {2, SNDRV_PCM_FORMAT_S16_LE, 44100, 11289600,
65 WM8350_BCLK_DIV_8, WM8350_DACDIV_1, 32,},
66 {2, SNDRV_PCM_FORMAT_S16_LE, 88200, 22579200,
67 WM8350_BCLK_DIV_8, WM8350_DACDIV_1, 32,},
68
69 /* 24bit stereo modes */
70 {2, SNDRV_PCM_FORMAT_S24_LE, 48000, 12288000,
71 WM8350_BCLK_DIV_4, WM8350_DACDIV_1, 64,},
72 {2, SNDRV_PCM_FORMAT_S24_LE, 96000, 24576000,
73 WM8350_BCLK_DIV_4, WM8350_DACDIV_1, 64,},
74 {2, SNDRV_PCM_FORMAT_S24_LE, 44100, 11289600,
75 WM8350_BCLK_DIV_4, WM8350_DACDIV_1, 64,},
76 {2, SNDRV_PCM_FORMAT_S24_LE, 88200, 22579200,
77 WM8350_BCLK_DIV_4, WM8350_DACDIV_1, 64,},
78};
79
80static int wm1133_ev1_hw_params(struct snd_pcm_substream *substream,
81 struct snd_pcm_hw_params *params)
82{
83 struct snd_soc_pcm_runtime *rtd = substream->private_data;
84 struct snd_soc_dai *codec_dai = rtd->codec_dai;
85 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
86 int i, found = 0;
87 snd_pcm_format_t format = params_format(params);
88 unsigned int rate = params_rate(params);
89 unsigned int channels = params_channels(params);
90 u32 dai_format;
91
92 /* find the correct audio parameters */
93 for (i = 0; i < ARRAY_SIZE(wm8350_audio); i++) {
94 if (rate == wm8350_audio[i].rate &&
95 format == wm8350_audio[i].format &&
96 channels == wm8350_audio[i].channels) {
97 found = 1;
98 break;
99 }
100 }
101 if (!found)
102 return -EINVAL;
103
104 /* codec FLL input is 14.75 MHz from MCLK */
105 snd_soc_dai_set_pll(codec_dai, 0, 0, 14750000, wm8350_audio[i].sysclk);
106
107 dai_format = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
108 SND_SOC_DAIFMT_CBM_CFM;
109
110 /* set codec DAI configuration */
111 snd_soc_dai_set_fmt(codec_dai, dai_format);
112
113 /* set cpu DAI configuration */
114 snd_soc_dai_set_fmt(cpu_dai, dai_format);
115
116 /* TODO: The SSI driver should figure this out for us */
117 switch (channels) {
118 case 2:
119 snd_soc_dai_set_tdm_slot(cpu_dai, 0xffffffc, 0xffffffc, 2, 0);
120 break;
121 case 1:
122 snd_soc_dai_set_tdm_slot(cpu_dai, 0xffffffe, 0xffffffe, 1, 0);
123 break;
124 default:
125 return -EINVAL;
126 }
127
128 /* set MCLK as the codec system clock for DAC and ADC */
129 snd_soc_dai_set_sysclk(codec_dai, WM8350_MCLK_SEL_PLL_MCLK,
130 wm8350_audio[i].sysclk, SND_SOC_CLOCK_IN);
131
132 /* set codec BCLK division for sample rate */
133 snd_soc_dai_set_clkdiv(codec_dai, WM8350_BCLK_CLKDIV,
134 wm8350_audio[i].bclkdiv);
135
136 /* DAI is synchronous and clocked with DAC LRCLK & ADC LRC */
137 snd_soc_dai_set_clkdiv(codec_dai,
138 WM8350_DACLR_CLKDIV, wm8350_audio[i].lr_rate);
139 snd_soc_dai_set_clkdiv(codec_dai,
140 WM8350_ADCLR_CLKDIV, wm8350_audio[i].lr_rate);
141
142 /* now configure DAC and ADC clocks */
143 snd_soc_dai_set_clkdiv(codec_dai,
144 WM8350_DAC_CLKDIV, wm8350_audio[i].clkdiv);
145
146 snd_soc_dai_set_clkdiv(codec_dai,
147 WM8350_ADC_CLKDIV, wm8350_audio[i].clkdiv);
148
149 return 0;
150}
151
152static struct snd_soc_ops wm1133_ev1_ops = {
153 .hw_params = wm1133_ev1_hw_params,
154};
155
156static const struct snd_soc_dapm_widget wm1133_ev1_widgets[] = {
157#ifdef USE_SIMIC
158 SND_SOC_DAPM_MIC("SiMIC", NULL),
159#endif
160 SND_SOC_DAPM_MIC("Mic1 Jack", NULL),
161 SND_SOC_DAPM_MIC("Mic2 Jack", NULL),
162 SND_SOC_DAPM_LINE("Line In Jack", NULL),
163 SND_SOC_DAPM_LINE("Line Out Jack", NULL),
164 SND_SOC_DAPM_HP("Headphone Jack", NULL),
165};
166
167/* imx32ads soc_card audio map */
168static const struct snd_soc_dapm_route wm1133_ev1_map[] = {
169
170#ifdef USE_SIMIC
171 /* SiMIC --> IN1LN (with automatic bias) via SP1 */
172 { "IN1LN", NULL, "Mic Bias" },
173 { "Mic Bias", NULL, "SiMIC" },
174#endif
175
176 /* Mic 1 Jack --> IN1LN and IN1LP (with automatic bias) */
177 { "IN1LN", NULL, "Mic Bias" },
178 { "IN1LP", NULL, "Mic1 Jack" },
179 { "Mic Bias", NULL, "Mic1 Jack" },
180
181 /* Mic 2 Jack --> IN1RN and IN1RP (with automatic bias) */
182 { "IN1RN", NULL, "Mic Bias" },
183 { "IN1RP", NULL, "Mic2 Jack" },
184 { "Mic Bias", NULL, "Mic2 Jack" },
185
186 /* Line in Jack --> AUX (L+R) */
187 { "IN3R", NULL, "Line In Jack" },
188 { "IN3L", NULL, "Line In Jack" },
189
190 /* Out1 --> Headphone Jack */
191 { "Headphone Jack", NULL, "OUT1R" },
192 { "Headphone Jack", NULL, "OUT1L" },
193
194 /* Out1 --> Line Out Jack */
195 { "Line Out Jack", NULL, "OUT2R" },
196 { "Line Out Jack", NULL, "OUT2L" },
197};
198
199static struct snd_soc_jack hp_jack;
200
201static struct snd_soc_jack_pin hp_jack_pins[] = {
202 { .pin = "Headphone Jack", .mask = SND_JACK_HEADPHONE },
203};
204
205static struct snd_soc_jack mic_jack;
206
207static struct snd_soc_jack_pin mic_jack_pins[] = {
208 { .pin = "Mic1 Jack", .mask = SND_JACK_MICROPHONE },
209 { .pin = "Mic2 Jack", .mask = SND_JACK_MICROPHONE },
210};
211
212static int wm1133_ev1_init(struct snd_soc_pcm_runtime *rtd)
213{
214 struct snd_soc_codec *codec = rtd->codec;
215 struct snd_soc_dapm_context *dapm = &codec->dapm;
216
217 snd_soc_dapm_new_controls(dapm, wm1133_ev1_widgets,
218 ARRAY_SIZE(wm1133_ev1_widgets));
219
220 snd_soc_dapm_add_routes(dapm, wm1133_ev1_map,
221 ARRAY_SIZE(wm1133_ev1_map));
222
223 /* Headphone jack detection */
224 snd_soc_jack_new(codec, "Headphone", SND_JACK_HEADPHONE, &hp_jack);
225 snd_soc_jack_add_pins(&hp_jack, ARRAY_SIZE(hp_jack_pins),
226 hp_jack_pins);
227 wm8350_hp_jack_detect(codec, WM8350_JDR, &hp_jack, SND_JACK_HEADPHONE);
228
229 /* Microphone jack detection */
230 snd_soc_jack_new(codec, "Microphone",
231 SND_JACK_MICROPHONE | SND_JACK_BTN_0, &mic_jack);
232 snd_soc_jack_add_pins(&mic_jack, ARRAY_SIZE(mic_jack_pins),
233 mic_jack_pins);
234 wm8350_mic_jack_detect(codec, &mic_jack, SND_JACK_MICROPHONE,
235 SND_JACK_BTN_0);
236
237 snd_soc_dapm_force_enable_pin(dapm, "Mic Bias");
238
239 return 0;
240}
241
242
243static struct snd_soc_dai_link wm1133_ev1_dai = {
244 .name = "WM1133-EV1",
245 .stream_name = "Audio",
246 .cpu_dai_name = "imx-ssi.0",
247 .codec_dai_name = "wm8350-hifi",
248 .platform_name = "imx-fiq-pcm-audio.0",
249 .codec_name = "wm8350-codec.0-0x1a",
250 .init = wm1133_ev1_init,
251 .ops = &wm1133_ev1_ops,
252 .symmetric_rates = 1,
253};
254
255static struct snd_soc_card wm1133_ev1 = {
256 .name = "WM1133-EV1",
257 .dai_link = &wm1133_ev1_dai,
258 .num_links = 1,
259};
260
261static struct platform_device *wm1133_ev1_snd_device;
262
263static int __init wm1133_ev1_audio_init(void)
264{
265 int ret;
266 unsigned int ptcr, pdcr;
267
268 /* SSI0 mastered by port 5 */
269 ptcr = MXC_AUDMUX_V2_PTCR_SYN |
270 MXC_AUDMUX_V2_PTCR_TFSDIR |
271 MXC_AUDMUX_V2_PTCR_TFSEL(MX31_AUDMUX_PORT5_SSI_PINS_5) |
272 MXC_AUDMUX_V2_PTCR_TCLKDIR |
273 MXC_AUDMUX_V2_PTCR_TCSEL(MX31_AUDMUX_PORT5_SSI_PINS_5);
274 pdcr = MXC_AUDMUX_V2_PDCR_RXDSEL(MX31_AUDMUX_PORT5_SSI_PINS_5);
275 mxc_audmux_v2_configure_port(MX31_AUDMUX_PORT1_SSI0, ptcr, pdcr);
276
277 ptcr = MXC_AUDMUX_V2_PTCR_SYN;
278 pdcr = MXC_AUDMUX_V2_PDCR_RXDSEL(MX31_AUDMUX_PORT1_SSI0);
279 mxc_audmux_v2_configure_port(MX31_AUDMUX_PORT5_SSI_PINS_5, ptcr, pdcr);
280
281 wm1133_ev1_snd_device = platform_device_alloc("soc-audio", -1);
282 if (!wm1133_ev1_snd_device)
283 return -ENOMEM;
284
285 platform_set_drvdata(wm1133_ev1_snd_device, &wm1133_ev1);
286 ret = platform_device_add(wm1133_ev1_snd_device);
287
288 if (ret)
289 platform_device_put(wm1133_ev1_snd_device);
290
291 return ret;
292}
293module_init(wm1133_ev1_audio_init);
294
295static void __exit wm1133_ev1_audio_exit(void)
296{
297 platform_device_unregister(wm1133_ev1_snd_device);
298}
299module_exit(wm1133_ev1_audio_exit);
300
301MODULE_AUTHOR("Mark Brown <broonie@opensource.wolfsonmicro.com>");
302MODULE_DESCRIPTION("Audio for WM1133-EV1 on i.MX31ADS");
303MODULE_LICENSE("GPL");
diff --git a/sound/soc/omap/igep0020.c b/sound/soc/omap/igep0020.c
new file mode 100644
index 00000000000..0ae34702995
--- /dev/null
+++ b/sound/soc/omap/igep0020.c
@@ -0,0 +1,137 @@
1/*
2 * igep0020.c -- SoC audio for IGEP v2
3 *
4 * Based on sound/soc/omap/overo.c by Steve Sakoman
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * version 2 as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18 * 02110-1301 USA
19 *
20 */
21
22#include <linux/clk.h>
23#include <linux/platform_device.h>
24#include <sound/core.h>
25#include <sound/pcm.h>
26#include <sound/soc.h>
27
28#include <asm/mach-types.h>
29#include <mach/hardware.h>
30#include <mach/gpio.h>
31#include <plat/mcbsp.h>
32
33#include "omap-mcbsp.h"
34#include "omap-pcm.h"
35
36static int igep2_hw_params(struct snd_pcm_substream *substream,
37 struct snd_pcm_hw_params *params)
38{
39 struct snd_soc_pcm_runtime *rtd = substream->private_data;
40 struct snd_soc_dai *codec_dai = rtd->codec_dai;
41 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
42 int ret;
43
44 /* Set codec DAI configuration */
45 ret = snd_soc_dai_set_fmt(codec_dai,
46 SND_SOC_DAIFMT_I2S |
47 SND_SOC_DAIFMT_NB_NF |
48 SND_SOC_DAIFMT_CBM_CFM);
49 if (ret < 0) {
50 printk(KERN_ERR "can't set codec DAI configuration\n");
51 return ret;
52 }
53
54 /* Set cpu DAI configuration */
55 ret = snd_soc_dai_set_fmt(cpu_dai,
56 SND_SOC_DAIFMT_I2S |
57 SND_SOC_DAIFMT_NB_NF |
58 SND_SOC_DAIFMT_CBM_CFM);
59 if (ret < 0) {
60 printk(KERN_ERR "can't set cpu DAI configuration\n");
61 return ret;
62 }
63
64 /* Set the codec system clock for DAC and ADC */
65 ret = snd_soc_dai_set_sysclk(codec_dai, 0, 26000000,
66 SND_SOC_CLOCK_IN);
67 if (ret < 0) {
68 printk(KERN_ERR "can't set codec system clock\n");
69 return ret;
70 }
71
72 return 0;
73}
74
75static struct snd_soc_ops igep2_ops = {
76 .hw_params = igep2_hw_params,
77};
78
79/* Digital audio interface glue - connects codec <--> CPU */
80static struct snd_soc_dai_link igep2_dai = {
81 .name = "TWL4030",
82 .stream_name = "TWL4030",
83 .cpu_dai_name = "omap-mcbsp-dai.1",
84 .codec_dai_name = "twl4030-hifi",
85 .platform_name = "omap-pcm-audio",
86 .codec_name = "twl4030-codec",
87 .ops = &igep2_ops,
88};
89
90/* Audio machine driver */
91static struct snd_soc_card snd_soc_card_igep2 = {
92 .name = "igep2",
93 .dai_link = &igep2_dai,
94 .num_links = 1,
95};
96
97static struct platform_device *igep2_snd_device;
98
99static int __init igep2_soc_init(void)
100{
101 int ret;
102
103 if (!machine_is_igep0020())
104 return -ENODEV;
105 printk(KERN_INFO "IGEP v2 SoC init\n");
106
107 igep2_snd_device = platform_device_alloc("soc-audio", -1);
108 if (!igep2_snd_device) {
109 printk(KERN_ERR "Platform device allocation failed\n");
110 return -ENOMEM;
111 }
112
113 platform_set_drvdata(igep2_snd_device, &snd_soc_card_igep2);
114
115 ret = platform_device_add(igep2_snd_device);
116 if (ret)
117 goto err1;
118
119 return 0;
120
121err1:
122 printk(KERN_ERR "Unable to add platform device\n");
123 platform_device_put(igep2_snd_device);
124
125 return ret;
126}
127module_init(igep2_soc_init);
128
129static void __exit igep2_soc_exit(void)
130{
131 platform_device_unregister(igep2_snd_device);
132}
133module_exit(igep2_soc_exit);
134
135MODULE_AUTHOR("Enric Balletbo i Serra <eballetbo@iseebcn.com>");
136MODULE_DESCRIPTION("ALSA SoC IGEP v2");
137MODULE_LICENSE("GPL");
diff --git a/sound/soc/omap/mcpdm.c b/sound/soc/omap/mcpdm.c
new file mode 100644
index 00000000000..50e59194ad8
--- /dev/null
+++ b/sound/soc/omap/mcpdm.c
@@ -0,0 +1,470 @@
1/*
2 * mcpdm.c -- McPDM interface driver
3 *
4 * Author: Jorge Eduardo Candelaria <x0107209@ti.com>
5 * Copyright (C) 2009 - Texas Instruments, Inc.
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 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
19 * 02110-1301 USA
20 *
21 */
22
23#include <linux/module.h>
24#include <linux/init.h>
25#include <linux/device.h>
26#include <linux/platform_device.h>
27#include <linux/wait.h>
28#include <linux/slab.h>
29#include <linux/interrupt.h>
30#include <linux/err.h>
31#include <linux/clk.h>
32#include <linux/delay.h>
33#include <linux/io.h>
34#include <linux/irq.h>
35
36#include "mcpdm.h"
37
38static struct omap_mcpdm *mcpdm;
39
40static inline void omap_mcpdm_write(u16 reg, u32 val)
41{
42 __raw_writel(val, mcpdm->io_base + reg);
43}
44
45static inline int omap_mcpdm_read(u16 reg)
46{
47 return __raw_readl(mcpdm->io_base + reg);
48}
49
50static void omap_mcpdm_reg_dump(void)
51{
52 dev_dbg(mcpdm->dev, "***********************\n");
53 dev_dbg(mcpdm->dev, "IRQSTATUS_RAW: 0x%04x\n",
54 omap_mcpdm_read(MCPDM_IRQSTATUS_RAW));
55 dev_dbg(mcpdm->dev, "IRQSTATUS: 0x%04x\n",
56 omap_mcpdm_read(MCPDM_IRQSTATUS));
57 dev_dbg(mcpdm->dev, "IRQENABLE_SET: 0x%04x\n",
58 omap_mcpdm_read(MCPDM_IRQENABLE_SET));
59 dev_dbg(mcpdm->dev, "IRQENABLE_CLR: 0x%04x\n",
60 omap_mcpdm_read(MCPDM_IRQENABLE_CLR));
61 dev_dbg(mcpdm->dev, "IRQWAKE_EN: 0x%04x\n",
62 omap_mcpdm_read(MCPDM_IRQWAKE_EN));
63 dev_dbg(mcpdm->dev, "DMAENABLE_SET: 0x%04x\n",
64 omap_mcpdm_read(MCPDM_DMAENABLE_SET));
65 dev_dbg(mcpdm->dev, "DMAENABLE_CLR: 0x%04x\n",
66 omap_mcpdm_read(MCPDM_DMAENABLE_CLR));
67 dev_dbg(mcpdm->dev, "DMAWAKEEN: 0x%04x\n",
68 omap_mcpdm_read(MCPDM_DMAWAKEEN));
69 dev_dbg(mcpdm->dev, "CTRL: 0x%04x\n",
70 omap_mcpdm_read(MCPDM_CTRL));
71 dev_dbg(mcpdm->dev, "DN_DATA: 0x%04x\n",
72 omap_mcpdm_read(MCPDM_DN_DATA));
73 dev_dbg(mcpdm->dev, "UP_DATA: 0x%04x\n",
74 omap_mcpdm_read(MCPDM_UP_DATA));
75 dev_dbg(mcpdm->dev, "FIFO_CTRL_DN: 0x%04x\n",
76 omap_mcpdm_read(MCPDM_FIFO_CTRL_DN));
77 dev_dbg(mcpdm->dev, "FIFO_CTRL_UP: 0x%04x\n",
78 omap_mcpdm_read(MCPDM_FIFO_CTRL_UP));
79 dev_dbg(mcpdm->dev, "DN_OFFSET: 0x%04x\n",
80 omap_mcpdm_read(MCPDM_DN_OFFSET));
81 dev_dbg(mcpdm->dev, "***********************\n");
82}
83
84/*
85 * Takes the McPDM module in and out of reset state.
86 * Uplink and downlink can be reset individually.
87 */
88static void omap_mcpdm_reset_capture(int reset)
89{
90 int ctrl = omap_mcpdm_read(MCPDM_CTRL);
91
92 if (reset)
93 ctrl |= SW_UP_RST;
94 else
95 ctrl &= ~SW_UP_RST;
96
97 omap_mcpdm_write(MCPDM_CTRL, ctrl);
98}
99
100static void omap_mcpdm_reset_playback(int reset)
101{
102 int ctrl = omap_mcpdm_read(MCPDM_CTRL);
103
104 if (reset)
105 ctrl |= SW_DN_RST;
106 else
107 ctrl &= ~SW_DN_RST;
108
109 omap_mcpdm_write(MCPDM_CTRL, ctrl);
110}
111
112/*
113 * Enables the transfer through the PDM interface to/from the Phoenix
114 * codec by enabling the corresponding UP or DN channels.
115 */
116void omap_mcpdm_start(int stream)
117{
118 int ctrl = omap_mcpdm_read(MCPDM_CTRL);
119
120 if (stream)
121 ctrl |= mcpdm->up_channels;
122 else
123 ctrl |= mcpdm->dn_channels;
124
125 omap_mcpdm_write(MCPDM_CTRL, ctrl);
126}
127
128/*
129 * Disables the transfer through the PDM interface to/from the Phoenix
130 * codec by disabling the corresponding UP or DN channels.
131 */
132void omap_mcpdm_stop(int stream)
133{
134 int ctrl = omap_mcpdm_read(MCPDM_CTRL);
135
136 if (stream)
137 ctrl &= ~mcpdm->up_channels;
138 else
139 ctrl &= ~mcpdm->dn_channels;
140
141 omap_mcpdm_write(MCPDM_CTRL, ctrl);
142}
143
144/*
145 * Configures McPDM uplink for audio recording.
146 * This function should be called before omap_mcpdm_start.
147 */
148int omap_mcpdm_capture_open(struct omap_mcpdm_link *uplink)
149{
150 int irq_mask = 0;
151 int ctrl;
152
153 if (!uplink)
154 return -EINVAL;
155
156 mcpdm->uplink = uplink;
157
158 /* Enable irq request generation */
159 irq_mask |= uplink->irq_mask & MCPDM_UPLINK_IRQ_MASK;
160 omap_mcpdm_write(MCPDM_IRQENABLE_SET, irq_mask);
161
162 /* Configure uplink threshold */
163 if (uplink->threshold > UP_THRES_MAX)
164 uplink->threshold = UP_THRES_MAX;
165
166 omap_mcpdm_write(MCPDM_FIFO_CTRL_UP, uplink->threshold);
167
168 /* Configure DMA controller */
169 omap_mcpdm_write(MCPDM_DMAENABLE_SET, DMA_UP_ENABLE);
170
171 /* Set pdm out format */
172 ctrl = omap_mcpdm_read(MCPDM_CTRL);
173 ctrl &= ~PDMOUTFORMAT;
174 ctrl |= uplink->format & PDMOUTFORMAT;
175
176 /* Uplink channels */
177 mcpdm->up_channels = uplink->channels & (PDM_UP_MASK | PDM_STATUS_MASK);
178
179 omap_mcpdm_write(MCPDM_CTRL, ctrl);
180
181 return 0;
182}
183
184/*
185 * Configures McPDM downlink for audio playback.
186 * This function should be called before omap_mcpdm_start.
187 */
188int omap_mcpdm_playback_open(struct omap_mcpdm_link *downlink)
189{
190 int irq_mask = 0;
191 int ctrl;
192
193 if (!downlink)
194 return -EINVAL;
195
196 mcpdm->downlink = downlink;
197
198 /* Enable irq request generation */
199 irq_mask |= downlink->irq_mask & MCPDM_DOWNLINK_IRQ_MASK;
200 omap_mcpdm_write(MCPDM_IRQENABLE_SET, irq_mask);
201
202 /* Configure uplink threshold */
203 if (downlink->threshold > DN_THRES_MAX)
204 downlink->threshold = DN_THRES_MAX;
205
206 omap_mcpdm_write(MCPDM_FIFO_CTRL_DN, downlink->threshold);
207
208 /* Enable DMA request generation */
209 omap_mcpdm_write(MCPDM_DMAENABLE_SET, DMA_DN_ENABLE);
210
211 /* Set pdm out format */
212 ctrl = omap_mcpdm_read(MCPDM_CTRL);
213 ctrl &= ~PDMOUTFORMAT;
214 ctrl |= downlink->format & PDMOUTFORMAT;
215
216 /* Downlink channels */
217 mcpdm->dn_channels = downlink->channels & (PDM_DN_MASK | PDM_CMD_MASK);
218
219 omap_mcpdm_write(MCPDM_CTRL, ctrl);
220
221 return 0;
222}
223
224/*
225 * Cleans McPDM uplink configuration.
226 * This function should be called when the stream is closed.
227 */
228int omap_mcpdm_capture_close(struct omap_mcpdm_link *uplink)
229{
230 int irq_mask = 0;
231
232 if (!uplink)
233 return -EINVAL;
234
235 /* Disable irq request generation */
236 irq_mask |= uplink->irq_mask & MCPDM_UPLINK_IRQ_MASK;
237 omap_mcpdm_write(MCPDM_IRQENABLE_CLR, irq_mask);
238
239 /* Disable DMA request generation */
240 omap_mcpdm_write(MCPDM_DMAENABLE_CLR, DMA_UP_ENABLE);
241
242 /* Clear Downlink channels */
243 mcpdm->up_channels = 0;
244
245 mcpdm->uplink = NULL;
246
247 return 0;
248}
249
250/*
251 * Cleans McPDM downlink configuration.
252 * This function should be called when the stream is closed.
253 */
254int omap_mcpdm_playback_close(struct omap_mcpdm_link *downlink)
255{
256 int irq_mask = 0;
257
258 if (!downlink)
259 return -EINVAL;
260
261 /* Disable irq request generation */
262 irq_mask |= downlink->irq_mask & MCPDM_DOWNLINK_IRQ_MASK;
263 omap_mcpdm_write(MCPDM_IRQENABLE_CLR, irq_mask);
264
265 /* Disable DMA request generation */
266 omap_mcpdm_write(MCPDM_DMAENABLE_CLR, DMA_DN_ENABLE);
267
268 /* clear Downlink channels */
269 mcpdm->dn_channels = 0;
270
271 mcpdm->downlink = NULL;
272
273 return 0;
274}
275
276static irqreturn_t omap_mcpdm_irq_handler(int irq, void *dev_id)
277{
278 struct omap_mcpdm *mcpdm_irq = dev_id;
279 int irq_status;
280
281 irq_status = omap_mcpdm_read(MCPDM_IRQSTATUS);
282
283 /* Acknowledge irq event */
284 omap_mcpdm_write(MCPDM_IRQSTATUS, irq_status);
285
286 if (irq & MCPDM_DN_IRQ_FULL) {
287 dev_err(mcpdm_irq->dev, "DN FIFO error %x\n", irq_status);
288 omap_mcpdm_reset_playback(1);
289 omap_mcpdm_playback_open(mcpdm_irq->downlink);
290 omap_mcpdm_reset_playback(0);
291 }
292
293 if (irq & MCPDM_DN_IRQ_EMPTY) {
294 dev_err(mcpdm_irq->dev, "DN FIFO error %x\n", irq_status);
295 omap_mcpdm_reset_playback(1);
296 omap_mcpdm_playback_open(mcpdm_irq->downlink);
297 omap_mcpdm_reset_playback(0);
298 }
299
300 if (irq & MCPDM_DN_IRQ) {
301 dev_dbg(mcpdm_irq->dev, "DN write request\n");
302 }
303
304 if (irq & MCPDM_UP_IRQ_FULL) {
305 dev_err(mcpdm_irq->dev, "UP FIFO error %x\n", irq_status);
306 omap_mcpdm_reset_capture(1);
307 omap_mcpdm_capture_open(mcpdm_irq->uplink);
308 omap_mcpdm_reset_capture(0);
309 }
310
311 if (irq & MCPDM_UP_IRQ_EMPTY) {
312 dev_err(mcpdm_irq->dev, "UP FIFO error %x\n", irq_status);
313 omap_mcpdm_reset_capture(1);
314 omap_mcpdm_capture_open(mcpdm_irq->uplink);
315 omap_mcpdm_reset_capture(0);
316 }
317
318 if (irq & MCPDM_UP_IRQ) {
319 dev_dbg(mcpdm_irq->dev, "UP write request\n");
320 }
321
322 return IRQ_HANDLED;
323}
324
325int omap_mcpdm_request(void)
326{
327 int ret;
328
329 clk_enable(mcpdm->clk);
330
331 spin_lock(&mcpdm->lock);
332
333 if (!mcpdm->free) {
334 dev_err(mcpdm->dev, "McPDM interface is in use\n");
335 spin_unlock(&mcpdm->lock);
336 ret = -EBUSY;
337 goto err;
338 }
339 mcpdm->free = 0;
340
341 spin_unlock(&mcpdm->lock);
342
343 /* Disable lines while request is ongoing */
344 omap_mcpdm_write(MCPDM_CTRL, 0x00);
345
346 ret = request_irq(mcpdm->irq, omap_mcpdm_irq_handler,
347 0, "McPDM", (void *)mcpdm);
348 if (ret) {
349 dev_err(mcpdm->dev, "Request for McPDM IRQ failed\n");
350 goto err;
351 }
352
353 return 0;
354
355err:
356 clk_disable(mcpdm->clk);
357 return ret;
358}
359
360void omap_mcpdm_free(void)
361{
362 spin_lock(&mcpdm->lock);
363 if (mcpdm->free) {
364 dev_err(mcpdm->dev, "McPDM interface is already free\n");
365 spin_unlock(&mcpdm->lock);
366 return;
367 }
368 mcpdm->free = 1;
369 spin_unlock(&mcpdm->lock);
370
371 clk_disable(mcpdm->clk);
372
373 free_irq(mcpdm->irq, (void *)mcpdm);
374}
375
376/* Enable/disable DC offset cancelation for the analog
377 * headset path (PDM channels 1 and 2).
378 */
379int omap_mcpdm_set_offset(int offset1, int offset2)
380{
381 int offset;
382
383 if ((offset1 > DN_OFST_MAX) || (offset2 > DN_OFST_MAX))
384 return -EINVAL;
385
386 offset = (offset1 << DN_OFST_RX1) | (offset2 << DN_OFST_RX2);
387
388 /* offset cancellation for channel 1 */
389 if (offset1)
390 offset |= DN_OFST_RX1_EN;
391 else
392 offset &= ~DN_OFST_RX1_EN;
393
394 /* offset cancellation for channel 2 */
395 if (offset2)
396 offset |= DN_OFST_RX2_EN;
397 else
398 offset &= ~DN_OFST_RX2_EN;
399
400 omap_mcpdm_write(MCPDM_DN_OFFSET, offset);
401
402 return 0;
403}
404
405int __devinit omap_mcpdm_probe(struct platform_device *pdev)
406{
407 struct resource *res;
408 int ret = 0;
409
410 mcpdm = kzalloc(sizeof(struct omap_mcpdm), GFP_KERNEL);
411 if (!mcpdm) {
412 ret = -ENOMEM;
413 goto exit;
414 }
415
416 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
417 if (res == NULL) {
418 dev_err(&pdev->dev, "no resource\n");
419 goto err_resource;
420 }
421
422 spin_lock_init(&mcpdm->lock);
423 mcpdm->free = 1;
424 mcpdm->io_base = ioremap(res->start, resource_size(res));
425 if (!mcpdm->io_base) {
426 ret = -ENOMEM;
427 goto err_resource;
428 }
429
430 mcpdm->irq = platform_get_irq(pdev, 0);
431
432 mcpdm->clk = clk_get(&pdev->dev, "pdm_ck");
433 if (IS_ERR(mcpdm->clk)) {
434 ret = PTR_ERR(mcpdm->clk);
435 dev_err(&pdev->dev, "unable to get pdm_ck: %d\n", ret);
436 goto err_clk;
437 }
438
439 mcpdm->dev = &pdev->dev;
440 platform_set_drvdata(pdev, mcpdm);
441
442 return 0;
443
444err_clk:
445 iounmap(mcpdm->io_base);
446err_resource:
447 kfree(mcpdm);
448exit:
449 return ret;
450}
451
452int omap_mcpdm_remove(struct platform_device *pdev)
453{
454 struct omap_mcpdm *mcpdm_ptr = platform_get_drvdata(pdev);
455
456 platform_set_drvdata(pdev, NULL);
457
458 clk_put(mcpdm_ptr->clk);
459
460 iounmap(mcpdm_ptr->io_base);
461
462 mcpdm_ptr->clk = NULL;
463 mcpdm_ptr->free = 0;
464 mcpdm_ptr->dev = NULL;
465
466 kfree(mcpdm_ptr);
467
468 return 0;
469}
470
diff --git a/sound/soc/omap/mcpdm.h b/sound/soc/omap/mcpdm.h
new file mode 100644
index 00000000000..20c20a8649f
--- /dev/null
+++ b/sound/soc/omap/mcpdm.h
@@ -0,0 +1,153 @@
1/*
2 * mcpdm.h -- Defines for McPDM driver
3 *
4 * Author: Jorge Eduardo Candelaria <x0107209@ti.com>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * version 2 as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18 * 02110-1301 USA
19 *
20 */
21
22/* McPDM registers */
23
24#define MCPDM_REVISION 0x00
25#define MCPDM_SYSCONFIG 0x10
26#define MCPDM_IRQSTATUS_RAW 0x24
27#define MCPDM_IRQSTATUS 0x28
28#define MCPDM_IRQENABLE_SET 0x2C
29#define MCPDM_IRQENABLE_CLR 0x30
30#define MCPDM_IRQWAKE_EN 0x34
31#define MCPDM_DMAENABLE_SET 0x38
32#define MCPDM_DMAENABLE_CLR 0x3C
33#define MCPDM_DMAWAKEEN 0x40
34#define MCPDM_CTRL 0x44
35#define MCPDM_DN_DATA 0x48
36#define MCPDM_UP_DATA 0x4C
37#define MCPDM_FIFO_CTRL_DN 0x50
38#define MCPDM_FIFO_CTRL_UP 0x54
39#define MCPDM_DN_OFFSET 0x58
40
41/*
42 * MCPDM_IRQ bit fields
43 * IRQSTATUS_RAW, IRQSTATUS, IRQENABLE_SET, IRQENABLE_CLR
44 */
45
46#define MCPDM_DN_IRQ (1 << 0)
47#define MCPDM_DN_IRQ_EMPTY (1 << 1)
48#define MCPDM_DN_IRQ_ALMST_EMPTY (1 << 2)
49#define MCPDM_DN_IRQ_FULL (1 << 3)
50
51#define MCPDM_UP_IRQ (1 << 8)
52#define MCPDM_UP_IRQ_EMPTY (1 << 9)
53#define MCPDM_UP_IRQ_ALMST_FULL (1 << 10)
54#define MCPDM_UP_IRQ_FULL (1 << 11)
55
56#define MCPDM_DOWNLINK_IRQ_MASK 0x00F
57#define MCPDM_UPLINK_IRQ_MASK 0xF00
58
59/*
60 * MCPDM_DMAENABLE bit fields
61 */
62
63#define DMA_DN_ENABLE 0x1
64#define DMA_UP_ENABLE 0x2
65
66/*
67 * MCPDM_CTRL bit fields
68 */
69
70#define PDM_UP1_EN 0x0001
71#define PDM_UP2_EN 0x0002
72#define PDM_UP3_EN 0x0004
73#define PDM_DN1_EN 0x0008
74#define PDM_DN2_EN 0x0010
75#define PDM_DN3_EN 0x0020
76#define PDM_DN4_EN 0x0040
77#define PDM_DN5_EN 0x0080
78#define PDMOUTFORMAT 0x0100
79#define CMD_INT 0x0200
80#define STATUS_INT 0x0400
81#define SW_UP_RST 0x0800
82#define SW_DN_RST 0x1000
83#define PDM_UP_MASK 0x007
84#define PDM_DN_MASK 0x0F8
85#define PDM_CMD_MASK 0x200
86#define PDM_STATUS_MASK 0x400
87
88
89#define PDMOUTFORMAT_LJUST (0 << 8)
90#define PDMOUTFORMAT_RJUST (1 << 8)
91
92/*
93 * MCPDM_FIFO_CTRL bit fields
94 */
95
96#define UP_THRES_MAX 0xF
97#define DN_THRES_MAX 0xF
98
99/*
100 * MCPDM_DN_OFFSET bit fields
101 */
102
103#define DN_OFST_RX1_EN 0x0001
104#define DN_OFST_RX2_EN 0x0100
105
106#define DN_OFST_RX1 1
107#define DN_OFST_RX2 9
108#define DN_OFST_MAX 0x1F
109
110#define MCPDM_UPLINK 1
111#define MCPDM_DOWNLINK 2
112
113struct omap_mcpdm_link {
114 int irq_mask;
115 int threshold;
116 int format;
117 int channels;
118};
119
120struct omap_mcpdm_platform_data {
121 unsigned long phys_base;
122 u16 irq;
123};
124
125struct omap_mcpdm {
126 struct device *dev;
127 unsigned long phys_base;
128 void __iomem *io_base;
129 u8 free;
130 int irq;
131
132 spinlock_t lock;
133 struct omap_mcpdm_platform_data *pdata;
134 struct clk *clk;
135 struct omap_mcpdm_link *downlink;
136 struct omap_mcpdm_link *uplink;
137 struct completion irq_completion;
138
139 int dn_channels;
140 int up_channels;
141};
142
143extern void omap_mcpdm_start(int stream);
144extern void omap_mcpdm_stop(int stream);
145extern int omap_mcpdm_capture_open(struct omap_mcpdm_link *uplink);
146extern int omap_mcpdm_playback_open(struct omap_mcpdm_link *downlink);
147extern int omap_mcpdm_capture_close(struct omap_mcpdm_link *uplink);
148extern int omap_mcpdm_playback_close(struct omap_mcpdm_link *downlink);
149extern int omap_mcpdm_request(void);
150extern void omap_mcpdm_free(void);
151extern int omap_mcpdm_set_offset(int offset1, int offset2);
152int __devinit omap_mcpdm_probe(struct platform_device *pdev);
153int omap_mcpdm_remove(struct platform_device *pdev);
diff --git a/sound/soc/omap/omap3beagle.c b/sound/soc/omap/omap3beagle.c
new file mode 100644
index 00000000000..40db813c079
--- /dev/null
+++ b/sound/soc/omap/omap3beagle.c
@@ -0,0 +1,149 @@
1/*
2 * omap3beagle.c -- SoC audio for OMAP3 Beagle
3 *
4 * Author: Steve Sakoman <steve@sakoman.com>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * version 2 as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18 * 02110-1301 USA
19 *
20 */
21
22#include <linux/clk.h>
23#include <linux/platform_device.h>
24#include <sound/core.h>
25#include <sound/pcm.h>
26#include <sound/soc.h>
27
28#include <asm/mach-types.h>
29#include <mach/hardware.h>
30#include <mach/gpio.h>
31#include <plat/mcbsp.h>
32
33#include "omap-mcbsp.h"
34#include "omap-pcm.h"
35
36static int omap3beagle_hw_params(struct snd_pcm_substream *substream,
37 struct snd_pcm_hw_params *params)
38{
39 struct snd_soc_pcm_runtime *rtd = substream->private_data;
40 struct snd_soc_dai *codec_dai = rtd->codec_dai;
41 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
42 unsigned int fmt;
43 int ret;
44
45 switch (params_channels(params)) {
46 case 2: /* Stereo I2S mode */
47 fmt = SND_SOC_DAIFMT_I2S |
48 SND_SOC_DAIFMT_NB_NF |
49 SND_SOC_DAIFMT_CBM_CFM;
50 break;
51 case 4: /* Four channel TDM mode */
52 fmt = SND_SOC_DAIFMT_DSP_A |
53 SND_SOC_DAIFMT_IB_NF |
54 SND_SOC_DAIFMT_CBM_CFM;
55 break;
56 default:
57 return -EINVAL;
58 }
59
60 /* Set codec DAI configuration */
61 ret = snd_soc_dai_set_fmt(codec_dai, fmt);
62 if (ret < 0) {
63 printk(KERN_ERR "can't set codec DAI configuration\n");
64 return ret;
65 }
66
67 /* Set cpu DAI configuration */
68 ret = snd_soc_dai_set_fmt(cpu_dai, fmt);
69 if (ret < 0) {
70 printk(KERN_ERR "can't set cpu DAI configuration\n");
71 return ret;
72 }
73
74 /* Set the codec system clock for DAC and ADC */
75 ret = snd_soc_dai_set_sysclk(codec_dai, 0, 26000000,
76 SND_SOC_CLOCK_IN);
77 if (ret < 0) {
78 printk(KERN_ERR "can't set codec system clock\n");
79 return ret;
80 }
81
82 return 0;
83}
84
85static struct snd_soc_ops omap3beagle_ops = {
86 .hw_params = omap3beagle_hw_params,
87};
88
89/* Digital audio interface glue - connects codec <--> CPU */
90static struct snd_soc_dai_link omap3beagle_dai = {
91 .name = "TWL4030",
92 .stream_name = "TWL4030",
93 .cpu_dai_name = "omap-mcbsp-dai.1",
94 .platform_name = "omap-pcm-audio",
95 .codec_dai_name = "twl4030-hifi",
96 .codec_name = "twl4030-codec",
97 .ops = &omap3beagle_ops,
98};
99
100/* Audio machine driver */
101static struct snd_soc_card snd_soc_omap3beagle = {
102 .name = "omap3beagle",
103 .owner = THIS_MODULE,
104 .dai_link = &omap3beagle_dai,
105 .num_links = 1,
106};
107
108static struct platform_device *omap3beagle_snd_device;
109
110static int __init omap3beagle_soc_init(void)
111{
112 int ret;
113
114 if (!(machine_is_omap3_beagle() || machine_is_devkit8000()))
115 return -ENODEV;
116 pr_info("OMAP3 Beagle/Devkit8000 SoC init\n");
117
118 omap3beagle_snd_device = platform_device_alloc("soc-audio", -1);
119 if (!omap3beagle_snd_device) {
120 printk(KERN_ERR "Platform device allocation failed\n");
121 return -ENOMEM;
122 }
123
124 platform_set_drvdata(omap3beagle_snd_device, &snd_soc_omap3beagle);
125
126 ret = platform_device_add(omap3beagle_snd_device);
127 if (ret)
128 goto err1;
129
130 return 0;
131
132err1:
133 printk(KERN_ERR "Unable to add platform device\n");
134 platform_device_put(omap3beagle_snd_device);
135
136 return ret;
137}
138
139static void __exit omap3beagle_soc_exit(void)
140{
141 platform_device_unregister(omap3beagle_snd_device);
142}
143
144module_init(omap3beagle_soc_init);
145module_exit(omap3beagle_soc_exit);
146
147MODULE_AUTHOR("Steve Sakoman <steve@sakoman.com>");
148MODULE_DESCRIPTION("ALSA SoC OMAP3 Beagle");
149MODULE_LICENSE("GPL");
diff --git a/sound/soc/omap/omap3evm.c b/sound/soc/omap/omap3evm.c
new file mode 100644
index 00000000000..0daa0446983
--- /dev/null
+++ b/sound/soc/omap/omap3evm.c
@@ -0,0 +1,135 @@
1/*
2 * omap3evm.c -- ALSA SoC support for OMAP3 EVM
3 *
4 * Author: Anuj Aggarwal <anuj.aggarwal@ti.com>
5 *
6 * Based on sound/soc/omap/beagle.c by Steve Sakoman
7 *
8 * Copyright (C) 2008 Texas Instruments, Incorporated
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation version 2.
13 *
14 * This program is distributed "as is" WITHOUT ANY WARRANTY of any kind,
15 * whether express or implied; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
18 */
19
20#include <linux/clk.h>
21#include <linux/platform_device.h>
22#include <sound/core.h>
23#include <sound/pcm.h>
24#include <sound/soc.h>
25
26#include <asm/mach-types.h>
27#include <mach/hardware.h>
28#include <mach/gpio.h>
29#include <plat/mcbsp.h>
30
31#include "omap-mcbsp.h"
32#include "omap-pcm.h"
33
34static int omap3evm_hw_params(struct snd_pcm_substream *substream,
35 struct snd_pcm_hw_params *params)
36{
37 struct snd_soc_pcm_runtime *rtd = substream->private_data;
38 struct snd_soc_dai *codec_dai = rtd->codec_dai;
39 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
40 int ret;
41
42 /* Set codec DAI configuration */
43 ret = snd_soc_dai_set_fmt(codec_dai,
44 SND_SOC_DAIFMT_I2S |
45 SND_SOC_DAIFMT_NB_NF |
46 SND_SOC_DAIFMT_CBM_CFM);
47 if (ret < 0) {
48 printk(KERN_ERR "Can't set codec DAI configuration\n");
49 return ret;
50 }
51
52 /* Set cpu DAI configuration */
53 ret = snd_soc_dai_set_fmt(cpu_dai,
54 SND_SOC_DAIFMT_I2S |
55 SND_SOC_DAIFMT_NB_NF |
56 SND_SOC_DAIFMT_CBM_CFM);
57 if (ret < 0) {
58 printk(KERN_ERR "Can't set cpu DAI configuration\n");
59 return ret;
60 }
61
62 /* Set the codec system clock for DAC and ADC */
63 ret = snd_soc_dai_set_sysclk(codec_dai, 0, 26000000,
64 SND_SOC_CLOCK_IN);
65 if (ret < 0) {
66 printk(KERN_ERR "Can't set codec system clock\n");
67 return ret;
68 }
69
70 return 0;
71}
72
73static struct snd_soc_ops omap3evm_ops = {
74 .hw_params = omap3evm_hw_params,
75};
76
77/* Digital audio interface glue - connects codec <--> CPU */
78static struct snd_soc_dai_link omap3evm_dai = {
79 .name = "TWL4030",
80 .stream_name = "TWL4030",
81 .cpu_dai_name = "omap-mcbsp-dai.1",
82 .codec_dai_name = "twl4030-hifi",
83 .platform_name = "omap-pcm-audio",
84 .codec_name = "twl4030-codec",
85 .ops = &omap3evm_ops,
86};
87
88/* Audio machine driver */
89static struct snd_soc_card snd_soc_omap3evm = {
90 .name = "omap3evm",
91 .dai_link = &omap3evm_dai,
92 .num_links = 1,
93};
94
95static struct platform_device *omap3evm_snd_device;
96
97static int __init omap3evm_soc_init(void)
98{
99 int ret;
100
101 if (!machine_is_omap3evm())
102 return -ENODEV;
103 pr_info("OMAP3 EVM SoC init\n");
104
105 omap3evm_snd_device = platform_device_alloc("soc-audio", -1);
106 if (!omap3evm_snd_device) {
107 printk(KERN_ERR "Platform device allocation failed\n");
108 return -ENOMEM;
109 }
110
111 platform_set_drvdata(omap3evm_snd_device, &snd_soc_omap3evm);
112 ret = platform_device_add(omap3evm_snd_device);
113 if (ret)
114 goto err1;
115
116 return 0;
117
118err1:
119 printk(KERN_ERR "Unable to add platform device\n");
120 platform_device_put(omap3evm_snd_device);
121
122 return ret;
123}
124
125static void __exit omap3evm_soc_exit(void)
126{
127 platform_device_unregister(omap3evm_snd_device);
128}
129
130module_init(omap3evm_soc_init);
131module_exit(omap3evm_soc_exit);
132
133MODULE_AUTHOR("Anuj Aggarwal <anuj.aggarwal@ti.com>");
134MODULE_DESCRIPTION("ALSA SoC OMAP3 EVM");
135MODULE_LICENSE("GPL v2");
diff --git a/sound/soc/omap/omap4-hdmi-card.c b/sound/soc/omap/omap4-hdmi-card.c
new file mode 100644
index 00000000000..9f32615b81f
--- /dev/null
+++ b/sound/soc/omap/omap4-hdmi-card.c
@@ -0,0 +1,129 @@
1/*
2 * omap4-hdmi-card.c
3 *
4 * OMAP ALSA SoC machine driver for TI OMAP4 HDMI
5 * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
6 * Author: Ricardo Neri <ricardo.neri@ti.com>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * version 2 as published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA
21 *
22 */
23
24#include <sound/pcm.h>
25#include <sound/soc.h>
26#include <asm/mach-types.h>
27#include <video/omapdss.h>
28
29#define DRV_NAME "omap4-hdmi-audio"
30
31static int omap4_hdmi_dai_hw_params(struct snd_pcm_substream *substream,
32 struct snd_pcm_hw_params *params)
33{
34 int i;
35 struct omap_overlay_manager *mgr = NULL;
36 struct device *dev = substream->pcm->card->dev;
37
38 /* Find DSS HDMI device */
39 for (i = 0; i < omap_dss_get_num_overlay_managers(); i++) {
40 mgr = omap_dss_get_overlay_manager(i);
41 if (mgr && mgr->device
42 && mgr->device->type == OMAP_DISPLAY_TYPE_HDMI)
43 break;
44 }
45
46 if (i == omap_dss_get_num_overlay_managers()) {
47 dev_err(dev, "HDMI display device not found!\n");
48 return -ENODEV;
49 }
50
51 /* Make sure HDMI is power-on to avoid L3 interconnect errors */
52 if (mgr->device->state != OMAP_DSS_DISPLAY_ACTIVE) {
53 dev_err(dev, "HDMI display is not active!\n");
54 return -EIO;
55 }
56
57 return 0;
58}
59
60static struct snd_soc_ops omap4_hdmi_dai_ops = {
61 .hw_params = omap4_hdmi_dai_hw_params,
62};
63
64static struct snd_soc_dai_link omap4_hdmi_dai = {
65 .name = "HDMI",
66 .stream_name = "HDMI",
67 .cpu_dai_name = "hdmi-audio-dai",
68 .platform_name = "omap-pcm-audio",
69 .codec_name = "omapdss_hdmi",
70 .codec_dai_name = "hdmi-audio-codec",
71 .ops = &omap4_hdmi_dai_ops,
72};
73
74static struct snd_soc_card snd_soc_omap4_hdmi = {
75 .name = "OMAP4HDMI",
76 .dai_link = &omap4_hdmi_dai,
77 .num_links = 1,
78};
79
80static __devinit int omap4_hdmi_probe(struct platform_device *pdev)
81{
82 struct snd_soc_card *card = &snd_soc_omap4_hdmi;
83 int ret;
84
85 card->dev = &pdev->dev;
86
87 ret = snd_soc_register_card(card);
88 if (ret) {
89 dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", ret);
90 card->dev = NULL;
91 return ret;
92 }
93 return 0;
94}
95
96static int __devexit omap4_hdmi_remove(struct platform_device *pdev)
97{
98 struct snd_soc_card *card = platform_get_drvdata(pdev);
99
100 snd_soc_unregister_card(card);
101 card->dev = NULL;
102 return 0;
103}
104
105static struct platform_driver omap4_hdmi_driver = {
106 .driver = {
107 .name = "omap4-hdmi-audio",
108 .owner = THIS_MODULE,
109 },
110 .probe = omap4_hdmi_probe,
111 .remove = __devexit_p(omap4_hdmi_remove),
112};
113
114static int __init omap4_hdmi_init(void)
115{
116 return platform_driver_register(&omap4_hdmi_driver);
117}
118module_init(omap4_hdmi_init);
119
120static void __exit omap4_hdmi_exit(void)
121{
122 platform_driver_unregister(&omap4_hdmi_driver);
123}
124module_exit(omap4_hdmi_exit);
125
126MODULE_AUTHOR("Ricardo Neri <ricardo.neri@ti.com>");
127MODULE_DESCRIPTION("OMAP4 HDMI machine ASoC driver");
128MODULE_LICENSE("GPL");
129MODULE_ALIAS("platform:" DRV_NAME);
diff --git a/sound/soc/omap/overo.c b/sound/soc/omap/overo.c
new file mode 100644
index 00000000000..bbcf380bfb5
--- /dev/null
+++ b/sound/soc/omap/overo.c
@@ -0,0 +1,139 @@
1/*
2 * overo.c -- SoC audio for Gumstix Overo
3 *
4 * Author: Steve Sakoman <steve@sakoman.com>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * version 2 as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18 * 02110-1301 USA
19 *
20 */
21
22#include <linux/clk.h>
23#include <linux/platform_device.h>
24#include <sound/core.h>
25#include <sound/pcm.h>
26#include <sound/soc.h>
27
28#include <asm/mach-types.h>
29#include <mach/hardware.h>
30#include <mach/gpio.h>
31#include <plat/mcbsp.h>
32
33#include "omap-mcbsp.h"
34#include "omap-pcm.h"
35
36static int overo_hw_params(struct snd_pcm_substream *substream,
37 struct snd_pcm_hw_params *params)
38{
39 struct snd_soc_pcm_runtime *rtd = substream->private_data;
40 struct snd_soc_dai *codec_dai = rtd->codec_dai;
41 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
42 int ret;
43
44 /* Set codec DAI configuration */
45 ret = snd_soc_dai_set_fmt(codec_dai,
46 SND_SOC_DAIFMT_I2S |
47 SND_SOC_DAIFMT_NB_NF |
48 SND_SOC_DAIFMT_CBM_CFM);
49 if (ret < 0) {
50 printk(KERN_ERR "can't set codec DAI configuration\n");
51 return ret;
52 }
53
54 /* Set cpu DAI configuration */
55 ret = snd_soc_dai_set_fmt(cpu_dai,
56 SND_SOC_DAIFMT_I2S |
57 SND_SOC_DAIFMT_NB_NF |
58 SND_SOC_DAIFMT_CBM_CFM);
59 if (ret < 0) {
60 printk(KERN_ERR "can't set cpu DAI configuration\n");
61 return ret;
62 }
63
64 /* Set the codec system clock for DAC and ADC */
65 ret = snd_soc_dai_set_sysclk(codec_dai, 0, 26000000,
66 SND_SOC_CLOCK_IN);
67 if (ret < 0) {
68 printk(KERN_ERR "can't set codec system clock\n");
69 return ret;
70 }
71
72 return 0;
73}
74
75static struct snd_soc_ops overo_ops = {
76 .hw_params = overo_hw_params,
77};
78
79/* Digital audio interface glue - connects codec <--> CPU */
80static struct snd_soc_dai_link overo_dai = {
81 .name = "TWL4030",
82 .stream_name = "TWL4030",
83 .cpu_dai_name = "omap-mcbsp-dai.1",
84 .codec_dai_name = "twl4030-hifi",
85 .platform_name = "omap-pcm-audio",
86 .codec_name = "twl4030-codec",
87 .ops = &overo_ops,
88};
89
90/* Audio machine driver */
91static struct snd_soc_card snd_soc_card_overo = {
92 .name = "overo",
93 .dai_link = &overo_dai,
94 .num_links = 1,
95};
96
97static struct platform_device *overo_snd_device;
98
99static int __init overo_soc_init(void)
100{
101 int ret;
102
103 if (!(machine_is_overo() || machine_is_cm_t35())) {
104 pr_debug("Incomatible machine!\n");
105 return -ENODEV;
106 }
107 printk(KERN_INFO "overo SoC init\n");
108
109 overo_snd_device = platform_device_alloc("soc-audio", -1);
110 if (!overo_snd_device) {
111 printk(KERN_ERR "Platform device allocation failed\n");
112 return -ENOMEM;
113 }
114
115 platform_set_drvdata(overo_snd_device, &snd_soc_card_overo);
116
117 ret = platform_device_add(overo_snd_device);
118 if (ret)
119 goto err1;
120
121 return 0;
122
123err1:
124 printk(KERN_ERR "Unable to add platform device\n");
125 platform_device_put(overo_snd_device);
126
127 return ret;
128}
129module_init(overo_soc_init);
130
131static void __exit overo_soc_exit(void)
132{
133 platform_device_unregister(overo_snd_device);
134}
135module_exit(overo_soc_exit);
136
137MODULE_AUTHOR("Steve Sakoman <steve@sakoman.com>");
138MODULE_DESCRIPTION("ALSA SoC overo");
139MODULE_LICENSE("GPL");
diff --git a/sound/soc/omap/sdp4430.c b/sound/soc/omap/sdp4430.c
new file mode 100644
index 00000000000..b80efb02bfc
--- /dev/null
+++ b/sound/soc/omap/sdp4430.c
@@ -0,0 +1,223 @@
1/*
2 * sdp4430.c -- SoC audio for TI OMAP4430 SDP
3 *
4 * Author: Misael Lopez Cruz <x0052729@ti.com>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * version 2 as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18 * 02110-1301 USA
19 *
20 */
21
22#include <linux/clk.h>
23#include <linux/platform_device.h>
24#include <linux/mfd/twl6040.h>
25
26#include <sound/core.h>
27#include <sound/pcm.h>
28#include <sound/soc.h>
29#include <sound/jack.h>
30
31#include <asm/mach-types.h>
32#include <plat/hardware.h>
33#include <plat/mux.h>
34
35#include "mcpdm.h"
36#include "omap-pcm.h"
37#include "../codecs/twl6040.h"
38
39static int sdp4430_hw_params(struct snd_pcm_substream *substream,
40 struct snd_pcm_hw_params *params)
41{
42 struct snd_soc_pcm_runtime *rtd = substream->private_data;
43 struct snd_soc_dai *codec_dai = rtd->codec_dai;
44 int clk_id, freq;
45 int ret;
46
47 clk_id = twl6040_get_clk_id(rtd->codec);
48 if (clk_id == TWL6040_SYSCLK_SEL_HPPLL)
49 freq = 38400000;
50 else if (clk_id == TWL6040_SYSCLK_SEL_LPPLL)
51 freq = 32768;
52 else
53 return -EINVAL;
54
55 /* set the codec mclk */
56 ret = snd_soc_dai_set_sysclk(codec_dai, clk_id, freq,
57 SND_SOC_CLOCK_IN);
58 if (ret) {
59 printk(KERN_ERR "can't set codec system clock\n");
60 return ret;
61 }
62 return ret;
63}
64
65static struct snd_soc_ops sdp4430_ops = {
66 .hw_params = sdp4430_hw_params,
67};
68
69/* Headset jack */
70static struct snd_soc_jack hs_jack;
71
72/*Headset jack detection DAPM pins */
73static struct snd_soc_jack_pin hs_jack_pins[] = {
74 {
75 .pin = "Headset Mic",
76 .mask = SND_JACK_MICROPHONE,
77 },
78 {
79 .pin = "Headset Stereophone",
80 .mask = SND_JACK_HEADPHONE,
81 },
82};
83
84/* SDP4430 machine DAPM */
85static const struct snd_soc_dapm_widget sdp4430_twl6040_dapm_widgets[] = {
86 SND_SOC_DAPM_MIC("Ext Mic", NULL),
87 SND_SOC_DAPM_SPK("Ext Spk", NULL),
88 SND_SOC_DAPM_MIC("Headset Mic", NULL),
89 SND_SOC_DAPM_HP("Headset Stereophone", NULL),
90 SND_SOC_DAPM_SPK("Earphone Spk", NULL),
91 SND_SOC_DAPM_INPUT("Aux/FM Stereo In"),
92};
93
94static const struct snd_soc_dapm_route audio_map[] = {
95 /* External Mics: MAINMIC, SUBMIC with bias*/
96 {"MAINMIC", NULL, "Main Mic Bias"},
97 {"SUBMIC", NULL, "Main Mic Bias"},
98 {"Main Mic Bias", NULL, "Ext Mic"},
99
100 /* External Speakers: HFL, HFR */
101 {"Ext Spk", NULL, "HFL"},
102 {"Ext Spk", NULL, "HFR"},
103
104 /* Headset Mic: HSMIC with bias */
105 {"HSMIC", NULL, "Headset Mic Bias"},
106 {"Headset Mic Bias", NULL, "Headset Mic"},
107
108 /* Headset Stereophone (Headphone): HSOL, HSOR */
109 {"Headset Stereophone", NULL, "HSOL"},
110 {"Headset Stereophone", NULL, "HSOR"},
111
112 /* Earphone speaker */
113 {"Earphone Spk", NULL, "EP"},
114
115 /* Aux/FM Stereo In: AFML, AFMR */
116 {"AFML", NULL, "Aux/FM Stereo In"},
117 {"AFMR", NULL, "Aux/FM Stereo In"},
118};
119
120static int sdp4430_twl6040_init(struct snd_soc_pcm_runtime *rtd)
121{
122 struct snd_soc_codec *codec = rtd->codec;
123 struct snd_soc_dapm_context *dapm = &codec->dapm;
124 int ret;
125
126 /* Add SDP4430 specific widgets */
127 ret = snd_soc_dapm_new_controls(dapm, sdp4430_twl6040_dapm_widgets,
128 ARRAY_SIZE(sdp4430_twl6040_dapm_widgets));
129 if (ret)
130 return ret;
131
132 /* Set up SDP4430 specific audio path audio_map */
133 snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
134
135 /* SDP4430 connected pins */
136 snd_soc_dapm_enable_pin(dapm, "Ext Mic");
137 snd_soc_dapm_enable_pin(dapm, "Ext Spk");
138 snd_soc_dapm_enable_pin(dapm, "AFML");
139 snd_soc_dapm_enable_pin(dapm, "AFMR");
140 snd_soc_dapm_enable_pin(dapm, "Headset Mic");
141 snd_soc_dapm_enable_pin(dapm, "Headset Stereophone");
142
143 ret = snd_soc_dapm_sync(dapm);
144 if (ret)
145 return ret;
146
147 /* Headset jack detection */
148 ret = snd_soc_jack_new(codec, "Headset Jack",
149 SND_JACK_HEADSET, &hs_jack);
150 if (ret)
151 return ret;
152
153 ret = snd_soc_jack_add_pins(&hs_jack, ARRAY_SIZE(hs_jack_pins),
154 hs_jack_pins);
155
156 if (machine_is_omap_4430sdp())
157 twl6040_hs_jack_detect(codec, &hs_jack, SND_JACK_HEADSET);
158 else
159 snd_soc_jack_report(&hs_jack, SND_JACK_HEADSET, SND_JACK_HEADSET);
160
161 return ret;
162}
163
164/* Digital audio interface glue - connects codec <--> CPU */
165static struct snd_soc_dai_link sdp4430_dai = {
166 .name = "TWL6040",
167 .stream_name = "TWL6040",
168 .cpu_dai_name ="omap-mcpdm-dai",
169 .codec_dai_name = "twl6040-hifi",
170 .platform_name = "omap-pcm-audio",
171 .codec_name = "twl6040-codec",
172 .init = sdp4430_twl6040_init,
173 .ops = &sdp4430_ops,
174};
175
176/* Audio machine driver */
177static struct snd_soc_card snd_soc_sdp4430 = {
178 .name = "SDP4430",
179 .dai_link = &sdp4430_dai,
180 .num_links = 1,
181};
182
183static struct platform_device *sdp4430_snd_device;
184
185static int __init sdp4430_soc_init(void)
186{
187 int ret;
188
189 if (!machine_is_omap_4430sdp())
190 return -ENODEV;
191 printk(KERN_INFO "SDP4430 SoC init\n");
192
193 sdp4430_snd_device = platform_device_alloc("soc-audio", -1);
194 if (!sdp4430_snd_device) {
195 printk(KERN_ERR "Platform device allocation failed\n");
196 return -ENOMEM;
197 }
198
199 platform_set_drvdata(sdp4430_snd_device, &snd_soc_sdp4430);
200
201 ret = platform_device_add(sdp4430_snd_device);
202 if (ret)
203 goto err;
204
205 return 0;
206
207err:
208 printk(KERN_ERR "Unable to add platform device\n");
209 platform_device_put(sdp4430_snd_device);
210 return ret;
211}
212module_init(sdp4430_soc_init);
213
214static void __exit sdp4430_soc_exit(void)
215{
216 platform_device_unregister(sdp4430_snd_device);
217}
218module_exit(sdp4430_soc_exit);
219
220MODULE_AUTHOR("Misael Lopez Cruz <x0052729@ti.com>");
221MODULE_DESCRIPTION("ALSA SoC SDP4430");
222MODULE_LICENSE("GPL");
223
diff --git a/sound/soc/samsung/speyside_wm8962.c b/sound/soc/samsung/speyside_wm8962.c
new file mode 100644
index 00000000000..72535f2daaf
--- /dev/null
+++ b/sound/soc/samsung/speyside_wm8962.c
@@ -0,0 +1,270 @@
1/*
2 * Speyside with WM8962 audio support
3 *
4 * Copyright 2011 Wolfson Microelectronics
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 */
11
12#include <sound/soc.h>
13#include <sound/soc-dapm.h>
14#include <sound/jack.h>
15#include <linux/gpio.h>
16
17#include "../codecs/wm8962.h"
18
19static int speyside_wm8962_set_bias_level(struct snd_soc_card *card,
20 struct snd_soc_dapm_context *dapm,
21 enum snd_soc_bias_level level)
22{
23 struct snd_soc_dai *codec_dai = card->rtd[0].codec_dai;
24 int ret;
25
26 if (dapm->dev != codec_dai->dev)
27 return 0;
28
29 switch (level) {
30 case SND_SOC_BIAS_PREPARE:
31 if (dapm->bias_level == SND_SOC_BIAS_STANDBY) {
32 ret = snd_soc_dai_set_pll(codec_dai, WM8962_FLL,
33 WM8962_FLL_MCLK, 32768,
34 44100 * 256);
35 if (ret < 0)
36 pr_err("Failed to start FLL: %d\n", ret);
37
38 ret = snd_soc_dai_set_sysclk(codec_dai,
39 WM8962_SYSCLK_FLL,
40 44100 * 256,
41 SND_SOC_CLOCK_IN);
42 if (ret < 0) {
43 pr_err("Failed to set SYSCLK: %d\n", ret);
44 return ret;
45 }
46 }
47 break;
48
49 default:
50 break;
51 }
52
53 return 0;
54}
55
56static int speyside_wm8962_set_bias_level_post(struct snd_soc_card *card,
57 struct snd_soc_dapm_context *dapm,
58 enum snd_soc_bias_level level)
59{
60 struct snd_soc_dai *codec_dai = card->rtd[0].codec_dai;
61 int ret;
62
63 if (dapm->dev != codec_dai->dev)
64 return 0;
65
66 switch (level) {
67 case SND_SOC_BIAS_STANDBY:
68 ret = snd_soc_dai_set_sysclk(codec_dai, WM8962_SYSCLK_MCLK,
69 32768, SND_SOC_CLOCK_IN);
70 if (ret < 0) {
71 pr_err("Failed to switch away from FLL: %d\n", ret);
72 return ret;
73 }
74
75 ret = snd_soc_dai_set_pll(codec_dai, WM8962_FLL,
76 0, 0, 0);
77 if (ret < 0) {
78 pr_err("Failed to stop FLL: %d\n", ret);
79 return ret;
80 }
81 break;
82
83 default:
84 break;
85 }
86
87 dapm->bias_level = level;
88
89 return 0;
90}
91
92static int speyside_wm8962_hw_params(struct snd_pcm_substream *substream,
93 struct snd_pcm_hw_params *params)
94{
95 struct snd_soc_pcm_runtime *rtd = substream->private_data;
96 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
97 struct snd_soc_dai *codec_dai = rtd->codec_dai;
98 int ret;
99
100 ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S
101 | SND_SOC_DAIFMT_NB_NF
102 | SND_SOC_DAIFMT_CBM_CFM);
103 if (ret < 0)
104 return ret;
105
106 ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S
107 | SND_SOC_DAIFMT_NB_NF
108 | SND_SOC_DAIFMT_CBM_CFM);
109 if (ret < 0)
110 return ret;
111
112 return 0;
113}
114
115static struct snd_soc_ops speyside_wm8962_ops = {
116 .hw_params = speyside_wm8962_hw_params,
117};
118
119static struct snd_soc_dai_link speyside_wm8962_dai[] = {
120 {
121 .name = "CPU",
122 .stream_name = "CPU",
123 .cpu_dai_name = "samsung-i2s.0",
124 .codec_dai_name = "wm8962",
125 .platform_name = "samsung-audio",
126 .codec_name = "wm8962.1-001a",
127 .ops = &speyside_wm8962_ops,
128 },
129};
130
131static const struct snd_kcontrol_new controls[] = {
132 SOC_DAPM_PIN_SWITCH("Main Speaker"),
133};
134
135static struct snd_soc_dapm_widget widgets[] = {
136 SND_SOC_DAPM_HP("Headphone", NULL),
137 SND_SOC_DAPM_MIC("Headset Mic", NULL),
138
139 SND_SOC_DAPM_MIC("DMIC", NULL),
140
141 SND_SOC_DAPM_SPK("Main Speaker", NULL),
142};
143
144static struct snd_soc_dapm_route audio_paths[] = {
145 { "Headphone", NULL, "HPOUTL" },
146 { "Headphone", NULL, "HPOUTR" },
147
148 { "Main Speaker", NULL, "SPKOUTL" },
149 { "Main Speaker", NULL, "SPKOUTR" },
150
151 { "MICBIAS", NULL, "Headset Mic" },
152 { "IN4L", NULL, "MICBIAS" },
153 { "IN4R", NULL, "MICBIAS" },
154
155 { "MICBIAS", NULL, "DMIC" },
156 { "DMICDAT", NULL, "MICBIAS" },
157};
158
159static struct snd_soc_jack speyside_wm8962_headset;
160
161/* Headset jack detection DAPM pins */
162static struct snd_soc_jack_pin speyside_wm8962_headset_pins[] = {
163 {
164 .pin = "Headset Mic",
165 .mask = SND_JACK_MICROPHONE,
166 },
167 {
168 .pin = "Headphone",
169 .mask = SND_JACK_MICROPHONE,
170 },
171};
172
173static int speyside_wm8962_late_probe(struct snd_soc_card *card)
174{
175 struct snd_soc_codec *codec = card->rtd[0].codec;
176 struct snd_soc_dai *codec_dai = card->rtd[0].codec_dai;
177 int ret;
178
179 ret = snd_soc_dai_set_sysclk(codec_dai, WM8962_SYSCLK_MCLK,
180 32768, SND_SOC_CLOCK_IN);
181 if (ret < 0)
182 return ret;
183
184 ret = snd_soc_jack_new(codec, "Headset",
185 SND_JACK_HEADSET | SND_JACK_BTN_0,
186 &speyside_wm8962_headset);
187 if (ret)
188 return ret;
189
190 ret = snd_soc_jack_add_pins(&speyside_wm8962_headset,
191 ARRAY_SIZE(speyside_wm8962_headset_pins),
192 speyside_wm8962_headset_pins);
193 if (ret)
194 return ret;
195
196 wm8962_mic_detect(codec, &speyside_wm8962_headset);
197
198 return 0;
199}
200
201static struct snd_soc_card speyside_wm8962 = {
202 .name = "Speyside WM8962",
203 .dai_link = speyside_wm8962_dai,
204 .num_links = ARRAY_SIZE(speyside_wm8962_dai),
205
206 .set_bias_level = speyside_wm8962_set_bias_level,
207 .set_bias_level_post = speyside_wm8962_set_bias_level_post,
208
209 .controls = controls,
210 .num_controls = ARRAY_SIZE(controls),
211 .dapm_widgets = widgets,
212 .num_dapm_widgets = ARRAY_SIZE(widgets),
213 .dapm_routes = audio_paths,
214 .num_dapm_routes = ARRAY_SIZE(audio_paths),
215
216 .late_probe = speyside_wm8962_late_probe,
217};
218
219static __devinit int speyside_wm8962_probe(struct platform_device *pdev)
220{
221 struct snd_soc_card *card = &speyside_wm8962;
222 int ret;
223
224 card->dev = &pdev->dev;
225
226 ret = snd_soc_register_card(card);
227 if (ret) {
228 dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n",
229 ret);
230 return ret;
231 }
232
233 return 0;
234}
235
236static int __devexit speyside_wm8962_remove(struct platform_device *pdev)
237{
238 struct snd_soc_card *card = platform_get_drvdata(pdev);
239
240 snd_soc_unregister_card(card);
241
242 return 0;
243}
244
245static struct platform_driver speyside_wm8962_driver = {
246 .driver = {
247 .name = "speyside-wm8962",
248 .owner = THIS_MODULE,
249 .pm = &snd_soc_pm_ops,
250 },
251 .probe = speyside_wm8962_probe,
252 .remove = __devexit_p(speyside_wm8962_remove),
253};
254
255static int __init speyside_wm8962_audio_init(void)
256{
257 return platform_driver_register(&speyside_wm8962_driver);
258}
259module_init(speyside_wm8962_audio_init);
260
261static void __exit speyside_wm8962_audio_exit(void)
262{
263 platform_driver_unregister(&speyside_wm8962_driver);
264}
265module_exit(speyside_wm8962_audio_exit);
266
267MODULE_DESCRIPTION("Speyside WM8962 audio support");
268MODULE_AUTHOR("Mark Brown <broonie@opensource.wolfsonmicro.com>");
269MODULE_LICENSE("GPL");
270MODULE_ALIAS("platform:speyside-wm8962");
diff --git a/sound/soc/sh/fsi-ak4642.c b/sound/soc/sh/fsi-ak4642.c
new file mode 100644
index 00000000000..770a71a1536
--- /dev/null
+++ b/sound/soc/sh/fsi-ak4642.c
@@ -0,0 +1,209 @@
1/*
2 * FSI-AK464x sound support for ms7724se
3 *
4 * Copyright (C) 2009 Renesas Solutions Corp.
5 * Kuninori Morimoto <morimoto.kuninori@renesas.com>
6 *
7 * This file is subject to the terms and conditions of the GNU General Public
8 * License. See the file "COPYING" in the main directory of this archive
9 * for more details.
10 */
11
12#include <linux/platform_device.h>
13#include <sound/sh_fsi.h>
14
15struct fsi_ak4642_data {
16 const char *name;
17 const char *card;
18 const char *cpu_dai;
19 const char *codec;
20 const char *platform;
21 int id;
22};
23
24static int fsi_ak4642_dai_init(struct snd_soc_pcm_runtime *rtd)
25{
26 struct snd_soc_dai *codec = rtd->codec_dai;
27 struct snd_soc_dai *cpu = rtd->cpu_dai;
28 int ret;
29
30 ret = snd_soc_dai_set_fmt(codec, SND_SOC_DAIFMT_LEFT_J |
31 SND_SOC_DAIFMT_CBM_CFM);
32 if (ret < 0)
33 return ret;
34
35 ret = snd_soc_dai_set_sysclk(codec, 0, 11289600, 0);
36 if (ret < 0)
37 return ret;
38
39 ret = snd_soc_dai_set_fmt(cpu, SND_SOC_DAIFMT_LEFT_J |
40 SND_SOC_DAIFMT_CBS_CFS);
41
42 return ret;
43}
44
45static struct snd_soc_dai_link fsi_dai_link = {
46 .codec_dai_name = "ak4642-hifi",
47 .init = fsi_ak4642_dai_init,
48};
49
50static struct snd_soc_card fsi_soc_card = {
51 .dai_link = &fsi_dai_link,
52 .num_links = 1,
53};
54
55static struct platform_device *fsi_snd_device;
56
57static int fsi_ak4642_probe(struct platform_device *pdev)
58{
59 int ret = -ENOMEM;
60 const struct platform_device_id *id_entry;
61 struct fsi_ak4642_data *pdata;
62
63 id_entry = pdev->id_entry;
64 if (!id_entry) {
65 dev_err(&pdev->dev, "unknown fsi ak4642\n");
66 return -ENODEV;
67 }
68
69 pdata = (struct fsi_ak4642_data *)id_entry->driver_data;
70
71 fsi_snd_device = platform_device_alloc("soc-audio", pdata->id);
72 if (!fsi_snd_device)
73 goto out;
74
75 fsi_dai_link.name = pdata->name;
76 fsi_dai_link.stream_name = pdata->name;
77 fsi_dai_link.cpu_dai_name = pdata->cpu_dai;
78 fsi_dai_link.platform_name = pdata->platform;
79 fsi_dai_link.codec_name = pdata->codec;
80 fsi_soc_card.name = pdata->card;
81
82 platform_set_drvdata(fsi_snd_device, &fsi_soc_card);
83 ret = platform_device_add(fsi_snd_device);
84
85 if (ret)
86 platform_device_put(fsi_snd_device);
87
88out:
89 return ret;
90}
91
92static int fsi_ak4642_remove(struct platform_device *pdev)
93{
94 platform_device_unregister(fsi_snd_device);
95 return 0;
96}
97
98static struct fsi_ak4642_data fsi_a_ak4642 = {
99 .name = "AK4642",
100 .card = "FSIA-AK4642",
101 .cpu_dai = "fsia-dai",
102 .codec = "ak4642-codec.0-0012",
103 .platform = "sh_fsi.0",
104 .id = FSI_PORT_A,
105};
106
107static struct fsi_ak4642_data fsi_b_ak4642 = {
108 .name = "AK4642",
109 .card = "FSIB-AK4642",
110 .cpu_dai = "fsib-dai",
111 .codec = "ak4642-codec.0-0012",
112 .platform = "sh_fsi.0",
113 .id = FSI_PORT_B,
114};
115
116static struct fsi_ak4642_data fsi_a_ak4643 = {
117 .name = "AK4643",
118 .card = "FSIA-AK4643",
119 .cpu_dai = "fsia-dai",
120 .codec = "ak4642-codec.0-0013",
121 .platform = "sh_fsi.0",
122 .id = FSI_PORT_A,
123};
124
125static struct fsi_ak4642_data fsi_b_ak4643 = {
126 .name = "AK4643",
127 .card = "FSIB-AK4643",
128 .cpu_dai = "fsib-dai",
129 .codec = "ak4642-codec.0-0013",
130 .platform = "sh_fsi.0",
131 .id = FSI_PORT_B,
132};
133
134static struct fsi_ak4642_data fsi2_a_ak4642 = {
135 .name = "AK4642",
136 .card = "FSI2A-AK4642",
137 .cpu_dai = "fsia-dai",
138 .codec = "ak4642-codec.0-0012",
139 .platform = "sh_fsi2",
140 .id = FSI_PORT_A,
141};
142
143static struct fsi_ak4642_data fsi2_b_ak4642 = {
144 .name = "AK4642",
145 .card = "FSI2B-AK4642",
146 .cpu_dai = "fsib-dai",
147 .codec = "ak4642-codec.0-0012",
148 .platform = "sh_fsi2",
149 .id = FSI_PORT_B,
150};
151
152static struct fsi_ak4642_data fsi2_a_ak4643 = {
153 .name = "AK4643",
154 .card = "FSI2A-AK4643",
155 .cpu_dai = "fsia-dai",
156 .codec = "ak4642-codec.0-0013",
157 .platform = "sh_fsi2",
158 .id = FSI_PORT_A,
159};
160
161static struct fsi_ak4642_data fsi2_b_ak4643 = {
162 .name = "AK4643",
163 .card = "FSI2B-AK4643",
164 .cpu_dai = "fsib-dai",
165 .codec = "ak4642-codec.0-0013",
166 .platform = "sh_fsi2",
167 .id = FSI_PORT_B,
168};
169
170static struct platform_device_id fsi_id_table[] = {
171 /* FSI */
172 { "sh_fsi_a_ak4642", (kernel_ulong_t)&fsi_a_ak4642 },
173 { "sh_fsi_b_ak4642", (kernel_ulong_t)&fsi_b_ak4642 },
174 { "sh_fsi_a_ak4643", (kernel_ulong_t)&fsi_a_ak4643 },
175 { "sh_fsi_b_ak4643", (kernel_ulong_t)&fsi_b_ak4643 },
176
177 /* FSI 2 */
178 { "sh_fsi2_a_ak4642", (kernel_ulong_t)&fsi2_a_ak4642 },
179 { "sh_fsi2_b_ak4642", (kernel_ulong_t)&fsi2_b_ak4642 },
180 { "sh_fsi2_a_ak4643", (kernel_ulong_t)&fsi2_a_ak4643 },
181 { "sh_fsi2_b_ak4643", (kernel_ulong_t)&fsi2_b_ak4643 },
182 {},
183};
184
185static struct platform_driver fsi_ak4642 = {
186 .driver = {
187 .name = "fsi-ak4642-audio",
188 },
189 .probe = fsi_ak4642_probe,
190 .remove = fsi_ak4642_remove,
191 .id_table = fsi_id_table,
192};
193
194static int __init fsi_ak4642_init(void)
195{
196 return platform_driver_register(&fsi_ak4642);
197}
198
199static void __exit fsi_ak4642_exit(void)
200{
201 platform_driver_unregister(&fsi_ak4642);
202}
203
204module_init(fsi_ak4642_init);
205module_exit(fsi_ak4642_exit);
206
207MODULE_LICENSE("GPL");
208MODULE_DESCRIPTION("Generic SH4 FSI-AK4642 sound card");
209MODULE_AUTHOR("Kuninori Morimoto <morimoto.kuninori@renesas.com>");
diff --git a/sound/soc/sh/fsi-da7210.c b/sound/soc/sh/fsi-da7210.c
new file mode 100644
index 00000000000..59553fd8c2f
--- /dev/null
+++ b/sound/soc/sh/fsi-da7210.c
@@ -0,0 +1,79 @@
1/*
2 * fsi-da7210.c
3 *
4 * Copyright (C) 2009 Renesas Solutions Corp.
5 * Kuninori Morimoto <morimoto.kuninori@renesas.com>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 */
12
13#include <linux/platform_device.h>
14#include <sound/sh_fsi.h>
15
16static int fsi_da7210_init(struct snd_soc_pcm_runtime *rtd)
17{
18 struct snd_soc_dai *codec = rtd->codec_dai;
19 struct snd_soc_dai *cpu = rtd->cpu_dai;
20 int ret;
21
22 ret = snd_soc_dai_set_fmt(codec,
23 SND_SOC_DAIFMT_I2S |
24 SND_SOC_DAIFMT_CBM_CFM);
25 if (ret < 0)
26 return ret;
27
28 ret = snd_soc_dai_set_fmt(cpu, SND_SOC_DAIFMT_I2S |
29 SND_SOC_DAIFMT_CBS_CFS);
30
31 return ret;
32}
33
34static struct snd_soc_dai_link fsi_da7210_dai = {
35 .name = "DA7210",
36 .stream_name = "DA7210",
37 .cpu_dai_name = "fsib-dai", /* FSI B */
38 .codec_dai_name = "da7210-hifi",
39 .platform_name = "sh_fsi.0",
40 .codec_name = "da7210-codec.0-001a",
41 .init = fsi_da7210_init,
42};
43
44static struct snd_soc_card fsi_soc_card = {
45 .name = "FSI-DA7210",
46 .dai_link = &fsi_da7210_dai,
47 .num_links = 1,
48};
49
50static struct platform_device *fsi_da7210_snd_device;
51
52static int __init fsi_da7210_sound_init(void)
53{
54 int ret;
55
56 fsi_da7210_snd_device = platform_device_alloc("soc-audio", FSI_PORT_B);
57 if (!fsi_da7210_snd_device)
58 return -ENOMEM;
59
60 platform_set_drvdata(fsi_da7210_snd_device, &fsi_soc_card);
61 ret = platform_device_add(fsi_da7210_snd_device);
62 if (ret)
63 platform_device_put(fsi_da7210_snd_device);
64
65 return ret;
66}
67
68static void __exit fsi_da7210_sound_exit(void)
69{
70 platform_device_unregister(fsi_da7210_snd_device);
71}
72
73module_init(fsi_da7210_sound_init);
74module_exit(fsi_da7210_sound_exit);
75
76/* Module information */
77MODULE_DESCRIPTION("ALSA SoC FSI DA2710");
78MODULE_AUTHOR("Kuninori Morimoto <morimoto.kuninori@renesas.com>");
79MODULE_LICENSE("GPL");
diff --git a/sound/soc/sh/fsi-hdmi.c b/sound/soc/sh/fsi-hdmi.c
new file mode 100644
index 00000000000..d3d9fd88068
--- /dev/null
+++ b/sound/soc/sh/fsi-hdmi.c
@@ -0,0 +1,127 @@
1/*
2 * FSI - HDMI sound support
3 *
4 * Copyright (C) 2010 Renesas Solutions Corp.
5 * Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
6 *
7 * This file is subject to the terms and conditions of the GNU General Public
8 * License. See the file "COPYING" in the main directory of this archive
9 * for more details.
10 */
11
12#include <linux/platform_device.h>
13#include <sound/sh_fsi.h>
14
15struct fsi_hdmi_data {
16 const char *cpu_dai;
17 const char *card;
18 int id;
19};
20
21static int fsi_hdmi_dai_init(struct snd_soc_pcm_runtime *rtd)
22{
23 struct snd_soc_dai *cpu = rtd->cpu_dai;
24 int ret;
25
26 ret = snd_soc_dai_set_fmt(cpu, SND_SOC_DAIFMT_CBM_CFM);
27
28 return ret;
29}
30
31static struct snd_soc_dai_link fsi_dai_link = {
32 .name = "HDMI",
33 .stream_name = "HDMI",
34 .codec_dai_name = "sh_mobile_hdmi-hifi",
35 .platform_name = "sh_fsi2",
36 .codec_name = "sh-mobile-hdmi",
37 .init = fsi_hdmi_dai_init,
38};
39
40static struct snd_soc_card fsi_soc_card = {
41 .dai_link = &fsi_dai_link,
42 .num_links = 1,
43};
44
45static struct platform_device *fsi_snd_device;
46
47static int fsi_hdmi_probe(struct platform_device *pdev)
48{
49 int ret = -ENOMEM;
50 const struct platform_device_id *id_entry;
51 struct fsi_hdmi_data *pdata;
52
53 id_entry = pdev->id_entry;
54 if (!id_entry) {
55 dev_err(&pdev->dev, "unknown fsi hdmi\n");
56 return -ENODEV;
57 }
58
59 pdata = (struct fsi_hdmi_data *)id_entry->driver_data;
60
61 fsi_snd_device = platform_device_alloc("soc-audio", pdata->id);
62 if (!fsi_snd_device)
63 goto out;
64
65 fsi_dai_link.cpu_dai_name = pdata->cpu_dai;
66 fsi_soc_card.name = pdata->card;
67
68 platform_set_drvdata(fsi_snd_device, &fsi_soc_card);
69 ret = platform_device_add(fsi_snd_device);
70
71 if (ret)
72 platform_device_put(fsi_snd_device);
73
74out:
75 return ret;
76}
77
78static int fsi_hdmi_remove(struct platform_device *pdev)
79{
80 platform_device_unregister(fsi_snd_device);
81 return 0;
82}
83
84static struct fsi_hdmi_data fsi2_a_hdmi = {
85 .cpu_dai = "fsia-dai",
86 .card = "FSI2A-HDMI",
87 .id = FSI_PORT_A,
88};
89
90static struct fsi_hdmi_data fsi2_b_hdmi = {
91 .cpu_dai = "fsib-dai",
92 .card = "FSI2B-HDMI",
93 .id = FSI_PORT_B,
94};
95
96static struct platform_device_id fsi_id_table[] = {
97 /* FSI 2 */
98 { "sh_fsi2_a_hdmi", (kernel_ulong_t)&fsi2_a_hdmi },
99 { "sh_fsi2_b_hdmi", (kernel_ulong_t)&fsi2_b_hdmi },
100 {},
101};
102
103static struct platform_driver fsi_hdmi = {
104 .driver = {
105 .name = "fsi-hdmi-audio",
106 },
107 .probe = fsi_hdmi_probe,
108 .remove = fsi_hdmi_remove,
109 .id_table = fsi_id_table,
110};
111
112static int __init fsi_hdmi_init(void)
113{
114 return platform_driver_register(&fsi_hdmi);
115}
116
117static void __exit fsi_hdmi_exit(void)
118{
119 platform_driver_unregister(&fsi_hdmi);
120}
121
122module_init(fsi_hdmi_init);
123module_exit(fsi_hdmi_exit);
124
125MODULE_LICENSE("GPL");
126MODULE_DESCRIPTION("Generic SH4 FSI-HDMI sound card");
127MODULE_AUTHOR("Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>");
diff --git a/sound/soc/tegra/tegra30_dam.c b/sound/soc/tegra/tegra30_dam.c
new file mode 100644
index 00000000000..d308179110c
--- /dev/null
+++ b/sound/soc/tegra/tegra30_dam.c
@@ -0,0 +1,650 @@
1/*
2 * tegra30_dam.c - Tegra 30 DAM driver
3 *
4 * Author: Nikesh Oswal <noswal@nvidia.com>
5 * Copyright (C) 2011 - NVIDIA, Inc.
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 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
19 * 02110-1301 USA
20 *
21 */
22
23#include <linux/clk.h>
24#include <linux/module.h>
25#include <linux/debugfs.h>
26#include <linux/device.h>
27#include <linux/platform_device.h>
28#include <linux/seq_file.h>
29#include <linux/slab.h>
30#include <linux/io.h>
31#include <sound/soc.h>
32#include "tegra30_dam.h"
33#include "tegra30_ahub.h"
34
35#define DRV_NAME "tegra30-dam"
36
37static struct tegra30_dam_context *dams_cont_info[TEGRA30_NR_DAM_IFC];
38
39enum {
40 dam_ch_in0 = 0x0,
41 dam_ch_in1,
42 dam_ch_out,
43 dam_ch_maxnum
44} tegra30_dam_chtype;
45
46struct tegra30_dam_src_step_table step_table[] = {
47 { 8000, 44100, 80 },
48 { 8000, 48000, 1 },
49 { 16000, 44100, 160 },
50 { 16000, 48000, 1 },
51 { 44100, 8000, 441 },
52 { 48000, 8000, 0 },
53 { 44100, 16000, 441 },
54 { 48000, 16000, 0 },
55};
56
57static void tegra30_dam_set_output_samplerate(struct tegra30_dam_context *dam,
58 int fsout);
59static void tegra30_dam_set_input_samplerate(struct tegra30_dam_context *dam,
60 int fsin);
61static int tegra30_dam_set_step_reset(struct tegra30_dam_context *dam,
62 int insample, int outsample);
63static void tegra30_dam_ch0_set_step(struct tegra30_dam_context *dam, int step);
64
65static inline void tegra30_dam_writel(struct tegra30_dam_context *dam,
66 u32 val, u32 reg)
67{
68#ifdef CONFIG_PM
69 dam->reg_cache[reg >> 2] = val;
70#endif
71 __raw_writel(val, dam->damregs + reg);
72}
73
74static inline u32 tegra30_dam_readl(struct tegra30_dam_context *dam, u32 reg)
75{
76 u32 val = __raw_readl(dam->damregs + reg);
77
78 return val;
79}
80
81#ifdef CONFIG_PM
82int tegra30_dam_resume(int ifc)
83{
84 int i = 0;
85 struct tegra30_dam_context *dam;
86
87 if (ifc >= TEGRA30_NR_DAM_IFC)
88 return -EINVAL;
89
90 dam = dams_cont_info[ifc];
91
92 if (dam->in_use) {
93 tegra30_dam_enable_clock(ifc);
94
95 for (i = 0; i <= TEGRA30_DAM_CTRL_REGINDEX; i++) {
96 if ((i == TEGRA30_DAM_CTRL_RSVD_6) ||
97 (i == TEGRA30_DAM_CTRL_RSVD_10))
98 continue;
99
100 tegra30_dam_writel(dam, dam->reg_cache[i],
101 (i << 2));
102 }
103
104 tegra30_dam_disable_clock(ifc);
105 }
106
107 return 0;
108}
109#endif
110
111void tegra30_dam_disable_clock(int ifc)
112{
113 struct tegra30_dam_context *dam;
114
115 if (ifc >= TEGRA30_NR_DAM_IFC)
116 return;
117
118 dam = dams_cont_info[ifc];
119 clk_disable(dam->dam_clk);
120 tegra30_ahub_disable_clocks();
121}
122
123int tegra30_dam_enable_clock(int ifc)
124{
125 struct tegra30_dam_context *dam;
126
127 if (ifc >= TEGRA30_NR_DAM_IFC)
128 return -EINVAL;
129
130 dam = dams_cont_info[ifc];
131 tegra30_ahub_enable_clocks();
132 clk_enable(dam->dam_clk);
133
134 return 0;
135}
136
137#ifdef CONFIG_DEBUG_FS
138static int tegra30_dam_show(struct seq_file *s, void *unused)
139{
140#define REG(r) { r, #r }
141 static const struct {
142 int offset;
143 const char *name;
144 } regs[] = {
145 REG(TEGRA30_DAM_CTRL),
146 REG(TEGRA30_DAM_CLIP),
147 REG(TEGRA30_DAM_CLIP_THRESHOLD),
148 REG(TEGRA30_DAM_AUDIOCIF_OUT_CTRL),
149 REG(TEGRA30_DAM_CH0_CTRL),
150 REG(TEGRA30_DAM_CH0_CONV),
151 REG(TEGRA30_DAM_AUDIOCIF_CH0_CTRL),
152 REG(TEGRA30_DAM_CH1_CTRL),
153 REG(TEGRA30_DAM_CH1_CONV),
154 REG(TEGRA30_DAM_AUDIOCIF_CH1_CTRL),
155 };
156#undef REG
157
158 struct tegra30_dam_context *dam = s->private;
159 int i;
160
161 clk_enable(dam->dam_clk);
162
163 for (i = 0; i < ARRAY_SIZE(regs); i++) {
164 u32 val = tegra30_dam_readl(dam, regs[i].offset);
165 seq_printf(s, "%s = %08x\n", regs[i].name, val);
166 }
167
168 clk_disable(dam->dam_clk);
169
170 return 0;
171}
172
173static int tegra30_dam_debug_open(struct inode *inode, struct file *file)
174{
175 return single_open(file, tegra30_dam_show, inode->i_private);
176}
177
178static const struct file_operations tegra30_dam_debug_fops = {
179 .open = tegra30_dam_debug_open,
180 .read = seq_read,
181 .llseek = seq_lseek,
182 .release = single_release,
183};
184
185static void tegra30_dam_debug_add(struct tegra30_dam_context *dam, int id)
186{
187 char name[] = DRV_NAME ".0";
188
189 snprintf(name, sizeof(name), DRV_NAME".%1d", id);
190 dam->debug = debugfs_create_file(name, S_IRUGO, snd_soc_debugfs_root,
191 dam, &tegra30_dam_debug_fops);
192}
193
194static void tegra30_dam_debug_remove(struct tegra30_dam_context *dam)
195{
196 if (dam->debug)
197 debugfs_remove(dam->debug);
198}
199#else
200static inline void tegra30_dam_debug_add(struct tegra30_dam_context *dam,
201 int id)
202{
203}
204
205static inline void tegra30_dam_debug_remove(struct tegra30_dam_context *dam)
206{
207}
208#endif
209
210int tegra30_dam_allocate_controller()
211{
212 int i = 0;
213 struct tegra30_dam_context *dam = NULL;
214
215 for (i = 0; i < TEGRA30_NR_DAM_IFC; i++) {
216
217 dam = dams_cont_info[i];
218
219 if (!dam->in_use) {
220 dam->in_use = true;
221 return i;
222 }
223 }
224
225 return -ENOENT;
226}
227
228int tegra30_dam_allocate_channel(int ifc, int chid)
229{
230 struct tegra30_dam_context *dam = NULL;
231
232 if (ifc >= TEGRA30_NR_DAM_IFC)
233 return -EINVAL;
234
235 dam = dams_cont_info[ifc];
236
237 if (!dam->ch_alloc[chid]) {
238 dam->ch_alloc[chid] = true;
239 return 0;
240 }
241
242 return -ENOENT;
243}
244
245int tegra30_dam_free_channel(int ifc, int chid)
246{
247 struct tegra30_dam_context *dam = NULL;
248
249 if (ifc >= TEGRA30_NR_DAM_IFC)
250 return -EINVAL;
251
252 dam = dams_cont_info[ifc];
253
254 if (dam->ch_alloc[chid]) {
255 dam->ch_alloc[chid] = false;
256 return 0;
257 }
258
259 return -EINVAL;
260}
261
262int tegra30_dam_free_controller(int ifc)
263{
264 struct tegra30_dam_context *dam = NULL;
265
266 if (ifc >= TEGRA30_NR_DAM_IFC)
267 return -EINVAL;
268
269 dam = dams_cont_info[ifc];
270
271 if (!dam->ch_alloc[dam_ch_in0] &&
272 !dam->ch_alloc[dam_ch_in1]) {
273 dam->in_use = false;
274 return 0;
275 }
276
277 return -EINVAL;
278}
279
280void tegra30_dam_set_samplerate(int ifc, int chid, int samplerate)
281{
282 struct tegra30_dam_context *dam = dams_cont_info[ifc];
283
284 if (ifc >= TEGRA30_NR_DAM_IFC)
285 return;
286
287 switch (chid) {
288 case dam_ch_in0:
289 tegra30_dam_set_input_samplerate(dam, samplerate);
290 dam->ch_insamplerate[dam_ch_in0] = samplerate;
291 tegra30_dam_set_step_reset(dam, samplerate, dam->outsamplerate);
292 break;
293 case dam_ch_in1:
294 if (samplerate != dam->outsamplerate)
295 return;
296 dam->ch_insamplerate[dam_ch_in1] = samplerate;
297 break;
298 case dam_ch_out:
299 tegra30_dam_set_output_samplerate(dam, samplerate);
300 dam->outsamplerate = samplerate;
301 break;
302 default:
303 break;
304 }
305}
306
307void tegra30_dam_set_output_samplerate(struct tegra30_dam_context *dam,
308 int fsout)
309{
310 u32 val;
311
312 val = tegra30_dam_readl(dam, TEGRA30_DAM_CTRL);
313 val &= ~TEGRA30_DAM_CTRL_FSOUT_MASK;
314
315 switch (fsout) {
316 case TEGRA30_AUDIO_SAMPLERATE_8000:
317 val |= TEGRA30_DAM_CTRL_FSOUT_FS8;
318 break;
319 case TEGRA30_AUDIO_SAMPLERATE_16000:
320 val |= TEGRA30_DAM_CTRL_FSOUT_FS16;
321 break;
322 case TEGRA30_AUDIO_SAMPLERATE_44100:
323 val |= TEGRA30_DAM_CTRL_FSOUT_FS44;
324 break;
325 case TEGRA30_AUDIO_SAMPLERATE_48000:
326 val |= TEGRA30_DAM_CTRL_FSOUT_FS48;
327 break;
328 default:
329 break;
330 }
331
332 tegra30_dam_writel(dam, val, TEGRA30_DAM_CTRL);
333}
334
335void tegra30_dam_set_input_samplerate(struct tegra30_dam_context *dam, int fsin)
336{
337 u32 val;
338
339 val = tegra30_dam_readl(dam, TEGRA30_DAM_CH0_CTRL);
340 val &= ~TEGRA30_DAM_CH0_CTRL_FSIN_MASK;
341
342 switch (fsin) {
343 case TEGRA30_AUDIO_SAMPLERATE_8000:
344 val |= TEGRA30_DAM_CH0_CTRL_FSIN_FS8;
345 break;
346 case TEGRA30_AUDIO_SAMPLERATE_16000:
347 val |= TEGRA30_DAM_CH0_CTRL_FSIN_FS16;
348 break;
349 case TEGRA30_AUDIO_SAMPLERATE_44100:
350 val |= TEGRA30_DAM_CH0_CTRL_FSIN_FS44;
351 break;
352 case TEGRA30_AUDIO_SAMPLERATE_48000:
353 val |= TEGRA30_DAM_CH0_CTRL_FSIN_FS48;
354 break;
355 default:
356 break;
357 }
358
359 tegra30_dam_writel(dam, val, TEGRA30_DAM_CH0_CTRL);
360}
361
362int tegra30_dam_set_step_reset(struct tegra30_dam_context *dam,
363 int insample, int outsample)
364{
365 int step_reset = 0;
366 int i = 0;
367
368 for (i = 0; i < ARRAY_SIZE(step_table); i++) {
369 if ((insample == step_table[i].insample) &&
370 (outsample == step_table[i].outsample))
371 step_reset = step_table[i].stepreset;
372 }
373
374 tegra30_dam_ch0_set_step(dam, step_reset);
375
376 return 0;
377}
378
379void tegra30_dam_ch0_set_step(struct tegra30_dam_context *dam, int step)
380{
381 u32 val;
382
383 val = tegra30_dam_readl(dam, TEGRA30_DAM_CH0_CTRL);
384 val &= ~TEGRA30_DAM_CH0_CTRL_STEP_MASK;
385 val |= step << TEGRA30_DAM_CH0_CTRL_STEP_SHIFT;
386 tegra30_dam_writel(dam, val, TEGRA30_DAM_CH0_CTRL);
387}
388
389int tegra30_dam_set_gain(int ifc, int chid, int gain)
390{
391
392 if (ifc >= TEGRA30_NR_DAM_IFC)
393 return -EINVAL;
394
395 switch (chid) {
396 case dam_ch_in0:
397 tegra30_dam_writel(dams_cont_info[ifc], gain,
398 TEGRA30_DAM_CH0_CONV);
399 break;
400 case dam_ch_in1:
401 tegra30_dam_writel(dams_cont_info[ifc], gain,
402 TEGRA30_DAM_CH1_CONV);
403 break;
404 default:
405 break;
406 }
407
408 return 0;
409}
410
411int tegra30_dam_set_acif(int ifc, int chid, unsigned int audio_channels,
412 unsigned int audio_bits, unsigned int client_channels,
413 unsigned int client_bits)
414{
415 unsigned int reg;
416 unsigned int value = 0;
417
418 if (ifc >= TEGRA30_NR_DAM_IFC)
419 return -EINVAL;
420
421 /*ch0 takes input as mono/16bit always*/
422 if ((chid == dam_ch_in0) &&
423 ((client_channels != 1) || (client_bits != 16)))
424 return -EINVAL;
425
426 value |= TEGRA30_CIF_MONOCONV_COPY;
427 value |= TEGRA30_CIF_STEREOCONV_CH0;
428 value |= (audio_channels-1) << TEGRA30_AUDIO_CHANNELS_SHIFT;
429 value |= (((audio_bits>>2)-1)<<TEGRA30_AUDIO_BITS_SHIFT);
430 value |= (client_channels-1) << TEGRA30_CLIENT_CHANNELS_SHIFT;
431 value |= (((client_bits>>2)-1)<<TEGRA30_CLIENT_BITS_SHIFT);
432
433 switch (chid) {
434 case dam_ch_out:
435 value |= TEGRA30_CIF_DIRECTION_TX;
436 reg = TEGRA30_DAM_AUDIOCIF_OUT_CTRL;
437 break;
438 case dam_ch_in0:
439 value |= TEGRA30_CIF_DIRECTION_RX;
440 reg = TEGRA30_DAM_AUDIOCIF_CH0_CTRL;
441 break;
442 case dam_ch_in1:
443 value |= TEGRA30_CIF_DIRECTION_RX;
444 reg = TEGRA30_DAM_AUDIOCIF_CH1_CTRL;
445 break;
446 default:
447 return -EINVAL;
448 }
449
450 tegra30_dam_writel(dams_cont_info[ifc], value, reg);
451
452 return 0;
453}
454
455void tegra30_dam_enable(int ifc, int on, int chid)
456{
457 u32 old_val, val, enreg;
458 struct tegra30_dam_context *dam = dams_cont_info[ifc];
459
460 if (ifc >= TEGRA30_NR_DAM_IFC)
461 return;
462
463 if (chid == dam_ch_in0)
464 enreg = TEGRA30_DAM_CH0_CTRL;
465 else
466 enreg = TEGRA30_DAM_CH1_CTRL;
467
468 old_val = val = tegra30_dam_readl(dam, enreg);
469
470 if (on) {
471 if (!dam->ch_enable_refcnt[chid]++)
472 val |= TEGRA30_DAM_CH0_CTRL_EN;
473 } else if (dam->ch_enable_refcnt[chid]) {
474 dam->ch_enable_refcnt[chid]--;
475 if (!dam->ch_enable_refcnt[chid])
476 val &= ~TEGRA30_DAM_CH0_CTRL_EN;
477 }
478
479 if (val != old_val)
480 tegra30_dam_writel(dam, val, enreg);
481
482 old_val = val = tegra30_dam_readl(dam, TEGRA30_DAM_CTRL);
483
484 if (dam->ch_enable_refcnt[dam_ch_in0] ||
485 dam->ch_enable_refcnt[dam_ch_in1])
486 val |= TEGRA30_DAM_CTRL_DAM_EN;
487 else
488 val &= ~TEGRA30_DAM_CTRL_DAM_EN;
489
490 if (old_val != val)
491 tegra30_dam_writel(dam, val, TEGRA30_DAM_CTRL);
492}
493
494void tegra30_dam_ch0_set_datasync(struct tegra30_dam_context *dam, int datasync)
495{
496 u32 val;
497
498 val = tegra30_dam_readl(dam, TEGRA30_DAM_CH0_CTRL);
499 val &= ~TEGRA30_DAM_CH0_CTRL_DATA_SYNC_MASK;
500 val |= datasync << TEGRA30_DAM_DATA_SYNC_SHIFT;
501 tegra30_dam_writel(dam, val, TEGRA30_DAM_CH0_CTRL);
502}
503
504void tegra30_dam_ch1_set_datasync(struct tegra30_dam_context *dam, int datasync)
505{
506 u32 val;
507
508 val = tegra30_dam_readl(dam, TEGRA30_DAM_CH1_CTRL);
509 val &= ~TEGRA30_DAM_CH1_CTRL_DATA_SYNC_MASK;
510 val |= datasync << TEGRA30_DAM_DATA_SYNC_SHIFT;
511 tegra30_dam_writel(dam, val, TEGRA30_DAM_CH1_CTRL);
512}
513
514void tegra30_dam_enable_clip_counter(struct tegra30_dam_context *dam, int on)
515{
516 u32 val;
517
518 val = tegra30_dam_readl(dam, TEGRA30_DAM_CLIP);
519 val &= ~TEGRA30_DAM_CLIP_COUNTER_ENABLE;
520 val |= on ? TEGRA30_DAM_CLIP_COUNTER_ENABLE : 0;
521 tegra30_dam_writel(dam, val, TEGRA30_DAM_CLIP);
522}
523
524static int __devinit tegra30_dam_probe(struct platform_device *pdev)
525{
526 struct resource *res, *region;
527 struct tegra30_dam_context *dam;
528 int ret = 0;
529#ifdef CONFIG_PM
530 int i;
531#endif
532 int clkm_rate;
533
534 if ((pdev->id < 0) ||
535 (pdev->id >= TEGRA30_NR_DAM_IFC)) {
536 dev_err(&pdev->dev, "ID %d out of range\n", pdev->id);
537 return -EINVAL;
538 }
539
540 dams_cont_info[pdev->id] = devm_kzalloc(&pdev->dev,
541 sizeof(struct tegra30_dam_context),
542 GFP_KERNEL);
543 if (!dams_cont_info[pdev->id]) {
544 dev_err(&pdev->dev, "Can't allocate dam context\n");
545 ret = -ENOMEM;
546 goto exit;
547 }
548 dam = dams_cont_info[pdev->id];
549
550 dam->dam_clk = clk_get(&pdev->dev, NULL);
551 if (IS_ERR(dam->dam_clk)) {
552 dev_err(&pdev->dev, "Can't retrieve dam clock\n");
553 ret = PTR_ERR(dam->dam_clk);
554 goto err_free;
555 }
556 clkm_rate = clk_get_rate(clk_get_parent(dam->dam_clk));
557 while (clkm_rate > 12000000)
558 clkm_rate >>= 1;
559
560 clk_set_rate(dam->dam_clk,clkm_rate);
561
562 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
563 if (!res) {
564 dev_err(&pdev->dev, "No memory 0 resource\n");
565 ret = -ENODEV;
566 goto err_clk_put_dam;
567 }
568
569 region = devm_request_mem_region(&pdev->dev, res->start,
570 resource_size(res), pdev->name);
571 if (!region) {
572 dev_err(&pdev->dev, "Memory region 0 already claimed\n");
573 ret = -EBUSY;
574 goto err_clk_put_dam;
575 }
576
577 dam->damregs = devm_ioremap(&pdev->dev, res->start, resource_size(res));
578 if (!dam->damregs) {
579 dev_err(&pdev->dev, "ioremap 0 failed\n");
580 ret = -ENOMEM;
581 goto err_clk_put_dam;
582 }
583
584#ifdef CONFIG_PM
585 /* cache the POR values of DAM regs*/
586 tegra30_dam_enable_clock(pdev->id);
587
588 for (i = 0; i <= TEGRA30_DAM_CTRL_REGINDEX; i++) {
589 if ((i == TEGRA30_DAM_CTRL_RSVD_6) ||
590 (i == TEGRA30_DAM_CTRL_RSVD_10))
591 continue;
592
593 dam->reg_cache[i] =
594 tegra30_dam_readl(dam, i << 2);
595 }
596
597 tegra30_dam_disable_clock(pdev->id);
598#endif
599
600 platform_set_drvdata(pdev, dam);
601
602 tegra30_dam_debug_add(dam, pdev->id);
603
604 return 0;
605
606err_clk_put_dam:
607 clk_put(dam->dam_clk);
608err_free:
609 dams_cont_info[pdev->id] = NULL;
610exit:
611 return ret;
612}
613
614static int __devexit tegra30_dam_remove(struct platform_device *pdev)
615{
616 struct tegra30_dam_context *dam;
617
618 dam = platform_get_drvdata(pdev);
619 clk_put(dam->dam_clk);
620 tegra30_dam_debug_remove(dam);
621 dams_cont_info[pdev->id] = NULL;
622
623 return 0;
624}
625
626static struct platform_driver tegra30_dam_driver = {
627 .probe = tegra30_dam_probe,
628 .remove = __devexit_p(tegra30_dam_remove),
629 .driver = {
630 .name = DRV_NAME,
631 .owner = THIS_MODULE,
632 },
633};
634
635static int __init tegra30_dam_modinit(void)
636{
637 return platform_driver_register(&tegra30_dam_driver);
638}
639module_init(tegra30_dam_modinit);
640
641static void __exit tegra30_dam_modexit(void)
642{
643 platform_driver_unregister(&tegra30_dam_driver);
644}
645module_exit(tegra30_dam_modexit);
646
647MODULE_AUTHOR("Nikesh Oswal <noswal@nvidia.com>");
648MODULE_DESCRIPTION("Tegra 30 DAM driver");
649MODULE_LICENSE("GPL");
650MODULE_ALIAS("platform:" DRV_NAME);
diff --git a/sound/soc/tegra/tegra30_dam.h b/sound/soc/tegra/tegra30_dam.h
new file mode 100644
index 00000000000..371e8139eec
--- /dev/null
+++ b/sound/soc/tegra/tegra30_dam.h
@@ -0,0 +1,163 @@
1/*
2 * tegra30_dam.h - Tegra 30 DAM driver.
3 *
4 * Author: Nikesh Oswal <noswal@nvidia.com>
5 * Copyright (C) 2011 - NVIDIA, Inc.
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 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
19 * 02110-1301 USA
20 *
21 */
22
23#ifndef __TEGRA30_DAM_H
24#define __TEGRA30_DAM_H
25
26/* Register offsets from TEGRA30_DAM*_BASE */
27#define TEGRA30_DAM_CTRL 0
28#define TEGRA30_DAM_CLIP 4
29#define TEGRA30_DAM_CLIP_THRESHOLD 8
30#define TEGRA30_DAM_AUDIOCIF_OUT_CTRL 0x0C
31#define TEGRA30_DAM_CH0_CTRL 0x10
32#define TEGRA30_DAM_CH0_CONV 0x14
33#define TEGRA30_DAM_AUDIOCIF_CH0_CTRL 0x1C
34#define TEGRA30_DAM_CH1_CTRL 0x20
35#define TEGRA30_DAM_CH1_CONV 0x24
36#define TEGRA30_DAM_AUDIOCIF_CH1_CTRL 0x2C
37#define TEGRA30_DAM_CTRL_REGINDEX (TEGRA30_DAM_AUDIOCIF_CH1_CTRL >> 2)
38#define TEGRA30_DAM_CTRL_RSVD_6 6
39#define TEGRA30_DAM_CTRL_RSVD_10 10
40
41#define TEGRA30_NR_DAM_IFC 3
42
43#define TEGRA30_DAM_NUM_INPUT_CHANNELS 2
44
45/* Fields in TEGRA30_DAM_CTRL */
46#define TEGRA30_DAM_CTRL_SOFT_RESET_ENABLE (1 << 31)
47#define TEGRA30_DAM_CTRL_FSOUT_SHIFT 4
48#define TEGRA30_DAM_CTRL_FSOUT_MASK (0xf << TEGRA30_DAM_CTRL_FSOUT_SHIFT)
49#define TEGRA30_DAM_FS_8KHZ 0
50#define TEGRA30_DAM_FS_16KHZ 1
51#define TEGRA30_DAM_FS_44KHZ 2
52#define TEGRA30_DAM_FS_48KHZ 3
53#define TEGRA30_DAM_CTRL_FSOUT_FS8 (TEGRA30_DAM_FS_8KHZ << TEGRA30_DAM_CTRL_FSOUT_SHIFT)
54#define TEGRA30_DAM_CTRL_FSOUT_FS16 (TEGRA30_DAM_FS_16KHZ << TEGRA30_DAM_CTRL_FSOUT_SHIFT)
55#define TEGRA30_DAM_CTRL_FSOUT_FS44 (TEGRA30_DAM_FS_44KHZ << TEGRA30_DAM_CTRL_FSOUT_SHIFT)
56#define TEGRA30_DAM_CTRL_FSOUT_FS48 (TEGRA30_DAM_FS_48KHZ << TEGRA30_DAM_CTRL_FSOUT_SHIFT)
57#define TEGRA30_DAM_CTRL_CG_EN (1 << 1)
58#define TEGRA30_DAM_CTRL_DAM_EN (1 << 0)
59
60
61/* Fields in TEGRA30_DAM_CLIP */
62#define TEGRA30_DAM_CLIP_COUNTER_ENABLE (1 << 31)
63#define TEGRA30_DAM_CLIP_COUNT_MASK 0x7fffffff
64
65
66/* Fields in TEGRA30_DAM_CH0_CTRL */
67#define TEGRA30_STEP_RESET 1
68#define TEGRA30_DAM_DATA_SYNC 1
69#define TEGRA30_DAM_DATA_SYNC_SHIFT 4
70#define TEGRA30_DAM_CH0_CTRL_FSIN_SHIFT 8
71#define TEGRA30_DAM_CH0_CTRL_STEP_SHIFT 16
72#define TEGRA30_DAM_CH0_CTRL_STEP_MASK (0xffff << 16)
73#define TEGRA30_DAM_CH0_CTRL_STEP_RESET (TEGRA30_STEP_RESET << 16)
74#define TEGRA30_DAM_CH0_CTRL_FSIN_MASK (0xf << 8)
75#define TEGRA30_DAM_CH0_CTRL_FSIN_FS8 (TEGRA30_DAM_FS_8KHZ << 8)
76#define TEGRA30_DAM_CH0_CTRL_FSIN_FS16 (TEGRA30_DAM_FS_16KHZ << 8)
77#define TEGRA30_DAM_CH0_CTRL_FSIN_FS44 (TEGRA30_DAM_FS_44KHZ << 8)
78#define TEGRA30_DAM_CH0_CTRL_FSIN_FS48 (TEGRA30_DAM_FS_48KHZ << 8)
79#define TEGRA30_DAM_CH0_CTRL_DATA_SYNC_MASK (0xf << TEGRA30_DAM_DATA_SYNC_SHIFT)
80#define TEGRA30_DAM_CH0_CTRL_DATA_SYNC (TEGRA30_DAM_DATA_SYNC << TEGRA30_DAM_DATA_SYNC_SHIFT)
81#define TEGRA30_DAM_CH0_CTRL_EN (1 << 0)
82
83
84/* Fields in TEGRA30_DAM_CH0_CONV */
85#define TEGRA30_DAM_GAIN 1
86#define TEGRA30_DAM_GAIN_SHIFT 0
87#define TEGRA30_DAM_CH0_CONV_GAIN (TEGRA30_DAM_GAIN << TEGRA30_DAM_GAIN_SHIFT)
88
89/* Fields in TEGRA30_DAM_CH1_CTRL */
90#define TEGRA30_DAM_CH1_CTRL_DATA_SYNC_MASK (0xf << TEGRA30_DAM_DATA_SYNC_SHIFT)
91#define TEGRA30_DAM_CH1_CTRL_DATA_SYNC (TEGRA30_DAM_DATA_SYNC << TEGRA30_DAM_DATA_SYNC_SHIFT)
92#define TEGRA30_DAM_CH1_CTRL_EN (1 << 0)
93
94/* Fields in TEGRA30_DAM_CH1_CONV */
95#define TEGRA30_DAM_CH1_CONV_GAIN (TEGRA30_DAM_GAIN << TEGRA30_DAM_GAIN_SHIFT)
96
97#define TEGRA30_AUDIO_CHANNELS_SHIFT 24
98#define TEGRA30_AUDIO_CHANNELS_MASK (7 << TEGRA30_AUDIO_CHANNELS_SHIFT)
99#define TEGRA30_CLIENT_CHANNELS_SHIFT 16
100#define TEGRA30_CLIENT_CHANNELS_MASK (7 << TEGRA30_CLIENT_CHANNELS_SHIFT)
101#define TEGRA30_AUDIO_BITS_SHIFT 12
102#define TEGRA30_AUDIO_BITS_MASK (7 << TEGRA30_AUDIO_BITS_SHIFT)
103#define TEGRA30_CLIENT_BITS_SHIFT 8
104#define TEGRA30_CLIENT_BITS_MASK (7 << TEGRA30_CLIENT_BITS_SHIFT)
105#define TEGRA30_CIF_DIRECTION_TX (0 << 2)
106#define TEGRA30_CIF_DIRECTION_RX (1 << 2)
107#define TEGRA30_CIF_BIT24 5
108#define TEGRA30_CIF_BIT16 3
109#define TEGRA30_CIF_CH1 0
110#define TEGRA30_CIF_MONOCONV_COPY (1<<0)
111#define TEGRA30_CIF_STEREOCONV_CH0 (0<<4)
112
113/*
114* Audio Samplerates
115*/
116#define TEGRA30_AUDIO_SAMPLERATE_8000 8000
117#define TEGRA30_AUDIO_SAMPLERATE_16000 16000
118#define TEGRA30_AUDIO_SAMPLERATE_44100 44100
119#define TEGRA30_AUDIO_SAMPLERATE_48000 48000
120
121#define TEGRA30_DAM_CHIN0_SRC 0
122#define TEGRA30_DAM_CHIN1 1
123#define TEGRA30_DAM_CHOUT 2
124#define TEGRA30_DAM_ENABLE 1
125#define TEGRA30_DAM_DISABLE 0
126
127struct tegra30_dam_context {
128 int outsamplerate;
129 bool ch_alloc[TEGRA30_DAM_NUM_INPUT_CHANNELS];
130 int ch_enable_refcnt[TEGRA30_DAM_NUM_INPUT_CHANNELS];
131 int ch_insamplerate[TEGRA30_DAM_NUM_INPUT_CHANNELS];
132#ifdef CONFIG_PM
133 int reg_cache[TEGRA30_DAM_CTRL_REGINDEX + 1];
134#endif
135 struct clk *dam_clk;
136 bool in_use;
137 void __iomem *damregs;
138 struct dentry *debug;
139};
140
141struct tegra30_dam_src_step_table {
142 int insample;
143 int outsample;
144 int stepreset;
145};
146
147#ifdef CONFIG_PM
148int tegra30_dam_resume(int ifc);
149#endif
150void tegra30_dam_disable_clock(int ifc);
151int tegra30_dam_enable_clock(int ifc);
152int tegra30_dam_allocate_controller(void);
153int tegra30_dam_allocate_channel(int ifc, int chid);
154int tegra30_dam_free_channel(int ifc, int chid);
155int tegra30_dam_free_controller(int ifc);
156void tegra30_dam_set_samplerate(int ifc, int chtype, int samplerate);
157int tegra30_dam_set_gain(int ifc, int chtype, int gain);
158int tegra30_dam_set_acif(int ifc, int chtype, unsigned int audio_channels,
159 unsigned int audio_bits, unsigned int client_channels,
160 unsigned int client_bits);
161void tegra30_dam_enable(int ifc, int on, int chtype);
162
163#endif
diff --git a/sound/soc/tegra/tegra30_spdif.c b/sound/soc/tegra/tegra30_spdif.c
new file mode 100644
index 00000000000..038127c0afb
--- /dev/null
+++ b/sound/soc/tegra/tegra30_spdif.c
@@ -0,0 +1,505 @@
1/*
2 * tegra30_spdif.c - Tegra30 SPDIF driver
3 *
4 * Author: Sumit Bhattacharya <sumitb@nvidia.com>
5 * Copyright (C) 2011 - NVIDIA, Inc.
6 *
7 * Based on code copyright/by:
8 *
9 * Copyright (c) 2009-2011, NVIDIA Corporation.
10 * Scott Peterson <speterson@nvidia.com>
11 *
12 * Copyright (C) 2010 Google, Inc.
13 * Iliyan Malchev <malchev@google.com>
14 *
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License
17 * version 2 as published by the Free Software Foundation.
18 *
19 * This program is distributed in the hope that it will be useful, but
20 * WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 * General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software
26 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
27 * 02110-1301 USA
28 *
29 */
30
31#include <linux/clk.h>
32#include <linux/module.h>
33#include <linux/debugfs.h>
34#include <linux/device.h>
35#include <linux/platform_device.h>
36#include <linux/seq_file.h>
37#include <linux/slab.h>
38#include <linux/io.h>
39#include <mach/iomap.h>
40#include <mach/hdmi-audio.h>
41#include <sound/core.h>
42#include <sound/pcm.h>
43#include <sound/pcm_params.h>
44#include <sound/soc.h>
45
46#include "tegra30_spdif.h"
47
48#define DRV_NAME "tegra30-spdif"
49
50static inline void tegra30_spdif_write(struct tegra30_spdif *spdif,
51 u32 reg, u32 val)
52{
53 __raw_writel(val, spdif->regs + reg);
54}
55
56static inline u32 tegra30_spdif_read(struct tegra30_spdif *spdif, u32 reg)
57{
58 return __raw_readl(spdif->regs + reg);
59}
60
61static void tegra30_spdif_enable_clocks(struct tegra30_spdif *spdif)
62{
63 clk_enable(spdif->clk_spdif_out);
64 tegra30_ahub_enable_clocks();
65}
66
67static void tegra30_spdif_disable_clocks(struct tegra30_spdif *spdif)
68{
69 tegra30_ahub_disable_clocks();
70 clk_disable(spdif->clk_spdif_out);
71}
72
73#ifdef CONFIG_DEBUG_FS
74static int tegra30_spdif_show(struct seq_file *s, void *unused)
75{
76#define REG(r) { r, #r }
77 static const struct {
78 int offset;
79 const char *name;
80 } regs[] = {
81 REG(TEGRA30_SPDIF_CTRL),
82 REG(TEGRA30_SPDIF_STROBE_CTRL),
83 REG(TEGRA30_SPDIF_CIF_TXD_CTRL),
84 REG(TEGRA30_SPDIF_CIF_RXD_CTRL),
85 REG(TEGRA30_SPDIF_CIF_TXU_CTRL),
86 REG(TEGRA30_SPDIF_CIF_RXU_CTRL),
87 REG(TEGRA30_SPDIF_CH_STA_RX_A),
88 REG(TEGRA30_SPDIF_CH_STA_RX_B),
89 REG(TEGRA30_SPDIF_CH_STA_RX_C),
90 REG(TEGRA30_SPDIF_CH_STA_RX_D),
91 REG(TEGRA30_SPDIF_CH_STA_RX_E),
92 REG(TEGRA30_SPDIF_CH_STA_RX_F),
93 REG(TEGRA30_SPDIF_CH_STA_TX_A),
94 REG(TEGRA30_SPDIF_CH_STA_TX_B),
95 REG(TEGRA30_SPDIF_CH_STA_TX_C),
96 REG(TEGRA30_SPDIF_CH_STA_TX_D),
97 REG(TEGRA30_SPDIF_CH_STA_TX_E),
98 REG(TEGRA30_SPDIF_CH_STA_TX_F),
99 REG(TEGRA30_SPDIF_FLOWCTL_CTRL),
100 REG(TEGRA30_SPDIF_TX_STEP),
101 REG(TEGRA30_SPDIF_FLOW_STATUS),
102 REG(TEGRA30_SPDIF_FLOW_TOTAL),
103 REG(TEGRA30_SPDIF_FLOW_OVER),
104 REG(TEGRA30_SPDIF_FLOW_UNDER),
105 REG(TEGRA30_SPDIF_LCOEF_1_4_0),
106 REG(TEGRA30_SPDIF_LCOEF_1_4_1),
107 REG(TEGRA30_SPDIF_LCOEF_1_4_2),
108 REG(TEGRA30_SPDIF_LCOEF_1_4_3),
109 REG(TEGRA30_SPDIF_LCOEF_1_4_4),
110 REG(TEGRA30_SPDIF_LCOEF_1_4_5),
111 REG(TEGRA30_SPDIF_LCOEF_2_4_0),
112 REG(TEGRA30_SPDIF_LCOEF_2_4_1),
113 REG(TEGRA30_SPDIF_LCOEF_2_4_2),
114 };
115#undef REG
116
117 struct tegra30_spdif *spdif = s->private;
118 int i;
119
120 tegra30_spdif_enable_clocks(spdif);
121
122 for (i = 0; i < ARRAY_SIZE(regs); i++) {
123 u32 val = tegra30_spdif_read(spdif, regs[i].offset);
124 seq_printf(s, "%s = %08x\n", regs[i].name, val);
125 }
126
127 tegra30_spdif_disable_clocks(spdif);
128
129 return 0;
130}
131
132static int tegra30_spdif_debug_open(struct inode *inode, struct file *file)
133{
134 return single_open(file, tegra30_spdif_show, inode->i_private);
135}
136
137static const struct file_operations tegra30_spdif_debug_fops = {
138 .open = tegra30_spdif_debug_open,
139 .read = seq_read,
140 .llseek = seq_lseek,
141 .release = single_release,
142};
143
144static void tegra30_spdif_debug_add(struct tegra30_spdif *spdif)
145{
146 char name[] = DRV_NAME;
147
148 spdif->debug = debugfs_create_file(name, S_IRUGO, snd_soc_debugfs_root,
149 spdif, &tegra30_spdif_debug_fops);
150}
151
152static void tegra30_spdif_debug_remove(struct tegra30_spdif *spdif)
153{
154 if (spdif->debug)
155 debugfs_remove(spdif->debug);
156}
157#else
158static inline void tegra30_spdif_debug_add(struct tegra30_spdif *spdif)
159{
160}
161
162static inline void tegra30_spdif_debug_remove(struct tegra30_spdif *spdif)
163{
164}
165#endif
166
167int tegra30_spdif_startup(struct snd_pcm_substream *substream,
168 struct snd_soc_dai *dai)
169{
170 struct tegra30_spdif *spdif = snd_soc_dai_get_drvdata(dai);
171 int ret = 0;
172
173 tegra30_spdif_enable_clocks(spdif);
174
175 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
176 ret = tegra30_ahub_allocate_tx_fifo(&spdif->txcif,
177 &spdif->playback_dma_data.addr,
178 &spdif->playback_dma_data.req_sel);
179 spdif->playback_dma_data.wrap = 4;
180 spdif->playback_dma_data.width = 32;
181 tegra30_ahub_set_rx_cif_source(TEGRA30_AHUB_RXCIF_SPDIF_RX0,
182 spdif->txcif);
183 }
184
185 tegra30_spdif_disable_clocks(spdif);
186
187 return ret;
188}
189
190void tegra30_spdif_shutdown(struct snd_pcm_substream *substream,
191 struct snd_soc_dai *dai)
192{
193 struct tegra30_spdif *spdif = snd_soc_dai_get_drvdata(dai);
194
195 tegra30_spdif_enable_clocks(spdif);
196
197 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
198 tegra30_ahub_unset_rx_cif_source(TEGRA30_AHUB_RXCIF_SPDIF_RX0);
199 tegra30_ahub_free_tx_fifo(spdif->txcif);
200 }
201
202 tegra30_spdif_disable_clocks(spdif);
203}
204
205static int tegra30_spdif_hw_params(struct snd_pcm_substream *substream,
206 struct snd_pcm_hw_params *params,
207 struct snd_soc_dai *dai)
208{
209 struct device *dev = substream->pcm->card->dev;
210 struct tegra30_spdif *spdif = snd_soc_dai_get_drvdata(dai);
211 int ret, srate, spdifclock;
212
213 if (substream->stream != SNDRV_PCM_STREAM_PLAYBACK) {
214 dev_err(dev, "spdif capture is not supported\n");
215 return -EINVAL;
216 }
217
218 spdif->reg_ctrl &= ~TEGRA30_SPDIF_CTRL_BIT_MODE_MASK;
219 switch (params_format(params)) {
220 case SNDRV_PCM_FORMAT_S16_LE:
221 spdif->reg_ctrl |= TEGRA30_SPDIF_CTRL_PACK_ENABLE;
222 spdif->reg_ctrl |= TEGRA30_SPDIF_CTRL_BIT_MODE_16BIT;
223 break;
224 default:
225 return -EINVAL;
226 }
227
228 srate = params_rate(params);
229 spdif->reg_ch_sta_a &= ~TEGRA30_SPDIF_CH_STA_TX_A_SAMP_FREQ_MASK;
230 spdif->reg_ch_sta_b &= ~TEGRA30_SPDIF_CH_STA_TX_B_ORIG_SAMP_FREQ_MASK;
231 switch (srate) {
232 case 32000:
233 spdifclock = 4096000;
234 spdif->reg_ch_sta_a |=
235 TEGRA30_SPDIF_CH_STA_TX_A_SAMP_FREQ_32000;
236 spdif->reg_ch_sta_b |=
237 TEGRA30_SPDIF_CH_STA_TX_B_ORIG_SAMP_FREQ_32000;
238 break;
239 case 44100:
240 spdifclock = 5644800;
241 spdif->reg_ch_sta_a |=
242 TEGRA30_SPDIF_CH_STA_TX_A_SAMP_FREQ_44100;
243 spdif->reg_ch_sta_b |=
244 TEGRA30_SPDIF_CH_STA_TX_B_ORIG_SAMP_FREQ_44100;
245 break;
246 case 48000:
247 spdifclock = 6144000;
248 spdif->reg_ch_sta_a |=
249 TEGRA30_SPDIF_CH_STA_TX_A_SAMP_FREQ_48000;
250 spdif->reg_ch_sta_b |=
251 TEGRA30_SPDIF_CH_STA_TX_B_ORIG_SAMP_FREQ_48000;
252 break;
253 case 88200:
254 spdifclock = 11289600;
255 spdif->reg_ch_sta_a |=
256 TEGRA30_SPDIF_CH_STA_TX_A_SAMP_FREQ_88200;
257 spdif->reg_ch_sta_b |=
258 TEGRA30_SPDIF_CH_STA_TX_B_ORIG_SAMP_FREQ_88200;
259 break;
260 case 96000:
261 spdifclock = 12288000;
262 spdif->reg_ch_sta_a |=
263 TEGRA30_SPDIF_CH_STA_TX_A_SAMP_FREQ_96000;
264 spdif->reg_ch_sta_b |=
265 TEGRA30_SPDIF_CH_STA_TX_B_ORIG_SAMP_FREQ_96000;
266 break;
267 case 176400:
268 spdifclock = 22579200;
269 spdif->reg_ch_sta_a |=
270 TEGRA30_SPDIF_CH_STA_TX_A_SAMP_FREQ_176400;
271 spdif->reg_ch_sta_b |=
272 TEGRA30_SPDIF_CH_STA_TX_B_ORIG_SAMP_FREQ_176400;
273 break;
274 case 192000:
275 spdifclock = 24576000;
276 spdif->reg_ch_sta_a |=
277 TEGRA30_SPDIF_CH_STA_TX_A_SAMP_FREQ_192000;
278 spdif->reg_ch_sta_b |=
279 TEGRA30_SPDIF_CH_STA_TX_B_ORIG_SAMP_FREQ_192000;
280 break;
281 default:
282 return -EINVAL;
283 }
284
285 ret = clk_set_rate(spdif->clk_spdif_out, spdifclock);
286 if (ret) {
287 dev_err(dev, "Can't set SPDIF clock rate: %d\n", ret);
288 return ret;
289 }
290
291 tegra30_spdif_enable_clocks(spdif);
292
293 tegra30_spdif_write(spdif, TEGRA30_SPDIF_CH_STA_TX_A,
294 spdif->reg_ch_sta_a);
295 tegra30_spdif_write(spdif, TEGRA30_SPDIF_CH_STA_TX_B,
296 spdif->reg_ch_sta_b);
297
298 tegra30_spdif_disable_clocks(spdif);
299
300 ret = tegra_hdmi_setup_audio_freq_source(srate, SPDIF);
301 if (ret) {
302 dev_err(dev, "Can't set HDMI audio freq source: %d\n", ret);
303 return ret;
304 }
305
306 return 0;
307}
308
309static void tegra30_spdif_start_playback(struct tegra30_spdif *spdif)
310{
311 tegra30_ahub_enable_tx_fifo(spdif->txcif);
312 spdif->reg_ctrl |= TEGRA30_SPDIF_CTRL_TX_EN_ENABLE |
313 TEGRA30_SPDIF_CTRL_TC_EN_ENABLE;
314 tegra30_spdif_write(spdif, TEGRA30_SPDIF_CTRL, spdif->reg_ctrl);
315}
316
317static void tegra30_spdif_stop_playback(struct tegra30_spdif *spdif)
318{
319 tegra30_ahub_disable_tx_fifo(spdif->txcif);
320 spdif->reg_ctrl &= ~(TEGRA30_SPDIF_CTRL_TX_EN_ENABLE |
321 TEGRA30_SPDIF_CTRL_TC_EN_ENABLE);
322 tegra30_spdif_write(spdif, TEGRA30_SPDIF_CTRL, spdif->reg_ctrl);
323}
324
325static int tegra30_spdif_trigger(struct snd_pcm_substream *substream, int cmd,
326 struct snd_soc_dai *dai)
327{
328 struct tegra30_spdif *spdif = snd_soc_dai_get_drvdata(dai);
329
330 switch (cmd) {
331 case SNDRV_PCM_TRIGGER_START:
332 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
333 case SNDRV_PCM_TRIGGER_RESUME:
334 tegra30_spdif_enable_clocks(spdif);
335 tegra30_spdif_start_playback(spdif);
336 break;
337 case SNDRV_PCM_TRIGGER_STOP:
338 case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
339 case SNDRV_PCM_TRIGGER_SUSPEND:
340 tegra30_spdif_stop_playback(spdif);
341 tegra30_spdif_disable_clocks(spdif);
342 break;
343 default:
344 return -EINVAL;
345 }
346
347 return 0;
348}
349
350static int tegra30_spdif_probe(struct snd_soc_dai *dai)
351{
352 struct tegra30_spdif *spdif = snd_soc_dai_get_drvdata(dai);
353
354 dai->playback_dma_data = &spdif->playback_dma_data;
355 dai->capture_dma_data = NULL;
356
357 return 0;
358}
359
360static struct snd_soc_dai_ops tegra30_spdif_dai_ops = {
361 .startup = tegra30_spdif_startup,
362 .shutdown = tegra30_spdif_shutdown,
363 .hw_params = tegra30_spdif_hw_params,
364 .trigger = tegra30_spdif_trigger,
365};
366
367struct snd_soc_dai_driver tegra30_spdif_dai = {
368 .name = DRV_NAME,
369 .probe = tegra30_spdif_probe,
370 .playback = {
371 .channels_min = 2,
372 .channels_max = 2,
373 .rates = SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 |
374 SNDRV_PCM_RATE_48000,
375 .formats = SNDRV_PCM_FMTBIT_S16_LE,
376 },
377 .ops = &tegra30_spdif_dai_ops,
378};
379
380static __devinit int tegra30_spdif_platform_probe(struct platform_device *pdev)
381{
382 struct tegra30_spdif *spdif;
383 struct resource *mem, *memregion;
384 int ret;
385 u32 reg_val;
386
387 spdif = kzalloc(sizeof(struct tegra30_spdif), GFP_KERNEL);
388 if (!spdif) {
389 dev_err(&pdev->dev, "Can't allocate tegra30_spdif\n");
390 ret = -ENOMEM;
391 goto exit;
392 }
393 dev_set_drvdata(&pdev->dev, spdif);
394
395 spdif->clk_spdif_out = clk_get(&pdev->dev, "spdif_out");
396 if (IS_ERR(spdif->clk_spdif_out)) {
397 dev_err(&pdev->dev, "Can't retrieve spdif clock\n");
398 ret = PTR_ERR(spdif->clk_spdif_out);
399 goto err_free;
400 }
401
402 mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
403 if (!mem) {
404 dev_err(&pdev->dev, "No memory resource\n");
405 ret = -ENODEV;
406 goto err_clk_put_spdif;
407 }
408
409 memregion = request_mem_region(mem->start, resource_size(mem),
410 DRV_NAME);
411 if (!memregion) {
412 dev_err(&pdev->dev, "Memory region already claimed\n");
413 ret = -EBUSY;
414 goto err_clk_put_spdif;
415 }
416
417 spdif->regs = ioremap(mem->start, resource_size(mem));
418 if (!spdif->regs) {
419 dev_err(&pdev->dev, "ioremap failed\n");
420 ret = -ENOMEM;
421 goto err_release;
422 }
423
424 tegra30_spdif_enable_clocks(spdif);
425
426 reg_val = TEGRA30_SPDIF_CIF_TXD_CTRL_DIRECTION_RXCIF |
427 TEGRA30_SPDIF_CIF_TXD_CTRL_AUDIO_BIT16 |
428 TEGRA30_SPDIF_CIF_TXD_CTRL_CLIENT_BIT16 |
429 TEGRA30_SPDIF_CIF_TXD_CTRL_AUDIO_CH2 |
430 TEGRA30_SPDIF_CIF_TXD_CTRL_CLIENT_CH2 |
431 (3 << TEGRA30_SPDIF_CIF_TXD_CTRL_FIFO_TH_SHIFT);
432
433 tegra30_spdif_write(spdif, TEGRA30_SPDIF_CIF_TXD_CTRL, reg_val);
434
435 tegra30_spdif_disable_clocks(spdif);
436
437 ret = snd_soc_register_dai(&pdev->dev, &tegra30_spdif_dai);
438 if (ret) {
439 dev_err(&pdev->dev, "Could not register DAI: %d\n", ret);
440 ret = -ENOMEM;
441 goto err_unmap;
442 }
443
444 tegra30_spdif_debug_add(spdif);
445
446 return 0;
447
448err_unmap:
449 iounmap(spdif->regs);
450err_release:
451 release_mem_region(mem->start, resource_size(mem));
452err_clk_put_spdif:
453 clk_put(spdif->clk_spdif_out);
454err_free:
455 kfree(spdif);
456exit:
457 return ret;
458}
459
460static int __devexit tegra30_spdif_platform_remove(struct platform_device *pdev)
461{
462 struct tegra30_spdif *spdif = dev_get_drvdata(&pdev->dev);
463 struct resource *res;
464
465 snd_soc_unregister_dai(&pdev->dev);
466
467 tegra30_spdif_debug_remove(spdif);
468
469 iounmap(spdif->regs);
470
471 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
472 release_mem_region(res->start, resource_size(res));
473
474 clk_put(spdif->clk_spdif_out);
475
476 kfree(spdif);
477
478 return 0;
479}
480
481static struct platform_driver tegra30_spdif_driver = {
482 .driver = {
483 .name = DRV_NAME,
484 .owner = THIS_MODULE,
485 },
486 .probe = tegra30_spdif_platform_probe,
487 .remove = __devexit_p(tegra30_spdif_platform_remove),
488};
489
490static int __init snd_tegra30_spdif_init(void)
491{
492 return platform_driver_register(&tegra30_spdif_driver);
493}
494module_init(snd_tegra30_spdif_init);
495
496static void __exit snd_tegra30_spdif_exit(void)
497{
498 platform_driver_unregister(&tegra30_spdif_driver);
499}
500module_exit(snd_tegra30_spdif_exit);
501
502MODULE_AUTHOR("Sumit Bhattacharya <sumitb@nvidia.com>");
503MODULE_DESCRIPTION("Tegra30 SPDIF ASoC driver");
504MODULE_LICENSE("GPL");
505MODULE_ALIAS("platform:" DRV_NAME);
diff --git a/sound/soc/tegra/tegra30_spdif.h b/sound/soc/tegra/tegra30_spdif.h
new file mode 100644
index 00000000000..c4763c31b25
--- /dev/null
+++ b/sound/soc/tegra/tegra30_spdif.h
@@ -0,0 +1,777 @@
1/*
2 * tegra30_spdif.h - Definitions for Tegra30 SPDIF driver
3 *
4 * Author: Sumit Bhattacharya <sumitb@nvidia.com>
5 * Copyright (C) 2011 - NVIDIA, Inc.
6 *
7 * Based on code copyright/by:
8 *
9 * Copyright (c) 2009-2011, NVIDIA Corporation.
10 * Scott Peterson <speterson@nvidia.com>
11 *
12 * Copyright (C) 2010 Google, Inc.
13 * Iliyan Malchev <malchev@google.com>
14 *
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License
17 * version 2 as published by the Free Software Foundation.
18 *
19 * This program is distributed in the hope that it will be useful, but
20 * WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 * General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software
26 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
27 * 02110-1301 USA
28 *
29 */
30
31#ifndef __TEGRA30_SPDIF_H__
32#define __TEGRA30_SPDIF_H__
33
34#include "tegra_pcm.h"
35#include "tegra30_ahub.h"
36
37/* Register offsets from TEGRA_SPDIF_BASE */
38
39#define TEGRA30_SPDIF_CTRL 0x0
40#define TEGRA30_SPDIF_STROBE_CTRL 0x4
41#define TEGRA30_SPDIF_CIF_TXD_CTRL 0x08
42#define TEGRA30_SPDIF_CIF_RXD_CTRL 0x0C
43#define TEGRA30_SPDIF_CIF_TXU_CTRL 0x10
44#define TEGRA30_SPDIF_CIF_RXU_CTRL 0x14
45#define TEGRA30_SPDIF_CH_STA_RX_A 0x18
46#define TEGRA30_SPDIF_CH_STA_RX_B 0x1C
47#define TEGRA30_SPDIF_CH_STA_RX_C 0x20
48#define TEGRA30_SPDIF_CH_STA_RX_D 0x24
49#define TEGRA30_SPDIF_CH_STA_RX_E 0x28
50#define TEGRA30_SPDIF_CH_STA_RX_F 0x2C
51#define TEGRA30_SPDIF_CH_STA_TX_A 0x30
52#define TEGRA30_SPDIF_CH_STA_TX_B 0x34
53#define TEGRA30_SPDIF_CH_STA_TX_C 0x38
54#define TEGRA30_SPDIF_CH_STA_TX_D 0x3C
55#define TEGRA30_SPDIF_CH_STA_TX_E 0x40
56#define TEGRA30_SPDIF_CH_STA_TX_F 0x44
57#define TEGRA30_SPDIF_FLOWCTL_CTRL 0x70
58#define TEGRA30_SPDIF_TX_STEP 0x74
59#define TEGRA30_SPDIF_FLOW_STATUS 0x78
60#define TEGRA30_SPDIF_FLOW_TOTAL 0x7c
61#define TEGRA30_SPDIF_FLOW_OVER 0x80
62#define TEGRA30_SPDIF_FLOW_UNDER 0x84
63#define TEGRA30_SPDIF_LCOEF_1_4_0 0x88
64#define TEGRA30_SPDIF_LCOEF_1_4_1 0x8c
65#define TEGRA30_SPDIF_LCOEF_1_4_2 0x90
66#define TEGRA30_SPDIF_LCOEF_1_4_3 0x94
67#define TEGRA30_SPDIF_LCOEF_1_4_4 0x98
68#define TEGRA30_SPDIF_LCOEF_1_4_5 0x9c
69#define TEGRA30_SPDIF_LCOEF_2_4_0 0xa0
70#define TEGRA30_SPDIF_LCOEF_2_4_1 0xa4
71#define TEGRA30_SPDIF_LCOEF_2_4_2 0xa8
72
73/* Fields in TEGRA30_SPDIF_CTRL */
74#define TEGRA30_SPDIF_CTRL_FLOWCTL_EN_ENABLE (1<<31)
75#define TEGRA30_SPDIF_CTRL_CAP_LC_LEFT_CH (1<<30)
76#define TEGRA30_SPDIF_CTRL_RX_EN_ENABLE (1<<29)
77#define TEGRA30_SPDIF_CTRL_TX_EN_ENABLE (1<<28)
78#define TEGRA30_SPDIF_CTRL_TC_EN_ENABLE (1<<27)
79#define TEGRA30_SPDIF_CTRL_TU_EN_ENABLE (1<<26)
80#define TEGRA30_SPDIF_CTRL_IE_P_RSVD_ENABLE (1<<23)
81#define TEGRA30_SPDIF_CTRL_IE_B_RSVD_ENABLE (1<<22)
82#define TEGRA30_SPDIF_CTRL_IE_C_RSVD_ENABLE (1<<21)
83#define TEGRA30_SPDIF_CTRL_IE_U_RSVD_ENABLE (1<<20)
84#define TEGRA30_SPDIF_CTRL_LBK_EN_ENABLE (1<<15)
85#define TEGRA30_SPDIF_CTRL_PACK_ENABLE (1<<14)
86
87#define TEGRA30_SPDIF_BIT_MODE16 0
88#define TEGRA30_SPDIF_BIT_MODE20 1
89#define TEGRA30_SPDIF_BIT_MODE24 2
90#define TEGRA30_SPDIF_BIT_MODERAW 3
91
92#define TEGRA30_SPDIF_CTRL_BIT_MODE_SHIFT 12
93#define TEGRA30_SPDIF_CTRL_BIT_MODE_MASK (3 << TEGRA30_SPDIF_CTRL_BIT_MODE_SHIFT)
94#define TEGRA30_SPDIF_CTRL_BIT_MODE_16BIT (TEGRA30_SPDIF_BIT_MODE16 << TEGRA30_SPDIF_CTRL_BIT_MODE_SHIFT)
95#define TEGRA30_SPDIF_CTRL_BIT_MODE_20BIT (TEGRA30_SPDIF_BIT_MODE20 << TEGRA30_SPDIF_CTRL_BIT_MODE_SHIFT)
96#define TEGRA30_SPDIF_CTRL_BIT_MODE_24BIT (TEGRA30_SPDIF_BIT_MODE24 << TEGRA30_SPDIF_CTRL_BIT_MODE_SHIFT)
97#define TEGRA30_SPDIF_CTRL_BIT_MODE_RAW (TEGRA30_SPDIF_BIT_MODERAW << TEGRA30_SPDIF_CTRL_BIT_MODE_SHIFT)
98
99#define TEGRA30_SPDIF_CTRL_CG_EN_ENABLE (1<<11)
100
101#define TEGRA30_SPDIF_CTRL_OBS_SEL_SHIFT 8
102#define TEGRA30_SPDIF_CTRL_OBS_SEL_NASK (0x7 << TEGRA30_SPDIF_CTRL_OBS_SEL_SHIFT)
103
104#define TEGRA30_SPDIF_CTRL_SOFT_RESET_ENABLE (1<<7)
105
106/* Fields in TEGRA30_SPDIF_STROBE_CTRL */
107#define TEGRA30_SPDIF_STROBE_CTRL_PERIOD_SHIFT 16
108#define TEGRA30_SPDIF_STROBE_CTRL_PERIOD_MASK (0xff << TEGRA30_SPDIF_STROBE_CTRL_PERIOD_SHIFT)
109
110#define TEGRA30_SPDIF_STROBE_CTRL_STROBE (1<<15)
111
112#define TEGRA30_SPDIF_STROBE_CTRL_DATA_STROBES_SHIFT 8
113#define TEGRA30_SPDIF_STROBE_CTRL_DATA_STROBES_MASK (0x1f << TEGRA30_SPDIF_STROBE_CTRL_DATA_STROBES_SHIFT)
114
115#define TEGRA30_SPDIF_STROBE_CTRL_CLOCK_PERIOD_SHIFT 0
116#define TEGRA30_SPDIF_STROBE_CTRL_CLOCK_PERIOD_MASK (0x3f << TEGRA30_SPDIF_STROBE_CTRL_CLOCK_PERIOD_SHIFT)
117
118/* Fields in TEGRA30_SPDIF_CIF_TXD_CTRL */
119#define TEGRA30_SPDIF_CIF_TXD_CTRL_MONO_CONV_COPY (1<<0)
120#define TEGRA30_SPDIF_CIF_TXD_CTRL_TRUNCATE_CHOP (1<<1)
121#define TEGRA30_SPDIF_CIF_TXD_CTRL_DIRECTION_RXCIF (1<<2)
122#define TEGRA30_SPDIF_CIF_TXD_CTRL_REPLICATE_ENABLE (1<<3)
123
124#define TEGRA30_SPDIF_CIF_STEREO_CH0 0
125#define TEGRA30_SPDIF_CIF_STEREO_CH1 1
126#define TEGRA30_SPDIF_CIF_STEREO_AVG 2
127#define TEGRA30_SPDIF_CIF_STEREO_RSVD 3
128
129#define TEGRA30_SPDIF_CIF_TXD_CTRL_STEREO_CONV_SHIFT 4
130#define TEGRA30_SPDIF_CIF_TXD_CTRL_STEREO_CONV_MASK \
131 (0x3 << TEGRA30_SPDIF_CIF_TXD_CTRL_STEREO_CONV_SHIFT)
132#define TEGRA30_SPDIF_CIF_TXD_CTRL_STEREO_CONV_CH0 \
133 (TEGRA30_SPDIF_CIF_STEREO_CH0 << TEGRA30_SPDIF_CIF_TXD_CTRL_STEREO_CONV_SHIFT)
134#define TEGRA30_SPDIF_CIF_TXD_CTRL_STEREO_CONV_CH1 \
135 (TEGRA30_SPDIF_CIF_STEREO_CH1 << TEGRA30_SPDIF_CIF_TXD_CTRL_STEREO_CONV_SHIFT)
136#define TEGRA30_SPDIF_CIF_TXD_CTRL_STEREO_CONV_AVG \
137 (TEGRA30_SPDIF_CIF_STEREO_AVG << TEGRA30_SPDIF_CIF_TXD_CTRL_STEREO_CONV_SHIFT)
138#define TEGRA30_SPDIF_CIF_TXD_CTRL_STEREO_CONV_RSVD \
139 (TEGRA30_SPDIF_CIF_STEREO_RSVD << TEGRA30_SPDIF_CIF_TXD_CTRL_STEREO_CONV_SHIFT)
140
141#define TEGRA30_SPDIF_CIF_EXPAND_ZERO 0
142#define TEGRA30_SPDIF_CIF_EXPAND_ONE 1
143#define TEGRA30_SPDIF_CIF_EXPAND_LFSR 2
144#define TEGRA30_SPDIF_CIF_EXPAND_RSVD 3
145
146#define TEGRA30_SPDIF_CIF_TXD_CTRL_EXPAND_SHIFT 6
147#define TEGRA30_SPDIF_CIF_TXD_CTRL_EXPAND_MASK \
148 (0x3 << TEGRA30_SPDIF_CIF_TXD_CTRL_EXPAND_SHIFT)
149#define TEGRA30_SPDIF_CIF_TXD_CTRL_EXPAND_ZERO \
150 (TEGRA30_SPDIF_CIF_EXPAND_ZERO << TEGRA30_SPDIF_CIF_TXD_CTRL_EXPAND_SHIFT)
151#define TEGRA30_SPDIF_CIF_TXD_CTRL_EXPAND_ONE \
152 (TEGRA30_SPDIF_CIF_EXPAND_ONE << TEGRA30_SPDIF_CIF_TXD_CTRL_EXPAND_SHIFT)
153#define TEGRA30_SPDIF_CIF_TXD_CTRL_EXPAND_LFSR \
154 (TEGRA30_SPDIF_CIF_EXPAND_LFSR << TEGRA30_SPDIF_CIF_TXD_CTRL_EXPAND_SHIFT)
155#define TEGRA30_SPDIF_CIF_TXD_CTRL_EXPAND_RSVD \
156 (TEGRA30_SPDIF_CIF_EXPAND_RSVD << TEGRA30_SPDIF_CIF_TXD_CTRL_EXPAND_SHIFT)
157
158#define TEGRA30_SPDIF_CIF_BIT4 0
159#define TEGRA30_SPDIF_CIF_BIT8 1
160#define TEGRA30_SPDIF_CIF_BIT12 2
161#define TEGRA30_SPDIF_CIF_BIT16 3
162#define TEGRA30_SPDIF_CIF_BIT20 4
163#define TEGRA30_SPDIF_CIF_BIT24 5
164#define TEGRA30_SPDIF_CIF_BIT28 6
165#define TEGRA30_SPDIF_CIF_BIT32 7
166
167#define TEGRA30_SPDIF_CIF_TXD_CTRL_CLIENT_BITS_SHIFT 8
168#define TEGRA30_SPDIF_CIF_TXD_CTRL_CLIENT_BITS_MASK \
169 (0x7 << TEGRA30_SPDIF_CIF_TXD_CTRL_CLIENT_BITS_SHIFT)
170#define TEGRA30_SPDIF_CIF_TXD_CTRL_CLIENT_BIT4 \
171 (TEGRA30_SPDIF_CIF_BIT4 << TEGRA30_SPDIF_CIF_TXD_CTRL_CLIENT_BITS_SHIFT)
172#define TEGRA30_SPDIF_CIF_TXD_CTRL_CLIENT_BIT8 \
173 (TEGRA30_SPDIF_CIF_BIT8 << TEGRA30_SPDIF_CIF_TXD_CTRL_CLIENT_BITS_SHIFT)
174#define TEGRA30_SPDIF_CIF_TXD_CTRL_CLIENT_BIT12 \
175 (TEGRA30_SPDIF_CIF_BIT12 << TEGRA30_SPDIF_CIF_TXD_CTRL_CLIENT_BITS_SHIFT)
176#define TEGRA30_SPDIF_CIF_TXD_CTRL_CLIENT_BIT16 \
177 (TEGRA30_SPDIF_CIF_BIT16 << TEGRA30_SPDIF_CIF_TXD_CTRL_CLIENT_BITS_SHIFT)
178#define TEGRA30_SPDIF_CIF_TXD_CTRL_CLIENT_BIT20 \
179 (TEGRA30_SPDIF_CIF_BIT20 << TEGRA30_SPDIF_CIF_TXD_CTRL_CLIENT_BITS_SHIFT)
180#define TEGRA30_SPDIF_CIF_TXD_CTRL_CLIENT_BIT24 \
181 (TEGRA30_SPDIF_CIF_BIT24 << TEGRA30_SPDIF_CIF_TXD_CTRL_CLIENT_BITS_SHIFT)
182#define TEGRA30_SPDIF_CIF_TXD_CTRL_CLIENT_BIT28 \
183 (TEGRA30_SPDIF_CIF_BIT28 << TEGRA30_SPDIF_CIF_TXD_CTRL_CLIENT_BITS_SHIFT)
184#define TEGRA30_SPDIF_CIF_TXD_CTRL_CLIENT_BIT32 \
185 (TEGRA30_SPDIF_CIF_BIT32 << TEGRA30_SPDIF_CIF_TXD_CTRL_CLIENT_BITS_SHIFT)
186
187
188#define TEGRA30_SPDIF_CIF_TXD_CTRL_AUDIO_BITS_SHIFT 12
189#define TEGRA30_SPDIF_CIF_TXD_CTRL_AUDIO_BITS_MASK \
190 (0x7 << TEGRA30_SPDIF_CIF_TXD_CTRL_AUDIO_BITS_SHIFT)
191#define TEGRA30_SPDIF_CIF_TXD_CTRL_AUDIO_BIT4 \
192 (TEGRA30_SPDIF_CIF_BIT4 << TEGRA30_SPDIF_CIF_TXD_CTRL_AUDIO_BITS_SHIFT)
193#define TEGRA30_SPDIF_CIF_TXD_CTRL_AUDIO_BIT8 \
194 (TEGRA30_SPDIF_CIF_BIT8 << TEGRA30_SPDIF_CIF_TXD_CTRL_AUDIO_BITS_SHIFT)
195#define TEGRA30_SPDIF_CIF_TXD_CTRL_AUDIO_BIT12 \
196 (TEGRA30_SPDIF_CIF_BIT12 << TEGRA30_SPDIF_CIF_TXD_CTRL_AUDIO_BITS_SHIFT)
197#define TEGRA30_SPDIF_CIF_TXD_CTRL_AUDIO_BIT16 \
198 (TEGRA30_SPDIF_CIF_BIT16 << TEGRA30_SPDIF_CIF_TXD_CTRL_AUDIO_BITS_SHIFT)
199#define TEGRA30_SPDIF_CIF_TXD_CTRL_AUDIO_BIT20 \
200 (TEGRA30_SPDIF_CIF_BIT20 << TEGRA30_SPDIF_CIF_TXD_CTRL_AUDIO_BITS_SHIFT)
201#define TEGRA30_SPDIF_CIF_TXD_CTRL_AUDIO_BIT24 \
202 (TEGRA30_SPDIF_CIF_BIT24 << TEGRA30_SPDIF_CIF_TXD_CTRL_AUDIO_BITS_SHIFT)
203#define TEGRA30_SPDIF_CIF_TXD_CTRL_AUDIO_BIT28 \
204 (TEGRA30_SPDIF_CIF_BIT28 << TEGRA30_SPDIF_CIF_TXD_CTRL_AUDIO_BITS_SHIFT)
205#define TEGRA30_SPDIF_CIF_TXD_CTRL_AUDIO_BIT32 \
206 (TEGRA30_SPDIF_CIF_BIT32 << TEGRA30_SPDIF_CIF_TXD_CTRL_AUDIO_BITS_SHIFT)
207
208#define TEGRA30_SPDIF_CIF_CH1 0
209#define TEGRA30_SPDIF_CIF_CH2 1
210#define TEGRA30_SPDIF_CIF_CH3 2
211#define TEGRA30_SPDIF_CIF_CH4 3
212#define TEGRA30_SPDIF_CIF_CH5 4
213#define TEGRA30_SPDIF_CIF_CH6 5
214#define TEGRA30_SPDIF_CIF_CH7 6
215#define TEGRA30_SPDIF_CIF_CH8 7
216
217#define TEGRA30_SPDIF_CIF_TXD_CTRL_CLIENT_CH_SHIFT 16
218#define TEGRA30_SPDIF_CIF_TXD_CTRL_CLIENT_CH_MASK \
219 (0x7 << TEGRA30_SPDIF_CIF_TXD_CTRL_CLIENT_CH_SHIFT)
220#define TEGRA30_SPDIF_CIF_TXD_CTRL_CLIENT_CH1 \
221 (TEGRA30_SPDIF_CIF_CH1 << TEGRA30_SPDIF_CIF_TXD_CTRL_CLIENT_CH_SHIFT)
222#define TEGRA30_SPDIF_CIF_TXD_CTRL_CLIENT_CH2 \
223 (TEGRA30_SPDIF_CIF_CH2 << TEGRA30_SPDIF_CIF_TXD_CTRL_CLIENT_CH_SHIFT)
224#define TEGRA30_SPDIF_CIF_TXD_CTRL_CLIENT_CH3 \
225 (TEGRA30_SPDIF_CIF_CH3 << TEGRA30_SPDIF_CIF_TXD_CTRL_CLIENT_CH_SHIFT)
226#define TEGRA30_SPDIF_CIF_TXD_CTRL_CLIENT_CH4 \
227 (TEGRA30_SPDIF_CIF_CH4 << TEGRA30_SPDIF_CIF_TXD_CTRL_CLIENT_CH_SHIFT)
228#define TEGRA30_SPDIF_CIF_TXD_CTRL_CLIENT_CH5 \
229 (TEGRA30_SPDIF_CIF_CH5 << TEGRA30_SPDIF_CIF_TXD_CTRL_CLIENT_CH_SHIFT)
230#define TEGRA30_SPDIF_CIF_TXD_CTRL_CLIENT_CH6 \
231 (TEGRA30_SPDIF_CIF_CH6 << TEGRA30_SPDIF_CIF_TXD_CTRL_CLIENT_CH_SHIFT)
232#define TEGRA30_SPDIF_CIF_TXD_CTRL_CLIENT_CH7 \
233 (TEGRA30_SPDIF_CIF_CH7 << TEGRA30_SPDIF_CIF_TXD_CTRL_CLIENT_CH_SHIFT)
234#define TEGRA30_SPDIF_CIF_TXD_CTRL_CLIENT_CH8 \
235 (TEGRA30_SPDIF_CIF_CH8 << TEGRA30_SPDIF_CIF_TXD_CTRL_CLIENT_CH_SHIFT)
236
237
238#define TEGRA30_SPDIF_CIF_TXD_CTRL_AUDIO_CH_SHIFT 24
239#define TEGRA30_SPDIF_CIF_TXD_CTRL_AUDIO_CH_MASK \
240 (0x7 << TEGRA30_SPDIF_CIF_TXD_CTRL_AUDIO_CH_SHIFT)
241#define TEGRA30_SPDIF_CIF_TXD_CTRL_AUDIO_CH1 \
242 (TEGRA30_SPDIF_CIF_CH1 << TEGRA30_SPDIF_CIF_TXD_CTRL_AUDIO_CH_SHIFT)
243#define TEGRA30_SPDIF_CIF_TXD_CTRL_AUDIO_CH2 \
244 (TEGRA30_SPDIF_CIF_CH2 << TEGRA30_SPDIF_CIF_TXD_CTRL_AUDIO_CH_SHIFT)
245#define TEGRA30_SPDIF_CIF_TXD_CTRL_AUDIO_CH3 \
246 (TEGRA30_SPDIF_CIF_CH3 << TEGRA30_SPDIF_CIF_TXD_CTRL_AUDIO_CH_SHIFT)
247#define TEGRA30_SPDIF_CIF_TXD_CTRL_AUDIO_CH4 \
248 (TEGRA30_SPDIF_CIF_CH4 << TEGRA30_SPDIF_CIF_TXD_CTRL_AUDIO_CH_SHIFT)
249#define TEGRA30_SPDIF_CIF_TXD_CTRL_AUDIO_CH5 \
250 (TEGRA30_SPDIF_CIF_CH5 << TEGRA30_SPDIF_CIF_TXD_CTRL_AUDIO_CH_SHIFT)
251#define TEGRA30_SPDIF_CIF_TXD_CTRL_AUDIO_CH6 \
252 (TEGRA30_SPDIF_CIF_CH6 << TEGRA30_SPDIF_CIF_TXD_CTRL_AUDIO_CH_SHIFT)
253#define TEGRA30_SPDIF_CIF_TXD_CTRL_AUDIO_CH7 \
254 (TEGRA30_SPDIF_CIF_CH7 << TEGRA30_SPDIF_CIF_TXD_CTRL_AUDIO_CH_SHIFT)
255#define TEGRA30_SPDIF_CIF_TXD_CTRL_AUDIO_CH8 \
256 (TEGRA30_SPDIF_CIF_CH8 << TEGRA30_SPDIF_CIF_TXD_CTRL_AUDIO_CH_SHIFT)
257
258#define TEGRA30_SPDIF_CIF_TXD_CTRL_FIFO_TH_SHIFT 28
259#define TEGRA30_SPDIF_CIF_TXD_CTRL_FIFO_TH_MASK (0x7 << TEGRA30_SPDIF_CIF_TXD_CTRL_FIFO_TH_SHIFT)
260
261/* Fields in TEGRA30_TEGRA30_SPDIF_CIF_RXD_CTRL */
262#define TEGRA30_SPDIF_CIF_RXD_CTRL_MONO_CONV_COPY (1<<0)
263#define TEGRA30_SPDIF_CIF_RXD_CTRL_TRUNCATE_CHOP (1<<1)
264#define TEGRA30_SPDIF_CIF_RXD_CTRL_DIRECTION_RXCIF (1<<2)
265#define TEGRA30_SPDIF_CIF_RXD_CTRL_REPLICATE_ENABLE (1<<3)
266
267#define TEGRA30_SPDIF_CIF_RXD_CTRL_STEREO_CONV_SHIFT 4
268#define TEGRA30_SPDIF_CIF_RXD_CTRL_STEREO_CONV_MASK \
269 (0x3 << TEGRA30_SPDIF_CIF_RXD_CTRL_STEREO_CONV_SHIFT)
270#define TEGRA30_SPDIF_CIF_RXD_CTRL_STEREO_CONV_CH0 \
271 (TEGRA30_SPDIF_CIF_STEREO_CH0 << TEGRA30_SPDIF_CIF_RXD_CTRL_STEREO_CONV_SHIFT)
272#define TEGRA30_SPDIF_CIF_RXD_CTRL_STEREO_CONV_CH1 \
273 (TEGRA30_SPDIF_CIF_STEREO_CH1 << TEGRA30_SPDIF_CIF_RXD_CTRL_STEREO_CONV_SHIFT)
274#define TEGRA30_SPDIF_CIF_RXD_CTRL_STEREO_CONV_AVG \
275 (TEGRA30_SPDIF_CIF_STEREO_AVG << TEGRA30_SPDIF_CIF_RXD_CTRL_STEREO_CONV_SHIFT)
276#define TEGRA30_SPDIF_CIF_RXD_CTRL_STEREO_CONV_RSVD \
277 (TEGRA30_SPDIF_CIF_STEREO_RSVD << TEGRA30_SPDIF_CIF_RXD_CTRL_STEREO_CONV_SHIFT)
278
279
280#define TEGRA30_SPDIF_CIF_RXD_CTRL_EXPAND_SHIFT 6
281#define TEGRA30_SPDIF_CIF_RXD_CTRL_EXPAND_MASK \
282 (0x3 << TEGRA30_SPDIF_CIF_RXD_CTRL_EXPAND_SHIFT)
283#define TEGRA30_SPDIF_CIF_RXD_CTRL_EXPAND_ZERO \
284 (TEGRA30_SPDIF_CIF_EXPAND_ZERO << TEGRA30_SPDIF_CIF_RXD_CTRL_EXPAND_SHIFT)
285#define TEGRA30_SPDIF_CIF_RXD_CTRL_EXPAND_ONE \
286 (TEGRA30_SPDIF_CIF_EXPAND_ONE << TEGRA30_SPDIF_CIF_RXD_CTRL_EXPAND_SHIFT)
287#define TEGRA30_SPDIF_CIF_RXD_CTRL_EXPAND_LFSR \
288 (TEGRA30_SPDIF_CIF_EXPAND_LFSR << TEGRA30_SPDIF_CIF_RXD_CTRL_EXPAND_SHIFT)
289#define TEGRA30_SPDIF_CIF_RXD_CTRL_EXPAND_RSVD \
290
291
292#define TEGRA30_SPDIF_CIF_RXD_CTRL_CLIENT_BITS_SHIFT 8
293#define TEGRA30_SPDIF_CIF_RXD_CTRL_CLIENT_BITS_MASK \
294 (0x7 << TEGRA30_SPDIF_CIF_RXD_CTRL_CLIENT_BITS_SHIFT)
295#define TEGRA30_SPDIF_CIF_RXD_CTRL_CLIENT_BIT4 \
296 (TEGRA30_SPDIF_CIF_BIT4 << TEGRA30_SPDIF_CIF_RXD_CTRL_CLIENT_BITS_SHIFT)
297#define TEGRA30_SPDIF_CIF_RXD_CTRL_CLIENT_BIT8 \
298 (TEGRA30_SPDIF_CIF_BIT8 << TEGRA30_SPDIF_CIF_RXD_CTRL_CLIENT_BITS_SHIFT)
299#define TEGRA30_SPDIF_CIF_RXD_CTRL_CLIENT_BIT12 \
300 (TEGRA30_SPDIF_CIF_BIT12 << TEGRA30_SPDIF_CIF_RXD_CTRL_CLIENT_BITS_SHIFT)
301#define TEGRA30_SPDIF_CIF_RXD_CTRL_CLIENT_BIT16 \
302 (TEGRA30_SPDIF_CIF_BIT16 << TEGRA30_SPDIF_CIF_RXD_CTRL_CLIENT_BITS_SHIFT)
303#define TEGRA30_SPDIF_CIF_RXD_CTRL_CLIENT_BIT20 \
304 (TEGRA30_SPDIF_CIF_BIT20 << TEGRA30_SPDIF_CIF_RXD_CTRL_CLIENT_BITS_SHIFT)
305#define TEGRA30_SPDIF_CIF_RXD_CTRL_CLIENT_BIT24 \
306 (TEGRA30_SPDIF_CIF_BIT24 << TEGRA30_SPDIF_CIF_RXD_CTRL_CLIENT_BITS_SHIFT)
307#define TEGRA30_SPDIF_CIF_RXD_CTRL_CLIENT_BIT28 \
308 (TEGRA30_SPDIF_CIF_BIT28 << TEGRA30_SPDIF_CIF_RXD_CTRL_CLIENT_BITS_SHIFT)
309#define TEGRA30_SPDIF_CIF_RXD_CTRL_CLIENT_BIT32 \
310 (TEGRA30_SPDIF_CIF_BIT32 << TEGRA30_SPDIF_CIF_RXD_CTRL_CLIENT_BITS_SHIFT)
311
312#define TEGRA30_SPDIF_CIF_RXD_CTRL_AUDIO_BITS_SHIFT 12
313#define TEGRA30_SPDIF_CIF_RXD_CTRL_AUDIO_BITS_MASK \
314 (0x7 << TEGRA30_SPDIF_CIF_RXD_CTRL_AUDIO_BITS_SHIFT)
315#define TEGRA30_SPDIF_CIF_RXD_CTRL_AUDIO_BIT4 \
316 (TEGRA30_SPDIF_CIF_BIT4 << TEGRA30_SPDIF_CIF_RXD_CTRL_AUDIO_BITS_SHIFT)
317#define TEGRA30_SPDIF_CIF_RXD_CTRL_AUDIO_BIT8 \
318 (TEGRA30_SPDIF_CIF_BIT8 << TEGRA30_SPDIF_CIF_RXD_CTRL_AUDIO_BITS_SHIFT)
319#define TEGRA30_SPDIF_CIF_RXD_CTRL_AUDIO_BIT12 \
320 (TEGRA30_SPDIF_CIF_BIT12 << TEGRA30_SPDIF_CIF_RXD_CTRL_AUDIO_BITS_SHIFT)
321#define TEGRA30_SPDIF_CIF_RXD_CTRL_AUDIO_BIT16 \
322 (TEGRA30_SPDIF_CIF_BIT16 << TEGRA30_SPDIF_CIF_RXD_CTRL_AUDIO_BITS_SHIFT)
323#define TEGRA30_SPDIF_CIF_RXD_CTRL_AUDIO_BIT20 \
324 (TEGRA30_SPDIF_CIF_BIT20 << TEGRA30_SPDIF_CIF_RXD_CTRL_AUDIO_BITS_SHIFT)
325#define TEGRA30_SPDIF_CIF_RXD_CTRL_AUDIO_BIT24 \
326 (TEGRA30_SPDIF_CIF_BIT24 << TEGRA30_SPDIF_CIF_RXD_CTRL_AUDIO_BITS_SHIFT)
327#define TEGRA30_SPDIF_CIF_RXD_CTRL_AUDIO_BIT28 \
328 (TEGRA30_SPDIF_CIF_BIT28 << TEGRA30_SPDIF_CIF_RXD_CTRL_AUDIO_BITS_SHIFT)
329#define TEGRA30_SPDIF_CIF_RXD_CTRL_AUDIO_BIT32 \
330 (TEGRA30_SPDIF_CIF_BIT32 << TEGRA30_SPDIF_CIF_RXD_CTRL_AUDIO_BITS_SHIFT)
331
332
333#define TEGRA30_SPDIF_CIF_RXD_CTRL_CLIENT_CH_SHIFT 16
334#define TEGRA30_SPDIF_CIF_RXD_CTRL_CLIENT_CH_MASK \
335 (0x7 << TEGRA30_SPDIF_CIF_RXD_CTRL_CLIENT_CH_SHIFT)
336#define TEGRA30_SPDIF_CIF_RXD_CTRL_CLIENT_CH1 \
337 (TEGRA30_SPDIF_CIF_CH1 << TEGRA30_SPDIF_CIF_RXD_CTRL_CLIENT_CH_SHIFT)
338#define TEGRA30_SPDIF_CIF_RXD_CTRL_CLIENT_CH2 \
339 (TEGRA30_SPDIF_CIF_CH2 << TEGRA30_SPDIF_CIF_RXD_CTRL_CLIENT_CH_SHIFT)
340#define TEGRA30_SPDIF_CIF_RXD_CTRL_CLIENT_CH3 \
341 (TEGRA30_SPDIF_CIF_CH3 << TEGRA30_SPDIF_CIF_RXD_CTRL_CLIENT_CH_SHIFT)
342#define TEGRA30_SPDIF_CIF_RXD_CTRL_CLIENT_CH4 \
343 (TEGRA30_SPDIF_CIF_CH4 << TEGRA30_SPDIF_CIF_RXD_CTRL_CLIENT_CH_SHIFT)
344#define TEGRA30_SPDIF_CIF_RXD_CTRL_CLIENT_CH5 \
345 (TEGRA30_SPDIF_CIF_CH5 << TEGRA30_SPDIF_CIF_RXD_CTRL_CLIENT_CH_SHIFT)
346#define TEGRA30_SPDIF_CIF_RXD_CTRL_CLIENT_CH6 \
347 (TEGRA30_SPDIF_CIF_CH6 << TEGRA30_SPDIF_CIF_RXD_CTRL_CLIENT_CH_SHIFT)
348#define TEGRA30_SPDIF_CIF_RXD_CTRL_CLIENT_CH7 \
349 (TEGRA30_SPDIF_CIF_CH7 << TEGRA30_SPDIF_CIF_RXD_CTRL_CLIENT_CH_SHIFT)
350#define TEGRA30_SPDIF_CIF_RXD_CTRL_CLIENT_CH8 \
351 (TEGRA30_SPDIF_CIF_CH8 << TEGRA30_SPDIF_CIF_RXD_CTRL_CLIENT_CH_SHIFT)
352
353
354#define TEGRA30_SPDIF_CIF_RXD_CTRL_AUDIO_CHANNELS_SHIFT 24
355#define TEGRA30_SPDIF_CIF_RXD_CTRL_AUDIO_CHANNELS_MASK \
356 (0x7 << TEGRA30_SPDIF_CIF_RXD_CTRL_AUDIO_CHANNELS_SHIFT)
357#define TEGRA30_SPDIF_CIF_RXD_CTRL_AUDIO_CH1 \
358 (TEGRA30_SPDIF_CIF_CH1 << TEGRA30_SPDIF_CIF_RXD_CTRL_AUDIO_CHANNELS_SHIFT)
359#define TEGRA30_SPDIF_CIF_RXD_CTRL_AUDIO_CH2 \
360 (TEGRA30_SPDIF_CIF_CH2 << TEGRA30_SPDIF_CIF_RXD_CTRL_AUDIO_CHANNELS_SHIFT)
361#define TEGRA30_SPDIF_CIF_RXD_CTRL_AUDIO_CH3 \
362 (TEGRA30_SPDIF_CIF_CH3 << TEGRA30_SPDIF_CIF_RXD_CTRL_AUDIO_CHANNELS_SHIFT)
363#define TEGRA30_SPDIF_CIF_RXD_CTRL_AUDIO_CH4 \
364 (TEGRA30_SPDIF_CIF_CH4 << TEGRA30_SPDIF_CIF_RXD_CTRL_AUDIO_CHANNELS_SHIFT)
365#define TEGRA30_SPDIF_CIF_RXD_CTRL_AUDIO_CH5 \
366 (TEGRA30_SPDIF_CIF_CH5 << TEGRA30_SPDIF_CIF_RXD_CTRL_AUDIO_CHANNELS_SHIFT)
367#define TEGRA30_SPDIF_CIF_RXD_CTRL_AUDIO_CH6 \
368 (TEGRA30_SPDIF_CIF_CH6 << TEGRA30_SPDIF_CIF_RXD_CTRL_AUDIO_CHANNELS_SHIFT)
369#define TEGRA30_SPDIF_CIF_RXD_CTRL_AUDIO_CH7 \
370 (TEGRA30_SPDIF_CIF_CH7 << TEGRA30_SPDIF_CIF_RXD_CTRL_AUDIO_CHANNELS_SHIFT)
371#define TEGRA30_SPDIF_CIF_RXD_CTRL_AUDIO_CH8 \
372 (TEGRA30_SPDIF_CIF_CH8 << TEGRA30_SPDIF_CIF_RXD_CTRL_AUDIO_CHANNELS_SHIFT)
373
374#define TEGRA30_SPDIF_CIF_RXD_CTRL_FIFO_TH_SHIFT 28
375#define TEGRA30_SPDIF_CIF_RXD_CTRL_FIFO_TH_MASK (0x7 << TEGRA30_SPDIF_CIF_RXD_CTRL_FIFO_TH_SHIFT)
376
377/* Fields in TEGRA30_TEGRA30_SPDIF_CIF_TXU_CTRL */
378#define TEGRA30_SPDIF_CIF_TXU_CTRL_MONO_CONV_COPY (1<<0)
379#define TEGRA30_SPDIF_CIF_TXU_CTRL_TRUNCATE_CHOP (1<<1)
380#define TEGRA30_SPDIF_CIF_TXU_CTRL_DIRECTION_RXCIF (1<<2)
381#define TEGRA30_SPDIF_CIF_TXU_CTRL_REPLICATE_ENABLE (1<<3)
382
383
384#define TEGRA30_SPDIF_CIF_TXU_CTRL_STEREO_CONV_SHIFT 4
385#define TEGRA30_SPDIF_CIF_TXU_CTRL_STEREO_CONV_MASK \
386 (0x3 << TEGRA30_SPDIF_CIF_TXU_CTRL_0_STEREO_CONV_SHIFT)
387#define TEGRA30_SPDIF_CIF_TXU_CTRL_STEREO_CONV_CH0 \
388 (TEGRA30_SPDIF_CIF_STEREO_CH0 << TEGRA30_SPDIF_CIF_TXU_CTRL_0_STEREO_CONV_SHIFT)
389#define TEGRA30_SPDIF_CIF_TXU_CTRL_STEREO_CONV_CH1 \
390 (TEGRA30_SPDIF_CIF_STEREO_CH1 << TEGRA30_SPDIF_CIF_TXU_CTRL_0_STEREO_CONV_SHIFT)
391#define TEGRA30_SPDIF_CIF_TXU_CTRL_STEREO_CONV_AVG \
392 (TEGRA30_SPDIF_CIF_STEREO_AVG << TEGRA30_SPDIF_CIF_TXU_CTRL_0_STEREO_CONV_SHIFT)
393#define TEGRA30_SPDIF_CIF_TXU_CTRL_STEREO_CONV_RSVD \
394 (TEGRA30_SPDIF_CIF_STEREO_RSVD << TEGRA30_SPDIF_CIF_TXU_CTRL_0_STEREO_CONV_SHIFT)
395
396
397#define TEGRA30_SPDIF_CIF_TXU_CTRL_EXPAND_SHIFT 6
398#define TEGRA30_SPDIF_CIF_TXU_CTRL_EXPAND_MASK \
399 (0x3 << TEGRA30_SPDIF_CIF_TXU_CTRL_EXPAND_SHIFT)
400#define TEGRA30_SPDIF_CIF_TXU_CTRL_EXPAND_ZERO \
401 (TEGRA30_SPDIF_CIF_EXPAND_ZERO << TEGRA30_SPDIF_CIF_TXU_CTRL_EXPAND_SHIFT)
402#define TEGRA30_SPDIF_CIF_TXU_CTRL_EXPAND_ONE \
403 (TEGRA30_SPDIF_CIF_EXPAND_ONE << TEGRA30_SPDIF_CIF_TXU_CTRL_EXPAND_SHIFT)
404#define TEGRA30_SPDIF_CIF_TXU_CTRL_EXPAND_LFSR \
405 (TEGRA30_SPDIF_CIF_EXPAND_LFSR << TEGRA30_SPDIF_CIF_TXU_CTRL_EXPAND_SHIFT)
406#define TEGRA30_SPDIF_CIF_TXU_CTRL_EXPAND_RSVD \
407 (TEGRA30_SPDIF_CIF_EXPAND_RSVD << TEGRA30_SPDIF_CIF_TXU_CTRL_EXPAND_SHIFT)
408
409
410#define TEGRA30_SPDIF_CIF_TXU_CTRL_CLIENT_BITS_SHIFT 8
411#define TEGRA30_SPDIF_CIF_TXU_CTRL_CLIENT_BITS_MASK \
412 (0x7 << TEGRA30_SPDIF_CIF_TXU_CTRL_CLIENT_BITS_SHIFT)
413#define TEGRA30_SPDIF_CIF_TXU_CTRL_CLIENT_BIT4 \
414 (TEGRA30_SPDIF_CIF_BIT4 << TEGRA30_SPDIF_CIF_TXU_CTRL_CLIENT_BITS_SHIFT)
415#define TEGRA30_SPDIF_CIF_TXU_CTRL_CLIENT_BIT8 \
416 (TEGRA30_SPDIF_CIF_BIT8 << TEGRA30_SPDIF_CIF_TXU_CTRL_CLIENT_BITS_SHIFT)
417#define TEGRA30_SPDIF_CIF_TXU_CTRL_CLIENT_BIT12 \
418 (TEGRA30_SPDIF_CIF_BIT12 << TEGRA30_SPDIF_CIF_TXU_CTRL_CLIENT_BITS_SHIFT)
419#define TEGRA30_SPDIF_CIF_TXU_CTRL_CLIENT_BIT16 \
420 (TEGRA30_SPDIF_CIF_BIT16 << TEGRA30_SPDIF_CIF_TXU_CTRL_CLIENT_BITS_SHIFT)
421#define TEGRA30_SPDIF_CIF_TXU_CTRL_CLIENT_BIT20 \
422 (TEGRA30_SPDIF_CIF_BIT20 << TEGRA30_SPDIF_CIF_TXU_CTRL_CLIENT_BITS_SHIFT)
423#define TEGRA30_SPDIF_CIF_TXU_CTRL_CLIENT_BIT24 \
424 (TEGRA30_SPDIF_CIF_BIT24 << TEGRA30_SPDIF_CIF_TXU_CTRL_CLIENT_BITS_SHIFT)
425#define TEGRA30_SPDIF_CIF_TXU_CTRL_CLIENT_BIT28 \
426 (TEGRA30_SPDIF_CIF_BIT28 << TEGRA30_SPDIF_CIF_TXU_CTRL_CLIENT_BITS_SHIFT)
427#define TEGRA30_SPDIF_CIF_TXU_CTRL_CLIENT_BIT32 \
428 (TEGRA30_SPDIF_CIF_BIT32 << TEGRA30_SPDIF_CIF_TXU_CTRL_CLIENT_BITS_SHIFT)
429
430
431#define TEGRA30_SPDIF_CIF_TXU_CTRL_AUDIO_BITS_SHIFT 12
432#define TEGRA30_SPDIF_CIF_TXU_CTRL_AUDIO_BITS_MASK \
433 (0x7 << TEGRA30_SPDIF_CIF_TXU_CTRL_AUDIO_BITS_SHIFT)
434#define TEGRA30_SPDIF_CIF_TXU_CTRL_AUDIO_BIT4 \
435 (TEGRA30_SPDIF_CIF_BIT4 << TEGRA30_SPDIF_CIF_TXU_CTRL_AUDIO_BITS_SHIFT)
436#define TEGRA30_SPDIF_CIF_TXU_CTRL_AUDIO_BIT8 \
437 (TEGRA30_SPDIF_CIF_BIT8 << TEGRA30_SPDIF_CIF_TXU_CTRL_AUDIO_BITS_SHIFT)
438#define TEGRA30_SPDIF_CIF_TXU_CTRL_AUDIO_BIT12 \
439 (TEGRA30_SPDIF_CIF_BIT12 << TEGRA30_SPDIF_CIF_TXU_CTRL_AUDIO_BITS_SHIFT)
440#define TEGRA30_SPDIF_CIF_TXU_CTRL_AUDIO_BIT16 \
441 (TEGRA30_SPDIF_CIF_BIT16 << TEGRA30_SPDIF_CIF_TXU_CTRL_AUDIO_BITS_SHIFT)
442#define TEGRA30_SPDIF_CIF_TXU_CTRL_AUDIO_BIT20 \
443 (TEGRA30_SPDIF_CIF_BIT20 << TEGRA30_SPDIF_CIF_TXU_CTRL_AUDIO_BITS_SHIFT)
444#define TEGRA30_SPDIF_CIF_TXU_CTRL_AUDIO_BIT24 \
445 (TEGRA30_SPDIF_CIF_BIT24 << TEGRA30_SPDIF_CIF_TXU_CTRL_AUDIO_BITS_SHIFT)
446#define TEGRA30_SPDIF_CIF_TXU_CTRL_AUDIO_BIT28 \
447 (TEGRA30_SPDIF_CIF_BIT28 << TEGRA30_SPDIF_CIF_TXU_CTRL_AUDIO_BITS_SHIFT)
448#define TEGRA30_SPDIF_CIF_TXU_CTRL_AUDIO_BIT32 \
449 (TEGRA30_SPDIF_CIF_BIT32 << TEGRA30_SPDIF_CIF_TXU_CTRL_AUDIO_BITS_SHIFT)
450
451
452#define TEGRA30_SPDIF_CIF_TXU_CTRL_CLIENT_CH_SHIFT 16
453#define TEGRA30_SPDIF_CIF_TXU_CTRL_CLIENT_CH_MASK \
454 (0x7 << TEGRA30_SPDIF_CIF_TXU_CTRL_CLIENT_CH_SHIFT)
455#define TEGRA30_SPDIF_CIF_TXU_CTRL_CLIENT_CH1 \
456 (TEGRA30_SPDIF_CIF_CH1 << TEGRA30_SPDIF_CIF_TXU_CTRL_CLIENT_CH_SHIFT)
457#define TEGRA30_SPDIF_CIF_TXU_CTRL_CLIENT_CH2 \
458 (TEGRA30_SPDIF_CIF_CH2 << TEGRA30_SPDIF_CIF_TXU_CTRL_CLIENT_CH_SHIFT)
459#define TEGRA30_SPDIF_CIF_TXU_CTRL_CLIENT_CH3 \
460 (TEGRA30_SPDIF_CIF_CH3 << TEGRA30_SPDIF_CIF_TXU_CTRL_CLIENT_CH_SHIFT)
461#define TEGRA30_SPDIF_CIF_TXU_CTRL_CLIENT_CH4 \
462 (TEGRA30_SPDIF_CIF_CH4 << TEGRA30_SPDIF_CIF_TXU_CTRL_CLIENT_CH_SHIFT)
463#define TEGRA30_SPDIF_CIF_TXU_CTRL_CLIENT_CH5 \
464 (TEGRA30_SPDIF_CIF_CH5 << TEGRA30_SPDIF_CIF_TXU_CTRL_CLIENT_CH_SHIFT)
465#define TEGRA30_SPDIF_CIF_TXU_CTRL_CLIENT_CH6 \
466 (TEGRA30_SPDIF_CIF_CH6 << TEGRA30_SPDIF_CIF_TXU_CTRL_CLIENT_CH_SHIFT)
467#define TEGRA30_SPDIF_CIF_TXU_CTRL_CLIENT_CH7 \
468 (TEGRA30_SPDIF_CIF_CH7 << TEGRA30_SPDIF_CIF_TXU_CTRL_CLIENT_CH_SHIFT)
469#define TEGRA30_SPDIF_CIF_TXU_CTRL_CLIENT_CH8 \
470 (TEGRA30_SPDIF_CIF_CH8 << TEGRA30_SPDIF_CIF_TXU_CTRL_CLIENT_CH_SHIFT)
471
472
473#define TEGRA30_SPDIF_CIF_TXU_CTRL_AUDIO_CH_SHIFT 24
474#define TEGRA30_SPDIF_CIF_TXU_CTRL_AUDIO_CH_MASK \
475 (0x7 << TEGRA30_SPDIF_CIF_TXU_CTRL_AUDIO_CH_SHIFT)
476#define TEGRA30_SPDIF_CIF_TXU_CTRL_AUDIO_CH1 \
477 (TEGRA30_SPDIF_CIF_CH1 << TEGRA30_SPDIF_CIF_TXU_CTRL_AUDIO_CH_SHIFT)
478#define TEGRA30_SPDIF_CIF_TXU_CTRL_AUDIO_CH2 \
479 (TEGRA30_SPDIF_CIF_CH2 << TEGRA30_SPDIF_CIF_TXU_CTRL_AUDIO_CH_SHIFT)
480#define TEGRA30_SPDIF_CIF_TXU_CTRL_AUDIO_CH3 \
481 (TEGRA30_SPDIF_CIF_CH3 << TEGRA30_SPDIF_CIF_TXU_CTRL_AUDIO_CH_SHIFT)
482#define TEGRA30_SPDIF_CIF_TXU_CTRL_AUDIO_CH4 \
483 (TEGRA30_SPDIF_CIF_CH4 << TEGRA30_SPDIF_CIF_TXU_CTRL_AUDIO_CH_SHIFT)
484#define TEGRA30_SPDIF_CIF_TXU_CTRL_AUDIO_CH5 \
485 (TEGRA30_SPDIF_CIF_CH5 << TEGRA30_SPDIF_CIF_TXU_CTRL_AUDIO_CH_SHIFT)
486#define TEGRA30_SPDIF_CIF_TXU_CTRL_AUDIO_CH6 \
487 (TEGRA30_SPDIF_CIF_CH6 << TEGRA30_SPDIF_CIF_TXU_CTRL_AUDIO_CH_SHIFT)
488#define TEGRA30_SPDIF_CIF_TXU_CTRL_AUDIO_CH7 \
489 (TEGRA30_SPDIF_CIF_CH7 << TEGRA30_SPDIF_CIF_TXU_CTRL_AUDIO_CH_SHIFT)
490#define TEGRA30_SPDIF_CIF_TXU_CTRL_AUDIO_CH8 \
491 (TEGRA30_SPDIF_CIF_CH8 << TEGRA30_SPDIF_CIF_TXU_CTRL_AUDIO_CH_SHIFT)
492
493#define TEGRA30_SPDIF_CIF_TXU_CTRL_FIFO_TH_SHIFT 28
494#define TEGRA30_SPDIF_CIF_TXU_CTRL_FIFO_TH_MASK (0x7 << TEGRA30_SPDIF_CIF_TXU_CTRL_FIFO_TH_SHIFT)
495
496/* Fields in TEGRA30_TEGRA30_SPDIF_CIF_RXU_CTRL */
497#define TEGRA30_SPDIF_CIF_RXU_CTRL_MONO_CONV_COPY (1<<0)
498#define TEGRA30_SPDIF_CIF_RXU_CTRL_TRUNCATE_CHOP (1<<1)
499#define TEGRA30_SPDIF_CIF_RXU_CTRL_DIRECTION_RXCIF (1<<2)
500#define TEGRA30_SPDIF_CIF_RXU_CTRL_REPLICATE_ENABLE (1<<3)
501
502
503#define TEGRA30_SPDIF_CIF_RXU_CTRL_STEREO_CONV_SHIFT 4
504#define TEGRA30_SPDIF_CIF_RXU_CTRL_STEREO_CONV_MASK \
505 (0x3 << TEGRA30_SPDIF_CIF_RXU_CTRL_0_STEREO_CONV_SHIFT)
506#define TEGRA30_SPDIF_CIF_RXU_CTRL_STEREO_CONV_CH0 \
507 (TEGRA30_SPDIF_CIF_STEREO_CH0 << TEGRA30_SPDIF_CIF_RXU_CTRL_0_STEREO_CONV_SHIFT)
508#define TEGRA30_SPDIF_CIF_RXU_CTRL_STEREO_CONV_CH1 \
509 (TEGRA30_SPDIF_CIF_STEREO_CH1 << TEGRA30_SPDIF_CIF_RXU_CTRL_0_STEREO_CONV_SHIFT)
510#define TEGRA30_SPDIF_CIF_RXU_CTRL_STEREO_CONV_AVG \
511 (TEGRA30_SPDIF_CIF_STEREO_AVG << TEGRA30_SPDIF_CIF_RXU_CTRL_0_STEREO_CONV_SHIFT)
512#define TEGRA30_SPDIF_CIF_RXU_CTRL_STEREO_CONV_RSVD \
513 (TEGRA30_SPDIF_CIF_STEREO_RSVD << TEGRA30_SPDIF_CIF_RXU_CTRL_0_STEREO_CONV_SHIFT)
514
515
516#define TEGRA30_SPDIF_CIF_RXU_CTRL_EXPAND_SHIFT 6
517#define TEGRA30_SPDIF_CIF_RXU_CTRL_EXPAND_MASK \
518 (0x3 << TEGRA30_SPDIF_CIF_RXU_CTRL_EXPAND_SHIFT)
519#define TEGRA30_SPDIF_CIF_RXU_CTRL_EXPAND_ZERO \
520 (TEGRA30_SPDIF_CIF_EXPAND_ZERO << TEGRA30_SPDIF_CIF_RXU_CTRL_EXPAND_SHIFT)
521#define TEGRA30_SPDIF_CIF_RXU_CTRL_EXPAND_ONE \
522 (TEGRA30_SPDIF_CIF_EXPAND_ONE << TEGRA30_SPDIF_CIF_RXU_CTRL_EXPAND_SHIFT)
523#define TEGRA30_SPDIF_CIF_RXU_CTRL_EXPAND_LFSR \
524 (TEGRA30_SPDIF_CIF_EXPAND_LFSR << TEGRA30_SPDIF_CIF_RXU_CTRL_EXPAND_SHIFT)
525#define TEGRA30_SPDIF_CIF_RXU_CTRL_EXPAND_RSVD \
526 (TEGRA30_SPDIF_CIF_EXPAND_RSVD << TEGRA30_SPDIF_CIF_RXU_CTRL_EXPAND_SHIFT)
527
528
529#define TEGRA30_SPDIF_CIF_RXU_CTRL_CLIENT_BITS_SHIFT 8
530#define TEGRA30_SPDIF_CIF_RXU_CTRL_CLIENT_BITS_MASK \
531 (0x7 << TEGRA30_SPDIF_CIF_RXU_CTRL_CLIENT_BITS_SHIFT)
532#define TEGRA30_SPDIF_CIF_RXU_CTRL_CLIENT_BIT4 \
533 (TEGRA30_SPDIF_CIF_BIT4 << TEGRA30_SPDIF_CIF_RXU_CTRL_CLIENT_BITS_SHIFT)
534#define TEGRA30_SPDIF_CIF_RXU_CTRL_CLIENT_BIT8 \
535 (TEGRA30_SPDIF_CIF_BIT8 << TEGRA30_SPDIF_CIF_RXU_CTRL_CLIENT_BITS_SHIFT)
536#define TEGRA30_SPDIF_CIF_RXU_CTRL_CLIENT_BIT12 \
537 (TEGRA30_SPDIF_CIF_BIT12 << TEGRA30_SPDIF_CIF_RXU_CTRL_CLIENT_BITS_SHIFT)
538#define TEGRA30_SPDIF_CIF_RXU_CTRL_CLIENT_BIT16 \
539 (TEGRA30_SPDIF_CIF_BIT16 << TEGRA30_SPDIF_CIF_RXU_CTRL_CLIENT_BITS_SHIFT)
540#define TEGRA30_SPDIF_CIF_RXU_CTRL_CLIENT_BIT20 \
541 (TEGRA30_SPDIF_CIF_BIT20 << TEGRA30_SPDIF_CIF_RXU_CTRL_CLIENT_BITS_SHIFT)
542#define TEGRA30_SPDIF_CIF_RXU_CTRL_CLIENT_BIT24 \
543 (TEGRA30_SPDIF_CIF_BIT24 << TEGRA30_SPDIF_CIF_RXU_CTRL_CLIENT_BITS_SHIFT)
544#define TEGRA30_SPDIF_CIF_RXU_CTRL_CLIENT_BIT28 \
545 (TEGRA30_SPDIF_CIF_BIT28 << TEGRA30_SPDIF_CIF_RXU_CTRL_CLIENT_BITS_SHIFT)
546#define TEGRA30_SPDIF_CIF_RXU_CTRL_CLIENT_BIT32 \
547 (TEGRA30_SPDIF_CIF_BIT32 << TEGRA30_SPDIF_CIF_RXU_CTRL_CLIENT_BITS_SHIFT)
548
549
550#define TEGRA30_SPDIF_CIF_RXU_CTRL_AUDIO_BITS_SHIFT 12
551#define TEGRA30_SPDIF_CIF_RXU_CTRL_AUDIO_BITS_MASK \
552 (0x7 << TEGRA30_SPDIF_CIF_RXU_CTRL_AUDIO_BITS_SHIFT)
553#define TEGRA30_SPDIF_CIF_RXU_CTRL_AUDIO_BIT4 \
554 (TEGRA30_SPDIF_CIF_BIT4 << TEGRA30_SPDIF_CIF_RXU_CTRL_AUDIO_BITS_SHIFT)
555#define TEGRA30_SPDIF_CIF_RXU_CTRL_AUDIO_BIT8 \
556 (TEGRA30_SPDIF_CIF_BIT8 << TEGRA30_SPDIF_CIF_RXU_CTRL_AUDIO_BITS_SHIFT)
557#define TEGRA30_SPDIF_CIF_RXU_CTRL_AUDIO_BIT12 \
558 (TEGRA30_SPDIF_CIF_BIT12 << TEGRA30_SPDIF_CIF_RXU_CTRL_AUDIO_BITS_SHIFT)
559#define TEGRA30_SPDIF_CIF_RXU_CTRL_AUDIO_BIT16 \
560 (TEGRA30_SPDIF_CIF_BIT16 << TEGRA30_SPDIF_CIF_RXU_CTRL_AUDIO_BITS_SHIFT)
561#define TEGRA30_SPDIF_CIF_RXU_CTRL_AUDIO_BIT20 \
562 (TEGRA30_SPDIF_CIF_BIT20 << TEGRA30_SPDIF_CIF_RXU_CTRL_AUDIO_BITS_SHIFT)
563#define TEGRA30_SPDIF_CIF_RXU_CTRL_AUDIO_BIT24 \
564 (TEGRA30_SPDIF_CIF_BIT24 << TEGRA30_SPDIF_CIF_RXU_CTRL_AUDIO_BITS_SHIFT)
565#define TEGRA30_SPDIF_CIF_RXU_CTRL_AUDIO_BIT28 \
566 (TEGRA30_SPDIF_CIF_BIT28 << TEGRA30_SPDIF_CIF_RXU_CTRL_AUDIO_BITS_SHIFT)
567#define TEGRA30_SPDIF_CIF_RXU_CTRL_AUDIO_BIT32 \
568 (TEGRA30_SPDIF_CIF_BIT32 << TEGRA30_SPDIF_CIF_RXU_CTRL_AUDIO_BITS_SHIFT)
569
570
571#define TEGRA30_SPDIF_CIF_RXU_CTRL_CLIENT_CH_SHIFT 16
572#define TEGRA30_SPDIF_CIF_RXU_CTRL_CLIENT_CH_MASK \
573 (0x7 << TEGRA30_SPDIF_CIF_RXU_CTRL_CLIENT_CH_SHIFT)
574#define TEGRA30_SPDIF_CIF_RXU_CTRL_CLIENT_CH1 \
575 (TEGRA30_SPDIF_CIF_CH1 << TEGRA30_SPDIF_CIF_RXU_CTRL_CLIENT_CH_SHIFT)
576#define TEGRA30_SPDIF_CIF_RXU_CTRL_CLIENT_CH2 \
577 (TEGRA30_SPDIF_CIF_CH2 << TEGRA30_SPDIF_CIF_RXU_CTRL_CLIENT_CH_SHIFT)
578#define TEGRA30_SPDIF_CIF_RXU_CTRL_CLIENT_CH3 \
579 (TEGRA30_SPDIF_CIF_CH3 << TEGRA30_SPDIF_CIF_RXU_CTRL_CLIENT_CH_SHIFT)
580#define TEGRA30_SPDIF_CIF_RXU_CTRL_CLIENT_CH4 \
581 (TEGRA30_SPDIF_CIF_CH4 << TEGRA30_SPDIF_CIF_RXU_CTRL_CLIENT_CH_SHIFT)
582#define TEGRA30_SPDIF_CIF_RXU_CTRL_CLIENT_CH5 \
583 (TEGRA30_SPDIF_CIF_CH5 << TEGRA30_SPDIF_CIF_RXU_CTRL_CLIENT_CH_SHIFT)
584#define TEGRA30_SPDIF_CIF_RXU_CTRL_CLIENT_CH6 \
585 (TEGRA30_SPDIF_CIF_CH6 << TEGRA30_SPDIF_CIF_RXU_CTRL_CLIENT_CH_SHIFT)
586#define TEGRA30_SPDIF_CIF_RXU_CTRL_CLIENT_CH7 \
587 (TEGRA30_SPDIF_CIF_CH7 << TEGRA30_SPDIF_CIF_RXU_CTRL_CLIENT_CH_SHIFT)
588#define TEGRA30_SPDIF_CIF_RXU_CTRL_CLIENT_CH8 \
589 (TEGRA30_SPDIF_CIF_CH8 << TEGRA30_SPDIF_CIF_RXU_CTRL_CLIENT_CH_SHIFT)
590
591
592#define TEGRA30_SPDIF_CIF_RXU_CTRL_AUDIO_CH_SHIFT 24
593#define TEGRA30_SPDIF_CIF_RXU_CTRL_AUDIO_CH_MASK \
594 (0x7 << TEGRA30_SPDIF_CIF_RXU_CTRL_AUDIO_CH_SHIFT)
595#define TEGRA30_SPDIF_CIF_RXU_CTRL_AUDIO_CH1 \
596 (TEGRA30_SPDIF_CIF_CH1 << TEGRA30_SPDIF_CIF_RXU_CTRL_AUDIO_CH_SHIFT)
597#define TEGRA30_SPDIF_CIF_RXU_CTRL_AUDIO_CH2 \
598 (TEGRA30_SPDIF_CIF_CH2 << TEGRA30_SPDIF_CIF_RXU_CTRL_AUDIO_CH_SHIFT)
599#define TEGRA30_SPDIF_CIF_RXU_CTRL_AUDIO_CH3 \
600 (TEGRA30_SPDIF_CIF_CH3 << TEGRA30_SPDIF_CIF_RXU_CTRL_AUDIO_CH_SHIFT)
601#define TEGRA30_SPDIF_CIF_RXU_CTRL_AUDIO_CH4 \
602 (TEGRA30_SPDIF_CIF_CH4 << TEGRA30_SPDIF_CIF_RXU_CTRL_AUDIO_CH_SHIFT)
603#define TEGRA30_SPDIF_CIF_RXU_CTRL_AUDIO_CH5 \
604 (TEGRA30_SPDIF_CIF_CH5 << TEGRA30_SPDIF_CIF_RXU_CTRL_AUDIO_CH_SHIFT)
605#define TEGRA30_SPDIF_CIF_RXU_CTRL_AUDIO_CH6 \
606 (TEGRA30_SPDIF_CIF_CH6 << TEGRA30_SPDIF_CIF_RXU_CTRL_AUDIO_CH_SHIFT)
607#define TEGRA30_SPDIF_CIF_RXU_CTRL_AUDIO_CH7 \
608 (TEGRA30_SPDIF_CIF_CH7 << TEGRA30_SPDIF_CIF_RXU_CTRL_AUDIO_CH_SHIFT)
609#define TEGRA30_SPDIF_CIF_RXU_CTRL_AUDIO_CH8 \
610 (TEGRA30_SPDIF_CIF_CH8 << TEGRA30_SPDIF_CIF_RXU_CTRL_AUDIO_CH_SHIFT)
611
612#define TEGRA30_SPDIF_CIF_RXU_CTRL_FIFO_TH_SHIFT 28
613#define TEGRA30_SPDIF_CIF_RXU_CTRL_FIFO_TH_MASK (0x7 << TEGRA30_SPDIF_CIF_RXU_CTRL_FIFO_TH_SHIFT)
614
615/* Fields in TEGRA30_SPDIF_CH_STA_RX_A */
616/* Fields in TEGRA30_SPDIF_CH_STA_RX_B */
617/* Fields in TEGRA30_SPDIF_CH_STA_RX_C */
618/* Fields in TEGRA30_SPDIF_CH_STA_RX_D */
619/* Fields in TEGRA30_SPDIF_CH_STA_RX_E */
620/* Fields in TEGRA30_SPDIF_CH_STA_RX_F */
621
622/*
623 * The 6-word receive channel data page buffer holds a block (192 frames) of
624 * channel status information. The order of receive is from LSB to MSB
625 * bit, and from CH_STA_RX_A to CH_STA_RX_F then back to CH_STA_RX_A.
626 */
627
628/* Fields in TEGRA30_SPDIF_CH_STA_TX_A */
629#define TEGRA30_SPDIF_CH_STA_TX_A_SF_22050 0x4
630#define TEGRA30_SPDIF_CH_STA_TX_A_SF_24000 0x6
631#define TEGRA30_SPDIF_CH_STA_TX_A_SF_32000 0x3
632#define TEGRA30_SPDIF_CH_STA_TX_A_SF_44100 0x0
633#define TEGRA30_SPDIF_CH_STA_TX_A_SF_48000 0x2
634#define TEGRA30_SPDIF_CH_STA_TX_A_SF_88200 0x8
635#define TEGRA30_SPDIF_CH_STA_TX_A_SF_96000 0xA
636#define TEGRA30_SPDIF_CH_STA_TX_A_SF_176400 0xC
637#define TEGRA30_SPDIF_CH_STA_TX_A_SF_192000 0xE
638
639#define TEGRA30_SPDIF_CH_STA_TX_A_SAMP_FREQ_SHIFT 24
640#define TEGRA30_SPDIF_CH_STA_TX_A_SAMP_FREQ_MASK \
641 (0xF << TEGRA30_SPDIF_CH_STA_TX_A_SAMP_FREQ_SHIFT)
642#define TEGRA30_SPDIF_CH_STA_TX_A_SAMP_FREQ_22050 \
643 (TEGRA30_SPDIF_CH_STA_TX_A_SF_22050 << TEGRA30_SPDIF_CH_STA_TX_A_SAMP_FREQ_SHIFT)
644#define TEGRA30_SPDIF_CH_STA_TX_A_SAMP_FREQ_24000 \
645 (TEGRA30_SPDIF_CH_STA_TX_A_SF_24000 << TEGRA30_SPDIF_CH_STA_TX_A_SAMP_FREQ_SHIFT)
646#define TEGRA30_SPDIF_CH_STA_TX_A_SAMP_FREQ_32000 \
647 (TEGRA30_SPDIF_CH_STA_TX_A_SF_32000 << TEGRA30_SPDIF_CH_STA_TX_A_SAMP_FREQ_SHIFT)
648#define TEGRA30_SPDIF_CH_STA_TX_A_SAMP_FREQ_44100 \
649 (TEGRA30_SPDIF_CH_STA_TX_A_SF_44100 << TEGRA30_SPDIF_CH_STA_TX_A_SAMP_FREQ_SHIFT)
650#define TEGRA30_SPDIF_CH_STA_TX_A_SAMP_FREQ_48000 \
651 (TEGRA30_SPDIF_CH_STA_TX_A_SF_48000 << TEGRA30_SPDIF_CH_STA_TX_A_SAMP_FREQ_SHIFT)
652#define TEGRA30_SPDIF_CH_STA_TX_A_SAMP_FREQ_88200 \
653 (TEGRA30_SPDIF_CH_STA_TX_A_SF_88200 << TEGRA30_SPDIF_CH_STA_TX_A_SAMP_FREQ_SHIFT)
654#define TEGRA30_SPDIF_CH_STA_TX_A_SAMP_FREQ_96000 \
655 (TEGRA30_SPDIF_CH_STA_TX_A_SF_96000 << TEGRA30_SPDIF_CH_STA_TX_A_SAMP_FREQ_SHIFT)
656#define TEGRA30_SPDIF_CH_STA_TX_A_SAMP_FREQ_176400 \
657 (TEGRA30_SPDIF_CH_STA_TX_A_SF_176400 << TEGRA30_SPDIF_CH_STA_TX_A_SAMP_FREQ_SHIFT)
658#define TEGRA30_SPDIF_CH_STA_TX_A_SAMP_FREQ_192000 \
659 (TEGRA30_SPDIF_CH_STA_TX_A_SF_192000 << TEGRA30_SPDIF_CH_STA_TX_A_SAMP_FREQ_SHIFT)
660
661/* Fields in TEGRA30_SPDIF_CH_STA_TX_B */
662#define TEGRA30_SPDIF_CH_STA_TX_B_SF_8000 0x6
663#define TEGRA30_SPDIF_CH_STA_TX_B_SF_11025 0xA
664#define TEGRA30_SPDIF_CH_STA_TX_B_SF_12000 0x2
665#define TEGRA30_SPDIF_CH_STA_TX_B_SF_16000 0x8
666#define TEGRA30_SPDIF_CH_STA_TX_B_SF_22050 0xB
667#define TEGRA30_SPDIF_CH_STA_TX_B_SF_24000 0x9
668#define TEGRA30_SPDIF_CH_STA_TX_B_SF_32000 0xC
669#define TEGRA30_SPDIF_CH_STA_TX_B_SF_44100 0xF
670#define TEGRA30_SPDIF_CH_STA_TX_B_SF_48000 0xD
671#define TEGRA30_SPDIF_CH_STA_TX_B_SF_88200 0x7
672#define TEGRA30_SPDIF_CH_STA_TX_B_SF_96000 0x5
673#define TEGRA30_SPDIF_CH_STA_TX_B_SF_176400 0x3
674#define TEGRA30_SPDIF_CH_STA_TX_B_SF_192000 0x1
675
676#define TEGRA30_SPDIF_CH_STA_TX_B_ORIG_SAMP_FREQ_SHIFT 4
677#define TEGRA30_SPDIF_CH_STA_TX_B_ORIG_SAMP_FREQ_MASK \
678 (0xF << TEGRA30_SPDIF_CH_STA_TX_B_ORIG_SAMP_FREQ_SHIFT)
679#define TEGRA30_SPDIF_CH_STA_TX_B_ORIG_SAMP_FREQ_8000 \
680 (TEGRA30_SPDIF_CH_STA_TX_B_SF_8000 << TEGRA30_SPDIF_CH_STA_TX_B_ORIG_SAMP_FREQ_SHIFT)
681#define TEGRA30_SPDIF_CH_STA_TX_B_ORIG_SAMP_FREQ_11025 \
682 (TEGRA30_SPDIF_CH_STA_TX_B_SF_11025 << TEGRA30_SPDIF_CH_STA_TX_B_ORIG_SAMP_FREQ_SHIFT)
683#define TEGRA30_SPDIF_CH_STA_TX_B_ORIG_SAMP_FREQ_12000 \
684 (TEGRA30_SPDIF_CH_STA_TX_B_SF_12000 << TEGRA30_SPDIF_CH_STA_TX_B_ORIG_SAMP_FREQ_SHIFT)
685#define TEGRA30_SPDIF_CH_STA_TX_B_ORIG_SAMP_FREQ_16000 \
686 (TEGRA30_SPDIF_CH_STA_TX_B_SF_16000 << TEGRA30_SPDIF_CH_STA_TX_B_ORIG_SAMP_FREQ_SHIFT)
687#define TEGRA30_SPDIF_CH_STA_TX_B_ORIG_SAMP_FREQ_22050 \
688 (TEGRA30_SPDIF_CH_STA_TX_B_SF_22025 << TEGRA30_SPDIF_CH_STA_TX_B_ORIG_SAMP_FREQ_SHIFT)
689#define TEGRA30_SPDIF_CH_STA_TX_B_ORIG_SAMP_FREQ_24000 \
690 (TEGRA30_SPDIF_CH_STA_TX_B_SF_24000 << TEGRA30_SPDIF_CH_STA_TX_B_ORIG_SAMP_FREQ_SHIFT)
691#define TEGRA30_SPDIF_CH_STA_TX_B_ORIG_SAMP_FREQ_32000 \
692 (TEGRA30_SPDIF_CH_STA_TX_B_SF_32000 << TEGRA30_SPDIF_CH_STA_TX_B_ORIG_SAMP_FREQ_SHIFT)
693#define TEGRA30_SPDIF_CH_STA_TX_B_ORIG_SAMP_FREQ_44100 \
694 (TEGRA30_SPDIF_CH_STA_TX_B_SF_44100 << TEGRA30_SPDIF_CH_STA_TX_B_ORIG_SAMP_FREQ_SHIFT)
695#define TEGRA30_SPDIF_CH_STA_TX_B_ORIG_SAMP_FREQ_48000 \
696 (TEGRA30_SPDIF_CH_STA_TX_B_SF_48000 << TEGRA30_SPDIF_CH_STA_TX_B_ORIG_SAMP_FREQ_SHIFT)
697#define TEGRA30_SPDIF_CH_STA_TX_B_ORIG_SAMP_FREQ_88200 \
698 (TEGRA30_SPDIF_CH_STA_TX_B_SF_88200 << TEGRA30_SPDIF_CH_STA_TX_B_ORIG_SAMP_FREQ_SHIFT)
699#define TEGRA30_SPDIF_CH_STA_TX_B_ORIG_SAMP_FREQ_96000 \
700 (TEGRA30_SPDIF_CH_STA_TX_B_SF_96000 << TEGRA30_SPDIF_CH_STA_TX_B_ORIG_SAMP_FREQ_SHIFT)
701#define TEGRA30_SPDIF_CH_STA_TX_B_ORIG_SAMP_FREQ_176400 \
702 (TEGRA30_SPDIF_CH_STA_TX_B_SF_176400 << TEGRA30_SPDIF_CH_STA_TX_B_ORIG_SAMP_FREQ_SHIFT)
703#define TEGRA30_SPDIF_CH_STA_TX_B_ORIG_SAMP_FREQ_192000 \
704 (TEGRA30_SPDIF_CH_STA_TX_B_SF_192000 << TEGRA30_SPDIF_CH_STA_TX_B_ORIG_SAMP_FREQ_SHIFT)
705
706/* Fields in TEGRA30_SPDIF_CH_STA_TX_C */
707/* Fields in TEGRA30_SPDIF_CH_STA_TX_D */
708/* Fields in TEGRA30_SPDIF_CH_STA_TX_E */
709/* Fields in TEGRA30_SPDIF_CH_STA_TX_F */
710
711/* Fields in TEGRA30_SPDIF_FLOWCTL_CTRL */
712#define TEGRA30_SPDIF_FLOWCTL_CTRL_FILTER_QUAD (1<<31)
713
714/* Fields in TEGRA30_SPDIF_TX_STEP */
715#define TEGRA30_SPDIF_TX_STEP_STEP_SIZE_SHIFT 0
716#define TEGRA30_SPDIF_TX_STEP_STEP_SIZE_MASK (0xffff << TEGRA30_SPDIF_TX_STEP_STEP_SIZE_SHIFT)
717
718/* Fields in TEGRA30_SPDIF_FLOW_STATUS */
719#define TEGRA30_SPDIF_FLOW_STATUS_COUNTER_EN_ENABLE (1<<1)
720#define TEGRA30_SPDIF_FLOW_STATUS_MONITOR_CLR_CLEAR (1<<2)
721#define TEGRA30_SPDIF_FLOW_STATUS_COUNTER_CLR_CLEAR (1<<3)
722#define TEGRA30_SPDIF_FLOW_STATUS_MONITOR_INT_EN_ENABLE (1<<4)
723#define TEGRA30_SPDIF_FLOW_STATUS_FLOW_OVERFLOW_OVER (1<<30)
724#define TEGRA30_SPDIF_FLOW_STATUS_FLOW_UNDERFLOW_UNDER (1<<31)
725
726/* Fields in TEGRA30_SPDIF_FLOW_TOTAL */
727/* Fields in TEGRA30_SPDIF_FLOW_OVER */
728/* Fields in TEGRA30_SPDIF_FLOW_UNDER */
729
730/* Fields in TEGRA30_SPDIF_LCOEF_1_4_0 */
731#define TEGRA30_SPDIF_LCOEF_1_4_0_COEF_SHIFT 0
732#define TEGRA30_SPDIF_LCOEF_1_4_0_COEF_MASK (0xffff << TEGRA30_TEGRA30_SPDIF_LCOEF_1_4_0_COEF_SHIFT)
733
734/* Fields in TEGRA30_SPDIF_LCOEF_1_4_1 */
735#define TEGRA30_SPDIF_LCOEF_1_4_1_COEF_SHIFT 0
736#define TEGRA30_SPDIF_LCOEF_1_4_1_COEF_MASK (0xffff << TEGRA30_SPDIF_LCOEF_1_4_1_COEF_SHIFT)
737
738/* Fields in TEGRA30_SPDIF_LCOEF_1_4_2 */
739#define TEGRA30_SPDIF_LCOEF_1_4_2_COEF_SHIFT 0
740#define TEGRA30_SPDIF_LCOEF_1_4_2_COEF_MASK (0xffff << TEGRA30_SPDIF_LCOEF_1_4_2_COEF_SHIFT)
741
742/* Fields in TEGRA30_SPDIF_LCOEF_1_4_3 */
743#define TEGRA30_SPDIF_LCOEF_1_4_3_COEF_SHIFT 0
744#define TEGRA30_SPDIF_LCOEF_1_4_3_COEF_MASK (0xffff << TEGRA30_SPDIF_LCOEF_1_4_3_COEF_SHIFT)
745
746/* Fields in TEGRA30_SPDIF_LCOEF_1_4_4 */
747#define TEGRA30_SPDIF_LCOEF_1_4_4_COEF_SHIFT 0
748#define TEGRA30_SPDIF_LCOEF_1_4_4_COEF_MASK (0xffff << TEGRA30_SPDIF_LCOEF_1_4_4_COEF_SHIFT)
749
750/* Fields in TEGRA30_SPDIF_LCOEF_1_4_5 */
751#define TEGRA30_SPDIF_LCOEF_1_4_5_COEF_SHIFT 0
752#define TEGRA30_SPDIF_LCOEF_1_4_5_COEF_MASK (0xffff << TEGRA30_SPDIF_LCOEF_1_4_5_COEF_SHIFT)
753
754/* Fields in TEGRA30_SPDIF_LCOEF_2_4_0 */
755#define TEGRA30_SPDIF_LCOEF_2_4_0_COEF_SHIFT 0
756#define TEGRA30_SPDIF_LCOEF_2_4_0_COEF_MASK (0xffff << TEGRA30_SPDIF_LCOEF_2_4_0_COEF_SHIFT)
757
758/* Fields in TEGRA30_SPDIF_LCOEF_2_4_1 */
759#define TEGRA30_SPDIF_LCOEF_2_4_1_COEF_SHIFT 0
760#define TEGRA30_SPDIF_LCOEF_2_4_1_COEF_MASK (0xffff << TEGRA30_SPDIF_LCOEF_2_4_1_COEF_SHIFT)
761
762/* Fields in TEGRA30_SPDIF_LCOEF_2_4_2 */
763#define TEGRA30_SPDIF_LCOEF_2_4_2_COEF_SHIFT 0
764#define TEGRA30_SPDIF_LCOEF_2_4_2_COEF_MASK (0xffff << SPDIF_LCOEF_2_4_2_COEF_SHIFT)
765
766struct tegra30_spdif {
767 struct clk *clk_spdif_out;
768 enum tegra30_ahub_txcif txcif;
769 struct tegra_pcm_dma_params playback_dma_data;
770 void __iomem *regs;
771 struct dentry *debug;
772 u32 reg_ctrl;
773 u32 reg_ch_sta_a;
774 u32 reg_ch_sta_b;
775};
776
777#endif
diff --git a/sound/soc/tegra/tegra_aic326x.c b/sound/soc/tegra/tegra_aic326x.c
new file mode 100644
index 00000000000..6d38934138b
--- /dev/null
+++ b/sound/soc/tegra/tegra_aic326x.c
@@ -0,0 +1,1281 @@
1/*
2 * tegra_aic326x.c - Tegra machine ASoC driver for boards using TI 3262 codec.
3 *
4 * Author: Vinod G. <vinodg@nvidia.com>
5 * Copyright (C) 2011 - NVIDIA, Inc.
6 *
7 * Based on code copyright/by:
8 *
9 * (c) 2010, 2011 Nvidia Graphics Pvt. Ltd.
10 *
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * version 2 as published by the Free Software Foundation.
14 *
15 * This program is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
23 * 02110-1301 USA
24 *
25 */
26
27#include <asm/mach-types.h>
28
29#include <linux/module.h>
30#include <linux/platform_device.h>
31#include <linux/slab.h>
32#include <linux/gpio.h>
33#include <linux/regulator/consumer.h>
34#ifdef CONFIG_SWITCH
35#include <linux/switch.h>
36#endif
37
38#include <mach/tegra_aic326x_pdata.h>
39
40#include <sound/core.h>
41#include <sound/jack.h>
42#include <sound/pcm.h>
43#include <sound/pcm_params.h>
44#include <sound/soc.h>
45
46#include "../codecs/tlv320aic326x.h"
47
48#include "tegra_pcm.h"
49#include "tegra_asoc_utils.h"
50
51#ifdef CONFIG_ARCH_TEGRA_2x_SOC
52#include "tegra20_das.h"
53#else
54#include "tegra30_ahub.h"
55#include "tegra30_i2s.h"
56#include "tegra30_dam.h"
57#endif
58
59
60#define DRV_NAME "tegra-snd-aic326x"
61
62#define GPIO_SPKR_EN BIT(0)
63#define GPIO_HP_MUTE BIT(1)
64#define GPIO_INT_MIC_EN BIT(2)
65#define GPIO_EXT_MIC_EN BIT(3)
66
67#define DAI_LINK_HIFI 0
68#define DAI_LINK_SPDIF 1
69#define DAI_LINK_BTSCO 2
70#define DAI_LINK_VOICE_CALL 3
71#define DAI_LINK_BT_VOICE_CALL 4
72#define NUM_DAI_LINKS 5
73
74extern int g_is_call_mode;
75
76#ifndef CONFIG_ARCH_TEGRA_2x_SOC
77const char *tegra_i2s_dai_name[TEGRA30_NR_I2S_IFC] = {
78 "tegra30-i2s.0",
79 "tegra30-i2s.1",
80 "tegra30-i2s.2",
81 "tegra30-i2s.3",
82 "tegra30-i2s.4",
83};
84#endif
85
86struct tegra_aic326x {
87 struct tegra_asoc_utils_data util_data;
88 struct tegra_aic326x_platform_data *pdata;
89 struct regulator *audio_reg;
90 int gpio_requested;
91 bool init_done;
92 int is_call_mode;
93 int is_device_bt;
94#ifndef CONFIG_ARCH_TEGRA_2x_SOC
95 struct codec_config codec_info[NUM_I2S_DEVICES];
96 struct snd_soc_card *pcard;
97#endif
98};
99
100static int tegra_aic326x_call_mode_info(struct snd_kcontrol *kcontrol,
101 struct snd_ctl_elem_info *uinfo)
102{
103 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
104 uinfo->count = 1;
105 uinfo->value.integer.min = 0;
106 uinfo->value.integer.max = 1;
107 return 0;
108}
109
110static int tegra_aic326x_call_mode_get(struct snd_kcontrol *kcontrol,
111 struct snd_ctl_elem_value *ucontrol)
112{
113 struct tegra_aic326x *machine = snd_kcontrol_chip(kcontrol);
114
115 ucontrol->value.integer.value[0] = machine->is_call_mode;
116
117 return 0;
118}
119
120static int tegra_aic326x_call_mode_put(struct snd_kcontrol *kcontrol,
121 struct snd_ctl_elem_value *ucontrol)
122{
123 struct tegra_aic326x *machine = snd_kcontrol_chip(kcontrol);
124 int is_call_mode_new = ucontrol->value.integer.value[0];
125#ifdef CONFIG_ARCH_TEGRA_2x_SOC
126 int codec_dap_id, codec_dap_sel, bb_dap_id, bb_dap_sel;
127#else /*assumes tegra3*/
128 int codec_index;
129 unsigned int i;
130#endif
131
132 if (machine->is_call_mode == is_call_mode_new)
133 return 0;
134
135#ifdef CONFIG_ARCH_TEGRA_2x_SOC
136 bb_dap_id = TEGRA20_DAS_DAP_ID_3;
137 bb_dap_sel = TEGRA20_DAS_DAP_SEL_DAP3;
138
139 if (machine->is_device_bt) {
140 codec_dap_id = TEGRA20_DAS_DAP_ID_4;
141 codec_dap_sel = TEGRA20_DAS_DAP_SEL_DAP4;
142 }
143 else {
144 codec_dap_id = TEGRA20_DAS_DAP_ID_2;
145 codec_dap_sel = TEGRA20_DAS_DAP_SEL_DAP2;
146 }
147#else /*assumes tegra3*/
148 if (machine->is_device_bt)
149 codec_index = BT_SCO;
150 else
151 codec_index = HIFI_CODEC;
152#endif
153
154 if (is_call_mode_new) {
155#ifdef CONFIG_ARCH_TEGRA_2x_SOC
156 tegra20_das_set_tristate(codec_dap_id, 1);
157 tegra20_das_set_tristate(bb_dap_id, 1);
158 tegra20_das_connect_dap_to_dap(codec_dap_id,
159 bb_dap_sel, 0, 0, 0);
160 tegra20_das_connect_dap_to_dap(bb_dap_id,
161 codec_dap_sel, 1, 0, 0);
162 tegra20_das_set_tristate(codec_dap_id, 0);
163 tegra20_das_set_tristate(bb_dap_id, 0);
164#else /*assumes tegra3*/
165 if (machine->codec_info[codec_index].rate == 0 ||
166 machine->codec_info[codec_index].channels == 0)
167 return -EINVAL;
168
169 for (i = 0; i < machine->pcard->num_links; i++)
170 machine->pcard->dai_link[i].ignore_suspend = 1;
171
172 tegra30_make_voice_call_connections(
173 &machine->codec_info[codec_index],
174 &machine->codec_info[BASEBAND]);
175#endif
176 } else {
177#ifdef CONFIG_ARCH_TEGRA_2x_SOC
178 tegra20_das_set_tristate(codec_dap_id, 1);
179 tegra20_das_set_tristate(bb_dap_id, 1);
180 tegra20_das_connect_dap_to_dap(bb_dap_id,
181 bb_dap_sel, 0, 0, 0);
182 tegra20_das_connect_dap_to_dap(codec_dap_id,
183 codec_dap_sel, 0, 0, 0);
184 tegra20_das_set_tristate(codec_dap_id, 0);
185 tegra20_das_set_tristate(bb_dap_id, 0);
186#else /*assumes tegra3*/
187 tegra30_break_voice_call_connections(
188 &machine->codec_info[codec_index],
189 &machine->codec_info[BASEBAND]);
190
191 for (i = 0; i < machine->pcard->num_links; i++)
192 machine->pcard->dai_link[i].ignore_suspend = 0;
193#endif
194 }
195
196 machine->is_call_mode = is_call_mode_new;
197 g_is_call_mode = machine->is_call_mode;
198
199 return 1;
200}
201
202struct snd_kcontrol_new tegra_aic326x_call_mode_control = {
203 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE,
204 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
205 .name = "Call Mode Switch",
206 .private_value = 0xffff,
207 .info = tegra_aic326x_call_mode_info,
208 .get = tegra_aic326x_call_mode_get,
209 .put = tegra_aic326x_call_mode_put
210};
211
212static int tegra_aic326x_get_mclk(int srate)
213{
214 int mclk = 0;
215 switch (srate) {
216 case 8000:
217 case 16000:
218 case 24000:
219 case 32000:
220 case 48000:
221 case 64000:
222 case 96000:
223 mclk = 12288000;
224 break;
225 case 11025:
226 case 22050:
227 case 44100:
228 case 88200:
229 mclk = 11289600;
230 break;
231 default:
232 mclk = -EINVAL;
233 break;
234 }
235
236 return mclk;
237}
238
239#ifndef CONFIG_ARCH_TEGRA_2x_SOC
240static int tegra_aic326x_set_dam_cif(int dam_ifc, int srate,
241 int channels, int bit_size, int src_on, int src_srate,
242 int src_channels, int src_bit_size)
243{
244 tegra30_dam_set_gain(dam_ifc, TEGRA30_DAM_CHIN1, 0x1000);
245 tegra30_dam_set_samplerate(dam_ifc, TEGRA30_DAM_CHOUT,
246 srate);
247 tegra30_dam_set_samplerate(dam_ifc, TEGRA30_DAM_CHIN1,
248 srate);
249 tegra30_dam_set_acif(dam_ifc, TEGRA30_DAM_CHIN1,
250 channels, bit_size, channels,
251 bit_size);
252 tegra30_dam_set_acif(dam_ifc, TEGRA30_DAM_CHOUT,
253 channels, bit_size, channels,
254 bit_size);
255
256 if (src_on) {
257 tegra30_dam_set_gain(dam_ifc, TEGRA30_DAM_CHIN0_SRC, 0x1000);
258 tegra30_dam_set_samplerate(dam_ifc, TEGRA30_DAM_CHIN0_SRC,
259 src_srate);
260 tegra30_dam_set_acif(dam_ifc, TEGRA30_DAM_CHIN0_SRC,
261 src_channels, src_bit_size, 1, 16);
262 }
263
264 return 0;
265}
266#endif
267
268static int tegra_aic326x_hw_params(struct snd_pcm_substream *substream,
269 struct snd_pcm_hw_params *params)
270{
271 struct snd_soc_pcm_runtime *rtd = substream->private_data;
272 struct snd_soc_dai *codec_dai = rtd->codec_dai;
273 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
274 struct snd_soc_codec *codec = rtd->codec;
275 struct snd_soc_card *card = codec->card;
276 struct tegra_aic326x *machine = snd_soc_card_get_drvdata(card);
277 int srate, mclk, sample_size, daifmt;
278 int err;
279#ifndef CONFIG_ARCH_TEGRA_2x_SOC
280 struct tegra30_i2s *i2s = snd_soc_dai_get_drvdata(cpu_dai);
281#endif
282
283 switch (params_format(params)) {
284 case SNDRV_PCM_FORMAT_S16_LE:
285 sample_size = 16;
286 break;
287 default:
288 return -EINVAL;
289 }
290
291 srate = params_rate(params);
292
293 mclk = tegra_aic326x_get_mclk(srate);
294 if (mclk < 0)
295 return mclk;
296
297 daifmt = SND_SOC_DAIFMT_I2S |
298 SND_SOC_DAIFMT_NB_NF |
299 SND_SOC_DAIFMT_CBS_CFS;
300
301 err = tegra_asoc_utils_set_rate(&machine->util_data, srate, mclk);
302 if (err < 0) {
303 if (!(machine->util_data.set_mclk % mclk))
304 mclk = machine->util_data.set_mclk;
305 else {
306 dev_err(card->dev, "Can't configure clocks\n");
307 return err;
308 }
309 }
310
311 tegra_asoc_utils_lock_clk_rate(&machine->util_data, 1);
312
313 err = snd_soc_dai_set_fmt(codec_dai, daifmt);
314 if (err < 0) {
315 dev_err(card->dev, "codec_dai fmt not set\n");
316 return err;
317 }
318
319 err = snd_soc_dai_set_fmt(cpu_dai, daifmt);
320 if (err < 0) {
321 dev_err(card->dev, "cpu_dai fmt not set\n");
322 return err;
323 }
324
325 err = snd_soc_dai_set_sysclk(codec_dai, 0, mclk,
326 SND_SOC_CLOCK_IN);
327 if (err < 0) {
328 dev_err(card->dev, "codec_dai clock not set\n");
329 return err;
330 }
331
332#ifdef CONFIG_ARCH_TEGRA_2x_SOC
333 err = tegra20_das_connect_dac_to_dap(TEGRA20_DAS_DAP_SEL_DAC1,
334 TEGRA20_DAS_DAP_ID_1);
335 if (err < 0) {
336 dev_err(card->dev, "failed to set dap-dac path\n");
337 return err;
338 }
339
340 err = tegra20_das_connect_dap_to_dac(TEGRA20_DAS_DAP_ID_1,
341 TEGRA20_DAS_DAP_SEL_DAC1);
342 if (err < 0) {
343 dev_err(card->dev, "failed to set dac-dap path\n");
344 return err;
345 }
346#else /*assumes tegra3*/
347 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK && i2s->is_dam_used)
348 tegra_aic326x_set_dam_cif(i2s->dam_ifc, srate,
349 params_channels(params), sample_size, 0, 0, 0, 0);
350#endif
351
352 return 0;
353}
354
355static int tegra_aic326x_spdif_hw_params(struct snd_pcm_substream *substream,
356 struct snd_pcm_hw_params *params)
357{
358 struct snd_soc_pcm_runtime *rtd = substream->private_data;
359 struct snd_soc_card *card = rtd->card;
360 struct tegra_aic326x *machine = snd_soc_card_get_drvdata(card);
361 int srate, mclk, min_mclk;
362 int err;
363
364 srate = params_rate(params);
365
366 mclk = tegra_aic326x_get_mclk(srate);
367 if (mclk < 0)
368 return mclk;
369
370 min_mclk = 128 * srate;
371
372 err = tegra_asoc_utils_set_rate(&machine->util_data, srate, mclk);
373 if (err < 0) {
374 if (!(machine->util_data.set_mclk % min_mclk))
375 mclk = machine->util_data.set_mclk;
376 else {
377 dev_err(card->dev, "Can't configure clocks\n");
378 return err;
379 }
380 }
381
382 tegra_asoc_utils_lock_clk_rate(&machine->util_data, 1);
383
384 return 0;
385}
386
387static int tegra_aic326x_bt_hw_params(struct snd_pcm_substream *substream,
388 struct snd_pcm_hw_params *params)
389{
390 struct snd_soc_pcm_runtime *rtd = substream->private_data;
391 struct snd_soc_card *card = rtd->card;
392 struct tegra_aic326x *machine = snd_soc_card_get_drvdata(card);
393 int err, srate, mclk, min_mclk, sample_size;
394#ifndef CONFIG_ARCH_TEGRA_2x_SOC
395 struct tegra30_i2s *i2s = snd_soc_dai_get_drvdata(rtd->cpu_dai);
396#endif
397
398 switch (params_format(params)) {
399 case SNDRV_PCM_FORMAT_S16_LE:
400 sample_size = 16;
401 break;
402 default:
403 return -EINVAL;
404 }
405
406 srate = params_rate(params);
407
408 mclk = tegra_aic326x_get_mclk(srate);
409 if (mclk < 0)
410 return mclk;
411
412 min_mclk = 64 * srate;
413
414 err = tegra_asoc_utils_set_rate(&machine->util_data, srate, mclk);
415 if (err < 0) {
416 if (!(machine->util_data.set_mclk % min_mclk))
417 mclk = machine->util_data.set_mclk;
418 else {
419 dev_err(card->dev, "Can't configure clocks\n");
420 return err;
421 }
422 }
423
424 tegra_asoc_utils_lock_clk_rate(&machine->util_data, 1);
425
426 err = snd_soc_dai_set_fmt(rtd->cpu_dai,
427 SND_SOC_DAIFMT_DSP_A |
428 SND_SOC_DAIFMT_NB_NF |
429 SND_SOC_DAIFMT_CBS_CFS);
430
431 if (err < 0) {
432 dev_err(rtd->codec->card->dev, "cpu_dai fmt not set\n");
433 return err;
434 }
435
436#ifdef CONFIG_ARCH_TEGRA_2x_SOC
437 err = tegra20_das_connect_dac_to_dap(TEGRA20_DAS_DAP_SEL_DAC2,
438 TEGRA20_DAS_DAP_ID_4);
439 if (err < 0) {
440 dev_err(card->dev, "failed to set dac-dap path\n");
441 return err;
442 }
443
444 err = tegra20_das_connect_dap_to_dac(TEGRA20_DAS_DAP_ID_4,
445 TEGRA20_DAS_DAP_SEL_DAC2);
446 if (err < 0) {
447 dev_err(card->dev, "failed to set dac-dap path\n");
448 return err;
449 }
450#else
451 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK && i2s->is_dam_used)
452 tegra_aic326x_set_dam_cif(i2s->dam_ifc, params_rate(params),
453 params_channels(params), sample_size, 0, 0, 0, 0);
454#endif
455
456 return 0;
457}
458
459#ifndef CONFIG_ARCH_TEGRA_2x_SOC
460static int tegra_aic326x_startup(struct snd_pcm_substream *substream)
461{
462 struct snd_soc_pcm_runtime *rtd = substream->private_data;
463 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
464 struct tegra30_i2s *i2s = snd_soc_dai_get_drvdata(cpu_dai);
465 struct tegra_aic326x *machine = snd_soc_card_get_drvdata(rtd->card);
466 struct codec_config *codec_info;
467 struct codec_config *bb_info;
468 int codec_index;
469
470 if (!i2s->is_dam_used)
471 return 0;
472
473 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
474 /*dam configuration*/
475 if (!i2s->dam_ch_refcount)
476 i2s->dam_ifc = tegra30_dam_allocate_controller();
477
478 tegra30_dam_allocate_channel(i2s->dam_ifc, TEGRA30_DAM_CHIN1);
479 i2s->dam_ch_refcount++;
480 tegra30_dam_enable_clock(i2s->dam_ifc);
481
482 tegra30_ahub_set_rx_cif_source(TEGRA30_AHUB_RXCIF_DAM0_RX1 +
483 (i2s->dam_ifc*2), i2s->txcif);
484
485 /*
486 *make the dam tx to i2s rx connection if this is the only client
487 *using i2s for playback
488 */
489 if (i2s->playback_ref_count == 1)
490 tegra30_ahub_set_rx_cif_source(
491 TEGRA30_AHUB_RXCIF_I2S0_RX0 + i2s->id,
492 TEGRA30_AHUB_TXCIF_DAM0_TX0 + i2s->dam_ifc);
493
494 /* enable the dam*/
495 tegra30_dam_enable(i2s->dam_ifc, TEGRA30_DAM_ENABLE,
496 TEGRA30_DAM_CHIN1);
497 } else {
498
499 i2s->is_call_mode_rec = machine->is_call_mode;
500
501 if (!i2s->is_call_mode_rec)
502 return 0;
503
504 if (machine->is_device_bt)
505 codec_index = BT_SCO;
506 else
507 codec_index = HIFI_CODEC;
508
509 codec_info = &machine->codec_info[codec_index];
510 bb_info = &machine->codec_info[BASEBAND];
511
512 /* allocate a dam for voice call recording */
513
514 i2s->call_record_dam_ifc = tegra30_dam_allocate_controller();
515 tegra30_dam_allocate_channel(i2s->call_record_dam_ifc,
516 TEGRA30_DAM_CHIN0_SRC);
517 tegra30_dam_allocate_channel(i2s->call_record_dam_ifc,
518 TEGRA30_DAM_CHIN1);
519 tegra30_dam_enable_clock(i2s->call_record_dam_ifc);
520
521 /* configure the dam */
522 tegra_aic326x_set_dam_cif(i2s->call_record_dam_ifc,
523 codec_info->rate, codec_info->channels,
524 codec_info->bitsize, 1, bb_info->rate,
525 bb_info->channels, bb_info->bitsize);
526
527 /* setup the connections for voice call record */
528
529 tegra30_ahub_unset_rx_cif_source(i2s->rxcif);
530 tegra30_ahub_set_rx_cif_source(TEGRA30_AHUB_RXCIF_DAM0_RX0 +
531 (i2s->call_record_dam_ifc*2),
532 TEGRA30_AHUB_TXCIF_I2S0_TX0 + bb_info->i2s_id);
533 tegra30_ahub_set_rx_cif_source(TEGRA30_AHUB_RXCIF_DAM0_RX1 +
534 (i2s->call_record_dam_ifc*2),
535 TEGRA30_AHUB_TXCIF_I2S0_TX0 + codec_info->i2s_id);
536 tegra30_ahub_set_rx_cif_source(i2s->rxcif,
537 TEGRA30_AHUB_TXCIF_DAM0_TX0 + i2s->call_record_dam_ifc);
538
539 /* enable the dam*/
540
541 tegra30_dam_enable(i2s->call_record_dam_ifc, TEGRA30_DAM_ENABLE,
542 TEGRA30_DAM_CHIN1);
543 tegra30_dam_enable(i2s->call_record_dam_ifc, TEGRA30_DAM_ENABLE,
544 TEGRA30_DAM_CHIN0_SRC);
545 }
546
547 return 0;
548}
549
550static void tegra_aic326x_shutdown(struct snd_pcm_substream *substream)
551{
552 struct snd_soc_pcm_runtime *rtd = substream->private_data;
553 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
554 struct tegra30_i2s *i2s = snd_soc_dai_get_drvdata(cpu_dai);
555
556 if (!i2s->is_dam_used)
557 return;
558
559 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
560 /* disable the dam*/
561 tegra30_dam_enable(i2s->dam_ifc, TEGRA30_DAM_DISABLE,
562 TEGRA30_DAM_CHIN1);
563
564 /* disconnect the ahub connections*/
565 tegra30_ahub_unset_rx_cif_source(TEGRA30_AHUB_RXCIF_DAM0_RX1 +
566 (i2s->dam_ifc*2));
567
568 /* disable the dam and free the controller */
569 tegra30_dam_disable_clock(i2s->dam_ifc);
570 tegra30_dam_free_channel(i2s->dam_ifc, TEGRA30_DAM_CHIN1);
571 i2s->dam_ch_refcount--;
572 if (!i2s->dam_ch_refcount)
573 tegra30_dam_free_controller(i2s->dam_ifc);
574 } else {
575
576 if (!i2s->is_call_mode_rec)
577 return 0;
578
579 i2s->is_call_mode_rec = 0;
580
581 /* disable the dam*/
582 tegra30_dam_enable(i2s->call_record_dam_ifc,
583 TEGRA30_DAM_DISABLE, TEGRA30_DAM_CHIN1);
584 tegra30_dam_enable(i2s->call_record_dam_ifc,
585 TEGRA30_DAM_DISABLE, TEGRA30_DAM_CHIN0_SRC);
586
587 /* disconnect the ahub connections*/
588 tegra30_ahub_unset_rx_cif_source(i2s->rxcif);
589 tegra30_ahub_unset_rx_cif_source(TEGRA30_AHUB_RXCIF_DAM0_RX0 +
590 (i2s->call_record_dam_ifc*2));
591 tegra30_ahub_unset_rx_cif_source(TEGRA30_AHUB_RXCIF_DAM0_RX1 +
592 (i2s->call_record_dam_ifc*2));
593
594 /* free the dam channels and dam controller */
595 tegra30_dam_disable_clock(i2s->call_record_dam_ifc);
596 tegra30_dam_free_channel(i2s->call_record_dam_ifc,
597 TEGRA30_DAM_CHIN1);
598 tegra30_dam_free_channel(i2s->call_record_dam_ifc,
599 TEGRA30_DAM_CHIN0_SRC);
600 tegra30_dam_free_controller(i2s->call_record_dam_ifc);
601 }
602
603 return;
604}
605#endif
606
607
608static int tegra_aic326x_hw_free(struct snd_pcm_substream *substream)
609{
610 struct snd_soc_pcm_runtime *rtd = substream->private_data;
611 struct tegra_aic326x *machine = snd_soc_card_get_drvdata(rtd->card);
612
613 tegra_asoc_utils_lock_clk_rate(&machine->util_data, 0);
614
615 return 0;
616}
617
618static int tegra_aic326x_voice_call_hw_params(
619 struct snd_pcm_substream *substream,
620 struct snd_pcm_hw_params *params)
621{
622 struct snd_soc_pcm_runtime *rtd = substream->private_data;
623 struct snd_soc_dai *codec_dai = rtd->codec_dai;
624 struct snd_soc_codec *codec = rtd->codec;
625 struct snd_soc_card *card = codec->card;
626 struct tegra_aic326x *machine = snd_soc_card_get_drvdata(card);
627 int srate, mclk;
628 int err, pcmdiv, vxclkdiv;;
629
630 srate = params_rate(params);
631 mclk = tegra_aic326x_get_mclk(srate);
632 if (mclk < 0)
633 return mclk;
634
635 err = tegra_asoc_utils_set_rate(&machine->util_data, srate, mclk);
636 if (err < 0) {
637 if (!(machine->util_data.set_mclk % mclk))
638 mclk = machine->util_data.set_mclk;
639 else {
640 dev_err(card->dev, "Can't configure clocks\n");
641 return err;
642 }
643 }
644
645 tegra_asoc_utils_lock_clk_rate(&machine->util_data, 1);
646
647 if(machine_is_tegra_enterprise()) {
648 err = snd_soc_dai_set_fmt(codec_dai,
649 SND_SOC_DAIFMT_I2S |
650 SND_SOC_DAIFMT_NB_NF |
651 SND_SOC_DAIFMT_CBS_CFS);
652 } else {
653 err = snd_soc_dai_set_fmt(codec_dai,
654 SND_SOC_DAIFMT_DSP_B |
655 SND_SOC_DAIFMT_NB_NF |
656 SND_SOC_DAIFMT_CBS_CFS);
657 }
658
659 if (err < 0) {
660 dev_err(card->dev, "codec_dai fmt not set\n");
661 return err;
662 }
663
664 err = snd_soc_dai_set_sysclk(codec_dai, 0, mclk,
665 SND_SOC_CLOCK_IN);
666 if (err < 0) {
667 dev_err(card->dev, "codec_dai clock not set\n");
668 return err;
669 }
670
671 if(!machine_is_tegra_enterprise()) {
672 if (params_rate(params) == 8000) {
673 /* Change these Settings for 8KHz*/
674 pcmdiv = 1;
675 /* BB expecting 2048Khz bclk */
676 vxclkdiv = 27;
677 } else if (params_rate(params) == 16000) {
678 pcmdiv = 1;
679 /* BB expecting 2048Khz bclk */
680 vxclkdiv = 27;
681 } else {
682 dev_err(card->dev, "codec_dai unsupported voice rate\n");
683 return -EINVAL;
684 }
685 }
686
687 //snd_soc_dai_set_clkdiv(codec_dai, ASI2_BCLK_N, vxclkdiv);
688 //snd_soc_dai_set_clkdiv(codec_dai, ASI2_WCLK_N, pcmdiv);
689
690#ifndef CONFIG_ARCH_TEGRA_2x_SOC
691 /* codec configuration */
692 machine->codec_info[HIFI_CODEC].rate = params_rate(params);
693 machine->codec_info[HIFI_CODEC].channels = params_channels(params);
694 machine->codec_info[HIFI_CODEC].bitsize = 16;
695 machine->codec_info[HIFI_CODEC].is_i2smaster = 1;
696 machine->codec_info[HIFI_CODEC].is_format_dsp = 0;
697
698 /* baseband configuration */
699 machine->codec_info[BASEBAND].bitsize = 16;
700 machine->codec_info[BASEBAND].is_i2smaster = 1;
701 machine->codec_info[BASEBAND].is_format_dsp = 1;
702#endif
703
704 machine->is_device_bt = 0;
705
706 return 0;
707}
708
709static void tegra_aic326x_voice_call_shutdown(
710 struct snd_pcm_substream *substream)
711{
712 struct snd_soc_pcm_runtime *rtd = substream->private_data;
713 struct tegra_aic326x *machine =
714 snd_soc_card_get_drvdata(rtd->codec->card);
715
716#ifndef CONFIG_ARCH_TEGRA_2x_SOC
717 machine->codec_info[HIFI_CODEC].rate = 0;
718 machine->codec_info[HIFI_CODEC].channels = 0;
719#endif
720
721 machine->is_device_bt = 0;
722}
723
724static int tegra_aic326x_bt_voice_call_hw_params(
725 struct snd_pcm_substream *substream,
726 struct snd_pcm_hw_params *params)
727{
728 struct snd_soc_pcm_runtime *rtd = substream->private_data;
729 struct snd_soc_card *card = rtd->card;
730 struct tegra_aic326x *machine = snd_soc_card_get_drvdata(card);
731 int err, srate, mclk, min_mclk;
732
733 srate = params_rate(params);
734
735 mclk = tegra_aic326x_get_mclk(srate);
736 if (mclk < 0)
737 return mclk;
738
739 min_mclk = 64 * srate;
740
741 err = tegra_asoc_utils_set_rate(&machine->util_data, srate, mclk);
742 if (err < 0) {
743 if (!(machine->util_data.set_mclk % min_mclk))
744 mclk = machine->util_data.set_mclk;
745 else {
746 dev_err(card->dev, "Can't configure clocks\n");
747 return err;
748 }
749 }
750
751 tegra_asoc_utils_lock_clk_rate(&machine->util_data, 1);
752
753#ifndef CONFIG_ARCH_TEGRA_2x_SOC
754 /* codec configuration */
755 machine->codec_info[BT_SCO].rate = params_rate(params);
756 machine->codec_info[BT_SCO].channels = params_channels(params);
757 machine->codec_info[BT_SCO].bitsize = 16;
758 machine->codec_info[BT_SCO].is_i2smaster = 1;
759 machine->codec_info[BT_SCO].is_format_dsp = 1;
760
761 /* baseband configuration */
762 machine->codec_info[BASEBAND].bitsize = 16;
763 machine->codec_info[BASEBAND].is_i2smaster = 1;
764 machine->codec_info[BASEBAND].is_format_dsp = 1;
765#endif
766
767 machine->is_device_bt = 1;
768
769 return 0;
770}
771
772static void tegra_aic326x_bt_voice_call_shutdown(
773 struct snd_pcm_substream *substream)
774{
775 struct snd_soc_pcm_runtime *rtd = substream->private_data;
776 struct tegra_aic326x *machine =
777 snd_soc_card_get_drvdata(rtd->codec->card);
778
779#ifndef CONFIG_ARCH_TEGRA_2x_SOC
780 machine->codec_info[BT_SCO].rate = 0;
781 machine->codec_info[BT_SCO].channels = 0;
782#endif
783
784 machine->is_device_bt = 0;
785}
786
787static struct snd_soc_ops tegra_aic326x_hifi_ops = {
788 .hw_params = tegra_aic326x_hw_params,
789 .hw_free = tegra_aic326x_hw_free,
790#ifndef CONFIG_ARCH_TEGRA_2x_SOC
791 .startup = tegra_aic326x_startup,
792 .shutdown = tegra_aic326x_shutdown,
793#endif
794};
795
796static struct snd_soc_ops tegra_aic326x_spdif_ops = {
797 .hw_params = tegra_aic326x_spdif_hw_params,
798 .hw_free = tegra_aic326x_hw_free,
799};
800
801static struct snd_soc_ops tegra_aic326x_voice_call_ops = {
802 .hw_params = tegra_aic326x_voice_call_hw_params,
803 .shutdown = tegra_aic326x_voice_call_shutdown,
804 .hw_free = tegra_aic326x_hw_free,
805};
806
807static struct snd_soc_ops tegra_aic326x_bt_voice_call_ops = {
808 .hw_params = tegra_aic326x_bt_voice_call_hw_params,
809 .shutdown = tegra_aic326x_bt_voice_call_shutdown,
810 .hw_free = tegra_aic326x_hw_free,
811};
812
813static struct snd_soc_ops tegra_aic326x_bt_ops = {
814 .hw_params = tegra_aic326x_bt_hw_params,
815 .hw_free = tegra_aic326x_hw_free,
816#ifndef CONFIG_ARCH_TEGRA_2x_SOC
817 .startup = tegra_aic326x_startup,
818 .shutdown = tegra_aic326x_shutdown,
819#endif
820};
821
822static struct snd_soc_jack tegra_aic326x_hp_jack;
823
824#ifdef CONFIG_SWITCH
825static struct switch_dev aic326x_wired_switch_dev = {
826 .name = "h2w",
827};
828
829/* These values are copied from WiredAccessoryObserver */
830enum headset_state {
831 BIT_NO_HEADSET = 0,
832 BIT_HEADSET = (1 << 0),
833 BIT_HEADSET_NO_MIC = (1 << 1),
834};
835
836static int aic326x_headset_switch_notify(struct notifier_block *self,
837 unsigned long action, void *dev)
838{
839 int state = 0;
840
841 switch (action) {
842 case SND_JACK_HEADPHONE:
843 state |= BIT_HEADSET_NO_MIC;
844 break;
845 case SND_JACK_HEADSET:
846 state |= BIT_HEADSET;
847 break;
848 default:
849 state |= BIT_NO_HEADSET;
850 }
851
852 switch_set_state(&aic326x_wired_switch_dev, state);
853
854 return NOTIFY_OK;
855}
856
857static struct notifier_block aic326x_headset_switch_nb = {
858 .notifier_call = aic326x_headset_switch_notify,
859};
860#else
861static struct snd_soc_jack_pin tegra_aic326x_hp_jack_pins[] = {
862 {
863 .pin = "Headphone Jack",
864 .mask = SND_JACK_HEADPHONE,
865 },
866};
867#endif
868
869static int tegra_aic326x_event_int_spk(struct snd_soc_dapm_widget *w,
870 struct snd_kcontrol *k, int event)
871{
872 struct snd_soc_dapm_context *dapm = w->dapm;
873 struct snd_soc_card *card = dapm->card;
874 struct tegra_aic326x *machine = snd_soc_card_get_drvdata(card);
875 struct tegra_aic326x_platform_data *pdata = machine->pdata;
876
877 if (!(machine->gpio_requested & GPIO_SPKR_EN))
878 return 0;
879
880 gpio_set_value_cansleep(pdata->gpio_spkr_en,
881 SND_SOC_DAPM_EVENT_ON(event));
882
883 return 0;
884}
885
886static int tegra_aic326x_event_hp(struct snd_soc_dapm_widget *w,
887 struct snd_kcontrol *k, int event)
888{
889 struct snd_soc_dapm_context *dapm = w->dapm;
890 struct snd_soc_card *card = dapm->card;
891 struct tegra_aic326x *machine = snd_soc_card_get_drvdata(card);
892 struct tegra_aic326x_platform_data *pdata = machine->pdata;
893
894 if (!(machine->gpio_requested & GPIO_HP_MUTE))
895 return 0;
896
897 gpio_set_value_cansleep(pdata->gpio_hp_mute,
898 !SND_SOC_DAPM_EVENT_ON(event));
899
900 return 0;
901}
902
903static const struct snd_soc_dapm_widget tegra_aic326x_dapm_widgets[] = {
904 SND_SOC_DAPM_SPK("Int Spk", tegra_aic326x_event_int_spk),
905 SND_SOC_DAPM_HP("Earpiece", NULL),
906 SND_SOC_DAPM_HP("Headphone Jack", tegra_aic326x_event_hp),
907 SND_SOC_DAPM_MIC("Mic Jack", NULL),
908 SND_SOC_DAPM_INPUT("Ext Mic"),
909 SND_SOC_DAPM_LINE("Linein", NULL),
910 SND_SOC_DAPM_MIC("Int Mic", NULL),
911};
912
913static const struct snd_soc_dapm_route aic326x_audio_map[] = {
914 {"Int Spk", NULL, "SPKL"},
915 {"Int Spk", NULL, "SPKR"},
916 {"Earpiece", NULL, "RECP"},
917 {"Earpiece", NULL, "RECM"},
918 {"Headphone Jack", NULL, "HPL"},
919 {"Headphone Jack", NULL, "HPR"},
920 /* internal (IN2L/IN2R) mic is stero */
921 {"Mic Bias Int" ,NULL, "Int Mic"},
922 {"IN2L", NULL, "Mic Bias Int"},
923 {"Mic Bias Int" ,NULL, "Int Mic"},
924 {"IN2R", NULL, "Mic Bias Int"},
925 {"Mic Bias Ext" ,NULL, "Mic Jack"},
926 {"CM1L" ,NULL, "Mic Jack"},
927 {"IN1L", NULL, "Mic Bias Ext"},
928 {"IN1L", NULL, "CM1L"},
929};
930
931static const struct snd_kcontrol_new tegra_aic326x_controls[] = {
932 SOC_DAPM_PIN_SWITCH("Int Spk"),
933 SOC_DAPM_PIN_SWITCH("Earpiece"),
934 SOC_DAPM_PIN_SWITCH("Headphone Jack"),
935 SOC_DAPM_PIN_SWITCH("Mic Jack"),
936 SOC_DAPM_PIN_SWITCH("Ext Mic"),
937 SOC_DAPM_PIN_SWITCH("Linein"),
938 SOC_DAPM_PIN_SWITCH("Int Mic"),
939};
940
941static int tegra_aic326x_init(struct snd_soc_pcm_runtime *rtd)
942{
943 struct snd_soc_codec *codec = rtd->codec;
944 struct snd_soc_dapm_context *dapm = &codec->dapm;
945 struct snd_soc_card *card = codec->card;
946 struct tegra_aic326x *machine = snd_soc_card_get_drvdata(card);
947 struct tegra_aic326x_platform_data *pdata = machine->pdata;
948#ifndef CONFIG_ARCH_TEGRA_2x_SOC
949 struct tegra30_i2s *i2s = snd_soc_dai_get_drvdata(rtd->cpu_dai);
950#endif
951 int ret;
952
953#ifndef CONFIG_ARCH_TEGRA_2x_SOC
954 if (machine->codec_info[BASEBAND].i2s_id != -1)
955 i2s->is_dam_used = true;
956#endif
957
958 if (machine->init_done)
959 return 0;
960
961 machine->init_done = true;
962
963#ifndef CONFIG_ARCH_TEGRA_2x_SOC
964 machine->pcard = card;
965#endif
966
967 if (machine_is_whistler()) {
968 machine->audio_reg = regulator_get(NULL, "avddio_audio");
969 if (IS_ERR(machine->audio_reg)) {
970 dev_err(card->dev, "cannot get avddio_audio reg\n");
971 ret = PTR_ERR(machine->audio_reg);
972 return ret;
973 }
974
975 ret = regulator_enable(machine->audio_reg);
976 if (ret) {
977 dev_err(card->dev, "cannot enable avddio_audio reg\n");
978 regulator_put(machine->audio_reg);
979 machine->audio_reg = NULL;
980 return ret;
981 }
982 }
983
984 if (gpio_is_valid(pdata->gpio_spkr_en)) {
985 ret = gpio_request(pdata->gpio_spkr_en, "spkr_en");
986 if (ret) {
987 dev_err(card->dev, "cannot get spkr_en gpio\n");
988 return ret;
989 }
990 machine->gpio_requested |= GPIO_SPKR_EN;
991
992 gpio_direction_output(pdata->gpio_spkr_en, 0);
993 }
994
995 if (gpio_is_valid(pdata->gpio_hp_mute)) {
996 ret = gpio_request(pdata->gpio_hp_mute, "hp_mute");
997 if (ret) {
998 dev_err(card->dev, "cannot get hp_mute gpio\n");
999 return ret;
1000 }
1001 machine->gpio_requested |= GPIO_HP_MUTE;
1002
1003 gpio_direction_output(pdata->gpio_hp_mute, 0);
1004 }
1005
1006 if (gpio_is_valid(pdata->gpio_int_mic_en)) {
1007 ret = gpio_request(pdata->gpio_int_mic_en, "int_mic_en");
1008 if (ret) {
1009 dev_err(card->dev, "cannot get int_mic_en gpio\n");
1010 return ret;
1011 }
1012 machine->gpio_requested |= GPIO_INT_MIC_EN;
1013
1014 /* Disable int mic; enable signal is active-high */
1015 gpio_direction_output(pdata->gpio_int_mic_en, 0);
1016 }
1017
1018 if (gpio_is_valid(pdata->gpio_ext_mic_en)) {
1019 ret = gpio_request(pdata->gpio_ext_mic_en, "ext_mic_en");
1020 if (ret) {
1021 dev_err(card->dev, "cannot get ext_mic_en gpio\n");
1022 return ret;
1023 }
1024 machine->gpio_requested |= GPIO_EXT_MIC_EN;
1025
1026 /* Enable ext mic; enable signal is active-low */
1027 gpio_direction_output(pdata->gpio_ext_mic_en, 0);
1028 }
1029
1030 ret = snd_soc_add_controls(codec, tegra_aic326x_controls,
1031 ARRAY_SIZE(tegra_aic326x_controls));
1032 if (ret < 0)
1033 return ret;
1034
1035 snd_soc_dapm_new_controls(dapm, tegra_aic326x_dapm_widgets,
1036 ARRAY_SIZE(tegra_aic326x_dapm_widgets));
1037
1038 snd_soc_dapm_add_routes(dapm, aic326x_audio_map,
1039 ARRAY_SIZE(aic326x_audio_map));
1040
1041 ret = snd_soc_jack_new(codec, "Headset Jack", SND_JACK_HEADSET,
1042 &tegra_aic326x_hp_jack);
1043 if (ret < 0)
1044 return ret;
1045
1046#ifdef CONFIG_SWITCH
1047 snd_soc_jack_notifier_register(&tegra_aic326x_hp_jack,
1048 &aic326x_headset_switch_nb);
1049#else /*gpio based headset detection*/
1050 snd_soc_jack_add_pins(&tegra_aic326x_hp_jack,
1051 ARRAY_SIZE(tegra_aic326x_hp_jack_pins),
1052 tegra_aic326x_hp_jack_pins);
1053#endif
1054
1055 aic326x_headset_detect(codec, &tegra_aic326x_hp_jack,
1056 SND_JACK_HEADSET);
1057
1058 /* Add call mode switch control */
1059 ret = snd_ctl_add(codec->card->snd_card,
1060 snd_ctl_new1(&tegra_aic326x_call_mode_control,
1061 machine));
1062 if (ret < 0)
1063 return ret;
1064
1065 snd_soc_dapm_force_enable_pin(dapm, "MICBIAS_EXT ON");
1066 snd_soc_dapm_force_enable_pin(dapm,"MICBIAS_INT ON");
1067 snd_soc_dapm_sync(dapm);
1068
1069 return 0;
1070}
1071
1072static struct snd_soc_dai_link tegra_aic326x_dai[] = {
1073 [DAI_LINK_HIFI] = {
1074 .name = "AIC3262",
1075 .stream_name = "AIC3262 PCM HIFI",
1076 .codec_name = "aic3262-codec.4-0018",
1077 .platform_name = "tegra-pcm-audio",
1078#ifdef CONFIG_ARCH_TEGRA_2x_SOC
1079 .cpu_dai_name = "tegra20-i2s.0",
1080#else
1081 .cpu_dai_name = "tegra30-i2s.0",
1082#endif
1083 .codec_dai_name = "aic3262-asi1",
1084 .init = tegra_aic326x_init,
1085 .ops = &tegra_aic326x_hifi_ops,
1086 },
1087 [DAI_LINK_SPDIF] = {
1088 .name = "SPDIF",
1089 .stream_name = "SPDIF PCM",
1090 .codec_name = "spdif-dit.0",
1091 .platform_name = "tegra-pcm-audio",
1092#ifdef CONFIG_ARCH_TEGRA_2x_SOC
1093 .cpu_dai_name = "tegra20-spdif",
1094#else
1095 .cpu_dai_name = "tegra30-spdif",
1096#endif
1097 .codec_dai_name = "dit-hifi",
1098 .ops = &tegra_aic326x_spdif_ops,
1099 },
1100 [DAI_LINK_BTSCO] = {
1101 .name = "BT-SCO",
1102 .stream_name = "BT SCO PCM",
1103 .codec_name = "spdif-dit.1",
1104 .platform_name = "tegra-pcm-audio",
1105#ifdef CONFIG_ARCH_TEGRA_2x_SOC
1106 .cpu_dai_name = "tegra20-i2s.1",
1107#else
1108 .cpu_dai_name = "tegra30-i2s.3",
1109#endif
1110 .codec_dai_name = "dit-hifi",
1111 .init = tegra_aic326x_init,
1112 .ops = &tegra_aic326x_bt_ops,
1113 },
1114 [DAI_LINK_VOICE_CALL] = {
1115 .name = "VOICE CALL",
1116 .stream_name = "VOICE CALL PCM",
1117 .codec_name = "aic3262-codec.4-0018",
1118 .platform_name = "tegra-pcm-audio",
1119 .cpu_dai_name = "dit-hifi",
1120 .codec_dai_name = "aic3262-asi2",
1121 .ops = &tegra_aic326x_voice_call_ops,
1122 },
1123 [DAI_LINK_BT_VOICE_CALL] = {
1124 .name = "BT VOICE CALL",
1125 .stream_name = "BT VOICE CALL PCM",
1126 .codec_name = "spdif-dit.2",
1127 .platform_name = "tegra-pcm-audio",
1128 .cpu_dai_name = "dit-hifi",
1129 .codec_dai_name = "dit-hifi",
1130 .ops = &tegra_aic326x_bt_voice_call_ops,
1131 },
1132};
1133
1134static struct snd_soc_card snd_soc_tegra_aic326x = {
1135 .name = "tegra-aic326x",
1136 .dai_link = tegra_aic326x_dai,
1137 .num_links = ARRAY_SIZE(tegra_aic326x_dai),
1138};
1139
1140static __devinit int tegra_aic326x_driver_probe(struct platform_device *pdev)
1141{
1142 struct snd_soc_card *card = &snd_soc_tegra_aic326x;
1143 struct tegra_aic326x *machine;
1144 struct tegra_aic326x_platform_data *pdata;
1145 int ret, i;
1146
1147 pdata = pdev->dev.platform_data;
1148 if (!pdata) {
1149 dev_err(&pdev->dev, "No platform data supplied\n");
1150 return -EINVAL;
1151 }
1152
1153 machine = kzalloc(sizeof(struct tegra_aic326x), GFP_KERNEL);
1154 if (!machine) {
1155 dev_err(&pdev->dev, "Can't allocate tegra_aic326x struct\n");
1156 return -ENOMEM;
1157 }
1158
1159 machine->pdata = pdata;
1160
1161 ret = tegra_asoc_utils_init(&machine->util_data, &pdev->dev);
1162 if (ret)
1163 goto err_free_machine;
1164
1165 card->dev = &pdev->dev;
1166 platform_set_drvdata(pdev, card);
1167 snd_soc_card_set_drvdata(card, machine);
1168
1169#ifdef CONFIG_SWITCH
1170 /* Add h2w switch class support */
1171 ret = switch_dev_register(&aic326x_wired_switch_dev);
1172 if (ret < 0) {
1173 dev_err(&pdev->dev, "not able to register switch device %d\n",
1174 ret);
1175 goto err_fini_utils;
1176 }
1177#endif
1178
1179#ifndef CONFIG_ARCH_TEGRA_2x_SOC
1180 for (i = 0; i < NUM_I2S_DEVICES ; i++)
1181 machine->codec_info[i].i2s_id = pdata->audio_port_id[i];
1182
1183 machine->codec_info[BASEBAND].rate = pdata->baseband_param.rate;
1184 machine->codec_info[BASEBAND].channels = pdata->baseband_param.channels;
1185
1186 tegra_aic326x_dai[DAI_LINK_HIFI].cpu_dai_name =
1187 tegra_i2s_dai_name[machine->codec_info[HIFI_CODEC].i2s_id];
1188
1189 tegra_aic326x_dai[DAI_LINK_BTSCO].cpu_dai_name =
1190 tegra_i2s_dai_name[machine->codec_info[BT_SCO].i2s_id];
1191#endif
1192
1193 if(machine_is_tegra_enterprise()) {
1194 tegra_aic326x_dai[DAI_LINK_HIFI].codec_name = "aic3262-codec.0-0018";
1195 tegra_aic326x_dai[DAI_LINK_VOICE_CALL].codec_name = "aic3262-codec.0-0018";
1196 tegra_aic326x_dai[DAI_LINK_VOICE_CALL].codec_dai_name = "aic3262-asi1";
1197 }
1198
1199 ret = snd_soc_register_card(card);
1200 if (ret) {
1201 dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n",
1202 ret);
1203 goto err_switch_unregister;
1204 }
1205
1206 if (!card->instantiated) {
1207 dev_err(&pdev->dev, "No TI AIC3262 codec\n");
1208 goto err_unregister_card;
1209 }
1210
1211 return 0;
1212
1213err_unregister_card:
1214 snd_soc_unregister_card(card);
1215err_switch_unregister:
1216#ifdef CONFIG_SWITCH
1217 switch_dev_unregister(&aic326x_wired_switch_dev);
1218#endif
1219err_fini_utils:
1220 tegra_asoc_utils_fini(&machine->util_data);
1221err_free_machine:
1222 kfree(machine);
1223 return ret;
1224}
1225
1226static int __devexit tegra_aic326x_driver_remove(struct platform_device *pdev)
1227{
1228 struct snd_soc_card *card = platform_get_drvdata(pdev);
1229 struct tegra_aic326x *machine = snd_soc_card_get_drvdata(card);
1230 struct tegra_aic326x_platform_data *pdata = machine->pdata;
1231
1232 snd_soc_unregister_card(card);
1233
1234#ifdef CONFIG_SWITCH
1235 switch_dev_unregister(&aic326x_wired_switch_dev);
1236#endif
1237
1238 tegra_asoc_utils_fini(&machine->util_data);
1239
1240 if (machine->gpio_requested & GPIO_EXT_MIC_EN)
1241 gpio_free(pdata->gpio_ext_mic_en);
1242 if (machine->gpio_requested & GPIO_INT_MIC_EN)
1243 gpio_free(pdata->gpio_int_mic_en);
1244 if (machine->gpio_requested & GPIO_HP_MUTE)
1245 gpio_free(pdata->gpio_hp_mute);
1246 if (machine->gpio_requested & GPIO_SPKR_EN)
1247 gpio_free(pdata->gpio_spkr_en);
1248
1249 kfree(machine);
1250
1251 return 0;
1252}
1253
1254static struct platform_driver tegra_aic326x_driver = {
1255 .driver = {
1256 .name = DRV_NAME,
1257 .owner = THIS_MODULE,
1258 .pm = &snd_soc_pm_ops,
1259 },
1260 .probe = tegra_aic326x_driver_probe,
1261 .remove = __devexit_p(tegra_aic326x_driver_remove),
1262};
1263
1264static int __init tegra_aic326x_modinit(void)
1265{
1266 return platform_driver_register(&tegra_aic326x_driver);
1267}
1268module_init(tegra_aic326x_modinit);
1269
1270static void __exit tegra_aic326x_modexit(void)
1271{
1272 platform_driver_unregister(&tegra_aic326x_driver);
1273}
1274module_exit(tegra_aic326x_modexit);
1275
1276/* Module information */
1277MODULE_AUTHOR("Vinod G. <vinodg@nvidia.com>");
1278MODULE_DESCRIPTION("Tegra+AIC3262 machine ASoC driver");
1279MODULE_DESCRIPTION("Tegra ALSA SoC");
1280MODULE_LICENSE("GPL");
1281
diff --git a/sound/soc/tegra/tegra_max98088.c b/sound/soc/tegra/tegra_max98088.c
new file mode 100644
index 00000000000..bae2b783895
--- /dev/null
+++ b/sound/soc/tegra/tegra_max98088.c
@@ -0,0 +1,1233 @@
1/*
2 * tegra_max98088.c - Tegra machine ASoC driver for boards using MAX98088 codec.
3 *
4 * Author: Sumit Bhattacharya <sumitb@nvidia.com>
5 * Copyright (C) 2011 - NVIDIA, Inc.
6 *
7 * Based on code copyright/by:
8 *
9 * (c) 2010, 2011 Nvidia Graphics Pvt. Ltd.
10 *
11 * Copyright 2007 Wolfson Microelectronics PLC.
12 * Author: Graeme Gregory
13 * graeme.gregory@wolfsonmicro.com or linux@wolfsonmicro.com
14 *
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License
17 * version 2 as published by the Free Software Foundation.
18 *
19 * This program is distributed in the hope that it will be useful, but
20 * WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 * General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software
26 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
27 * 02110-1301 USA
28 *
29 */
30
31#include <asm/mach-types.h>
32
33#include <linux/clk.h>
34#include <linux/module.h>
35#include <linux/platform_device.h>
36#include <linux/slab.h>
37#include <linux/gpio.h>
38#include <linux/regulator/consumer.h>
39#ifdef CONFIG_SWITCH
40#include <linux/switch.h>
41#endif
42
43#include <mach/tegra_asoc_pdata.h>
44
45#include <sound/core.h>
46#include <sound/jack.h>
47#include <sound/pcm.h>
48#include <sound/pcm_params.h>
49#include <sound/soc.h>
50
51#include "../codecs/max98088.h"
52
53#include "tegra_pcm.h"
54#include "tegra_asoc_utils.h"
55#ifndef CONFIG_ARCH_TEGRA_2x_SOC
56#include "tegra30_ahub.h"
57#include "tegra30_i2s.h"
58#include "tegra30_dam.h"
59#endif
60
61#define DRV_NAME "tegra-snd-max98088"
62
63#define GPIO_SPKR_EN BIT(0)
64#define GPIO_HP_MUTE BIT(1)
65#define GPIO_INT_MIC_EN BIT(2)
66#define GPIO_EXT_MIC_EN BIT(3)
67
68#define DAI_LINK_HIFI 0
69#define DAI_LINK_SPDIF 1
70#define DAI_LINK_BTSCO 2
71#define DAI_LINK_VOICE_CALL 3
72#define DAI_LINK_BT_VOICE_CALL 4
73#define NUM_DAI_LINKS 5
74
75#ifndef CONFIG_ARCH_TEGRA_2x_SOC
76const char *tegra_max98088_i2s_dai_name[TEGRA30_NR_I2S_IFC] = {
77 "tegra30-i2s.0",
78 "tegra30-i2s.1",
79 "tegra30-i2s.2",
80 "tegra30-i2s.3",
81 "tegra30-i2s.4",
82};
83#endif
84
85extern int g_is_call_mode;
86
87struct tegra_max98088 {
88 struct tegra_asoc_utils_data util_data;
89 struct tegra_asoc_platform_data *pdata;
90 int gpio_requested;
91 bool init_done;
92 int is_call_mode;
93 int is_device_bt;
94#ifndef CONFIG_ARCH_TEGRA_2x_SOC
95 struct codec_config codec_info[NUM_I2S_DEVICES];
96#endif
97 enum snd_soc_bias_level bias_level;
98 struct snd_soc_card *pcard;
99};
100
101static int tegra_call_mode_info(struct snd_kcontrol *kcontrol,
102 struct snd_ctl_elem_info *uinfo)
103{
104 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
105 uinfo->count = 1;
106 uinfo->value.integer.min = 0;
107 uinfo->value.integer.max = 1;
108 return 0;
109}
110
111static int tegra_call_mode_get(struct snd_kcontrol *kcontrol,
112 struct snd_ctl_elem_value *ucontrol)
113{
114 struct tegra_max98088 *machine = snd_kcontrol_chip(kcontrol);
115
116 ucontrol->value.integer.value[0] = machine->is_call_mode;
117
118 return 0;
119}
120
121static int tegra_call_mode_put(struct snd_kcontrol *kcontrol,
122 struct snd_ctl_elem_value *ucontrol)
123{
124 struct tegra_max98088 *machine = snd_kcontrol_chip(kcontrol);
125 int is_call_mode_new = ucontrol->value.integer.value[0];
126 int codec_index;
127 unsigned int i;
128
129 if (machine->is_call_mode == is_call_mode_new)
130 return 0;
131
132 if (machine->is_device_bt)
133 codec_index = BT_SCO;
134 else
135 codec_index = HIFI_CODEC;
136
137 if (is_call_mode_new) {
138#ifndef CONFIG_ARCH_TEGRA_2x_SOC
139 if (machine->codec_info[codec_index].rate == 0 ||
140 machine->codec_info[codec_index].channels == 0)
141 return -EINVAL;
142
143 for (i = 0; i < machine->pcard->num_links; i++)
144 machine->pcard->dai_link[i].ignore_suspend = 1;
145
146 tegra30_make_voice_call_connections(
147 &machine->codec_info[codec_index],
148 &machine->codec_info[BASEBAND]);
149#endif
150 } else {
151#ifndef CONFIG_ARCH_TEGRA_2x_SOC
152 tegra30_break_voice_call_connections(
153 &machine->codec_info[codec_index],
154 &machine->codec_info[BASEBAND]);
155
156 for (i = 0; i < machine->pcard->num_links; i++)
157 machine->pcard->dai_link[i].ignore_suspend = 0;
158#endif
159 }
160
161 machine->is_call_mode = is_call_mode_new;
162 g_is_call_mode = machine->is_call_mode;
163
164 return 1;
165}
166
167struct snd_kcontrol_new tegra_call_mode_control = {
168 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE,
169 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
170 .name = "Call Mode Switch",
171 .private_value = 0xffff,
172 .info = tegra_call_mode_info,
173 .get = tegra_call_mode_get,
174 .put = tegra_call_mode_put
175};
176
177#ifndef CONFIG_ARCH_TEGRA_2x_SOC
178static int tegra_max98088_set_dam_cif(int dam_ifc, int srate,
179 int channels, int bit_size, int src_on, int src_srate,
180 int src_channels, int src_bit_size)
181{
182 tegra30_dam_set_gain(dam_ifc, TEGRA30_DAM_CHIN1, 0x1000);
183 tegra30_dam_set_samplerate(dam_ifc, TEGRA30_DAM_CHOUT,
184 srate);
185 tegra30_dam_set_samplerate(dam_ifc, TEGRA30_DAM_CHIN1,
186 srate);
187 tegra30_dam_set_acif(dam_ifc, TEGRA30_DAM_CHIN1,
188 channels, bit_size, channels,
189 bit_size);
190 tegra30_dam_set_acif(dam_ifc, TEGRA30_DAM_CHOUT,
191 channels, bit_size, channels,
192 bit_size);
193
194 if (src_on) {
195 tegra30_dam_set_gain(dam_ifc, TEGRA30_DAM_CHIN0_SRC, 0x1000);
196 tegra30_dam_set_samplerate(dam_ifc, TEGRA30_DAM_CHIN0_SRC,
197 src_srate);
198 tegra30_dam_set_acif(dam_ifc, TEGRA30_DAM_CHIN0_SRC,
199 src_channels, src_bit_size, 1, 16);
200 }
201
202 return 0;
203}
204#endif
205
206static int tegra_max98088_hw_params(struct snd_pcm_substream *substream,
207 struct snd_pcm_hw_params *params)
208{
209 struct snd_soc_pcm_runtime *rtd = substream->private_data;
210 struct snd_soc_dai *codec_dai = rtd->codec_dai;
211 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
212 struct snd_soc_codec *codec = rtd->codec;
213 struct snd_soc_card *card = codec->card;
214 struct tegra_max98088 *machine = snd_soc_card_get_drvdata(card);
215#ifndef CONFIG_ARCH_TEGRA_2x_SOC
216 struct tegra30_i2s *i2s = snd_soc_dai_get_drvdata(cpu_dai);
217#endif
218 int srate, mclk, sample_size, i2s_daifmt;
219 int err;
220 struct clk *clk;
221 int rate;
222
223 switch (params_format(params)) {
224 case SNDRV_PCM_FORMAT_S16_LE:
225 sample_size = 16;
226 break;
227 default:
228 return -EINVAL;
229 }
230
231 srate = params_rate(params);
232 switch (srate) {
233 case 8000:
234 case 16000:
235 case 24000:
236 case 32000:
237 case 48000:
238 case 64000:
239 case 96000:
240 mclk = 12288000;
241 break;
242 case 11025:
243 case 22050:
244 case 44100:
245 case 88200:
246 mclk = 11289600;
247 break;
248 default:
249 mclk = 12000000;
250 break;
251 }
252
253
254#if defined(CONFIG_ARCH_TEGRA_2x_SOC)
255 clk = clk_get_sys(NULL, "cdev1");
256#else
257 clk = clk_get_sys("extern1", NULL);
258#endif
259 if (IS_ERR(clk)) {
260 dev_err(card->dev, "Can't retrieve clk cdev1\n");
261 err = PTR_ERR(clk);
262 return err;
263 }
264
265 rate = clk_get_rate(clk);
266 printk("extern1 rate=%d\n",rate);
267
268#if TEGRA30_I2S_MASTER_PLAYBACK
269 i2s_daifmt = SND_SOC_DAIFMT_I2S |
270 SND_SOC_DAIFMT_NB_NF |
271 SND_SOC_DAIFMT_CBS_CFS;
272#else
273 i2s_daifmt = SND_SOC_DAIFMT_I2S |
274 SND_SOC_DAIFMT_NB_NF |
275 SND_SOC_DAIFMT_CBM_CFM;
276 mclk = rate;
277#endif
278
279 err = tegra_asoc_utils_set_rate(&machine->util_data, srate, mclk);
280 if (err < 0) {
281 if (!(machine->util_data.set_mclk % mclk))
282 mclk = machine->util_data.set_mclk;
283 else {
284 dev_err(card->dev, "Can't configure clocks\n");
285 return err;
286 }
287 }
288
289 tegra_asoc_utils_lock_clk_rate(&machine->util_data, 1);
290
291 err = snd_soc_dai_set_fmt(codec_dai,i2s_daifmt);
292 if (err < 0) {
293 dev_err(card->dev, "codec_dai fmt not set\n");
294 return err;
295 }
296
297 err = snd_soc_dai_set_fmt(cpu_dai, i2s_daifmt);
298 if (err < 0) {
299 dev_err(card->dev, "cpu_dai fmt not set\n");
300 return err;
301 }
302
303 err = snd_soc_dai_set_sysclk(codec_dai, 0, mclk,
304 SND_SOC_CLOCK_IN);
305 if (err < 0) {
306 dev_err(card->dev, "codec_dai clock not set\n");
307 return err;
308 }
309
310#ifndef CONFIG_ARCH_TEGRA_2x_SOC
311 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
312 tegra_max98088_set_dam_cif(i2s->dam_ifc, srate,
313 params_channels(params), sample_size, 0, 0, 0, 0);
314#endif
315
316 return 0;
317}
318
319static int tegra_spdif_hw_params(struct snd_pcm_substream *substream,
320 struct snd_pcm_hw_params *params)
321{
322 struct snd_soc_pcm_runtime *rtd = substream->private_data;
323 struct snd_soc_card *card = rtd->card;
324 struct tegra_max98088 *machine = snd_soc_card_get_drvdata(card);
325 int srate, mclk, min_mclk;
326 int err;
327
328 srate = params_rate(params);
329 switch (srate) {
330 case 11025:
331 case 22050:
332 case 44100:
333 case 88200:
334 mclk = 11289600;
335 break;
336 case 8000:
337 case 16000:
338 case 32000:
339 case 48000:
340 case 64000:
341 case 96000:
342 mclk = 12288000;
343 break;
344 default:
345 return -EINVAL;
346 }
347 min_mclk = 128 * srate;
348
349 err = tegra_asoc_utils_set_rate(&machine->util_data, srate, mclk);
350 if (err < 0) {
351 if (!(machine->util_data.set_mclk % min_mclk))
352 mclk = machine->util_data.set_mclk;
353 else {
354 dev_err(card->dev, "Can't configure clocks\n");
355 return err;
356 }
357 }
358
359 tegra_asoc_utils_lock_clk_rate(&machine->util_data, 1);
360
361 return 0;
362}
363
364static int tegra_bt_hw_params(struct snd_pcm_substream *substream,
365 struct snd_pcm_hw_params *params)
366{
367 struct snd_soc_pcm_runtime *rtd = substream->private_data;
368#ifndef CONFIG_ARCH_TEGRA_2x_SOC
369 struct tegra30_i2s *i2s = snd_soc_dai_get_drvdata(rtd->cpu_dai);
370#endif
371 struct snd_soc_card *card = rtd->card;
372 struct tegra_max98088 *machine = snd_soc_card_get_drvdata(card);
373 int err, srate, mclk, min_mclk, sample_size;
374
375 switch (params_format(params)) {
376 case SNDRV_PCM_FORMAT_S16_LE:
377 sample_size = 16;
378 break;
379 default:
380 return -EINVAL;
381 }
382
383 srate = params_rate(params);
384 switch (srate) {
385 case 11025:
386 case 22050:
387 case 44100:
388 case 88200:
389 mclk = 11289600;
390 break;
391 case 8000:
392 case 16000:
393 case 32000:
394 case 48000:
395 case 64000:
396 case 96000:
397 mclk = 12288000;
398 break;
399 default:
400 return -EINVAL;
401 }
402 min_mclk = 64 * srate;
403
404 err = tegra_asoc_utils_set_rate(&machine->util_data, srate, mclk);
405 if (err < 0) {
406 if (!(machine->util_data.set_mclk % min_mclk))
407 mclk = machine->util_data.set_mclk;
408 else {
409 dev_err(card->dev, "Can't configure clocks\n");
410 return err;
411 }
412 }
413
414 tegra_asoc_utils_lock_clk_rate(&machine->util_data, 1);
415
416 err = snd_soc_dai_set_fmt(rtd->cpu_dai,
417 SND_SOC_DAIFMT_DSP_A |
418 SND_SOC_DAIFMT_NB_NF |
419 SND_SOC_DAIFMT_CBS_CFS);
420 if (err < 0) {
421 dev_err(rtd->codec->card->dev, "cpu_dai fmt not set\n");
422 return err;
423 }
424
425#ifndef CONFIG_ARCH_TEGRA_2x_SOC
426 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
427 tegra_max98088_set_dam_cif(i2s->dam_ifc, params_rate(params),
428 params_channels(params), sample_size, 0, 0, 0, 0);
429#endif
430
431 return 0;
432}
433
434static int tegra_hw_free(struct snd_pcm_substream *substream)
435{
436 struct snd_soc_pcm_runtime *rtd = substream->private_data;
437 struct tegra_max98088 *machine = snd_soc_card_get_drvdata(rtd->card);
438
439 tegra_asoc_utils_lock_clk_rate(&machine->util_data, 0);
440
441 return 0;
442}
443
444#ifndef CONFIG_ARCH_TEGRA_2x_SOC
445static int tegra_max98088_startup(struct snd_pcm_substream *substream)
446{
447 struct snd_soc_pcm_runtime *rtd = substream->private_data;
448 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
449 struct tegra30_i2s *i2s = snd_soc_dai_get_drvdata(cpu_dai);
450 struct tegra_max98088 *machine = snd_soc_card_get_drvdata(rtd->card);
451 struct codec_config *codec_info;
452 struct codec_config *bb_info;
453 int codec_index;
454
455 if (!i2s->is_dam_used)
456 return 0;
457
458 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
459 /*dam configuration*/
460 if (!i2s->dam_ch_refcount)
461 i2s->dam_ifc = tegra30_dam_allocate_controller();
462
463 tegra30_dam_allocate_channel(i2s->dam_ifc, TEGRA30_DAM_CHIN1);
464 i2s->dam_ch_refcount++;
465 tegra30_dam_enable_clock(i2s->dam_ifc);
466
467 tegra30_ahub_set_rx_cif_source(TEGRA30_AHUB_RXCIF_DAM0_RX1 +
468 (i2s->dam_ifc*2), i2s->txcif);
469
470 /*
471 *make the dam tx to i2s rx connection if this is the only client
472 *using i2s for playback
473 */
474 if (i2s->playback_ref_count == 1)
475 tegra30_ahub_set_rx_cif_source(
476 TEGRA30_AHUB_RXCIF_I2S0_RX0 + i2s->id,
477 TEGRA30_AHUB_TXCIF_DAM0_TX0 + i2s->dam_ifc);
478
479 /* enable the dam*/
480 tegra30_dam_enable(i2s->dam_ifc, TEGRA30_DAM_ENABLE,
481 TEGRA30_DAM_CHIN1);
482 } else {
483
484 i2s->is_call_mode_rec = machine->is_call_mode;
485
486 if (!i2s->is_call_mode_rec)
487 return 0;
488
489 if (machine->is_device_bt)
490 codec_index = BT_SCO;
491 else
492 codec_index = HIFI_CODEC;
493
494 codec_info = &machine->codec_info[codec_index];
495 bb_info = &machine->codec_info[BASEBAND];
496
497 /* allocate a dam for voice call recording */
498
499 i2s->call_record_dam_ifc = tegra30_dam_allocate_controller();
500 tegra30_dam_allocate_channel(i2s->call_record_dam_ifc,
501 TEGRA30_DAM_CHIN0_SRC);
502 tegra30_dam_allocate_channel(i2s->call_record_dam_ifc,
503 TEGRA30_DAM_CHIN1);
504 tegra30_dam_enable_clock(i2s->call_record_dam_ifc);
505
506 /* configure the dam */
507 tegra_max98088_set_dam_cif(i2s->call_record_dam_ifc,
508 codec_info->rate, codec_info->channels,
509 codec_info->bitsize, 1, bb_info->rate,
510 bb_info->channels, bb_info->bitsize);
511
512 /* setup the connections for voice call record */
513
514 tegra30_ahub_unset_rx_cif_source(i2s->rxcif);
515 tegra30_ahub_set_rx_cif_source(TEGRA30_AHUB_RXCIF_DAM0_RX0 +
516 (i2s->call_record_dam_ifc*2),
517 TEGRA30_AHUB_TXCIF_I2S0_TX0 + bb_info->i2s_id);
518 tegra30_ahub_set_rx_cif_source(TEGRA30_AHUB_RXCIF_DAM0_RX1 +
519 (i2s->call_record_dam_ifc*2),
520 TEGRA30_AHUB_TXCIF_I2S0_TX0 + codec_info->i2s_id);
521 tegra30_ahub_set_rx_cif_source(i2s->rxcif,
522 TEGRA30_AHUB_TXCIF_DAM0_TX0 + i2s->call_record_dam_ifc);
523
524 /* enable the dam*/
525
526 tegra30_dam_enable(i2s->call_record_dam_ifc, TEGRA30_DAM_ENABLE,
527 TEGRA30_DAM_CHIN1);
528 tegra30_dam_enable(i2s->call_record_dam_ifc, TEGRA30_DAM_ENABLE,
529 TEGRA30_DAM_CHIN0_SRC);
530 }
531
532 return 0;
533}
534
535static void tegra_max98088_shutdown(struct snd_pcm_substream *substream)
536{
537 struct snd_soc_pcm_runtime *rtd = substream->private_data;
538 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
539 struct tegra30_i2s *i2s = snd_soc_dai_get_drvdata(cpu_dai);
540
541 if (!i2s->is_dam_used)
542 return;
543
544 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
545 /* disable the dam*/
546 tegra30_dam_enable(i2s->dam_ifc, TEGRA30_DAM_DISABLE,
547 TEGRA30_DAM_CHIN1);
548
549 /* disconnect the ahub connections*/
550 tegra30_ahub_unset_rx_cif_source(TEGRA30_AHUB_RXCIF_DAM0_RX1 +
551 (i2s->dam_ifc*2));
552
553 /* disable the dam and free the controller */
554 tegra30_dam_disable_clock(i2s->dam_ifc);
555 tegra30_dam_free_channel(i2s->dam_ifc, TEGRA30_DAM_CHIN1);
556 i2s->dam_ch_refcount--;
557 if (!i2s->dam_ch_refcount)
558 tegra30_dam_free_controller(i2s->dam_ifc);
559 } else {
560
561 if (!i2s->is_call_mode_rec)
562 return 0;
563
564 i2s->is_call_mode_rec = 0;
565
566 /* disable the dam*/
567 tegra30_dam_enable(i2s->call_record_dam_ifc,
568 TEGRA30_DAM_DISABLE, TEGRA30_DAM_CHIN1);
569 tegra30_dam_enable(i2s->call_record_dam_ifc,
570 TEGRA30_DAM_DISABLE, TEGRA30_DAM_CHIN0_SRC);
571
572 /* disconnect the ahub connections*/
573 tegra30_ahub_unset_rx_cif_source(i2s->rxcif);
574 tegra30_ahub_unset_rx_cif_source(TEGRA30_AHUB_RXCIF_DAM0_RX0 +
575 (i2s->call_record_dam_ifc*2));
576 tegra30_ahub_unset_rx_cif_source(TEGRA30_AHUB_RXCIF_DAM0_RX1 +
577 (i2s->call_record_dam_ifc*2));
578
579 /* free the dam channels and dam controller */
580 tegra30_dam_disable_clock(i2s->call_record_dam_ifc);
581 tegra30_dam_free_channel(i2s->call_record_dam_ifc,
582 TEGRA30_DAM_CHIN1);
583 tegra30_dam_free_channel(i2s->call_record_dam_ifc,
584 TEGRA30_DAM_CHIN0_SRC);
585 tegra30_dam_free_controller(i2s->call_record_dam_ifc);
586 }
587
588 return;
589}
590#endif
591
592static int tegra_voice_call_hw_params(struct snd_pcm_substream *substream,
593 struct snd_pcm_hw_params *params)
594{
595 struct snd_soc_pcm_runtime *rtd = substream->private_data;
596 struct snd_soc_dai *codec_dai = rtd->codec_dai;
597 struct snd_soc_codec *codec = rtd->codec;
598 struct snd_soc_card *card = codec->card;
599 struct tegra_max98088 *machine = snd_soc_card_get_drvdata(card);
600 int srate, mclk;
601 int err;
602
603 srate = params_rate(params);
604 switch (srate) {
605 case 8000:
606 case 16000:
607 case 24000:
608 case 32000:
609 case 48000:
610 case 64000:
611 case 96000:
612 mclk = 12288000;
613 break;
614 case 11025:
615 case 22050:
616 case 44100:
617 case 88200:
618 mclk = 11289600;
619 break;
620 default:
621 return -EINVAL;
622 break;
623 }
624
625 err = tegra_asoc_utils_set_rate(&machine->util_data, srate, mclk);
626 if (err < 0) {
627 if (!(machine->util_data.set_mclk % mclk))
628 mclk = machine->util_data.set_mclk;
629 else {
630 dev_err(card->dev, "Can't configure clocks\n");
631 return err;
632 }
633 }
634
635 tegra_asoc_utils_lock_clk_rate(&machine->util_data, 1);
636
637 err = snd_soc_dai_set_fmt(codec_dai,
638 SND_SOC_DAIFMT_I2S |
639 SND_SOC_DAIFMT_NB_NF |
640 SND_SOC_DAIFMT_CBS_CFS);
641 if (err < 0) {
642 dev_err(card->dev, "codec_dai fmt not set\n");
643 return err;
644 }
645
646 err = snd_soc_dai_set_sysclk(codec_dai, 0, mclk,
647 SND_SOC_CLOCK_IN);
648 if (err < 0) {
649 dev_err(card->dev, "codec_dai clock not set\n");
650 return err;
651 }
652
653#ifndef CONFIG_ARCH_TEGRA_2x_SOC
654 /* codec configuration */
655 machine->codec_info[HIFI_CODEC].rate = params_rate(params);
656 machine->codec_info[HIFI_CODEC].channels = params_channels(params);
657 machine->codec_info[HIFI_CODEC].bitsize = 16;
658 machine->codec_info[HIFI_CODEC].is_i2smaster = 1;
659 machine->codec_info[HIFI_CODEC].is_format_dsp = 0;
660
661 /* baseband configuration */
662 machine->codec_info[BASEBAND].bitsize = 16;
663 machine->codec_info[BASEBAND].is_i2smaster = 1;
664 machine->codec_info[BASEBAND].is_format_dsp = 1;
665#endif
666
667 machine->is_device_bt = 0;
668
669 return 0;
670}
671
672static void tegra_voice_call_shutdown(struct snd_pcm_substream *substream)
673{
674 struct snd_soc_pcm_runtime *rtd = substream->private_data;
675 struct tegra_max98088 *machine =
676 snd_soc_card_get_drvdata(rtd->codec->card);
677
678#ifndef CONFIG_ARCH_TEGRA_2x_SOC
679 machine->codec_info[HIFI_CODEC].rate = 0;
680 machine->codec_info[HIFI_CODEC].channels = 0;
681#endif
682
683 return;
684}
685
686static int tegra_bt_voice_call_hw_params(struct snd_pcm_substream *substream,
687 struct snd_pcm_hw_params *params)
688{
689 struct snd_soc_pcm_runtime *rtd = substream->private_data;
690 struct snd_soc_card *card = rtd->card;
691 struct tegra_max98088 *machine = snd_soc_card_get_drvdata(card);
692 int err, srate, mclk, min_mclk;
693
694 srate = params_rate(params);
695 switch (srate) {
696 case 11025:
697 case 22050:
698 case 44100:
699 case 88200:
700 mclk = 11289600;
701 break;
702 case 8000:
703 case 16000:
704 case 32000:
705 case 48000:
706 case 64000:
707 case 96000:
708 mclk = 12288000;
709 break;
710 default:
711 return -EINVAL;
712 }
713 min_mclk = 64 * srate;
714
715 err = tegra_asoc_utils_set_rate(&machine->util_data, srate, mclk);
716 if (err < 0) {
717 if (!(machine->util_data.set_mclk % min_mclk))
718 mclk = machine->util_data.set_mclk;
719 else {
720 dev_err(card->dev, "Can't configure clocks\n");
721 return err;
722 }
723 }
724
725 tegra_asoc_utils_lock_clk_rate(&machine->util_data, 1);
726
727#ifndef CONFIG_ARCH_TEGRA_2x_SOC
728 /* codec configuration */
729 machine->codec_info[BT_SCO].rate = params_rate(params);
730 machine->codec_info[BT_SCO].channels = params_channels(params);
731 machine->codec_info[BT_SCO].bitsize = 16;
732 machine->codec_info[BT_SCO].is_i2smaster = 1;
733 machine->codec_info[BT_SCO].is_format_dsp = 1;
734
735 /* baseband configuration */
736 machine->codec_info[BASEBAND].bitsize = 16;
737 machine->codec_info[BASEBAND].is_i2smaster = 1;
738 machine->codec_info[BASEBAND].is_format_dsp = 1;
739#endif
740
741 machine->is_device_bt = 1;
742
743 return 0;
744}
745
746static void tegra_bt_voice_call_shutdown(struct snd_pcm_substream *substream)
747{
748 struct snd_soc_pcm_runtime *rtd = substream->private_data;
749 struct tegra_max98088 *machine =
750 snd_soc_card_get_drvdata(rtd->codec->card);
751
752#ifndef CONFIG_ARCH_TEGRA_2x_SOC
753 machine->codec_info[BT_SCO].rate = 0;
754 machine->codec_info[BT_SCO].channels = 0;
755#endif
756
757 return;
758}
759
760static struct snd_soc_ops tegra_max98088_ops = {
761 .hw_params = tegra_max98088_hw_params,
762 .hw_free = tegra_hw_free,
763#ifndef CONFIG_ARCH_TEGRA_2x_SOC
764 .startup = tegra_max98088_startup,
765 .shutdown = tegra_max98088_shutdown,
766#endif
767};
768
769static struct snd_soc_ops tegra_spdif_ops = {
770 .hw_params = tegra_spdif_hw_params,
771 .hw_free = tegra_hw_free,
772};
773
774static struct snd_soc_ops tegra_voice_call_ops = {
775 .hw_params = tegra_voice_call_hw_params,
776 .shutdown = tegra_voice_call_shutdown,
777 .hw_free = tegra_hw_free,
778};
779
780static struct snd_soc_ops tegra_bt_voice_call_ops = {
781 .hw_params = tegra_bt_voice_call_hw_params,
782 .shutdown = tegra_bt_voice_call_shutdown,
783 .hw_free = tegra_hw_free,
784};
785
786static struct snd_soc_ops tegra_bt_ops = {
787 .hw_params = tegra_bt_hw_params,
788 .hw_free = tegra_hw_free,
789#ifndef CONFIG_ARCH_TEGRA_2x_SOC
790 .startup = tegra_max98088_startup,
791 .shutdown = tegra_max98088_shutdown,
792#endif
793};
794
795static struct snd_soc_jack tegra_max98088_hp_jack;
796
797#ifdef CONFIG_SWITCH
798static struct switch_dev wired_switch_dev = {
799 .name = "h2w",
800};
801
802/* These values are copied from WiredAccessoryObserver */
803enum headset_state {
804 BIT_NO_HEADSET = 0,
805 BIT_HEADSET = (1 << 0),
806 BIT_HEADSET_NO_MIC = (1 << 1),
807};
808
809static int headset_switch_notify(struct notifier_block *self,
810 unsigned long action, void *dev)
811{
812 int state = 0;
813
814 switch (action) {
815 case SND_JACK_HEADPHONE:
816 state |= BIT_HEADSET_NO_MIC;
817 break;
818 case SND_JACK_HEADSET:
819 state |= BIT_HEADSET;
820 break;
821 default:
822 state |= BIT_NO_HEADSET;
823 }
824
825 switch_set_state(&wired_switch_dev, state);
826
827 return NOTIFY_OK;
828}
829
830static struct notifier_block headset_switch_nb = {
831 .notifier_call = headset_switch_notify,
832};
833#else
834static struct snd_soc_jack_pin tegra_max98088_hp_jack_pins[] = {
835 {
836 .pin = "Headphone Jack",
837 .mask = SND_JACK_HEADPHONE,
838 },
839};
840#endif
841
842static int tegra_max98088_event_int_spk(struct snd_soc_dapm_widget *w,
843 struct snd_kcontrol *k, int event)
844{
845 struct snd_soc_dapm_context *dapm = w->dapm;
846 struct snd_soc_card *card = dapm->card;
847 struct tegra_max98088 *machine = snd_soc_card_get_drvdata(card);
848 struct tegra_asoc_platform_data *pdata = machine->pdata;
849
850 if (!(machine->gpio_requested & GPIO_SPKR_EN))
851 return 0;
852
853 gpio_set_value_cansleep(pdata->gpio_spkr_en,
854 SND_SOC_DAPM_EVENT_ON(event));
855
856 return 0;
857}
858
859static int tegra_max98088_event_hp(struct snd_soc_dapm_widget *w,
860 struct snd_kcontrol *k, int event)
861{
862 struct snd_soc_dapm_context *dapm = w->dapm;
863 struct snd_soc_card *card = dapm->card;
864 struct tegra_max98088 *machine = snd_soc_card_get_drvdata(card);
865 struct tegra_asoc_platform_data *pdata = machine->pdata;
866
867 if (!(machine->gpio_requested & GPIO_HP_MUTE))
868 return 0;
869
870 gpio_set_value_cansleep(pdata->gpio_hp_mute,
871 !SND_SOC_DAPM_EVENT_ON(event));
872
873 return 0;
874}
875
876static const struct snd_soc_dapm_widget tegra_max98088_dapm_widgets[] = {
877 SND_SOC_DAPM_SPK("Int Spk", tegra_max98088_event_int_spk),
878 SND_SOC_DAPM_OUTPUT("Earpiece"),
879 SND_SOC_DAPM_HP("Headphone Jack", tegra_max98088_event_hp),
880 SND_SOC_DAPM_MIC("Mic Jack", NULL),
881 SND_SOC_DAPM_INPUT("Int Mic"),
882};
883
884static const struct snd_soc_dapm_route enterprise_audio_map[] = {
885 {"Int Spk", NULL, "SPKL"},
886 {"Int Spk", NULL, "SPKR"},
887 {"Earpiece", NULL, "RECL"},
888 {"Earpiece", NULL, "RECR"},
889 {"Headphone Jack", NULL, "HPL"},
890 {"Headphone Jack", NULL, "HPR"},
891 {"MICBIAS", NULL, "Mic Jack"},
892 {"MIC2", NULL, "MICBIAS"},
893 {"MICBIAS", NULL, "Int Mic"},
894 {"MIC1", NULL, "MICBIAS"},
895};
896
897static const struct snd_kcontrol_new tegra_max98088_controls[] = {
898 SOC_DAPM_PIN_SWITCH("Int Spk"),
899 SOC_DAPM_PIN_SWITCH("Earpiece"),
900 SOC_DAPM_PIN_SWITCH("Headphone Jack"),
901 SOC_DAPM_PIN_SWITCH("Mic Jack"),
902 SOC_DAPM_PIN_SWITCH("Int Mic"),
903};
904
905static int tegra_max98088_init(struct snd_soc_pcm_runtime *rtd)
906{
907 struct snd_soc_codec *codec = rtd->codec;
908 struct snd_soc_dapm_context *dapm = &codec->dapm;
909 struct snd_soc_card *card = codec->card;
910 struct tegra_max98088 *machine = snd_soc_card_get_drvdata(card);
911 struct tegra_asoc_platform_data *pdata = machine->pdata;
912#ifndef CONFIG_ARCH_TEGRA_2x_SOC
913 struct tegra30_i2s *i2s = snd_soc_dai_get_drvdata(rtd->cpu_dai);
914#endif
915 int ret;
916
917#ifndef CONFIG_ARCH_TEGRA_2x_SOC
918 if (machine->codec_info[BASEBAND].i2s_id != -1)
919 i2s->is_dam_used = true;
920#endif
921
922 if (machine->init_done)
923 return 0;
924
925 machine->init_done = true;
926
927 machine->pcard = card;
928 machine->bias_level = SND_SOC_BIAS_STANDBY;
929
930 if (gpio_is_valid(pdata->gpio_spkr_en)) {
931 ret = gpio_request(pdata->gpio_spkr_en, "spkr_en");
932 if (ret) {
933 dev_err(card->dev, "cannot get spkr_en gpio\n");
934 return ret;
935 }
936 machine->gpio_requested |= GPIO_SPKR_EN;
937
938 gpio_direction_output(pdata->gpio_spkr_en, 0);
939 }
940
941 if (gpio_is_valid(pdata->gpio_hp_mute)) {
942 ret = gpio_request(pdata->gpio_hp_mute, "hp_mute");
943 if (ret) {
944 dev_err(card->dev, "cannot get hp_mute gpio\n");
945 return ret;
946 }
947 machine->gpio_requested |= GPIO_HP_MUTE;
948
949 gpio_direction_output(pdata->gpio_hp_mute, 0);
950 }
951
952 if (gpio_is_valid(pdata->gpio_int_mic_en)) {
953 ret = gpio_request(pdata->gpio_int_mic_en, "int_mic_en");
954 if (ret) {
955 dev_err(card->dev, "cannot get int_mic_en gpio\n");
956 return ret;
957 }
958 machine->gpio_requested |= GPIO_INT_MIC_EN;
959
960 /* Disable int mic; enable signal is active-high */
961 gpio_direction_output(pdata->gpio_int_mic_en, 0);
962 }
963
964 if (gpio_is_valid(pdata->gpio_ext_mic_en)) {
965 ret = gpio_request(pdata->gpio_ext_mic_en, "ext_mic_en");
966 if (ret) {
967 dev_err(card->dev, "cannot get ext_mic_en gpio\n");
968 return ret;
969 }
970 machine->gpio_requested |= GPIO_EXT_MIC_EN;
971
972 /* Enable ext mic; enable signal is active-low */
973 gpio_direction_output(pdata->gpio_ext_mic_en, 0);
974 }
975
976 ret = snd_soc_add_controls(codec, tegra_max98088_controls,
977 ARRAY_SIZE(tegra_max98088_controls));
978 if (ret < 0)
979 return ret;
980
981 snd_soc_dapm_new_controls(dapm, tegra_max98088_dapm_widgets,
982 ARRAY_SIZE(tegra_max98088_dapm_widgets));
983
984 snd_soc_dapm_add_routes(dapm, enterprise_audio_map,
985 ARRAY_SIZE(enterprise_audio_map));
986
987 ret = snd_soc_jack_new(codec, "Headset Jack", SND_JACK_HEADSET,
988 &tegra_max98088_hp_jack);
989 if (ret < 0)
990 return ret;
991
992#ifdef CONFIG_SWITCH
993 snd_soc_jack_notifier_register(&tegra_max98088_hp_jack,
994 &headset_switch_nb);
995#else /*gpio based headset detection*/
996 snd_soc_jack_add_pins(&tegra_max98088_hp_jack,
997 ARRAY_SIZE(tegra_max98088_hp_jack_pins),
998 tegra_max98088_hp_jack_pins);
999#endif
1000
1001 max98088_headset_detect(codec, &tegra_max98088_hp_jack,
1002 SND_JACK_HEADSET);
1003
1004 /* Add call mode switch control */
1005 ret = snd_ctl_add(codec->card->snd_card,
1006 snd_ctl_new1(&tegra_call_mode_control, machine));
1007 if (ret < 0)
1008 return ret;
1009
1010 snd_soc_dapm_nc_pin(dapm, "INA1");
1011 snd_soc_dapm_nc_pin(dapm, "INA2");
1012 snd_soc_dapm_nc_pin(dapm, "INB1");
1013 snd_soc_dapm_nc_pin(dapm, "INB2");
1014 snd_soc_dapm_sync(dapm);
1015
1016 return 0;
1017}
1018
1019static struct snd_soc_dai_link tegra_max98088_dai[NUM_DAI_LINKS] = {
1020 [DAI_LINK_HIFI] = {
1021 .name = "MAX98088",
1022 .stream_name = "MAX98088 HIFI",
1023 .codec_name = "max98088.0-0010",
1024 .platform_name = "tegra-pcm-audio",
1025 .codec_dai_name = "HiFi",
1026 .init = tegra_max98088_init,
1027 .ops = &tegra_max98088_ops,
1028 },
1029 [DAI_LINK_SPDIF] = {
1030 .name = "SPDIF",
1031 .stream_name = "SPDIF PCM",
1032 .codec_name = "spdif-dit.0",
1033 .platform_name = "tegra-pcm-audio",
1034 .cpu_dai_name = "tegra30-spdif",
1035 .codec_dai_name = "dit-hifi",
1036 .ops = &tegra_spdif_ops,
1037 },
1038 [DAI_LINK_BTSCO] = {
1039 .name = "BT SCO",
1040 .stream_name = "BT SCO PCM",
1041 .codec_name = "spdif-dit.1",
1042 .platform_name = "tegra-pcm-audio",
1043 .codec_dai_name = "dit-hifi",
1044 .init = tegra_max98088_init,
1045 .ops = &tegra_bt_ops,
1046 },
1047 [DAI_LINK_VOICE_CALL] = {
1048 .name = "VOICE CALL",
1049 .stream_name = "VOICE CALL PCM",
1050 .codec_name = "max98088.0-0010",
1051 .platform_name = "tegra-pcm-audio",
1052 .cpu_dai_name = "dit-hifi",
1053 .codec_dai_name = "HiFi",
1054 .ops = &tegra_voice_call_ops,
1055 },
1056 [DAI_LINK_BT_VOICE_CALL] = {
1057 .name = "BT VOICE CALL",
1058 .stream_name = "BT VOICE CALL PCM",
1059 .codec_name = "spdif-dit.2",
1060 .platform_name = "tegra-pcm-audio",
1061 .cpu_dai_name = "dit-hifi",
1062 .codec_dai_name = "dit-hifi",
1063 .ops = &tegra_bt_voice_call_ops,
1064 },
1065};
1066
1067static int tegra30_soc_set_bias_level(struct snd_soc_card *card,
1068 enum snd_soc_bias_level level)
1069{
1070 struct tegra_max98088 *machine = snd_soc_card_get_drvdata(card);
1071
1072 if (machine->bias_level == SND_SOC_BIAS_OFF &&
1073 level != SND_SOC_BIAS_OFF)
1074 tegra_asoc_utils_clk_enable(&machine->util_data);
1075
1076 return 0;
1077}
1078
1079static int tegra30_soc_set_bias_level_post(struct snd_soc_card *card,
1080 enum snd_soc_bias_level level)
1081{
1082 struct tegra_max98088 *machine = snd_soc_card_get_drvdata(card);
1083
1084 if (machine->bias_level != SND_SOC_BIAS_OFF &&
1085 level == SND_SOC_BIAS_OFF)
1086 tegra_asoc_utils_clk_disable(&machine->util_data);
1087
1088 machine->bias_level = level;
1089
1090 return 0 ;
1091}
1092
1093static struct snd_soc_card snd_soc_tegra_max98088 = {
1094 .name = "tegra-max98088",
1095 .dai_link = tegra_max98088_dai,
1096 .num_links = ARRAY_SIZE(tegra_max98088_dai),
1097 .set_bias_level = tegra30_soc_set_bias_level,
1098 .set_bias_level_post = tegra30_soc_set_bias_level_post,
1099};
1100
1101static __devinit int tegra_max98088_driver_probe(struct platform_device *pdev)
1102{
1103 struct snd_soc_card *card = &snd_soc_tegra_max98088;
1104 struct tegra_max98088 *machine;
1105 struct tegra_asoc_platform_data *pdata;
1106 int ret, i;
1107
1108 pdata = pdev->dev.platform_data;
1109 if (!pdata) {
1110 dev_err(&pdev->dev, "No platform data supplied\n");
1111 return -EINVAL;
1112 }
1113
1114 machine = kzalloc(sizeof(struct tegra_max98088), GFP_KERNEL);
1115 if (!machine) {
1116 dev_err(&pdev->dev, "Can't allocate tegra_max98088 struct\n");
1117 return -ENOMEM;
1118 }
1119
1120 machine->pdata = pdata;
1121
1122 ret = tegra_asoc_utils_init(&machine->util_data, &pdev->dev);
1123 if (ret)
1124 goto err_free_machine;
1125
1126 card->dev = &pdev->dev;
1127 platform_set_drvdata(pdev, card);
1128 snd_soc_card_set_drvdata(card, machine);
1129
1130#ifdef CONFIG_SWITCH
1131 /* Add h2w switch class support */
1132 ret = switch_dev_register(&wired_switch_dev);
1133 if (ret < 0) {
1134 dev_err(&pdev->dev, "not able to register switch device\n");
1135 goto err_fini_utils;
1136 }
1137#endif
1138
1139#ifndef CONFIG_ARCH_TEGRA_2x_SOC
1140 for (i = 0; i < NUM_I2S_DEVICES ; i++)
1141 machine->codec_info[i].i2s_id = pdata->audio_port_id[i];
1142
1143 machine->codec_info[BASEBAND].rate = pdata->baseband_param.rate;
1144 machine->codec_info[BASEBAND].channels = pdata->baseband_param.channels;
1145
1146 tegra_max98088_dai[DAI_LINK_HIFI].cpu_dai_name =
1147 tegra_max98088_i2s_dai_name[machine->codec_info[HIFI_CODEC].i2s_id];
1148
1149 tegra_max98088_dai[DAI_LINK_BTSCO].cpu_dai_name =
1150 tegra_max98088_i2s_dai_name[machine->codec_info[BT_SCO].i2s_id];
1151#endif
1152
1153 ret = snd_soc_register_card(card);
1154 if (ret) {
1155 dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n",
1156 ret);
1157 goto err_switch_unregister;
1158 }
1159
1160 if (!card->instantiated) {
1161 dev_err(&pdev->dev, "No MAX98088 codec\n");
1162 goto err_unregister_card;
1163 }
1164
1165 return 0;
1166
1167err_unregister_card:
1168 snd_soc_unregister_card(card);
1169err_switch_unregister:
1170#ifdef CONFIG_SWITCH
1171 switch_dev_unregister(&wired_switch_dev);
1172#endif
1173err_fini_utils:
1174 tegra_asoc_utils_fini(&machine->util_data);
1175err_free_machine:
1176 kfree(machine);
1177 return ret;
1178}
1179
1180static int __devexit tegra_max98088_driver_remove(struct platform_device *pdev)
1181{
1182 struct snd_soc_card *card = platform_get_drvdata(pdev);
1183 struct tegra_max98088 *machine = snd_soc_card_get_drvdata(card);
1184 struct tegra_asoc_platform_data *pdata = machine->pdata;
1185
1186 snd_soc_unregister_card(card);
1187
1188#ifdef CONFIG_SWITCH
1189 switch_dev_unregister(&wired_switch_dev);
1190#endif
1191
1192 tegra_asoc_utils_fini(&machine->util_data);
1193
1194 if (machine->gpio_requested & GPIO_EXT_MIC_EN)
1195 gpio_free(pdata->gpio_ext_mic_en);
1196 if (machine->gpio_requested & GPIO_INT_MIC_EN)
1197 gpio_free(pdata->gpio_int_mic_en);
1198 if (machine->gpio_requested & GPIO_HP_MUTE)
1199 gpio_free(pdata->gpio_hp_mute);
1200 if (machine->gpio_requested & GPIO_SPKR_EN)
1201 gpio_free(pdata->gpio_spkr_en);
1202
1203 kfree(machine);
1204
1205 return 0;
1206}
1207
1208static struct platform_driver tegra_max98088_driver = {
1209 .driver = {
1210 .name = DRV_NAME,
1211 .owner = THIS_MODULE,
1212 .pm = &snd_soc_pm_ops,
1213 },
1214 .probe = tegra_max98088_driver_probe,
1215 .remove = __devexit_p(tegra_max98088_driver_remove),
1216};
1217
1218static int __init tegra_max98088_modinit(void)
1219{
1220 return platform_driver_register(&tegra_max98088_driver);
1221}
1222module_init(tegra_max98088_modinit);
1223
1224static void __exit tegra_max98088_modexit(void)
1225{
1226 platform_driver_unregister(&tegra_max98088_driver);
1227}
1228module_exit(tegra_max98088_modexit);
1229
1230MODULE_AUTHOR("Sumit Bhattacharya <sumitb@nvidia.com>");
1231MODULE_DESCRIPTION("Tegra+MAX98088 machine ASoC driver");
1232MODULE_LICENSE("GPL");
1233MODULE_ALIAS("platform:" DRV_NAME);
diff --git a/sound/soc/tegra/tegra_max98095.c b/sound/soc/tegra/tegra_max98095.c
new file mode 100644
index 00000000000..2104ba849cd
--- /dev/null
+++ b/sound/soc/tegra/tegra_max98095.c
@@ -0,0 +1,723 @@
1/*
2 * tegra_max98095.c - Tegra machine ASoC driver for boards using MAX98095 codec.
3 *
4 * Author: Ravindra Lokhande <rlokhande@nvidia.com>
5 * Copyright (C) 2012 - NVIDIA, Inc.
6 *
7 * Based on version from Sumit Bhattacharya <sumitb@nvidia.com>
8 *
9 * Based on code copyright/by:
10 *
11 * (c) 2010, 2011, 2012 Nvidia Graphics Pvt. Ltd.
12 *
13 * Copyright 2007 Wolfson Microelectronics PLC.
14 * Author: Graeme Gregory
15 * graeme.gregory@wolfsonmicro.com or linux@wolfsonmicro.com
16 *
17 * This program is free software; you can redistribute it and/or
18 * modify it under the terms of the GNU General Public License
19 * version 2 as published by the Free Software Foundation.
20 *
21 * This program is distributed in the hope that it will be useful, but
22 * WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
24 * General Public License for more details.
25 *
26 * You should have received a copy of the GNU General Public License
27 * along with this program; if not, write to the Free Software
28 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
29 * 02110-1301 USA
30 *
31 */
32
33#include <asm/mach-types.h>
34
35#include <linux/module.h>
36#include <linux/platform_device.h>
37#include <linux/slab.h>
38#include <linux/gpio.h>
39#include <linux/regulator/consumer.h>
40#ifdef CONFIG_SWITCH
41#include <linux/switch.h>
42#endif
43
44#include <mach/tegra_asoc_pdata.h>
45
46#include <sound/core.h>
47#include <sound/jack.h>
48#include <sound/pcm.h>
49#include <sound/pcm_params.h>
50#include <sound/soc.h>
51
52#include "../codecs/max98095.h"
53
54#include "tegra_pcm.h"
55#include "tegra_asoc_utils.h"
56#ifndef CONFIG_ARCH_TEGRA_2x_SOC
57#include "tegra30_ahub.h"
58#include "tegra30_i2s.h"
59#include "tegra30_dam.h"
60#endif
61
62#define DRV_NAME "tegra-snd-max98095"
63
64#define GPIO_SPKR_EN BIT(0)
65#define GPIO_HP_MUTE BIT(1)
66#define GPIO_INT_MIC_EN BIT(2)
67#define GPIO_EXT_MIC_EN BIT(3)
68
69#ifndef CONFIG_ARCH_TEGRA_2x_SOC
70const char *tegra_max98095_i2s_dai_name[TEGRA30_NR_I2S_IFC] = {
71 "tegra30-i2s.0",
72 "tegra30-i2s.1",
73 "tegra30-i2s.2",
74 "tegra30-i2s.3",
75 "tegra30-i2s.4",
76};
77#endif
78
79struct tegra_max98095 {
80 struct tegra_asoc_utils_data util_data;
81 struct tegra_asoc_platform_data *pdata;
82 int gpio_requested;
83 bool init_done;
84 int is_call_mode;
85 int is_device_bt;
86#ifndef CONFIG_ARCH_TEGRA_2x_SOC
87 struct codec_config codec_info[NUM_I2S_DEVICES];
88#endif
89 enum snd_soc_bias_level bias_level;
90};
91
92
93#ifndef CONFIG_ARCH_TEGRA_2x_SOC
94static int tegra_max98095_set_dam_cif(int dam_ifc, int srate,
95 int channels, int bit_size)
96{
97 tegra30_dam_set_samplerate(dam_ifc, TEGRA30_DAM_CHOUT,
98 srate);
99 tegra30_dam_set_samplerate(dam_ifc, TEGRA30_DAM_CHIN1,
100 srate);
101 tegra30_dam_set_acif(dam_ifc, TEGRA30_DAM_CHIN1,
102 channels, bit_size, channels,
103 bit_size);
104 tegra30_dam_set_acif(dam_ifc, TEGRA30_DAM_CHOUT,
105 channels, bit_size, channels,
106 bit_size);
107
108 return 0;
109}
110#endif
111
112static int tegra_max98095_hw_params(struct snd_pcm_substream *substream,
113 struct snd_pcm_hw_params *params)
114{
115 struct snd_soc_pcm_runtime *rtd = substream->private_data;
116 struct snd_soc_dai *codec_dai = rtd->codec_dai;
117 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
118 struct snd_soc_codec *codec = rtd->codec;
119 struct snd_soc_card *card = codec->card;
120 struct tegra_max98095 *machine = snd_soc_card_get_drvdata(card);
121#ifndef CONFIG_ARCH_TEGRA_2x_SOC
122 struct tegra30_i2s *i2s = snd_soc_dai_get_drvdata(cpu_dai);
123#endif
124 unsigned int srate, mclk, sample_size;
125 int err;
126
127 switch (params_format(params)) {
128 case SNDRV_PCM_FORMAT_S16_LE:
129 sample_size = 16;
130 break;
131 default:
132 return -EINVAL;
133 }
134
135 srate = params_rate(params);
136 switch (srate) {
137 case 8000:
138 case 16000:
139 case 24000:
140 case 32000:
141 case 48000:
142 case 64000:
143 case 96000:
144 mclk = 12288000;
145 break;
146 case 11025:
147 case 22050:
148 case 44100:
149 case 88200:
150 mclk = 11289600;
151 break;
152 default:
153 mclk = 12000000;
154 break;
155 }
156
157 err = tegra_asoc_utils_set_rate(&machine->util_data, srate, mclk);
158 if (err < 0) {
159 if (!(machine->util_data.set_mclk % mclk))
160 mclk = machine->util_data.set_mclk;
161 else {
162 dev_err(card->dev, "Can't configure clocks\n");
163 return err;
164 }
165 }
166
167 tegra_asoc_utils_lock_clk_rate(&machine->util_data, 1);
168
169 err = snd_soc_dai_set_fmt(codec_dai,
170 SND_SOC_DAIFMT_I2S |
171 SND_SOC_DAIFMT_NB_NF |
172 SND_SOC_DAIFMT_CBS_CFS);
173 if (err < 0) {
174 dev_err(card->dev, "codec_dai fmt not set\n");
175 return err;
176 }
177
178 err = snd_soc_dai_set_fmt(cpu_dai,
179 SND_SOC_DAIFMT_I2S |
180 SND_SOC_DAIFMT_NB_NF |
181 SND_SOC_DAIFMT_CBS_CFS);
182 if (err < 0) {
183 dev_err(card->dev, "cpu_dai fmt not set\n");
184 return err;
185 }
186
187 err = snd_soc_dai_set_sysclk(codec_dai, 0, mclk,
188 SND_SOC_CLOCK_IN);
189 if (err < 0) {
190 dev_err(card->dev, "codec_dai clock not set\n");
191 return err;
192 }
193
194#ifndef CONFIG_ARCH_TEGRA_2x_SOC
195 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
196 tegra_max98095_set_dam_cif(i2s->dam_ifc, srate,
197 params_channels(params), sample_size);
198#endif
199
200 return 0;
201}
202
203static int tegra_spdif_hw_params(struct snd_pcm_substream *substream,
204 struct snd_pcm_hw_params *params)
205{
206 struct snd_soc_pcm_runtime *rtd = substream->private_data;
207 struct snd_soc_card *card = rtd->card;
208 struct tegra_max98095 *machine = snd_soc_card_get_drvdata(card);
209 unsigned int srate, mclk, min_mclk;
210 int err;
211
212 srate = params_rate(params);
213 switch (srate) {
214 case 11025:
215 case 22050:
216 case 44100:
217 case 88200:
218 mclk = 11289600;
219 break;
220 case 8000:
221 case 16000:
222 case 32000:
223 case 48000:
224 case 64000:
225 case 96000:
226 mclk = 12288000;
227 break;
228 default:
229 return -EINVAL;
230 }
231 min_mclk = 128 * srate;
232
233 err = tegra_asoc_utils_set_rate(&machine->util_data, srate, mclk);
234 if (err < 0) {
235 if (!(machine->util_data.set_mclk % min_mclk))
236 mclk = machine->util_data.set_mclk;
237 else {
238 dev_err(card->dev, "Can't configure clocks\n");
239 return err;
240 }
241 }
242
243 tegra_asoc_utils_lock_clk_rate(&machine->util_data, 1);
244
245
246
247 return 0;
248}
249
250static int tegra_hw_free(struct snd_pcm_substream *substream)
251{
252 struct snd_soc_pcm_runtime *rtd = substream->private_data;
253 struct tegra_max98095 *machine = snd_soc_card_get_drvdata(rtd->card);
254
255 tegra_asoc_utils_lock_clk_rate(&machine->util_data, 0);
256
257 return 0;
258}
259
260#ifndef CONFIG_ARCH_TEGRA_2x_SOC
261static int tegra_max98095_startup(struct snd_pcm_substream *substream)
262{
263 struct snd_soc_pcm_runtime *rtd = substream->private_data;
264 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
265 struct tegra30_i2s *i2s = snd_soc_dai_get_drvdata(cpu_dai);
266
267 if ((substream->stream != SNDRV_PCM_STREAM_PLAYBACK) ||
268 !(i2s->is_dam_used))
269 return 0;
270
271 /*dam configuration*/
272 if (!i2s->dam_ch_refcount)
273 i2s->dam_ifc = tegra30_dam_allocate_controller();
274
275 tegra30_dam_allocate_channel(i2s->dam_ifc, TEGRA30_DAM_CHIN1);
276 i2s->dam_ch_refcount++;
277 tegra30_dam_enable_clock(i2s->dam_ifc);
278 tegra30_dam_set_gain(i2s->dam_ifc, TEGRA30_DAM_CHIN1, 0x1000);
279
280 tegra30_ahub_set_rx_cif_source(TEGRA30_AHUB_RXCIF_DAM0_RX1 +
281 (i2s->dam_ifc*2), i2s->txcif);
282
283 /*
284 *make the dam tx to i2s rx connection if this is the only client
285 *using i2s for playback
286 */
287 if (i2s->playback_ref_count == 1)
288 tegra30_ahub_set_rx_cif_source(
289 TEGRA30_AHUB_RXCIF_I2S0_RX0 + i2s->id,
290 TEGRA30_AHUB_TXCIF_DAM0_TX0 + i2s->dam_ifc);
291
292 /* enable the dam*/
293 tegra30_dam_enable(i2s->dam_ifc, TEGRA30_DAM_ENABLE,
294 TEGRA30_DAM_CHIN1);
295
296 return 0;
297}
298
299static void tegra_max98095_shutdown(struct snd_pcm_substream *substream)
300{
301 struct snd_soc_pcm_runtime *rtd = substream->private_data;
302 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
303 struct tegra30_i2s *i2s = snd_soc_dai_get_drvdata(cpu_dai);
304
305 if ((substream->stream != SNDRV_PCM_STREAM_PLAYBACK) ||
306 !(i2s->is_dam_used))
307 return;
308
309 /* disable the dam*/
310 tegra30_dam_enable(i2s->dam_ifc, TEGRA30_DAM_DISABLE,
311 TEGRA30_DAM_CHIN1);
312
313 /* disconnect the ahub connections*/
314 tegra30_ahub_unset_rx_cif_source(TEGRA30_AHUB_RXCIF_DAM0_RX1 +
315 (i2s->dam_ifc*2));
316
317 /* disable the dam and free the controller */
318 tegra30_dam_disable_clock(i2s->dam_ifc);
319 tegra30_dam_free_channel(i2s->dam_ifc, TEGRA30_DAM_CHIN1);
320 i2s->dam_ch_refcount--;
321 if (!i2s->dam_ch_refcount)
322 tegra30_dam_free_controller(i2s->dam_ifc);
323
324 return;
325}
326#endif
327
328static struct snd_soc_ops tegra_max98095_ops = {
329 .hw_params = tegra_max98095_hw_params,
330 .hw_free = tegra_hw_free,
331#ifndef CONFIG_ARCH_TEGRA_2x_SOC
332 .startup = tegra_max98095_startup,
333 .shutdown = tegra_max98095_shutdown,
334#endif
335};
336
337static struct snd_soc_ops tegra_spdif_ops = {
338 .hw_params = tegra_spdif_hw_params,
339 .hw_free = tegra_hw_free,
340};
341
342static struct snd_soc_jack tegra_max98095_hp_jack;
343
344#ifdef CONFIG_SWITCH
345static struct switch_dev wired_switch_dev = {
346 .name = "h2w",
347};
348
349/* These values are copied from WiredAccessoryObserver */
350enum headset_state {
351 BIT_NO_HEADSET = 0,
352 BIT_HEADSET = (1 << 0),
353 BIT_HEADSET_NO_MIC = (1 << 1),
354};
355
356static int headset_switch_notify(struct notifier_block *self,
357 unsigned long action, void *dev)
358{
359 int state = 0;
360
361 switch (action) {
362 case SND_JACK_HEADPHONE:
363 state |= BIT_HEADSET_NO_MIC;
364 break;
365 case SND_JACK_HEADSET:
366 state |= BIT_HEADSET;
367 break;
368 default:
369 state |= BIT_NO_HEADSET;
370 }
371
372 switch_set_state(&wired_switch_dev, state);
373
374 return NOTIFY_OK;
375}
376
377static struct notifier_block headset_switch_nb = {
378 .notifier_call = headset_switch_notify,
379};
380#else
381static struct snd_soc_jack_pin tegra_max98095_hp_jack_pins[] = {
382 {
383 .pin = "Headphone Jack",
384 .mask = SND_JACK_HEADPHONE,
385 },
386};
387#endif
388
389static int tegra_max98095_event_int_spk(struct snd_soc_dapm_widget *w,
390 struct snd_kcontrol *k, int event)
391{
392 struct snd_soc_dapm_context *dapm = w->dapm;
393 struct snd_soc_card *card = dapm->card;
394 struct tegra_max98095 *machine = snd_soc_card_get_drvdata(card);
395 struct tegra_asoc_platform_data *pdata = machine->pdata;
396
397 if (!(machine->gpio_requested & GPIO_SPKR_EN))
398 return 0;
399
400 gpio_set_value_cansleep(pdata->gpio_spkr_en,
401 SND_SOC_DAPM_EVENT_ON(event));
402
403 return 0;
404}
405
406static int tegra_max98095_event_hp(struct snd_soc_dapm_widget *w,
407 struct snd_kcontrol *k, int event)
408{
409 struct snd_soc_dapm_context *dapm = w->dapm;
410 struct snd_soc_card *card = dapm->card;
411 struct tegra_max98095 *machine = snd_soc_card_get_drvdata(card);
412 struct tegra_asoc_platform_data *pdata = machine->pdata;
413
414 if (!(machine->gpio_requested & GPIO_HP_MUTE))
415 return 0;
416
417 gpio_set_value_cansleep(pdata->gpio_hp_mute,
418 !SND_SOC_DAPM_EVENT_ON(event));
419
420 return 0;
421}
422
423static const struct snd_soc_dapm_widget tegra_max98095_dapm_widgets[] = {
424 SND_SOC_DAPM_SPK("Int Spk", tegra_max98095_event_int_spk),
425 SND_SOC_DAPM_HP("Headphone Jack", tegra_max98095_event_hp),
426 SND_SOC_DAPM_MIC("Mic Jack", NULL),
427 SND_SOC_DAPM_INPUT("Int Mic"),
428 SND_SOC_DAPM_LINE("Line In", NULL),
429};
430
431static const struct snd_soc_dapm_route enterprise_audio_map[] = {
432 {"Int Spk", NULL, "SPKL"},
433 {"Int Spk", NULL, "SPKR"},
434 {"Headphone Jack", NULL, "HPL"},
435 {"Headphone Jack", NULL, "HPR"},
436 {"MICBIAS2", NULL, "Mic Jack"},
437 {"MIC2", NULL, "MICBIAS2"},
438 {"MIC1", NULL, "Int Mic"},
439 {"MIC1", NULL, "MICBIAS1"},
440 {"INB1", NULL, "Line In"},
441 {"INB2", NULL, "Line In"},
442};
443
444static const struct snd_kcontrol_new tegra_max98095_controls[] = {
445 SOC_DAPM_PIN_SWITCH("Int Spk"),
446 SOC_DAPM_PIN_SWITCH("Headphone Jack"),
447 SOC_DAPM_PIN_SWITCH("Mic Jack"),
448 SOC_DAPM_PIN_SWITCH("Int Mic"),
449 SOC_DAPM_PIN_SWITCH("LineIn"),
450};
451
452static int tegra_max98095_init(struct snd_soc_pcm_runtime *rtd)
453{
454 struct snd_soc_codec *codec = rtd->codec;
455 struct snd_soc_dapm_context *dapm = &codec->dapm;
456 struct snd_soc_card *card = codec->card;
457 struct tegra_max98095 *machine = snd_soc_card_get_drvdata(card);
458 struct tegra_asoc_platform_data *pdata = machine->pdata;
459#ifndef CONFIG_ARCH_TEGRA_2x_SOC
460 struct tegra30_i2s *i2s = snd_soc_dai_get_drvdata(rtd->cpu_dai);
461#endif
462 int ret;
463
464#ifndef CONFIG_ARCH_TEGRA_2x_SOC
465 if (machine->codec_info[BASEBAND].i2s_id != -1)
466 i2s->is_dam_used = true;
467#endif
468
469 if (machine->init_done)
470 return 0;
471
472 machine->init_done = true;
473
474 if (gpio_is_valid(pdata->gpio_spkr_en)) {
475 ret = gpio_request(pdata->gpio_spkr_en, "spkr_en");
476 if (ret) {
477 dev_err(card->dev, "cannot get spkr_en gpio\n");
478 return ret;
479 }
480 machine->gpio_requested |= GPIO_SPKR_EN;
481
482 gpio_direction_output(pdata->gpio_spkr_en, 0);
483 }
484
485 if (gpio_is_valid(pdata->gpio_hp_mute)) {
486 ret = gpio_request(pdata->gpio_hp_mute, "hp_mute");
487 if (ret) {
488 dev_err(card->dev, "cannot get hp_mute gpio\n");
489 return ret;
490 }
491 machine->gpio_requested |= GPIO_HP_MUTE;
492
493 gpio_direction_output(pdata->gpio_hp_mute, 0);
494 }
495
496 if (gpio_is_valid(pdata->gpio_int_mic_en)) {
497 ret = gpio_request(pdata->gpio_int_mic_en, "int_mic_en");
498 if (ret) {
499 dev_err(card->dev, "cannot get int_mic_en gpio\n");
500 return ret;
501 }
502 machine->gpio_requested |= GPIO_INT_MIC_EN;
503
504 /* Disable int mic; enable signal is active-high */
505 gpio_direction_output(pdata->gpio_int_mic_en, 0);
506 }
507
508 if (gpio_is_valid(pdata->gpio_ext_mic_en)) {
509 ret = gpio_request(pdata->gpio_ext_mic_en, "ext_mic_en");
510 if (ret) {
511 dev_err(card->dev, "cannot get ext_mic_en gpio\n");
512 return ret;
513 }
514 machine->gpio_requested |= GPIO_EXT_MIC_EN;
515
516 /* Enable ext mic; enable signal is active-low */
517 gpio_direction_output(pdata->gpio_ext_mic_en, 0);
518 }
519
520 ret = snd_soc_add_controls(codec, tegra_max98095_controls,
521 ARRAY_SIZE(tegra_max98095_controls));
522 if (ret < 0)
523 return ret;
524
525 snd_soc_dapm_new_controls(dapm, tegra_max98095_dapm_widgets,
526 ARRAY_SIZE(tegra_max98095_dapm_widgets));
527
528 snd_soc_dapm_add_routes(dapm, enterprise_audio_map,
529 ARRAY_SIZE(enterprise_audio_map));
530
531 ret = snd_soc_jack_new(codec, "Headset Jack", SND_JACK_HEADSET,
532 &tegra_max98095_hp_jack);
533 if (ret < 0)
534 return ret;
535
536#ifdef CONFIG_SWITCH
537 snd_soc_jack_notifier_register(&tegra_max98095_hp_jack,
538 &headset_switch_nb);
539#else /*gpio based headset detection*/
540 snd_soc_jack_add_pins(&tegra_max98095_hp_jack,
541 ARRAY_SIZE(tegra_max98095_hp_jack_pins),
542 tegra_max98095_hp_jack_pins);
543#endif
544
545 /* max98095_headset_detect(codec, &tegra_max98095_hp_jack,
546 SND_JACK_HEADSET); */
547
548 snd_soc_dapm_nc_pin(dapm, "INA1");
549 snd_soc_dapm_nc_pin(dapm, "INA2");
550 snd_soc_dapm_nc_pin(dapm, "INB1");
551 snd_soc_dapm_nc_pin(dapm, "INB2");
552 snd_soc_dapm_sync(dapm);
553
554 return 0;
555}
556
557static struct snd_soc_dai_link tegra_max98095_dai[] = {
558 {
559 .name = "MAX98095",
560 .stream_name = "MAX98095 HIFI",
561 .codec_name = "max98095.4-0010",
562 .platform_name = "tegra-pcm-audio",
563 .cpu_dai_name = "tegra30-i2s.1",
564 .codec_dai_name = "HiFi",
565 .init = tegra_max98095_init,
566 .ops = &tegra_max98095_ops,
567 },
568 {
569 .name = "SPDIF",
570 .stream_name = "SPDIF PCM",
571 .codec_name = "spdif-dit.0",
572 .platform_name = "tegra-pcm-audio",
573 .cpu_dai_name = "tegra30-spdif",
574 .codec_dai_name = "dit-hifi",
575 .ops = &tegra_spdif_ops,
576 },
577};
578
579static int tegra30_soc_set_bias_level(struct snd_soc_card *card,
580 enum snd_soc_bias_level level)
581{
582 struct tegra_max98095 *machine = snd_soc_card_get_drvdata(card);
583
584 if (machine->bias_level == SND_SOC_BIAS_OFF &&
585 level != SND_SOC_BIAS_OFF)
586 tegra_asoc_utils_clk_enable(&machine->util_data);
587
588 machine->bias_level = level;
589
590 return 0;
591}
592
593static int tegra30_soc_set_bias_level_post(struct snd_soc_card *card,
594 enum snd_soc_bias_level level)
595{
596 struct tegra_max98095 *machine = snd_soc_card_get_drvdata(card);
597
598 if (level == SND_SOC_BIAS_OFF)
599 tegra_asoc_utils_clk_disable(&machine->util_data);
600
601 return 0 ;
602}
603
604static struct snd_soc_card snd_soc_tegra_max98095 = {
605 .name = "tegra-max98095",
606 .dai_link = tegra_max98095_dai,
607 .num_links = ARRAY_SIZE(tegra_max98095_dai),
608 .set_bias_level = tegra30_soc_set_bias_level,
609 .set_bias_level_post = tegra30_soc_set_bias_level_post,
610};
611
612static __devinit int tegra_max98095_driver_probe(struct platform_device *pdev)
613{
614 struct snd_soc_card *card = &snd_soc_tegra_max98095;
615 struct tegra_max98095 *machine;
616 struct tegra_asoc_platform_data *pdata;
617 int ret;
618
619 pdata = pdev->dev.platform_data;
620 if (!pdata) {
621 dev_err(&pdev->dev, "No platform data supplied\n");
622 return -EINVAL;
623 }
624
625 machine = kzalloc(sizeof(struct tegra_max98095), GFP_KERNEL);
626 if (!machine) {
627 dev_err(&pdev->dev, "Can't allocate tegra_max98095 struct\n");
628 return -ENOMEM;
629 }
630
631 machine->pdata = pdata;
632
633 ret = tegra_asoc_utils_init(&machine->util_data, &pdev->dev);
634 if (ret)
635 goto err_free_machine;
636
637 card->dev = &pdev->dev;
638 platform_set_drvdata(pdev, card);
639 snd_soc_card_set_drvdata(card, machine);
640
641#ifdef CONFIG_SWITCH
642 /* Add h2w switch class support */
643 ret = switch_dev_register(&wired_switch_dev);
644 if (ret < 0) {
645 dev_err(&pdev->dev, "not able to register switch device\n");
646 goto err_fini_utils;
647 }
648#endif
649
650 ret = snd_soc_register_card(card);
651 if (ret) {
652 dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n",
653 ret);
654 goto err_switch_unregister;
655 }
656
657 return 0;
658
659err_switch_unregister:
660#ifdef CONFIG_SWITCH
661 switch_dev_unregister(&wired_switch_dev);
662#endif
663err_fini_utils:
664 tegra_asoc_utils_fini(&machine->util_data);
665err_free_machine:
666 kfree(machine);
667 return ret;
668}
669
670static int __devexit tegra_max98095_driver_remove(struct platform_device *pdev)
671{
672 struct snd_soc_card *card = platform_get_drvdata(pdev);
673 struct tegra_max98095 *machine = snd_soc_card_get_drvdata(card);
674 struct tegra_asoc_platform_data *pdata = machine->pdata;
675
676 snd_soc_unregister_card(card);
677
678#ifdef CONFIG_SWITCH
679 switch_dev_unregister(&wired_switch_dev);
680#endif
681
682 tegra_asoc_utils_fini(&machine->util_data);
683
684 if (machine->gpio_requested & GPIO_EXT_MIC_EN)
685 gpio_free(pdata->gpio_ext_mic_en);
686 if (machine->gpio_requested & GPIO_INT_MIC_EN)
687 gpio_free(pdata->gpio_int_mic_en);
688 if (machine->gpio_requested & GPIO_HP_MUTE)
689 gpio_free(pdata->gpio_hp_mute);
690 if (machine->gpio_requested & GPIO_SPKR_EN)
691 gpio_free(pdata->gpio_spkr_en);
692
693 kfree(machine);
694
695 return 0;
696}
697
698static struct platform_driver tegra_max98095_driver = {
699 .driver = {
700 .name = DRV_NAME,
701 .owner = THIS_MODULE,
702 .pm = &snd_soc_pm_ops,
703 },
704 .probe = tegra_max98095_driver_probe,
705 .remove = __devexit_p(tegra_max98095_driver_remove),
706};
707
708static int __init tegra_max98095_modinit(void)
709{
710 return platform_driver_register(&tegra_max98095_driver);
711}
712module_init(tegra_max98095_modinit);
713
714static void __exit tegra_max98095_modexit(void)
715{
716 platform_driver_unregister(&tegra_max98095_driver);
717}
718module_exit(tegra_max98095_modexit);
719
720MODULE_AUTHOR("Ravindra Lokhande <rlokhande@nvidia.com>");
721MODULE_DESCRIPTION("Tegra+MAX98095 machine ASoC driver");
722MODULE_LICENSE("GPL");
723MODULE_ALIAS("platform:" DRV_NAME);
diff --git a/sound/soc/tegra/tegra_p1852.c b/sound/soc/tegra/tegra_p1852.c
new file mode 100644
index 00000000000..27a1ea59034
--- /dev/null
+++ b/sound/soc/tegra/tegra_p1852.c
@@ -0,0 +1,272 @@
1/*
2 * tegra_p1852.c - Tegra machine ASoC driver for P1852 Boards.
3 *
4 * Author: Nitin Pai <npai@nvidia.com>
5 * Copyright (C) 2010-2012 - NVIDIA, Inc.
6 *
7 * Based on code copyright/by:
8 * Copyright (c) 2009-2010, NVIDIA Corporation.
9 * Stephen Warren <swarren@nvidia.com>
10 *
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * version 2 as published by the Free Software Foundation.
14 *
15 * This program is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
23 * 02110-1301 USA
24 *
25 */
26
27#include <asm/mach-types.h>
28
29#include <linux/clk.h>
30#include <linux/module.h>
31#include <linux/platform_device.h>
32#include <linux/slab.h>
33
34#include <mach/tegra_p1852_pdata.h>
35
36#include <sound/core.h>
37#include <sound/pcm.h>
38#include <sound/pcm_params.h>
39#include <sound/soc.h>
40
41#include "tegra_pcm.h"
42#include "tegra_asoc_utils.h"
43
44#define DRV_NAME "tegra-snd-p1852"
45
46struct tegra_p1852 {
47 struct tegra_asoc_utils_data util_data;
48 struct tegra_p1852_platform_data *pdata;
49};
50
51static int tegra_p1852_hw_params(struct snd_pcm_substream *substream,
52 struct snd_pcm_hw_params *params)
53{
54 struct snd_soc_pcm_runtime *rtd = substream->private_data;
55 struct snd_soc_dai *codec_dai = rtd->codec_dai;
56 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
57 struct snd_soc_codec *codec = rtd->codec;
58 struct snd_soc_card *card = codec->card;
59 struct tegra_p1852 *machine = snd_soc_card_get_drvdata(card);
60 int srate, mclk;
61 int i2s_daifmt = 0;
62 int err;
63 struct tegra_p1852_platform_data *pdata;
64 int codec_id = codec_dai->id;
65
66 pdata = machine->pdata;
67
68 srate = params_rate(params);
69 switch (srate) {
70 case 64000:
71 case 88200:
72 case 96000:
73 mclk = 128 * srate;
74 break;
75 default:
76 mclk = 256 * srate;
77 break;
78 }
79
80 err = tegra_asoc_utils_set_rate(&machine->util_data, srate, mclk);
81 if (err < 0) {
82 if (!(machine->util_data.set_mclk % mclk))
83 mclk = machine->util_data.set_mclk;
84 else {
85 dev_err(card->dev, "Can't configure clocks\n");
86 return err;
87 }
88 }
89
90 tegra_asoc_utils_lock_clk_rate(&machine->util_data, 1);
91
92 if (pdata->codec_info[codec_id].master)
93 i2s_daifmt |= SND_SOC_DAIFMT_CBM_CFM;
94 else
95 i2s_daifmt |= SND_SOC_DAIFMT_CBS_CFS;
96
97 switch (pdata->codec_info[codec_id].i2s_format) {
98 case format_tdm:
99 i2s_daifmt |= SND_SOC_DAIFMT_DSP_A;
100 break;
101 case format_i2s:
102 i2s_daifmt |= SND_SOC_DAIFMT_I2S;
103 break;
104 case format_rjm:
105 i2s_daifmt |= SND_SOC_DAIFMT_RIGHT_J;
106 break;
107 case format_ljm:
108 i2s_daifmt |= SND_SOC_DAIFMT_LEFT_J;
109 break;
110 default:
111 break;
112 }
113
114 err = snd_soc_dai_set_fmt(codec_dai, i2s_daifmt);
115 if (err < 0)
116 dev_info(card->dev, "codec_dai fmt not set\n");
117
118 err = snd_soc_dai_set_fmt(cpu_dai, i2s_daifmt);
119 if (err < 0) {
120 dev_err(card->dev, "cpu_dai fmt not set\n");
121 return err;
122 }
123
124 err = snd_soc_dai_set_sysclk(codec_dai, 0, mclk,
125 SND_SOC_CLOCK_IN);
126 if (err < 0)
127 dev_info(card->dev, "codec_dai clock not set\n");
128
129 return 0;
130}
131
132static int tegra_hw_free(struct snd_pcm_substream *substream)
133{
134 struct snd_soc_pcm_runtime *rtd = substream->private_data;
135 struct tegra_p1852 *machine = snd_soc_card_get_drvdata(rtd->card);
136
137 tegra_asoc_utils_lock_clk_rate(&machine->util_data, 0);
138
139 return 0;
140}
141
142static struct snd_soc_ops tegra_p1852_ops = {
143 .hw_params = tegra_p1852_hw_params,
144 .hw_free = tegra_hw_free,
145};
146
147static struct snd_soc_dai_link tegra_p1852_dai_link[] = {
148 {
149 .name = "I2S-TDM-1",
150 .stream_name = "TEGRA PCM",
151 .platform_name = "tegra-pcm-audio",
152 .ops = &tegra_p1852_ops,
153 },
154 {
155 .name = "I2S-TDM-2",
156 .stream_name = "TEGRA PCM",
157 .platform_name = "tegra-pcm-audio",
158 .ops = &tegra_p1852_ops,
159 }
160};
161
162static struct snd_soc_card snd_soc_tegra_p1852 = {
163 .name = "tegra-p1852",
164 .dai_link = tegra_p1852_dai_link,
165 .num_links = ARRAY_SIZE(tegra_p1852_dai_link),
166};
167
168static __devinit int tegra_p1852_driver_probe(struct platform_device *pdev)
169{
170 struct snd_soc_card *card = &snd_soc_tegra_p1852;
171 struct tegra_p1852 *machine;
172 struct tegra_p1852_platform_data *pdata;
173 int ret;
174 int i;
175
176 pdata = pdev->dev.platform_data;
177 if (!pdata) {
178 dev_err(&pdev->dev, "No platform data supplied\n");
179 return -EINVAL;
180 }
181
182 machine = kzalloc(sizeof(struct tegra_p1852), GFP_KERNEL);
183 if (!machine) {
184 dev_err(&pdev->dev, "Can't allocate tegra_p1852 struct\n");
185 return -ENOMEM;
186 }
187
188 machine->pdata = pdata;
189
190 /* The codec driver and codec dai have to come from the system
191 * level board configuration file
192 * */
193 for (i = 0; i < ARRAY_SIZE(tegra_p1852_dai_link); i++) {
194 tegra_p1852_dai_link[i].codec_name =
195 pdata->codec_info[i].codec_name;
196 tegra_p1852_dai_link[i].cpu_dai_name =
197 pdata->codec_info[i].cpu_dai_name;
198 tegra_p1852_dai_link[i].codec_dai_name =
199 pdata->codec_info[i].codec_dai_name;
200 tegra_p1852_dai_link[i].name =
201 pdata->codec_info[i].name;
202 }
203
204 ret = tegra_asoc_utils_init(&machine->util_data, &pdev->dev);
205 if (ret)
206 goto err_free_machine;
207
208 card->dev = &pdev->dev;
209 platform_set_drvdata(pdev, card);
210 snd_soc_card_set_drvdata(card, machine);
211
212 ret = snd_soc_register_card(card);
213 if (ret) {
214 dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n",
215 ret);
216 }
217
218 if (!card->instantiated) {
219 ret = -ENODEV;
220 dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n",
221 ret);
222 goto err_unregister_card;
223 }
224
225 return 0;
226
227err_unregister_card:
228 snd_soc_unregister_card(card);
229 tegra_asoc_utils_fini(&machine->util_data);
230err_free_machine:
231 kfree(machine);
232 return ret;
233}
234
235static int __devexit tegra_p1852_driver_remove(struct platform_device *pdev)
236{
237 struct snd_soc_card *card = platform_get_drvdata(pdev);
238 struct tegra_p1852 *machine = snd_soc_card_get_drvdata(card);
239
240 snd_soc_unregister_card(card);
241 tegra_asoc_utils_fini(&machine->util_data);
242 kfree(machine);
243
244 return 0;
245}
246
247static struct platform_driver tegra_p1852_driver = {
248 .driver = {
249 .name = DRV_NAME,
250 .owner = THIS_MODULE,
251 .pm = &snd_soc_pm_ops,
252 },
253 .probe = tegra_p1852_driver_probe,
254 .remove = __devexit_p(tegra_p1852_driver_remove),
255};
256
257static int __init tegra_p1852_modinit(void)
258{
259 return platform_driver_register(&tegra_p1852_driver);
260}
261module_init(tegra_p1852_modinit);
262
263static void __exit tegra_p1852_modexit(void)
264{
265 platform_driver_unregister(&tegra_p1852_driver);
266}
267module_exit(tegra_p1852_modexit);
268
269MODULE_AUTHOR("Nitin Pai <npai@nvidia.com>");
270MODULE_DESCRIPTION("Tegra+P1852 machine ASoC driver");
271MODULE_LICENSE("GPL");
272MODULE_ALIAS("platform:" DRV_NAME);
diff --git a/sound/soc/tegra/tegra_rt5640.c b/sound/soc/tegra/tegra_rt5640.c
new file mode 100644
index 00000000000..f6f4ed3d421
--- /dev/null
+++ b/sound/soc/tegra/tegra_rt5640.c
@@ -0,0 +1,738 @@
1/*
2 * tegra_rt5640.c - Tegra machine ASoC driver for boards using ALC5640 codec.
3 *
4 * Author: Johnny Qiu <joqiu@nvidia.com>
5 * Copyright (C) 2011-2012, NVIDIA, Inc.
6 *
7 * Based on code copyright/by:
8 *
9 * Copyright 2007 Wolfson Microelectronics PLC.
10 * Author: Graeme Gregory
11 * graeme.gregory@wolfsonmicro.com or linux@wolfsonmicro.com
12 *
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License
15 * version 2 as published by the Free Software Foundation.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
25 * 02110-1301 USA
26 *
27 */
28
29#include <asm/mach-types.h>
30
31#include <linux/module.h>
32#include <linux/platform_device.h>
33#include <linux/slab.h>
34#include <linux/gpio.h>
35#include <linux/regulator/consumer.h>
36#ifdef CONFIG_SWITCH
37#include <linux/switch.h>
38#endif
39
40#include <mach/tegra_rt5640_pdata.h>
41
42#include <sound/core.h>
43#include <sound/jack.h>
44#include <sound/pcm.h>
45#include <sound/pcm_params.h>
46#include <sound/soc.h>
47
48#include "../codecs/rt5639.h"
49#include "../codecs/rt5640.h"
50
51#include "tegra_pcm.h"
52#include "tegra_asoc_utils.h"
53
54#define DRV_NAME "tegra-snd-rt5640"
55
56#define GPIO_SPKR_EN BIT(0)
57#define GPIO_HP_MUTE BIT(1)
58#define GPIO_INT_MIC_EN BIT(2)
59#define GPIO_EXT_MIC_EN BIT(3)
60#define GPIO_HP_DET BIT(4)
61
62struct tegra_rt5640 {
63 struct tegra_asoc_utils_data util_data;
64 struct tegra_rt5640_platform_data *pdata;
65 struct regulator *spk_reg;
66 struct regulator *dmic_reg;
67 struct regulator *cdc_en;
68 int gpio_requested;
69#ifdef CONFIG_SWITCH
70 int jack_status;
71#endif
72};
73
74static int tegra_rt5640_hw_params(struct snd_pcm_substream *substream,
75 struct snd_pcm_hw_params *params)
76{
77 struct snd_soc_pcm_runtime *rtd = substream->private_data;
78 struct snd_soc_dai *codec_dai = rtd->codec_dai;
79 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
80 struct snd_soc_codec *codec = rtd->codec;
81 struct snd_soc_card *card = codec->card;
82 struct tegra_rt5640 *machine = snd_soc_card_get_drvdata(card);
83 int srate, mclk, i2s_daifmt;
84 int err;
85
86 srate = params_rate(params);
87 mclk = 256 * srate;
88 err = tegra_asoc_utils_set_rate(&machine->util_data, srate, mclk);
89 if (err < 0) {
90 if (!(machine->util_data.set_mclk % mclk)) {
91 mclk = machine->util_data.set_mclk;
92 } else {
93 dev_err(card->dev, "Can't configure clocks\n");
94 return err;
95 }
96 }
97
98 tegra_asoc_utils_lock_clk_rate(&machine->util_data, 1);
99
100 i2s_daifmt = SND_SOC_DAIFMT_NB_NF |
101 SND_SOC_DAIFMT_CBS_CFS;
102
103 i2s_daifmt |= SND_SOC_DAIFMT_I2S;
104
105 err = snd_soc_dai_set_fmt(codec_dai, i2s_daifmt);
106 if (err < 0) {
107 dev_err(card->dev, "codec_dai fmt not set\n");
108 return err;
109 }
110
111 err = snd_soc_dai_set_fmt(cpu_dai, i2s_daifmt);
112 if (err < 0) {
113 dev_err(card->dev, "cpu_dai fmt not set\n");
114 return err;
115 }
116
117 err = snd_soc_dai_set_sysclk(codec_dai, 0, mclk,
118 SND_SOC_CLOCK_IN);
119 if (err < 0) {
120 dev_err(card->dev, "codec_dai clock not set\n");
121 return err;
122 }
123
124 return 0;
125}
126
127static int tegra_bt_sco_hw_params(struct snd_pcm_substream *substream,
128 struct snd_pcm_hw_params *params)
129{
130 struct snd_soc_pcm_runtime *rtd = substream->private_data;
131 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
132 struct snd_soc_card *card = rtd->card;
133 struct tegra_rt5640 *machine = snd_soc_card_get_drvdata(card);
134 int srate, mclk, min_mclk;
135 int err;
136
137 srate = params_rate(params);
138 switch (srate) {
139 case 11025:
140 case 22050:
141 case 44100:
142 case 88200:
143 mclk = 11289600;
144 break;
145 case 8000:
146 case 16000:
147 case 32000:
148 case 48000:
149 case 64000:
150 case 96000:
151 mclk = 12288000;
152 break;
153 default:
154 return -EINVAL;
155 }
156 min_mclk = 64 * srate;
157
158 err = tegra_asoc_utils_set_rate(&machine->util_data, srate, mclk);
159 if (err < 0) {
160 if (!(machine->util_data.set_mclk % min_mclk))
161 mclk = machine->util_data.set_mclk;
162 else {
163 dev_err(card->dev, "Can't configure clocks\n");
164 return err;
165 }
166 }
167
168 tegra_asoc_utils_lock_clk_rate(&machine->util_data, 1);
169
170 err = snd_soc_dai_set_fmt(cpu_dai,
171 SND_SOC_DAIFMT_DSP_A |
172 SND_SOC_DAIFMT_NB_NF |
173 SND_SOC_DAIFMT_CBS_CFS);
174 if (err < 0) {
175 dev_err(card->dev, "cpu_dai fmt not set\n");
176 return err;
177 }
178
179 return 0;
180}
181
182static int tegra_spdif_hw_params(struct snd_pcm_substream *substream,
183 struct snd_pcm_hw_params *params)
184{
185 struct snd_soc_pcm_runtime *rtd = substream->private_data;
186 struct snd_soc_card *card = rtd->card;
187 struct tegra_rt5640 *machine = snd_soc_card_get_drvdata(card);
188 int srate, mclk, min_mclk;
189 int err;
190
191 srate = params_rate(params);
192 switch (srate) {
193 case 11025:
194 case 22050:
195 case 44100:
196 case 88200:
197 mclk = 11289600;
198 break;
199 case 8000:
200 case 16000:
201 case 32000:
202 case 48000:
203 case 64000:
204 case 96000:
205 mclk = 12288000;
206 break;
207 default:
208 return -EINVAL;
209 }
210 min_mclk = 128 * srate;
211
212 err = tegra_asoc_utils_set_rate(&machine->util_data, srate, mclk);
213 if (err < 0) {
214 if (!(machine->util_data.set_mclk % min_mclk))
215 mclk = machine->util_data.set_mclk;
216 else {
217 dev_err(card->dev, "Can't configure clocks\n");
218 return err;
219 }
220 }
221
222 tegra_asoc_utils_lock_clk_rate(&machine->util_data, 1);
223
224 return 0;
225}
226
227static int tegra_hw_free(struct snd_pcm_substream *substream)
228{
229 struct snd_soc_pcm_runtime *rtd = substream->private_data;
230 struct tegra_rt5640 *machine = snd_soc_card_get_drvdata(rtd->card);
231
232 tegra_asoc_utils_lock_clk_rate(&machine->util_data, 0);
233
234 return 0;
235}
236
237static struct snd_soc_ops tegra_rt5640_ops = {
238 .hw_params = tegra_rt5640_hw_params,
239 .hw_free = tegra_hw_free,
240};
241
242static struct snd_soc_ops tegra_rt5640_bt_sco_ops = {
243 .hw_params = tegra_bt_sco_hw_params,
244 .hw_free = tegra_hw_free,
245};
246
247static struct snd_soc_ops tegra_spdif_ops = {
248 .hw_params = tegra_spdif_hw_params,
249 .hw_free = tegra_hw_free,
250};
251
252static struct snd_soc_jack tegra_rt5640_hp_jack;
253
254static struct snd_soc_jack_gpio tegra_rt5640_hp_jack_gpio = {
255 .name = "headphone detect",
256 .report = SND_JACK_HEADPHONE,
257 .debounce_time = 150,
258 .invert = 1,
259};
260
261#ifdef CONFIG_SWITCH
262/* These values are copied from Android WiredAccessoryObserver */
263enum headset_state {
264 BIT_NO_HEADSET = 0,
265 BIT_HEADSET = (1 << 0),
266 BIT_HEADSET_NO_MIC = (1 << 1),
267};
268
269static struct switch_dev tegra_rt5640_headset_switch = {
270 .name = "h2w",
271};
272
273static int tegra_rt5640_jack_notifier(struct notifier_block *self,
274 unsigned long action, void *dev)
275{
276 struct snd_soc_jack *jack = dev;
277 struct snd_soc_codec *codec = jack->codec;
278 struct snd_soc_card *card = codec->card;
279 struct tegra_rt5640 *machine = snd_soc_card_get_drvdata(card);
280 enum headset_state state = BIT_NO_HEADSET;
281 unsigned char status_jack;
282
283 if (jack == &tegra_rt5640_hp_jack) {
284 if (action) {
285 if (!strncmp(machine->pdata->codec_name, "rt5639", 6))
286 status_jack = rt5639_headset_detect(codec, 1);
287 else if (!strncmp(machine->pdata->codec_name, "rt5640",
288 6))
289 status_jack = rt5640_headset_detect(codec, 1);
290
291 machine->jack_status &= ~SND_JACK_HEADPHONE;
292 machine->jack_status &= ~SND_JACK_MICROPHONE;
293 if (status_jack == RT5639_HEADPHO_DET ||
294 status_jack == RT5640_HEADPHO_DET)
295 machine->jack_status |=
296 SND_JACK_HEADPHONE;
297 else if (status_jack == RT5639_HEADSET_DET ||
298 status_jack == RT5640_HEADSET_DET) {
299 machine->jack_status |=
300 SND_JACK_HEADPHONE;
301 machine->jack_status |=
302 SND_JACK_MICROPHONE;
303 }
304 } else {
305 if (!strncmp(machine->pdata->codec_name, "rt5639", 6))
306 rt5639_headset_detect(codec, 0);
307 else if (!strncmp(machine->pdata->codec_name, "rt5640",
308 6))
309 rt5640_headset_detect(codec, 0);
310
311 machine->jack_status &= ~SND_JACK_HEADPHONE;
312 machine->jack_status &= ~SND_JACK_MICROPHONE;
313 }
314 }
315
316 switch (machine->jack_status) {
317 case SND_JACK_HEADPHONE:
318 state = BIT_HEADSET_NO_MIC;
319 break;
320 case SND_JACK_HEADSET:
321 state = BIT_HEADSET;
322 break;
323 case SND_JACK_MICROPHONE:
324 /* mic: would not report */
325 default:
326 state = BIT_NO_HEADSET;
327 }
328
329 switch_set_state(&tegra_rt5640_headset_switch, state);
330
331 return NOTIFY_OK;
332}
333
334static struct notifier_block tegra_rt5640_jack_detect_nb = {
335 .notifier_call = tegra_rt5640_jack_notifier,
336};
337#else
338static struct snd_soc_jack_pin tegra_rt5640_hp_jack_pins[] = {
339 {
340 .pin = "Headphone Jack",
341 .mask = SND_JACK_HEADPHONE,
342 },
343};
344
345#endif
346
347static int tegra_rt5640_event_int_spk(struct snd_soc_dapm_widget *w,
348 struct snd_kcontrol *k, int event)
349{
350 struct snd_soc_dapm_context *dapm = w->dapm;
351 struct snd_soc_card *card = dapm->card;
352 struct tegra_rt5640 *machine = snd_soc_card_get_drvdata(card);
353 struct tegra_rt5640_platform_data *pdata = machine->pdata;
354
355 if (machine->spk_reg) {
356 if (SND_SOC_DAPM_EVENT_ON(event))
357 regulator_enable(machine->spk_reg);
358 else
359 regulator_disable(machine->spk_reg);
360 }
361
362 if (!(machine->gpio_requested & GPIO_SPKR_EN))
363 return 0;
364
365 gpio_set_value_cansleep(pdata->gpio_spkr_en,
366 SND_SOC_DAPM_EVENT_ON(event));
367
368 return 0;
369}
370
371static int tegra_rt5640_event_hp(struct snd_soc_dapm_widget *w,
372 struct snd_kcontrol *k, int event)
373{
374 struct snd_soc_dapm_context *dapm = w->dapm;
375 struct snd_soc_card *card = dapm->card;
376 struct tegra_rt5640 *machine = snd_soc_card_get_drvdata(card);
377 struct tegra_rt5640_platform_data *pdata = machine->pdata;
378
379 if (!(machine->gpio_requested & GPIO_HP_MUTE))
380 return 0;
381
382 gpio_set_value_cansleep(pdata->gpio_hp_mute,
383 !SND_SOC_DAPM_EVENT_ON(event));
384
385 return 0;
386}
387
388static int tegra_rt5640_event_int_mic(struct snd_soc_dapm_widget *w,
389 struct snd_kcontrol *k, int event)
390{
391 struct snd_soc_dapm_context *dapm = w->dapm;
392 struct snd_soc_card *card = dapm->card;
393 struct tegra_rt5640 *machine = snd_soc_card_get_drvdata(card);
394 struct tegra_rt5640_platform_data *pdata = machine->pdata;
395
396 if (machine->dmic_reg) {
397 if (SND_SOC_DAPM_EVENT_ON(event))
398 regulator_enable(machine->dmic_reg);
399 else
400 regulator_disable(machine->dmic_reg);
401 }
402
403 if (!(machine->gpio_requested & GPIO_INT_MIC_EN))
404 return 0;
405
406 gpio_set_value_cansleep(pdata->gpio_int_mic_en,
407 SND_SOC_DAPM_EVENT_ON(event));
408
409 return 0;
410}
411
412static int tegra_rt5640_event_ext_mic(struct snd_soc_dapm_widget *w,
413 struct snd_kcontrol *k, int event)
414{
415 struct snd_soc_dapm_context *dapm = w->dapm;
416 struct snd_soc_card *card = dapm->card;
417 struct tegra_rt5640 *machine = snd_soc_card_get_drvdata(card);
418 struct tegra_rt5640_platform_data *pdata = machine->pdata;
419
420 if (!(machine->gpio_requested & GPIO_EXT_MIC_EN))
421 return 0;
422
423 gpio_set_value_cansleep(pdata->gpio_ext_mic_en,
424 !SND_SOC_DAPM_EVENT_ON(event));
425
426 return 0;
427}
428
429static const struct snd_soc_dapm_widget cardhu_dapm_widgets[] = {
430 SND_SOC_DAPM_SPK("Int Spk", tegra_rt5640_event_int_spk),
431 SND_SOC_DAPM_HP("Headphone Jack", tegra_rt5640_event_hp),
432 SND_SOC_DAPM_MIC("Mic Jack", tegra_rt5640_event_ext_mic),
433 SND_SOC_DAPM_MIC("Int Mic", tegra_rt5640_event_int_mic),
434};
435
436static const struct snd_soc_dapm_route cardhu_audio_map[] = {
437 {"Headphone Jack", NULL, "HPOR"},
438 {"Headphone Jack", NULL, "HPOL"},
439 {"Int Spk", NULL, "SPORP"},
440 {"Int Spk", NULL, "SPORN"},
441 {"Int Spk", NULL, "SPOLP"},
442 {"Int Spk", NULL, "SPOLN"},
443 {"micbias1", NULL, "Mic Jack"},
444 {"IN1P", NULL, "micbias1"},
445 {"IN1N", NULL, "micbias1"},
446 {"micbias1", NULL, "Int Mic"},
447 {"IN2P", NULL, "micbias1"},
448};
449
450static const struct snd_kcontrol_new cardhu_controls[] = {
451 SOC_DAPM_PIN_SWITCH("Int Spk"),
452 SOC_DAPM_PIN_SWITCH("Headphone Jack"),
453 SOC_DAPM_PIN_SWITCH("Mic Jack"),
454 SOC_DAPM_PIN_SWITCH("Int Mic"),
455};
456
457static int tegra_rt5640_init(struct snd_soc_pcm_runtime *rtd)
458{
459 struct snd_soc_codec *codec = rtd->codec;
460 struct snd_soc_dapm_context *dapm = &codec->dapm;
461 struct snd_soc_card *card = codec->card;
462 struct tegra_rt5640 *machine = snd_soc_card_get_drvdata(card);
463 struct tegra_rt5640_platform_data *pdata = machine->pdata;
464 int ret;
465
466 if (gpio_is_valid(pdata->gpio_spkr_en)) {
467 ret = gpio_request(pdata->gpio_spkr_en, "spkr_en");
468 if (ret) {
469 dev_err(card->dev, "cannot get spkr_en gpio\n");
470 return ret;
471 }
472 machine->gpio_requested |= GPIO_SPKR_EN;
473
474 gpio_direction_output(pdata->gpio_spkr_en, 0);
475 }
476
477 if (gpio_is_valid(pdata->gpio_hp_mute)) {
478 ret = gpio_request(pdata->gpio_hp_mute, "hp_mute");
479 if (ret) {
480 dev_err(card->dev, "cannot get hp_mute gpio\n");
481 return ret;
482 }
483 machine->gpio_requested |= GPIO_HP_MUTE;
484
485 gpio_direction_output(pdata->gpio_hp_mute, 0);
486 }
487
488 if (gpio_is_valid(pdata->gpio_int_mic_en)) {
489 ret = gpio_request(pdata->gpio_int_mic_en, "int_mic_en");
490 if (ret) {
491 dev_err(card->dev, "cannot get int_mic_en gpio\n");
492 return ret;
493 }
494 machine->gpio_requested |= GPIO_INT_MIC_EN;
495
496 /* Disable int mic; enable signal is active-high */
497 gpio_direction_output(pdata->gpio_int_mic_en, 0);
498 }
499
500 if (gpio_is_valid(pdata->gpio_ext_mic_en)) {
501 ret = gpio_request(pdata->gpio_ext_mic_en, "ext_mic_en");
502 if (ret) {
503 dev_err(card->dev, "cannot get ext_mic_en gpio\n");
504 return ret;
505 }
506 machine->gpio_requested |= GPIO_EXT_MIC_EN;
507
508 /* Enable ext mic; enable signal is active-low */
509 gpio_direction_output(pdata->gpio_ext_mic_en, 0);
510 }
511
512 if (gpio_is_valid(pdata->gpio_hp_det)) {
513 tegra_rt5640_hp_jack_gpio.gpio = pdata->gpio_hp_det;
514 snd_soc_jack_new(codec, "Headphone Jack", SND_JACK_HEADPHONE,
515 &tegra_rt5640_hp_jack);
516#ifndef CONFIG_SWITCH
517 snd_soc_jack_add_pins(&tegra_rt5640_hp_jack,
518 ARRAY_SIZE(tegra_rt5640_hp_jack_pins),
519 tegra_rt5640_hp_jack_pins);
520#else
521 snd_soc_jack_notifier_register(&tegra_rt5640_hp_jack,
522 &tegra_rt5640_jack_detect_nb);
523#endif
524 snd_soc_jack_add_gpios(&tegra_rt5640_hp_jack,
525 1,
526 &tegra_rt5640_hp_jack_gpio);
527 machine->gpio_requested |= GPIO_HP_DET;
528 }
529
530 ret = snd_soc_add_controls(codec, cardhu_controls,
531 ARRAY_SIZE(cardhu_controls));
532 if (ret < 0)
533 return ret;
534
535 snd_soc_dapm_new_controls(dapm, cardhu_dapm_widgets,
536 ARRAY_SIZE(cardhu_dapm_widgets));
537
538 snd_soc_dapm_add_routes(dapm, cardhu_audio_map,
539 ARRAY_SIZE(cardhu_audio_map));
540 /* FIXME: Calculate automatically based on DAPM routes? */
541 snd_soc_dapm_nc_pin(dapm, "LOUTL");
542 snd_soc_dapm_nc_pin(dapm, "LOUTR");
543
544 snd_soc_dapm_sync(dapm);
545
546 return 0;
547}
548
549static struct snd_soc_dai_link tegra_rt5640_dai[] = {
550 {
551 .name = "RT5640",
552 .stream_name = "RT5640 PCM",
553 .codec_name = "rt5640.4-001c",
554 .platform_name = "tegra-pcm-audio",
555 .cpu_dai_name = "tegra30-i2s.1",
556 .codec_dai_name = "rt5640-aif1",
557 .init = tegra_rt5640_init,
558 .ops = &tegra_rt5640_ops,
559 },
560 {
561 .name = "SPDIF",
562 .stream_name = "SPDIF PCM",
563 .codec_name = "spdif-dit.0",
564 .platform_name = "tegra-pcm-audio",
565 .cpu_dai_name = "tegra30-spdif",
566 .codec_dai_name = "dit-hifi",
567 .ops = &tegra_spdif_ops,
568 },
569 {
570 .name = "BT-SCO",
571 .stream_name = "BT SCO PCM",
572 .codec_name = "spdif-dit.1",
573 .platform_name = "tegra-pcm-audio",
574 .cpu_dai_name = "tegra30-i2s.3",
575 .codec_dai_name = "dit-hifi",
576 .ops = &tegra_rt5640_bt_sco_ops,
577 },
578};
579
580static struct snd_soc_card snd_soc_tegra_rt5640 = {
581 .name = "tegra-rt5640",
582 .dai_link = tegra_rt5640_dai,
583 .num_links = ARRAY_SIZE(tegra_rt5640_dai),
584};
585
586static __devinit int tegra_rt5640_driver_probe(struct platform_device *pdev)
587{
588 struct snd_soc_card *card = &snd_soc_tegra_rt5640;
589 struct tegra_rt5640 *machine;
590 struct tegra_rt5640_platform_data *pdata;
591 int ret;
592
593 pdata = pdev->dev.platform_data;
594 if (!pdata) {
595 dev_err(&pdev->dev, "No platform data supplied\n");
596 return -EINVAL;
597 }
598
599 if (pdata->codec_name)
600 card->dai_link->codec_name = pdata->codec_name;
601 if (pdata->codec_dai_name)
602 card->dai_link->codec_dai_name = pdata->codec_dai_name;
603
604 machine = kzalloc(sizeof(struct tegra_rt5640), GFP_KERNEL);
605 if (!machine) {
606 dev_err(&pdev->dev, "Can't allocate tegra_rt5640 struct\n");
607 return -ENOMEM;
608 }
609
610 machine->pdata = pdata;
611
612 ret = tegra_asoc_utils_init(&machine->util_data, &pdev->dev);
613 if (ret)
614 goto err_free_machine;
615
616 machine->cdc_en = regulator_get(NULL, "cdc_en");
617 if (WARN_ON(IS_ERR(machine->cdc_en))) {
618 dev_err(&pdev->dev, "Couldn't get regulator cdc_en: %ld\n",
619 PTR_ERR(machine->cdc_en));
620 machine->cdc_en = 0;
621 } else {
622 regulator_enable(machine->cdc_en);
623 }
624
625 machine->spk_reg = regulator_get(&pdev->dev, "vdd_spk_amp");
626 if (IS_ERR(machine->spk_reg)) {
627 dev_info(&pdev->dev, "No speaker regulator found\n");
628 machine->spk_reg = 0;
629 }
630
631#ifdef CONFIG_SWITCH
632 /* Addd h2w swith class support */
633 ret = switch_dev_register(&tegra_rt5640_headset_switch);
634 if (ret < 0)
635 goto err_fini_utils;
636#endif
637
638 card->dev = &pdev->dev;
639 platform_set_drvdata(pdev, card);
640 snd_soc_card_set_drvdata(card, machine);
641
642 ret = snd_soc_register_card(card);
643 if (ret) {
644 dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n",
645 ret);
646 goto err_unregister_switch;
647 }
648
649 if (!card->instantiated) {
650 ret = -ENODEV;
651 dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n",
652 ret);
653 goto err_unregister_card;
654 }
655
656 return 0;
657
658err_unregister_card:
659 snd_soc_unregister_card(card);
660err_unregister_switch:
661#ifdef CONFIG_SWITCH
662 switch_dev_unregister(&tegra_rt5640_headset_switch);
663err_fini_utils:
664#endif
665 tegra_asoc_utils_fini(&machine->util_data);
666err_free_machine:
667 kfree(machine);
668 return ret;
669}
670
671static int __devexit tegra_rt5640_driver_remove(struct platform_device *pdev)
672{
673 struct snd_soc_card *card = platform_get_drvdata(pdev);
674 struct tegra_rt5640 *machine = snd_soc_card_get_drvdata(card);
675 struct tegra_rt5640_platform_data *pdata = machine->pdata;
676
677 if (machine->gpio_requested & GPIO_HP_DET)
678 snd_soc_jack_free_gpios(&tegra_rt5640_hp_jack,
679 1,
680 &tegra_rt5640_hp_jack_gpio);
681 if (machine->gpio_requested & GPIO_EXT_MIC_EN)
682 gpio_free(pdata->gpio_ext_mic_en);
683 if (machine->gpio_requested & GPIO_INT_MIC_EN)
684 gpio_free(pdata->gpio_int_mic_en);
685 if (machine->gpio_requested & GPIO_HP_MUTE)
686 gpio_free(pdata->gpio_hp_mute);
687 if (machine->gpio_requested & GPIO_SPKR_EN)
688 gpio_free(pdata->gpio_spkr_en);
689 machine->gpio_requested = 0;
690
691 if (machine->spk_reg)
692 regulator_put(machine->spk_reg);
693 if (machine->dmic_reg)
694 regulator_put(machine->dmic_reg);
695
696 if (machine->cdc_en) {
697 regulator_disable(machine->cdc_en);
698 regulator_put(machine->cdc_en);
699 }
700
701 snd_soc_unregister_card(card);
702
703 tegra_asoc_utils_fini(&machine->util_data);
704
705#ifdef CONFIG_SWITCH
706 switch_dev_unregister(&tegra_rt5640_headset_switch);
707#endif
708 kfree(machine);
709
710 return 0;
711}
712
713static struct platform_driver tegra_rt5640_driver = {
714 .driver = {
715 .name = DRV_NAME,
716 .owner = THIS_MODULE,
717 .pm = &snd_soc_pm_ops,
718 },
719 .probe = tegra_rt5640_driver_probe,
720 .remove = __devexit_p(tegra_rt5640_driver_remove),
721};
722
723static int __init tegra_rt5640_modinit(void)
724{
725 return platform_driver_register(&tegra_rt5640_driver);
726}
727module_init(tegra_rt5640_modinit);
728
729static void __exit tegra_rt5640_modexit(void)
730{
731 platform_driver_unregister(&tegra_rt5640_driver);
732}
733module_exit(tegra_rt5640_modexit);
734
735MODULE_AUTHOR("Johnny Qiu <joqiu@nvidia.com>");
736MODULE_DESCRIPTION("Tegra+RT5640 machine ASoC driver");
737MODULE_LICENSE("GPL");
738MODULE_ALIAS("platform:" DRV_NAME);