linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 4/4] arm: dts: am57xx-idk-common: Add overide powerhold property
       [not found] ` <1477559414-12520-1-git-send-email-j-keerthy-l0cyMroinI0@public.gmane.org>
@ 2016-10-27  9:10   ` Keerthy
  0 siblings, 0 replies; 5+ messages in thread
From: Keerthy @ 2016-10-27  9:10 UTC (permalink / raw)
  To: tony-4v6yS6AI5VpBDgjK7y7TUQ, lee.jones-QSEj5FYQhm4dnm+yROfE0A,
	robh+dt-DgEjT+Ai2ygdnm+yROfE0A
  Cc: linux-omap-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-gpio-u79uwXL29TY76Z2rM5mHXA, nm-l0cyMroinI0,
	j-keerthy-l0cyMroinI0, t-kristo-l0cyMroinI0

The PMICs have POWERHOLD set by default which prevents PMIC shutdown
even on DEV_CTRL On bit set to 0 as the Powerhold has higher priority.
So to enable pmic power off this property lets one over ride the default
value and enable pmic power off.

Signed-off-by: Keerthy <j-keerthy-l0cyMroinI0@public.gmane.org>
---
 arch/arm/boot/dts/am57xx-idk-common.dtsi | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/boot/dts/am57xx-idk-common.dtsi b/arch/arm/boot/dts/am57xx-idk-common.dtsi
index 6d537cf..18297f3 100644
--- a/arch/arm/boot/dts/am57xx-idk-common.dtsi
+++ b/arch/arm/boot/dts/am57xx-idk-common.dtsi
@@ -200,6 +200,7 @@
 		#interrupt-cells = <2>;
 		interrupt-controller;
 		ti,system-power-controller;
+		ti,palmas-override-powerhold;
 
 		tps659038_pmic {
 			compatible = "ti,tps659038-pmic";
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 1/4] Documentation: pinctrl: palmas: Add ti,palmas-powerhold-override property definition
       [not found] ` <1477559414-12520-2-git-send-email-j-keerthy@ti.com>
@ 2016-11-09 16:10   ` Lee Jones
  2016-11-10  4:11     ` Keerthy
  0 siblings, 1 reply; 5+ messages in thread
From: Lee Jones @ 2016-11-09 16:10 UTC (permalink / raw)
  To: Keerthy
  Cc: tony, robh+dt, linux-omap, linux-kernel, devicetree, linux-gpio,
	nm, t-kristo

On Thu, 27 Oct 2016, Keerthy wrote:

> GPIO7 is configured in POWERHOLD mode which has higher priority
> over DEV_ON bit and keeps the PMIC supplies on even after the DEV_ON
> bit is turned off. This property enables driver to over ride the
> POWERHOLD value to GPIO7 so as to turn off the PMIC in power off
> scenarios.
> 
> Signed-off-by: Keerthy <j-keerthy@ti.com>
> ---
>  Documentation/devicetree/bindings/pinctrl/pinctrl-palmas.txt | 9 +++++++++
>  1 file changed, 9 insertions(+)

This requires a DT Ack.

> diff --git a/Documentation/devicetree/bindings/pinctrl/pinctrl-palmas.txt b/Documentation/devicetree/bindings/pinctrl/pinctrl-palmas.txt
> index caf297b..c28d4eb8 100644
> --- a/Documentation/devicetree/bindings/pinctrl/pinctrl-palmas.txt
> +++ b/Documentation/devicetree/bindings/pinctrl/pinctrl-palmas.txt
> @@ -35,6 +35,15 @@ Optional properties:
>  - ti,palmas-enable-dvfs2: Enable DVFS2. Configure pins for DVFS2 mode.
>  	Selection primary or secondary function associated to GPADC_START
>  	and SYSEN2 pin/pad for DVFS2 interface
> +- ti,palmas-override-powerhold: This is applicable for PMICs for which
> +	GPIO7 is configured in POWERHOLD mode which has higher priority
> +	over DEV_ON bit and keeps the PMIC supplies on even after the DEV_ON
> +	bit is turned off. This property enables driver to over ride the
> +	POWERHOLD value to GPIO7 so as to turn off the PMIC in power off
> +	scenarios. So for GPIO7 if ti,palmas-override-powerhold is set
> +	then the GPIO_7 field should never be muxed to anything else.
> +	It should be set to POWERHOLD by default and only in case of
> +	power off scenarios the driver will over ride the mux value.
>  
>  This binding uses the following generic properties as defined in
>  pinctrl-bindings.txt:

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH 2/4] mfd: palmas: Reset the POWERHOLD mux during power off
       [not found]   ` <1477559414-12520-3-git-send-email-j-keerthy-l0cyMroinI0@public.gmane.org>
