diff options
author | Anton Vorontsov <avorontsov@ru.mvista.com> | 2009-09-22 19:49:27 -0400 |
---|---|---|
committer | Anton Vorontsov <avorontsov@ru.mvista.com> | 2009-09-22 19:49:27 -0400 |
commit | f056878332a91ed984a116bad4e7d49aefff9e6e (patch) | |
tree | 572f4757c8e7811d45e0be0c2ae529c78fb63441 /Documentation/hwmon | |
parent | 3961f7c3cf247eee5df7fabadc7a40f2deeb98f3 (diff) | |
parent | 7fa07729e439a6184bd824746d06a49cca553f15 (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
Conflicts:
drivers/power/wm97xx_battery.c
Diffstat (limited to 'Documentation/hwmon')
-rw-r--r-- | Documentation/hwmon/hpfall.c | 115 | ||||
-rw-r--r-- | Documentation/hwmon/pc87427 | 2 | ||||
-rw-r--r-- | Documentation/hwmon/pcf8591 | 28 | ||||
-rw-r--r-- | Documentation/hwmon/tmp421 | 36 | ||||
-rw-r--r-- | Documentation/hwmon/wm831x | 37 | ||||
-rw-r--r-- | Documentation/hwmon/wm8350 | 26 |
6 files changed, 195 insertions, 49 deletions
diff --git a/Documentation/hwmon/hpfall.c b/Documentation/hwmon/hpfall.c index bbea1ccfd46a..681ec22b9d0e 100644 --- a/Documentation/hwmon/hpfall.c +++ b/Documentation/hwmon/hpfall.c | |||
@@ -16,6 +16,34 @@ | |||
16 | #include <stdint.h> | 16 | #include <stdint.h> |
17 | #include <errno.h> | 17 | #include <errno.h> |
18 | #include <signal.h> | 18 | #include <signal.h> |
19 | #include <sys/mman.h> | ||
20 | #include <sched.h> | ||
21 | |||
22 | char unload_heads_path[64]; | ||
23 | |||
24 | int set_unload_heads_path(char *device) | ||
25 | { | ||
26 | char devname[64]; | ||
27 | |||
28 | if (strlen(device) <= 5 || strncmp(device, "/dev/", 5) != 0) | ||
29 | return -EINVAL; | ||
30 | strncpy(devname, device + 5, sizeof(devname)); | ||
31 | |||
32 | snprintf(unload_heads_path, sizeof(unload_heads_path), | ||
33 | "/sys/block/%s/device/unload_heads", devname); | ||
34 | return 0; | ||
35 | } | ||
36 | int valid_disk(void) | ||
37 | { | ||
38 | int fd = open(unload_heads_path, O_RDONLY); | ||
39 | if (fd < 0) { | ||
40 | perror(unload_heads_path); | ||
41 | return 0; | ||
42 | } | ||
43 | |||
44 | close(fd); | ||
45 | return 1; | ||
46 | } | ||
19 | 47 | ||
20 | void write_int(char *path, int i) | 48 | void write_int(char *path, int i) |
21 | { | 49 | { |
@@ -40,7 +68,7 @@ void set_led(int on) | |||
40 | 68 | ||
41 | void protect(int seconds) | 69 | void protect(int seconds) |
42 | { | 70 | { |
43 | write_int("/sys/block/sda/device/unload_heads", seconds*1000); | 71 | write_int(unload_heads_path, seconds*1000); |
44 | } | 72 | } |
45 | 73 | ||
46 | int on_ac(void) | 74 | int on_ac(void) |
@@ -57,45 +85,62 @@ void ignore_me(void) | |||
57 | { | 85 | { |
58 | protect(0); | 86 | protect(0); |
59 | set_led(0); | 87 | set_led(0); |
60 | |||
61 | } | 88 | } |
62 | 89 | ||
63 | int main(int argc, char* argv[]) | 90 | int main(int argc, char **argv) |
64 | { | 91 | { |
65 | int fd, ret; | 92 | int fd, ret; |
93 | struct sched_param param; | ||
94 | |||
95 | if (argc == 1) | ||
96 | ret = set_unload_heads_path("/dev/sda"); | ||
97 | else if (argc == 2) | ||
98 | ret = set_unload_heads_path(argv[1]); | ||
99 | else | ||
100 | ret = -EINVAL; | ||
101 | |||
102 | if (ret || !valid_disk()) { | ||
103 | fprintf(stderr, "usage: %s <device> (default: /dev/sda)\n", | ||
104 | argv[0]); | ||
105 | exit(1); | ||
106 | } | ||
107 | |||
108 | fd = open("/dev/freefall", O_RDONLY); | ||
109 | if (fd < 0) { | ||
110 | perror("/dev/freefall"); | ||
111 | return EXIT_FAILURE; | ||
112 | } | ||
66 | 113 | ||
67 | fd = open("/dev/freefall", O_RDONLY); | 114 | daemon(0, 0); |
68 | if (fd < 0) { | 115 | param.sched_priority = sched_get_priority_max(SCHED_FIFO); |
69 | perror("open"); | 116 | sched_setscheduler(0, SCHED_FIFO, ¶m); |
70 | return EXIT_FAILURE; | 117 | mlockall(MCL_CURRENT|MCL_FUTURE); |
71 | } | ||
72 | 118 | ||
73 | signal(SIGALRM, ignore_me); | 119 | signal(SIGALRM, ignore_me); |
74 | 120 | ||
75 | for (;;) { | 121 | for (;;) { |
76 | unsigned char count; | 122 | unsigned char count; |
77 | 123 | ||
78 | ret = read(fd, &count, sizeof(count)); | 124 | ret = read(fd, &count, sizeof(count)); |
79 | alarm(0); | 125 | alarm(0); |
80 | if ((ret == -1) && (errno == EINTR)) { | 126 | if ((ret == -1) && (errno == EINTR)) { |
81 | /* Alarm expired, time to unpark the heads */ | 127 | /* Alarm expired, time to unpark the heads */ |
82 | continue; | 128 | continue; |
83 | } | 129 | } |
84 | 130 | ||
85 | if (ret != sizeof(count)) { | 131 | if (ret != sizeof(count)) { |
86 | perror("read"); | 132 | perror("read"); |
87 | break; | 133 | break; |
88 | } | 134 | } |
89 | 135 | ||
90 | protect(21); | 136 | protect(21); |
91 | set_led(1); | 137 | set_led(1); |
92 | if (1 || on_ac() || lid_open()) { | 138 | if (1 || on_ac() || lid_open()) |
93 | alarm(2); | 139 | alarm(2); |
94 | } else { | 140 | else |
95 | alarm(20); | 141 | alarm(20); |
96 | } | 142 | } |
97 | } | 143 | |
98 | 144 | close(fd); | |
99 | close(fd); | 145 | return EXIT_SUCCESS; |
100 | return EXIT_SUCCESS; | ||
101 | } | 146 | } |
diff --git a/Documentation/hwmon/pc87427 b/Documentation/hwmon/pc87427 index d1ebbe510f35..db5cc1227a83 100644 --- a/Documentation/hwmon/pc87427 +++ b/Documentation/hwmon/pc87427 | |||
@@ -34,5 +34,5 @@ Fan rotation speeds are reported as 14-bit values from a gated clock | |||
34 | signal. Speeds down to 83 RPM can be measured. | 34 | signal. Speeds down to 83 RPM can be measured. |
35 | 35 | ||
36 | An alarm is triggered if the rotation speed drops below a programmable | 36 | An alarm is triggered if the rotation speed drops below a programmable |
37 | limit. Another alarm is triggered if the speed is too low to to be measured | 37 | limit. Another alarm is triggered if the speed is too low to be measured |
38 | (including stalled or missing fan). | 38 | (including stalled or missing fan). |
diff --git a/Documentation/hwmon/pcf8591 b/Documentation/hwmon/pcf8591 index 5628fcf4207f..e76a7892f68e 100644 --- a/Documentation/hwmon/pcf8591 +++ b/Documentation/hwmon/pcf8591 | |||
@@ -2,11 +2,11 @@ Kernel driver pcf8591 | |||
2 | ===================== | 2 | ===================== |
3 | 3 | ||
4 | Supported chips: | 4 | Supported chips: |
5 | * Philips PCF8591 | 5 | * Philips/NXP PCF8591 |
6 | Prefix: 'pcf8591' | 6 | Prefix: 'pcf8591' |
7 | Addresses scanned: I2C 0x48 - 0x4f | 7 | Addresses scanned: I2C 0x48 - 0x4f |
8 | Datasheet: Publicly available at the Philips Semiconductor website | 8 | Datasheet: Publicly available at the NXP website |
9 | http://www.semiconductors.philips.com/pip/PCF8591P.html | 9 | http://www.nxp.com/pip/PCF8591_6.html |
10 | 10 | ||
11 | Authors: | 11 | Authors: |
12 | Aurelien Jarno <aurelien@aurel32.net> | 12 | Aurelien Jarno <aurelien@aurel32.net> |
@@ -16,9 +16,10 @@ Authors: | |||
16 | 16 | ||
17 | Description | 17 | Description |
18 | ----------- | 18 | ----------- |
19 | |||
19 | The PCF8591 is an 8-bit A/D and D/A converter (4 analog inputs and one | 20 | The PCF8591 is an 8-bit A/D and D/A converter (4 analog inputs and one |
20 | analog output) for the I2C bus produced by Philips Semiconductors. It | 21 | analog output) for the I2C bus produced by Philips Semiconductors (now NXP). |
21 | is designed to provide a byte I2C interface to up to 4 separate devices. | 22 | It is designed to provide a byte I2C interface to up to 4 separate devices. |
22 | 23 | ||
23 | The PCF8591 has 4 analog inputs programmable as single-ended or | 24 | The PCF8591 has 4 analog inputs programmable as single-ended or |
24 | differential inputs : | 25 | differential inputs : |
@@ -58,8 +59,8 @@ Accessing PCF8591 via /sys interface | |||
58 | ------------------------------------- | 59 | ------------------------------------- |
59 | 60 | ||
60 | ! Be careful ! | 61 | ! Be careful ! |
61 | The PCF8591 is plainly impossible to detect ! Stupid chip. | 62 | The PCF8591 is plainly impossible to detect! Stupid chip. |
62 | So every chip with address in the interval [48..4f] is | 63 | So every chip with address in the interval [0x48..0x4f] is |
63 | detected as PCF8591. If you have other chips in this address | 64 | detected as PCF8591. If you have other chips in this address |
64 | range, the workaround is to load this module after the one | 65 | range, the workaround is to load this module after the one |
65 | for your others chips. | 66 | for your others chips. |
@@ -67,19 +68,20 @@ for your others chips. | |||
67 | On detection (i.e. insmod, modprobe et al.), directories are being | 68 | On detection (i.e. insmod, modprobe et al.), directories are being |
68 | created for each detected PCF8591: | 69 | created for each detected PCF8591: |
69 | 70 | ||
70 | /sys/bus/devices/<0>-<1>/ | 71 | /sys/bus/i2c/devices/<0>-<1>/ |
71 | where <0> is the bus the chip was detected on (e. g. i2c-0) | 72 | where <0> is the bus the chip was detected on (e. g. i2c-0) |
72 | and <1> the chip address ([48..4f]) | 73 | and <1> the chip address ([48..4f]) |
73 | 74 | ||
74 | Inside these directories, there are such files: | 75 | Inside these directories, there are such files: |
75 | in0, in1, in2, in3, out0_enable, out0_output, name | 76 | in0_input, in1_input, in2_input, in3_input, out0_enable, out0_output, name |
76 | 77 | ||
77 | Name contains chip name. | 78 | Name contains chip name. |
78 | 79 | ||
79 | The in0, in1, in2 and in3 files are RO. Reading gives the value of the | 80 | The in0_input, in1_input, in2_input and in3_input files are RO. Reading gives |
80 | corresponding channel. Depending on the current analog inputs configuration, | 81 | the value of the corresponding channel. Depending on the current analog inputs |
81 | files in2 and/or in3 do not exist. Values range are from 0 to 255 for single | 82 | configuration, files in2_input and in3_input may not exist. Values range |
82 | ended inputs and -128 to +127 for differential inputs (8-bit ADC). | 83 | from 0 to 255 for single ended inputs and -128 to +127 for differential inputs |
84 | (8-bit ADC). | ||
83 | 85 | ||
84 | The out0_enable file is RW. Reading gives "1" for analog output enabled and | 86 | The out0_enable file is RW. Reading gives "1" for analog output enabled and |
85 | "0" for analog output disabled. Writing accepts "0" and "1" accordingly. | 87 | "0" for analog output disabled. Writing accepts "0" and "1" accordingly. |
diff --git a/Documentation/hwmon/tmp421 b/Documentation/hwmon/tmp421 new file mode 100644 index 000000000000..0cf07f824741 --- /dev/null +++ b/Documentation/hwmon/tmp421 | |||
@@ -0,0 +1,36 @@ | |||
1 | Kernel driver tmp421 | ||
2 | ==================== | ||
3 | |||
4 | Supported chips: | ||
5 | * Texas Instruments TMP421 | ||
6 | Prefix: 'tmp421' | ||
7 | Addresses scanned: I2C 0x2a, 0x4c, 0x4d, 0x4e and 0x4f | ||
8 | Datasheet: http://focus.ti.com/docs/prod/folders/print/tmp421.html | ||
9 | * Texas Instruments TMP422 | ||
10 | Prefix: 'tmp422' | ||
11 | Addresses scanned: I2C 0x2a, 0x4c, 0x4d, 0x4e and 0x4f | ||
12 | Datasheet: http://focus.ti.com/docs/prod/folders/print/tmp421.html | ||
13 | * Texas Instruments TMP423 | ||
14 | Prefix: 'tmp423' | ||
15 | Addresses scanned: I2C 0x2a, 0x4c, 0x4d, 0x4e and 0x4f | ||
16 | Datasheet: http://focus.ti.com/docs/prod/folders/print/tmp421.html | ||
17 | |||
18 | Authors: | ||
19 | Andre Prendel <andre.prendel@gmx.de> | ||
20 | |||
21 | Description | ||
22 | ----------- | ||
23 | |||
24 | This driver implements support for Texas Instruments TMP421, TMP422 | ||
25 | and TMP423 temperature sensor chips. These chips implement one local | ||
26 | and up to one (TMP421), up to two (TMP422) or up to three (TMP423) | ||
27 | remote sensors. Temperature is measured in degrees Celsius. The chips | ||
28 | are wired over I2C/SMBus and specified over a temperature range of -40 | ||
29 | to +125 degrees Celsius. Resolution for both the local and remote | ||
30 | channels is 0.0625 degree C. | ||
31 | |||
32 | The chips support only temperature measurement. The driver exports | ||
33 | the temperature values via the following sysfs files: | ||
34 | |||
35 | temp[1-4]_input | ||
36 | temp[2-4]_fault | ||
diff --git a/Documentation/hwmon/wm831x b/Documentation/hwmon/wm831x new file mode 100644 index 000000000000..24f47d8f6a42 --- /dev/null +++ b/Documentation/hwmon/wm831x | |||
@@ -0,0 +1,37 @@ | |||
1 | Kernel driver wm831x-hwmon | ||
2 | ========================== | ||
3 | |||
4 | Supported chips: | ||
5 | * Wolfson Microelectronics WM831x PMICs | ||
6 | Prefix: 'wm831x' | ||
7 | Datasheet: | ||
8 | http://www.wolfsonmicro.com/products/WM8310 | ||
9 | http://www.wolfsonmicro.com/products/WM8311 | ||
10 | http://www.wolfsonmicro.com/products/WM8312 | ||
11 | |||
12 | Authors: Mark Brown <broonie@opensource.wolfsonmicro.com> | ||
13 | |||
14 | Description | ||
15 | ----------- | ||
16 | |||
17 | The WM831x series of PMICs include an AUXADC which can be used to | ||
18 | monitor a range of system operating parameters, including the voltages | ||
19 | of the major supplies within the system. Currently the driver provides | ||
20 | reporting of all the input values but does not provide any alarms. | ||
21 | |||
22 | Voltage Monitoring | ||
23 | ------------------ | ||
24 | |||
25 | Voltages are sampled by a 12 bit ADC. Voltages in milivolts are 1.465 | ||
26 | times the ADC value. | ||
27 | |||
28 | Temperature Monitoring | ||
29 | ---------------------- | ||
30 | |||
31 | Temperatures are sampled by a 12 bit ADC. Chip and battery temperatures | ||
32 | are available. The chip temperature is calculated as: | ||
33 | |||
34 | Degrees celsius = (512.18 - data) / 1.0983 | ||
35 | |||
36 | while the battery temperature calculation will depend on the NTC | ||
37 | thermistor component. | ||
diff --git a/Documentation/hwmon/wm8350 b/Documentation/hwmon/wm8350 new file mode 100644 index 000000000000..98f923bd2e92 --- /dev/null +++ b/Documentation/hwmon/wm8350 | |||
@@ -0,0 +1,26 @@ | |||
1 | Kernel driver wm8350-hwmon | ||
2 | ========================== | ||
3 | |||
4 | Supported chips: | ||
5 | * Wolfson Microelectronics WM835x PMICs | ||
6 | Prefix: 'wm8350' | ||
7 | Datasheet: | ||
8 | http://www.wolfsonmicro.com/products/WM8350 | ||
9 | http://www.wolfsonmicro.com/products/WM8351 | ||
10 | http://www.wolfsonmicro.com/products/WM8352 | ||
11 | |||
12 | Authors: Mark Brown <broonie@opensource.wolfsonmicro.com> | ||
13 | |||
14 | Description | ||
15 | ----------- | ||
16 | |||
17 | The WM835x series of PMICs include an AUXADC which can be used to | ||
18 | monitor a range of system operating parameters, including the voltages | ||
19 | of the major supplies within the system. Currently the driver provides | ||
20 | simple access to these major supplies. | ||
21 | |||
22 | Voltage Monitoring | ||
23 | ------------------ | ||
24 | |||
25 | Voltages are sampled by a 12 bit ADC. For the internal supplies the ADC | ||
26 | is referenced to the system VRTC. | ||