Merge tag 'v3.3.7' into 3.3/master
[zen-stable.git] / sound / soc / ep93xx / simone.c
blobdd997094eb301f8134b0b11db3a12ac6ed16d782
1 /*
2 * simone.c -- ASoC audio for Simplemachines Sim.One board
4 * Copyright (c) 2010 Mika Westerberg
6 * Based on snappercl15 machine driver by Ryan Mallon.
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
13 #include <linux/init.h>
14 #include <linux/module.h>
15 #include <linux/platform_device.h>
17 #include <sound/core.h>
18 #include <sound/pcm.h>
19 #include <sound/soc.h>
21 #include <asm/mach-types.h>
22 #include <mach/hardware.h>
24 #include "ep93xx-pcm.h"
26 static struct snd_soc_dai_link simone_dai = {
27 .name = "AC97",
28 .stream_name = "AC97 HiFi",
29 .cpu_dai_name = "ep93xx-ac97",
30 .codec_dai_name = "ac97-hifi",
31 .codec_name = "ac97-codec",
32 .platform_name = "ep93xx-pcm-audio",
35 static struct snd_soc_card snd_soc_simone = {
36 .name = "Sim.One",
37 .owner = THIS_MODULE,
38 .dai_link = &simone_dai,
39 .num_links = 1,
42 static struct platform_device *simone_snd_ac97_device;
44 static int __devinit simone_probe(struct platform_device *pdev)
46 struct snd_soc_card *card = &snd_soc_simone;
47 int ret;
49 simone_snd_ac97_device = platform_device_register_simple("ac97-codec",
50 -1, NULL, 0);
51 if (IS_ERR(simone_snd_ac97_device))
52 return PTR_ERR(simone_snd_ac97_device);
54 card->dev = &pdev->dev;
56 ret = snd_soc_register_card(card);
57 if (ret) {
58 dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n",
59 ret);
60 platform_device_unregister(simone_snd_ac97_device);
63 return ret;
66 static int __devexit simone_remove(struct platform_device *pdev)
68 struct snd_soc_card *card = platform_get_drvdata(pdev);
70 snd_soc_unregister_card(card);
71 platform_device_unregister(simone_snd_ac97_device);
73 return 0;
76 static struct platform_driver simone_driver = {
77 .driver = {
78 .name = "simone-audio",
79 .owner = THIS_MODULE,
81 .probe = simone_probe,
82 .remove = __devexit_p(simone_remove),
85 module_platform_driver(simone_driver);
87 MODULE_DESCRIPTION("ALSA SoC Simplemachines Sim.One");
88 MODULE_AUTHOR("Mika Westerberg <mika.westerberg@iki.fi>");
89 MODULE_LICENSE("GPL");
90 MODULE_ALIAS("platform:simone-audio");