Skip to contentSkip to conversation

hwmon: PMBus device driver

PATCH Superseded Guenter Roeck 2 participants 8 messages Jul 5, 2010 – Jul 6, 2010

Subsystems (4)

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v2 cover hwmon: PMBus device driver

This patchset adds support for hardware monitoring features of PMBus devices.

The driver has not yet been tested with actual hardware. It is submitted for early review and to solicit test coverage.

A PMBus device emulator is provided for reference, to show the level of testing performed. I don't currently plan to submit this emulator in the final patchset. If there is interest to have it included, and if someone is willing to review the code, I will be happy to clean it up and include it.

I will test the driver with real HW for BMR453 and LTC2978 as soon as I get access to it. For other devices, I will add a remark that support is untested, unless I get feedback that a specific device was tested and is working.

---
Open issues/questions:
- The driver adds new power monitoring attributes to the hwmon sysfs API. Need to get feedback if those are acceptable.
- Currently no support for chips with multiple phases (PHASE command). Adding this will require access to a system with a chip supporting multiple phases (e.g., UCD9240/46/48) to determine a feasible implementation.
- Need to add support for COEFFICIENTS command. Will require system with real chip for testing, or will not add support at this time.
- Need to add fan support. Will require system with real chip for testing, or will not add support at this time.
Datasheets of chips with fan control support indicate that chip specific code may be necessary. See UCD9240 or UCD90124 datasheets.

---
v2 changes:
- Calculate maximum number of attributes / sensors / booleans / labels instead of using defines
- Increased maximum number of supported pages to the PMBus maximum of 32.
- Replaced most fixed size arrays with dynamically allocated arrays/structures.
- Added comments and clarifications
- Renamed local defines to start with PB_ or PMBUS_ prefix
- Removed pages module parameter. Replaced with code to auto-detect the number of supported pages.
- Split probe code into several functions to make it better readable
- Replaced _fault attributes with _lcrit_alarm and _crit_alarm attributes
- Several other minor changes to address review feedback
- PMBus emulator: Fixed fault status detection code. Also use more reasonable power limits (eg 200W instead of 2kW).

#1 lore raw

PATCH v2 1/4 hwmon: PMBus device driver

This driver adds support for hardware monitoring features of various PMBus devices.

---
 drivers/hwmon/Kconfig  |   12 +
 drivers/hwmon/Makefile |    1 +
 drivers/hwmon/pmbus.c  | 1396 ++++++++++++++++++++++++++++++++++++++++++++++++
 drivers/hwmon/pmbus.h  |  209 ++++++++
 4 files changed, 1618 insertions(+), 0 deletions(-)
 create mode 100644 drivers/hwmon/pmbus.c
 create mode 100644 drivers/hwmon/pmbus.h
drivers/hwmon/Kconfig +12 -0
index e19cf8e..8d53cf7 100644
@@ -702,6 +702,18 @@ config SENSORS_PCF8591
 	  These devices are hard to detect and rarely found on mainstream
 	  hardware.  If unsure, say N.
 
+config SENSORS_PMBUS
+	tristate "PMBus devices"
+	depends on I2C && EXPERIMENTAL
+	default n
+	help
+	  If you say yes here you get hardware monitoring support for various
+	  PMBus devices, including but not limited to BMR45x, LTC2978, MAX16064,
+	  MAX8688, and UCD92xx.
+
+	  This driver can also be built as a module. If so, the module will
+	  be called pmbus.
+
 config SENSORS_SHT15
 	tristate "Sensiron humidity and temperature sensors. SHT15 and compat."
 	depends on GENERIC_GPIO
drivers/hwmon/Makefile +1 -0
index 2138ceb..88b043e 100644
@@ -83,6 +83,7 @@ obj-$(CONFIG_SENSORS_MC13783_ADC)+= mc13783-adc.o
 obj-$(CONFIG_SENSORS_PC87360)	+= pc87360.o
 obj-$(CONFIG_SENSORS_PC87427)	+= pc87427.o
 obj-$(CONFIG_SENSORS_PCF8591)	+= pcf8591.o
+obj-$(CONFIG_SENSORS_PMBUS)	+= pmbus.o
 obj-$(CONFIG_SENSORS_S3C)	+= s3c-hwmon.o
 obj-$(CONFIG_SENSORS_SHT15)	+= sht15.o
 obj-$(CONFIG_SENSORS_SIS5595)	+= sis5595.o
