Skip to contentSkip to conversation

drivers/hwmon/occ: Change power sensor type a0 attributes

PATCH In review Eddie James 3 participants 3 messages Jul 17, 2017 – Jul 19, 2017 Hardware monitoring

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers/hwmon/occ: Change power sensor type a0 attributes

From: "Edward A. James" <[email protected]>

Needed to be more standard.

---
 drivers/hwmon/occ/common.c | 74 ++++++++++++++++++++++++++++++++++++----------
 1 file changed, 58 insertions(+), 16 deletions(-)
drivers/hwmon/occ/common.c +58 -16
index 4e3e411..8b0a008 100644
@@ -565,6 +565,14 @@ static ssize_t occ_show_power_a0(struct device *dev,
 	case 14:
 		val = get_unaligned_be64(&power->vdn.accumulator);
 		break;
+	case 15:
+		return snprintf(buf, PAGE_SIZE - 1, "system\n");
+	case 16:
+		return snprintf(buf, PAGE_SIZE - 1, "proc\n");
+	case 17:
+		return snprintf(buf, PAGE_SIZE - 1, "vdd\n");
+	case 18:
+		return snprintf(buf, PAGE_SIZE - 1, "vdn\n");
 	}
 
 	return snprintf(buf, PAGE_SIZE - 1, "%llu\n", val);
@@ -804,7 +812,7 @@ int occ_setup_sensor_attrs(struct occ *occ)
 		show_power = occ_show_power_2;
 		break;
 	case 0xA0:
-		occ->num_attrs += (sensors->power.num_sensors * 15);
+		occ->num_attrs += (sensors->power.num_sensors * 19);
 		show_power = occ_show_power_a0;
 		break;
 	default:
@@ -888,91 +896,125 @@ int occ_setup_sensor_attrs(struct occ *occ)
 			s = i + 1;
 
 			snprintf(attr->name, sizeof(attr->name),
-				 "power%d_label", s);
+				 "power%d_id", s);
 			attr->sensor = OCC_INIT_ATTR(attr->name, 0444,
 						     show_power, NULL, 0, i);
 			attr++;
 
+			/* system power attributes */
 			snprintf(attr->name, sizeof(attr->name),
-				 "power%d_system_update_time", s);
+				 "power%d_label", s);
+			attr->sensor = OCC_INIT_ATTR(attr->name, 0444,
+						     show_power, NULL, 15, i);
+			attr++;
+
+			snprintf(attr->name, sizeof(attr->name),
+				 "power%d_update_time", s);
 			attr->sensor = OCC_INIT_ATTR(attr->name, 0444,
 						     show_power, NULL, 1, i);
 			attr++;
 
 			snprintf(attr->name, sizeof(attr->name),
-				 "power%d_system_value", s);
+				 "power%d_input", s);
 			attr->sensor = OCC_INIT_ATTR(attr->name, 0444,
 						     show_power, NULL, 2, i);
 			attr++;
 
 			snprintf(attr->name, sizeof(attr->name),
-				 "power%d_system_update_tag", s);
+				 "power%d_update_tag", s);
 			attr->sensor = OCC_INIT_ATTR(attr->name, 0444,
 						     show_power, NULL, 3, i);
 			attr++;
 
 			snprintf(attr->name, sizeof(attr->name),
-				 "power%d_system_accumulator", s);
+				 "power%d_accumulator", s);
 			attr->sensor = OCC_INIT_ATTR(attr->name, 0444,
 						     show_power, NULL, 4, i);
 			attr++;
 
+			s++;
+
+			/* proc power attributes */
 			snprintf(attr->name, sizeof(attr->name),
-				 "power%d_proc_update_time", s);
+				 "power%d_label", s);
+			attr->sensor = OCC_INIT_ATTR(attr->name, 0444,
+						     show_power, NULL, 16, i);
+			attr++;
+
+			snprintf(attr->name, sizeof(attr->name),
+				 "power%d_update_time", s);
 			attr->sensor = OCC_INIT_ATTR(attr->name, 0444,
 						     show_power, NULL, 5, i);
 			attr++;
 
 			snprintf(attr->name, sizeof(attr->name),
-				 "power%d_proc_value", s);
+				 "power%d_input", s);
 			attr->sensor = OCC_INIT_ATTR(attr->name, 0444,
 						     show_power, NULL, 6, i);
 			attr++;
 
 			snprintf(attr->name, sizeof(attr->name),
-				 "power%d_proc_update_tag", s);
+				 "power%d_update_tag", s);
 			attr->sensor = OCC_INIT_ATTR(attr->name, 0444,
 						     show_power, NULL, 7, i);
 			attr++;
 
 			snprintf(attr->name, sizeof(attr->name),
-				 "power%d_proc_accumulator", s);
+				 "power%d_accumulator", s);
 			attr->sensor = OCC_INIT_ATTR(attr->name, 0444,
 						     show_power, NULL, 8, i);
 			attr++;
 
