2 * Generic AC97 sound support for SH7760
4 * (c) 2007 Manuel Lauss
6 * Licensed under the GPLv2.
9 #include <linux/module.h>
10 #include <linux/moduleparam.h>
11 #include <linux/platform_device.h>
12 #include <sound/driver.h>
13 #include <sound/core.h>
14 #include <sound/pcm.h>
15 #include <sound/soc.h>
16 #include <sound/soc-dapm.h>
19 #include "../codecs/ac97.h"
21 #define IPSEL 0xFE400034
23 /* platform specific structs can be declared here */
24 extern struct snd_soc_cpu_dai sh4_hac_dai
[2];
25 extern struct snd_soc_platform sh7760_soc_platform
;
27 static int machine_init(struct snd_soc_codec
*codec
)
29 snd_soc_dapm_sync_endpoints(codec
);
33 static struct snd_soc_dai_link sh7760_ac97_dai
= {
35 .stream_name
= "AC97 HiFi",
36 .cpu_dai
= &sh4_hac_dai
[0], /* HAC0 */
37 .codec_dai
= &ac97_dai
,
42 static struct snd_soc_machine sh7760_ac97_soc_machine
= {
43 .name
= "SH7760 AC97",
44 .dai_link
= &sh7760_ac97_dai
,
48 static struct snd_soc_device sh7760_ac97_snd_devdata
= {
49 .machine
= &sh7760_ac97_soc_machine
,
50 .platform
= &sh7760_soc_platform
,
51 .codec_dev
= &soc_codec_dev_ac97
,
54 static struct platform_device
*sh7760_ac97_snd_device
;
56 static int __init
sh7760_ac97_init(void)
61 /* enable both AC97 controllers in pinmux reg */
62 ipsel
= ctrl_inw(IPSEL
);
63 ctrl_outw(ipsel
| (3 << 10), IPSEL
);
66 sh7760_ac97_snd_device
= platform_device_alloc("soc-audio", -1);
67 if (!sh7760_ac97_snd_device
)
70 platform_set_drvdata(sh7760_ac97_snd_device
,
71 &sh7760_ac97_snd_devdata
);
72 sh7760_ac97_snd_devdata
.dev
= &sh7760_ac97_snd_device
->dev
;
73 ret
= platform_device_add(sh7760_ac97_snd_device
);
76 platform_device_put(sh7760_ac97_snd_device
);
82 static void __exit
sh7760_ac97_exit(void)
84 platform_device_unregister(sh7760_ac97_snd_device
);
87 module_init(sh7760_ac97_init
);
88 module_exit(sh7760_ac97_exit
);
90 MODULE_LICENSE("GPL");
91 MODULE_DESCRIPTION("Generic SH7760 AC97 sound machine");
92 MODULE_AUTHOR("Manuel Lauss <mano@roarinelk.homelinux.net>");