@ 2016-11-09 16:14     ` Lee Jones
  2016-11-10  4:18       ` Keerthy
  0 siblings, 1 reply; 5+ messages in thread
From: Lee Jones @ 2016-11-09 16:14 UTC (permalink / raw)
  To: Keerthy
  Cc: tony-4v6yS6AI5VpBDgjK7y7TUQ, robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
	linux-omap-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-gpio-u79uwXL29TY76Z2rM5mHXA, nm-l0cyMroinI0,
	t-kristo-l0cyMroinI0

On Thu, 27 Oct 2016, Keerthy wrote:

> POWERHOLD signal has higher priority  over the DEV_ON bit.
> So power off will not happen if the POWERHOLD is held high.
> Hence reset the MUX to GPIO_7 mode to release the POWERHOLD
> and the DEV_ON bit to take effect to power off the PMIC.
> 
> PMIC Power off happens in dire situations like thermal shutdown
> so irrespective of the POWERHOLD setting go ahead and turn off
> the powerhold.  Currently poweroff is broken on boards that have
> powerhold enabled. This fixes poweroff on those boards.
> 
> Signed-off-by: Keerthy <j-keerthy-l0cyMroinI0@public.gmane.org>
> ---
>  drivers/mfd/palmas.c | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
> 
> diff --git a/drivers/mfd/palmas.c b/drivers/mfd/palmas.c
> index 8f8bacb..8fbc5e0 100644
> --- a/drivers/mfd/palmas.c
> +++ b/drivers/mfd/palmas.c
> @@ -430,10 +430,28 @@ static void palmas_power_off(void)
>  {
>  	unsigned int addr;
>  	int ret, slave;
> +	struct device_node *node;
> +	bool override_powerhold;
>  
>  	if (!palmas_dev)

Can this happen?

>  		return;
>  
> +	node = palmas_dev->dev->of_node;

Just do:

struct device_node *np = palmas_dev->dev->of_node;

> +	override_powerhold = of_property_read_bool(node,
> +					"ti,palmas-override-powerhold");

Break the line after the '=' instead.

> +	if (override_powerhold) {

if (of_property_read_bool(node,	"ti,palmas-override-powerhold"))

Then remove 'override_powerhold'.

> +		addr = PALMAS_BASE_TO_REG(PALMAS_PU_PD_OD_BASE,
> +					  PALMAS_PRIMARY_SECONDARY_PAD2);
> +		slave = PALMAS_BASE_TO_SLAVE(PALMAS_PU_PD_OD_BASE);
> +
> +		ret = regmap_update_bits(palmas_dev->regmap[slave], addr,
> +					 PALMAS_PRIMARY_SECONDARY_PAD2_GPIO_7_MASK, 0);
> +		if (ret)
> +			pr_err("%s: Unable to write PALMAS_PRIMARY_SECONDARY_PAD2 %d\n",
> +			       __func__, ret);

Don't use __func__ in live code.

And use dev_err();


> +	}
> +
>  	slave = PALMAS_BASE_TO_SLAVE(PALMAS_PMU_CONTROL_BASE);
>  	addr = PALMAS_BASE_TO_REG(PALMAS_PMU_CONTROL_BASE, PALMAS_DEV_CTRL);
>  

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 1/4] Documentation: pinctrl: palmas: Add ti,palmas-powerhold-override property definition
  2016-11-09 16:10   ` [PATCH 1/4] Documentation: pinctrl: palmas: Add ti,palmas-powerhold-override property definition Lee Jones
@ 2016-11-10  4:11     ` Keerthy
  0 siblings, 0 replies; 5+ messages in thread
