]>
Commit | Line | Data |
---|---|---|
aef3b06a ML |
1 | /* |
2 | * Generic AC97 sound support for SH7760 | |
3 | * | |
4 | * (c) 2007 Manuel Lauss | |
5 | * | |
6 | * Licensed under the GPLv2. | |
7 | */ | |
8 | ||
9 | #include <linux/module.h> | |
10 | #include <linux/moduleparam.h> | |
11 | #include <linux/platform_device.h> | |
aef3b06a ML |
12 | #include <sound/core.h> |
13 | #include <sound/pcm.h> | |
14 | #include <sound/soc.h> | |
aef3b06a ML |
15 | #include <asm/io.h> |
16 | ||
aef3b06a ML |
17 | #define IPSEL 0xFE400034 |
18 | ||
aef3b06a ML |
19 | static struct snd_soc_dai_link sh7760_ac97_dai = { |
20 | .name = "AC97", | |
21 | .stream_name = "AC97 HiFi", | |
f0fba2ad LG |
22 | .cpu_dai_name = "hac-dai.0", /* HAC0 */ |
23 | .codec_dai_name = "ac97-hifi", | |
24 | .platform_name = "sh7760-pcm-audio", | |
25 | .codec_name = "ac97-codec", | |
aef3b06a ML |
26 | .ops = NULL, |
27 | }; | |
28 | ||
87506549 | 29 | static struct snd_soc_card sh7760_ac97_soc_machine = { |
aef3b06a ML |
30 | .name = "SH7760 AC97", |
31 | .dai_link = &sh7760_ac97_dai, | |
32 | .num_links = 1, | |
33 | }; | |
34 | ||
aef3b06a ML |
35 | static struct platform_device *sh7760_ac97_snd_device; |
36 | ||
37 | static int __init sh7760_ac97_init(void) | |
38 | { | |
39 | int ret; | |
40 | unsigned short ipsel; | |
41 | ||
42 | /* enable both AC97 controllers in pinmux reg */ | |
48ccb2ce PM |
43 | ipsel = __raw_readw(IPSEL); |
44 | __raw_writew(ipsel | (3 << 10), IPSEL); | |
aef3b06a ML |
45 | |
46 | ret = -ENOMEM; | |
47 | sh7760_ac97_snd_device = platform_device_alloc("soc-audio", -1); | |
48 | if (!sh7760_ac97_snd_device) | |
49 | goto out; | |
50 | ||
51 | platform_set_drvdata(sh7760_ac97_snd_device, | |
f0fba2ad | 52 | &sh7760_ac97_soc_machine); |
aef3b06a ML |
53 | ret = platform_device_add(sh7760_ac97_snd_device); |
54 | ||
55 | if (ret) | |
56 | platform_device_put(sh7760_ac97_snd_device); | |
57 | ||
58 | out: | |
59 | return ret; | |
60 | } | |
61 | ||
62 | static void __exit sh7760_ac97_exit(void) | |
63 | { | |
64 | platform_device_unregister(sh7760_ac97_snd_device); | |
65 | } | |
66 | ||
67 | module_init(sh7760_ac97_init); | |
68 | module_exit(sh7760_ac97_exit); | |
69 | ||
70 | MODULE_LICENSE("GPL"); | |
71 | MODULE_DESCRIPTION("Generic SH7760 AC97 sound machine"); | |
72 | MODULE_AUTHOR("Manuel Lauss <mano@roarinelk.homelinux.net>"); |