diff options
author | Guenter Roeck <guenter.roeck@ericsson.com> | 2011-07-09 16:10:19 -0400 |
---|---|---|
committer | Guenter Roeck <guenter.roeck@ericsson.com> | 2011-07-28 20:09:53 -0400 |
commit | 8ebed854506301f4f67e75c73cae967d4a45ab4d (patch) | |
tree | 931d27507b081f39551cc1092b5db6fd1812f9a0 | |
parent | c576e30cd0c9814b3b45772d46924d796f538dee (diff) |
hwmon: (max16064) Add support for peak attributes
Add support for voltage and temperature peak (historic maximum) attributes.
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Reviewed-by: Robert Coulson <robert.coulson@ericsson.com>
-rw-r--r-- | Documentation/hwmon/max16064 | 4 | ||||
-rw-r--r-- | drivers/hwmon/pmbus/max16064.c | 51 |
2 files changed, 55 insertions, 0 deletions
diff --git a/Documentation/hwmon/max16064 b/Documentation/hwmon/max16064 index 41728999e142..f6e8bcbfaccf 100644 --- a/Documentation/hwmon/max16064 +++ b/Documentation/hwmon/max16064 | |||
@@ -50,6 +50,8 @@ in[1-4]_min_alarm Voltage low alarm. From VOLTAGE_UV_WARNING status. | |||
50 | in[1-4]_max_alarm Voltage high alarm. From VOLTAGE_OV_WARNING status. | 50 | in[1-4]_max_alarm Voltage high alarm. From VOLTAGE_OV_WARNING status. |
51 | in[1-4]_lcrit_alarm Voltage critical low alarm. From VOLTAGE_UV_FAULT status. | 51 | in[1-4]_lcrit_alarm Voltage critical low alarm. From VOLTAGE_UV_FAULT status. |
52 | in[1-4]_crit_alarm Voltage critical high alarm. From VOLTAGE_OV_FAULT status. | 52 | in[1-4]_crit_alarm Voltage critical high alarm. From VOLTAGE_OV_FAULT status. |
53 | in[1-4]_highest Historical maximum voltage. | ||
54 | in[1-4]_reset_history Write any value to reset history. | ||
53 | 55 | ||
54 | temp1_input Measured temperature. From READ_TEMPERATURE_1 register. | 56 | temp1_input Measured temperature. From READ_TEMPERATURE_1 register. |
55 | temp1_max Maximum temperature. From OT_WARN_LIMIT register. | 57 | temp1_max Maximum temperature. From OT_WARN_LIMIT register. |
@@ -60,3 +62,5 @@ temp1_max_alarm Chip temperature high alarm. Set by comparing | |||
60 | temp1_crit_alarm Chip temperature critical high alarm. Set by comparing | 62 | temp1_crit_alarm Chip temperature critical high alarm. Set by comparing |
61 | READ_TEMPERATURE_1 with OT_FAULT_LIMIT if TEMP_OT_FAULT | 63 | READ_TEMPERATURE_1 with OT_FAULT_LIMIT if TEMP_OT_FAULT |
62 | status is set. | 64 | status is set. |
65 | temp1_highest Historical maximum temperature. | ||
66 | temp1_reset_history Write any value to reset history. | ||
diff --git a/drivers/hwmon/pmbus/max16064.c b/drivers/hwmon/pmbus/max16064.c index 78e20bca53a9..e50b296e8db4 100644 --- a/drivers/hwmon/pmbus/max16064.c +++ b/drivers/hwmon/pmbus/max16064.c | |||
@@ -25,6 +25,55 @@ | |||
25 | #include <linux/i2c.h> | 25 | #include <linux/i2c.h> |
26 | #include "pmbus.h" | 26 | #include "pmbus.h" |
27 | 27 | ||
28 | #define MAX16064_MFR_VOUT_PEAK 0xd4 | ||
29 | #define MAX16064_MFR_TEMPERATURE_PEAK 0xd6 | ||
30 | |||
31 | static int max16064_read_word_data(struct i2c_client *client, int page, int reg) | ||
32 | { | ||
33 | int ret; | ||
34 | |||
35 | switch (reg) { | ||
36 | case PMBUS_VIRT_READ_VOUT_MAX: | ||
37 | ret = pmbus_read_word_data(client, page, | ||
38 | MAX16064_MFR_VOUT_PEAK); | ||
39 | break; | ||
40 | case PMBUS_VIRT_READ_TEMP_MAX: | ||
41 | ret = pmbus_read_word_data(client, page, | ||
42 | MAX16064_MFR_TEMPERATURE_PEAK); | ||
43 | break; | ||
44 | case PMBUS_VIRT_RESET_VOUT_HISTORY: | ||
45 | case PMBUS_VIRT_RESET_TEMP_HISTORY: | ||
46 | ret = 0; | ||
47 | break; | ||
48 | default: | ||
49 | ret = -ENODATA; | ||
50 | break; | ||
51 | } | ||
52 | return ret; | ||
53 | } | ||
54 | |||
55 | static int max16064_write_word_data(struct i2c_client *client, int page, | ||
56 | int reg, u16 word) | ||
57 | { | ||
58 | int ret; | ||
59 | |||
60 | switch (reg) { | ||
61 | case PMBUS_VIRT_RESET_VOUT_HISTORY: | ||
62 | ret = pmbus_write_word_data(client, page, | ||
63 | MAX16064_MFR_VOUT_PEAK, 0); | ||
64 | break; | ||
65 | case PMBUS_VIRT_RESET_TEMP_HISTORY: | ||
66 | ret = pmbus_write_word_data(client, page, | ||
67 | MAX16064_MFR_TEMPERATURE_PEAK, | ||
68 | 0xffff); | ||
69 | break; | ||
70 | default: | ||
71 | ret = -ENODATA; | ||
72 | break; | ||
73 | } | ||
74 | return ret; | ||
75 | } | ||
76 | |||
28 | static struct pmbus_driver_info max16064_info = { | 77 | static struct pmbus_driver_info max16064_info = { |
29 | .pages = 4, | 78 | .pages = 4, |
30 | .format[PSC_VOLTAGE_IN] = direct, | 79 | .format[PSC_VOLTAGE_IN] = direct, |
@@ -44,6 +93,8 @@ static struct pmbus_driver_info max16064_info = { | |||
44 | .func[1] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT, | 93 | .func[1] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT, |
45 | .func[2] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT, | 94 | .func[2] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT, |
46 | .func[3] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT, | 95 | .func[3] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT, |
96 | .read_word_data = max16064_read_word_data, | ||
97 | .write_word_data = max16064_write_word_data, | ||
47 | }; | 98 | }; |
48 | 99 | ||
49 | static int max16064_probe(struct i2c_client *client, | 100 | static int max16064_probe(struct i2c_client *client, |