aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/s3c24xx/s3c24xx_simtec_hermes.c
diff options
context:
space:
mode:
authorBen Dooks <ben@simtec.co.uk>2009-08-20 17:50:43 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2009-08-21 05:53:06 -0400
commitb2ec22e2633996727f4f2abcd806aaeb0506dd6a (patch)
tree25b6c45cd3f420f179b0a49f3824c1abf72dbbc0 /sound/soc/s3c24xx/s3c24xx_simtec_hermes.c
parentaa6b904e66d5f484bd52763d63259b9a16f6e107 (diff)
ASoC: S3C24XX: Support for Simtec Hermes boards
Add support for the tlv320aic3x CODEC on the Simtec Hermes board. Signed-off-by: Ben Dooks <ben@simtec.co.uk> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/s3c24xx/s3c24xx_simtec_hermes.c')
-rw-r--r--sound/soc/s3c24xx/s3c24xx_simtec_hermes.c153
1 files changed, 153 insertions, 0 deletions
diff --git a/sound/soc/s3c24xx/s3c24xx_simtec_hermes.c b/sound/soc/s3c24xx/s3c24xx_simtec_hermes.c
new file mode 100644
index 000000000000..8346bd96eaf5
--- /dev/null
+++ b/sound/soc/s3c24xx/s3c24xx_simtec_hermes.c
@@ -0,0 +1,153 @@
1/* sound/soc/s3c24xx/s3c24xx_simtec_hermes.c
2 *
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
10#include <linux/module.h>
11#include <linux/clk.h>
12#include <linux/platform_device.h>
13
14#include <sound/core.h>
15#include <sound/pcm.h>
16#include <sound/soc.h>
17#include <sound/soc-dapm.h>
18
19#include <plat/audio-simtec.h>
20
21#include "s3c24xx-pcm.h"
22#include "s3c24xx-i2s.h"
23#include "s3c24xx_simtec.h"
24
25#include "../codecs/tlv320aic3x.h"
26
27static const struct snd_soc_dapm_widget dapm_widgets[] = {
28 SND_SOC_DAPM_LINE("GSM Out", NULL),
29 SND_SOC_DAPM_LINE("GSM In", NULL),
30 SND_SOC_DAPM_LINE("Line In", NULL),
31 SND_SOC_DAPM_LINE("Line Out", NULL),
32 SND_SOC_DAPM_LINE("ZV", NULL),
33 SND_SOC_DAPM_MIC("Mic Jack", NULL),
34 SND_SOC_DAPM_HP("Headphone Jack", NULL),
35};
36
37static const struct snd_soc_dapm_route base_map[] = {
38 /* Headphone connected to HP{L,R}OUT and HP{L,R}COM */
39
40 { "Headphone Jack", NULL, "HPLOUT" },
41 { "Headphone Jack", NULL, "HPLCOM" },
42 { "Headphone Jack", NULL, "HPROUT" },
43 { "Headphone Jack", NULL, "HPRCOM" },
44
45 /* ZV connected to Line1 */
46
47 { "LINE1L", NULL, "ZV" },
48 { "LINE1R", NULL, "ZV" },
49
50 /* Line In connected to Line2 */
51
52 { "LINE2L", NULL, "Line In" },
53 { "LINE2R", NULL, "Line In" },
54
55 /* Microphone connected to MIC3R and MIC_BIAS */
56
57 { "MIC3L", NULL, "Mic Jack" },
58
59 /* GSM connected to MONO_LOUT and MIC3L (in) */
60
61 { "GSM Out", NULL, "MONO_LOUT" },
62 { "MIC3L", NULL, "GSM In" },
63
64 /* Speaker is connected to LINEOUT{LN,LP,RN,RP}, however we are
65 * not using the DAPM to power it up and down as there it makes
66 * a click when powering up. */
67};
68
69/**
70 * simtec_hermes_init - initialise and add controls
71 * @codec; The codec instance to attach to.
72 *
73 * Attach our controls and configure the necessary codec
74 * mappings for our sound card instance.
75*/
76static int simtec_hermes_init(struct snd_soc_codec *codec)
77{
78 snd_soc_dapm_new_controls(codec, dapm_widgets,
79 ARRAY_SIZE(dapm_widgets));
80
81 snd_soc_dapm_add_routes(codec, base_map, ARRAY_SIZE(base_map));
82
83 snd_soc_dapm_enable_pin(codec, "Headphone Jack");
84 snd_soc_dapm_enable_pin(codec, "Line In");
85 snd_soc_dapm_enable_pin(codec, "Line Out");
86 snd_soc_dapm_enable_pin(codec, "Mic Jack");
87
88 simtec_audio_init(codec);
89 snd_soc_dapm_sync(codec);
90
91 return 0;
92}
93
94static struct aic3x_setup_data codec_setup = {
95};
96
97static struct snd_soc_dai_link simtec_dai_aic33 = {
98 .name = "tlv320aic33",
99 .stream_name = "TLV320AIC33",
100 .cpu_dai = &s3c24xx_i2s_dai,
101 .codec_dai = &aic3x_dai,
102 .init = simtec_hermes_init,
103};
104
105/* simtec audio machine driver */
106static struct snd_soc_card snd_soc_machine_simtec_aic33 = {
107 .name = "Simtec-Hermes",
108 .platform = &s3c24xx_soc_platform,
109 .dai_link = &simtec_dai_aic33,
110 .num_links = 1,
111};
112
113/* simtec audio subsystem */
114static struct snd_soc_device simtec_snd_devdata_aic33 = {
115 .card = &snd_soc_machine_simtec_aic33,
116 .codec_dev = &soc_codec_dev_aic3x,
117 .codec_data = &codec_setup,
118};
119
120static int __devinit simtec_audio_hermes_probe(struct platform_device *pd)
121{
122 dev_info(&pd->dev, "probing....\n");
123 return simtec_audio_core_probe(pd, &simtec_snd_devdata_aic33);
124}
125
126static struct platform_driver simtec_audio_hermes_platdrv = {
127 .driver = {
128 .owner = THIS_MODULE,
129 .name = "s3c24xx-simtec-hermes-snd",
130 .pm = simtec_audio_pm,
131 },
132 .probe = simtec_audio_hermes_probe,
133 .remove = __devexit_p(simtec_audio_remove),
134};
135
136MODULE_ALIAS("platform:s3c24xx-simtec-hermes-snd");
137
138static int __init simtec_hermes_modinit(void)
139{
140 return platform_driver_register(&simtec_audio_hermes_platdrv);
141}
142
143static void __exit simtec_hermes_modexit(void)
144{
145 platform_driver_unregister(&simtec_audio_hermes_platdrv);
146}
147
148module_init(simtec_hermes_modinit);
149module_exit(simtec_hermes_modexit);
150
151MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>");
152MODULE_DESCRIPTION("ALSA SoC Simtec Audio support");
153MODULE_LICENSE("GPL");