Full support for Ginger Console
[linux-ginger.git] / sound / soc / txx9 / txx9aclc-generic.c
blob3175de9a92cbddc82fbbe9a1f3554159ca9a868c
1 /*
2 * Generic TXx9 ACLC machine driver
4 * Copyright (C) 2009 Atsushi Nemoto
6 * Based on RBTX49xx patch from CELF patch archive.
7 * (C) Copyright TOSHIBA CORPORATION 2004-2006
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.
13 * This is a very generic AC97 sound machine driver for boards which
14 * have (AC97) audio at ACLC (e.g. RBTX49XX boards).
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>
22 #include "../codecs/ac97.h"
23 #include "txx9aclc.h"
25 static struct snd_soc_dai_link txx9aclc_generic_dai = {
26 .name = "AC97",
27 .stream_name = "AC97 HiFi",
28 .cpu_dai = &txx9aclc_ac97_dai,
29 .codec_dai = &ac97_dai,
32 static struct snd_soc_card txx9aclc_generic_card = {
33 .name = "Generic TXx9 ACLC Audio",
34 .platform = &txx9aclc_soc_platform,
35 .dai_link = &txx9aclc_generic_dai,
36 .num_links = 1,
39 static struct txx9aclc_soc_device txx9aclc_generic_soc_device = {
40 .soc_dev = {
41 .card = &txx9aclc_generic_card,
42 .codec_dev = &soc_codec_dev_ac97,
46 static int __init txx9aclc_generic_probe(struct platform_device *pdev)
48 struct txx9aclc_soc_device *dev = &txx9aclc_generic_soc_device;
49 struct platform_device *soc_pdev;
50 int ret;
52 soc_pdev = platform_device_alloc("soc-audio", -1);
53 if (!soc_pdev)
54 return -ENOMEM;
55 platform_set_drvdata(soc_pdev, &dev->soc_dev);
56 dev->soc_dev.dev = &soc_pdev->dev;
57 ret = platform_device_add(soc_pdev);
58 if (ret) {
59 platform_device_put(soc_pdev);
60 return ret;
62 platform_set_drvdata(pdev, soc_pdev);
63 return 0;
66 static int __exit txx9aclc_generic_remove(struct platform_device *pdev)
68 struct platform_device *soc_pdev = platform_get_drvdata(pdev);
70 platform_device_unregister(soc_pdev);
71 return 0;
74 static struct platform_driver txx9aclc_generic_driver = {
75 .remove = txx9aclc_generic_remove,
76 .driver = {
77 .name = "txx9aclc-generic",
78 .owner = THIS_MODULE,
82 static int __init txx9aclc_generic_init(void)
84 return platform_driver_probe(&txx9aclc_generic_driver,
85 txx9aclc_generic_probe);
88 static void __exit txx9aclc_generic_exit(void)
90 platform_driver_unregister(&txx9aclc_generic_driver);
93 module_init(txx9aclc_generic_init);
94 module_exit(txx9aclc_generic_exit);
96 MODULE_AUTHOR("Atsushi Nemoto <anemo@mba.ocn.ne.jp>");
97 MODULE_DESCRIPTION("Generic TXx9 ACLC ALSA SoC audio driver");
98 MODULE_LICENSE("GPL");