]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
hwmon: (occ) Fix P10 VRM temp sensors
authorEddie James <eajames@linux.ibm.com>
Wed, 29 Sep 2021 15:36:04 +0000 (10:36 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 27 Jun 2025 10:04:24 +0000 (11:04 +0100)
commit ffa2600044979aff4bd6238edb9af815a47d7c32 upstream.

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>
Link: https://lore.kernel.org/r/20210929153604.14968-1-eajames@linux.ibm.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/hwmon/occ/common.c

index 51bf560ef20b13a67d1ffc30d18debe41ef8483e..18f1b57431ff007016eaaaf674783b68cad30800 100644 (file)
@@ -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;
@@ -888,7 +881,7 @@ static int occ_setup_sensor_attrs(struct occ *occ)
                                   0, i, "temp%d_label", s);
                attr++;
 
-               if (sensors->temp.version > 1 &&
+               if (sensors->temp.version == 2 &&
                    temp->fru_type == OCC_FRU_TYPE_VRM) {
                        occ_init_attribute(attr, 0444, show_temp, NULL,
                                           1, i, "temp%d_alarm", s);