All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] hwmon: (occ) Fix P10 VRM temp sensors
@ 2021-09-29 15:36 Eddie James
  2021-10-02 11:36 ` Guenter Roeck
  0 siblings, 1 reply; 2+ messages in thread
From: Eddie James @ 2021-09-29 15:36 UTC (permalink / raw)
  To: linux; +Cc: jdelvare, linux-hwmon, linux-kernel, Eddie James

The P10 (temp sensor version 0x10) doesn't do the same VRM status
reporting that was used on P9. It just reports the temperature, so
drop the check for VRM fru type in the sysfs show function, and don't
set the name to "alarm".

Fixes: db4919ec86 ("hwmon: (occ) Add new temperature sensor type")
Signed-off-by: Eddie James <eajames@linux.ibm.com>
---
 drivers/hwmon/occ/common.c | 17 +++++------------
 1 file changed, 5 insertions(+), 12 deletions(-)

diff --git a/drivers/hwmon/occ/common.c b/drivers/hwmon/occ/common.c
index 0d68a78be980..ae664613289c 100644
--- a/drivers/hwmon/occ/common.c
+++ b/drivers/hwmon/occ/common.c
@@ -340,18 +340,11 @@ static ssize_t occ_show_temp_10(struct device *dev,
 		if (val == OCC_TEMP_SENSOR_FAULT)
 			return -EREMOTEIO;
 
-		/*
-		 * VRM doesn't return temperature, only alarm bit. This
-		 * attribute maps to tempX_alarm instead of tempX_input for
-		 * VRM
-		 */
-		if (temp->fru_type != OCC_FRU_TYPE_VRM) {
-			/* sensor not ready */
-			if (val == 0)
-				return -EAGAIN;
+		/* sensor not ready */
+		if (val == 0)
+			return -EAGAIN;
 
-			val *= 1000;
-		}
+		val *= 1000;
 		break;
 	case 2:
 		val = temp->fru_type;
@@ -886,7 +879,7 @@ static int occ_setup_sensor_attrs(struct occ *occ)
 					     0, i);
 		attr++;
 
-		if (sensors->temp.version > 1 &&
+		if (sensors->temp.version == 2 &&
 		    temp->fru_type == OCC_FRU_TYPE_VRM) {
 			snprintf(attr->name, sizeof(attr->name),
 				 "temp%d_alarm", s);
-- 
2.27.0


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

* Re: [PATCH] hwmon: (occ) Fix P10 VRM temp sensors
  2021-09-29 15:36 [PATCH] hwmon: (occ) Fix P10 VRM temp sensors Eddie James
@ 2021-10-02 11:36 ` Guenter Roeck
  0 siblings, 0 replies; 2+ messages in thread
From: Guenter Roeck @ 2021-10-02 11:36 UTC (permalink / raw)
  To: Eddie James; +Cc: jdelvare, linux-hwmon, linux-kernel

On Wed, Sep 29, 2021 at 10:36:04AM -0500, Eddie James wrote:
> The P10 (temp sensor version 0x10) doesn't do the same VRM status
> reporting that was used on P9. It just reports the temperature, so
> drop the check for VRM fru type in the sysfs show function, and don't
> set the name to "alarm".
> 
> Fixes: db4919ec86 ("hwmon: (occ) Add new temperature sensor type")
> Signed-off-by: Eddie James <eajames@linux.ibm.com>

Applied.

Thanks,
Guenter

> ---
>  drivers/hwmon/occ/common.c | 17 +++++------------
>  1 file changed, 5 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/hwmon/occ/common.c b/drivers/hwmon/occ/common.c
> index 0d68a78be980..ae664613289c 100644
> --- a/drivers/hwmon/occ/common.c
> +++ b/drivers/hwmon/occ/common.c
> @@ -340,18 +340,11 @@ static ssize_t occ_show_temp_10(struct device *dev,
>  		if (val == OCC_TEMP_SENSOR_FAULT)
>  			return -EREMOTEIO;
>  
> -		/*
> -		 * VRM doesn't return temperature, only alarm bit. This
> -		 * attribute maps to tempX_alarm instead of tempX_input for
> -		 * VRM
> -		 */
> -		if (temp->fru_type != OCC_FRU_TYPE_VRM) {
> -			/* sensor not ready */
> -			if (val == 0)
> -				return -EAGAIN;
> +		/* sensor not ready */
> +		if (val == 0)
> +			return -EAGAIN;
>  
> -			val *= 1000;
> -		}
> +		val *= 1000;
>  		break;
>  	case 2:
>  		val = temp->fru_type;
> @@ -886,7 +879,7 @@ static int occ_setup_sensor_attrs(struct occ *occ)
>  					     0, i);
>  		attr++;
>  
> -		if (sensors->temp.version > 1 &&
> +		if (sensors->temp.version == 2 &&
>  		    temp->fru_type == OCC_FRU_TYPE_VRM) {
>  			snprintf(attr->name, sizeof(attr->name),
>  				 "temp%d_alarm", s);

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

end of thread, other threads:[~2021-10-02 11:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-29 15:36 [PATCH] hwmon: (occ) Fix P10 VRM temp sensors Eddie James
2021-10-02 11:36 ` Guenter Roeck

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.