diff options
| -rw-r--r-- | sound/soc/pxa/raumfeld.c | 92 |
1 files changed, 58 insertions, 34 deletions
diff --git a/sound/soc/pxa/raumfeld.c b/sound/soc/pxa/raumfeld.c index 2afabaf59491..1a591f1ebfbd 100644 --- a/sound/soc/pxa/raumfeld.c +++ b/sound/soc/pxa/raumfeld.c | |||
| @@ -151,13 +151,13 @@ static struct snd_soc_ops raumfeld_cs4270_ops = { | |||
| 151 | .hw_params = raumfeld_cs4270_hw_params, | 151 | .hw_params = raumfeld_cs4270_hw_params, |
| 152 | }; | 152 | }; |
| 153 | 153 | ||
| 154 | static int raumfeld_line_suspend(struct snd_soc_card *card) | 154 | static int raumfeld_analog_suspend(struct snd_soc_card *card) |
| 155 | { | 155 | { |
| 156 | raumfeld_enable_audio(false); | 156 | raumfeld_enable_audio(false); |
| 157 | return 0; | 157 | return 0; |
| 158 | } | 158 | } |
| 159 | 159 | ||
| 160 | static int raumfeld_line_resume(struct snd_soc_card *card) | 160 | static int raumfeld_analog_resume(struct snd_soc_card *card) |
| 161 | { | 161 | { |
| 162 | raumfeld_enable_audio(true); | 162 | raumfeld_enable_audio(true); |
| 163 | return 0; | 163 | return 0; |
| @@ -225,32 +225,53 @@ static struct snd_soc_ops raumfeld_ak4104_ops = { | |||
| 225 | .hw_params = raumfeld_ak4104_hw_params, | 225 | .hw_params = raumfeld_ak4104_hw_params, |
| 226 | }; | 226 | }; |
| 227 | 227 | ||
| 228 | static struct snd_soc_dai_link raumfeld_dai[] = { | 228 | #define DAI_LINK_CS4270 \ |
| 229 | { \ | ||
| 230 | .name = "CS4270", \ | ||
| 231 | .stream_name = "CS4270", \ | ||
| 232 | .cpu_dai_name = "pxa-ssp-dai.0", \ | ||
| 233 | .platform_name = "pxa-pcm-audio", \ | ||
| 234 | .codec_dai_name = "cs4270-hifi", \ | ||
| 235 | .codec_name = "cs4270-codec.0-0048", \ | ||
| 236 | .ops = &raumfeld_cs4270_ops, \ | ||
| 237 | } | ||
| 238 | |||
| 239 | #define DAI_LINK_AK4104 \ | ||
| 240 | { \ | ||
| 241 | .name = "ak4104", \ | ||
| 242 | .stream_name = "Playback", \ | ||
| 243 | .cpu_dai_name = "pxa-ssp-dai.1", \ | ||
| 244 | .codec_dai_name = "ak4104-hifi", \ | ||
| 245 | .platform_name = "pxa-pcm-audio", \ | ||
| 246 | .ops = &raumfeld_ak4104_ops, \ | ||
| 247 | .codec_name = "spi0.0", \ | ||
| 248 | } | ||
| 249 | |||
| 250 | static struct snd_soc_dai_link snd_soc_raumfeld_connector_dai[] = | ||
| 229 | { | 251 | { |
| 230 | .name = "ak4104", | 252 | DAI_LINK_CS4270, |
| 231 | .stream_name = "Playback", | 253 | DAI_LINK_AK4104, |
| 232 | .cpu_dai_name = "pxa-ssp-dai.1", | 254 | }; |
| 233 | .codec_dai_name = "ak4104-hifi", | 255 | |
| 234 | .platform_name = "pxa-pcm-audio", | 256 | static struct snd_soc_dai_link snd_soc_raumfeld_speaker_dai[] = |
| 235 | .ops = &raumfeld_ak4104_ops, | ||
| 236 | .codec_name = "ak4104-codec.0", | ||
| 237 | }, | ||
| 238 | { | 257 | { |
| 239 | .name = "CS4270", | 258 | DAI_LINK_CS4270, |
| 240 | .stream_name = "CS4270", | 259 | }; |
| 241 | .cpu_dai_name = "pxa-ssp-dai.0", | 260 | |
| 242 | .platform_name = "pxa-pcm-audio", | 261 | static struct snd_soc_card snd_soc_raumfeld_connector = { |
| 243 | .codec_dai_name = "cs4270-hifi", | 262 | .name = "Raumfeld Connector", |
| 244 | .codec_name = "cs4270-codec.0-0048", | 263 | .dai_link = snd_soc_raumfeld_connector_dai, |
| 245 | .ops = &raumfeld_cs4270_ops, | 264 | .num_links = ARRAY_SIZE(snd_soc_raumfeld_connector_dai), |
| 246 | },}; | 265 | .suspend_post = raumfeld_analog_suspend, |
| 247 | 266 | .resume_pre = raumfeld_analog_resume, | |
| 248 | static struct snd_soc_card snd_soc_raumfeld = { | 267 | }; |
| 249 | .name = "Raumfeld", | 268 | |
| 250 | .dai_link = raumfeld_dai, | 269 | static struct snd_soc_card snd_soc_raumfeld_speaker = { |
| 251 | .suspend_post = raumfeld_line_suspend, | 270 | .name = "Raumfeld Speaker", |
| 252 | .resume_pre = raumfeld_line_resume, | 271 | .dai_link = snd_soc_raumfeld_speaker_dai, |
| 253 | .num_links = ARRAY_SIZE(raumfeld_dai), | 272 | .num_links = ARRAY_SIZE(snd_soc_raumfeld_speaker_dai), |
| 273 | .suspend_post = raumfeld_analog_suspend, | ||
| 274 | .resume_pre = raumfeld_analog_resume, | ||
| 254 | }; | 275 | }; |
| 255 | 276 | ||
| 256 | static struct platform_device *raumfeld_audio_device; | 277 | static struct platform_device *raumfeld_audio_device; |
| @@ -271,22 +292,25 @@ static int __init raumfeld_audio_init(void) | |||
| 271 | 292 | ||
| 272 | set_max9485_clk(MAX9485_MCLK_FREQ_122880); | 293 | set_max9485_clk(MAX9485_MCLK_FREQ_122880); |
| 273 | 294 | ||
| 274 | /* Register LINE and SPDIF */ | 295 | /* Register analog device */ |
| 275 | raumfeld_audio_device = platform_device_alloc("soc-audio", 0); | 296 | raumfeld_audio_device = platform_device_alloc("soc-audio", 0); |
| 276 | if (!raumfeld_audio_device) | 297 | if (!raumfeld_audio_device) |
| 277 | return -ENOMEM; | 298 | return -ENOMEM; |
| 278 | 299 | ||
| 279 | platform_set_drvdata(raumfeld_audio_device, | ||
| 280 | &snd_soc_raumfeld); | ||
| 281 | ret = platform_device_add(raumfeld_audio_device); | ||
| 282 | |||
| 283 | /* no S/PDIF on Speakers */ | ||
| 284 | if (machine_is_raumfeld_speaker()) | 300 | if (machine_is_raumfeld_speaker()) |
| 301 | platform_set_drvdata(raumfeld_audio_device, | ||
| 302 | &snd_soc_raumfeld_speaker); | ||
| 303 | |||
| 304 | if (machine_is_raumfeld_connector()) | ||
| 305 | platform_set_drvdata(raumfeld_audio_device, | ||
| 306 | &snd_soc_raumfeld_connector); | ||
| 307 | |||
| 308 | ret = platform_device_add(raumfeld_audio_device); | ||
| 309 | if (ret < 0) | ||
| 285 | return ret; | 310 | return ret; |
| 286 | 311 | ||
| 287 | raumfeld_enable_audio(true); | 312 | raumfeld_enable_audio(true); |
| 288 | 313 | return 0; | |
| 289 | return ret; | ||
| 290 | } | 314 | } |
| 291 | 315 | ||
| 292 | static void __exit raumfeld_audio_exit(void) | 316 | static void __exit raumfeld_audio_exit(void) |