+			s++;
+
+			/* vdd power attributes */
 			snprintf(attr->name, sizeof(attr->name),
-				 "power%d_vdd_value", s);
+				 "power%d_label", s);
+			attr->sensor = OCC_INIT_ATTR(attr->name, 0444,
+						     show_power, NULL, 17, i);
+			attr++;
+
+			snprintf(attr->name, sizeof(attr->name),
+				 "power%d_input", s);
 			attr->sensor = OCC_INIT_ATTR(attr->name, 0444,
 						     show_power, NULL, 9, i);
 			attr++;
 
 			snprintf(attr->name, sizeof(attr->name),
-				 "power%d_vdd_update_tag", s);
+				 "power%d_update_tag", s);
 			attr->sensor = OCC_INIT_ATTR(attr->name, 0444,
 						     show_power, NULL, 10, i);
 			attr++;
 
 			snprintf(attr->name, sizeof(attr->name),
-				 "power%d_vdd_accumulator", s);
+				 "power%d_accumulator", s);
 			attr->sensor = OCC_INIT_ATTR(attr->name, 0444,
 						     show_power, NULL, 11, i);
 			attr++;
 
+			s++;
+
+			/* vdn power attributes */
 			snprintf(attr->name, sizeof(attr->name),
-				 "power%d_vdn_value", s);
+				 "power%d_label", s);
+			attr->sensor = OCC_INIT_ATTR(attr->name, 0444,
+						     show_power, NULL, 18, i);
+			attr++;
+
+			snprintf(attr->name, sizeof(attr->name),
+				 "power%d_input", s);
 			attr->sensor = OCC_INIT_ATTR(attr->name, 0444,
 						     show_power, NULL, 12, i);
 			attr++;
 
 			snprintf(attr->name, sizeof(attr->name),
-				 "power%d_vdn_update_tag", s);
+				 "power%d_update_tag", s);
 			attr->sensor = OCC_INIT_ATTR(attr->name, 0444,
 						     show_power, NULL, 13, i);
 			attr++;
 
 			snprintf(attr->name, sizeof(attr->name),
-				 "power%d_vdn_accumulator", s);
+				 "power%d_accumulator", s);
 			attr->sensor = OCC_INIT_ATTR(attr->name, 0444,
 						     show_power, NULL, 14, i);
 			attr++;
Signature · 1 line
1.8.3.1
Tested-by on v1 1/1
#1 lore raw
Quoted 179 lines · Eddie James

From: "Edward A. James" <[email protected]>

Needed to be more standard.

---
 drivers/hwmon/occ/common.c | 74 ++++++++++++++++++++++++++++++++++++----------
 1 file changed, 58 insertions(+), 16 deletions(-)
drivers/hwmon/occ/common.c +58 -17
index 4e3e411..8b0a008 100644
@@ -565,6 +565,14 @@ static ssize_t occ_show_power_a0(struct device *dev,
        case 14:
                val = get_unaligned_be64(&power->vdn.accumulator);
                break;
+       case 15:
+               return snprintf(buf, PAGE_SIZE - 1, "system\n");
+       case 16:
+               return snprintf(buf, PAGE_SIZE - 1, "proc\n");
+       case 17:
+               return snprintf(buf, PAGE_SIZE - 1, "vdd\n");
+       case 18:
+               return snprintf(buf, PAGE_SIZE - 1, "vdn\n");
        }
 
        return snprintf(buf, PAGE_SIZE - 1, "%llu\n", val);
@@ -804,7 +812,7 @@ int occ_setup_sensor_attrs(struct occ *occ)
                show_power = occ_show_power_2;
                break;
        case 0xA0:
-               occ->num_attrs += (sensors->power.num_sensors * 15);
+               occ->num_attrs += (sensors->power.num_sensors * 19);
                show_power = occ_show_power_a0;
                break;
        default:
@@ -888,91 +896,125 @@ int occ_setup_sensor_attrs(struct occ *occ)
                        s = i + 1;
 
                        snprintf(attr->name, sizeof(attr->name),
-                                "power%d_label", s);
+                                "power%d_id", s);
                        attr->sensor = OCC_INIT_ATTR(attr->name, 0444,
                                                     show_power, NULL, 0, i);
                        attr++;
 
+                       /* system power attributes */
                        snprintf(attr->name, sizeof(attr->name),
-                                "power%d_system_update_time", s);
+                                "power%d_label", s);
+                       attr->sensor = OCC_INIT_ATTR(attr->name, 0444,
+                                                    show_power, NULL, 15, i);
+                       attr++;
+
+                       snprintf(attr->name, sizeof(attr->name),
+                                "power%d_update_time", s);
                        attr->sensor = OCC_INIT_ATTR(attr->name, 0444,
                                                     show_power, NULL, 1, i);
                        attr++;
 
                        snprintf(attr->name, sizeof(attr->name),
-                                "power%d_system_value", s);
+                                "power%d_input", s);
                        attr->sensor = OCC_INIT_ATTR(attr->name, 0444,
                                                     show_power, NULL, 2, i);
                        attr++;
 
                        snprintf(attr->name, sizeof(attr->name),
-                                "power%d_system_update_tag", s);
+                                "power%d_update_tag", s);
                        attr->sensor = OCC_INIT_ATTR(attr->name, 0444,
                                                     show_power, NULL, 3, i);
                        attr++;
 
                        snprintf(attr->name, sizeof(attr->name),
-                                "power%d_system_accumulator", s);
+                                "power%d_accumulator", s);
                        attr->sensor = OCC_INIT_ATTR(attr->name, 0444,
                                                     show_power, NULL, 4, i);
                        attr++;
 
