linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH 4.6 69/81] gpio: zynq: initialize clock even without CONFIG_PM
       [not found]   ` <CAKfKVtEFF=PvZ62N-Re9BX4iq+pCK5qchbp7N3TworkpRkAZZQ@mail.gmail.com>
@ 2016-07-21 10:57     ` Helmut Grohne
  2016-08-02  8:59       ` Shubhrajyoti Datta
  0 siblings, 1 reply; 3+ messages in thread
From: Helmut Grohne @ 2016-07-21 10:57 UTC (permalink / raw)
  To: Shubhrajyoti Datta; +Cc: linux-gpio, Shubhrajyoti Datta

On Fri, Jul 08, 2016 at 10:23:07AM +0200, Shubhrajyoti Datta wrote:
>  A small issue
> 
> Now it will be off by 1 ie we enable twice in probe.
> 
> solution is that either there should be get_sync or clk_enable but not both.

As far as I understand the inner workings of pm_runtime_get_sync this is
not a problem.

> > +       ret = clk_prepare_enable(gpio->clk);
> > +       if (ret) {
> > +               dev_err(&pdev->dev, "Unable to enable clock.\n");
> > +               return ret;
> > +       }
> 
> This will now enable the first time.
> >
> > +       pm_runtime_set_active(&pdev->dev);
> the the pm core that it is enabled .

This function sets pdev->dev.power.runtime_status to RPM_ACTIVE (via
__update_runtime_status).

> >         pm_runtime_enable(&pdev->dev);
> >         ret = pm_runtime_get_sync(&pdev->dev);
> 
> this will enable the second time.

The bulk of the work is done by rpm_resume. Close to the top of the
function the runtime_status field is compared to RPM_ACTIVE and if so,
the resume operation is skipped.

Is there any mistake in that analysis?

Helmut

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 4.6 69/81] gpio: zynq: initialize clock even without CONFIG_PM
  2016-07-21 10:57     ` [PATCH 4.6 69/81] gpio: zynq: initialize clock even without CONFIG_PM Helmut Grohne
@ 2016-08-02  8:59       ` Shubhrajyoti Datta
  2016-08-02 10:58         ` Helmut Grohne
  0 siblings, 1 reply; 3+ messages in thread
From: Shubhrajyoti Datta @ 2016-08-02  8:59 UTC (permalink / raw)
  To: Helmut Grohne; +Cc: linux-gpio, Shubhrajyoti Datta

On Thu, Jul 21, 2016 at 4:27 PM, Helmut Grohne <h.grohne@intenta.de> wrote:
> On Fri, Jul 08, 2016 at 10:23:07AM +0200, Shubhrajyoti Datta wrote:
>>  A small issue
>>
>> Now it will be off by 1 ie we enable twice in probe.
>>
>> solution is that either there should be get_sync or clk_enable but not both.
>
> As far as I understand the inner workings of pm_runtime_get_sync this is
> not a problem.

the issue is not with the runtime.
>
>> > +       ret = clk_prepare_enable(gpio->clk);
>> > +       if (ret) {
>> > +               dev_err(&pdev->dev, "Unable to enable clock.\n");
>> > +               return ret;
>> > +       }
>>
>> This will now enable the first time.
>> >
>> > +       pm_runtime_set_active(&pdev->dev);
>> the the pm core that it is enabled .
>
> This function sets pdev->dev.power.runtime_status to RPM_ACTIVE (via
> __update_runtime_status).
>
>> >         pm_runtime_enable(&pdev->dev);
>> >         ret = pm_runtime_get_sync(&pdev->dev);
>>
>> this will enable the second time.
>
> The bulk of the work is done by rpm_resume. Close to the top of the
> function the runtime_status field is compared to RPM_ACTIVE and if so,
> the resume operation is skipped.
>
> Is there any mistake in that analysis?

I feel that if you can print the clk enable count in at boot things
could be easy
to understand.

>
> Helmut

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 4.6 69/81] gpio: zynq: initialize clock even without CONFIG_PM
  2016-08-02  8:59       ` Shubhrajyoti Datta
@ 2016-08-02 10:58         ` Helmut Grohne
  0 siblings, 0 replies; 3+ messages in thread
From: Helmut Grohne @ 2016-08-02 10:58 UTC (permalink / raw)
  To: Shubhrajyoti Datta; +Cc: linux-gpio@vger.kernel.org, Shubhrajyoti Datta

On Tue, Aug 02, 2016 at 10:59:05AM +0200, Shubhrajyoti Datta wrote:
> I feel that if you can print the clk enable count in at boot things
> could be easy
> to understand.

I verifed this via two ways now (holds both for CONFIG_PM=y and
CONFIG_PM=n):

 * zynq_gpio_runtime_resume is not called (as expected given my
   analysis). I simply added a printk to check that.
 * After boot, /sys/kernel/debug/clk/gpio_aper/clk_enable_count also
   confirms my analysis by yielding "1".

Thus I conclude that there there is no bug. Neither in theory nor in
practise.

Helmut

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-08-02 10:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20160622223743.240652686@linuxfoundation.org>
     [not found] ` <20160622223746.777833462@linuxfoundation.org>
     [not found]   ` <CAKfKVtEFF=PvZ62N-Re9BX4iq+pCK5qchbp7N3TworkpRkAZZQ@mail.gmail.com>
2016-07-21 10:57     ` [PATCH 4.6 69/81] gpio: zynq: initialize clock even without CONFIG_PM Helmut Grohne
2016-08-02  8:59       ` Shubhrajyoti Datta
2016-08-02 10:58         ` Helmut Grohne

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).