ASoC: au1x: Add .owner to struct snd_soc_card
[deliverable/linux.git] / sound / soc / imx / phycore-ac97.c
CommitLineData
22313eaf
MB
1/*
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>
22313eaf
MB
20#include <asm/mach-types.h>
21
22313eaf
MB
22static struct snd_soc_card imx_phycore;
23
24static struct snd_soc_ops imx_phycore_hifi_ops = {
25};
26
27static struct snd_soc_dai_link imx_phycore_dai_ac97[] = {
28 {
29 .name = "HiFi",
30 .stream_name = "HiFi",
f0fba2ad
LG
31 .codec_dai_name = "wm9712-hifi",
32 .codec_name = "wm9712-codec",
205d231b 33 .cpu_dai_name = "imx-ssi.0",
f0fba2ad 34 .platform_name = "imx-fiq-pcm-audio.0",
22313eaf
MB
35 .ops = &imx_phycore_hifi_ops,
36 },
37};
38
39static struct snd_soc_card imx_phycore = {
6424dca2 40 .name = "PhyCORE-ac97-audio",
22313eaf
MB
41 .dai_link = imx_phycore_dai_ac97,
42 .num_links = ARRAY_SIZE(imx_phycore_dai_ac97),
43};
44
09de9533 45static struct platform_device *imx_phycore_snd_ac97_device;
22313eaf
MB
46static 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
09de9533
AL
56 imx_phycore_snd_ac97_device = platform_device_alloc("soc-audio", -1);
57 if (!imx_phycore_snd_ac97_device)
22313eaf
MB
58 return -ENOMEM;
59
09de9533
AL
60 platform_set_drvdata(imx_phycore_snd_ac97_device, &imx_phycore);
61 ret = platform_device_add(imx_phycore_snd_ac97_device);
62 if (ret)
63 goto fail1;
22313eaf 64
f0fba2ad 65 imx_phycore_snd_device = platform_device_alloc("wm9712-codec", -1);
09de9533
AL
66 if (!imx_phycore_snd_device) {
67 ret = -ENOMEM;
68 goto fail2;
69 }
22313eaf
MB
70 ret = platform_device_add(imx_phycore_snd_device);
71
72 if (ret) {
73 printk(KERN_ERR "ASoC: Platform device allocation failed\n");
09de9533 74 goto fail3;
22313eaf
MB
75 }
76
09de9533
AL
77 return 0;
78
79fail3:
80 platform_device_put(imx_phycore_snd_device);
81fail2:
82 platform_device_del(imx_phycore_snd_ac97_device);
83fail1:
84 platform_device_put(imx_phycore_snd_ac97_device);
22313eaf
MB
85 return ret;
86}
87
88static void __exit imx_phycore_exit(void)
89{
90 platform_device_unregister(imx_phycore_snd_device);
09de9533 91 platform_device_unregister(imx_phycore_snd_ac97_device);
22313eaf
MB
92}
93
94late_initcall(imx_phycore_init);
95module_exit(imx_phycore_exit);
96
97MODULE_AUTHOR("Sascha Hauer <s.hauer@pengutronix.de>");
98MODULE_DESCRIPTION("PhyCORE ALSA SoC driver");
99MODULE_LICENSE("GPL");
This page took 0.092606 seconds and 5 git commands to generate.