Skip to contentSkip to conversation

hwmon: Driver for MAX16065/MAX16066 System

PATCH Superseded Guenter Roeck 1 participant 2 messages Apr 7, 2011

Subsystems (2)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 hwmon: Driver for MAX16065/MAX16066 System

This patch adds hardware monitoring support for Maxim MAX16065, MAX16066, MAX16067, MAX16068, MAX16070, and MAX16071 flash-configurable system managers and monitors with nonvolatile fault registers.

---
v2:

- Added support for MAX16067, MAX16068, MAX16070, and MAX16070 (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), where l is 0, 1, or 2.
- Removed several 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 |  100 ++++++
 drivers/hwmon/Kconfig        |   16 +
 drivers/hwmon/Makefile       |    1 +
 drivers/hwmon/max16065.c     |  721 ++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 838 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/hwmon/max16065
 create mode 100644 drivers/hwmon/max16065.c
Documentation/hwmon/max16065 new file +100 -0
new file mode 100644
index 0000000..8d87d17
@@ -0,0 +1,100 @@
+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 6-Channel, Flash-Configurable System Manager
+    with Nonvolatile Fault Registers
+    Prefix: 'max16067'
+    Addresses scanned: -
+    Datasheet:
+	http://datasheets.maxim-ic.com/en/ds/MAX16067.pdf
+ *  Maxim MAX16068 6-Channel, Flash-Configurable System Manager
+    with Nonvolatile Fault Registers
+    Prefix: 'max16068'
+    Addresses scanned: -
+    Datasheet:
+	http://datasheets.maxim-ic.com/en/ds/MAX16068.pdf
+ *  Maxim MAX16070/MAX16071 12-Channel/8-Channel, Flash-Configurable
+    System Monitors with Nonvolatile Fault Registers
+    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.
+
+
+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
index 060ef63..c755070 100644
@@ -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 MAX160XX System Managers"
+	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
index 967d0ea..cb10098 100644
@@ -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 +720 -0

720 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
#1 lore raw

Re: [lm-sensors] [PATCH v2] hwmon: Driver for MAX16065/MAX16066

Quoted 9 lines · Guenter Roeck

This patch adds hardware monitoring support for Maxim MAX16065, MAX16066, MAX16067, MAX16068, MAX16070, and MAX16071 flash-configurable system managers and monitors with nonvolatile fault registers.

---
v2:

- Added support for MAX16067, MAX16068, MAX16070, and MAX16070 (untested).

	... and MAX16071, not MAX16070 twice ;)
Quoted 16 lines

- 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), where l is 0, 1, or 2.
- Removed several 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.

Quoted 9 lines

- 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).

Should have mentioned: Platform data to configure the current sense resistor value is not there yet. Right now I have no means to test that (I use a test board, not the real HW). Plan is to add that with a patch once I get real HW (with its own kernel and platform files) to play with.

Thanks,
Guenter

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors