From: Krzysztof Kozlowski <k.kozlowski@samsung.com>
To: Tomasz Figa <tomasz.figa@gmail.com>
Cc: Mike Turquette <mturquette@linaro.org>,
Sylwester Nawrocki <s.nawrocki@samsung.com>,
Kukjin Kim <kgene@kernel.org>,
linux-kernel <linux-kernel@vger.kernel.org>,
"linux-samsung-soc@vger.kernel.org"
<linux-samsung-soc@vger.kernel.org>,
linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
Javier Martinez Canillas <javier.martinez@collabora.co.uk>,
Vivek Gautam <gautam.vivek@samsung.com>,
Kevin Hilman <khilman@kernel.org>
Subject: Re: [RFC 2/2] clk: samsung: Fix clock disable failure because domain being gated
Date: Tue, 25 Nov 2014 13:19:05 +0100 [thread overview]
Message-ID: <1416917945.29431.6.camel@AMDC1943> (raw)
In-Reply-To: <CA+Ln22FTJ8AwNOq+jrA6dK=4ziGFwFT+Ofjr2zE4z=8B4f3QJw@mail.gmail.com>
On wto, 2014-11-25 at 20:35 +0900, Tomasz Figa wrote:
> Hi Krzysztof,
>
> Please see my comments inline.
>
> 2014-11-25 0:18 GMT+09:00 Krzysztof Kozlowski <k.kozlowski@samsung.com>:
> > +static int audss_clk_gate_enable(struct clk_hw *hw)
> > +{
> > + int ret;
> > +
> > + if (!IS_ERR(pll_in))
> > + clk_prepare_enable(pll_in);
>
> Calling clk_prepare_enable() from enable() callback doesn't look like
> a good idea, because enabling is not supposed to sleep, while
> preparing might do so.
Right.
> I guess you have to pre-prepare this clock in probe and then only call
> enable here.
Yes, the prepare won't have any negative effect on energy usage anyway.
>
> > + ret = clk_gate_ops.enable(hw);
> > + if (!IS_ERR(pll_in))
> > + clk_disable_unprepare(pll_in);
> > +
> > + return ret;
> > +}
>
> [snip]
>
> > +/* TODO: Also mux and div */
> > +const struct clk_ops audss_clk_gate_ops = {
>
> nit: static const probably?
Yes.
>
> > + .enable = audss_clk_gate_enable,
> > + .disable = audss_clk_gate_disable,
> > + .is_enabled = audss_clk_gate_is_enabled,
> > +};
>
> As for the approach itself, maybe you should simply register fully
> custom clocks with clk_register(), without altering
> clk_register_gate() at all and simply calling gate ops whenever
> necessary? I don't know, just a loose idea.
Initially that seemed to me the simplest way to encapsulate gate_ops
calls. However in that approach I should also change clk_register_mux
and clk_register_divider... which complicates this patch and maybe your
idea will be simpler overall.
> By the way, this issue could be probably solved by integrating generic
> clocks with regmap API, since regmap-mmio can automatically control a
> clock.
Indeed but this looks like much bigger task.
Anyway thanks for feedback. I'll prepare another version.
Best regards,
Krzysztof
WARNING: multiple messages have this Message-ID (diff)
From: k.kozlowski@samsung.com (Krzysztof Kozlowski)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC 2/2] clk: samsung: Fix clock disable failure because domain being gated
Date: Tue, 25 Nov 2014 13:19:05 +0100 [thread overview]
Message-ID: <1416917945.29431.6.camel@AMDC1943> (raw)
In-Reply-To: <CA+Ln22FTJ8AwNOq+jrA6dK=4ziGFwFT+Ofjr2zE4z=8B4f3QJw@mail.gmail.com>
On wto, 2014-11-25 at 20:35 +0900, Tomasz Figa wrote:
> Hi Krzysztof,
>
> Please see my comments inline.
>
> 2014-11-25 0:18 GMT+09:00 Krzysztof Kozlowski <k.kozlowski@samsung.com>:
> > +static int audss_clk_gate_enable(struct clk_hw *hw)
> > +{
> > + int ret;
> > +
> > + if (!IS_ERR(pll_in))
> > + clk_prepare_enable(pll_in);
>
> Calling clk_prepare_enable() from enable() callback doesn't look like
> a good idea, because enabling is not supposed to sleep, while
> preparing might do so.
Right.
> I guess you have to pre-prepare this clock in probe and then only call
> enable here.
Yes, the prepare won't have any negative effect on energy usage anyway.
>
> > + ret = clk_gate_ops.enable(hw);
> > + if (!IS_ERR(pll_in))
> > + clk_disable_unprepare(pll_in);
> > +
> > + return ret;
> > +}
>
> [snip]
>
> > +/* TODO: Also mux and div */
> > +const struct clk_ops audss_clk_gate_ops = {
>
> nit: static const probably?
Yes.
>
> > + .enable = audss_clk_gate_enable,
> > + .disable = audss_clk_gate_disable,
> > + .is_enabled = audss_clk_gate_is_enabled,
> > +};
>
> As for the approach itself, maybe you should simply register fully
> custom clocks with clk_register(), without altering
> clk_register_gate() at all and simply calling gate ops whenever
> necessary? I don't know, just a loose idea.
Initially that seemed to me the simplest way to encapsulate gate_ops
calls. However in that approach I should also change clk_register_mux
and clk_register_divider... which complicates this patch and maybe your
idea will be simpler overall.
> By the way, this issue could be probably solved by integrating generic
> clocks with regmap API, since regmap-mmio can automatically control a
> clock.
Indeed but this looks like much bigger task.
Anyway thanks for feedback. I'll prepare another version.
Best regards,
Krzysztof
next prev parent reply other threads:[~2014-11-25 12:19 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-24 15:18 [RFC 0/2] Fix Arndale Octa/Peach Pi boot on Audio subsystem clocks Krzysztof Kozlowski
2014-11-24 15:18 ` Krzysztof Kozlowski
2014-11-24 15:18 ` [RFC 1/2] clk: Allow overriding generic ops for clocks Krzysztof Kozlowski
2014-11-24 15:18 ` Krzysztof Kozlowski
2014-11-25 1:34 ` Mike Turquette
2014-11-25 1:34 ` Mike Turquette
2014-11-25 1:34 ` Mike Turquette
2014-11-25 8:10 ` Krzysztof Kozlowski
2014-11-25 8:10 ` Krzysztof Kozlowski
2014-11-24 15:18 ` [RFC 2/2] clk: samsung: Fix clock disable failure because domain being gated Krzysztof Kozlowski
2014-11-24 15:18 ` Krzysztof Kozlowski
2014-11-25 11:35 ` Tomasz Figa
2014-11-25 11:35 ` Tomasz Figa
2014-11-25 12:19 ` Krzysztof Kozlowski [this message]
2014-11-25 12:19 ` Krzysztof Kozlowski
2014-11-24 17:28 ` [RFC 0/2] Fix Arndale Octa/Peach Pi boot on Audio subsystem clocks Javier Martinez Canillas
2014-11-24 17:28 ` Javier Martinez Canillas
2014-11-25 9:22 ` Krzysztof Kozlowski
2014-11-25 9:22 ` Krzysztof Kozlowski
2014-11-25 13:36 ` Javier Martinez Canillas
2014-11-25 13:36 ` Javier Martinez Canillas
2014-11-25 14:22 ` Krzysztof Kozlowski
2014-11-25 14:22 ` Krzysztof Kozlowski
2014-11-25 14:52 ` Javier Martinez Canillas
2014-11-25 14:52 ` Javier Martinez Canillas
2014-11-25 14:54 ` Krzysztof Kozlowski
2014-11-25 14:54 ` Krzysztof Kozlowski
2014-11-25 15:13 ` Javier Martinez Canillas
2014-11-25 15:13 ` Javier Martinez Canillas
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=1416917945.29431.6.camel@AMDC1943 \
--to=k.kozlowski@samsung.com \
--cc=gautam.vivek@samsung.com \
--cc=javier.martinez@collabora.co.uk \
--cc=kgene@kernel.org \
--cc=khilman@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=mturquette@linaro.org \
--cc=s.nawrocki@samsung.com \
--cc=tomasz.figa@gmail.com \
/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.