linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mfd: palmas: Assign the right powerhold mask for tps65917
@ 2017-10-24  8:21 Keerthy
  2017-10-31 10:48 ` Lee Jones
  2017-11-29 11:05 ` Lee Jones
  0 siblings, 2 replies; 5+ messages in thread
From: Keerthy @ 2017-10-24  8:21 UTC (permalink / raw)
  To: lee.jones; +Cc: tony, linux-omap, linux-kernel, t-kristo, j-keerthy

The powerhold mask for TPS65917 is different when comapred to
the other palmas versions. Hence assign the right mask that enables
power off of tps65917 pmic correctly.

Signed-off-by: Keerthy <j-keerthy@ti.com>
---
 drivers/mfd/palmas.c       | 10 +++++++++-
 include/linux/mfd/palmas.h |  3 +++
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/mfd/palmas.c b/drivers/mfd/palmas.c
index 3922a93..663a239 100644
--- a/drivers/mfd/palmas.c
+++ b/drivers/mfd/palmas.c
@@ -430,6 +430,7 @@ static void palmas_power_off(void)
 {
 	unsigned int addr;
 	int ret, slave;
+	u8 powerhold_mask;
 	struct device_node *np = palmas_dev->dev->of_node;
 
 	if (of_property_read_bool(np, "ti,palmas-override-powerhold")) {
@@ -437,8 +438,15 @@ static void palmas_power_off(void)
 					  PALMAS_PRIMARY_SECONDARY_PAD2);
 		slave = PALMAS_BASE_TO_SLAVE(PALMAS_PU_PD_OD_BASE);
 
+		if (of_device_is_compatible(np, "ti,tps65917"))
+			powerhold_mask =
+				TPS65917_PRIMARY_SECONDARY_PAD2_GPIO_5_MASK;
+		else
+			powerhold_mask =
+				PALMAS_PRIMARY_SECONDARY_PAD2_GPIO_7_MASK;
+
 		ret = regmap_update_bits(palmas_dev->regmap[slave], addr,
-				PALMAS_PRIMARY_SECONDARY_PAD2_GPIO_7_MASK, 0);
+					 powerhold_mask, 0);
 		if (ret)
 			dev_err(palmas_dev->dev,
 				"Unable to write PRIMARY_SECONDARY_PAD2 %d\n",
diff --git a/include/linux/mfd/palmas.h b/include/linux/mfd/palmas.h
index 6dec438..cffb23b 100644
--- a/include/linux/mfd/palmas.h
+++ b/include/linux/mfd/palmas.h
@@ -3733,6 +3733,9 @@ enum usb_irq_events {
 #define TPS65917_REGEN3_CTRL_MODE_ACTIVE			0x01
 #define TPS65917_REGEN3_CTRL_MODE_ACTIVE_SHIFT			0x00
 
+/* POWERHOLD Mask field for PRIMARY_SECONDARY_PAD2 register */
+#define TPS65917_PRIMARY_SECONDARY_PAD2_GPIO_5_MASK		0xC
+
 /* Registers for function RESOURCE */
 #define TPS65917_REGEN1_CTRL					0x2
 #define TPS65917_PLLEN_CTRL					0x3
-- 
1.9.1

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

* Re: [PATCH] mfd: palmas: Assign the right powerhold mask for tps65917
  2017-10-24  8:21 [PATCH] mfd: palmas: Assign the right powerhold mask for tps65917 Keerthy
@ 2017-10-31 10:48 ` Lee Jones
  2017-11-06  9:52   ` Keerthy
  2017-11-29 11:05 ` Lee Jones
  1 sibling, 1 reply; 5+ messages in thread
From: Lee Jones @ 2017-10-31 10:48 UTC (permalink / raw)
  To: Keerthy; +Cc: tony, linux-omap, linux-kernel, t-kristo

On Tue, 24 Oct 2017, Keerthy wrote:

> The powerhold mask for TPS65917 is different when comapred to
> the other palmas versions. Hence assign the right mask that enables
> power off of tps65917 pmic correctly.
> 
> Signed-off-by: Keerthy <j-keerthy@ti.com>
> ---
>  drivers/mfd/palmas.c       | 10 +++++++++-
>  include/linux/mfd/palmas.h |  3 +++
>  2 files changed, 12 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/mfd/palmas.c b/drivers/mfd/palmas.c
> index 3922a93..663a239 100644
> --- a/drivers/mfd/palmas.c
> +++ b/drivers/mfd/palmas.c
> @@ -430,6 +430,7 @@ static void palmas_power_off(void)
>  {
>  	unsigned int addr;
>  	int ret, slave;
> +	u8 powerhold_mask;
>  	struct device_node *np = palmas_dev->dev->of_node;
>  
>  	if (of_property_read_bool(np, "ti,palmas-override-powerhold")) {
> @@ -437,8 +438,15 @@ static void palmas_power_off(void)
>  					  PALMAS_PRIMARY_SECONDARY_PAD2);
>  		slave = PALMAS_BASE_TO_SLAVE(PALMAS_PU_PD_OD_BASE);
>  
> +		if (of_device_is_compatible(np, "ti,tps65917"))

Is it possible to interrogate the device itself, rather than DT?

> +			powerhold_mask =
> +				TPS65917_PRIMARY_SECONDARY_PAD2_GPIO_5_MASK;
> +		else
> +			powerhold_mask =
> +				PALMAS_PRIMARY_SECONDARY_PAD2_GPIO_7_MASK;
> +
>  		ret = regmap_update_bits(palmas_dev->regmap[slave], addr,
> -				PALMAS_PRIMARY_SECONDARY_PAD2_GPIO_7_MASK, 0);
> +					 powerhold_mask, 0);
>  		if (ret)
>  			dev_err(palmas_dev->dev,
>  				"Unable to write PRIMARY_SECONDARY_PAD2 %d\n",
> diff --git a/include/linux/mfd/palmas.h b/include/linux/mfd/palmas.h
> index 6dec438..cffb23b 100644
> --- a/include/linux/mfd/palmas.h
> +++ b/include/linux/mfd/palmas.h
> @@ -3733,6 +3733,9 @@ enum usb_irq_events {
>  #define TPS65917_REGEN3_CTRL_MODE_ACTIVE			0x01
>  #define TPS65917_REGEN3_CTRL_MODE_ACTIVE_SHIFT			0x00
>  
> +/* POWERHOLD Mask field for PRIMARY_SECONDARY_PAD2 register */
> +#define TPS65917_PRIMARY_SECONDARY_PAD2_GPIO_5_MASK		0xC
> +
>  /* Registers for function RESOURCE */
>  #define TPS65917_REGEN1_CTRL					0x2
>  #define TPS65917_PLLEN_CTRL					0x3

-- 
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] mfd: palmas: Assign the right powerhold mask for tps65917
  2017-10-31 10:48 ` Lee Jones
@ 2017-11-06  9:52   ` Keerthy
  2017-11-06 12:28     ` Keerthy
  0 siblings, 1 reply; 5+ messages in thread
From: Keerthy @ 2017-11-06  9:52 UTC (permalink / raw)
  To: Lee Jones; +Cc: tony, linux-omap, linux-kernel, t-kristo



On Tuesday 31 October 2017 04:18 PM, Lee Jones wrote:
> On Tue, 24 Oct 2017, Keerthy wrote:
> 
>> The powerhold mask for TPS65917 is different when comapred to
>> the other palmas versions. Hence assign the right mask that enables
>> power off of tps65917 pmic correctly.
>>
>> Signed-off-by: Keerthy <j-keerthy@ti.com>
>> ---
>>  drivers/mfd/palmas.c       | 10 +++++++++-
>>  include/linux/mfd/palmas.h |  3 +++
>>  2 files changed, 12 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/mfd/palmas.c b/drivers/mfd/palmas.c
>> index 3922a93..663a239 100644
>> --- a/drivers/mfd/palmas.c
>> +++ b/drivers/mfd/palmas.c
>> @@ -430,6 +430,7 @@ static void palmas_power_off(void)
>>  {
>>  	unsigned int addr;
>>  	int ret, slave;
>> +	u8 powerhold_mask;
>>  	struct device_node *np = palmas_dev->dev->of_node;
>>  
>>  	if (of_property_read_bool(np, "ti,palmas-override-powerhold")) {
>> @@ -437,8 +438,15 @@ static void palmas_power_off(void)
>>  					  PALMAS_PRIMARY_SECONDARY_PAD2);
>>  		slave = PALMAS_BASE_TO_SLAVE(PALMAS_PU_PD_OD_BASE);
>>  
>> +		if (of_device_is_compatible(np, "ti,tps65917"))
> 
> Is it possible to interrogate the device itself, rather than DT?

You mean using driver data tagged with compatibles?

> 
>> +			powerhold_mask =
>> +				TPS65917_PRIMARY_SECONDARY_PAD2_GPIO_5_MASK;
>> +		else
>> +			powerhold_mask =
>> +				PALMAS_PRIMARY_SECONDARY_PAD2_GPIO_7_MASK;
>> +
>>  		ret = regmap_update_bits(palmas_dev->regmap[slave], addr,
>> -				PALMAS_PRIMARY_SECONDARY_PAD2_GPIO_7_MASK, 0);
>> +					 powerhold_mask, 0);
>>  		if (ret)
>>  			dev_err(palmas_dev->dev,
>>  				"Unable to write PRIMARY_SECONDARY_PAD2 %d\n",
>> diff --git a/include/linux/mfd/palmas.h b/include/linux/mfd/palmas.h
>> index 6dec438..cffb23b 100644
>> --- a/include/linux/mfd/palmas.h
>> +++ b/include/linux/mfd/palmas.h
>> @@ -3733,6 +3733,9 @@ enum usb_irq_events {
>>  #define TPS65917_REGEN3_CTRL_MODE_ACTIVE			0x01
>>  #define TPS65917_REGEN3_CTRL_MODE_ACTIVE_SHIFT			0x00
>>  
>> +/* POWERHOLD Mask field for PRIMARY_SECONDARY_PAD2 register */
>> +#define TPS65917_PRIMARY_SECONDARY_PAD2_GPIO_5_MASK		0xC
>> +
>>  /* Registers for function RESOURCE */
>>  #define TPS65917_REGEN1_CTRL					0x2
>>  #define TPS65917_PLLEN_CTRL					0x3
> 

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

* Re: [PATCH] mfd: palmas: Assign the right powerhold mask for tps65917
  2017-11-06  9:52   ` Keerthy
@ 2017-11-06 12:28     ` Keerthy
  0 siblings, 0 replies; 5+ messages in thread
From: Keerthy @ 2017-11-06 12:28 UTC (permalink / raw)
  To: Lee Jones; +Cc: tony, linux-omap, linux-kernel, t-kristo



On Monday 06 November 2017 03:22 PM, Keerthy wrote:
> 
> 
> On Tuesday 31 October 2017 04:18 PM, Lee Jones wrote:
>> On Tue, 24 Oct 2017, Keerthy wrote:
>>
>>> The powerhold mask for TPS65917 is different when comapred to
>>> the other palmas versions. Hence assign the right mask that enables
>>> power off of tps65917 pmic correctly.
>>>
>>> Signed-off-by: Keerthy <j-keerthy@ti.com>
>>> ---
>>>  drivers/mfd/palmas.c       | 10 +++++++++-
>>>  include/linux/mfd/palmas.h |  3 +++
>>>  2 files changed, 12 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/mfd/palmas.c b/drivers/mfd/palmas.c
>>> index 3922a93..663a239 100644
>>> --- a/drivers/mfd/palmas.c
>>> +++ b/drivers/mfd/palmas.c
>>> @@ -430,6 +430,7 @@ static void palmas_power_off(void)
>>>  {
>>>  	unsigned int addr;
>>>  	int ret, slave;
>>> +	u8 powerhold_mask;
>>>  	struct device_node *np = palmas_dev->dev->of_node;
>>>  
>>>  	if (of_property_read_bool(np, "ti,palmas-override-powerhold")) {
>>> @@ -437,8 +438,15 @@ static void palmas_power_off(void)
>>>  					  PALMAS_PRIMARY_SECONDARY_PAD2);
>>>  		slave = PALMAS_BASE_TO_SLAVE(PALMAS_PU_PD_OD_BASE);
>>>  
>>> +		if (of_device_is_compatible(np, "ti,tps65917"))
>>
>> Is it possible to interrogate the device itself, rather than DT?
> 
> You mean using driver data tagged with compatibles?

I guess you meant interrogating by i2c register red like revision
register, i am afraid no such register to distinguish hence went by the
compatible.

Regards,
Keerthy
> 
>>
>>> +			powerhold_mask =
>>> +				TPS65917_PRIMARY_SECONDARY_PAD2_GPIO_5_MASK;
>>> +		else
>>> +			powerhold_mask =
>>> +				PALMAS_PRIMARY_SECONDARY_PAD2_GPIO_7_MASK;
>>> +
>>>  		ret = regmap_update_bits(palmas_dev->regmap[slave], addr,
>>> -				PALMAS_PRIMARY_SECONDARY_PAD2_GPIO_7_MASK, 0);
>>> +					 powerhold_mask, 0);
>>>  		if (ret)
>>>  			dev_err(palmas_dev->dev,
>>>  				"Unable to write PRIMARY_SECONDARY_PAD2 %d\n",
>>> diff --git a/include/linux/mfd/palmas.h b/include/linux/mfd/palmas.h
>>> index 6dec438..cffb23b 100644
>>> --- a/include/linux/mfd/palmas.h
>>> +++ b/include/linux/mfd/palmas.h
>>> @@ -3733,6 +3733,9 @@ enum usb_irq_events {
>>>  #define TPS65917_REGEN3_CTRL_MODE_ACTIVE			0x01
>>>  #define TPS65917_REGEN3_CTRL_MODE_ACTIVE_SHIFT			0x00
>>>  
>>> +/* POWERHOLD Mask field for PRIMARY_SECONDARY_PAD2 register */
>>> +#define TPS65917_PRIMARY_SECONDARY_PAD2_GPIO_5_MASK		0xC
>>> +
>>>  /* Registers for function RESOURCE */
>>>  #define TPS65917_REGEN1_CTRL					0x2
>>>  #define TPS65917_PLLEN_CTRL					0x3
>>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

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

* Re: [PATCH] mfd: palmas: Assign the right powerhold mask for tps65917
  2017-10-24  8:21 [PATCH] mfd: palmas: Assign the right powerhold mask for tps65917 Keerthy
  2017-10-31 10:48 ` Lee Jones
@ 2017-11-29 11:05 ` Lee Jones
  1 sibling, 0 replies; 5+ messages in thread
From: Lee Jones @ 2017-11-29 11:05 UTC (permalink / raw)
  To: Keerthy; +Cc: tony, linux-omap, linux-kernel, t-kristo

On Tue, 24 Oct 2017, Keerthy wrote:

> The powerhold mask for TPS65917 is different when comapred to
> the other palmas versions. Hence assign the right mask that enables
> power off of tps65917 pmic correctly.
> 
> Signed-off-by: Keerthy <j-keerthy@ti.com>
> ---
>  drivers/mfd/palmas.c       | 10 +++++++++-
>  include/linux/mfd/palmas.h |  3 +++
>  2 files changed, 12 insertions(+), 1 deletion(-)

Applied, thanks.

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

end of thread, other threads:[~2017-11-29 11:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-24  8:21 [PATCH] mfd: palmas: Assign the right powerhold mask for tps65917 Keerthy
2017-10-31 10:48 ` Lee Jones
2017-11-06  9:52   ` Keerthy
2017-11-06 12:28     ` Keerthy
2017-11-29 11:05 ` Lee Jones

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