linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] ASoC: Samsung: Remove platform device support
@ 2012-12-01 10:07 Padmavathi Venna
  2012-12-01 10:07 ` [PATCH 1/2] ASoC: Samsung: WM8994: Add basic device tree support for machine file Padmavathi Venna
  2012-12-01 10:07 ` [PATCH 2/2] ASoC: Samsung: Do not register samsung audio dma device as pdev Padmavathi Venna
  0 siblings, 2 replies; 5+ messages in thread
From: Padmavathi Venna @ 2012-12-01 10:07 UTC (permalink / raw)
  To: linux-arm-kernel

Samsung audio DMA device and machine device were getting registered as
platform devices with out having any real H/W peripherials associated
with them. With device tree support we can't add these platform devices
in the machine file. So Added basic device tree based look up for the
machine device.

The sole purpose of DMA platform device is to call the
"snd_soc_register_platform". So removed the pdev support in the DMA device
and each Samsung DAI now registers the ASoC 'platform' itself.

Padmavathi Venna (2):
  ASoC: Samsung: WM8994: Add basic device tree support for machine file
  ASoC: Samsung: Do not register samsung audio dma device as pdev

 sound/soc/samsung/dma.c         |   24 ++++++------------------
 sound/soc/samsung/dma.h         |    3 +++
 sound/soc/samsung/i2s.c         |    3 +++
 sound/soc/samsung/smdk_wm8994.c |   30 ++++++++++++++++++++++++++++--
 4 files changed, 40 insertions(+), 20 deletions(-)

-- 
1.7.4.4

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] ASoC: Samsung: WM8994: Add basic device tree support for machine file
  2012-12-01 10:07 [PATCH 0/2] ASoC: Samsung: Remove platform device support Padmavathi Venna
@ 2012-12-01 10:07 ` Padmavathi Venna
  2012-12-01 13:49   ` Mark Brown
  2012-12-01 10:07 ` [PATCH 2/2] ASoC: Samsung: Do not register samsung audio dma device as pdev Padmavathi Venna
  1 sibling, 1 reply; 5+ messages in thread
From: Padmavathi Venna @ 2012-12-01 10:07 UTC (permalink / raw)
  To: linux-arm-kernel

Add the basic device tree based lookup.

Signed-off-by: Padmavathi Venna <padma.v@samsung.com>
---
 sound/soc/samsung/smdk_wm8994.c |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/sound/soc/samsung/smdk_wm8994.c b/sound/soc/samsung/smdk_wm8994.c
index 48dd4dd..f9ba2b9 100644
--- a/sound/soc/samsung/smdk_wm8994.c
+++ b/sound/soc/samsung/smdk_wm8994.c
@@ -10,6 +10,7 @@
 #include "../codecs/wm8994.h"
 #include <sound/pcm_params.h>
 #include <linux/module.h>
+#include <linux/of.h>
 
  /*
   * Default CFG switch settings to use this driver:
@@ -153,9 +154,22 @@ static struct snd_soc_card smdk = {
 static int __devinit smdk_audio_probe(struct platform_device *pdev)
 {
 	int ret;
+	struct device_node *np = pdev->dev.of_node;
 	struct snd_soc_card *card = &smdk;
 
 	card->dev = &pdev->dev;
+
+	if (np) {
+		smdk_dai[0].cpu_dai_name = NULL;
+		smdk_dai[0].cpu_of_node = of_parse_phandle(np,
+				"samsung,i2s-controller", 0);
+		if (!smdk_dai[0].cpu_of_node) {
+			dev_err(&pdev->dev,
+			   "Property 'samsung,i2s-controller' missing or invalid\n");
+			ret = -EINVAL;
+		}
+	}
+
 	ret = snd_soc_register_card(card);
 
 	if (ret)
@@ -173,10 +187,19 @@ static int __devexit smdk_audio_remove(struct platform_device *pdev)
 	return 0;
 }
 
+#ifdef CONFIG_OF
+static const struct of_device_id samsung_wm8994_of_match[] = {
+	{ .compatible = "samsung,smdk-wm8994", },
+	{},
+};
+MODULE_DEVICE_TABLE(of, samsung_wm8994_of_match);
+#endif /* CONFIG_OF */
+
 static struct platform_driver smdk_audio_driver = {
 	.driver		= {
 		.name	= "smdk-audio",
 		.owner	= THIS_MODULE,
+		.of_match_table = of_match_ptr(samsung_wm8994_of_match),
 	},
 	.probe		= smdk_audio_probe,
 	.remove		= __devexit_p(smdk_audio_remove),
-- 
1.7.4.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] ASoC: Samsung: Do not register samsung audio dma device as pdev
  2012-12-01 10:07 [PATCH 0/2] ASoC: Samsung: Remove platform device support Padmavathi Venna
  2012-12-01 10:07 ` [PATCH 1/2] ASoC: Samsung: WM8994: Add basic device tree support for machine file Padmavathi Venna
