[omap35xx] Update u-boot command-line parameters
[openwrt.git] / target / linux / xburst / patches-2.6.34 / 060-jzcodec.patch
1 From 075550fa667fca846d1217f649438df5cb4f9529 Mon Sep 17 00:00:00 2001
2 From: Lars-Peter Clausen <lars@metafoo.de>
3 Date: Fri, 28 May 2010 19:53:05 +0200
4 Subject: [PATCH] Add jz4740 codec driver
5
6 ---
7 sound/soc/codecs/Kconfig | 7 +
8 sound/soc/codecs/Makefile | 2 +
9 sound/soc/codecs/jzcodec.c | 513 ++++++++++++++++++++++++++++++++++++++++++++
10 sound/soc/codecs/jzcodec.h | 22 ++
11 4 files changed, 544 insertions(+), 0 deletions(-)
12 create mode 100644 sound/soc/codecs/jzcodec.c
13 create mode 100644 sound/soc/codecs/jzcodec.h
14
15 diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig
16 index 1743d56..b25598a 100644
17 --- a/sound/soc/codecs/Kconfig
18 +++ b/sound/soc/codecs/Kconfig
19 @@ -260,6 +260,13 @@ config SND_SOC_WM9712
20 config SND_SOC_WM9713
21 tristate
22
23 +config SND_SOC_JZCODEC
24 + tristate "JZ4720/JZ4740 SoC internal codec"
25 + depends on SND_SOC && SOC_JZ4740
26 + help
27 + Say Y if you want to use internal codec on Ingenic JZ4720/JZ4740 based
28 + boards.
29 +
30 # Amp
31 config SND_SOC_MAX9877
32 tristate
33 diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile
34 index dd5ce6d..3f6ce05 100644
35 --- a/sound/soc/codecs/Makefile
36 +++ b/sound/soc/codecs/Makefile
37 @@ -54,6 +54,7 @@ snd-soc-wm9705-objs := wm9705.o
38 snd-soc-wm9712-objs := wm9712.o
39 snd-soc-wm9713-objs := wm9713.o
40 snd-soc-wm-hubs-objs := wm_hubs.o
41 +snd-soc-jzcodec-objs := jzcodec.o
42
43 # Amp
44 snd-soc-max9877-objs := max9877.o
45 @@ -116,6 +117,7 @@ obj-$(CONFIG_SND_SOC_WM9705) += snd-soc-wm9705.o
46 obj-$(CONFIG_SND_SOC_WM9712) += snd-soc-wm9712.o
47 obj-$(CONFIG_SND_SOC_WM9713) += snd-soc-wm9713.o
48 obj-$(CONFIG_SND_SOC_WM_HUBS) += snd-soc-wm-hubs.o
49 +obj-$(CONFIG_SND_SOC_JZCODEC) += snd-soc-jzcodec.o
50
51 # Amp
52 obj-$(CONFIG_SND_SOC_MAX9877) += snd-soc-max9877.o
53 diff --git a/sound/soc/codecs/jzcodec.c b/sound/soc/codecs/jzcodec.c
54 new file mode 100644
55 index 0000000..91720fa
56 --- /dev/null
57 +++ b/sound/soc/codecs/jzcodec.c
58 @@ -0,0 +1,513 @@
59 +/*
60 + * Copyright (C) 2009, Lars-Peter Clausen <lars@metafoo.de>
61 + *
62 + * This program is free software; you can redistribute it and/or modify
63 + * it under the terms of the GNU General Public License version 2 as
64 + * published by the Free Software Foundation.
65 + *
66 + * You should have received a copy of the GNU General Public License along
67 + * with this program; if not, write to the Free Software Foundation, Inc.,
68 + * 675 Mass Ave, Cambridge, MA 02139, USA.
69 + *
70 + */
71 +
72 +#include <linux/kernel.h>
73 +#include <linux/module.h>
74 +#include <linux/platform_device.h>
75 +#include <linux/slab.h>
76 +
77 +#include <linux/delay.h>
78 +
79 +#include <sound/core.h>
80 +#include <sound/pcm.h>
81 +#include <sound/pcm_params.h>
82 +#include <sound/initval.h>
83 +#include <sound/soc-dapm.h>
84 +#include <sound/soc.h>
85 +
86 +#define JZ_REG_CODEC_1 0x0
87 +#define JZ_REG_CODEC_2 0x1
88 +
89 +#define JZ_CODEC_1_LINE_ENABLE BIT(29)
90 +#define JZ_CODEC_1_MIC_ENABLE BIT(28)
91 +#define JZ_CODEC_1_SW1_ENABLE BIT(27)
92 +#define JZ_CODEC_1_ADC_ENABLE BIT(26)
93 +#define JZ_CODEC_1_SW2_ENABLE BIT(25)
94 +#define JZ_CODEC_1_DAC_ENABLE BIT(24)
95 +#define JZ_CODEC_1_VREF_DISABLE BIT(20)
96 +#define JZ_CODEC_1_VREF_AMP_DISABLE BIT(19)
97 +#define JZ_CODEC_1_VREF_PULL_DOWN BIT(18)
98 +#define JZ_CODEC_1_VREF_LOW_CURRENT BIT(17)
99 +#define JZ_CODEC_1_VREF_HIGH_CURRENT BIT(16)
100 +#define JZ_CODEC_1_HEADPHONE_DISABLE BIT(14)
101 +#define JZ_CODEC_1_HEADPHONE_AMP_CHANGE_ANY BIT(13)
102 +#define JZ_CODEC_1_HEADPHONE_CHANGE BIT(12)
103 +#define JZ_CODEC_1_HEADPHONE_PULL_DOWN_M BIT(11)
104 +#define JZ_CODEC_1_HEADPHONE_PULL_DOWN_R BIT(10)
105 +#define JZ_CODEC_1_HEADPHONE_POWER_DOWN_M BIT(9)
106 +#define JZ_CODEC_1_HEADPHONE_POWER_DOWN BIT(8)
107 +#define JZ_CODEC_1_SUSPEND BIT(1)
108 +#define JZ_CODEC_1_RESET BIT(0)
109 +
110 +#define JZ_CODEC_1_LINE_ENABLE_OFFSET 29
111 +#define JZ_CODEC_1_MIC_ENABLE_OFFSET 28
112 +#define JZ_CODEC_1_SW1_ENABLE_OFFSET 27
113 +#define JZ_CODEC_1_ADC_ENABLE_OFFSET 26
114 +#define JZ_CODEC_1_SW2_ENABLE_OFFSET 25
115 +#define JZ_CODEC_1_DAC_ENABLE_OFFSET 24
116 +#define JZ_CODEC_1_HEADPHONE_DISABLE_OFFSET 14
117 +#define JZ_CODEC_1_HEADPHONE_POWER_DOWN_OFFSET 8
118 +
119 +#define JZ_CODEC_2_INPUT_VOLUME_MASK 0x1f0000
120 +#define JZ_CODEC_2_SAMPLE_RATE_MASK 0x000f00
121 +#define JZ_CODEC_2_MIC_BOOST_GAIN_MASK 0x000030
122 +#define JZ_CODEC_2_HEADPHONE_VOLUME_MASK 0x000003
123 +
124 +#define JZ_CODEC_2_INPUT_VOLUME_OFFSET 16
125 +#define JZ_CODEC_2_SAMPLE_RATE_OFFSET 8
126 +#define JZ_CODEC_2_MIC_BOOST_GAIN_OFFSET 4
127 +#define JZ_CODEC_2_HEADPHONE_VOLUME_OFFSET 0
128 +
129 +struct jz_codec {
130 + void __iomem *base;
131 + struct resource *mem;
132 +
133 + uint32_t reg_cache[2];
134 + struct snd_soc_codec codec;
135 +};
136 +
137 +static inline struct jz_codec *codec_to_jz(struct snd_soc_codec *codec)
138 +{
139 + return container_of(codec, struct jz_codec, codec);
140 +}
141 +
142 +static unsigned int jz_codec_read(struct snd_soc_codec *codec, unsigned int reg)
143 +{
144 + struct jz_codec *jz_codec = codec_to_jz(codec);
145 + return readl(jz_codec->base + (reg << 2));
146 +}
147 +
148 +static int jz_codec_write(struct snd_soc_codec *codec, unsigned int reg,
149 +unsigned int val)
150 +{
151 + struct jz_codec *jz_codec = codec_to_jz(codec);
152 + jz_codec->reg_cache[reg] = val;
153 +
154 + writel(val, jz_codec->base + (reg << 2));
155 + return 0;
156 +}
157 +
158 +static const struct snd_kcontrol_new jz_codec_controls[] = {
159 + SOC_SINGLE("Master Playback Volume", JZ_REG_CODEC_2,
160 + JZ_CODEC_2_HEADPHONE_VOLUME_OFFSET, 3, 0),
161 + SOC_SINGLE("Capture Volume", JZ_REG_CODEC_2,
162 + JZ_CODEC_2_INPUT_VOLUME_OFFSET, 31, 0),
163 + SOC_SINGLE("Master Playback Switch", JZ_REG_CODEC_1,
164 + JZ_CODEC_1_HEADPHONE_DISABLE_OFFSET, 1, 1),
165 + SOC_SINGLE("Mic Capture Volume", JZ_REG_CODEC_2,
166 + JZ_CODEC_2_MIC_BOOST_GAIN_OFFSET, 3, 0),
167 +};
168 +
169 +static const struct snd_kcontrol_new jz_codec_output_controls[] = {
170 + SOC_DAPM_SINGLE("Bypass Switch", JZ_REG_CODEC_1,
171 + JZ_CODEC_1_SW1_ENABLE_OFFSET, 1, 0),
172 + SOC_DAPM_SINGLE("DAC Switch", JZ_REG_CODEC_1,
173 + JZ_CODEC_1_SW2_ENABLE_OFFSET, 1, 0),
174 +};
175 +
176 +static const struct snd_kcontrol_new jz_codec_input_controls[] = {
177 + SOC_DAPM_SINGLE("Line Capture Switch", JZ_REG_CODEC_1,
178 + JZ_CODEC_1_LINE_ENABLE_OFFSET, 1, 0),
179 + SOC_DAPM_SINGLE("Mic Capture Switch", JZ_REG_CODEC_1,
180 + JZ_CODEC_1_MIC_ENABLE_OFFSET, 1, 0),
181 +};
182 +
183 +static const struct snd_soc_dapm_widget jz_codec_dapm_widgets[] = {
184 + SND_SOC_DAPM_ADC("ADC", "Capture", JZ_REG_CODEC_1,
185 + JZ_CODEC_1_ADC_ENABLE_OFFSET, 0),
186 + SND_SOC_DAPM_DAC("DAC", "Playback", JZ_REG_CODEC_1,
187 + JZ_CODEC_1_DAC_ENABLE_OFFSET, 0),
188 +
189 + SND_SOC_DAPM_MIXER("Output Mixer", JZ_REG_CODEC_1,
190 + JZ_CODEC_1_HEADPHONE_POWER_DOWN_OFFSET, 1,
191 + jz_codec_output_controls,
192 + ARRAY_SIZE(jz_codec_output_controls)),
193 +
194 + SND_SOC_DAPM_MIXER_NAMED_CTL("Input Mixer", SND_SOC_NOPM, 0, 0,
195 + jz_codec_input_controls,
196 + ARRAY_SIZE(jz_codec_input_controls)),
197 + SND_SOC_DAPM_MIXER("Line Input", SND_SOC_NOPM, 0, 0, NULL, 0),
198 +
199 + SND_SOC_DAPM_OUTPUT("LOUT"),
200 + SND_SOC_DAPM_OUTPUT("ROUT"),
201 +
202 + SND_SOC_DAPM_INPUT("MIC"),
203 + SND_SOC_DAPM_INPUT("LIN"),
204 + SND_SOC_DAPM_INPUT("RIN"),
205 +};
206 +
207 +static const struct snd_soc_dapm_route jz_codec_dapm_routes[] = {
208 +
209 + {"Line Input", NULL, "LIN"},
210 + {"Line Input", NULL, "RIN"},
211 +
212 + {"Input Mixer", "Line Capture Switch", "Line Input"},
213 + {"Input Mixer", "Mic Capture Switch", "MIC"},
214 +
215 + {"ADC", NULL, "Input Mixer"},
216 +
217 + {"Output Mixer", "Bypass Switch", "Input Mixer"},
218 + {"Output Mixer", "DAC Switch", "DAC"},
219 +
220 + {"LOUT", NULL, "Output Mixer"},
221 + {"ROUT", NULL, "Output Mixer"},
222 +};
223 +
224 +static int jz_codec_hw_params(struct snd_pcm_substream *substream, struct
225 +snd_pcm_hw_params *params, struct snd_soc_dai *dai)
226 +{
227 + uint32_t val;
228 + struct snd_soc_pcm_runtime *rtd = substream->private_data;
229 + struct snd_soc_device *socdev = rtd->socdev;
230 + struct snd_soc_codec *codec = socdev->card->codec;
231 +
232 + switch (params_format(params)) {
233 + case SNDRV_PCM_FORMAT_S8:
234 + case SNDRV_PCM_FORMAT_S16_LE:
235 + case SNDRV_PCM_FORMAT_S18_3LE:
236 + break;
237 + default:
238 + return -EINVAL;
239 + break;
240 + }
241 +
242 + switch (params_rate(params)) {
243 + case 8000:
244 + val = 0;
245 + break;
246 + case 11025:
247 + val = 1;
248 + break;
249 + case 12000:
250 + val = 2;
251 + break;
252 + case 16000:
253 + val = 3;
254 + break;
255 + case 22050:
256 + val = 4;
257 + break;
258 + case 24000:
259 + val = 5;
260 + break;
261 + case 32000:
262 + val = 6;
263 + break;
264 + case 44100:
265 + val = 7;
266 + break;
267 + case 48000:
268 + val = 8;
269 + break;
270 + default:
271 + return -EINVAL;
272 + }
273 +
274 + val <<= JZ_CODEC_2_SAMPLE_RATE_OFFSET;
275 +
276 + snd_soc_update_bits(codec, JZ_REG_CODEC_2,
277 + JZ_CODEC_2_SAMPLE_RATE_MASK, val);
278 +
279 + return 0;
280 +}
281 +
282 +static int jz_codec_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
283 +{
284 + switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
285 + case SND_SOC_DAIFMT_CBM_CFM:
286 + break;
287 + default:
288 + return -EINVAL;
289 + }
290 +
291 + switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
292 + case SND_SOC_DAIFMT_I2S:
293 + break;
294 + default:
295 + return -EINVAL;
296 + }
297 +
298 + switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
299 + case SND_SOC_DAIFMT_NB_NF:
300 + break;
301 + default:
302 + return -EINVAL;
303 + }
304 +
305 + return 0;
306 +}
307 +
308 +static int jz_codec_set_sysclk(struct snd_soc_dai *codec_dai,
309 + int clk_id, unsigned int freq, int dir)
310 +{
311 + return 0;
312 +}
313 +
314 +
315 +static struct snd_soc_dai_ops jz_codec_dai_ops = {
316 + .hw_params = jz_codec_hw_params,
317 + .set_fmt = jz_codec_set_fmt,
318 +/* .set_clkdiv = jz_codec_set_clkdiv,*/
319 + .set_sysclk = jz_codec_set_sysclk,
320 +};
321 +
322 +struct snd_soc_dai jz_codec_dai = {
323 + .name = "jz-codec",
324 + .playback = {
325 + .stream_name = "Playback",
326 + .channels_min = 2,
327 + .channels_max = 2,
328 + .rates = SNDRV_PCM_RATE_8000_48000,
329 + .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S8,
330 + },
331 + .capture = {
332 + .stream_name = "Capture",
333 + .channels_min = 2,
334 + .channels_max = 2,
335 + .rates = SNDRV_PCM_RATE_8000_48000,
336 + .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S8,
337 + },
338 + .ops = &jz_codec_dai_ops,
339 + .symmetric_rates = 1,
340 +};
341 +EXPORT_SYMBOL_GPL(jz_codec_dai);
342 +
343 +static int jz_codec_set_bias_level(struct snd_soc_codec *codec,
344 + enum snd_soc_bias_level level)
345 +{
346 +
347 + if (codec->bias_level == SND_SOC_BIAS_OFF && level != SND_SOC_BIAS_OFF) {
348 + snd_soc_update_bits(codec, JZ_REG_CODEC_1,
349 + JZ_CODEC_1_RESET, JZ_CODEC_1_RESET);
350 + udelay(2);
351 +
352 + snd_soc_update_bits(codec, JZ_REG_CODEC_1,
353 + JZ_CODEC_1_SUSPEND | JZ_CODEC_1_RESET, 0);
354 + }
355 + switch (level) {
356 + case SND_SOC_BIAS_ON:
357 + snd_soc_update_bits(codec, JZ_REG_CODEC_1,
358 + JZ_CODEC_1_VREF_DISABLE |
359 + JZ_CODEC_1_VREF_AMP_DISABLE |
360 + JZ_CODEC_1_HEADPHONE_POWER_DOWN_M |
361 + JZ_CODEC_1_VREF_LOW_CURRENT |
362 + JZ_CODEC_1_VREF_HIGH_CURRENT,
363 + 0);
364 + break;
365 + case SND_SOC_BIAS_PREPARE:
366 + snd_soc_update_bits(codec, JZ_REG_CODEC_1,
367 + JZ_CODEC_1_VREF_LOW_CURRENT |
368 + JZ_CODEC_1_VREF_HIGH_CURRENT,
369 + JZ_CODEC_1_VREF_LOW_CURRENT |
370 + JZ_CODEC_1_VREF_HIGH_CURRENT);
371 + break;
372 + case SND_SOC_BIAS_STANDBY:
373 + snd_soc_update_bits(codec, JZ_REG_CODEC_1,
374 + JZ_CODEC_1_VREF_DISABLE | JZ_CODEC_1_VREF_AMP_DISABLE,
375 + JZ_CODEC_1_VREF_DISABLE | JZ_CODEC_1_VREF_AMP_DISABLE);
376 + break;
377 + case SND_SOC_BIAS_OFF:
378 + snd_soc_update_bits(codec, JZ_REG_CODEC_1,
379 + JZ_CODEC_1_SUSPEND, JZ_CODEC_1_SUSPEND);
380 + break;
381 + }
382 + codec->bias_level = level;
383 +
384 + return 0;
385 +}
386 +
387 +
388 +static struct snd_soc_codec *jz_codec_codec;
389 +
390 +static int jz_codec_dev_probe(struct platform_device *pdev)
391 +{
392 + int ret;
393 + struct snd_soc_device *socdev = platform_get_drvdata(pdev);
394 + struct snd_soc_codec *codec = jz_codec_codec;
395 +
396 + BUG_ON(!codec);
397 +
398 + socdev->card->codec = codec;
399 +
400 + ret = snd_soc_new_pcms(socdev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1);
401 + if (ret) {
402 + dev_err(&pdev->dev, "Failed to create pcms: %d\n", ret);
403 + return ret;
404 + }
405 +
406 + snd_soc_add_controls(codec, jz_codec_controls,
407 + ARRAY_SIZE(jz_codec_controls));
408 +
409 + snd_soc_dapm_new_controls(codec, jz_codec_dapm_widgets,
410 + ARRAY_SIZE(jz_codec_dapm_widgets));
411 +
412 + snd_soc_dapm_add_routes(codec, jz_codec_dapm_routes,
413 + ARRAY_SIZE(jz_codec_dapm_routes));
414 +
415 + snd_soc_dapm_new_widgets(codec);
416 +
417 + return 0;
418 +}
419 +
420 +static int jz_codec_dev_remove(struct platform_device *pdev)
421 +{
422 + struct snd_soc_device *socdev = platform_get_drvdata(pdev);
423 + snd_soc_free_pcms(socdev);
424 + snd_soc_dapm_free(socdev);
425 +
426 + return 0;
427 +}
428 +
429 +struct snd_soc_codec_device soc_codec_dev_jzcodec = {
430 + .probe = jz_codec_dev_probe,
431 + .remove = jz_codec_dev_remove,
432 +};
433 +EXPORT_SYMBOL_GPL(soc_codec_dev_jzcodec);
434 +
435 +static int __devinit jz_codec_probe(struct platform_device *pdev)
436 +{
437 + int ret;
438 + struct jz_codec *jz_codec;
439 + struct snd_soc_codec *codec;
440 +
441 + jz_codec = kzalloc(sizeof(*jz_codec), GFP_KERNEL);
442 +
443 + if (!jz_codec)
444 + return -ENOMEM;
445 +
446 + jz_codec->mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
447 +
448 + if (!jz_codec->mem) {
449 + dev_err(&pdev->dev, "Failed to get mmio memory resource\n");
450 + ret = -ENOENT;
451 + goto err_free_jz_codec;
452 + }
453 +
454 + jz_codec->mem = request_mem_region(jz_codec->mem->start,
455 + resource_size(jz_codec->mem), pdev->name);
456 +
457 + if (!jz_codec->mem) {
458 + dev_err(&pdev->dev, "Failed to request mmio memory region\n");
459 + ret = -EBUSY;
460 + goto err_free_jz_codec;
461 + }
462 +
463 + jz_codec->base = ioremap(jz_codec->mem->start, resource_size(jz_codec->mem));
464 +
465 + if (!jz_codec->base) {
466 + dev_err(&pdev->dev, "Failed to ioremap mmio memory\n");
467 + ret = -EBUSY;
468 + goto err_release_mem_region;
469 + }
470 +
471 + jz_codec_dai.dev = &pdev->dev;
472 +
473 + codec = &jz_codec->codec;
474 +
475 + codec->dev = &pdev->dev;
476 + codec->name = "jz-codec";
477 + codec->owner = THIS_MODULE;
478 +
479 + codec->read = jz_codec_read;
480 + codec->write = jz_codec_write;
481 + codec->set_bias_level = jz_codec_set_bias_level;
482 + codec->bias_level = SND_SOC_BIAS_OFF;
483 +
484 + codec->dai = &jz_codec_dai;
485 + codec->num_dai = 1;
486 +
487 + codec->reg_cache = jz_codec->reg_cache;
488 + codec->reg_cache_size = 2;
489 +
490 + codec->private_data = jz_codec;
491 +
492 + mutex_init(&codec->mutex);
493 + INIT_LIST_HEAD(&codec->dapm_widgets);
494 + INIT_LIST_HEAD(&codec->dapm_paths);
495 +
496 + jz_codec_codec = codec;
497 +
498 + snd_soc_update_bits(codec, JZ_REG_CODEC_1,
499 + JZ_CODEC_1_SW2_ENABLE, JZ_CODEC_1_SW2_ENABLE);
500 +
501 +
502 + platform_set_drvdata(pdev, jz_codec);
503 + ret = snd_soc_register_codec(codec);
504 +
505 + if (ret) {
506 + dev_err(&pdev->dev, "Failed to register codec\n");
507 + goto err_iounmap;
508 + }
509 +
510 + ret = snd_soc_register_dai(&jz_codec_dai);
511 + if (ret) {
512 + dev_err(&pdev->dev, "Failed to register codec dai\n");
513 + goto err_unregister_codec;
514 + }
515 +
516 + jz_codec_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
517 +
518 + return 0;
519 +err_unregister_codec:
520 + snd_soc_unregister_codec(codec);
521 +err_iounmap:
522 + iounmap(jz_codec->base);
523 +err_release_mem_region:
524 + release_mem_region(jz_codec->mem->start, resource_size(jz_codec->mem));
525 +err_free_jz_codec:
526 + kfree(jz_codec);
527 +
528 + return ret;
529 +}
530 +
531 +static int __devexit jz_codec_remove(struct platform_device *pdev)
532 +{
533 + struct jz_codec *jz_codec = platform_get_drvdata(pdev);
534 +
535 + snd_soc_unregister_dai(&jz_codec_dai);
536 + snd_soc_unregister_codec(&jz_codec->codec);
537 +
538 + iounmap(jz_codec->base);
539 + release_mem_region(jz_codec->mem->start, resource_size(jz_codec->mem));
540 +
541 + platform_set_drvdata(pdev, NULL);
542 + kfree(jz_codec);
543 +
544 + return 0;
545 +}
546 +
547 +static struct platform_driver jz_codec_driver = {
548 + .probe = jz_codec_probe,
549 + .remove = __devexit_p(jz_codec_remove),
550 + .driver = {
551 + .name = "jz4740-codec",
552 + .owner = THIS_MODULE,
553 + },
554 +};
555 +
556 +static int __init jz_codec_init(void)
557 +{
558 + return platform_driver_register(&jz_codec_driver);
559 +}
560 +module_init(jz_codec_init);
561 +
562 +static void __exit jz_codec_exit(void)
563 +{
564 + platform_driver_unregister(&jz_codec_driver);
565 +}
566 +module_exit(jz_codec_exit);
567 +
568 +MODULE_DESCRIPTION("JZ4720/JZ4740 SoC internal codec driver");
569 +MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>");
570 +MODULE_LICENSE("GPL v2");
571 +MODULE_ALIAS("platform:jz-codec");
572 diff --git a/sound/soc/codecs/jzcodec.h b/sound/soc/codecs/jzcodec.h
573 new file mode 100644
574 index 0000000..05c57b8
575 --- /dev/null
576 +++ b/sound/soc/codecs/jzcodec.h
577 @@ -0,0 +1,22 @@
578 +/*
579 + * Copyright (C) 2009, Lars-Peter Clausen <lars@metafoo.de>
580 + *
581 + * This program is free software; you can redistribute it and/or modify
582 + * it under the terms of the GNU General Public License version 2 as
583 + * published by the Free Software Foundation.
584 + *
585 + * You should have received a copy of the GNU General Public License along
586 + * with this program; if not, write to the Free Software Foundation, Inc.,
587 + * 675 Mass Ave, Cambridge, MA 02139, USA.
588 + *
589 + */
590 +
591 +#ifndef _ICODEC_H
592 +#define _ICODEC_H
593 +
594 +#define JZCODEC_SYSCLK 0
595 +
596 +extern struct snd_soc_dai jz_codec_dai;
597 +extern struct snd_soc_codec_device soc_codec_dev_jzcodec;
598 +
599 +#endif
600 --
601 1.5.6.5
602
This page took 0.065151 seconds and 5 git commands to generate.