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 /drivers/hwmon/pmbus | |
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>
Diffstat (limited to 'drivers/hwmon/pmbus')
-rw-r--r-- | drivers/hwmon/pmbus/max16064.c | 51 |
1 files changed, 51 insertions, 0 deletions
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, |