blob: 53251e6b5bd509303dc17500e8f4d64feeea7021 [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"
29#include "mpc5200_psc_ac97.h"
30#include "../codecs/stac9766.h"
31
Takashi Iwaiafc5e652009-08-07 16:33:53 +020032#define DRV_NAME "efika-audio-fabric"
33
Jon Smirl6ffee432009-05-26 08:34:14 -040034static struct snd_soc_card card;
35
36static struct snd_soc_dai_link efika_fabric_dai[] = {
37{
38 .name = "AC97",
39 .stream_name = "AC97 Analog",
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +000040 .codec_dai_name = "stac9766-hifi-analog",
41 .cpu_dai_name = "mpc5200-psc-ac97.0",
42 .platform_name = "mpc5200-pcm-audio",
43 .codec_name = "stac9766-codec",
Jon Smirl6ffee432009-05-26 08:34:14 -040044},
45{
46 .name = "AC97",
47 .stream_name = "AC97 IEC958",
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +000048 .codec_dai_name = "stac9766-hifi-IEC958",
49 .cpu_dai_name = "mpc5200-psc-ac97.1",
50 .platform_name = "mpc5200-pcm-audio",
51 .codec_name = "stac9766-codec",
Jon Smirl6ffee432009-05-26 08:34:14 -040052},
53};
54
55static __init int efika_fabric_init(void)
56{
57 struct platform_device *pdev;
58 int rc;
59
Grant Likely71a157e2010-02-01 21:34:14 -070060 if (!of_machine_is_compatible("bplan,efika"))
Jon Smirl6ffee432009-05-26 08:34:14 -040061 return -ENODEV;
62
Jon Smirl6ffee432009-05-26 08:34:14 -040063 card.name = "Efika";
64 card.dai_link = efika_fabric_dai;
65 card.num_links = ARRAY_SIZE(efika_fabric_dai);
66
Jon Smirl6ffee432009-05-26 08:34:14 -040067
68 pdev = platform_device_alloc("soc-audio", 1);
69 if (!pdev) {
70 pr_err("efika_fabric_init: platform_device_alloc() failed\n");
71 return -ENODEV;
72 }
73
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +000074 platform_set_drvdata(pdev, &card);
Jon Smirl6ffee432009-05-26 08:34:14 -040075
76 rc = platform_device_add(pdev);
77 if (rc) {
78 pr_err("efika_fabric_init: platform_device_add() failed\n");
79 return -ENODEV;
80 }
81 return 0;
82}
83
84module_init(efika_fabric_init);
85
86
87MODULE_AUTHOR("Jon Smirl <jonsmirl@gmail.com>");
88MODULE_DESCRIPTION(DRV_NAME ": mpc5200 Efika fabric driver");
89MODULE_LICENSE("GPL");
90