devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Fainelli <f.fainelli@gmail.com>
To: Charles Keepax <ckeepax@opensource.cirrus.com>
Cc: Linus Walleij <linus.walleij@linaro.org>,
	ext Tony Lindgren <tony@atomide.com>,
	Charles Keepax <ckeepax@opensource.wolfsonmicro.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Stephen Warren <swarren@nvidia.com>,
	Andy Shevchenko <andy.shevchenko@gmail.com>,
	Al Cooper <alcooperx@gmail.com>,
	"linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	Rob Herring <robh+dt@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	bcm-kernel-feedback-list <bcm-kernel-feedback-list@broadcom.com>
Subject: Re: [PATCH 1/2] pinctrl: Allow a device to indicate when to force a state
Date: Tue, 26 Sep 2017 10:51:14 -0700	[thread overview]
Message-ID: <61d19678-e90c-3b3a-099a-81200873edc8@gmail.com> (raw)
In-Reply-To: <20170926141628.h27hcrujzhxu4sph@localhost.localdomain>

On 09/26/2017 07:16 AM, Charles Keepax wrote:
> On Fri, Sep 22, 2017 at 09:57:22AM -0700, Florian Fainelli wrote:
>> On 09/22/2017 06:20 AM, Charles Keepax wrote:
>>> On Fri, Sep 22, 2017 at 01:55:22PM +0200, Linus Walleij wrote:
>>>> On Thu, Sep 21, 2017 at 3:04 AM, Florian Fainelli <f.fainelli@gmail.com> wrote:
>>> I guess in our case we didn't really consider the restore aspect
>>> because we essentially get that for free from regmap. Regmap
>>> cache's all our register state and provides a mechanism to sync
>>> that back to the hardware, so we simply invoke that on resume and
>>> all our GPIO/pinctrl state is restored.
>>
>> As you may see, the problem in my case is that the hardware has only onw
>> pinctrl state: "default", and it loses its hardware register contents,
>> and because of early check in pinctrl_select_state(), we do nothing (the
>> state has not changed per-se), so we are left with SW thinking we
>> applied the "default" state again, while in fact we did not.
>>
> 
> That is exactly the situation we have on the CODECs when they go
> into runtime suspend, power is removed, and everything is back at
> defaults when we resume. Just in our case we re-apply the state
> as part of the CODEC resume using a regmap sync.

Do you just re-apply the previous state, or do you force a "fake" state
by moving to a state different than the current during suspend, just to
force a transition during resume?

> 
>> The approach taken here was to move this to the core pinctrl code
>> because this is not something a pinctrl consumer should be aware of,
>> when it calls pinctrl_select_state(), it should do what it asked for.
>>
> 
> Apologies if I have missed something here, but does the consumer
> not still to some extent need to be aware with this solution
> since it needs to re-request the pin state in resume?

Consumers may indeed have to call pinctrl_select_state() but because of
the current check that does:

if (p->state == state)

this is not happening, but you are absolutely right, consumers that wish
to see their pin state be (re)configured during driver resume absolutely
need to tell the core about it, I am not thinking about any of this
happening "under the hood", this absolutely would not be right.

> 
> I think that is really my only reservation here, is it feels
> like this should be something that is purely implemented on the
> provider, and be invisible to the consumer, and I am not clear
> this is.
> 
>> I also decided to make this a per-provider property as opposed to a
>> per-group property because chances are that the state retention is on a
>> per-controller basis, and not per-bank/group, although I may be wrong.
>>
> 
> It seems quite likely that this property would mostly be
> per-provider to me as well.
> 
> Thanks,
> Charles
> 


-- 
Florian

  reply	other threads:[~2017-09-26 17:51 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-21  1:04 [PATCH 0/2] pinctrl: Allow indicating loss of state across suspend/resume Florian Fainelli
2017-09-21  1:04 ` [PATCH 1/2] pinctrl: Allow a device to indicate when to force a state Florian Fainelli
2017-09-22 11:55   ` Linus Walleij
2017-09-22 13:20     ` Charles Keepax
2017-09-22 13:57       ` Linus Walleij
2017-09-25 19:18         ` Florian Fainelli
     [not found]       ` <20170922132011.wssbhnsggteffgte-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2017-09-22 16:57         ` Florian Fainelli
2017-09-26 14:16           ` Charles Keepax
2017-09-26 17:51             ` Florian Fainelli [this message]
2017-09-27  8:26               ` Charles Keepax
2017-09-22 12:47   ` Charles Keepax
2017-09-22 16:45     ` Florian Fainelli
2017-09-21  1:04 ` [PATCH 2/2] pinctrl: single: Allow indicating loss of pin states during low-power Florian Fainelli
     [not found]   ` <20170921010421.7467-3-f.fainelli-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-09-22 13:03     ` Linus Walleij
2017-09-25 19:15       ` Florian Fainelli

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=61d19678-e90c-3b3a-099a-81200873edc8@gmail.com \
    --to=f.fainelli@gmail.com \
    --cc=alcooperx@gmail.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=ckeepax@opensource.cirrus.com \
    --cc=ckeepax@opensource.wolfsonmicro.com \
    --cc=devicetree@vger.kernel.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=robh+dt@kernel.org \
    --cc=swarren@nvidia.com \
    --cc=tony@atomide.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 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).