aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/hwmon/max86886
-rw-r--r--drivers/hwmon/pmbus/max8688.c61
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.
50in1_max_alarm Voltage high alarm. From VOLTAGE_OV_WARNING status. 50in1_max_alarm Voltage high alarm. From VOLTAGE_OV_WARNING status.
51in1_lcrit_alarm Voltage critical low alarm. From VOLTAGE_UV_FAULT status. 51in1_lcrit_alarm Voltage critical low alarm. From VOLTAGE_UV_FAULT status.
52in1_crit_alarm Voltage critical high alarm. From VOLTAGE_OV_FAULT status. 52in1_crit_alarm Voltage critical high alarm. From VOLTAGE_OV_FAULT status.
53in1_highest Historical maximum voltage.
54in1_reset_history Write any value to reset history.
53 55
54curr1_label "iout1" 56curr1_label "iout1"
55curr1_input Measured current. From READ_IOUT register. 57curr1_input Measured current. From READ_IOUT register.
@@ -57,6 +59,8 @@ curr1_max Maximum current. From IOUT_OC_WARN_LIMIT register.
57curr1_crit Critical maximum current. From IOUT_OC_FAULT_LIMIT register. 59curr1_crit Critical maximum current. From IOUT_OC_FAULT_LIMIT register.
58curr1_max_alarm Current high alarm. From IOUT_OC_WARN_LIMIT register. 60curr1_max_alarm Current high alarm. From IOUT_OC_WARN_LIMIT register.
59curr1_crit_alarm Current critical high alarm. From IOUT_OC_FAULT status. 61curr1_crit_alarm Current critical high alarm. From IOUT_OC_FAULT status.
62curr1_highest Historical maximum current.
63curr1_reset_history Write any value to reset history.
60 64
61temp1_input Measured temperature. From READ_TEMPERATURE_1 register. 65temp1_input Measured temperature. From READ_TEMPERATURE_1 register.
62temp1_max Maximum temperature. From OT_WARN_LIMIT register. 66temp1_max Maximum temperature. From OT_WARN_LIMIT register.
@@ -67,3 +71,5 @@ temp1_max_alarm Chip temperature high alarm. Set by comparing
67temp1_crit_alarm Chip temperature critical high alarm. Set by comparing 71temp1_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.
74temp1_highest Historical maximum temperature.
75temp1_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
43static 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
73static 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
40static int max8688_read_byte_data(struct i2c_client *client, int page, int reg) 99static 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
116static int max8688_probe(struct i2c_client *client, 177static int max8688_probe(struct i2c_client *client,