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 /* supported machines:
0011  *
0012  * Machine  Connections     AMP
0013  * -------  -----------     ---
0014  * BAST     MIC, HPOUT, LOUT, LIN   TPA2001D1 (HPOUTL,R) (gain hardwired)
0015  * VR1000   HPOUT, LIN      None
0016  * VR2000   LIN, LOUT, MIC, HP  LM4871 (HPOUTL,R)
0017  * DePicture    LIN, LOUT, MIC, HP  LM4871 (HPOUTL,R)
0018  * Anubis   LIN, LOUT, MIC, HP  TPA2001D1 (HPOUTL,R)
0019  */
0020 
0021 static const struct snd_soc_dapm_widget dapm_widgets[] = {
0022     SND_SOC_DAPM_HP("Headphone Jack", NULL),
0023     SND_SOC_DAPM_LINE("Line In", NULL),
0024     SND_SOC_DAPM_LINE("Line Out", NULL),
0025     SND_SOC_DAPM_MIC("Mic Jack", NULL),
0026 };
0027 
0028 static const struct snd_soc_dapm_route base_map[] = {
0029     { "Headphone Jack", NULL, "LHPOUT"},
0030     { "Headphone Jack", NULL, "RHPOUT"},
0031 
0032     { "Line Out", NULL, "LOUT" },
0033     { "Line Out", NULL, "ROUT" },
0034 
0035     { "LLINEIN", NULL, "Line In"},
0036     { "RLINEIN", NULL, "Line In"},
0037 
0038     { "MICIN", NULL, "Mic Jack"},
0039 };
0040 
0041 /**
0042  * simtec_tlv320aic23_init - initialise and add controls
0043  * @codec; The codec instance to attach to.
0044  *
0045  * Attach our controls and configure the necessary codec
0046  * mappings for our sound card instance.
0047 */
0048 static int simtec_tlv320aic23_init(struct snd_soc_pcm_runtime *rtd)
0049 {
0050     simtec_audio_init(rtd);
0051 
0052     return 0;
0053 }
0054 
0055 SND_SOC_DAILINK_DEFS(tlv320aic23,
0056     DAILINK_COMP_ARRAY(COMP_CPU("s3c24xx-iis")),
0057     DAILINK_COMP_ARRAY(COMP_CODEC("tlv320aic3x-codec.0-001a",
0058                       "tlv320aic3x-hifi")),
0059     DAILINK_COMP_ARRAY(COMP_PLATFORM("s3c24xx-iis")));
0060 
0061 static struct snd_soc_dai_link simtec_dai_aic23 = {
0062     .name       = "tlv320aic23",
0063     .stream_name    = "TLV320AIC23",
0064     .init       = simtec_tlv320aic23_init,
0065     SND_SOC_DAILINK_REG(tlv320aic23),
0066 };
0067 
0068 /* simtec audio machine driver */
0069 static struct snd_soc_card snd_soc_machine_simtec_aic23 = {
0070     .name       = "Simtec",
0071     .owner      = THIS_MODULE,
0072     .dai_link   = &simtec_dai_aic23,
0073     .num_links  = 1,
0074 
0075     .dapm_widgets   = dapm_widgets,
0076     .num_dapm_widgets = ARRAY_SIZE(dapm_widgets),
0077     .dapm_routes    = base_map,
0078     .num_dapm_routes = ARRAY_SIZE(base_map),
0079 };
0080 
0081 static int simtec_audio_tlv320aic23_probe(struct platform_device *pd)
0082 {
0083     return simtec_audio_core_probe(pd, &snd_soc_machine_simtec_aic23);
0084 }
0085 
0086 static struct platform_driver simtec_audio_tlv320aic23_driver = {
0087     .driver = {
0088         .name   = "s3c24xx-simtec-tlv320aic23",
0089         .pm = simtec_audio_pm,
0090     },
0091     .probe  = simtec_audio_tlv320aic23_probe,
0092     .remove = simtec_audio_remove,
0093 };
0094 
0095 module_platform_driver(simtec_audio_tlv320aic23_driver);
0096 
0097 MODULE_ALIAS("platform:s3c24xx-simtec-tlv320aic23");
0098 MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>");
0099 MODULE_DESCRIPTION("ALSA SoC Simtec Audio support");
0100 MODULE_LICENSE("GPL");