+                       s++;
+
+                       /* proc power attributes */
                        snprintf(attr->name, sizeof(attr->name),
-                                "power%d_proc_update_time", s);
+                                "power%d_label", s);
+                       attr->sensor = OCC_INIT_ATTR(attr->name, 0444,
+                                                    show_power, NULL, 16, i);
+                       attr++;
+
+                       snprintf(attr->name, sizeof(attr->name),
+                                "power%d_update_time", s);
                        attr->sensor = OCC_INIT_ATTR(attr->name, 0444,
                                                     show_power, NULL, 5, i);
                        attr++;
 
                        snprintf(attr->name, sizeof(attr->name),
-                                "power%d_proc_value", s);
+                                "power%d_input", s);
                        attr->sensor = OCC_INIT_ATTR(attr->name, 0444,
                                                     show_power, NULL, 6, i);
                        attr++;
 
                        snprintf(attr->name, sizeof(attr->name),
-                                "power%d_proc_update_tag", s);
+                                "power%d_update_tag", s);
                        attr->sensor = OCC_INIT_ATTR(attr->name, 0444,
                                                     show_power, NULL, 7, i);
                        attr++;
 
                        snprintf(attr->name, sizeof(attr->name),
-                                "power%d_proc_accumulator", s);
+                                "power%d_accumulator", s);
                        attr->sensor = OCC_INIT_ATTR(attr->name, 0444,
                                                     show_power, NULL, 8, i);
                        attr++;
 
+                       s++;
+
+                       /* vdd power attributes */
                        snprintf(attr->name, sizeof(attr->name),
-                                "power%d_vdd_value", s);
+                                "power%d_label", s);
+                       attr->sensor = OCC_INIT_ATTR(attr->name, 0444,
+                                                    show_power, NULL, 17, i);
+                       attr++;
+
+                       snprintf(attr->name, sizeof(attr->name),
+                                "power%d_input", s);
                        attr->sensor = OCC_INIT_ATTR(attr->name, 0444,
                                                     show_power, NULL, 9, i);
                        attr++;
 
                        snprintf(attr->name, sizeof(attr->name),
-                                "power%d_vdd_update_tag", s);
+                                "power%d_update_tag", s);
                        attr->sensor = OCC_INIT_ATTR(attr->name, 0444,
                                                     show_power, NULL, 10, i);
                        attr++;
 
                        snprintf(attr->name, sizeof(attr->name),
-                                "power%d_vdd_accumulator", s);
+                                "power%d_accumulator", s);
                        attr->sensor = OCC_INIT_ATTR(attr->name, 0444,
                                                     show_power, NULL, 11, i);
                        attr++;
 
+                       s++;
+
+                       /* vdn power attributes */
                        snprintf(attr->name, sizeof(attr->name),
-                                "power%d_vdn_value", s);
+                                "power%d_label", s);
+                       attr->sensor = OCC_INIT_ATTR(attr->name, 0444,
+                                                    show_power, NULL, 18, i);
+                       attr++;
+
+                       snprintf(attr->name, sizeof(attr->name),
+                                "power%d_input", s);
                        attr->sensor = OCC_INIT_ATTR(attr->name, 0444,
                                                     show_power, NULL, 12, i);
                        attr++;
 
                        snprintf(attr->name, sizeof(attr->name),
-                                "power%d_vdn_update_tag", s);
+                                "power%d_update_tag", s);
                        attr->sensor = OCC_INIT_ATTR(attr->name, 0444,
                                                     show_power, NULL, 13, i);
                        attr++;
 
                        snprintf(attr->name, sizeof(attr->name),
-                                "power%d_vdn_accumulator", s);
+                                "power%d_accumulator", s);
                        attr->sensor = OCC_INIT_ATTR(attr->name, 0444,
                                                     show_power, NULL, 14, i);
                        attr++;
--
Quoted 2 lines

1.8.3.1

Eddie provided me this patch (plus his zaius gpio one) up in gerrit via https://gerrit.openbmc-project.xyz/#/c/5243/ which I then verified my hwmon conf files on top of.

#2 lore raw
Quoted 5 lines · Andrew Geissler
Quoted 4 lines · Eddie James

From: "Edward A. James" <[email protected]>

Needed to be more standard.

Quoted 7 lines
Quoted 1 line

Eddie provided me this patch (plus his zaius gpio one) up in gerrit via https://gerrit.openbmc-project.xyz/#/c/5243/ which I then verified my hwmon conf files on top of.

Thanks for the testing Andrew. Applied to dev-4.10.

Cheers,

Joel