diff options
-rw-r--r-- | Documentation/hwmon/max8688 | 6 | ||||
-rw-r--r-- | drivers/hwmon/pmbus/max8688.c | 61 |
2 files changed, 67 insertions, 0 deletions
diff --git a/Documentation/hwmon/max8688 b/Documentation/hwmon/max8688 index 0ddd3a412030..71ed10a3c94e 100644 --- a/Documentation/hwmon/max8688 +++ b/Documentation/hwmon/max8688 | |||
@@ -50,6 +50,8 @@ in1_min_alarm Voltage low alarm. From VOLTAGE_UV_WARNING status. | |||
50 | in1_max_alarm Voltage high alarm. From VOLTAGE_OV_WARNING status. | 50 | in1_max_alarm Voltage high alarm. From VOLTAGE_OV_WARNING status. |
51 | in1_lcrit_alarm Voltage critical low alarm. From VOLTAGE_UV_FAULT status. | 51 | in1_lcrit_alarm Voltage critical low alarm. From VOLTAGE_UV_FAULT status. |
52 | in1_crit_alarm Voltage critical high alarm. From VOLTAGE_OV_FAULT status. | 52 | in1_crit_alarm Voltage critical high alarm. From VOLTAGE_OV_FAULT status. |
53 | in1_highest Historical maximum voltage. | ||
54 | in1_reset_history Write any value to reset history. | ||
53 | 55 | ||
54 | curr1_label "iout1" | 56 | curr1_label "iout1" |
55 | curr1_input Measured current. From READ_IOUT register. | 57 | curr1_input Measured current. From READ_IOUT register. |
@@ -57,6 +59,8 @@ curr1_max Maximum current. From IOUT_OC_WARN_LIMIT register. | |||
57 | curr1_crit Critical maximum current. From IOUT_OC_FAULT_LIMIT register. | 59 | curr1_crit Critical maximum current. From IOUT_OC_FAULT_LIMIT register. |
58 | curr1_max_alarm Current high alarm. From IOUT_OC_WARN_LIMIT register. | 60 | curr1_max_alarm Current high alarm. From IOUT_OC_WARN_LIMIT register. |
59 | curr1_crit_alarm Current critical high alarm. From IOUT_OC_FAULT status. | 61 | curr1_crit_alarm Current critical high alarm. From IOUT_OC_FAULT status. |
62 | curr1_highest Historical maximum current. | ||
63 | curr1_reset_history Write any value to reset history. | ||
60 | 64 | ||
61 | temp1_input Measured temperature. From READ_TEMPERATURE_1 register. | 65 | temp1_input Measured temperature. From READ_TEMPERATURE_1 register. |
62 | temp1_max Maximum temperature. From OT_WARN_LIMIT register. | 66 | temp1_max Maximum temperature. From OT_WARN_LIMIT register. |
@@ -67,3 +71,5 @@ temp1_max_alarm Chip temperature high alarm. Set by comparing | |||
67 | temp1_crit_alarm Chip temperature critical high alarm. Set by comparing | 71 | temp1_crit_alarm Chip temperature critical high alarm. Set by comparing |
68 | READ_TEMPERATURE_1 with OT_FAULT_LIMIT if TEMP_OT_FAULT | 72 | READ_TEMPERATURE_1 with OT_FAULT_LIMIT if TEMP_OT_FAULT |
69 | status is set. | 73 | status is set. |
74 | temp1_highest Historical maximum temperature. | ||
75 | temp1_reset_history Write any value to reset history. | ||
diff --git a/drivers/hwmon/pmbus/max8688.c b/drivers/hwmon/pmbus/max8688.c index ddc8a64c2ba5..c3e72f1a3cfb 100644 --- a/drivers/hwmon/pmbus/max8688.c +++ b/drivers/hwmon/pmbus/max8688.c | |||
@@ -25,6 +25,9 @@ | |||
25 | #include <linux/i2c.h> | 25 | #include <linux/i2c.h> |
26 | #include "pmbus.h" | 26 | #include "pmbus.h" |
27 | 27 | ||
28 | #define MAX8688_MFR_VOUT_PEAK 0xd4 | ||
29 | #define MAX8688_MFR_IOUT_PEAK 0xd5 | ||
30 | #define MAX8688_MFR_TEMPERATURE_PEAK 0xd6 | ||
28 | #define MAX8688_MFG_STATUS 0xd8 | 31 | #define MAX8688_MFG_STATUS 0xd8 |
29 | 32 | ||
30 | #define MAX8688_STATUS_OC_FAULT (1 << 4) | 33 | #define MAX8688_STATUS_OC_FAULT (1 << 4) |
@@ -37,6 +40,62 @@ | |||
37 | #define MAX8688_STATUS_OT_FAULT (1 << 13) | 40 | #define MAX8688_STATUS_OT_FAULT (1 << 13) |
38 | #define MAX8688_STATUS_OT_WARNING (1 << 14) | 41 | #define MAX8688_STATUS_OT_WARNING (1 << 14) |
39 | 42 | ||
43 | static int max8688_read_word_data(struct i2c_client *client, int page, int reg) | ||
44 | { | ||
45 | int ret; | ||
46 | |||
47 | if (page) | ||
48 | return -EINVAL; | ||
49 | |||
50 | switch (reg) { | ||
51 | case PMBUS_VIRT_READ_VOUT_MAX: | ||
52 | ret = pmbus_read_word_data(client, 0, MAX8688_MFR_VOUT_PEAK); | ||
53 | break; | ||
54 | case PMBUS_VIRT_READ_IOUT_MAX: | ||
55 | ret = pmbus_read_word_data(client, 0, MAX8688_MFR_IOUT_PEAK); | ||
56 | break; | ||
57 | case PMBUS_VIRT_READ_TEMP_MAX: | ||
58 | ret = pmbus_read_word_data(client, 0, | ||
59 | MAX8688_MFR_TEMPERATURE_PEAK); | ||
60 | break; | ||
61 | case PMBUS_VIRT_RESET_VOUT_HISTORY: | ||
62 | case PMBUS_VIRT_RESET_IOUT_HISTORY: | ||
63 | case PMBUS_VIRT_RESET_TEMP_HISTORY: | ||
64 | ret = 0; | ||
65 | break; | ||
66 | default: | ||
67 | ret = -ENODATA; | ||
68 | break; | ||
69 | } | ||
70 | return ret; | ||
71 | } | ||
72 | |||
73 | static int max8688_write_word_data(struct i2c_client *client, int page, int reg, | ||
74 | u16 word) | ||
75 | { | ||
76 | int ret; | ||
77 | |||
78 | switch (reg) { | ||
79 | case PMBUS_VIRT_RESET_VOUT_HISTORY: | ||
80 | ret = pmbus_write_word_data(client, 0, MAX8688_MFR_VOUT_PEAK, | ||
81 | 0); | ||
82 | break; | ||
83 | case PMBUS_VIRT_RESET_IOUT_HISTORY: | ||
84 | ret = pmbus_write_word_data(client, 0, MAX8688_MFR_IOUT_PEAK, | ||
85 | 0); | ||
86 | break; | ||
87 | case PMBUS_VIRT_RESET_TEMP_HISTORY: | ||
88 | ret = pmbus_write_word_data(client, 0, | ||
89 | MAX8688_MFR_TEMPERATURE_PEAK, | ||
90 | 0xffff); | ||
91 | break; | ||
92 | default: | ||
93 | ret = -ENODATA; | ||
94 | break; | ||
95 | } | ||
96 | return ret; | ||
97 | } | ||
98 | |||
40 | static int max8688_read_byte_data(struct i2c_client *client, int page, int reg) | 99 | static int max8688_read_byte_data(struct i2c_client *client, int page, int reg) |
41 | { | 100 | { |
42 | int ret = 0; | 101 | int ret = 0; |
@@ -111,6 +170,8 @@ static struct pmbus_driver_info max8688_info = { | |||
111 | | PMBUS_HAVE_STATUS_VOUT | PMBUS_HAVE_STATUS_IOUT | 170 | | PMBUS_HAVE_STATUS_VOUT | PMBUS_HAVE_STATUS_IOUT |
112 | | PMBUS_HAVE_STATUS_TEMP, | 171 | | PMBUS_HAVE_STATUS_TEMP, |
113 | .read_byte_data = max8688_read_byte_data, | 172 | .read_byte_data = max8688_read_byte_data, |
173 | .read_word_data = max8688_read_word_data, | ||
174 | .write_word_data = max8688_write_word_data, | ||
114 | }; | 175 | }; |
115 | 176 | ||
116 | static int max8688_probe(struct i2c_client *client, | 177 | static int max8688_probe(struct i2c_client *client, |