aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/pxa/raumfeld.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/pxa/raumfeld.c')
-rw-r--r--sound/soc/pxa/raumfeld.c114
1 files changed, 36 insertions, 78 deletions
diff --git a/sound/soc/pxa/raumfeld.c b/sound/soc/pxa/raumfeld.c
index 7e3f41696c41..2cda82bc5d2e 100644
--- a/sound/soc/pxa/raumfeld.c
+++ b/sound/soc/pxa/raumfeld.c
@@ -26,9 +26,6 @@
26 26
27#include <asm/mach-types.h> 27#include <asm/mach-types.h>
28 28
29#include "../codecs/cs4270.h"
30#include "../codecs/ak4104.h"
31#include "pxa2xx-pcm.h"
32#include "pxa-ssp.h" 29#include "pxa-ssp.h"
33 30
34#define GPIO_SPDIF_RESET (38) 31#define GPIO_SPDIF_RESET (38)
@@ -71,7 +68,7 @@ static void raumfeld_enable_audio(bool en)
71static int raumfeld_cs4270_startup(struct snd_pcm_substream *substream) 68static int raumfeld_cs4270_startup(struct snd_pcm_substream *substream)
72{ 69{
73 struct snd_soc_pcm_runtime *rtd = substream->private_data; 70 struct snd_soc_pcm_runtime *rtd = substream->private_data;
74 struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; 71 struct snd_soc_dai *codec_dai = rtd->codec_dai;
75 72
76 /* set freq to 0 to enable all possible codec sample rates */ 73 /* set freq to 0 to enable all possible codec sample rates */
77 return snd_soc_dai_set_sysclk(codec_dai, 0, 0, 0); 74 return snd_soc_dai_set_sysclk(codec_dai, 0, 0, 0);
@@ -80,7 +77,7 @@ static int raumfeld_cs4270_startup(struct snd_pcm_substream *substream)
80static void raumfeld_cs4270_shutdown(struct snd_pcm_substream *substream) 77static void raumfeld_cs4270_shutdown(struct snd_pcm_substream *substream)
81{ 78{
82 struct snd_soc_pcm_runtime *rtd = substream->private_data; 79 struct snd_soc_pcm_runtime *rtd = substream->private_data;
83 struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; 80 struct snd_soc_dai *codec_dai = rtd->codec_dai;
84 81
85 /* set freq to 0 to enable all possible codec sample rates */ 82 /* set freq to 0 to enable all possible codec sample rates */
86 snd_soc_dai_set_sysclk(codec_dai, 0, 0, 0); 83 snd_soc_dai_set_sysclk(codec_dai, 0, 0, 0);
@@ -90,8 +87,8 @@ static int raumfeld_cs4270_hw_params(struct snd_pcm_substream *substream,
90 struct snd_pcm_hw_params *params) 87 struct snd_pcm_hw_params *params)
91{ 88{
92 struct snd_soc_pcm_runtime *rtd = substream->private_data; 89 struct snd_soc_pcm_runtime *rtd = substream->private_data;
93 struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; 90 struct snd_soc_dai *codec_dai = rtd->codec_dai;
94 struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; 91 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
95 unsigned int fmt, clk = 0; 92 unsigned int fmt, clk = 0;
96 int ret = 0; 93 int ret = 0;
97 94
@@ -167,32 +164,14 @@ static int raumfeld_line_resume(struct platform_device *pdev)
167 return 0; 164 return 0;
168} 165}
169 166
170static struct snd_soc_dai_link raumfeld_line_dai = {
171 .name = "CS4270",
172 .stream_name = "CS4270",
173 .cpu_dai = &pxa_ssp_dai[PXA_DAI_SSP1],
174 .codec_dai = &cs4270_dai,
175 .ops = &raumfeld_cs4270_ops,
176};
177
178static struct snd_soc_card snd_soc_line_raumfeld = {
179 .name = "Raumfeld analog",
180 .platform = &pxa2xx_soc_platform,
181 .dai_link = &raumfeld_line_dai,
182 .suspend_post = raumfeld_line_suspend,
183 .resume_pre = raumfeld_line_resume,
184 .num_links = 1,
185};
186
187
188/* AK4104 */ 167/* AK4104 */
189 168
190static int raumfeld_ak4104_hw_params(struct snd_pcm_substream *substream, 169static int raumfeld_ak4104_hw_params(struct snd_pcm_substream *substream,
191 struct snd_pcm_hw_params *params) 170 struct snd_pcm_hw_params *params)
192{ 171{
193 struct snd_soc_pcm_runtime *rtd = substream->private_data; 172 struct snd_soc_pcm_runtime *rtd = substream->private_data;
194 struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; 173 struct snd_soc_dai *codec_dai = rtd->codec_dai;
195 struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; 174 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
196 int fmt, ret = 0, clk = 0; 175 int fmt, ret = 0, clk = 0;
197 176
198 switch (params_rate(params)) { 177 switch (params_rate(params)) {
@@ -247,34 +226,35 @@ static struct snd_soc_ops raumfeld_ak4104_ops = {
247 .hw_params = raumfeld_ak4104_hw_params, 226 .hw_params = raumfeld_ak4104_hw_params,
248}; 227};
249 228
250static struct snd_soc_dai_link raumfeld_spdif_dai = { 229static struct snd_soc_dai_link raumfeld_dai[] = {
230{
251 .name = "ak4104", 231 .name = "ak4104",
252 .stream_name = "Playback", 232 .stream_name = "Playback",
253 .cpu_dai = &pxa_ssp_dai[PXA_DAI_SSP2], 233 .cpu_dai_name = "pxa-ssp-dai.1",
254 .codec_dai = &ak4104_dai, 234 .codec_dai_name = "ak4104-hifi",
235 .platform_name = "pxa-pcm-audio",
255 .ops = &raumfeld_ak4104_ops, 236 .ops = &raumfeld_ak4104_ops,
256}; 237 .codec_name = "ak4104-codec.0",
257 238},
258static struct snd_soc_card snd_soc_spdif_raumfeld = { 239{
259 .name = "Raumfeld S/PDIF", 240 .name = "CS4270",
260 .platform = &pxa2xx_soc_platform, 241 .stream_name = "CS4270",
261 .dai_link = &raumfeld_spdif_dai, 242 .cpu_dai_name = "pxa-ssp-dai.0",
262 .num_links = 1 243 .platform_name = "pxa-pcm-audio",
263}; 244 .codec_dai_name = "cs4270-hifi",
264 245 .codec_name = "cs4270-codec.0-0048",
265/* raumfeld_audio audio subsystem */ 246 .ops = &raumfeld_cs4270_ops,
266static struct snd_soc_device raumfeld_line_devdata = { 247},};
267 .card = &snd_soc_line_raumfeld,
268 .codec_dev = &soc_codec_device_cs4270,
269};
270 248
271static struct snd_soc_device raumfeld_spdif_devdata = { 249static struct snd_soc_card snd_soc_raumfeld = {
272 .card = &snd_soc_spdif_raumfeld, 250 .name = "Raumfeld",
273 .codec_dev = &soc_codec_device_ak4104, 251 .dai_link = raumfeld_dai,
252 .suspend_post = raumfeld_line_suspend,
253 .resume_pre = raumfeld_line_resume,
254 .num_links = ARRAY_SIZE(raumfeld_dai),
274}; 255};
275 256
276static struct platform_device *raumfeld_audio_line_device; 257static struct platform_device *raumfeld_audio_device;
277static struct platform_device *raumfeld_audio_spdif_device;
278 258
279static int __init raumfeld_audio_init(void) 259static int __init raumfeld_audio_init(void)
280{ 260{
@@ -292,38 +272,19 @@ static int __init raumfeld_audio_init(void)
292 272
293 set_max9485_clk(MAX9485_MCLK_FREQ_122880); 273 set_max9485_clk(MAX9485_MCLK_FREQ_122880);
294 274
295 /* LINE */ 275 /* Register LINE and SPDIF */
296 raumfeld_audio_line_device = platform_device_alloc("soc-audio", 0); 276 raumfeld_audio_device = platform_device_alloc("soc-audio", 0);
297 if (!raumfeld_audio_line_device) 277 if (!raumfeld_audio_device)
298 return -ENOMEM; 278 return -ENOMEM;
299 279
300 platform_set_drvdata(raumfeld_audio_line_device, 280 platform_set_drvdata(raumfeld_audio_device,
301 &raumfeld_line_devdata); 281 &snd_soc_raumfeld);
302 raumfeld_line_devdata.dev = &raumfeld_audio_line_device->dev; 282 ret = platform_device_add(raumfeld_audio_device);
303 ret = platform_device_add(raumfeld_audio_line_device);
304 if (ret)
305 platform_device_put(raumfeld_audio_line_device);
306 283
307 /* no S/PDIF on Speakers */ 284 /* no S/PDIF on Speakers */
308 if (machine_is_raumfeld_speaker()) 285 if (machine_is_raumfeld_speaker())
309 return ret; 286 return ret;
310 287
311 /* S/PDIF */
312 raumfeld_audio_spdif_device = platform_device_alloc("soc-audio", 1);
313 if (!raumfeld_audio_spdif_device) {
314 platform_device_put(raumfeld_audio_line_device);
315 return -ENOMEM;
316 }
317
318 platform_set_drvdata(raumfeld_audio_spdif_device,
319 &raumfeld_spdif_devdata);
320 raumfeld_spdif_devdata.dev = &raumfeld_audio_spdif_device->dev;
321 ret = platform_device_add(raumfeld_audio_spdif_device);
322 if (ret) {
323 platform_device_put(raumfeld_audio_line_device);
324 platform_device_put(raumfeld_audio_spdif_device);
325 }
326
327 raumfeld_enable_audio(true); 288 raumfeld_enable_audio(true);
328 289
329 return ret; 290 return ret;
@@ -333,10 +294,7 @@ static void __exit raumfeld_audio_exit(void)
333{ 294{
334 raumfeld_enable_audio(false); 295 raumfeld_enable_audio(false);
335 296
336 platform_device_unregister(raumfeld_audio_line_device); 297 platform_device_unregister(raumfeld_audio_device);
337
338 if (machine_is_raumfeld_connector())
339 platform_device_unregister(raumfeld_audio_spdif_device);
340 298
341 i2c_unregister_device(max9486_client); 299 i2c_unregister_device(max9486_client);
342 300