Path: blob/master/sound/soc/samsung/s3c24xx_simtec_tlv320aic23.c
10817 views
/* sound/soc/samsung/s3c24xx_simtec_tlv320aic23.c1*2* Copyright 2009 Simtec Electronics3*4* This program is free software; you can redistribute it and/or modify5* it under the terms of the GNU General Public License version 2 as6* published by the Free Software Foundation.7*/89#include <sound/soc.h>1011#include "s3c24xx_simtec.h"1213/* supported machines:14*15* Machine Connections AMP16* ------- ----------- ---17* BAST MIC, HPOUT, LOUT, LIN TPA2001D1 (HPOUTL,R) (gain hardwired)18* VR1000 HPOUT, LIN None19* VR2000 LIN, LOUT, MIC, HP LM4871 (HPOUTL,R)20* DePicture LIN, LOUT, MIC, HP LM4871 (HPOUTL,R)21* Anubis LIN, LOUT, MIC, HP TPA2001D1 (HPOUTL,R)22*/2324static const struct snd_soc_dapm_widget dapm_widgets[] = {25SND_SOC_DAPM_HP("Headphone Jack", NULL),26SND_SOC_DAPM_LINE("Line In", NULL),27SND_SOC_DAPM_LINE("Line Out", NULL),28SND_SOC_DAPM_MIC("Mic Jack", NULL),29};3031static const struct snd_soc_dapm_route base_map[] = {32{ "Headphone Jack", NULL, "LHPOUT"},33{ "Headphone Jack", NULL, "RHPOUT"},3435{ "Line Out", NULL, "LOUT" },36{ "Line Out", NULL, "ROUT" },3738{ "LLINEIN", NULL, "Line In"},39{ "RLINEIN", NULL, "Line In"},4041{ "MICIN", NULL, "Mic Jack"},42};4344/**45* simtec_tlv320aic23_init - initialise and add controls46* @codec; The codec instance to attach to.47*48* Attach our controls and configure the necessary codec49* mappings for our sound card instance.50*/51static int simtec_tlv320aic23_init(struct snd_soc_pcm_runtime *rtd)52{53struct snd_soc_codec *codec = rtd->codec;54struct snd_soc_dapm_context *dapm = &codec->dapm;5556snd_soc_dapm_new_controls(dapm, dapm_widgets,57ARRAY_SIZE(dapm_widgets));5859snd_soc_dapm_add_routes(dapm, base_map, ARRAY_SIZE(base_map));6061snd_soc_dapm_enable_pin(dapm, "Headphone Jack");62snd_soc_dapm_enable_pin(dapm, "Line In");63snd_soc_dapm_enable_pin(dapm, "Line Out");64snd_soc_dapm_enable_pin(dapm, "Mic Jack");6566simtec_audio_init(rtd);67snd_soc_dapm_sync(dapm);6869return 0;70}7172static struct snd_soc_dai_link simtec_dai_aic23 = {73.name = "tlv320aic23",74.stream_name = "TLV320AIC23",75.codec_name = "tlv320aic3x-codec.0-001a",76.cpu_dai_name = "s3c24xx-iis",77.codec_dai_name = "tlv320aic3x-hifi",78.platform_name = "samsung-audio",79.init = simtec_tlv320aic23_init,80};8182/* simtec audio machine driver */83static struct snd_soc_card snd_soc_machine_simtec_aic23 = {84.name = "Simtec",85.dai_link = &simtec_dai_aic23,86.num_links = 1,87};8889static int __devinit simtec_audio_tlv320aic23_probe(struct platform_device *pd)90{91return simtec_audio_core_probe(pd, &snd_soc_machine_simtec_aic23);92}9394static struct platform_driver simtec_audio_tlv320aic23_platdrv = {95.driver = {96.owner = THIS_MODULE,97.name = "s3c24xx-simtec-tlv320aic23",98.pm = simtec_audio_pm,99},100.probe = simtec_audio_tlv320aic23_probe,101.remove = __devexit_p(simtec_audio_remove),102};103104MODULE_ALIAS("platform:s3c24xx-simtec-tlv320aic23");105106static int __init simtec_tlv320aic23_modinit(void)107{108return platform_driver_register(&simtec_audio_tlv320aic23_platdrv);109}110111static void __exit simtec_tlv320aic23_modexit(void)112{113platform_driver_unregister(&simtec_audio_tlv320aic23_platdrv);114}115116module_init(simtec_tlv320aic23_modinit);117module_exit(simtec_tlv320aic23_modexit);118119MODULE_AUTHOR("Ben Dooks <[email protected]>");120MODULE_DESCRIPTION("ALSA SoC Simtec Audio support");121MODULE_LICENSE("GPL");122123124