Skip to contentSkip to conversation

hwmon: (pmbus) Add Delta AHE-50DC fan control module driver

PATCH Superseded Zev Weiss 3 participants 14 messages Dec 7, 2021 – Dec 8, 2021

Subsystems (3)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Zev Weiss

author maintainer
#0 lore raw

v3 cover hwmon: (pmbus) Add Delta AHE-50DC fan control module driver

Hello,

These patches add a hwmon pmbus driver for the integrated fan control module in the Delta AHE-50DC Open19 power shelf. I don't know of a datasheet or any proper documentation for it; the registers it has available have deen deduced from a combination of an existing GPL driver in a code release from LinkedIn [0] and some manual experimentation with i2cdump. In addition to some standard PMBus sensors (three temperature readings, four fan speeds, and one voltage), it also has a manufacturer-specific fourth temperature reading available, which is supported via a virtual second page (the device itself is not paged, but the driver remaps PMBUS_READ_TEMPERATURE_1 in page 1 to the manufacturer-specific TEMPERATURE_4).

Thanks,
Zev Weiss

Changes since v2 [2]:
- converted to pmbus driver

Changes since v1 [1]:
- fixed invalid name warning from __hwmon_device_register()

[0] https://github.com/linkedin/o19-bmc-firmware/blob/master/meta-openbmc/meta-linkedin/meta-deltapower/recipes-kernel/fancontrol-mod/files/fancontrol.c
[1] https://lore.kernel.org/linux-hwmon/[email protected]/
[2] https://lore.kernel.org/linux-hwmon/[email protected]/

Zev Weiss (2):
hwmon: (pmbus) Add Delta AHE-50DC fan control module driver
dt-bindings: add Delta AHE-50DC fan control module

 .../devicetree/bindings/trivial-devices.yaml  |  2 +
 MAINTAINERS                                   |  6 ++
 drivers/hwmon/pmbus/Kconfig                   | 12 +++
 drivers/hwmon/pmbus/Makefile                  |  1 +
 drivers/hwmon/pmbus/delta-ahe50dc-fan.c       | 84 +++++++++++++++++++
 5 files changed, 105 insertions(+)
 create mode 100644 drivers/hwmon/pmbus/delta-ahe50dc-fan.c
Signature · 1 line
2.34.1
author maintainer
#1 lore raw

PATCH v3 1/2 hwmon: (pmbus) Add Delta AHE-50DC fan control module driver

This device is an integrated module of the Delta AHE-50DC Open19 power shelf. For lack of proper documentation, this driver has been developed referencing an existing (GPL) driver that was included in a code release from LinkedIn [1]. It provides four fan speeds, four temperatures, and one voltage reading, as well as a handful of warning and fault indicators.

[1] https://github.com/linkedin/o19-bmc-firmware/blob/master/meta-openbmc/meta-linkedin/meta-deltapower/recipes-kernel/fancontrol-mod/files/fancontrol.c

---
 MAINTAINERS                             |  6 ++
 drivers/hwmon/pmbus/Kconfig             | 12 ++++
 drivers/hwmon/pmbus/Makefile            |  1 +
 drivers/hwmon/pmbus/delta-ahe50dc-fan.c | 84 +++++++++++++++++++++++++
 4 files changed, 103 insertions(+)
 create mode 100644 drivers/hwmon/pmbus/delta-ahe50dc-fan.c
MAINTAINERS +6 -0
index 0ac052200ecb..8bb7ba52d2f5 100644
@@ -5425,6 +5425,12 @@ W:	https://linuxtv.org
 T:	git git://linuxtv.org/media_tree.git
 F:	drivers/media/platform/sti/delta
 
+DELTA AHE-50DC FAN CONTROL MODULE DRIVER
+M:	Zev Weiss <[email protected]>
+L:	[email protected]
+S:	Maintained
+F:	drivers/hwmon/pmbus/delta-ahe50dc-fan.c
+
 DELTA DPS920AB PSU DRIVER
 M:	Robert Marko <[email protected]>
 L:	[email protected]
drivers/hwmon/pmbus/Kconfig +12 -0
index ffb609cee3a4..937e1c2c11e7 100644
@@ -66,6 +66,18 @@ config SENSORS_BPA_RS600
 	  This driver can also be built as a module. If so, the module will
 	  be called bpa-rs600.
 
+config SENSORS_DELTA_AHE50DC_FAN
+	tristate "Delta AHE-50DC fan control module"
+	depends on I2C
+	select REGMAP_I2C
+	help
+	  If you say yes here you get hardware monitoring support for
+	  the integrated fan control module of the Delta AHE-50DC
+	  Open19 power shelf.
+
+	  This driver can also be built as a module. If so, the module
+	  will be called delta-ahe50dc-fan.
+
 config SENSORS_FSP_3Y
 	tristate "FSP/3Y-Power power supplies"
 	help
drivers/hwmon/pmbus/Makefile +1 -0
index 0ed4d596a948..a56b2897288d 100644
@@ -9,6 +9,7 @@ obj-$(CONFIG_SENSORS_ADM1266)	+= adm1266.o
 obj-$(CONFIG_SENSORS_ADM1275)	+= adm1275.o
 obj-$(CONFIG_SENSORS_BEL_PFE)	+= bel-pfe.o
 obj-$(CONFIG_SENSORS_BPA_RS600)	+= bpa-rs600.o
+obj-$(CONFIG_SENSORS_DELTA_AHE50DC_FAN) += delta-ahe50dc-fan.o
 obj-$(CONFIG_SENSORS_FSP_3Y)	+= fsp-3y.o
 obj-$(CONFIG_SENSORS_IBM_CFFPS)	+= ibm-cffps.o
 obj-$(CONFIG_SENSORS_DPS920AB)	+= dps920ab.o
drivers/hwmon/pmbus/delta-ahe50dc-fan.c new file +84 -0

84 lines not on this page · raw message

Signature · 1 line
2.34.1
maintainer
#2 lore raw
Quoted 9 lines · Zev Weiss

This device is an integrated module of the Delta AHE-50DC Open19 power shelf. For lack of proper documentation, this driver has been developed referencing an existing (GPL) driver that was included in a code release from LinkedIn [1]. It provides four fan speeds, four temperatures, and one voltage reading, as well as a handful of warning and fault indicators.

[1] https://github.com/linkedin/o19-bmc-firmware/blob/master/meta-openbmc/meta-linkedin/meta-deltapower/recipes-kernel/fancontrol-mod/files/fancontrol.c

Hmm, that reference isn't really accurate anymore. I think it would be better to just say that the device was found to be PMBus compliant.

Quoted 68 lines
---
 MAINTAINERS                             |  6 ++
 drivers/hwmon/pmbus/Kconfig             | 12 ++++
 drivers/hwmon/pmbus/Makefile            |  1 +
 drivers/hwmon/pmbus/delta-ahe50dc-fan.c | 84 +++++++++++++++++++++++++
 4 files changed, 103 insertions(+)
 create mode 100644 drivers/hwmon/pmbus/delta-ahe50dc-fan.c
MAINTAINERS +6 -0
index 0ac052200ecb..8bb7ba52d2f5 100644
@@ -5425,6 +5425,12 @@ W:	https://linuxtv.org
 T:	git git://linuxtv.org/media_tree.git
 F:	drivers/media/platform/sti/delta
 
+DELTA AHE-50DC FAN CONTROL MODULE DRIVER
+M:	Zev Weiss <[email protected]>
+L:	[email protected]
+S:	Maintained
+F:	drivers/hwmon/pmbus/delta-ahe50dc-fan.c
+
 DELTA DPS920AB PSU DRIVER
 M:	Robert Marko <[email protected]>
 L:	[email protected]
drivers/hwmon/pmbus/Kconfig +12 -0
index ffb609cee3a4..937e1c2c11e7 100644
@@ -66,6 +66,18 @@ config SENSORS_BPA_RS600
 	  This driver can also be built as a module. If so, the module will
 	  be called bpa-rs600.
 
