Thread (51 messages) 51 messages, 7 authors, 2014-10-26

Re: [PATCH 06/14] net: dsa: Add support for hardware monitoring

From: Florian Fainelli <f.fainelli@gmail.com>
Date: 2014-10-23 04:38:07
Also in: lkml

2014-10-22 21:03 GMT-07:00 Guenter Roeck [off-list ref]:
Some Marvell switches provide chip temperature data.
Add support for reporting it to the dsa infrastructure.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
[snip]
+/* hwmon support ************************************************************/
+
+#if defined(CONFIG_HWMON) || (defined(MODULE) && defined(CONFIG_HWMON_MODULE))
IS_ENABLED(CONFIG_HWMON)?
+
+static ssize_t temp1_input_show(struct device *dev,
+                               struct device_attribute *attr, char *buf)
+{
+       struct dsa_switch *ds = dev_get_drvdata(dev);
+       int temp, ret;
+
+       ret = ds->drv->get_temp(ds, &temp);
+       if (ret < 0)
+               return ret;
+
+       return sprintf(buf, "%d\n", temp * 1000);
+}
+static DEVICE_ATTR_RO(temp1_input);
You probably want the number of temperature sensors to come from the
switch driver, and support arbitrary number of temperature sensors?
--
Florian
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help