blob: ce6aef6041793b40ac1f8b494feea76ae3f14b90 [file] [log] [blame]
Jassi Brar5033f432010-11-22 15:37:25 +09001/* sound/soc/samsung/s3c24xx_simtec_hermes.c
Ben Dooksb2ec22e2009-08-20 22:50:43 +01002 *
3 * Copyright 2009 Simtec Electronics
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8*/
9
Ben Dooksb2ec22e2009-08-20 22:50:43 +010010#include <sound/soc.h>
Ben Dooksb2ec22e2009-08-20 22:50:43 +010011
Ben Dooksb2ec22e2009-08-20 22:50:43 +010012#include "s3c24xx_simtec.h"
13
Ben Dooksb2ec22e2009-08-20 22:50:43 +010014static const struct snd_soc_dapm_widget dapm_widgets[] = {
15 SND_SOC_DAPM_LINE("GSM Out", NULL),
16 SND_SOC_DAPM_LINE("GSM In", NULL),
17 SND_SOC_DAPM_LINE("Line In", NULL),
18 SND_SOC_DAPM_LINE("Line Out", NULL),
19 SND_SOC_DAPM_LINE("ZV", NULL),
20 SND_SOC_DAPM_MIC("Mic Jack", NULL),
21 SND_SOC_DAPM_HP("Headphone Jack", NULL),
22};
23
24static const struct snd_soc_dapm_route base_map[] = {
25 /* Headphone connected to HP{L,R}OUT and HP{L,R}COM */
26
27 { "Headphone Jack", NULL, "HPLOUT" },
28 { "Headphone Jack", NULL, "HPLCOM" },
29 { "Headphone Jack", NULL, "HPROUT" },
30 { "Headphone Jack", NULL, "HPRCOM" },
31
32 /* ZV connected to Line1 */
33
34 { "LINE1L", NULL, "ZV" },
35 { "LINE1R", NULL, "ZV" },
36
37 /* Line In connected to Line2 */
38
39 { "LINE2L", NULL, "Line In" },
40 { "LINE2R", NULL, "Line In" },
41
42 /* Microphone connected to MIC3R and MIC_BIAS */
43
44 { "MIC3L", NULL, "Mic Jack" },
45
46 /* GSM connected to MONO_LOUT and MIC3L (in) */
47
48 { "GSM Out", NULL, "MONO_LOUT" },
49 { "MIC3L", NULL, "GSM In" },
50
51 /* Speaker is connected to LINEOUT{LN,LP,RN,RP}, however we are
52 * not using the DAPM to power it up and down as there it makes
53 * a click when powering up. */
54};
55
56/**
57 * simtec_hermes_init - initialise and add controls
58 * @codec; The codec instance to attach to.
59 *
60 * Attach our controls and configure the necessary codec
61 * mappings for our sound card instance.
62*/
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +000063static int simtec_hermes_init(struct snd_soc_pcm_runtime *rtd)
Ben Dooksb2ec22e2009-08-20 22:50:43 +010064{
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +000065 struct snd_soc_codec *codec = rtd->codec;
Liam Girdwoodce6120c2010-11-05 15:53:46 +020066 struct snd_soc_dapm_context *dapm = &codec->dapm;
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +000067
Liam Girdwoodce6120c2010-11-05 15:53:46 +020068 snd_soc_dapm_new_controls(dapm, dapm_widgets,
Ben Dooksb2ec22e2009-08-20 22:50:43 +010069 ARRAY_SIZE(dapm_widgets));
70
Liam Girdwoodce6120c2010-11-05 15:53:46 +020071 snd_soc_dapm_add_routes(dapm, base_map, ARRAY_SIZE(base_map));
Ben Dooksb2ec22e2009-08-20 22:50:43 +010072
Liam Girdwoodce6120c2010-11-05 15:53:46 +020073 snd_soc_dapm_enable_pin(dapm, "Headphone Jack");
74 snd_soc_dapm_enable_pin(dapm, "Line In");
75 snd_soc_dapm_enable_pin(dapm, "Line Out");
76 snd_soc_dapm_enable_pin(dapm, "Mic Jack");
Ben Dooksb2ec22e2009-08-20 22:50:43 +010077
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +000078 simtec_audio_init(rtd);
Liam Girdwoodce6120c2010-11-05 15:53:46 +020079 snd_soc_dapm_sync(dapm);
Ben Dooksb2ec22e2009-08-20 22:50:43 +010080
81 return 0;
82}
83
Ben Dooksb2ec22e2009-08-20 22:50:43 +010084static struct snd_soc_dai_link simtec_dai_aic33 = {
85 .name = "tlv320aic33",
86 .stream_name = "TLV320AIC33",
Lars-Peter Clausen81d7da52011-01-24 22:09:22 +010087 .codec_name = "tlv320aic3x-codec.0-001a",
Lars-Peter Clausen518aa592011-01-24 22:12:42 +010088 .cpu_dai_name = "s3c24xx-iis",
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +000089 .codec_dai_name = "tlv320aic3x-hifi",
Jassi Brar58bb4072010-11-22 15:35:50 +090090 .platform_name = "samsung-audio",
Ben Dooksb2ec22e2009-08-20 22:50:43 +010091 .init = simtec_hermes_init,
92};
93
94/* simtec audio machine driver */
95static struct snd_soc_card snd_soc_machine_simtec_aic33 = {
96 .name = "Simtec-Hermes",
Ben Dooksb2ec22e2009-08-20 22:50:43 +010097 .dai_link = &simtec_dai_aic33,
98 .num_links = 1,
99};
100
Ben Dooksb2ec22e2009-08-20 22:50:43 +0100101static int __devinit simtec_audio_hermes_probe(struct platform_device *pd)
102{
103 dev_info(&pd->dev, "probing....\n");
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +0000104 return simtec_audio_core_probe(pd, &snd_soc_machine_simtec_aic33);
Ben Dooksb2ec22e2009-08-20 22:50:43 +0100105}
106
107static struct platform_driver simtec_audio_hermes_platdrv = {
108 .driver = {
109 .owner = THIS_MODULE,
110 .name = "s3c24xx-simtec-hermes-snd",
111 .pm = simtec_audio_pm,
112 },
113 .probe = simtec_audio_hermes_probe,
114 .remove = __devexit_p(simtec_audio_remove),
115};
116
117MODULE_ALIAS("platform:s3c24xx-simtec-hermes-snd");
118
119static int __init simtec_hermes_modinit(void)
120{
121 return platform_driver_register(&simtec_audio_hermes_platdrv);
122}
123
124static void __exit simtec_hermes_modexit(void)
125{
126 platform_driver_unregister(&simtec_audio_hermes_platdrv);
127}
128
129module_init(simtec_hermes_modinit);
130module_exit(simtec_hermes_modexit);
131
132MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>");
133MODULE_DESCRIPTION("ALSA SoC Simtec Audio support");
134MODULE_LICENSE("GPL");