* [PATCH 0/2] Fix audio on Nokia RX-51 @ 2013-01-20 3:04 Pali Rohár 2013-01-20 3:04 ` [PATCH 1/2] ASoC: omap: rx51: Use snd_soc_register_card and add module alias for autoloading driver Pali Rohár ` (2 more replies) 0 siblings, 3 replies; 5+ messages in thread From: Pali Rohár @ 2013-01-20 3:04 UTC (permalink / raw) To: Peter Ujfalusi, Jarkko Nikula, Tony Lindgren Cc: linux-omap, linux-kernel, Pali Rohár This patch series updating rx51 sound driver, using snd_soc_register_card, adding module alias for autoloading kernel driver and registring sound driver in rx51 board code. Pali Rohár (2): ASoC: omap: rx51: Use snd_soc_register_card and add module alias for autoloading driver ARM: OMAP: rx51: Register audio device arch/arm/mach-omap2/board-rx51-peripherals.c | 11 ++++++ sound/soc/omap/rx51.c | 50 +++++++++++++++----------- 2 files changed, 41 insertions(+), 20 deletions(-) -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/2] ASoC: omap: rx51: Use snd_soc_register_card and add module alias for autoloading driver 2013-01-20 3:04 [PATCH 0/2] Fix audio on Nokia RX-51 Pali Rohár @ 2013-01-20 3:04 ` Pali Rohár 2013-01-21 8:47 ` Peter Ujfalusi 2013-01-20 3:04 ` [PATCH 2/2] ARM: OMAP: rx51: Register audio device Pali Rohár 2013-01-21 9:14 ` [PATCH 0/2] Fix audio on Nokia RX-51 Peter Ujfalusi 2 siblings, 1 reply; 5+ messages in thread From: Pali Rohár @ 2013-01-20 3:04 UTC (permalink / raw) To: Peter Ujfalusi, Jarkko Nikula, Tony Lindgren Cc: linux-omap, linux-kernel, Pali Rohár Signed-off-by: Pali Rohár <pali.rohar@gmail.com> --- sound/soc/omap/rx51.c | 50 +++++++++++++++++++++++++++++-------------------- 1 file changed, 30 insertions(+), 20 deletions(-) diff --git a/sound/soc/omap/rx51.c b/sound/soc/omap/rx51.c index d921ddb..82e3aae 100644 --- a/sound/soc/omap/rx51.c +++ b/sound/soc/omap/rx51.c @@ -391,10 +391,9 @@ static struct snd_soc_card rx51_sound_card = { .num_configs = ARRAY_SIZE(rx51_codec_conf), }; -static struct platform_device *rx51_snd_device; - -static int __init rx51_soc_init(void) +static int rx51_soc_probe(struct platform_device *pdev) { + struct snd_soc_card *card = &rx51_sound_card; int err; if (!machine_is_nokia_rx51()) @@ -409,22 +408,18 @@ static int __init rx51_soc_init(void) if (err) goto err_gpio_eci_sw; - rx51_snd_device = platform_device_alloc("soc-audio", -1); - if (!rx51_snd_device) { - err = -ENOMEM; - goto err1; - } - - platform_set_drvdata(rx51_snd_device, &rx51_sound_card); + card->dev = &pdev->dev; - err = platform_device_add(rx51_snd_device); - if (err) - goto err2; + err = snd_soc_register_card(card); + if (err) { + dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", err); + goto err_snd; + } return 0; -err2: - platform_device_put(rx51_snd_device); -err1: + +err_snd: + card->dev = NULL; gpio_free(RX51_ECI_SW_GPIO); err_gpio_eci_sw: gpio_free(RX51_TVOUT_SEL_GPIO); @@ -433,19 +428,34 @@ err_gpio_tvout_sel: return err; } -static void __exit rx51_soc_exit(void) +static int rx51_soc_remove(struct platform_device *pdev) { + struct snd_soc_card *card = platform_get_drvdata(pdev); + snd_soc_jack_free_gpios(&rx51_av_jack, ARRAY_SIZE(rx51_av_jack_gpios), rx51_av_jack_gpios); - platform_device_unregister(rx51_snd_device); + snd_soc_unregister_card(card); + card->dev = NULL; + gpio_free(RX51_ECI_SW_GPIO); gpio_free(RX51_TVOUT_SEL_GPIO); + + return 0; } -module_init(rx51_soc_init); -module_exit(rx51_soc_exit); +static struct platform_driver rx51_soc_driver = { + .driver = { + .name = "rx51-audio", + .owner = THIS_MODULE, + }, + .probe = rx51_soc_probe, + .remove = rx51_soc_remove, +}; + +module_platform_driver(rx51_soc_driver); MODULE_AUTHOR("Nokia Corporation"); MODULE_DESCRIPTION("ALSA SoC Nokia RX-51"); MODULE_LICENSE("GPL"); +MODULE_ALIAS("platform:rx51-audio"); -- 1.7.10.4 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] ASoC: omap: rx51: Use snd_soc_register_card and add module alias for autoloading driver 2013-01-20 3:04 ` [PATCH 1/2] ASoC: omap: rx51: Use snd_soc_register_card and add module alias for autoloading driver Pali Rohár @ 2013-01-21 8:47 ` Peter Ujfalusi 0 siblings, 0 replies; 5+ messages in thread From: Peter Ujfalusi @ 2013-01-21 8:47 UTC (permalink / raw) To: Pali Rohár; +Cc: Jarkko Nikula, Tony Lindgren, linux-omap, linux-kernel Hi, On 01/20/2013 04:04 AM, Pali Rohár wrote: > Signed-off-by: Pali Rohár <pali.rohar@gmail.com> This is really welcome. It would be even better if we would have commit message... Also for ASoC patches please CC alsa-devel and the maintainers so they will also have a chance to review. There are still couple of things which can improve the rx51 machine driver: - Switch to use devm_gpio_request_one() so we can remove the failure handling. - I would introduce platform data for this driver to pass the GPIO numbers. This is especially important for the RX51_SPEAKER_AMP_TWL_GPIO since it is in twl4030 and the GPIO range now allocated dynamically so the (192 + 7) might not be valid anymore. -- Péter > --- > sound/soc/omap/rx51.c | 50 +++++++++++++++++++++++++++++-------------------- > 1 file changed, 30 insertions(+), 20 deletions(-) > > diff --git a/sound/soc/omap/rx51.c b/sound/soc/omap/rx51.c > index d921ddb..82e3aae 100644 > --- a/sound/soc/omap/rx51.c > +++ b/sound/soc/omap/rx51.c > @@ -391,10 +391,9 @@ static struct snd_soc_card rx51_sound_card = { > .num_configs = ARRAY_SIZE(rx51_codec_conf), > }; > > -static struct platform_device *rx51_snd_device; > - > -static int __init rx51_soc_init(void) > +static int rx51_soc_probe(struct platform_device *pdev) > { > + struct snd_soc_card *card = &rx51_sound_card; > int err; > > if (!machine_is_nokia_rx51()) > @@ -409,22 +408,18 @@ static int __init rx51_soc_init(void) > if (err) > goto err_gpio_eci_sw; > > - rx51_snd_device = platform_device_alloc("soc-audio", -1); > - if (!rx51_snd_device) { > - err = -ENOMEM; > - goto err1; > - } > - > - platform_set_drvdata(rx51_snd_device, &rx51_sound_card); > + card->dev = &pdev->dev; > > - err = platform_device_add(rx51_snd_device); > - if (err) > - goto err2; > + err = snd_soc_register_card(card); > + if (err) { > + dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", err); > + goto err_snd; > + } > > return 0; > -err2: > - platform_device_put(rx51_snd_device); > -err1: > + > +err_snd: > + card->dev = NULL; > gpio_free(RX51_ECI_SW_GPIO); > err_gpio_eci_sw: > gpio_free(RX51_TVOUT_SEL_GPIO); > @@ -433,19 +428,34 @@ err_gpio_tvout_sel: > return err; > } > > -static void __exit rx51_soc_exit(void) > +static int rx51_soc_remove(struct platform_device *pdev) > { > + struct snd_soc_card *card = platform_get_drvdata(pdev); > + > snd_soc_jack_free_gpios(&rx51_av_jack, ARRAY_SIZE(rx51_av_jack_gpios), > rx51_av_jack_gpios); > > - platform_device_unregister(rx51_snd_device); > + snd_soc_unregister_card(card); > + card->dev = NULL; > + > gpio_free(RX51_ECI_SW_GPIO); > gpio_free(RX51_TVOUT_SEL_GPIO); > + > + return 0; > } > > -module_init(rx51_soc_init); > -module_exit(rx51_soc_exit); > +static struct platform_driver rx51_soc_driver = { > + .driver = { > + .name = "rx51-audio", > + .owner = THIS_MODULE, > + }, > + .probe = rx51_soc_probe, > + .remove = rx51_soc_remove, > +}; > + > +module_platform_driver(rx51_soc_driver); > > MODULE_AUTHOR("Nokia Corporation"); > MODULE_DESCRIPTION("ALSA SoC Nokia RX-51"); > MODULE_LICENSE("GPL"); > +MODULE_ALIAS("platform:rx51-audio"); > ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 2/2] ARM: OMAP: rx51: Register audio device 2013-01-20 3:04 [PATCH 0/2] Fix audio on Nokia RX-51 Pali Rohár 2013-01-20 3:04 ` [PATCH 1/2] ASoC: omap: rx51: Use snd_soc_register_card and add module alias for autoloading driver Pali Rohár @ 2013-01-20 3:04 ` Pali Rohár 2013-01-21 9:14 ` [PATCH 0/2] Fix audio on Nokia RX-51 Peter Ujfalusi 2 siblings, 0 replies; 5+ messages in thread From: Pali Rohár @ 2013-01-20 3:04 UTC (permalink / raw) To: Peter Ujfalusi, Jarkko Nikula, Tony Lindgren Cc: linux-omap, linux-kernel, Pali Rohár Signed-off-by: Pali Rohár <pali.rohar@gmail.com> --- arch/arm/mach-omap2/board-rx51-peripherals.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/arch/arm/mach-omap2/board-rx51-peripherals.c b/arch/arm/mach-omap2/board-rx51-peripherals.c index 45d401a..038ea1f 100644 --- a/arch/arm/mach-omap2/board-rx51-peripherals.c +++ b/arch/arm/mach-omap2/board-rx51-peripherals.c @@ -1370,6 +1370,16 @@ error: */ } +static struct platform_device rx51_audio_device = { + .name = "rx51-audio", + .id = -1, +}; + +static void __init rx51_init_audio(void) +{ + platform_device_register(&rx51_audio_device); +} + static struct tsc2005_platform_data tsc2005_pdata = { .ts_pressure_max = 2048, .ts_pressure_fudge = 2, @@ -1568,6 +1578,7 @@ void __init rx51_peripherals_init(void) gpmc_onenand_init(board_onenand_data); board_smc91x_init(); rx51_add_gpio_keys(); + rx51_init_audio(); rx51_init_wl1251(); rx51_init_tsc2005(); rx51_init_si4713(); -- 1.7.10.4 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 0/2] Fix audio on Nokia RX-51 2013-01-20 3:04 [PATCH 0/2] Fix audio on Nokia RX-51 Pali Rohár 2013-01-20 3:04 ` [PATCH 1/2] ASoC: omap: rx51: Use snd_soc_register_card and add module alias for autoloading driver Pali Rohár 2013-01-20 3:04 ` [PATCH 2/2] ARM: OMAP: rx51: Register audio device Pali Rohár @ 2013-01-21 9:14 ` Peter Ujfalusi 2 siblings, 0 replies; 5+ messages in thread From: Peter Ujfalusi @ 2013-01-21 9:14 UTC (permalink / raw) To: Pali Rohár; +Cc: Jarkko Nikula, Tony Lindgren, linux-omap, linux-kernel Hi, On 01/20/2013 04:04 AM, Pali Rohár wrote: > This patch series updating rx51 sound driver, using snd_soc_register_card, > adding module alias for autoloading kernel driver and registring sound > driver in rx51 board code. > > Pali Rohár (2): > ASoC: omap: rx51: Use snd_soc_register_card and add module alias for > autoloading driver > ARM: OMAP: rx51: Register audio device Can you reverse the order of the patches so we will avoid to have non working audio between the two patch? > > arch/arm/mach-omap2/board-rx51-peripherals.c | 11 ++++++ > sound/soc/omap/rx51.c | 50 +++++++++++++++----------- > 2 files changed, 41 insertions(+), 20 deletions(-) > -- Péter -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-01-21 9:14 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2013-01-20 3:04 [PATCH 0/2] Fix audio on Nokia RX-51 Pali Rohár 2013-01-20 3:04 ` [PATCH 1/2] ASoC: omap: rx51: Use snd_soc_register_card and add module alias for autoloading driver Pali Rohár 2013-01-21 8:47 ` Peter Ujfalusi 2013-01-20 3:04 ` [PATCH 2/2] ARM: OMAP: rx51: Register audio device Pali Rohár 2013-01-21 9:14 ` [PATCH 0/2] Fix audio on Nokia RX-51 Peter Ujfalusi
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).