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