diff options
| -rw-r--r-- | Documentation/hwmon/sysfs-interface | 33 | ||||
| -rw-r--r-- | MAINTAINERS | 6 | ||||
| -rw-r--r-- | drivers/hwmon/abituguru3.c | 18 | ||||
| -rw-r--r-- | drivers/hwmon/adt7473.c | 3 | ||||
| -rw-r--r-- | drivers/hwmon/lm75.c | 20 | ||||
| -rw-r--r-- | drivers/hwmon/lm85.c | 25 |
6 files changed, 60 insertions, 45 deletions
diff --git a/Documentation/hwmon/sysfs-interface b/Documentation/hwmon/sysfs-interface index f4a8ebc1ef1a..2d845730d4e0 100644 --- a/Documentation/hwmon/sysfs-interface +++ b/Documentation/hwmon/sysfs-interface | |||
| @@ -2,17 +2,12 @@ Naming and data format standards for sysfs files | |||
| 2 | ------------------------------------------------ | 2 | ------------------------------------------------ |
| 3 | 3 | ||
| 4 | The libsensors library offers an interface to the raw sensors data | 4 | The libsensors library offers an interface to the raw sensors data |
| 5 | through the sysfs interface. See libsensors documentation and source for | 5 | through the sysfs interface. Since lm-sensors 3.0.0, libsensors is |
| 6 | further information. As of writing this document, libsensors | 6 | completely chip-independent. It assumes that all the kernel drivers |
| 7 | (from lm_sensors 2.8.3) is heavily chip-dependent. Adding or updating | 7 | implement the standard sysfs interface described in this document. |
| 8 | support for any given chip requires modifying the library's code. | 8 | This makes adding or updating support for any given chip very easy, as |
| 9 | This is because libsensors was written for the procfs interface | 9 | libsensors, and applications using it, do not need to be modified. |
| 10 | older kernel modules were using, which wasn't standardized enough. | 10 | This is a major improvement compared to lm-sensors 2. |
| 11 | Recent versions of libsensors (from lm_sensors 2.8.2 and later) have | ||
| 12 | support for the sysfs interface, though. | ||
| 13 | |||
| 14 | The new sysfs interface was designed to be as chip-independent as | ||
| 15 | possible. | ||
| 16 | 11 | ||
| 17 | Note that motherboards vary widely in the connections to sensor chips. | 12 | Note that motherboards vary widely in the connections to sensor chips. |
| 18 | There is no standard that ensures, for example, that the second | 13 | There is no standard that ensures, for example, that the second |
| @@ -35,19 +30,17 @@ access this data in a simple and consistent way. That said, such programs | |||
| 35 | will have to implement conversion, labeling and hiding of inputs. For | 30 | will have to implement conversion, labeling and hiding of inputs. For |
| 36 | this reason, it is still not recommended to bypass the library. | 31 | this reason, it is still not recommended to bypass the library. |
| 37 | 32 | ||
| 38 | If you are developing a userspace application please send us feedback on | ||
| 39 | this standard. | ||
| 40 | |||
| 41 | Note that this standard isn't completely established yet, so it is subject | ||
| 42 | to changes. If you are writing a new hardware monitoring driver those | ||
| 43 | features can't seem to fit in this interface, please contact us with your | ||
| 44 | extension proposal. Keep in mind that backward compatibility must be | ||
| 45 | preserved. | ||
| 46 | |||
| 47 | Each chip gets its own directory in the sysfs /sys/devices tree. To | 33 | Each chip gets its own directory in the sysfs /sys/devices tree. To |
| 48 | find all sensor chips, it is easier to follow the device symlinks from | 34 | find all sensor chips, it is easier to follow the device symlinks from |
| 49 | /sys/class/hwmon/hwmon*. | 35 | /sys/class/hwmon/hwmon*. |
| 50 | 36 | ||
| 37 | Up to lm-sensors 3.0.0, libsensors looks for hardware monitoring attributes | ||
| 38 | in the "physical" device directory. Since lm-sensors 3.0.1, attributes found | ||
| 39 | in the hwmon "class" device directory are also supported. Complex drivers | ||
| 40 | (e.g. drivers for multifunction chips) may want to use this possibility to | ||
| 41 | avoid namespace pollution. The only drawback will be that older versions of | ||
| 42 | libsensors won't support the driver in question. | ||
| 43 | |||
| 51 | All sysfs values are fixed point numbers. | 44 | All sysfs values are fixed point numbers. |
| 52 | 45 | ||
| 53 | There is only one value per file, unlike the older /proc specification. | 46 | There is only one value per file, unlike the older /proc specification. |
diff --git a/MAINTAINERS b/MAINTAINERS index cd587eec9fa7..8f0ec46a7096 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
| @@ -4431,10 +4431,10 @@ M: johnpol@2ka.mipt.ru | |||
| 4431 | S: Maintained | 4431 | S: Maintained |
| 4432 | 4432 | ||
| 4433 | W83791D HARDWARE MONITORING DRIVER | 4433 | W83791D HARDWARE MONITORING DRIVER |
| 4434 | P: Charles Spirakis | 4434 | P: Marc Hulsman |
| 4435 | M: bezaur@gmail.com | 4435 | M: m.hulsman@tudelft.nl |
| 4436 | L: lm-sensors@lm-sensors.org | 4436 | L: lm-sensors@lm-sensors.org |
| 4437 | S: Odd Fixes | 4437 | S: Maintained |
| 4438 | 4438 | ||
| 4439 | W83793 HARDWARE MONITORING DRIVER | 4439 | W83793 HARDWARE MONITORING DRIVER |
| 4440 | P: Rudolf Marek | 4440 | P: Rudolf Marek |
diff --git a/drivers/hwmon/abituguru3.c b/drivers/hwmon/abituguru3.c index ed33fddc4dee..f00f497b9ca9 100644 --- a/drivers/hwmon/abituguru3.c +++ b/drivers/hwmon/abituguru3.c | |||
| @@ -30,6 +30,7 @@ | |||
| 30 | #include <linux/platform_device.h> | 30 | #include <linux/platform_device.h> |
| 31 | #include <linux/hwmon.h> | 31 | #include <linux/hwmon.h> |
| 32 | #include <linux/hwmon-sysfs.h> | 32 | #include <linux/hwmon-sysfs.h> |
| 33 | #include <linux/dmi.h> | ||
| 33 | #include <asm/io.h> | 34 | #include <asm/io.h> |
| 34 | 35 | ||
| 35 | /* uGuru3 bank addresses */ | 36 | /* uGuru3 bank addresses */ |
| @@ -323,7 +324,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { | |||
| 323 | { "AUX1 Fan", 36, 2, 60, 1, 0 }, | 324 | { "AUX1 Fan", 36, 2, 60, 1, 0 }, |
| 324 | { NULL, 0, 0, 0, 0, 0 } } | 325 | { NULL, 0, 0, 0, 0, 0 } } |
| 325 | }, | 326 | }, |
| 326 | { 0x0013, "unknown", { | 327 | { 0x0013, "Abit AW8D", { |
| 327 | { "CPU Core", 0, 0, 10, 1, 0 }, | 328 | { "CPU Core", 0, 0, 10, 1, 0 }, |
| 328 | { "DDR", 1, 0, 10, 1, 0 }, | 329 | { "DDR", 1, 0, 10, 1, 0 }, |
| 329 | { "DDR VTT", 2, 0, 10, 1, 0 }, | 330 | { "DDR VTT", 2, 0, 10, 1, 0 }, |
| @@ -349,6 +350,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { | |||
| 349 | { "AUX2 Fan", 36, 2, 60, 1, 0 }, | 350 | { "AUX2 Fan", 36, 2, 60, 1, 0 }, |
| 350 | { "AUX3 Fan", 37, 2, 60, 1, 0 }, | 351 | { "AUX3 Fan", 37, 2, 60, 1, 0 }, |
| 351 | { "AUX4 Fan", 38, 2, 60, 1, 0 }, | 352 | { "AUX4 Fan", 38, 2, 60, 1, 0 }, |
| 353 | { "AUX5 Fan", 39, 2, 60, 1, 0 }, | ||
| 352 | { NULL, 0, 0, 0, 0, 0 } } | 354 | { NULL, 0, 0, 0, 0, 0 } } |
| 353 | }, | 355 | }, |
| 354 | { 0x0014, "Abit AB9 Pro", { | 356 | { 0x0014, "Abit AB9 Pro", { |
| @@ -1111,11 +1113,12 @@ static int __init abituguru3_detect(void) | |||
| 1111 | { | 1113 | { |
| 1112 | /* See if there is an uguru3 there. An idle uGuru3 will hold 0x00 or | 1114 | /* See if there is an uguru3 there. An idle uGuru3 will hold 0x00 or |
| 1113 | 0x08 at DATA and 0xAC at CMD. Sometimes the uGuru3 will hold 0x05 | 1115 | 0x08 at DATA and 0xAC at CMD. Sometimes the uGuru3 will hold 0x05 |
| 1114 | at CMD instead, why is unknown. So we test for 0x05 too. */ | 1116 | or 0x55 at CMD instead, why is unknown. */ |
| 1115 | u8 data_val = inb_p(ABIT_UGURU3_BASE + ABIT_UGURU3_DATA); | 1117 | u8 data_val = inb_p(ABIT_UGURU3_BASE + ABIT_UGURU3_DATA); |
| 1116 | u8 cmd_val = inb_p(ABIT_UGURU3_BASE + ABIT_UGURU3_CMD); | 1118 | u8 cmd_val = inb_p(ABIT_UGURU3_BASE + ABIT_UGURU3_CMD); |
| 1117 | if (((data_val == 0x00) || (data_val == 0x08)) && | 1119 | if (((data_val == 0x00) || (data_val == 0x08)) && |
| 1118 | ((cmd_val == 0xAC) || (cmd_val == 0x05))) | 1120 | ((cmd_val == 0xAC) || (cmd_val == 0x05) || |
| 1121 | (cmd_val == 0x55))) | ||
| 1119 | return ABIT_UGURU3_BASE; | 1122 | return ABIT_UGURU3_BASE; |
| 1120 | 1123 | ||
| 1121 | ABIT_UGURU3_DEBUG("no Abit uGuru3 found, data = 0x%02X, cmd = " | 1124 | ABIT_UGURU3_DEBUG("no Abit uGuru3 found, data = 0x%02X, cmd = " |
| @@ -1138,6 +1141,15 @@ static int __init abituguru3_init(void) | |||
| 1138 | int address, err; | 1141 | int address, err; |
| 1139 | struct resource res = { .flags = IORESOURCE_IO }; | 1142 | struct resource res = { .flags = IORESOURCE_IO }; |
| 1140 | 1143 | ||
| 1144 | #ifdef CONFIG_DMI | ||
| 1145 | const char *board_vendor = dmi_get_system_info(DMI_BOARD_VENDOR); | ||
| 1146 | |||
| 1147 | /* safety check, refuse to load on non Abit motherboards */ | ||
| 1148 | if (!force && (!board_vendor || | ||
| 1149 | strcmp(board_vendor, "http://www.abit.com.tw/"))) | ||
| 1150 | return -ENODEV; | ||
| 1151 | #endif | ||
| 1152 | |||
| 1141 | address = abituguru3_detect(); | 1153 | address = abituguru3_detect(); |
| 1142 | if (address < 0) | 1154 | if (address < 0) |
| 1143 | return address; | 1155 | return address; |
diff --git a/drivers/hwmon/adt7473.c b/drivers/hwmon/adt7473.c index c1009d6f9796..93dbf5e7ff8a 100644 --- a/drivers/hwmon/adt7473.c +++ b/drivers/hwmon/adt7473.c | |||
| @@ -309,6 +309,9 @@ no_sensor_update: | |||
| 309 | ADT7473_REG_PWM_BHVR(i)); | 309 | ADT7473_REG_PWM_BHVR(i)); |
| 310 | } | 310 | } |
| 311 | 311 | ||
| 312 | i = i2c_smbus_read_byte_data(client, ADT7473_REG_CFG4); | ||
| 313 | data->max_duty_at_overheat = !!(i & ADT7473_CFG4_MAX_DUTY_AT_OVT); | ||
| 314 | |||
| 312 | data->limits_last_updated = local_jiffies; | 315 | data->limits_last_updated = local_jiffies; |
| 313 | data->limits_valid = 1; | 316 | data->limits_valid = 1; |
| 314 | 317 | ||
diff --git a/drivers/hwmon/lm75.c b/drivers/hwmon/lm75.c index fa7696905154..de698dc73020 100644 --- a/drivers/hwmon/lm75.c +++ b/drivers/hwmon/lm75.c | |||
| @@ -251,10 +251,13 @@ static int lm75_detach_client(struct i2c_client *client) | |||
| 251 | the SMBus standard. */ | 251 | the SMBus standard. */ |
| 252 | static int lm75_read_value(struct i2c_client *client, u8 reg) | 252 | static int lm75_read_value(struct i2c_client *client, u8 reg) |
| 253 | { | 253 | { |
| 254 | int value; | ||
| 255 | |||
| 254 | if (reg == LM75_REG_CONF) | 256 | if (reg == LM75_REG_CONF) |
| 255 | return i2c_smbus_read_byte_data(client, reg); | 257 | return i2c_smbus_read_byte_data(client, reg); |
| 256 | else | 258 | |
| 257 | return swab16(i2c_smbus_read_word_data(client, reg)); | 259 | value = i2c_smbus_read_word_data(client, reg); |
| 260 | return (value < 0) ? value : swab16(value); | ||
| 258 | } | 261 | } |
| 259 | 262 | ||
| 260 | static int lm75_write_value(struct i2c_client *client, u8 reg, u16 value) | 263 | static int lm75_write_value(struct i2c_client *client, u8 reg, u16 value) |
| @@ -287,9 +290,16 @@ static struct lm75_data *lm75_update_device(struct device *dev) | |||
| 287 | int i; | 290 | int i; |
| 288 | dev_dbg(&client->dev, "Starting lm75 update\n"); | 291 | dev_dbg(&client->dev, "Starting lm75 update\n"); |
| 289 | 292 | ||
| 290 | for (i = 0; i < ARRAY_SIZE(data->temp); i++) | 293 | for (i = 0; i < ARRAY_SIZE(data->temp); i++) { |
| 291 | data->temp[i] = lm75_read_value(client, | 294 | int status; |
| 292 | LM75_REG_TEMP[i]); | 295 | |
| 296 | status = lm75_read_value(client, LM75_REG_TEMP[i]); | ||
| 297 | if (status < 0) | ||
| 298 | dev_dbg(&client->dev, "reg %d, err %d\n", | ||
| 299 | LM75_REG_TEMP[i], status); | ||
| 300 | else | ||
| 301 | data->temp[i] = status; | ||
| 302 | } | ||
| 293 | data->last_updated = jiffies; | 303 | data->last_updated = jiffies; |
| 294 | data->valid = 1; | 304 | data->valid = 1; |
| 295 | } | 305 | } |
diff --git a/drivers/hwmon/lm85.c b/drivers/hwmon/lm85.c index 182fe6a5605f..ee5eca1c1921 100644 --- a/drivers/hwmon/lm85.c +++ b/drivers/hwmon/lm85.c | |||
| @@ -192,23 +192,20 @@ static int RANGE_TO_REG( int range ) | |||
| 192 | { | 192 | { |
| 193 | int i; | 193 | int i; |
| 194 | 194 | ||
| 195 | if ( range < lm85_range_map[0] ) { | 195 | if (range >= lm85_range_map[15]) |
| 196 | return 0 ; | ||
| 197 | } else if ( range > lm85_range_map[15] ) { | ||
| 198 | return 15 ; | 196 | return 15 ; |
| 199 | } else { /* find closest match */ | 197 | |
| 200 | for ( i = 14 ; i >= 0 ; --i ) { | 198 | /* Find the closest match */ |
| 201 | if ( range > lm85_range_map[i] ) { /* range bracketed */ | 199 | for (i = 14; i >= 0; --i) { |
| 202 | if ((lm85_range_map[i+1] - range) < | 200 | if (range >= lm85_range_map[i]) { |
| 203 | (range - lm85_range_map[i])) { | 201 | if ((lm85_range_map[i + 1] - range) < |
| 204 | i++; | 202 | (range - lm85_range_map[i])) |
| 205 | break; | 203 | return i + 1; |
| 206 | } | 204 | return i; |
| 207 | break; | ||
| 208 | } | ||
| 209 | } | 205 | } |
| 210 | } | 206 | } |
| 211 | return( i & 0x0f ); | 207 | |
| 208 | return 0; | ||
| 212 | } | 209 | } |
| 213 | #define RANGE_FROM_REG(val) (lm85_range_map[(val)&0x0f]) | 210 | #define RANGE_FROM_REG(val) (lm85_range_map[(val)&0x0f]) |
| 214 | 211 | ||
