Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-or-later
0002 /*
0003  * SoC audio driver for EM-X270, eXeda and CM-X300
0004  *
0005  * Copyright 2007, 2009 CompuLab, Ltd.
0006  *
0007  * Author: Mike Rapoport <mike@compulab.co.il>
0008  *
0009  * Copied from tosa.c:
0010  * Copyright 2005 Wolfson Microelectronics PLC.
0011  * Copyright 2005 Openedhand Ltd.
0012  *
0013  * Authors: Liam Girdwood <lrg@slimlogic.co.uk>
0014  *          Richard Purdie <richard@openedhand.com>
0015  */
0016 
0017 #include <linux/module.h>
0018 #include <linux/moduleparam.h>
0019 #include <linux/device.h>
0020 
0021 #include <sound/core.h>
0022 #include <sound/pcm.h>
0023 #include <sound/soc.h>
0024 
0025 #include <asm/mach-types.h>
0026 #include <linux/platform_data/asoc-pxa.h>
0027 
0028 SND_SOC_DAILINK_DEFS(ac97,
0029     DAILINK_COMP_ARRAY(COMP_CPU("pxa2xx-ac97")),
0030     DAILINK_COMP_ARRAY(COMP_CODEC("wm9712-codec", "wm9712-hifi")),
0031     DAILINK_COMP_ARRAY(COMP_PLATFORM("pxa-pcm-audio")));
0032 
0033 SND_SOC_DAILINK_DEFS(ac97_aux,
0034     DAILINK_COMP_ARRAY(COMP_CPU("pxa2xx-ac97-aux")),
0035     DAILINK_COMP_ARRAY(COMP_CODEC("wm9712-codec", "wm9712-aux")),
0036     DAILINK_COMP_ARRAY(COMP_PLATFORM("pxa-pcm-audio")));
0037 
0038 static struct snd_soc_dai_link em_x270_dai[] = {
0039     {
0040         .name = "AC97",
0041         .stream_name = "AC97 HiFi",
0042         SND_SOC_DAILINK_REG(ac97),
0043     },
0044     {
0045         .name = "AC97 Aux",
0046         .stream_name = "AC97 Aux",
0047         SND_SOC_DAILINK_REG(ac97_aux),
0048     },
0049 };
0050 
0051 static struct snd_soc_card em_x270 = {
0052     .name = "EM-X270",
0053     .owner = THIS_MODULE,
0054     .dai_link = em_x270_dai,
0055     .num_links = ARRAY_SIZE(em_x270_dai),
0056 };
0057 
0058 static struct platform_device *em_x270_snd_device;
0059 
0060 static int __init em_x270_init(void)
0061 {
0062     int ret;
0063 
0064     if (!(machine_is_em_x270() || machine_is_exeda()
0065           || machine_is_cm_x300()))
0066         return -ENODEV;
0067 
0068     em_x270_snd_device = platform_device_alloc("soc-audio", -1);
0069     if (!em_x270_snd_device)
0070         return -ENOMEM;
0071 
0072     platform_set_drvdata(em_x270_snd_device, &em_x270);
0073     ret = platform_device_add(em_x270_snd_device);
0074 
0075     if (ret)
0076         platform_device_put(em_x270_snd_device);
0077 
0078     return ret;
0079 }
0080 
0081 static void __exit em_x270_exit(void)
0082 {
0083     platform_device_unregister(em_x270_snd_device);
0084 }
0085 
0086 module_init(em_x270_init);
0087 module_exit(em_x270_exit);
0088 
0089 /* Module information */
0090 MODULE_AUTHOR("Mike Rapoport");
0091 MODULE_DESCRIPTION("ALSA SoC EM-X270, eXeda and CM-X300");
0092 MODULE_LICENSE("GPL");