Thomas Gleixner | d2912cb | 2019-06-04 10:11:33 +0200 | [diff] [blame^] | 1 | // SPDX-License-Identifier: GPL-2.0-only |
Atsushi Nemoto | e24805d | 2009-05-19 22:12:15 +0900 | [diff] [blame] | 2 | /* |
| 3 | * Generic TXx9 ACLC machine driver |
| 4 | * |
| 5 | * Copyright (C) 2009 Atsushi Nemoto |
| 6 | * |
| 7 | * Based on RBTX49xx patch from CELF patch archive. |
| 8 | * (C) Copyright TOSHIBA CORPORATION 2004-2006 |
| 9 | * |
Atsushi Nemoto | e24805d | 2009-05-19 22:12:15 +0900 | [diff] [blame] | 10 | * This is a very generic AC97 sound machine driver for boards which |
| 11 | * have (AC97) audio at ACLC (e.g. RBTX49XX boards). |
| 12 | */ |
| 13 | |
| 14 | #include <linux/module.h> |
| 15 | #include <linux/platform_device.h> |
| 16 | #include <sound/core.h> |
| 17 | #include <sound/pcm.h> |
| 18 | #include <sound/soc.h> |
Atsushi Nemoto | e24805d | 2009-05-19 22:12:15 +0900 | [diff] [blame] | 19 | #include "txx9aclc.h" |
| 20 | |
| 21 | static struct snd_soc_dai_link txx9aclc_generic_dai = { |
| 22 | .name = "AC97", |
| 23 | .stream_name = "AC97 HiFi", |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 24 | .cpu_dai_name = "txx9aclc-ac97", |
| 25 | .codec_dai_name = "ac97-hifi", |
| 26 | .platform_name = "txx9aclc-pcm-audio", |
| 27 | .codec_name = "ac97-codec", |
Atsushi Nemoto | e24805d | 2009-05-19 22:12:15 +0900 | [diff] [blame] | 28 | }; |
| 29 | |
| 30 | static struct snd_soc_card txx9aclc_generic_card = { |
| 31 | .name = "Generic TXx9 ACLC Audio", |
Axel Lin | e181d14 | 2011-12-23 14:54:30 +0800 | [diff] [blame] | 32 | .owner = THIS_MODULE, |
Atsushi Nemoto | e24805d | 2009-05-19 22:12:15 +0900 | [diff] [blame] | 33 | .dai_link = &txx9aclc_generic_dai, |
| 34 | .num_links = 1, |
| 35 | }; |
| 36 | |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 37 | static struct platform_device *soc_pdev; |
Atsushi Nemoto | e24805d | 2009-05-19 22:12:15 +0900 | [diff] [blame] | 38 | |
| 39 | static int __init txx9aclc_generic_probe(struct platform_device *pdev) |
| 40 | { |
Atsushi Nemoto | e24805d | 2009-05-19 22:12:15 +0900 | [diff] [blame] | 41 | int ret; |
| 42 | |
| 43 | soc_pdev = platform_device_alloc("soc-audio", -1); |
| 44 | if (!soc_pdev) |
| 45 | return -ENOMEM; |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 46 | platform_set_drvdata(soc_pdev, &txx9aclc_generic_card); |
Atsushi Nemoto | e24805d | 2009-05-19 22:12:15 +0900 | [diff] [blame] | 47 | ret = platform_device_add(soc_pdev); |
| 48 | if (ret) { |
| 49 | platform_device_put(soc_pdev); |
| 50 | return ret; |
| 51 | } |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 52 | |
Atsushi Nemoto | e24805d | 2009-05-19 22:12:15 +0900 | [diff] [blame] | 53 | return 0; |
| 54 | } |
| 55 | |
| 56 | static int __exit txx9aclc_generic_remove(struct platform_device *pdev) |
| 57 | { |
Atsushi Nemoto | e24805d | 2009-05-19 22:12:15 +0900 | [diff] [blame] | 58 | platform_device_unregister(soc_pdev); |
| 59 | return 0; |
| 60 | } |
| 61 | |
| 62 | static struct platform_driver txx9aclc_generic_driver = { |
Axel Lin | f6a74ce | 2011-10-03 09:38:32 +0800 | [diff] [blame] | 63 | .remove = __exit_p(txx9aclc_generic_remove), |
Atsushi Nemoto | e24805d | 2009-05-19 22:12:15 +0900 | [diff] [blame] | 64 | .driver = { |
| 65 | .name = "txx9aclc-generic", |
Atsushi Nemoto | e24805d | 2009-05-19 22:12:15 +0900 | [diff] [blame] | 66 | }, |
| 67 | }; |
| 68 | |
| 69 | static int __init txx9aclc_generic_init(void) |
| 70 | { |
| 71 | return platform_driver_probe(&txx9aclc_generic_driver, |
| 72 | txx9aclc_generic_probe); |
| 73 | } |
| 74 | |
| 75 | static void __exit txx9aclc_generic_exit(void) |
| 76 | { |
| 77 | platform_driver_unregister(&txx9aclc_generic_driver); |
| 78 | } |
| 79 | |
| 80 | module_init(txx9aclc_generic_init); |
| 81 | module_exit(txx9aclc_generic_exit); |
| 82 | |
| 83 | MODULE_AUTHOR("Atsushi Nemoto <anemo@mba.ocn.ne.jp>"); |
| 84 | MODULE_DESCRIPTION("Generic TXx9 ACLC ALSA SoC audio driver"); |
| 85 | MODULE_LICENSE("GPL"); |
Geert Uytterhoeven | b0b4ce3 | 2010-04-08 20:52:00 +0200 | [diff] [blame] | 86 | MODULE_ALIAS("platform:txx9aclc-generic"); |