aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@gmail.com>2011-12-29 20:16:11 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2011-12-29 21:00:06 -0500
commit2445ecc3c036ae5f1cc0c3dfed4731d9519a3811 (patch)
tree2933161346e760b1052cb92227c5f47b485ea734
parent1b39bf3468e03016ffdcadef3dac1fd75d2db6fa (diff)
ASoC: pxa: Convert poodle to use snd_soc_register_card()
Use snd_soc_register_card() instead of creating a "soc-audio" platform device. Signed-off-by: Axel Lin <axel.lin@gmail.com> Acked-by: Haojian Zhuang <haojian.zhuang@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
-rw-r--r--arch/arm/mach-pxa/poodle.c6
-rw-r--r--sound/soc/pxa/poodle.c42
2 files changed, 29 insertions, 19 deletions
diff --git a/arch/arm/mach-pxa/poodle.c b/arch/arm/mach-pxa/poodle.c
index 50c833177866..bd5682a31f34 100644
--- a/arch/arm/mach-pxa/poodle.c
+++ b/arch/arm/mach-pxa/poodle.c
@@ -158,6 +158,11 @@ static struct scoop_pcmcia_config poodle_pcmcia_config = {
158EXPORT_SYMBOL(poodle_scoop_device); 158EXPORT_SYMBOL(poodle_scoop_device);
159 159
160 160
161static struct platform_device poodle_audio_device = {
162 .name = "poodle-audio",
163 .id = -1,
164};
165
161/* LoCoMo device */ 166/* LoCoMo device */
162static struct resource locomo_resources[] = { 167static struct resource locomo_resources[] = {
163 [0] = { 168 [0] = {
@@ -407,6 +412,7 @@ static struct platform_device sharpsl_rom_device = {
407static struct platform_device *devices[] __initdata = { 412static struct platform_device *devices[] __initdata = {
408 &poodle_locomo_device, 413 &poodle_locomo_device,
409 &poodle_scoop_device, 414 &poodle_scoop_device,
415 &poodle_audio_device,
410 &sharpsl_nand_device, 416 &sharpsl_nand_device,
411 &sharpsl_rom_device, 417 &sharpsl_rom_device,
412}; 418};
diff --git a/sound/soc/pxa/poodle.c b/sound/soc/pxa/poodle.c
index 4c29bc1f9cfe..c9e24bf51763 100644
--- a/sound/soc/pxa/poodle.c
+++ b/sound/soc/pxa/poodle.c
@@ -281,22 +281,18 @@ static struct snd_soc_dai_link poodle_dai = {
281}; 281};
282 282
283/* poodle audio machine driver */ 283/* poodle audio machine driver */
284static struct snd_soc_card snd_soc_poodle = { 284static struct snd_soc_card poodle = {
285 .name = "Poodle", 285 .name = "Poodle",
286 .dai_link = &poodle_dai, 286 .dai_link = &poodle_dai,
287 .num_links = 1, 287 .num_links = 1,
288 .owner = THIS_MODULE, 288 .owner = THIS_MODULE,
289}; 289};
290 290
291static struct platform_device *poodle_snd_device; 291static int __devinit poodle_probe(struct platform_device *pdev)
292
293static int __init poodle_init(void)
294{ 292{
293 struct snd_soc_card *card = &poodle;
295 int ret; 294 int ret;
296 295
297 if (!machine_is_poodle())
298 return -ENODEV;
299
300 locomo_gpio_set_dir(&poodle_locomo_device.dev, 296 locomo_gpio_set_dir(&poodle_locomo_device.dev,
301 POODLE_LOCOMO_GPIO_AMP_ON, 0); 297 POODLE_LOCOMO_GPIO_AMP_ON, 0);
302 /* should we mute HP at startup - burning power ?*/ 298 /* should we mute HP at startup - burning power ?*/
@@ -305,28 +301,36 @@ static int __init poodle_init(void)
305 locomo_gpio_set_dir(&poodle_locomo_device.dev, 301 locomo_gpio_set_dir(&poodle_locomo_device.dev,
306 POODLE_LOCOMO_GPIO_MUTE_R, 0); 302 POODLE_LOCOMO_GPIO_MUTE_R, 0);
307 303
308 poodle_snd_device = platform_device_alloc("soc-audio", -1); 304 card->dev = &pdev->dev;
309 if (!poodle_snd_device)
310 return -ENOMEM;
311
312 platform_set_drvdata(poodle_snd_device, &snd_soc_poodle);
313 ret = platform_device_add(poodle_snd_device);
314 305
306 ret = snd_soc_register_card(card);
315 if (ret) 307 if (ret)
316 platform_device_put(poodle_snd_device); 308 dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n",
317 309 ret);
318 return ret; 310 return ret;
319} 311}
320 312
321static void __exit poodle_exit(void) 313static int __devexit poodle_remove(struct platform_device *pdev)
322{ 314{
323 platform_device_unregister(poodle_snd_device); 315 struct snd_soc_card *card = platform_get_drvdata(pdev);
316
317 snd_soc_unregister_card(card);
318 return 0;
324} 319}
325 320
326module_init(poodle_init); 321static struct platform_driver poodle_driver = {
327module_exit(poodle_exit); 322 .driver = {
323 .name = "poodle-audio",
324 .owner = THIS_MODULE,
325 },
326 .probe = poodle_probe,
327 .remove = __devexit_p(poodle_remove),
328};
329
330module_platform_driver(poodle_driver);
328 331
329/* Module information */ 332/* Module information */
330MODULE_AUTHOR("Richard Purdie"); 333MODULE_AUTHOR("Richard Purdie");
331MODULE_DESCRIPTION("ALSA SoC Poodle"); 334MODULE_DESCRIPTION("ALSA SoC Poodle");
332MODULE_LICENSE("GPL"); 335MODULE_LICENSE("GPL");
336MODULE_ALIAS("platform:poodle-audio");