diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-03-27 20:03:39 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-03-27 20:03:39 -0700 |
commit | 4329510c22af1d0cfcc291dc4ce6274abebfe170 (patch) | |
tree | 20f78e40c7c919ce01d1ab5f648d95cfa9710814 /drivers/hwmon | |
parent | 17c6dd8144924e3c71930636091704da6d043536 (diff) | |
parent | 3506999e2fd1eb7ed7375eaa67dcc1d1d60e8ccd (diff) |
Merge branch 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/staging
* 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/staging:
hwmon: (pmbus) Fix temperature limit register access
Diffstat (limited to 'drivers/hwmon')
-rw-r--r-- | drivers/hwmon/pmbus_core.c | 70 |
1 files changed, 36 insertions, 34 deletions
diff --git a/drivers/hwmon/pmbus_core.c b/drivers/hwmon/pmbus_core.c index 6474512f49b0..edfb92e41735 100644 --- a/drivers/hwmon/pmbus_core.c +++ b/drivers/hwmon/pmbus_core.c @@ -752,7 +752,7 @@ static void pmbus_add_boolean_cmp(struct pmbus_data *data, static void pmbus_add_sensor(struct pmbus_data *data, const char *name, const char *type, int seq, int page, int reg, enum pmbus_sensor_classes class, - bool update) + bool update, bool readonly) { struct pmbus_sensor *sensor; @@ -765,7 +765,7 @@ static void pmbus_add_sensor(struct pmbus_data *data, sensor->reg = reg; sensor->class = class; sensor->update = update; - if (update) + if (readonly) PMBUS_ADD_GET_ATTR(data, sensor->name, sensor, data->num_sensors); else @@ -916,14 +916,14 @@ static void pmbus_find_attributes(struct i2c_client *client, i0 = data->num_sensors; pmbus_add_label(data, "in", in_index, "vin", 0); - pmbus_add_sensor(data, "in", "input", in_index, - 0, PMBUS_READ_VIN, PSC_VOLTAGE_IN, true); + pmbus_add_sensor(data, "in", "input", in_index, 0, + PMBUS_READ_VIN, PSC_VOLTAGE_IN, true, true); if (pmbus_check_word_register(client, 0, PMBUS_VIN_UV_WARN_LIMIT)) { i1 = data->num_sensors; pmbus_add_sensor(data, "in", "min", in_index, 0, PMBUS_VIN_UV_WARN_LIMIT, - PSC_VOLTAGE_IN, false); + PSC_VOLTAGE_IN, false, false); if (info->func[0] & PMBUS_HAVE_STATUS_INPUT) { pmbus_add_boolean_reg(data, "in", "min_alarm", in_index, @@ -937,7 +937,7 @@ static void pmbus_find_attributes(struct i2c_client *client, i1 = data->num_sensors; pmbus_add_sensor(data, "in", "lcrit", in_index, 0, PMBUS_VIN_UV_FAULT_LIMIT, - PSC_VOLTAGE_IN, false); + PSC_VOLTAGE_IN, false, false); if (info->func[0] & PMBUS_HAVE_STATUS_INPUT) { pmbus_add_boolean_reg(data, "in", "lcrit_alarm", in_index, @@ -951,7 +951,7 @@ static void pmbus_find_attributes(struct i2c_client *client, i1 = data->num_sensors; pmbus_add_sensor(data, "in", "max", in_index, 0, PMBUS_VIN_OV_WARN_LIMIT, - PSC_VOLTAGE_IN, false); + PSC_VOLTAGE_IN, false, false); if (info->func[0] & PMBUS_HAVE_STATUS_INPUT) { pmbus_add_boolean_reg(data, "in", "max_alarm", in_index, @@ -965,7 +965,7 @@ static void pmbus_find_attributes(struct i2c_client *client, i1 = data->num_sensors; pmbus_add_sensor(data, "in", "crit", in_index, 0, PMBUS_VIN_OV_FAULT_LIMIT, - PSC_VOLTAGE_IN, false); + PSC_VOLTAGE_IN, false, false); if (info->func[0] & PMBUS_HAVE_STATUS_INPUT) { pmbus_add_boolean_reg(data, "in", "crit_alarm", in_index, @@ -988,7 +988,7 @@ static void pmbus_find_attributes(struct i2c_client *client, if (info->func[0] & PMBUS_HAVE_VCAP) { pmbus_add_label(data, "in", in_index, "vcap", 0); pmbus_add_sensor(data, "in", "input", in_index, 0, - PMBUS_READ_VCAP, PSC_VOLTAGE_IN, true); + PMBUS_READ_VCAP, PSC_VOLTAGE_IN, true, true); in_index++; } @@ -1004,13 +1004,13 @@ static void pmbus_find_attributes(struct i2c_client *client, i0 = data->num_sensors; pmbus_add_label(data, "in", in_index, "vout", page + 1); pmbus_add_sensor(data, "in", "input", in_index, page, - PMBUS_READ_VOUT, PSC_VOLTAGE_OUT, true); + PMBUS_READ_VOUT, PSC_VOLTAGE_OUT, true, true); if (pmbus_check_word_register(client, page, PMBUS_VOUT_UV_WARN_LIMIT)) { i1 = data->num_sensors; pmbus_add_sensor(data, "in", "min", in_index, page, PMBUS_VOUT_UV_WARN_LIMIT, - PSC_VOLTAGE_OUT, false); + PSC_VOLTAGE_OUT, false, false); if (info->func[page] & PMBUS_HAVE_STATUS_VOUT) { pmbus_add_boolean_reg(data, "in", "min_alarm", in_index, @@ -1025,7 +1025,7 @@ static void pmbus_find_attributes(struct i2c_client *client, i1 = data->num_sensors; pmbus_add_sensor(data, "in", "lcrit", in_index, page, PMBUS_VOUT_UV_FAULT_LIMIT, - PSC_VOLTAGE_OUT, false); + PSC_VOLTAGE_OUT, false, false); if (info->func[page] & PMBUS_HAVE_STATUS_VOUT) { pmbus_add_boolean_reg(data, "in", "lcrit_alarm", in_index, @@ -1040,7 +1040,7 @@ static void pmbus_find_attributes(struct i2c_client *client, i1 = data->num_sensors; pmbus_add_sensor(data, "in", "max", in_index, page, PMBUS_VOUT_OV_WARN_LIMIT, - PSC_VOLTAGE_OUT, false); + PSC_VOLTAGE_OUT, false, false); if (info->func[page] & PMBUS_HAVE_STATUS_VOUT) { pmbus_add_boolean_reg(data, "in", "max_alarm", in_index, @@ -1055,7 +1055,7 @@ static void pmbus_find_attributes(struct i2c_client *client, i1 = data->num_sensors; pmbus_add_sensor(data, "in", "crit", in_index, page, PMBUS_VOUT_OV_FAULT_LIMIT, - PSC_VOLTAGE_OUT, false); + PSC_VOLTAGE_OUT, false, false); if (info->func[page] & PMBUS_HAVE_STATUS_VOUT) { pmbus_add_boolean_reg(data, "in", "crit_alarm", in_index, @@ -1088,14 +1088,14 @@ static void pmbus_find_attributes(struct i2c_client *client, if (info->func[0] & PMBUS_HAVE_IIN) { i0 = data->num_sensors; pmbus_add_label(data, "curr", in_index, "iin", 0); - pmbus_add_sensor(data, "curr", "input", in_index, - 0, PMBUS_READ_IIN, PSC_CURRENT_IN, true); + pmbus_add_sensor(data, "curr", "input", in_index, 0, + PMBUS_READ_IIN, PSC_CURRENT_IN, true, true); if (pmbus_check_word_register(client, 0, PMBUS_IIN_OC_WARN_LIMIT)) { i1 = data->num_sensors; pmbus_add_sensor(data, "curr", "max", in_index, 0, PMBUS_IIN_OC_WARN_LIMIT, - PSC_CURRENT_IN, false); + PSC_CURRENT_IN, false, false); if (info->func[0] & PMBUS_HAVE_STATUS_INPUT) { pmbus_add_boolean_reg(data, "curr", "max_alarm", in_index, @@ -1108,7 +1108,7 @@ static void pmbus_find_attributes(struct i2c_client *client, i1 = data->num_sensors; pmbus_add_sensor(data, "curr", "crit", in_index, 0, PMBUS_IIN_OC_FAULT_LIMIT, - PSC_CURRENT_IN, false); + PSC_CURRENT_IN, false, false); if (info->func[0] & PMBUS_HAVE_STATUS_INPUT) pmbus_add_boolean_reg(data, "curr", "crit_alarm", @@ -1131,13 +1131,13 @@ static void pmbus_find_attributes(struct i2c_client *client, i0 = data->num_sensors; pmbus_add_label(data, "curr", in_index, "iout", page + 1); pmbus_add_sensor(data, "curr", "input", in_index, page, - PMBUS_READ_IOUT, PSC_CURRENT_OUT, true); + PMBUS_READ_IOUT, PSC_CURRENT_OUT, true, true); if (pmbus_check_word_register(client, page, PMBUS_IOUT_OC_WARN_LIMIT)) { i1 = data->num_sensors; pmbus_add_sensor(data, "curr", "max", in_index, page, PMBUS_IOUT_OC_WARN_LIMIT, - PSC_CURRENT_OUT, false); + PSC_CURRENT_OUT, false, false); if (info->func[page] & PMBUS_HAVE_STATUS_IOUT) { pmbus_add_boolean_reg(data, "curr", "max_alarm", in_index, @@ -1151,7 +1151,7 @@ static void pmbus_find_attributes(struct i2c_client *client, i1 = data->num_sensors; pmbus_add_sensor(data, "curr", "lcrit", in_index, page, PMBUS_IOUT_UC_FAULT_LIMIT, - PSC_CURRENT_OUT, false); + PSC_CURRENT_OUT, false, false); if (info->func[page] & PMBUS_HAVE_STATUS_IOUT) { pmbus_add_boolean_reg(data, "curr", "lcrit_alarm", @@ -1166,7 +1166,7 @@ static void pmbus_find_attributes(struct i2c_client *client, i1 = data->num_sensors; pmbus_add_sensor(data, "curr", "crit", in_index, page, PMBUS_IOUT_OC_FAULT_LIMIT, - PSC_CURRENT_OUT, false); + PSC_CURRENT_OUT, false, false); if (info->func[page] & PMBUS_HAVE_STATUS_IOUT) { pmbus_add_boolean_reg(data, "curr", "crit_alarm", @@ -1199,13 +1199,13 @@ static void pmbus_find_attributes(struct i2c_client *client, i0 = data->num_sensors; pmbus_add_label(data, "power", in_index, "pin", 0); pmbus_add_sensor(data, "power", "input", in_index, - 0, PMBUS_READ_PIN, PSC_POWER, true); + 0, PMBUS_READ_PIN, PSC_POWER, true, true); if (pmbus_check_word_register(client, 0, PMBUS_PIN_OP_WARN_LIMIT)) { i1 = data->num_sensors; pmbus_add_sensor(data, "power", "max", in_index, 0, PMBUS_PIN_OP_WARN_LIMIT, PSC_POWER, - false); + false, false); if (info->func[0] & PMBUS_HAVE_STATUS_INPUT) pmbus_add_boolean_reg(data, "power", "alarm", @@ -1228,7 +1228,7 @@ static void pmbus_find_attributes(struct i2c_client *client, i0 = data->num_sensors; pmbus_add_label(data, "power", in_index, "pout", page + 1); pmbus_add_sensor(data, "power", "input", in_index, page, - PMBUS_READ_POUT, PSC_POWER, true); + PMBUS_READ_POUT, PSC_POWER, true, true); /* * Per hwmon sysfs API, power_cap is to be used to limit output * power. @@ -1241,7 +1241,8 @@ static void pmbus_find_attributes(struct i2c_client *client, if (pmbus_check_word_register(client, page, PMBUS_POUT_MAX)) { i1 = data->num_sensors; pmbus_add_sensor(data, "power", "cap", in_index, page, - PMBUS_POUT_MAX, PSC_POWER, false); + PMBUS_POUT_MAX, PSC_POWER, + false, false); need_alarm = true; } if (pmbus_check_word_register(client, page, @@ -1249,7 +1250,7 @@ static void pmbus_find_attributes(struct i2c_client *client, i1 = data->num_sensors; pmbus_add_sensor(data, "power", "max", in_index, page, PMBUS_POUT_OP_WARN_LIMIT, PSC_POWER, - false); + false, false); need_alarm = true; } if (need_alarm && (info->func[page] & PMBUS_HAVE_STATUS_IOUT)) @@ -1264,7 +1265,7 @@ static void pmbus_find_attributes(struct i2c_client *client, i1 = data->num_sensors; pmbus_add_sensor(data, "power", "crit", in_index, page, PMBUS_POUT_OP_FAULT_LIMIT, PSC_POWER, - false); + false, false); if (info->func[page] & PMBUS_HAVE_STATUS_IOUT) pmbus_add_boolean_reg(data, "power", "crit_alarm", @@ -1302,7 +1303,7 @@ static void pmbus_find_attributes(struct i2c_client *client, i0 = data->num_sensors; pmbus_add_sensor(data, "temp", "input", in_index, page, pmbus_temp_registers[t], - PSC_TEMPERATURE, true); + PSC_TEMPERATURE, true, true); /* * PMBus provides only one status register for TEMP1-3. @@ -1323,7 +1324,7 @@ static void pmbus_find_attributes(struct i2c_client *client, i1 = data->num_sensors; pmbus_add_sensor(data, "temp", "min", in_index, page, PMBUS_UT_WARN_LIMIT, - PSC_TEMPERATURE, true); + PSC_TEMPERATURE, true, false); if (info->func[page] & PMBUS_HAVE_STATUS_TEMP) { pmbus_add_boolean_cmp(data, "temp", "min_alarm", in_index, i1, i0, @@ -1338,7 +1339,7 @@ static void pmbus_find_attributes(struct i2c_client *client, pmbus_add_sensor(data, "temp", "lcrit", in_index, page, PMBUS_UT_FAULT_LIMIT, - PSC_TEMPERATURE, true); + PSC_TEMPERATURE, true, false); if (info->func[page] & PMBUS_HAVE_STATUS_TEMP) { pmbus_add_boolean_cmp(data, "temp", "lcrit_alarm", in_index, i1, i0, @@ -1352,7 +1353,7 @@ static void pmbus_find_attributes(struct i2c_client *client, i1 = data->num_sensors; pmbus_add_sensor(data, "temp", "max", in_index, page, PMBUS_OT_WARN_LIMIT, - PSC_TEMPERATURE, true); + PSC_TEMPERATURE, true, false); if (info->func[page] & PMBUS_HAVE_STATUS_TEMP) { pmbus_add_boolean_cmp(data, "temp", "max_alarm", in_index, i0, i1, @@ -1366,7 +1367,7 @@ static void pmbus_find_attributes(struct i2c_client *client, i1 = data->num_sensors; pmbus_add_sensor(data, "temp", "crit", in_index, page, PMBUS_OT_FAULT_LIMIT, - PSC_TEMPERATURE, true); + PSC_TEMPERATURE, true, false); if (info->func[page] & PMBUS_HAVE_STATUS_TEMP) { pmbus_add_boolean_cmp(data, "temp", "crit_alarm", in_index, i0, i1, @@ -1421,7 +1422,8 @@ static void pmbus_find_attributes(struct i2c_client *client, i0 = data->num_sensors; pmbus_add_sensor(data, "fan", "input", in_index, page, - pmbus_fan_registers[f], PSC_FAN, true); + pmbus_fan_registers[f], PSC_FAN, true, + true); /* * Each fan status register covers multiple fans, |