ASoC: fsl: add imx-sgtl5000 machine driver
[linux-2.6-block.git] / sound / soc / fsl / pcm030-audio-fabric.c
CommitLineData
a9262c4f
JS
1/*
2 * Phytec pcm030 driver for the PSC of the Freescale MPC52xx
3 * configured as AC97 interface
4 *
5 * Copyright 2008 Jon Smirl, Digispeaker
6 * Author: Jon Smirl <jonsmirl@gmail.com>
7 *
8 * This file is licensed under the terms of the GNU General Public License
9 * version 2. This program is licensed "as is" without any warranty of any
10 * kind, whether express or implied.
11 */
12
13#include <linux/init.h>
14#include <linux/module.h>
15#include <linux/interrupt.h>
16#include <linux/device.h>
17#include <linux/delay.h>
18#include <linux/of_device.h>
19#include <linux/of_platform.h>
20#include <linux/dma-mapping.h>
21
22#include <sound/core.h>
23#include <sound/pcm.h>
24#include <sound/pcm_params.h>
25#include <sound/initval.h>
26#include <sound/soc.h>
a9262c4f
JS
27
28#include "mpc5200_dma.h"
29#include "mpc5200_psc_ac97.h"
30#include "../codecs/wm9712.h"
31
afc5e652
TI
32#define DRV_NAME "pcm030-audio-fabric"
33
a9262c4f
JS
34static struct snd_soc_dai_link pcm030_fabric_dai[] = {
35{
36 .name = "AC97",
37 .stream_name = "AC97 Analog",
f0fba2ad
LG
38 .codec_dai_name = "wm9712-hifi",
39 .cpu_dai_name = "mpc5200-psc-ac97.0",
40 .platform_name = "mpc5200-pcm-audio",
41 .codec_name = "wm9712-codec",
a9262c4f
JS
42},
43{
44 .name = "AC97",
45 .stream_name = "AC97 IEC958",
f0fba2ad
LG
46 .codec_dai_name = "wm9712-aux",
47 .cpu_dai_name = "mpc5200-psc-ac97.1",
48 .platform_name = "mpc5200-pcm-audio",
e94be5f3 49 .codec_name = "wm9712-codec",
a9262c4f
JS
50},
51};
52
4c3c5df0
AL
53static struct snd_soc_card card = {
54 .name = "pcm030",
55 .owner = THIS_MODULE,
56 .dai_link = pcm030_fabric_dai,
57 .num_links = ARRAY_SIZE(pcm030_fabric_dai),
58};
59
a9262c4f
JS
60static __init int pcm030_fabric_init(void)
61{
62 struct platform_device *pdev;
63 int rc;
64
71a157e8 65 if (!of_machine_is_compatible("phytec,pcm030"))
a9262c4f
JS
66 return -ENODEV;
67
a9262c4f
JS
68 pdev = platform_device_alloc("soc-audio", 1);
69 if (!pdev) {
70 pr_err("pcm030_fabric_init: platform_device_alloc() failed\n");
71 return -ENODEV;
72 }
73
f0fba2ad 74 platform_set_drvdata(pdev, &card);
a9262c4f
JS
75
76 rc = platform_device_add(pdev);
77 if (rc) {
78 pr_err("pcm030_fabric_init: platform_device_add() failed\n");
917dac0f 79 platform_device_put(pdev);
a9262c4f
JS
80 return -ENODEV;
81 }
82 return 0;
83}
84
85module_init(pcm030_fabric_init);
86
87
88MODULE_AUTHOR("Jon Smirl <jonsmirl@gmail.com>");
89MODULE_DESCRIPTION(DRV_NAME ": mpc5200 pcm030 fabric driver");
90MODULE_LICENSE("GPL");
91