Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0
0002 //
0003 // Copyright 2009 Simtec Electronics
0004 
0005 #include <linux/module.h>
0006 #include <sound/soc.h>
0007 
0008 #include "s3c24xx_simtec.h"
0009 
0010 static const struct snd_soc_dapm_widget dapm_widgets[] = {
0011     SND_SOC_DAPM_LINE("GSM Out", NULL),
0012     SND_SOC_DAPM_LINE("GSM In", NULL),
0013     SND_SOC_DAPM_LINE("Line In", NULL),
0014     SND_SOC_DAPM_LINE("Line Out", NULL),
0015     SND_SOC_DAPM_LINE("ZV", NULL),
0016     SND_SOC_DAPM_MIC("Mic Jack", NULL),
0017     SND_SOC_DAPM_HP("Headphone Jack", NULL),
0018 };
0019 
0020 static const struct snd_soc_dapm_route base_map[] = {
0021     /* Headphone connected to HP{L,R}OUT and HP{L,R}COM */
0022 
0023     { "Headphone Jack", NULL, "HPLOUT" },
0024     { "Headphone Jack", NULL, "HPLCOM" },
0025     { "Headphone Jack", NULL, "HPROUT" },
0026     { "Headphone Jack", NULL, "HPRCOM" },
0027 
0028     /* ZV connected to Line1 */
0029 
0030     { "LINE1L", NULL, "ZV" },
0031     { "LINE1R", NULL, "ZV" },
0032 
0033     /* Line In connected to Line2 */
0034 
0035     { "LINE2L", NULL, "Line In" },
0036     { "LINE2R", NULL, "Line In" },
0037 
0038     /* Microphone connected to MIC3R and MIC_BIAS */
0039 
0040     { "MIC3L", NULL, "Mic Jack" },
0041 
0042     /* GSM connected to MONO_LOUT and MIC3L (in) */
0043 
0044     { "GSM Out", NULL, "MONO_LOUT" },
0045     { "MIC3L", NULL, "GSM In" },
0046 
0047     /* Speaker is connected to LINEOUT{LN,LP,RN,RP}, however we are
0048      * not using the DAPM to power it up and down as there it makes
0049      * a click when powering up. */
0050 };
0051 
0052 /**
0053  * simtec_hermes_init - initialise and add controls
0054  * @codec; The codec instance to attach to.
0055  *
0056  * Attach our controls and configure the necessary codec
0057  * mappings for our sound card instance.
0058 */
0059 static int simtec_hermes_init(struct snd_soc_pcm_runtime *rtd)
0060 {
0061     simtec_audio_init(rtd);
0062 
0063     return 0;
0064 }
0065 
0066 SND_SOC_DAILINK_DEFS(tlv320aic33,
0067     DAILINK_COMP_ARRAY(COMP_CPU("s3c24xx-iis")),
0068     DAILINK_COMP_ARRAY(COMP_CODEC("tlv320aic3x-codec.0-001a",
0069                       "tlv320aic3x-hifi")),
0070     DAILINK_COMP_ARRAY(COMP_PLATFORM("s3c24xx-iis")));
0071 
0072 static struct snd_soc_dai_link simtec_dai_aic33 = {
0073     .name       = "tlv320aic33",
0074     .stream_name    = "TLV320AIC33",
0075     .init       = simtec_hermes_init,
0076     SND_SOC_DAILINK_REG(tlv320aic33),
0077 };
0078 
0079 /* simtec audio machine driver */
0080 static struct snd_soc_card snd_soc_machine_simtec_aic33 = {
0081     .name       = "Simtec-Hermes",
0082     .owner      = THIS_MODULE,
0083     .dai_link   = &simtec_dai_aic33,
0084     .num_links  = 1,
0085 
0086     .dapm_widgets   = dapm_widgets,
0087     .num_dapm_widgets = ARRAY_SIZE(dapm_widgets),
0088     .dapm_routes    = base_map,
0089     .num_dapm_routes = ARRAY_SIZE(base_map),
0090 };
0091 
0092 static int simtec_audio_hermes_probe(struct platform_device *pd)
0093 {
0094     dev_info(&pd->dev, "probing....\n");
0095     return simtec_audio_core_probe(pd, &snd_soc_machine_simtec_aic33);
0096 }
0097 
0098 static struct platform_driver simtec_audio_hermes_platdrv = {
0099     .driver = {
0100         .name   = "s3c24xx-simtec-hermes-snd",
0101         .pm = simtec_audio_pm,
0102     },
0103     .probe  = simtec_audio_hermes_probe,
0104     .remove = simtec_audio_remove,
0105 };
0106 
0107 module_platform_driver(simtec_audio_hermes_platdrv);
0108 
0109 MODULE_ALIAS("platform:s3c24xx-simtec-hermes-snd");
0110 MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>");
0111 MODULE_DESCRIPTION("ALSA SoC Simtec Audio support");
0112 MODULE_LICENSE("GPL");