0001
0002
0003
0004
0005
0006
0007 #include <linux/module.h>
0008 #include <linux/moduleparam.h>
0009 #include <linux/platform_device.h>
0010 #include <sound/core.h>
0011 #include <sound/pcm.h>
0012 #include <sound/soc.h>
0013 #include <asm/io.h>
0014
0015 #define IPSEL 0xFE400034
0016
0017 SND_SOC_DAILINK_DEFS(ac97,
0018 DAILINK_COMP_ARRAY(COMP_CPU("hac-dai.0")),
0019 DAILINK_COMP_ARRAY(COMP_CODEC("ac97-codec", "ac97-hifi")),
0020 DAILINK_COMP_ARRAY(COMP_PLATFORM("sh7760-pcm-audio")));
0021
0022 static struct snd_soc_dai_link sh7760_ac97_dai = {
0023 .name = "AC97",
0024 .stream_name = "AC97 HiFi",
0025 SND_SOC_DAILINK_REG(ac97),
0026 };
0027
0028 static struct snd_soc_card sh7760_ac97_soc_machine = {
0029 .name = "SH7760 AC97",
0030 .owner = THIS_MODULE,
0031 .dai_link = &sh7760_ac97_dai,
0032 .num_links = 1,
0033 };
0034
0035 static struct platform_device *sh7760_ac97_snd_device;
0036
0037 static int __init sh7760_ac97_init(void)
0038 {
0039 int ret;
0040 unsigned short ipsel;
0041
0042
0043 ipsel = __raw_readw(IPSEL);
0044 __raw_writew(ipsel | (3 << 10), IPSEL);
0045
0046 ret = -ENOMEM;
0047 sh7760_ac97_snd_device = platform_device_alloc("soc-audio", -1);
0048 if (!sh7760_ac97_snd_device)
0049 goto out;
0050
0051 platform_set_drvdata(sh7760_ac97_snd_device,
0052 &sh7760_ac97_soc_machine);
0053 ret = platform_device_add(sh7760_ac97_snd_device);
0054
0055 if (ret)
0056 platform_device_put(sh7760_ac97_snd_device);
0057
0058 out:
0059 return ret;
0060 }
0061
0062 static void __exit sh7760_ac97_exit(void)
0063 {
0064 platform_device_unregister(sh7760_ac97_snd_device);
0065 }
0066
0067 module_init(sh7760_ac97_init);
0068 module_exit(sh7760_ac97_exit);
0069
0070 MODULE_LICENSE("GPL v2");
0071 MODULE_DESCRIPTION("Generic SH7760 AC97 sound machine");
0072 MODULE_AUTHOR("Manuel Lauss <mano@roarinelk.homelinux.net>");