blob: a397bb0d8179650e60967ed65fd4e02665940e6c [file] [log] [blame]
Mika Westerbergd42a2802010-10-14 17:49:08 +03001/*
2 * simone.c -- ASoC audio for Simplemachines Sim.One board
3 *
4 * Copyright (c) 2010 Mika Westerberg
5 *
6 * Based on snappercl15 machine driver by Ryan Mallon.
7 *
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.
11 */
12
13#include <linux/init.h>
14#include <linux/module.h>
15#include <linux/platform_device.h>
16
17#include <sound/core.h>
18#include <sound/pcm.h>
19#include <sound/soc.h>
20
21#include <asm/mach-types.h>
22#include <mach/hardware.h>
23
24#include "ep93xx-pcm.h"
25
26static 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",
33};
34
35static struct snd_soc_card snd_soc_simone = {
36 .name = "Sim.One",
Axel Lina76a7022011-12-22 21:21:37 +080037 .owner = THIS_MODULE,
Mika Westerbergd42a2802010-10-14 17:49:08 +030038 .dai_link = &simone_dai,
39 .num_links = 1,
40};
41
42static struct platform_device *simone_snd_ac97_device;
Mika Westerberg5a0a03c2011-09-11 12:28:50 +030043
Bill Pemberton145e2872012-12-07 09:26:23 -050044static int simone_probe(struct platform_device *pdev)
Mika Westerberg5a0a03c2011-09-11 12:28:50 +030045{
46 struct snd_soc_card *card = &snd_soc_simone;
47 int ret;
48
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);
53
54 card->dev = &pdev->dev;
55
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);
61 }
62
63 return ret;
64}
65
Bill Pemberton145e2872012-12-07 09:26:23 -050066static int simone_remove(struct platform_device *pdev)
Mika Westerberg5a0a03c2011-09-11 12:28:50 +030067{
68 struct snd_soc_card *card = platform_get_drvdata(pdev);
69
70 snd_soc_unregister_card(card);
71 platform_device_unregister(simone_snd_ac97_device);
72
73 return 0;
74}
75
76static struct platform_driver simone_driver = {
77 .driver = {
78 .name = "simone-audio",
79 .owner = THIS_MODULE,
80 },
81 .probe = simone_probe,
Bill Pemberton145e2872012-12-07 09:26:23 -050082 .remove = simone_remove,
Mika Westerberg5a0a03c2011-09-11 12:28:50 +030083};
Mika Westerbergd42a2802010-10-14 17:49:08 +030084
Axel Linee18f632011-11-24 12:07:55 +080085module_platform_driver(simone_driver);
Mika Westerbergd42a2802010-10-14 17:49:08 +030086
87MODULE_DESCRIPTION("ALSA SoC Simplemachines Sim.One");
88MODULE_AUTHOR("Mika Westerberg <mika.westerberg@iki.fi>");
89MODULE_LICENSE("GPL");
Mika Westerberg5a0a03c2011-09-11 12:28:50 +030090MODULE_ALIAS("platform:simone-audio");