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