Re: [PATCH 1/2] pinctrl: Allow a device to indicate when to force a state

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




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@xxxxxxxxx>
>> ---
>>  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
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux