Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 261756
b: refs/heads/master
c: 8ebed85
h: refs/heads/master
v: v3
  • Loading branch information
Guenter Roeck committed Jul 29, 2011
1 parent 5131677 commit c3d868d
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c576e30cd0c9814b3b45772d46924d796f538dee
refs/heads/master: 8ebed854506301f4f67e75c73cae967d4a45ab4d
4 changes: 4 additions & 0 deletions trunk/Documentation/hwmon/max16064
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ in[1-4]_min_alarm Voltage low alarm. From VOLTAGE_UV_WARNING status.
in[1-4]_max_alarm Voltage high alarm. From VOLTAGE_OV_WARNING status.
in[1-4]_lcrit_alarm Voltage critical low alarm. From VOLTAGE_UV_FAULT status.
in[1-4]_crit_alarm Voltage critical high alarm. From VOLTAGE_OV_FAULT status.
in[1-4]_highest Historical maximum voltage.
in[1-4]_reset_history Write any value to reset history.

temp1_input Measured temperature. From READ_TEMPERATURE_1 register.
temp1_max Maximum temperature. From OT_WARN_LIMIT register.
Expand All @@ -60,3 +62,5 @@ temp1_max_alarm Chip temperature high alarm. Set by comparing
temp1_crit_alarm Chip temperature critical high alarm. Set by comparing
READ_TEMPERATURE_1 with OT_FAULT_LIMIT if TEMP_OT_FAULT
status is set.
temp1_highest Historical maximum temperature.
temp1_reset_history Write any value to reset history.
51 changes: 51 additions & 0 deletions trunk/drivers/hwmon/pmbus/max16064.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,55 @@
#include <linux/i2c.h>
#include "pmbus.h"

#define MAX16064_MFR_VOUT_PEAK 0xd4
#define MAX16064_MFR_TEMPERATURE_PEAK 0xd6

static int max16064_read_word_data(struct i2c_client *client, int page, int reg)
{
int ret;

switch (reg) {
case PMBUS_VIRT_READ_VOUT_MAX:
ret = pmbus_read_word_data(client, page,
MAX16064_MFR_VOUT_PEAK);
break;
case PMBUS_VIRT_READ_TEMP_MAX:
ret = pmbus_read_word_data(client, page,
MAX16064_MFR_TEMPERATURE_PEAK);
break;
case PMBUS_VIRT_RESET_VOUT_HISTORY:
case PMBUS_VIRT_RESET_TEMP_HISTORY:
ret = 0;
break;
default:
ret = -ENODATA;
break;
}
return ret;
}

static int max16064_write_word_data(struct i2c_client *client, int page,
int reg, u16 word)
{
int ret;

switch (reg) {
case PMBUS_VIRT_RESET_VOUT_HISTORY:
ret = pmbus_write_word_data(client, page,
MAX16064_MFR_VOUT_PEAK, 0);
break;
case PMBUS_VIRT_RESET_TEMP_HISTORY:
ret = pmbus_write_word_data(client, page,
MAX16064_MFR_TEMPERATURE_PEAK,
0xffff);
break;
default:
ret = -ENODATA;
break;
}
return ret;
}

static struct pmbus_driver_info max16064_info = {
.pages = 4,
.format[PSC_VOLTAGE_IN] = direct,
Expand All @@ -44,6 +93,8 @@ static struct pmbus_driver_info max16064_info = {
.func[1] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT,
.func[2] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT,
.func[3] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT,
.read_word_data = max16064_read_word_data,
.write_word_data = max16064_write_word_data,
};

static int max16064_probe(struct i2c_client *client,
Expand Down

0 comments on commit c3d868d

Please sign in to comment.