+config SENSORS_DELTA_AHE50DC_FAN
+	tristate "Delta AHE-50DC fan control module"
+	depends on I2C
+	select REGMAP_I2C
+	help
+	  If you say yes here you get hardware monitoring support for
+	  the integrated fan control module of the Delta AHE-50DC
+	  Open19 power shelf.
+
+	  This driver can also be built as a module. If so, the module
+	  will be called delta-ahe50dc-fan.
+
 config SENSORS_FSP_3Y
 	tristate "FSP/3Y-Power power supplies"
 	help
drivers/hwmon/pmbus/Makefile +1 -0
index 0ed4d596a948..a56b2897288d 100644
@@ -9,6 +9,7 @@ obj-$(CONFIG_SENSORS_ADM1266)	+= adm1266.o
 obj-$(CONFIG_SENSORS_ADM1275)	+= adm1275.o
 obj-$(CONFIG_SENSORS_BEL_PFE)	+= bel-pfe.o
 obj-$(CONFIG_SENSORS_BPA_RS600)	+= bpa-rs600.o
+obj-$(CONFIG_SENSORS_DELTA_AHE50DC_FAN) += delta-ahe50dc-fan.o
 obj-$(CONFIG_SENSORS_FSP_3Y)	+= fsp-3y.o
 obj-$(CONFIG_SENSORS_IBM_CFFPS)	+= ibm-cffps.o
 obj-$(CONFIG_SENSORS_DPS920AB)	+= dps920ab.o
drivers/hwmon/pmbus/delta-ahe50dc-fan.c new file +1 -0
new file mode 100644
index 000000000000..07b1e7c5f5f5
@@ -0,0 +1,84 @@
+// SPDX-License-Identifier: GPL-2.0

drivers/hwmon/pmbus/delta-ahe50dc-fan.c line 11

Quoted 10 lines
drivers/hwmon/pmbus/delta-ahe50dc-fan.c new file +10 -0
+/*
+ * Delta AHE-50DC power shelf fan control module driver
+ *
+ * Copyright 2021 Zev Weiss <[email protected]>
+ */
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/i2c.h>
+#include <linux/pmbus.h>

Alphabetic include file order please.

Quoted 20 lines
drivers/hwmon/pmbus/delta-ahe50dc-fan.c new file +20 -0
+
+#include "pmbus.h"
+
+#define AHE50DC_PMBUS_READ_TEMP4 0xd0
+
+static int ahe50dc_fan_read_word_data(struct i2c_client *client, int page, int phase, int reg)
+{
+	/* temp1 in (virtual) page 1 is remapped to mfr-specific temp4 */
+	if (page == 1) {
+		if (reg == PMBUS_READ_TEMPERATURE_1)
+			return i2c_smbus_read_word_data(client, AHE50DC_PMBUS_READ_TEMP4);
+		return -EOPNOTSUPP;
+	}
+	return -ENODATA;
+}
+
+static struct pmbus_driver_info ahe50dc_fan_info = {
+	.pages = 2,
+	.format[PSC_FAN] = direct,
+	.format[PSC_TEMPERATURE] = direct,

drivers/hwmon/pmbus/delta-ahe50dc-fan.c line 41

Quoted 10 lines
drivers/hwmon/pmbus/delta-ahe50dc-fan.c new file +10 -0
+	.format[PSC_VOLTAGE_IN] = direct,
+	.m[PSC_FAN] = 1,
+	.b[PSC_FAN] = 0,
+	.R[PSC_FAN] = 0,
+	.m[PSC_TEMPERATURE] = 1,
+	.b[PSC_TEMPERATURE] = 0,
+	.R[PSC_TEMPERATURE] = 1,
+	.m[PSC_VOLTAGE_IN] = 1,
+	.b[PSC_VOLTAGE_IN] = 0,
+	.R[PSC_VOLTAGE_IN] = 3,

How did you determine the exponents ? The referenced driver doesn't seem to make a difference between voltage and temperature exponents (nor fan speed, which is a bit odd).

drivers/hwmon/pmbus/delta-ahe50dc-fan.c line 51

Quoted 10 lines
drivers/hwmon/pmbus/delta-ahe50dc-fan.c new file +10 -0
+	.func[0] = PMBUS_HAVE_TEMP | PMBUS_HAVE_TEMP2 | PMBUS_HAVE_TEMP3 |
+		PMBUS_HAVE_VIN | PMBUS_HAVE_FAN12 | PMBUS_HAVE_FAN34 |
+		PMBUS_HAVE_STATUS_FAN12 | PMBUS_HAVE_STATUS_FAN34 | PMBUS_PAGE_VIRTUAL,
+	.func[1] = PMBUS_HAVE_TEMP | PMBUS_PAGE_VIRTUAL,
+	.read_word_data = ahe50dc_fan_read_word_data,
+};
+
+static struct pmbus_platform_data ahe50dc_fan_data = {
+	.flags = PMBUS_NO_CAPABILITY,
+};

Is that necessary ? It should only be used if trying to read CAPABILITY reports bad data.

Thanks,
Guenter

Quoted 36 lines
drivers/hwmon/pmbus/delta-ahe50dc-fan.c new file +33 -0
+
+static int ahe50dc_fan_probe(struct i2c_client *client)
+{
+	client->dev.platform_data = &ahe50dc_fan_data;
+	return pmbus_do_probe(client, &ahe50dc_fan_info);
+}
+
+static const struct i2c_device_id ahe50dc_fan_id[] = {
+	{ "ahe50dc_fan" },
+	{ }
+};
+MODULE_DEVICE_TABLE(i2c, ahe50dc_fan_id);
+
+static const struct of_device_id __maybe_unused ahe50dc_fan_of_match[] = {
+	{ .compatible = "delta,ahe50dc-fan" },
+	{ }
+};
+MODULE_DEVICE_TABLE(of, ahe50dc_fan_of_match);
+
+static struct i2c_driver ahe50dc_fan_driver = {
+	.driver = {
+		   .name = "ahe50dc_fan",
+		   .of_match_table = of_match_ptr(ahe50dc_fan_of_match),
+	},
+	.probe_new = ahe50dc_fan_probe,
+	.id_table = ahe50dc_fan_id,
+};
+module_i2c_driver(ahe50dc_fan_driver);
+
+MODULE_AUTHOR("Zev Weiss <[email protected]>");
+MODULE_DESCRIPTION("Driver for Delta AHE-50DC power shelf fan control module");
+MODULE_LICENSE("GPL");
+MODULE_IMPORT_NS(PMBUS);
Signature · 1 line
2.34.1
author maintainer
#3 lore raw
Quoted 8 lines · Guenter Roeck
Quoted 7 lines · Zev Weiss

This device is an integrated module of the Delta AHE-50DC Open19 power shelf. For lack of proper documentation, this driver has been developed referencing an existing (GPL) driver that was included in a code release from LinkedIn [1]. It provides four fan speeds, four temperatures, and one voltage reading, as well as a handful of warning and fault indicators.

Quoted 5 lines
Quoted 2 lines

[1] https://github.com/linkedin/o19-bmc-firmware/blob/master/meta-openbmc/meta-linkedin/meta-deltapower/recipes-kernel/fancontrol-mod/files/fancontrol.c

Hmm, that reference isn't really accurate anymore. I think it would be better to just say that the device was found to be PMBus compliant.

Sure, will do.

Quoted 35 lines
Quoted 35 lines
---
 MAINTAINERS                             |  6 ++
 drivers/hwmon/pmbus/Kconfig             | 12 ++++
 drivers/hwmon/pmbus/Makefile            |  1 +
 drivers/hwmon/pmbus/delta-ahe50dc-fan.c | 84 +++++++++++++++++++++++++
 4 files changed, 103 insertions(+)
 create mode 100644 drivers/hwmon/pmbus/delta-ahe50dc-fan.c
