All of lore.kernel.org
 help / color / mirror / Atom feed
From: shawn.guo@freescale.com (Shawn Guo)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH V1 1/3] ARM: clk-imx6sl: refine clock tree for SSI
Date: Mon, 15 Sep 2014 22:48:05 +0800	[thread overview]
Message-ID: <20140915144803.GL18566@dragon> (raw)
In-Reply-To: <20140915115855.GC23877@audiosh1>

On Mon, Sep 15, 2014 at 07:58:56PM +0800, Shengjiu Wang wrote:
> I add IMX6QDL_CLK_SSIx in this patch, which use share count with 
> IMX6QDL_CLK_SSIx_IPG. The SSI driver sound/soc/fsl/fsl_ssi.c will enable
> IMX6QDL_CLK_SSIx_IPG clock in probe, but don't disable it. In the end of kernel
> boot up, some one(it is not ssi driver, maybe is the clock tree) will disable
> the IMX6QDL_CLK_SSIx clock, which is not enabled. IMX6QDL_CLK_SSIx_IPG share
> the enable/disable bit with IMX6QDL_CLK_SSIx, So IMX6QDL_CLK_SSIx_IPG is 
> disabled, the aplay will fail.
> 
> Is this the issue of imx_clk_gate2_shared()? When we want to disable IMX6QDL_CLK_SSIx,
> but IMX6QDL_CLK_SSIx_IPG is enabled, can IMX6QDL_CLK_SSIx be disabled?
> 
> 
> Shawn
> 
>    How do you think about this?

Shengjiu,

Your analysis is right.  I hope the following change will get the shared
gate clock code eventually does the right thing.

Shawn

diff --git a/arch/arm/mach-imx/clk-gate2.c b/arch/arm/mach-imx/clk-gate2.c
index 84acdfd1d715..89abdf738dc9 100644
--- a/arch/arm/mach-imx/clk-gate2.c
+++ b/arch/arm/mach-imx/clk-gate2.c
@@ -97,7 +97,7 @@ static int clk_gate2_is_enabled(struct clk_hw *hw)
        struct clk_gate2 *gate = to_clk_gate2(hw);

        if (gate->share_count)
-               return !!(*gate->share_count);
+               return !!__clk_get_enable_count(hw->clk);
        else
                return clk_gate2_reg_is_enabled(gate->reg, gate->bit_idx);
 }

WARNING: multiple messages have this Message-ID (diff)
From: Shawn Guo <shawn.guo@freescale.com>
To: Shengjiu Wang <shengjiu.wang@freescale.com>
Cc: Fabio Estevam <festevam@gmail.com>,
	Sascha Hauer <kernel@pengutronix.de>,
	Russell King <linux@arm.linux.org.uk>,
	"robh+dt@kernel.org" <robh+dt@kernel.org>,
	Pawel Moll <pawel.moll@arm.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Ian Campbell <ijc+devicetree@hellion.org.uk>,
	"Kumar Gala" <galak@codeaurora.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH V1 1/3] ARM: clk-imx6sl: refine clock tree for SSI
Date: Mon, 15 Sep 2014 22:48:05 +0800	[thread overview]
Message-ID: <20140915144803.GL18566@dragon> (raw)
In-Reply-To: <20140915115855.GC23877@audiosh1>

On Mon, Sep 15, 2014 at 07:58:56PM +0800, Shengjiu Wang wrote:
> I add IMX6QDL_CLK_SSIx in this patch, which use share count with 
> IMX6QDL_CLK_SSIx_IPG. The SSI driver sound/soc/fsl/fsl_ssi.c will enable
> IMX6QDL_CLK_SSIx_IPG clock in probe, but don't disable it. In the end of kernel
> boot up, some one(it is not ssi driver, maybe is the clock tree) will disable
> the IMX6QDL_CLK_SSIx clock, which is not enabled. IMX6QDL_CLK_SSIx_IPG share
> the enable/disable bit with IMX6QDL_CLK_SSIx, So IMX6QDL_CLK_SSIx_IPG is 
> disabled, the aplay will fail.
> 
> Is this the issue of imx_clk_gate2_shared()? When we want to disable IMX6QDL_CLK_SSIx,
> but IMX6QDL_CLK_SSIx_IPG is enabled, can IMX6QDL_CLK_SSIx be disabled?
> 
> 
> Shawn
> 
>    How do you think about this?

Shengjiu,

Your analysis is right.  I hope the following change will get the shared
gate clock code eventually does the right thing.

Shawn

diff --git a/arch/arm/mach-imx/clk-gate2.c b/arch/arm/mach-imx/clk-gate2.c
index 84acdfd1d715..89abdf738dc9 100644
--- a/arch/arm/mach-imx/clk-gate2.c
+++ b/arch/arm/mach-imx/clk-gate2.c
@@ -97,7 +97,7 @@ static int clk_gate2_is_enabled(struct clk_hw *hw)
        struct clk_gate2 *gate = to_clk_gate2(hw);

        if (gate->share_count)
-               return !!(*gate->share_count);
+               return !!__clk_get_enable_count(hw->clk);
        else
                return clk_gate2_reg_is_enabled(gate->reg, gate->bit_idx);
 }

  reply	other threads:[~2014-09-15 14:48 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-09  9:13 [PATCH V1 0/3] refine the ssi clock for imx6sl, and update dts file Shengjiu Wang
2014-09-09  9:13 ` Shengjiu Wang
2014-09-09  9:13 ` [PATCH V1 1/3] ARM: clk-imx6sl: refine clock tree for SSI Shengjiu Wang
2014-09-09  9:13   ` Shengjiu Wang
2014-09-12 16:35   ` Fabio Estevam
2014-09-12 16:35     ` Fabio Estevam
2014-09-12 16:43     ` Fabio Estevam
2014-09-12 16:43       ` Fabio Estevam
2014-09-15 11:58       ` Shengjiu Wang
2014-09-15 11:58         ` Shengjiu Wang
2014-09-15 14:48         ` Shawn Guo [this message]
2014-09-15 14:48           ` Shawn Guo
2014-09-15 15:09           ` Fabio Estevam
2014-09-15 15:09             ` Fabio Estevam
2014-09-09  9:13 ` [PATCH V1 2/3] ARM: dts: imx6qdl: add baud clock and clock-names for ssi Shengjiu Wang
2014-09-09  9:13   ` Shengjiu Wang
2014-09-09  9:13 ` [PATCH V1 3/3] ARM: dts: imx6sl: " Shengjiu Wang
2014-09-09  9:13   ` Shengjiu Wang
2014-09-10  3:10 ` [PATCH V1 0/3] refine the ssi clock for imx6sl, and update dts file Shawn Guo
2014-09-10  3:10   ` Shawn Guo

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=20140915144803.GL18566@dragon \
    --to=shawn.guo@freescale.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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.