blob: b056a1431ed41024a6d245374e42ff739eb0e365 [file] [log] [blame]
Atsushi Nemotoe24805d2009-05-19 22:12:15 +09001/*
2 * Generic TXx9 ACLC machine driver
3 *
4 * Copyright (C) 2009 Atsushi Nemoto
5 *
6 * Based on RBTX49xx patch from CELF patch archive.
7 * (C) Copyright TOSHIBA CORPORATION 2004-2006
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 *
13 * This is a very generic AC97 sound machine driver for boards which
14 * have (AC97) audio at ACLC (e.g. RBTX49XX boards).
15 */
16
17#include <linux/module.h>
18#include <linux/platform_device.h>
19#include <sound/core.h>
20#include <sound/pcm.h>
21#include <sound/soc.h>
Atsushi Nemotoe24805d2009-05-19 22:12:15 +090022#include "txx9aclc.h"
23
24static struct snd_soc_dai_link txx9aclc_generic_dai = {
25 .name = "AC97",
26 .stream_name = "AC97 HiFi",
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +000027 .cpu_dai_name = "txx9aclc-ac97",
28 .codec_dai_name = "ac97-hifi",
29 .platform_name = "txx9aclc-pcm-audio",
30 .codec_name = "ac97-codec",
Atsushi Nemotoe24805d2009-05-19 22:12:15 +090031};
32
33static struct snd_soc_card txx9aclc_generic_card = {
34 .name = "Generic TXx9 ACLC Audio",
Axel Line181d142011-12-23 14:54:30 +080035 .owner = THIS_MODULE,
Atsushi Nemotoe24805d2009-05-19 22:12:15 +090036 .dai_link = &txx9aclc_generic_dai,
37 .num_links = 1,
38};
39
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +000040static struct platform_device *soc_pdev;
Atsushi Nemotoe24805d2009-05-19 22:12:15 +090041
42static int __init txx9aclc_generic_probe(struct platform_device *pdev)
43{
Atsushi Nemotoe24805d2009-05-19 22:12:15 +090044 int ret;
45
46 soc_pdev = platform_device_alloc("soc-audio", -1);
47 if (!soc_pdev)
48 return -ENOMEM;
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +000049 platform_set_drvdata(soc_pdev, &txx9aclc_generic_card);
Atsushi Nemotoe24805d2009-05-19 22:12:15 +090050 ret = platform_device_add(soc_pdev);
51 if (ret) {
52 platform_device_put(soc_pdev);
53 return ret;
54 }
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +000055
Atsushi Nemotoe24805d2009-05-19 22:12:15 +090056 return 0;
57}
58
59static int __exit txx9aclc_generic_remove(struct platform_device *pdev)
60{
Atsushi Nemotoe24805d2009-05-19 22:12:15 +090061 platform_device_unregister(soc_pdev);
62 return 0;
63}
64
65static struct platform_driver txx9aclc_generic_driver = {
Axel Linf6a74ce2011-10-03 09:38:32 +080066 .remove = __exit_p(txx9aclc_generic_remove),
Atsushi Nemotoe24805d2009-05-19 22:12:15 +090067 .driver = {
68 .name = "txx9aclc-generic",
69 .owner = THIS_MODULE,
70 },
71};
72
73static int __init txx9aclc_generic_init(void)
74{
75 return platform_driver_probe(&txx9aclc_generic_driver,
76 txx9aclc_generic_probe);
77}
78
79static void __exit txx9aclc_generic_exit(void)
80{
81 platform_driver_unregister(&txx9aclc_generic_driver);
82}
83
84module_init(txx9aclc_generic_init);
85module_exit(txx9aclc_generic_exit);
86
87MODULE_AUTHOR("Atsushi Nemoto <anemo@mba.ocn.ne.jp>");
88MODULE_DESCRIPTION("Generic TXx9 ACLC ALSA SoC audio driver");
89MODULE_LICENSE("GPL");
Geert Uytterhoevenb0b4ce32010-04-08 20:52:00 +020090MODULE_ALIAS("platform:txx9aclc-generic");