openbmc.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] hwmon: (pmbus) Add Vin unit off handling
@ 2022-03-17 23:21 Brandon Wyman
  2022-03-18  5:31 ` Guenter Roeck
  0 siblings, 1 reply; 3+ messages in thread
From: Brandon Wyman @ 2022-03-17 23:21 UTC (permalink / raw)
  To: Joel Stanley, openbmc, Eddie James, Guenter Roeck, Jean Delvare,
	linux-hwmon, linux-kernel
  Cc: Brandon Wyman

If there is an input undervoltage fault, reported in STATUS_INPUT
command response, there is quite likely a "Unit Off For Insufficient
Input Voltage" condition as well.

Add a constant for bit 3 of STATUS_INPUT. Update the Vin limit
attributes to include both bits in the mask for clearing faults.

If an input undervoltage fault occurs, causing a unit off for
insufficient input voltage, but the unit is off bit is not cleared, the
STATUS_WORD will not be updated to clear the input fault condition.
Including the unit is off bit (bit 3) allows for the input fault
condition to completely clear.

Signed-off-by: Brandon Wyman <bjwyman@gmail.com>
---
 drivers/hwmon/pmbus/pmbus.h      | 1 +
 drivers/hwmon/pmbus/pmbus_core.c | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/hwmon/pmbus/pmbus.h b/drivers/hwmon/pmbus/pmbus.h
index e0aa8aa46d8c..ef3a8ecde4df 100644
--- a/drivers/hwmon/pmbus/pmbus.h
+++ b/drivers/hwmon/pmbus/pmbus.h
@@ -319,6 +319,7 @@ enum pmbus_fan_mode { percent = 0, rpm };
 /*
  * STATUS_VOUT, STATUS_INPUT
  */
+#define PB_VOLTAGE_VIN_OFF		BIT(3)
 #define PB_VOLTAGE_UV_FAULT		BIT(4)
 #define PB_VOLTAGE_UV_WARNING		BIT(5)
 #define PB_VOLTAGE_OV_WARNING		BIT(6)
diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c
index ac2fbee1ba9c..a0d899dc81f0 100644
--- a/drivers/hwmon/pmbus/pmbus_core.c
+++ b/drivers/hwmon/pmbus/pmbus_core.c
@@ -1373,7 +1373,7 @@ static const struct pmbus_limit_attr vin_limit_attrs[] = {
 		.reg = PMBUS_VIN_UV_FAULT_LIMIT,
 		.attr = "lcrit",
 		.alarm = "lcrit_alarm",
-		.sbit = PB_VOLTAGE_UV_FAULT,
+		.sbit = (PB_VOLTAGE_UV_FAULT | PB_VOLTAGE_VIN_OFF),
 	}, {
 		.reg = PMBUS_VIN_OV_WARN_LIMIT,
 		.attr = "max",
-- 
2.25.1


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

* Re: [PATCH] hwmon: (pmbus) Add Vin unit off handling
  2022-03-17 23:21 [PATCH] hwmon: (pmbus) Add Vin unit off handling Brandon Wyman
@ 2022-03-18  5:31 ` Guenter Roeck
  2022-03-19  0:29   ` Brandon Wyman
  0 siblings, 1 reply; 3+ messages in thread
From: Guenter Roeck @ 2022-03-18  5:31 UTC (permalink / raw)
  To: Brandon Wyman
  Cc: linux-hwmon, Jean Delvare, openbmc, Eddie James, linux-kernel,
	Joel Stanley

On Thu, Mar 17, 2022 at 11:21:23PM +0000, Brandon Wyman wrote:
> If there is an input undervoltage fault, reported in STATUS_INPUT
> command response, there is quite likely a "Unit Off For Insufficient
> Input Voltage" condition as well.
> 
> Add a constant for bit 3 of STATUS_INPUT. Update the Vin limit
> attributes to include both bits in the mask for clearing faults.
> 
> If an input undervoltage fault occurs, causing a unit off for
> insufficient input voltage, but the unit is off bit is not cleared, the
> STATUS_WORD will not be updated to clear the input fault condition.
> Including the unit is off bit (bit 3) allows for the input fault
> condition to completely clear.
> 
> Signed-off-by: Brandon Wyman <bjwyman@gmail.com>

Applied.

Thanks,
Guenter

> ---
>  drivers/hwmon/pmbus/pmbus.h      | 1 +
>  drivers/hwmon/pmbus/pmbus_core.c | 2 +-
>  2 files changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/hwmon/pmbus/pmbus.h b/drivers/hwmon/pmbus/pmbus.h
> index e0aa8aa46d8c..ef3a8ecde4df 100644
> --- a/drivers/hwmon/pmbus/pmbus.h
> +++ b/drivers/hwmon/pmbus/pmbus.h
> @@ -319,6 +319,7 @@ enum pmbus_fan_mode { percent = 0, rpm };
>  /*
>   * STATUS_VOUT, STATUS_INPUT
>   */
> +#define PB_VOLTAGE_VIN_OFF		BIT(3)
>  #define PB_VOLTAGE_UV_FAULT		BIT(4)
>  #define PB_VOLTAGE_UV_WARNING		BIT(5)
>  #define PB_VOLTAGE_OV_WARNING		BIT(6)
> diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c
> index ac2fbee1ba9c..a0d899dc81f0 100644
> --- a/drivers/hwmon/pmbus/pmbus_core.c
> +++ b/drivers/hwmon/pmbus/pmbus_core.c
> @@ -1373,7 +1373,7 @@ static const struct pmbus_limit_attr vin_limit_attrs[] = {
>  		.reg = PMBUS_VIN_UV_FAULT_LIMIT,
>  		.attr = "lcrit",
>  		.alarm = "lcrit_alarm",
> -		.sbit = PB_VOLTAGE_UV_FAULT,
> +		.sbit = (PB_VOLTAGE_UV_FAULT | PB_VOLTAGE_VIN_OFF),
>  	}, {
>  		.reg = PMBUS_VIN_OV_WARN_LIMIT,
>  		.attr = "max",

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

* Re: [PATCH] hwmon: (pmbus) Add Vin unit off handling
  2022-03-18  5:31 ` Guenter Roeck
