First Support on Ginger and OMAP TI
[linux-ginger.git] / sound / soc / fsl / efika-audio-fabric.c
blob3326e2a1e8633a9ee357541c687536ec701f6f62
1 /*
2 * Efika driver for the PSC of the Freescale MPC52xx
3 * configured as AC97 interface
5 * Copyright 2008 Jon Smirl, Digispeaker
6 * Author: Jon Smirl <jonsmirl@gmail.com>
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.
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>
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>
27 #include <sound/soc-of-simple.h>
29 #include "mpc5200_dma.h"
30 #include "mpc5200_psc_ac97.h"
31 #include "../codecs/stac9766.h"
33 #define DRV_NAME "efika-audio-fabric"
35 static struct snd_soc_device device;
36 static struct snd_soc_card card;
38 static struct snd_soc_dai_link efika_fabric_dai[] = {
40 .name = "AC97",
41 .stream_name = "AC97 Analog",
42 .codec_dai = &stac9766_dai[STAC9766_DAI_AC97_ANALOG],
43 .cpu_dai = &psc_ac97_dai[MPC5200_AC97_NORMAL],
46 .name = "AC97",
47 .stream_name = "AC97 IEC958",
48 .codec_dai = &stac9766_dai[STAC9766_DAI_AC97_DIGITAL],
49 .cpu_dai = &psc_ac97_dai[MPC5200_AC97_SPDIF],
53 static __init int efika_fabric_init(void)
55 struct platform_device *pdev;
56 int rc;
58 if (!machine_is_compatible("bplan,efika"))
59 return -ENODEV;
61 card.platform = &mpc5200_audio_dma_platform;
62 card.name = "Efika";
63 card.dai_link = efika_fabric_dai;
64 card.num_links = ARRAY_SIZE(efika_fabric_dai);
66 device.card = &card;
67 device.codec_dev = &soc_codec_dev_stac9766;
69 pdev = platform_device_alloc("soc-audio", 1);
70 if (!pdev) {
71 pr_err("efika_fabric_init: platform_device_alloc() failed\n");
72 return -ENODEV;
75 platform_set_drvdata(pdev, &device);
76 device.dev = &pdev->dev;
78 rc = platform_device_add(pdev);
79 if (rc) {
80 pr_err("efika_fabric_init: platform_device_add() failed\n");
81 return -ENODEV;
83 return 0;
86 module_init(efika_fabric_init);
89 MODULE_AUTHOR("Jon Smirl <jonsmirl@gmail.com>");
90 MODULE_DESCRIPTION(DRV_NAME ": mpc5200 Efika fabric driver");
91 MODULE_LICENSE("GPL");