Atsushi Nemoto | e24805d | 2009-05-19 22:12:15 +0900 | [diff] [blame] | 1 | /* |
| 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> |
| 22 | #include "../codecs/ac97.h" |
| 23 | #include "txx9aclc.h" |
| 24 | |
| 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, |
| 30 | }; |
| 31 | |
| 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, |
| 37 | }; |
| 38 | |
| 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, |
| 43 | }, |
| 44 | }; |
| 45 | |
| 46 | static int __init txx9aclc_generic_probe(struct platform_device *pdev) |
| 47 | { |
| 48 | struct txx9aclc_soc_device *dev = &txx9aclc_generic_soc_device; |
| 49 | struct platform_device *soc_pdev; |
| 50 | int ret; |
| 51 | |
| 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; |
| 61 | } |
| 62 | platform_set_drvdata(pdev, soc_pdev); |
| 63 | return 0; |
| 64 | } |
| 65 | |
| 66 | static int __exit txx9aclc_generic_remove(struct platform_device *pdev) |
| 67 | { |
| 68 | struct platform_device *soc_pdev = platform_get_drvdata(pdev); |
| 69 | |
| 70 | platform_device_unregister(soc_pdev); |
| 71 | return 0; |
| 72 | } |
| 73 | |
| 74 | static struct platform_driver txx9aclc_generic_driver = { |
| 75 | .remove = txx9aclc_generic_remove, |
| 76 | .driver = { |
| 77 | .name = "txx9aclc-generic", |
| 78 | .owner = THIS_MODULE, |
| 79 | }, |
| 80 | }; |
| 81 | |
| 82 | static int __init txx9aclc_generic_init(void) |
| 83 | { |
| 84 | return platform_driver_probe(&txx9aclc_generic_driver, |
| 85 | txx9aclc_generic_probe); |
| 86 | } |
| 87 | |
| 88 | static void __exit txx9aclc_generic_exit(void) |
| 89 | { |
| 90 | platform_driver_unregister(&txx9aclc_generic_driver); |
| 91 | } |
| 92 | |
| 93 | module_init(txx9aclc_generic_init); |
| 94 | module_exit(txx9aclc_generic_exit); |
| 95 | |
| 96 | MODULE_AUTHOR("Atsushi Nemoto <anemo@mba.ocn.ne.jp>"); |
| 97 | MODULE_DESCRIPTION("Generic TXx9 ACLC ALSA SoC audio driver"); |
| 98 | MODULE_LICENSE("GPL"); |
Geert Uytterhoeven | b0b4ce3 | 2010-04-08 20:52:00 +0200 | [diff] [blame] | 99 | MODULE_ALIAS("platform:txx9aclc-generic"); |