@ 2012-12-01 10:07 ` Padmavathi Venna
  2012-12-02  4:33   ` Mark Brown
  1 sibling, 1 reply; 5+ messages in thread
From: Padmavathi Venna @ 2012-12-01 10:07 UTC (permalink / raw)
  To: linux-arm-kernel

Previously, the ASoC 'platform' (PCM/DMA) object was instantiated via a
platform_device. This didn't represent the hardware well, since there
was no separate hardware associated with this platform_device; it was a
virtual device with sole purpose to call snd_soc_register_platform().

This change removes the platform_device completely. Each Samsung DAI now
registers the ASoC 'platform' itself. Machine drivers are adjusted for
the new 'platform' name.

Signed-off-by: Padmavathi Venna <padma.v@samsung.com>
---
 sound/soc/samsung/dma.c         |   24 ++++++------------------
 sound/soc/samsung/dma.h         |    3 +++
 sound/soc/samsung/i2s.c         |    3 +++
 sound/soc/samsung/smdk_wm8994.c |    7 +++++--
 4 files changed, 17 insertions(+), 20 deletions(-)

diff --git a/sound/soc/samsung/dma.c b/sound/soc/samsung/dma.c
index 359708c..f7e0d47 100644
--- a/sound/soc/samsung/dma.c
+++ b/sound/soc/samsung/dma.c
@@ -433,30 +433,18 @@ static struct snd_soc_platform_driver samsung_asoc_platform = {
 	.pcm_free	= dma_free_dma_buffers,
 };
 
-static int __devinit samsung_asoc_platform_probe(struct platform_device *pdev)
+int __devinit samsung_dma_platform_register(struct device *dev)
 {
-	return snd_soc_register_platform(&pdev->dev, &samsung_asoc_platform);
+	return snd_soc_register_platform(dev, &samsung_asoc_platform);
 }
+EXPORT_SYMBOL_GPL(samsung_dma_platform_register);
 
-static int __devexit samsung_asoc_platform_remove(struct platform_device *pdev)
+void __devexit samsung_dma_platform_unregister(struct device *dev)
 {
-	snd_soc_unregister_platform(&pdev->dev);
-	return 0;
+	snd_soc_unregister_platform(dev);
 }
-
-static struct platform_driver asoc_dma_driver = {
-	.driver = {
-		.name = "samsung-audio",
-		.owner = THIS_MODULE,
-	},
-
-	.probe = samsung_asoc_platform_probe,
-	.remove = __devexit_p(samsung_asoc_platform_remove),
-};
-
-module_platform_driver(asoc_dma_driver);
+EXPORT_SYMBOL_GPL(samsung_dma_platform_unregister);
 
 MODULE_AUTHOR("Ben Dooks, <ben@simtec.co.uk>");
 MODULE_DESCRIPTION("Samsung ASoC DMA Driver");
 MODULE_LICENSE("GPL");
-MODULE_ALIAS("platform:samsung-audio");
diff --git a/sound/soc/samsung/dma.h b/sound/soc/samsung/dma.h
index 2e60415..3c462a8 100644
--- a/sound/soc/samsung/dma.h
+++ b/sound/soc/samsung/dma.h
@@ -22,4 +22,7 @@ struct s3c_dma_params {
 	struct property *dma_prop;
 };
 
+int samsung_dma_platform_register(struct device *dev);
+void samsung_dma_platform_unregister(struct device *dev);
+
 #endif
diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c
index a7d03d9..dbf1e5c 100644
--- a/sound/soc/samsung/i2s.c
+++ b/sound/soc/samsung/i2s.c
@@ -1075,6 +1075,7 @@ static __devinit int samsung_i2s_probe(struct platform_device *pdev)
 		sec_dai = dev_get_drvdata(&pdev->dev);
 		snd_soc_register_dai(&sec_dai->pdev->dev,
 			&sec_dai->i2s_dai_drv);
+		samsung_dma_platform_register(&pdev->dev);
 		return 0;
 	}
 
@@ -1232,6 +1233,8 @@ static __devinit int samsung_i2s_probe(struct platform_device *pdev)
 
 	pm_runtime_enable(&pdev->dev);
 
