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/core.h>
13 #include <sound/pcm.h>
14 #include <sound/soc.h>
15 #include <sound/soc-dapm.h>
18 #define IPSEL 0xFE400034
20 /* platform specific structs can be declared here */
21 extern struct snd_soc_dai_driver sh4_hac_dai
[2];
22 extern struct snd_soc_platform_driver sh7760_soc_platform
;
24 static int machine_init(struct snd_soc_pcm_runtime
*rtd
)
26 snd_soc_dapm_sync(rtd
->codec
);
30 static struct snd_soc_dai_link sh7760_ac97_dai
= {
32 .stream_name
= "AC97 HiFi",
33 .cpu_dai_name
= "hac-dai.0", /* HAC0 */
34 .codec_dai_name
= "ac97-hifi",
35 .platform_name
= "sh7760-pcm-audio",
36 .codec_name
= "ac97-codec",
41 static struct snd_soc_card sh7760_ac97_soc_machine
= {
42 .name
= "SH7760 AC97",
43 .dai_link
= &sh7760_ac97_dai
,
47 static struct platform_device
*sh7760_ac97_snd_device
;
49 static int __init
sh7760_ac97_init(void)
54 /* enable both AC97 controllers in pinmux reg */
55 ipsel
= ctrl_inw(IPSEL
);
56 ctrl_outw(ipsel
| (3 << 10), IPSEL
);
59 sh7760_ac97_snd_device
= platform_device_alloc("soc-audio", -1);
60 if (!sh7760_ac97_snd_device
)
63 platform_set_drvdata(sh7760_ac97_snd_device
,
64 &sh7760_ac97_soc_machine
);
65 ret
= platform_device_add(sh7760_ac97_snd_device
);
68 platform_device_put(sh7760_ac97_snd_device
);
74 static void __exit
sh7760_ac97_exit(void)
76 platform_device_unregister(sh7760_ac97_snd_device
);
79 module_init(sh7760_ac97_init
);
80 module_exit(sh7760_ac97_exit
);
82 MODULE_LICENSE("GPL");
83 MODULE_DESCRIPTION("Generic SH7760 AC97 sound machine");
84 MODULE_AUTHOR("Manuel Lauss <mano@roarinelk.homelinux.net>");