diff options
author | Jassi Brar <jassi.brar@samsung.com> | 2010-11-22 01:35:36 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2010-11-23 09:02:11 -0500 |
commit | 3a56d0ca72f8fc47240849b83acacd1c92283b99 (patch) | |
tree | bdbbb0b2bcd6ca6079363b5e66a27ee284cf8ef2 /sound/soc/s3c24xx | |
parent | cbe80def41f2f12b1b4f8b5c4eb048d50d842d6e (diff) |
ASoC: Samsung: Remove redundant AQUILA driver
AQUILA and GONI are essentially the same h/w w.r.t ASoC.
They only differ by the fact that GONI has stereo speaker-out
whereas AQUILA has mono.
The difference can easily be handled in the same MACHINE driver
by making machine-specific runtime changes.
Signed-off-by: Jassi Brar <jassi.brar@samsung.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/s3c24xx')
-rw-r--r-- | sound/soc/s3c24xx/Kconfig | 17 | ||||
-rw-r--r-- | sound/soc/s3c24xx/Makefile | 4 | ||||
-rw-r--r-- | sound/soc/s3c24xx/aquila_wm8994.c | 295 | ||||
-rw-r--r-- | sound/soc/s3c24xx/goni_wm8994.c | 19 |
4 files changed, 23 insertions, 312 deletions
diff --git a/sound/soc/s3c24xx/Kconfig b/sound/soc/s3c24xx/Kconfig index d85bf8a0abb..226f831d46f 100644 --- a/sound/soc/s3c24xx/Kconfig +++ b/sound/soc/s3c24xx/Kconfig | |||
@@ -145,22 +145,13 @@ config SND_S3C64XX_SOC_SMARTQ | |||
145 | select SND_S3C64XX_SOC_I2S | 145 | select SND_S3C64XX_SOC_I2S |
146 | select SND_SOC_WM8750 | 146 | select SND_SOC_WM8750 |
147 | 147 | ||
148 | config SND_S5PC110_SOC_AQUILA_WM8994 | 148 | config SND_SOC_GONI_AQUILA_WM8994 |
149 | tristate "SoC I2S Audio support for AQUILA - WM8994" | 149 | tristate "SoC I2S Audio support for AQUILA/GONI - WM8994" |
150 | depends on SND_S3C24XX_SOC && MACH_AQUILA | 150 | depends on SND_S3C24XX_SOC && (MACH_GONI || MACH_AQUILA) |
151 | select SND_S3C64XX_SOC_I2S_V4 | 151 | select SND_S3C64XX_SOC_I2S_V4 |
152 | select SND_SOC_WM8994 | 152 | select SND_SOC_WM8994 |
153 | help | 153 | help |
154 | Say Y if you want to add support for SoC audio on aquila | 154 | Say Y if you want to add support for SoC audio on goni or aquila |
155 | with the WM8994. | ||
156 | |||
157 | config SND_S5PV210_SOC_GONI_WM8994 | ||
158 | tristate "SoC I2S Audio support for GONI - WM8994" | ||
159 | depends on SND_S3C24XX_SOC && MACH_GONI | ||
160 | select SND_S3C64XX_SOC_I2S_V4 | ||
161 | select SND_SOC_WM8994 | ||
162 | help | ||
163 | Say Y if you want to add support for SoC audio on goni | ||
164 | with the WM8994. | 155 | with the WM8994. |
165 | 156 | ||
166 | config SND_SOC_SMDK_SPDIF | 157 | config SND_SOC_SMDK_SPDIF |
diff --git a/sound/soc/s3c24xx/Makefile b/sound/soc/s3c24xx/Makefile index ee8f41d6df9..4e232f11243 100644 --- a/sound/soc/s3c24xx/Makefile +++ b/sound/soc/s3c24xx/Makefile | |||
@@ -33,7 +33,6 @@ snd-soc-rx1950-uda1380-objs := rx1950_uda1380.o | |||
33 | snd-soc-smdk64xx-wm8580-objs := smdk64xx_wm8580.o | 33 | snd-soc-smdk64xx-wm8580-objs := smdk64xx_wm8580.o |
34 | snd-soc-smdk-wm9713-objs := smdk_wm9713.o | 34 | snd-soc-smdk-wm9713-objs := smdk_wm9713.o |
35 | snd-soc-s3c64xx-smartq-wm8987-objs := smartq_wm8987.o | 35 | snd-soc-s3c64xx-smartq-wm8987-objs := smartq_wm8987.o |
36 | snd-soc-aquila-wm8994-objs := aquila_wm8994.o | ||
37 | snd-soc-goni-wm8994-objs := goni_wm8994.o | 36 | snd-soc-goni-wm8994-objs := goni_wm8994.o |
38 | snd-soc-smdk-spdif-objs := smdk_spdif.o | 37 | snd-soc-smdk-spdif-objs := smdk_spdif.o |
39 | 38 | ||
@@ -50,6 +49,5 @@ obj-$(CONFIG_SND_S3C24XX_SOC_RX1950_UDA1380) += snd-soc-rx1950-uda1380.o | |||
50 | obj-$(CONFIG_SND_S3C64XX_SOC_WM8580) += snd-soc-smdk64xx-wm8580.o | 49 | obj-$(CONFIG_SND_S3C64XX_SOC_WM8580) += snd-soc-smdk64xx-wm8580.o |
51 | obj-$(CONFIG_SND_SOC_SMDK_WM9713) += snd-soc-smdk-wm9713.o | 50 | obj-$(CONFIG_SND_SOC_SMDK_WM9713) += snd-soc-smdk-wm9713.o |
52 | obj-$(CONFIG_SND_S3C64XX_SOC_SMARTQ) += snd-soc-s3c64xx-smartq-wm8987.o | 51 | obj-$(CONFIG_SND_S3C64XX_SOC_SMARTQ) += snd-soc-s3c64xx-smartq-wm8987.o |
53 | obj-$(CONFIG_SND_S5PC110_SOC_AQUILA_WM8994) += snd-soc-aquila-wm8994.o | ||
54 | obj-$(CONFIG_SND_S5PV210_SOC_GONI_WM8994) += snd-soc-goni-wm8994.o | ||
55 | obj-$(CONFIG_SND_SOC_SMDK_SPDIF) += snd-soc-smdk-spdif.o | 52 | obj-$(CONFIG_SND_SOC_SMDK_SPDIF) += snd-soc-smdk-spdif.o |
53 | obj-$(CONFIG_SND_SOC_GONI_AQUILA_WM8994) += snd-soc-goni-wm8994.o | ||
diff --git a/sound/soc/s3c24xx/aquila_wm8994.c b/sound/soc/s3c24xx/aquila_wm8994.c deleted file mode 100644 index 0043e6296c9..00000000000 --- a/sound/soc/s3c24xx/aquila_wm8994.c +++ /dev/null | |||
@@ -1,295 +0,0 @@ | |||
1 | /* | ||
2 | * aquila_wm8994.c | ||
3 | * | ||
4 | * Copyright (C) 2010 Samsung Electronics Co.Ltd | ||
5 | * Author: Chanwoo Choi <cw00.choi@samsung.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify it | ||
8 | * under the terms of the GNU General Public License as published by the | ||
9 | * Free Software Foundation; either version 2 of the License, or (at your | ||
10 | * option) any later version. | ||
11 | * | ||
12 | */ | ||
13 | |||
14 | #include <linux/module.h> | ||
15 | #include <linux/moduleparam.h> | ||
16 | #include <linux/io.h> | ||
17 | #include <linux/platform_device.h> | ||
18 | #include <sound/soc.h> | ||
19 | #include <sound/jack.h> | ||
20 | #include <asm/mach-types.h> | ||
21 | #include <mach/gpio.h> | ||
22 | #include <mach/regs-clock.h> | ||
23 | |||
24 | #include <linux/mfd/wm8994/core.h> | ||
25 | #include <linux/mfd/wm8994/registers.h> | ||
26 | #include "../codecs/wm8994.h" | ||
27 | #include "s3c-dma.h" | ||
28 | #include "s3c64xx-i2s.h" | ||
29 | |||
30 | static struct snd_soc_card aquila; | ||
31 | static struct platform_device *aquila_snd_device; | ||
32 | |||
33 | /* 3.5 pie jack */ | ||
34 | static struct snd_soc_jack jack; | ||
35 | |||
36 | /* 3.5 pie jack detection DAPM pins */ | ||
37 | static struct snd_soc_jack_pin jack_pins[] = { | ||
38 | { | ||
39 | .pin = "Headset Mic", | ||
40 | .mask = SND_JACK_MICROPHONE, | ||
41 | }, { | ||
42 | .pin = "Headset Stereophone", | ||
43 | .mask = SND_JACK_HEADPHONE | SND_JACK_MECHANICAL | | ||
44 | SND_JACK_AVOUT, | ||
45 | }, | ||
46 | }; | ||
47 | |||
48 | /* 3.5 pie jack detection gpios */ | ||
49 | static struct snd_soc_jack_gpio jack_gpios[] = { | ||
50 | { | ||
51 | .gpio = S5PV210_GPH0(6), | ||
52 | .name = "DET_3.5", | ||
53 | .report = SND_JACK_HEADSET | SND_JACK_MECHANICAL | | ||
54 | SND_JACK_AVOUT, | ||
55 | .debounce_time = 200, | ||
56 | }, | ||
57 | }; | ||
58 | |||
59 | static const struct snd_soc_dapm_widget aquila_dapm_widgets[] = { | ||
60 | SND_SOC_DAPM_SPK("Ext Spk", NULL), | ||
61 | SND_SOC_DAPM_SPK("Ext Rcv", NULL), | ||
62 | SND_SOC_DAPM_HP("Headset Stereophone", NULL), | ||
63 | SND_SOC_DAPM_MIC("Headset Mic", NULL), | ||
64 | SND_SOC_DAPM_MIC("Main Mic", NULL), | ||
65 | SND_SOC_DAPM_MIC("2nd Mic", NULL), | ||
66 | SND_SOC_DAPM_LINE("Radio In", NULL), | ||
67 | }; | ||
68 | |||
69 | static const struct snd_soc_dapm_route aquila_dapm_routes[] = { | ||
70 | {"Ext Spk", NULL, "SPKOUTLP"}, | ||
71 | {"Ext Spk", NULL, "SPKOUTLN"}, | ||
72 | |||
73 | {"Ext Rcv", NULL, "HPOUT2N"}, | ||
74 | {"Ext Rcv", NULL, "HPOUT2P"}, | ||
75 | |||
76 | {"Headset Stereophone", NULL, "HPOUT1L"}, | ||
77 | {"Headset Stereophone", NULL, "HPOUT1R"}, | ||
78 | |||
79 | {"IN1RN", NULL, "Headset Mic"}, | ||
80 | {"IN1RP", NULL, "Headset Mic"}, | ||
81 | |||
82 | {"IN1RN", NULL, "2nd Mic"}, | ||
83 | {"IN1RP", NULL, "2nd Mic"}, | ||
84 | |||
85 | {"IN1LN", NULL, "Main Mic"}, | ||
86 | {"IN1LP", NULL, "Main Mic"}, | ||
87 | |||
88 | {"IN2LN", NULL, "Radio In"}, | ||
89 | {"IN2RN", NULL, "Radio In"}, | ||
90 | }; | ||
91 | |||
92 | static int aquila_wm8994_init(struct snd_soc_pcm_runtime *rtd) | ||
93 | { | ||
94 | struct snd_soc_codec *codec = rtd->codec; | ||
95 | struct snd_soc_dapm_context *dapm = &codec->dapm; | ||
96 | int ret; | ||
97 | |||
98 | /* add aquila specific widgets */ | ||
99 | snd_soc_dapm_new_controls(dapm, aquila_dapm_widgets, | ||
100 | ARRAY_SIZE(aquila_dapm_widgets)); | ||
101 | |||
102 | /* set up aquila specific audio routes */ | ||
103 | snd_soc_dapm_add_routes(dapm, aquila_dapm_routes, | ||
104 | ARRAY_SIZE(aquila_dapm_routes)); | ||
105 | |||
106 | /* set endpoints to not connected */ | ||
107 | snd_soc_dapm_nc_pin(dapm, "IN2LP:VXRN"); | ||
108 | snd_soc_dapm_nc_pin(dapm, "IN2RP:VXRP"); | ||
109 | snd_soc_dapm_nc_pin(dapm, "LINEOUT1N"); | ||
110 | snd_soc_dapm_nc_pin(dapm, "LINEOUT1P"); | ||
111 | snd_soc_dapm_nc_pin(dapm, "LINEOUT2N"); | ||
112 | snd_soc_dapm_nc_pin(dapm, "LINEOUT2P"); | ||
113 | snd_soc_dapm_nc_pin(dapm, "SPKOUTRN"); | ||
114 | snd_soc_dapm_nc_pin(dapm, "SPKOUTRP"); | ||
115 | |||
116 | snd_soc_dapm_sync(dapm); | ||
117 | |||
118 | /* Headset jack detection */ | ||
119 | ret = snd_soc_jack_new(&aquila, "Headset Jack", | ||
120 | SND_JACK_HEADSET | SND_JACK_MECHANICAL | SND_JACK_AVOUT, | ||
121 | &jack); | ||
122 | if (ret) | ||
123 | return ret; | ||
124 | |||
125 | ret = snd_soc_jack_add_pins(&jack, ARRAY_SIZE(jack_pins), jack_pins); | ||
126 | if (ret) | ||
127 | return ret; | ||
128 | |||
129 | ret = snd_soc_jack_add_gpios(&jack, ARRAY_SIZE(jack_gpios), jack_gpios); | ||
130 | if (ret) | ||
131 | return ret; | ||
132 | |||
133 | return 0; | ||
134 | } | ||
135 | |||
136 | static int aquila_hifi_hw_params(struct snd_pcm_substream *substream, | ||
137 | struct snd_pcm_hw_params *params) | ||
138 | { | ||
139 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | ||
140 | struct snd_soc_dai *codec_dai = rtd->codec_dai; | ||
141 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; | ||
142 | unsigned int pll_out = 24000000; | ||
143 | int ret = 0; | ||
144 | |||
145 | /* set the cpu DAI configuration */ | ||
146 | ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S | | ||
147 | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM); | ||
148 | if (ret < 0) | ||
149 | return ret; | ||
150 | |||
151 | /* set the cpu system clock */ | ||
152 | ret = snd_soc_dai_set_sysclk(cpu_dai, S3C64XX_CLKSRC_PCLK, | ||
153 | 0, SND_SOC_CLOCK_IN); | ||
154 | if (ret < 0) | ||
155 | return ret; | ||
156 | |||
157 | /* set codec DAI configuration */ | ||
158 | ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S | | ||
159 | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM); | ||
160 | if (ret < 0) | ||
161 | return ret; | ||
162 | |||
163 | /* set the codec FLL */ | ||
164 | ret = snd_soc_dai_set_pll(codec_dai, WM8994_FLL1, 0, pll_out, | ||
165 | params_rate(params) * 256); | ||
166 | if (ret < 0) | ||
167 | return ret; | ||
168 | |||
169 | /* set the codec system clock */ | ||
170 | ret = snd_soc_dai_set_sysclk(codec_dai, WM8994_SYSCLK_FLL1, | ||
171 | params_rate(params) * 256, SND_SOC_CLOCK_IN); | ||
172 | if (ret < 0) | ||
173 | return ret; | ||
174 | |||
175 | return 0; | ||
176 | } | ||
177 | |||
178 | static struct snd_soc_ops aquila_hifi_ops = { | ||
179 | .hw_params = aquila_hifi_hw_params, | ||
180 | }; | ||
181 | |||
182 | static int aquila_voice_hw_params(struct snd_pcm_substream *substream, | ||
183 | struct snd_pcm_hw_params *params) | ||
184 | { | ||
185 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | ||
186 | struct snd_soc_dai *codec_dai = rtd->codec_dai; | ||
187 | unsigned int pll_out = 24000000; | ||
188 | int ret = 0; | ||
189 | |||
190 | if (params_rate(params) != 8000) | ||
191 | return -EINVAL; | ||
192 | |||
193 | /* set codec DAI configuration */ | ||
194 | ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_LEFT_J | | ||
195 | SND_SOC_DAIFMT_IB_IF | SND_SOC_DAIFMT_CBM_CFM); | ||
196 | if (ret < 0) | ||
197 | return ret; | ||
198 | |||
199 | /* set the codec FLL */ | ||
200 | ret = snd_soc_dai_set_pll(codec_dai, WM8994_FLL2, 0, pll_out, | ||
201 | params_rate(params) * 256); | ||
202 | if (ret < 0) | ||
203 | return ret; | ||
204 | |||
205 | /* set the codec system clock */ | ||
206 | ret = snd_soc_dai_set_sysclk(codec_dai, WM8994_SYSCLK_FLL2, | ||
207 | params_rate(params) * 256, SND_SOC_CLOCK_IN); | ||
208 | if (ret < 0) | ||
209 | return ret; | ||
210 | |||
211 | return 0; | ||
212 | } | ||
213 | |||
214 | static struct snd_soc_dai_driver voice_dai = { | ||
215 | .name = "aquila-voice-dai", | ||
216 | .playback = { | ||
217 | .channels_min = 1, | ||
218 | .channels_max = 2, | ||
219 | .rates = SNDRV_PCM_RATE_8000, | ||
220 | .formats = SNDRV_PCM_FMTBIT_S16_LE,}, | ||
221 | .capture = { | ||
222 | .channels_min = 1, | ||
223 | .channels_max = 2, | ||
224 | .rates = SNDRV_PCM_RATE_8000, | ||
225 | .formats = SNDRV_PCM_FMTBIT_S16_LE,}, | ||
226 | }; | ||
227 | |||
228 | static struct snd_soc_ops aquila_voice_ops = { | ||
229 | .hw_params = aquila_voice_hw_params, | ||
230 | }; | ||
231 | |||
232 | static struct snd_soc_dai_link aquila_dai[] = { | ||
233 | { | ||
234 | .name = "WM8994", | ||
235 | .stream_name = "WM8994 HiFi", | ||
236 | .cpu_dai_name = "s3c64xx-i2s-v4", | ||
237 | .codec_dai_name = "wm8994-hifi", | ||
238 | .platform_name = "s3c24xx-pcm-audio", | ||
239 | .codec_name = "wm8994-codec.0-0x1a", | ||
240 | .init = aquila_wm8994_init, | ||
241 | .ops = &aquila_hifi_ops, | ||
242 | }, { | ||
243 | .name = "WM8994 Voice", | ||
244 | .stream_name = "Voice", | ||
245 | .cpu_dai_name = "aquila-voice-dai", | ||
246 | .codec_dai_name = "wm8994-voice", | ||
247 | .platform_name = "s3c24xx-pcm-audio", | ||
248 | .codec_name = "wm8994-codec.0-0x1a", | ||
249 | .ops = &aquila_voice_ops, | ||
250 | }, | ||
251 | }; | ||
252 | |||
253 | static struct snd_soc_card aquila = { | ||
254 | .name = "aquila", | ||
255 | .dai_link = aquila_dai, | ||
256 | .num_links = ARRAY_SIZE(aquila_dai), | ||
257 | }; | ||
258 | |||
259 | static int __init aquila_init(void) | ||
260 | { | ||
261 | int ret; | ||
262 | |||
263 | if (!machine_is_aquila()) | ||
264 | return -ENODEV; | ||
265 | |||
266 | aquila_snd_device = platform_device_alloc("soc-audio", -1); | ||
267 | if (!aquila_snd_device) | ||
268 | return -ENOMEM; | ||
269 | |||
270 | /* register voice DAI here */ | ||
271 | ret = snd_soc_register_dai(&aquila_snd_device->dev, &voice_dai); | ||
272 | if (ret) | ||
273 | return ret; | ||
274 | |||
275 | platform_set_drvdata(aquila_snd_device, &aquila); | ||
276 | ret = platform_device_add(aquila_snd_device); | ||
277 | |||
278 | if (ret) | ||
279 | platform_device_put(aquila_snd_device); | ||
280 | |||
281 | return ret; | ||
282 | } | ||
283 | |||
284 | static void __exit aquila_exit(void) | ||
285 | { | ||
286 | platform_device_unregister(aquila_snd_device); | ||
287 | } | ||
288 | |||
289 | module_init(aquila_init); | ||
290 | module_exit(aquila_exit); | ||
291 | |||
292 | /* Module information */ | ||
293 | MODULE_DESCRIPTION("ALSA SoC WM8994 Aquila(S5PC110)"); | ||
294 | MODULE_AUTHOR("Chanwoo Choi <cw00.choi@samsung.com>"); | ||
295 | MODULE_LICENSE("GPL"); | ||
diff --git a/sound/soc/s3c24xx/goni_wm8994.c b/sound/soc/s3c24xx/goni_wm8994.c index bcbfe8534f3..62134ed3aa5 100644 --- a/sound/soc/s3c24xx/goni_wm8994.c +++ b/sound/soc/s3c24xx/goni_wm8994.c | |||
@@ -27,6 +27,14 @@ | |||
27 | #include "s3c-dma.h" | 27 | #include "s3c-dma.h" |
28 | #include "s3c64xx-i2s.h" | 28 | #include "s3c64xx-i2s.h" |
29 | 29 | ||
30 | #define MACHINE_NAME 0 | ||
31 | #define CPU_VOICE_DAI 1 | ||
32 | |||
33 | static const char *aquila_str[] = { | ||
34 | [MACHINE_NAME] = "aquila", | ||
35 | [CPU_VOICE_DAI] = "aquila-voice-dai", | ||
36 | }; | ||
37 | |||
30 | static struct snd_soc_card goni; | 38 | static struct snd_soc_card goni; |
31 | static struct platform_device *goni_snd_device; | 39 | static struct platform_device *goni_snd_device; |
32 | 40 | ||
@@ -115,6 +123,11 @@ static int goni_wm8994_init(struct snd_soc_pcm_runtime *rtd) | |||
115 | snd_soc_dapm_nc_pin(dapm, "LINEOUT2N"); | 123 | snd_soc_dapm_nc_pin(dapm, "LINEOUT2N"); |
116 | snd_soc_dapm_nc_pin(dapm, "LINEOUT2P"); | 124 | snd_soc_dapm_nc_pin(dapm, "LINEOUT2P"); |
117 | 125 | ||
126 | if (machine_is_aquila()) { | ||
127 | snd_soc_dapm_nc_pin(dapm, "SPKOUTRN"); | ||
128 | snd_soc_dapm_nc_pin(dapm, "SPKOUTRP"); | ||
129 | } | ||
130 | |||
118 | snd_soc_dapm_sync(dapm); | 131 | snd_soc_dapm_sync(dapm); |
119 | 132 | ||
120 | /* Headset jack detection */ | 133 | /* Headset jack detection */ |
@@ -263,7 +276,11 @@ static int __init goni_init(void) | |||
263 | { | 276 | { |
264 | int ret; | 277 | int ret; |
265 | 278 | ||
266 | if (!machine_is_goni()) | 279 | if (machine_is_aquila()) { |
280 | voice_dai.name = aquila_str[CPU_VOICE_DAI]; | ||
281 | goni_dai[1].cpu_dai_name = aquila_str[CPU_VOICE_DAI]; | ||
282 | goni.name = aquila_str[MACHINE_NAME]; | ||
283 | } else if (!machine_is_goni()) | ||
267 | return -ENODEV; | 284 | return -ENODEV; |
268 | 285 | ||
269 | goni_snd_device = platform_device_alloc("soc-audio", -1); | 286 | goni_snd_device = platform_device_alloc("soc-audio", -1); |