MAINTAINERS +6 -0
index 0ac052200ecb..8bb7ba52d2f5 100644
@@ -5425,6 +5425,12 @@ W:	https://linuxtv.org
 T:	git git://linuxtv.org/media_tree.git
 F:	drivers/media/platform/sti/delta
 
+DELTA AHE-50DC FAN CONTROL MODULE DRIVER
+M:	Zev Weiss <[email protected]>
+L:	[email protected]
+S:	Maintained
+F:	drivers/hwmon/pmbus/delta-ahe50dc-fan.c
+
 DELTA DPS920AB PSU DRIVER
 M:	Robert Marko <[email protected]>
 L:	[email protected]
drivers/hwmon/pmbus/Kconfig +0 -0
index ffb609cee3a4..937e1c2c11e7 100644
@@ -66,6 +66,18 @@ config SENSORS_BPA_RS600
 	  This driver can also be built as a module. If so, the module will
 	  be called bpa-rs600.
 
Quoted 4 lines

drivers/hwmon/pmbus/Kconfig config SENSORS_BPA_RS600 · line 72

Quoted 4 lines
drivers/hwmon/pmbus/Kconfig +4 -0
+config SENSORS_DELTA_AHE50DC_FAN
+	tristate "Delta AHE-50DC fan control module"
+	depends on I2C
+	select REGMAP_I2C

And I realize I neglected to drop the depends & select lines here when moving this bit into the pmbus directory...

Quoted 34 lines
Quoted 34 lines
drivers/hwmon/pmbus/Kconfig +8 -0
+	help
+	  If you say yes here you get hardware monitoring support for
+	  the integrated fan control module of the Delta AHE-50DC
+	  Open19 power shelf.
+
+	  This driver can also be built as a module. If so, the module
+	  will be called delta-ahe50dc-fan.
+
 config SENSORS_FSP_3Y
 	tristate "FSP/3Y-Power power supplies"
 	help
drivers/hwmon/pmbus/Makefile +1 -0
index 0ed4d596a948..a56b2897288d 100644
@@ -9,6 +9,7 @@ obj-$(CONFIG_SENSORS_ADM1266)	+= adm1266.o
 obj-$(CONFIG_SENSORS_ADM1275)	+= adm1275.o
 obj-$(CONFIG_SENSORS_BEL_PFE)	+= bel-pfe.o
 obj-$(CONFIG_SENSORS_BPA_RS600)	+= bpa-rs600.o
+obj-$(CONFIG_SENSORS_DELTA_AHE50DC_FAN) += delta-ahe50dc-fan.o
 obj-$(CONFIG_SENSORS_FSP_3Y)	+= fsp-3y.o
 obj-$(CONFIG_SENSORS_IBM_CFFPS)	+= ibm-cffps.o
 obj-$(CONFIG_SENSORS_DPS920AB)	+= dps920ab.o
drivers/hwmon/pmbus/delta-ahe50dc-fan.c new file +5 -0
new file mode 100644
index 000000000000..07b1e7c5f5f5
@@ -0,0 +1,84 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Delta AHE-50DC power shelf fan control module driver
+ *
+ * Copyright 2021 Zev Weiss <[email protected]>
Quoted 8 lines

drivers/hwmon/pmbus/delta-ahe50dc-fan.c line 11

Quoted 6 lines
drivers/hwmon/pmbus/delta-ahe50dc-fan.c new file +6 -0
+ */
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/i2c.h>
+#include <linux/pmbus.h>

Alphabetic include file order please.

Ack, will fix.

Quoted 27 lines
Quoted 27 lines
drivers/hwmon/pmbus/delta-ahe50dc-fan.c new file +26 -0
+
+#include "pmbus.h"
+
+#define AHE50DC_PMBUS_READ_TEMP4 0xd0
+
+static int ahe50dc_fan_read_word_data(struct i2c_client *client, int page, int phase, int reg)
+{
+	/* temp1 in (virtual) page 1 is remapped to mfr-specific temp4 */
+	if (page == 1) {
+		if (reg == PMBUS_READ_TEMPERATURE_1)
+			return i2c_smbus_read_word_data(client, AHE50DC_PMBUS_READ_TEMP4);
+		return -EOPNOTSUPP;
+	}
+	return -ENODATA;
+}
+
+static struct pmbus_driver_info ahe50dc_fan_info = {
+	.pages = 2,
+	.format[PSC_FAN] = direct,
+	.format[PSC_TEMPERATURE] = direct,
+	.format[PSC_VOLTAGE_IN] = direct,
+	.m[PSC_FAN] = 1,
+	.b[PSC_FAN] = 0,
+	.R[PSC_FAN] = 0,
+	.m[PSC_TEMPERATURE] = 1,
+	.b[PSC_TEMPERATURE] = 0,
Quoted 8 lines

drivers/hwmon/pmbus/delta-ahe50dc-fan.c line 41

Quoted 4 lines
drivers/hwmon/pmbus/delta-ahe50dc-fan.c new file +4 -0
+	.R[PSC_TEMPERATURE] = 1,
+	.m[PSC_VOLTAGE_IN] = 1,
+	.b[PSC_VOLTAGE_IN] = 0,
+	.R[PSC_VOLTAGE_IN] = 3,

How did you determine the exponents ? The referenced driver doesn't seem to make a difference between voltage and temperature exponents (nor fan speed, which is a bit odd).

Lacking documentation, the honest answer here is that I just sort of eyeballed it. However, after doing so, I dug through the code dump a bit more and found some userspace unit-conversion bits that appear to confirm what I arrived at:

https://github.com/linkedin/o19-bmc-firmware/blob/master/meta-openbmc/meta-linkedin/meta-deltapower/recipes-deltapower/platform-lib/files/powershelf/powershelf_fan.c

(Lines 107, and 153/161/169/177.)

Quoted 14 lines

drivers/hwmon/pmbus/delta-ahe50dc-fan.c line 51

Quoted 11 lines
drivers/hwmon/pmbus/delta-ahe50dc-fan.c new file +10 -0
+	.func[0] = PMBUS_HAVE_TEMP | PMBUS_HAVE_TEMP2 | PMBUS_HAVE_TEMP3 |
+		PMBUS_HAVE_VIN | PMBUS_HAVE_FAN12 | PMBUS_HAVE_FAN34 |
+		PMBUS_HAVE_STATUS_FAN12 | PMBUS_HAVE_STATUS_FAN34 | PMBUS_PAGE_VIRTUAL,
+	.func[1] = PMBUS_HAVE_TEMP | PMBUS_PAGE_VIRTUAL,
+	.read_word_data = ahe50dc_fan_read_word_data,
+};
+
+static struct pmbus_platform_data ahe50dc_fan_data = {
+	.flags = PMBUS_NO_CAPABILITY,
+};

Is that necessary ? It should only be used if trying to read CAPABILITY reports bad data.

Unfortunately it does seem to be needed -- CAPABILITY returns 0xff, but despite having bit 7 set the device mangles all subsequent transactions by returning bad PEC bytes if we enable I2C_CLIENT_PEC. Actually, none of the fields in that CAPABILITY value seem to accurately reflect the device's observed behavior; I'm pretty sure 0xff is just what it returns when it doesn't support something (I think the bad PECs it sends are all 0xff too).

I'll add an explanatory comment in v4.

Thanks for the review!

Zev

maintainer
#4 lore raw
Quoted 140 lines · Zev Weiss
Quoted 8 lines · Guenter Roeck
Quoted 7 lines · Zev Weiss

This device is an integrated module of the Delta AHE-50DC Open19 power shelf.  For lack of proper documentation, this driver has been developed referencing an existing (GPL) driver that was included in a code release from LinkedIn [1].  It provides four fan speeds, four temperatures, and one voltage reading, as well as a handful of warning and fault indicators.

Quoted 5 lines
Quoted 2 lines

