From: "Pali Rohár" <pali.rohar@gmail.com>
To: Peter Ujfalusi <peter.ujfalusi@ti.com>,
Jarkko Nikula <jarkko.nikula@bitmer.com>,
Tony Lindgren <tony@atomide.com>
Cc: linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org,
"Pali Rohár" <pali.rohar@gmail.com>
Subject: [PATCH 1/2] ASoC: omap: rx51: Use snd_soc_register_card and add module alias for autoloading driver
Date: Sun, 20 Jan 2013 04:04:29 +0100 [thread overview]
Message-ID: <1358651070-30029-2-git-send-email-pali.rohar@gmail.com> (raw)
In-Reply-To: <1358651070-30029-1-git-send-email-pali.rohar@gmail.com>
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
next prev parent reply other threads:[~2013-01-20 3:04 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
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-20 3:04 ` Pali Rohár [this message]
2013-01-21 8:47 ` [PATCH 1/2] ASoC: omap: rx51: Use snd_soc_register_card and add module alias for autoloading driver Peter Ujfalusi
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
2013-01-21 9:14 ` Peter Ujfalusi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1358651070-30029-2-git-send-email-pali.rohar@gmail.com \
--to=pali.rohar@gmail.com \
--cc=jarkko.nikula@bitmer.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=peter.ujfalusi@ti.com \
--cc=tony@atomide.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.