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


Groups > linux.kernel > #1736307 > unrolled thread

[PATCH 2/2] pinctrl: single: Allow indicating loss of pin states during low-power

Started byFlorian Fainelli <f.fainelli@gmail.com>
First post2017-09-21 03:10 +0200
Last post2017-09-25 21:20 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 2/2] pinctrl: single: Allow indicating loss of pin states during low-power Florian Fainelli <f.fainelli@gmail.com> - 2017-09-21 03:10 +0200
    Re: [PATCH 2/2] pinctrl: single: Allow indicating loss of pin states  during low-power Linus Walleij <linus.walleij@linaro.org> - 2017-09-22 15:10 +0200
      Re: [PATCH 2/2] pinctrl: single: Allow indicating loss of pin states  during low-power Florian Fainelli <f.fainelli@gmail.com> - 2017-09-25 21:20 +0200

#1736307 — [PATCH 2/2] pinctrl: single: Allow indicating loss of pin states during low-power

FromFlorian Fainelli <f.fainelli@gmail.com>
Date2017-09-21 03:10 +0200
Subject[PATCH 2/2] pinctrl: single: Allow indicating loss of pin states during low-power
Message-ID<urYa6-2kx-15@gated-at.bofh.it>
Some platforms (e.g: Broadcom STB: BMIPS_GENERIC/ARCH_BRCMSTB) will lose
their register contents when entering their lower power state. In such a
case, the pinctrl-single driver that is used will not be able to restore
the power states without telling the core about it and having
pinctrl_select_state() check for that.

This patch adds a new optional boolean property that Device Tree can
define in order to obtain exactly that and having the core pinctrl code
take that into account.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 Documentation/devicetree/bindings/pinctrl/pinctrl-single.txt | 4 ++++
 drivers/pinctrl/pinctrl-single.c                             | 3 +++
 2 files changed, 7 insertions(+)

diff --git a/Documentation/devicetree/bindings/pinctrl/pinctrl-single.txt b/Documentation/devicetree/bindings/pinctrl/pinctrl-single.txt
index e705acd3612c..e71967f6a1a7 100644
--- a/Documentation/devicetree/bindings/pinctrl/pinctrl-single.txt
+++ b/Documentation/devicetree/bindings/pinctrl/pinctrl-single.txt
@@ -82,6 +82,10 @@ Optional properties:
 		/* pin base, nr pins & gpio function */
 		pinctrl-single,gpio-range = <&range 0 3 0 &range 3 9 1>;
 
+- pinctrl-single,low-power-state-loss : indicates that the pins lose their
+  state during low power modes and therefore need to be restored upon
+  system resumption.
+
 - interrupt-controller : standard interrupt controller binding if using
   interrupts for wake-up events for example. In this case pinctrl-single
   is set up as a chained interrupt controller and the wake-up interrupts
diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c
index b8b3d932cd73..d69d20b8247a 100644
--- a/drivers/pinctrl/pinctrl-single.c
+++ b/drivers/pinctrl/pinctrl-single.c
@@ -1749,6 +1749,9 @@ static int pcs_probe(struct platform_device *pdev)
 		goto free;
 	}
 
+	if (of_property_read_bool(np, "pinctrl-single,low-power-state-loss"))
+		pcs->pctl->flags |= PINCTRL_FLG_FORCE_STATE;
+
 	ret = pcs_add_gpio_func(np, pcs);
 	if (ret < 0)
 		goto free;
-- 
2.14.1

[toc] | [next] | [standalone]


#1737489 — Re: [PATCH 2/2] pinctrl: single: Allow indicating loss of pin states during low-power

FromLinus Walleij <linus.walleij@linaro.org>
Date2017-09-22 15:10 +0200
SubjectRe: [PATCH 2/2] pinctrl: single: Allow indicating loss of pin states during low-power
Message-ID<usvSq-6uj-17@gated-at.bofh.it>
In reply to#1736307
On Thu, Sep 21, 2017 at 3:04 AM, Florian Fainelli <f.fainelli@gmail.com> wrote:

> Some platforms (e.g: Broadcom STB: BMIPS_GENERIC/ARCH_BRCMSTB) will lose
> their register contents when entering their lower power state. In such a
> case, the pinctrl-single driver that is used will not be able to restore
> the power states without telling the core about it and having
> pinctrl_select_state() check for that.
>
> This patch adds a new optional boolean property that Device Tree can
> define in order to obtain exactly that and having the core pinctrl code
> take that into account.
>
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>

If we use this per-controller approach rather than the per-state approach
I discuss in reply to patch 1/2, we should probably make it a generic
property for pin controllers and not just a pinctrl-single business.

So patch pinctrl-bindings.txt and put the code somewhere in
core.

But that is more of a detail, first we need to figure out how to
handle this business in general.

Yours,
Linus Walleij

[toc] | [prev] | [next] | [standalone]


#1739229 — Re: [PATCH 2/2] pinctrl: single: Allow indicating loss of pin states during low-power

FromFlorian Fainelli <f.fainelli@gmail.com>
Date2017-09-25 21:20 +0200
SubjectRe: [PATCH 2/2] pinctrl: single: Allow indicating loss of pin states during low-power
Message-ID<utH58-2b5-1@gated-at.bofh.it>
In reply to#1737489
On 09/22/2017 06:03 AM, Linus Walleij wrote:
> On Thu, Sep 21, 2017 at 3:04 AM, Florian Fainelli <f.fainelli@gmail.com> wrote:
> 
>> Some platforms (e.g: Broadcom STB: BMIPS_GENERIC/ARCH_BRCMSTB) will lose
>> their register contents when entering their lower power state. In such a
>> case, the pinctrl-single driver that is used will not be able to restore
>> the power states without telling the core about it and having
>> pinctrl_select_state() check for that.
>>
>> This patch adds a new optional boolean property that Device Tree can
>> define in order to obtain exactly that and having the core pinctrl code
>> take that into account.
>>
>> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
> 
> If we use this per-controller approach rather than the per-state approach
> I discuss in reply to patch 1/2, we should probably make it a generic
> property for pin controllers and not just a pinctrl-single business.

I suppose it makes sense to make this a generic pinctrl property then.
drivers/pinctrl/core.c does not appear to be trying to fetch any
properties for a pinctrl device, but that is probably not too hard to add.

> 
> So patch pinctrl-bindings.txt and put the code somewhere in
> core.
> 
> But that is more of a detail, first we need to figure out how to
> handle this business in general.

Fair enough.
-- 
Florian

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web