ASoC: mx27vis-aic32x4: Convert it to platform driver
Subsystems (5)
Fabio Estevam
reviewerPATCH v2 1/1 ASoC: mx27vis-aic32x4: Convert it to platform driver
Convert mx27vis-aic32x4 to platform driver.
---
Changes since v1:
- Fix MODULE_ALIAS
- Rename it to mx27vis
arch/arm/mach-imx/mach-imx27_visstrim_m10.c | 1 + sound/soc/imx/mx27vis-aic32x4.c | 40 ++++++++++++++------------- 2 files changed, 22 insertions(+), 19 deletions(-)
arch/arm/mach-imx/mach-imx27_visstrim_m10.c +1 -0
@@ -397,6 +397,7 @@ static void __init visstrim_m10_board_init(void) &iclink_tvp5150, sizeof(iclink_tvp5150));gpio_led_register_device (0 , &visstrim_m10_led_data);visstrim_camera_init (); +imx_add_platform_device ("mx27vis" ,0 ,NULL ,0 ,NULL ,0 ); }static void __init visstrim_m10_timer_init (void )
sound/soc/imx/mx27vis-aic32x4.c +21 -19
@@ -188,22 +188,15 @@ static struct snd_soc_card mx27vis_aic32x4 = { .num_dapm_routes = ARRAY_SIZE(aic32x4_dapm_routes), }; -static struct platform_device *mx27vis_aic32x4_snd_device; - -static int __init mx27vis_aic32x4_init (void ) +static int __devinit mx27vis_aic32x4_probe (struct platform_device *pdev) {int ret; - mx27vis_aic32x4_snd_device =platform_device_alloc ("soc-audio" ,-1 ); -if (!mx27vis_aic32x4_snd_device) -return -ENOMEM ; - -platform_set_drvdata (mx27vis_aic32x4_snd_device, &mx27vis_aic32x4); - ret =platform_device_add (mx27vis_aic32x4_snd_device); - + ret =snd_soc_register_card (&mx27vis_aic32x4);if (ret) { -printk (KERN_ERR "ASoC: Platform device allocation failed\n" ); -platform_device_put (mx27vis_aic32x4_snd_device); +dev_err (&pdev->dev,"snd_soc_register_card failed (%d)\n" , + ret); +return ret; }/* Connect SSI0 as clock slave to SSI1 external pins */
@@ -221,22 +214,31 @@ static int __init mx27vis_aic32x4_init(void) ret =mxc_gpio_setup_multiple_pins (mx27vis_amp_pins,ARRAY_SIZE (mx27vis_amp_pins),"MX27VIS_AMP" ); -if (ret) { +if (ret)printk (KERN_ERR "ASoC: unable to setup gpios\n" ); -platform_device_put (mx27vis_aic32x4_snd_device); - }return ret; } -static void __exit mx27vis_aic32x4_exit(void) +static int __devexit mx27vis_aic32x4_remove(struct platform_device *pdev) { -platform_device_unregister (mx27vis_aic32x4_snd_device); +snd_soc_unregister_card (&mx27vis_aic32x4); + +return 0 ; } -module_init (mx27vis_aic32x4_init); -module_exit (mx27vis_aic32x4_exit); +static struct platform_driver mx27vis_aic32x4_audio_driver = { + .driver = { + .name ="mx27vis" , + .owner =THIS_MODULE , + }, + .probe = mx27vis_aic32x4_probe, + .remove =__devexit_p (mx27vis_aic32x4_remove), +}; + +module_platform_driver (mx27vis_aic32x4_audio_driver);MODULE_AUTHOR ("Javier Martin <[email protected]>" );MODULE_DESCRIPTION ("ALSA SoC AIC32X4 mx27 visstrim" );MODULE_LICENSE ("GPL" ); +MODULE_ALIAS ("platform:mx27vis" );
Signature · 1 line
1.7.1
Hi Fabio,
Quoted 86 lines · Fabio Estevam
Convert mx27vis-aic32x4 to platform driver.
Signed-off-by Fabio Estevam <[email protected]>---
Changes since v1:
- FixMODULE_ALIAS
- Rename it to mx27visarch/arm/mach-imx/mach-imx27_visstrim_m10.c | 1 +
sound/soc/imx/mx27vis-aic32x4.c| 40 ++++++++++++++-------------2 files changed, 22 insertions(+), 19 deletions(-)arch/arm/mach-imx/mach-imx27_visstrim_m10.c +1
-0@@ -397,6 +397,7 @@ static void __init visstrim_m10_board_init(void) &iclink_tvp5150, sizeof(iclink_tvp5150)); gpio_led_register_device(0, &visstrim_m10_led_data); visstrim_camera_init(); + imx_add_platform_device("mx27vis", 0, NULL, 0, NULL, 0); } static void __init visstrim_m10_timer_init(void)sound/soc/imx/mx27vis-aic32x4.c +16
-19@@ -188,22 +188,15 @@ static struct snd_soc_card mx27vis_aic32x4 = { .num_dapm_routes = ARRAY_SIZE(aic32x4_dapm_routes), }; -static struct platform_device *mx27vis_aic32x4_snd_device; - -static int __init mx27vis_aic32x4_init (void ) +static int __devinit mx27vis_aic32x4_probe (struct platform_device *pdev) { int ret; - mx27vis_aic32x4_snd_device = platform_device_alloc("soc-audio", -1); - if (!mx27vis_aic32x4_snd_device) - return -ENOMEM; - - platform_set_drvdata(mx27vis_aic32x4_snd_device, &mx27vis_aic32x4); - ret = platform_device_add(mx27vis_aic32x4_snd_device); - + ret = snd_soc_register_card(&mx27vis_aic32x4); if (ret) { - printk(KERN_ERR "ASoC: Platform device allocation failed\n"); - platform_device_put(mx27vis_aic32x4_snd_device); + dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", + ret); + return ret; } /* Connect SSI0 as clock slave to SSI1 external pins */@@ -221,22 +214,31 @@ static int __init mx27vis_aic32x4_init(void) ret = mxc_gpio_setup_multiple_pins(mx27vis_amp_pins, ARRAY_SIZE(mx27vis_amp_pins), "MX27VIS_AMP"); - if (ret) { + if (ret) printk(KERN_ERR "ASoC: unable to setup gpios\n"); - platform_device_put(mx27vis_aic32x4_snd_device); - } return ret; } -static void __exit mx27vis_aic32x4_exit(void) +static int __devexit mx27vis_aic32x4_remove(struct platform_device *pdev) { - platform_device_unregister(mx27vis_aic32x4_snd_device); + snd_soc_unregister_card(&mx27vis_aic32x4); + + return 0; } -module_init (mx27vis_aic32x4_init); -module_exit (mx27vis_aic32x4_exit); +static struct platform_driver mx27vis_aic32x4_audio_driver = { + .driver = { + .name = "mx27vis", + .owner = THIS_MODULE, + }, + .probe = mx27vis_aic32x4_probe,
sound/soc/imx/mx27vis-aic32x4.c static int __init mx27vis_aic32x4_init(void)
Quoted 10 lines
sound/soc/imx/mx27vis-aic32x4.c +5
-1+ .remove = __devexit_p(mx27vis_aic32x4_remove), +}; + +module_platform_driver (mx27vis_aic32x4_audio_driver); MODULE_AUTHOR("Javier Martin <[email protected]>"); MODULE_DESCRIPTION("ALSA SoC AIC32X4 mx27 visstrim"); MODULE_LICENSE("GPL"); +MODULE_ALIAS ("platform:mx27vis" ); --
I agree with the patch. However, I think another patch, which registers this platform device for the visstrim_m10 board file
(http://lxr.linux.no/#linux+v3.2.9/arch/arm/mach-imx/mach-imx27_visstrim_m10.c)
should be applied at the same time. Otherwise, audio would stop working on this platform and that would be a regression.
Regards.
Signature · 7 lines
Javier Martin Vista Silicon S.L. CDTUC - FASE C - Oficina S-345 Avda de los Castros s/n 39005- Santander. Cantabria. Spain +34 942 25 32 60 www.vista-silicon.com
Fabio Estevam
reviewerHi Javier.
Quoted 6 lines · javier Martin
I agree with the patch. However, I think another patch, which registers this platform device for the
visstrim_m10board file
(http://lxr.linux.no/#linux+v3.2.9/arch/arm/mach-imx/mach-imx27_visstrim_m10.c)
should be applied at the same time. Otherwise, audio would stop working on this platform and that would be a regression.
The first hunk of this patch does register the audio device inside arch/arm/mach-imx/mach-imx27_visstrim_m10.c:
(quoted diff) +0 -0
b/arch/arm/mach-imx/mach-imx27_visstrim_m10.c
index 0a1643c..ed6023f 100644
arch/arm/mach-imx/mach-imx27_visstrim_m10.c +1 -0
@@ -397,6 +397,7 @@ static void __init visstrim_m10_board_init(void) &iclink_tvp5150, sizeof(iclink_tvp5150));gpio_led_register_device (0 , &visstrim_m10_led_data);visstrim_camera_init (); +imx_add_platform_device ("mx27vis" ,0 ,NULL ,0 ,NULL ,0 ); }
Did I miss anything?
Regards,
Fabio Estevam
Hi Fabio,
Quoted 26 lines · Fabio Estevam
Hi Javier.
Quoted 6 lines · javier Martin
I agree with the patch. However, I think another patch, which registers this platform device for the
visstrim_m10board file
(http://lxr.linux.no/#linux+v3.2.9/arch/arm/mach-imx/mach-imx27_visstrim_m10.c)
should be applied at the same time. Otherwise, audio would stop working on this platform and that would be a regression.The first hunk of this patch does register the audio device inside
arch/arm/mach-imx/mach-imx27_visstrim_m10.c:arch/arm/mach-imx/mach-imx27_visstrim_m10.c +1
-0@@ -397,6 +397,7 @@ static void __init visstrim_m10_board_init(void) &iclink_tvp5150, sizeof(iclink_tvp5150)); gpio_led_register_device(0, &visstrim_m10_led_data); visstrim_camera_init(); + imx_add_platform_device("mx27vis", 0, NULL, 0, NULL, 0); }
Quoted 1 line
Did I miss anything?
Sorry, I missed it, it was quite early in the morning...
Could you please provide a git repository and a branch for me to test this patch?
Regards.
Signature · 7 lines
Javier Martin Vista Silicon S.L. CDTUC - FASE C - Oficina S-345 Avda de los Castros s/n 39005- Santander. Cantabria. Spain +34 942 25 32 60 www.vista-silicon.com
Fabio Estevam
reviewerQuoted 2 lines · javier Martin
Could you please provide a git repository and a branch for me to test this patch?
Please apply this patch against linux-next git tree.
Thanks,
Fabio Estevam
Fabio Estevam
reviewerQuoted 6 lines · Fabio Estevam
Quoted 2 lines · javier Martin
Could you please provide a git repository and a branch for me to test this patch?
Please apply this patch against linux-next git tree.
You also need this patch:
http://comments.gmane.org/gmane.linux.drivers.video-input-infrastructure/45617
Otherwise linux-next does not build for mx27.
Regards,
Fabio Estevam
Quoted 8 lines · Fabio Estevam
Quoted 6 lines · Fabio Estevam
Quoted 2 lines · javier Martin
Could you please provide a git repository and a branch for me to test this patch?
Please apply this patch against linux-next git tree.
Quoted 8 lines
You also need this patch:
http://comments.gmane.org/gmane.linux.drivers.video-input-infrastructure/45617Otherwise linux-next does not build for mx27.
Regards,
Fabio Estevam
I get the following error when testing your patch in linux-next master:
ASoC: Platform device allocation failed mx27vis mx27vis.0: snd_soc_register_card failed (-22)
mx27vis: probe of mx27vis.0 failed with error -22 ALSA device list:
No soundcards found.
Signature · 7 lines
Javier Martin Vista Silicon S.L. CDTUC - FASE C - Oficina S-345 Avda de los Castros s/n 39005- Santander. Cantabria. Spain +34 942 25 32 60 www.vista-silicon.com
Fabio Estevam
reviewerQuoted 8 lines · javier Martin
I get the following error when testing your patch in linux-next master:
ASoC: Platform device allocation failed mx27vis mx27vis.0:
snd_soc_register_cardfailed (-22)
mx27vis: probe of mx27vis.0 failed with error -22 ALSA device list:
No soundcards found.
Thanks for testing it. I missed one line.
Could you please add the following line:
mx27vis_aic32x4.dev = &pdev->dev;
prior to
ret = snd_soc_register_card(&mx27vis_aic32x4);
and let me know if it works?
Then I will submit a new version of the patch.
Thanks,
Fabio Estevam
javier Martin
Tested-byQuoted 20 lines · Fabio Estevam
Quoted 8 lines · javier Martin
I get the following error when testing your patch in linux-next master:
ASoC: Platform device allocation failed mx27vis mx27vis.0:
snd_soc_register_cardfailed (-22)
mx27vis: probe of mx27vis.0 failed with error -22 ALSA device list:
No soundcards found.Thanks for testing it. I missed one line.
Could you please add the following line:
mx27vis_aic32x4.dev =
&pdev->dev;prior to
ret =
snd_soc_register_card(&mx27vis_aic32x4);
Quoted 7 lines
and let me know if it works?
Then I will submit a new version of the patch.
Thanks,
Fabio Estevam
Yeah, that works.
Signature · 7 lines
Javier Martin Vista Silicon S.L. CDTUC - FASE C - Oficina S-345 Avda de los Castros s/n 39005- Santander. Cantabria. Spain +34 942 25 32 60 www.vista-silicon.com