hwmon: Driver for MAX16065 System Manager
Subsystems (2)
PATCH v4 1/1 hwmon: Driver for MAX16065 System Manager
This patch adds hardware monitoring support for Maxim MAX16065, MAX16066, MAX16067, MAX16068, MAX16070, and MAX16071 flash-configurable system managers with nonvolatile fault registers.
---
Note: I had planned to add support for MAX16047 and MAX16049. That did not work out; register functionality is the same, but register addresses are different.
v4:
- Removed individual chip description from summary in Documentation/hwmon/max16065.
- In Kconfig, replaced MAX160XX with "MAX16065 System Manager and compatibles".
- Removed list of datasheets from driver source.
- Use C99 style initializations.
- In LIMIT_TO_MV and ADC_TO_CURR, don't use DIV_ROUND_CLOSEST; replace with divide.
- Validate range register values when reading them from chip. If the range value indicates that an ADC channel is disabled, don't create sysfs entries for it.
- Simplified initialization code detecting if current sensing is enabled or not.
v3:
- Tested with MAX16067 and MAX16068.
- Number of ADC channels is no longer always a multiple of four. Thus, we have to round up the loop count limit when reading the ADC range (there are four range values per register).
v2:
- Added support for MAX16067, MAX16068, MAX16070, and MAX16071 (untested).
- Refer to Documentation/i2c/instantiating-devices for details about device instantiation.
- Define and use MAX16065_SCALE(x) instead of MAX16065_SCALE_BASE + x.
- Replace MAX16065_SECONDARY(x), MAX16065_CRIT(x), and MAX16065_LCRIT(x) with MAX16065_LIMIT(l, x).
- Removed unused / duplicate defines.
- Replaced function macros with inline functions.
- Replaced secondary[], lcrit[], and crit[] arrays in max16065_data with two-dimensional array limit[nLimit][nAdc].
- In max16065_read_adc(), use single 16-bit read instead of two 8-bit read operations to ensure that data is consistent.
- In max16065_update_device(), only read device registers if the device supports it. Specifically, use data->num_adc instead of MAX16065_NUM_ADC, and only read current sense information if supported and enabled.
- In max16065_show_alarm(), use to_i2c_client(dev) directly and drop 'client' variable.
- Use unlikely() for all error checks.
- Use single function to read and set all limits.
- When setting a limit, ensure that limit range is valid.
- In sensor groups, remove unnecessary ',' after NULL entries.
- Rearranged sensor groups to be more flexible regarding the number of supported sensors. Use sysfs_create_file() instead of sysfs_create_group() to create sysfs entries for groups supporting a variable number of sensors (voltages and voltage limits).
Documentation/hwmon/max16065 | 98 ++++++ drivers/hwmon/Kconfig | 16 + drivers/hwmon/Makefile | 1 + drivers/hwmon/max16065.c | 717 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 832 insertions(+), 0 deletions(-) create mode 100644 Documentation/hwmon/max16065 create mode 100644 drivers/hwmon/max16065.c
Documentation/hwmon/max16065 new file +98 -0
@@ -0,0 +1,98 @@ +Kernel driver max16065 +=========== + +Supported chips: + * Maxim MAX16065, MAX16066 + Prefixes: 'max16065', 'max16066' + Addresses scanned: - + Datasheet: + http://datasheets.maxim-ic.com/en/ds/MAX16065-MAX16066.pdf + * Maxim MAX16067 + Prefix: 'max16067' + Addresses scanned: - + Datasheet: + http://datasheets.maxim-ic.com/en/ds/MAX16067.pdf + * Maxim MAX16068 + Prefix: 'max16068' + Addresses scanned: - + Datasheet: + http://datasheets.maxim-ic.com/en/ds/MAX16068.pdf + * Maxim MAX16070/MAX16071 + Prefixes: 'max16070', 'max16071' + Addresses scanned: - + Datasheet: + http://datasheets.maxim-ic.com/en/ds/MAX16070-MAX16071.pdf + + +Author: Guenter Roeck <[email protected]> + + +Description +----------- + +[From datasheets] The MAX16065/MAX16066 flash-configurable system managers +monitor and sequence multiple system voltages. The MAX16065/MAX16066 can also +accurately monitor (+/-2.5%) one current channel using a dedicated high-side +current-sense amplifier. The MAX16065 manages up to twelve system voltages +simultaneously, and the MAX16066 manages up to eight supply voltages. + +The MAX16067 flash-configurable system manager monitors and sequences multiple +system voltages. The MAX16067 manages up to six system voltages simultaneously. + +The MAX16068 flash-configurable system manager monitors and manages up to six +system voltages simultaneously. + +The MAX16070/MAX16071 flash-configurable system monitors supervise multiple +system voltages. The MAX16070/MAX16071 can also accurately monitor (+/-2.5%) +one current channel using a dedicated high-side current-sense amplifier. The +MAX16070 monitors up to twelve system voltages simultaneously, and the MAX16071 +monitors up to eight supply voltages. + +Each monitored channel has its own low and high critical limits. MAX16065, +MAX16066, MAX16070, and MAX16071 support an additional limit which is +configurable as either low or high secondary limit. MAX16065, MAX16066, +MAX16070, and MAX16071 also support supply current monitoring. + + +Usage Notes +----------- + +This driver does not probe for devices, since there is no register which +can be safely used to identify the chip. You will have to instantiate +the devices explicitly. Please see Documentation/i2c/instantiating-devices for +details. + + +Sysfs entries +------------- + +in[0-11]_input Input voltage measurements. + +in12_input Voltage on CSP (Current Sense Positive) pin. + Only if the chip supports current sensing and if + current sensing is enabled. + +in[0-11]_min Low warning limit. + Supported on MAX16065, MAX16066, MAX16070, and MAX16071 + only. + +in[0-11]_max High warning limit. + Supported on MAX16065, MAX16066, MAX16070, and MAX16071 + only. + + Either low or high warning limits are supported + (depending on chip configuration), but not both. + +in[0-11]_lcrit Low critical limit. + +in[0-11]_crit High critical limit. + +in[0-11]_alarm Input voltage alarm. + +curr1_input Current sense input; only if the chip supports current + sensing and if current sensing is enabled. + Displayed current assumes 0.001 Ohm current sense + resistor. + +curr1_alarm Overcurrent alarm; only if the chip supports current + sensing and if current sensing is enabled.
drivers/hwmon/Kconfig +16 -0
@@ -709,6 +709,22 @@ config SENSORS_MAX1111 This driver can also be built as a module. If so, the module will be called max1111. +config SENSORS_MAX16065 + tristate "Maxim MAX16065 System Manager and compatibles" + depends on I2C + help + If you say yes here you get support for hardware monitoring + capabilities of the following Maxim System Manager chips. + MAX16065 + MAX16066 + MAX16067 + MAX16068 + MAX16070 + MAX16071 + + This driver can also be built as a module. If so, the module + will be called max16065. + config SENSORS_MAX1619 tristate "Maxim MAX1619 sensor chip" depends on I2C
drivers/hwmon/Makefile +1 -0
@@ -83,6 +83,7 @@ obj-$(CONFIG_SENSORS_LTC4215) += ltc4215.o obj-$(CONFIG_SENSORS_LTC4245) += ltc4245.o obj-$(CONFIG_SENSORS_LTC4261) += ltc4261.o obj-$(CONFIG_SENSORS_MAX1111) += max1111.o +obj-$(CONFIG_SENSORS_MAX16065) += max16065.o obj-$(CONFIG_SENSORS_MAX1619) += max1619.o obj-$(CONFIG_SENSORS_MAX6639) += max6639.o obj-$(CONFIG_SENSORS_MAX6650) += max6650.o
drivers/hwmon/max16065.c new file +716 -0
716 lines not on this page · raw message
Signature · 7 lines
1.7.3.1 _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Re: [lm-sensors] [PATCH v4] hwmon: Driver for MAX16065 System
Quoted 6 lines · Guenter Roeck
This patch adds hardware monitoring support for Maxim MAX16065, MAX16066, MAX16067, MAX16068, MAX16070, and MAX16071 flash-configurable system managers with nonvolatile fault registers.
Signed-off-by Guenter Roeck <[email protected]>Reviewed-by Jean Delvare <[email protected]>
Quoted 7 lines
---
Note: I had planned to add support for MAX16047 and MAX16049. That did not work out; register functionality is the same, but register addresses are different.v4:
(...)
Looks very good now. Great work!
Signature · 6 lines
Jean Delvare _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors