1 /* sound/soc/samsung/s3c24xx_simtec_hermes.c
3 * Copyright 2009 Simtec Electronics
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.
10 #include <linux/module.h>
11 #include <sound/soc.h>
13 #include "s3c24xx_simtec.h"
15 static const struct snd_soc_dapm_widget dapm_widgets
[] = {
16 SND_SOC_DAPM_LINE("GSM Out", NULL
),
17 SND_SOC_DAPM_LINE("GSM In", NULL
),
18 SND_SOC_DAPM_LINE("Line In", NULL
),
19 SND_SOC_DAPM_LINE("Line Out", NULL
),
20 SND_SOC_DAPM_LINE("ZV", NULL
),
21 SND_SOC_DAPM_MIC("Mic Jack", NULL
),
22 SND_SOC_DAPM_HP("Headphone Jack", NULL
),
25 static const struct snd_soc_dapm_route base_map
[] = {
26 /* Headphone connected to HP{L,R}OUT and HP{L,R}COM */
28 { "Headphone Jack", NULL
, "HPLOUT" },
29 { "Headphone Jack", NULL
, "HPLCOM" },
30 { "Headphone Jack", NULL
, "HPROUT" },
31 { "Headphone Jack", NULL
, "HPRCOM" },
33 /* ZV connected to Line1 */
35 { "LINE1L", NULL
, "ZV" },
36 { "LINE1R", NULL
, "ZV" },
38 /* Line In connected to Line2 */
40 { "LINE2L", NULL
, "Line In" },
41 { "LINE2R", NULL
, "Line In" },
43 /* Microphone connected to MIC3R and MIC_BIAS */
45 { "MIC3L", NULL
, "Mic Jack" },
47 /* GSM connected to MONO_LOUT and MIC3L (in) */
49 { "GSM Out", NULL
, "MONO_LOUT" },
50 { "MIC3L", NULL
, "GSM In" },
52 /* Speaker is connected to LINEOUT{LN,LP,RN,RP}, however we are
53 * not using the DAPM to power it up and down as there it makes
54 * a click when powering up. */
58 * simtec_hermes_init - initialise and add controls
59 * @codec; The codec instance to attach to.
61 * Attach our controls and configure the necessary codec
62 * mappings for our sound card instance.
64 static int simtec_hermes_init(struct snd_soc_pcm_runtime
*rtd
)
66 struct snd_soc_codec
*codec
= rtd
->codec
;
67 struct snd_soc_dapm_context
*dapm
= &codec
->dapm
;
69 snd_soc_dapm_enable_pin(dapm
, "Headphone Jack");
70 snd_soc_dapm_enable_pin(dapm
, "Line In");
71 snd_soc_dapm_enable_pin(dapm
, "Line Out");
72 snd_soc_dapm_enable_pin(dapm
, "Mic Jack");
74 simtec_audio_init(rtd
);
79 static struct snd_soc_dai_link simtec_dai_aic33
= {
80 .name
= "tlv320aic33",
81 .stream_name
= "TLV320AIC33",
82 .codec_name
= "tlv320aic3x-codec.0-001a",
83 .cpu_dai_name
= "s3c24xx-iis",
84 .codec_dai_name
= "tlv320aic3x-hifi",
85 .platform_name
= "samsung-audio",
86 .init
= simtec_hermes_init
,
89 /* simtec audio machine driver */
90 static struct snd_soc_card snd_soc_machine_simtec_aic33
= {
91 .name
= "Simtec-Hermes",
93 .dai_link
= &simtec_dai_aic33
,
96 .dapm_widgets
= dapm_widgets
,
97 .num_dapm_widgets
= ARRAY_SIZE(dapm_widgets
),
98 .dapm_routes
= base_map
,
99 .num_dapm_routes
= ARRAY_SIZE(base_map
),
102 static int __devinit
simtec_audio_hermes_probe(struct platform_device
*pd
)
104 dev_info(&pd
->dev
, "probing....\n");
105 return simtec_audio_core_probe(pd
, &snd_soc_machine_simtec_aic33
);
108 static struct platform_driver simtec_audio_hermes_platdrv
= {
110 .owner
= THIS_MODULE
,
111 .name
= "s3c24xx-simtec-hermes-snd",
112 .pm
= simtec_audio_pm
,
114 .probe
= simtec_audio_hermes_probe
,
115 .remove
= __devexit_p(simtec_audio_remove
),
118 module_platform_driver(simtec_audio_hermes_platdrv
);
120 MODULE_ALIAS("platform:s3c24xx-simtec-hermes-snd");
121 MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>");
122 MODULE_DESCRIPTION("ALSA SoC Simtec Audio support");
123 MODULE_LICENSE("GPL");