Commit a66a6eb9 authored by Edward A. James's avatar Edward A. James Committed by Guenter Roeck

hwmon: (pmbus): Switch status registers to 16 bit

Switch the storage of status registers to 16 bit values. This allows us
to store all the bits of STATUS_WORD.
Signed-off-by: default avatarEdward A. James <eajames@us.ibm.com>
Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
parent 384548e5
...@@ -112,7 +112,7 @@ struct pmbus_data { ...@@ -112,7 +112,7 @@ struct pmbus_data {
* A single status register covers multiple attributes, * A single status register covers multiple attributes,
* so we keep them all together. * so we keep them all together.
*/ */
u8 status[PB_NUM_STATUS_REG]; u16 status[PB_NUM_STATUS_REG];
u8 status_register; u8 status_register;
u8 currpage; u8 currpage;
...@@ -716,10 +716,10 @@ static int pmbus_get_boolean(struct pmbus_data *data, struct pmbus_boolean *b, ...@@ -716,10 +716,10 @@ static int pmbus_get_boolean(struct pmbus_data *data, struct pmbus_boolean *b,
{ {
struct pmbus_sensor *s1 = b->s1; struct pmbus_sensor *s1 = b->s1;
struct pmbus_sensor *s2 = b->s2; struct pmbus_sensor *s2 = b->s2;
u16 reg = (index >> 8) & 0xffff; u16 reg = (index >> 16) & 0xffff;
u8 mask = index & 0xff; u16 mask = index & 0xffff;
int ret, status; int ret, status;
u8 regval; u16 regval;
status = data->status[reg]; status = data->status[reg];
if (status < 0) if (status < 0)
...@@ -860,7 +860,7 @@ static int pmbus_add_boolean(struct pmbus_data *data, ...@@ -860,7 +860,7 @@ static int pmbus_add_boolean(struct pmbus_data *data,
const char *name, const char *type, int seq, const char *name, const char *type, int seq,
struct pmbus_sensor *s1, struct pmbus_sensor *s1,
struct pmbus_sensor *s2, struct pmbus_sensor *s2,
u16 reg, u8 mask) u16 reg, u16 mask)
{ {
struct pmbus_boolean *boolean; struct pmbus_boolean *boolean;
struct sensor_device_attribute *a; struct sensor_device_attribute *a;
...@@ -876,7 +876,7 @@ static int pmbus_add_boolean(struct pmbus_data *data, ...@@ -876,7 +876,7 @@ static int pmbus_add_boolean(struct pmbus_data *data,
boolean->s1 = s1; boolean->s1 = s1;
boolean->s2 = s2; boolean->s2 = s2;
pmbus_attr_init(a, boolean->name, S_IRUGO, pmbus_show_boolean, NULL, pmbus_attr_init(a, boolean->name, S_IRUGO, pmbus_show_boolean, NULL,
(reg << 8) | mask); (reg << 16) | mask);
return pmbus_add_attribute(data, &a->dev_attr.attr); return pmbus_add_attribute(data, &a->dev_attr.attr);
} }
...@@ -962,7 +962,7 @@ struct pmbus_limit_attr { ...@@ -962,7 +962,7 @@ struct pmbus_limit_attr {
*/ */
struct pmbus_sensor_attr { struct pmbus_sensor_attr {
u16 reg; /* sensor register */ u16 reg; /* sensor register */
u8 gbit; /* generic status bit */ u16 gbit; /* generic status bit */
u8 nlimit; /* # of limit registers */ u8 nlimit; /* # of limit registers */
enum pmbus_sensor_classes class;/* sensor class */ enum pmbus_sensor_classes class;/* sensor class */
const char *label; /* sensor label */ const char *label; /* sensor label */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment