blob: 667f4215dfc0f07dd58b02c92e7dc542ac5eb1f5 [file] [log] [blame]
Jon Smirl6ffee432009-05-26 08:34:14 -04001/*
2 * Efika 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>
Jon Smirl6ffee432009-05-26 08:34:14 -040027
28#include "mpc5200_dma.h"
Jon Smirl6ffee432009-05-26 08:34:14 -040029
Takashi Iwaiafc5e652009-08-07 16:33:53 +020030#define DRV_NAME "efika-audio-fabric"
31
Jon Smirl6ffee432009-05-26 08:34:14 -040032static struct snd_soc_dai_link efika_fabric_dai[] = {
33{
34 .name = "AC97",
35 .stream_name = "AC97 Analog",
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +000036 .codec_dai_name = "stac9766-hifi-analog",
37 .cpu_dai_name = "mpc5200-psc-ac97.0",
38 .platform_name = "mpc5200-pcm-audio",
39 .codec_name = "stac9766-codec",
Jon Smirl6ffee432009-05-26 08:34:14 -040040},
41{
42 .name = "AC97",
43 .stream_name = "AC97 IEC958",
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +000044 .codec_dai_name = "stac9766-hifi-IEC958",
45 .cpu_dai_name = "mpc5200-psc-ac97.1",
46 .platform_name = "mpc5200-pcm-audio",
47 .codec_name = "stac9766-codec",
Jon Smirl6ffee432009-05-26 08:34:14 -040048},
49};
50
Axel Lin4c3c5df2011-12-22 21:04:54 +080051static struct snd_soc_card card = {
52 .name = "Efika",
53 .owner = THIS_MODULE,
54 .dai_link = efika_fabric_dai,
55 .num_links = ARRAY_SIZE(efika_fabric_dai),
56};
57
Jon Smirl6ffee432009-05-26 08:34:14 -040058static __init int efika_fabric_init(void)
59{
60 struct platform_device *pdev;
61 int rc;
62
Grant Likely71a157e2010-02-01 21:34:14 -070063 if (!of_machine_is_compatible("bplan,efika"))
Jon Smirl6ffee432009-05-26 08:34:14 -040064 return -ENODEV;
65
Jon Smirl6ffee432009-05-26 08:34:14 -040066 pdev = platform_device_alloc("soc-audio", 1);
67 if (!pdev) {
68 pr_err("efika_fabric_init: platform_device_alloc() failed\n");
69 return -ENODEV;
70 }
71
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +000072 platform_set_drvdata(pdev, &card);
Jon Smirl6ffee432009-05-26 08:34:14 -040073
74 rc = platform_device_add(pdev);
75 if (rc) {
76 pr_err("efika_fabric_init: platform_device_add() failed\n");
Axel Lin4e1f8652010-11-25 15:07:25 +080077 platform_device_put(pdev);
Jon Smirl6ffee432009-05-26 08:34:14 -040078 return -ENODEV;
79 }
80 return 0;
81}
82
83module_init(efika_fabric_init);
84
85
86MODULE_AUTHOR("Jon Smirl <jonsmirl@gmail.com>");
87MODULE_DESCRIPTION(DRV_NAME ": mpc5200 Efika fabric driver");
88MODULE_LICENSE("GPL");
89