[Skiboot] [PATCH 4/4] hwmon: (ibmpowernv) pretty print labels
Cédric Le Goater
clg at fr.ibm.com
Wed Apr 1 21:15:06 AEDT 2015
The new OPAL device tree adds a few properties which can be used to add
extra information on the sensor label.
Signed-off-by: Cédric Le Goater <clg at fr.ibm.com>
---
drivers/hwmon/ibmpowernv.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/drivers/hwmon/ibmpowernv.c b/drivers/hwmon/ibmpowernv.c
index be6fe559b52a..3e753c215b40 100644
--- a/drivers/hwmon/ibmpowernv.c
+++ b/drivers/hwmon/ibmpowernv.c
@@ -113,9 +113,31 @@ static ssize_t show_label(struct device *dev, struct device_attribute *devattr,
static void __init make_sensor_label(struct device_node *np,
struct sensor_data *sdata, const char *label)
{
+ u32 id;
size_t n;
n = snprintf(sdata->label, sizeof(sdata->label), "%s", label);
+
+ /*
+ * Core temp pretty print
+ */
+ if (!of_property_read_u32(np, "ibm,pir", &id)) {
+ int i;
+
+ for_each_possible_cpu(i)
+ if (paca[i].hw_cpu_id == id)
+ break;
+
+ n += snprintf(sdata->label + n, sizeof(sdata->label) - n,
+ " %d-%d", i, i+7);
+ }
+
+ /*
+ * Membuffer pretty print
+ */
+ if (!of_property_read_u32(np, "ibm,chip-id", &id))
+ n += snprintf(sdata->label + n, sizeof(sdata->label) - n,
+ " %d", id & 0xffff);
}
static int get_sensor_index_attr(const char *name, u32 *index,
--
1.7.10.4
More information about the Skiboot
mailing list