diff mbox

[v5,2/6] ASoC: dwc: Prepare clock before use

Message ID faa0193d388fe808c2fae461954bb1730ba29244.1419936132.git.Andrew.Jackson@arm.com (mailing list archive)
State New, archived
Headers show

Commit Message

Andrew Jackson Dec. 30, 2014, 10:55 a.m. UTC
From: Andrew Jackson <Andrew.Jackson@arm.com>

Some I2S clocks may require some time to get the clock ready
for operation and so need to be prepared before they are enabled.
So, prepare the clock as well as enabling it, but combine the
two through clk_prepare_enable.

Signed-off-by: Andrew Jackson <Andrew.Jackson@arm.com>
---
 sound/soc/dwc/designware_i2s.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

Comments

Sergei Shtylyov Dec. 30, 2014, 12:39 p.m. UTC | #1
Hello.

On 12/30/2014 1:55 PM, Andrew Jackson wrote:

> From: Andrew Jackson <Andrew.Jackson@arm.com>

> Some I2S clocks may require some time to get the clock ready
> for operation and so need to be prepared before they are enabled.
> So, prepare the clock as well as enabling it, but combine the
> two through clk_prepare_enable.

> Signed-off-by: Andrew Jackson <Andrew.Jackson@arm.com>
> ---
>   sound/soc/dwc/designware_i2s.c |    7 +++++--
>   1 files changed, 5 insertions(+), 2 deletions(-)

> diff --git a/sound/soc/dwc/designware_i2s.c b/sound/soc/dwc/designware_i2s.c
> index 5e9d163..08608c1 100644
> --- a/sound/soc/dwc/designware_i2s.c
> +++ b/sound/soc/dwc/designware_i2s.c
[...]
> @@ -426,13 +426,16 @@ static int dw_i2s_probe(struct platform_device *pdev)
[...]
>   static int dw_i2s_remove(struct platform_device *pdev)
>   {
> +	struct dw_i2s_dev *dev = dev_get_drvdata(&pdev->dev);

    Why not just platform_get_drvdata(pdev)?

[...]

WBR, Sergei
Mark Brown Dec. 30, 2014, 4:51 p.m. UTC | #2
On Tue, Dec 30, 2014 at 10:55:44AM +0000, Andrew Jackson wrote:
> From: Andrew Jackson <Andrew.Jackson@arm.com>
> 
> Some I2S clocks may require some time to get the clock ready
> for operation and so need to be prepared before they are enabled.
> So, prepare the clock as well as enabling it, but combine the
> two through clk_prepare_enable.

Applied, though the changelog is inaccurate - the need to do things
outside of hardirq context is the reason the common clock API has a
prepare stage but it's just a flat out requirement of the common clock
API to prepare clocks.
diff mbox

Patch

diff --git a/sound/soc/dwc/designware_i2s.c b/sound/soc/dwc/designware_i2s.c
index 5e9d163..08608c1 100644
--- a/sound/soc/dwc/designware_i2s.c
+++ b/sound/soc/dwc/designware_i2s.c
@@ -411,7 +411,7 @@  static int dw_i2s_probe(struct platform_device *pdev)
 	if (IS_ERR(dev->clk))
 		return  PTR_ERR(dev->clk);
 
-	ret = clk_enable(dev->clk);
+	ret = clk_prepare_enable(dev->clk);
 	if (ret < 0)
 		return ret;
 
@@ -426,13 +426,16 @@  static int dw_i2s_probe(struct platform_device *pdev)
 	return 0;
 
 err_clk_disable:
-	clk_disable(dev->clk);
+	clk_disable_unprepare(dev->clk);
 	return ret;
 }
 
 static int dw_i2s_remove(struct platform_device *pdev)
 {
+	struct dw_i2s_dev *dev = dev_get_drvdata(&pdev->dev);
+
 	snd_soc_unregister_component(&pdev->dev);
+	clk_disable_unprepare(dev->clk);
 
 	return 0;
 }