aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/hwmon/max344406
-rw-r--r--drivers/hwmon/pmbus/max34440.c63
2 files changed, 69 insertions, 0 deletions
diff --git a/Documentation/hwmon/max34440 b/Documentation/hwmon/max34440
index 6c525dd07d59..8ab51536a1eb 100644
--- a/Documentation/hwmon/max34440
+++ b/Documentation/hwmon/max34440
@@ -56,6 +56,8 @@ in[1-6]_min_alarm Voltage low alarm. From VOLTAGE_UV_WARNING status.
56in[1-6]_max_alarm Voltage high alarm. From VOLTAGE_OV_WARNING status. 56in[1-6]_max_alarm Voltage high alarm. From VOLTAGE_OV_WARNING status.
57in[1-6]_lcrit_alarm Voltage critical low alarm. From VOLTAGE_UV_FAULT status. 57in[1-6]_lcrit_alarm Voltage critical low alarm. From VOLTAGE_UV_FAULT status.
58in[1-6]_crit_alarm Voltage critical high alarm. From VOLTAGE_OV_FAULT status. 58in[1-6]_crit_alarm Voltage critical high alarm. From VOLTAGE_OV_FAULT status.
59in[1-6]_highest Historical maximum voltage.
60in[1-6]_reset_history Write any value to reset history.
59 61
60curr[1-6]_label "iout[1-6]". 62curr[1-6]_label "iout[1-6]".
61curr[1-6]_input Measured current. From READ_IOUT register. 63curr[1-6]_input Measured current. From READ_IOUT register.
@@ -63,6 +65,8 @@ curr[1-6]_max Maximum current. From IOUT_OC_WARN_LIMIT register.
63curr[1-6]_crit Critical maximum current. From IOUT_OC_FAULT_LIMIT register. 65curr[1-6]_crit Critical maximum current. From IOUT_OC_FAULT_LIMIT register.
64curr[1-6]_max_alarm Current high alarm. From IOUT_OC_WARNING status. 66curr[1-6]_max_alarm Current high alarm. From IOUT_OC_WARNING status.
65curr[1-6]_crit_alarm Current critical high alarm. From IOUT_OC_FAULT status. 67curr[1-6]_crit_alarm Current critical high alarm. From IOUT_OC_FAULT status.
68curr[1-6]_highest Historical maximum current.
69curr[1-6]_reset_history Write any value to reset history.
66 70
67 in6 and curr6 attributes only exist for MAX34440. 71 in6 and curr6 attributes only exist for MAX34440.
68 72
@@ -75,5 +79,7 @@ temp[1-8]_max Maximum temperature. From OT_WARN_LIMIT register.
75temp[1-8]_crit Critical high temperature. From OT_FAULT_LIMIT register. 79temp[1-8]_crit Critical high temperature. From OT_FAULT_LIMIT register.
76temp[1-8]_max_alarm Temperature high alarm. 80temp[1-8]_max_alarm Temperature high alarm.
77temp[1-8]_crit_alarm Temperature critical high alarm. 81temp[1-8]_crit_alarm Temperature critical high alarm.
82temp[1-8]_highest Historical maximum temperature.
83temp[1-8]_reset_history Write any value to reset history.
78 84
79 temp7 and temp8 attributes only exist for MAX34440. 85 temp7 and temp8 attributes only exist for MAX34440.
diff --git a/drivers/hwmon/pmbus/max34440.c b/drivers/hwmon/pmbus/max34440.c
index 2e30046a116e..fda621d2e458 100644
--- a/drivers/hwmon/pmbus/max34440.c
+++ b/drivers/hwmon/pmbus/max34440.c
@@ -27,11 +27,70 @@
27 27
28enum chips { max34440, max34441 }; 28enum chips { max34440, max34441 };
29 29
30#define MAX34440_MFR_VOUT_PEAK 0xd4
31#define MAX34440_MFR_IOUT_PEAK 0xd5
32#define MAX34440_MFR_TEMPERATURE_PEAK 0xd6
33
30#define MAX34440_STATUS_OC_WARN (1 << 0) 34#define MAX34440_STATUS_OC_WARN (1 << 0)
31#define MAX34440_STATUS_OC_FAULT (1 << 1) 35#define MAX34440_STATUS_OC_FAULT (1 << 1)
32#define MAX34440_STATUS_OT_FAULT (1 << 5) 36#define MAX34440_STATUS_OT_FAULT (1 << 5)
33#define MAX34440_STATUS_OT_WARN (1 << 6) 37#define MAX34440_STATUS_OT_WARN (1 << 6)
34 38
39static int max34440_read_word_data(struct i2c_client *client, int page, int reg)
40{
41 int ret;
42
43 switch (reg) {
44 case PMBUS_VIRT_READ_VOUT_MAX:
45 ret = pmbus_read_word_data(client, page,
46 MAX34440_MFR_VOUT_PEAK);
47 break;
48 case PMBUS_VIRT_READ_IOUT_MAX:
49 ret = pmbus_read_word_data(client, page,
50 MAX34440_MFR_IOUT_PEAK);
51 break;
52 case PMBUS_VIRT_READ_TEMP_MAX:
53 ret = pmbus_read_word_data(client, page,
54 MAX34440_MFR_TEMPERATURE_PEAK);
55 break;
56 case PMBUS_VIRT_RESET_VOUT_HISTORY:
57 case PMBUS_VIRT_RESET_IOUT_HISTORY:
58 case PMBUS_VIRT_RESET_TEMP_HISTORY:
59 ret = 0;
60 break;
61 default:
62 ret = -ENODATA;
63 break;
64 }
65 return ret;
66}
67
68static int max34440_write_word_data(struct i2c_client *client, int page,
69 int reg, u16 word)
70{
71 int ret;
72
73 switch (reg) {
74 case PMBUS_VIRT_RESET_VOUT_HISTORY:
75 ret = pmbus_write_word_data(client, page,
76 MAX34440_MFR_VOUT_PEAK, 0);
77 break;
78 case PMBUS_VIRT_RESET_IOUT_HISTORY:
79 ret = pmbus_write_word_data(client, page,
80 MAX34440_MFR_IOUT_PEAK, 0);
81 break;
82 case PMBUS_VIRT_RESET_TEMP_HISTORY:
83 ret = pmbus_write_word_data(client, page,
84 MAX34440_MFR_TEMPERATURE_PEAK,
85 0xffff);
86 break;
87 default:
88 ret = -ENODATA;
89 break;
90 }
91 return ret;
92}
93
35static int max34440_read_byte_data(struct i2c_client *client, int page, int reg) 94static int max34440_read_byte_data(struct i2c_client *client, int page, int reg)
36{ 95{
37 int ret; 96 int ret;
@@ -109,6 +168,8 @@ static struct pmbus_driver_info max34440_info[] = {
109 .func[12] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP, 168 .func[12] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP,
110 .func[13] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP, 169 .func[13] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP,
111 .read_byte_data = max34440_read_byte_data, 170 .read_byte_data = max34440_read_byte_data,
171 .read_word_data = max34440_read_word_data,
172 .write_word_data = max34440_write_word_data,
112 }, 173 },
113 [max34441] = { 174 [max34441] = {
114 .pages = 12, 175 .pages = 12,
@@ -150,6 +211,8 @@ static struct pmbus_driver_info max34440_info[] = {
150 .func[10] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP, 211 .func[10] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP,
151 .func[11] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP, 212 .func[11] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP,
152 .read_byte_data = max34440_read_byte_data, 213 .read_byte_data = max34440_read_byte_data,
214 .read_word_data = max34440_read_word_data,
215 .write_word_data = max34440_write_word_data,
153 }, 216 },
154}; 217};
155 218