ASoC: Convert PXA AC97 driver to probe with the platform device

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Thursday, March 26, 2009 - 12:10 pm

Gitweb:     http://git.kernel.org/linus/6b849bcff0004aa5dd216b4d3eb56f51c9df8a72
Commit:     6b849bcff0004aa5dd216b4d3eb56f51c9df8a72
Parent:     a381934e5f9c0c3c292d780d61f5be9c22b2ef54
Author:     Mark Brown <broonie@opensource.wolfsonmicro.com>
AuthorDate: Mon Mar 9 18:18:33 2009 +0000
Committer:  Mark Brown <broonie@opensource.wolfsonmicro.com>
CommitDate: Mon Mar 9 18:19:01 2009 +0000

    ASoC: Convert PXA AC97 driver to probe with the platform device
    
    This will break any boards that don't register the AC97 controller
    device due to using ASoC.
    
    Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
 sound/soc/pxa/pxa2xx-ac97.c |   38 ++++++++++++++++++++++++++++++++++----
 1 files changed, 34 insertions(+), 4 deletions(-)

diff --git a/sound/soc/pxa/pxa2xx-ac97.c b/sound/soc/pxa/pxa2xx-ac97.c
index 812c2b4..49a2810 100644
--- a/sound/soc/pxa/pxa2xx-ac97.c
+++ b/sound/soc/pxa/pxa2xx-ac97.c
@@ -106,13 +106,13 @@ static int pxa2xx_ac97_resume(struct snd_soc_dai *dai)
 static int pxa2xx_ac97_probe(struct platform_device *pdev,
 			     struct snd_soc_dai *dai)
 {
-	return pxa2xx_ac97_hw_probe(pdev);
+	return pxa2xx_ac97_hw_probe(to_platform_device(dai->dev));
 }
 
 static void pxa2xx_ac97_remove(struct platform_device *pdev,
 			       struct snd_soc_dai *dai)
 {
-	pxa2xx_ac97_hw_remove(pdev);
+	pxa2xx_ac97_hw_remove(to_platform_device(dai->dev));
 }
 
 static int pxa2xx_ac97_hw_params(struct snd_pcm_substream *substream,
@@ -229,15 +229,45 @@ struct snd_soc_dai pxa_ac97_dai[] = {
 EXPORT_SYMBOL_GPL(pxa_ac97_dai);
 EXPORT_SYMBOL_GPL(soc_ac97_ops);
 
-static int __init pxa_ac97_init(void)
+static int __devinit pxa2xx_ac97_dev_probe(struct platform_device *pdev)
 {
+	int i;
+
+	for (i = 0; i < ARRAY_SIZE(pxa_ac97_dai); i++)
+		pxa_ac97_dai[i].dev = &pdev->dev;
+
+	/* Punt most of the init to the SoC probe; we may need the machine
+	 * driver to do interesting things with the clocking to get us up
+	 * and running.
+	 */
 	return snd_soc_register_dais(pxa_ac97_dai, ARRAY_SIZE(pxa_ac97_dai));
 }
+
+static int __devexit pxa2xx_ac97_dev_remove(struct platform_device *pdev)
+{
+	snd_soc_unregister_dais(pxa_ac97_dai, ARRAY_SIZE(pxa_ac97_dai));
+
+	return 0;
+}
+
+static struct platform_driver pxa2xx_ac97_driver = {
+	.probe		= pxa2xx_ac97_dev_probe,
+	.remove		= __devexit_p(pxa2xx_ac97_dev_remove),
+	.driver		= {
+		.name	= "pxa2xx-ac97",
+		.owner	= THIS_MODULE,
+	},
+};
+
+static int __init pxa_ac97_init(void)
+{
+	return platform_driver_register(&pxa2xx_ac97_driver);
+}
 module_init(pxa_ac97_init);
 
 static void __exit pxa_ac97_exit(void)
 {
-	snd_soc_unregister_dais(pxa_ac97_dai, ARRAY_SIZE(pxa_ac97_dai));
+	platform_driver_unregister(&pxa2xx_ac97_driver);
 }
 module_exit(pxa_ac97_exit);
 
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
ASoC: Convert PXA AC97 driver to probe with the platform d ..., Linux Kernel Mailing ..., (Thu Mar 26, 12:10 pm)