mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Florian Fainelli <f.fainelli@gmail.com>
To: Charles Keepax <ckeepax@opensource.cirrus.com>,
	Florian Fainelli <f.fainelli@gmail.com>
Cc: linux-kernel@vger.kernel.org, linus.walleij@linaro.org,
	swarren@nvidia.com, andy.shevchenko@gmail.com,
	alcooperx@gmail.com, linux-gpio@vger.kernel.org,
	devicetree@vger.kernel.org, robh+dt@kernel.org,
	mark.rutland@arm.com, bcm-kernel-feedback-list@broadcom.com
Subject: Re: [PATCH 1/2] pinctrl: Allow a device to indicate when to force a state
Date: Fri, 22 Sep 2017 09:45:48 -0700	[thread overview]
Message-ID: <bbb3e112-c9ed-889b-713c-c4b5641d22d8@gmail.com> (raw)
In-Reply-To: <20170922124704.yfu46ak4rypai3vp@localhost.localdomain>

On 09/22/2017 05:47 AM, Charles Keepax wrote:
> On Wed, Sep 20, 2017 at 06:04:20PM -0700, Florian Fainelli wrote:
>> It may happen that a device needs to force applying a state, e.g:
>> because it only defines one state of pin states (default) but loses
>> power/register contents when entering low power modes. Add a
>> pinctrl_dev::flags bitmask to help describe future quirks and define
>> PINCTRL_FLG_FORCE_STATE as such a settable flag.
>>
>> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
>> ---
>>  drivers/pinctrl/core.c | 15 +++++++++++++++
>>  drivers/pinctrl/core.h |  4 ++++
>>  2 files changed, 19 insertions(+)
>>
>> diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
>> index 56fbe4c3e800..c450a97de88f 100644
>> --- a/drivers/pinctrl/core.c
>> +++ b/drivers/pinctrl/core.c
>> @@ -1197,11 +1197,26 @@ int pinctrl_select_state(struct pinctrl *p, struct pinctrl_state *state)
>>  {
>>  	struct pinctrl_setting *setting, *setting2;
>>  	struct pinctrl_state *old_state = p->state;
>> +	bool force = false;
>>  	int ret;
>>  
>>  	if (p->state == state)
>>  		return 0;
> 
> I am guessing you probably intended to remove these two lines.

Argh right, I cherry-picked what I done on an earlier kernel version and
this resolved to this, thanks for noticing!

> 
>>  
>> +	if (p->state) {
>> +		list_for_each_entry(setting, &p->state->settings, node) {
>> +			if (setting->pctldev->flags & PINCTRL_FLG_FORCE_STATE)
>> +				force = true;
>> +		}
>> +	}
>> +
>> +	/* Some controllers may want to force this operation when they define
>> +	 * only one set of functions and lose power state, e.g: pinctrl-single
>> +	 * with its pinctrl-single,low-power-state-loss property.
>> +	 */
>> +	if (p->state == state && !force)
>> +		return 0;
>> +
> 
> Thanks,
> Charles
> 


-- 
Florian

  reply	other threads:[~2017-09-22 16:45 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
2017-09-22 16:57       ` Florian Fainelli
2017-09-26 14:16         ` Charles Keepax
2017-09-26 17:51           ` Florian Fainelli
2017-09-27  8:26             ` Charles Keepax
2017-09-22 12:47   ` Charles Keepax
2017-09-22 16:45     ` Florian Fainelli [this message]
2017-09-21  1:04 ` [PATCH 2/2] pinctrl: single: Allow indicating loss of pin states during low-power Florian Fainelli
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=bbb3e112-c9ed-889b-713c-c4b5641d22d8@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=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 \
    /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

Powered by JetHome