@ 2022-03-19  0:29   ` Brandon Wyman
  0 siblings, 0 replies; 3+ messages in thread
From: Brandon Wyman @ 2022-03-19  0:29 UTC (permalink / raw)
  To: Joel Stanley, openbmc; +Cc: Eddie James

Joel,

Can you merge this, and the dependent patch to the openbmc/linux kernel?

Dependent patch is in v5.17-rc6 or later kernels: 35f165f08950 (""hwmon: 
(pmbus) Clear pmbus fault/warning bits after read").

On 2022-03-18 00:31, Guenter Roeck wrote:

> On Thu, Mar 17, 2022 at 11:21:23PM +0000, Brandon Wyman wrote:
>> If there is an input undervoltage fault, reported in STATUS_INPUT
>> command response, there is quite likely a "Unit Off For Insufficient
>> Input Voltage" condition as well.
>>
>> Add a constant for bit 3 of STATUS_INPUT. Update the Vin limit
>> attributes to include both bits in the mask for clearing faults.
>>
>> If an input undervoltage fault occurs, causing a unit off for
>> insufficient input voltage, but the unit is off bit is not cleared, the
>> STATUS_WORD will not be updated to clear the input fault condition.
>> Including the unit is off bit (bit 3) allows for the input fault
>> condition to completely clear.
>>
>> Signed-off-by: Brandon Wyman <bjwyman@gmail.com>
> Applied.
>
> Thanks,
> Guenter
>
>> ---
>>   drivers/hwmon/pmbus/pmbus.h      | 1 +
>>   drivers/hwmon/pmbus/pmbus_core.c | 2 +-
>>   2 files changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/hwmon/pmbus/pmbus.h b/drivers/hwmon/pmbus/pmbus.h
>> index e0aa8aa46d8c..ef3a8ecde4df 100644
>> --- a/drivers/hwmon/pmbus/pmbus.h
>> +++ b/drivers/hwmon/pmbus/pmbus.h
>> @@ -319,6 +319,7 @@ enum pmbus_fan_mode { percent = 0, rpm };
>>   /*
>>    * STATUS_VOUT, STATUS_INPUT
>>    */
>> +#define PB_VOLTAGE_VIN_OFF		BIT(3)
>>   #define PB_VOLTAGE_UV_FAULT		BIT(4)
>>   #define PB_VOLTAGE_UV_WARNING		BIT(5)
>>   #define PB_VOLTAGE_OV_WARNING		BIT(6)
>> diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c
>> index ac2fbee1ba9c..a0d899dc81f0 100644
>> --- a/drivers/hwmon/pmbus/pmbus_core.c
>> +++ b/drivers/hwmon/pmbus/pmbus_core.c
>> @@ -1373,7 +1373,7 @@ static const struct pmbus_limit_attr vin_limit_attrs[] = {
>>   		.reg = PMBUS_VIN_UV_FAULT_LIMIT,
>>   		.attr = "lcrit",
>>   		.alarm = "lcrit_alarm",
>> -		.sbit = PB_VOLTAGE_UV_FAULT,
>> +		.sbit = (PB_VOLTAGE_UV_FAULT | PB_VOLTAGE_VIN_OFF),
>>   	}, {
>>   		.reg = PMBUS_VIN_OV_WARN_LIMIT,
>>   		.attr = "max",

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

end of thread, other threads:[~2022-03-19  0:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-17 23:21 [PATCH] hwmon: (pmbus) Add Vin unit off handling Brandon Wyman
2022-03-18  5:31 ` Guenter Roeck
2022-03-19  0:29   ` Brandon Wyman

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