Path: blob/master/sound/soc/samsung/s3c24xx_simtec_hermes.c
10819 views
/* sound/soc/samsung/s3c24xx_simtec_hermes.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"1213static const struct snd_soc_dapm_widget dapm_widgets[] = {14SND_SOC_DAPM_LINE("GSM Out", NULL),15SND_SOC_DAPM_LINE("GSM In", NULL),16SND_SOC_DAPM_LINE("Line In", NULL),17SND_SOC_DAPM_LINE("Line Out", NULL),18SND_SOC_DAPM_LINE("ZV", NULL),19SND_SOC_DAPM_MIC("Mic Jack", NULL),20SND_SOC_DAPM_HP("Headphone Jack", NULL),21};2223static const struct snd_soc_dapm_route base_map[] = {24/* Headphone connected to HP{L,R}OUT and HP{L,R}COM */2526{ "Headphone Jack", NULL, "HPLOUT" },27{ "Headphone Jack", NULL, "HPLCOM" },28{ "Headphone Jack", NULL, "HPROUT" },29{ "Headphone Jack", NULL, "HPRCOM" },3031/* ZV connected to Line1 */3233{ "LINE1L", NULL, "ZV" },34{ "LINE1R", NULL, "ZV" },3536/* Line In connected to Line2 */3738{ "LINE2L", NULL, "Line In" },39{ "LINE2R", NULL, "Line In" },4041/* Microphone connected to MIC3R and MIC_BIAS */4243{ "MIC3L", NULL, "Mic Jack" },4445/* GSM connected to MONO_LOUT and MIC3L (in) */4647{ "GSM Out", NULL, "MONO_LOUT" },48{ "MIC3L", NULL, "GSM In" },4950/* Speaker is connected to LINEOUT{LN,LP,RN,RP}, however we are51* not using the DAPM to power it up and down as there it makes52* a click when powering up. */53};5455/**56* simtec_hermes_init - initialise and add controls57* @codec; The codec instance to attach to.58*59* Attach our controls and configure the necessary codec60* mappings for our sound card instance.61*/62static int simtec_hermes_init(struct snd_soc_pcm_runtime *rtd)63{64struct snd_soc_codec *codec = rtd->codec;65struct snd_soc_dapm_context *dapm = &codec->dapm;6667snd_soc_dapm_new_controls(dapm, dapm_widgets,68ARRAY_SIZE(dapm_widgets));6970snd_soc_dapm_add_routes(dapm, base_map, ARRAY_SIZE(base_map));7172snd_soc_dapm_enable_pin(dapm, "Headphone Jack");73snd_soc_dapm_enable_pin(dapm, "Line In");74snd_soc_dapm_enable_pin(dapm, "Line Out");75snd_soc_dapm_enable_pin(dapm, "Mic Jack");7677simtec_audio_init(rtd);78snd_soc_dapm_sync(dapm);7980return 0;81}8283static struct snd_soc_dai_link simtec_dai_aic33 = {84.name = "tlv320aic33",85.stream_name = "TLV320AIC33",86.codec_name = "tlv320aic3x-codec.0-001a",87.cpu_dai_name = "s3c24xx-iis",88.codec_dai_name = "tlv320aic3x-hifi",89.platform_name = "samsung-audio",90.init = simtec_hermes_init,91};9293/* simtec audio machine driver */94static struct snd_soc_card snd_soc_machine_simtec_aic33 = {95.name = "Simtec-Hermes",96.dai_link = &simtec_dai_aic33,97.num_links = 1,98};99100static int __devinit simtec_audio_hermes_probe(struct platform_device *pd)101{102dev_info(&pd->dev, "probing....\n");103return simtec_audio_core_probe(pd, &snd_soc_machine_simtec_aic33);104}105106static struct platform_driver simtec_audio_hermes_platdrv = {107.driver = {108.owner = THIS_MODULE,109.name = "s3c24xx-simtec-hermes-snd",110.pm = simtec_audio_pm,111},112.probe = simtec_audio_hermes_probe,113.remove = __devexit_p(simtec_audio_remove),114};115116MODULE_ALIAS("platform:s3c24xx-simtec-hermes-snd");117118static int __init simtec_hermes_modinit(void)119{120return platform_driver_register(&simtec_audio_hermes_platdrv);121}122123static void __exit simtec_hermes_modexit(void)124{125platform_driver_unregister(&simtec_audio_hermes_platdrv);126}127128module_init(simtec_hermes_modinit);129module_exit(simtec_hermes_modexit);130131MODULE_AUTHOR("Ben Dooks <[email protected]>");132MODULE_DESCRIPTION("ALSA SoC Simtec Audio support");133MODULE_LICENSE("GPL");134135136