Merge tag 'armsoc-soc' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc
[linux-2.6-microblaze.git] / sound / soc / samsung / s3c24xx_simtec_hermes.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 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 */
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 static struct snd_soc_dai_link simtec_dai_aic33 = {
67         .name           = "tlv320aic33",
68         .stream_name    = "TLV320AIC33",
69         .codec_name     = "tlv320aic3x-codec.0-001a",
70         .cpu_dai_name   = "s3c24xx-iis",
71         .codec_dai_name = "tlv320aic3x-hifi",
72         .platform_name  = "s3c24xx-iis",
73         .init           = simtec_hermes_init,
74 };
75
76 /* simtec audio machine driver */
77 static struct snd_soc_card snd_soc_machine_simtec_aic33 = {
78         .name           = "Simtec-Hermes",
79         .owner          = THIS_MODULE,
80         .dai_link       = &simtec_dai_aic33,
81         .num_links      = 1,
82
83         .dapm_widgets   = dapm_widgets,
84         .num_dapm_widgets = ARRAY_SIZE(dapm_widgets),
85         .dapm_routes    = base_map,
86         .num_dapm_routes = ARRAY_SIZE(base_map),
87 };
88
89 static int simtec_audio_hermes_probe(struct platform_device *pd)
90 {
91         dev_info(&pd->dev, "probing....\n");
92         return simtec_audio_core_probe(pd, &snd_soc_machine_simtec_aic33);
93 }
94
95 static struct platform_driver simtec_audio_hermes_platdrv = {
96         .driver = {
97                 .name   = "s3c24xx-simtec-hermes-snd",
98                 .pm     = simtec_audio_pm,
99         },
100         .probe  = simtec_audio_hermes_probe,
101         .remove = simtec_audio_remove,
102 };
103
104 module_platform_driver(simtec_audio_hermes_platdrv);
105
106 MODULE_ALIAS("platform:s3c24xx-simtec-hermes-snd");
107 MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>");
108 MODULE_DESCRIPTION("ALSA SoC Simtec Audio support");
109 MODULE_LICENSE("GPL");