Add support for MDIO busses

Marvell Ethernet PHYs can contain a temperature sensor, which the kernel
exports as an HWMON device. The PHY is on an MDIO bus. Add support for
this bus types to libsensors. The sensor is then displayed by sensors(1):

socaipsbus02100000ethernet02188000mdioswitch0mdio01-mdio-1
Adapter: MDIO adapter
temp1:        +54.0°C  (crit = +100.0°C)

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
This commit is contained in:
Andrew Lunn authored and Guenter Roeck committed 2017-07-08 20:19:13 -07:00
1 parent 0d5ccf640d
commit 0880db23b9
5 files changed
+17 -2

No files matched your search

+6
View File
@@ -717,6 +717,12 @@ static int sensors_read_one_sysfs_chip(const char *dev_path,
/* As of kernel 2.6.32, the hid device names don't look good */
entry.chip.bus.nr = bus;
entry.chip.addr = id;
} else
if (subsys && !strcmp(subsys, "mdio_bus")) {
if (sscanf(dev_name, "%*[^:]:%d", &entry.chip.addr) != 1)
entry.chip.addr = 0;
entry.chip.bus.type = SENSORS_BUS_TYPE_MDIO;
entry.chip.bus.nr = 0;
} else {
/* Ignore unknown device */
err = 0;