blob: 6644cba7cbf20e5a16e75ad459df1c2663afcc93 [file] [log] [blame]
Jon Smirla9262c42009-05-26 08:34:12 -04001/*
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>
27#include <sound/soc-of-simple.h>
28
29#include "mpc5200_dma.h"
30#include "mpc5200_psc_ac97.h"
31#include "../codecs/wm9712.h"
32
Takashi Iwaiafc5e652009-08-07 16:33:53 +020033#define DRV_NAME "pcm030-audio-fabric"
34
Jon Smirla9262c42009-05-26 08:34:12 -040035static struct snd_soc_device device;
36static struct snd_soc_card card;
37
38static struct snd_soc_dai_link pcm030_fabric_dai[] = {
39{
40 .name = "AC97",
41 .stream_name = "AC97 Analog",
42 .codec_dai = &wm9712_dai[WM9712_DAI_AC97_HIFI],
43 .cpu_dai = &psc_ac97_dai[MPC5200_AC97_NORMAL],
44},
45{
46 .name = "AC97",
47 .stream_name = "AC97 IEC958",
48 .codec_dai = &wm9712_dai[WM9712_DAI_AC97_AUX],
49 .cpu_dai = &psc_ac97_dai[MPC5200_AC97_SPDIF],
50},
51};
52
53static __init int pcm030_fabric_init(void)
54{
55 struct platform_device *pdev;
56 int rc;
57
Grant Likely71a157e2010-02-01 21:34:14 -070058 if (!of_machine_is_compatible("phytec,pcm030"))
Jon Smirla9262c42009-05-26 08:34:12 -040059 return -ENODEV;
60
61 card.platform = &mpc5200_audio_dma_platform;
62 card.name = "pcm030";
63 card.dai_link = pcm030_fabric_dai;
64 card.num_links = ARRAY_SIZE(pcm030_fabric_dai);
65
66 device.card = &card;
67 device.codec_dev = &soc_codec_dev_wm9712;
68
69 pdev = platform_device_alloc("soc-audio", 1);
70 if (!pdev) {
71 pr_err("pcm030_fabric_init: platform_device_alloc() failed\n");
72 return -ENODEV;
73 }
74
75 platform_set_drvdata(pdev, &device);
76 device.dev = &pdev->dev;
77
78 rc = platform_device_add(pdev);
79 if (rc) {
80 pr_err("pcm030_fabric_init: platform_device_add() failed\n");
81 return -ENODEV;
82 }
83 return 0;
84}
85
86module_init(pcm030_fabric_init);
87
88
89MODULE_AUTHOR("Jon Smirl <jonsmirl@gmail.com>");
90MODULE_DESCRIPTION(DRV_NAME ": mpc5200 pcm030 fabric driver");
91MODULE_LICENSE("GPL");
92