em-x270.c (2172B)
1// SPDX-License-Identifier: GPL-2.0-or-later 2/* 3 * SoC audio driver for EM-X270, eXeda and CM-X300 4 * 5 * Copyright 2007, 2009 CompuLab, Ltd. 6 * 7 * Author: Mike Rapoport <mike@compulab.co.il> 8 * 9 * Copied from tosa.c: 10 * Copyright 2005 Wolfson Microelectronics PLC. 11 * Copyright 2005 Openedhand Ltd. 12 * 13 * Authors: Liam Girdwood <lrg@slimlogic.co.uk> 14 * Richard Purdie <richard@openedhand.com> 15 */ 16 17#include <linux/module.h> 18#include <linux/moduleparam.h> 19#include <linux/device.h> 20 21#include <sound/core.h> 22#include <sound/pcm.h> 23#include <sound/soc.h> 24 25#include <asm/mach-types.h> 26#include <linux/platform_data/asoc-pxa.h> 27 28SND_SOC_DAILINK_DEFS(ac97, 29 DAILINK_COMP_ARRAY(COMP_CPU("pxa2xx-ac97")), 30 DAILINK_COMP_ARRAY(COMP_CODEC("wm9712-codec", "wm9712-hifi")), 31 DAILINK_COMP_ARRAY(COMP_PLATFORM("pxa-pcm-audio"))); 32 33SND_SOC_DAILINK_DEFS(ac97_aux, 34 DAILINK_COMP_ARRAY(COMP_CPU("pxa2xx-ac97-aux")), 35 DAILINK_COMP_ARRAY(COMP_CODEC("wm9712-codec", "wm9712-aux")), 36 DAILINK_COMP_ARRAY(COMP_PLATFORM("pxa-pcm-audio"))); 37 38static struct snd_soc_dai_link em_x270_dai[] = { 39 { 40 .name = "AC97", 41 .stream_name = "AC97 HiFi", 42 SND_SOC_DAILINK_REG(ac97), 43 }, 44 { 45 .name = "AC97 Aux", 46 .stream_name = "AC97 Aux", 47 SND_SOC_DAILINK_REG(ac97_aux), 48 }, 49}; 50 51static struct snd_soc_card em_x270 = { 52 .name = "EM-X270", 53 .owner = THIS_MODULE, 54 .dai_link = em_x270_dai, 55 .num_links = ARRAY_SIZE(em_x270_dai), 56}; 57 58static struct platform_device *em_x270_snd_device; 59 60static int __init em_x270_init(void) 61{ 62 int ret; 63 64 if (!(machine_is_em_x270() || machine_is_exeda() 65 || machine_is_cm_x300())) 66 return -ENODEV; 67 68 em_x270_snd_device = platform_device_alloc("soc-audio", -1); 69 if (!em_x270_snd_device) 70 return -ENOMEM; 71 72 platform_set_drvdata(em_x270_snd_device, &em_x270); 73 ret = platform_device_add(em_x270_snd_device); 74 75 if (ret) 76 platform_device_put(em_x270_snd_device); 77 78 return ret; 79} 80 81static void __exit em_x270_exit(void) 82{ 83 platform_device_unregister(em_x270_snd_device); 84} 85 86module_init(em_x270_init); 87module_exit(em_x270_exit); 88 89/* Module information */ 90MODULE_AUTHOR("Mike Rapoport"); 91MODULE_DESCRIPTION("ALSA SoC EM-X270, eXeda and CM-X300"); 92MODULE_LICENSE("GPL");