diff options
| author | Axel Lin <axel.lin@gmail.com> | 2012-01-05 22:30:10 -0500 |
|---|---|---|
| committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-01-20 08:58:29 -0500 |
| commit | b33005f3ef6a85be3202ee1b8a2513ed1ef4019d (patch) | |
| tree | fd8d00e704125e71c77f8cdc2d5b26636b7cd32e | |
| parent | cef6d1d450ba217dc173a83a50d12de9aaa32bb6 (diff) | |
ASoC: jz4740: Convert qi_lb60 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: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
| -rw-r--r-- | arch/mips/jz4740/board-qi_lb60.c | 6 | ||||
| -rw-r--r-- | sound/soc/jz4740/qi_lb60.c | 56 |
2 files changed, 32 insertions, 30 deletions
diff --git a/arch/mips/jz4740/board-qi_lb60.c b/arch/mips/jz4740/board-qi_lb60.c index 639e3ce6c264..9a91fe9de696 100644 --- a/arch/mips/jz4740/board-qi_lb60.c +++ b/arch/mips/jz4740/board-qi_lb60.c | |||
| @@ -418,6 +418,11 @@ static struct platform_device qi_lb60_charger_device = { | |||
| 418 | }, | 418 | }, |
| 419 | }; | 419 | }; |
| 420 | 420 | ||
| 421 | /* audio */ | ||
| 422 | static struct platform_device qi_lb60_audio_device = { | ||
| 423 | .name = "qi-lb60-audio", | ||
| 424 | .id = -1, | ||
| 425 | }; | ||
| 421 | 426 | ||
| 422 | static struct platform_device *jz_platform_devices[] __initdata = { | 427 | static struct platform_device *jz_platform_devices[] __initdata = { |
| 423 | &jz4740_udc_device, | 428 | &jz4740_udc_device, |
| @@ -434,6 +439,7 @@ static struct platform_device *jz_platform_devices[] __initdata = { | |||
| 434 | &qi_lb60_gpio_keys, | 439 | &qi_lb60_gpio_keys, |
| 435 | &qi_lb60_pwm_beeper, | 440 | &qi_lb60_pwm_beeper, |
| 436 | &qi_lb60_charger_device, | 441 | &qi_lb60_charger_device, |
| 442 | &qi_lb60_audio_device, | ||
| 437 | }; | 443 | }; |
| 438 | 444 | ||
| 439 | static void __init board_gpio_setup(void) | 445 | static void __init board_gpio_setup(void) |
diff --git a/sound/soc/jz4740/qi_lb60.c b/sound/soc/jz4740/qi_lb60.c index 0097c3b13a1a..e8aaff18d7cc 100644 --- a/sound/soc/jz4740/qi_lb60.c +++ b/sound/soc/jz4740/qi_lb60.c | |||
| @@ -91,56 +91,52 @@ static struct snd_soc_card qi_lb60 = { | |||
| 91 | .num_dapm_routes = ARRAY_SIZE(qi_lb60_routes), | 91 | .num_dapm_routes = ARRAY_SIZE(qi_lb60_routes), |
| 92 | }; | 92 | }; |
| 93 | 93 | ||
| 94 | static struct platform_device *qi_lb60_snd_device; | ||
| 95 | |||
| 96 | static const struct gpio qi_lb60_gpios[] = { | 94 | static const struct gpio qi_lb60_gpios[] = { |
| 97 | { QI_LB60_SND_GPIO, GPIOF_OUT_INIT_LOW, "SND" }, | 95 | { QI_LB60_SND_GPIO, GPIOF_OUT_INIT_LOW, "SND" }, |
| 98 | { QI_LB60_AMP_GPIO, GPIOF_OUT_INIT_LOW, "AMP" }, | 96 | { QI_LB60_AMP_GPIO, GPIOF_OUT_INIT_LOW, "AMP" }, |
| 99 | }; | 97 | }; |
| 100 | 98 | ||
| 101 | static int __init qi_lb60_init(void) | 99 | static int __devinit qi_lb60_probe(struct platform_device *pdev) |
| 102 | { | 100 | { |
| 101 | struct snd_soc_card *card = &qi_lb60; | ||
| 103 | int ret; | 102 | int ret; |
| 104 | 103 | ||
| 105 | qi_lb60_snd_device = platform_device_alloc("soc-audio", -1); | ||
| 106 | |||
| 107 | if (!qi_lb60_snd_device) | ||
| 108 | return -ENOMEM; | ||
| 109 | |||
| 110 | ret = gpio_request_array(qi_lb60_gpios, ARRAY_SIZE(qi_lb60_gpios)); | 104 | ret = gpio_request_array(qi_lb60_gpios, ARRAY_SIZE(qi_lb60_gpios)); |
| 111 | if (ret) { | 105 | if (ret) |
| 112 | pr_err("qi_lb60 snd: Failed to request gpios: %d\n", ret); | 106 | return ret; |
| 113 | goto err_device_put; | ||
| 114 | } | ||
| 115 | 107 | ||
| 116 | platform_set_drvdata(qi_lb60_snd_device, &qi_lb60); | 108 | card->dev = &pdev->dev; |
| 117 | 109 | ||
| 118 | ret = platform_device_add(qi_lb60_snd_device); | 110 | ret = snd_soc_register_card(card); |
| 119 | if (ret) { | 111 | if (ret) { |
| 120 | pr_err("qi_lb60 snd: Failed to add snd soc device: %d\n", ret); | 112 | dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", |
| 121 | goto err_unset_pdata; | 113 | ret); |
| 114 | gpio_free_array(qi_lb60_gpios, ARRAY_SIZE(qi_lb60_gpios)); | ||
| 122 | } | 115 | } |
| 123 | |||
| 124 | return 0; | ||
| 125 | |||
| 126 | err_unset_pdata: | ||
| 127 | platform_set_drvdata(qi_lb60_snd_device, NULL); | ||
| 128 | /*err_gpio_free_array:*/ | ||
| 129 | gpio_free_array(qi_lb60_gpios, ARRAY_SIZE(qi_lb60_gpios)); | ||
| 130 | err_device_put: | ||
| 131 | platform_device_put(qi_lb60_snd_device); | ||
| 132 | |||
| 133 | return ret; | 116 | return ret; |
| 134 | } | 117 | } |
| 135 | module_init(qi_lb60_init); | ||
| 136 | 118 | ||
| 137 | static void __exit qi_lb60_exit(void) | 119 | static int __devexit qi_lb60_remove(struct platform_device *pdev) |
| 138 | { | 120 | { |
| 139 | platform_device_unregister(qi_lb60_snd_device); | 121 | struct snd_soc_card *card = platform_get_drvdata(pdev); |
| 122 | |||
| 123 | snd_soc_unregister_card(card); | ||
| 140 | gpio_free_array(qi_lb60_gpios, ARRAY_SIZE(qi_lb60_gpios)); | 124 | gpio_free_array(qi_lb60_gpios, ARRAY_SIZE(qi_lb60_gpios)); |
| 125 | return 0; | ||
| 141 | } | 126 | } |
| 142 | module_exit(qi_lb60_exit); | 127 | |
| 128 | static struct platform_driver qi_lb60_driver = { | ||
| 129 | .driver = { | ||
| 130 | .name = "qi-lb60-audio", | ||
| 131 | .owner = THIS_MODULE, | ||
| 132 | }, | ||
| 133 | .probe = qi_lb60_probe, | ||
| 134 | .remove = __devexit_p(qi_lb60_remove), | ||
| 135 | }; | ||
| 136 | |||
| 137 | module_platform_driver(qi_lb60_driver); | ||
| 143 | 138 | ||
| 144 | MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>"); | 139 | MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>"); |
| 145 | MODULE_DESCRIPTION("ALSA SoC QI LB60 Audio support"); | 140 | MODULE_DESCRIPTION("ALSA SoC QI LB60 Audio support"); |
| 146 | MODULE_LICENSE("GPL v2"); | 141 | MODULE_LICENSE("GPL v2"); |
| 142 | MODULE_ALIAS("platform:qi-lb60-audio"); | ||
