David Brazdil | 0f672f6 | 2019-12-10 10:32:29 +0000 | [diff] [blame^] | 1 | // SPDX-License-Identifier: GPL-2.0-only |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [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 | * |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [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> |
| 19 | #include "txx9aclc.h" |
| 20 | |
David Brazdil | 0f672f6 | 2019-12-10 10:32:29 +0000 | [diff] [blame^] | 21 | SND_SOC_DAILINK_DEFS(hifi, |
| 22 | DAILINK_COMP_ARRAY(COMP_CPU("txx9aclc-ac97")), |
| 23 | DAILINK_COMP_ARRAY(COMP_CODEC("ac97-codec", "ac97-hifi")), |
| 24 | DAILINK_COMP_ARRAY(COMP_PLATFORM("txx9aclc-pcm-audio"))); |
| 25 | |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 26 | static struct snd_soc_dai_link txx9aclc_generic_dai = { |
| 27 | .name = "AC97", |
| 28 | .stream_name = "AC97 HiFi", |
David Brazdil | 0f672f6 | 2019-12-10 10:32:29 +0000 | [diff] [blame^] | 29 | SND_SOC_DAILINK_REG(hifi), |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 30 | }; |
| 31 | |
| 32 | static struct snd_soc_card txx9aclc_generic_card = { |
| 33 | .name = "Generic TXx9 ACLC Audio", |
| 34 | .owner = THIS_MODULE, |
| 35 | .dai_link = &txx9aclc_generic_dai, |
| 36 | .num_links = 1, |
| 37 | }; |
| 38 | |
| 39 | static struct platform_device *soc_pdev; |
| 40 | |
| 41 | static int __init txx9aclc_generic_probe(struct platform_device *pdev) |
| 42 | { |
| 43 | int ret; |
| 44 | |
| 45 | soc_pdev = platform_device_alloc("soc-audio", -1); |
| 46 | if (!soc_pdev) |
| 47 | return -ENOMEM; |
| 48 | platform_set_drvdata(soc_pdev, &txx9aclc_generic_card); |
| 49 | ret = platform_device_add(soc_pdev); |
| 50 | if (ret) { |
| 51 | platform_device_put(soc_pdev); |
| 52 | return ret; |
| 53 | } |
| 54 | |
| 55 | return 0; |
| 56 | } |
| 57 | |
| 58 | static int __exit txx9aclc_generic_remove(struct platform_device *pdev) |
| 59 | { |
| 60 | platform_device_unregister(soc_pdev); |
| 61 | return 0; |
| 62 | } |
| 63 | |
| 64 | static struct platform_driver txx9aclc_generic_driver = { |
| 65 | .remove = __exit_p(txx9aclc_generic_remove), |
| 66 | .driver = { |
| 67 | .name = "txx9aclc-generic", |
| 68 | }, |
| 69 | }; |
| 70 | |
| 71 | static int __init txx9aclc_generic_init(void) |
| 72 | { |
| 73 | return platform_driver_probe(&txx9aclc_generic_driver, |
| 74 | txx9aclc_generic_probe); |
| 75 | } |
| 76 | |
| 77 | static void __exit txx9aclc_generic_exit(void) |
| 78 | { |
| 79 | platform_driver_unregister(&txx9aclc_generic_driver); |
| 80 | } |
| 81 | |
| 82 | module_init(txx9aclc_generic_init); |
| 83 | module_exit(txx9aclc_generic_exit); |
| 84 | |
| 85 | MODULE_AUTHOR("Atsushi Nemoto <anemo@mba.ocn.ne.jp>"); |
| 86 | MODULE_DESCRIPTION("Generic TXx9 ACLC ALSA SoC audio driver"); |
| 87 | MODULE_LICENSE("GPL"); |
| 88 | MODULE_ALIAS("platform:txx9aclc-generic"); |