drivers/hwmon/pmbus.c new file +1396 -0

1,396 lines not on this page · raw message

drivers/hwmon/pmbus.h new file +209 -0

209 lines not on this page · raw message

Signature · 1 line
1.7.0.87.g0901d
#2 lore raw

PATCH v2 2/4 hwmon: i2c PMBus device emulator

In reply to Guenter Roeck
---
 Documentation/i2c/i2c-pmbus    |   41 ++
 drivers/i2c/busses/Kconfig     |   13 +
 drivers/i2c/busses/Makefile    |    1 +
 drivers/i2c/busses/i2c-pmbus.c |  877 ++++++++++++++++++++++++++++++++++++++++
 4 files changed, 932 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/i2c/i2c-pmbus
 create mode 100644 drivers/i2c/busses/i2c-pmbus.c
Documentation/i2c/i2c-pmbus new file +41 -0
new file mode 100644
index 0000000..4ba01fc
@@ -0,0 +1,41 @@
+MODULE: i2c-pmbus
+
+DESCRIPTION:
+
+This module is a fake I2C/SMBus driver to emulate various PMBus devices.
+It implements five types of SMBus commands: write quick, (r/w) byte,
+(r/w) byte data, (r/w) word data, and (r/w) I2C block data.
+
+The driver supports various PMBus devices at fixed addresses. The following
+PMBus devices are supported.
+
+Device	        Address
+BMR453	        0x10
+LTC2978	        0x20
+MAX16064	0x30
+MAX8688	        0x40
+UCD9240         0x50
+
+No hardware is needed nor associated with this module.  It will accept write
+quick commands to the specified addresses; it will respond to the other
+commands (also to the specified addresses) by reading from or writing to
+arrays in memory.
+
+Once loaded, the driver randomly changes sensor readings, up to lower and upper
+fault limits. This may cause alarms or faults to be raised. This is expected
+behavior.
+
+The typical use-case is like this:
+	1. load this module
+	3. load the target chip driver module
+	4. observe its behavior using the sensors command
+
+
+CAVEATS:
+
+Support for multiple pages (PMBus PAGE command) is limited. Pages can be
+selected, but there is only one set of data, causing all paged registers to
+return the same values.
+
+The emulator does not support self-modification of sensor readings for devices
+which have to be programmed in direct mode.
drivers/i2c/busses/Kconfig +13 -0
index bceafbf..5ab4abc 100644
@@ -731,6 +731,19 @@ config I2C_PCA_ISA
 	  delays when I2C/SMBus chip drivers are loaded (e.g. at boot
 	  time).  If unsure, say N.
 
+config I2C_PMBUS
+	tristate "I2C/PMBus Chip Emulator"
+	depends on EXPERIMENTAL
+	default 'n'
+	help
+	  This module emulates various PMBus devices. It may be useful to
+	  developers of PMBus client drivers.
+
+	  If you do build this module, be sure to read the notes and warnings
+	  in <file:Documentation/i2c/i2c-pmbus>.
+
+	  If you don't know what to do here, definitely say N.
+
 config I2C_SIBYTE
 	tristate "SiByte SMBus interface"
 	depends on SIBYTE_SB1xxx_SOC
drivers/i2c/busses/Makefile +1 -0
index 936880b..c11884e 100644
@@ -70,6 +70,7 @@ obj-$(CONFIG_I2C_TINY_USB)	+= i2c-tiny-usb.o
 obj-$(CONFIG_I2C_ACORN)		+= i2c-acorn.o
 obj-$(CONFIG_I2C_ELEKTOR)	+= i2c-elektor.o
 obj-$(CONFIG_I2C_PCA_ISA)	+= i2c-pca-isa.o
+obj-$(CONFIG_I2C_PMBUS)		+= i2c-pmbus.o
 obj-$(CONFIG_I2C_SIBYTE)	+= i2c-sibyte.o
 obj-$(CONFIG_I2C_STUB)		+= i2c-stub.o
 obj-$(CONFIG_SCx200_ACB)	+= scx200_acb.o
drivers/i2c/busses/i2c-pmbus.c new file +877 -0

877 lines not on this page · raw message

Signature · 1 line
1.7.0.87.g0901d
#3 lore raw

PATCH v2 3/4 hwmon: pmbus driver documentation

In reply to Guenter Roeck
---
 Documentation/hwmon/pmbus |  139 +++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 139 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/hwmon/pmbus
Documentation/hwmon/pmbus new file +139 -0
new file mode 100644
index 0000000..f5c256b
@@ -0,0 +1,139 @@
+Kernel driver pmbus
+====================
+
+Supported chips:
+  * Ericsson BMR45X series
+    DC/DC Converter
+    Prefix: 'bmr45x'
+    Addresses scanned: -
+    Datasheet:
+ http://archive.ericsson.net/service/internet/picov/get?DocNo=28701-EN/LZT146395
+  * Linear Technology LTC2978
+    Octal PMBus Power Supply Monitor and Controller
+    Prefix: 'ltc2978'
+    Addresses scanned: -
+    Datasheet: http://cds.linear.com/docs/Datasheet/2978fa.pdf
+  * Maxim MAX16064
+    Quad Power-Supply Controller
+    Prefix: 'max16064'
+    Addresses scanned: -
+    Datasheet: http://datasheets.maxim-ic.com/en/ds/MAX16064.pdf
+  * Maxim MAX8688
+    Digital Power-Supply Controller/Monitor
+    Prefix: 'max8688'
+    Addresses scanned: -
+    Datasheet: http://datasheets.maxim-ic.com/en/ds/MAX8688.pdf
+  * Texas Instruments UCD92xx
+    Digital PWM System Controller
+    Prefix: 'ucd921x', 'ucd9220', 'ucd9240'
+    Addresses scanned: -
+    Datasheet: http://focus.ti.com/lit/ds/symlink/ucd9240.pdf
+  * Generic PMBus devices
+    Prefix: 'pmbus'
+    Addresses scanned: -
+    Datasheet: n.a.
+
+Author: Guenter Roeck <guenter.roeck-IzeFyvvaP7pWk0Htik3J/[email protected]>
+
+
+Description
+-----------
+
+This driver supports hardware montoring for various PMBus compliant devices.
+It supports voltage, current, power, and temperature sensors as supported
+by the device.
+
+Each monitored channel has its own high and low limits, plus a critical
+limit.
+
+
+Usage Notes
+-----------
+
+This driver does not probe for PMBus devices, since there is no register
+which can be safely used to identify the chip (The MFG_ID register is not
+supported by all chips), and since there is no well defined address range for
+PMBus devices. You will have to instantiate the devices explicitly.
+
+Example: the following will load the driver for an LTC2978 at address 0x60
+on I2C bus #1:
+$ modprobe pmbus
+$ echo ltc2978 0x60 > /sys/bus/i2c/devices/i2c-1/new_device
+
+
+Sysfs entries
+-------------
+
+When probing the chip, the driver identifies which PMBus registers are
+supported, and determines available sensors from this information.
+Attribute files only exist if respective sensors are suported by the chip.
+Labels are provided to inform the user about the sensor associated with
+a given sysfs entry.
+
+The following attributes are supported. Limits are read-write; all other
+attributes are read-only.
+
+inX_input		Measured voltage. From READ_VIN or READ_VOUT register.
+inX_min			Minumum Voltage.
+			From VIN_UV_WARN_LIMIT or VOUT_UV_WARN_LIMIT register.
+inX_max			Maximum voltage.
+			From VIN_OV_WARN_LIMIT or VOUT_OV_WARN_LIMIT register.
+inX_lcrit		Critical minumum Voltage.
+			From VIN_UV_FAULT_LIMIT or VOUT_UV_FAULT_LIMIT register.
+inX_crit		Critical maximum voltage.
+			From VIN_OV_FAULT_LIMIT or VOUT_OV_FAULT_LIMIT register.
+inX_min_alarm		Voltage low alarm. From VOLTAGE_UV_WARNING status.
+inX_max_alarm		Voltage high alarm. From VOLTAGE_OV_WARNING status.
+inX_lcrit_alarm		Voltage critical low alarm.
+			From VOLTAGE_UV_FAULT status.
+inX_crit_alarm		Voltage critical high alarm.
+			From VOLTAGE_OV_FAULT status.
+inX_label		"vin", "vcap", or "voutY"
+
+currX_input		Measured current. From READ_IIN or READ_IOUT register.
+currX_max		Maximum current.
+			From IIN_OC_WARN_LIMIT or IOUT_OC_WARN_LIMIT register.
+currX_lcrit		Critical minumum output current.
+			From IOUT_UC_FAULT_LIMIT register.
+currX_crit		Critical maximum current.
+			From IIN_OC_FAULT_LIMIT or IOUT_OC_FAULT_LIMIT register.
+currX_alarm		Current high alarm.
+			From IIN_OC_WARNING or IOUT_OC_WARNING status.
+currX_lcrit_alarm	Output current critical low alarm.
+			From IOUT_UC_FAULT status.
+currX_crit_alarm	Current critical high alarm.
+			From IIN_OC_FAULT or IOUT_OC_FAULT status.
+currX_label		"iin" or "vinY"
+
+powerX_input		Measured power. From READ_PIN or READ_POUT register.
+powerX_cap		Output power cap. From POUT_MAX register.
+powerX_max		Power limit. From PIN_OP_WARN_LIMIT or
+			POUT_OP_WARN_LIMIT register.
+powerX_crit		Critical output power limit.
+			From POUT_OP_FAULT_LIMIT register.
+powerX_alarm		Power high alarm.
+			From PIN_OP_WARNING or POUT_OP_WARNING status.
+powerX_crit_alarm	Output power critical high alarm.
+			From POUT_OP_FAULT status.
+powerX_label		"pin" or "poutY"
+
+tempX_input		Measured tempererature.
+			From READ_TEMPERATURE_X register.
+tempX_min		Mimimum tempererature. From UT_WARN_LIMIT register.
+tempX_max		Maximum tempererature. From OT_WARN_LIMIT register.
+tempX_lcrit		Critical low tempererature.
+			From UT_FAULT_LIMIT register.
+tempX_crit		Critical high tempererature.
+			From OT_FAULT_LIMIT register.
+tempX_min_alarm		Chip temperature low alarm. Set by comparing
+			READ_TEMPERATURE_X with UT_WARN_LIMIT if
+			TEMP_UT_WARNING status is set.
+tempX_max_alarm		Chip temperature high alarm. Set by comparing
+			READ_TEMPERATURE_X with OT_WARN_LIMIT if
+			TEMP_OT_WARNING status is set.
+tempX_lcrit_alarm	Chip temperature critical low alarm. Set by comparing
+			READ_TEMPERATURE_X with UT_FAULT_LIMIT if
+			TEMP_UT_FAULT status is set.
+tempX_crit_alarm	Chip temperature critical high alarm. Set by comparing
+			READ_TEMPERATURE_X with OT_FAULT_LIMIT if
+			TEMP_OT_FAULT status is set.
Signature · 1 line
1.7.0.87.g0901d
#4 lore raw

PATCH v2 4/4 hwmon: sysfs API updates

In reply to Guenter Roeck
---
 Documentation/hwmon/sysfs-interface |   37 +++++++++++++++++++++++++++++-----
 1 files changed, 31 insertions(+), 6 deletions(-)
Documentation/hwmon/sysfs-interface +31 -6
index d4e2917..2dcec0f 100644
@@ -421,11 +421,12 @@ power[1-*]_accuracy		Accuracy of the power meter.
 				Unit: Percent
 				RO
 
-power[1-*]_alarm		1 if the system is drawing more power than the
-				cap allows; 0 otherwise.  A poll notification is
-				sent to this file when the power use exceeds the
-				cap.  This file only appears if the cap is known
-				to be enforced by hardware.
+power[1-*]_alarm		1 if the system is drawing more power than cap
+				or max allows; 0 otherwise.  A poll notification
+				is sent to this file when the power use exceeds
+				the cap or max limit. If only cap is supported,
+				this file only appears if the cap is known to be
+				enforced by hardware.
 				RO
 
 power[1-*]_cap			If power use rises above this limit, the
@@ -450,6 +451,18 @@ power[1-*]_cap_min		Minimum cap that can be set.
 				Unit: microWatt
 				RO
 
+power[1-*]_max			Maximum power.
+				Unit: microWatt
+				RW
+
+power[1-*]_crit			Critical maximum power.
+				If power rises to or above this limit, the
+				system will take drastic action to reduce power
+				consumption, such as a system shutdown. At the
+				very least, a power fault will be generated.
+				Unit: microWatt
+				RO
+
 **********
 * Energy *
 **********
@@ -471,8 +484,14 @@ limit-related alarms, not both. The driver should just reflect the hardware
 implementation.
 
 in[0-*]_alarm
+in[0-*]_crit_alarm
+curr[1-*]_alarm
+curr[1-*]_crit_alarm
+power[1-*]_alarm
+power[1-*]_crit_alarm
 fan[1-*]_alarm
 temp[1-*]_alarm
+temp[1-*]_crit_alarm
 		Channel alarm
 		0: no alarm
 		1: alarm
@@ -482,10 +501,17 @@ OR
 
 in[0-*]_min_alarm
 in[0-*]_max_alarm
+in[0-*]_lcrit_alarm
+in[0-*]_crit_alarm
+curr[1-*]_lcrit_alarm
+curr[1-*]_crit_alarm
+power[1-*]_min_alarm
+power[1-*]_max_alarm
 fan[1-*]_min_alarm
 fan[1-*]_max_alarm
 temp[1-*]_min_alarm
 temp[1-*]_max_alarm
+temp[1-*]_lcrit_alarm
 temp[1-*]_crit_alarm
 		Limit alarm
 		0: no alarm
@@ -497,7 +523,6 @@ to notify open diodes, unconnected fans etc. where the hardware
 supports it. When this boolean has value 1, the measurement for that
 channel should not be trusted.
 
-in[0-*]_fault
 fan[1-*]_fault
 temp[1-*]_fault
 		Input fault condition
Signature · 1 line
1.7.0.87.g0901d
#5 lore raw

Re: [PATCH/RFC v2 4/4] hwmon: sysfs API updates

Hi Guenter,

Quoted 4 lines · Guenter Roeck
---
 Documentation/hwmon/sysfs-interface |   37 +++++++++++++++++++++++++++++-----
 1 files changed, 31 insertions(+), 6 deletions(-)

As usual, I don't have the time to review the code, but I'd like to at least comment on the sysfs interface changes:

Quoted 28 lines
Documentation/hwmon/sysfs-interface +7 -5
index d4e2917..2dcec0f 100644
@@ -421,11 +421,12 @@ power[1-*]_accuracy		Accuracy of the power meter.
 				Unit: Percent
 				RO
 
-power[1-*]_alarm		1 if the system is drawing more power than the
-				cap allows; 0 otherwise.  A poll notification is
-				sent to this file when the power use exceeds the
-				cap.  This file only appears if the cap is known
-				to be enforced by hardware.
+power[1-*]_alarm		1 if the system is drawing more power than cap
+				or max allows; 0 otherwise.  A poll notification
+				is sent to this file when the power use exceeds
+				the cap or max limit. If only cap is supported,
+				this file only appears if the cap is known to be
+				enforced by hardware.
 				RO
 
 power[1-*]_cap			If power use rises above this limit, the
@@ -450,6 +451,18 @@ power[1-*]_cap_min		Minimum cap that can be set.
 				Unit: microWatt
 				RO
 
+power[1-*]_max			Maximum power.

Documentation/hwmon/sysfs-interface power[1-*]_cap_min Minimum cap that can be set. · line 464

Quoted 10 lines
Documentation/hwmon/sysfs-interface +10 -0
+				Unit: microWatt
+				RW
+
+power[1-*]_crit			Critical maximum power.
+				If power rises to or above this limit, the
+				system will take drastic action to reduce power
+				consumption, such as a system shutdown. At the
+				very least, a power fault will be generated.
+				Unit: microWatt
+				RO

Why RO and not RW as every other limit file?

Quoted 9 lines
Documentation/hwmon/sysfs-interface +2 -0
+
 **********
 * Energy *
 **********
@@ -471,8 +484,14 @@ limit-related alarms, not both. The driver should just reflect the hardware
 implementation.
 
 in[0-*]_alarm
+in[0-*]_crit_alarm

Documentation/hwmon/sysfs-interface limit-related alarms, not both. The driver should just reflect the hardware · line 497

Quoted 10 lines
Documentation/hwmon/sysfs-interface +5 -0
+curr[1-*]_alarm
+curr[1-*]_crit_alarm
+power[1-*]_alarm
+power[1-*]_crit_alarm
 fan[1-*]_alarm
 temp[1-*]_alarm
+temp[1-*]_crit_alarm
 		Channel alarm
 		0: no alarm
 		1: alarm

The limit-specific alarms (*_crit_alarm) go in the second section, below. And as a matter of fact, you've already added some of them there...

Documentation/hwmon/sysfs-interface OR · line 507

Quoted 8 lines
Documentation/hwmon/sysfs-interface +4 -0
@@ -482,10 +501,17 @@ OR
 
 in[0-*]_min_alarm
 in[0-*]_max_alarm
+in[0-*]_lcrit_alarm
+in[0-*]_crit_alarm
+curr[1-*]_lcrit_alarm
+curr[1-*]_crit_alarm

No _min and _max alarm for curr?

Quoted 11 lines
Documentation/hwmon/sysfs-interface +3 -0
+power[1-*]_min_alarm
+power[1-*]_max_alarm
 fan[1-*]_min_alarm
 fan[1-*]_max_alarm
 temp[1-*]_min_alarm
 temp[1-*]_max_alarm
+temp[1-*]_lcrit_alarm
 temp[1-*]_crit_alarm
 		Limit alarm
 		0: no alarm

Documentation/hwmon/sysfs-interface to notify open diodes, unconnected fans etc. where the hardware · line 500

Quoted 4 lines
Documentation/hwmon/sysfs-interface +0 -1
@@ -497,7 +523,6 @@ to notify open diodes, unconnected fans etc. where the hardware
 supports it. When this boolean has value 1, the measurement for that
 channel should not be trusted.
 
-in[0-*]_fault

I've removed it already in a separate patch, so your patch won't apply if you try to remove it again.

Documentation/hwmon/sysfs-interface to notify open diodes, unconnected fans etc. where the hardware · line 528

Quoted 3 lines
Documentation/hwmon/sysfs-interface +0 -0
 fan[1-*]_fault
 temp[1-*]_fault
 		Input fault condition

In general, I'm happy with the proposed changes.

Signature · 1 line
Jean Delvare
#6 lore raw

Re: [PATCH/RFC v2 4/4] hwmon: sysfs API updates

Hi Jean,

I noticed I did not copy the list with my reply, so here are are again, with a couple of additional comments.

Quoted 11 lines · Jean Delvare

Hi Guenter,

Quoted 4 lines · Guenter Roeck
---
 Documentation/hwmon/sysfs-interface |   37 +++++++++++++++++++++++++++++-----
 1 files changed, 31 insertions(+), 6 deletions(-)

As usual, I don't have the time to review the code, but I'd like to at least comment on the sysfs interface changes:

I appreciate any feedback I can get.

Quoted 27 lines
Quoted 27 lines
Documentation/hwmon/sysfs-interface +6 -5
index d4e2917..2dcec0f 100644
@@ -421,11 +421,12 @@ power[1-*]_accuracy		Accuracy of the power meter.
 				Unit: Percent
 				RO
 
-power[1-*]_alarm		1 if the system is drawing more power than the
-				cap allows; 0 otherwise.  A poll notification is
-				sent to this file when the power use exceeds the
-				cap.  This file only appears if the cap is known
-				to be enforced by hardware.
+power[1-*]_alarm		1 if the system is drawing more power than cap
+				or max allows; 0 otherwise.  A poll notification
+				is sent to this file when the power use exceeds
+				the cap or max limit. If only cap is supported,
+				this file only appears if the cap is known to be
+				enforced by hardware.
 				RO
 
 power[1-*]_cap			If power use rises above this limit, the
@@ -450,6 +451,18 @@ power[1-*]_cap_min		Minimum cap that can be set.
 				Unit: microWatt
 				RO
 
Quoted 14 lines

Documentation/hwmon/sysfs-interface power[1-*]_cap_min Minimum cap that can be set. · line 464

Quoted 11 lines
Documentation/hwmon/sysfs-interface +11 -0
+power[1-*]_max			Maximum power.
+				Unit: microWatt
+				RW
+
+power[1-*]_crit			Critical maximum power.
+				If power rises to or above this limit, the
+				system will take drastic action to reduce power
+				consumption, such as a system shutdown. At the
+				very least, a power fault will be generated.
+				Unit: microWatt
+				RO

Why RO and not RW as every other limit file?

Cut-and-paste error. I'll fix it.

Quoted 7 lines
Quoted 7 lines
Documentation/hwmon/sysfs-interface +1 -0
+
 **********
 * Energy *
 **********
@@ -471,8 +484,14 @@ limit-related alarms, not both. The driver should just reflect the hardware
 implementation.
 
Quoted 17 lines

Documentation/hwmon/sysfs-interface limit-related alarms, not both. The driver should just reflect the hardware · line 497

Quoted 12 lines
Documentation/hwmon/sysfs-interface +6 -0
 in[0-*]_alarm
+in[0-*]_crit_alarm
+curr[1-*]_alarm
+curr[1-*]_crit_alarm
+power[1-*]_alarm
+power[1-*]_crit_alarm
 fan[1-*]_alarm
 temp[1-*]_alarm
+temp[1-*]_crit_alarm
 		Channel alarm
 		0: no alarm
 		1: alarm

The limit-specific alarms (*_crit_alarm) go in the second section, below. And as a matter of fact, you've already added some of them there...

Ok, makes sense.

Quoted 11 lines

Documentation/hwmon/sysfs-interface OR · line 507

Quoted 8 lines
Documentation/hwmon/sysfs-interface +4 -0
@@ -482,10 +501,17 @@ OR
 
 in[0-*]_min_alarm
 in[0-*]_max_alarm
+in[0-*]_lcrit_alarm
+in[0-*]_crit_alarm
+curr[1-*]_lcrit_alarm
+curr[1-*]_crit_alarm

No _min and _max alarm for curr?

Oversight. pmbus devices don't support currX_min and currX_min_alarm, only currX_lcrit and currX_lcrit_alarm. The ltc4245 driver already supports currX_max_alarm, though, so I'll add both for consistency.

The ltc4245 driver only supports currX_max_alarm, not currX_min_alarm, though. Wonder if that should be changed to currX_alarm, to more closely follow the API. Let me know and I'll submit a patch if needed.

Quoted 14 lines
Quoted 14 lines
Documentation/hwmon/sysfs-interface +3 -0
+power[1-*]_min_alarm
+power[1-*]_max_alarm
 fan[1-*]_min_alarm
 fan[1-*]_max_alarm
 temp[1-*]_min_alarm
 temp[1-*]_max_alarm
+temp[1-*]_lcrit_alarm
 temp[1-*]_crit_alarm
 		Limit alarm
 		0: no alarm
@@ -497,7 +523,6 @@ to notify open diodes, unconnected fans etc. where the hardware
 supports it. When this boolean has value 1, the measurement for that
 channel should not be trusted.
 
Quoted 5 lines

Documentation/hwmon/sysfs-interface to notify open diodes, unconnected fans etc. where the hardware · line 500

Quoted 1 line
Documentation/hwmon/sysfs-interface +0 -1
-in[0-*]_fault

I've removed it already in a separate patch, so your patch won't apply if you try to remove it again.

Ok, good point. I'll take it out.

Quoted 6 lines

Documentation/hwmon/sysfs-interface to notify open diodes, unconnected fans etc. where the hardware · line 528

Quoted 3 lines
Documentation/hwmon/sysfs-interface +0 -0
 fan[1-*]_fault
 temp[1-*]_fault
 		Input fault condition

In general, I'm happy with the proposed changes.

Thanks a lot for your time!

Guenter

#7 lore raw

Re: [PATCH/RFC v2 4/4] hwmon: sysfs API updates

Quoted 18 lines · Guenter Roeck

Hi Jean,

I noticed I did not copy the list with my reply, so here are are again, with a couple of additional comments.

Quoted 12 lines · Jean Delvare

Documentation/hwmon/sysfs-interface OR · line 507

Quoted 8 lines · Guenter Roeck
Documentation/hwmon/sysfs-interface +4 -0
@@ -482,10 +501,17 @@ OR
 
 in[0-*]_min_alarm
 in[0-*]_max_alarm
+in[0-*]_lcrit_alarm
+in[0-*]_crit_alarm
+curr[1-*]_lcrit_alarm
+curr[1-*]_crit_alarm

No _min and _max alarm for curr?

Quoted 7 lines

Oversight. pmbus devices don't support currX_min and currX_min_alarm, only currX_lcrit and currX_lcrit_alarm. The ltc4245 driver already supports currX_max_alarm, though, so I'll add both for consistency.

The ltc4245 driver only supports currX_max_alarm, not currX_min_alarm, though. Wonder if that should be changed to currX_alarm, to more closely follow the API. Let me know and I'll submit a patch if needed.

Both should be defined and supported, and the driver author chooses what fits his/her chip best.

Signature · 1 line
Jean Delvare