Skip to content

Commit bec95aa

Browse files
committed
Merge branch 'release' of git://lm-sensors.org/kernel/mhoffman/hwmon-2.6
* 'release' of git://lm-sensors.org/kernel/mhoffman/hwmon-2.6: hwmon: (lm75) sensor reading bugfix hwmon: (abituguru3) update driver detection hwmon: (w83791d) new maintainer hwmon: (abituguru3) Identify Abit AW8D board as such hwmon: Update the sysfs interface documentation hwmon: (adt7473) Initialize max_duty_at_overheat before use hwmon: (lm85) Fix function RANGE_TO_REG()
2 parents 71c2742 + bcccc3a commit bec95aa

File tree

6 files changed

+60
-45
lines changed

6 files changed

+60
-45
lines changed

Documentation/hwmon/sysfs-interface

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,12 @@ Naming and data format standards for sysfs files
22
------------------------------------------------
33

44
The libsensors library offers an interface to the raw sensors data
5-
through the sysfs interface. See libsensors documentation and source for
6-
further information. As of writing this document, libsensors
7-
(from lm_sensors 2.8.3) is heavily chip-dependent. Adding or updating
8-
support for any given chip requires modifying the library's code.
9-
This is because libsensors was written for the procfs interface
10-
older kernel modules were using, which wasn't standardized enough.
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.
5+
through the sysfs interface. Since lm-sensors 3.0.0, libsensors is
6+
completely chip-independent. It assumes that all the kernel drivers
7+
implement the standard sysfs interface described in this document.
8+
This makes adding or updating support for any given chip very easy, as
9+
libsensors, and applications using it, do not need to be modified.
10+
This is a major improvement compared to lm-sensors 2.
1611

1712
Note that motherboards vary widely in the connections to sensor chips.
1813
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
3530
will have to implement conversion, labeling and hiding of inputs. For
3631
this reason, it is still not recommended to bypass the library.
3732

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-
4733
Each chip gets its own directory in the sysfs /sys/devices tree. To
4834
find all sensor chips, it is easier to follow the device symlinks from
4935
/sys/class/hwmon/hwmon*.
5036

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+
5144
All sysfs values are fixed point numbers.
5245

5346
There is only one value per file, unlike the older /proc specification.

MAINTAINERS

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4431,10 +4431,10 @@ M: [email protected]
44314431
S: Maintained
44324432

44334433
W83791D HARDWARE MONITORING DRIVER
4434-
P: Charles Spirakis
4435-
4434+
P: Marc Hulsman
4435+
44364436
4437-
S: Odd Fixes
4437+
S: Maintained
44384438

44394439
W83793 HARDWARE MONITORING DRIVER
44404440
P: Rudolf Marek

drivers/hwmon/abituguru3.c

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include <linux/platform_device.h>
3131
#include <linux/hwmon.h>
3232
#include <linux/hwmon-sysfs.h>
33+
#include <linux/dmi.h>
3334
#include <asm/io.h>
3435

3536
/* uGuru3 bank addresses */
@@ -323,7 +324,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = {
323324
{ "AUX1 Fan", 36, 2, 60, 1, 0 },
324325
{ NULL, 0, 0, 0, 0, 0 } }
325326
},
326-
{ 0x0013, "unknown", {
327+
{ 0x0013, "Abit AW8D", {
327328
{ "CPU Core", 0, 0, 10, 1, 0 },
328329
{ "DDR", 1, 0, 10, 1, 0 },
329330
{ "DDR VTT", 2, 0, 10, 1, 0 },
@@ -349,6 +350,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = {
349350
{ "AUX2 Fan", 36, 2, 60, 1, 0 },
350351
{ "AUX3 Fan", 37, 2, 60, 1, 0 },
351352
{ "AUX4 Fan", 38, 2, 60, 1, 0 },
353+
{ "AUX5 Fan", 39, 2, 60, 1, 0 },
352354
{ NULL, 0, 0, 0, 0, 0 } }
353355
},
354356
{ 0x0014, "Abit AB9 Pro", {
@@ -1111,11 +1113,12 @@ static int __init abituguru3_detect(void)
11111113
{
11121114
/* See if there is an uguru3 there. An idle uGuru3 will hold 0x00 or
11131115
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. */
11151117
u8 data_val = inb_p(ABIT_UGURU3_BASE + ABIT_UGURU3_DATA);
11161118
u8 cmd_val = inb_p(ABIT_UGURU3_BASE + ABIT_UGURU3_CMD);
11171119
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)))
11191122
return ABIT_UGURU3_BASE;
11201123

11211124
ABIT_UGURU3_DEBUG("no Abit uGuru3 found, data = 0x%02X, cmd = "
@@ -1138,6 +1141,15 @@ static int __init abituguru3_init(void)
11381141
int address, err;
11391142
struct resource res = { .flags = IORESOURCE_IO };
11401143

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+
11411153
address = abituguru3_detect();
11421154
if (address < 0)
11431155
return address;

drivers/hwmon/adt7473.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,9 @@ static struct adt7473_data *adt7473_update_device(struct device *dev)
309309
ADT7473_REG_PWM_BHVR(i));
310310
}
311311

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+
312315
data->limits_last_updated = local_jiffies;
313316
data->limits_valid = 1;
314317

drivers/hwmon/lm75.c

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -251,10 +251,13 @@ static int lm75_detach_client(struct i2c_client *client)
251251
the SMBus standard. */
252252
static int lm75_read_value(struct i2c_client *client, u8 reg)
253253
{
254+
int value;
255+
254256
if (reg == LM75_REG_CONF)
255257
return i2c_smbus_read_byte_data(client, reg);
256-
else
257-
return swab16(i2c_smbus_read_word_data(client, reg));
258+
259+
value = i2c_smbus_read_word_data(client, reg);
260+
return (value < 0) ? value : swab16(value);
258261
}
259262

260263
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)
287290
int i;
288291
dev_dbg(&client->dev, "Starting lm75 update\n");
289292

290-
for (i = 0; i < ARRAY_SIZE(data->temp); i++)
291-
data->temp[i] = lm75_read_value(client,
292-
LM75_REG_TEMP[i]);
293+
for (i = 0; i < ARRAY_SIZE(data->temp); i++) {
294+
int status;
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+
}
293303
data->last_updated = jiffies;
294304
data->valid = 1;
295305
}

drivers/hwmon/lm85.c

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -192,23 +192,20 @@ static int RANGE_TO_REG( int range )
192192
{
193193
int i;
194194

195-
if ( range < lm85_range_map[0] ) {
196-
return 0 ;
197-
} else if ( range > lm85_range_map[15] ) {
195+
if (range >= lm85_range_map[15])
198196
return 15 ;
199-
} else { /* find closest match */
200-
for ( i = 14 ; i >= 0 ; --i ) {
201-
if ( range > lm85_range_map[i] ) { /* range bracketed */
202-
if ((lm85_range_map[i+1] - range) <
203-
(range - lm85_range_map[i])) {
204-
i++;
205-
break;
206-
}
207-
break;
208-
}
197+
198+
/* Find the closest match */
199+
for (i = 14; i >= 0; --i) {
200+
if (range >= lm85_range_map[i]) {
201+
if ((lm85_range_map[i + 1] - range) <
202+
(range - lm85_range_map[i]))
203+
return i + 1;
204+
return i;
209205
}
210206
}
211-
return( i & 0x0f );
207+
208+
return 0;
212209
}
213210
#define RANGE_FROM_REG(val) (lm85_range_map[(val)&0x0f])
214211

0 commit comments

Comments
 (0)