diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2010-08-12 09:40:28 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2010-08-12 09:40:28 -0400 |
commit | cf7af01aa77ec1b17687f5328ce0a598709efd59 (patch) | |
tree | 4cc46339721366c7498dacf5ebac01906be273e7 /sound/soc/s3c24xx | |
parent | 6f341d14811550d863ba804ce6ec7757a7145081 (diff) | |
parent | 5dcba5d6741d4533e0ef696507f93f2a4c738efb (diff) |
Merge branch 'topic/multi-component' of git://git.kernel.org/pub/scm/linux/kernel/git/lrg/asoc-2.6 into for-2.6.37
Diffstat (limited to 'sound/soc/s3c24xx')
31 files changed, 1105 insertions, 440 deletions
diff --git a/sound/soc/s3c24xx/Kconfig b/sound/soc/s3c24xx/Kconfig index 213963ac3c28..1cdc37bd58f4 100644 --- a/sound/soc/s3c24xx/Kconfig +++ b/sound/soc/s3c24xx/Kconfig | |||
@@ -131,3 +131,21 @@ config SND_S3C64XX_SOC_SMARTQ | |||
131 | depends on SND_S3C24XX_SOC && MACH_SMARTQ | 131 | depends on SND_S3C24XX_SOC && MACH_SMARTQ |
132 | select SND_S3C64XX_SOC_I2S | 132 | select SND_S3C64XX_SOC_I2S |
133 | select SND_SOC_WM8750 | 133 | select SND_SOC_WM8750 |
134 | |||
135 | config SND_S5PC110_SOC_AQUILA_WM8994 | ||
136 | tristate "SoC I2S Audio support for AQUILA - WM8994" | ||
137 | depends on SND_S3C24XX_SOC && MACH_AQUILA | ||
138 | select SND_S3C64XX_SOC_I2S_V4 | ||
139 | select SND_SOC_WM8994 | ||
140 | help | ||
141 | Say Y if you want to add support for SoC audio on aquila | ||
142 | with the WM8994. | ||
143 | |||
144 | config SND_S5PV210_SOC_GONI_WM8994 | ||
145 | tristate "SoC I2S Audio support for GONI - WM8994" | ||
146 | depends on SND_S3C24XX_SOC && MACH_GONI | ||
147 | select SND_S3C64XX_SOC_I2S_V4 | ||
148 | select SND_SOC_WM8994 | ||
149 | help | ||
150 | Say Y if you want to add support for SoC audio on goni | ||
151 | with the WM8994. | ||
diff --git a/sound/soc/s3c24xx/Makefile b/sound/soc/s3c24xx/Makefile index 50172c385d90..47ed6d70b90b 100644 --- a/sound/soc/s3c24xx/Makefile +++ b/sound/soc/s3c24xx/Makefile | |||
@@ -30,6 +30,8 @@ snd-soc-s3c24xx-simtec-tlv320aic23-objs := s3c24xx_simtec_tlv320aic23.o | |||
30 | snd-soc-smdk64xx-wm8580-objs := smdk64xx_wm8580.o | 30 | snd-soc-smdk64xx-wm8580-objs := smdk64xx_wm8580.o |
31 | snd-soc-smdk-wm9713-objs := smdk_wm9713.o | 31 | snd-soc-smdk-wm9713-objs := smdk_wm9713.o |
32 | snd-soc-s3c64xx-smartq-wm8987-objs := smartq_wm8987.o | 32 | snd-soc-s3c64xx-smartq-wm8987-objs := smartq_wm8987.o |
33 | snd-soc-aquila-wm8994-objs := aquila_wm8994.o | ||
34 | snd-soc-goni-wm8994-objs := goni_wm8994.o | ||
33 | 35 | ||
34 | obj-$(CONFIG_SND_S3C24XX_SOC_JIVE_WM8750) += snd-soc-jive-wm8750.o | 36 | obj-$(CONFIG_SND_S3C24XX_SOC_JIVE_WM8750) += snd-soc-jive-wm8750.o |
35 | obj-$(CONFIG_SND_S3C24XX_SOC_NEO1973_WM8753) += snd-soc-neo1973-wm8753.o | 37 | obj-$(CONFIG_SND_S3C24XX_SOC_NEO1973_WM8753) += snd-soc-neo1973-wm8753.o |
@@ -43,3 +45,5 @@ obj-$(CONFIG_SND_S3C24XX_SOC_SIMTEC_TLV320AIC23) += snd-soc-s3c24xx-simtec-tlv32 | |||
43 | obj-$(CONFIG_SND_S3C64XX_SOC_WM8580) += snd-soc-smdk64xx-wm8580.o | 45 | obj-$(CONFIG_SND_S3C64XX_SOC_WM8580) += snd-soc-smdk64xx-wm8580.o |
44 | obj-$(CONFIG_SND_SOC_SMDK_WM9713) += snd-soc-smdk-wm9713.o | 46 | obj-$(CONFIG_SND_SOC_SMDK_WM9713) += snd-soc-smdk-wm9713.o |
45 | obj-$(CONFIG_SND_S3C64XX_SOC_SMARTQ) += snd-soc-s3c64xx-smartq-wm8987.o | 47 | obj-$(CONFIG_SND_S3C64XX_SOC_SMARTQ) += snd-soc-s3c64xx-smartq-wm8987.o |
48 | obj-$(CONFIG_SND_S5PC110_SOC_AQUILA_WM8994) += snd-soc-aquila-wm8994.o | ||
49 | obj-$(CONFIG_SND_S5PV210_SOC_GONI_WM8994) += snd-soc-goni-wm8994.o | ||
diff --git a/sound/soc/s3c24xx/aquila_wm8994.c b/sound/soc/s3c24xx/aquila_wm8994.c new file mode 100644 index 000000000000..235d1973f7d0 --- /dev/null +++ b/sound/soc/s3c24xx/aquila_wm8994.c | |||
@@ -0,0 +1,295 @@ | |||
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/soc-dapm.h> | ||
20 | #include <sound/jack.h> | ||
21 | #include <asm/mach-types.h> | ||
22 | #include <mach/gpio.h> | ||
23 | #include <mach/regs-clock.h> | ||
24 | |||
25 | #include <linux/mfd/wm8994/core.h> | ||
26 | #include <linux/mfd/wm8994/registers.h> | ||
27 | #include "../codecs/wm8994.h" | ||
28 | #include "s3c-dma.h" | ||
29 | #include "s3c64xx-i2s.h" | ||
30 | |||
31 | static struct snd_soc_card aquila; | ||
32 | static struct platform_device *aquila_snd_device; | ||
33 | |||
34 | /* 3.5 pie jack */ | ||
35 | static struct snd_soc_jack jack; | ||
36 | |||
37 | /* 3.5 pie jack detection DAPM pins */ | ||
38 | static struct snd_soc_jack_pin jack_pins[] = { | ||
39 | { | ||
40 | .pin = "Headset Mic", | ||
41 | .mask = SND_JACK_MICROPHONE, | ||
42 | }, { | ||
43 | .pin = "Headset Stereophone", | ||
44 | .mask = SND_JACK_HEADPHONE | SND_JACK_MECHANICAL | | ||
45 | SND_JACK_AVOUT, | ||
46 | }, | ||
47 | }; | ||
48 | |||
49 | /* 3.5 pie jack detection gpios */ | ||
50 | static struct snd_soc_jack_gpio jack_gpios[] = { | ||
51 | { | ||
52 | .gpio = S5PV210_GPH0(6), | ||
53 | .name = "DET_3.5", | ||
54 | .report = SND_JACK_HEADSET | SND_JACK_MECHANICAL | | ||
55 | SND_JACK_AVOUT, | ||
56 | .debounce_time = 200, | ||
57 | }, | ||
58 | }; | ||
59 | |||
60 | static const struct snd_soc_dapm_widget aquila_dapm_widgets[] = { | ||
61 | SND_SOC_DAPM_SPK("Ext Spk", NULL), | ||
62 | SND_SOC_DAPM_SPK("Ext Rcv", NULL), | ||
63 | SND_SOC_DAPM_HP("Headset Stereophone", NULL), | ||
64 | SND_SOC_DAPM_MIC("Headset Mic", NULL), | ||
65 | SND_SOC_DAPM_MIC("Main Mic", NULL), | ||
66 | SND_SOC_DAPM_MIC("2nd Mic", NULL), | ||
67 | SND_SOC_DAPM_LINE("Radio In", NULL), | ||
68 | }; | ||
69 | |||
70 | static const struct snd_soc_dapm_route aquila_dapm_routes[] = { | ||
71 | {"Ext Spk", NULL, "SPKOUTLP"}, | ||
72 | {"Ext Spk", NULL, "SPKOUTLN"}, | ||
73 | |||
74 | {"Ext Rcv", NULL, "HPOUT2N"}, | ||
75 | {"Ext Rcv", NULL, "HPOUT2P"}, | ||
76 | |||
77 | {"Headset Stereophone", NULL, "HPOUT1L"}, | ||
78 | {"Headset Stereophone", NULL, "HPOUT1R"}, | ||
79 | |||
80 | {"IN1RN", NULL, "Headset Mic"}, | ||
81 | {"IN1RP", NULL, "Headset Mic"}, | ||
82 | |||
83 | {"IN1RN", NULL, "2nd Mic"}, | ||
84 | {"IN1RP", NULL, "2nd Mic"}, | ||
85 | |||
86 | {"IN1LN", NULL, "Main Mic"}, | ||
87 | {"IN1LP", NULL, "Main Mic"}, | ||
88 | |||
89 | {"IN2LN", NULL, "Radio In"}, | ||
90 | {"IN2RN", NULL, "Radio In"}, | ||
91 | }; | ||
92 | |||
93 | static int aquila_wm8994_init(struct snd_soc_pcm_runtime *rtd) | ||
94 | { | ||
95 | struct snd_soc_codec *codec = rtd->codec; | ||
96 | int ret; | ||
97 | |||
98 | /* add aquila specific widgets */ | ||
99 | snd_soc_dapm_new_controls(codec, aquila_dapm_widgets, | ||
100 | ARRAY_SIZE(aquila_dapm_widgets)); | ||
101 | |||
102 | /* set up aquila specific audio routes */ | ||
103 | snd_soc_dapm_add_routes(codec, aquila_dapm_routes, | ||
104 | ARRAY_SIZE(aquila_dapm_routes)); | ||
105 | |||
106 | /* set endpoints to not connected */ | ||
107 | snd_soc_dapm_nc_pin(codec, "IN2LP:VXRN"); | ||
108 | snd_soc_dapm_nc_pin(codec, "IN2RP:VXRP"); | ||
109 | snd_soc_dapm_nc_pin(codec, "LINEOUT1N"); | ||
110 | snd_soc_dapm_nc_pin(codec, "LINEOUT1P"); | ||
111 | snd_soc_dapm_nc_pin(codec, "LINEOUT2N"); | ||
112 | snd_soc_dapm_nc_pin(codec, "LINEOUT2P"); | ||
113 | snd_soc_dapm_nc_pin(codec, "SPKOUTRN"); | ||
114 | snd_soc_dapm_nc_pin(codec, "SPKOUTRP"); | ||
115 | |||
116 | snd_soc_dapm_sync(codec); | ||
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 new file mode 100644 index 000000000000..694f702cc8e2 --- /dev/null +++ b/sound/soc/s3c24xx/goni_wm8994.c | |||
@@ -0,0 +1,298 @@ | |||
1 | /* | ||
2 | * goni_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/soc-dapm.h> | ||
20 | #include <sound/jack.h> | ||
21 | #include <asm/mach-types.h> | ||
22 | #include <mach/gpio.h> | ||
23 | #include <mach/regs-clock.h> | ||
24 | |||
25 | #include <linux/mfd/wm8994/core.h> | ||
26 | #include <linux/mfd/wm8994/registers.h> | ||
27 | #include "../codecs/wm8994.h" | ||
28 | #include "s3c-dma.h" | ||
29 | #include "s3c64xx-i2s.h" | ||
30 | |||
31 | static struct snd_soc_card goni; | ||
32 | static struct platform_device *goni_snd_device; | ||
33 | |||
34 | /* 3.5 pie jack */ | ||
35 | static struct snd_soc_jack jack; | ||
36 | |||
37 | /* 3.5 pie jack detection DAPM pins */ | ||
38 | static struct snd_soc_jack_pin jack_pins[] = { | ||
39 | { | ||
40 | .pin = "Headset Mic", | ||
41 | .mask = SND_JACK_MICROPHONE, | ||
42 | }, { | ||
43 | .pin = "Headset Stereophone", | ||
44 | .mask = SND_JACK_HEADPHONE | SND_JACK_MECHANICAL | | ||
45 | SND_JACK_AVOUT, | ||
46 | }, | ||
47 | }; | ||
48 | |||
49 | /* 3.5 pie jack detection gpios */ | ||
50 | static struct snd_soc_jack_gpio jack_gpios[] = { | ||
51 | { | ||
52 | .gpio = S5PV210_GPH0(6), | ||
53 | .name = "DET_3.5", | ||
54 | .report = SND_JACK_HEADSET | SND_JACK_MECHANICAL | | ||
55 | SND_JACK_AVOUT, | ||
56 | .debounce_time = 200, | ||
57 | }, | ||
58 | }; | ||
59 | |||
60 | static const struct snd_soc_dapm_widget goni_dapm_widgets[] = { | ||
61 | SND_SOC_DAPM_SPK("Ext Left Spk", NULL), | ||
62 | SND_SOC_DAPM_SPK("Ext Right Spk", NULL), | ||
63 | SND_SOC_DAPM_SPK("Ext Rcv", NULL), | ||
64 | SND_SOC_DAPM_HP("Headset Stereophone", NULL), | ||
65 | SND_SOC_DAPM_MIC("Headset Mic", NULL), | ||
66 | SND_SOC_DAPM_MIC("Main Mic", NULL), | ||
67 | SND_SOC_DAPM_MIC("2nd Mic", NULL), | ||
68 | SND_SOC_DAPM_LINE("Radio In", NULL), | ||
69 | }; | ||
70 | |||
71 | static const struct snd_soc_dapm_route goni_dapm_routes[] = { | ||
72 | {"Ext Left Spk", NULL, "SPKOUTLP"}, | ||
73 | {"Ext Left Spk", NULL, "SPKOUTLN"}, | ||
74 | |||
75 | {"Ext Right Spk", NULL, "SPKOUTRP"}, | ||
76 | {"Ext Right Spk", NULL, "SPKOUTRN"}, | ||
77 | |||
78 | {"Ext Rcv", NULL, "HPOUT2N"}, | ||
79 | {"Ext Rcv", NULL, "HPOUT2P"}, | ||
80 | |||
81 | {"Headset Stereophone", NULL, "HPOUT1L"}, | ||
82 | {"Headset Stereophone", NULL, "HPOUT1R"}, | ||
83 | |||
84 | {"IN1RN", NULL, "Headset Mic"}, | ||
85 | {"IN1RP", NULL, "Headset Mic"}, | ||
86 | |||
87 | {"IN1RN", NULL, "2nd Mic"}, | ||
88 | {"IN1RP", NULL, "2nd Mic"}, | ||
89 | |||
90 | {"IN1LN", NULL, "Main Mic"}, | ||
91 | {"IN1LP", NULL, "Main Mic"}, | ||
92 | |||
93 | {"IN2LN", NULL, "Radio In"}, | ||
94 | {"IN2RN", NULL, "Radio In"}, | ||
95 | }; | ||
96 | |||
97 | static int goni_wm8994_init(struct snd_soc_pcm_runtime *rtd) | ||
98 | { | ||
99 | struct snd_soc_codec *codec = rtd->codec; | ||
100 | int ret; | ||
101 | |||
102 | /* add goni specific widgets */ | ||
103 | snd_soc_dapm_new_controls(codec, goni_dapm_widgets, | ||
104 | ARRAY_SIZE(goni_dapm_widgets)); | ||
105 | |||
106 | /* set up goni specific audio routes */ | ||
107 | snd_soc_dapm_add_routes(codec, goni_dapm_routes, | ||
108 | ARRAY_SIZE(goni_dapm_routes)); | ||
109 | |||
110 | /* set endpoints to not connected */ | ||
111 | snd_soc_dapm_nc_pin(codec, "IN2LP:VXRN"); | ||
112 | snd_soc_dapm_nc_pin(codec, "IN2RP:VXRP"); | ||
113 | snd_soc_dapm_nc_pin(codec, "LINEOUT1N"); | ||
114 | snd_soc_dapm_nc_pin(codec, "LINEOUT1P"); | ||
115 | snd_soc_dapm_nc_pin(codec, "LINEOUT2N"); | ||
116 | snd_soc_dapm_nc_pin(codec, "LINEOUT2P"); | ||
117 | |||
118 | snd_soc_dapm_sync(codec); | ||
119 | |||
120 | /* Headset jack detection */ | ||
121 | ret = snd_soc_jack_new(&goni, "Headset Jack", | ||
122 | SND_JACK_HEADSET | SND_JACK_MECHANICAL | SND_JACK_AVOUT, | ||
123 | &jack); | ||
124 | if (ret) | ||
125 | return ret; | ||
126 | |||
127 | ret = snd_soc_jack_add_pins(&jack, ARRAY_SIZE(jack_pins), jack_pins); | ||
128 | if (ret) | ||
129 | return ret; | ||
130 | |||
131 | ret = snd_soc_jack_add_gpios(&jack, ARRAY_SIZE(jack_gpios), jack_gpios); | ||
132 | if (ret) | ||
133 | return ret; | ||
134 | |||
135 | return 0; | ||
136 | } | ||
137 | |||
138 | static int goni_hifi_hw_params(struct snd_pcm_substream *substream, | ||
139 | struct snd_pcm_hw_params *params) | ||
140 | { | ||
141 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | ||
142 | struct snd_soc_dai *codec_dai = rtd->codec_dai; | ||
143 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; | ||
144 | unsigned int pll_out = 24000000; | ||
145 | int ret = 0; | ||
146 | |||
147 | /* set the cpu DAI configuration */ | ||
148 | ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S | | ||
149 | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM); | ||
150 | if (ret < 0) | ||
151 | return ret; | ||
152 | |||
153 | /* set the cpu system clock */ | ||
154 | ret = snd_soc_dai_set_sysclk(cpu_dai, S3C64XX_CLKSRC_PCLK, | ||
155 | 0, SND_SOC_CLOCK_IN); | ||
156 | if (ret < 0) | ||
157 | return ret; | ||
158 | |||
159 | /* set codec DAI configuration */ | ||
160 | ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S | | ||
161 | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM); | ||
162 | if (ret < 0) | ||
163 | return ret; | ||
164 | |||
165 | /* set the codec FLL */ | ||
166 | ret = snd_soc_dai_set_pll(codec_dai, WM8994_FLL1, 0, pll_out, | ||
167 | params_rate(params) * 256); | ||
168 | if (ret < 0) | ||
169 | return ret; | ||
170 | |||
171 | /* set the codec system clock */ | ||
172 | ret = snd_soc_dai_set_sysclk(codec_dai, WM8994_SYSCLK_FLL1, | ||
173 | params_rate(params) * 256, SND_SOC_CLOCK_IN); | ||
174 | if (ret < 0) | ||
175 | return ret; | ||
176 | |||
177 | return 0; | ||
178 | } | ||
179 | |||
180 | static struct snd_soc_ops goni_hifi_ops = { | ||
181 | .hw_params = goni_hifi_hw_params, | ||
182 | }; | ||
183 | |||
184 | static int goni_voice_hw_params(struct snd_pcm_substream *substream, | ||
185 | struct snd_pcm_hw_params *params) | ||
186 | { | ||
187 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | ||
188 | struct snd_soc_dai *codec_dai = rtd->codec_dai; | ||
189 | unsigned int pll_out = 24000000; | ||
190 | int ret = 0; | ||
191 | |||
192 | if (params_rate(params) != 8000) | ||
193 | return -EINVAL; | ||
194 | |||
195 | /* set codec DAI configuration */ | ||
196 | ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_LEFT_J | | ||
197 | SND_SOC_DAIFMT_IB_IF | SND_SOC_DAIFMT_CBM_CFM); | ||
198 | if (ret < 0) | ||
199 | return ret; | ||
200 | |||
201 | /* set the codec FLL */ | ||
202 | ret = snd_soc_dai_set_pll(codec_dai, WM8994_FLL2, 0, pll_out, | ||
203 | params_rate(params) * 256); | ||
204 | if (ret < 0) | ||
205 | return ret; | ||
206 | |||
207 | /* set the codec system clock */ | ||
208 | ret = snd_soc_dai_set_sysclk(codec_dai, WM8994_SYSCLK_FLL2, | ||
209 | params_rate(params) * 256, SND_SOC_CLOCK_IN); | ||
210 | if (ret < 0) | ||
211 | return ret; | ||
212 | |||
213 | return 0; | ||
214 | } | ||
215 | |||
216 | static struct snd_soc_dai_driver voice_dai = { | ||
217 | .name = "goni-voice-dai", | ||
218 | .id = 0, | ||
219 | .playback = { | ||
220 | .channels_min = 1, | ||
221 | .channels_max = 2, | ||
222 | .rates = SNDRV_PCM_RATE_8000, | ||
223 | .formats = SNDRV_PCM_FMTBIT_S16_LE,}, | ||
224 | .capture = { | ||
225 | .channels_min = 1, | ||
226 | .channels_max = 2, | ||
227 | .rates = SNDRV_PCM_RATE_8000, | ||
228 | .formats = SNDRV_PCM_FMTBIT_S16_LE,}, | ||
229 | }; | ||
230 | |||
231 | static struct snd_soc_ops goni_voice_ops = { | ||
232 | .hw_params = goni_voice_hw_params, | ||
233 | }; | ||
234 | |||
235 | static struct snd_soc_dai_link goni_dai[] = { | ||
236 | { | ||
237 | .name = "WM8994", | ||
238 | .stream_name = "WM8994 HiFi", | ||
239 | .cpu_dai_name = "s3c64xx-i2s-v4", | ||
240 | .codec_dai_name = "wm8994-hifi", | ||
241 | .platform_name = "s3c24xx-pcm-audio", | ||
242 | .codec_name = "wm8994-codec.0-0x1a", | ||
243 | .init = goni_wm8994_init, | ||
244 | .ops = &goni_hifi_ops, | ||
245 | }, { | ||
246 | .name = "WM8994 Voice", | ||
247 | .stream_name = "Voice", | ||
248 | .cpu_dai_name = "goni-voice-dai", | ||
249 | .codec_dai_name = "wm8994-voice", | ||
250 | .platform_name = "s3c24xx-pcm-audio", | ||
251 | .codec_name = "wm8994-codec.0-0x1a", | ||
252 | .ops = &goni_voice_ops, | ||
253 | }, | ||
254 | }; | ||
255 | |||
256 | static struct snd_soc_card goni = { | ||
257 | .name = "goni", | ||
258 | .dai_link = goni_dai, | ||
259 | .num_links = ARRAY_SIZE(goni_dai), | ||
260 | }; | ||
261 | |||
262 | static int __init goni_init(void) | ||
263 | { | ||
264 | int ret; | ||
265 | |||
266 | if (!machine_is_goni()) | ||
267 | return -ENODEV; | ||
268 | |||
269 | goni_snd_device = platform_device_alloc("soc-audio", -1); | ||
270 | if (!goni_snd_device) | ||
271 | return -ENOMEM; | ||
272 | |||
273 | /* register voice DAI here */ | ||
274 | ret = snd_soc_register_dai(&goni_snd_device->dev, &voice_dai); | ||
275 | if (ret) | ||
276 | return ret; | ||
277 | |||
278 | platform_set_drvdata(goni_snd_device, &goni); | ||
279 | ret = platform_device_add(goni_snd_device); | ||
280 | |||
281 | if (ret) | ||
282 | platform_device_put(goni_snd_device); | ||
283 | |||
284 | return ret; | ||
285 | } | ||
286 | |||
287 | static void __exit goni_exit(void) | ||
288 | { | ||
289 | platform_device_unregister(goni_snd_device); | ||
290 | } | ||
291 | |||
292 | module_init(goni_init); | ||
293 | module_exit(goni_exit); | ||
294 | |||
295 | /* Module information */ | ||
296 | MODULE_DESCRIPTION("ALSA SoC WM8994 GONI(S5PV210)"); | ||
297 | MODULE_AUTHOR("Chanwoo Choi <cw00.choi@samsung.com>"); | ||
298 | MODULE_LICENSE("GPL"); | ||
diff --git a/sound/soc/s3c24xx/jive_wm8750.c b/sound/soc/s3c24xx/jive_wm8750.c index 8c108b121c10..49605cd83947 100644 --- a/sound/soc/s3c24xx/jive_wm8750.c +++ b/sound/soc/s3c24xx/jive_wm8750.c | |||
@@ -49,8 +49,8 @@ static int jive_hw_params(struct snd_pcm_substream *substream, | |||
49 | struct snd_pcm_hw_params *params) | 49 | struct snd_pcm_hw_params *params) |
50 | { | 50 | { |
51 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 51 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
52 | struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; | 52 | struct snd_soc_dai *codec_dai = rtd->codec_dai; |
53 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | 53 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
54 | struct s3c_i2sv2_rate_calc div; | 54 | struct s3c_i2sv2_rate_calc div; |
55 | unsigned int clk = 0; | 55 | unsigned int clk = 0; |
56 | int ret = 0; | 56 | int ret = 0; |
@@ -108,8 +108,9 @@ static struct snd_soc_ops jive_ops = { | |||
108 | .hw_params = jive_hw_params, | 108 | .hw_params = jive_hw_params, |
109 | }; | 109 | }; |
110 | 110 | ||
111 | static int jive_wm8750_init(struct snd_soc_codec *codec) | 111 | static int jive_wm8750_init(struct snd_soc_pcm_runtime *rtd) |
112 | { | 112 | { |
113 | struct snd_soc_codec *codec = rtd->codec; | ||
113 | int err; | 114 | int err; |
114 | 115 | ||
115 | /* These endpoints are not being used. */ | 116 | /* These endpoints are not being used. */ |
@@ -138,8 +139,10 @@ static int jive_wm8750_init(struct snd_soc_codec *codec) | |||
138 | static struct snd_soc_dai_link jive_dai = { | 139 | static struct snd_soc_dai_link jive_dai = { |
139 | .name = "wm8750", | 140 | .name = "wm8750", |
140 | .stream_name = "WM8750", | 141 | .stream_name = "WM8750", |
141 | .cpu_dai = &s3c2412_i2s_dai, | 142 | .cpu_dai_name = "s3c2412-i2s", |
142 | .codec_dai = &wm8750_dai, | 143 | .codec_dai_name = "wm8750-hifi", |
144 | .platform_name = "s3c24xx-pcm-audio", | ||
145 | .codec_name = "wm8750-codec.0-0x1a", | ||
143 | .init = jive_wm8750_init, | 146 | .init = jive_wm8750_init, |
144 | .ops = &jive_ops, | 147 | .ops = &jive_ops, |
145 | }; | 148 | }; |
@@ -147,17 +150,10 @@ static struct snd_soc_dai_link jive_dai = { | |||
147 | /* jive audio machine driver */ | 150 | /* jive audio machine driver */ |
148 | static struct snd_soc_card snd_soc_machine_jive = { | 151 | static struct snd_soc_card snd_soc_machine_jive = { |
149 | .name = "Jive", | 152 | .name = "Jive", |
150 | .platform = &s3c24xx_soc_platform, | ||
151 | .dai_link = &jive_dai, | 153 | .dai_link = &jive_dai, |
152 | .num_links = 1, | 154 | .num_links = 1, |
153 | }; | 155 | }; |
154 | 156 | ||
155 | /* jive audio subsystem */ | ||
156 | static struct snd_soc_device jive_snd_devdata = { | ||
157 | .card = &snd_soc_machine_jive, | ||
158 | .codec_dev = &soc_codec_dev_wm8750, | ||
159 | }; | ||
160 | |||
161 | static struct platform_device *jive_snd_device; | 157 | static struct platform_device *jive_snd_device; |
162 | 158 | ||
163 | static int __init jive_init(void) | 159 | static int __init jive_init(void) |
@@ -173,8 +169,7 @@ static int __init jive_init(void) | |||
173 | if (!jive_snd_device) | 169 | if (!jive_snd_device) |
174 | return -ENOMEM; | 170 | return -ENOMEM; |
175 | 171 | ||
176 | platform_set_drvdata(jive_snd_device, &jive_snd_devdata); | 172 | platform_set_drvdata(jive_snd_device, &snd_soc_machine_jive); |
177 | jive_snd_devdata.dev = &jive_snd_device->dev; | ||
178 | ret = platform_device_add(jive_snd_device); | 173 | ret = platform_device_add(jive_snd_device); |
179 | 174 | ||
180 | if (ret) | 175 | if (ret) |
diff --git a/sound/soc/s3c24xx/ln2440sbc_alc650.c b/sound/soc/s3c24xx/ln2440sbc_alc650.c index ffa954fe6931..abe64abe8c84 100644 --- a/sound/soc/s3c24xx/ln2440sbc_alc650.c +++ b/sound/soc/s3c24xx/ln2440sbc_alc650.c | |||
@@ -23,7 +23,6 @@ | |||
23 | #include <sound/soc.h> | 23 | #include <sound/soc.h> |
24 | #include <sound/soc-dapm.h> | 24 | #include <sound/soc-dapm.h> |
25 | 25 | ||
26 | #include "../codecs/ac97.h" | ||
27 | #include "s3c-dma.h" | 26 | #include "s3c-dma.h" |
28 | #include "s3c-ac97.h" | 27 | #include "s3c-ac97.h" |
29 | 28 | ||
@@ -33,23 +32,19 @@ static struct snd_soc_dai_link ln2440sbc_dai[] = { | |||
33 | { | 32 | { |
34 | .name = "AC97", | 33 | .name = "AC97", |
35 | .stream_name = "AC97 HiFi", | 34 | .stream_name = "AC97 HiFi", |
36 | .cpu_dai = &s3c_ac97_dai[S3C_AC97_DAI_PCM], | 35 | .cpu_dai_name = "s3c-ac97", |
37 | .codec_dai = &ac97_dai, | 36 | .codec_dai_name = "ac97-hifi", |
37 | .codec_name = "ac97-codec", | ||
38 | .platform_name = "s3c24xx-pcm-audio", | ||
38 | }, | 39 | }, |
39 | }; | 40 | }; |
40 | 41 | ||
41 | static struct snd_soc_card ln2440sbc = { | 42 | static struct snd_soc_card ln2440sbc = { |
42 | .name = "LN2440SBC", | 43 | .name = "LN2440SBC", |
43 | .platform = &s3c24xx_soc_platform, | ||
44 | .dai_link = ln2440sbc_dai, | 44 | .dai_link = ln2440sbc_dai, |
45 | .num_links = ARRAY_SIZE(ln2440sbc_dai), | 45 | .num_links = ARRAY_SIZE(ln2440sbc_dai), |
46 | }; | 46 | }; |
47 | 47 | ||
48 | static struct snd_soc_device ln2440sbc_snd_ac97_devdata = { | ||
49 | .card = &ln2440sbc, | ||
50 | .codec_dev = &soc_codec_dev_ac97, | ||
51 | }; | ||
52 | |||
53 | static struct platform_device *ln2440sbc_snd_ac97_device; | 48 | static struct platform_device *ln2440sbc_snd_ac97_device; |
54 | 49 | ||
55 | static int __init ln2440sbc_init(void) | 50 | static int __init ln2440sbc_init(void) |
@@ -60,9 +55,7 @@ static int __init ln2440sbc_init(void) | |||
60 | if (!ln2440sbc_snd_ac97_device) | 55 | if (!ln2440sbc_snd_ac97_device) |
61 | return -ENOMEM; | 56 | return -ENOMEM; |
62 | 57 | ||
63 | platform_set_drvdata(ln2440sbc_snd_ac97_device, | 58 | platform_set_drvdata(ln2440sbc_snd_ac97_device, &ln2440sbc); |
64 | &ln2440sbc_snd_ac97_devdata); | ||
65 | ln2440sbc_snd_ac97_devdata.dev = &ln2440sbc_snd_ac97_device->dev; | ||
66 | ret = platform_device_add(ln2440sbc_snd_ac97_device); | 59 | ret = platform_device_add(ln2440sbc_snd_ac97_device); |
67 | 60 | ||
68 | if (ret) | 61 | if (ret) |
diff --git a/sound/soc/s3c24xx/neo1973_gta02_wm8753.c b/sound/soc/s3c24xx/neo1973_gta02_wm8753.c index 209c25994c7e..c457bfd8297c 100644 --- a/sound/soc/s3c24xx/neo1973_gta02_wm8753.c +++ b/sound/soc/s3c24xx/neo1973_gta02_wm8753.c | |||
@@ -41,8 +41,8 @@ static int neo1973_gta02_hifi_hw_params(struct snd_pcm_substream *substream, | |||
41 | struct snd_pcm_hw_params *params) | 41 | struct snd_pcm_hw_params *params) |
42 | { | 42 | { |
43 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 43 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
44 | struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; | 44 | struct snd_soc_dai *codec_dai = rtd->codec_dai; |
45 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | 45 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
46 | unsigned int pll_out = 0, bclk = 0; | 46 | unsigned int pll_out = 0, bclk = 0; |
47 | int ret = 0; | 47 | int ret = 0; |
48 | unsigned long iis_clkrate; | 48 | unsigned long iis_clkrate; |
@@ -130,7 +130,7 @@ static int neo1973_gta02_hifi_hw_params(struct snd_pcm_substream *substream, | |||
130 | static int neo1973_gta02_hifi_hw_free(struct snd_pcm_substream *substream) | 130 | static int neo1973_gta02_hifi_hw_free(struct snd_pcm_substream *substream) |
131 | { | 131 | { |
132 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 132 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
133 | struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; | 133 | struct snd_soc_dai *codec_dai = rtd->codec_dai; |
134 | 134 | ||
135 | /* disable the PLL */ | 135 | /* disable the PLL */ |
136 | return snd_soc_dai_set_pll(codec_dai, WM8753_PLL1, 0, 0, 0); | 136 | return snd_soc_dai_set_pll(codec_dai, WM8753_PLL1, 0, 0, 0); |
@@ -149,7 +149,7 @@ static int neo1973_gta02_voice_hw_params( | |||
149 | struct snd_pcm_hw_params *params) | 149 | struct snd_pcm_hw_params *params) |
150 | { | 150 | { |
151 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 151 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
152 | struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; | 152 | struct snd_soc_dai *codec_dai = rtd->codec_dai; |
153 | unsigned int pcmdiv = 0; | 153 | unsigned int pcmdiv = 0; |
154 | int ret = 0; | 154 | int ret = 0; |
155 | unsigned long iis_clkrate; | 155 | unsigned long iis_clkrate; |
@@ -194,7 +194,7 @@ static int neo1973_gta02_voice_hw_params( | |||
194 | static int neo1973_gta02_voice_hw_free(struct snd_pcm_substream *substream) | 194 | static int neo1973_gta02_voice_hw_free(struct snd_pcm_substream *substream) |
195 | { | 195 | { |
196 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 196 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
197 | struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; | 197 | struct snd_soc_dai *codec_dai = rtd->codec_dai; |
198 | 198 | ||
199 | /* disable the PLL */ | 199 | /* disable the PLL */ |
200 | return snd_soc_dai_set_pll(codec_dai, WM8753_PLL2, 0, 0, 0); | 200 | return snd_soc_dai_set_pll(codec_dai, WM8753_PLL2, 0, 0, 0); |
@@ -262,7 +262,7 @@ static int lm4853_event(struct snd_soc_dapm_widget *w, | |||
262 | struct snd_kcontrol *k, | 262 | struct snd_kcontrol *k, |
263 | int event) | 263 | int event) |
264 | { | 264 | { |
265 | gpio_set_value(GTA02_GPIO_AMP_SHUT, SND_SOC_DAPM_EVENT_OFF(value)); | 265 | gpio_set_value(GTA02_GPIO_AMP_SHUT, SND_SOC_DAPM_EVENT_OFF(event)); |
266 | 266 | ||
267 | return 0; | 267 | return 0; |
268 | } | 268 | } |
@@ -330,8 +330,9 @@ static const struct snd_kcontrol_new wm8753_neo1973_gta02_controls[] = { | |||
330 | * This is an example machine initialisation for a wm8753 connected to a | 330 | * This is an example machine initialisation for a wm8753 connected to a |
331 | * neo1973 GTA02. | 331 | * neo1973 GTA02. |
332 | */ | 332 | */ |
333 | static int neo1973_gta02_wm8753_init(struct snd_soc_codec *codec) | 333 | static int neo1973_gta02_wm8753_init(struct snd_soc_pcm_runtime *rtd) |
334 | { | 334 | { |
335 | struct snd_soc_codec *codec = rtd->codec; | ||
335 | int err; | 336 | int err; |
336 | 337 | ||
337 | /* set up NC codec pins */ | 338 | /* set up NC codec pins */ |
@@ -378,9 +379,8 @@ static int neo1973_gta02_wm8753_init(struct snd_soc_codec *codec) | |||
378 | /* | 379 | /* |
379 | * BT Codec DAI | 380 | * BT Codec DAI |
380 | */ | 381 | */ |
381 | static struct snd_soc_dai bt_dai = { | 382 | static struct snd_soc_dai_driver bt_dai = { |
382 | .name = "Bluetooth", | 383 | .name = "bluetooth-dai", |
383 | .id = 0, | ||
384 | .playback = { | 384 | .playback = { |
385 | .channels_min = 1, | 385 | .channels_min = 1, |
386 | .channels_max = 1, | 386 | .channels_max = 1, |
@@ -397,32 +397,30 @@ static struct snd_soc_dai_link neo1973_gta02_dai[] = { | |||
397 | { /* Hifi Playback - for similatious use with voice below */ | 397 | { /* Hifi Playback - for similatious use with voice below */ |
398 | .name = "WM8753", | 398 | .name = "WM8753", |
399 | .stream_name = "WM8753 HiFi", | 399 | .stream_name = "WM8753 HiFi", |
400 | .cpu_dai = &s3c24xx_i2s_dai, | 400 | .cpu_dai_name = "s3c24xx-i2s", |
401 | .codec_dai = &wm8753_dai[WM8753_DAI_HIFI], | 401 | .codec_dai_name = "wm8753-hifi", |
402 | .init = neo1973_gta02_wm8753_init, | 402 | .init = neo1973_gta02_wm8753_init, |
403 | .platform_name = "s3c24xx-pcm-audio", | ||
404 | .codec_name = "wm8753-codec.0-0x1a", | ||
403 | .ops = &neo1973_gta02_hifi_ops, | 405 | .ops = &neo1973_gta02_hifi_ops, |
404 | }, | 406 | }, |
405 | { /* Voice via BT */ | 407 | { /* Voice via BT */ |
406 | .name = "Bluetooth", | 408 | .name = "Bluetooth", |
407 | .stream_name = "Voice", | 409 | .stream_name = "Voice", |
408 | .cpu_dai = &bt_dai, | 410 | .cpu_dai_name = "bluetooth-dai", |
409 | .codec_dai = &wm8753_dai[WM8753_DAI_VOICE], | 411 | .codec_dai_name = "wm8753-voice", |
410 | .ops = &neo1973_gta02_voice_ops, | 412 | .ops = &neo1973_gta02_voice_ops, |
413 | .codec_name = "wm8753-codec.0-0x1a", | ||
414 | .platform_name = "s3c24xx-pcm-audio", | ||
411 | }, | 415 | }, |
412 | }; | 416 | }; |
413 | 417 | ||
414 | static struct snd_soc_card neo1973_gta02 = { | 418 | static struct snd_soc_card neo1973_gta02 = { |
415 | .name = "neo1973-gta02", | 419 | .name = "neo1973-gta02", |
416 | .platform = &s3c24xx_soc_platform, | ||
417 | .dai_link = neo1973_gta02_dai, | 420 | .dai_link = neo1973_gta02_dai, |
418 | .num_links = ARRAY_SIZE(neo1973_gta02_dai), | 421 | .num_links = ARRAY_SIZE(neo1973_gta02_dai), |
419 | }; | 422 | }; |
420 | 423 | ||
421 | static struct snd_soc_device neo1973_gta02_snd_devdata = { | ||
422 | .card = &neo1973_gta02, | ||
423 | .codec_dev = &soc_codec_dev_wm8753, | ||
424 | }; | ||
425 | |||
426 | static struct platform_device *neo1973_gta02_snd_device; | 424 | static struct platform_device *neo1973_gta02_snd_device; |
427 | 425 | ||
428 | static int __init neo1973_gta02_init(void) | 426 | static int __init neo1973_gta02_init(void) |
@@ -435,18 +433,18 @@ static int __init neo1973_gta02_init(void) | |||
435 | return -ENODEV; | 433 | return -ENODEV; |
436 | } | 434 | } |
437 | 435 | ||
438 | /* register bluetooth DAI here */ | ||
439 | ret = snd_soc_register_dai(&bt_dai); | ||
440 | if (ret) | ||
441 | return ret; | ||
442 | |||
443 | neo1973_gta02_snd_device = platform_device_alloc("soc-audio", -1); | 436 | neo1973_gta02_snd_device = platform_device_alloc("soc-audio", -1); |
444 | if (!neo1973_gta02_snd_device) | 437 | if (!neo1973_gta02_snd_device) |
445 | return -ENOMEM; | 438 | return -ENOMEM; |
446 | 439 | ||
447 | platform_set_drvdata(neo1973_gta02_snd_device, | 440 | /* register bluetooth DAI here */ |
448 | &neo1973_gta02_snd_devdata); | 441 | ret = snd_soc_register_dai(&neo1973_gta02_snd_device->dev, -1, &bt_dai); |
449 | neo1973_gta02_snd_devdata.dev = &neo1973_gta02_snd_device->dev; | 442 | if (ret) { |
443 | platform_device_put(neo1973_gta02_snd_device); | ||
444 | return ret; | ||
445 | } | ||
446 | |||
447 | platform_set_drvdata(neo1973_gta02_snd_device, &neo1973_gta02); | ||
450 | ret = platform_device_add(neo1973_gta02_snd_device); | 448 | ret = platform_device_add(neo1973_gta02_snd_device); |
451 | 449 | ||
452 | if (ret) { | 450 | if (ret) { |
@@ -461,7 +459,7 @@ static int __init neo1973_gta02_init(void) | |||
461 | goto err_unregister_device; | 459 | goto err_unregister_device; |
462 | } | 460 | } |
463 | 461 | ||
464 | ret = gpio_direction_output(GTA02_GPIO_AMP_HP_IN, 1); | 462 | ret = gpio_direction_output(GTA02_GPIO_HP_IN, 1); |
465 | if (ret) { | 463 | if (ret) { |
466 | pr_err("gta02_wm8753: Failed to configure GPIO %d\n", GTA02_GPIO_HP_IN); | 464 | pr_err("gta02_wm8753: Failed to configure GPIO %d\n", GTA02_GPIO_HP_IN); |
467 | goto err_free_gpio_hp_in; | 465 | goto err_free_gpio_hp_in; |
@@ -493,7 +491,7 @@ module_init(neo1973_gta02_init); | |||
493 | 491 | ||
494 | static void __exit neo1973_gta02_exit(void) | 492 | static void __exit neo1973_gta02_exit(void) |
495 | { | 493 | { |
496 | snd_soc_unregister_dai(&bt_dai); | 494 | snd_soc_unregister_dai(&neo1973_gta02_snd_device->dev, -1); |
497 | platform_device_unregister(neo1973_gta02_snd_device); | 495 | platform_device_unregister(neo1973_gta02_snd_device); |
498 | gpio_free(GTA02_GPIO_HP_IN); | 496 | gpio_free(GTA02_GPIO_HP_IN); |
499 | gpio_free(GTA02_GPIO_AMP_SHUT); | 497 | gpio_free(GTA02_GPIO_AMP_SHUT); |
diff --git a/sound/soc/s3c24xx/neo1973_wm8753.c b/sound/soc/s3c24xx/neo1973_wm8753.c index 0cb4f86f6d1e..d7a39a0fe99b 100644 --- a/sound/soc/s3c24xx/neo1973_wm8753.c +++ b/sound/soc/s3c24xx/neo1973_wm8753.c | |||
@@ -57,8 +57,8 @@ static int neo1973_hifi_hw_params(struct snd_pcm_substream *substream, | |||
57 | struct snd_pcm_hw_params *params) | 57 | struct snd_pcm_hw_params *params) |
58 | { | 58 | { |
59 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 59 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
60 | struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; | 60 | struct snd_soc_dai *codec_dai = rtd->codec_dai; |
61 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | 61 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
62 | unsigned int pll_out = 0, bclk = 0; | 62 | unsigned int pll_out = 0, bclk = 0; |
63 | int ret = 0; | 63 | int ret = 0; |
64 | unsigned long iis_clkrate; | 64 | unsigned long iis_clkrate; |
@@ -147,7 +147,7 @@ static int neo1973_hifi_hw_params(struct snd_pcm_substream *substream, | |||
147 | static int neo1973_hifi_hw_free(struct snd_pcm_substream *substream) | 147 | static int neo1973_hifi_hw_free(struct snd_pcm_substream *substream) |
148 | { | 148 | { |
149 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 149 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
150 | struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; | 150 | struct snd_soc_dai *codec_dai = rtd->codec_dai; |
151 | 151 | ||
152 | pr_debug("Entered %s\n", __func__); | 152 | pr_debug("Entered %s\n", __func__); |
153 | 153 | ||
@@ -167,7 +167,7 @@ static int neo1973_voice_hw_params(struct snd_pcm_substream *substream, | |||
167 | struct snd_pcm_hw_params *params) | 167 | struct snd_pcm_hw_params *params) |
168 | { | 168 | { |
169 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 169 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
170 | struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; | 170 | struct snd_soc_dai *codec_dai = rtd->codec_dai; |
171 | unsigned int pcmdiv = 0; | 171 | unsigned int pcmdiv = 0; |
172 | int ret = 0; | 172 | int ret = 0; |
173 | unsigned long iis_clkrate; | 173 | unsigned long iis_clkrate; |
@@ -213,7 +213,7 @@ static int neo1973_voice_hw_params(struct snd_pcm_substream *substream, | |||
213 | static int neo1973_voice_hw_free(struct snd_pcm_substream *substream) | 213 | static int neo1973_voice_hw_free(struct snd_pcm_substream *substream) |
214 | { | 214 | { |
215 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 215 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
216 | struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; | 216 | struct snd_soc_dai *codec_dai = rtd->codec_dai; |
217 | 217 | ||
218 | pr_debug("Entered %s\n", __func__); | 218 | pr_debug("Entered %s\n", __func__); |
219 | 219 | ||
@@ -499,8 +499,9 @@ static const struct snd_kcontrol_new wm8753_neo1973_controls[] = { | |||
499 | * neo1973 II. It is missing logic to detect hp/mic insertions and logic | 499 | * neo1973 II. It is missing logic to detect hp/mic insertions and logic |
500 | * to re-route the audio in such an event. | 500 | * to re-route the audio in such an event. |
501 | */ | 501 | */ |
502 | static int neo1973_wm8753_init(struct snd_soc_codec *codec) | 502 | static int neo1973_wm8753_init(struct snd_soc_pcm_runtime *rtd) |
503 | { | 503 | { |
504 | struct snd_soc_codec *codec = rtd->codec; | ||
504 | int err; | 505 | int err; |
505 | 506 | ||
506 | pr_debug("Entered %s\n", __func__); | 507 | pr_debug("Entered %s\n", __func__); |
@@ -538,8 +539,7 @@ static int neo1973_wm8753_init(struct snd_soc_codec *codec) | |||
538 | * BT Codec DAI | 539 | * BT Codec DAI |
539 | */ | 540 | */ |
540 | static struct snd_soc_dai bt_dai = { | 541 | static struct snd_soc_dai bt_dai = { |
541 | .name = "Bluetooth", | 542 | .name = "bluetooth-dai", |
542 | .id = 0, | ||
543 | .playback = { | 543 | .playback = { |
544 | .channels_min = 1, | 544 | .channels_min = 1, |
545 | .channels_max = 1, | 545 | .channels_max = 1, |
@@ -556,32 +556,30 @@ static struct snd_soc_dai_link neo1973_dai[] = { | |||
556 | { /* Hifi Playback - for similatious use with voice below */ | 556 | { /* Hifi Playback - for similatious use with voice below */ |
557 | .name = "WM8753", | 557 | .name = "WM8753", |
558 | .stream_name = "WM8753 HiFi", | 558 | .stream_name = "WM8753 HiFi", |
559 | .cpu_dai = &s3c24xx_i2s_dai, | 559 | .platform_name = "s3c24xx-pcm-audio", |
560 | .codec_dai = &wm8753_dai[WM8753_DAI_HIFI], | 560 | .cpu_dai_name = "s3c24xx-i2s", |
561 | .codec_dai_name = "wm8753-hifi", | ||
562 | .codec_name = "wm8753-codec.0-0x1a", | ||
561 | .init = neo1973_wm8753_init, | 563 | .init = neo1973_wm8753_init, |
562 | .ops = &neo1973_hifi_ops, | 564 | .ops = &neo1973_hifi_ops, |
563 | }, | 565 | }, |
564 | { /* Voice via BT */ | 566 | { /* Voice via BT */ |
565 | .name = "Bluetooth", | 567 | .name = "Bluetooth", |
566 | .stream_name = "Voice", | 568 | .stream_name = "Voice", |
567 | .cpu_dai = &bt_dai, | 569 | .platform_name = "s3c24xx-pcm-audio", |
568 | .codec_dai = &wm8753_dai[WM8753_DAI_VOICE], | 570 | .cpu_dai_name = "bluetooth-dai", |
571 | .codec_dai_name = "wm8753-voice", | ||
572 | .codec_name = "wm8753-codec.0-0x1a", | ||
569 | .ops = &neo1973_voice_ops, | 573 | .ops = &neo1973_voice_ops, |
570 | }, | 574 | }, |
571 | }; | 575 | }; |
572 | 576 | ||
573 | static struct snd_soc_card neo1973 = { | 577 | static struct snd_soc_card neo1973 = { |
574 | .name = "neo1973", | 578 | .name = "neo1973", |
575 | .platform = &s3c24xx_soc_platform, | ||
576 | .dai_link = neo1973_dai, | 579 | .dai_link = neo1973_dai, |
577 | .num_links = ARRAY_SIZE(neo1973_dai), | 580 | .num_links = ARRAY_SIZE(neo1973_dai), |
578 | }; | 581 | }; |
579 | 582 | ||
580 | static struct snd_soc_device neo1973_snd_devdata = { | ||
581 | .card = &neo1973, | ||
582 | .codec_dev = &soc_codec_dev_wm8753, | ||
583 | }; | ||
584 | |||
585 | static int lm4857_i2c_probe(struct i2c_client *client, | 583 | static int lm4857_i2c_probe(struct i2c_client *client, |
586 | const struct i2c_device_id *id) | 584 | const struct i2c_device_id *id) |
587 | { | 585 | { |
@@ -673,8 +671,7 @@ static int __init neo1973_init(void) | |||
673 | if (!neo1973_snd_device) | 671 | if (!neo1973_snd_device) |
674 | return -ENOMEM; | 672 | return -ENOMEM; |
675 | 673 | ||
676 | platform_set_drvdata(neo1973_snd_device, &neo1973_snd_devdata); | 674 | platform_set_drvdata(neo1973_snd_device, &neo1973); |
677 | neo1973_snd_devdata.dev = &neo1973_snd_device->dev; | ||
678 | ret = platform_device_add(neo1973_snd_device); | 675 | ret = platform_device_add(neo1973_snd_device); |
679 | 676 | ||
680 | if (ret) { | 677 | if (ret) { |
diff --git a/sound/soc/s3c24xx/s3c-ac97.c b/sound/soc/s3c24xx/s3c-ac97.c index 31f6d45b6384..26f4ed90a0ee 100644 --- a/sound/soc/s3c24xx/s3c-ac97.c +++ b/sound/soc/s3c24xx/s3c-ac97.c | |||
@@ -222,7 +222,7 @@ static int s3c_ac97_hw_params(struct snd_pcm_substream *substream, | |||
222 | struct snd_soc_dai *dai) | 222 | struct snd_soc_dai *dai) |
223 | { | 223 | { |
224 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 224 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
225 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | 225 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
226 | struct s3c_dma_params *dma_data; | 226 | struct s3c_dma_params *dma_data; |
227 | 227 | ||
228 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) | 228 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) |
@@ -241,7 +241,7 @@ static int s3c_ac97_trigger(struct snd_pcm_substream *substream, int cmd, | |||
241 | u32 ac_glbctrl; | 241 | u32 ac_glbctrl; |
242 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 242 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
243 | struct s3c_dma_params *dma_data = | 243 | struct s3c_dma_params *dma_data = |
244 | snd_soc_dai_get_dma_data(rtd->dai->cpu_dai, substream); | 244 | snd_soc_dai_get_dma_data(rtd->cpu_dai, substream); |
245 | 245 | ||
246 | ac_glbctrl = readl(s3c_ac97.regs + S3C_AC97_GLBCTRL); | 246 | ac_glbctrl = readl(s3c_ac97.regs + S3C_AC97_GLBCTRL); |
247 | if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) | 247 | if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) |
@@ -277,7 +277,7 @@ static int s3c_ac97_hw_mic_params(struct snd_pcm_substream *substream, | |||
277 | struct snd_soc_dai *dai) | 277 | struct snd_soc_dai *dai) |
278 | { | 278 | { |
279 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 279 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
280 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | 280 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
281 | 281 | ||
282 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) | 282 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) |
283 | return -ENODEV; | 283 | return -ENODEV; |
@@ -293,7 +293,7 @@ static int s3c_ac97_mic_trigger(struct snd_pcm_substream *substream, | |||
293 | u32 ac_glbctrl; | 293 | u32 ac_glbctrl; |
294 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 294 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
295 | struct s3c_dma_params *dma_data = | 295 | struct s3c_dma_params *dma_data = |
296 | snd_soc_dai_get_dma_data(rtd->dai->cpu_dai, substream); | 296 | snd_soc_dai_get_dma_data(rtd->cpu_dai, substream); |
297 | 297 | ||
298 | ac_glbctrl = readl(s3c_ac97.regs + S3C_AC97_GLBCTRL); | 298 | ac_glbctrl = readl(s3c_ac97.regs + S3C_AC97_GLBCTRL); |
299 | ac_glbctrl &= ~S3C_AC97_GLBCTRL_MICINTM_MASK; | 299 | ac_glbctrl &= ~S3C_AC97_GLBCTRL_MICINTM_MASK; |
@@ -328,10 +328,9 @@ static struct snd_soc_dai_ops s3c_ac97_mic_dai_ops = { | |||
328 | .trigger = s3c_ac97_mic_trigger, | 328 | .trigger = s3c_ac97_mic_trigger, |
329 | }; | 329 | }; |
330 | 330 | ||
331 | struct snd_soc_dai s3c_ac97_dai[] = { | 331 | static struct snd_soc_dai_driver s3c_ac97_dai[] = { |
332 | [S3C_AC97_DAI_PCM] = { | 332 | [S3C_AC97_DAI_PCM] = { |
333 | .name = "s3c-ac97", | 333 | .name = "s3c-ac97", |
334 | .id = S3C_AC97_DAI_PCM, | ||
335 | .ac97_control = 1, | 334 | .ac97_control = 1, |
336 | .playback = { | 335 | .playback = { |
337 | .stream_name = "AC97 Playback", | 336 | .stream_name = "AC97 Playback", |
@@ -349,7 +348,6 @@ struct snd_soc_dai s3c_ac97_dai[] = { | |||
349 | }, | 348 | }, |
350 | [S3C_AC97_DAI_MIC] = { | 349 | [S3C_AC97_DAI_MIC] = { |
351 | .name = "s3c-ac97-mic", | 350 | .name = "s3c-ac97-mic", |
352 | .id = S3C_AC97_DAI_MIC, | ||
353 | .ac97_control = 1, | 351 | .ac97_control = 1, |
354 | .capture = { | 352 | .capture = { |
355 | .stream_name = "AC97 Mic Capture", | 353 | .stream_name = "AC97 Mic Capture", |
@@ -360,7 +358,6 @@ struct snd_soc_dai s3c_ac97_dai[] = { | |||
360 | .ops = &s3c_ac97_mic_dai_ops, | 358 | .ops = &s3c_ac97_mic_dai_ops, |
361 | }, | 359 | }, |
362 | }; | 360 | }; |
363 | EXPORT_SYMBOL_GPL(s3c_ac97_dai); | ||
364 | 361 | ||
365 | static __devinit int s3c_ac97_probe(struct platform_device *pdev) | 362 | static __devinit int s3c_ac97_probe(struct platform_device *pdev) |
366 | { | 363 | { |
@@ -449,10 +446,8 @@ static __devinit int s3c_ac97_probe(struct platform_device *pdev) | |||
449 | goto err4; | 446 | goto err4; |
450 | } | 447 | } |
451 | 448 | ||
452 | s3c_ac97_dai[S3C_AC97_DAI_PCM].dev = &pdev->dev; | 449 | ret = snd_soc_register_dais(&pdev->dev, s3c_ac97_dai, |
453 | s3c_ac97_dai[S3C_AC97_DAI_MIC].dev = &pdev->dev; | 450 | ARRAY_SIZE(s3c_ac97_dai)); |
454 | |||
455 | ret = snd_soc_register_dais(s3c_ac97_dai, ARRAY_SIZE(s3c_ac97_dai)); | ||
456 | if (ret) | 451 | if (ret) |
457 | goto err5; | 452 | goto err5; |
458 | 453 | ||
@@ -476,7 +471,7 @@ static __devexit int s3c_ac97_remove(struct platform_device *pdev) | |||
476 | { | 471 | { |
477 | struct resource *mem_res, *irq_res; | 472 | struct resource *mem_res, *irq_res; |
478 | 473 | ||
479 | snd_soc_unregister_dais(s3c_ac97_dai, ARRAY_SIZE(s3c_ac97_dai)); | 474 | snd_soc_unregister_dais(&pdev->dev, ARRAY_SIZE(s3c_ac97_dai)); |
480 | 475 | ||
481 | irq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); | 476 | irq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); |
482 | if (irq_res) | 477 | if (irq_res) |
@@ -518,3 +513,4 @@ module_exit(s3c_ac97_exit); | |||
518 | MODULE_AUTHOR("Jaswinder Singh, <jassi.brar@samsung.com>"); | 513 | MODULE_AUTHOR("Jaswinder Singh, <jassi.brar@samsung.com>"); |
519 | MODULE_DESCRIPTION("AC97 driver for the Samsung SoC"); | 514 | MODULE_DESCRIPTION("AC97 driver for the Samsung SoC"); |
520 | MODULE_LICENSE("GPL"); | 515 | MODULE_LICENSE("GPL"); |
516 | MODULE_ALIAS("platform:s3c-ac97"); | ||
diff --git a/sound/soc/s3c24xx/s3c-ac97.h b/sound/soc/s3c24xx/s3c-ac97.h index 278198379def..5dcedd07fdbb 100644 --- a/sound/soc/s3c24xx/s3c-ac97.h +++ b/sound/soc/s3c24xx/s3c-ac97.h | |||
@@ -18,6 +18,4 @@ | |||
18 | #define S3C_AC97_DAI_PCM 0 | 18 | #define S3C_AC97_DAI_PCM 0 |
19 | #define S3C_AC97_DAI_MIC 1 | 19 | #define S3C_AC97_DAI_MIC 1 |
20 | 20 | ||
21 | extern struct snd_soc_dai s3c_ac97_dai[]; | ||
22 | |||
23 | #endif /* __S3C_AC97_H_ */ | 21 | #endif /* __S3C_AC97_H_ */ |
diff --git a/sound/soc/s3c24xx/s3c-dma.c b/sound/soc/s3c24xx/s3c-dma.c index 1b61c23ff300..54bff83c98b4 100644 --- a/sound/soc/s3c24xx/s3c-dma.c +++ b/sound/soc/s3c24xx/s3c-dma.c | |||
@@ -147,7 +147,7 @@ static int s3c_dma_hw_params(struct snd_pcm_substream *substream, | |||
147 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 147 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
148 | unsigned long totbytes = params_buffer_bytes(params); | 148 | unsigned long totbytes = params_buffer_bytes(params); |
149 | struct s3c_dma_params *dma = | 149 | struct s3c_dma_params *dma = |
150 | snd_soc_dai_get_dma_data(rtd->dai->cpu_dai, substream); | 150 | snd_soc_dai_get_dma_data(rtd->cpu_dai, substream); |
151 | int ret = 0; | 151 | int ret = 0; |
152 | 152 | ||
153 | 153 | ||
@@ -441,14 +441,14 @@ static int s3c_dma_new(struct snd_card *card, | |||
441 | if (!card->dev->coherent_dma_mask) | 441 | if (!card->dev->coherent_dma_mask) |
442 | card->dev->coherent_dma_mask = 0xffffffff; | 442 | card->dev->coherent_dma_mask = 0xffffffff; |
443 | 443 | ||
444 | if (dai->playback.channels_min) { | 444 | if (dai->driver->playback.channels_min) { |
445 | ret = s3c_preallocate_dma_buffer(pcm, | 445 | ret = s3c_preallocate_dma_buffer(pcm, |
446 | SNDRV_PCM_STREAM_PLAYBACK); | 446 | SNDRV_PCM_STREAM_PLAYBACK); |
447 | if (ret) | 447 | if (ret) |
448 | goto out; | 448 | goto out; |
449 | } | 449 | } |
450 | 450 | ||
451 | if (dai->capture.channels_min) { | 451 | if (dai->driver->capture.channels_min) { |
452 | ret = s3c_preallocate_dma_buffer(pcm, | 452 | ret = s3c_preallocate_dma_buffer(pcm, |
453 | SNDRV_PCM_STREAM_CAPTURE); | 453 | SNDRV_PCM_STREAM_CAPTURE); |
454 | if (ret) | 454 | if (ret) |
@@ -458,26 +458,46 @@ static int s3c_dma_new(struct snd_card *card, | |||
458 | return ret; | 458 | return ret; |
459 | } | 459 | } |
460 | 460 | ||
461 | struct snd_soc_platform s3c24xx_soc_platform = { | 461 | static struct snd_soc_platform_driver s3c24xx_soc_platform = { |
462 | .name = "s3c24xx-audio", | 462 | .ops = &s3c_dma_ops, |
463 | .pcm_ops = &s3c_dma_ops, | ||
464 | .pcm_new = s3c_dma_new, | 463 | .pcm_new = s3c_dma_new, |
465 | .pcm_free = s3c_dma_free_dma_buffers, | 464 | .pcm_free = s3c_dma_free_dma_buffers, |
466 | }; | 465 | }; |
467 | EXPORT_SYMBOL_GPL(s3c24xx_soc_platform); | ||
468 | 466 | ||
469 | static int __init s3c24xx_soc_platform_init(void) | 467 | static int __devinit s3c24xx_soc_platform_probe(struct platform_device *pdev) |
470 | { | 468 | { |
471 | return snd_soc_register_platform(&s3c24xx_soc_platform); | 469 | return snd_soc_register_platform(&pdev->dev, &s3c24xx_soc_platform); |
472 | } | 470 | } |
473 | module_init(s3c24xx_soc_platform_init); | ||
474 | 471 | ||
475 | static void __exit s3c24xx_soc_platform_exit(void) | 472 | static int __devexit s3c24xx_soc_platform_remove(struct platform_device *pdev) |
476 | { | 473 | { |
477 | snd_soc_unregister_platform(&s3c24xx_soc_platform); | 474 | snd_soc_unregister_platform(&pdev->dev); |
475 | return 0; | ||
476 | } | ||
477 | |||
478 | static struct platform_driver s3c24xx_pcm_driver = { | ||
479 | .driver = { | ||
480 | .name = "s3c24xx-pcm-audio", | ||
481 | .owner = THIS_MODULE, | ||
482 | }, | ||
483 | |||
484 | .probe = s3c24xx_soc_platform_probe, | ||
485 | .remove = __devexit_p(s3c24xx_soc_platform_remove), | ||
486 | }; | ||
487 | |||
488 | static int __init snd_s3c24xx_pcm_init(void) | ||
489 | { | ||
490 | return platform_driver_register(&s3c24xx_pcm_driver); | ||
491 | } | ||
492 | module_init(snd_s3c24xx_pcm_init); | ||
493 | |||
494 | static void __exit snd_s3c24xx_pcm_exit(void) | ||
495 | { | ||
496 | platform_driver_unregister(&s3c24xx_pcm_driver); | ||
478 | } | 497 | } |
479 | module_exit(s3c24xx_soc_platform_exit); | 498 | module_exit(snd_s3c24xx_pcm_exit); |
480 | 499 | ||
481 | MODULE_AUTHOR("Ben Dooks, <ben@simtec.co.uk>"); | 500 | MODULE_AUTHOR("Ben Dooks, <ben@simtec.co.uk>"); |
482 | MODULE_DESCRIPTION("Samsung S3C Audio DMA module"); | 501 | MODULE_DESCRIPTION("Samsung S3C Audio DMA module"); |
483 | MODULE_LICENSE("GPL"); | 502 | MODULE_LICENSE("GPL"); |
503 | MODULE_ALIAS("platform:s3c24xx-pcm-audio"); | ||
diff --git a/sound/soc/s3c24xx/s3c-dma.h b/sound/soc/s3c24xx/s3c-dma.h index 69bb6bf6fc1c..748c07d7c075 100644 --- a/sound/soc/s3c24xx/s3c-dma.h +++ b/sound/soc/s3c24xx/s3c-dma.h | |||
@@ -25,7 +25,6 @@ struct s3c_dma_params { | |||
25 | #define S3C24XX_DAI_I2S 0 | 25 | #define S3C24XX_DAI_I2S 0 |
26 | 26 | ||
27 | /* platform data */ | 27 | /* platform data */ |
28 | extern struct snd_soc_platform s3c24xx_soc_platform; | ||
29 | extern struct snd_ac97_bus_ops s3c24xx_ac97_ops; | 28 | extern struct snd_ac97_bus_ops s3c24xx_ac97_ops; |
30 | 29 | ||
31 | #endif | 30 | #endif |
diff --git a/sound/soc/s3c24xx/s3c-i2s-v2.c b/sound/soc/s3c24xx/s3c-i2s-v2.c index 64376b2aac73..b3866d5b19e9 100644 --- a/sound/soc/s3c24xx/s3c-i2s-v2.c +++ b/sound/soc/s3c24xx/s3c-i2s-v2.c | |||
@@ -49,7 +49,7 @@ | |||
49 | 49 | ||
50 | static inline struct s3c_i2sv2_info *to_info(struct snd_soc_dai *cpu_dai) | 50 | static inline struct s3c_i2sv2_info *to_info(struct snd_soc_dai *cpu_dai) |
51 | { | 51 | { |
52 | return cpu_dai->private_data; | 52 | return snd_soc_dai_get_drvdata(cpu_dai); |
53 | } | 53 | } |
54 | 54 | ||
55 | #define bit_set(v, b) (((v) & (b)) ? 1 : 0) | 55 | #define bit_set(v, b) (((v) & (b)) ? 1 : 0) |
@@ -307,11 +307,9 @@ static int s3c2412_i2s_set_fmt(struct snd_soc_dai *cpu_dai, | |||
307 | 307 | ||
308 | static int s3c_i2sv2_hw_params(struct snd_pcm_substream *substream, | 308 | static int s3c_i2sv2_hw_params(struct snd_pcm_substream *substream, |
309 | struct snd_pcm_hw_params *params, | 309 | struct snd_pcm_hw_params *params, |
310 | struct snd_soc_dai *socdai) | 310 | struct snd_soc_dai *dai) |
311 | { | 311 | { |
312 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 312 | struct s3c_i2sv2_info *i2s = to_info(dai); |
313 | struct snd_soc_dai_link *dai = rtd->dai; | ||
314 | struct s3c_i2sv2_info *i2s = to_info(dai->cpu_dai); | ||
315 | struct s3c_dma_params *dma_data; | 313 | struct s3c_dma_params *dma_data; |
316 | u32 iismod; | 314 | u32 iismod; |
317 | 315 | ||
@@ -322,7 +320,7 @@ static int s3c_i2sv2_hw_params(struct snd_pcm_substream *substream, | |||
322 | else | 320 | else |
323 | dma_data = i2s->dma_capture; | 321 | dma_data = i2s->dma_capture; |
324 | 322 | ||
325 | snd_soc_dai_set_dma_data(dai->cpu_dai, substream, dma_data); | 323 | snd_soc_dai_set_dma_data(dai, substream, dma_data); |
326 | 324 | ||
327 | /* Working copies of register */ | 325 | /* Working copies of register */ |
328 | iismod = readl(i2s->regs + S3C2412_IISMOD); | 326 | iismod = readl(i2s->regs + S3C2412_IISMOD); |
@@ -396,12 +394,12 @@ static int s3c2412_i2s_trigger(struct snd_pcm_substream *substream, int cmd, | |||
396 | struct snd_soc_dai *dai) | 394 | struct snd_soc_dai *dai) |
397 | { | 395 | { |
398 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 396 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
399 | struct s3c_i2sv2_info *i2s = to_info(rtd->dai->cpu_dai); | 397 | struct s3c_i2sv2_info *i2s = to_info(rtd->cpu_dai); |
400 | int capture = (substream->stream == SNDRV_PCM_STREAM_CAPTURE); | 398 | int capture = (substream->stream == SNDRV_PCM_STREAM_CAPTURE); |
401 | unsigned long irqs; | 399 | unsigned long irqs; |
402 | int ret = 0; | 400 | int ret = 0; |
403 | struct s3c_dma_params *dma_data = | 401 | struct s3c_dma_params *dma_data = |
404 | snd_soc_dai_get_dma_data(rtd->dai->cpu_dai, substream); | 402 | snd_soc_dai_get_dma_data(rtd->cpu_dai, substream); |
405 | 403 | ||
406 | pr_debug("Entered %s\n", __func__); | 404 | pr_debug("Entered %s\n", __func__); |
407 | 405 | ||
@@ -640,36 +638,17 @@ int s3c_i2sv2_iis_calc_rate(struct s3c_i2sv2_rate_calc *info, | |||
640 | } | 638 | } |
641 | EXPORT_SYMBOL_GPL(s3c_i2sv2_iis_calc_rate); | 639 | EXPORT_SYMBOL_GPL(s3c_i2sv2_iis_calc_rate); |
642 | 640 | ||
643 | int s3c_i2sv2_probe(struct platform_device *pdev, | 641 | int s3c_i2sv2_probe(struct snd_soc_dai *dai, |
644 | struct snd_soc_dai *dai, | ||
645 | struct s3c_i2sv2_info *i2s, | 642 | struct s3c_i2sv2_info *i2s, |
646 | unsigned long base) | 643 | unsigned long base) |
647 | { | 644 | { |
648 | struct device *dev = &pdev->dev; | 645 | struct device *dev = dai->dev; |
649 | unsigned int iismod; | 646 | unsigned int iismod; |
650 | 647 | ||
651 | i2s->dev = dev; | 648 | i2s->dev = dev; |
652 | 649 | ||
653 | /* record our i2s structure for later use in the callbacks */ | 650 | /* record our i2s structure for later use in the callbacks */ |
654 | dai->private_data = i2s; | 651 | snd_soc_dai_set_drvdata(dai, i2s); |
655 | |||
656 | if (!base) { | ||
657 | struct resource *res = platform_get_resource(pdev, | ||
658 | IORESOURCE_MEM, | ||
659 | 0); | ||
660 | if (!res) { | ||
661 | dev_err(dev, "Unable to get register resource\n"); | ||
662 | return -ENXIO; | ||
663 | } | ||
664 | |||
665 | if (!request_mem_region(res->start, resource_size(res), | ||
666 | "s3c64xx-i2s-v4")) { | ||
667 | dev_err(dev, "Unable to request register region\n"); | ||
668 | return -EBUSY; | ||
669 | } | ||
670 | |||
671 | base = res->start; | ||
672 | } | ||
673 | 652 | ||
674 | i2s->regs = ioremap(base, 0x100); | 653 | i2s->regs = ioremap(base, 0x100); |
675 | if (i2s->regs == NULL) { | 654 | if (i2s->regs == NULL) { |
@@ -752,9 +731,10 @@ static int s3c2412_i2s_resume(struct snd_soc_dai *dai) | |||
752 | #define s3c2412_i2s_resume NULL | 731 | #define s3c2412_i2s_resume NULL |
753 | #endif | 732 | #endif |
754 | 733 | ||
755 | int s3c_i2sv2_register_dai(struct snd_soc_dai *dai) | 734 | int s3c_i2sv2_register_dai(struct device *dev, int id, |
735 | struct snd_soc_dai_driver *drv) | ||
756 | { | 736 | { |
757 | struct snd_soc_dai_ops *ops = dai->ops; | 737 | struct snd_soc_dai_ops *ops = drv->ops; |
758 | 738 | ||
759 | ops->trigger = s3c2412_i2s_trigger; | 739 | ops->trigger = s3c2412_i2s_trigger; |
760 | if (!ops->hw_params) | 740 | if (!ops->hw_params) |
@@ -767,10 +747,10 @@ int s3c_i2sv2_register_dai(struct snd_soc_dai *dai) | |||
767 | if (!ops->delay) | 747 | if (!ops->delay) |
768 | ops->delay = s3c2412_i2s_delay; | 748 | ops->delay = s3c2412_i2s_delay; |
769 | 749 | ||
770 | dai->suspend = s3c2412_i2s_suspend; | 750 | drv->suspend = s3c2412_i2s_suspend; |
771 | dai->resume = s3c2412_i2s_resume; | 751 | drv->resume = s3c2412_i2s_resume; |
772 | 752 | ||
773 | return snd_soc_register_dai(dai); | 753 | return snd_soc_register_dai(dev, drv); |
774 | } | 754 | } |
775 | EXPORT_SYMBOL_GPL(s3c_i2sv2_register_dai); | 755 | EXPORT_SYMBOL_GPL(s3c_i2sv2_register_dai); |
776 | 756 | ||
diff --git a/sound/soc/s3c24xx/s3c-i2s-v2.h b/sound/soc/s3c24xx/s3c-i2s-v2.h index 766f43a13d8b..d45830151484 100644 --- a/sound/soc/s3c24xx/s3c-i2s-v2.h +++ b/sound/soc/s3c24xx/s3c-i2s-v2.h | |||
@@ -66,6 +66,8 @@ struct s3c_i2sv2_info { | |||
66 | u32 suspend_iismod; | 66 | u32 suspend_iismod; |
67 | u32 suspend_iiscon; | 67 | u32 suspend_iiscon; |
68 | u32 suspend_iispsr; | 68 | u32 suspend_iispsr; |
69 | |||
70 | unsigned long base; | ||
69 | }; | 71 | }; |
70 | 72 | ||
71 | extern struct clk *s3c_i2sv2_get_clock(struct snd_soc_dai *cpu_dai); | 73 | extern struct clk *s3c_i2sv2_get_clock(struct snd_soc_dai *cpu_dai); |
@@ -81,23 +83,24 @@ extern int s3c_i2sv2_iis_calc_rate(struct s3c_i2sv2_rate_calc *info, | |||
81 | 83 | ||
82 | /** | 84 | /** |
83 | * s3c_i2sv2_probe - probe for i2s device helper | 85 | * s3c_i2sv2_probe - probe for i2s device helper |
84 | * @pdev: The platform device supplied to the original probe. | ||
85 | * @dai: The ASoC DAI structure supplied to the original probe. | 86 | * @dai: The ASoC DAI structure supplied to the original probe. |
86 | * @i2s: Our local i2s structure to fill in. | 87 | * @i2s: Our local i2s structure to fill in. |
87 | * @base: The base address for the registers. | 88 | * @base: The base address for the registers. |
88 | */ | 89 | */ |
89 | extern int s3c_i2sv2_probe(struct platform_device *pdev, | 90 | extern int s3c_i2sv2_probe(struct snd_soc_dai *dai, |
90 | struct snd_soc_dai *dai, | ||
91 | struct s3c_i2sv2_info *i2s, | 91 | struct s3c_i2sv2_info *i2s, |
92 | unsigned long base); | 92 | unsigned long base); |
93 | 93 | ||
94 | /** | 94 | /** |
95 | * s3c_i2sv2_register_dai - register dai with soc core | 95 | * s3c_i2sv2_register_dai - register dai with soc core |
96 | * @dai: The snd_soc_dai structure to register | 96 | * @dev: DAI device |
97 | * @id: DAI ID | ||
98 | * @drv: The driver structure to register | ||
97 | * | 99 | * |
98 | * Fill in any missing fields and then register the given dai with the | 100 | * Fill in any missing fields and then register the given dai with the |
99 | * soc core. | 101 | * soc core. |
100 | */ | 102 | */ |
101 | extern int s3c_i2sv2_register_dai(struct snd_soc_dai *dai); | 103 | extern int s3c_i2sv2_register_dai(struct device *dev, int id, |
104 | struct snd_soc_dai_driver *drv); | ||
102 | 105 | ||
103 | #endif /* __SND_SOC_S3C24XX_S3C_I2SV2_I2S_H */ | 106 | #endif /* __SND_SOC_S3C24XX_S3C_I2SV2_I2S_H */ |
diff --git a/sound/soc/s3c24xx/s3c-pcm.c b/sound/soc/s3c24xx/s3c-pcm.c index 326f0a9e7e30..6174e26e433e 100644 --- a/sound/soc/s3c24xx/s3c-pcm.c +++ b/sound/soc/s3c24xx/s3c-pcm.c | |||
@@ -64,11 +64,6 @@ static struct s3c_dma_params s3c_pcm_stereo_in[] = { | |||
64 | 64 | ||
65 | static struct s3c_pcm_info s3c_pcm[2]; | 65 | static struct s3c_pcm_info s3c_pcm[2]; |
66 | 66 | ||
67 | static inline struct s3c_pcm_info *to_info(struct snd_soc_dai *cpu_dai) | ||
68 | { | ||
69 | return cpu_dai->private_data; | ||
70 | } | ||
71 | |||
72 | static void s3c_pcm_snd_txctrl(struct s3c_pcm_info *pcm, int on) | 67 | static void s3c_pcm_snd_txctrl(struct s3c_pcm_info *pcm, int on) |
73 | { | 68 | { |
74 | void __iomem *regs = pcm->regs; | 69 | void __iomem *regs = pcm->regs; |
@@ -132,7 +127,7 @@ static int s3c_pcm_trigger(struct snd_pcm_substream *substream, int cmd, | |||
132 | struct snd_soc_dai *dai) | 127 | struct snd_soc_dai *dai) |
133 | { | 128 | { |
134 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 129 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
135 | struct s3c_pcm_info *pcm = to_info(rtd->dai->cpu_dai); | 130 | struct s3c_pcm_info *pcm = snd_soc_dai_get_drvdata(rtd->cpu_dai); |
136 | unsigned long flags; | 131 | unsigned long flags; |
137 | 132 | ||
138 | dev_dbg(pcm->dev, "Entered %s\n", __func__); | 133 | dev_dbg(pcm->dev, "Entered %s\n", __func__); |
@@ -176,8 +171,7 @@ static int s3c_pcm_hw_params(struct snd_pcm_substream *substream, | |||
176 | struct snd_soc_dai *socdai) | 171 | struct snd_soc_dai *socdai) |
177 | { | 172 | { |
178 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 173 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
179 | struct snd_soc_dai_link *dai = rtd->dai; | 174 | struct s3c_pcm_info *pcm = snd_soc_dai_get_drvdata(rtd->cpu_dai); |
180 | struct s3c_pcm_info *pcm = to_info(dai->cpu_dai); | ||
181 | struct s3c_dma_params *dma_data; | 175 | struct s3c_dma_params *dma_data; |
182 | void __iomem *regs = pcm->regs; | 176 | void __iomem *regs = pcm->regs; |
183 | struct clk *clk; | 177 | struct clk *clk; |
@@ -192,7 +186,7 @@ static int s3c_pcm_hw_params(struct snd_pcm_substream *substream, | |||
192 | else | 186 | else |
193 | dma_data = pcm->dma_capture; | 187 | dma_data = pcm->dma_capture; |
194 | 188 | ||
195 | snd_soc_dai_set_dma_data(dai->cpu_dai, substream, dma_data); | 189 | snd_soc_dai_set_dma_data(rtd->cpu_dai, substream, dma_data); |
196 | 190 | ||
197 | /* Strictly check for sample size */ | 191 | /* Strictly check for sample size */ |
198 | switch (params_format(params)) { | 192 | switch (params_format(params)) { |
@@ -242,7 +236,7 @@ static int s3c_pcm_hw_params(struct snd_pcm_substream *substream, | |||
242 | static int s3c_pcm_set_fmt(struct snd_soc_dai *cpu_dai, | 236 | static int s3c_pcm_set_fmt(struct snd_soc_dai *cpu_dai, |
243 | unsigned int fmt) | 237 | unsigned int fmt) |
244 | { | 238 | { |
245 | struct s3c_pcm_info *pcm = to_info(cpu_dai); | 239 | struct s3c_pcm_info *pcm = snd_soc_dai_get_drvdata(cpu_dai); |
246 | void __iomem *regs = pcm->regs; | 240 | void __iomem *regs = pcm->regs; |
247 | unsigned long flags; | 241 | unsigned long flags; |
248 | int ret = 0; | 242 | int ret = 0; |
@@ -313,7 +307,7 @@ exit: | |||
313 | static int s3c_pcm_set_clkdiv(struct snd_soc_dai *cpu_dai, | 307 | static int s3c_pcm_set_clkdiv(struct snd_soc_dai *cpu_dai, |
314 | int div_id, int div) | 308 | int div_id, int div) |
315 | { | 309 | { |
316 | struct s3c_pcm_info *pcm = to_info(cpu_dai); | 310 | struct s3c_pcm_info *pcm = snd_soc_dai_get_drvdata(cpu_dai); |
317 | 311 | ||
318 | switch (div_id) { | 312 | switch (div_id) { |
319 | case S3C_PCM_SCLK_PER_FS: | 313 | case S3C_PCM_SCLK_PER_FS: |
@@ -330,7 +324,7 @@ static int s3c_pcm_set_clkdiv(struct snd_soc_dai *cpu_dai, | |||
330 | static int s3c_pcm_set_sysclk(struct snd_soc_dai *cpu_dai, | 324 | static int s3c_pcm_set_sysclk(struct snd_soc_dai *cpu_dai, |
331 | int clk_id, unsigned int freq, int dir) | 325 | int clk_id, unsigned int freq, int dir) |
332 | { | 326 | { |
333 | struct s3c_pcm_info *pcm = to_info(cpu_dai); | 327 | struct s3c_pcm_info *pcm = snd_soc_dai_get_drvdata(cpu_dai); |
334 | void __iomem *regs = pcm->regs; | 328 | void __iomem *regs = pcm->regs; |
335 | u32 clkctl = readl(regs + S3C_PCM_CLKCTL); | 329 | u32 clkctl = readl(regs + S3C_PCM_CLKCTL); |
336 | 330 | ||
@@ -366,10 +360,9 @@ static struct snd_soc_dai_ops s3c_pcm_dai_ops = { | |||
366 | 360 | ||
367 | #define S3C_PCM_RATES SNDRV_PCM_RATE_8000_96000 | 361 | #define S3C_PCM_RATES SNDRV_PCM_RATE_8000_96000 |
368 | 362 | ||
369 | #define S3C_PCM_DECLARE(n) \ | 363 | #define S3C_PCM_DAI_DECLARE \ |
370 | { \ | 364 | { \ |
371 | .name = "samsung-pcm", \ | 365 | .name = "samsung-dai", \ |
372 | .id = (n), \ | ||
373 | .symmetric_rates = 1, \ | 366 | .symmetric_rates = 1, \ |
374 | .ops = &s3c_pcm_dai_ops, \ | 367 | .ops = &s3c_pcm_dai_ops, \ |
375 | .playback = { \ | 368 | .playback = { \ |
@@ -386,16 +379,15 @@ static struct snd_soc_dai_ops s3c_pcm_dai_ops = { | |||
386 | }, \ | 379 | }, \ |
387 | } | 380 | } |
388 | 381 | ||
389 | struct snd_soc_dai s3c_pcm_dai[] = { | 382 | struct snd_soc_dai_driver s3c_pcm_dai[] = { |
390 | S3C_PCM_DECLARE(0), | 383 | S3C_PCM_DAI_DECLARE, |
391 | S3C_PCM_DECLARE(1), | 384 | S3C_PCM_DAI_DECLARE, |
392 | }; | 385 | }; |
393 | EXPORT_SYMBOL_GPL(s3c_pcm_dai); | 386 | EXPORT_SYMBOL_GPL(s3c_pcm_dai); |
394 | 387 | ||
395 | static __devinit int s3c_pcm_dev_probe(struct platform_device *pdev) | 388 | static __devinit int s3c_pcm_dev_probe(struct platform_device *pdev) |
396 | { | 389 | { |
397 | struct s3c_pcm_info *pcm; | 390 | struct s3c_pcm_info *pcm; |
398 | struct snd_soc_dai *dai; | ||
399 | struct resource *mem_res, *dmatx_res, *dmarx_res; | 391 | struct resource *mem_res, *dmatx_res, *dmarx_res; |
400 | struct s3c_audio_pdata *pcm_pdata; | 392 | struct s3c_audio_pdata *pcm_pdata; |
401 | int ret; | 393 | int ret; |
@@ -437,9 +429,6 @@ static __devinit int s3c_pcm_dev_probe(struct platform_device *pdev) | |||
437 | 429 | ||
438 | spin_lock_init(&pcm->lock); | 430 | spin_lock_init(&pcm->lock); |
439 | 431 | ||
440 | dai = &s3c_pcm_dai[pdev->id]; | ||
441 | dai->dev = &pdev->dev; | ||
442 | |||
443 | /* Default is 128fs */ | 432 | /* Default is 128fs */ |
444 | pcm->sclk_per_fs = 128; | 433 | pcm->sclk_per_fs = 128; |
445 | 434 | ||
@@ -452,7 +441,7 @@ static __devinit int s3c_pcm_dev_probe(struct platform_device *pdev) | |||
452 | clk_enable(pcm->cclk); | 441 | clk_enable(pcm->cclk); |
453 | 442 | ||
454 | /* record our pcm structure for later use in the callbacks */ | 443 | /* record our pcm structure for later use in the callbacks */ |
455 | dai->private_data = pcm; | 444 | dev_set_drvdata(&pdev->dev, pcm); |
456 | 445 | ||
457 | if (!request_mem_region(mem_res->start, | 446 | if (!request_mem_region(mem_res->start, |
458 | resource_size(mem_res), "samsung-pcm")) { | 447 | resource_size(mem_res), "samsung-pcm")) { |
@@ -476,7 +465,7 @@ static __devinit int s3c_pcm_dev_probe(struct platform_device *pdev) | |||
476 | } | 465 | } |
477 | clk_enable(pcm->pclk); | 466 | clk_enable(pcm->pclk); |
478 | 467 | ||
479 | ret = snd_soc_register_dai(dai); | 468 | ret = snd_soc_register_dai(&pdev->dev, s3c_pcm_dai); |
480 | if (ret != 0) { | 469 | if (ret != 0) { |
481 | dev_err(&pdev->dev, "failed to get pcm_clock\n"); | 470 | dev_err(&pdev->dev, "failed to get pcm_clock\n"); |
482 | goto err5; | 471 | goto err5; |
@@ -514,6 +503,8 @@ static __devexit int s3c_pcm_dev_remove(struct platform_device *pdev) | |||
514 | struct s3c_pcm_info *pcm = &s3c_pcm[pdev->id]; | 503 | struct s3c_pcm_info *pcm = &s3c_pcm[pdev->id]; |
515 | struct resource *mem_res; | 504 | struct resource *mem_res; |
516 | 505 | ||
506 | snd_soc_unregister_dai(&pdev->dev); | ||
507 | |||
517 | iounmap(pcm->regs); | 508 | iounmap(pcm->regs); |
518 | 509 | ||
519 | mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 510 | mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
@@ -531,7 +522,7 @@ static struct platform_driver s3c_pcm_driver = { | |||
531 | .probe = s3c_pcm_dev_probe, | 522 | .probe = s3c_pcm_dev_probe, |
532 | .remove = s3c_pcm_dev_remove, | 523 | .remove = s3c_pcm_dev_remove, |
533 | .driver = { | 524 | .driver = { |
534 | .name = "samsung-pcm", | 525 | .name = "samsung-pcm-audio", |
535 | .owner = THIS_MODULE, | 526 | .owner = THIS_MODULE, |
536 | }, | 527 | }, |
537 | }; | 528 | }; |
@@ -552,3 +543,4 @@ module_exit(s3c_pcm_exit); | |||
552 | MODULE_AUTHOR("Jaswinder Singh, <jassi.brar@samsung.com>"); | 543 | MODULE_AUTHOR("Jaswinder Singh, <jassi.brar@samsung.com>"); |
553 | MODULE_DESCRIPTION("S3C PCM Controller Driver"); | 544 | MODULE_DESCRIPTION("S3C PCM Controller Driver"); |
554 | MODULE_LICENSE("GPL"); | 545 | MODULE_LICENSE("GPL"); |
546 | MODULE_ALIAS("platform:samsung-pcm-audio"); | ||
diff --git a/sound/soc/s3c24xx/s3c2412-i2s.c b/sound/soc/s3c24xx/s3c2412-i2s.c index 709adef9d043..4a861cfa52c5 100644 --- a/sound/soc/s3c24xx/s3c2412-i2s.c +++ b/sound/soc/s3c24xx/s3c2412-i2s.c | |||
@@ -65,26 +65,20 @@ static struct s3c_dma_params s3c2412_i2s_pcm_stereo_in = { | |||
65 | 65 | ||
66 | static struct s3c_i2sv2_info s3c2412_i2s; | 66 | static struct s3c_i2sv2_info s3c2412_i2s; |
67 | 67 | ||
68 | static inline struct s3c_i2sv2_info *to_info(struct snd_soc_dai *cpu_dai) | 68 | static int s3c2412_i2s_probe(struct snd_soc_dai *dai) |
69 | { | ||
70 | return cpu_dai->private_data; | ||
71 | } | ||
72 | |||
73 | static int s3c2412_i2s_probe(struct platform_device *pdev, | ||
74 | struct snd_soc_dai *dai) | ||
75 | { | 69 | { |
76 | int ret; | 70 | int ret; |
77 | 71 | ||
78 | pr_debug("Entered %s\n", __func__); | 72 | pr_debug("Entered %s\n", __func__); |
79 | 73 | ||
80 | ret = s3c_i2sv2_probe(pdev, dai, &s3c2412_i2s, S3C2410_PA_IIS); | 74 | ret = s3c_i2sv2_probe(dai, &s3c2412_i2s, S3C2410_PA_IIS); |
81 | if (ret) | 75 | if (ret) |
82 | return ret; | 76 | return ret; |
83 | 77 | ||
84 | s3c2412_i2s.dma_capture = &s3c2412_i2s_pcm_stereo_in; | 78 | s3c2412_i2s.dma_capture = &s3c2412_i2s_pcm_stereo_in; |
85 | s3c2412_i2s.dma_playback = &s3c2412_i2s_pcm_stereo_out; | 79 | s3c2412_i2s.dma_playback = &s3c2412_i2s_pcm_stereo_out; |
86 | 80 | ||
87 | s3c2412_i2s.iis_cclk = clk_get(&pdev->dev, "i2sclk"); | 81 | s3c2412_i2s.iis_cclk = clk_get(dai->dev, "i2sclk"); |
88 | if (s3c2412_i2s.iis_cclk == NULL) { | 82 | if (s3c2412_i2s.iis_cclk == NULL) { |
89 | pr_err("failed to get i2sclk clock\n"); | 83 | pr_err("failed to get i2sclk clock\n"); |
90 | iounmap(s3c2412_i2s.regs); | 84 | iounmap(s3c2412_i2s.regs); |
@@ -108,11 +102,20 @@ static int s3c2412_i2s_probe(struct platform_device *pdev, | |||
108 | return 0; | 102 | return 0; |
109 | } | 103 | } |
110 | 104 | ||
105 | static int s3c2412_i2s_remove(struct snd_soc_dai *dai) | ||
106 | { | ||
107 | clk_disable(s3c2412_i2s.iis_cclk); | ||
108 | clk_put(s3c2412_i2s.iis_cclk); | ||
109 | iounmap(s3c2412_i2s.regs); | ||
110 | |||
111 | return 0; | ||
112 | } | ||
113 | |||
111 | static int s3c2412_i2s_hw_params(struct snd_pcm_substream *substream, | 114 | static int s3c2412_i2s_hw_params(struct snd_pcm_substream *substream, |
112 | struct snd_pcm_hw_params *params, | 115 | struct snd_pcm_hw_params *params, |
113 | struct snd_soc_dai *cpu_dai) | 116 | struct snd_soc_dai *cpu_dai) |
114 | { | 117 | { |
115 | struct s3c_i2sv2_info *i2s = to_info(cpu_dai); | 118 | struct s3c_i2sv2_info *i2s = snd_soc_dai_get_drvdata(cpu_dai); |
116 | struct s3c_dma_params *dma_data; | 119 | struct s3c_dma_params *dma_data; |
117 | u32 iismod; | 120 | u32 iismod; |
118 | 121 | ||
@@ -152,10 +155,9 @@ static struct snd_soc_dai_ops s3c2412_i2s_dai_ops = { | |||
152 | .hw_params = s3c2412_i2s_hw_params, | 155 | .hw_params = s3c2412_i2s_hw_params, |
153 | }; | 156 | }; |
154 | 157 | ||
155 | struct snd_soc_dai s3c2412_i2s_dai = { | 158 | static struct snd_soc_dai_driver s3c2412_i2s_dai = { |
156 | .name = "s3c2412-i2s", | ||
157 | .id = 0, | ||
158 | .probe = s3c2412_i2s_probe, | 159 | .probe = s3c2412_i2s_probe, |
160 | .remove = s3c2412_i2s_remove, | ||
159 | .playback = { | 161 | .playback = { |
160 | .channels_min = 2, | 162 | .channels_min = 2, |
161 | .channels_max = 2, | 163 | .channels_max = 2, |
@@ -170,17 +172,36 @@ struct snd_soc_dai s3c2412_i2s_dai = { | |||
170 | }, | 172 | }, |
171 | .ops = &s3c2412_i2s_dai_ops, | 173 | .ops = &s3c2412_i2s_dai_ops, |
172 | }; | 174 | }; |
173 | EXPORT_SYMBOL_GPL(s3c2412_i2s_dai); | 175 | |
176 | static __devinit int s3c2412_iis_dev_probe(struct platform_device *pdev) | ||
177 | { | ||
178 | return snd_soc_register_dai(&pdev->dev, &s3c2412_i2s_dai); | ||
179 | } | ||
180 | |||
181 | static __devexit int s3c2412_iis_dev_remove(struct platform_device *pdev) | ||
182 | { | ||
183 | snd_soc_unregister_dai(&pdev->dev); | ||
184 | return 0; | ||
185 | } | ||
186 | |||
187 | static struct platform_driver s3c2412_iis_driver = { | ||
188 | .probe = s3c2412_iis_dev_probe, | ||
189 | .remove = s3c2412_iis_dev_remove, | ||
190 | .driver = { | ||
191 | .name = "s3c2412-iis", | ||
192 | .owner = THIS_MODULE, | ||
193 | }, | ||
194 | }; | ||
174 | 195 | ||
175 | static int __init s3c2412_i2s_init(void) | 196 | static int __init s3c2412_i2s_init(void) |
176 | { | 197 | { |
177 | return s3c_i2sv2_register_dai(&s3c2412_i2s_dai); | 198 | return platform_driver_register(&s3c2412_iis_driver); |
178 | } | 199 | } |
179 | module_init(s3c2412_i2s_init); | 200 | module_init(s3c2412_i2s_init); |
180 | 201 | ||
181 | static void __exit s3c2412_i2s_exit(void) | 202 | static void __exit s3c2412_i2s_exit(void) |
182 | { | 203 | { |
183 | snd_soc_unregister_dai(&s3c2412_i2s_dai); | 204 | platform_driver_unregister(&s3c2412_iis_driver); |
184 | } | 205 | } |
185 | module_exit(s3c2412_i2s_exit); | 206 | module_exit(s3c2412_i2s_exit); |
186 | 207 | ||
@@ -188,3 +209,4 @@ module_exit(s3c2412_i2s_exit); | |||
188 | MODULE_AUTHOR("Ben Dooks, <ben@simtec.co.uk>"); | 209 | MODULE_AUTHOR("Ben Dooks, <ben@simtec.co.uk>"); |
189 | MODULE_DESCRIPTION("S3C2412 I2S SoC Interface"); | 210 | MODULE_DESCRIPTION("S3C2412 I2S SoC Interface"); |
190 | MODULE_LICENSE("GPL"); | 211 | MODULE_LICENSE("GPL"); |
212 | MODULE_ALIAS("platform:s3c2412-iis"); | ||
diff --git a/sound/soc/s3c24xx/s3c2412-i2s.h b/sound/soc/s3c24xx/s3c2412-i2s.h index 0b5686b4d5c3..01a0471ac65c 100644 --- a/sound/soc/s3c24xx/s3c2412-i2s.h +++ b/sound/soc/s3c24xx/s3c2412-i2s.h | |||
@@ -24,6 +24,4 @@ | |||
24 | #define S3C2412_CLKSRC_PCLK S3C_I2SV2_CLKSRC_PCLK | 24 | #define S3C2412_CLKSRC_PCLK S3C_I2SV2_CLKSRC_PCLK |
25 | #define S3C2412_CLKSRC_I2SCLK S3C_I2SV2_CLKSRC_AUDIOBUS | 25 | #define S3C2412_CLKSRC_I2SCLK S3C_I2SV2_CLKSRC_AUDIOBUS |
26 | 26 | ||
27 | extern struct snd_soc_dai s3c2412_i2s_dai; | ||
28 | |||
29 | #endif /* __SND_SOC_S3C24XX_S3C2412_I2S_H */ | 27 | #endif /* __SND_SOC_S3C24XX_S3C2412_I2S_H */ |
diff --git a/sound/soc/s3c24xx/s3c24xx-i2s.c b/sound/soc/s3c24xx/s3c24xx-i2s.c index c3ac890a3986..e060daaa458f 100644 --- a/sound/soc/s3c24xx/s3c24xx-i2s.c +++ b/sound/soc/s3c24xx/s3c24xx-i2s.c | |||
@@ -252,7 +252,7 @@ static int s3c24xx_i2s_hw_params(struct snd_pcm_substream *substream, | |||
252 | else | 252 | else |
253 | dma_data = &s3c24xx_i2s_pcm_stereo_in; | 253 | dma_data = &s3c24xx_i2s_pcm_stereo_in; |
254 | 254 | ||
255 | snd_soc_dai_set_dma_data(rtd->dai->cpu_dai, substream, dma_data); | 255 | snd_soc_dai_set_dma_data(rtd->cpu_dai, substream, dma_data); |
256 | 256 | ||
257 | /* Working copies of register */ | 257 | /* Working copies of register */ |
258 | iismod = readl(s3c24xx_i2s.regs + S3C2410_IISMOD); | 258 | iismod = readl(s3c24xx_i2s.regs + S3C2410_IISMOD); |
@@ -280,9 +280,8 @@ static int s3c24xx_i2s_trigger(struct snd_pcm_substream *substream, int cmd, | |||
280 | struct snd_soc_dai *dai) | 280 | struct snd_soc_dai *dai) |
281 | { | 281 | { |
282 | int ret = 0; | 282 | int ret = 0; |
283 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | ||
284 | struct s3c_dma_params *dma_data = | 283 | struct s3c_dma_params *dma_data = |
285 | snd_soc_dai_get_dma_data(rtd->dai->cpu_dai, substream); | 284 | snd_soc_dai_get_dma_data(dai, substream); |
286 | 285 | ||
287 | pr_debug("Entered %s\n", __func__); | 286 | pr_debug("Entered %s\n", __func__); |
288 | 287 | ||
@@ -387,8 +386,7 @@ u32 s3c24xx_i2s_get_clockrate(void) | |||
387 | } | 386 | } |
388 | EXPORT_SYMBOL_GPL(s3c24xx_i2s_get_clockrate); | 387 | EXPORT_SYMBOL_GPL(s3c24xx_i2s_get_clockrate); |
389 | 388 | ||
390 | static int s3c24xx_i2s_probe(struct platform_device *pdev, | 389 | static int s3c24xx_i2s_probe(struct snd_soc_dai *dai) |
391 | struct snd_soc_dai *dai) | ||
392 | { | 390 | { |
393 | pr_debug("Entered %s\n", __func__); | 391 | pr_debug("Entered %s\n", __func__); |
394 | 392 | ||
@@ -396,7 +394,7 @@ static int s3c24xx_i2s_probe(struct platform_device *pdev, | |||
396 | if (s3c24xx_i2s.regs == NULL) | 394 | if (s3c24xx_i2s.regs == NULL) |
397 | return -ENXIO; | 395 | return -ENXIO; |
398 | 396 | ||
399 | s3c24xx_i2s.iis_clk = clk_get(&pdev->dev, "iis"); | 397 | s3c24xx_i2s.iis_clk = clk_get(dai->dev, "iis"); |
400 | if (s3c24xx_i2s.iis_clk == NULL) { | 398 | if (s3c24xx_i2s.iis_clk == NULL) { |
401 | pr_err("failed to get iis_clock\n"); | 399 | pr_err("failed to get iis_clock\n"); |
402 | iounmap(s3c24xx_i2s.regs); | 400 | iounmap(s3c24xx_i2s.regs); |
@@ -465,9 +463,7 @@ static struct snd_soc_dai_ops s3c24xx_i2s_dai_ops = { | |||
465 | .set_sysclk = s3c24xx_i2s_set_sysclk, | 463 | .set_sysclk = s3c24xx_i2s_set_sysclk, |
466 | }; | 464 | }; |
467 | 465 | ||
468 | struct snd_soc_dai s3c24xx_i2s_dai = { | 466 | static struct snd_soc_dai_driver s3c24xx_i2s_dai = { |
469 | .name = "s3c24xx-i2s", | ||
470 | .id = 0, | ||
471 | .probe = s3c24xx_i2s_probe, | 467 | .probe = s3c24xx_i2s_probe, |
472 | .suspend = s3c24xx_i2s_suspend, | 468 | .suspend = s3c24xx_i2s_suspend, |
473 | .resume = s3c24xx_i2s_resume, | 469 | .resume = s3c24xx_i2s_resume, |
@@ -483,17 +479,36 @@ struct snd_soc_dai s3c24xx_i2s_dai = { | |||
483 | .formats = SNDRV_PCM_FMTBIT_S8 | SNDRV_PCM_FMTBIT_S16_LE,}, | 479 | .formats = SNDRV_PCM_FMTBIT_S8 | SNDRV_PCM_FMTBIT_S16_LE,}, |
484 | .ops = &s3c24xx_i2s_dai_ops, | 480 | .ops = &s3c24xx_i2s_dai_ops, |
485 | }; | 481 | }; |
486 | EXPORT_SYMBOL_GPL(s3c24xx_i2s_dai); | 482 | |
483 | static __devinit int s3c24xx_iis_dev_probe(struct platform_device *pdev) | ||
484 | { | ||
485 | return snd_soc_register_dai(&pdev->dev, &s3c24xx_i2s_dai); | ||
486 | } | ||
487 | |||
488 | static __devexit int s3c24xx_iis_dev_remove(struct platform_device *pdev) | ||
489 | { | ||
490 | snd_soc_unregister_dai(&pdev->dev); | ||
491 | return 0; | ||
492 | } | ||
493 | |||
494 | static struct platform_driver s3c24xx_iis_driver = { | ||
495 | .probe = s3c24xx_iis_dev_probe, | ||
496 | .remove = s3c24xx_iis_dev_remove, | ||
497 | .driver = { | ||
498 | .name = "s3c24xx-iis", | ||
499 | .owner = THIS_MODULE, | ||
500 | }, | ||
501 | }; | ||
487 | 502 | ||
488 | static int __init s3c24xx_i2s_init(void) | 503 | static int __init s3c24xx_i2s_init(void) |
489 | { | 504 | { |
490 | return snd_soc_register_dai(&s3c24xx_i2s_dai); | 505 | return platform_driver_register(&s3c24xx_iis_driver); |
491 | } | 506 | } |
492 | module_init(s3c24xx_i2s_init); | 507 | module_init(s3c24xx_i2s_init); |
493 | 508 | ||
494 | static void __exit s3c24xx_i2s_exit(void) | 509 | static void __exit s3c24xx_i2s_exit(void) |
495 | { | 510 | { |
496 | snd_soc_unregister_dai(&s3c24xx_i2s_dai); | 511 | platform_driver_unregister(&s3c24xx_iis_driver); |
497 | } | 512 | } |
498 | module_exit(s3c24xx_i2s_exit); | 513 | module_exit(s3c24xx_i2s_exit); |
499 | 514 | ||
@@ -501,3 +516,4 @@ module_exit(s3c24xx_i2s_exit); | |||
501 | MODULE_AUTHOR("Ben Dooks, <ben@simtec.co.uk>"); | 516 | MODULE_AUTHOR("Ben Dooks, <ben@simtec.co.uk>"); |
502 | MODULE_DESCRIPTION("s3c24xx I2S SoC Interface"); | 517 | MODULE_DESCRIPTION("s3c24xx I2S SoC Interface"); |
503 | MODULE_LICENSE("GPL"); | 518 | MODULE_LICENSE("GPL"); |
519 | MODULE_ALIAS("platform:s3c24xx-iis"); | ||
diff --git a/sound/soc/s3c24xx/s3c24xx-i2s.h b/sound/soc/s3c24xx/s3c24xx-i2s.h index 726d91cf4e1c..f9ca04edacb7 100644 --- a/sound/soc/s3c24xx/s3c24xx-i2s.h +++ b/sound/soc/s3c24xx/s3c24xx-i2s.h | |||
@@ -32,6 +32,4 @@ | |||
32 | 32 | ||
33 | u32 s3c24xx_i2s_get_clockrate(void); | 33 | u32 s3c24xx_i2s_get_clockrate(void); |
34 | 34 | ||
35 | extern struct snd_soc_dai s3c24xx_i2s_dai; | ||
36 | |||
37 | #endif /*S3C24XXI2S_H_*/ | 35 | #endif /*S3C24XXI2S_H_*/ |
diff --git a/sound/soc/s3c24xx/s3c24xx_simtec.c b/sound/soc/s3c24xx/s3c24xx_simtec.c index 4984754f3298..c4c111442010 100644 --- a/sound/soc/s3c24xx/s3c24xx_simtec.c +++ b/sound/soc/s3c24xx/s3c24xx_simtec.c | |||
@@ -139,8 +139,10 @@ static const struct snd_kcontrol_new amp_unmute_controls[] = { | |||
139 | speaker_unmute_get, speaker_unmute_put), | 139 | speaker_unmute_get, speaker_unmute_put), |
140 | }; | 140 | }; |
141 | 141 | ||
142 | void simtec_audio_init(struct snd_soc_codec *codec) | 142 | void simtec_audio_init(struct snd_soc_pcm_runtime *rtd) |
143 | { | 143 | { |
144 | struct snd_soc_codec *codec = rtd->codec; | ||
145 | |||
144 | if (pdata->amp_gpio > 0) { | 146 | if (pdata->amp_gpio > 0) { |
145 | pr_debug("%s: adding amp routes\n", __func__); | 147 | pr_debug("%s: adding amp routes\n", __func__); |
146 | 148 | ||
@@ -170,8 +172,8 @@ static int simtec_hw_params(struct snd_pcm_substream *substream, | |||
170 | struct snd_pcm_hw_params *params) | 172 | struct snd_pcm_hw_params *params) |
171 | { | 173 | { |
172 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 174 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
173 | struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; | 175 | struct snd_soc_dai *codec_dai = rtd->codec_dai; |
174 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | 176 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
175 | int ret; | 177 | int ret; |
176 | 178 | ||
177 | /* Set the CODEC as the bus clock master, I2S */ | 179 | /* Set the CODEC as the bus clock master, I2S */ |
@@ -319,12 +321,12 @@ EXPORT_SYMBOL_GPL(simtec_audio_pmops); | |||
319 | #endif | 321 | #endif |
320 | 322 | ||
321 | int __devinit simtec_audio_core_probe(struct platform_device *pdev, | 323 | int __devinit simtec_audio_core_probe(struct platform_device *pdev, |
322 | struct snd_soc_device *socdev) | 324 | struct snd_soc_card *card) |
323 | { | 325 | { |
324 | struct platform_device *snd_dev; | 326 | struct platform_device *snd_dev; |
325 | int ret; | 327 | int ret; |
326 | 328 | ||
327 | socdev->card->dai_link->ops = &simtec_snd_ops; | 329 | card->dai_link->ops = &simtec_snd_ops; |
328 | 330 | ||
329 | pdata = pdev->dev.platform_data; | 331 | pdata = pdev->dev.platform_data; |
330 | if (!pdata) { | 332 | if (!pdata) { |
@@ -353,8 +355,7 @@ int __devinit simtec_audio_core_probe(struct platform_device *pdev, | |||
353 | goto err_gpio; | 355 | goto err_gpio; |
354 | } | 356 | } |
355 | 357 | ||
356 | platform_set_drvdata(snd_dev, socdev); | 358 | platform_set_drvdata(snd_dev, card); |
357 | socdev->dev = &snd_dev->dev; | ||
358 | 359 | ||
359 | ret = platform_device_add(snd_dev); | 360 | ret = platform_device_add(snd_dev); |
360 | if (ret) { | 361 | if (ret) { |
diff --git a/sound/soc/s3c24xx/s3c24xx_simtec.h b/sound/soc/s3c24xx/s3c24xx_simtec.h index e18faee30cce..e63d5ff9c41f 100644 --- a/sound/soc/s3c24xx/s3c24xx_simtec.h +++ b/sound/soc/s3c24xx/s3c24xx_simtec.h | |||
@@ -7,10 +7,10 @@ | |||
7 | * published by the Free Software Foundation. | 7 | * published by the Free Software Foundation. |
8 | */ | 8 | */ |
9 | 9 | ||
10 | extern void simtec_audio_init(struct snd_soc_codec *codec); | 10 | extern void simtec_audio_init(struct snd_soc_pcm_runtime *rtd); |
11 | 11 | ||
12 | extern int simtec_audio_core_probe(struct platform_device *pdev, | 12 | extern int simtec_audio_core_probe(struct platform_device *pdev, |
13 | struct snd_soc_device *socdev); | 13 | struct snd_soc_card *card); |
14 | 14 | ||
15 | extern int simtec_audio_remove(struct platform_device *pdev); | 15 | extern int simtec_audio_remove(struct platform_device *pdev); |
16 | 16 | ||
diff --git a/sound/soc/s3c24xx/s3c24xx_simtec_hermes.c b/sound/soc/s3c24xx/s3c24xx_simtec_hermes.c index bdf8951af8e3..f88453735ae2 100644 --- a/sound/soc/s3c24xx/s3c24xx_simtec_hermes.c +++ b/sound/soc/s3c24xx/s3c24xx_simtec_hermes.c | |||
@@ -73,8 +73,10 @@ static const struct snd_soc_dapm_route base_map[] = { | |||
73 | * Attach our controls and configure the necessary codec | 73 | * Attach our controls and configure the necessary codec |
74 | * mappings for our sound card instance. | 74 | * mappings for our sound card instance. |
75 | */ | 75 | */ |
76 | static int simtec_hermes_init(struct snd_soc_codec *codec) | 76 | static int simtec_hermes_init(struct snd_soc_pcm_runtime *rtd) |
77 | { | 77 | { |
78 | struct snd_soc_codec *codec = rtd->codec; | ||
79 | |||
78 | snd_soc_dapm_new_controls(codec, dapm_widgets, | 80 | snd_soc_dapm_new_controls(codec, dapm_widgets, |
79 | ARRAY_SIZE(dapm_widgets)); | 81 | ARRAY_SIZE(dapm_widgets)); |
80 | 82 | ||
@@ -85,42 +87,33 @@ static int simtec_hermes_init(struct snd_soc_codec *codec) | |||
85 | snd_soc_dapm_enable_pin(codec, "Line Out"); | 87 | snd_soc_dapm_enable_pin(codec, "Line Out"); |
86 | snd_soc_dapm_enable_pin(codec, "Mic Jack"); | 88 | snd_soc_dapm_enable_pin(codec, "Mic Jack"); |
87 | 89 | ||
88 | simtec_audio_init(codec); | 90 | simtec_audio_init(rtd); |
89 | snd_soc_dapm_sync(codec); | 91 | snd_soc_dapm_sync(codec); |
90 | 92 | ||
91 | return 0; | 93 | return 0; |
92 | } | 94 | } |
93 | 95 | ||
94 | static struct aic3x_setup_data codec_setup = { | ||
95 | }; | ||
96 | |||
97 | static struct snd_soc_dai_link simtec_dai_aic33 = { | 96 | static struct snd_soc_dai_link simtec_dai_aic33 = { |
98 | .name = "tlv320aic33", | 97 | .name = "tlv320aic33", |
99 | .stream_name = "TLV320AIC33", | 98 | .stream_name = "TLV320AIC33", |
100 | .cpu_dai = &s3c24xx_i2s_dai, | 99 | .codec_name = "tlv320aic3x-codec.0-0x1a", |
101 | .codec_dai = &aic3x_dai, | 100 | .cpu_dai_name = "s3c24xx-i2s", |
101 | .codec_dai_name = "tlv320aic3x-hifi", | ||
102 | .platform_name = "s3c24xx-pcm-audio", | ||
102 | .init = simtec_hermes_init, | 103 | .init = simtec_hermes_init, |
103 | }; | 104 | }; |
104 | 105 | ||
105 | /* simtec audio machine driver */ | 106 | /* simtec audio machine driver */ |
106 | static struct snd_soc_card snd_soc_machine_simtec_aic33 = { | 107 | static struct snd_soc_card snd_soc_machine_simtec_aic33 = { |
107 | .name = "Simtec-Hermes", | 108 | .name = "Simtec-Hermes", |
108 | .platform = &s3c24xx_soc_platform, | ||
109 | .dai_link = &simtec_dai_aic33, | 109 | .dai_link = &simtec_dai_aic33, |
110 | .num_links = 1, | 110 | .num_links = 1, |
111 | }; | 111 | }; |
112 | 112 | ||
113 | /* simtec audio subsystem */ | ||
114 | static 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 | |||
120 | static int __devinit simtec_audio_hermes_probe(struct platform_device *pd) | 113 | static int __devinit simtec_audio_hermes_probe(struct platform_device *pd) |
121 | { | 114 | { |
122 | dev_info(&pd->dev, "probing....\n"); | 115 | dev_info(&pd->dev, "probing....\n"); |
123 | return simtec_audio_core_probe(pd, &simtec_snd_devdata_aic33); | 116 | return simtec_audio_core_probe(pd, &snd_soc_machine_simtec_aic33); |
124 | } | 117 | } |
125 | 118 | ||
126 | static struct platform_driver simtec_audio_hermes_platdrv = { | 119 | static struct platform_driver simtec_audio_hermes_platdrv = { |
diff --git a/sound/soc/s3c24xx/s3c24xx_simtec_tlv320aic23.c b/sound/soc/s3c24xx/s3c24xx_simtec_tlv320aic23.c index 185c0acb5ce6..c0967593510d 100644 --- a/sound/soc/s3c24xx/s3c24xx_simtec_tlv320aic23.c +++ b/sound/soc/s3c24xx/s3c24xx_simtec_tlv320aic23.c | |||
@@ -62,8 +62,10 @@ static const struct snd_soc_dapm_route base_map[] = { | |||
62 | * Attach our controls and configure the necessary codec | 62 | * Attach our controls and configure the necessary codec |
63 | * mappings for our sound card instance. | 63 | * mappings for our sound card instance. |
64 | */ | 64 | */ |
65 | static int simtec_tlv320aic23_init(struct snd_soc_codec *codec) | 65 | static int simtec_tlv320aic23_init(struct snd_soc_pcm_runtime *rtd) |
66 | { | 66 | { |
67 | struct snd_soc_codec *codec = rtd->codec; | ||
68 | |||
67 | snd_soc_dapm_new_controls(codec, dapm_widgets, | 69 | snd_soc_dapm_new_controls(codec, dapm_widgets, |
68 | ARRAY_SIZE(dapm_widgets)); | 70 | ARRAY_SIZE(dapm_widgets)); |
69 | 71 | ||
@@ -74,7 +76,7 @@ static int simtec_tlv320aic23_init(struct snd_soc_codec *codec) | |||
74 | snd_soc_dapm_enable_pin(codec, "Line Out"); | 76 | snd_soc_dapm_enable_pin(codec, "Line Out"); |
75 | snd_soc_dapm_enable_pin(codec, "Mic Jack"); | 77 | snd_soc_dapm_enable_pin(codec, "Mic Jack"); |
76 | 78 | ||
77 | simtec_audio_init(codec); | 79 | simtec_audio_init(rtd); |
78 | snd_soc_dapm_sync(codec); | 80 | snd_soc_dapm_sync(codec); |
79 | 81 | ||
80 | return 0; | 82 | return 0; |
@@ -83,28 +85,23 @@ static int simtec_tlv320aic23_init(struct snd_soc_codec *codec) | |||
83 | static struct snd_soc_dai_link simtec_dai_aic23 = { | 85 | static struct snd_soc_dai_link simtec_dai_aic23 = { |
84 | .name = "tlv320aic23", | 86 | .name = "tlv320aic23", |
85 | .stream_name = "TLV320AIC23", | 87 | .stream_name = "TLV320AIC23", |
86 | .cpu_dai = &s3c24xx_i2s_dai, | 88 | .codec_name = "tlv320aic3x-codec.0-0x1a", |
87 | .codec_dai = &tlv320aic23_dai, | 89 | .cpu_dai_name = "s3c24xx-i2s", |
90 | .codec_dai_name = "tlv320aic3x-hifi", | ||
91 | .platform_name = "s3c24xx-pcm-audio", | ||
88 | .init = simtec_tlv320aic23_init, | 92 | .init = simtec_tlv320aic23_init, |
89 | }; | 93 | }; |
90 | 94 | ||
91 | /* simtec audio machine driver */ | 95 | /* simtec audio machine driver */ |
92 | static struct snd_soc_card snd_soc_machine_simtec_aic23 = { | 96 | static struct snd_soc_card snd_soc_machine_simtec_aic23 = { |
93 | .name = "Simtec", | 97 | .name = "Simtec", |
94 | .platform = &s3c24xx_soc_platform, | ||
95 | .dai_link = &simtec_dai_aic23, | 98 | .dai_link = &simtec_dai_aic23, |
96 | .num_links = 1, | 99 | .num_links = 1, |
97 | }; | 100 | }; |
98 | 101 | ||
99 | /* simtec audio subsystem */ | ||
100 | static struct snd_soc_device simtec_snd_devdata_aic23 = { | ||
101 | .card = &snd_soc_machine_simtec_aic23, | ||
102 | .codec_dev = &soc_codec_dev_tlv320aic23, | ||
103 | }; | ||
104 | |||
105 | static int __devinit simtec_audio_tlv320aic23_probe(struct platform_device *pd) | 102 | static int __devinit simtec_audio_tlv320aic23_probe(struct platform_device *pd) |
106 | { | 103 | { |
107 | return simtec_audio_core_probe(pd, &simtec_snd_devdata_aic23); | 104 | return simtec_audio_core_probe(pd, &snd_soc_machine_simtec_aic23); |
108 | } | 105 | } |
109 | 106 | ||
110 | static struct platform_driver simtec_audio_tlv320aic23_platdrv = { | 107 | static struct platform_driver simtec_audio_tlv320aic23_platdrv = { |
diff --git a/sound/soc/s3c24xx/s3c24xx_uda134x.c b/sound/soc/s3c24xx/s3c24xx_uda134x.c index 052d59659c29..bd48ffbde880 100644 --- a/sound/soc/s3c24xx/s3c24xx_uda134x.c +++ b/sound/soc/s3c24xx/s3c24xx_uda134x.c | |||
@@ -133,8 +133,8 @@ static int s3c24xx_uda134x_hw_params(struct snd_pcm_substream *substream, | |||
133 | struct snd_pcm_hw_params *params) | 133 | struct snd_pcm_hw_params *params) |
134 | { | 134 | { |
135 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 135 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
136 | struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; | 136 | struct snd_soc_dai *codec_dai = rtd->codec_dai; |
137 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | 137 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
138 | unsigned int clk = 0; | 138 | unsigned int clk = 0; |
139 | int ret = 0; | 139 | int ret = 0; |
140 | int clk_source, fs_mode; | 140 | int clk_source, fs_mode; |
@@ -227,14 +227,15 @@ static struct snd_soc_ops s3c24xx_uda134x_ops = { | |||
227 | static struct snd_soc_dai_link s3c24xx_uda134x_dai_link = { | 227 | static struct snd_soc_dai_link s3c24xx_uda134x_dai_link = { |
228 | .name = "UDA134X", | 228 | .name = "UDA134X", |
229 | .stream_name = "UDA134X", | 229 | .stream_name = "UDA134X", |
230 | .codec_dai = &uda134x_dai, | 230 | .codec_name = "uda134x-hifi", |
231 | .cpu_dai = &s3c24xx_i2s_dai, | 231 | .codec_dai_name = "uda134x-hifi", |
232 | .cpu_dai_name = "s3c24xx-i2s", | ||
232 | .ops = &s3c24xx_uda134x_ops, | 233 | .ops = &s3c24xx_uda134x_ops, |
234 | .platform_name = "s3c24xx-pcm-audio", | ||
233 | }; | 235 | }; |
234 | 236 | ||
235 | static struct snd_soc_card snd_soc_s3c24xx_uda134x = { | 237 | static struct snd_soc_card snd_soc_s3c24xx_uda134x = { |
236 | .name = "S3C24XX_UDA134X", | 238 | .name = "S3C24XX_UDA134X", |
237 | .platform = &s3c24xx_soc_platform, | ||
238 | .dai_link = &s3c24xx_uda134x_dai_link, | 239 | .dai_link = &s3c24xx_uda134x_dai_link, |
239 | .num_links = 1, | 240 | .num_links = 1, |
240 | }; | 241 | }; |
@@ -256,6 +257,7 @@ static void setmode(int v) | |||
256 | gpio_set_value(s3c24xx_uda134x_l3_pins->l3_mode, v > 0); | 257 | gpio_set_value(s3c24xx_uda134x_l3_pins->l3_mode, v > 0); |
257 | } | 258 | } |
258 | 259 | ||
260 | /* FIXME - This must be codec platform data but in which board file ?? */ | ||
259 | static struct uda134x_platform_data s3c24xx_uda134x = { | 261 | static struct uda134x_platform_data s3c24xx_uda134x = { |
260 | .l3 = { | 262 | .l3 = { |
261 | .setdat = setdat, | 263 | .setdat = setdat, |
@@ -270,12 +272,6 @@ static struct uda134x_platform_data s3c24xx_uda134x = { | |||
270 | }, | 272 | }, |
271 | }; | 273 | }; |
272 | 274 | ||
273 | static struct snd_soc_device s3c24xx_uda134x_snd_devdata = { | ||
274 | .card = &snd_soc_s3c24xx_uda134x, | ||
275 | .codec_dev = &soc_codec_dev_uda134x, | ||
276 | .codec_data = &s3c24xx_uda134x, | ||
277 | }; | ||
278 | |||
279 | static int s3c24xx_uda134x_setup_pin(int pin, char *fun) | 275 | static int s3c24xx_uda134x_setup_pin(int pin, char *fun) |
280 | { | 276 | { |
281 | if (gpio_request(pin, "s3c24xx_uda134x") < 0) { | 277 | if (gpio_request(pin, "s3c24xx_uda134x") < 0) { |
@@ -325,8 +321,7 @@ static int s3c24xx_uda134x_probe(struct platform_device *pdev) | |||
325 | } | 321 | } |
326 | 322 | ||
327 | platform_set_drvdata(s3c24xx_uda134x_snd_device, | 323 | platform_set_drvdata(s3c24xx_uda134x_snd_device, |
328 | &s3c24xx_uda134x_snd_devdata); | 324 | &snd_soc_s3c24xx_uda134x); |
329 | s3c24xx_uda134x_snd_devdata.dev = &s3c24xx_uda134x_snd_device->dev; | ||
330 | ret = platform_device_add(s3c24xx_uda134x_snd_device); | 325 | ret = platform_device_add(s3c24xx_uda134x_snd_device); |
331 | if (ret) { | 326 | if (ret) { |
332 | printk(KERN_ERR "S3C24XX_UDA134X SoC Audio: Unable to add\n"); | 327 | printk(KERN_ERR "S3C24XX_UDA134X SoC Audio: Unable to add\n"); |
diff --git a/sound/soc/s3c24xx/s3c64xx-i2s-v4.c b/sound/soc/s3c24xx/s3c64xx-i2s-v4.c index 06db130030a1..a13415a85a45 100644 --- a/sound/soc/s3c24xx/s3c64xx-i2s-v4.c +++ b/sound/soc/s3c24xx/s3c64xx-i2s-v4.c | |||
@@ -16,9 +16,7 @@ | |||
16 | #include <sound/soc.h> | 16 | #include <sound/soc.h> |
17 | #include <sound/pcm_params.h> | 17 | #include <sound/pcm_params.h> |
18 | 18 | ||
19 | #include <mach/gpio-bank-c.h> | 19 | #include <plat/audio.h> |
20 | #include <mach/gpio-bank-h.h> | ||
21 | #include <plat/gpio-cfg.h> | ||
22 | 20 | ||
23 | #include <mach/map.h> | 21 | #include <mach/map.h> |
24 | #include <mach/dma.h> | 22 | #include <mach/dma.h> |
@@ -39,34 +37,23 @@ static struct s3c_dma_params s3c64xx_i2sv4_pcm_stereo_out; | |||
39 | static struct s3c_dma_params s3c64xx_i2sv4_pcm_stereo_in; | 37 | static struct s3c_dma_params s3c64xx_i2sv4_pcm_stereo_in; |
40 | static struct s3c_i2sv2_info s3c64xx_i2sv4; | 38 | static struct s3c_i2sv2_info s3c64xx_i2sv4; |
41 | 39 | ||
42 | struct snd_soc_dai s3c64xx_i2s_v4_dai; | 40 | static int s3c64xx_i2sv4_probe(struct snd_soc_dai *dai) |
43 | EXPORT_SYMBOL_GPL(s3c64xx_i2s_v4_dai); | ||
44 | |||
45 | static inline struct s3c_i2sv2_info *to_info(struct snd_soc_dai *cpu_dai) | ||
46 | { | 41 | { |
47 | return cpu_dai->private_data; | 42 | struct s3c_i2sv2_info *i2s = &s3c64xx_i2sv4; |
48 | } | 43 | int ret = 0; |
49 | 44 | ||
50 | static int s3c64xx_i2sv4_probe(struct platform_device *pdev, | 45 | snd_soc_dai_set_drvdata(dai, i2s); |
51 | struct snd_soc_dai *dai) | ||
52 | { | ||
53 | /* configure GPIO for i2s port */ | ||
54 | s3c_gpio_cfgpin(S3C64XX_GPC(4), S3C64XX_GPC4_I2S_V40_DO0); | ||
55 | s3c_gpio_cfgpin(S3C64XX_GPC(5), S3C64XX_GPC5_I2S_V40_DO1); | ||
56 | s3c_gpio_cfgpin(S3C64XX_GPC(7), S3C64XX_GPC7_I2S_V40_DO2); | ||
57 | s3c_gpio_cfgpin(S3C64XX_GPH(6), S3C64XX_GPH6_I2S_V40_BCLK); | ||
58 | s3c_gpio_cfgpin(S3C64XX_GPH(7), S3C64XX_GPH7_I2S_V40_CDCLK); | ||
59 | s3c_gpio_cfgpin(S3C64XX_GPH(8), S3C64XX_GPH8_I2S_V40_LRCLK); | ||
60 | s3c_gpio_cfgpin(S3C64XX_GPH(9), S3C64XX_GPH9_I2S_V40_DI); | ||
61 | 46 | ||
62 | return 0; | 47 | ret = s3c_i2sv2_probe(dai, i2s, i2s->base); |
48 | |||
49 | return ret; | ||
63 | } | 50 | } |
64 | 51 | ||
65 | static int s3c_i2sv4_hw_params(struct snd_pcm_substream *substream, | 52 | static int s3c_i2sv4_hw_params(struct snd_pcm_substream *substream, |
66 | struct snd_pcm_hw_params *params, | 53 | struct snd_pcm_hw_params *params, |
67 | struct snd_soc_dai *cpu_dai) | 54 | struct snd_soc_dai *cpu_dai) |
68 | { | 55 | { |
69 | struct s3c_i2sv2_info *i2s = to_info(cpu_dai); | 56 | struct s3c_i2sv2_info *i2s = snd_soc_dai_get_drvdata(cpu_dai); |
70 | struct s3c_dma_params *dma_data; | 57 | struct s3c_dma_params *dma_data; |
71 | u32 iismod; | 58 | u32 iismod; |
72 | 59 | ||
@@ -104,51 +91,79 @@ static struct snd_soc_dai_ops s3c64xx_i2sv4_dai_ops = { | |||
104 | .hw_params = s3c_i2sv4_hw_params, | 91 | .hw_params = s3c_i2sv4_hw_params, |
105 | }; | 92 | }; |
106 | 93 | ||
94 | static struct snd_soc_dai_driver s3c64xx_i2s_v4_dai = { | ||
95 | .symmetric_rates = 1, | ||
96 | .playback = { | ||
97 | .channels_min = 2, | ||
98 | .channels_max = 2, | ||
99 | .rates = S3C64XX_I2S_RATES, | ||
100 | .formats = S3C64XX_I2S_FMTS, | ||
101 | }, | ||
102 | .capture = { | ||
103 | .channels_min = 2, | ||
104 | .channels_max = 2, | ||
105 | .rates = S3C64XX_I2S_RATES, | ||
106 | .formats = S3C64XX_I2S_FMTS, | ||
107 | }, | ||
108 | .probe = s3c64xx_i2sv4_probe, | ||
109 | .ops = &s3c64xx_i2sv4_dai_ops, | ||
110 | }; | ||
111 | |||
107 | static __devinit int s3c64xx_i2sv4_dev_probe(struct platform_device *pdev) | 112 | static __devinit int s3c64xx_i2sv4_dev_probe(struct platform_device *pdev) |
108 | { | 113 | { |
114 | struct s3c_audio_pdata *i2s_pdata; | ||
109 | struct s3c_i2sv2_info *i2s; | 115 | struct s3c_i2sv2_info *i2s; |
110 | struct snd_soc_dai *dai; | 116 | struct resource *res; |
111 | int ret; | 117 | int ret; |
112 | 118 | ||
113 | i2s = &s3c64xx_i2sv4; | 119 | i2s = &s3c64xx_i2sv4; |
114 | dai = &s3c64xx_i2s_v4_dai; | ||
115 | |||
116 | if (dai->dev) { | ||
117 | dev_dbg(dai->dev, "%s: \ | ||
118 | I2Sv4 instance already registered!\n", __func__); | ||
119 | return -EBUSY; | ||
120 | } | ||
121 | |||
122 | dai->dev = &pdev->dev; | ||
123 | dai->name = "s3c64xx-i2s-v4"; | ||
124 | dai->id = 0; | ||
125 | dai->symmetric_rates = 1; | ||
126 | dai->playback.channels_min = 2; | ||
127 | dai->playback.channels_max = 2; | ||
128 | dai->playback.rates = S3C64XX_I2S_RATES; | ||
129 | dai->playback.formats = S3C64XX_I2S_FMTS; | ||
130 | dai->capture.channels_min = 2; | ||
131 | dai->capture.channels_max = 2; | ||
132 | dai->capture.rates = S3C64XX_I2S_RATES; | ||
133 | dai->capture.formats = S3C64XX_I2S_FMTS; | ||
134 | dai->probe = s3c64xx_i2sv4_probe; | ||
135 | dai->ops = &s3c64xx_i2sv4_dai_ops; | ||
136 | 120 | ||
137 | i2s->feature |= S3C_FEATURE_CDCLKCON; | 121 | i2s->feature |= S3C_FEATURE_CDCLKCON; |
138 | 122 | ||
139 | i2s->dma_capture = &s3c64xx_i2sv4_pcm_stereo_in; | 123 | i2s->dma_capture = &s3c64xx_i2sv4_pcm_stereo_in; |
140 | i2s->dma_playback = &s3c64xx_i2sv4_pcm_stereo_out; | 124 | i2s->dma_playback = &s3c64xx_i2sv4_pcm_stereo_out; |
141 | 125 | ||
142 | i2s->dma_capture->channel = DMACH_HSI_I2SV40_RX; | 126 | res = platform_get_resource(pdev, IORESOURCE_DMA, 0); |
143 | i2s->dma_capture->dma_addr = S3C64XX_PA_IISV4 + S3C2412_IISRXD; | 127 | if (!res) { |
144 | i2s->dma_playback->channel = DMACH_HSI_I2SV40_TX; | 128 | dev_err(&pdev->dev, "Unable to get I2S-TX dma resource\n"); |
145 | i2s->dma_playback->dma_addr = S3C64XX_PA_IISV4 + S3C2412_IISTXD; | 129 | return -ENXIO; |
130 | } | ||
131 | i2s->dma_playback->channel = res->start; | ||
132 | |||
133 | res = platform_get_resource(pdev, IORESOURCE_DMA, 1); | ||
134 | if (!res) { | ||
135 | dev_err(&pdev->dev, "Unable to get I2S-RX dma resource\n"); | ||
136 | return -ENXIO; | ||
137 | } | ||
138 | i2s->dma_capture->channel = res->start; | ||
139 | |||
140 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
141 | if (!res) { | ||
142 | dev_err(&pdev->dev, "Unable to get I2S SFR address\n"); | ||
143 | return -ENXIO; | ||
144 | } | ||
145 | |||
146 | if (!request_mem_region(res->start, resource_size(res), | ||
147 | "s3c64xx-i2s-v4")) { | ||
148 | dev_err(&pdev->dev, "Unable to request SFR region\n"); | ||
149 | return -EBUSY; | ||
150 | } | ||
151 | i2s->dma_capture->dma_addr = res->start + S3C2412_IISRXD; | ||
152 | i2s->dma_playback->dma_addr = res->start + S3C2412_IISTXD; | ||
146 | 153 | ||
147 | i2s->dma_capture->client = &s3c64xx_dma_client_in; | 154 | i2s->dma_capture->client = &s3c64xx_dma_client_in; |
148 | i2s->dma_capture->dma_size = 4; | 155 | i2s->dma_capture->dma_size = 4; |
149 | i2s->dma_playback->client = &s3c64xx_dma_client_out; | 156 | i2s->dma_playback->client = &s3c64xx_dma_client_out; |
150 | i2s->dma_playback->dma_size = 4; | 157 | i2s->dma_playback->dma_size = 4; |
151 | 158 | ||
159 | i2s->base = res->start; | ||
160 | |||
161 | i2s_pdata = pdev->dev.platform_data; | ||
162 | if (i2s_pdata && i2s_pdata->cfg_gpio && i2s_pdata->cfg_gpio(pdev)) { | ||
163 | dev_err(&pdev->dev, "Unable to configure gpio\n"); | ||
164 | return -EINVAL; | ||
165 | } | ||
166 | |||
152 | i2s->iis_cclk = clk_get(&pdev->dev, "audio-bus"); | 167 | i2s->iis_cclk = clk_get(&pdev->dev, "audio-bus"); |
153 | if (IS_ERR(i2s->iis_cclk)) { | 168 | if (IS_ERR(i2s->iis_cclk)) { |
154 | dev_err(&pdev->dev, "failed to get audio-bus\n"); | 169 | dev_err(&pdev->dev, "failed to get audio-bus\n"); |
@@ -158,19 +173,13 @@ static __devinit int s3c64xx_i2sv4_dev_probe(struct platform_device *pdev) | |||
158 | 173 | ||
159 | clk_enable(i2s->iis_cclk); | 174 | clk_enable(i2s->iis_cclk); |
160 | 175 | ||
161 | ret = s3c_i2sv2_probe(pdev, dai, i2s, 0); | 176 | ret = s3c_i2sv2_register_dai(&pdev->dev, pdev->id, &s3c64xx_i2s_v4_dai); |
162 | if (ret) | ||
163 | goto err_clk; | ||
164 | |||
165 | ret = s3c_i2sv2_register_dai(dai); | ||
166 | if (ret != 0) | 177 | if (ret != 0) |
167 | goto err_i2sv2; | 178 | goto err_i2sv2; |
168 | 179 | ||
169 | return 0; | 180 | return 0; |
170 | 181 | ||
171 | err_i2sv2: | 182 | err_i2sv2: |
172 | /* Not implemented for I2Sv2 core yet */ | ||
173 | err_clk: | ||
174 | clk_put(i2s->iis_cclk); | 183 | clk_put(i2s->iis_cclk); |
175 | err: | 184 | err: |
176 | return ret; | 185 | return ret; |
@@ -178,7 +187,7 @@ err: | |||
178 | 187 | ||
179 | static __devexit int s3c64xx_i2sv4_dev_remove(struct platform_device *pdev) | 188 | static __devexit int s3c64xx_i2sv4_dev_remove(struct platform_device *pdev) |
180 | { | 189 | { |
181 | dev_err(&pdev->dev, "Device removal not yet supported\n"); | 190 | snd_soc_unregister_dai(&pdev->dev); |
182 | return 0; | 191 | return 0; |
183 | } | 192 | } |
184 | 193 | ||
@@ -207,3 +216,4 @@ module_exit(s3c64xx_i2sv4_exit); | |||
207 | MODULE_AUTHOR("Jaswinder Singh, <jassi.brar@samsung.com>"); | 216 | MODULE_AUTHOR("Jaswinder Singh, <jassi.brar@samsung.com>"); |
208 | MODULE_DESCRIPTION("S3C64XX I2Sv4 SoC Interface"); | 217 | MODULE_DESCRIPTION("S3C64XX I2Sv4 SoC Interface"); |
209 | MODULE_LICENSE("GPL"); | 218 | MODULE_LICENSE("GPL"); |
219 | MODULE_ALIAS("platform:s3c64xx-iis-v4"); | ||
diff --git a/sound/soc/s3c24xx/s3c64xx-i2s.c b/sound/soc/s3c24xx/s3c64xx-i2s.c index 1d85cb85a7d2..ae7acb6c4f1d 100644 --- a/sound/soc/s3c24xx/s3c64xx-i2s.c +++ b/sound/soc/s3c24xx/s3c64xx-i2s.c | |||
@@ -12,15 +12,15 @@ | |||
12 | * published by the Free Software Foundation. | 12 | * published by the Free Software Foundation. |
13 | */ | 13 | */ |
14 | 14 | ||
15 | #include <linux/module.h> | ||
15 | #include <linux/clk.h> | 16 | #include <linux/clk.h> |
16 | #include <linux/gpio.h> | 17 | #include <linux/gpio.h> |
17 | #include <linux/io.h> | 18 | #include <linux/io.h> |
19 | #include <linux/slab.h> | ||
18 | 20 | ||
19 | #include <sound/soc.h> | 21 | #include <sound/soc.h> |
20 | 22 | ||
21 | #include <mach/gpio-bank-d.h> | 23 | #include <plat/audio.h> |
22 | #include <mach/gpio-bank-e.h> | ||
23 | #include <plat/gpio-cfg.h> | ||
24 | 24 | ||
25 | #include <mach/map.h> | 25 | #include <mach/map.h> |
26 | #include <mach/dma.h> | 26 | #include <mach/dma.h> |
@@ -46,45 +46,107 @@ static struct s3c_dma_params s3c64xx_i2s_pcm_stereo_out[MAX_I2SV3]; | |||
46 | static struct s3c_dma_params s3c64xx_i2s_pcm_stereo_in[MAX_I2SV3]; | 46 | static struct s3c_dma_params s3c64xx_i2s_pcm_stereo_in[MAX_I2SV3]; |
47 | static struct s3c_i2sv2_info s3c64xx_i2s[MAX_I2SV3]; | 47 | static struct s3c_i2sv2_info s3c64xx_i2s[MAX_I2SV3]; |
48 | 48 | ||
49 | struct snd_soc_dai s3c64xx_i2s_dai[MAX_I2SV3]; | 49 | struct clk *s3c64xx_i2s_get_clock(struct snd_soc_dai *dai) |
50 | EXPORT_SYMBOL_GPL(s3c64xx_i2s_dai); | ||
51 | |||
52 | static inline struct s3c_i2sv2_info *to_info(struct snd_soc_dai *cpu_dai) | ||
53 | { | 50 | { |
54 | return cpu_dai->private_data; | 51 | struct s3c_i2sv2_info *i2s = snd_soc_dai_get_drvdata(dai); |
52 | u32 iismod = readl(i2s->regs + S3C2412_IISMOD); | ||
53 | |||
54 | if (iismod & S3C2412_IISMOD_IMS_SYSMUX) | ||
55 | return i2s->iis_cclk; | ||
56 | else | ||
57 | return i2s->iis_pclk; | ||
55 | } | 58 | } |
59 | EXPORT_SYMBOL_GPL(s3c64xx_i2s_get_clock); | ||
56 | 60 | ||
57 | static int s3c64xx_i2s_probe(struct platform_device *pdev, | 61 | static int s3c64xx_i2s_probe(struct snd_soc_dai *dai) |
58 | struct snd_soc_dai *dai) | ||
59 | { | 62 | { |
60 | /* configure GPIO for i2s port */ | 63 | struct s3c_i2sv2_info *i2s; |
61 | switch (dai->id) { | 64 | int ret; |
62 | case 0: | 65 | |
63 | s3c_gpio_cfgpin(S3C64XX_GPD(0), S3C64XX_GPD0_I2S0_CLK); | 66 | if (dai->id >= MAX_I2SV3) { |
64 | s3c_gpio_cfgpin(S3C64XX_GPD(1), S3C64XX_GPD1_I2S0_CDCLK); | 67 | dev_err(dai->dev, "id %d out of range\n", dai->id); |
65 | s3c_gpio_cfgpin(S3C64XX_GPD(2), S3C64XX_GPD2_I2S0_LRCLK); | 68 | return -EINVAL; |
66 | s3c_gpio_cfgpin(S3C64XX_GPD(3), S3C64XX_GPD3_I2S0_DI); | 69 | } |
67 | s3c_gpio_cfgpin(S3C64XX_GPD(4), S3C64XX_GPD4_I2S0_D0); | 70 | |
68 | break; | 71 | i2s = &s3c64xx_i2s[dai->id]; |
69 | case 1: | 72 | snd_soc_dai_set_drvdata(dai, i2s); |
70 | s3c_gpio_cfgpin(S3C64XX_GPE(0), S3C64XX_GPE0_I2S1_CLK); | 73 | |
71 | s3c_gpio_cfgpin(S3C64XX_GPE(1), S3C64XX_GPE1_I2S1_CDCLK); | 74 | i2s->iis_cclk = clk_get(dai->dev, "audio-bus"); |
72 | s3c_gpio_cfgpin(S3C64XX_GPE(2), S3C64XX_GPE2_I2S1_LRCLK); | 75 | if (IS_ERR(i2s->iis_cclk)) { |
73 | s3c_gpio_cfgpin(S3C64XX_GPE(3), S3C64XX_GPE3_I2S1_DI); | 76 | dev_err(dai->dev, "failed to get audio-bus\n"); |
74 | s3c_gpio_cfgpin(S3C64XX_GPE(4), S3C64XX_GPE4_I2S1_D0); | 77 | ret = PTR_ERR(i2s->iis_cclk); |
78 | goto err; | ||
75 | } | 79 | } |
76 | 80 | ||
81 | clk_enable(i2s->iis_cclk); | ||
82 | |||
83 | ret = s3c_i2sv2_probe(dai, i2s, i2s->base); | ||
84 | if (ret) | ||
85 | goto err_clk; | ||
86 | |||
77 | return 0; | 87 | return 0; |
88 | |||
89 | err_clk: | ||
90 | clk_disable(i2s->iis_cclk); | ||
91 | clk_put(i2s->iis_cclk); | ||
92 | err: | ||
93 | kfree(i2s); | ||
94 | return ret; | ||
78 | } | 95 | } |
79 | 96 | ||
97 | static int s3c64xx_i2s_remove(struct snd_soc_dai *dai) | ||
98 | { | ||
99 | struct s3c_i2sv2_info *i2s = snd_soc_dai_get_drvdata(dai); | ||
100 | |||
101 | clk_disable(i2s->iis_cclk); | ||
102 | clk_put(i2s->iis_cclk); | ||
103 | kfree(i2s); | ||
104 | return 0; | ||
105 | } | ||
80 | 106 | ||
81 | static struct snd_soc_dai_ops s3c64xx_i2s_dai_ops; | 107 | static struct snd_soc_dai_ops s3c64xx_i2s_dai_ops; |
82 | 108 | ||
109 | static struct snd_soc_dai_driver s3c64xx_i2s_dai[MAX_I2SV3] = { | ||
110 | { | ||
111 | .name = "s3c64xx-i2s-0", | ||
112 | .probe = s3c64xx_i2s_probe, | ||
113 | .remove = s3c64xx_i2s_remove, | ||
114 | .playback = { | ||
115 | .channels_min = 2, | ||
116 | .channels_max = 2, | ||
117 | .rates = S3C64XX_I2S_RATES, | ||
118 | .formats = S3C64XX_I2S_FMTS,}, | ||
119 | .capture = { | ||
120 | .channels_min = 2, | ||
121 | .channels_max = 2, | ||
122 | .rates = S3C64XX_I2S_RATES, | ||
123 | .formats = S3C64XX_I2S_FMTS,}, | ||
124 | .ops = &s3c64xx_i2s_dai_ops, | ||
125 | .symmetric_rates = 1, | ||
126 | }, { | ||
127 | .name = "s3c64xx-i2s-1", | ||
128 | .probe = s3c64xx_i2s_probe, | ||
129 | .remove = s3c64xx_i2s_remove, | ||
130 | .playback = { | ||
131 | .channels_min = 2, | ||
132 | .channels_max = 2, | ||
133 | .rates = S3C64XX_I2S_RATES, | ||
134 | .formats = S3C64XX_I2S_FMTS,}, | ||
135 | .capture = { | ||
136 | .channels_min = 2, | ||
137 | .channels_max = 2, | ||
138 | .rates = S3C64XX_I2S_RATES, | ||
139 | .formats = S3C64XX_I2S_FMTS,}, | ||
140 | .ops = &s3c64xx_i2s_dai_ops, | ||
141 | .symmetric_rates = 1, | ||
142 | },}; | ||
143 | |||
83 | static __devinit int s3c64xx_iis_dev_probe(struct platform_device *pdev) | 144 | static __devinit int s3c64xx_iis_dev_probe(struct platform_device *pdev) |
84 | { | 145 | { |
146 | struct s3c_audio_pdata *i2s_pdata; | ||
85 | struct s3c_i2sv2_info *i2s; | 147 | struct s3c_i2sv2_info *i2s; |
86 | struct snd_soc_dai *dai; | 148 | struct resource *res; |
87 | int ret; | 149 | int i, ret; |
88 | 150 | ||
89 | if (pdev->id >= MAX_I2SV3) { | 151 | if (pdev->id >= MAX_I2SV3) { |
90 | dev_err(&pdev->dev, "id %d out of range\n", pdev->id); | 152 | dev_err(&pdev->dev, "id %d out of range\n", pdev->id); |
@@ -92,74 +154,63 @@ static __devinit int s3c64xx_iis_dev_probe(struct platform_device *pdev) | |||
92 | } | 154 | } |
93 | 155 | ||
94 | i2s = &s3c64xx_i2s[pdev->id]; | 156 | i2s = &s3c64xx_i2s[pdev->id]; |
95 | dai = &s3c64xx_i2s_dai[pdev->id]; | ||
96 | dai->dev = &pdev->dev; | ||
97 | dai->name = "s3c64xx-i2s"; | ||
98 | dai->id = pdev->id; | ||
99 | dai->symmetric_rates = 1; | ||
100 | dai->playback.channels_min = 2; | ||
101 | dai->playback.channels_max = 2; | ||
102 | dai->playback.rates = S3C64XX_I2S_RATES; | ||
103 | dai->playback.formats = S3C64XX_I2S_FMTS; | ||
104 | dai->capture.channels_min = 2; | ||
105 | dai->capture.channels_max = 2; | ||
106 | dai->capture.rates = S3C64XX_I2S_RATES; | ||
107 | dai->capture.formats = S3C64XX_I2S_FMTS; | ||
108 | dai->probe = s3c64xx_i2s_probe; | ||
109 | dai->ops = &s3c64xx_i2s_dai_ops; | ||
110 | |||
111 | i2s->feature |= S3C_FEATURE_CDCLKCON; | ||
112 | 157 | ||
113 | i2s->dma_capture = &s3c64xx_i2s_pcm_stereo_in[pdev->id]; | 158 | i2s->dma_capture = &s3c64xx_i2s_pcm_stereo_in[pdev->id]; |
114 | i2s->dma_playback = &s3c64xx_i2s_pcm_stereo_out[pdev->id]; | 159 | i2s->dma_playback = &s3c64xx_i2s_pcm_stereo_out[pdev->id]; |
115 | 160 | ||
116 | if (pdev->id == 0) { | 161 | res = platform_get_resource(pdev, IORESOURCE_DMA, 0); |
117 | i2s->dma_capture->channel = DMACH_I2S0_IN; | 162 | if (!res) { |
118 | i2s->dma_capture->dma_addr = S3C64XX_PA_IIS0 + S3C2412_IISRXD; | 163 | dev_err(&pdev->dev, "Unable to get I2S-TX dma resource\n"); |
119 | i2s->dma_playback->channel = DMACH_I2S0_OUT; | 164 | return -ENXIO; |
120 | i2s->dma_playback->dma_addr = S3C64XX_PA_IIS0 + S3C2412_IISTXD; | 165 | } |
121 | } else { | 166 | i2s->dma_playback->channel = res->start; |
122 | i2s->dma_capture->channel = DMACH_I2S1_IN; | 167 | |
123 | i2s->dma_capture->dma_addr = S3C64XX_PA_IIS1 + S3C2412_IISRXD; | 168 | res = platform_get_resource(pdev, IORESOURCE_DMA, 1); |
124 | i2s->dma_playback->channel = DMACH_I2S1_OUT; | 169 | if (!res) { |
125 | i2s->dma_playback->dma_addr = S3C64XX_PA_IIS1 + S3C2412_IISTXD; | 170 | dev_err(&pdev->dev, "Unable to get I2S-RX dma resource\n"); |
171 | return -ENXIO; | ||
172 | } | ||
173 | i2s->dma_capture->channel = res->start; | ||
174 | |||
175 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
176 | if (!res) { | ||
177 | dev_err(&pdev->dev, "Unable to get I2S SFR address\n"); | ||
178 | return -ENXIO; | ||
126 | } | 179 | } |
127 | 180 | ||
181 | if (!request_mem_region(res->start, resource_size(res), | ||
182 | "s3c64xx-i2s")) { | ||
183 | dev_err(&pdev->dev, "Unable to request SFR region\n"); | ||
184 | return -EBUSY; | ||
185 | } | ||
186 | i2s->base = res->start; | ||
187 | |||
188 | i2s_pdata = pdev->dev.platform_data; | ||
189 | if (i2s_pdata && i2s_pdata->cfg_gpio && i2s_pdata->cfg_gpio(pdev)) { | ||
190 | dev_err(&pdev->dev, "Unable to configure gpio\n"); | ||
191 | return -EINVAL; | ||
192 | } | ||
193 | i2s->dma_capture->dma_addr = res->start + S3C2412_IISRXD; | ||
194 | i2s->dma_playback->dma_addr = res->start + S3C2412_IISTXD; | ||
195 | |||
128 | i2s->dma_capture->client = &s3c64xx_dma_client_in; | 196 | i2s->dma_capture->client = &s3c64xx_dma_client_in; |
129 | i2s->dma_capture->dma_size = 4; | 197 | i2s->dma_capture->dma_size = 4; |
130 | i2s->dma_playback->client = &s3c64xx_dma_client_out; | 198 | i2s->dma_playback->client = &s3c64xx_dma_client_out; |
131 | i2s->dma_playback->dma_size = 4; | 199 | i2s->dma_playback->dma_size = 4; |
132 | 200 | ||
133 | i2s->iis_cclk = clk_get(&pdev->dev, "audio-bus"); | 201 | for (i = 0; i < ARRAY_SIZE(s3c64xx_i2s_dai); i++) { |
134 | if (IS_ERR(i2s->iis_cclk)) { | 202 | ret = s3c_i2sv2_register_dai(&pdev->dev, i, |
135 | dev_err(&pdev->dev, "failed to get audio-bus\n"); | 203 | &s3c64xx_i2s_dai[i]); |
136 | ret = PTR_ERR(i2s->iis_cclk); | 204 | if (ret != 0) |
137 | goto err; | 205 | return ret; |
138 | } | 206 | } |
139 | 207 | ||
140 | clk_enable(i2s->iis_cclk); | ||
141 | |||
142 | ret = s3c_i2sv2_probe(pdev, dai, i2s, 0); | ||
143 | if (ret) | ||
144 | goto err_clk; | ||
145 | |||
146 | ret = s3c_i2sv2_register_dai(dai); | ||
147 | if (ret != 0) | ||
148 | goto err_i2sv2; | ||
149 | |||
150 | return 0; | 208 | return 0; |
151 | |||
152 | err_i2sv2: | ||
153 | /* Not implemented for I2Sv2 core yet */ | ||
154 | err_clk: | ||
155 | clk_put(i2s->iis_cclk); | ||
156 | err: | ||
157 | return ret; | ||
158 | } | 209 | } |
159 | 210 | ||
160 | static __devexit int s3c64xx_iis_dev_remove(struct platform_device *pdev) | 211 | static __devexit int s3c64xx_iis_dev_remove(struct platform_device *pdev) |
161 | { | 212 | { |
162 | dev_err(&pdev->dev, "Device removal not yet supported\n"); | 213 | snd_soc_unregister_dais(&pdev->dev, ARRAY_SIZE(s3c64xx_i2s_dai)); |
163 | return 0; | 214 | return 0; |
164 | } | 215 | } |
165 | 216 | ||
@@ -188,3 +239,4 @@ module_exit(s3c64xx_i2s_exit); | |||
188 | MODULE_AUTHOR("Ben Dooks, <ben@simtec.co.uk>"); | 239 | MODULE_AUTHOR("Ben Dooks, <ben@simtec.co.uk>"); |
189 | MODULE_DESCRIPTION("S3C64XX I2S SoC Interface"); | 240 | MODULE_DESCRIPTION("S3C64XX I2S SoC Interface"); |
190 | MODULE_LICENSE("GPL"); | 241 | MODULE_LICENSE("GPL"); |
242 | MODULE_ALIAS("platform:s3c64xx-iis"); | ||
diff --git a/sound/soc/s3c24xx/s3c64xx-i2s.h b/sound/soc/s3c24xx/s3c64xx-i2s.h index 7a40f43d1d51..19bd444bf8a6 100644 --- a/sound/soc/s3c24xx/s3c64xx-i2s.h +++ b/sound/soc/s3c24xx/s3c64xx-i2s.h | |||
@@ -36,7 +36,5 @@ struct clk; | |||
36 | (SNDRV_PCM_FMTBIT_S8 | SNDRV_PCM_FMTBIT_S16_LE |\ | 36 | (SNDRV_PCM_FMTBIT_S8 | SNDRV_PCM_FMTBIT_S16_LE |\ |
37 | SNDRV_PCM_FMTBIT_S24_LE) | 37 | SNDRV_PCM_FMTBIT_S24_LE) |
38 | 38 | ||
39 | extern struct snd_soc_dai s3c64xx_i2s_dai[]; | ||
40 | extern struct snd_soc_dai s3c64xx_i2s_v4_dai; | ||
41 | 39 | ||
42 | #endif /* __SND_SOC_S3C24XX_S3C64XX_I2S_H */ | 40 | #endif /* __SND_SOC_S3C24XX_S3C64XX_I2S_H */ |
diff --git a/sound/soc/s3c24xx/smartq_wm8987.c b/sound/soc/s3c24xx/smartq_wm8987.c index b480348140b0..dd20ca7f4681 100644 --- a/sound/soc/s3c24xx/smartq_wm8987.c +++ b/sound/soc/s3c24xx/smartq_wm8987.c | |||
@@ -211,8 +211,10 @@ static struct snd_soc_dai_link smartq_dai[] = { | |||
211 | { | 211 | { |
212 | .name = "wm8987", | 212 | .name = "wm8987", |
213 | .stream_name = "SmartQ Hi-Fi", | 213 | .stream_name = "SmartQ Hi-Fi", |
214 | .cpu_dai = &s3c64xx_i2s_dai[0], | 214 | .cpu_dai_name = "s3c64xx-i2s.0", |
215 | .codec_dai = &wm8750_dai, | 215 | .codec_dai_name = "wm8750-hifi", |
216 | .platform_name = "s3c24xx-pcm-audio", | ||
217 | .codec_name = "wm8750-codec.0-0x1a", | ||
216 | .init = smartq_wm8987_init, | 218 | .init = smartq_wm8987_init, |
217 | .ops = &smartq_hifi_ops, | 219 | .ops = &smartq_hifi_ops, |
218 | }, | 220 | }, |
@@ -220,16 +222,10 @@ static struct snd_soc_dai_link smartq_dai[] = { | |||
220 | 222 | ||
221 | static struct snd_soc_card snd_soc_smartq = { | 223 | static struct snd_soc_card snd_soc_smartq = { |
222 | .name = "SmartQ", | 224 | .name = "SmartQ", |
223 | .platform = &s3c24xx_soc_platform, | ||
224 | .dai_link = smartq_dai, | 225 | .dai_link = smartq_dai, |
225 | .num_links = ARRAY_SIZE(smartq_dai), | 226 | .num_links = ARRAY_SIZE(smartq_dai), |
226 | }; | 227 | }; |
227 | 228 | ||
228 | static struct snd_soc_device smartq_snd_devdata = { | ||
229 | .card = &snd_soc_smartq, | ||
230 | .codec_dev = &soc_codec_dev_wm8750, | ||
231 | }; | ||
232 | |||
233 | static struct platform_device *smartq_snd_device; | 229 | static struct platform_device *smartq_snd_device; |
234 | 230 | ||
235 | static int __init smartq_init(void) | 231 | static int __init smartq_init(void) |
@@ -245,8 +241,7 @@ static int __init smartq_init(void) | |||
245 | if (!smartq_snd_device) | 241 | if (!smartq_snd_device) |
246 | return -ENOMEM; | 242 | return -ENOMEM; |
247 | 243 | ||
248 | platform_set_drvdata(smartq_snd_device, &smartq_snd_devdata); | 244 | platform_set_drvdata(smartq_snd_device, &snd_soc_smartq); |
249 | smartq_snd_devdata.dev = &smartq_snd_device->dev; | ||
250 | 245 | ||
251 | ret = platform_device_add(smartq_snd_device); | 246 | ret = platform_device_add(smartq_snd_device); |
252 | if (ret) { | 247 | if (ret) { |
diff --git a/sound/soc/s3c24xx/smdk2443_wm9710.c b/sound/soc/s3c24xx/smdk2443_wm9710.c index 362258835e8d..66f9e222220b 100644 --- a/sound/soc/s3c24xx/smdk2443_wm9710.c +++ b/sound/soc/s3c24xx/smdk2443_wm9710.c | |||
@@ -19,7 +19,6 @@ | |||
19 | #include <sound/soc.h> | 19 | #include <sound/soc.h> |
20 | #include <sound/soc-dapm.h> | 20 | #include <sound/soc-dapm.h> |
21 | 21 | ||
22 | #include "../codecs/ac97.h" | ||
23 | #include "s3c-dma.h" | 22 | #include "s3c-dma.h" |
24 | #include "s3c-ac97.h" | 23 | #include "s3c-ac97.h" |
25 | 24 | ||
@@ -29,23 +28,19 @@ static struct snd_soc_dai_link smdk2443_dai[] = { | |||
29 | { | 28 | { |
30 | .name = "AC97", | 29 | .name = "AC97", |
31 | .stream_name = "AC97 HiFi", | 30 | .stream_name = "AC97 HiFi", |
32 | .cpu_dai = &s3c_ac97_dai[S3C_AC97_DAI_PCM], | 31 | .cpu_dai_name = "s3c-ac97-dai", |
33 | .codec_dai = &ac97_dai, | 32 | .codec_dai_name = "ac97-hifi", |
33 | .codec_name = "ac97-codec", | ||
34 | .platform_name = "s3c24xx-pcm-audio", | ||
34 | }, | 35 | }, |
35 | }; | 36 | }; |
36 | 37 | ||
37 | static struct snd_soc_card smdk2443 = { | 38 | static struct snd_soc_card smdk2443 = { |
38 | .name = "SMDK2443", | 39 | .name = "SMDK2443", |
39 | .platform = &s3c24xx_soc_platform, | ||
40 | .dai_link = smdk2443_dai, | 40 | .dai_link = smdk2443_dai, |
41 | .num_links = ARRAY_SIZE(smdk2443_dai), | 41 | .num_links = ARRAY_SIZE(smdk2443_dai), |
42 | }; | 42 | }; |
43 | 43 | ||
44 | static struct snd_soc_device smdk2443_snd_ac97_devdata = { | ||
45 | .card = &smdk2443, | ||
46 | .codec_dev = &soc_codec_dev_ac97, | ||
47 | }; | ||
48 | |||
49 | static struct platform_device *smdk2443_snd_ac97_device; | 44 | static struct platform_device *smdk2443_snd_ac97_device; |
50 | 45 | ||
51 | static int __init smdk2443_init(void) | 46 | static int __init smdk2443_init(void) |
@@ -56,9 +51,7 @@ static int __init smdk2443_init(void) | |||
56 | if (!smdk2443_snd_ac97_device) | 51 | if (!smdk2443_snd_ac97_device) |
57 | return -ENOMEM; | 52 | return -ENOMEM; |
58 | 53 | ||
59 | platform_set_drvdata(smdk2443_snd_ac97_device, | 54 | platform_set_drvdata(smdk2443_snd_ac97_device, &smdk2443); |
60 | &smdk2443_snd_ac97_devdata); | ||
61 | smdk2443_snd_ac97_devdata.dev = &smdk2443_snd_ac97_device->dev; | ||
62 | ret = platform_device_add(smdk2443_snd_ac97_device); | 55 | ret = platform_device_add(smdk2443_snd_ac97_device); |
63 | 56 | ||
64 | if (ret) | 57 | if (ret) |
diff --git a/sound/soc/s3c24xx/smdk64xx_wm8580.c b/sound/soc/s3c24xx/smdk64xx_wm8580.c index 4926acaaa8b0..5c21e26da075 100644 --- a/sound/soc/s3c24xx/smdk64xx_wm8580.c +++ b/sound/soc/s3c24xx/smdk64xx_wm8580.c | |||
@@ -35,8 +35,8 @@ static int smdk64xx_hw_params(struct snd_pcm_substream *substream, | |||
35 | struct snd_pcm_hw_params *params) | 35 | struct snd_pcm_hw_params *params) |
36 | { | 36 | { |
37 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 37 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
38 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | 38 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
39 | struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; | 39 | struct snd_soc_dai *codec_dai = rtd->codec_dai; |
40 | unsigned int pll_out; | 40 | unsigned int pll_out; |
41 | int bfs, rfs, ret; | 41 | int bfs, rfs, ret; |
42 | 42 | ||
@@ -180,8 +180,10 @@ static const struct snd_soc_dapm_route audio_map_rx[] = { | |||
180 | {"Rear", NULL, "VOUT3R"}, | 180 | {"Rear", NULL, "VOUT3R"}, |
181 | }; | 181 | }; |
182 | 182 | ||
183 | static int smdk64xx_wm8580_init_paiftx(struct snd_soc_codec *codec) | 183 | static int smdk64xx_wm8580_init_paiftx(struct snd_soc_pcm_runtime *rtd) |
184 | { | 184 | { |
185 | struct snd_soc_codec *codec = rtd->codec; | ||
186 | |||
185 | /* Add smdk64xx specific Capture widgets */ | 187 | /* Add smdk64xx specific Capture widgets */ |
186 | snd_soc_dapm_new_controls(codec, wm8580_dapm_widgets_cpt, | 188 | snd_soc_dapm_new_controls(codec, wm8580_dapm_widgets_cpt, |
187 | ARRAY_SIZE(wm8580_dapm_widgets_cpt)); | 189 | ARRAY_SIZE(wm8580_dapm_widgets_cpt)); |
@@ -200,8 +202,10 @@ static int smdk64xx_wm8580_init_paiftx(struct snd_soc_codec *codec) | |||
200 | return 0; | 202 | return 0; |
201 | } | 203 | } |
202 | 204 | ||
203 | static int smdk64xx_wm8580_init_paifrx(struct snd_soc_codec *codec) | 205 | static int smdk64xx_wm8580_init_paifrx(struct snd_soc_pcm_runtime *rtd) |
204 | { | 206 | { |
207 | struct snd_soc_codec *codec = rtd->codec; | ||
208 | |||
205 | /* Add smdk64xx specific Playback widgets */ | 209 | /* Add smdk64xx specific Playback widgets */ |
206 | snd_soc_dapm_new_controls(codec, wm8580_dapm_widgets_pbk, | 210 | snd_soc_dapm_new_controls(codec, wm8580_dapm_widgets_pbk, |
207 | ARRAY_SIZE(wm8580_dapm_widgets_pbk)); | 211 | ARRAY_SIZE(wm8580_dapm_widgets_pbk)); |
@@ -219,16 +223,20 @@ static struct snd_soc_dai_link smdk64xx_dai[] = { | |||
219 | { /* Primary Playback i/f */ | 223 | { /* Primary Playback i/f */ |
220 | .name = "WM8580 PAIF RX", | 224 | .name = "WM8580 PAIF RX", |
221 | .stream_name = "Playback", | 225 | .stream_name = "Playback", |
222 | .cpu_dai = &s3c64xx_i2s_v4_dai, | 226 | .cpu_dai_name = "s3c64xx-iis-v4", |
223 | .codec_dai = &wm8580_dai[WM8580_DAI_PAIFRX], | 227 | .codec_dai_name = "wm8580-hifi-playback", |
228 | .platform_name = "s3c24xx-pcm-audio", | ||
229 | .codec_name = "wm8580-codec.0-001b", | ||
224 | .init = smdk64xx_wm8580_init_paifrx, | 230 | .init = smdk64xx_wm8580_init_paifrx, |
225 | .ops = &smdk64xx_ops, | 231 | .ops = &smdk64xx_ops, |
226 | }, | 232 | }, |
227 | { /* Primary Capture i/f */ | 233 | { /* Primary Capture i/f */ |
228 | .name = "WM8580 PAIF TX", | 234 | .name = "WM8580 PAIF TX", |
229 | .stream_name = "Capture", | 235 | .stream_name = "Capture", |
230 | .cpu_dai = &s3c64xx_i2s_v4_dai, | 236 | .cpu_dai_name = "s3c64xx-iis-v4", |
231 | .codec_dai = &wm8580_dai[WM8580_DAI_PAIFTX], | 237 | .codec_dai_name = "wm8580-hifi-capture", |
238 | .platform_name = "s3c24xx-pcm-audio", | ||
239 | .codec_name = "wm8580-codec.0-001b", | ||
232 | .init = smdk64xx_wm8580_init_paiftx, | 240 | .init = smdk64xx_wm8580_init_paiftx, |
233 | .ops = &smdk64xx_ops, | 241 | .ops = &smdk64xx_ops, |
234 | }, | 242 | }, |
@@ -236,16 +244,10 @@ static struct snd_soc_dai_link smdk64xx_dai[] = { | |||
236 | 244 | ||
237 | static struct snd_soc_card smdk64xx = { | 245 | static struct snd_soc_card smdk64xx = { |
238 | .name = "smdk64xx", | 246 | .name = "smdk64xx", |
239 | .platform = &s3c24xx_soc_platform, | ||
240 | .dai_link = smdk64xx_dai, | 247 | .dai_link = smdk64xx_dai, |
241 | .num_links = ARRAY_SIZE(smdk64xx_dai), | 248 | .num_links = ARRAY_SIZE(smdk64xx_dai), |
242 | }; | 249 | }; |
243 | 250 | ||
244 | static struct snd_soc_device smdk64xx_snd_devdata = { | ||
245 | .card = &smdk64xx, | ||
246 | .codec_dev = &soc_codec_dev_wm8580, | ||
247 | }; | ||
248 | |||
249 | static struct platform_device *smdk64xx_snd_device; | 251 | static struct platform_device *smdk64xx_snd_device; |
250 | 252 | ||
251 | static int __init smdk64xx_audio_init(void) | 253 | static int __init smdk64xx_audio_init(void) |
@@ -256,8 +258,7 @@ static int __init smdk64xx_audio_init(void) | |||
256 | if (!smdk64xx_snd_device) | 258 | if (!smdk64xx_snd_device) |
257 | return -ENOMEM; | 259 | return -ENOMEM; |
258 | 260 | ||
259 | platform_set_drvdata(smdk64xx_snd_device, &smdk64xx_snd_devdata); | 261 | platform_set_drvdata(smdk64xx_snd_device, &smdk64xx); |
260 | smdk64xx_snd_devdata.dev = &smdk64xx_snd_device->dev; | ||
261 | ret = platform_device_add(smdk64xx_snd_device); | 262 | ret = platform_device_add(smdk64xx_snd_device); |
262 | 263 | ||
263 | if (ret) | 264 | if (ret) |
diff --git a/sound/soc/s3c24xx/smdk_wm9713.c b/sound/soc/s3c24xx/smdk_wm9713.c index 5527b9e88c98..90108a7a0a8e 100644 --- a/sound/soc/s3c24xx/smdk_wm9713.c +++ b/sound/soc/s3c24xx/smdk_wm9713.c | |||
@@ -46,40 +46,50 @@ static struct snd_soc_card smdk; | |||
46 | static struct snd_soc_dai_link smdk_dai = { | 46 | static struct snd_soc_dai_link smdk_dai = { |
47 | .name = "AC97", | 47 | .name = "AC97", |
48 | .stream_name = "AC97 PCM", | 48 | .stream_name = "AC97 PCM", |
49 | .cpu_dai = &s3c_ac97_dai[S3C_AC97_DAI_PCM], | 49 | .platform_name = "s3c24xx-pcm-audio", |
50 | .codec_dai = &wm9713_dai[WM9713_DAI_AC97_HIFI], | 50 | .cpu_dai_name = "s3c-ac97-dai", |
51 | .codec_dai_name = "wm9713-hifi", | ||
52 | .codec_name = "wm9713-codec", | ||
51 | }; | 53 | }; |
52 | 54 | ||
53 | static struct snd_soc_card smdk = { | 55 | static struct snd_soc_card smdk = { |
54 | .name = "SMDK", | 56 | .name = "SMDK", |
55 | .platform = &s3c24xx_soc_platform, | ||
56 | .dai_link = &smdk_dai, | 57 | .dai_link = &smdk_dai, |
57 | .num_links = 1, | 58 | .num_links = 1, |
58 | }; | 59 | }; |
59 | 60 | ||
60 | static struct snd_soc_device smdk_snd_ac97_devdata = { | 61 | static struct platform_device *smdk_snd_wm9713_device; |
61 | .card = &smdk, | ||
62 | .codec_dev = &soc_codec_dev_wm9713, | ||
63 | }; | ||
64 | |||
65 | static struct platform_device *smdk_snd_ac97_device; | 62 | static struct platform_device *smdk_snd_ac97_device; |
66 | 63 | ||
67 | static int __init smdk_init(void) | 64 | static int __init smdk_init(void) |
68 | { | 65 | { |
69 | int ret; | 66 | int ret; |
70 | 67 | ||
71 | smdk_snd_ac97_device = platform_device_alloc("soc-audio", -1); | 68 | smdk_snd_wm9713_device = platform_device_alloc("wm9713-codec", -1); |
72 | if (!smdk_snd_ac97_device) | 69 | if (!smdk_snd_wm9713_device) |
73 | return -ENOMEM; | 70 | return -ENOMEM; |
74 | 71 | ||
75 | platform_set_drvdata(smdk_snd_ac97_device, | 72 | ret = platform_device_add(smdk_snd_wm9713_device); |
76 | &smdk_snd_ac97_devdata); | 73 | if (ret) |
77 | smdk_snd_ac97_devdata.dev = &smdk_snd_ac97_device->dev; | 74 | goto err; |
75 | |||
76 | smdk_snd_ac97_device = platform_device_alloc("soc-audio", -1); | ||
77 | if (!smdk_snd_ac97_device) { | ||
78 | ret = -ENOMEM; | ||
79 | goto err; | ||
80 | } | ||
81 | |||
82 | platform_set_drvdata(smdk_snd_ac97_device, &smdk); | ||
78 | 83 | ||
79 | ret = platform_device_add(smdk_snd_ac97_device); | 84 | ret = platform_device_add(smdk_snd_ac97_device); |
80 | if (ret) | 85 | if (ret) { |
81 | platform_device_put(smdk_snd_ac97_device); | 86 | platform_device_put(smdk_snd_ac97_device); |
87 | goto err; | ||
88 | } | ||
82 | 89 | ||
90 | return 0; | ||
91 | err: | ||
92 | platform_device_put(smdk_snd_wm9713_device); | ||
83 | return ret; | 93 | return ret; |
84 | } | 94 | } |
85 | 95 | ||