Skip to contentSkip to conversation

hwmon: (pmbus) Move pec attribute to I2C device

PATCH New Guenter Roeck 1 participant 1 message May 21, 2022

Subsystems (2)
lore
Share & tools
lore

Guenter Roeck

author maintainer
#0 lore raw

PATCH 1/1 hwmon: (pmbus) Move pec attribute to I2C device

Enabling and disabling PEC for PMBus devices is currently only supported with a debugfs attribute, which requires debugfs to be enabled and is thus less than perfect. Take the lm90 driver as example and add a 'pec' attribute to the I2C device if both the I2C adapter and the PMBus device support it. Remove the now obsolete 'pec' attribute from debugfs.

---
 Documentation/ABI/testing/sysfs-class-hwmon |  9 +++
 Documentation/hwmon/pmbus-core.rst          |  9 +++
 drivers/hwmon/pmbus/pmbus_core.c            | 89 ++++++++++++---------
 3 files changed, 68 insertions(+), 39 deletions(-)
Documentation/ABI/testing/sysfs-class-hwmon +9 -0
index 653d4c75eddb..7271781a23b2 100644
@@ -938,3 +938,12 @@ Description:
 		- 1: enable
 
 		RW
+
+What:		/sys/class/hwmon/hwmonX/device/pec
+Description:
+		PEC support on I2C devices
+
+		- 0, off, n: disable
+		- 1, on, y: enable
+
+		RW
Documentation/hwmon/pmbus-core.rst +9 -0
index e7e0c9ef10be..84c5a4e40c40 100644
@@ -121,6 +121,15 @@ Specifically, it provides the following information.
   non-standard PMBus commands to standard commands, or to augment standard
   command return values with device specific information.
 
+PEC Support
+===========
+
+Many PMBus devices support SMBus PEC (Packet Error Checking). If supported
+by both the I2C adapter and by the PMBus chip, it is by default enabled.
+If PEC is supported, the PMBus core driver adds an attribute named 'pec' to
+the I2C device. This attribute can be used to control PEC support in the
+communication with the PMBus chip.
+
 API functions
 =============
 
drivers/hwmon/pmbus/pmbus_core.c +50 -39

113 lines not on this page · raw message

Signature · 1 line
2.35.1