From: Keerthy @ 2016-11-10  4:11 UTC (permalink / raw)
  To: Lee Jones
  Cc: tony, robh+dt, linux-omap, linux-kernel, devicetree, linux-gpio,
	nm, t-kristo



On Wednesday 09 November 2016 09:40 PM, Lee Jones wrote:
> On Thu, 27 Oct 2016, Keerthy wrote:
>
>> GPIO7 is configured in POWERHOLD mode which has higher priority
>> over DEV_ON bit and keeps the PMIC supplies on even after the DEV_ON
>> bit is turned off. This property enables driver to over ride the
>> POWERHOLD value to GPIO7 so as to turn off the PMIC in power off
>> scenarios.
>>
>> Signed-off-by: Keerthy <j-keerthy@ti.com>
>> ---
>>  Documentation/devicetree/bindings/pinctrl/pinctrl-palmas.txt | 9 +++++++++
>>  1 file changed, 9 insertions(+)
>
> This requires a DT Ack.

Okay.

>
>> diff --git a/Documentation/devicetree/bindings/pinctrl/pinctrl-palmas.txt b/Documentation/devicetree/bindings/pinctrl/pinctrl-palmas.txt
>> index caf297b..c28d4eb8 100644
>> --- a/Documentation/devicetree/bindings/pinctrl/pinctrl-palmas.txt
>> +++ b/Documentation/devicetree/bindings/pinctrl/pinctrl-palmas.txt
>> @@ -35,6 +35,15 @@ Optional properties:
>>  - ti,palmas-enable-dvfs2: Enable DVFS2. Configure pins for DVFS2 mode.
>>  	Selection primary or secondary function associated to GPADC_START
>>  	and SYSEN2 pin/pad for DVFS2 interface
>> +- ti,palmas-override-powerhold: This is applicable for PMICs for which
>> +	GPIO7 is configured in POWERHOLD mode which has higher priority
>> +	over DEV_ON bit and keeps the PMIC supplies on even after the DEV_ON
>> +	bit is turned off. This property enables driver to over ride the
>> +	POWERHOLD value to GPIO7 so as to turn off the PMIC in power off
>> +	scenarios. So for GPIO7 if ti,palmas-override-powerhold is set
>> +	then the GPIO_7 field should never be muxed to anything else.
>> +	It should be set to POWERHOLD by default and only in case of
>> +	power off scenarios the driver will over ride the mux value.
>>
>>  This binding uses the following generic properties as defined in
>>  pinctrl-bindings.txt:
>

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

* Re: [PATCH 2/4] mfd: palmas: Reset the POWERHOLD mux during power off
  2016-11-09 16:14     ` [PATCH 2/4] mfd: palmas: Reset the POWERHOLD mux during power off Lee Jones
@ 2016-11-10  4:18       ` Keerthy
  0 siblings, 0 replies; 5+ messages in thread
From: Keerthy @ 2016-11-10  4:18 UTC (permalink / raw)
  To: Lee Jones
  Cc: tony-4v6yS6AI5VpBDgjK7y7TUQ, robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
	linux-omap-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-gpio-u79uwXL29TY76Z2rM5mHXA, nm-l0cyMroinI0,
	t-kristo-l0cyMroinI0



