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


Groups > linux.kernel > #1331431

Re: [PATCH] clk: clk_register: Correctly initialize enable_count

From Rhyland Klein <rklein@nvidia.com>
Newsgroups linux.kernel
Subject Re: [PATCH] clk: clk_register: Correctly initialize enable_count
Date 2016-02-10 19:40 +0100
Message-ID <r0HQf-5YR-33@gated-at.bofh.it> (permalink)
References <r0pgC-21e-13@gated-at.bofh.it> <r0ttU-51J-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 2/9/2016 9:56 PM, Emilio López wrote:
> Hi,
> 
> El 09/02/16 a las 19:48, Rhyland Klein escribió:
>> When clocks are registered, they could be enabled already in
>> hardware. As of now, the enable count will start at 0. When this
>> happens, it means a clock is enabled and the framework doesn't know
>> that, so it will always report it as disabled.
> 
> Keep in mind that during the boot process, towards the end, unused
> clocks get disabled, so the state remains in sync. If suddenly the
> enable_count on unused clocks is not 0, this will break and unused
> clocks will remain on, wasting power.

Hmm, I had misread the logic in clk_disable_unused_subtree(), namely I
inverted the check on enable_count when I was looking at it. It does
seem like it would take care of the clocks I was referring to.

> 
> http://lxr.free-electrons.com/source/drivers/clk/clk.c#L244
> 
> What issue were you having that prompted you to write this patch?

I ran into the situation where a peripheral clock was enabled before the
kernel loaded, and I was trying to disable it in the clk-tegra210
driver. Calling clk_disable() won't work, as the clock doesn't have an
enable_count.

I do think that the clk_disable_unused_subtree() should pick up the
slack, but I was trying to disable it before the cleanup code to remove
unused clocks ran.

I think you are right and the clean up code should cover the situation I
was looking at.

Thanks.
-rhyland


-- 
nvpublic

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] clk: clk_register: Correctly initialize enable_count Rhyland Klein <rklein@nvidia.com> - 2016-02-09 23:50 +0100
  Re: [PATCH] clk: clk_register: Correctly initialize enable_count Emilio López <emilio@elopez.com.ar> - 2016-02-10 04:20 +0100
    Re: [PATCH] clk: clk_register: Correctly initialize enable_count Rhyland Klein <rklein@nvidia.com> - 2016-02-10 19:40 +0100
      Re: [PATCH] clk: clk_register: Correctly initialize enable_count Michael Turquette <mturquette@baylibre.com> - 2016-02-11 22:40 +0100
        Re: [PATCH] clk: clk_register: Correctly initialize enable_count Rhyland Klein <rklein@nvidia.com> - 2016-02-11 23:00 +0100

csiph-web