[1] https://github.com/linkedin/o19-bmc-firmware/blob/master/meta-openbmc/meta-linkedin/meta-deltapower/recipes-kernel/fancontrol-mod/files/fancontrol.c

Hmm, that reference isn't really accurate anymore. I think it would be better to just say that the device was found to be PMBus compliant.

Sure, will do.

Quoted 35 lines
Quoted 35 lines

---
 MAINTAINERS                             |  6 ++ drivers/hwmon/pmbus/Kconfig             | 12 ++++ drivers/hwmon/pmbus/Makefile            |  1 + drivers/hwmon/pmbus/delta-ahe50dc-fan.c | 84 +++++++++++++++++++++++++

 4 files changed, 103 insertions(+)

 create mode 100644 drivers/hwmon/pmbus/delta-ahe50dc-fan.c

MAINTAINERS +0 -0
index 0ac052200ecb..8bb7ba52d2f5 100644
@@ -5425,6 +5425,12 @@ W:    https://linuxtv.org

 T:    git git://linuxtv.org/media_tree.git
 F:    drivers/media/platform/sti/delta

MAINTAINERS +6 -0
+DELTA AHE-50DC FAN CONTROL MODULE DRIVER
+M:    Zev Weiss <[email protected]>
+L:    [email protected]
+S:    Maintained
+F:    drivers/hwmon/pmbus/delta-ahe50dc-fan.c
+

 DELTA DPS920AB PSU DRIVER
 M:    Robert Marko <[email protected]>
 L:    [email protected]

drivers/hwmon/pmbus/Kconfig +0 -0
index ffb609cee3a4..937e1c2c11e7 100644
@@ -66,6 +66,18 @@ config SENSORS_BPA_RS600

       This driver can also be built as a module. If so, the module will be called bpa-rs600.

Quoted 4 lines
Quoted 4 lines

+config SENSORS_DELTA_AHE50DC_FAN
+    tristate "Delta AHE-50DC fan control module"
+    depends on I2C
+    select REGMAP_I2C

And I realize I neglected to drop the depends & select lines here when moving this bit into the pmbus directory...

Quoted 34 lines
Quoted 34 lines

+    help
+      If you say yes here you get hardware monitoring support for +      the integrated fan control module of the Delta AHE-50DC +      Open19 power shelf.

drivers/hwmon/pmbus/Kconfig +4 -0
+
+      This driver can also be built as a module. If so, the module
+      will be called delta-ahe50dc-fan.
+

 config SENSORS_FSP_3Y
     tristate "FSP/3Y-Power power supplies"
     help

drivers/hwmon/pmbus/Makefile +0 -0
index 0ed4d596a948..a56b2897288d 100644
@@ -9,6 +9,7 @@ obj-$(CONFIG_SENSORS_ADM1266)    += adm1266.o

 obj-$(CONFIG_SENSORS_ADM1275)    += adm1275.o obj-$(CONFIG_SENSORS_BEL_PFE)    += bel-pfe.o obj-$(CONFIG_SENSORS_BPA_RS600)    += bpa-rs600.o +obj-$(CONFIG_SENSORS_DELTA_AHE50DC_FAN) += delta-ahe50dc-fan.o obj-$(CONFIG_SENSORS_FSP_3Y)    += fsp-3y.o obj-$(CONFIG_SENSORS_IBM_CFFPS)    += ibm-cffps.o obj-$(CONFIG_SENSORS_DPS920AB)    += dps920ab.o

drivers/hwmon/pmbus/delta-ahe50dc-fan.c new file +5 -0
new file mode 100644
index 000000000000..07b1e7c5f5f5
@@ -0,0 +1,84 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Delta AHE-50DC power shelf fan control module driver
+ *
+ * Copyright 2021 Zev Weiss <[email protected]>
Quoted 8 lines

drivers/hwmon/pmbus/delta-ahe50dc-fan.c line 11

Quoted 6 lines
drivers/hwmon/pmbus/delta-ahe50dc-fan.c new file +6 -0
+ */
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/i2c.h>
+#include <linux/pmbus.h>

Alphabetic include file order please.

Ack, will fix.

Quoted 27 lines
Quoted 27 lines
drivers/hwmon/pmbus/delta-ahe50dc-fan.c new file +26 -0
+
+#include "pmbus.h"
+
+#define AHE50DC_PMBUS_READ_TEMP4 0xd0
+
+static int ahe50dc_fan_read_word_data(struct i2c_client *client, int page, int phase, int reg)
+{
+    /* temp1 in (virtual) page 1 is remapped to mfr-specific temp4 */
+    if (page == 1) {
+        if (reg == PMBUS_READ_TEMPERATURE_1)
+            return i2c_smbus_read_word_data(client, AHE50DC_PMBUS_READ_TEMP4);
+        return -EOPNOTSUPP;
+    }
+    return -ENODATA;
+}
+
+static struct pmbus_driver_info ahe50dc_fan_info = {
+    .pages = 2,
+    .format[PSC_FAN] = direct,
+    .format[PSC_TEMPERATURE] = direct,
+    .format[PSC_VOLTAGE_IN] = direct,
+    .m[PSC_FAN] = 1,
+    .b[PSC_FAN] = 0,
+    .R[PSC_FAN] = 0,
+    .m[PSC_TEMPERATURE] = 1,
+    .b[PSC_TEMPERATURE] = 0,
Quoted 8 lines

drivers/hwmon/pmbus/delta-ahe50dc-fan.c line 41

Quoted 4 lines
drivers/hwmon/pmbus/delta-ahe50dc-fan.c new file +4 -0
+    .R[PSC_TEMPERATURE] = 1,
+    .m[PSC_VOLTAGE_IN] = 1,
+    .b[PSC_VOLTAGE_IN] = 0,
+    .R[PSC_VOLTAGE_IN] = 3,

How did you determine the exponents ? The referenced driver doesn't seem to make a difference between voltage and temperature exponents (nor fan speed, which is a bit odd).

Quoted 6 lines

Lacking documentation, the honest answer here is that I just sort of eyeballed it.  However, after doing so, I dug through the code dump a bit more and found some userspace unit-conversion bits that appear to confirm what I arrived at:

https://github.com/linkedin/o19-bmc-firmware/blob/master/meta-openbmc/meta-linkedin/meta-deltapower/recipes-deltapower/platform-lib/files/powershelf/powershelf_fan.c

(Lines 107, and 153/161/169/177.)

Brr. Well, why use a standard API/ABI if one can invent a non-standard one.

Can you check this with real hardware, by any chance ?

Quoted 15 lines
Quoted 14 lines

drivers/hwmon/pmbus/delta-ahe50dc-fan.c line 51

Quoted 11 lines
drivers/hwmon/pmbus/delta-ahe50dc-fan.c new file +10 -0
+    .func[0] = PMBUS_HAVE_TEMP | PMBUS_HAVE_TEMP2 | PMBUS_HAVE_TEMP3 |
+        PMBUS_HAVE_VIN | PMBUS_HAVE_FAN12 | PMBUS_HAVE_FAN34 |
+        PMBUS_HAVE_STATUS_FAN12 | PMBUS_HAVE_STATUS_FAN34 | PMBUS_PAGE_VIRTUAL,
+    .func[1] = PMBUS_HAVE_TEMP | PMBUS_PAGE_VIRTUAL,
+    .read_word_data = ahe50dc_fan_read_word_data,
+};
+
+static struct pmbus_platform_data ahe50dc_fan_data = {
+    .flags = PMBUS_NO_CAPABILITY,
+};

Is that necessary ? It should only be used if trying to read CAPABILITY reports bad data.

Quoted 5 lines

Unfortunately it does seem to be needed -- CAPABILITY returns 0xff, but despite having bit 7 set the device mangles all subsequent transactions by returning bad PEC bytes if we enable I2C_CLIENT_PEC.  Actually, none of the fields in that CAPABILITY value seem to accurately reflect the device's observed behavior; I'm pretty sure 0xff is just what it returns when it doesn't support something (I think the bad PECs it sends are all 0xff too).

