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 static const struct snd_soc_dapm_widget dapm_widgets[] = {
11 SND_SOC_DAPM_LINE("GSM Out", NULL),
12 SND_SOC_DAPM_LINE("GSM In", NULL),
13 SND_SOC_DAPM_LINE("Line In", NULL),
14 SND_SOC_DAPM_LINE("Line Out", NULL),
15 SND_SOC_DAPM_LINE("ZV", NULL),
16 SND_SOC_DAPM_MIC("Mic Jack", NULL),
17 SND_SOC_DAPM_HP("Headphone Jack", NULL),
18 };
19
20 static const struct snd_soc_dapm_route base_map[] = {
21 /* Headphone connected to HP{L,R}OUT and HP{L,R}COM */
22
23 { "Headphone Jack", NULL, "HPLOUT" },
24 { "Headphone Jack", NULL, "HPLCOM" },
25 { "Headphone Jack", NULL, "HPROUT" },
26 { "Headphone Jack", NULL, "HPRCOM" },
27
28 /* ZV connected to Line1 */
29
30 { "LINE1L", NULL, "ZV" },
31 { "LINE1R", NULL, "ZV" },
32
33 /* Line In connected to Line2 */
34
35 { "LINE2L", NULL, "Line In" },
36 { "LINE2R", NULL, "Line In" },
37
38 /* Microphone connected to MIC3R and MIC_BIAS */
39
40 { "MIC3L", NULL, "Mic Jack" },
41
42 /* GSM connected to MONO_LOUT and MIC3L (in) */
43
44 { "GSM Out", NULL, "MONO_LOUT" },
45 { "MIC3L", NULL, "GSM In" },
46
47 /* Speaker is connected to LINEOUT{LN,LP,RN,RP}, however we are
48 * not using the DAPM to power it up and down as there it makes
49 * a click when powering up. */
50 };
51
52 /**
53 * simtec_hermes_init - initialise and add controls
54 * @codec; The codec instance to attach to.
55 *
56 * Attach our controls and configure the necessary codec
57 * mappings for our sound card instance.
58 */
simtec_hermes_init(struct snd_soc_pcm_runtime * rtd)59 static int simtec_hermes_init(struct snd_soc_pcm_runtime *rtd)
60 {
61 simtec_audio_init(rtd);
62
63 return 0;
64 }
65
66 SND_SOC_DAILINK_DEFS(tlv320aic33,
67 DAILINK_COMP_ARRAY(COMP_CPU("s3c24xx-iis")),
68 DAILINK_COMP_ARRAY(COMP_CODEC("tlv320aic3x-codec.0-001a",
69 "tlv320aic3x-hifi")),
70 DAILINK_COMP_ARRAY(COMP_PLATFORM("s3c24xx-iis")));
71
72 static struct snd_soc_dai_link simtec_dai_aic33 = {
73 .name = "tlv320aic33",
74 .stream_name = "TLV320AIC33",
75 .init = simtec_hermes_init,
76 SND_SOC_DAILINK_REG(tlv320aic33),
77 };
78
79 /* simtec audio machine driver */
80 static struct snd_soc_card snd_soc_machine_simtec_aic33 = {
81 .name = "Simtec-Hermes",
82 .owner = THIS_MODULE,
83 .dai_link = &simtec_dai_aic33,
84 .num_links = 1,
85
86 .dapm_widgets = dapm_widgets,
87 .num_dapm_widgets = ARRAY_SIZE(dapm_widgets),
88 .dapm_routes = base_map,
89 .num_dapm_routes = ARRAY_SIZE(base_map),
90 };
91
simtec_audio_hermes_probe(struct platform_device * pd)92 static int simtec_audio_hermes_probe(struct platform_device *pd)
93 {
94 dev_info(&pd->dev, "probing....\n");
95 return simtec_audio_core_probe(pd, &snd_soc_machine_simtec_aic33);
96 }
97
98 static struct platform_driver simtec_audio_hermes_platdrv = {
99 .driver = {
100 .name = "s3c24xx-simtec-hermes-snd",
101 .pm = simtec_audio_pm,
102 },
103 .probe = simtec_audio_hermes_probe,
104 .remove = simtec_audio_remove,
105 };
106
107 module_platform_driver(simtec_audio_hermes_platdrv);
108
109 MODULE_ALIAS("platform:s3c24xx-simtec-hermes-snd");
110 MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>");
111 MODULE_DESCRIPTION("ALSA SoC Simtec Audio support");
112 MODULE_LICENSE("GPL");
113