Skip to contentSkip to conversation

ASoC: jz4740: Convert qi_lb60 to use snd_soc_register_card()

PATCH Superseded Axel Lin 2 participants 2 messages Dec 26, 2011

Subsystems (4)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH v2 1/1 ASoC: jz4740: Convert qi_lb60 to use snd_soc_register_card()

Use snd_soc_register_card() instead of creating a "soc-audio" platform device.

---
v2: fix a typo in v1.
Only compile tested, I appreciate if someone can test it.

 arch/mips/jz4740/board-qi_lb60.c |    6 ++++
 sound/soc/jz4740/qi_lb60.c       |   56 +++++++++++++++++--------------------
 2 files changed, 32 insertions(+), 30 deletions(-)
arch/mips/jz4740/board-qi_lb60.c +6 -0
index 639e3ce..9a91fe9 100644
@@ -418,6 +418,11 @@ static struct platform_device qi_lb60_charger_device = {
 	},
 };
 
+/* audio */
+static struct platform_device qi_lb60_audio_device = {
+	.name = "qi-lb60-audio",
+	.id = -1,
+};
 
 static struct platform_device *jz_platform_devices[] __initdata = {
 	&jz4740_udc_device,
@@ -434,6 +439,7 @@ static struct platform_device *jz_platform_devices[] __initdata = {
 	&qi_lb60_gpio_keys,
 	&qi_lb60_pwm_beeper,
 	&qi_lb60_charger_device,
+	&qi_lb60_audio_device,
 };
 
 static void __init board_gpio_setup(void)
sound/soc/jz4740/qi_lb60.c +26 -30

82 lines not on this page · raw message

Signature · 1 line
1.7.5.4
#1 lore raw
Quoted 6 lines · Axel Lin

Use snd_soc_register_card() instead of creating a "soc-audio" platform device.

---
v2: fix a typo in v1.
Only compile tested, I appreciate if someone can test it.

Hi,

Looks good on first sight. One minor comment inline though. I wont have access to the hardware until new year, so I can't test the patch right now.

Thanks,
- Lars

Quoted 10 lines
 arch/mips/jz4740/board-qi_lb60.c |    6 ++++
 sound/soc/jz4740/qi_lb60.c       |   56 +++++++++++++++++--------------------
 2 files changed, 32 insertions(+), 30 deletions(-)
arch/mips/jz4740/board-qi_lb60.c +0 -0
index 639e3ce..9a91fe9 100644

arch/mips/jz4740/board-qi_lb60.c static struct platform_device qi_lb60_charger_device = {

Quoted 10 lines
arch/mips/jz4740/board-qi_lb60.c +4 -2
@@ -418,6 +418,11 @@ static struct platform_device qi_lb60_charger_device = {
[...]
 
-static void __exit qi_lb60_exit(void)
+static int __devexit qi_lb60_remove(struct platform_device *pdev)
 {
-	platform_device_unregister(qi_lb60_snd_device);
+	struct snd_soc_card *card = platform_get_drvdata(pdev);
+
 	gpio_free_array(qi_lb60_gpios, ARRAY_SIZE(qi_lb60_gpios));
+	snd_soc_unregister_card(card);

It's probably better to free the card before the GPIOs since the card uses the GPIOs.

Quoted 19 lines
arch/mips/jz4740/board-qi_lb60.c +13 -1
+	return 0;
 }
-module_exit(qi_lb60_exit);
+
+static struct platform_driver qi_lb60_driver = {
+	.driver		= {
+		.name	= "qi-lb60-audio",
+		.owner	= THIS_MODULE,
+	},
+	.probe		= qi_lb60_probe,
+	.remove		= __devexit_p(qi_lb60_remove),
+};
+
+module_platform_driver(qi_lb60_driver);
 
 MODULE_AUTHOR("Lars-Peter Clausen <[email protected]>");
 MODULE_DESCRIPTION("ALSA SoC QI LB60 Audio support");
 MODULE_LICENSE("GPL v2");
+MODULE_ALIAS("platform:qi-lb60-audio");