I'll add an explanatory comment in v4.

Please do.

Thanks,
Guenter

author maintainer
#5 lore raw
Quoted 13 lines · Guenter Roeck
Quoted 12 lines · Zev Weiss
Quoted 11 lines · Guenter Roeck
Quoted 9 lines · Zev Weiss

This device is an integrated module of the Delta AHE-50DC Open19 power shelf.  For lack of proper documentation, this driver has been developed referencing an existing (GPL) driver that was included in a code release from LinkedIn [1].  It provides four fan speeds, four temperatures, and one voltage reading, as well as a handful of warning and fault indicators.

[1] https://github.com/linkedin/o19-bmc-firmware/blob/master/meta-openbmc/meta-linkedin/meta-deltapower/recipes-kernel/fancontrol-mod/files/fancontrol.c

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

Hmm, that reference isn't really accurate anymore. I think it would be better to just say that the device was found to be PMBus compliant.

Sure, will do.

Makes me wonder: How do you know that the referenced driver is for Delta AHE-50DC ?

We'd been waiting for the source code for the software it ships with for a while, and were finally provided with that repo; everything I've observed from the factory software is consistent with the code in that driver. A sampling:

    # no modinfo command available, but...
    root@bmc-oob:~# strings -n8 /lib/modules/4.1.51-deltapower/extra/fancontrol.ko | head
    fancontrol
    license=GPL
    description=FANCTRL Driver
    author=Ping Mao <[email protected]>
    alias=i2c:fancontrol
    depends=i2c_dev_sysfs
    vermagic=4.1.51-deltapower mod_unload ARMv5 p2v8
    fancontrol
    status_word
    bit 2:  Temparature Warning
    root@bmc-oob:~# cd /sys/bus/i2c/drivers/fancontrol/8-0030
    root@bmc-oob:/sys/bus/i2c/drivers/fancontrol/8-0030# grep . fan* temp* vin
    fan1_2_status:0
    fan1_speed:7860
    fan2_speed:7860
    fan3_4_status:0
    fan3_speed:7680
    fan4_speed:7560
    temperature1:292
    temperature2:278
    temperature3:286
    temperature4:302
    vin:12251
Quoted 123 lines
Quoted 123 lines
Quoted 35 lines
Quoted 35 lines

---
 MAINTAINERS                             |  6 ++ drivers/hwmon/pmbus/Kconfig             | 12 ++++ drivers/hwmon/pmbus/Makefile            |  1 + drivers/hwmon/pmbus/delta-ahe50dc-fan.c | 84 +++++++++++++++++++++++++

 4 files changed, 103 insertions(+)

 create mode 100644 drivers/hwmon/pmbus/delta-ahe50dc-fan.c

MAINTAINERS +0 -0
index 0ac052200ecb..8bb7ba52d2f5 100644
@@ -5425,6 +5425,12 @@ W:    https://linuxtv.org

 T:    git git://linuxtv.org/media_tree.git
 F:    drivers/media/platform/sti/delta

MAINTAINERS +6 -0
+DELTA AHE-50DC FAN CONTROL MODULE DRIVER
+M:    Zev Weiss <[email protected]>
+L:    [email protected]
+S:    Maintained
+F:    drivers/hwmon/pmbus/delta-ahe50dc-fan.c
+

 DELTA DPS920AB PSU DRIVER
 M:    Robert Marko <[email protected]>
 L:    [email protected]

drivers/hwmon/pmbus/Kconfig +0 -0
index ffb609cee3a4..937e1c2c11e7 100644
@@ -66,6 +66,18 @@ config SENSORS_BPA_RS600

       This driver can also be built as a module. If so, the module will be called bpa-rs600.

Quoted 4 lines
Quoted 4 lines

+config SENSORS_DELTA_AHE50DC_FAN
+    tristate "Delta AHE-50DC fan control module"
+    depends on I2C
+    select REGMAP_I2C

And I realize I neglected to drop the depends & select lines here when moving this bit into the pmbus directory...

Quoted 34 lines
Quoted 34 lines

+    help
+      If you say yes here you get hardware monitoring support for +      the integrated fan control module of the Delta AHE-50DC +      Open19 power shelf.

drivers/hwmon/pmbus/Kconfig +4 -0
+
+      This driver can also be built as a module. If so, the module
+      will be called delta-ahe50dc-fan.
+

 config SENSORS_FSP_3Y
     tristate "FSP/3Y-Power power supplies"
     help

drivers/hwmon/pmbus/Makefile +0 -0
index 0ed4d596a948..a56b2897288d 100644
@@ -9,6 +9,7 @@ obj-$(CONFIG_SENSORS_ADM1266)    += adm1266.o

 obj-$(CONFIG_SENSORS_ADM1275)    += adm1275.o obj-$(CONFIG_SENSORS_BEL_PFE)    += bel-pfe.o obj-$(CONFIG_SENSORS_BPA_RS600)    += bpa-rs600.o +obj-$(CONFIG_SENSORS_DELTA_AHE50DC_FAN) += delta-ahe50dc-fan.o obj-$(CONFIG_SENSORS_FSP_3Y)    += fsp-3y.o obj-$(CONFIG_SENSORS_IBM_CFFPS)    += ibm-cffps.o obj-$(CONFIG_SENSORS_DPS920AB)    += dps920ab.o

drivers/hwmon/pmbus/delta-ahe50dc-fan.c new file +5 -0
new file mode 100644
index 000000000000..07b1e7c5f5f5
@@ -0,0 +1,84 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Delta AHE-50DC power shelf fan control module driver
+ *
+ * Copyright 2021 Zev Weiss <[email protected]>
Quoted 8 lines

drivers/hwmon/pmbus/delta-ahe50dc-fan.c line 11

Quoted 6 lines
drivers/hwmon/pmbus/delta-ahe50dc-fan.c new file +6 -0
+ */
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/i2c.h>
+#include <linux/pmbus.h>

Alphabetic include file order please.

Ack, will fix.