+	samsung_dma_platform_register(&pdev->dev);
+
 	return 0;
 err:
 	release_mem_region(regs_base, resource_size(res));
diff --git a/sound/soc/samsung/smdk_wm8994.c b/sound/soc/samsung/smdk_wm8994.c
index f9ba2b9..2f3e2b8 100644
--- a/sound/soc/samsung/smdk_wm8994.c
+++ b/sound/soc/samsung/smdk_wm8994.c
@@ -128,7 +128,7 @@ static struct snd_soc_dai_link smdk_dai[] = {
 		.stream_name = "Pri_Dai",
 		.cpu_dai_name = "samsung-i2s.0",
 		.codec_dai_name = "wm8994-aif1",
-		.platform_name = "samsung-audio",
+		.platform_name = "samsung-i2s.0",
 		.codec_name = "wm8994-codec",
 		.init = smdk_wm8994_init_paiftx,
 		.ops = &smdk_ops,
@@ -137,7 +137,7 @@ static struct snd_soc_dai_link smdk_dai[] = {
 		.stream_name = "Sec_Dai",
 		.cpu_dai_name = "samsung-i2s.4",
 		.codec_dai_name = "wm8994-aif1",
-		.platform_name = "samsung-audio",
+		.platform_name = "samsung-i2s.4",
 		.codec_name = "wm8994-codec",
 		.ops = &smdk_ops,
 	},
@@ -168,6 +168,9 @@ static int __devinit smdk_audio_probe(struct platform_device *pdev)
 			   "Property 'samsung,i2s-controller' missing or invalid\n");
 			ret = -EINVAL;
 		}
+
+		smdk_dai[0].platform_name = NULL;
+		smdk_dai[0].platform_of_node = smdk_dai[0].cpu_of_node;
 	}
 
 	ret = snd_soc_register_card(card);
-- 
1.7.4.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 1/2] ASoC: Samsung: WM8994: Add basic device tree support for machine file
  2012-12-01 10:07 ` [PATCH 1/2] ASoC: Samsung: WM8994: Add basic device tree support for machine file Padmavathi Venna
@ 2012-12-01 13:49   ` Mark Brown
  0 siblings, 0 replies; 5+ messages in thread
From: Mark Brown @ 2012-12-01 13:49 UTC (permalink / raw)
  To: linux-arm-kernel

On Sat, Dec 01, 2012 at 03:37:26PM +0530, Padmavathi Venna wrote:
> Add the basic device tree based lookup.
> 
> Signed-off-by: Padmavathi Venna <padma.v@samsung.com>
> ---
>  sound/soc/samsung/smdk_wm8994.c |   23 +++++++++++++++++++++++

Any new device tree bindings need binding documentation.

Your subject line is also very misleading here...  it should say that
it's talking about the SMDK.  There's at least two other WM8994 based
Samsung boards in mainline.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20121201/b82b780b/attachment.sig>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 2/2] ASoC: Samsung: Do not register samsung audio dma device as pdev
  2012-12-01 10:07 ` [PATCH 2/2] ASoC: Samsung: Do not register samsung audio dma device as pdev Padmavathi Venna
@ 2012-12-02  4:33   ` Mark Brown
  0 siblings, 0 replies; 5+ messages in thread
From: Mark Brown @ 2012-12-02  4:33 UTC (permalink / raw)
  To: linux-arm-kernel

On Sat, Dec 01, 2012 at 03:37:27PM +0530, Padmavathi Venna wrote:

>  sound/soc/samsung/dma.c         |   24 ++++++------------------
>  sound/soc/samsung/dma.h         |    3 +++
>  sound/soc/samsung/i2s.c         |    3 +++
>  sound/soc/samsung/smdk_wm8994.c |    7 +++++--
>  4 files changed, 17 insertions(+), 20 deletions(-)

This is fine in principle but it's going to break every Samsung based
platform except the SMDK with WM8994 as only machine driver updated to
reflect the changed DAI name is that one, the others need updating too.

This includes pretty much all the platforms I actively work on...
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20121202/2249480c/attachment.sig>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-12-02  4:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-01 10:07 [PATCH 0/2] ASoC: Samsung: Remove platform device support Padmavathi Venna
2012-12-01 10:07 ` [PATCH 1/2] ASoC: Samsung: WM8994: Add basic device tree support for machine file Padmavathi Venna
2012-12-01 13:49   ` Mark Brown
2012-12-01 10:07 ` [PATCH 2/2] ASoC: Samsung: Do not register samsung audio dma device as pdev Padmavathi Venna
2012-12-02  4:33   ` Mark Brown

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).