Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1402985 > unrolled thread

[PATCH 14/14] ASoC: omap-mcpdm: Add support for pdmclk clock handling

Started byPeter Ujfalusi <peter.ujfalusi@ti.com>
First post2016-05-18 15:50 +0200
Last post2016-05-27 22:40 +0200
Articles 3 — 3 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 14/14] ASoC: omap-mcpdm: Add support for pdmclk clock handling Peter Ujfalusi <peter.ujfalusi@ti.com> - 2016-05-18 15:50 +0200
    Re: [PATCH 14/14] ASoC: omap-mcpdm: Add support for pdmclk clock  handling Rob Herring <robh@kernel.org> - 2016-05-19 01:40 +0200
    Re: [PATCH 14/14] ASoC: omap-mcpdm: Add support for pdmclk clock  handling Mark Brown <broonie@kernel.org> - 2016-05-27 22:40 +0200

#1402985 — [PATCH 14/14] ASoC: omap-mcpdm: Add support for pdmclk clock handling

FromPeter Ujfalusi <peter.ujfalusi@ti.com>
Date2016-05-18 15:50 +0200
Subject[PATCH 14/14] ASoC: omap-mcpdm: Add support for pdmclk clock handling
Message-ID<rAa1k-2O5-9@gated-at.bofh.it>
McPDM module receives it's functional clock from external source. This
clock is the pdmclk provided by the twl6040 audio IC. If the clock is not
available all register accesses to McPDM fails and the module is not
operational.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
---
 Documentation/devicetree/bindings/sound/omap-mcpdm.txt | 10 ++++++++++
 sound/soc/omap/omap-mcpdm.c                            | 17 +++++++++++++++++
 2 files changed, 27 insertions(+)

diff --git a/Documentation/devicetree/bindings/sound/omap-mcpdm.txt b/Documentation/devicetree/bindings/sound/omap-mcpdm.txt
index 0741dff048dd..6f6c2f8e908d 100644
--- a/Documentation/devicetree/bindings/sound/omap-mcpdm.txt
+++ b/Documentation/devicetree/bindings/sound/omap-mcpdm.txt
@@ -8,6 +8,8 @@ Required properties:
 - interrupts: Interrupt number for McPDM
 - interrupt-parent: The parent interrupt controller
 - ti,hwmods: Name of the hwmod associated to the McPDM
+- clocks:  phandle for the pdmclk provider, likely <&twl6040>
+- clock-names: Must be "pdmclk"
 
 Example:
 
@@ -19,3 +21,11 @@ mcpdm: mcpdm@40132000 {
 	interrupt-parent = <&gic>;
 	ti,hwmods = "mcpdm";
 };
+
+In board DTS file the pdmclk needs to be added:
+
+&mcpdm {
+	clocks = <&twl6040>;
+	clock-names = "pdmclk";
+	status = "okay";
+};
diff --git a/sound/soc/omap/omap-mcpdm.c b/sound/soc/omap/omap-mcpdm.c
index 74d6e6fdcfd0..e7cdc51fd806 100644
--- a/sound/soc/omap/omap-mcpdm.c
+++ b/sound/soc/omap/omap-mcpdm.c
@@ -31,6 +31,7 @@
 #include <linux/err.h>
 #include <linux/io.h>
 #include <linux/irq.h>
+#include <linux/clk.h>
 #include <linux/slab.h>
 #include <linux/pm_runtime.h>
 #include <linux/of_device.h>
@@ -54,6 +55,7 @@ struct omap_mcpdm {
 	unsigned long phys_base;
 	void __iomem *io_base;
 	int irq;
+	struct clk *pdmclk;
 
 	struct mutex mutex;
 
@@ -388,6 +390,7 @@ static int omap_mcpdm_probe(struct snd_soc_dai *dai)
 	struct omap_mcpdm *mcpdm = snd_soc_dai_get_drvdata(dai);
 	int ret;
 
+	clk_prepare_enable(mcpdm->pdmclk);
 	pm_runtime_enable(mcpdm->dev);
 
 	/* Disable lines while request is ongoing */
@@ -422,6 +425,7 @@ static int omap_mcpdm_remove(struct snd_soc_dai *dai)
 
 	pm_runtime_disable(mcpdm->dev);
 
+	clk_disable_unprepare(mcpdm->pdmclk);
 	return 0;
 }
 
@@ -441,6 +445,8 @@ static int omap_mcpdm_suspend(struct snd_soc_dai *dai)
 		mcpdm->pm_active_count++;
 	}
 
+	clk_disable_unprepare(mcpdm->pdmclk);
+
 	return 0;
 }
 
@@ -448,6 +454,8 @@ static int omap_mcpdm_resume(struct snd_soc_dai *dai)
 {
 	struct omap_mcpdm *mcpdm = snd_soc_dai_get_drvdata(dai);
 
+	clk_prepare_enable(mcpdm->pdmclk);
+
 	if (mcpdm->pm_active_count) {
 		while (mcpdm->pm_active_count--)
 			pm_runtime_get_sync(mcpdm->dev);
@@ -541,6 +549,15 @@ static int asoc_mcpdm_probe(struct platform_device *pdev)
 
 	mcpdm->dev = &pdev->dev;
 
+	mcpdm->pdmclk = devm_clk_get(&pdev->dev, "pdmclk");
+	if (IS_ERR(mcpdm->pdmclk)) {
+		if (PTR_ERR(mcpdm->pdmclk) == -EPROBE_DEFER)
+			return -EPROBE_DEFER;
+		dev_warn(&pdev->dev, "Error getting pdmclk (%ld)!\n",
+			 PTR_ERR(mcpdm->pdmclk));
+		mcpdm->pdmclk = NULL;
+	}
+
 	ret =  devm_snd_soc_register_component(&pdev->dev,
 					       &omap_mcpdm_component,
 					       &omap_mcpdm_dai, 1);
-- 
2.8.2

[toc] | [next] | [standalone]


#1403347 — Re: [PATCH 14/14] ASoC: omap-mcpdm: Add support for pdmclk clock handling

FromRob Herring <robh@kernel.org>
Date2016-05-19 01:40 +0200
SubjectRe: [PATCH 14/14] ASoC: omap-mcpdm: Add support for pdmclk clock handling
Message-ID<rAjeh-iW-1@gated-at.bofh.it>
In reply to#1402985
On Wed, May 18, 2016 at 04:46:36PM +0300, Peter Ujfalusi wrote:
> McPDM module receives it's functional clock from external source. This
> clock is the pdmclk provided by the twl6040 audio IC. If the clock is not
> available all register accesses to McPDM fails and the module is not
> operational.
> 
> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
> ---
>  Documentation/devicetree/bindings/sound/omap-mcpdm.txt | 10 ++++++++++
>  sound/soc/omap/omap-mcpdm.c                            | 17 +++++++++++++++++
>  2 files changed, 27 insertions(+)

Acked-by: Rob Herring <robh@kernel.org>

[toc] | [prev] | [next] | [standalone]


#1408297 — Re: [PATCH 14/14] ASoC: omap-mcpdm: Add support for pdmclk clock handling

FromMark Brown <broonie@kernel.org>
Date2016-05-27 22:40 +0200
SubjectRe: [PATCH 14/14] ASoC: omap-mcpdm: Add support for pdmclk clock handling
Message-ID<rDwI2-861-25@gated-at.bofh.it>
In reply to#1402985

[Multipart message — attachments visible in raw view] — view raw

On Wed, May 18, 2016 at 04:46:36PM +0300, Peter Ujfalusi wrote:

> +	clk_prepare_enable(mcpdm->pdmclk);

Should really check the return value here.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web