Linux-libre 5.3.12-gnu
[librecmc/linux-libre.git] / sound / soc / samsung / s3c24xx_simtec_tlv320aic23.c
1 // SPDX-License-Identifier: GPL-2.0
2 //
3 // Copyright 2009 Simtec Electronics
4
5 #include <linux/module.h>
6 #include <sound/soc.h>
7
8 #include "s3c24xx_simtec.h"
9
10 /* supported machines:
11  *
12  * Machine      Connections             AMP
13  * -------      -----------             ---
14  * BAST         MIC, HPOUT, LOUT, LIN   TPA2001D1 (HPOUTL,R) (gain hardwired)
15  * VR1000       HPOUT, LIN              None
16  * VR2000       LIN, LOUT, MIC, HP      LM4871 (HPOUTL,R)
17  * DePicture    LIN, LOUT, MIC, HP      LM4871 (HPOUTL,R)
18  * Anubis       LIN, LOUT, MIC, HP      TPA2001D1 (HPOUTL,R)
19  */
20
21 static const struct snd_soc_dapm_widget dapm_widgets[] = {
22         SND_SOC_DAPM_HP("Headphone Jack", NULL),
23         SND_SOC_DAPM_LINE("Line In", NULL),
24         SND_SOC_DAPM_LINE("Line Out", NULL),
25         SND_SOC_DAPM_MIC("Mic Jack", NULL),
26 };
27
28 static const struct snd_soc_dapm_route base_map[] = {
29         { "Headphone Jack", NULL, "LHPOUT"},
30         { "Headphone Jack", NULL, "RHPOUT"},
31
32         { "Line Out", NULL, "LOUT" },
33         { "Line Out", NULL, "ROUT" },
34
35         { "LLINEIN", NULL, "Line In"},
36         { "RLINEIN", NULL, "Line In"},
37
38         { "MICIN", NULL, "Mic Jack"},
39 };
40
41 /**
42  * simtec_tlv320aic23_init - initialise and add controls
43  * @codec; The codec instance to attach to.
44  *
45  * Attach our controls and configure the necessary codec
46  * mappings for our sound card instance.
47 */
48 static int simtec_tlv320aic23_init(struct snd_soc_pcm_runtime *rtd)
49 {
50         simtec_audio_init(rtd);
51
52         return 0;
53 }
54
55 SND_SOC_DAILINK_DEFS(tlv320aic23,
56         DAILINK_COMP_ARRAY(COMP_CPU("s3c24xx-iis")),
57         DAILINK_COMP_ARRAY(COMP_CODEC("tlv320aic3x-codec.0-001a",
58                                       "tlv320aic3x-hifi")),
59         DAILINK_COMP_ARRAY(COMP_PLATFORM("s3c24xx-iis")));
60
61 static struct snd_soc_dai_link simtec_dai_aic23 = {
62         .name           = "tlv320aic23",
63         .stream_name    = "TLV320AIC23",
64         .init           = simtec_tlv320aic23_init,
65         SND_SOC_DAILINK_REG(tlv320aic23),
66 };
67
68 /* simtec audio machine driver */
69 static struct snd_soc_card snd_soc_machine_simtec_aic23 = {
70         .name           = "Simtec",
71         .owner          = THIS_MODULE,
72         .dai_link       = &simtec_dai_aic23,
73         .num_links      = 1,
74
75         .dapm_widgets   = dapm_widgets,
76         .num_dapm_widgets = ARRAY_SIZE(dapm_widgets),
77         .dapm_routes    = base_map,
78         .num_dapm_routes = ARRAY_SIZE(base_map),
79 };
80
81 static int simtec_audio_tlv320aic23_probe(struct platform_device *pd)
82 {
83         return simtec_audio_core_probe(pd, &snd_soc_machine_simtec_aic23);
84 }
85
86 static struct platform_driver simtec_audio_tlv320aic23_driver = {
87         .driver = {
88                 .name   = "s3c24xx-simtec-tlv320aic23",
89                 .pm     = simtec_audio_pm,
90         },
91         .probe  = simtec_audio_tlv320aic23_probe,
92         .remove = simtec_audio_remove,
93 };
94
95 module_platform_driver(simtec_audio_tlv320aic23_driver);
96
97 MODULE_ALIAS("platform:s3c24xx-simtec-tlv320aic23");
98 MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>");
99 MODULE_DESCRIPTION("ALSA SoC Simtec Audio support");
100 MODULE_LICENSE("GPL");