blob: 39f23734781afe1686c68eb812f654daebd13d13 [file] [log] [blame]
Mark Brown22313ea2010-02-10 10:42:33 +00001/*
2 * phycore-ac97.c -- SoC audio for imx_phycore in AC97 mode
3 *
4 * Copyright 2009 Sascha Hauer, Pengutronix <s.hauer@pengutronix.de>
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 *
11 */
12
13#include <linux/module.h>
14#include <linux/moduleparam.h>
15#include <linux/device.h>
16#include <linux/i2c.h>
17#include <sound/core.h>
18#include <sound/pcm.h>
19#include <sound/soc.h>
20#include <sound/soc-dapm.h>
21#include <asm/mach-types.h>
22
Mark Brown22313ea2010-02-10 10:42:33 +000023static struct snd_soc_card imx_phycore;
24
25static struct snd_soc_ops imx_phycore_hifi_ops = {
26};
27
28static struct snd_soc_dai_link imx_phycore_dai_ac97[] = {
29 {
30 .name = "HiFi",
31 .stream_name = "HiFi",
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +000032 .codec_dai_name = "wm9712-hifi",
33 .codec_name = "wm9712-codec",
Mark Brown205d2312010-09-30 13:46:14 -070034 .cpu_dai_name = "imx-ssi.0",
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +000035 .platform_name = "imx-fiq-pcm-audio.0",
Mark Brown22313ea2010-02-10 10:42:33 +000036 .ops = &imx_phycore_hifi_ops,
37 },
38};
39
40static struct snd_soc_card imx_phycore = {
Sascha Hauer6424dca2010-11-04 17:05:44 +010041 .name = "PhyCORE-ac97-audio",
Mark Brown22313ea2010-02-10 10:42:33 +000042 .dai_link = imx_phycore_dai_ac97,
43 .num_links = ARRAY_SIZE(imx_phycore_dai_ac97),
44};
45
Mark Brown22313ea2010-02-10 10:42:33 +000046static struct platform_device *imx_phycore_snd_device;
47
48static int __init imx_phycore_init(void)
49{
50 int ret;
51
52 if (!machine_is_pcm043() && !machine_is_pca100())
53 /* return happy. We might run on a totally different machine */
54 return 0;
55
56 imx_phycore_snd_device = platform_device_alloc("soc-audio", -1);
57 if (!imx_phycore_snd_device)
58 return -ENOMEM;
59
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +000060 platform_set_drvdata(imx_phycore_snd_device, &imx_phycore);
61 ret = platform_device_add(imx_phycore_snd_device);
Mark Brown22313ea2010-02-10 10:42:33 +000062
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +000063 imx_phycore_snd_device = platform_device_alloc("wm9712-codec", -1);
64 if (!imx_phycore_snd_device)
65 return -ENOMEM;
Mark Brown22313ea2010-02-10 10:42:33 +000066 ret = platform_device_add(imx_phycore_snd_device);
67
68 if (ret) {
69 printk(KERN_ERR "ASoC: Platform device allocation failed\n");
70 platform_device_put(imx_phycore_snd_device);
71 }
72
73 return ret;
74}
75
76static void __exit imx_phycore_exit(void)
77{
78 platform_device_unregister(imx_phycore_snd_device);
79}
80
81late_initcall(imx_phycore_init);
82module_exit(imx_phycore_exit);
83
84MODULE_AUTHOR("Sascha Hauer <s.hauer@pengutronix.de>");
85MODULE_DESCRIPTION("PhyCORE ALSA SoC driver");
86MODULE_LICENSE("GPL");