On Wednesday 09 November 2016 09:44 PM, Lee Jones wrote:
> On Thu, 27 Oct 2016, Keerthy wrote:
>
>> POWERHOLD signal has higher priority  over the DEV_ON bit.
>> So power off will not happen if the POWERHOLD is held high.
>> Hence reset the MUX to GPIO_7 mode to release the POWERHOLD
>> and the DEV_ON bit to take effect to power off the PMIC.
>>
>> PMIC Power off happens in dire situations like thermal shutdown
>> so irrespective of the POWERHOLD setting go ahead and turn off
>> the powerhold.  Currently poweroff is broken on boards that have
>> powerhold enabled. This fixes poweroff on those boards.
>>
>> Signed-off-by: Keerthy <j-keerthy-l0cyMroinI0@public.gmane.org>
>> ---
>>  drivers/mfd/palmas.c | 18 ++++++++++++++++++
>>  1 file changed, 18 insertions(+)
>>
>> diff --git a/drivers/mfd/palmas.c b/drivers/mfd/palmas.c
>> index 8f8bacb..8fbc5e0 100644
>> --- a/drivers/mfd/palmas.c
>> +++ b/drivers/mfd/palmas.c
>> @@ -430,10 +430,28 @@ static void palmas_power_off(void)
>>  {
>>  	unsigned int addr;
>>  	int ret, slave;
>> +	struct device_node *node;
>> +	bool override_powerhold;
>>
>>  	if (!palmas_dev)
>
> Can this happen?

pm_power_off and palmas_dev are always assigned together. You are right 
this is redundant and can be removed.

>
>>  		return;
>>
>> +	node = palmas_dev->dev->of_node;
>
> Just do:
>
> struct device_node *np = palmas_dev->dev->of_node;
>
>> +	override_powerhold = of_property_read_bool(node,
>> +					"ti,palmas-override-powerhold");
>
> Break the line after the '=' instead.

okay.

>
>> +	if (override_powerhold) {
>
> if (of_property_read_bool(node,	"ti,palmas-override-powerhold"))
>
> Then remove 'override_powerhold'.

Okay.

>
>> +		addr = PALMAS_BASE_TO_REG(PALMAS_PU_PD_OD_BASE,
>> +					  PALMAS_PRIMARY_SECONDARY_PAD2);
>> +		slave = PALMAS_BASE_TO_SLAVE(PALMAS_PU_PD_OD_BASE);
>> +
>> +		ret = regmap_update_bits(palmas_dev->regmap[slave], addr,
>> +					 PALMAS_PRIMARY_SECONDARY_PAD2_GPIO_7_MASK, 0);
>> +		if (ret)
>> +			pr_err("%s: Unable to write PALMAS_PRIMARY_SECONDARY_PAD2 %d\n",
>> +			       __func__, ret);
>
> Don't use __func__ in live code.

okay.

>
> And use dev_err();

sure.

>
>
>> +	}
>> +
>>  	slave = PALMAS_BASE_TO_SLAVE(PALMAS_PMU_CONTROL_BASE);
>>  	addr = PALMAS_BASE_TO_REG(PALMAS_PMU_CONTROL_BASE, PALMAS_DEV_CTRL);
>>
>
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2016-11-10  4:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1477559414-12520-1-git-send-email-j-keerthy@ti.com>
     [not found] ` <1477559414-12520-1-git-send-email-j-keerthy-l0cyMroinI0@public.gmane.org>
2016-10-27  9:10   ` [PATCH 4/4] arm: dts: am57xx-idk-common: Add overide powerhold property Keerthy
     [not found] ` <1477559414-12520-2-git-send-email-j-keerthy@ti.com>
2016-11-09 16:10   ` [PATCH 1/4] Documentation: pinctrl: palmas: Add ti,palmas-powerhold-override property definition Lee Jones
2016-11-10  4:11     ` Keerthy
     [not found] ` <1477559414-12520-3-git-send-email-j-keerthy@ti.com>
     [not found]   ` <1477559414-12520-3-git-send-email-j-keerthy-l0cyMroinI0@public.gmane.org>
2016-11-09 16:14     ` [PATCH 2/4] mfd: palmas: Reset the POWERHOLD mux during power off Lee Jones
2016-11-10  4:18       ` Keerthy

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).