Quoted 35 lines
Quoted 21 lines
drivers/hwmon/pmbus/delta-ahe50dc-fan.c new file +20 -0
+
+#include "pmbus.h"
+
+#define AHE50DC_PMBUS_READ_TEMP4 0xd0
+
+static int ahe50dc_fan_read_word_data(struct i2c_client *client, int page, int phase, int reg)
+{
+    /* temp1 in (virtual) page 1 is remapped to mfr-specific temp4 */
+    if (page == 1) {
+        if (reg == PMBUS_READ_TEMPERATURE_1)
+            return i2c_smbus_read_word_data(client, AHE50DC_PMBUS_READ_TEMP4);
+        return -EOPNOTSUPP;
+    }
+    return -ENODATA;
+}
+
+static struct pmbus_driver_info ahe50dc_fan_info = {
+    .pages = 2,
+    .format[PSC_FAN] = direct,
+    .format[PSC_TEMPERATURE] = direct,

drivers/hwmon/pmbus/delta-ahe50dc-fan.c line 41

Quoted 10 lines
drivers/hwmon/pmbus/delta-ahe50dc-fan.c new file +10 -0
+    .format[PSC_VOLTAGE_IN] = direct,
+    .m[PSC_FAN] = 1,
+    .b[PSC_FAN] = 0,
+    .R[PSC_FAN] = 0,
+    .m[PSC_TEMPERATURE] = 1,
+    .b[PSC_TEMPERATURE] = 0,
+    .R[PSC_TEMPERATURE] = 1,
+    .m[PSC_VOLTAGE_IN] = 1,
+    .b[PSC_VOLTAGE_IN] = 0,
+    .R[PSC_VOLTAGE_IN] = 3,

How did you determine the exponents ? The referenced driver doesn't seem to make a difference between voltage and temperature exponents (nor fan speed, which is a bit odd).

Quoted 9 lines
Quoted 6 lines

Lacking documentation, the honest answer here is that I just sort of eyeballed it.  However, after doing so, I dug through the code dump a bit more and found some userspace unit-conversion bits that appear to confirm what I arrived at:

https://github.com/linkedin/o19-bmc-firmware/blob/master/meta-openbmc/meta-linkedin/meta-deltapower/recipes-deltapower/platform-lib/files/powershelf/powershelf_fan.c

(Lines 107, and 153/161/169/177.)

Brr. Well, why use a standard API/ABI if one can invent a non-standard one.

It's...not the only bit of gratuitous wheel-reinvention we've come across in this particular system.

Quoted 2 lines

Can you check this with real hardware, by any chance ?

If you mean running that code on it, yes -- here's the userspace utility that invokes that library routine:

    root@bmc-oob:~# fan-util.sh
    fan1 speed: 7860 RPM
    fan2 speed: 7860 RPM
    fan3 speed: 7620 RPM
    fan4 speed: 7560 RPM
    temperature1: 29.20 C
    temperature2: 27.80 C
    temperature3: 28.50 C
    temperature4: 30.20 C
    vin_undervolt_fault: no
    overtemperature_warning: no
    fan_fault: no
    fan_warning: no
    fan_status: ok

That fan-util.sh script being this:

https://github.com/linkedin/o19-bmc-firmware/blob/master/meta-openbmc/meta-linkedin/meta-deltapower/recipes-deltapower/liutils/files/fan-util.sh

which invokes this:

https://github.com/linkedin/o19-bmc-firmware/blob/master/meta-openbmc/meta-linkedin/meta-deltapower/recipes-deltapower/liutils/files/fan-ctrl/fan-util.c

(which calls into the routine in powershelf_fan.c linked above).

Zev

author maintainer
#6 lore raw
Quoted 209 lines · Zev Weiss
Quoted 13 lines · Guenter Roeck
Quoted 12 lines · Zev Weiss
Quoted 11 lines · Guenter Roeck
Quoted 9 lines · Zev Weiss

This device is an integrated module of the Delta AHE-50DC Open19 power shelf.  For lack of proper documentation, this driver has been developed referencing an existing (GPL) driver that was included in a code release from LinkedIn [1].  It provides four fan speeds, four temperatures, and one voltage reading, as well as a handful of warning and fault indicators.

[1] https://github.com/linkedin/o19-bmc-firmware/blob/master/meta-openbmc/meta-linkedin/meta-deltapower/recipes-kernel/fancontrol-mod/files/fancontrol.c

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

Hmm, that reference isn't really accurate anymore. I think it would be better to just say that the device was found to be PMBus compliant.

Sure, will do.

Makes me wonder: How do you know that the referenced driver is for Delta AHE-50DC ?

We'd been waiting for the source code for the software it ships with for a while, and were finally provided with that repo; everything I've observed from the factory software is consistent with the code in that driver. A sampling:

   # no modinfo command available, but...
   root@bmc-oob:~# strings -n8 /lib/modules/4.1.51-deltapower/extra/fancontrol.ko | head
   fancontrol
   license=GPL
   description=FANCTRL Driver
   author=Ping Mao <[email protected]>
   alias=i2c:fancontrol
   depends=i2c_dev_sysfs
   vermagic=4.1.51-deltapower mod_unload ARMv5 p2v8
   fancontrol
   status_word
   bit 2:  Temparature Warning
   root@bmc-oob:~# cd /sys/bus/i2c/drivers/fancontrol/8-0030
   root@bmc-oob:/sys/bus/i2c/drivers/fancontrol/8-0030# grep . fan* temp* vin
   fan1_2_status:0
   fan1_speed:7860
   fan2_speed:7860
   fan3_4_status:0
   fan3_speed:7680
   fan4_speed:7560
   temperature1:292
   temperature2:278
   temperature3:286
   temperature4:302
   vin:12251
Quoted 123 lines
Quoted 123 lines
Quoted 35 lines
Quoted 35 lines

---
 MAINTAINERS                             |  6 ++ drivers/hwmon/pmbus/Kconfig             | 12 ++++ drivers/hwmon/pmbus/Makefile            |  1 + drivers/hwmon/pmbus/delta-ahe50dc-fan.c | 84 +++++++++++++++++++++++++

 4 files changed, 103 insertions(+)

 create mode 100644 drivers/hwmon/pmbus/delta-ahe50dc-fan.c

MAINTAINERS +0 -0
index 0ac052200ecb..8bb7ba52d2f5 100644
@@ -5425,6 +5425,12 @@ W:    https://linuxtv.org

 T:    git git://linuxtv.org/media_tree.git
 F:    drivers/media/platform/sti/delta

MAINTAINERS +6 -0
+DELTA AHE-50DC FAN CONTROL MODULE DRIVER
+M:    Zev Weiss <[email protected]>
+L:    [email protected]
+S:    Maintained
+F:    drivers/hwmon/pmbus/delta-ahe50dc-fan.c
+

 DELTA DPS920AB PSU DRIVER
 M:    Robert Marko <[email protected]>
 L:    [email protected]

drivers/hwmon/pmbus/Kconfig +0 -0
index ffb609cee3a4..937e1c2c11e7 100644
@@ -66,6 +66,18 @@ config SENSORS_BPA_RS600

       This driver can also be built as a module. If so, the module will be called bpa-rs600.

Quoted 4 lines
Quoted 4 lines

+config SENSORS_DELTA_AHE50DC_FAN
+    tristate "Delta AHE-50DC fan control module"
+    depends on I2C
+    select REGMAP_I2C

And I realize I neglected to drop the depends & select lines here when moving this bit into the pmbus directory...

Quoted 34 lines
Quoted 34 lines

+    help
+      If you say yes here you get hardware monitoring support for +      the integrated fan control module of the Delta AHE-50DC +      Open19 power shelf.

drivers/hwmon/pmbus/Kconfig +4 -0
+
+      This driver can also be built as a module. If so, the module
+      will be called delta-ahe50dc-fan.
+

 config SENSORS_FSP_3Y
     tristate "FSP/3Y-Power power supplies"
     help

drivers/hwmon/pmbus/Makefile +0 -0
index 0ed4d596a948..a56b2897288d 100644
@@ -9,6 +9,7 @@ obj-$(CONFIG_SENSORS_ADM1266)    += adm1266.o

 obj-$(CONFIG_SENSORS_ADM1275)    += adm1275.o obj-$(CONFIG_SENSORS_BEL_PFE)    += bel-pfe.o obj-$(CONFIG_SENSORS_BPA_RS600)    += bpa-rs600.o +obj-$(CONFIG_SENSORS_DELTA_AHE50DC_FAN) += delta-ahe50dc-fan.o obj-$(CONFIG_SENSORS_FSP_3Y)    += fsp-3y.o obj-$(CONFIG_SENSORS_IBM_CFFPS)    += ibm-cffps.o obj-$(CONFIG_SENSORS_DPS920AB)    += dps920ab.o

drivers/hwmon/pmbus/delta-ahe50dc-fan.c new file +5 -0
new file mode 100644
index 000000000000..07b1e7c5f5f5
@@ -0,0 +1,84 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Delta AHE-50DC power shelf fan control module driver
+ *
+ * Copyright 2021 Zev Weiss <[email protected]>
Quoted 8 lines

drivers/hwmon/pmbus/delta-ahe50dc-fan.c line 11

Quoted 6 lines
drivers/hwmon/pmbus/delta-ahe50dc-fan.c new file +6 -0
+ */
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/i2c.h>
+#include <linux/pmbus.h>

Alphabetic include file order please.

Ack, will fix.

Quoted 35 lines
Quoted 21 lines
drivers/hwmon/pmbus/delta-ahe50dc-fan.c new file +20 -0
+
+#include "pmbus.h"
+
+#define AHE50DC_PMBUS_READ_TEMP4 0xd0
+
+static int ahe50dc_fan_read_word_data(struct i2c_client *client, int page, int phase, int reg)
+{
+    /* temp1 in (virtual) page 1 is remapped to mfr-specific temp4 */
+    if (page == 1) {
+        if (reg == PMBUS_READ_TEMPERATURE_1)
+            return i2c_smbus_read_word_data(client, AHE50DC_PMBUS_READ_TEMP4);
+        return -EOPNOTSUPP;
+    }
+    return -ENODATA;
+}
+
+static struct pmbus_driver_info ahe50dc_fan_info = {
+    .pages = 2,
+    .format[PSC_FAN] = direct,
+    .format[PSC_TEMPERATURE] = direct,

drivers/hwmon/pmbus/delta-ahe50dc-fan.c line 41

Quoted 10 lines
drivers/hwmon/pmbus/delta-ahe50dc-fan.c new file +10 -0
+    .format[PSC_VOLTAGE_IN] = direct,
+    .m[PSC_FAN] = 1,
+    .b[PSC_FAN] = 0,
+    .R[PSC_FAN] = 0,
+    .m[PSC_TEMPERATURE] = 1,
+    .b[PSC_TEMPERATURE] = 0,
+    .R[PSC_TEMPERATURE] = 1,
+    .m[PSC_VOLTAGE_IN] = 1,
+    .b[PSC_VOLTAGE_IN] = 0,
+    .R[PSC_VOLTAGE_IN] = 3,

How did you determine the exponents ? The referenced driver doesn't seem to make a difference between voltage and temperature exponents (nor fan speed, which is a bit odd).

Quoted 9 lines
Quoted 6 lines

Lacking documentation, the honest answer here is that I just sort of eyeballed it.  However, after doing so, I dug through the code dump a bit more and found some userspace unit-conversion bits that appear to confirm what I arrived at:

https://github.com/linkedin/o19-bmc-firmware/blob/master/meta-openbmc/meta-linkedin/meta-deltapower/recipes-deltapower/platform-lib/files/powershelf/powershelf_fan.c

(Lines 107, and 153/161/169/177.)

Brr. Well, why use a standard API/ABI if one can invent a non-standard one.

It's...not the only bit of gratuitous wheel-reinvention we've come across in this particular system.

Quoted 2 lines

Can you check this with real hardware, by any chance ?

If you mean running that code on it, yes -- here's the userspace utility that invokes that library routine:

   root@bmc-oob:~# fan-util.sh
   fan1 speed: 7860 RPM
   fan2 speed: 7860 RPM
   fan3 speed: 7620 RPM
   fan4 speed: 7560 RPM
   temperature1: 29.20 C
   temperature2: 27.80 C
   temperature3: 28.50 C
   temperature4: 30.20 C
   vin_undervolt_fault: no
   overtemperature_warning: no
   fan_fault: no
   fan_warning: no
   fan_status: ok

That fan-util.sh script being this:

Quoted 8 lines

https://github.com/linkedin/o19-bmc-firmware/blob/master/meta-openbmc/meta-linkedin/meta-deltapower/recipes-deltapower/liutils/files/fan-util.sh

which invokes this:

https://github.com/linkedin/o19-bmc-firmware/blob/master/meta-openbmc/meta-linkedin/meta-deltapower/recipes-deltapower/liutils/files/fan-ctrl/fan-util.c

(which calls into the routine in powershelf_fan.c linked above).

...though I think I accidentally glossed over some additional steps in beteween there; looks like there's actually another daemon involved that does the read from the sysfs files and the unit normalization and then drops the resulting data into a file that fan-util.c then reads:

https://github.com/linkedin/o19-bmc-firmware/blob/master/meta-openbmc/meta-linkedin/meta-deltapower/recipes-core/health-mon/files/healthmon.c

Anyway, the upshot is that I'm fairly confident that the code there is in fact what's running on the device as shipped from the factory, and I think the coefficients I determined for the pmbus driver should handle it appropriately. (It produces readings that align with what the factory software gives and are generally sane-looking.)

Zev

maintainer
#7 lore raw
In reply to Zev Weiss
Quoted 17 lines · Zev Weiss
Quoted 16 lines · Guenter Roeck
Quoted 15 lines · Zev Weiss
Quoted 13 lines · Guenter Roeck
Quoted 9 lines · Zev Weiss

This device is an integrated module of the Delta AHE-50DC Open19 power shelf.  For lack of proper documentation, this driver has been developed referencing an existing (GPL) driver that was included in a code release from LinkedIn [1].  It provides four fan speeds, four temperatures, and one voltage reading, as well as a handful of warning and fault indicators.

[1] https://github.com/linkedin/o19-bmc-firmware/blob/master/meta-openbmc/meta-linkedin/meta-deltapower/recipes-kernel/fancontrol-mod/files/fancontrol.c

Hmm, that reference isn't really accurate anymore. I think it would be better to just say that the device was found to be PMBus compliant.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Sure, will do.

Makes me wonder: How do you know that the referenced driver is for Delta AHE-50DC ?

We'd been waiting for the source code for the software it ships with for a while, and were finally provided with that repo; everything I've observed from the factory software is consistent with the code in that driver.  A sampling:

I assume you mean "Delta AHE-50DC" when you refer to "it".

[ ... ]

Quoted 5 lines
Quoted 2 lines

Can you check this with real hardware, by any chance ?

If you mean running that code on it, yes -- here's the userspace utility that invokes that library routine:

Quoted 15 lines
     root@bmc-oob:~# fan-util.sh
     fan1 speed: 7860 RPM
     fan2 speed: 7860 RPM
     fan3 speed: 7620 RPM
     fan4 speed: 7560 RPM
     temperature1: 29.20 C
     temperature2: 27.80 C
     temperature3: 28.50 C
     temperature4: 30.20 C
     vin_undervolt_fault: no
     overtemperature_warning: no
     fan_fault: no
     fan_warning: no
     fan_status: ok

That doesn't really tell me anything in the context of the driver you submitted. Would it be possible to install your driver and provide the output from the "sensors" command ? It should match the information from the proprietary driver/tool.

Thanks,
Guenter

author maintainer
#8 lore raw
Quoted 21 lines · Guenter Roeck
Quoted 20 lines · Zev Weiss
Quoted 19 lines · Guenter Roeck
Quoted 17 lines · Zev Weiss
Quoted 8 lines · Guenter Roeck
Quoted 7 lines · Zev Weiss

This device is an integrated module of the Delta AHE-50DC Open19 power shelf.  For lack of proper documentation, this driver has been developed referencing an existing (GPL) driver that was included in a code release from LinkedIn [1].  It provides four fan speeds, four temperatures, and one voltage reading, as well as a handful of warning and fault indicators.

Quoted 5 lines
Quoted 2 lines

[1] https://github.com/linkedin/o19-bmc-firmware/blob/master/meta-openbmc/meta-linkedin/meta-deltapower/recipes-kernel/fancontrol-mod/files/fancontrol.c

Hmm, that reference isn't really accurate anymore. I think it would be better to just say that the device was found to be PMBus compliant.

Sure, will do.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

Makes me wonder: How do you know that the referenced driver is for Delta AHE-50DC ?

We'd been waiting for the source code for the software it ships with for a while, and were finally provided with that repo; everything I've observed from the factory software is consistent with the code in that driver.  A sampling:

I assume you mean "Delta AHE-50DC" when you refer to "it".

Yes.

Quoted 22 lines

[ ... ]

Quoted 5 lines
Quoted 2 lines

Can you check this with real hardware, by any chance ?

If you mean running that code on it, yes -- here's the userspace utility that invokes that library routine:

Quoted 15 lines
    root@bmc-oob:~# fan-util.sh
    fan1 speed: 7860 RPM
    fan2 speed: 7860 RPM
    fan3 speed: 7620 RPM
    fan4 speed: 7560 RPM
    temperature1: 29.20 C
    temperature2: 27.80 C
    temperature3: 28.50 C
    temperature4: 30.20 C
    vin_undervolt_fault: no
    overtemperature_warning: no
    fan_fault: no
    fan_warning: no
    fan_status: ok
Quoted 5 lines

That doesn't really tell me anything in the context of the driver you submitted. Would it be possible to install your driver and provide the output from the "sensors" command ? It should match the information from the proprietary driver/tool.

Thanks, in doing so I realized I'd neglected to prevent reads from unsupported registers in the read_word_data function, which was leading to the driver producing sysfs files for meaningless sensor limits that the device doesn't actually support. With that fix (which I'll include in v4):

    root@ahe-50dc:~# /tmp/sensors 'ahe50dc_fan-*'
    ahe50dc_fan-i2c-28-30
    Adapter: i2c-8-mux (chan_id 0)
    vin:          12.29 V  
    fan1:        7680 RPM
    fan2:        7860 RPM
    fan3:        7680 RPM
    fan4:        7380 RPM
    temp1:        +27.8 C  
    temp2:        +23.4 C  
    temp3:        +25.3 C  
    temp4:        +24.5 C  

Zev

maintainer
#9 lore raw
Quoted 54 lines · Zev Weiss
Quoted 21 lines · Guenter Roeck
Quoted 20 lines · Zev Weiss
Quoted 19 lines · Guenter Roeck
Quoted 17 lines · Zev Weiss
Quoted 8 lines · Guenter Roeck
Quoted 7 lines · Zev Weiss

This device is an integrated module of the Delta AHE-50DC Open19 power shelf.  For lack of proper documentation, this driver has been developed referencing an existing (GPL) driver that was included in a code release from LinkedIn [1].  It provides four fan speeds, four temperatures, and one voltage reading, as well as a handful of warning and fault indicators.

Quoted 5 lines
Quoted 2 lines

[1] https://github.com/linkedin/o19-bmc-firmware/blob/master/meta-openbmc/meta-linkedin/meta-deltapower/recipes-kernel/fancontrol-mod/files/fancontrol.c

Hmm, that reference isn't really accurate anymore. I think it would be better to just say that the device was found to be PMBus compliant.

Sure, will do.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

Makes me wonder: How do you know that the referenced driver is for Delta AHE-50DC ?

We'd been waiting for the source code for the software it ships with for a while, and were finally provided with that repo; everything I've observed from the factory software is consistent with the code in that driver.  A sampling:

I assume you mean "Delta AHE-50DC" when you refer to "it".

Yes.

Quoted 22 lines

[ ... ]

Quoted 20 lines
Quoted 2 lines

Can you check this with real hardware, by any chance ?

If you mean running that code on it, yes -- here's the userspace utility that invokes that library routine:

    root@bmc-oob:~# fan-util.sh
    fan1 speed: 7860 RPM
    fan2 speed: 7860 RPM
    fan3 speed: 7620 RPM
    fan4 speed: 7560 RPM
    temperature1: 29.20 C
    temperature2: 27.80 C
    temperature3: 28.50 C
    temperature4: 30.20 C
    vin_undervolt_fault: no
    overtemperature_warning: no
    fan_fault: no
    fan_warning: no
    fan_status: ok
Quoted 8 lines
Quoted 5 lines

That doesn't really tell me anything in the context of the driver you submitted. Would it be possible to install your driver and provide the output from the "sensors" command ? It should match the information from the proprietary driver/tool.

Thanks, in doing so I realized I'd neglected to prevent reads from unsupported registers in the read_word_data function, which was leading to the driver producing sysfs files for meaningless sensor limits that the device doesn't actually support.  With that fix (which I'll include in v4):

What a surprise. See drivers/hwmon/pmbus/dps920ab.c; that seems to be a common theme for devices from Delta. I would suggest to add a similar comment.

Guenter

maintainer
#10 lore raw
In reply to Zev Weiss
Quoted 9 lines · Zev Weiss
Quoted 8 lines · Guenter Roeck
Quoted 7 lines · Zev Weiss

This device is an integrated module of the Delta AHE-50DC Open19 power shelf.  For lack of proper documentation, this driver has been developed referencing an existing (GPL) driver that was included in a code release from LinkedIn [1].  It provides four fan speeds, four temperatures, and one voltage reading, as well as a handful of warning and fault indicators.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

[1] https://github.com/linkedin/o19-bmc-firmware/blob/master/meta-openbmc/meta-linkedin/meta-deltapower/recipes-kernel/fancontrol-mod/files/fancontrol.c

Hmm, that reference isn't really accurate anymore. I think it would be better to just say that the device was found to be PMBus compliant.

Sure, will do.

Makes me wonder: How do you know that the referenced driver is for Delta AHE-50DC ?

Guenter

author maintainer
#11 lore raw

PATCH v3 2/2 dt-bindings: add Delta AHE-50DC fan control module

In reply to Zev Weiss

This is the integrated fan control module of the Delta AHE-50DC Open19 power shelf.

---
 Documentation/devicetree/bindings/trivial-devices.yaml | 2 ++
 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/trivial-devices.yaml +2 -0
index 791079021f1b..1c43cc91f804 100644
@@ -73,6 +73,8 @@ properties:
           - dallas,ds4510
             # Digital Thermometer and Thermostat
           - dallas,ds75
+            # Delta AHE-50DC Open19 power shelf fan control module
+          - delta,ahe50dc-fan
             # Delta Electronics DPS-650-AB power supply
           - delta,dps650ab
           # Delta Electronics DPS920AB 920W 54V Power Supply
Signature · 1 line
2.34.1
#12 lore raw

Re: [PATCH v3 2/2] dt-bindings: add Delta AHE-50DC fan control module

Quoted 7 lines · Zev Weiss

This is the integrated fan control module of the Delta AHE-50DC Open19 power shelf.

---
 Documentation/devicetree/bindings/trivial-devices.yaml | 2 ++
 1 file changed, 2 insertions(+)

This is a third version sent within one night, without changelog and any indication why sending the same three times. Please do not send multiple versions the same day and give people some time to respond. When creating a new version, add a changelog under ---.

Quoted 7 lines
Documentation/devicetree/bindings/trivial-devices.yaml +0 -0
index 791079021f1b..1c43cc91f804 100644

Documentation/devicetree/bindings/trivial-devices.yaml properties: · line 80

Quoted 8 lines
Documentation/devicetree/bindings/trivial-devices.yaml +2 -0
@@ -73,6 +73,8 @@ properties:
           - dallas,ds4510
             # Digital Thermometer and Thermostat
           - dallas,ds75
+            # Delta AHE-50DC Open19 power shelf fan control module
+          - delta,ahe50dc-fan
             # Delta Electronics DPS-650-AB power supply
           - delta,dps650ab
           # Delta Electronics DPS920AB 920W 54V Power Supply

Best regards,
Krzysztof

author maintainer
#13 lore raw

Re: [PATCH v3 2/2] dt-bindings: add Delta AHE-50DC fan control module

Quoted 9 lines · Krzysztof Kozlowski
Quoted 7 lines · Zev Weiss

This is the integrated fan control module of the Delta AHE-50DC Open19 power shelf.

---
 Documentation/devicetree/bindings/trivial-devices.yaml | 2 ++
 1 file changed, 2 insertions(+)
Quoted 5 lines

This is a third version sent within one night, without changelog and any indication why sending the same three times. Please do not send multiple versions the same day and give people some time to respond. When creating a new version, add a changelog under ---.

Sorry for the noise -- I wrote changelogs in the cover letter (https://lore.kernel.org/linux-hwmon/[email protected]/), but forgot to include all the recipients of the component patches in the CC list of the cover (which I presume would have been preferred), I just used git send-email's --cc-cmd flag with get_maintainer.pl.

Zev