Commit 16b5dda22e3798e61bb008d2329d4f4d90ef764e
Committed by
Jean Delvare
1 parent
d6db23c7ce
Exists in
master
and in
6 other branches
hwmon: (it87) Add IT8728F support
Until we get a datasheet for the IT8728F, treat it as fully compatible with the IT8721F, as it seems to work reasonably well. This closes kernel bug #27262. Signed-off-by: Jean Delvare <khali@linux-fr.org> Acked-by: Guenter Roeck <guenter.roeck@ericsson.com>
Showing 3 changed files with 58 additions and 20 deletions Inline Diff
Documentation/hwmon/it87
1 | Kernel driver it87 | 1 | Kernel driver it87 |
2 | ================== | 2 | ================== |
3 | 3 | ||
4 | Supported chips: | 4 | Supported chips: |
5 | * IT8705F | 5 | * IT8705F |
6 | Prefix: 'it87' | 6 | Prefix: 'it87' |
7 | Addresses scanned: from Super I/O config space (8 I/O ports) | 7 | Addresses scanned: from Super I/O config space (8 I/O ports) |
8 | Datasheet: Once publicly available at the ITE website, but no longer | 8 | Datasheet: Once publicly available at the ITE website, but no longer |
9 | * IT8712F | 9 | * IT8712F |
10 | Prefix: 'it8712' | 10 | Prefix: 'it8712' |
11 | Addresses scanned: from Super I/O config space (8 I/O ports) | 11 | Addresses scanned: from Super I/O config space (8 I/O ports) |
12 | Datasheet: Once publicly available at the ITE website, but no longer | 12 | Datasheet: Once publicly available at the ITE website, but no longer |
13 | * IT8716F/IT8726F | 13 | * IT8716F/IT8726F |
14 | Prefix: 'it8716' | 14 | Prefix: 'it8716' |
15 | Addresses scanned: from Super I/O config space (8 I/O ports) | 15 | Addresses scanned: from Super I/O config space (8 I/O ports) |
16 | Datasheet: Once publicly available at the ITE website, but no longer | 16 | Datasheet: Once publicly available at the ITE website, but no longer |
17 | * IT8718F | 17 | * IT8718F |
18 | Prefix: 'it8718' | 18 | Prefix: 'it8718' |
19 | Addresses scanned: from Super I/O config space (8 I/O ports) | 19 | Addresses scanned: from Super I/O config space (8 I/O ports) |
20 | Datasheet: Once publicly available at the ITE website, but no longer | 20 | Datasheet: Once publicly available at the ITE website, but no longer |
21 | * IT8720F | 21 | * IT8720F |
22 | Prefix: 'it8720' | 22 | Prefix: 'it8720' |
23 | Addresses scanned: from Super I/O config space (8 I/O ports) | 23 | Addresses scanned: from Super I/O config space (8 I/O ports) |
24 | Datasheet: Not publicly available | 24 | Datasheet: Not publicly available |
25 | * IT8721F/IT8758E | 25 | * IT8721F/IT8758E |
26 | Prefix: 'it8721' | 26 | Prefix: 'it8721' |
27 | Addresses scanned: from Super I/O config space (8 I/O ports) | 27 | Addresses scanned: from Super I/O config space (8 I/O ports) |
28 | Datasheet: Not publicly available | 28 | Datasheet: Not publicly available |
29 | * IT8728F | ||
30 | Prefix: 'it8728' | ||
31 | Addresses scanned: from Super I/O config space (8 I/O ports) | ||
32 | Datasheet: Not publicly available | ||
29 | * SiS950 [clone of IT8705F] | 33 | * SiS950 [clone of IT8705F] |
30 | Prefix: 'it87' | 34 | Prefix: 'it87' |
31 | Addresses scanned: from Super I/O config space (8 I/O ports) | 35 | Addresses scanned: from Super I/O config space (8 I/O ports) |
32 | Datasheet: No longer be available | 36 | Datasheet: No longer be available |
33 | 37 | ||
34 | Authors: | 38 | Authors: |
35 | Christophe Gauthron | 39 | Christophe Gauthron |
36 | Jean Delvare <khali@linux-fr.org> | 40 | Jean Delvare <khali@linux-fr.org> |
37 | 41 | ||
38 | 42 | ||
39 | Module Parameters | 43 | Module Parameters |
40 | ----------------- | 44 | ----------------- |
41 | 45 | ||
42 | * update_vbat: int | 46 | * update_vbat: int |
43 | 47 | ||
44 | 0 if vbat should report power on value, 1 if vbat should be updated after | 48 | 0 if vbat should report power on value, 1 if vbat should be updated after |
45 | each read. Default is 0. On some boards the battery voltage is provided | 49 | each read. Default is 0. On some boards the battery voltage is provided |
46 | by either the battery or the onboard power supply. Only the first reading | 50 | by either the battery or the onboard power supply. Only the first reading |
47 | at power on will be the actual battery voltage (which the chip does | 51 | at power on will be the actual battery voltage (which the chip does |
48 | automatically). On other boards the battery voltage is always fed to | 52 | automatically). On other boards the battery voltage is always fed to |
49 | the chip so can be read at any time. Excessive reading may decrease | 53 | the chip so can be read at any time. Excessive reading may decrease |
50 | battery life but no information is given in the datasheet. | 54 | battery life but no information is given in the datasheet. |
51 | 55 | ||
52 | * fix_pwm_polarity int | 56 | * fix_pwm_polarity int |
53 | 57 | ||
54 | Force PWM polarity to active high (DANGEROUS). Some chips are | 58 | Force PWM polarity to active high (DANGEROUS). Some chips are |
55 | misconfigured by BIOS - PWM values would be inverted. This option tries | 59 | misconfigured by BIOS - PWM values would be inverted. This option tries |
56 | to fix this. Please contact your BIOS manufacturer and ask him for fix. | 60 | to fix this. Please contact your BIOS manufacturer and ask him for fix. |
57 | 61 | ||
58 | 62 | ||
59 | Hardware Interfaces | 63 | Hardware Interfaces |
60 | ------------------- | 64 | ------------------- |
61 | 65 | ||
62 | All the chips suported by this driver are LPC Super-I/O chips, accessed | 66 | All the chips suported by this driver are LPC Super-I/O chips, accessed |
63 | through the LPC bus (ISA-like I/O ports). The IT8712F additionally has an | 67 | through the LPC bus (ISA-like I/O ports). The IT8712F additionally has an |
64 | SMBus interface to the hardware monitoring functions. This driver no | 68 | SMBus interface to the hardware monitoring functions. This driver no |
65 | longer supports this interface though, as it is slower and less reliable | 69 | longer supports this interface though, as it is slower and less reliable |
66 | than the ISA access, and was only available on a small number of | 70 | than the ISA access, and was only available on a small number of |
67 | motherboard models. | 71 | motherboard models. |
68 | 72 | ||
69 | 73 | ||
70 | Description | 74 | Description |
71 | ----------- | 75 | ----------- |
72 | 76 | ||
73 | This driver implements support for the IT8705F, IT8712F, IT8716F, | 77 | This driver implements support for the IT8705F, IT8712F, IT8716F, |
74 | IT8718F, IT8720F, IT8721F, IT8726F, IT8758E and SiS950 chips. | 78 | IT8718F, IT8720F, IT8721F, IT8726F, IT8728F, IT8758E and SiS950 chips. |
75 | 79 | ||
76 | These chips are 'Super I/O chips', supporting floppy disks, infrared ports, | 80 | These chips are 'Super I/O chips', supporting floppy disks, infrared ports, |
77 | joysticks and other miscellaneous stuff. For hardware monitoring, they | 81 | joysticks and other miscellaneous stuff. For hardware monitoring, they |
78 | include an 'environment controller' with 3 temperature sensors, 3 fan | 82 | include an 'environment controller' with 3 temperature sensors, 3 fan |
79 | rotation speed sensors, 8 voltage sensors, associated alarms, and chassis | 83 | rotation speed sensors, 8 voltage sensors, associated alarms, and chassis |
80 | intrusion detection. | 84 | intrusion detection. |
81 | 85 | ||
82 | The IT8712F and IT8716F additionally feature VID inputs, used to report | 86 | The IT8712F and IT8716F additionally feature VID inputs, used to report |
83 | the Vcore voltage of the processor. The early IT8712F have 5 VID pins, | 87 | the Vcore voltage of the processor. The early IT8712F have 5 VID pins, |
84 | the IT8716F and late IT8712F have 6. They are shared with other functions | 88 | the IT8716F and late IT8712F have 6. They are shared with other functions |
85 | though, so the functionality may not be available on a given system. | 89 | though, so the functionality may not be available on a given system. |
86 | 90 | ||
87 | The IT8718F and IT8720F also features VID inputs (up to 8 pins) but the value | 91 | The IT8718F and IT8720F also features VID inputs (up to 8 pins) but the value |
88 | is stored in the Super-I/O configuration space. Due to technical limitations, | 92 | is stored in the Super-I/O configuration space. Due to technical limitations, |
89 | this value can currently only be read once at initialization time, so | 93 | this value can currently only be read once at initialization time, so |
90 | the driver won't notice and report changes in the VID value. The two | 94 | the driver won't notice and report changes in the VID value. The two |
91 | upper VID bits share their pins with voltage inputs (in5 and in6) so you | 95 | upper VID bits share their pins with voltage inputs (in5 and in6) so you |
92 | can't have both on a given board. | 96 | can't have both on a given board. |
93 | 97 | ||
94 | The IT8716F, IT8718F, IT8720F, IT8721F/IT8758E and later IT8712F revisions | 98 | The IT8716F, IT8718F, IT8720F, IT8721F/IT8758E and later IT8712F revisions |
95 | have support for 2 additional fans. The additional fans are supported by the | 99 | have support for 2 additional fans. The additional fans are supported by the |
96 | driver. | 100 | driver. |
97 | 101 | ||
98 | The IT8716F, IT8718F, IT8720F and IT8721F/IT8758E, and late IT8712F and | 102 | The IT8716F, IT8718F, IT8720F and IT8721F/IT8758E, and late IT8712F and |
99 | IT8705F also have optional 16-bit tachometer counters for fans 1 to 3. This | 103 | IT8705F also have optional 16-bit tachometer counters for fans 1 to 3. This |
100 | is better (no more fan clock divider mess) but not compatible with the older | 104 | is better (no more fan clock divider mess) but not compatible with the older |
101 | chips and revisions. The 16-bit tachometer mode is enabled by the driver when | 105 | chips and revisions. The 16-bit tachometer mode is enabled by the driver when |
102 | one of the above chips is detected. | 106 | one of the above chips is detected. |
103 | 107 | ||
104 | The IT8726F is just bit enhanced IT8716F with additional hardware | 108 | The IT8726F is just bit enhanced IT8716F with additional hardware |
105 | for AMD power sequencing. Therefore the chip will appear as IT8716F | 109 | for AMD power sequencing. Therefore the chip will appear as IT8716F |
106 | to userspace applications. | 110 | to userspace applications. |
107 | 111 | ||
112 | The IT8728F is considered compatible with the IT8721F, until a datasheet | ||
113 | becomes available (hopefully.) | ||
114 | |||
108 | Temperatures are measured in degrees Celsius. An alarm is triggered once | 115 | Temperatures are measured in degrees Celsius. An alarm is triggered once |
109 | when the Overtemperature Shutdown limit is crossed. | 116 | when the Overtemperature Shutdown limit is crossed. |
110 | 117 | ||
111 | Fan rotation speeds are reported in RPM (rotations per minute). An alarm is | 118 | Fan rotation speeds are reported in RPM (rotations per minute). An alarm is |
112 | triggered if the rotation speed has dropped below a programmable limit. When | 119 | triggered if the rotation speed has dropped below a programmable limit. When |
113 | 16-bit tachometer counters aren't used, fan readings can be divided by | 120 | 16-bit tachometer counters aren't used, fan readings can be divided by |
114 | a programmable divider (1, 2, 4 or 8) to give the readings more range or | 121 | a programmable divider (1, 2, 4 or 8) to give the readings more range or |
115 | accuracy. With a divider of 2, the lowest representable value is around | 122 | accuracy. With a divider of 2, the lowest representable value is around |
116 | 2600 RPM. Not all RPM values can accurately be represented, so some rounding | 123 | 2600 RPM. Not all RPM values can accurately be represented, so some rounding |
117 | is done. | 124 | is done. |
118 | 125 | ||
119 | Voltage sensors (also known as IN sensors) report their values in volts. An | 126 | Voltage sensors (also known as IN sensors) report their values in volts. An |
120 | alarm is triggered if the voltage has crossed a programmable minimum or | 127 | alarm is triggered if the voltage has crossed a programmable minimum or |
121 | maximum limit. Note that minimum in this case always means 'closest to | 128 | maximum limit. Note that minimum in this case always means 'closest to |
122 | zero'; this is important for negative voltage measurements. All voltage | 129 | zero'; this is important for negative voltage measurements. All voltage |
123 | inputs can measure voltages between 0 and 4.08 volts, with a resolution of | 130 | inputs can measure voltages between 0 and 4.08 volts, with a resolution of |
124 | 0.016 volt (except IT8721F/IT8758E: 0.012 volt.) The battery voltage in8 does | 131 | 0.016 volt (except IT8721F/IT8758E and IT8728F: 0.012 volt.) The battery |
125 | not have limit registers. | 132 | voltage in8 does not have limit registers. |
126 | 133 | ||
127 | On the IT8721F/IT8758E, some voltage inputs are internal and scaled inside | 134 | On the IT8721F/IT8758E, some voltage inputs are internal and scaled inside |
128 | the chip (in7, in8 and optionally in3). The driver handles this transparently | 135 | the chip (in7, in8 and optionally in3). The driver handles this transparently |
129 | so user-space doesn't have to care. | 136 | so user-space doesn't have to care. |
130 | 137 | ||
131 | The VID lines (IT8712F/IT8716F/IT8718F/IT8720F) encode the core voltage value: | 138 | The VID lines (IT8712F/IT8716F/IT8718F/IT8720F) encode the core voltage value: |
132 | the voltage level your processor should work with. This is hardcoded by | 139 | the voltage level your processor should work with. This is hardcoded by |
133 | the mainboard and/or processor itself. It is a value in volts. | 140 | the mainboard and/or processor itself. It is a value in volts. |
134 | 141 | ||
135 | If an alarm triggers, it will remain triggered until the hardware register | 142 | If an alarm triggers, it will remain triggered until the hardware register |
136 | is read at least once. This means that the cause for the alarm may already | 143 | is read at least once. This means that the cause for the alarm may already |
137 | have disappeared! Note that in the current implementation, all hardware | 144 | have disappeared! Note that in the current implementation, all hardware |
138 | registers are read whenever any data is read (unless it is less than 1.5 | 145 | registers are read whenever any data is read (unless it is less than 1.5 |
139 | seconds since the last update). This means that you can easily miss | 146 | seconds since the last update). This means that you can easily miss |
140 | once-only alarms. | 147 | once-only alarms. |
141 | 148 | ||
142 | Out-of-limit readings can also result in beeping, if the chip is properly | 149 | Out-of-limit readings can also result in beeping, if the chip is properly |
143 | wired and configured. Beeping can be enabled or disabled per sensor type | 150 | wired and configured. Beeping can be enabled or disabled per sensor type |
144 | (temperatures, voltages and fans.) | 151 | (temperatures, voltages and fans.) |
145 | 152 | ||
146 | The IT87xx only updates its values each 1.5 seconds; reading it more often | 153 | The IT87xx only updates its values each 1.5 seconds; reading it more often |
147 | will do no harm, but will return 'old' values. | 154 | will do no harm, but will return 'old' values. |
148 | 155 | ||
149 | To change sensor N to a thermistor, 'echo 4 > tempN_type' where N is 1, 2, | 156 | To change sensor N to a thermistor, 'echo 4 > tempN_type' where N is 1, 2, |
150 | or 3. To change sensor N to a thermal diode, 'echo 3 > tempN_type'. | 157 | or 3. To change sensor N to a thermal diode, 'echo 3 > tempN_type'. |
151 | Give 0 for unused sensor. Any other value is invalid. To configure this at | 158 | Give 0 for unused sensor. Any other value is invalid. To configure this at |
152 | startup, consult lm_sensors's /etc/sensors.conf. (4 = thermistor; | 159 | startup, consult lm_sensors's /etc/sensors.conf. (4 = thermistor; |
153 | 3 = thermal diode) | 160 | 3 = thermal diode) |
154 | 161 | ||
155 | 162 | ||
156 | Fan speed control | 163 | Fan speed control |
157 | ----------------- | 164 | ----------------- |
158 | 165 | ||
159 | The fan speed control features are limited to manual PWM mode. Automatic | 166 | The fan speed control features are limited to manual PWM mode. Automatic |
160 | "Smart Guardian" mode control handling is only implemented for older chips | 167 | "Smart Guardian" mode control handling is only implemented for older chips |
161 | (see below.) However if you want to go for "manual mode" just write 1 to | 168 | (see below.) However if you want to go for "manual mode" just write 1 to |
162 | pwmN_enable. | 169 | pwmN_enable. |
163 | 170 | ||
164 | If you are only able to control the fan speed with very small PWM values, | 171 | If you are only able to control the fan speed with very small PWM values, |
165 | try lowering the PWM base frequency (pwm1_freq). Depending on the fan, | 172 | try lowering the PWM base frequency (pwm1_freq). Depending on the fan, |
166 | it may give you a somewhat greater control range. The same frequency is | 173 | it may give you a somewhat greater control range. The same frequency is |
167 | used to drive all fan outputs, which is why pwm2_freq and pwm3_freq are | 174 | used to drive all fan outputs, which is why pwm2_freq and pwm3_freq are |
168 | read-only. | 175 | read-only. |
169 | 176 | ||
170 | 177 | ||
171 | Automatic fan speed control (old interface) | 178 | Automatic fan speed control (old interface) |
172 | ------------------------------------------- | 179 | ------------------------------------------- |
173 | 180 | ||
174 | The driver supports the old interface to automatic fan speed control | 181 | The driver supports the old interface to automatic fan speed control |
175 | which is implemented by IT8705F chips up to revision F and IT8712F | 182 | which is implemented by IT8705F chips up to revision F and IT8712F |
176 | chips up to revision G. | 183 | chips up to revision G. |
177 | 184 | ||
178 | This interface implements 4 temperature vs. PWM output trip points. | 185 | This interface implements 4 temperature vs. PWM output trip points. |
179 | The PWM output of trip point 4 is always the maximum value (fan running | 186 | The PWM output of trip point 4 is always the maximum value (fan running |
180 | at full speed) while the PWM output of the other 3 trip points can be | 187 | at full speed) while the PWM output of the other 3 trip points can be |
181 | freely chosen. The temperature of all 4 trip points can be freely chosen. | 188 | freely chosen. The temperature of all 4 trip points can be freely chosen. |
182 | Additionally, trip point 1 has an hysteresis temperature attached, to | 189 | Additionally, trip point 1 has an hysteresis temperature attached, to |
183 | prevent fast switching between fan on and off. | 190 | prevent fast switching between fan on and off. |
184 | 191 | ||
185 | The chip automatically computes the PWM output value based on the input | 192 | The chip automatically computes the PWM output value based on the input |
186 | temperature, based on this simple rule: if the temperature value is | 193 | temperature, based on this simple rule: if the temperature value is |
187 | between trip point N and trip point N+1 then the PWM output value is | 194 | between trip point N and trip point N+1 then the PWM output value is |
188 | the one of trip point N. The automatic control mode is less flexible | 195 | the one of trip point N. The automatic control mode is less flexible |
189 | than the manual control mode, but it reacts faster, is more robust and | 196 | than the manual control mode, but it reacts faster, is more robust and |
190 | doesn't use CPU cycles. | 197 | doesn't use CPU cycles. |
191 | 198 | ||
192 | Trip points must be set properly before switching to automatic fan speed | 199 | Trip points must be set properly before switching to automatic fan speed |
193 | control mode. The driver will perform basic integrity checks before | 200 | control mode. The driver will perform basic integrity checks before |
194 | actually switching to automatic control mode. | 201 | actually switching to automatic control mode. |
195 | 202 |
drivers/hwmon/Kconfig
1 | # | 1 | # |
2 | # Hardware monitoring chip drivers configuration | 2 | # Hardware monitoring chip drivers configuration |
3 | # | 3 | # |
4 | 4 | ||
5 | menuconfig HWMON | 5 | menuconfig HWMON |
6 | tristate "Hardware Monitoring support" | 6 | tristate "Hardware Monitoring support" |
7 | depends on HAS_IOMEM | 7 | depends on HAS_IOMEM |
8 | default y | 8 | default y |
9 | help | 9 | help |
10 | Hardware monitoring devices let you monitor the hardware health | 10 | Hardware monitoring devices let you monitor the hardware health |
11 | of a system. Most modern motherboards include such a device. It | 11 | of a system. Most modern motherboards include such a device. It |
12 | can include temperature sensors, voltage sensors, fan speed | 12 | can include temperature sensors, voltage sensors, fan speed |
13 | sensors and various additional features such as the ability to | 13 | sensors and various additional features such as the ability to |
14 | control the speed of the fans. If you want this support you | 14 | control the speed of the fans. If you want this support you |
15 | should say Y here and also to the specific driver(s) for your | 15 | should say Y here and also to the specific driver(s) for your |
16 | sensors chip(s) below. | 16 | sensors chip(s) below. |
17 | 17 | ||
18 | To find out which specific driver(s) you need, use the | 18 | To find out which specific driver(s) you need, use the |
19 | sensors-detect script from the lm_sensors package. Read | 19 | sensors-detect script from the lm_sensors package. Read |
20 | <file:Documentation/hwmon/userspace-tools> for details. | 20 | <file:Documentation/hwmon/userspace-tools> for details. |
21 | 21 | ||
22 | This support can also be built as a module. If so, the module | 22 | This support can also be built as a module. If so, the module |
23 | will be called hwmon. | 23 | will be called hwmon. |
24 | 24 | ||
25 | if HWMON | 25 | if HWMON |
26 | 26 | ||
27 | config HWMON_VID | 27 | config HWMON_VID |
28 | tristate | 28 | tristate |
29 | default n | 29 | default n |
30 | 30 | ||
31 | config HWMON_DEBUG_CHIP | 31 | config HWMON_DEBUG_CHIP |
32 | bool "Hardware Monitoring Chip debugging messages" | 32 | bool "Hardware Monitoring Chip debugging messages" |
33 | default n | 33 | default n |
34 | help | 34 | help |
35 | Say Y here if you want the I2C chip drivers to produce a bunch of | 35 | Say Y here if you want the I2C chip drivers to produce a bunch of |
36 | debug messages to the system log. Select this if you are having | 36 | debug messages to the system log. Select this if you are having |
37 | a problem with I2C support and want to see more of what is going | 37 | a problem with I2C support and want to see more of what is going |
38 | on. | 38 | on. |
39 | 39 | ||
40 | comment "Native drivers" | 40 | comment "Native drivers" |
41 | 41 | ||
42 | config SENSORS_ABITUGURU | 42 | config SENSORS_ABITUGURU |
43 | tristate "Abit uGuru (rev 1 & 2)" | 43 | tristate "Abit uGuru (rev 1 & 2)" |
44 | depends on X86 && DMI && EXPERIMENTAL | 44 | depends on X86 && DMI && EXPERIMENTAL |
45 | help | 45 | help |
46 | If you say yes here you get support for the sensor part of the first | 46 | If you say yes here you get support for the sensor part of the first |
47 | and second revision of the Abit uGuru chip. The voltage and frequency | 47 | and second revision of the Abit uGuru chip. The voltage and frequency |
48 | control parts of the Abit uGuru are not supported. The Abit uGuru | 48 | control parts of the Abit uGuru are not supported. The Abit uGuru |
49 | chip can be found on Abit uGuru featuring motherboards (most modern | 49 | chip can be found on Abit uGuru featuring motherboards (most modern |
50 | Abit motherboards from before end 2005). For more info and a list | 50 | Abit motherboards from before end 2005). For more info and a list |
51 | of which motherboards have which revision see | 51 | of which motherboards have which revision see |
52 | Documentation/hwmon/abituguru | 52 | Documentation/hwmon/abituguru |
53 | 53 | ||
54 | This driver can also be built as a module. If so, the module | 54 | This driver can also be built as a module. If so, the module |
55 | will be called abituguru. | 55 | will be called abituguru. |
56 | 56 | ||
57 | config SENSORS_ABITUGURU3 | 57 | config SENSORS_ABITUGURU3 |
58 | tristate "Abit uGuru (rev 3)" | 58 | tristate "Abit uGuru (rev 3)" |
59 | depends on X86 && DMI && EXPERIMENTAL | 59 | depends on X86 && DMI && EXPERIMENTAL |
60 | help | 60 | help |
61 | If you say yes here you get support for the sensor part of the | 61 | If you say yes here you get support for the sensor part of the |
62 | third revision of the Abit uGuru chip. Only reading the sensors | 62 | third revision of the Abit uGuru chip. Only reading the sensors |
63 | and their settings is supported. The third revision of the Abit | 63 | and their settings is supported. The third revision of the Abit |
64 | uGuru chip can be found on recent Abit motherboards (since end | 64 | uGuru chip can be found on recent Abit motherboards (since end |
65 | 2005). For more info and a list of which motherboards have which | 65 | 2005). For more info and a list of which motherboards have which |
66 | revision see Documentation/hwmon/abituguru3 | 66 | revision see Documentation/hwmon/abituguru3 |
67 | 67 | ||
68 | This driver can also be built as a module. If so, the module | 68 | This driver can also be built as a module. If so, the module |
69 | will be called abituguru3. | 69 | will be called abituguru3. |
70 | 70 | ||
71 | config SENSORS_AD7314 | 71 | config SENSORS_AD7314 |
72 | tristate "Analog Devices AD7314 and compatibles" | 72 | tristate "Analog Devices AD7314 and compatibles" |
73 | depends on SPI && EXPERIMENTAL | 73 | depends on SPI && EXPERIMENTAL |
74 | help | 74 | help |
75 | If you say yes here you get support for the Analog Devices | 75 | If you say yes here you get support for the Analog Devices |
76 | AD7314, ADT7301 and ADT7302 temperature sensors. | 76 | AD7314, ADT7301 and ADT7302 temperature sensors. |
77 | 77 | ||
78 | This driver can also be built as a module. If so, the module | 78 | This driver can also be built as a module. If so, the module |
79 | will be called ad7314. | 79 | will be called ad7314. |
80 | 80 | ||
81 | config SENSORS_AD7414 | 81 | config SENSORS_AD7414 |
82 | tristate "Analog Devices AD7414" | 82 | tristate "Analog Devices AD7414" |
83 | depends on I2C && EXPERIMENTAL | 83 | depends on I2C && EXPERIMENTAL |
84 | help | 84 | help |
85 | If you say yes here you get support for the Analog Devices | 85 | If you say yes here you get support for the Analog Devices |
86 | AD7414 temperature monitoring chip. | 86 | AD7414 temperature monitoring chip. |
87 | 87 | ||
88 | This driver can also be built as a module. If so, the module | 88 | This driver can also be built as a module. If so, the module |
89 | will be called ad7414. | 89 | will be called ad7414. |
90 | 90 | ||
91 | config SENSORS_AD7418 | 91 | config SENSORS_AD7418 |
92 | tristate "Analog Devices AD7416, AD7417 and AD7418" | 92 | tristate "Analog Devices AD7416, AD7417 and AD7418" |
93 | depends on I2C && EXPERIMENTAL | 93 | depends on I2C && EXPERIMENTAL |
94 | help | 94 | help |
95 | If you say yes here you get support for the Analog Devices | 95 | If you say yes here you get support for the Analog Devices |
96 | AD7416, AD7417 and AD7418 temperature monitoring chips. | 96 | AD7416, AD7417 and AD7418 temperature monitoring chips. |
97 | 97 | ||
98 | This driver can also be built as a module. If so, the module | 98 | This driver can also be built as a module. If so, the module |
99 | will be called ad7418. | 99 | will be called ad7418. |
100 | 100 | ||
101 | config SENSORS_ADCXX | 101 | config SENSORS_ADCXX |
102 | tristate "National Semiconductor ADCxxxSxxx" | 102 | tristate "National Semiconductor ADCxxxSxxx" |
103 | depends on SPI_MASTER && EXPERIMENTAL | 103 | depends on SPI_MASTER && EXPERIMENTAL |
104 | help | 104 | help |
105 | If you say yes here you get support for the National Semiconductor | 105 | If you say yes here you get support for the National Semiconductor |
106 | ADC<bb><c>S<sss> chip family, where | 106 | ADC<bb><c>S<sss> chip family, where |
107 | * bb is the resolution in number of bits (8, 10, 12) | 107 | * bb is the resolution in number of bits (8, 10, 12) |
108 | * c is the number of channels (1, 2, 4, 8) | 108 | * c is the number of channels (1, 2, 4, 8) |
109 | * sss is the maximum conversion speed (021 for 200 kSPS, 051 for 500 | 109 | * sss is the maximum conversion speed (021 for 200 kSPS, 051 for 500 |
110 | kSPS and 101 for 1 MSPS) | 110 | kSPS and 101 for 1 MSPS) |
111 | 111 | ||
112 | Examples : ADC081S101, ADC124S501, ... | 112 | Examples : ADC081S101, ADC124S501, ... |
113 | 113 | ||
114 | This driver can also be built as a module. If so, the module | 114 | This driver can also be built as a module. If so, the module |
115 | will be called adcxx. | 115 | will be called adcxx. |
116 | 116 | ||
117 | config SENSORS_ADM1021 | 117 | config SENSORS_ADM1021 |
118 | tristate "Analog Devices ADM1021 and compatibles" | 118 | tristate "Analog Devices ADM1021 and compatibles" |
119 | depends on I2C | 119 | depends on I2C |
120 | help | 120 | help |
121 | If you say yes here you get support for Analog Devices ADM1021 | 121 | If you say yes here you get support for Analog Devices ADM1021 |
122 | and ADM1023 sensor chips and clones: Maxim MAX1617 and MAX1617A, | 122 | and ADM1023 sensor chips and clones: Maxim MAX1617 and MAX1617A, |
123 | Genesys Logic GL523SM, National Semiconductor LM84 and TI THMC10. | 123 | Genesys Logic GL523SM, National Semiconductor LM84 and TI THMC10. |
124 | 124 | ||
125 | This driver can also be built as a module. If so, the module | 125 | This driver can also be built as a module. If so, the module |
126 | will be called adm1021. | 126 | will be called adm1021. |
127 | 127 | ||
128 | config SENSORS_ADM1025 | 128 | config SENSORS_ADM1025 |
129 | tristate "Analog Devices ADM1025 and compatibles" | 129 | tristate "Analog Devices ADM1025 and compatibles" |
130 | depends on I2C | 130 | depends on I2C |
131 | select HWMON_VID | 131 | select HWMON_VID |
132 | help | 132 | help |
133 | If you say yes here you get support for Analog Devices ADM1025 | 133 | If you say yes here you get support for Analog Devices ADM1025 |
134 | and Philips NE1619 sensor chips. | 134 | and Philips NE1619 sensor chips. |
135 | 135 | ||
136 | This driver can also be built as a module. If so, the module | 136 | This driver can also be built as a module. If so, the module |
137 | will be called adm1025. | 137 | will be called adm1025. |
138 | 138 | ||
139 | config SENSORS_ADM1026 | 139 | config SENSORS_ADM1026 |
140 | tristate "Analog Devices ADM1026 and compatibles" | 140 | tristate "Analog Devices ADM1026 and compatibles" |
141 | depends on I2C | 141 | depends on I2C |
142 | select HWMON_VID | 142 | select HWMON_VID |
143 | help | 143 | help |
144 | If you say yes here you get support for Analog Devices ADM1026 | 144 | If you say yes here you get support for Analog Devices ADM1026 |
145 | sensor chip. | 145 | sensor chip. |
146 | 146 | ||
147 | This driver can also be built as a module. If so, the module | 147 | This driver can also be built as a module. If so, the module |
148 | will be called adm1026. | 148 | will be called adm1026. |
149 | 149 | ||
150 | config SENSORS_ADM1029 | 150 | config SENSORS_ADM1029 |
151 | tristate "Analog Devices ADM1029" | 151 | tristate "Analog Devices ADM1029" |
152 | depends on I2C | 152 | depends on I2C |
153 | help | 153 | help |
154 | If you say yes here you get support for Analog Devices ADM1029 | 154 | If you say yes here you get support for Analog Devices ADM1029 |
155 | sensor chip. | 155 | sensor chip. |
156 | Very rare chip, please let us know you use it. | 156 | Very rare chip, please let us know you use it. |
157 | 157 | ||
158 | This driver can also be built as a module. If so, the module | 158 | This driver can also be built as a module. If so, the module |
159 | will be called adm1029. | 159 | will be called adm1029. |
160 | 160 | ||
161 | config SENSORS_ADM1031 | 161 | config SENSORS_ADM1031 |
162 | tristate "Analog Devices ADM1031 and compatibles" | 162 | tristate "Analog Devices ADM1031 and compatibles" |
163 | depends on I2C | 163 | depends on I2C |
164 | help | 164 | help |
165 | If you say yes here you get support for Analog Devices ADM1031 | 165 | If you say yes here you get support for Analog Devices ADM1031 |
166 | and ADM1030 sensor chips. | 166 | and ADM1030 sensor chips. |
167 | 167 | ||
168 | This driver can also be built as a module. If so, the module | 168 | This driver can also be built as a module. If so, the module |
169 | will be called adm1031. | 169 | will be called adm1031. |
170 | 170 | ||
171 | config SENSORS_ADM9240 | 171 | config SENSORS_ADM9240 |
172 | tristate "Analog Devices ADM9240 and compatibles" | 172 | tristate "Analog Devices ADM9240 and compatibles" |
173 | depends on I2C | 173 | depends on I2C |
174 | select HWMON_VID | 174 | select HWMON_VID |
175 | help | 175 | help |
176 | If you say yes here you get support for Analog Devices ADM9240, | 176 | If you say yes here you get support for Analog Devices ADM9240, |
177 | Dallas DS1780, National Semiconductor LM81 sensor chips. | 177 | Dallas DS1780, National Semiconductor LM81 sensor chips. |
178 | 178 | ||
179 | This driver can also be built as a module. If so, the module | 179 | This driver can also be built as a module. If so, the module |
180 | will be called adm9240. | 180 | will be called adm9240. |
181 | 181 | ||
182 | config SENSORS_ADT7411 | 182 | config SENSORS_ADT7411 |
183 | tristate "Analog Devices ADT7411" | 183 | tristate "Analog Devices ADT7411" |
184 | depends on I2C && EXPERIMENTAL | 184 | depends on I2C && EXPERIMENTAL |
185 | help | 185 | help |
186 | If you say yes here you get support for the Analog Devices | 186 | If you say yes here you get support for the Analog Devices |
187 | ADT7411 voltage and temperature monitoring chip. | 187 | ADT7411 voltage and temperature monitoring chip. |
188 | 188 | ||
189 | This driver can also be built as a module. If so, the module | 189 | This driver can also be built as a module. If so, the module |
190 | will be called adt7411. | 190 | will be called adt7411. |
191 | 191 | ||
192 | config SENSORS_ADT7462 | 192 | config SENSORS_ADT7462 |
193 | tristate "Analog Devices ADT7462" | 193 | tristate "Analog Devices ADT7462" |
194 | depends on I2C && EXPERIMENTAL | 194 | depends on I2C && EXPERIMENTAL |
195 | help | 195 | help |
196 | If you say yes here you get support for the Analog Devices | 196 | If you say yes here you get support for the Analog Devices |
197 | ADT7462 temperature monitoring chips. | 197 | ADT7462 temperature monitoring chips. |
198 | 198 | ||
199 | This driver can also be built as a module. If so, the module | 199 | This driver can also be built as a module. If so, the module |
200 | will be called adt7462. | 200 | will be called adt7462. |
201 | 201 | ||
202 | config SENSORS_ADT7470 | 202 | config SENSORS_ADT7470 |
203 | tristate "Analog Devices ADT7470" | 203 | tristate "Analog Devices ADT7470" |
204 | depends on I2C && EXPERIMENTAL | 204 | depends on I2C && EXPERIMENTAL |
205 | help | 205 | help |
206 | If you say yes here you get support for the Analog Devices | 206 | If you say yes here you get support for the Analog Devices |
207 | ADT7470 temperature monitoring chips. | 207 | ADT7470 temperature monitoring chips. |
208 | 208 | ||
209 | This driver can also be built as a module. If so, the module | 209 | This driver can also be built as a module. If so, the module |
210 | will be called adt7470. | 210 | will be called adt7470. |
211 | 211 | ||
212 | config SENSORS_ADT7475 | 212 | config SENSORS_ADT7475 |
213 | tristate "Analog Devices ADT7473, ADT7475, ADT7476 and ADT7490" | 213 | tristate "Analog Devices ADT7473, ADT7475, ADT7476 and ADT7490" |
214 | depends on I2C | 214 | depends on I2C |
215 | select HWMON_VID | 215 | select HWMON_VID |
216 | help | 216 | help |
217 | If you say yes here you get support for the Analog Devices | 217 | If you say yes here you get support for the Analog Devices |
218 | ADT7473, ADT7475, ADT7476 and ADT7490 hardware monitoring | 218 | ADT7473, ADT7475, ADT7476 and ADT7490 hardware monitoring |
219 | chips. | 219 | chips. |
220 | 220 | ||
221 | This driver can also be build as a module. If so, the module | 221 | This driver can also be build as a module. If so, the module |
222 | will be called adt7475. | 222 | will be called adt7475. |
223 | 223 | ||
224 | config SENSORS_ASC7621 | 224 | config SENSORS_ASC7621 |
225 | tristate "Andigilog aSC7621" | 225 | tristate "Andigilog aSC7621" |
226 | depends on I2C | 226 | depends on I2C |
227 | help | 227 | help |
228 | If you say yes here you get support for the aSC7621 | 228 | If you say yes here you get support for the aSC7621 |
229 | family of SMBus sensors chip found on most Intel X38, X48, X58, | 229 | family of SMBus sensors chip found on most Intel X38, X48, X58, |
230 | 945, 965 and 975 desktop boards. Currently supported chips: | 230 | 945, 965 and 975 desktop boards. Currently supported chips: |
231 | aSC7621 | 231 | aSC7621 |
232 | aSC7621a | 232 | aSC7621a |
233 | 233 | ||
234 | This driver can also be built as a module. If so, the module | 234 | This driver can also be built as a module. If so, the module |
235 | will be called asc7621. | 235 | will be called asc7621. |
236 | 236 | ||
237 | config SENSORS_K8TEMP | 237 | config SENSORS_K8TEMP |
238 | tristate "AMD Athlon64/FX or Opteron temperature sensor" | 238 | tristate "AMD Athlon64/FX or Opteron temperature sensor" |
239 | depends on X86 && PCI && EXPERIMENTAL | 239 | depends on X86 && PCI && EXPERIMENTAL |
240 | help | 240 | help |
241 | If you say yes here you get support for the temperature | 241 | If you say yes here you get support for the temperature |
242 | sensor(s) inside your CPU. Supported is whole AMD K8 | 242 | sensor(s) inside your CPU. Supported is whole AMD K8 |
243 | microarchitecture. Please note that you will need at least | 243 | microarchitecture. Please note that you will need at least |
244 | lm-sensors 2.10.1 for proper userspace support. | 244 | lm-sensors 2.10.1 for proper userspace support. |
245 | 245 | ||
246 | This driver can also be built as a module. If so, the module | 246 | This driver can also be built as a module. If so, the module |
247 | will be called k8temp. | 247 | will be called k8temp. |
248 | 248 | ||
249 | config SENSORS_K10TEMP | 249 | config SENSORS_K10TEMP |
250 | tristate "AMD Family 10h+ temperature sensor" | 250 | tristate "AMD Family 10h+ temperature sensor" |
251 | depends on X86 && PCI | 251 | depends on X86 && PCI |
252 | help | 252 | help |
253 | If you say yes here you get support for the temperature | 253 | If you say yes here you get support for the temperature |
254 | sensor(s) inside your CPU. Supported are later revisions of | 254 | sensor(s) inside your CPU. Supported are later revisions of |
255 | the AMD Family 10h and all revisions of the AMD Family 11h, | 255 | the AMD Family 10h and all revisions of the AMD Family 11h, |
256 | 12h (Llano), 14h (Brazos) and 15h (Bulldozer) microarchitectures. | 256 | 12h (Llano), 14h (Brazos) and 15h (Bulldozer) microarchitectures. |
257 | 257 | ||
258 | This driver can also be built as a module. If so, the module | 258 | This driver can also be built as a module. If so, the module |
259 | will be called k10temp. | 259 | will be called k10temp. |
260 | 260 | ||
261 | config SENSORS_FAM15H_POWER | 261 | config SENSORS_FAM15H_POWER |
262 | tristate "AMD Family 15h processor power" | 262 | tristate "AMD Family 15h processor power" |
263 | depends on X86 && PCI | 263 | depends on X86 && PCI |
264 | help | 264 | help |
265 | If you say yes here you get support for processor power | 265 | If you say yes here you get support for processor power |
266 | information of your AMD family 15h CPU. | 266 | information of your AMD family 15h CPU. |
267 | 267 | ||
268 | This driver can also be built as a module. If so, the module | 268 | This driver can also be built as a module. If so, the module |
269 | will be called fam15h_power. | 269 | will be called fam15h_power. |
270 | 270 | ||
271 | config SENSORS_ASB100 | 271 | config SENSORS_ASB100 |
272 | tristate "Asus ASB100 Bach" | 272 | tristate "Asus ASB100 Bach" |
273 | depends on X86 && I2C && EXPERIMENTAL | 273 | depends on X86 && I2C && EXPERIMENTAL |
274 | select HWMON_VID | 274 | select HWMON_VID |
275 | help | 275 | help |
276 | If you say yes here you get support for the ASB100 Bach sensor | 276 | If you say yes here you get support for the ASB100 Bach sensor |
277 | chip found on some Asus mainboards. | 277 | chip found on some Asus mainboards. |
278 | 278 | ||
279 | This driver can also be built as a module. If so, the module | 279 | This driver can also be built as a module. If so, the module |
280 | will be called asb100. | 280 | will be called asb100. |
281 | 281 | ||
282 | config SENSORS_ATXP1 | 282 | config SENSORS_ATXP1 |
283 | tristate "Attansic ATXP1 VID controller" | 283 | tristate "Attansic ATXP1 VID controller" |
284 | depends on I2C && EXPERIMENTAL | 284 | depends on I2C && EXPERIMENTAL |
285 | select HWMON_VID | 285 | select HWMON_VID |
286 | help | 286 | help |
287 | If you say yes here you get support for the Attansic ATXP1 VID | 287 | If you say yes here you get support for the Attansic ATXP1 VID |
288 | controller. | 288 | controller. |
289 | 289 | ||
290 | If your board have such a chip, you are able to control your CPU | 290 | If your board have such a chip, you are able to control your CPU |
291 | core and other voltages. | 291 | core and other voltages. |
292 | 292 | ||
293 | This driver can also be built as a module. If so, the module | 293 | This driver can also be built as a module. If so, the module |
294 | will be called atxp1. | 294 | will be called atxp1. |
295 | 295 | ||
296 | config SENSORS_DS620 | 296 | config SENSORS_DS620 |
297 | tristate "Dallas Semiconductor DS620" | 297 | tristate "Dallas Semiconductor DS620" |
298 | depends on I2C | 298 | depends on I2C |
299 | help | 299 | help |
300 | If you say yes here you get support for Dallas Semiconductor | 300 | If you say yes here you get support for Dallas Semiconductor |
301 | DS620 sensor chip. | 301 | DS620 sensor chip. |
302 | 302 | ||
303 | This driver can also be built as a module. If so, the module | 303 | This driver can also be built as a module. If so, the module |
304 | will be called ds620. | 304 | will be called ds620. |
305 | 305 | ||
306 | config SENSORS_DS1621 | 306 | config SENSORS_DS1621 |
307 | tristate "Dallas Semiconductor DS1621 and DS1625" | 307 | tristate "Dallas Semiconductor DS1621 and DS1625" |
308 | depends on I2C | 308 | depends on I2C |
309 | help | 309 | help |
310 | If you say yes here you get support for Dallas Semiconductor | 310 | If you say yes here you get support for Dallas Semiconductor |
311 | DS1621 and DS1625 sensor chips. | 311 | DS1621 and DS1625 sensor chips. |
312 | 312 | ||
313 | This driver can also be built as a module. If so, the module | 313 | This driver can also be built as a module. If so, the module |
314 | will be called ds1621. | 314 | will be called ds1621. |
315 | 315 | ||
316 | config SENSORS_EXYNOS4_TMU | 316 | config SENSORS_EXYNOS4_TMU |
317 | tristate "Temperature sensor on Samsung EXYNOS4" | 317 | tristate "Temperature sensor on Samsung EXYNOS4" |
318 | depends on ARCH_EXYNOS4 | 318 | depends on ARCH_EXYNOS4 |
319 | help | 319 | help |
320 | If you say yes here you get support for TMU (Thermal Managment | 320 | If you say yes here you get support for TMU (Thermal Managment |
321 | Unit) on SAMSUNG EXYNOS4 series of SoC. | 321 | Unit) on SAMSUNG EXYNOS4 series of SoC. |
322 | 322 | ||
323 | This driver can also be built as a module. If so, the module | 323 | This driver can also be built as a module. If so, the module |
324 | will be called exynos4-tmu. | 324 | will be called exynos4-tmu. |
325 | 325 | ||
326 | config SENSORS_I5K_AMB | 326 | config SENSORS_I5K_AMB |
327 | tristate "FB-DIMM AMB temperature sensor on Intel 5000 series chipsets" | 327 | tristate "FB-DIMM AMB temperature sensor on Intel 5000 series chipsets" |
328 | depends on PCI && EXPERIMENTAL | 328 | depends on PCI && EXPERIMENTAL |
329 | help | 329 | help |
330 | If you say yes here you get support for FB-DIMM AMB temperature | 330 | If you say yes here you get support for FB-DIMM AMB temperature |
331 | monitoring chips on systems with the Intel 5000 series chipset. | 331 | monitoring chips on systems with the Intel 5000 series chipset. |
332 | 332 | ||
333 | This driver can also be built as a module. If so, the module | 333 | This driver can also be built as a module. If so, the module |
334 | will be called i5k_amb. | 334 | will be called i5k_amb. |
335 | 335 | ||
336 | config SENSORS_F71805F | 336 | config SENSORS_F71805F |
337 | tristate "Fintek F71805F/FG, F71806F/FG and F71872F/FG" | 337 | tristate "Fintek F71805F/FG, F71806F/FG and F71872F/FG" |
338 | depends on !PPC | 338 | depends on !PPC |
339 | help | 339 | help |
340 | If you say yes here you get support for hardware monitoring | 340 | If you say yes here you get support for hardware monitoring |
341 | features of the Fintek F71805F/FG, F71806F/FG and F71872F/FG | 341 | features of the Fintek F71805F/FG, F71806F/FG and F71872F/FG |
342 | Super-I/O chips. | 342 | Super-I/O chips. |
343 | 343 | ||
344 | This driver can also be built as a module. If so, the module | 344 | This driver can also be built as a module. If so, the module |
345 | will be called f71805f. | 345 | will be called f71805f. |
346 | 346 | ||
347 | config SENSORS_F71882FG | 347 | config SENSORS_F71882FG |
348 | tristate "Fintek F71882FG and compatibles" | 348 | tristate "Fintek F71882FG and compatibles" |
349 | depends on !PPC | 349 | depends on !PPC |
350 | help | 350 | help |
351 | If you say yes here you get support for hardware monitoring | 351 | If you say yes here you get support for hardware monitoring |
352 | features of many Fintek Super-I/O (LPC) chips. The currently | 352 | features of many Fintek Super-I/O (LPC) chips. The currently |
353 | supported chips are: | 353 | supported chips are: |
354 | F71808E/A | 354 | F71808E/A |
355 | F71858FG | 355 | F71858FG |
356 | F71862FG | 356 | F71862FG |
357 | F71863FG | 357 | F71863FG |
358 | F71869F/E/A | 358 | F71869F/E/A |
359 | F71882FG | 359 | F71882FG |
360 | F71883FG | 360 | F71883FG |
361 | F71889FG/ED/A | 361 | F71889FG/ED/A |
362 | F8000 | 362 | F8000 |
363 | F81801U | 363 | F81801U |
364 | F81865F | 364 | F81865F |
365 | 365 | ||
366 | This driver can also be built as a module. If so, the module | 366 | This driver can also be built as a module. If so, the module |
367 | will be called f71882fg. | 367 | will be called f71882fg. |
368 | 368 | ||
369 | config SENSORS_F75375S | 369 | config SENSORS_F75375S |
370 | tristate "Fintek F75375S/SP, F75373 and F75387" | 370 | tristate "Fintek F75375S/SP, F75373 and F75387" |
371 | depends on I2C | 371 | depends on I2C |
372 | help | 372 | help |
373 | If you say yes here you get support for hardware monitoring | 373 | If you say yes here you get support for hardware monitoring |
374 | features of the Fintek F75375S/SP, F75373 and F75387 | 374 | features of the Fintek F75375S/SP, F75373 and F75387 |
375 | 375 | ||
376 | This driver can also be built as a module. If so, the module | 376 | This driver can also be built as a module. If so, the module |
377 | will be called f75375s. | 377 | will be called f75375s. |
378 | 378 | ||
379 | config SENSORS_FSCHMD | 379 | config SENSORS_FSCHMD |
380 | tristate "Fujitsu Siemens Computers sensor chips" | 380 | tristate "Fujitsu Siemens Computers sensor chips" |
381 | depends on X86 && I2C | 381 | depends on X86 && I2C |
382 | help | 382 | help |
383 | If you say yes here you get support for the following Fujitsu | 383 | If you say yes here you get support for the following Fujitsu |
384 | Siemens Computers (FSC) sensor chips: Poseidon, Scylla, Hermes, | 384 | Siemens Computers (FSC) sensor chips: Poseidon, Scylla, Hermes, |
385 | Heimdall, Heracles, Hades and Syleus including support for the | 385 | Heimdall, Heracles, Hades and Syleus including support for the |
386 | integrated watchdog. | 386 | integrated watchdog. |
387 | 387 | ||
388 | This is a merged driver for FSC sensor chips replacing the fscpos, | 388 | This is a merged driver for FSC sensor chips replacing the fscpos, |
389 | fscscy and fscher drivers and adding support for several other FSC | 389 | fscscy and fscher drivers and adding support for several other FSC |
390 | sensor chips. | 390 | sensor chips. |
391 | 391 | ||
392 | This driver can also be built as a module. If so, the module | 392 | This driver can also be built as a module. If so, the module |
393 | will be called fschmd. | 393 | will be called fschmd. |
394 | 394 | ||
395 | config SENSORS_G760A | 395 | config SENSORS_G760A |
396 | tristate "GMT G760A" | 396 | tristate "GMT G760A" |
397 | depends on I2C | 397 | depends on I2C |
398 | help | 398 | help |
399 | If you say yes here you get support for Global Mixed-mode | 399 | If you say yes here you get support for Global Mixed-mode |
400 | Technology Inc G760A fan speed PWM controller chips. | 400 | Technology Inc G760A fan speed PWM controller chips. |
401 | 401 | ||
402 | This driver can also be built as a module. If so, the module | 402 | This driver can also be built as a module. If so, the module |
403 | will be called g760a. | 403 | will be called g760a. |
404 | 404 | ||
405 | config SENSORS_GL518SM | 405 | config SENSORS_GL518SM |
406 | tristate "Genesys Logic GL518SM" | 406 | tristate "Genesys Logic GL518SM" |
407 | depends on I2C | 407 | depends on I2C |
408 | help | 408 | help |
409 | If you say yes here you get support for Genesys Logic GL518SM | 409 | If you say yes here you get support for Genesys Logic GL518SM |
410 | sensor chips. | 410 | sensor chips. |
411 | 411 | ||
412 | This driver can also be built as a module. If so, the module | 412 | This driver can also be built as a module. If so, the module |
413 | will be called gl518sm. | 413 | will be called gl518sm. |
414 | 414 | ||
415 | config SENSORS_GL520SM | 415 | config SENSORS_GL520SM |
416 | tristate "Genesys Logic GL520SM" | 416 | tristate "Genesys Logic GL520SM" |
417 | depends on I2C | 417 | depends on I2C |
418 | select HWMON_VID | 418 | select HWMON_VID |
419 | help | 419 | help |
420 | If you say yes here you get support for Genesys Logic GL520SM | 420 | If you say yes here you get support for Genesys Logic GL520SM |
421 | sensor chips. | 421 | sensor chips. |
422 | 422 | ||
423 | This driver can also be built as a module. If so, the module | 423 | This driver can also be built as a module. If so, the module |
424 | will be called gl520sm. | 424 | will be called gl520sm. |
425 | 425 | ||
426 | config SENSORS_GPIO_FAN | 426 | config SENSORS_GPIO_FAN |
427 | tristate "GPIO fan" | 427 | tristate "GPIO fan" |
428 | depends on GENERIC_GPIO | 428 | depends on GENERIC_GPIO |
429 | help | 429 | help |
430 | If you say yes here you get support for fans connected to GPIO lines. | 430 | If you say yes here you get support for fans connected to GPIO lines. |
431 | 431 | ||
432 | This driver can also be built as a module. If so, the module | 432 | This driver can also be built as a module. If so, the module |
433 | will be called gpio-fan. | 433 | will be called gpio-fan. |
434 | 434 | ||
435 | config SENSORS_CORETEMP | 435 | config SENSORS_CORETEMP |
436 | tristate "Intel Core/Core2/Atom temperature sensor" | 436 | tristate "Intel Core/Core2/Atom temperature sensor" |
437 | depends on X86 && PCI && EXPERIMENTAL | 437 | depends on X86 && PCI && EXPERIMENTAL |
438 | help | 438 | help |
439 | If you say yes here you get support for the temperature | 439 | If you say yes here you get support for the temperature |
440 | sensor inside your CPU. Most of the family 6 CPUs | 440 | sensor inside your CPU. Most of the family 6 CPUs |
441 | are supported. Check Documentation/hwmon/coretemp for details. | 441 | are supported. Check Documentation/hwmon/coretemp for details. |
442 | 442 | ||
443 | config SENSORS_IBMAEM | 443 | config SENSORS_IBMAEM |
444 | tristate "IBM Active Energy Manager temperature/power sensors and control" | 444 | tristate "IBM Active Energy Manager temperature/power sensors and control" |
445 | select IPMI_SI | 445 | select IPMI_SI |
446 | depends on IPMI_HANDLER | 446 | depends on IPMI_HANDLER |
447 | help | 447 | help |
448 | If you say yes here you get support for the temperature and | 448 | If you say yes here you get support for the temperature and |
449 | power sensors and capping hardware in various IBM System X | 449 | power sensors and capping hardware in various IBM System X |
450 | servers that support Active Energy Manager. This includes | 450 | servers that support Active Energy Manager. This includes |
451 | the x3350, x3550, x3650, x3655, x3755, x3850 M2, x3950 M2, | 451 | the x3350, x3550, x3650, x3655, x3755, x3850 M2, x3950 M2, |
452 | and certain HC10/HS2x/LS2x/QS2x blades. | 452 | and certain HC10/HS2x/LS2x/QS2x blades. |
453 | 453 | ||
454 | This driver can also be built as a module. If so, the module | 454 | This driver can also be built as a module. If so, the module |
455 | will be called ibmaem. | 455 | will be called ibmaem. |
456 | 456 | ||
457 | config SENSORS_IBMPEX | 457 | config SENSORS_IBMPEX |
458 | tristate "IBM PowerExecutive temperature/power sensors" | 458 | tristate "IBM PowerExecutive temperature/power sensors" |
459 | select IPMI_SI | 459 | select IPMI_SI |
460 | depends on IPMI_HANDLER | 460 | depends on IPMI_HANDLER |
461 | help | 461 | help |
462 | If you say yes here you get support for the temperature and | 462 | If you say yes here you get support for the temperature and |
463 | power sensors in various IBM System X servers that support | 463 | power sensors in various IBM System X servers that support |
464 | PowerExecutive. So far this includes the x3350, x3550, x3650, | 464 | PowerExecutive. So far this includes the x3350, x3550, x3650, |
465 | x3655, and x3755; the x3800, x3850, and x3950 models that have | 465 | x3655, and x3755; the x3800, x3850, and x3950 models that have |
466 | PCI Express; and some of the HS2x, LS2x, and QS2x blades. | 466 | PCI Express; and some of the HS2x, LS2x, and QS2x blades. |
467 | 467 | ||
468 | This driver can also be built as a module. If so, the module | 468 | This driver can also be built as a module. If so, the module |
469 | will be called ibmpex. | 469 | will be called ibmpex. |
470 | 470 | ||
471 | config SENSORS_IT87 | 471 | config SENSORS_IT87 |
472 | tristate "ITE IT87xx and compatibles" | 472 | tristate "ITE IT87xx and compatibles" |
473 | depends on !PPC | 473 | depends on !PPC |
474 | select HWMON_VID | 474 | select HWMON_VID |
475 | help | 475 | help |
476 | If you say yes here you get support for ITE IT8705F, IT8712F, | 476 | If you say yes here you get support for ITE IT8705F, IT8712F, |
477 | IT8716F, IT8718F, IT8720F, IT8721F, IT8726F and IT8758E sensor | 477 | IT8716F, IT8718F, IT8720F, IT8721F, IT8726F, IT8728F and IT8758E |
478 | chips, and the SiS960 clone. | 478 | sensor chips, and the SiS960 clone. |
479 | 479 | ||
480 | This driver can also be built as a module. If so, the module | 480 | This driver can also be built as a module. If so, the module |
481 | will be called it87. | 481 | will be called it87. |
482 | 482 | ||
483 | config SENSORS_JZ4740 | 483 | config SENSORS_JZ4740 |
484 | tristate "Ingenic JZ4740 SoC ADC driver" | 484 | tristate "Ingenic JZ4740 SoC ADC driver" |
485 | depends on MACH_JZ4740 && MFD_JZ4740_ADC | 485 | depends on MACH_JZ4740 && MFD_JZ4740_ADC |
486 | help | 486 | help |
487 | If you say yes here you get support for reading adc values from the ADCIN | 487 | If you say yes here you get support for reading adc values from the ADCIN |
488 | pin on Ingenic JZ4740 SoC based boards. | 488 | pin on Ingenic JZ4740 SoC based boards. |
489 | 489 | ||
490 | This driver can also be build as a module. If so, the module will be | 490 | This driver can also be build as a module. If so, the module will be |
491 | called jz4740-hwmon. | 491 | called jz4740-hwmon. |
492 | 492 | ||
493 | config SENSORS_JC42 | 493 | config SENSORS_JC42 |
494 | tristate "JEDEC JC42.4 compliant memory module temperature sensors" | 494 | tristate "JEDEC JC42.4 compliant memory module temperature sensors" |
495 | depends on I2C | 495 | depends on I2C |
496 | help | 496 | help |
497 | If you say yes here, you get support for JEDEC JC42.4 compliant | 497 | If you say yes here, you get support for JEDEC JC42.4 compliant |
498 | temperature sensors, which are used on many DDR3 memory modules for | 498 | temperature sensors, which are used on many DDR3 memory modules for |
499 | mobile devices and servers. Support will include, but not be limited | 499 | mobile devices and servers. Support will include, but not be limited |
500 | to, ADT7408, CAT34TS02, CAT6095, MAX6604, MCP9805, MCP98242, MCP98243, | 500 | to, ADT7408, CAT34TS02, CAT6095, MAX6604, MCP9805, MCP98242, MCP98243, |
501 | MCP9843, SE97, SE98, STTS424(E), TSE2002B3, and TS3000B3. | 501 | MCP9843, SE97, SE98, STTS424(E), TSE2002B3, and TS3000B3. |
502 | 502 | ||
503 | This driver can also be built as a module. If so, the module | 503 | This driver can also be built as a module. If so, the module |
504 | will be called jc42. | 504 | will be called jc42. |
505 | 505 | ||
506 | config SENSORS_LINEAGE | 506 | config SENSORS_LINEAGE |
507 | tristate "Lineage Compact Power Line Power Entry Module" | 507 | tristate "Lineage Compact Power Line Power Entry Module" |
508 | depends on I2C && EXPERIMENTAL | 508 | depends on I2C && EXPERIMENTAL |
509 | help | 509 | help |
510 | If you say yes here you get support for the Lineage Compact Power Line | 510 | If you say yes here you get support for the Lineage Compact Power Line |
511 | series of DC/DC and AC/DC converters such as CP1800, CP2000AC, | 511 | series of DC/DC and AC/DC converters such as CP1800, CP2000AC, |
512 | CP2000DC, CP2725, and others. | 512 | CP2000DC, CP2725, and others. |
513 | 513 | ||
514 | This driver can also be built as a module. If so, the module | 514 | This driver can also be built as a module. If so, the module |
515 | will be called lineage-pem. | 515 | will be called lineage-pem. |
516 | 516 | ||
517 | config SENSORS_LM63 | 517 | config SENSORS_LM63 |
518 | tristate "National Semiconductor LM63 and compatibles" | 518 | tristate "National Semiconductor LM63 and compatibles" |
519 | depends on I2C | 519 | depends on I2C |
520 | help | 520 | help |
521 | If you say yes here you get support for the National | 521 | If you say yes here you get support for the National |
522 | Semiconductor LM63, LM64, and LM96163 remote diode digital temperature | 522 | Semiconductor LM63, LM64, and LM96163 remote diode digital temperature |
523 | sensors with integrated fan control. Such chips are found | 523 | sensors with integrated fan control. Such chips are found |
524 | on the Tyan S4882 (Thunder K8QS Pro) motherboard, among | 524 | on the Tyan S4882 (Thunder K8QS Pro) motherboard, among |
525 | others. | 525 | others. |
526 | 526 | ||
527 | This driver can also be built as a module. If so, the module | 527 | This driver can also be built as a module. If so, the module |
528 | will be called lm63. | 528 | will be called lm63. |
529 | 529 | ||
530 | config SENSORS_LM70 | 530 | config SENSORS_LM70 |
531 | tristate "National Semiconductor LM70 / Texas Instruments TMP121" | 531 | tristate "National Semiconductor LM70 / Texas Instruments TMP121" |
532 | depends on SPI_MASTER | 532 | depends on SPI_MASTER |
533 | help | 533 | help |
534 | If you say yes here you get support for the National Semiconductor | 534 | If you say yes here you get support for the National Semiconductor |
535 | LM70 and Texas Instruments TMP121/TMP123 digital temperature | 535 | LM70 and Texas Instruments TMP121/TMP123 digital temperature |
536 | sensor chips. | 536 | sensor chips. |
537 | 537 | ||
538 | This driver can also be built as a module. If so, the module | 538 | This driver can also be built as a module. If so, the module |
539 | will be called lm70. | 539 | will be called lm70. |
540 | 540 | ||
541 | config SENSORS_LM73 | 541 | config SENSORS_LM73 |
542 | tristate "National Semiconductor LM73" | 542 | tristate "National Semiconductor LM73" |
543 | depends on I2C | 543 | depends on I2C |
544 | help | 544 | help |
545 | If you say yes here you get support for National Semiconductor LM73 | 545 | If you say yes here you get support for National Semiconductor LM73 |
546 | sensor chips. | 546 | sensor chips. |
547 | This driver can also be built as a module. If so, the module | 547 | This driver can also be built as a module. If so, the module |
548 | will be called lm73. | 548 | will be called lm73. |
549 | 549 | ||
550 | config SENSORS_LM75 | 550 | config SENSORS_LM75 |
551 | tristate "National Semiconductor LM75 and compatibles" | 551 | tristate "National Semiconductor LM75 and compatibles" |
552 | depends on I2C | 552 | depends on I2C |
553 | help | 553 | help |
554 | If you say yes here you get support for one common type of | 554 | If you say yes here you get support for one common type of |
555 | temperature sensor chip, with models including: | 555 | temperature sensor chip, with models including: |
556 | 556 | ||
557 | - Analog Devices ADT75 | 557 | - Analog Devices ADT75 |
558 | - Dallas Semiconductor DS75 and DS1775 | 558 | - Dallas Semiconductor DS75 and DS1775 |
559 | - Maxim MAX6625 and MAX6626 | 559 | - Maxim MAX6625 and MAX6626 |
560 | - Microchip MCP980x | 560 | - Microchip MCP980x |
561 | - National Semiconductor LM75, LM75A | 561 | - National Semiconductor LM75, LM75A |
562 | - NXP's LM75A | 562 | - NXP's LM75A |
563 | - ST Microelectronics STDS75 | 563 | - ST Microelectronics STDS75 |
564 | - TelCom (now Microchip) TCN75 | 564 | - TelCom (now Microchip) TCN75 |
565 | - Texas Instruments TMP100, TMP101, TMP105, TMP75, TMP175, | 565 | - Texas Instruments TMP100, TMP101, TMP105, TMP75, TMP175, |
566 | TMP275 | 566 | TMP275 |
567 | 567 | ||
568 | This driver supports driver model based binding through board | 568 | This driver supports driver model based binding through board |
569 | specific I2C device tables. | 569 | specific I2C device tables. |
570 | 570 | ||
571 | It also supports the "legacy" style of driver binding. To use | 571 | It also supports the "legacy" style of driver binding. To use |
572 | that with some chips which don't replicate LM75 quirks exactly, | 572 | that with some chips which don't replicate LM75 quirks exactly, |
573 | you may need the "force" module parameter. | 573 | you may need the "force" module parameter. |
574 | 574 | ||
575 | This driver can also be built as a module. If so, the module | 575 | This driver can also be built as a module. If so, the module |
576 | will be called lm75. | 576 | will be called lm75. |
577 | 577 | ||
578 | config SENSORS_LM77 | 578 | config SENSORS_LM77 |
579 | tristate "National Semiconductor LM77" | 579 | tristate "National Semiconductor LM77" |
580 | depends on I2C | 580 | depends on I2C |
581 | help | 581 | help |
582 | If you say yes here you get support for National Semiconductor LM77 | 582 | If you say yes here you get support for National Semiconductor LM77 |
583 | sensor chips. | 583 | sensor chips. |
584 | 584 | ||
585 | This driver can also be built as a module. If so, the module | 585 | This driver can also be built as a module. If so, the module |
586 | will be called lm77. | 586 | will be called lm77. |
587 | 587 | ||
588 | config SENSORS_LM78 | 588 | config SENSORS_LM78 |
589 | tristate "National Semiconductor LM78 and compatibles" | 589 | tristate "National Semiconductor LM78 and compatibles" |
590 | depends on I2C | 590 | depends on I2C |
591 | select HWMON_VID | 591 | select HWMON_VID |
592 | help | 592 | help |
593 | If you say yes here you get support for National Semiconductor LM78, | 593 | If you say yes here you get support for National Semiconductor LM78, |
594 | LM78-J and LM79. | 594 | LM78-J and LM79. |
595 | 595 | ||
596 | This driver can also be built as a module. If so, the module | 596 | This driver can also be built as a module. If so, the module |
597 | will be called lm78. | 597 | will be called lm78. |
598 | 598 | ||
599 | config SENSORS_LM80 | 599 | config SENSORS_LM80 |
600 | tristate "National Semiconductor LM80" | 600 | tristate "National Semiconductor LM80" |
601 | depends on I2C | 601 | depends on I2C |
602 | help | 602 | help |
603 | If you say yes here you get support for National Semiconductor | 603 | If you say yes here you get support for National Semiconductor |
604 | LM80 sensor chips. | 604 | LM80 sensor chips. |
605 | 605 | ||
606 | This driver can also be built as a module. If so, the module | 606 | This driver can also be built as a module. If so, the module |
607 | will be called lm80. | 607 | will be called lm80. |
608 | 608 | ||
609 | config SENSORS_LM83 | 609 | config SENSORS_LM83 |
610 | tristate "National Semiconductor LM83 and compatibles" | 610 | tristate "National Semiconductor LM83 and compatibles" |
611 | depends on I2C | 611 | depends on I2C |
612 | help | 612 | help |
613 | If you say yes here you get support for National Semiconductor | 613 | If you say yes here you get support for National Semiconductor |
614 | LM82 and LM83 sensor chips. | 614 | LM82 and LM83 sensor chips. |
615 | 615 | ||
616 | This driver can also be built as a module. If so, the module | 616 | This driver can also be built as a module. If so, the module |
617 | will be called lm83. | 617 | will be called lm83. |
618 | 618 | ||
619 | config SENSORS_LM85 | 619 | config SENSORS_LM85 |
620 | tristate "National Semiconductor LM85 and compatibles" | 620 | tristate "National Semiconductor LM85 and compatibles" |
621 | depends on I2C | 621 | depends on I2C |
622 | select HWMON_VID | 622 | select HWMON_VID |
623 | help | 623 | help |
624 | If you say yes here you get support for National Semiconductor LM85 | 624 | If you say yes here you get support for National Semiconductor LM85 |
625 | sensor chips and clones: ADM1027, ADT7463, ADT7468, EMC6D100, | 625 | sensor chips and clones: ADM1027, ADT7463, ADT7468, EMC6D100, |
626 | EMC6D101, EMC6D102, and EMC6D103. | 626 | EMC6D101, EMC6D102, and EMC6D103. |
627 | 627 | ||
628 | This driver can also be built as a module. If so, the module | 628 | This driver can also be built as a module. If so, the module |
629 | will be called lm85. | 629 | will be called lm85. |
630 | 630 | ||
631 | config SENSORS_LM87 | 631 | config SENSORS_LM87 |
632 | tristate "National Semiconductor LM87 and compatibles" | 632 | tristate "National Semiconductor LM87 and compatibles" |
633 | depends on I2C | 633 | depends on I2C |
634 | select HWMON_VID | 634 | select HWMON_VID |
635 | help | 635 | help |
636 | If you say yes here you get support for National Semiconductor LM87 | 636 | If you say yes here you get support for National Semiconductor LM87 |
637 | and Analog Devices ADM1024 sensor chips. | 637 | and Analog Devices ADM1024 sensor chips. |
638 | 638 | ||
639 | This driver can also be built as a module. If so, the module | 639 | This driver can also be built as a module. If so, the module |
640 | will be called lm87. | 640 | will be called lm87. |
641 | 641 | ||
642 | config SENSORS_LM90 | 642 | config SENSORS_LM90 |
643 | tristate "National Semiconductor LM90 and compatibles" | 643 | tristate "National Semiconductor LM90 and compatibles" |
644 | depends on I2C | 644 | depends on I2C |
645 | help | 645 | help |
646 | If you say yes here you get support for National Semiconductor LM90, | 646 | If you say yes here you get support for National Semiconductor LM90, |
647 | LM86, LM89 and LM99, Analog Devices ADM1032, ADT7461, and ADT7461A, | 647 | LM86, LM89 and LM99, Analog Devices ADM1032, ADT7461, and ADT7461A, |
648 | Maxim MAX6646, MAX6647, MAX6648, MAX6649, MAX6657, MAX6658, MAX6659, | 648 | Maxim MAX6646, MAX6647, MAX6648, MAX6649, MAX6657, MAX6658, MAX6659, |
649 | MAX6680, MAX6681, MAX6692, MAX6695, MAX6696, ON Semiconductor NCT1008, | 649 | MAX6680, MAX6681, MAX6692, MAX6695, MAX6696, ON Semiconductor NCT1008, |
650 | Winbond/Nuvoton W83L771W/G/AWG/ASG and Philips SA56004 sensor chips. | 650 | Winbond/Nuvoton W83L771W/G/AWG/ASG and Philips SA56004 sensor chips. |
651 | 651 | ||
652 | This driver can also be built as a module. If so, the module | 652 | This driver can also be built as a module. If so, the module |
653 | will be called lm90. | 653 | will be called lm90. |
654 | 654 | ||
655 | config SENSORS_LM92 | 655 | config SENSORS_LM92 |
656 | tristate "National Semiconductor LM92 and compatibles" | 656 | tristate "National Semiconductor LM92 and compatibles" |
657 | depends on I2C | 657 | depends on I2C |
658 | help | 658 | help |
659 | If you say yes here you get support for National Semiconductor LM92 | 659 | If you say yes here you get support for National Semiconductor LM92 |
660 | and Maxim MAX6635 sensor chips. | 660 | and Maxim MAX6635 sensor chips. |
661 | 661 | ||
662 | This driver can also be built as a module. If so, the module | 662 | This driver can also be built as a module. If so, the module |
663 | will be called lm92. | 663 | will be called lm92. |
664 | 664 | ||
665 | config SENSORS_LM93 | 665 | config SENSORS_LM93 |
666 | tristate "National Semiconductor LM93 and compatibles" | 666 | tristate "National Semiconductor LM93 and compatibles" |
667 | depends on I2C | 667 | depends on I2C |
668 | select HWMON_VID | 668 | select HWMON_VID |
669 | help | 669 | help |
670 | If you say yes here you get support for National Semiconductor LM93, | 670 | If you say yes here you get support for National Semiconductor LM93, |
671 | LM94, and compatible sensor chips. | 671 | LM94, and compatible sensor chips. |
672 | 672 | ||
673 | This driver can also be built as a module. If so, the module | 673 | This driver can also be built as a module. If so, the module |
674 | will be called lm93. | 674 | will be called lm93. |
675 | 675 | ||
676 | config SENSORS_LTC4151 | 676 | config SENSORS_LTC4151 |
677 | tristate "Linear Technology LTC4151" | 677 | tristate "Linear Technology LTC4151" |
678 | depends on I2C | 678 | depends on I2C |
679 | default n | 679 | default n |
680 | help | 680 | help |
681 | If you say yes here you get support for Linear Technology LTC4151 | 681 | If you say yes here you get support for Linear Technology LTC4151 |
682 | High Voltage I2C Current and Voltage Monitor interface. | 682 | High Voltage I2C Current and Voltage Monitor interface. |
683 | 683 | ||
684 | This driver can also be built as a module. If so, the module will | 684 | This driver can also be built as a module. If so, the module will |
685 | be called ltc4151. | 685 | be called ltc4151. |
686 | 686 | ||
687 | config SENSORS_LTC4215 | 687 | config SENSORS_LTC4215 |
688 | tristate "Linear Technology LTC4215" | 688 | tristate "Linear Technology LTC4215" |
689 | depends on I2C && EXPERIMENTAL | 689 | depends on I2C && EXPERIMENTAL |
690 | default n | 690 | default n |
691 | help | 691 | help |
692 | If you say yes here you get support for Linear Technology LTC4215 | 692 | If you say yes here you get support for Linear Technology LTC4215 |
693 | Hot Swap Controller I2C interface. | 693 | Hot Swap Controller I2C interface. |
694 | 694 | ||
695 | This driver can also be built as a module. If so, the module will | 695 | This driver can also be built as a module. If so, the module will |
696 | be called ltc4215. | 696 | be called ltc4215. |
697 | 697 | ||
698 | config SENSORS_LTC4245 | 698 | config SENSORS_LTC4245 |
699 | tristate "Linear Technology LTC4245" | 699 | tristate "Linear Technology LTC4245" |
700 | depends on I2C && EXPERIMENTAL | 700 | depends on I2C && EXPERIMENTAL |
701 | default n | 701 | default n |
702 | help | 702 | help |
703 | If you say yes here you get support for Linear Technology LTC4245 | 703 | If you say yes here you get support for Linear Technology LTC4245 |
704 | Multiple Supply Hot Swap Controller I2C interface. | 704 | Multiple Supply Hot Swap Controller I2C interface. |
705 | 705 | ||
706 | This driver can also be built as a module. If so, the module will | 706 | This driver can also be built as a module. If so, the module will |
707 | be called ltc4245. | 707 | be called ltc4245. |
708 | 708 | ||
709 | config SENSORS_LTC4261 | 709 | config SENSORS_LTC4261 |
710 | tristate "Linear Technology LTC4261" | 710 | tristate "Linear Technology LTC4261" |
711 | depends on I2C && EXPERIMENTAL | 711 | depends on I2C && EXPERIMENTAL |
712 | default n | 712 | default n |
713 | help | 713 | help |
714 | If you say yes here you get support for Linear Technology LTC4261 | 714 | If you say yes here you get support for Linear Technology LTC4261 |
715 | Negative Voltage Hot Swap Controller I2C interface. | 715 | Negative Voltage Hot Swap Controller I2C interface. |
716 | 716 | ||
717 | This driver can also be built as a module. If so, the module will | 717 | This driver can also be built as a module. If so, the module will |
718 | be called ltc4261. | 718 | be called ltc4261. |
719 | 719 | ||
720 | config SENSORS_LM95241 | 720 | config SENSORS_LM95241 |
721 | tristate "National Semiconductor LM95241 and compatibles" | 721 | tristate "National Semiconductor LM95241 and compatibles" |
722 | depends on I2C | 722 | depends on I2C |
723 | help | 723 | help |
724 | If you say yes here you get support for LM95231 and LM95241 sensor | 724 | If you say yes here you get support for LM95231 and LM95241 sensor |
725 | chips. | 725 | chips. |
726 | 726 | ||
727 | This driver can also be built as a module. If so, the module | 727 | This driver can also be built as a module. If so, the module |
728 | will be called lm95241. | 728 | will be called lm95241. |
729 | 729 | ||
730 | config SENSORS_LM95245 | 730 | config SENSORS_LM95245 |
731 | tristate "National Semiconductor LM95245 sensor chip" | 731 | tristate "National Semiconductor LM95245 sensor chip" |
732 | depends on I2C && EXPERIMENTAL | 732 | depends on I2C && EXPERIMENTAL |
733 | help | 733 | help |
734 | If you say yes here you get support for LM95245 sensor chip. | 734 | If you say yes here you get support for LM95245 sensor chip. |
735 | 735 | ||
736 | This driver can also be built as a module. If so, the module | 736 | This driver can also be built as a module. If so, the module |
737 | will be called lm95245. | 737 | will be called lm95245. |
738 | 738 | ||
739 | config SENSORS_MAX1111 | 739 | config SENSORS_MAX1111 |
740 | tristate "Maxim MAX1111 Multichannel, Serial 8-bit ADC chip" | 740 | tristate "Maxim MAX1111 Multichannel, Serial 8-bit ADC chip" |
741 | depends on SPI_MASTER | 741 | depends on SPI_MASTER |
742 | help | 742 | help |
743 | Say y here to support Maxim's MAX1111 ADC chips. | 743 | Say y here to support Maxim's MAX1111 ADC chips. |
744 | 744 | ||
745 | This driver can also be built as a module. If so, the module | 745 | This driver can also be built as a module. If so, the module |
746 | will be called max1111. | 746 | will be called max1111. |
747 | 747 | ||
748 | config SENSORS_MAX16065 | 748 | config SENSORS_MAX16065 |
749 | tristate "Maxim MAX16065 System Manager and compatibles" | 749 | tristate "Maxim MAX16065 System Manager and compatibles" |
750 | depends on I2C | 750 | depends on I2C |
751 | help | 751 | help |
752 | If you say yes here you get support for hardware monitoring | 752 | If you say yes here you get support for hardware monitoring |
753 | capabilities of the following Maxim System Manager chips. | 753 | capabilities of the following Maxim System Manager chips. |
754 | MAX16065 | 754 | MAX16065 |
755 | MAX16066 | 755 | MAX16066 |
756 | MAX16067 | 756 | MAX16067 |
757 | MAX16068 | 757 | MAX16068 |
758 | MAX16070 | 758 | MAX16070 |
759 | MAX16071 | 759 | MAX16071 |
760 | 760 | ||
761 | This driver can also be built as a module. If so, the module | 761 | This driver can also be built as a module. If so, the module |
762 | will be called max16065. | 762 | will be called max16065. |
763 | 763 | ||
764 | config SENSORS_MAX1619 | 764 | config SENSORS_MAX1619 |
765 | tristate "Maxim MAX1619 sensor chip" | 765 | tristate "Maxim MAX1619 sensor chip" |
766 | depends on I2C | 766 | depends on I2C |
767 | help | 767 | help |
768 | If you say yes here you get support for MAX1619 sensor chip. | 768 | If you say yes here you get support for MAX1619 sensor chip. |
769 | 769 | ||
770 | This driver can also be built as a module. If so, the module | 770 | This driver can also be built as a module. If so, the module |
771 | will be called max1619. | 771 | will be called max1619. |
772 | 772 | ||
773 | config SENSORS_MAX1668 | 773 | config SENSORS_MAX1668 |
774 | tristate "Maxim MAX1668 and compatibles" | 774 | tristate "Maxim MAX1668 and compatibles" |
775 | depends on I2C && EXPERIMENTAL | 775 | depends on I2C && EXPERIMENTAL |
776 | help | 776 | help |
777 | If you say yes here you get support for MAX1668, MAX1989 and | 777 | If you say yes here you get support for MAX1668, MAX1989 and |
778 | MAX1805 chips. | 778 | MAX1805 chips. |
779 | 779 | ||
780 | This driver can also be built as a module. If so, the module | 780 | This driver can also be built as a module. If so, the module |
781 | will be called max1668. | 781 | will be called max1668. |
782 | 782 | ||
783 | config SENSORS_MAX6639 | 783 | config SENSORS_MAX6639 |
784 | tristate "Maxim MAX6639 sensor chip" | 784 | tristate "Maxim MAX6639 sensor chip" |
785 | depends on I2C && EXPERIMENTAL | 785 | depends on I2C && EXPERIMENTAL |
786 | help | 786 | help |
787 | If you say yes here you get support for the MAX6639 | 787 | If you say yes here you get support for the MAX6639 |
788 | sensor chips. | 788 | sensor chips. |
789 | 789 | ||
790 | This driver can also be built as a module. If so, the module | 790 | This driver can also be built as a module. If so, the module |
791 | will be called max6639. | 791 | will be called max6639. |
792 | 792 | ||
793 | config SENSORS_MAX6642 | 793 | config SENSORS_MAX6642 |
794 | tristate "Maxim MAX6642 sensor chip" | 794 | tristate "Maxim MAX6642 sensor chip" |
795 | depends on I2C && EXPERIMENTAL | 795 | depends on I2C && EXPERIMENTAL |
796 | help | 796 | help |
797 | If you say yes here you get support for MAX6642 sensor chip. | 797 | If you say yes here you get support for MAX6642 sensor chip. |
798 | MAX6642 is a SMBus-Compatible Remote/Local Temperature Sensor | 798 | MAX6642 is a SMBus-Compatible Remote/Local Temperature Sensor |
799 | with Overtemperature Alarm from Maxim. | 799 | with Overtemperature Alarm from Maxim. |
800 | 800 | ||
801 | This driver can also be built as a module. If so, the module | 801 | This driver can also be built as a module. If so, the module |
802 | will be called max6642. | 802 | will be called max6642. |
803 | 803 | ||
804 | config SENSORS_MAX6650 | 804 | config SENSORS_MAX6650 |
805 | tristate "Maxim MAX6650 sensor chip" | 805 | tristate "Maxim MAX6650 sensor chip" |
806 | depends on I2C && EXPERIMENTAL | 806 | depends on I2C && EXPERIMENTAL |
807 | help | 807 | help |
808 | If you say yes here you get support for the MAX6650 / MAX6651 | 808 | If you say yes here you get support for the MAX6650 / MAX6651 |
809 | sensor chips. | 809 | sensor chips. |
810 | 810 | ||
811 | This driver can also be built as a module. If so, the module | 811 | This driver can also be built as a module. If so, the module |
812 | will be called max6650. | 812 | will be called max6650. |
813 | 813 | ||
814 | config SENSORS_NTC_THERMISTOR | 814 | config SENSORS_NTC_THERMISTOR |
815 | tristate "NTC thermistor support" | 815 | tristate "NTC thermistor support" |
816 | depends on EXPERIMENTAL | 816 | depends on EXPERIMENTAL |
817 | help | 817 | help |
818 | This driver supports NTC thermistors sensor reading and its | 818 | This driver supports NTC thermistors sensor reading and its |
819 | interpretation. The driver can also monitor the temperature and | 819 | interpretation. The driver can also monitor the temperature and |
820 | send notifications about the temperature. | 820 | send notifications about the temperature. |
821 | 821 | ||
822 | Currently, this driver supports | 822 | Currently, this driver supports |
823 | NCP15WB473, NCP18WB473, NCP21WB473, NCP03WB473, and NCP15WL333. | 823 | NCP15WB473, NCP18WB473, NCP21WB473, NCP03WB473, and NCP15WL333. |
824 | 824 | ||
825 | This driver can also be built as a module. If so, the module | 825 | This driver can also be built as a module. If so, the module |
826 | will be called ntc-thermistor. | 826 | will be called ntc-thermistor. |
827 | 827 | ||
828 | config SENSORS_PC87360 | 828 | config SENSORS_PC87360 |
829 | tristate "National Semiconductor PC87360 family" | 829 | tristate "National Semiconductor PC87360 family" |
830 | depends on !PPC | 830 | depends on !PPC |
831 | select HWMON_VID | 831 | select HWMON_VID |
832 | help | 832 | help |
833 | If you say yes here you get access to the hardware monitoring | 833 | If you say yes here you get access to the hardware monitoring |
834 | functions of the National Semiconductor PC8736x Super-I/O chips. | 834 | functions of the National Semiconductor PC8736x Super-I/O chips. |
835 | The PC87360, PC87363 and PC87364 only have fan monitoring and | 835 | The PC87360, PC87363 and PC87364 only have fan monitoring and |
836 | control. The PC87365 and PC87366 additionally have voltage and | 836 | control. The PC87365 and PC87366 additionally have voltage and |
837 | temperature monitoring. | 837 | temperature monitoring. |
838 | 838 | ||
839 | This driver can also be built as a module. If so, the module | 839 | This driver can also be built as a module. If so, the module |
840 | will be called pc87360. | 840 | will be called pc87360. |
841 | 841 | ||
842 | config SENSORS_PC87427 | 842 | config SENSORS_PC87427 |
843 | tristate "National Semiconductor PC87427" | 843 | tristate "National Semiconductor PC87427" |
844 | depends on !PPC | 844 | depends on !PPC |
845 | help | 845 | help |
846 | If you say yes here you get access to the hardware monitoring | 846 | If you say yes here you get access to the hardware monitoring |
847 | functions of the National Semiconductor PC87427 Super-I/O chip. | 847 | functions of the National Semiconductor PC87427 Super-I/O chip. |
848 | The chip has two distinct logical devices, one for fan speed | 848 | The chip has two distinct logical devices, one for fan speed |
849 | monitoring and control, and one for voltage and temperature | 849 | monitoring and control, and one for voltage and temperature |
850 | monitoring. Fan speed monitoring and control are supported, as | 850 | monitoring. Fan speed monitoring and control are supported, as |
851 | well as temperature monitoring. Voltages aren't supported yet. | 851 | well as temperature monitoring. Voltages aren't supported yet. |
852 | 852 | ||
853 | This driver can also be built as a module. If so, the module | 853 | This driver can also be built as a module. If so, the module |
854 | will be called pc87427. | 854 | will be called pc87427. |
855 | 855 | ||
856 | config SENSORS_PCF8591 | 856 | config SENSORS_PCF8591 |
857 | tristate "Philips PCF8591 ADC/DAC" | 857 | tristate "Philips PCF8591 ADC/DAC" |
858 | depends on I2C | 858 | depends on I2C |
859 | default n | 859 | default n |
860 | help | 860 | help |
861 | If you say yes here you get support for Philips PCF8591 4-channel | 861 | If you say yes here you get support for Philips PCF8591 4-channel |
862 | ADC, 1-channel DAC chips. | 862 | ADC, 1-channel DAC chips. |
863 | 863 | ||
864 | This driver can also be built as a module. If so, the module | 864 | This driver can also be built as a module. If so, the module |
865 | will be called pcf8591. | 865 | will be called pcf8591. |
866 | 866 | ||
867 | These devices are hard to detect and rarely found on mainstream | 867 | These devices are hard to detect and rarely found on mainstream |
868 | hardware. If unsure, say N. | 868 | hardware. If unsure, say N. |
869 | 869 | ||
870 | source drivers/hwmon/pmbus/Kconfig | 870 | source drivers/hwmon/pmbus/Kconfig |
871 | 871 | ||
872 | config SENSORS_SHT15 | 872 | config SENSORS_SHT15 |
873 | tristate "Sensiron humidity and temperature sensors. SHT15 and compat." | 873 | tristate "Sensiron humidity and temperature sensors. SHT15 and compat." |
874 | depends on GENERIC_GPIO | 874 | depends on GENERIC_GPIO |
875 | help | 875 | help |
876 | If you say yes here you get support for the Sensiron SHT10, SHT11, | 876 | If you say yes here you get support for the Sensiron SHT10, SHT11, |
877 | SHT15, SHT71, SHT75 humidity and temperature sensors. | 877 | SHT15, SHT71, SHT75 humidity and temperature sensors. |
878 | 878 | ||
879 | This driver can also be built as a module. If so, the module | 879 | This driver can also be built as a module. If so, the module |
880 | will be called sht15. | 880 | will be called sht15. |
881 | 881 | ||
882 | config SENSORS_SHT21 | 882 | config SENSORS_SHT21 |
883 | tristate "Sensiron humidity and temperature sensors. SHT21 and compat." | 883 | tristate "Sensiron humidity and temperature sensors. SHT21 and compat." |
884 | depends on I2C | 884 | depends on I2C |
885 | help | 885 | help |
886 | If you say yes here you get support for the Sensiron SHT21, SHT25 | 886 | If you say yes here you get support for the Sensiron SHT21, SHT25 |
887 | humidity and temperature sensors. | 887 | humidity and temperature sensors. |
888 | 888 | ||
889 | This driver can also be built as a module. If so, the module | 889 | This driver can also be built as a module. If so, the module |
890 | will be called sht21. | 890 | will be called sht21. |
891 | 891 | ||
892 | config SENSORS_S3C | 892 | config SENSORS_S3C |
893 | tristate "Samsung built-in ADC" | 893 | tristate "Samsung built-in ADC" |
894 | depends on S3C_ADC | 894 | depends on S3C_ADC |
895 | help | 895 | help |
896 | If you say yes here you get support for the on-board ADCs of | 896 | If you say yes here you get support for the on-board ADCs of |
897 | the Samsung S3C24XX, S3C64XX and other series of SoC | 897 | the Samsung S3C24XX, S3C64XX and other series of SoC |
898 | 898 | ||
899 | This driver can also be built as a module. If so, the module | 899 | This driver can also be built as a module. If so, the module |
900 | will be called s3c-hwmon. | 900 | will be called s3c-hwmon. |
901 | 901 | ||
902 | config SENSORS_S3C_RAW | 902 | config SENSORS_S3C_RAW |
903 | bool "Include raw channel attributes in sysfs" | 903 | bool "Include raw channel attributes in sysfs" |
904 | depends on SENSORS_S3C | 904 | depends on SENSORS_S3C |
905 | help | 905 | help |
906 | Say Y here if you want to include raw copies of all the ADC | 906 | Say Y here if you want to include raw copies of all the ADC |
907 | channels in sysfs. | 907 | channels in sysfs. |
908 | 908 | ||
909 | config SENSORS_SIS5595 | 909 | config SENSORS_SIS5595 |
910 | tristate "Silicon Integrated Systems Corp. SiS5595" | 910 | tristate "Silicon Integrated Systems Corp. SiS5595" |
911 | depends on PCI | 911 | depends on PCI |
912 | help | 912 | help |
913 | If you say yes here you get support for the integrated sensors in | 913 | If you say yes here you get support for the integrated sensors in |
914 | SiS5595 South Bridges. | 914 | SiS5595 South Bridges. |
915 | 915 | ||
916 | This driver can also be built as a module. If so, the module | 916 | This driver can also be built as a module. If so, the module |
917 | will be called sis5595. | 917 | will be called sis5595. |
918 | 918 | ||
919 | config SENSORS_SMM665 | 919 | config SENSORS_SMM665 |
920 | tristate "Summit Microelectronics SMM665" | 920 | tristate "Summit Microelectronics SMM665" |
921 | depends on I2C && EXPERIMENTAL | 921 | depends on I2C && EXPERIMENTAL |
922 | default n | 922 | default n |
923 | help | 923 | help |
924 | If you say yes here you get support for the hardware monitoring | 924 | If you say yes here you get support for the hardware monitoring |
925 | features of the Summit Microelectronics SMM665/SMM665B Six-Channel | 925 | features of the Summit Microelectronics SMM665/SMM665B Six-Channel |
926 | Active DC Output Controller / Monitor. | 926 | Active DC Output Controller / Monitor. |
927 | 927 | ||
928 | Other supported chips are SMM465, SMM665C, SMM764, and SMM766. | 928 | Other supported chips are SMM465, SMM665C, SMM764, and SMM766. |
929 | Support for those chips is untested. | 929 | Support for those chips is untested. |
930 | 930 | ||
931 | This driver can also be built as a module. If so, the module will | 931 | This driver can also be built as a module. If so, the module will |
932 | be called smm665. | 932 | be called smm665. |
933 | 933 | ||
934 | config SENSORS_DME1737 | 934 | config SENSORS_DME1737 |
935 | tristate "SMSC DME1737, SCH311x and compatibles" | 935 | tristate "SMSC DME1737, SCH311x and compatibles" |
936 | depends on I2C && EXPERIMENTAL && !PPC | 936 | depends on I2C && EXPERIMENTAL && !PPC |
937 | select HWMON_VID | 937 | select HWMON_VID |
938 | help | 938 | help |
939 | If you say yes here you get support for the hardware monitoring | 939 | If you say yes here you get support for the hardware monitoring |
940 | and fan control features of the SMSC DME1737, SCH311x, SCH5027, and | 940 | and fan control features of the SMSC DME1737, SCH311x, SCH5027, and |
941 | Asus A8000 Super-I/O chips. | 941 | Asus A8000 Super-I/O chips. |
942 | 942 | ||
943 | This driver can also be built as a module. If so, the module | 943 | This driver can also be built as a module. If so, the module |
944 | will be called dme1737. | 944 | will be called dme1737. |
945 | 945 | ||
946 | config SENSORS_EMC1403 | 946 | config SENSORS_EMC1403 |
947 | tristate "SMSC EMC1403/23 thermal sensor" | 947 | tristate "SMSC EMC1403/23 thermal sensor" |
948 | depends on I2C | 948 | depends on I2C |
949 | help | 949 | help |
950 | If you say yes here you get support for the SMSC EMC1403/23 | 950 | If you say yes here you get support for the SMSC EMC1403/23 |
951 | temperature monitoring chip. | 951 | temperature monitoring chip. |
952 | 952 | ||
953 | Threshold values can be configured using sysfs. | 953 | Threshold values can be configured using sysfs. |
954 | Data from the different diodes are accessible via sysfs. | 954 | Data from the different diodes are accessible via sysfs. |
955 | 955 | ||
956 | config SENSORS_EMC2103 | 956 | config SENSORS_EMC2103 |
957 | tristate "SMSC EMC2103" | 957 | tristate "SMSC EMC2103" |
958 | depends on I2C | 958 | depends on I2C |
959 | help | 959 | help |
960 | If you say yes here you get support for the temperature | 960 | If you say yes here you get support for the temperature |
961 | and fan sensors of the SMSC EMC2103 chips. | 961 | and fan sensors of the SMSC EMC2103 chips. |
962 | 962 | ||
963 | This driver can also be built as a module. If so, the module | 963 | This driver can also be built as a module. If so, the module |
964 | will be called emc2103. | 964 | will be called emc2103. |
965 | 965 | ||
966 | config SENSORS_EMC6W201 | 966 | config SENSORS_EMC6W201 |
967 | tristate "SMSC EMC6W201" | 967 | tristate "SMSC EMC6W201" |
968 | depends on I2C | 968 | depends on I2C |
969 | help | 969 | help |
970 | If you say yes here you get support for the SMSC EMC6W201 | 970 | If you say yes here you get support for the SMSC EMC6W201 |
971 | hardware monitoring chip. | 971 | hardware monitoring chip. |
972 | 972 | ||
973 | This driver can also be built as a module. If so, the module | 973 | This driver can also be built as a module. If so, the module |
974 | will be called emc6w201. | 974 | will be called emc6w201. |
975 | 975 | ||
976 | config SENSORS_SMSC47M1 | 976 | config SENSORS_SMSC47M1 |
977 | tristate "SMSC LPC47M10x and compatibles" | 977 | tristate "SMSC LPC47M10x and compatibles" |
978 | depends on !PPC | 978 | depends on !PPC |
979 | help | 979 | help |
980 | If you say yes here you get support for the integrated fan | 980 | If you say yes here you get support for the integrated fan |
981 | monitoring and control capabilities of the SMSC LPC47B27x, | 981 | monitoring and control capabilities of the SMSC LPC47B27x, |
982 | LPC47M10x, LPC47M112, LPC47M13x, LPC47M14x, LPC47M15x, | 982 | LPC47M10x, LPC47M112, LPC47M13x, LPC47M14x, LPC47M15x, |
983 | LPC47M192, LPC47M292 and LPC47M997 chips. | 983 | LPC47M192, LPC47M292 and LPC47M997 chips. |
984 | 984 | ||
985 | The temperature and voltage sensor features of the LPC47M15x, | 985 | The temperature and voltage sensor features of the LPC47M15x, |
986 | LPC47M192, LPC47M292 and LPC47M997 are supported by another | 986 | LPC47M192, LPC47M292 and LPC47M997 are supported by another |
987 | driver, select also "SMSC LPC47M192 and compatibles" below for | 987 | driver, select also "SMSC LPC47M192 and compatibles" below for |
988 | those. | 988 | those. |
989 | 989 | ||
990 | This driver can also be built as a module. If so, the module | 990 | This driver can also be built as a module. If so, the module |
991 | will be called smsc47m1. | 991 | will be called smsc47m1. |
992 | 992 | ||
993 | config SENSORS_SMSC47M192 | 993 | config SENSORS_SMSC47M192 |
994 | tristate "SMSC LPC47M192 and compatibles" | 994 | tristate "SMSC LPC47M192 and compatibles" |
995 | depends on I2C | 995 | depends on I2C |
996 | select HWMON_VID | 996 | select HWMON_VID |
997 | help | 997 | help |
998 | If you say yes here you get support for the temperature and | 998 | If you say yes here you get support for the temperature and |
999 | voltage sensors of the SMSC LPC47M192, LPC47M15x, LPC47M292 | 999 | voltage sensors of the SMSC LPC47M192, LPC47M15x, LPC47M292 |
1000 | and LPC47M997 chips. | 1000 | and LPC47M997 chips. |
1001 | 1001 | ||
1002 | The fan monitoring and control capabilities of these chips | 1002 | The fan monitoring and control capabilities of these chips |
1003 | are supported by another driver, select | 1003 | are supported by another driver, select |
1004 | "SMSC LPC47M10x and compatibles" above. You need both drivers | 1004 | "SMSC LPC47M10x and compatibles" above. You need both drivers |
1005 | if you want fan control and voltage/temperature sensor support. | 1005 | if you want fan control and voltage/temperature sensor support. |
1006 | 1006 | ||
1007 | This driver can also be built as a module. If so, the module | 1007 | This driver can also be built as a module. If so, the module |
1008 | will be called smsc47m192. | 1008 | will be called smsc47m192. |
1009 | 1009 | ||
1010 | config SENSORS_SMSC47B397 | 1010 | config SENSORS_SMSC47B397 |
1011 | tristate "SMSC LPC47B397-NC" | 1011 | tristate "SMSC LPC47B397-NC" |
1012 | depends on EXPERIMENTAL && !PPC | 1012 | depends on EXPERIMENTAL && !PPC |
1013 | help | 1013 | help |
1014 | If you say yes here you get support for the SMSC LPC47B397-NC | 1014 | If you say yes here you get support for the SMSC LPC47B397-NC |
1015 | sensor chip. | 1015 | sensor chip. |
1016 | 1016 | ||
1017 | This driver can also be built as a module. If so, the module | 1017 | This driver can also be built as a module. If so, the module |
1018 | will be called smsc47b397. | 1018 | will be called smsc47b397. |
1019 | 1019 | ||
1020 | config SENSORS_SCH56XX_COMMON | 1020 | config SENSORS_SCH56XX_COMMON |
1021 | tristate | 1021 | tristate |
1022 | default n | 1022 | default n |
1023 | 1023 | ||
1024 | config SENSORS_SCH5627 | 1024 | config SENSORS_SCH5627 |
1025 | tristate "SMSC SCH5627" | 1025 | tristate "SMSC SCH5627" |
1026 | depends on !PPC | 1026 | depends on !PPC |
1027 | select SENSORS_SCH56XX_COMMON | 1027 | select SENSORS_SCH56XX_COMMON |
1028 | help | 1028 | help |
1029 | If you say yes here you get support for the hardware monitoring | 1029 | If you say yes here you get support for the hardware monitoring |
1030 | features of the SMSC SCH5627 Super-I/O chip. | 1030 | features of the SMSC SCH5627 Super-I/O chip. |
1031 | 1031 | ||
1032 | This driver can also be built as a module. If so, the module | 1032 | This driver can also be built as a module. If so, the module |
1033 | will be called sch5627. | 1033 | will be called sch5627. |
1034 | 1034 | ||
1035 | config SENSORS_SCH5636 | 1035 | config SENSORS_SCH5636 |
1036 | tristate "SMSC SCH5636" | 1036 | tristate "SMSC SCH5636" |
1037 | depends on !PPC | 1037 | depends on !PPC |
1038 | select SENSORS_SCH56XX_COMMON | 1038 | select SENSORS_SCH56XX_COMMON |
1039 | help | 1039 | help |
1040 | SMSC SCH5636 Super I/O chips include an embedded microcontroller for | 1040 | SMSC SCH5636 Super I/O chips include an embedded microcontroller for |
1041 | hardware monitoring solutions, allowing motherboard manufacturers to | 1041 | hardware monitoring solutions, allowing motherboard manufacturers to |
1042 | create their own custom hwmon solution based upon the SCH5636. | 1042 | create their own custom hwmon solution based upon the SCH5636. |
1043 | 1043 | ||
1044 | Currently this driver only supports the Fujitsu Theseus SCH5636 based | 1044 | Currently this driver only supports the Fujitsu Theseus SCH5636 based |
1045 | hwmon solution. Say yes here if you want support for the Fujitsu | 1045 | hwmon solution. Say yes here if you want support for the Fujitsu |
1046 | Theseus' hardware monitoring features. | 1046 | Theseus' hardware monitoring features. |
1047 | 1047 | ||
1048 | This driver can also be built as a module. If so, the module | 1048 | This driver can also be built as a module. If so, the module |
1049 | will be called sch5636. | 1049 | will be called sch5636. |
1050 | 1050 | ||
1051 | config SENSORS_ADS1015 | 1051 | config SENSORS_ADS1015 |
1052 | tristate "Texas Instruments ADS1015" | 1052 | tristate "Texas Instruments ADS1015" |
1053 | depends on I2C | 1053 | depends on I2C |
1054 | help | 1054 | help |
1055 | If you say yes here you get support for Texas Instruments ADS1015 | 1055 | If you say yes here you get support for Texas Instruments ADS1015 |
1056 | 12-bit 4-input ADC device. | 1056 | 12-bit 4-input ADC device. |
1057 | 1057 | ||
1058 | This driver can also be built as a module. If so, the module | 1058 | This driver can also be built as a module. If so, the module |
1059 | will be called ads1015. | 1059 | will be called ads1015. |
1060 | 1060 | ||
1061 | config SENSORS_ADS7828 | 1061 | config SENSORS_ADS7828 |
1062 | tristate "Texas Instruments ADS7828" | 1062 | tristate "Texas Instruments ADS7828" |
1063 | depends on I2C | 1063 | depends on I2C |
1064 | help | 1064 | help |
1065 | If you say yes here you get support for Texas Instruments ADS7828 | 1065 | If you say yes here you get support for Texas Instruments ADS7828 |
1066 | 12-bit 8-channel ADC device. | 1066 | 12-bit 8-channel ADC device. |
1067 | 1067 | ||
1068 | This driver can also be built as a module. If so, the module | 1068 | This driver can also be built as a module. If so, the module |
1069 | will be called ads7828. | 1069 | will be called ads7828. |
1070 | 1070 | ||
1071 | config SENSORS_ADS7871 | 1071 | config SENSORS_ADS7871 |
1072 | tristate "Texas Instruments ADS7871 A/D converter" | 1072 | tristate "Texas Instruments ADS7871 A/D converter" |
1073 | depends on SPI | 1073 | depends on SPI |
1074 | help | 1074 | help |
1075 | If you say yes here you get support for TI ADS7871 & ADS7870 | 1075 | If you say yes here you get support for TI ADS7871 & ADS7870 |
1076 | 1076 | ||
1077 | This driver can also be built as a module. If so, the module | 1077 | This driver can also be built as a module. If so, the module |
1078 | will be called ads7871. | 1078 | will be called ads7871. |
1079 | 1079 | ||
1080 | config SENSORS_AMC6821 | 1080 | config SENSORS_AMC6821 |
1081 | tristate "Texas Instruments AMC6821" | 1081 | tristate "Texas Instruments AMC6821" |
1082 | depends on I2C && EXPERIMENTAL | 1082 | depends on I2C && EXPERIMENTAL |
1083 | help | 1083 | help |
1084 | If you say yes here you get support for the Texas Instruments | 1084 | If you say yes here you get support for the Texas Instruments |
1085 | AMC6821 hardware monitoring chips. | 1085 | AMC6821 hardware monitoring chips. |
1086 | 1086 | ||
1087 | This driver can also be build as a module. If so, the module | 1087 | This driver can also be build as a module. If so, the module |
1088 | will be called amc6821. | 1088 | will be called amc6821. |
1089 | 1089 | ||
1090 | config SENSORS_THMC50 | 1090 | config SENSORS_THMC50 |
1091 | tristate "Texas Instruments THMC50 / Analog Devices ADM1022" | 1091 | tristate "Texas Instruments THMC50 / Analog Devices ADM1022" |
1092 | depends on I2C | 1092 | depends on I2C |
1093 | help | 1093 | help |
1094 | If you say yes here you get support for Texas Instruments THMC50 | 1094 | If you say yes here you get support for Texas Instruments THMC50 |
1095 | sensor chips and clones: the Analog Devices ADM1022. | 1095 | sensor chips and clones: the Analog Devices ADM1022. |
1096 | 1096 | ||
1097 | This driver can also be built as a module. If so, the module | 1097 | This driver can also be built as a module. If so, the module |
1098 | will be called thmc50. | 1098 | will be called thmc50. |
1099 | 1099 | ||
1100 | config SENSORS_TMP102 | 1100 | config SENSORS_TMP102 |
1101 | tristate "Texas Instruments TMP102" | 1101 | tristate "Texas Instruments TMP102" |
1102 | depends on I2C && EXPERIMENTAL | 1102 | depends on I2C && EXPERIMENTAL |
1103 | help | 1103 | help |
1104 | If you say yes here you get support for Texas Instruments TMP102 | 1104 | If you say yes here you get support for Texas Instruments TMP102 |
1105 | sensor chips. | 1105 | sensor chips. |
1106 | 1106 | ||
1107 | This driver can also be built as a module. If so, the module | 1107 | This driver can also be built as a module. If so, the module |
1108 | will be called tmp102. | 1108 | will be called tmp102. |
1109 | 1109 | ||
1110 | config SENSORS_TMP401 | 1110 | config SENSORS_TMP401 |
1111 | tristate "Texas Instruments TMP401 and compatibles" | 1111 | tristate "Texas Instruments TMP401 and compatibles" |
1112 | depends on I2C && EXPERIMENTAL | 1112 | depends on I2C && EXPERIMENTAL |
1113 | help | 1113 | help |
1114 | If you say yes here you get support for Texas Instruments TMP401 and | 1114 | If you say yes here you get support for Texas Instruments TMP401 and |
1115 | TMP411 temperature sensor chips. | 1115 | TMP411 temperature sensor chips. |
1116 | 1116 | ||
1117 | This driver can also be built as a module. If so, the module | 1117 | This driver can also be built as a module. If so, the module |
1118 | will be called tmp401. | 1118 | will be called tmp401. |
1119 | 1119 | ||
1120 | config SENSORS_TMP421 | 1120 | config SENSORS_TMP421 |
1121 | tristate "Texas Instruments TMP421 and compatible" | 1121 | tristate "Texas Instruments TMP421 and compatible" |
1122 | depends on I2C && EXPERIMENTAL | 1122 | depends on I2C && EXPERIMENTAL |
1123 | help | 1123 | help |
1124 | If you say yes here you get support for Texas Instruments TMP421, | 1124 | If you say yes here you get support for Texas Instruments TMP421, |
1125 | TMP422 and TMP423 temperature sensor chips. | 1125 | TMP422 and TMP423 temperature sensor chips. |
1126 | 1126 | ||
1127 | This driver can also be built as a module. If so, the module | 1127 | This driver can also be built as a module. If so, the module |
1128 | will be called tmp421. | 1128 | will be called tmp421. |
1129 | 1129 | ||
1130 | config SENSORS_TWL4030_MADC | 1130 | config SENSORS_TWL4030_MADC |
1131 | tristate "Texas Instruments TWL4030 MADC Hwmon" | 1131 | tristate "Texas Instruments TWL4030 MADC Hwmon" |
1132 | depends on TWL4030_MADC | 1132 | depends on TWL4030_MADC |
1133 | help | 1133 | help |
1134 | If you say yes here you get hwmon support for triton | 1134 | If you say yes here you get hwmon support for triton |
1135 | TWL4030-MADC. | 1135 | TWL4030-MADC. |
1136 | 1136 | ||
1137 | This driver can also be built as a module. If so it will be called | 1137 | This driver can also be built as a module. If so it will be called |
1138 | twl4030-madc-hwmon. | 1138 | twl4030-madc-hwmon. |
1139 | 1139 | ||
1140 | config SENSORS_VIA_CPUTEMP | 1140 | config SENSORS_VIA_CPUTEMP |
1141 | tristate "VIA CPU temperature sensor" | 1141 | tristate "VIA CPU temperature sensor" |
1142 | depends on X86 | 1142 | depends on X86 |
1143 | select HWMON_VID | 1143 | select HWMON_VID |
1144 | help | 1144 | help |
1145 | If you say yes here you get support for the temperature | 1145 | If you say yes here you get support for the temperature |
1146 | sensor inside your CPU. Supported are all known variants of | 1146 | sensor inside your CPU. Supported are all known variants of |
1147 | the VIA C7 and Nano. | 1147 | the VIA C7 and Nano. |
1148 | 1148 | ||
1149 | config SENSORS_VIA686A | 1149 | config SENSORS_VIA686A |
1150 | tristate "VIA686A" | 1150 | tristate "VIA686A" |
1151 | depends on PCI | 1151 | depends on PCI |
1152 | help | 1152 | help |
1153 | If you say yes here you get support for the integrated sensors in | 1153 | If you say yes here you get support for the integrated sensors in |
1154 | Via 686A/B South Bridges. | 1154 | Via 686A/B South Bridges. |
1155 | 1155 | ||
1156 | This driver can also be built as a module. If so, the module | 1156 | This driver can also be built as a module. If so, the module |
1157 | will be called via686a. | 1157 | will be called via686a. |
1158 | 1158 | ||
1159 | config SENSORS_VT1211 | 1159 | config SENSORS_VT1211 |
1160 | tristate "VIA VT1211" | 1160 | tristate "VIA VT1211" |
1161 | depends on !PPC | 1161 | depends on !PPC |
1162 | select HWMON_VID | 1162 | select HWMON_VID |
1163 | help | 1163 | help |
1164 | If you say yes here then you get support for hardware monitoring | 1164 | If you say yes here then you get support for hardware monitoring |
1165 | features of the VIA VT1211 Super-I/O chip. | 1165 | features of the VIA VT1211 Super-I/O chip. |
1166 | 1166 | ||
1167 | This driver can also be built as a module. If so, the module | 1167 | This driver can also be built as a module. If so, the module |
1168 | will be called vt1211. | 1168 | will be called vt1211. |
1169 | 1169 | ||
1170 | config SENSORS_VT8231 | 1170 | config SENSORS_VT8231 |
1171 | tristate "VIA VT8231" | 1171 | tristate "VIA VT8231" |
1172 | depends on PCI | 1172 | depends on PCI |
1173 | select HWMON_VID | 1173 | select HWMON_VID |
1174 | help | 1174 | help |
1175 | If you say yes here then you get support for the integrated sensors | 1175 | If you say yes here then you get support for the integrated sensors |
1176 | in the VIA VT8231 device. | 1176 | in the VIA VT8231 device. |
1177 | 1177 | ||
1178 | This driver can also be built as a module. If so, the module | 1178 | This driver can also be built as a module. If so, the module |
1179 | will be called vt8231. | 1179 | will be called vt8231. |
1180 | 1180 | ||
1181 | config SENSORS_W83781D | 1181 | config SENSORS_W83781D |
1182 | tristate "Winbond W83781D, W83782D, W83783S, Asus AS99127F" | 1182 | tristate "Winbond W83781D, W83782D, W83783S, Asus AS99127F" |
1183 | depends on I2C | 1183 | depends on I2C |
1184 | select HWMON_VID | 1184 | select HWMON_VID |
1185 | help | 1185 | help |
1186 | If you say yes here you get support for the Winbond W8378x series | 1186 | If you say yes here you get support for the Winbond W8378x series |
1187 | of sensor chips: the W83781D, W83782D and W83783S, and the similar | 1187 | of sensor chips: the W83781D, W83782D and W83783S, and the similar |
1188 | Asus AS99127F. | 1188 | Asus AS99127F. |
1189 | 1189 | ||
1190 | This driver can also be built as a module. If so, the module | 1190 | This driver can also be built as a module. If so, the module |
1191 | will be called w83781d. | 1191 | will be called w83781d. |
1192 | 1192 | ||
1193 | config SENSORS_W83791D | 1193 | config SENSORS_W83791D |
1194 | tristate "Winbond W83791D" | 1194 | tristate "Winbond W83791D" |
1195 | depends on I2C | 1195 | depends on I2C |
1196 | select HWMON_VID | 1196 | select HWMON_VID |
1197 | help | 1197 | help |
1198 | If you say yes here you get support for the Winbond W83791D chip. | 1198 | If you say yes here you get support for the Winbond W83791D chip. |
1199 | 1199 | ||
1200 | This driver can also be built as a module. If so, the module | 1200 | This driver can also be built as a module. If so, the module |
1201 | will be called w83791d. | 1201 | will be called w83791d. |
1202 | 1202 | ||
1203 | config SENSORS_W83792D | 1203 | config SENSORS_W83792D |
1204 | tristate "Winbond W83792D" | 1204 | tristate "Winbond W83792D" |
1205 | depends on I2C | 1205 | depends on I2C |
1206 | help | 1206 | help |
1207 | If you say yes here you get support for the Winbond W83792D chip. | 1207 | If you say yes here you get support for the Winbond W83792D chip. |
1208 | 1208 | ||
1209 | This driver can also be built as a module. If so, the module | 1209 | This driver can also be built as a module. If so, the module |
1210 | will be called w83792d. | 1210 | will be called w83792d. |
1211 | 1211 | ||
1212 | config SENSORS_W83793 | 1212 | config SENSORS_W83793 |
1213 | tristate "Winbond W83793" | 1213 | tristate "Winbond W83793" |
1214 | depends on I2C && EXPERIMENTAL | 1214 | depends on I2C && EXPERIMENTAL |
1215 | select HWMON_VID | 1215 | select HWMON_VID |
1216 | help | 1216 | help |
1217 | If you say yes here you get support for the Winbond W83793 | 1217 | If you say yes here you get support for the Winbond W83793 |
1218 | hardware monitoring chip, including support for the integrated | 1218 | hardware monitoring chip, including support for the integrated |
1219 | watchdog. | 1219 | watchdog. |
1220 | 1220 | ||
1221 | This driver can also be built as a module. If so, the module | 1221 | This driver can also be built as a module. If so, the module |
1222 | will be called w83793. | 1222 | will be called w83793. |
1223 | 1223 | ||
1224 | config SENSORS_W83795 | 1224 | config SENSORS_W83795 |
1225 | tristate "Winbond/Nuvoton W83795G/ADG" | 1225 | tristate "Winbond/Nuvoton W83795G/ADG" |
1226 | depends on I2C && EXPERIMENTAL | 1226 | depends on I2C && EXPERIMENTAL |
1227 | help | 1227 | help |
1228 | If you say yes here you get support for the Winbond W83795G and | 1228 | If you say yes here you get support for the Winbond W83795G and |
1229 | W83795ADG hardware monitoring chip. | 1229 | W83795ADG hardware monitoring chip. |
1230 | 1230 | ||
1231 | This driver can also be built as a module. If so, the module | 1231 | This driver can also be built as a module. If so, the module |
1232 | will be called w83795. | 1232 | will be called w83795. |
1233 | 1233 | ||
1234 | config SENSORS_W83795_FANCTRL | 1234 | config SENSORS_W83795_FANCTRL |
1235 | boolean "Include fan control support (DANGEROUS)" | 1235 | boolean "Include fan control support (DANGEROUS)" |
1236 | depends on SENSORS_W83795 && EXPERIMENTAL | 1236 | depends on SENSORS_W83795 && EXPERIMENTAL |
1237 | default n | 1237 | default n |
1238 | help | 1238 | help |
1239 | If you say yes here, support for the both manual and automatic | 1239 | If you say yes here, support for the both manual and automatic |
1240 | fan control features will be included in the driver. | 1240 | fan control features will be included in the driver. |
1241 | 1241 | ||
1242 | This part of the code wasn't carefully reviewed and tested yet, | 1242 | This part of the code wasn't carefully reviewed and tested yet, |
1243 | so enabling this option is strongly discouraged on production | 1243 | so enabling this option is strongly discouraged on production |
1244 | servers. Only developers and testers should enable it for the | 1244 | servers. Only developers and testers should enable it for the |
1245 | time being. | 1245 | time being. |
1246 | 1246 | ||
1247 | Please also note that this option will create sysfs attribute | 1247 | Please also note that this option will create sysfs attribute |
1248 | files which may change in the future, so you shouldn't rely | 1248 | files which may change in the future, so you shouldn't rely |
1249 | on them being stable. | 1249 | on them being stable. |
1250 | 1250 | ||
1251 | config SENSORS_W83L785TS | 1251 | config SENSORS_W83L785TS |
1252 | tristate "Winbond W83L785TS-S" | 1252 | tristate "Winbond W83L785TS-S" |
1253 | depends on I2C && EXPERIMENTAL | 1253 | depends on I2C && EXPERIMENTAL |
1254 | help | 1254 | help |
1255 | If you say yes here you get support for the Winbond W83L785TS-S | 1255 | If you say yes here you get support for the Winbond W83L785TS-S |
1256 | sensor chip, which is used on the Asus A7N8X, among other | 1256 | sensor chip, which is used on the Asus A7N8X, among other |
1257 | motherboards. | 1257 | motherboards. |
1258 | 1258 | ||
1259 | This driver can also be built as a module. If so, the module | 1259 | This driver can also be built as a module. If so, the module |
1260 | will be called w83l785ts. | 1260 | will be called w83l785ts. |
1261 | 1261 | ||
1262 | config SENSORS_W83L786NG | 1262 | config SENSORS_W83L786NG |
1263 | tristate "Winbond W83L786NG, W83L786NR" | 1263 | tristate "Winbond W83L786NG, W83L786NR" |
1264 | depends on I2C && EXPERIMENTAL | 1264 | depends on I2C && EXPERIMENTAL |
1265 | help | 1265 | help |
1266 | If you say yes here you get support for the Winbond W83L786NG | 1266 | If you say yes here you get support for the Winbond W83L786NG |
1267 | and W83L786NR sensor chips. | 1267 | and W83L786NR sensor chips. |
1268 | 1268 | ||
1269 | This driver can also be built as a module. If so, the module | 1269 | This driver can also be built as a module. If so, the module |
1270 | will be called w83l786ng. | 1270 | will be called w83l786ng. |
1271 | 1271 | ||
1272 | config SENSORS_W83627HF | 1272 | config SENSORS_W83627HF |
1273 | tristate "Winbond W83627HF, W83627THF, W83637HF, W83687THF, W83697HF" | 1273 | tristate "Winbond W83627HF, W83627THF, W83637HF, W83687THF, W83697HF" |
1274 | depends on !PPC | 1274 | depends on !PPC |
1275 | select HWMON_VID | 1275 | select HWMON_VID |
1276 | help | 1276 | help |
1277 | If you say yes here you get support for the Winbond W836X7 series | 1277 | If you say yes here you get support for the Winbond W836X7 series |
1278 | of sensor chips: the W83627HF, W83627THF, W83637HF, W83687THF and | 1278 | of sensor chips: the W83627HF, W83627THF, W83637HF, W83687THF and |
1279 | W83697HF. | 1279 | W83697HF. |
1280 | 1280 | ||
1281 | This driver can also be built as a module. If so, the module | 1281 | This driver can also be built as a module. If so, the module |
1282 | will be called w83627hf. | 1282 | will be called w83627hf. |
1283 | 1283 | ||
1284 | config SENSORS_W83627EHF | 1284 | config SENSORS_W83627EHF |
1285 | tristate "Winbond W83627EHF/EHG/DHG/UHG, W83667HG, NCT6775F, NCT6776F" | 1285 | tristate "Winbond W83627EHF/EHG/DHG/UHG, W83667HG, NCT6775F, NCT6776F" |
1286 | depends on !PPC | 1286 | depends on !PPC |
1287 | select HWMON_VID | 1287 | select HWMON_VID |
1288 | help | 1288 | help |
1289 | If you say yes here you get support for the hardware | 1289 | If you say yes here you get support for the hardware |
1290 | monitoring functionality of the Winbond W83627EHF Super-I/O chip. | 1290 | monitoring functionality of the Winbond W83627EHF Super-I/O chip. |
1291 | 1291 | ||
1292 | This driver also supports the W83627EHG, which is the lead-free | 1292 | This driver also supports the W83627EHG, which is the lead-free |
1293 | version of the W83627EHF, and the W83627DHG, which is a similar | 1293 | version of the W83627EHF, and the W83627DHG, which is a similar |
1294 | chip suited for specific Intel processors that use PECI such as | 1294 | chip suited for specific Intel processors that use PECI such as |
1295 | the Core 2 Duo. And also the W83627UHG, which is a stripped down | 1295 | the Core 2 Duo. And also the W83627UHG, which is a stripped down |
1296 | version of the W83627DHG (as far as hardware monitoring goes.) | 1296 | version of the W83627DHG (as far as hardware monitoring goes.) |
1297 | 1297 | ||
1298 | This driver also supports Nuvoton W83667HG, W83667HG-B, NCT6775F | 1298 | This driver also supports Nuvoton W83667HG, W83667HG-B, NCT6775F |
1299 | (also known as W83667HG-I), and NCT6776F. | 1299 | (also known as W83667HG-I), and NCT6776F. |
1300 | 1300 | ||
1301 | This driver can also be built as a module. If so, the module | 1301 | This driver can also be built as a module. If so, the module |
1302 | will be called w83627ehf. | 1302 | will be called w83627ehf. |
1303 | 1303 | ||
1304 | config SENSORS_WM831X | 1304 | config SENSORS_WM831X |
1305 | tristate "WM831x PMICs" | 1305 | tristate "WM831x PMICs" |
1306 | depends on MFD_WM831X | 1306 | depends on MFD_WM831X |
1307 | help | 1307 | help |
1308 | If you say yes here you get support for the hardware | 1308 | If you say yes here you get support for the hardware |
1309 | monitoring functionality of the Wolfson Microelectronics | 1309 | monitoring functionality of the Wolfson Microelectronics |
1310 | WM831x series of PMICs. | 1310 | WM831x series of PMICs. |
1311 | 1311 | ||
1312 | This driver can also be built as a module. If so, the module | 1312 | This driver can also be built as a module. If so, the module |
1313 | will be called wm831x-hwmon. | 1313 | will be called wm831x-hwmon. |
1314 | 1314 | ||
1315 | config SENSORS_WM8350 | 1315 | config SENSORS_WM8350 |
1316 | tristate "Wolfson Microelectronics WM835x" | 1316 | tristate "Wolfson Microelectronics WM835x" |
1317 | depends on MFD_WM8350 | 1317 | depends on MFD_WM8350 |
1318 | help | 1318 | help |
1319 | If you say yes here you get support for the hardware | 1319 | If you say yes here you get support for the hardware |
1320 | monitoring features of the WM835x series of PMICs. | 1320 | monitoring features of the WM835x series of PMICs. |
1321 | 1321 | ||
1322 | This driver can also be built as a module. If so, the module | 1322 | This driver can also be built as a module. If so, the module |
1323 | will be called wm8350-hwmon. | 1323 | will be called wm8350-hwmon. |
1324 | 1324 | ||
1325 | config SENSORS_ULTRA45 | 1325 | config SENSORS_ULTRA45 |
1326 | tristate "Sun Ultra45 PIC16F747" | 1326 | tristate "Sun Ultra45 PIC16F747" |
1327 | depends on SPARC64 | 1327 | depends on SPARC64 |
1328 | help | 1328 | help |
1329 | This driver provides support for the Ultra45 workstation environmental | 1329 | This driver provides support for the Ultra45 workstation environmental |
1330 | sensors. | 1330 | sensors. |
1331 | 1331 | ||
1332 | config SENSORS_APPLESMC | 1332 | config SENSORS_APPLESMC |
1333 | tristate "Apple SMC (Motion sensor, light sensor, keyboard backlight)" | 1333 | tristate "Apple SMC (Motion sensor, light sensor, keyboard backlight)" |
1334 | depends on INPUT && X86 | 1334 | depends on INPUT && X86 |
1335 | select NEW_LEDS | 1335 | select NEW_LEDS |
1336 | select LEDS_CLASS | 1336 | select LEDS_CLASS |
1337 | select INPUT_POLLDEV | 1337 | select INPUT_POLLDEV |
1338 | default n | 1338 | default n |
1339 | help | 1339 | help |
1340 | This driver provides support for the Apple System Management | 1340 | This driver provides support for the Apple System Management |
1341 | Controller, which provides an accelerometer (Apple Sudden Motion | 1341 | Controller, which provides an accelerometer (Apple Sudden Motion |
1342 | Sensor), light sensors, temperature sensors, keyboard backlight | 1342 | Sensor), light sensors, temperature sensors, keyboard backlight |
1343 | control and fan control. | 1343 | control and fan control. |
1344 | 1344 | ||
1345 | Only Intel-based Apple's computers are supported (MacBook Pro, | 1345 | Only Intel-based Apple's computers are supported (MacBook Pro, |
1346 | MacBook, MacMini). | 1346 | MacBook, MacMini). |
1347 | 1347 | ||
1348 | Data from the different sensors, keyboard backlight control and fan | 1348 | Data from the different sensors, keyboard backlight control and fan |
1349 | control are accessible via sysfs. | 1349 | control are accessible via sysfs. |
1350 | 1350 | ||
1351 | This driver also provides an absolute input class device, allowing | 1351 | This driver also provides an absolute input class device, allowing |
1352 | the laptop to act as a pinball machine-esque joystick. | 1352 | the laptop to act as a pinball machine-esque joystick. |
1353 | 1353 | ||
1354 | Say Y here if you have an applicable laptop and want to experience | 1354 | Say Y here if you have an applicable laptop and want to experience |
1355 | the awesome power of applesmc. | 1355 | the awesome power of applesmc. |
1356 | 1356 | ||
1357 | config SENSORS_MC13783_ADC | 1357 | config SENSORS_MC13783_ADC |
1358 | tristate "Freescale MC13783 ADC" | 1358 | tristate "Freescale MC13783 ADC" |
1359 | depends on MFD_MC13783 | 1359 | depends on MFD_MC13783 |
1360 | help | 1360 | help |
1361 | Support for the A/D converter on MC13783 PMIC. | 1361 | Support for the A/D converter on MC13783 PMIC. |
1362 | 1362 | ||
1363 | if ACPI | 1363 | if ACPI |
1364 | 1364 | ||
1365 | comment "ACPI drivers" | 1365 | comment "ACPI drivers" |
1366 | 1366 | ||
1367 | config SENSORS_ACPI_POWER | 1367 | config SENSORS_ACPI_POWER |
1368 | tristate "ACPI 4.0 power meter" | 1368 | tristate "ACPI 4.0 power meter" |
1369 | help | 1369 | help |
1370 | This driver exposes ACPI 4.0 power meters as hardware monitoring | 1370 | This driver exposes ACPI 4.0 power meters as hardware monitoring |
1371 | devices. Say Y (or M) if you have a computer with ACPI 4.0 firmware | 1371 | devices. Say Y (or M) if you have a computer with ACPI 4.0 firmware |
1372 | and a power meter. | 1372 | and a power meter. |
1373 | 1373 | ||
1374 | To compile this driver as a module, choose M here: | 1374 | To compile this driver as a module, choose M here: |
1375 | the module will be called acpi_power_meter. | 1375 | the module will be called acpi_power_meter. |
1376 | 1376 | ||
1377 | config SENSORS_ATK0110 | 1377 | config SENSORS_ATK0110 |
1378 | tristate "ASUS ATK0110" | 1378 | tristate "ASUS ATK0110" |
1379 | depends on X86 && EXPERIMENTAL | 1379 | depends on X86 && EXPERIMENTAL |
1380 | help | 1380 | help |
1381 | If you say yes here you get support for the ACPI hardware | 1381 | If you say yes here you get support for the ACPI hardware |
1382 | monitoring interface found in many ASUS motherboards. This | 1382 | monitoring interface found in many ASUS motherboards. This |
1383 | driver will provide readings of fans, voltages and temperatures | 1383 | driver will provide readings of fans, voltages and temperatures |
1384 | through the system firmware. | 1384 | through the system firmware. |
1385 | 1385 | ||
1386 | This driver can also be built as a module. If so, the module | 1386 | This driver can also be built as a module. If so, the module |
1387 | will be called asus_atk0110. | 1387 | will be called asus_atk0110. |
1388 | 1388 | ||
1389 | endif # ACPI | 1389 | endif # ACPI |
1390 | 1390 | ||
1391 | endif # HWMON | 1391 | endif # HWMON |
1392 | 1392 |
drivers/hwmon/it87.c
1 | /* | 1 | /* |
2 | * it87.c - Part of lm_sensors, Linux kernel modules for hardware | 2 | * it87.c - Part of lm_sensors, Linux kernel modules for hardware |
3 | * monitoring. | 3 | * monitoring. |
4 | * | 4 | * |
5 | * The IT8705F is an LPC-based Super I/O part that contains UARTs, a | 5 | * The IT8705F is an LPC-based Super I/O part that contains UARTs, a |
6 | * parallel port, an IR port, a MIDI port, a floppy controller, etc., in | 6 | * parallel port, an IR port, a MIDI port, a floppy controller, etc., in |
7 | * addition to an Environment Controller (Enhanced Hardware Monitor and | 7 | * addition to an Environment Controller (Enhanced Hardware Monitor and |
8 | * Fan Controller) | 8 | * Fan Controller) |
9 | * | 9 | * |
10 | * This driver supports only the Environment Controller in the IT8705F and | 10 | * This driver supports only the Environment Controller in the IT8705F and |
11 | * similar parts. The other devices are supported by different drivers. | 11 | * similar parts. The other devices are supported by different drivers. |
12 | * | 12 | * |
13 | * Supports: IT8705F Super I/O chip w/LPC interface | 13 | * Supports: IT8705F Super I/O chip w/LPC interface |
14 | * IT8712F Super I/O chip w/LPC interface | 14 | * IT8712F Super I/O chip w/LPC interface |
15 | * IT8716F Super I/O chip w/LPC interface | 15 | * IT8716F Super I/O chip w/LPC interface |
16 | * IT8718F Super I/O chip w/LPC interface | 16 | * IT8718F Super I/O chip w/LPC interface |
17 | * IT8720F Super I/O chip w/LPC interface | 17 | * IT8720F Super I/O chip w/LPC interface |
18 | * IT8721F Super I/O chip w/LPC interface | 18 | * IT8721F Super I/O chip w/LPC interface |
19 | * IT8726F Super I/O chip w/LPC interface | 19 | * IT8726F Super I/O chip w/LPC interface |
20 | * IT8728F Super I/O chip w/LPC interface | ||
20 | * IT8758E Super I/O chip w/LPC interface | 21 | * IT8758E Super I/O chip w/LPC interface |
21 | * Sis950 A clone of the IT8705F | 22 | * Sis950 A clone of the IT8705F |
22 | * | 23 | * |
23 | * Copyright (C) 2001 Chris Gauthron | 24 | * Copyright (C) 2001 Chris Gauthron |
24 | * Copyright (C) 2005-2010 Jean Delvare <khali@linux-fr.org> | 25 | * Copyright (C) 2005-2010 Jean Delvare <khali@linux-fr.org> |
25 | * | 26 | * |
26 | * This program is free software; you can redistribute it and/or modify | 27 | * This program is free software; you can redistribute it and/or modify |
27 | * it under the terms of the GNU General Public License as published by | 28 | * it under the terms of the GNU General Public License as published by |
28 | * the Free Software Foundation; either version 2 of the License, or | 29 | * the Free Software Foundation; either version 2 of the License, or |
29 | * (at your option) any later version. | 30 | * (at your option) any later version. |
30 | * | 31 | * |
31 | * This program is distributed in the hope that it will be useful, | 32 | * This program is distributed in the hope that it will be useful, |
32 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 33 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
33 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 34 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
34 | * GNU General Public License for more details. | 35 | * GNU General Public License for more details. |
35 | * | 36 | * |
36 | * You should have received a copy of the GNU General Public License | 37 | * You should have received a copy of the GNU General Public License |
37 | * along with this program; if not, write to the Free Software | 38 | * along with this program; if not, write to the Free Software |
38 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 39 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
39 | */ | 40 | */ |
40 | 41 | ||
41 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | 42 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
42 | 43 | ||
43 | #include <linux/module.h> | 44 | #include <linux/module.h> |
44 | #include <linux/init.h> | 45 | #include <linux/init.h> |
45 | #include <linux/slab.h> | 46 | #include <linux/slab.h> |
46 | #include <linux/jiffies.h> | 47 | #include <linux/jiffies.h> |
47 | #include <linux/platform_device.h> | 48 | #include <linux/platform_device.h> |
48 | #include <linux/hwmon.h> | 49 | #include <linux/hwmon.h> |
49 | #include <linux/hwmon-sysfs.h> | 50 | #include <linux/hwmon-sysfs.h> |
50 | #include <linux/hwmon-vid.h> | 51 | #include <linux/hwmon-vid.h> |
51 | #include <linux/err.h> | 52 | #include <linux/err.h> |
52 | #include <linux/mutex.h> | 53 | #include <linux/mutex.h> |
53 | #include <linux/sysfs.h> | 54 | #include <linux/sysfs.h> |
54 | #include <linux/string.h> | 55 | #include <linux/string.h> |
55 | #include <linux/dmi.h> | 56 | #include <linux/dmi.h> |
56 | #include <linux/acpi.h> | 57 | #include <linux/acpi.h> |
57 | #include <linux/io.h> | 58 | #include <linux/io.h> |
58 | 59 | ||
59 | #define DRVNAME "it87" | 60 | #define DRVNAME "it87" |
60 | 61 | ||
61 | enum chips { it87, it8712, it8716, it8718, it8720, it8721 }; | 62 | enum chips { it87, it8712, it8716, it8718, it8720, it8721, it8728 }; |
62 | 63 | ||
63 | static unsigned short force_id; | 64 | static unsigned short force_id; |
64 | module_param(force_id, ushort, 0); | 65 | module_param(force_id, ushort, 0); |
65 | MODULE_PARM_DESC(force_id, "Override the detected device ID"); | 66 | MODULE_PARM_DESC(force_id, "Override the detected device ID"); |
66 | 67 | ||
67 | static struct platform_device *pdev; | 68 | static struct platform_device *pdev; |
68 | 69 | ||
69 | #define REG 0x2e /* The register to read/write */ | 70 | #define REG 0x2e /* The register to read/write */ |
70 | #define DEV 0x07 /* Register: Logical device select */ | 71 | #define DEV 0x07 /* Register: Logical device select */ |
71 | #define VAL 0x2f /* The value to read/write */ | 72 | #define VAL 0x2f /* The value to read/write */ |
72 | #define PME 0x04 /* The device with the fan registers in it */ | 73 | #define PME 0x04 /* The device with the fan registers in it */ |
73 | 74 | ||
74 | /* The device with the IT8718F/IT8720F VID value in it */ | 75 | /* The device with the IT8718F/IT8720F VID value in it */ |
75 | #define GPIO 0x07 | 76 | #define GPIO 0x07 |
76 | 77 | ||
77 | #define DEVID 0x20 /* Register: Device ID */ | 78 | #define DEVID 0x20 /* Register: Device ID */ |
78 | #define DEVREV 0x22 /* Register: Device Revision */ | 79 | #define DEVREV 0x22 /* Register: Device Revision */ |
79 | 80 | ||
80 | static inline int superio_inb(int reg) | 81 | static inline int superio_inb(int reg) |
81 | { | 82 | { |
82 | outb(reg, REG); | 83 | outb(reg, REG); |
83 | return inb(VAL); | 84 | return inb(VAL); |
84 | } | 85 | } |
85 | 86 | ||
86 | static inline void superio_outb(int reg, int val) | 87 | static inline void superio_outb(int reg, int val) |
87 | { | 88 | { |
88 | outb(reg, REG); | 89 | outb(reg, REG); |
89 | outb(val, VAL); | 90 | outb(val, VAL); |
90 | } | 91 | } |
91 | 92 | ||
92 | static int superio_inw(int reg) | 93 | static int superio_inw(int reg) |
93 | { | 94 | { |
94 | int val; | 95 | int val; |
95 | outb(reg++, REG); | 96 | outb(reg++, REG); |
96 | val = inb(VAL) << 8; | 97 | val = inb(VAL) << 8; |
97 | outb(reg, REG); | 98 | outb(reg, REG); |
98 | val |= inb(VAL); | 99 | val |= inb(VAL); |
99 | return val; | 100 | return val; |
100 | } | 101 | } |
101 | 102 | ||
102 | static inline void superio_select(int ldn) | 103 | static inline void superio_select(int ldn) |
103 | { | 104 | { |
104 | outb(DEV, REG); | 105 | outb(DEV, REG); |
105 | outb(ldn, VAL); | 106 | outb(ldn, VAL); |
106 | } | 107 | } |
107 | 108 | ||
108 | static inline int superio_enter(void) | 109 | static inline int superio_enter(void) |
109 | { | 110 | { |
110 | /* | 111 | /* |
111 | * Try to reserve REG and REG + 1 for exclusive access. | 112 | * Try to reserve REG and REG + 1 for exclusive access. |
112 | */ | 113 | */ |
113 | if (!request_muxed_region(REG, 2, DRVNAME)) | 114 | if (!request_muxed_region(REG, 2, DRVNAME)) |
114 | return -EBUSY; | 115 | return -EBUSY; |
115 | 116 | ||
116 | outb(0x87, REG); | 117 | outb(0x87, REG); |
117 | outb(0x01, REG); | 118 | outb(0x01, REG); |
118 | outb(0x55, REG); | 119 | outb(0x55, REG); |
119 | outb(0x55, REG); | 120 | outb(0x55, REG); |
120 | return 0; | 121 | return 0; |
121 | } | 122 | } |
122 | 123 | ||
123 | static inline void superio_exit(void) | 124 | static inline void superio_exit(void) |
124 | { | 125 | { |
125 | outb(0x02, REG); | 126 | outb(0x02, REG); |
126 | outb(0x02, VAL); | 127 | outb(0x02, VAL); |
127 | release_region(REG, 2); | 128 | release_region(REG, 2); |
128 | } | 129 | } |
129 | 130 | ||
130 | /* Logical device 4 registers */ | 131 | /* Logical device 4 registers */ |
131 | #define IT8712F_DEVID 0x8712 | 132 | #define IT8712F_DEVID 0x8712 |
132 | #define IT8705F_DEVID 0x8705 | 133 | #define IT8705F_DEVID 0x8705 |
133 | #define IT8716F_DEVID 0x8716 | 134 | #define IT8716F_DEVID 0x8716 |
134 | #define IT8718F_DEVID 0x8718 | 135 | #define IT8718F_DEVID 0x8718 |
135 | #define IT8720F_DEVID 0x8720 | 136 | #define IT8720F_DEVID 0x8720 |
136 | #define IT8721F_DEVID 0x8721 | 137 | #define IT8721F_DEVID 0x8721 |
137 | #define IT8726F_DEVID 0x8726 | 138 | #define IT8726F_DEVID 0x8726 |
139 | #define IT8728F_DEVID 0x8728 | ||
138 | #define IT87_ACT_REG 0x30 | 140 | #define IT87_ACT_REG 0x30 |
139 | #define IT87_BASE_REG 0x60 | 141 | #define IT87_BASE_REG 0x60 |
140 | 142 | ||
141 | /* Logical device 7 registers (IT8712F and later) */ | 143 | /* Logical device 7 registers (IT8712F and later) */ |
142 | #define IT87_SIO_GPIO3_REG 0x27 | 144 | #define IT87_SIO_GPIO3_REG 0x27 |
143 | #define IT87_SIO_GPIO5_REG 0x29 | 145 | #define IT87_SIO_GPIO5_REG 0x29 |
144 | #define IT87_SIO_PINX2_REG 0x2c /* Pin selection */ | 146 | #define IT87_SIO_PINX2_REG 0x2c /* Pin selection */ |
145 | #define IT87_SIO_VID_REG 0xfc /* VID value */ | 147 | #define IT87_SIO_VID_REG 0xfc /* VID value */ |
146 | #define IT87_SIO_BEEP_PIN_REG 0xf6 /* Beep pin mapping */ | 148 | #define IT87_SIO_BEEP_PIN_REG 0xf6 /* Beep pin mapping */ |
147 | 149 | ||
148 | /* Update battery voltage after every reading if true */ | 150 | /* Update battery voltage after every reading if true */ |
149 | static bool update_vbat; | 151 | static bool update_vbat; |
150 | 152 | ||
151 | /* Not all BIOSes properly configure the PWM registers */ | 153 | /* Not all BIOSes properly configure the PWM registers */ |
152 | static bool fix_pwm_polarity; | 154 | static bool fix_pwm_polarity; |
153 | 155 | ||
154 | /* Many IT87 constants specified below */ | 156 | /* Many IT87 constants specified below */ |
155 | 157 | ||
156 | /* Length of ISA address segment */ | 158 | /* Length of ISA address segment */ |
157 | #define IT87_EXTENT 8 | 159 | #define IT87_EXTENT 8 |
158 | 160 | ||
159 | /* Length of ISA address segment for Environmental Controller */ | 161 | /* Length of ISA address segment for Environmental Controller */ |
160 | #define IT87_EC_EXTENT 2 | 162 | #define IT87_EC_EXTENT 2 |
161 | 163 | ||
162 | /* Offset of EC registers from ISA base address */ | 164 | /* Offset of EC registers from ISA base address */ |
163 | #define IT87_EC_OFFSET 5 | 165 | #define IT87_EC_OFFSET 5 |
164 | 166 | ||
165 | /* Where are the ISA address/data registers relative to the EC base address */ | 167 | /* Where are the ISA address/data registers relative to the EC base address */ |
166 | #define IT87_ADDR_REG_OFFSET 0 | 168 | #define IT87_ADDR_REG_OFFSET 0 |
167 | #define IT87_DATA_REG_OFFSET 1 | 169 | #define IT87_DATA_REG_OFFSET 1 |
168 | 170 | ||
169 | /*----- The IT87 registers -----*/ | 171 | /*----- The IT87 registers -----*/ |
170 | 172 | ||
171 | #define IT87_REG_CONFIG 0x00 | 173 | #define IT87_REG_CONFIG 0x00 |
172 | 174 | ||
173 | #define IT87_REG_ALARM1 0x01 | 175 | #define IT87_REG_ALARM1 0x01 |
174 | #define IT87_REG_ALARM2 0x02 | 176 | #define IT87_REG_ALARM2 0x02 |
175 | #define IT87_REG_ALARM3 0x03 | 177 | #define IT87_REG_ALARM3 0x03 |
176 | 178 | ||
177 | /* The IT8718F and IT8720F have the VID value in a different register, in | 179 | /* The IT8718F and IT8720F have the VID value in a different register, in |
178 | Super-I/O configuration space. */ | 180 | Super-I/O configuration space. */ |
179 | #define IT87_REG_VID 0x0a | 181 | #define IT87_REG_VID 0x0a |
180 | /* The IT8705F and IT8712F earlier than revision 0x08 use register 0x0b | 182 | /* The IT8705F and IT8712F earlier than revision 0x08 use register 0x0b |
181 | for fan divisors. Later IT8712F revisions must use 16-bit tachometer | 183 | for fan divisors. Later IT8712F revisions must use 16-bit tachometer |
182 | mode. */ | 184 | mode. */ |
183 | #define IT87_REG_FAN_DIV 0x0b | 185 | #define IT87_REG_FAN_DIV 0x0b |
184 | #define IT87_REG_FAN_16BIT 0x0c | 186 | #define IT87_REG_FAN_16BIT 0x0c |
185 | 187 | ||
186 | /* Monitors: 9 voltage (0 to 7, battery), 3 temp (1 to 3), 3 fan (1 to 3) */ | 188 | /* Monitors: 9 voltage (0 to 7, battery), 3 temp (1 to 3), 3 fan (1 to 3) */ |
187 | 189 | ||
188 | static const u8 IT87_REG_FAN[] = { 0x0d, 0x0e, 0x0f, 0x80, 0x82 }; | 190 | static const u8 IT87_REG_FAN[] = { 0x0d, 0x0e, 0x0f, 0x80, 0x82 }; |
189 | static const u8 IT87_REG_FAN_MIN[] = { 0x10, 0x11, 0x12, 0x84, 0x86 }; | 191 | static const u8 IT87_REG_FAN_MIN[] = { 0x10, 0x11, 0x12, 0x84, 0x86 }; |
190 | static const u8 IT87_REG_FANX[] = { 0x18, 0x19, 0x1a, 0x81, 0x83 }; | 192 | static const u8 IT87_REG_FANX[] = { 0x18, 0x19, 0x1a, 0x81, 0x83 }; |
191 | static const u8 IT87_REG_FANX_MIN[] = { 0x1b, 0x1c, 0x1d, 0x85, 0x87 }; | 193 | static const u8 IT87_REG_FANX_MIN[] = { 0x1b, 0x1c, 0x1d, 0x85, 0x87 }; |
192 | #define IT87_REG_FAN_MAIN_CTRL 0x13 | 194 | #define IT87_REG_FAN_MAIN_CTRL 0x13 |
193 | #define IT87_REG_FAN_CTL 0x14 | 195 | #define IT87_REG_FAN_CTL 0x14 |
194 | #define IT87_REG_PWM(nr) (0x15 + (nr)) | 196 | #define IT87_REG_PWM(nr) (0x15 + (nr)) |
195 | #define IT87_REG_PWM_DUTY(nr) (0x63 + (nr) * 8) | 197 | #define IT87_REG_PWM_DUTY(nr) (0x63 + (nr) * 8) |
196 | 198 | ||
197 | #define IT87_REG_VIN(nr) (0x20 + (nr)) | 199 | #define IT87_REG_VIN(nr) (0x20 + (nr)) |
198 | #define IT87_REG_TEMP(nr) (0x29 + (nr)) | 200 | #define IT87_REG_TEMP(nr) (0x29 + (nr)) |
199 | 201 | ||
200 | #define IT87_REG_VIN_MAX(nr) (0x30 + (nr) * 2) | 202 | #define IT87_REG_VIN_MAX(nr) (0x30 + (nr) * 2) |
201 | #define IT87_REG_VIN_MIN(nr) (0x31 + (nr) * 2) | 203 | #define IT87_REG_VIN_MIN(nr) (0x31 + (nr) * 2) |
202 | #define IT87_REG_TEMP_HIGH(nr) (0x40 + (nr) * 2) | 204 | #define IT87_REG_TEMP_HIGH(nr) (0x40 + (nr) * 2) |
203 | #define IT87_REG_TEMP_LOW(nr) (0x41 + (nr) * 2) | 205 | #define IT87_REG_TEMP_LOW(nr) (0x41 + (nr) * 2) |
204 | 206 | ||
205 | #define IT87_REG_VIN_ENABLE 0x50 | 207 | #define IT87_REG_VIN_ENABLE 0x50 |
206 | #define IT87_REG_TEMP_ENABLE 0x51 | 208 | #define IT87_REG_TEMP_ENABLE 0x51 |
207 | #define IT87_REG_BEEP_ENABLE 0x5c | 209 | #define IT87_REG_BEEP_ENABLE 0x5c |
208 | 210 | ||
209 | #define IT87_REG_CHIPID 0x58 | 211 | #define IT87_REG_CHIPID 0x58 |
210 | 212 | ||
211 | #define IT87_REG_AUTO_TEMP(nr, i) (0x60 + (nr) * 8 + (i)) | 213 | #define IT87_REG_AUTO_TEMP(nr, i) (0x60 + (nr) * 8 + (i)) |
212 | #define IT87_REG_AUTO_PWM(nr, i) (0x65 + (nr) * 8 + (i)) | 214 | #define IT87_REG_AUTO_PWM(nr, i) (0x65 + (nr) * 8 + (i)) |
213 | 215 | ||
214 | 216 | ||
215 | struct it87_sio_data { | 217 | struct it87_sio_data { |
216 | enum chips type; | 218 | enum chips type; |
217 | /* Values read from Super-I/O config space */ | 219 | /* Values read from Super-I/O config space */ |
218 | u8 revision; | 220 | u8 revision; |
219 | u8 vid_value; | 221 | u8 vid_value; |
220 | u8 beep_pin; | 222 | u8 beep_pin; |
221 | u8 internal; /* Internal sensors can be labeled */ | 223 | u8 internal; /* Internal sensors can be labeled */ |
222 | /* Features skipped based on config or DMI */ | 224 | /* Features skipped based on config or DMI */ |
223 | u8 skip_vid; | 225 | u8 skip_vid; |
224 | u8 skip_fan; | 226 | u8 skip_fan; |
225 | u8 skip_pwm; | 227 | u8 skip_pwm; |
226 | }; | 228 | }; |
227 | 229 | ||
228 | /* For each registered chip, we need to keep some data in memory. | 230 | /* For each registered chip, we need to keep some data in memory. |
229 | The structure is dynamically allocated. */ | 231 | The structure is dynamically allocated. */ |
230 | struct it87_data { | 232 | struct it87_data { |
231 | struct device *hwmon_dev; | 233 | struct device *hwmon_dev; |
232 | enum chips type; | 234 | enum chips type; |
233 | u8 revision; | 235 | u8 revision; |
234 | 236 | ||
235 | unsigned short addr; | 237 | unsigned short addr; |
236 | const char *name; | 238 | const char *name; |
237 | struct mutex update_lock; | 239 | struct mutex update_lock; |
238 | char valid; /* !=0 if following fields are valid */ | 240 | char valid; /* !=0 if following fields are valid */ |
239 | unsigned long last_updated; /* In jiffies */ | 241 | unsigned long last_updated; /* In jiffies */ |
240 | 242 | ||
241 | u16 in_scaled; /* Internal voltage sensors are scaled */ | 243 | u16 in_scaled; /* Internal voltage sensors are scaled */ |
242 | u8 in[9]; /* Register value */ | 244 | u8 in[9]; /* Register value */ |
243 | u8 in_max[8]; /* Register value */ | 245 | u8 in_max[8]; /* Register value */ |
244 | u8 in_min[8]; /* Register value */ | 246 | u8 in_min[8]; /* Register value */ |
245 | u8 has_fan; /* Bitfield, fans enabled */ | 247 | u8 has_fan; /* Bitfield, fans enabled */ |
246 | u16 fan[5]; /* Register values, possibly combined */ | 248 | u16 fan[5]; /* Register values, possibly combined */ |
247 | u16 fan_min[5]; /* Register values, possibly combined */ | 249 | u16 fan_min[5]; /* Register values, possibly combined */ |
248 | s8 temp[3]; /* Register value */ | 250 | s8 temp[3]; /* Register value */ |
249 | s8 temp_high[3]; /* Register value */ | 251 | s8 temp_high[3]; /* Register value */ |
250 | s8 temp_low[3]; /* Register value */ | 252 | s8 temp_low[3]; /* Register value */ |
251 | u8 sensor; /* Register value */ | 253 | u8 sensor; /* Register value */ |
252 | u8 fan_div[3]; /* Register encoding, shifted right */ | 254 | u8 fan_div[3]; /* Register encoding, shifted right */ |
253 | u8 vid; /* Register encoding, combined */ | 255 | u8 vid; /* Register encoding, combined */ |
254 | u8 vrm; | 256 | u8 vrm; |
255 | u32 alarms; /* Register encoding, combined */ | 257 | u32 alarms; /* Register encoding, combined */ |
256 | u8 beeps; /* Register encoding */ | 258 | u8 beeps; /* Register encoding */ |
257 | u8 fan_main_ctrl; /* Register value */ | 259 | u8 fan_main_ctrl; /* Register value */ |
258 | u8 fan_ctl; /* Register value */ | 260 | u8 fan_ctl; /* Register value */ |
259 | 261 | ||
260 | /* The following 3 arrays correspond to the same registers up to | 262 | /* The following 3 arrays correspond to the same registers up to |
261 | * the IT8720F. The meaning of bits 6-0 depends on the value of bit | 263 | * the IT8720F. The meaning of bits 6-0 depends on the value of bit |
262 | * 7, and we want to preserve settings on mode changes, so we have | 264 | * 7, and we want to preserve settings on mode changes, so we have |
263 | * to track all values separately. | 265 | * to track all values separately. |
264 | * Starting with the IT8721F, the manual PWM duty cycles are stored | 266 | * Starting with the IT8721F, the manual PWM duty cycles are stored |
265 | * in separate registers (8-bit values), so the separate tracking | 267 | * in separate registers (8-bit values), so the separate tracking |
266 | * is no longer needed, but it is still done to keep the driver | 268 | * is no longer needed, but it is still done to keep the driver |
267 | * simple. */ | 269 | * simple. */ |
268 | u8 pwm_ctrl[3]; /* Register value */ | 270 | u8 pwm_ctrl[3]; /* Register value */ |
269 | u8 pwm_duty[3]; /* Manual PWM value set by user */ | 271 | u8 pwm_duty[3]; /* Manual PWM value set by user */ |
270 | u8 pwm_temp_map[3]; /* PWM to temp. chan. mapping (bits 1-0) */ | 272 | u8 pwm_temp_map[3]; /* PWM to temp. chan. mapping (bits 1-0) */ |
271 | 273 | ||
272 | /* Automatic fan speed control registers */ | 274 | /* Automatic fan speed control registers */ |
273 | u8 auto_pwm[3][4]; /* [nr][3] is hard-coded */ | 275 | u8 auto_pwm[3][4]; /* [nr][3] is hard-coded */ |
274 | s8 auto_temp[3][5]; /* [nr][0] is point1_temp_hyst */ | 276 | s8 auto_temp[3][5]; /* [nr][0] is point1_temp_hyst */ |
275 | }; | 277 | }; |
276 | 278 | ||
279 | static inline int has_12mv_adc(const struct it87_data *data) | ||
280 | { | ||
281 | /* | ||
282 | * IT8721F and later have a 12 mV ADC, also with internal scaling | ||
283 | * on selected inputs. | ||
284 | */ | ||
285 | return data->type == it8721 | ||
286 | || data->type == it8728; | ||
287 | } | ||
288 | |||
289 | static inline int has_newer_autopwm(const struct it87_data *data) | ||
290 | { | ||
291 | /* | ||
292 | * IT8721F and later have separate registers for the temperature | ||
293 | * mapping and the manual duty cycle. | ||
294 | */ | ||
295 | return data->type == it8721 | ||
296 | || data->type == it8728; | ||
297 | } | ||
298 | |||
277 | static u8 in_to_reg(const struct it87_data *data, int nr, long val) | 299 | static u8 in_to_reg(const struct it87_data *data, int nr, long val) |
278 | { | 300 | { |
279 | long lsb; | 301 | long lsb; |
280 | 302 | ||
281 | if (data->type == it8721) { | 303 | if (has_12mv_adc(data)) { |
282 | if (data->in_scaled & (1 << nr)) | 304 | if (data->in_scaled & (1 << nr)) |
283 | lsb = 24; | 305 | lsb = 24; |
284 | else | 306 | else |
285 | lsb = 12; | 307 | lsb = 12; |
286 | } else | 308 | } else |
287 | lsb = 16; | 309 | lsb = 16; |
288 | 310 | ||
289 | val = DIV_ROUND_CLOSEST(val, lsb); | 311 | val = DIV_ROUND_CLOSEST(val, lsb); |
290 | return SENSORS_LIMIT(val, 0, 255); | 312 | return SENSORS_LIMIT(val, 0, 255); |
291 | } | 313 | } |
292 | 314 | ||
293 | static int in_from_reg(const struct it87_data *data, int nr, int val) | 315 | static int in_from_reg(const struct it87_data *data, int nr, int val) |
294 | { | 316 | { |
295 | if (data->type == it8721) { | 317 | if (has_12mv_adc(data)) { |
296 | if (data->in_scaled & (1 << nr)) | 318 | if (data->in_scaled & (1 << nr)) |
297 | return val * 24; | 319 | return val * 24; |
298 | else | 320 | else |
299 | return val * 12; | 321 | return val * 12; |
300 | } else | 322 | } else |
301 | return val * 16; | 323 | return val * 16; |
302 | } | 324 | } |
303 | 325 | ||
304 | static inline u8 FAN_TO_REG(long rpm, int div) | 326 | static inline u8 FAN_TO_REG(long rpm, int div) |
305 | { | 327 | { |
306 | if (rpm == 0) | 328 | if (rpm == 0) |
307 | return 255; | 329 | return 255; |
308 | rpm = SENSORS_LIMIT(rpm, 1, 1000000); | 330 | rpm = SENSORS_LIMIT(rpm, 1, 1000000); |
309 | return SENSORS_LIMIT((1350000 + rpm * div / 2) / (rpm * div), 1, | 331 | return SENSORS_LIMIT((1350000 + rpm * div / 2) / (rpm * div), 1, |
310 | 254); | 332 | 254); |
311 | } | 333 | } |
312 | 334 | ||
313 | static inline u16 FAN16_TO_REG(long rpm) | 335 | static inline u16 FAN16_TO_REG(long rpm) |
314 | { | 336 | { |
315 | if (rpm == 0) | 337 | if (rpm == 0) |
316 | return 0xffff; | 338 | return 0xffff; |
317 | return SENSORS_LIMIT((1350000 + rpm) / (rpm * 2), 1, 0xfffe); | 339 | return SENSORS_LIMIT((1350000 + rpm) / (rpm * 2), 1, 0xfffe); |
318 | } | 340 | } |
319 | 341 | ||
320 | #define FAN_FROM_REG(val, div) ((val) == 0 ? -1 : (val) == 255 ? 0 : \ | 342 | #define FAN_FROM_REG(val, div) ((val) == 0 ? -1 : (val) == 255 ? 0 : \ |
321 | 1350000 / ((val) * (div))) | 343 | 1350000 / ((val) * (div))) |
322 | /* The divider is fixed to 2 in 16-bit mode */ | 344 | /* The divider is fixed to 2 in 16-bit mode */ |
323 | #define FAN16_FROM_REG(val) ((val) == 0 ? -1 : (val) == 0xffff ? 0 : \ | 345 | #define FAN16_FROM_REG(val) ((val) == 0 ? -1 : (val) == 0xffff ? 0 : \ |
324 | 1350000 / ((val) * 2)) | 346 | 1350000 / ((val) * 2)) |
325 | 347 | ||
326 | #define TEMP_TO_REG(val) (SENSORS_LIMIT(((val) < 0 ? (((val) - 500) / 1000) : \ | 348 | #define TEMP_TO_REG(val) (SENSORS_LIMIT(((val) < 0 ? (((val) - 500) / 1000) : \ |
327 | ((val) + 500) / 1000), -128, 127)) | 349 | ((val) + 500) / 1000), -128, 127)) |
328 | #define TEMP_FROM_REG(val) ((val) * 1000) | 350 | #define TEMP_FROM_REG(val) ((val) * 1000) |
329 | 351 | ||
330 | static u8 pwm_to_reg(const struct it87_data *data, long val) | 352 | static u8 pwm_to_reg(const struct it87_data *data, long val) |
331 | { | 353 | { |
332 | if (data->type == it8721) | 354 | if (has_newer_autopwm(data)) |
333 | return val; | 355 | return val; |
334 | else | 356 | else |
335 | return val >> 1; | 357 | return val >> 1; |
336 | } | 358 | } |
337 | 359 | ||
338 | static int pwm_from_reg(const struct it87_data *data, u8 reg) | 360 | static int pwm_from_reg(const struct it87_data *data, u8 reg) |
339 | { | 361 | { |
340 | if (data->type == it8721) | 362 | if (has_newer_autopwm(data)) |
341 | return reg; | 363 | return reg; |
342 | else | 364 | else |
343 | return (reg & 0x7f) << 1; | 365 | return (reg & 0x7f) << 1; |
344 | } | 366 | } |
345 | 367 | ||
346 | 368 | ||
347 | static int DIV_TO_REG(int val) | 369 | static int DIV_TO_REG(int val) |
348 | { | 370 | { |
349 | int answer = 0; | 371 | int answer = 0; |
350 | while (answer < 7 && (val >>= 1)) | 372 | while (answer < 7 && (val >>= 1)) |
351 | answer++; | 373 | answer++; |
352 | return answer; | 374 | return answer; |
353 | } | 375 | } |
354 | #define DIV_FROM_REG(val) (1 << (val)) | 376 | #define DIV_FROM_REG(val) (1 << (val)) |
355 | 377 | ||
356 | static const unsigned int pwm_freq[8] = { | 378 | static const unsigned int pwm_freq[8] = { |
357 | 48000000 / 128, | 379 | 48000000 / 128, |
358 | 24000000 / 128, | 380 | 24000000 / 128, |
359 | 12000000 / 128, | 381 | 12000000 / 128, |
360 | 8000000 / 128, | 382 | 8000000 / 128, |
361 | 6000000 / 128, | 383 | 6000000 / 128, |
362 | 3000000 / 128, | 384 | 3000000 / 128, |
363 | 1500000 / 128, | 385 | 1500000 / 128, |
364 | 750000 / 128, | 386 | 750000 / 128, |
365 | }; | 387 | }; |
366 | 388 | ||
367 | static inline int has_16bit_fans(const struct it87_data *data) | 389 | static inline int has_16bit_fans(const struct it87_data *data) |
368 | { | 390 | { |
369 | /* IT8705F Datasheet 0.4.1, 3h == Version G. | 391 | /* IT8705F Datasheet 0.4.1, 3h == Version G. |
370 | IT8712F Datasheet 0.9.1, section 8.3.5 indicates 8h == Version J. | 392 | IT8712F Datasheet 0.9.1, section 8.3.5 indicates 8h == Version J. |
371 | These are the first revisions with 16bit tachometer support. */ | 393 | These are the first revisions with 16bit tachometer support. */ |
372 | return (data->type == it87 && data->revision >= 0x03) | 394 | return (data->type == it87 && data->revision >= 0x03) |
373 | || (data->type == it8712 && data->revision >= 0x08) | 395 | || (data->type == it8712 && data->revision >= 0x08) |
374 | || data->type == it8716 | 396 | || data->type == it8716 |
375 | || data->type == it8718 | 397 | || data->type == it8718 |
376 | || data->type == it8720 | 398 | || data->type == it8720 |
377 | || data->type == it8721; | 399 | || data->type == it8721 |
400 | || data->type == it8728; | ||
378 | } | 401 | } |
379 | 402 | ||
380 | static inline int has_old_autopwm(const struct it87_data *data) | 403 | static inline int has_old_autopwm(const struct it87_data *data) |
381 | { | 404 | { |
382 | /* The old automatic fan speed control interface is implemented | 405 | /* The old automatic fan speed control interface is implemented |
383 | by IT8705F chips up to revision F and IT8712F chips up to | 406 | by IT8705F chips up to revision F and IT8712F chips up to |
384 | revision G. */ | 407 | revision G. */ |
385 | return (data->type == it87 && data->revision < 0x03) | 408 | return (data->type == it87 && data->revision < 0x03) |
386 | || (data->type == it8712 && data->revision < 0x08); | 409 | || (data->type == it8712 && data->revision < 0x08); |
387 | } | 410 | } |
388 | 411 | ||
389 | static int it87_probe(struct platform_device *pdev); | 412 | static int it87_probe(struct platform_device *pdev); |
390 | static int __devexit it87_remove(struct platform_device *pdev); | 413 | static int __devexit it87_remove(struct platform_device *pdev); |
391 | 414 | ||
392 | static int it87_read_value(struct it87_data *data, u8 reg); | 415 | static int it87_read_value(struct it87_data *data, u8 reg); |
393 | static void it87_write_value(struct it87_data *data, u8 reg, u8 value); | 416 | static void it87_write_value(struct it87_data *data, u8 reg, u8 value); |
394 | static struct it87_data *it87_update_device(struct device *dev); | 417 | static struct it87_data *it87_update_device(struct device *dev); |
395 | static int it87_check_pwm(struct device *dev); | 418 | static int it87_check_pwm(struct device *dev); |
396 | static void it87_init_device(struct platform_device *pdev); | 419 | static void it87_init_device(struct platform_device *pdev); |
397 | 420 | ||
398 | 421 | ||
399 | static struct platform_driver it87_driver = { | 422 | static struct platform_driver it87_driver = { |
400 | .driver = { | 423 | .driver = { |
401 | .owner = THIS_MODULE, | 424 | .owner = THIS_MODULE, |
402 | .name = DRVNAME, | 425 | .name = DRVNAME, |
403 | }, | 426 | }, |
404 | .probe = it87_probe, | 427 | .probe = it87_probe, |
405 | .remove = __devexit_p(it87_remove), | 428 | .remove = __devexit_p(it87_remove), |
406 | }; | 429 | }; |
407 | 430 | ||
408 | static ssize_t show_in(struct device *dev, struct device_attribute *attr, | 431 | static ssize_t show_in(struct device *dev, struct device_attribute *attr, |
409 | char *buf) | 432 | char *buf) |
410 | { | 433 | { |
411 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); | 434 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); |
412 | int nr = sensor_attr->index; | 435 | int nr = sensor_attr->index; |
413 | 436 | ||
414 | struct it87_data *data = it87_update_device(dev); | 437 | struct it87_data *data = it87_update_device(dev); |
415 | return sprintf(buf, "%d\n", in_from_reg(data, nr, data->in[nr])); | 438 | return sprintf(buf, "%d\n", in_from_reg(data, nr, data->in[nr])); |
416 | } | 439 | } |
417 | 440 | ||
418 | static ssize_t show_in_min(struct device *dev, struct device_attribute *attr, | 441 | static ssize_t show_in_min(struct device *dev, struct device_attribute *attr, |
419 | char *buf) | 442 | char *buf) |
420 | { | 443 | { |
421 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); | 444 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); |
422 | int nr = sensor_attr->index; | 445 | int nr = sensor_attr->index; |
423 | 446 | ||
424 | struct it87_data *data = it87_update_device(dev); | 447 | struct it87_data *data = it87_update_device(dev); |
425 | return sprintf(buf, "%d\n", in_from_reg(data, nr, data->in_min[nr])); | 448 | return sprintf(buf, "%d\n", in_from_reg(data, nr, data->in_min[nr])); |
426 | } | 449 | } |
427 | 450 | ||
428 | static ssize_t show_in_max(struct device *dev, struct device_attribute *attr, | 451 | static ssize_t show_in_max(struct device *dev, struct device_attribute *attr, |
429 | char *buf) | 452 | char *buf) |
430 | { | 453 | { |
431 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); | 454 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); |
432 | int nr = sensor_attr->index; | 455 | int nr = sensor_attr->index; |
433 | 456 | ||
434 | struct it87_data *data = it87_update_device(dev); | 457 | struct it87_data *data = it87_update_device(dev); |
435 | return sprintf(buf, "%d\n", in_from_reg(data, nr, data->in_max[nr])); | 458 | return sprintf(buf, "%d\n", in_from_reg(data, nr, data->in_max[nr])); |
436 | } | 459 | } |
437 | 460 | ||
438 | static ssize_t set_in_min(struct device *dev, struct device_attribute *attr, | 461 | static ssize_t set_in_min(struct device *dev, struct device_attribute *attr, |
439 | const char *buf, size_t count) | 462 | const char *buf, size_t count) |
440 | { | 463 | { |
441 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); | 464 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); |
442 | int nr = sensor_attr->index; | 465 | int nr = sensor_attr->index; |
443 | 466 | ||
444 | struct it87_data *data = dev_get_drvdata(dev); | 467 | struct it87_data *data = dev_get_drvdata(dev); |
445 | unsigned long val; | 468 | unsigned long val; |
446 | 469 | ||
447 | if (kstrtoul(buf, 10, &val) < 0) | 470 | if (kstrtoul(buf, 10, &val) < 0) |
448 | return -EINVAL; | 471 | return -EINVAL; |
449 | 472 | ||
450 | mutex_lock(&data->update_lock); | 473 | mutex_lock(&data->update_lock); |
451 | data->in_min[nr] = in_to_reg(data, nr, val); | 474 | data->in_min[nr] = in_to_reg(data, nr, val); |
452 | it87_write_value(data, IT87_REG_VIN_MIN(nr), | 475 | it87_write_value(data, IT87_REG_VIN_MIN(nr), |
453 | data->in_min[nr]); | 476 | data->in_min[nr]); |
454 | mutex_unlock(&data->update_lock); | 477 | mutex_unlock(&data->update_lock); |
455 | return count; | 478 | return count; |
456 | } | 479 | } |
457 | static ssize_t set_in_max(struct device *dev, struct device_attribute *attr, | 480 | static ssize_t set_in_max(struct device *dev, struct device_attribute *attr, |
458 | const char *buf, size_t count) | 481 | const char *buf, size_t count) |
459 | { | 482 | { |
460 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); | 483 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); |
461 | int nr = sensor_attr->index; | 484 | int nr = sensor_attr->index; |
462 | 485 | ||
463 | struct it87_data *data = dev_get_drvdata(dev); | 486 | struct it87_data *data = dev_get_drvdata(dev); |
464 | unsigned long val; | 487 | unsigned long val; |
465 | 488 | ||
466 | if (kstrtoul(buf, 10, &val) < 0) | 489 | if (kstrtoul(buf, 10, &val) < 0) |
467 | return -EINVAL; | 490 | return -EINVAL; |
468 | 491 | ||
469 | mutex_lock(&data->update_lock); | 492 | mutex_lock(&data->update_lock); |
470 | data->in_max[nr] = in_to_reg(data, nr, val); | 493 | data->in_max[nr] = in_to_reg(data, nr, val); |
471 | it87_write_value(data, IT87_REG_VIN_MAX(nr), | 494 | it87_write_value(data, IT87_REG_VIN_MAX(nr), |
472 | data->in_max[nr]); | 495 | data->in_max[nr]); |
473 | mutex_unlock(&data->update_lock); | 496 | mutex_unlock(&data->update_lock); |
474 | return count; | 497 | return count; |
475 | } | 498 | } |
476 | 499 | ||
477 | #define show_in_offset(offset) \ | 500 | #define show_in_offset(offset) \ |
478 | static SENSOR_DEVICE_ATTR(in##offset##_input, S_IRUGO, \ | 501 | static SENSOR_DEVICE_ATTR(in##offset##_input, S_IRUGO, \ |
479 | show_in, NULL, offset); | 502 | show_in, NULL, offset); |
480 | 503 | ||
481 | #define limit_in_offset(offset) \ | 504 | #define limit_in_offset(offset) \ |
482 | static SENSOR_DEVICE_ATTR(in##offset##_min, S_IRUGO | S_IWUSR, \ | 505 | static SENSOR_DEVICE_ATTR(in##offset##_min, S_IRUGO | S_IWUSR, \ |
483 | show_in_min, set_in_min, offset); \ | 506 | show_in_min, set_in_min, offset); \ |
484 | static SENSOR_DEVICE_ATTR(in##offset##_max, S_IRUGO | S_IWUSR, \ | 507 | static SENSOR_DEVICE_ATTR(in##offset##_max, S_IRUGO | S_IWUSR, \ |
485 | show_in_max, set_in_max, offset); | 508 | show_in_max, set_in_max, offset); |
486 | 509 | ||
487 | show_in_offset(0); | 510 | show_in_offset(0); |
488 | limit_in_offset(0); | 511 | limit_in_offset(0); |
489 | show_in_offset(1); | 512 | show_in_offset(1); |
490 | limit_in_offset(1); | 513 | limit_in_offset(1); |
491 | show_in_offset(2); | 514 | show_in_offset(2); |
492 | limit_in_offset(2); | 515 | limit_in_offset(2); |
493 | show_in_offset(3); | 516 | show_in_offset(3); |
494 | limit_in_offset(3); | 517 | limit_in_offset(3); |
495 | show_in_offset(4); | 518 | show_in_offset(4); |
496 | limit_in_offset(4); | 519 | limit_in_offset(4); |
497 | show_in_offset(5); | 520 | show_in_offset(5); |
498 | limit_in_offset(5); | 521 | limit_in_offset(5); |
499 | show_in_offset(6); | 522 | show_in_offset(6); |
500 | limit_in_offset(6); | 523 | limit_in_offset(6); |
501 | show_in_offset(7); | 524 | show_in_offset(7); |
502 | limit_in_offset(7); | 525 | limit_in_offset(7); |
503 | show_in_offset(8); | 526 | show_in_offset(8); |
504 | 527 | ||
505 | /* 3 temperatures */ | 528 | /* 3 temperatures */ |
506 | static ssize_t show_temp(struct device *dev, struct device_attribute *attr, | 529 | static ssize_t show_temp(struct device *dev, struct device_attribute *attr, |
507 | char *buf) | 530 | char *buf) |
508 | { | 531 | { |
509 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); | 532 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); |
510 | int nr = sensor_attr->index; | 533 | int nr = sensor_attr->index; |
511 | 534 | ||
512 | struct it87_data *data = it87_update_device(dev); | 535 | struct it87_data *data = it87_update_device(dev); |
513 | return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp[nr])); | 536 | return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp[nr])); |
514 | } | 537 | } |
515 | static ssize_t show_temp_max(struct device *dev, struct device_attribute *attr, | 538 | static ssize_t show_temp_max(struct device *dev, struct device_attribute *attr, |
516 | char *buf) | 539 | char *buf) |
517 | { | 540 | { |
518 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); | 541 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); |
519 | int nr = sensor_attr->index; | 542 | int nr = sensor_attr->index; |
520 | 543 | ||
521 | struct it87_data *data = it87_update_device(dev); | 544 | struct it87_data *data = it87_update_device(dev); |
522 | return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_high[nr])); | 545 | return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_high[nr])); |
523 | } | 546 | } |
524 | static ssize_t show_temp_min(struct device *dev, struct device_attribute *attr, | 547 | static ssize_t show_temp_min(struct device *dev, struct device_attribute *attr, |
525 | char *buf) | 548 | char *buf) |
526 | { | 549 | { |
527 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); | 550 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); |
528 | int nr = sensor_attr->index; | 551 | int nr = sensor_attr->index; |
529 | 552 | ||
530 | struct it87_data *data = it87_update_device(dev); | 553 | struct it87_data *data = it87_update_device(dev); |
531 | return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_low[nr])); | 554 | return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_low[nr])); |
532 | } | 555 | } |
533 | static ssize_t set_temp_max(struct device *dev, struct device_attribute *attr, | 556 | static ssize_t set_temp_max(struct device *dev, struct device_attribute *attr, |
534 | const char *buf, size_t count) | 557 | const char *buf, size_t count) |
535 | { | 558 | { |
536 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); | 559 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); |
537 | int nr = sensor_attr->index; | 560 | int nr = sensor_attr->index; |
538 | 561 | ||
539 | struct it87_data *data = dev_get_drvdata(dev); | 562 | struct it87_data *data = dev_get_drvdata(dev); |
540 | long val; | 563 | long val; |
541 | 564 | ||
542 | if (kstrtol(buf, 10, &val) < 0) | 565 | if (kstrtol(buf, 10, &val) < 0) |
543 | return -EINVAL; | 566 | return -EINVAL; |
544 | 567 | ||
545 | mutex_lock(&data->update_lock); | 568 | mutex_lock(&data->update_lock); |
546 | data->temp_high[nr] = TEMP_TO_REG(val); | 569 | data->temp_high[nr] = TEMP_TO_REG(val); |
547 | it87_write_value(data, IT87_REG_TEMP_HIGH(nr), data->temp_high[nr]); | 570 | it87_write_value(data, IT87_REG_TEMP_HIGH(nr), data->temp_high[nr]); |
548 | mutex_unlock(&data->update_lock); | 571 | mutex_unlock(&data->update_lock); |
549 | return count; | 572 | return count; |
550 | } | 573 | } |
551 | static ssize_t set_temp_min(struct device *dev, struct device_attribute *attr, | 574 | static ssize_t set_temp_min(struct device *dev, struct device_attribute *attr, |
552 | const char *buf, size_t count) | 575 | const char *buf, size_t count) |
553 | { | 576 | { |
554 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); | 577 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); |
555 | int nr = sensor_attr->index; | 578 | int nr = sensor_attr->index; |
556 | 579 | ||
557 | struct it87_data *data = dev_get_drvdata(dev); | 580 | struct it87_data *data = dev_get_drvdata(dev); |
558 | long val; | 581 | long val; |
559 | 582 | ||
560 | if (kstrtol(buf, 10, &val) < 0) | 583 | if (kstrtol(buf, 10, &val) < 0) |
561 | return -EINVAL; | 584 | return -EINVAL; |
562 | 585 | ||
563 | mutex_lock(&data->update_lock); | 586 | mutex_lock(&data->update_lock); |
564 | data->temp_low[nr] = TEMP_TO_REG(val); | 587 | data->temp_low[nr] = TEMP_TO_REG(val); |
565 | it87_write_value(data, IT87_REG_TEMP_LOW(nr), data->temp_low[nr]); | 588 | it87_write_value(data, IT87_REG_TEMP_LOW(nr), data->temp_low[nr]); |
566 | mutex_unlock(&data->update_lock); | 589 | mutex_unlock(&data->update_lock); |
567 | return count; | 590 | return count; |
568 | } | 591 | } |
569 | #define show_temp_offset(offset) \ | 592 | #define show_temp_offset(offset) \ |
570 | static SENSOR_DEVICE_ATTR(temp##offset##_input, S_IRUGO, \ | 593 | static SENSOR_DEVICE_ATTR(temp##offset##_input, S_IRUGO, \ |
571 | show_temp, NULL, offset - 1); \ | 594 | show_temp, NULL, offset - 1); \ |
572 | static SENSOR_DEVICE_ATTR(temp##offset##_max, S_IRUGO | S_IWUSR, \ | 595 | static SENSOR_DEVICE_ATTR(temp##offset##_max, S_IRUGO | S_IWUSR, \ |
573 | show_temp_max, set_temp_max, offset - 1); \ | 596 | show_temp_max, set_temp_max, offset - 1); \ |
574 | static SENSOR_DEVICE_ATTR(temp##offset##_min, S_IRUGO | S_IWUSR, \ | 597 | static SENSOR_DEVICE_ATTR(temp##offset##_min, S_IRUGO | S_IWUSR, \ |
575 | show_temp_min, set_temp_min, offset - 1); | 598 | show_temp_min, set_temp_min, offset - 1); |
576 | 599 | ||
577 | show_temp_offset(1); | 600 | show_temp_offset(1); |
578 | show_temp_offset(2); | 601 | show_temp_offset(2); |
579 | show_temp_offset(3); | 602 | show_temp_offset(3); |
580 | 603 | ||
581 | static ssize_t show_sensor(struct device *dev, struct device_attribute *attr, | 604 | static ssize_t show_sensor(struct device *dev, struct device_attribute *attr, |
582 | char *buf) | 605 | char *buf) |
583 | { | 606 | { |
584 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); | 607 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); |
585 | int nr = sensor_attr->index; | 608 | int nr = sensor_attr->index; |
586 | 609 | ||
587 | struct it87_data *data = it87_update_device(dev); | 610 | struct it87_data *data = it87_update_device(dev); |
588 | u8 reg = data->sensor; /* In case the value is updated while | 611 | u8 reg = data->sensor; /* In case the value is updated while |
589 | we use it */ | 612 | we use it */ |
590 | 613 | ||
591 | if (reg & (1 << nr)) | 614 | if (reg & (1 << nr)) |
592 | return sprintf(buf, "3\n"); /* thermal diode */ | 615 | return sprintf(buf, "3\n"); /* thermal diode */ |
593 | if (reg & (8 << nr)) | 616 | if (reg & (8 << nr)) |
594 | return sprintf(buf, "4\n"); /* thermistor */ | 617 | return sprintf(buf, "4\n"); /* thermistor */ |
595 | return sprintf(buf, "0\n"); /* disabled */ | 618 | return sprintf(buf, "0\n"); /* disabled */ |
596 | } | 619 | } |
597 | static ssize_t set_sensor(struct device *dev, struct device_attribute *attr, | 620 | static ssize_t set_sensor(struct device *dev, struct device_attribute *attr, |
598 | const char *buf, size_t count) | 621 | const char *buf, size_t count) |
599 | { | 622 | { |
600 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); | 623 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); |
601 | int nr = sensor_attr->index; | 624 | int nr = sensor_attr->index; |
602 | 625 | ||
603 | struct it87_data *data = dev_get_drvdata(dev); | 626 | struct it87_data *data = dev_get_drvdata(dev); |
604 | long val; | 627 | long val; |
605 | u8 reg; | 628 | u8 reg; |
606 | 629 | ||
607 | if (kstrtol(buf, 10, &val) < 0) | 630 | if (kstrtol(buf, 10, &val) < 0) |
608 | return -EINVAL; | 631 | return -EINVAL; |
609 | 632 | ||
610 | reg = it87_read_value(data, IT87_REG_TEMP_ENABLE); | 633 | reg = it87_read_value(data, IT87_REG_TEMP_ENABLE); |
611 | reg &= ~(1 << nr); | 634 | reg &= ~(1 << nr); |
612 | reg &= ~(8 << nr); | 635 | reg &= ~(8 << nr); |
613 | if (val == 2) { /* backwards compatibility */ | 636 | if (val == 2) { /* backwards compatibility */ |
614 | dev_warn(dev, "Sensor type 2 is deprecated, please use 4 " | 637 | dev_warn(dev, "Sensor type 2 is deprecated, please use 4 " |
615 | "instead\n"); | 638 | "instead\n"); |
616 | val = 4; | 639 | val = 4; |
617 | } | 640 | } |
618 | /* 3 = thermal diode; 4 = thermistor; 0 = disabled */ | 641 | /* 3 = thermal diode; 4 = thermistor; 0 = disabled */ |
619 | if (val == 3) | 642 | if (val == 3) |
620 | reg |= 1 << nr; | 643 | reg |= 1 << nr; |
621 | else if (val == 4) | 644 | else if (val == 4) |
622 | reg |= 8 << nr; | 645 | reg |= 8 << nr; |
623 | else if (val != 0) | 646 | else if (val != 0) |
624 | return -EINVAL; | 647 | return -EINVAL; |
625 | 648 | ||
626 | mutex_lock(&data->update_lock); | 649 | mutex_lock(&data->update_lock); |
627 | data->sensor = reg; | 650 | data->sensor = reg; |
628 | it87_write_value(data, IT87_REG_TEMP_ENABLE, data->sensor); | 651 | it87_write_value(data, IT87_REG_TEMP_ENABLE, data->sensor); |
629 | data->valid = 0; /* Force cache refresh */ | 652 | data->valid = 0; /* Force cache refresh */ |
630 | mutex_unlock(&data->update_lock); | 653 | mutex_unlock(&data->update_lock); |
631 | return count; | 654 | return count; |
632 | } | 655 | } |
633 | #define show_sensor_offset(offset) \ | 656 | #define show_sensor_offset(offset) \ |
634 | static SENSOR_DEVICE_ATTR(temp##offset##_type, S_IRUGO | S_IWUSR, \ | 657 | static SENSOR_DEVICE_ATTR(temp##offset##_type, S_IRUGO | S_IWUSR, \ |
635 | show_sensor, set_sensor, offset - 1); | 658 | show_sensor, set_sensor, offset - 1); |
636 | 659 | ||
637 | show_sensor_offset(1); | 660 | show_sensor_offset(1); |
638 | show_sensor_offset(2); | 661 | show_sensor_offset(2); |
639 | show_sensor_offset(3); | 662 | show_sensor_offset(3); |
640 | 663 | ||
641 | /* 3 Fans */ | 664 | /* 3 Fans */ |
642 | 665 | ||
643 | static int pwm_mode(const struct it87_data *data, int nr) | 666 | static int pwm_mode(const struct it87_data *data, int nr) |
644 | { | 667 | { |
645 | int ctrl = data->fan_main_ctrl & (1 << nr); | 668 | int ctrl = data->fan_main_ctrl & (1 << nr); |
646 | 669 | ||
647 | if (ctrl == 0) /* Full speed */ | 670 | if (ctrl == 0) /* Full speed */ |
648 | return 0; | 671 | return 0; |
649 | if (data->pwm_ctrl[nr] & 0x80) /* Automatic mode */ | 672 | if (data->pwm_ctrl[nr] & 0x80) /* Automatic mode */ |
650 | return 2; | 673 | return 2; |
651 | else /* Manual mode */ | 674 | else /* Manual mode */ |
652 | return 1; | 675 | return 1; |
653 | } | 676 | } |
654 | 677 | ||
655 | static ssize_t show_fan(struct device *dev, struct device_attribute *attr, | 678 | static ssize_t show_fan(struct device *dev, struct device_attribute *attr, |
656 | char *buf) | 679 | char *buf) |
657 | { | 680 | { |
658 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); | 681 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); |
659 | int nr = sensor_attr->index; | 682 | int nr = sensor_attr->index; |
660 | 683 | ||
661 | struct it87_data *data = it87_update_device(dev); | 684 | struct it87_data *data = it87_update_device(dev); |
662 | return sprintf(buf, "%d\n", FAN_FROM_REG(data->fan[nr], | 685 | return sprintf(buf, "%d\n", FAN_FROM_REG(data->fan[nr], |
663 | DIV_FROM_REG(data->fan_div[nr]))); | 686 | DIV_FROM_REG(data->fan_div[nr]))); |
664 | } | 687 | } |
665 | static ssize_t show_fan_min(struct device *dev, struct device_attribute *attr, | 688 | static ssize_t show_fan_min(struct device *dev, struct device_attribute *attr, |
666 | char *buf) | 689 | char *buf) |
667 | { | 690 | { |
668 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); | 691 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); |
669 | int nr = sensor_attr->index; | 692 | int nr = sensor_attr->index; |
670 | 693 | ||
671 | struct it87_data *data = it87_update_device(dev); | 694 | struct it87_data *data = it87_update_device(dev); |
672 | return sprintf(buf, "%d\n", FAN_FROM_REG(data->fan_min[nr], | 695 | return sprintf(buf, "%d\n", FAN_FROM_REG(data->fan_min[nr], |
673 | DIV_FROM_REG(data->fan_div[nr]))); | 696 | DIV_FROM_REG(data->fan_div[nr]))); |
674 | } | 697 | } |
675 | static ssize_t show_fan_div(struct device *dev, struct device_attribute *attr, | 698 | static ssize_t show_fan_div(struct device *dev, struct device_attribute *attr, |
676 | char *buf) | 699 | char *buf) |
677 | { | 700 | { |
678 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); | 701 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); |
679 | int nr = sensor_attr->index; | 702 | int nr = sensor_attr->index; |
680 | 703 | ||
681 | struct it87_data *data = it87_update_device(dev); | 704 | struct it87_data *data = it87_update_device(dev); |
682 | return sprintf(buf, "%d\n", DIV_FROM_REG(data->fan_div[nr])); | 705 | return sprintf(buf, "%d\n", DIV_FROM_REG(data->fan_div[nr])); |
683 | } | 706 | } |
684 | static ssize_t show_pwm_enable(struct device *dev, | 707 | static ssize_t show_pwm_enable(struct device *dev, |
685 | struct device_attribute *attr, char *buf) | 708 | struct device_attribute *attr, char *buf) |
686 | { | 709 | { |
687 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); | 710 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); |
688 | int nr = sensor_attr->index; | 711 | int nr = sensor_attr->index; |
689 | 712 | ||
690 | struct it87_data *data = it87_update_device(dev); | 713 | struct it87_data *data = it87_update_device(dev); |
691 | return sprintf(buf, "%d\n", pwm_mode(data, nr)); | 714 | return sprintf(buf, "%d\n", pwm_mode(data, nr)); |
692 | } | 715 | } |
693 | static ssize_t show_pwm(struct device *dev, struct device_attribute *attr, | 716 | static ssize_t show_pwm(struct device *dev, struct device_attribute *attr, |
694 | char *buf) | 717 | char *buf) |
695 | { | 718 | { |
696 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); | 719 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); |
697 | int nr = sensor_attr->index; | 720 | int nr = sensor_attr->index; |
698 | 721 | ||
699 | struct it87_data *data = it87_update_device(dev); | 722 | struct it87_data *data = it87_update_device(dev); |
700 | return sprintf(buf, "%d\n", | 723 | return sprintf(buf, "%d\n", |
701 | pwm_from_reg(data, data->pwm_duty[nr])); | 724 | pwm_from_reg(data, data->pwm_duty[nr])); |
702 | } | 725 | } |
703 | static ssize_t show_pwm_freq(struct device *dev, struct device_attribute *attr, | 726 | static ssize_t show_pwm_freq(struct device *dev, struct device_attribute *attr, |
704 | char *buf) | 727 | char *buf) |
705 | { | 728 | { |
706 | struct it87_data *data = it87_update_device(dev); | 729 | struct it87_data *data = it87_update_device(dev); |
707 | int index = (data->fan_ctl >> 4) & 0x07; | 730 | int index = (data->fan_ctl >> 4) & 0x07; |
708 | 731 | ||
709 | return sprintf(buf, "%u\n", pwm_freq[index]); | 732 | return sprintf(buf, "%u\n", pwm_freq[index]); |
710 | } | 733 | } |
711 | static ssize_t set_fan_min(struct device *dev, struct device_attribute *attr, | 734 | static ssize_t set_fan_min(struct device *dev, struct device_attribute *attr, |
712 | const char *buf, size_t count) | 735 | const char *buf, size_t count) |
713 | { | 736 | { |
714 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); | 737 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); |
715 | int nr = sensor_attr->index; | 738 | int nr = sensor_attr->index; |
716 | 739 | ||
717 | struct it87_data *data = dev_get_drvdata(dev); | 740 | struct it87_data *data = dev_get_drvdata(dev); |
718 | long val; | 741 | long val; |
719 | u8 reg; | 742 | u8 reg; |
720 | 743 | ||
721 | if (kstrtol(buf, 10, &val) < 0) | 744 | if (kstrtol(buf, 10, &val) < 0) |
722 | return -EINVAL; | 745 | return -EINVAL; |
723 | 746 | ||
724 | mutex_lock(&data->update_lock); | 747 | mutex_lock(&data->update_lock); |
725 | reg = it87_read_value(data, IT87_REG_FAN_DIV); | 748 | reg = it87_read_value(data, IT87_REG_FAN_DIV); |
726 | switch (nr) { | 749 | switch (nr) { |
727 | case 0: | 750 | case 0: |
728 | data->fan_div[nr] = reg & 0x07; | 751 | data->fan_div[nr] = reg & 0x07; |
729 | break; | 752 | break; |
730 | case 1: | 753 | case 1: |
731 | data->fan_div[nr] = (reg >> 3) & 0x07; | 754 | data->fan_div[nr] = (reg >> 3) & 0x07; |
732 | break; | 755 | break; |
733 | case 2: | 756 | case 2: |
734 | data->fan_div[nr] = (reg & 0x40) ? 3 : 1; | 757 | data->fan_div[nr] = (reg & 0x40) ? 3 : 1; |
735 | break; | 758 | break; |
736 | } | 759 | } |
737 | 760 | ||
738 | data->fan_min[nr] = FAN_TO_REG(val, DIV_FROM_REG(data->fan_div[nr])); | 761 | data->fan_min[nr] = FAN_TO_REG(val, DIV_FROM_REG(data->fan_div[nr])); |
739 | it87_write_value(data, IT87_REG_FAN_MIN[nr], data->fan_min[nr]); | 762 | it87_write_value(data, IT87_REG_FAN_MIN[nr], data->fan_min[nr]); |
740 | mutex_unlock(&data->update_lock); | 763 | mutex_unlock(&data->update_lock); |
741 | return count; | 764 | return count; |
742 | } | 765 | } |
743 | static ssize_t set_fan_div(struct device *dev, struct device_attribute *attr, | 766 | static ssize_t set_fan_div(struct device *dev, struct device_attribute *attr, |
744 | const char *buf, size_t count) | 767 | const char *buf, size_t count) |
745 | { | 768 | { |
746 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); | 769 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); |
747 | int nr = sensor_attr->index; | 770 | int nr = sensor_attr->index; |
748 | 771 | ||
749 | struct it87_data *data = dev_get_drvdata(dev); | 772 | struct it87_data *data = dev_get_drvdata(dev); |
750 | unsigned long val; | 773 | unsigned long val; |
751 | int min; | 774 | int min; |
752 | u8 old; | 775 | u8 old; |
753 | 776 | ||
754 | if (kstrtoul(buf, 10, &val) < 0) | 777 | if (kstrtoul(buf, 10, &val) < 0) |
755 | return -EINVAL; | 778 | return -EINVAL; |
756 | 779 | ||
757 | mutex_lock(&data->update_lock); | 780 | mutex_lock(&data->update_lock); |
758 | old = it87_read_value(data, IT87_REG_FAN_DIV); | 781 | old = it87_read_value(data, IT87_REG_FAN_DIV); |
759 | 782 | ||
760 | /* Save fan min limit */ | 783 | /* Save fan min limit */ |
761 | min = FAN_FROM_REG(data->fan_min[nr], DIV_FROM_REG(data->fan_div[nr])); | 784 | min = FAN_FROM_REG(data->fan_min[nr], DIV_FROM_REG(data->fan_div[nr])); |
762 | 785 | ||
763 | switch (nr) { | 786 | switch (nr) { |
764 | case 0: | 787 | case 0: |
765 | case 1: | 788 | case 1: |
766 | data->fan_div[nr] = DIV_TO_REG(val); | 789 | data->fan_div[nr] = DIV_TO_REG(val); |
767 | break; | 790 | break; |
768 | case 2: | 791 | case 2: |
769 | if (val < 8) | 792 | if (val < 8) |
770 | data->fan_div[nr] = 1; | 793 | data->fan_div[nr] = 1; |
771 | else | 794 | else |
772 | data->fan_div[nr] = 3; | 795 | data->fan_div[nr] = 3; |
773 | } | 796 | } |
774 | val = old & 0x80; | 797 | val = old & 0x80; |
775 | val |= (data->fan_div[0] & 0x07); | 798 | val |= (data->fan_div[0] & 0x07); |
776 | val |= (data->fan_div[1] & 0x07) << 3; | 799 | val |= (data->fan_div[1] & 0x07) << 3; |
777 | if (data->fan_div[2] == 3) | 800 | if (data->fan_div[2] == 3) |
778 | val |= 0x1 << 6; | 801 | val |= 0x1 << 6; |
779 | it87_write_value(data, IT87_REG_FAN_DIV, val); | 802 | it87_write_value(data, IT87_REG_FAN_DIV, val); |
780 | 803 | ||
781 | /* Restore fan min limit */ | 804 | /* Restore fan min limit */ |
782 | data->fan_min[nr] = FAN_TO_REG(min, DIV_FROM_REG(data->fan_div[nr])); | 805 | data->fan_min[nr] = FAN_TO_REG(min, DIV_FROM_REG(data->fan_div[nr])); |
783 | it87_write_value(data, IT87_REG_FAN_MIN[nr], data->fan_min[nr]); | 806 | it87_write_value(data, IT87_REG_FAN_MIN[nr], data->fan_min[nr]); |
784 | 807 | ||
785 | mutex_unlock(&data->update_lock); | 808 | mutex_unlock(&data->update_lock); |
786 | return count; | 809 | return count; |
787 | } | 810 | } |
788 | 811 | ||
789 | /* Returns 0 if OK, -EINVAL otherwise */ | 812 | /* Returns 0 if OK, -EINVAL otherwise */ |
790 | static int check_trip_points(struct device *dev, int nr) | 813 | static int check_trip_points(struct device *dev, int nr) |
791 | { | 814 | { |
792 | const struct it87_data *data = dev_get_drvdata(dev); | 815 | const struct it87_data *data = dev_get_drvdata(dev); |
793 | int i, err = 0; | 816 | int i, err = 0; |
794 | 817 | ||
795 | if (has_old_autopwm(data)) { | 818 | if (has_old_autopwm(data)) { |
796 | for (i = 0; i < 3; i++) { | 819 | for (i = 0; i < 3; i++) { |
797 | if (data->auto_temp[nr][i] > data->auto_temp[nr][i + 1]) | 820 | if (data->auto_temp[nr][i] > data->auto_temp[nr][i + 1]) |
798 | err = -EINVAL; | 821 | err = -EINVAL; |
799 | } | 822 | } |
800 | for (i = 0; i < 2; i++) { | 823 | for (i = 0; i < 2; i++) { |
801 | if (data->auto_pwm[nr][i] > data->auto_pwm[nr][i + 1]) | 824 | if (data->auto_pwm[nr][i] > data->auto_pwm[nr][i + 1]) |
802 | err = -EINVAL; | 825 | err = -EINVAL; |
803 | } | 826 | } |
804 | } | 827 | } |
805 | 828 | ||
806 | if (err) { | 829 | if (err) { |
807 | dev_err(dev, "Inconsistent trip points, not switching to " | 830 | dev_err(dev, "Inconsistent trip points, not switching to " |
808 | "automatic mode\n"); | 831 | "automatic mode\n"); |
809 | dev_err(dev, "Adjust the trip points and try again\n"); | 832 | dev_err(dev, "Adjust the trip points and try again\n"); |
810 | } | 833 | } |
811 | return err; | 834 | return err; |
812 | } | 835 | } |
813 | 836 | ||
814 | static ssize_t set_pwm_enable(struct device *dev, | 837 | static ssize_t set_pwm_enable(struct device *dev, |
815 | struct device_attribute *attr, const char *buf, size_t count) | 838 | struct device_attribute *attr, const char *buf, size_t count) |
816 | { | 839 | { |
817 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); | 840 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); |
818 | int nr = sensor_attr->index; | 841 | int nr = sensor_attr->index; |
819 | 842 | ||
820 | struct it87_data *data = dev_get_drvdata(dev); | 843 | struct it87_data *data = dev_get_drvdata(dev); |
821 | long val; | 844 | long val; |
822 | 845 | ||
823 | if (kstrtol(buf, 10, &val) < 0 || val < 0 || val > 2) | 846 | if (kstrtol(buf, 10, &val) < 0 || val < 0 || val > 2) |
824 | return -EINVAL; | 847 | return -EINVAL; |
825 | 848 | ||
826 | /* Check trip points before switching to automatic mode */ | 849 | /* Check trip points before switching to automatic mode */ |
827 | if (val == 2) { | 850 | if (val == 2) { |
828 | if (check_trip_points(dev, nr) < 0) | 851 | if (check_trip_points(dev, nr) < 0) |
829 | return -EINVAL; | 852 | return -EINVAL; |
830 | } | 853 | } |
831 | 854 | ||
832 | mutex_lock(&data->update_lock); | 855 | mutex_lock(&data->update_lock); |
833 | 856 | ||
834 | if (val == 0) { | 857 | if (val == 0) { |
835 | int tmp; | 858 | int tmp; |
836 | /* make sure the fan is on when in on/off mode */ | 859 | /* make sure the fan is on when in on/off mode */ |
837 | tmp = it87_read_value(data, IT87_REG_FAN_CTL); | 860 | tmp = it87_read_value(data, IT87_REG_FAN_CTL); |
838 | it87_write_value(data, IT87_REG_FAN_CTL, tmp | (1 << nr)); | 861 | it87_write_value(data, IT87_REG_FAN_CTL, tmp | (1 << nr)); |
839 | /* set on/off mode */ | 862 | /* set on/off mode */ |
840 | data->fan_main_ctrl &= ~(1 << nr); | 863 | data->fan_main_ctrl &= ~(1 << nr); |
841 | it87_write_value(data, IT87_REG_FAN_MAIN_CTRL, | 864 | it87_write_value(data, IT87_REG_FAN_MAIN_CTRL, |
842 | data->fan_main_ctrl); | 865 | data->fan_main_ctrl); |
843 | } else { | 866 | } else { |
844 | if (val == 1) /* Manual mode */ | 867 | if (val == 1) /* Manual mode */ |
845 | data->pwm_ctrl[nr] = data->type == it8721 ? | 868 | data->pwm_ctrl[nr] = has_newer_autopwm(data) ? |
846 | data->pwm_temp_map[nr] : | 869 | data->pwm_temp_map[nr] : |
847 | data->pwm_duty[nr]; | 870 | data->pwm_duty[nr]; |
848 | else /* Automatic mode */ | 871 | else /* Automatic mode */ |
849 | data->pwm_ctrl[nr] = 0x80 | data->pwm_temp_map[nr]; | 872 | data->pwm_ctrl[nr] = 0x80 | data->pwm_temp_map[nr]; |
850 | it87_write_value(data, IT87_REG_PWM(nr), data->pwm_ctrl[nr]); | 873 | it87_write_value(data, IT87_REG_PWM(nr), data->pwm_ctrl[nr]); |
851 | /* set SmartGuardian mode */ | 874 | /* set SmartGuardian mode */ |
852 | data->fan_main_ctrl |= (1 << nr); | 875 | data->fan_main_ctrl |= (1 << nr); |
853 | it87_write_value(data, IT87_REG_FAN_MAIN_CTRL, | 876 | it87_write_value(data, IT87_REG_FAN_MAIN_CTRL, |
854 | data->fan_main_ctrl); | 877 | data->fan_main_ctrl); |
855 | } | 878 | } |
856 | 879 | ||
857 | mutex_unlock(&data->update_lock); | 880 | mutex_unlock(&data->update_lock); |
858 | return count; | 881 | return count; |
859 | } | 882 | } |
860 | static ssize_t set_pwm(struct device *dev, struct device_attribute *attr, | 883 | static ssize_t set_pwm(struct device *dev, struct device_attribute *attr, |
861 | const char *buf, size_t count) | 884 | const char *buf, size_t count) |
862 | { | 885 | { |
863 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); | 886 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); |
864 | int nr = sensor_attr->index; | 887 | int nr = sensor_attr->index; |
865 | 888 | ||
866 | struct it87_data *data = dev_get_drvdata(dev); | 889 | struct it87_data *data = dev_get_drvdata(dev); |
867 | long val; | 890 | long val; |
868 | 891 | ||
869 | if (kstrtol(buf, 10, &val) < 0 || val < 0 || val > 255) | 892 | if (kstrtol(buf, 10, &val) < 0 || val < 0 || val > 255) |
870 | return -EINVAL; | 893 | return -EINVAL; |
871 | 894 | ||
872 | mutex_lock(&data->update_lock); | 895 | mutex_lock(&data->update_lock); |
873 | if (data->type == it8721) { | 896 | if (has_newer_autopwm(data)) { |
874 | /* If we are in automatic mode, the PWM duty cycle register | 897 | /* If we are in automatic mode, the PWM duty cycle register |
875 | * is read-only so we can't write the value */ | 898 | * is read-only so we can't write the value */ |
876 | if (data->pwm_ctrl[nr] & 0x80) { | 899 | if (data->pwm_ctrl[nr] & 0x80) { |
877 | mutex_unlock(&data->update_lock); | 900 | mutex_unlock(&data->update_lock); |
878 | return -EBUSY; | 901 | return -EBUSY; |
879 | } | 902 | } |
880 | data->pwm_duty[nr] = pwm_to_reg(data, val); | 903 | data->pwm_duty[nr] = pwm_to_reg(data, val); |
881 | it87_write_value(data, IT87_REG_PWM_DUTY(nr), | 904 | it87_write_value(data, IT87_REG_PWM_DUTY(nr), |
882 | data->pwm_duty[nr]); | 905 | data->pwm_duty[nr]); |
883 | } else { | 906 | } else { |
884 | data->pwm_duty[nr] = pwm_to_reg(data, val); | 907 | data->pwm_duty[nr] = pwm_to_reg(data, val); |
885 | /* If we are in manual mode, write the duty cycle immediately; | 908 | /* If we are in manual mode, write the duty cycle immediately; |
886 | * otherwise, just store it for later use. */ | 909 | * otherwise, just store it for later use. */ |
887 | if (!(data->pwm_ctrl[nr] & 0x80)) { | 910 | if (!(data->pwm_ctrl[nr] & 0x80)) { |
888 | data->pwm_ctrl[nr] = data->pwm_duty[nr]; | 911 | data->pwm_ctrl[nr] = data->pwm_duty[nr]; |
889 | it87_write_value(data, IT87_REG_PWM(nr), | 912 | it87_write_value(data, IT87_REG_PWM(nr), |
890 | data->pwm_ctrl[nr]); | 913 | data->pwm_ctrl[nr]); |
891 | } | 914 | } |
892 | } | 915 | } |
893 | mutex_unlock(&data->update_lock); | 916 | mutex_unlock(&data->update_lock); |
894 | return count; | 917 | return count; |
895 | } | 918 | } |
896 | static ssize_t set_pwm_freq(struct device *dev, | 919 | static ssize_t set_pwm_freq(struct device *dev, |
897 | struct device_attribute *attr, const char *buf, size_t count) | 920 | struct device_attribute *attr, const char *buf, size_t count) |
898 | { | 921 | { |
899 | struct it87_data *data = dev_get_drvdata(dev); | 922 | struct it87_data *data = dev_get_drvdata(dev); |
900 | unsigned long val; | 923 | unsigned long val; |
901 | int i; | 924 | int i; |
902 | 925 | ||
903 | if (kstrtoul(buf, 10, &val) < 0) | 926 | if (kstrtoul(buf, 10, &val) < 0) |
904 | return -EINVAL; | 927 | return -EINVAL; |
905 | 928 | ||
906 | /* Search for the nearest available frequency */ | 929 | /* Search for the nearest available frequency */ |
907 | for (i = 0; i < 7; i++) { | 930 | for (i = 0; i < 7; i++) { |
908 | if (val > (pwm_freq[i] + pwm_freq[i+1]) / 2) | 931 | if (val > (pwm_freq[i] + pwm_freq[i+1]) / 2) |
909 | break; | 932 | break; |
910 | } | 933 | } |
911 | 934 | ||
912 | mutex_lock(&data->update_lock); | 935 | mutex_lock(&data->update_lock); |
913 | data->fan_ctl = it87_read_value(data, IT87_REG_FAN_CTL) & 0x8f; | 936 | data->fan_ctl = it87_read_value(data, IT87_REG_FAN_CTL) & 0x8f; |
914 | data->fan_ctl |= i << 4; | 937 | data->fan_ctl |= i << 4; |
915 | it87_write_value(data, IT87_REG_FAN_CTL, data->fan_ctl); | 938 | it87_write_value(data, IT87_REG_FAN_CTL, data->fan_ctl); |
916 | mutex_unlock(&data->update_lock); | 939 | mutex_unlock(&data->update_lock); |
917 | 940 | ||
918 | return count; | 941 | return count; |
919 | } | 942 | } |
920 | static ssize_t show_pwm_temp_map(struct device *dev, | 943 | static ssize_t show_pwm_temp_map(struct device *dev, |
921 | struct device_attribute *attr, char *buf) | 944 | struct device_attribute *attr, char *buf) |
922 | { | 945 | { |
923 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); | 946 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); |
924 | int nr = sensor_attr->index; | 947 | int nr = sensor_attr->index; |
925 | 948 | ||
926 | struct it87_data *data = it87_update_device(dev); | 949 | struct it87_data *data = it87_update_device(dev); |
927 | int map; | 950 | int map; |
928 | 951 | ||
929 | if (data->pwm_temp_map[nr] < 3) | 952 | if (data->pwm_temp_map[nr] < 3) |
930 | map = 1 << data->pwm_temp_map[nr]; | 953 | map = 1 << data->pwm_temp_map[nr]; |
931 | else | 954 | else |
932 | map = 0; /* Should never happen */ | 955 | map = 0; /* Should never happen */ |
933 | return sprintf(buf, "%d\n", map); | 956 | return sprintf(buf, "%d\n", map); |
934 | } | 957 | } |
935 | static ssize_t set_pwm_temp_map(struct device *dev, | 958 | static ssize_t set_pwm_temp_map(struct device *dev, |
936 | struct device_attribute *attr, const char *buf, size_t count) | 959 | struct device_attribute *attr, const char *buf, size_t count) |
937 | { | 960 | { |
938 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); | 961 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); |
939 | int nr = sensor_attr->index; | 962 | int nr = sensor_attr->index; |
940 | 963 | ||
941 | struct it87_data *data = dev_get_drvdata(dev); | 964 | struct it87_data *data = dev_get_drvdata(dev); |
942 | long val; | 965 | long val; |
943 | u8 reg; | 966 | u8 reg; |
944 | 967 | ||
945 | /* This check can go away if we ever support automatic fan speed | 968 | /* This check can go away if we ever support automatic fan speed |
946 | control on newer chips. */ | 969 | control on newer chips. */ |
947 | if (!has_old_autopwm(data)) { | 970 | if (!has_old_autopwm(data)) { |
948 | dev_notice(dev, "Mapping change disabled for safety reasons\n"); | 971 | dev_notice(dev, "Mapping change disabled for safety reasons\n"); |
949 | return -EINVAL; | 972 | return -EINVAL; |
950 | } | 973 | } |
951 | 974 | ||
952 | if (kstrtol(buf, 10, &val) < 0) | 975 | if (kstrtol(buf, 10, &val) < 0) |
953 | return -EINVAL; | 976 | return -EINVAL; |
954 | 977 | ||
955 | switch (val) { | 978 | switch (val) { |
956 | case (1 << 0): | 979 | case (1 << 0): |
957 | reg = 0x00; | 980 | reg = 0x00; |
958 | break; | 981 | break; |
959 | case (1 << 1): | 982 | case (1 << 1): |
960 | reg = 0x01; | 983 | reg = 0x01; |
961 | break; | 984 | break; |
962 | case (1 << 2): | 985 | case (1 << 2): |
963 | reg = 0x02; | 986 | reg = 0x02; |
964 | break; | 987 | break; |
965 | default: | 988 | default: |
966 | return -EINVAL; | 989 | return -EINVAL; |
967 | } | 990 | } |
968 | 991 | ||
969 | mutex_lock(&data->update_lock); | 992 | mutex_lock(&data->update_lock); |
970 | data->pwm_temp_map[nr] = reg; | 993 | data->pwm_temp_map[nr] = reg; |
971 | /* If we are in automatic mode, write the temp mapping immediately; | 994 | /* If we are in automatic mode, write the temp mapping immediately; |
972 | * otherwise, just store it for later use. */ | 995 | * otherwise, just store it for later use. */ |
973 | if (data->pwm_ctrl[nr] & 0x80) { | 996 | if (data->pwm_ctrl[nr] & 0x80) { |
974 | data->pwm_ctrl[nr] = 0x80 | data->pwm_temp_map[nr]; | 997 | data->pwm_ctrl[nr] = 0x80 | data->pwm_temp_map[nr]; |
975 | it87_write_value(data, IT87_REG_PWM(nr), data->pwm_ctrl[nr]); | 998 | it87_write_value(data, IT87_REG_PWM(nr), data->pwm_ctrl[nr]); |
976 | } | 999 | } |
977 | mutex_unlock(&data->update_lock); | 1000 | mutex_unlock(&data->update_lock); |
978 | return count; | 1001 | return count; |
979 | } | 1002 | } |
980 | 1003 | ||
981 | static ssize_t show_auto_pwm(struct device *dev, | 1004 | static ssize_t show_auto_pwm(struct device *dev, |
982 | struct device_attribute *attr, char *buf) | 1005 | struct device_attribute *attr, char *buf) |
983 | { | 1006 | { |
984 | struct it87_data *data = it87_update_device(dev); | 1007 | struct it87_data *data = it87_update_device(dev); |
985 | struct sensor_device_attribute_2 *sensor_attr = | 1008 | struct sensor_device_attribute_2 *sensor_attr = |
986 | to_sensor_dev_attr_2(attr); | 1009 | to_sensor_dev_attr_2(attr); |
987 | int nr = sensor_attr->nr; | 1010 | int nr = sensor_attr->nr; |
988 | int point = sensor_attr->index; | 1011 | int point = sensor_attr->index; |
989 | 1012 | ||
990 | return sprintf(buf, "%d\n", | 1013 | return sprintf(buf, "%d\n", |
991 | pwm_from_reg(data, data->auto_pwm[nr][point])); | 1014 | pwm_from_reg(data, data->auto_pwm[nr][point])); |
992 | } | 1015 | } |
993 | 1016 | ||
994 | static ssize_t set_auto_pwm(struct device *dev, | 1017 | static ssize_t set_auto_pwm(struct device *dev, |
995 | struct device_attribute *attr, const char *buf, size_t count) | 1018 | struct device_attribute *attr, const char *buf, size_t count) |
996 | { | 1019 | { |
997 | struct it87_data *data = dev_get_drvdata(dev); | 1020 | struct it87_data *data = dev_get_drvdata(dev); |
998 | struct sensor_device_attribute_2 *sensor_attr = | 1021 | struct sensor_device_attribute_2 *sensor_attr = |
999 | to_sensor_dev_attr_2(attr); | 1022 | to_sensor_dev_attr_2(attr); |
1000 | int nr = sensor_attr->nr; | 1023 | int nr = sensor_attr->nr; |
1001 | int point = sensor_attr->index; | 1024 | int point = sensor_attr->index; |
1002 | long val; | 1025 | long val; |
1003 | 1026 | ||
1004 | if (kstrtol(buf, 10, &val) < 0 || val < 0 || val > 255) | 1027 | if (kstrtol(buf, 10, &val) < 0 || val < 0 || val > 255) |
1005 | return -EINVAL; | 1028 | return -EINVAL; |
1006 | 1029 | ||
1007 | mutex_lock(&data->update_lock); | 1030 | mutex_lock(&data->update_lock); |
1008 | data->auto_pwm[nr][point] = pwm_to_reg(data, val); | 1031 | data->auto_pwm[nr][point] = pwm_to_reg(data, val); |
1009 | it87_write_value(data, IT87_REG_AUTO_PWM(nr, point), | 1032 | it87_write_value(data, IT87_REG_AUTO_PWM(nr, point), |
1010 | data->auto_pwm[nr][point]); | 1033 | data->auto_pwm[nr][point]); |
1011 | mutex_unlock(&data->update_lock); | 1034 | mutex_unlock(&data->update_lock); |
1012 | return count; | 1035 | return count; |
1013 | } | 1036 | } |
1014 | 1037 | ||
1015 | static ssize_t show_auto_temp(struct device *dev, | 1038 | static ssize_t show_auto_temp(struct device *dev, |
1016 | struct device_attribute *attr, char *buf) | 1039 | struct device_attribute *attr, char *buf) |
1017 | { | 1040 | { |
1018 | struct it87_data *data = it87_update_device(dev); | 1041 | struct it87_data *data = it87_update_device(dev); |
1019 | struct sensor_device_attribute_2 *sensor_attr = | 1042 | struct sensor_device_attribute_2 *sensor_attr = |
1020 | to_sensor_dev_attr_2(attr); | 1043 | to_sensor_dev_attr_2(attr); |
1021 | int nr = sensor_attr->nr; | 1044 | int nr = sensor_attr->nr; |
1022 | int point = sensor_attr->index; | 1045 | int point = sensor_attr->index; |
1023 | 1046 | ||
1024 | return sprintf(buf, "%d\n", TEMP_FROM_REG(data->auto_temp[nr][point])); | 1047 | return sprintf(buf, "%d\n", TEMP_FROM_REG(data->auto_temp[nr][point])); |
1025 | } | 1048 | } |
1026 | 1049 | ||
1027 | static ssize_t set_auto_temp(struct device *dev, | 1050 | static ssize_t set_auto_temp(struct device *dev, |
1028 | struct device_attribute *attr, const char *buf, size_t count) | 1051 | struct device_attribute *attr, const char *buf, size_t count) |
1029 | { | 1052 | { |
1030 | struct it87_data *data = dev_get_drvdata(dev); | 1053 | struct it87_data *data = dev_get_drvdata(dev); |
1031 | struct sensor_device_attribute_2 *sensor_attr = | 1054 | struct sensor_device_attribute_2 *sensor_attr = |
1032 | to_sensor_dev_attr_2(attr); | 1055 | to_sensor_dev_attr_2(attr); |
1033 | int nr = sensor_attr->nr; | 1056 | int nr = sensor_attr->nr; |
1034 | int point = sensor_attr->index; | 1057 | int point = sensor_attr->index; |
1035 | long val; | 1058 | long val; |
1036 | 1059 | ||
1037 | if (kstrtol(buf, 10, &val) < 0 || val < -128000 || val > 127000) | 1060 | if (kstrtol(buf, 10, &val) < 0 || val < -128000 || val > 127000) |
1038 | return -EINVAL; | 1061 | return -EINVAL; |
1039 | 1062 | ||
1040 | mutex_lock(&data->update_lock); | 1063 | mutex_lock(&data->update_lock); |
1041 | data->auto_temp[nr][point] = TEMP_TO_REG(val); | 1064 | data->auto_temp[nr][point] = TEMP_TO_REG(val); |
1042 | it87_write_value(data, IT87_REG_AUTO_TEMP(nr, point), | 1065 | it87_write_value(data, IT87_REG_AUTO_TEMP(nr, point), |
1043 | data->auto_temp[nr][point]); | 1066 | data->auto_temp[nr][point]); |
1044 | mutex_unlock(&data->update_lock); | 1067 | mutex_unlock(&data->update_lock); |
1045 | return count; | 1068 | return count; |
1046 | } | 1069 | } |
1047 | 1070 | ||
1048 | #define show_fan_offset(offset) \ | 1071 | #define show_fan_offset(offset) \ |
1049 | static SENSOR_DEVICE_ATTR(fan##offset##_input, S_IRUGO, \ | 1072 | static SENSOR_DEVICE_ATTR(fan##offset##_input, S_IRUGO, \ |
1050 | show_fan, NULL, offset - 1); \ | 1073 | show_fan, NULL, offset - 1); \ |
1051 | static SENSOR_DEVICE_ATTR(fan##offset##_min, S_IRUGO | S_IWUSR, \ | 1074 | static SENSOR_DEVICE_ATTR(fan##offset##_min, S_IRUGO | S_IWUSR, \ |
1052 | show_fan_min, set_fan_min, offset - 1); \ | 1075 | show_fan_min, set_fan_min, offset - 1); \ |
1053 | static SENSOR_DEVICE_ATTR(fan##offset##_div, S_IRUGO | S_IWUSR, \ | 1076 | static SENSOR_DEVICE_ATTR(fan##offset##_div, S_IRUGO | S_IWUSR, \ |
1054 | show_fan_div, set_fan_div, offset - 1); | 1077 | show_fan_div, set_fan_div, offset - 1); |
1055 | 1078 | ||
1056 | show_fan_offset(1); | 1079 | show_fan_offset(1); |
1057 | show_fan_offset(2); | 1080 | show_fan_offset(2); |
1058 | show_fan_offset(3); | 1081 | show_fan_offset(3); |
1059 | 1082 | ||
1060 | #define show_pwm_offset(offset) \ | 1083 | #define show_pwm_offset(offset) \ |
1061 | static SENSOR_DEVICE_ATTR(pwm##offset##_enable, S_IRUGO | S_IWUSR, \ | 1084 | static SENSOR_DEVICE_ATTR(pwm##offset##_enable, S_IRUGO | S_IWUSR, \ |
1062 | show_pwm_enable, set_pwm_enable, offset - 1); \ | 1085 | show_pwm_enable, set_pwm_enable, offset - 1); \ |
1063 | static SENSOR_DEVICE_ATTR(pwm##offset, S_IRUGO | S_IWUSR, \ | 1086 | static SENSOR_DEVICE_ATTR(pwm##offset, S_IRUGO | S_IWUSR, \ |
1064 | show_pwm, set_pwm, offset - 1); \ | 1087 | show_pwm, set_pwm, offset - 1); \ |
1065 | static DEVICE_ATTR(pwm##offset##_freq, \ | 1088 | static DEVICE_ATTR(pwm##offset##_freq, \ |
1066 | (offset == 1 ? S_IRUGO | S_IWUSR : S_IRUGO), \ | 1089 | (offset == 1 ? S_IRUGO | S_IWUSR : S_IRUGO), \ |
1067 | show_pwm_freq, (offset == 1 ? set_pwm_freq : NULL)); \ | 1090 | show_pwm_freq, (offset == 1 ? set_pwm_freq : NULL)); \ |
1068 | static SENSOR_DEVICE_ATTR(pwm##offset##_auto_channels_temp, \ | 1091 | static SENSOR_DEVICE_ATTR(pwm##offset##_auto_channels_temp, \ |
1069 | S_IRUGO | S_IWUSR, show_pwm_temp_map, set_pwm_temp_map, \ | 1092 | S_IRUGO | S_IWUSR, show_pwm_temp_map, set_pwm_temp_map, \ |
1070 | offset - 1); \ | 1093 | offset - 1); \ |
1071 | static SENSOR_DEVICE_ATTR_2(pwm##offset##_auto_point1_pwm, \ | 1094 | static SENSOR_DEVICE_ATTR_2(pwm##offset##_auto_point1_pwm, \ |
1072 | S_IRUGO | S_IWUSR, show_auto_pwm, set_auto_pwm, \ | 1095 | S_IRUGO | S_IWUSR, show_auto_pwm, set_auto_pwm, \ |
1073 | offset - 1, 0); \ | 1096 | offset - 1, 0); \ |
1074 | static SENSOR_DEVICE_ATTR_2(pwm##offset##_auto_point2_pwm, \ | 1097 | static SENSOR_DEVICE_ATTR_2(pwm##offset##_auto_point2_pwm, \ |
1075 | S_IRUGO | S_IWUSR, show_auto_pwm, set_auto_pwm, \ | 1098 | S_IRUGO | S_IWUSR, show_auto_pwm, set_auto_pwm, \ |
1076 | offset - 1, 1); \ | 1099 | offset - 1, 1); \ |
1077 | static SENSOR_DEVICE_ATTR_2(pwm##offset##_auto_point3_pwm, \ | 1100 | static SENSOR_DEVICE_ATTR_2(pwm##offset##_auto_point3_pwm, \ |
1078 | S_IRUGO | S_IWUSR, show_auto_pwm, set_auto_pwm, \ | 1101 | S_IRUGO | S_IWUSR, show_auto_pwm, set_auto_pwm, \ |
1079 | offset - 1, 2); \ | 1102 | offset - 1, 2); \ |
1080 | static SENSOR_DEVICE_ATTR_2(pwm##offset##_auto_point4_pwm, \ | 1103 | static SENSOR_DEVICE_ATTR_2(pwm##offset##_auto_point4_pwm, \ |
1081 | S_IRUGO, show_auto_pwm, NULL, offset - 1, 3); \ | 1104 | S_IRUGO, show_auto_pwm, NULL, offset - 1, 3); \ |
1082 | static SENSOR_DEVICE_ATTR_2(pwm##offset##_auto_point1_temp, \ | 1105 | static SENSOR_DEVICE_ATTR_2(pwm##offset##_auto_point1_temp, \ |
1083 | S_IRUGO | S_IWUSR, show_auto_temp, set_auto_temp, \ | 1106 | S_IRUGO | S_IWUSR, show_auto_temp, set_auto_temp, \ |
1084 | offset - 1, 1); \ | 1107 | offset - 1, 1); \ |
1085 | static SENSOR_DEVICE_ATTR_2(pwm##offset##_auto_point1_temp_hyst, \ | 1108 | static SENSOR_DEVICE_ATTR_2(pwm##offset##_auto_point1_temp_hyst, \ |
1086 | S_IRUGO | S_IWUSR, show_auto_temp, set_auto_temp, \ | 1109 | S_IRUGO | S_IWUSR, show_auto_temp, set_auto_temp, \ |
1087 | offset - 1, 0); \ | 1110 | offset - 1, 0); \ |
1088 | static SENSOR_DEVICE_ATTR_2(pwm##offset##_auto_point2_temp, \ | 1111 | static SENSOR_DEVICE_ATTR_2(pwm##offset##_auto_point2_temp, \ |
1089 | S_IRUGO | S_IWUSR, show_auto_temp, set_auto_temp, \ | 1112 | S_IRUGO | S_IWUSR, show_auto_temp, set_auto_temp, \ |
1090 | offset - 1, 2); \ | 1113 | offset - 1, 2); \ |
1091 | static SENSOR_DEVICE_ATTR_2(pwm##offset##_auto_point3_temp, \ | 1114 | static SENSOR_DEVICE_ATTR_2(pwm##offset##_auto_point3_temp, \ |
1092 | S_IRUGO | S_IWUSR, show_auto_temp, set_auto_temp, \ | 1115 | S_IRUGO | S_IWUSR, show_auto_temp, set_auto_temp, \ |
1093 | offset - 1, 3); \ | 1116 | offset - 1, 3); \ |
1094 | static SENSOR_DEVICE_ATTR_2(pwm##offset##_auto_point4_temp, \ | 1117 | static SENSOR_DEVICE_ATTR_2(pwm##offset##_auto_point4_temp, \ |
1095 | S_IRUGO | S_IWUSR, show_auto_temp, set_auto_temp, \ | 1118 | S_IRUGO | S_IWUSR, show_auto_temp, set_auto_temp, \ |
1096 | offset - 1, 4); | 1119 | offset - 1, 4); |
1097 | 1120 | ||
1098 | show_pwm_offset(1); | 1121 | show_pwm_offset(1); |
1099 | show_pwm_offset(2); | 1122 | show_pwm_offset(2); |
1100 | show_pwm_offset(3); | 1123 | show_pwm_offset(3); |
1101 | 1124 | ||
1102 | /* A different set of callbacks for 16-bit fans */ | 1125 | /* A different set of callbacks for 16-bit fans */ |
1103 | static ssize_t show_fan16(struct device *dev, struct device_attribute *attr, | 1126 | static ssize_t show_fan16(struct device *dev, struct device_attribute *attr, |
1104 | char *buf) | 1127 | char *buf) |
1105 | { | 1128 | { |
1106 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); | 1129 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); |
1107 | int nr = sensor_attr->index; | 1130 | int nr = sensor_attr->index; |
1108 | struct it87_data *data = it87_update_device(dev); | 1131 | struct it87_data *data = it87_update_device(dev); |
1109 | return sprintf(buf, "%d\n", FAN16_FROM_REG(data->fan[nr])); | 1132 | return sprintf(buf, "%d\n", FAN16_FROM_REG(data->fan[nr])); |
1110 | } | 1133 | } |
1111 | 1134 | ||
1112 | static ssize_t show_fan16_min(struct device *dev, struct device_attribute *attr, | 1135 | static ssize_t show_fan16_min(struct device *dev, struct device_attribute *attr, |
1113 | char *buf) | 1136 | char *buf) |
1114 | { | 1137 | { |
1115 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); | 1138 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); |
1116 | int nr = sensor_attr->index; | 1139 | int nr = sensor_attr->index; |
1117 | struct it87_data *data = it87_update_device(dev); | 1140 | struct it87_data *data = it87_update_device(dev); |
1118 | return sprintf(buf, "%d\n", FAN16_FROM_REG(data->fan_min[nr])); | 1141 | return sprintf(buf, "%d\n", FAN16_FROM_REG(data->fan_min[nr])); |
1119 | } | 1142 | } |
1120 | 1143 | ||
1121 | static ssize_t set_fan16_min(struct device *dev, struct device_attribute *attr, | 1144 | static ssize_t set_fan16_min(struct device *dev, struct device_attribute *attr, |
1122 | const char *buf, size_t count) | 1145 | const char *buf, size_t count) |
1123 | { | 1146 | { |
1124 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); | 1147 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); |
1125 | int nr = sensor_attr->index; | 1148 | int nr = sensor_attr->index; |
1126 | struct it87_data *data = dev_get_drvdata(dev); | 1149 | struct it87_data *data = dev_get_drvdata(dev); |
1127 | long val; | 1150 | long val; |
1128 | 1151 | ||
1129 | if (kstrtol(buf, 10, &val) < 0) | 1152 | if (kstrtol(buf, 10, &val) < 0) |
1130 | return -EINVAL; | 1153 | return -EINVAL; |
1131 | 1154 | ||
1132 | mutex_lock(&data->update_lock); | 1155 | mutex_lock(&data->update_lock); |
1133 | data->fan_min[nr] = FAN16_TO_REG(val); | 1156 | data->fan_min[nr] = FAN16_TO_REG(val); |
1134 | it87_write_value(data, IT87_REG_FAN_MIN[nr], | 1157 | it87_write_value(data, IT87_REG_FAN_MIN[nr], |
1135 | data->fan_min[nr] & 0xff); | 1158 | data->fan_min[nr] & 0xff); |
1136 | it87_write_value(data, IT87_REG_FANX_MIN[nr], | 1159 | it87_write_value(data, IT87_REG_FANX_MIN[nr], |
1137 | data->fan_min[nr] >> 8); | 1160 | data->fan_min[nr] >> 8); |
1138 | mutex_unlock(&data->update_lock); | 1161 | mutex_unlock(&data->update_lock); |
1139 | return count; | 1162 | return count; |
1140 | } | 1163 | } |
1141 | 1164 | ||
1142 | /* We want to use the same sysfs file names as 8-bit fans, but we need | 1165 | /* We want to use the same sysfs file names as 8-bit fans, but we need |
1143 | different variable names, so we have to use SENSOR_ATTR instead of | 1166 | different variable names, so we have to use SENSOR_ATTR instead of |
1144 | SENSOR_DEVICE_ATTR. */ | 1167 | SENSOR_DEVICE_ATTR. */ |
1145 | #define show_fan16_offset(offset) \ | 1168 | #define show_fan16_offset(offset) \ |
1146 | static struct sensor_device_attribute sensor_dev_attr_fan##offset##_input16 \ | 1169 | static struct sensor_device_attribute sensor_dev_attr_fan##offset##_input16 \ |
1147 | = SENSOR_ATTR(fan##offset##_input, S_IRUGO, \ | 1170 | = SENSOR_ATTR(fan##offset##_input, S_IRUGO, \ |
1148 | show_fan16, NULL, offset - 1); \ | 1171 | show_fan16, NULL, offset - 1); \ |
1149 | static struct sensor_device_attribute sensor_dev_attr_fan##offset##_min16 \ | 1172 | static struct sensor_device_attribute sensor_dev_attr_fan##offset##_min16 \ |
1150 | = SENSOR_ATTR(fan##offset##_min, S_IRUGO | S_IWUSR, \ | 1173 | = SENSOR_ATTR(fan##offset##_min, S_IRUGO | S_IWUSR, \ |
1151 | show_fan16_min, set_fan16_min, offset - 1) | 1174 | show_fan16_min, set_fan16_min, offset - 1) |
1152 | 1175 | ||
1153 | show_fan16_offset(1); | 1176 | show_fan16_offset(1); |
1154 | show_fan16_offset(2); | 1177 | show_fan16_offset(2); |
1155 | show_fan16_offset(3); | 1178 | show_fan16_offset(3); |
1156 | show_fan16_offset(4); | 1179 | show_fan16_offset(4); |
1157 | show_fan16_offset(5); | 1180 | show_fan16_offset(5); |
1158 | 1181 | ||
1159 | /* Alarms */ | 1182 | /* Alarms */ |
1160 | static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, | 1183 | static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, |
1161 | char *buf) | 1184 | char *buf) |
1162 | { | 1185 | { |
1163 | struct it87_data *data = it87_update_device(dev); | 1186 | struct it87_data *data = it87_update_device(dev); |
1164 | return sprintf(buf, "%u\n", data->alarms); | 1187 | return sprintf(buf, "%u\n", data->alarms); |
1165 | } | 1188 | } |
1166 | static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); | 1189 | static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); |
1167 | 1190 | ||
1168 | static ssize_t show_alarm(struct device *dev, struct device_attribute *attr, | 1191 | static ssize_t show_alarm(struct device *dev, struct device_attribute *attr, |
1169 | char *buf) | 1192 | char *buf) |
1170 | { | 1193 | { |
1171 | int bitnr = to_sensor_dev_attr(attr)->index; | 1194 | int bitnr = to_sensor_dev_attr(attr)->index; |
1172 | struct it87_data *data = it87_update_device(dev); | 1195 | struct it87_data *data = it87_update_device(dev); |
1173 | return sprintf(buf, "%u\n", (data->alarms >> bitnr) & 1); | 1196 | return sprintf(buf, "%u\n", (data->alarms >> bitnr) & 1); |
1174 | } | 1197 | } |
1175 | 1198 | ||
1176 | static ssize_t clear_intrusion(struct device *dev, struct device_attribute | 1199 | static ssize_t clear_intrusion(struct device *dev, struct device_attribute |
1177 | *attr, const char *buf, size_t count) | 1200 | *attr, const char *buf, size_t count) |
1178 | { | 1201 | { |
1179 | struct it87_data *data = dev_get_drvdata(dev); | 1202 | struct it87_data *data = dev_get_drvdata(dev); |
1180 | long val; | 1203 | long val; |
1181 | int config; | 1204 | int config; |
1182 | 1205 | ||
1183 | if (kstrtol(buf, 10, &val) < 0 || val != 0) | 1206 | if (kstrtol(buf, 10, &val) < 0 || val != 0) |
1184 | return -EINVAL; | 1207 | return -EINVAL; |
1185 | 1208 | ||
1186 | mutex_lock(&data->update_lock); | 1209 | mutex_lock(&data->update_lock); |
1187 | config = it87_read_value(data, IT87_REG_CONFIG); | 1210 | config = it87_read_value(data, IT87_REG_CONFIG); |
1188 | if (config < 0) { | 1211 | if (config < 0) { |
1189 | count = config; | 1212 | count = config; |
1190 | } else { | 1213 | } else { |
1191 | config |= 1 << 5; | 1214 | config |= 1 << 5; |
1192 | it87_write_value(data, IT87_REG_CONFIG, config); | 1215 | it87_write_value(data, IT87_REG_CONFIG, config); |
1193 | /* Invalidate cache to force re-read */ | 1216 | /* Invalidate cache to force re-read */ |
1194 | data->valid = 0; | 1217 | data->valid = 0; |
1195 | } | 1218 | } |
1196 | mutex_unlock(&data->update_lock); | 1219 | mutex_unlock(&data->update_lock); |
1197 | 1220 | ||
1198 | return count; | 1221 | return count; |
1199 | } | 1222 | } |
1200 | 1223 | ||
1201 | static SENSOR_DEVICE_ATTR(in0_alarm, S_IRUGO, show_alarm, NULL, 8); | 1224 | static SENSOR_DEVICE_ATTR(in0_alarm, S_IRUGO, show_alarm, NULL, 8); |
1202 | static SENSOR_DEVICE_ATTR(in1_alarm, S_IRUGO, show_alarm, NULL, 9); | 1225 | static SENSOR_DEVICE_ATTR(in1_alarm, S_IRUGO, show_alarm, NULL, 9); |
1203 | static SENSOR_DEVICE_ATTR(in2_alarm, S_IRUGO, show_alarm, NULL, 10); | 1226 | static SENSOR_DEVICE_ATTR(in2_alarm, S_IRUGO, show_alarm, NULL, 10); |
1204 | static SENSOR_DEVICE_ATTR(in3_alarm, S_IRUGO, show_alarm, NULL, 11); | 1227 | static SENSOR_DEVICE_ATTR(in3_alarm, S_IRUGO, show_alarm, NULL, 11); |
1205 | static SENSOR_DEVICE_ATTR(in4_alarm, S_IRUGO, show_alarm, NULL, 12); | 1228 | static SENSOR_DEVICE_ATTR(in4_alarm, S_IRUGO, show_alarm, NULL, 12); |
1206 | static SENSOR_DEVICE_ATTR(in5_alarm, S_IRUGO, show_alarm, NULL, 13); | 1229 | static SENSOR_DEVICE_ATTR(in5_alarm, S_IRUGO, show_alarm, NULL, 13); |
1207 | static SENSOR_DEVICE_ATTR(in6_alarm, S_IRUGO, show_alarm, NULL, 14); | 1230 | static SENSOR_DEVICE_ATTR(in6_alarm, S_IRUGO, show_alarm, NULL, 14); |
1208 | static SENSOR_DEVICE_ATTR(in7_alarm, S_IRUGO, show_alarm, NULL, 15); | 1231 | static SENSOR_DEVICE_ATTR(in7_alarm, S_IRUGO, show_alarm, NULL, 15); |
1209 | static SENSOR_DEVICE_ATTR(fan1_alarm, S_IRUGO, show_alarm, NULL, 0); | 1232 | static SENSOR_DEVICE_ATTR(fan1_alarm, S_IRUGO, show_alarm, NULL, 0); |
1210 | static SENSOR_DEVICE_ATTR(fan2_alarm, S_IRUGO, show_alarm, NULL, 1); | 1233 | static SENSOR_DEVICE_ATTR(fan2_alarm, S_IRUGO, show_alarm, NULL, 1); |
1211 | static SENSOR_DEVICE_ATTR(fan3_alarm, S_IRUGO, show_alarm, NULL, 2); | 1234 | static SENSOR_DEVICE_ATTR(fan3_alarm, S_IRUGO, show_alarm, NULL, 2); |
1212 | static SENSOR_DEVICE_ATTR(fan4_alarm, S_IRUGO, show_alarm, NULL, 3); | 1235 | static SENSOR_DEVICE_ATTR(fan4_alarm, S_IRUGO, show_alarm, NULL, 3); |
1213 | static SENSOR_DEVICE_ATTR(fan5_alarm, S_IRUGO, show_alarm, NULL, 6); | 1236 | static SENSOR_DEVICE_ATTR(fan5_alarm, S_IRUGO, show_alarm, NULL, 6); |
1214 | static SENSOR_DEVICE_ATTR(temp1_alarm, S_IRUGO, show_alarm, NULL, 16); | 1237 | static SENSOR_DEVICE_ATTR(temp1_alarm, S_IRUGO, show_alarm, NULL, 16); |
1215 | static SENSOR_DEVICE_ATTR(temp2_alarm, S_IRUGO, show_alarm, NULL, 17); | 1238 | static SENSOR_DEVICE_ATTR(temp2_alarm, S_IRUGO, show_alarm, NULL, 17); |
1216 | static SENSOR_DEVICE_ATTR(temp3_alarm, S_IRUGO, show_alarm, NULL, 18); | 1239 | static SENSOR_DEVICE_ATTR(temp3_alarm, S_IRUGO, show_alarm, NULL, 18); |
1217 | static SENSOR_DEVICE_ATTR(intrusion0_alarm, S_IRUGO | S_IWUSR, | 1240 | static SENSOR_DEVICE_ATTR(intrusion0_alarm, S_IRUGO | S_IWUSR, |
1218 | show_alarm, clear_intrusion, 4); | 1241 | show_alarm, clear_intrusion, 4); |
1219 | 1242 | ||
1220 | static ssize_t show_beep(struct device *dev, struct device_attribute *attr, | 1243 | static ssize_t show_beep(struct device *dev, struct device_attribute *attr, |
1221 | char *buf) | 1244 | char *buf) |
1222 | { | 1245 | { |
1223 | int bitnr = to_sensor_dev_attr(attr)->index; | 1246 | int bitnr = to_sensor_dev_attr(attr)->index; |
1224 | struct it87_data *data = it87_update_device(dev); | 1247 | struct it87_data *data = it87_update_device(dev); |
1225 | return sprintf(buf, "%u\n", (data->beeps >> bitnr) & 1); | 1248 | return sprintf(buf, "%u\n", (data->beeps >> bitnr) & 1); |
1226 | } | 1249 | } |
1227 | static ssize_t set_beep(struct device *dev, struct device_attribute *attr, | 1250 | static ssize_t set_beep(struct device *dev, struct device_attribute *attr, |
1228 | const char *buf, size_t count) | 1251 | const char *buf, size_t count) |
1229 | { | 1252 | { |
1230 | int bitnr = to_sensor_dev_attr(attr)->index; | 1253 | int bitnr = to_sensor_dev_attr(attr)->index; |
1231 | struct it87_data *data = dev_get_drvdata(dev); | 1254 | struct it87_data *data = dev_get_drvdata(dev); |
1232 | long val; | 1255 | long val; |
1233 | 1256 | ||
1234 | if (kstrtol(buf, 10, &val) < 0 | 1257 | if (kstrtol(buf, 10, &val) < 0 |
1235 | || (val != 0 && val != 1)) | 1258 | || (val != 0 && val != 1)) |
1236 | return -EINVAL; | 1259 | return -EINVAL; |
1237 | 1260 | ||
1238 | mutex_lock(&data->update_lock); | 1261 | mutex_lock(&data->update_lock); |
1239 | data->beeps = it87_read_value(data, IT87_REG_BEEP_ENABLE); | 1262 | data->beeps = it87_read_value(data, IT87_REG_BEEP_ENABLE); |
1240 | if (val) | 1263 | if (val) |
1241 | data->beeps |= (1 << bitnr); | 1264 | data->beeps |= (1 << bitnr); |
1242 | else | 1265 | else |
1243 | data->beeps &= ~(1 << bitnr); | 1266 | data->beeps &= ~(1 << bitnr); |
1244 | it87_write_value(data, IT87_REG_BEEP_ENABLE, data->beeps); | 1267 | it87_write_value(data, IT87_REG_BEEP_ENABLE, data->beeps); |
1245 | mutex_unlock(&data->update_lock); | 1268 | mutex_unlock(&data->update_lock); |
1246 | return count; | 1269 | return count; |
1247 | } | 1270 | } |
1248 | 1271 | ||
1249 | static SENSOR_DEVICE_ATTR(in0_beep, S_IRUGO | S_IWUSR, | 1272 | static SENSOR_DEVICE_ATTR(in0_beep, S_IRUGO | S_IWUSR, |
1250 | show_beep, set_beep, 1); | 1273 | show_beep, set_beep, 1); |
1251 | static SENSOR_DEVICE_ATTR(in1_beep, S_IRUGO, show_beep, NULL, 1); | 1274 | static SENSOR_DEVICE_ATTR(in1_beep, S_IRUGO, show_beep, NULL, 1); |
1252 | static SENSOR_DEVICE_ATTR(in2_beep, S_IRUGO, show_beep, NULL, 1); | 1275 | static SENSOR_DEVICE_ATTR(in2_beep, S_IRUGO, show_beep, NULL, 1); |
1253 | static SENSOR_DEVICE_ATTR(in3_beep, S_IRUGO, show_beep, NULL, 1); | 1276 | static SENSOR_DEVICE_ATTR(in3_beep, S_IRUGO, show_beep, NULL, 1); |
1254 | static SENSOR_DEVICE_ATTR(in4_beep, S_IRUGO, show_beep, NULL, 1); | 1277 | static SENSOR_DEVICE_ATTR(in4_beep, S_IRUGO, show_beep, NULL, 1); |
1255 | static SENSOR_DEVICE_ATTR(in5_beep, S_IRUGO, show_beep, NULL, 1); | 1278 | static SENSOR_DEVICE_ATTR(in5_beep, S_IRUGO, show_beep, NULL, 1); |
1256 | static SENSOR_DEVICE_ATTR(in6_beep, S_IRUGO, show_beep, NULL, 1); | 1279 | static SENSOR_DEVICE_ATTR(in6_beep, S_IRUGO, show_beep, NULL, 1); |
1257 | static SENSOR_DEVICE_ATTR(in7_beep, S_IRUGO, show_beep, NULL, 1); | 1280 | static SENSOR_DEVICE_ATTR(in7_beep, S_IRUGO, show_beep, NULL, 1); |
1258 | /* fanX_beep writability is set later */ | 1281 | /* fanX_beep writability is set later */ |
1259 | static SENSOR_DEVICE_ATTR(fan1_beep, S_IRUGO, show_beep, set_beep, 0); | 1282 | static SENSOR_DEVICE_ATTR(fan1_beep, S_IRUGO, show_beep, set_beep, 0); |
1260 | static SENSOR_DEVICE_ATTR(fan2_beep, S_IRUGO, show_beep, set_beep, 0); | 1283 | static SENSOR_DEVICE_ATTR(fan2_beep, S_IRUGO, show_beep, set_beep, 0); |
1261 | static SENSOR_DEVICE_ATTR(fan3_beep, S_IRUGO, show_beep, set_beep, 0); | 1284 | static SENSOR_DEVICE_ATTR(fan3_beep, S_IRUGO, show_beep, set_beep, 0); |
1262 | static SENSOR_DEVICE_ATTR(fan4_beep, S_IRUGO, show_beep, set_beep, 0); | 1285 | static SENSOR_DEVICE_ATTR(fan4_beep, S_IRUGO, show_beep, set_beep, 0); |
1263 | static SENSOR_DEVICE_ATTR(fan5_beep, S_IRUGO, show_beep, set_beep, 0); | 1286 | static SENSOR_DEVICE_ATTR(fan5_beep, S_IRUGO, show_beep, set_beep, 0); |
1264 | static SENSOR_DEVICE_ATTR(temp1_beep, S_IRUGO | S_IWUSR, | 1287 | static SENSOR_DEVICE_ATTR(temp1_beep, S_IRUGO | S_IWUSR, |
1265 | show_beep, set_beep, 2); | 1288 | show_beep, set_beep, 2); |
1266 | static SENSOR_DEVICE_ATTR(temp2_beep, S_IRUGO, show_beep, NULL, 2); | 1289 | static SENSOR_DEVICE_ATTR(temp2_beep, S_IRUGO, show_beep, NULL, 2); |
1267 | static SENSOR_DEVICE_ATTR(temp3_beep, S_IRUGO, show_beep, NULL, 2); | 1290 | static SENSOR_DEVICE_ATTR(temp3_beep, S_IRUGO, show_beep, NULL, 2); |
1268 | 1291 | ||
1269 | static ssize_t show_vrm_reg(struct device *dev, struct device_attribute *attr, | 1292 | static ssize_t show_vrm_reg(struct device *dev, struct device_attribute *attr, |
1270 | char *buf) | 1293 | char *buf) |
1271 | { | 1294 | { |
1272 | struct it87_data *data = dev_get_drvdata(dev); | 1295 | struct it87_data *data = dev_get_drvdata(dev); |
1273 | return sprintf(buf, "%u\n", data->vrm); | 1296 | return sprintf(buf, "%u\n", data->vrm); |
1274 | } | 1297 | } |
1275 | static ssize_t store_vrm_reg(struct device *dev, struct device_attribute *attr, | 1298 | static ssize_t store_vrm_reg(struct device *dev, struct device_attribute *attr, |
1276 | const char *buf, size_t count) | 1299 | const char *buf, size_t count) |
1277 | { | 1300 | { |
1278 | struct it87_data *data = dev_get_drvdata(dev); | 1301 | struct it87_data *data = dev_get_drvdata(dev); |
1279 | unsigned long val; | 1302 | unsigned long val; |
1280 | 1303 | ||
1281 | if (kstrtoul(buf, 10, &val) < 0) | 1304 | if (kstrtoul(buf, 10, &val) < 0) |
1282 | return -EINVAL; | 1305 | return -EINVAL; |
1283 | 1306 | ||
1284 | data->vrm = val; | 1307 | data->vrm = val; |
1285 | 1308 | ||
1286 | return count; | 1309 | return count; |
1287 | } | 1310 | } |
1288 | static DEVICE_ATTR(vrm, S_IRUGO | S_IWUSR, show_vrm_reg, store_vrm_reg); | 1311 | static DEVICE_ATTR(vrm, S_IRUGO | S_IWUSR, show_vrm_reg, store_vrm_reg); |
1289 | 1312 | ||
1290 | static ssize_t show_vid_reg(struct device *dev, struct device_attribute *attr, | 1313 | static ssize_t show_vid_reg(struct device *dev, struct device_attribute *attr, |
1291 | char *buf) | 1314 | char *buf) |
1292 | { | 1315 | { |
1293 | struct it87_data *data = it87_update_device(dev); | 1316 | struct it87_data *data = it87_update_device(dev); |
1294 | return sprintf(buf, "%ld\n", (long) vid_from_reg(data->vid, data->vrm)); | 1317 | return sprintf(buf, "%ld\n", (long) vid_from_reg(data->vid, data->vrm)); |
1295 | } | 1318 | } |
1296 | static DEVICE_ATTR(cpu0_vid, S_IRUGO, show_vid_reg, NULL); | 1319 | static DEVICE_ATTR(cpu0_vid, S_IRUGO, show_vid_reg, NULL); |
1297 | 1320 | ||
1298 | static ssize_t show_label(struct device *dev, struct device_attribute *attr, | 1321 | static ssize_t show_label(struct device *dev, struct device_attribute *attr, |
1299 | char *buf) | 1322 | char *buf) |
1300 | { | 1323 | { |
1301 | static const char *labels[] = { | 1324 | static const char *labels[] = { |
1302 | "+5V", | 1325 | "+5V", |
1303 | "5VSB", | 1326 | "5VSB", |
1304 | "Vbat", | 1327 | "Vbat", |
1305 | }; | 1328 | }; |
1306 | static const char *labels_it8721[] = { | 1329 | static const char *labels_it8721[] = { |
1307 | "+3.3V", | 1330 | "+3.3V", |
1308 | "3VSB", | 1331 | "3VSB", |
1309 | "Vbat", | 1332 | "Vbat", |
1310 | }; | 1333 | }; |
1311 | struct it87_data *data = dev_get_drvdata(dev); | 1334 | struct it87_data *data = dev_get_drvdata(dev); |
1312 | int nr = to_sensor_dev_attr(attr)->index; | 1335 | int nr = to_sensor_dev_attr(attr)->index; |
1313 | 1336 | ||
1314 | return sprintf(buf, "%s\n", data->type == it8721 ? labels_it8721[nr] | 1337 | return sprintf(buf, "%s\n", has_12mv_adc(data) ? labels_it8721[nr] |
1315 | : labels[nr]); | 1338 | : labels[nr]); |
1316 | } | 1339 | } |
1317 | static SENSOR_DEVICE_ATTR(in3_label, S_IRUGO, show_label, NULL, 0); | 1340 | static SENSOR_DEVICE_ATTR(in3_label, S_IRUGO, show_label, NULL, 0); |
1318 | static SENSOR_DEVICE_ATTR(in7_label, S_IRUGO, show_label, NULL, 1); | 1341 | static SENSOR_DEVICE_ATTR(in7_label, S_IRUGO, show_label, NULL, 1); |
1319 | static SENSOR_DEVICE_ATTR(in8_label, S_IRUGO, show_label, NULL, 2); | 1342 | static SENSOR_DEVICE_ATTR(in8_label, S_IRUGO, show_label, NULL, 2); |
1320 | 1343 | ||
1321 | static ssize_t show_name(struct device *dev, struct device_attribute | 1344 | static ssize_t show_name(struct device *dev, struct device_attribute |
1322 | *devattr, char *buf) | 1345 | *devattr, char *buf) |
1323 | { | 1346 | { |
1324 | struct it87_data *data = dev_get_drvdata(dev); | 1347 | struct it87_data *data = dev_get_drvdata(dev); |
1325 | return sprintf(buf, "%s\n", data->name); | 1348 | return sprintf(buf, "%s\n", data->name); |
1326 | } | 1349 | } |
1327 | static DEVICE_ATTR(name, S_IRUGO, show_name, NULL); | 1350 | static DEVICE_ATTR(name, S_IRUGO, show_name, NULL); |
1328 | 1351 | ||
1329 | static struct attribute *it87_attributes[] = { | 1352 | static struct attribute *it87_attributes[] = { |
1330 | &sensor_dev_attr_in0_input.dev_attr.attr, | 1353 | &sensor_dev_attr_in0_input.dev_attr.attr, |
1331 | &sensor_dev_attr_in1_input.dev_attr.attr, | 1354 | &sensor_dev_attr_in1_input.dev_attr.attr, |
1332 | &sensor_dev_attr_in2_input.dev_attr.attr, | 1355 | &sensor_dev_attr_in2_input.dev_attr.attr, |
1333 | &sensor_dev_attr_in3_input.dev_attr.attr, | 1356 | &sensor_dev_attr_in3_input.dev_attr.attr, |
1334 | &sensor_dev_attr_in4_input.dev_attr.attr, | 1357 | &sensor_dev_attr_in4_input.dev_attr.attr, |
1335 | &sensor_dev_attr_in5_input.dev_attr.attr, | 1358 | &sensor_dev_attr_in5_input.dev_attr.attr, |
1336 | &sensor_dev_attr_in6_input.dev_attr.attr, | 1359 | &sensor_dev_attr_in6_input.dev_attr.attr, |
1337 | &sensor_dev_attr_in7_input.dev_attr.attr, | 1360 | &sensor_dev_attr_in7_input.dev_attr.attr, |
1338 | &sensor_dev_attr_in8_input.dev_attr.attr, | 1361 | &sensor_dev_attr_in8_input.dev_attr.attr, |
1339 | &sensor_dev_attr_in0_min.dev_attr.attr, | 1362 | &sensor_dev_attr_in0_min.dev_attr.attr, |
1340 | &sensor_dev_attr_in1_min.dev_attr.attr, | 1363 | &sensor_dev_attr_in1_min.dev_attr.attr, |
1341 | &sensor_dev_attr_in2_min.dev_attr.attr, | 1364 | &sensor_dev_attr_in2_min.dev_attr.attr, |
1342 | &sensor_dev_attr_in3_min.dev_attr.attr, | 1365 | &sensor_dev_attr_in3_min.dev_attr.attr, |
1343 | &sensor_dev_attr_in4_min.dev_attr.attr, | 1366 | &sensor_dev_attr_in4_min.dev_attr.attr, |
1344 | &sensor_dev_attr_in5_min.dev_attr.attr, | 1367 | &sensor_dev_attr_in5_min.dev_attr.attr, |
1345 | &sensor_dev_attr_in6_min.dev_attr.attr, | 1368 | &sensor_dev_attr_in6_min.dev_attr.attr, |
1346 | &sensor_dev_attr_in7_min.dev_attr.attr, | 1369 | &sensor_dev_attr_in7_min.dev_attr.attr, |
1347 | &sensor_dev_attr_in0_max.dev_attr.attr, | 1370 | &sensor_dev_attr_in0_max.dev_attr.attr, |
1348 | &sensor_dev_attr_in1_max.dev_attr.attr, | 1371 | &sensor_dev_attr_in1_max.dev_attr.attr, |
1349 | &sensor_dev_attr_in2_max.dev_attr.attr, | 1372 | &sensor_dev_attr_in2_max.dev_attr.attr, |
1350 | &sensor_dev_attr_in3_max.dev_attr.attr, | 1373 | &sensor_dev_attr_in3_max.dev_attr.attr, |
1351 | &sensor_dev_attr_in4_max.dev_attr.attr, | 1374 | &sensor_dev_attr_in4_max.dev_attr.attr, |
1352 | &sensor_dev_attr_in5_max.dev_attr.attr, | 1375 | &sensor_dev_attr_in5_max.dev_attr.attr, |
1353 | &sensor_dev_attr_in6_max.dev_attr.attr, | 1376 | &sensor_dev_attr_in6_max.dev_attr.attr, |
1354 | &sensor_dev_attr_in7_max.dev_attr.attr, | 1377 | &sensor_dev_attr_in7_max.dev_attr.attr, |
1355 | &sensor_dev_attr_in0_alarm.dev_attr.attr, | 1378 | &sensor_dev_attr_in0_alarm.dev_attr.attr, |
1356 | &sensor_dev_attr_in1_alarm.dev_attr.attr, | 1379 | &sensor_dev_attr_in1_alarm.dev_attr.attr, |
1357 | &sensor_dev_attr_in2_alarm.dev_attr.attr, | 1380 | &sensor_dev_attr_in2_alarm.dev_attr.attr, |
1358 | &sensor_dev_attr_in3_alarm.dev_attr.attr, | 1381 | &sensor_dev_attr_in3_alarm.dev_attr.attr, |
1359 | &sensor_dev_attr_in4_alarm.dev_attr.attr, | 1382 | &sensor_dev_attr_in4_alarm.dev_attr.attr, |
1360 | &sensor_dev_attr_in5_alarm.dev_attr.attr, | 1383 | &sensor_dev_attr_in5_alarm.dev_attr.attr, |
1361 | &sensor_dev_attr_in6_alarm.dev_attr.attr, | 1384 | &sensor_dev_attr_in6_alarm.dev_attr.attr, |
1362 | &sensor_dev_attr_in7_alarm.dev_attr.attr, | 1385 | &sensor_dev_attr_in7_alarm.dev_attr.attr, |
1363 | 1386 | ||
1364 | &sensor_dev_attr_temp1_input.dev_attr.attr, | 1387 | &sensor_dev_attr_temp1_input.dev_attr.attr, |
1365 | &sensor_dev_attr_temp2_input.dev_attr.attr, | 1388 | &sensor_dev_attr_temp2_input.dev_attr.attr, |
1366 | &sensor_dev_attr_temp3_input.dev_attr.attr, | 1389 | &sensor_dev_attr_temp3_input.dev_attr.attr, |
1367 | &sensor_dev_attr_temp1_max.dev_attr.attr, | 1390 | &sensor_dev_attr_temp1_max.dev_attr.attr, |
1368 | &sensor_dev_attr_temp2_max.dev_attr.attr, | 1391 | &sensor_dev_attr_temp2_max.dev_attr.attr, |
1369 | &sensor_dev_attr_temp3_max.dev_attr.attr, | 1392 | &sensor_dev_attr_temp3_max.dev_attr.attr, |
1370 | &sensor_dev_attr_temp1_min.dev_attr.attr, | 1393 | &sensor_dev_attr_temp1_min.dev_attr.attr, |
1371 | &sensor_dev_attr_temp2_min.dev_attr.attr, | 1394 | &sensor_dev_attr_temp2_min.dev_attr.attr, |
1372 | &sensor_dev_attr_temp3_min.dev_attr.attr, | 1395 | &sensor_dev_attr_temp3_min.dev_attr.attr, |
1373 | &sensor_dev_attr_temp1_type.dev_attr.attr, | 1396 | &sensor_dev_attr_temp1_type.dev_attr.attr, |
1374 | &sensor_dev_attr_temp2_type.dev_attr.attr, | 1397 | &sensor_dev_attr_temp2_type.dev_attr.attr, |
1375 | &sensor_dev_attr_temp3_type.dev_attr.attr, | 1398 | &sensor_dev_attr_temp3_type.dev_attr.attr, |
1376 | &sensor_dev_attr_temp1_alarm.dev_attr.attr, | 1399 | &sensor_dev_attr_temp1_alarm.dev_attr.attr, |
1377 | &sensor_dev_attr_temp2_alarm.dev_attr.attr, | 1400 | &sensor_dev_attr_temp2_alarm.dev_attr.attr, |
1378 | &sensor_dev_attr_temp3_alarm.dev_attr.attr, | 1401 | &sensor_dev_attr_temp3_alarm.dev_attr.attr, |
1379 | 1402 | ||
1380 | &dev_attr_alarms.attr, | 1403 | &dev_attr_alarms.attr, |
1381 | &sensor_dev_attr_intrusion0_alarm.dev_attr.attr, | 1404 | &sensor_dev_attr_intrusion0_alarm.dev_attr.attr, |
1382 | &dev_attr_name.attr, | 1405 | &dev_attr_name.attr, |
1383 | NULL | 1406 | NULL |
1384 | }; | 1407 | }; |
1385 | 1408 | ||
1386 | static const struct attribute_group it87_group = { | 1409 | static const struct attribute_group it87_group = { |
1387 | .attrs = it87_attributes, | 1410 | .attrs = it87_attributes, |
1388 | }; | 1411 | }; |
1389 | 1412 | ||
1390 | static struct attribute *it87_attributes_beep[] = { | 1413 | static struct attribute *it87_attributes_beep[] = { |
1391 | &sensor_dev_attr_in0_beep.dev_attr.attr, | 1414 | &sensor_dev_attr_in0_beep.dev_attr.attr, |
1392 | &sensor_dev_attr_in1_beep.dev_attr.attr, | 1415 | &sensor_dev_attr_in1_beep.dev_attr.attr, |
1393 | &sensor_dev_attr_in2_beep.dev_attr.attr, | 1416 | &sensor_dev_attr_in2_beep.dev_attr.attr, |
1394 | &sensor_dev_attr_in3_beep.dev_attr.attr, | 1417 | &sensor_dev_attr_in3_beep.dev_attr.attr, |
1395 | &sensor_dev_attr_in4_beep.dev_attr.attr, | 1418 | &sensor_dev_attr_in4_beep.dev_attr.attr, |
1396 | &sensor_dev_attr_in5_beep.dev_attr.attr, | 1419 | &sensor_dev_attr_in5_beep.dev_attr.attr, |
1397 | &sensor_dev_attr_in6_beep.dev_attr.attr, | 1420 | &sensor_dev_attr_in6_beep.dev_attr.attr, |
1398 | &sensor_dev_attr_in7_beep.dev_attr.attr, | 1421 | &sensor_dev_attr_in7_beep.dev_attr.attr, |
1399 | 1422 | ||
1400 | &sensor_dev_attr_temp1_beep.dev_attr.attr, | 1423 | &sensor_dev_attr_temp1_beep.dev_attr.attr, |
1401 | &sensor_dev_attr_temp2_beep.dev_attr.attr, | 1424 | &sensor_dev_attr_temp2_beep.dev_attr.attr, |
1402 | &sensor_dev_attr_temp3_beep.dev_attr.attr, | 1425 | &sensor_dev_attr_temp3_beep.dev_attr.attr, |
1403 | NULL | 1426 | NULL |
1404 | }; | 1427 | }; |
1405 | 1428 | ||
1406 | static const struct attribute_group it87_group_beep = { | 1429 | static const struct attribute_group it87_group_beep = { |
1407 | .attrs = it87_attributes_beep, | 1430 | .attrs = it87_attributes_beep, |
1408 | }; | 1431 | }; |
1409 | 1432 | ||
1410 | static struct attribute *it87_attributes_fan16[5][3+1] = { { | 1433 | static struct attribute *it87_attributes_fan16[5][3+1] = { { |
1411 | &sensor_dev_attr_fan1_input16.dev_attr.attr, | 1434 | &sensor_dev_attr_fan1_input16.dev_attr.attr, |
1412 | &sensor_dev_attr_fan1_min16.dev_attr.attr, | 1435 | &sensor_dev_attr_fan1_min16.dev_attr.attr, |
1413 | &sensor_dev_attr_fan1_alarm.dev_attr.attr, | 1436 | &sensor_dev_attr_fan1_alarm.dev_attr.attr, |
1414 | NULL | 1437 | NULL |
1415 | }, { | 1438 | }, { |
1416 | &sensor_dev_attr_fan2_input16.dev_attr.attr, | 1439 | &sensor_dev_attr_fan2_input16.dev_attr.attr, |
1417 | &sensor_dev_attr_fan2_min16.dev_attr.attr, | 1440 | &sensor_dev_attr_fan2_min16.dev_attr.attr, |
1418 | &sensor_dev_attr_fan2_alarm.dev_attr.attr, | 1441 | &sensor_dev_attr_fan2_alarm.dev_attr.attr, |
1419 | NULL | 1442 | NULL |
1420 | }, { | 1443 | }, { |
1421 | &sensor_dev_attr_fan3_input16.dev_attr.attr, | 1444 | &sensor_dev_attr_fan3_input16.dev_attr.attr, |
1422 | &sensor_dev_attr_fan3_min16.dev_attr.attr, | 1445 | &sensor_dev_attr_fan3_min16.dev_attr.attr, |
1423 | &sensor_dev_attr_fan3_alarm.dev_attr.attr, | 1446 | &sensor_dev_attr_fan3_alarm.dev_attr.attr, |
1424 | NULL | 1447 | NULL |
1425 | }, { | 1448 | }, { |
1426 | &sensor_dev_attr_fan4_input16.dev_attr.attr, | 1449 | &sensor_dev_attr_fan4_input16.dev_attr.attr, |
1427 | &sensor_dev_attr_fan4_min16.dev_attr.attr, | 1450 | &sensor_dev_attr_fan4_min16.dev_attr.attr, |
1428 | &sensor_dev_attr_fan4_alarm.dev_attr.attr, | 1451 | &sensor_dev_attr_fan4_alarm.dev_attr.attr, |
1429 | NULL | 1452 | NULL |
1430 | }, { | 1453 | }, { |
1431 | &sensor_dev_attr_fan5_input16.dev_attr.attr, | 1454 | &sensor_dev_attr_fan5_input16.dev_attr.attr, |
1432 | &sensor_dev_attr_fan5_min16.dev_attr.attr, | 1455 | &sensor_dev_attr_fan5_min16.dev_attr.attr, |
1433 | &sensor_dev_attr_fan5_alarm.dev_attr.attr, | 1456 | &sensor_dev_attr_fan5_alarm.dev_attr.attr, |
1434 | NULL | 1457 | NULL |
1435 | } }; | 1458 | } }; |
1436 | 1459 | ||
1437 | static const struct attribute_group it87_group_fan16[5] = { | 1460 | static const struct attribute_group it87_group_fan16[5] = { |
1438 | { .attrs = it87_attributes_fan16[0] }, | 1461 | { .attrs = it87_attributes_fan16[0] }, |
1439 | { .attrs = it87_attributes_fan16[1] }, | 1462 | { .attrs = it87_attributes_fan16[1] }, |
1440 | { .attrs = it87_attributes_fan16[2] }, | 1463 | { .attrs = it87_attributes_fan16[2] }, |
1441 | { .attrs = it87_attributes_fan16[3] }, | 1464 | { .attrs = it87_attributes_fan16[3] }, |
1442 | { .attrs = it87_attributes_fan16[4] }, | 1465 | { .attrs = it87_attributes_fan16[4] }, |
1443 | }; | 1466 | }; |
1444 | 1467 | ||
1445 | static struct attribute *it87_attributes_fan[3][4+1] = { { | 1468 | static struct attribute *it87_attributes_fan[3][4+1] = { { |
1446 | &sensor_dev_attr_fan1_input.dev_attr.attr, | 1469 | &sensor_dev_attr_fan1_input.dev_attr.attr, |
1447 | &sensor_dev_attr_fan1_min.dev_attr.attr, | 1470 | &sensor_dev_attr_fan1_min.dev_attr.attr, |
1448 | &sensor_dev_attr_fan1_div.dev_attr.attr, | 1471 | &sensor_dev_attr_fan1_div.dev_attr.attr, |
1449 | &sensor_dev_attr_fan1_alarm.dev_attr.attr, | 1472 | &sensor_dev_attr_fan1_alarm.dev_attr.attr, |
1450 | NULL | 1473 | NULL |
1451 | }, { | 1474 | }, { |
1452 | &sensor_dev_attr_fan2_input.dev_attr.attr, | 1475 | &sensor_dev_attr_fan2_input.dev_attr.attr, |
1453 | &sensor_dev_attr_fan2_min.dev_attr.attr, | 1476 | &sensor_dev_attr_fan2_min.dev_attr.attr, |
1454 | &sensor_dev_attr_fan2_div.dev_attr.attr, | 1477 | &sensor_dev_attr_fan2_div.dev_attr.attr, |
1455 | &sensor_dev_attr_fan2_alarm.dev_attr.attr, | 1478 | &sensor_dev_attr_fan2_alarm.dev_attr.attr, |
1456 | NULL | 1479 | NULL |
1457 | }, { | 1480 | }, { |
1458 | &sensor_dev_attr_fan3_input.dev_attr.attr, | 1481 | &sensor_dev_attr_fan3_input.dev_attr.attr, |
1459 | &sensor_dev_attr_fan3_min.dev_attr.attr, | 1482 | &sensor_dev_attr_fan3_min.dev_attr.attr, |
1460 | &sensor_dev_attr_fan3_div.dev_attr.attr, | 1483 | &sensor_dev_attr_fan3_div.dev_attr.attr, |
1461 | &sensor_dev_attr_fan3_alarm.dev_attr.attr, | 1484 | &sensor_dev_attr_fan3_alarm.dev_attr.attr, |
1462 | NULL | 1485 | NULL |
1463 | } }; | 1486 | } }; |
1464 | 1487 | ||
1465 | static const struct attribute_group it87_group_fan[3] = { | 1488 | static const struct attribute_group it87_group_fan[3] = { |
1466 | { .attrs = it87_attributes_fan[0] }, | 1489 | { .attrs = it87_attributes_fan[0] }, |
1467 | { .attrs = it87_attributes_fan[1] }, | 1490 | { .attrs = it87_attributes_fan[1] }, |
1468 | { .attrs = it87_attributes_fan[2] }, | 1491 | { .attrs = it87_attributes_fan[2] }, |
1469 | }; | 1492 | }; |
1470 | 1493 | ||
1471 | static const struct attribute_group * | 1494 | static const struct attribute_group * |
1472 | it87_get_fan_group(const struct it87_data *data) | 1495 | it87_get_fan_group(const struct it87_data *data) |
1473 | { | 1496 | { |
1474 | return has_16bit_fans(data) ? it87_group_fan16 : it87_group_fan; | 1497 | return has_16bit_fans(data) ? it87_group_fan16 : it87_group_fan; |
1475 | } | 1498 | } |
1476 | 1499 | ||
1477 | static struct attribute *it87_attributes_pwm[3][4+1] = { { | 1500 | static struct attribute *it87_attributes_pwm[3][4+1] = { { |
1478 | &sensor_dev_attr_pwm1_enable.dev_attr.attr, | 1501 | &sensor_dev_attr_pwm1_enable.dev_attr.attr, |
1479 | &sensor_dev_attr_pwm1.dev_attr.attr, | 1502 | &sensor_dev_attr_pwm1.dev_attr.attr, |
1480 | &dev_attr_pwm1_freq.attr, | 1503 | &dev_attr_pwm1_freq.attr, |
1481 | &sensor_dev_attr_pwm1_auto_channels_temp.dev_attr.attr, | 1504 | &sensor_dev_attr_pwm1_auto_channels_temp.dev_attr.attr, |
1482 | NULL | 1505 | NULL |
1483 | }, { | 1506 | }, { |
1484 | &sensor_dev_attr_pwm2_enable.dev_attr.attr, | 1507 | &sensor_dev_attr_pwm2_enable.dev_attr.attr, |
1485 | &sensor_dev_attr_pwm2.dev_attr.attr, | 1508 | &sensor_dev_attr_pwm2.dev_attr.attr, |
1486 | &dev_attr_pwm2_freq.attr, | 1509 | &dev_attr_pwm2_freq.attr, |
1487 | &sensor_dev_attr_pwm2_auto_channels_temp.dev_attr.attr, | 1510 | &sensor_dev_attr_pwm2_auto_channels_temp.dev_attr.attr, |
1488 | NULL | 1511 | NULL |
1489 | }, { | 1512 | }, { |
1490 | &sensor_dev_attr_pwm3_enable.dev_attr.attr, | 1513 | &sensor_dev_attr_pwm3_enable.dev_attr.attr, |
1491 | &sensor_dev_attr_pwm3.dev_attr.attr, | 1514 | &sensor_dev_attr_pwm3.dev_attr.attr, |
1492 | &dev_attr_pwm3_freq.attr, | 1515 | &dev_attr_pwm3_freq.attr, |
1493 | &sensor_dev_attr_pwm3_auto_channels_temp.dev_attr.attr, | 1516 | &sensor_dev_attr_pwm3_auto_channels_temp.dev_attr.attr, |
1494 | NULL | 1517 | NULL |
1495 | } }; | 1518 | } }; |
1496 | 1519 | ||
1497 | static const struct attribute_group it87_group_pwm[3] = { | 1520 | static const struct attribute_group it87_group_pwm[3] = { |
1498 | { .attrs = it87_attributes_pwm[0] }, | 1521 | { .attrs = it87_attributes_pwm[0] }, |
1499 | { .attrs = it87_attributes_pwm[1] }, | 1522 | { .attrs = it87_attributes_pwm[1] }, |
1500 | { .attrs = it87_attributes_pwm[2] }, | 1523 | { .attrs = it87_attributes_pwm[2] }, |
1501 | }; | 1524 | }; |
1502 | 1525 | ||
1503 | static struct attribute *it87_attributes_autopwm[3][9+1] = { { | 1526 | static struct attribute *it87_attributes_autopwm[3][9+1] = { { |
1504 | &sensor_dev_attr_pwm1_auto_point1_pwm.dev_attr.attr, | 1527 | &sensor_dev_attr_pwm1_auto_point1_pwm.dev_attr.attr, |
1505 | &sensor_dev_attr_pwm1_auto_point2_pwm.dev_attr.attr, | 1528 | &sensor_dev_attr_pwm1_auto_point2_pwm.dev_attr.attr, |
1506 | &sensor_dev_attr_pwm1_auto_point3_pwm.dev_attr.attr, | 1529 | &sensor_dev_attr_pwm1_auto_point3_pwm.dev_attr.attr, |
1507 | &sensor_dev_attr_pwm1_auto_point4_pwm.dev_attr.attr, | 1530 | &sensor_dev_attr_pwm1_auto_point4_pwm.dev_attr.attr, |
1508 | &sensor_dev_attr_pwm1_auto_point1_temp.dev_attr.attr, | 1531 | &sensor_dev_attr_pwm1_auto_point1_temp.dev_attr.attr, |
1509 | &sensor_dev_attr_pwm1_auto_point1_temp_hyst.dev_attr.attr, | 1532 | &sensor_dev_attr_pwm1_auto_point1_temp_hyst.dev_attr.attr, |
1510 | &sensor_dev_attr_pwm1_auto_point2_temp.dev_attr.attr, | 1533 | &sensor_dev_attr_pwm1_auto_point2_temp.dev_attr.attr, |
1511 | &sensor_dev_attr_pwm1_auto_point3_temp.dev_attr.attr, | 1534 | &sensor_dev_attr_pwm1_auto_point3_temp.dev_attr.attr, |
1512 | &sensor_dev_attr_pwm1_auto_point4_temp.dev_attr.attr, | 1535 | &sensor_dev_attr_pwm1_auto_point4_temp.dev_attr.attr, |
1513 | NULL | 1536 | NULL |
1514 | }, { | 1537 | }, { |
1515 | &sensor_dev_attr_pwm2_auto_point1_pwm.dev_attr.attr, | 1538 | &sensor_dev_attr_pwm2_auto_point1_pwm.dev_attr.attr, |
1516 | &sensor_dev_attr_pwm2_auto_point2_pwm.dev_attr.attr, | 1539 | &sensor_dev_attr_pwm2_auto_point2_pwm.dev_attr.attr, |
1517 | &sensor_dev_attr_pwm2_auto_point3_pwm.dev_attr.attr, | 1540 | &sensor_dev_attr_pwm2_auto_point3_pwm.dev_attr.attr, |
1518 | &sensor_dev_attr_pwm2_auto_point4_pwm.dev_attr.attr, | 1541 | &sensor_dev_attr_pwm2_auto_point4_pwm.dev_attr.attr, |
1519 | &sensor_dev_attr_pwm2_auto_point1_temp.dev_attr.attr, | 1542 | &sensor_dev_attr_pwm2_auto_point1_temp.dev_attr.attr, |
1520 | &sensor_dev_attr_pwm2_auto_point1_temp_hyst.dev_attr.attr, | 1543 | &sensor_dev_attr_pwm2_auto_point1_temp_hyst.dev_attr.attr, |
1521 | &sensor_dev_attr_pwm2_auto_point2_temp.dev_attr.attr, | 1544 | &sensor_dev_attr_pwm2_auto_point2_temp.dev_attr.attr, |
1522 | &sensor_dev_attr_pwm2_auto_point3_temp.dev_attr.attr, | 1545 | &sensor_dev_attr_pwm2_auto_point3_temp.dev_attr.attr, |
1523 | &sensor_dev_attr_pwm2_auto_point4_temp.dev_attr.attr, | 1546 | &sensor_dev_attr_pwm2_auto_point4_temp.dev_attr.attr, |
1524 | NULL | 1547 | NULL |
1525 | }, { | 1548 | }, { |
1526 | &sensor_dev_attr_pwm3_auto_point1_pwm.dev_attr.attr, | 1549 | &sensor_dev_attr_pwm3_auto_point1_pwm.dev_attr.attr, |
1527 | &sensor_dev_attr_pwm3_auto_point2_pwm.dev_attr.attr, | 1550 | &sensor_dev_attr_pwm3_auto_point2_pwm.dev_attr.attr, |
1528 | &sensor_dev_attr_pwm3_auto_point3_pwm.dev_attr.attr, | 1551 | &sensor_dev_attr_pwm3_auto_point3_pwm.dev_attr.attr, |
1529 | &sensor_dev_attr_pwm3_auto_point4_pwm.dev_attr.attr, | 1552 | &sensor_dev_attr_pwm3_auto_point4_pwm.dev_attr.attr, |
1530 | &sensor_dev_attr_pwm3_auto_point1_temp.dev_attr.attr, | 1553 | &sensor_dev_attr_pwm3_auto_point1_temp.dev_attr.attr, |
1531 | &sensor_dev_attr_pwm3_auto_point1_temp_hyst.dev_attr.attr, | 1554 | &sensor_dev_attr_pwm3_auto_point1_temp_hyst.dev_attr.attr, |
1532 | &sensor_dev_attr_pwm3_auto_point2_temp.dev_attr.attr, | 1555 | &sensor_dev_attr_pwm3_auto_point2_temp.dev_attr.attr, |
1533 | &sensor_dev_attr_pwm3_auto_point3_temp.dev_attr.attr, | 1556 | &sensor_dev_attr_pwm3_auto_point3_temp.dev_attr.attr, |
1534 | &sensor_dev_attr_pwm3_auto_point4_temp.dev_attr.attr, | 1557 | &sensor_dev_attr_pwm3_auto_point4_temp.dev_attr.attr, |
1535 | NULL | 1558 | NULL |
1536 | } }; | 1559 | } }; |
1537 | 1560 | ||
1538 | static const struct attribute_group it87_group_autopwm[3] = { | 1561 | static const struct attribute_group it87_group_autopwm[3] = { |
1539 | { .attrs = it87_attributes_autopwm[0] }, | 1562 | { .attrs = it87_attributes_autopwm[0] }, |
1540 | { .attrs = it87_attributes_autopwm[1] }, | 1563 | { .attrs = it87_attributes_autopwm[1] }, |
1541 | { .attrs = it87_attributes_autopwm[2] }, | 1564 | { .attrs = it87_attributes_autopwm[2] }, |
1542 | }; | 1565 | }; |
1543 | 1566 | ||
1544 | static struct attribute *it87_attributes_fan_beep[] = { | 1567 | static struct attribute *it87_attributes_fan_beep[] = { |
1545 | &sensor_dev_attr_fan1_beep.dev_attr.attr, | 1568 | &sensor_dev_attr_fan1_beep.dev_attr.attr, |
1546 | &sensor_dev_attr_fan2_beep.dev_attr.attr, | 1569 | &sensor_dev_attr_fan2_beep.dev_attr.attr, |
1547 | &sensor_dev_attr_fan3_beep.dev_attr.attr, | 1570 | &sensor_dev_attr_fan3_beep.dev_attr.attr, |
1548 | &sensor_dev_attr_fan4_beep.dev_attr.attr, | 1571 | &sensor_dev_attr_fan4_beep.dev_attr.attr, |
1549 | &sensor_dev_attr_fan5_beep.dev_attr.attr, | 1572 | &sensor_dev_attr_fan5_beep.dev_attr.attr, |
1550 | }; | 1573 | }; |
1551 | 1574 | ||
1552 | static struct attribute *it87_attributes_vid[] = { | 1575 | static struct attribute *it87_attributes_vid[] = { |
1553 | &dev_attr_vrm.attr, | 1576 | &dev_attr_vrm.attr, |
1554 | &dev_attr_cpu0_vid.attr, | 1577 | &dev_attr_cpu0_vid.attr, |
1555 | NULL | 1578 | NULL |
1556 | }; | 1579 | }; |
1557 | 1580 | ||
1558 | static const struct attribute_group it87_group_vid = { | 1581 | static const struct attribute_group it87_group_vid = { |
1559 | .attrs = it87_attributes_vid, | 1582 | .attrs = it87_attributes_vid, |
1560 | }; | 1583 | }; |
1561 | 1584 | ||
1562 | static struct attribute *it87_attributes_label[] = { | 1585 | static struct attribute *it87_attributes_label[] = { |
1563 | &sensor_dev_attr_in3_label.dev_attr.attr, | 1586 | &sensor_dev_attr_in3_label.dev_attr.attr, |
1564 | &sensor_dev_attr_in7_label.dev_attr.attr, | 1587 | &sensor_dev_attr_in7_label.dev_attr.attr, |
1565 | &sensor_dev_attr_in8_label.dev_attr.attr, | 1588 | &sensor_dev_attr_in8_label.dev_attr.attr, |
1566 | NULL | 1589 | NULL |
1567 | }; | 1590 | }; |
1568 | 1591 | ||
1569 | static const struct attribute_group it87_group_label = { | 1592 | static const struct attribute_group it87_group_label = { |
1570 | .attrs = it87_attributes_label, | 1593 | .attrs = it87_attributes_label, |
1571 | }; | 1594 | }; |
1572 | 1595 | ||
1573 | /* SuperIO detection - will change isa_address if a chip is found */ | 1596 | /* SuperIO detection - will change isa_address if a chip is found */ |
1574 | static int __init it87_find(unsigned short *address, | 1597 | static int __init it87_find(unsigned short *address, |
1575 | struct it87_sio_data *sio_data) | 1598 | struct it87_sio_data *sio_data) |
1576 | { | 1599 | { |
1577 | int err; | 1600 | int err; |
1578 | u16 chip_type; | 1601 | u16 chip_type; |
1579 | const char *board_vendor, *board_name; | 1602 | const char *board_vendor, *board_name; |
1580 | 1603 | ||
1581 | err = superio_enter(); | 1604 | err = superio_enter(); |
1582 | if (err) | 1605 | if (err) |
1583 | return err; | 1606 | return err; |
1584 | 1607 | ||
1585 | err = -ENODEV; | 1608 | err = -ENODEV; |
1586 | chip_type = force_id ? force_id : superio_inw(DEVID); | 1609 | chip_type = force_id ? force_id : superio_inw(DEVID); |
1587 | 1610 | ||
1588 | switch (chip_type) { | 1611 | switch (chip_type) { |
1589 | case IT8705F_DEVID: | 1612 | case IT8705F_DEVID: |
1590 | sio_data->type = it87; | 1613 | sio_data->type = it87; |
1591 | break; | 1614 | break; |
1592 | case IT8712F_DEVID: | 1615 | case IT8712F_DEVID: |
1593 | sio_data->type = it8712; | 1616 | sio_data->type = it8712; |
1594 | break; | 1617 | break; |
1595 | case IT8716F_DEVID: | 1618 | case IT8716F_DEVID: |
1596 | case IT8726F_DEVID: | 1619 | case IT8726F_DEVID: |
1597 | sio_data->type = it8716; | 1620 | sio_data->type = it8716; |
1598 | break; | 1621 | break; |
1599 | case IT8718F_DEVID: | 1622 | case IT8718F_DEVID: |
1600 | sio_data->type = it8718; | 1623 | sio_data->type = it8718; |
1601 | break; | 1624 | break; |
1602 | case IT8720F_DEVID: | 1625 | case IT8720F_DEVID: |
1603 | sio_data->type = it8720; | 1626 | sio_data->type = it8720; |
1604 | break; | 1627 | break; |
1605 | case IT8721F_DEVID: | 1628 | case IT8721F_DEVID: |
1606 | sio_data->type = it8721; | 1629 | sio_data->type = it8721; |
1607 | break; | 1630 | break; |
1631 | case IT8728F_DEVID: | ||
1632 | sio_data->type = it8728; | ||
1633 | break; | ||
1608 | case 0xffff: /* No device at all */ | 1634 | case 0xffff: /* No device at all */ |
1609 | goto exit; | 1635 | goto exit; |
1610 | default: | 1636 | default: |
1611 | pr_debug("Unsupported chip (DEVID=0x%x)\n", chip_type); | 1637 | pr_debug("Unsupported chip (DEVID=0x%x)\n", chip_type); |
1612 | goto exit; | 1638 | goto exit; |
1613 | } | 1639 | } |
1614 | 1640 | ||
1615 | superio_select(PME); | 1641 | superio_select(PME); |
1616 | if (!(superio_inb(IT87_ACT_REG) & 0x01)) { | 1642 | if (!(superio_inb(IT87_ACT_REG) & 0x01)) { |
1617 | pr_info("Device not activated, skipping\n"); | 1643 | pr_info("Device not activated, skipping\n"); |
1618 | goto exit; | 1644 | goto exit; |
1619 | } | 1645 | } |
1620 | 1646 | ||
1621 | *address = superio_inw(IT87_BASE_REG) & ~(IT87_EXTENT - 1); | 1647 | *address = superio_inw(IT87_BASE_REG) & ~(IT87_EXTENT - 1); |
1622 | if (*address == 0) { | 1648 | if (*address == 0) { |
1623 | pr_info("Base address not set, skipping\n"); | 1649 | pr_info("Base address not set, skipping\n"); |
1624 | goto exit; | 1650 | goto exit; |
1625 | } | 1651 | } |
1626 | 1652 | ||
1627 | err = 0; | 1653 | err = 0; |
1628 | sio_data->revision = superio_inb(DEVREV) & 0x0f; | 1654 | sio_data->revision = superio_inb(DEVREV) & 0x0f; |
1629 | pr_info("Found IT%04xF chip at 0x%x, revision %d\n", | 1655 | pr_info("Found IT%04xF chip at 0x%x, revision %d\n", |
1630 | chip_type, *address, sio_data->revision); | 1656 | chip_type, *address, sio_data->revision); |
1631 | 1657 | ||
1632 | /* in8 (Vbat) is always internal */ | 1658 | /* in8 (Vbat) is always internal */ |
1633 | sio_data->internal = (1 << 2); | 1659 | sio_data->internal = (1 << 2); |
1634 | 1660 | ||
1635 | /* Read GPIO config and VID value from LDN 7 (GPIO) */ | 1661 | /* Read GPIO config and VID value from LDN 7 (GPIO) */ |
1636 | if (sio_data->type == it87) { | 1662 | if (sio_data->type == it87) { |
1637 | /* The IT8705F doesn't have VID pins at all */ | 1663 | /* The IT8705F doesn't have VID pins at all */ |
1638 | sio_data->skip_vid = 1; | 1664 | sio_data->skip_vid = 1; |
1639 | 1665 | ||
1640 | /* The IT8705F has a different LD number for GPIO */ | 1666 | /* The IT8705F has a different LD number for GPIO */ |
1641 | superio_select(5); | 1667 | superio_select(5); |
1642 | sio_data->beep_pin = superio_inb(IT87_SIO_BEEP_PIN_REG) & 0x3f; | 1668 | sio_data->beep_pin = superio_inb(IT87_SIO_BEEP_PIN_REG) & 0x3f; |
1643 | } else { | 1669 | } else { |
1644 | int reg; | 1670 | int reg; |
1645 | 1671 | ||
1646 | superio_select(GPIO); | 1672 | superio_select(GPIO); |
1647 | 1673 | ||
1648 | reg = superio_inb(IT87_SIO_GPIO3_REG); | 1674 | reg = superio_inb(IT87_SIO_GPIO3_REG); |
1649 | if (sio_data->type == it8721) { | 1675 | if (sio_data->type == it8721 || sio_data->type == it8728) { |
1650 | /* The IT8721F/IT8758E doesn't have VID pins at all */ | 1676 | /* |
1677 | * The IT8721F/IT8758E doesn't have VID pins at all, | ||
1678 | * not sure about the IT8728F. | ||
1679 | */ | ||
1651 | sio_data->skip_vid = 1; | 1680 | sio_data->skip_vid = 1; |
1652 | } else { | 1681 | } else { |
1653 | /* We need at least 4 VID pins */ | 1682 | /* We need at least 4 VID pins */ |
1654 | if (reg & 0x0f) { | 1683 | if (reg & 0x0f) { |
1655 | pr_info("VID is disabled (pins used for GPIO)\n"); | 1684 | pr_info("VID is disabled (pins used for GPIO)\n"); |
1656 | sio_data->skip_vid = 1; | 1685 | sio_data->skip_vid = 1; |
1657 | } | 1686 | } |
1658 | } | 1687 | } |
1659 | 1688 | ||
1660 | /* Check if fan3 is there or not */ | 1689 | /* Check if fan3 is there or not */ |
1661 | if (reg & (1 << 6)) | 1690 | if (reg & (1 << 6)) |
1662 | sio_data->skip_pwm |= (1 << 2); | 1691 | sio_data->skip_pwm |= (1 << 2); |
1663 | if (reg & (1 << 7)) | 1692 | if (reg & (1 << 7)) |
1664 | sio_data->skip_fan |= (1 << 2); | 1693 | sio_data->skip_fan |= (1 << 2); |
1665 | 1694 | ||
1666 | /* Check if fan2 is there or not */ | 1695 | /* Check if fan2 is there or not */ |
1667 | reg = superio_inb(IT87_SIO_GPIO5_REG); | 1696 | reg = superio_inb(IT87_SIO_GPIO5_REG); |
1668 | if (reg & (1 << 1)) | 1697 | if (reg & (1 << 1)) |
1669 | sio_data->skip_pwm |= (1 << 1); | 1698 | sio_data->skip_pwm |= (1 << 1); |
1670 | if (reg & (1 << 2)) | 1699 | if (reg & (1 << 2)) |
1671 | sio_data->skip_fan |= (1 << 1); | 1700 | sio_data->skip_fan |= (1 << 1); |
1672 | 1701 | ||
1673 | if ((sio_data->type == it8718 || sio_data->type == it8720) | 1702 | if ((sio_data->type == it8718 || sio_data->type == it8720) |
1674 | && !(sio_data->skip_vid)) | 1703 | && !(sio_data->skip_vid)) |
1675 | sio_data->vid_value = superio_inb(IT87_SIO_VID_REG); | 1704 | sio_data->vid_value = superio_inb(IT87_SIO_VID_REG); |
1676 | 1705 | ||
1677 | reg = superio_inb(IT87_SIO_PINX2_REG); | 1706 | reg = superio_inb(IT87_SIO_PINX2_REG); |
1678 | /* | 1707 | /* |
1679 | * The IT8720F has no VIN7 pin, so VCCH should always be | 1708 | * The IT8720F has no VIN7 pin, so VCCH should always be |
1680 | * routed internally to VIN7 with an internal divider. | 1709 | * routed internally to VIN7 with an internal divider. |
1681 | * Curiously, there still is a configuration bit to control | 1710 | * Curiously, there still is a configuration bit to control |
1682 | * this, which means it can be set incorrectly. And even | 1711 | * this, which means it can be set incorrectly. And even |
1683 | * more curiously, many boards out there are improperly | 1712 | * more curiously, many boards out there are improperly |
1684 | * configured, even though the IT8720F datasheet claims | 1713 | * configured, even though the IT8720F datasheet claims |
1685 | * that the internal routing of VCCH to VIN7 is the default | 1714 | * that the internal routing of VCCH to VIN7 is the default |
1686 | * setting. So we force the internal routing in this case. | 1715 | * setting. So we force the internal routing in this case. |
1687 | */ | 1716 | */ |
1688 | if (sio_data->type == it8720 && !(reg & (1 << 1))) { | 1717 | if (sio_data->type == it8720 && !(reg & (1 << 1))) { |
1689 | reg |= (1 << 1); | 1718 | reg |= (1 << 1); |
1690 | superio_outb(IT87_SIO_PINX2_REG, reg); | 1719 | superio_outb(IT87_SIO_PINX2_REG, reg); |
1691 | pr_notice("Routing internal VCCH to in7\n"); | 1720 | pr_notice("Routing internal VCCH to in7\n"); |
1692 | } | 1721 | } |
1693 | if (reg & (1 << 0)) | 1722 | if (reg & (1 << 0)) |
1694 | sio_data->internal |= (1 << 0); | 1723 | sio_data->internal |= (1 << 0); |
1695 | if ((reg & (1 << 1)) || sio_data->type == it8721) | 1724 | if ((reg & (1 << 1)) || sio_data->type == it8721 || |
1725 | sio_data->type == it8728) | ||
1696 | sio_data->internal |= (1 << 1); | 1726 | sio_data->internal |= (1 << 1); |
1697 | 1727 | ||
1698 | sio_data->beep_pin = superio_inb(IT87_SIO_BEEP_PIN_REG) & 0x3f; | 1728 | sio_data->beep_pin = superio_inb(IT87_SIO_BEEP_PIN_REG) & 0x3f; |
1699 | } | 1729 | } |
1700 | if (sio_data->beep_pin) | 1730 | if (sio_data->beep_pin) |
1701 | pr_info("Beeping is supported\n"); | 1731 | pr_info("Beeping is supported\n"); |
1702 | 1732 | ||
1703 | /* Disable specific features based on DMI strings */ | 1733 | /* Disable specific features based on DMI strings */ |
1704 | board_vendor = dmi_get_system_info(DMI_BOARD_VENDOR); | 1734 | board_vendor = dmi_get_system_info(DMI_BOARD_VENDOR); |
1705 | board_name = dmi_get_system_info(DMI_BOARD_NAME); | 1735 | board_name = dmi_get_system_info(DMI_BOARD_NAME); |
1706 | if (board_vendor && board_name) { | 1736 | if (board_vendor && board_name) { |
1707 | if (strcmp(board_vendor, "nVIDIA") == 0 | 1737 | if (strcmp(board_vendor, "nVIDIA") == 0 |
1708 | && strcmp(board_name, "FN68PT") == 0) { | 1738 | && strcmp(board_name, "FN68PT") == 0) { |
1709 | /* On the Shuttle SN68PT, FAN_CTL2 is apparently not | 1739 | /* On the Shuttle SN68PT, FAN_CTL2 is apparently not |
1710 | connected to a fan, but to something else. One user | 1740 | connected to a fan, but to something else. One user |
1711 | has reported instant system power-off when changing | 1741 | has reported instant system power-off when changing |
1712 | the PWM2 duty cycle, so we disable it. | 1742 | the PWM2 duty cycle, so we disable it. |
1713 | I use the board name string as the trigger in case | 1743 | I use the board name string as the trigger in case |
1714 | the same board is ever used in other systems. */ | 1744 | the same board is ever used in other systems. */ |
1715 | pr_info("Disabling pwm2 due to hardware constraints\n"); | 1745 | pr_info("Disabling pwm2 due to hardware constraints\n"); |
1716 | sio_data->skip_pwm = (1 << 1); | 1746 | sio_data->skip_pwm = (1 << 1); |
1717 | } | 1747 | } |
1718 | } | 1748 | } |
1719 | 1749 | ||
1720 | exit: | 1750 | exit: |
1721 | superio_exit(); | 1751 | superio_exit(); |
1722 | return err; | 1752 | return err; |
1723 | } | 1753 | } |
1724 | 1754 | ||
1725 | static void it87_remove_files(struct device *dev) | 1755 | static void it87_remove_files(struct device *dev) |
1726 | { | 1756 | { |
1727 | struct it87_data *data = platform_get_drvdata(pdev); | 1757 | struct it87_data *data = platform_get_drvdata(pdev); |
1728 | struct it87_sio_data *sio_data = dev->platform_data; | 1758 | struct it87_sio_data *sio_data = dev->platform_data; |
1729 | const struct attribute_group *fan_group = it87_get_fan_group(data); | 1759 | const struct attribute_group *fan_group = it87_get_fan_group(data); |
1730 | int i; | 1760 | int i; |
1731 | 1761 | ||
1732 | sysfs_remove_group(&dev->kobj, &it87_group); | 1762 | sysfs_remove_group(&dev->kobj, &it87_group); |
1733 | if (sio_data->beep_pin) | 1763 | if (sio_data->beep_pin) |
1734 | sysfs_remove_group(&dev->kobj, &it87_group_beep); | 1764 | sysfs_remove_group(&dev->kobj, &it87_group_beep); |
1735 | for (i = 0; i < 5; i++) { | 1765 | for (i = 0; i < 5; i++) { |
1736 | if (!(data->has_fan & (1 << i))) | 1766 | if (!(data->has_fan & (1 << i))) |
1737 | continue; | 1767 | continue; |
1738 | sysfs_remove_group(&dev->kobj, &fan_group[i]); | 1768 | sysfs_remove_group(&dev->kobj, &fan_group[i]); |
1739 | if (sio_data->beep_pin) | 1769 | if (sio_data->beep_pin) |
1740 | sysfs_remove_file(&dev->kobj, | 1770 | sysfs_remove_file(&dev->kobj, |
1741 | it87_attributes_fan_beep[i]); | 1771 | it87_attributes_fan_beep[i]); |
1742 | } | 1772 | } |
1743 | for (i = 0; i < 3; i++) { | 1773 | for (i = 0; i < 3; i++) { |
1744 | if (sio_data->skip_pwm & (1 << 0)) | 1774 | if (sio_data->skip_pwm & (1 << 0)) |
1745 | continue; | 1775 | continue; |
1746 | sysfs_remove_group(&dev->kobj, &it87_group_pwm[i]); | 1776 | sysfs_remove_group(&dev->kobj, &it87_group_pwm[i]); |
1747 | if (has_old_autopwm(data)) | 1777 | if (has_old_autopwm(data)) |
1748 | sysfs_remove_group(&dev->kobj, | 1778 | sysfs_remove_group(&dev->kobj, |
1749 | &it87_group_autopwm[i]); | 1779 | &it87_group_autopwm[i]); |
1750 | } | 1780 | } |
1751 | if (!sio_data->skip_vid) | 1781 | if (!sio_data->skip_vid) |
1752 | sysfs_remove_group(&dev->kobj, &it87_group_vid); | 1782 | sysfs_remove_group(&dev->kobj, &it87_group_vid); |
1753 | sysfs_remove_group(&dev->kobj, &it87_group_label); | 1783 | sysfs_remove_group(&dev->kobj, &it87_group_label); |
1754 | } | 1784 | } |
1755 | 1785 | ||
1756 | static int __devinit it87_probe(struct platform_device *pdev) | 1786 | static int __devinit it87_probe(struct platform_device *pdev) |
1757 | { | 1787 | { |
1758 | struct it87_data *data; | 1788 | struct it87_data *data; |
1759 | struct resource *res; | 1789 | struct resource *res; |
1760 | struct device *dev = &pdev->dev; | 1790 | struct device *dev = &pdev->dev; |
1761 | struct it87_sio_data *sio_data = dev->platform_data; | 1791 | struct it87_sio_data *sio_data = dev->platform_data; |
1762 | const struct attribute_group *fan_group; | 1792 | const struct attribute_group *fan_group; |
1763 | int err = 0, i; | 1793 | int err = 0, i; |
1764 | int enable_pwm_interface; | 1794 | int enable_pwm_interface; |
1765 | int fan_beep_need_rw; | 1795 | int fan_beep_need_rw; |
1766 | static const char *names[] = { | 1796 | static const char *names[] = { |
1767 | "it87", | 1797 | "it87", |
1768 | "it8712", | 1798 | "it8712", |
1769 | "it8716", | 1799 | "it8716", |
1770 | "it8718", | 1800 | "it8718", |
1771 | "it8720", | 1801 | "it8720", |
1772 | "it8721", | 1802 | "it8721", |
1803 | "it8728", | ||
1773 | }; | 1804 | }; |
1774 | 1805 | ||
1775 | res = platform_get_resource(pdev, IORESOURCE_IO, 0); | 1806 | res = platform_get_resource(pdev, IORESOURCE_IO, 0); |
1776 | if (!request_region(res->start, IT87_EC_EXTENT, DRVNAME)) { | 1807 | if (!request_region(res->start, IT87_EC_EXTENT, DRVNAME)) { |
1777 | dev_err(dev, "Failed to request region 0x%lx-0x%lx\n", | 1808 | dev_err(dev, "Failed to request region 0x%lx-0x%lx\n", |
1778 | (unsigned long)res->start, | 1809 | (unsigned long)res->start, |
1779 | (unsigned long)(res->start + IT87_EC_EXTENT - 1)); | 1810 | (unsigned long)(res->start + IT87_EC_EXTENT - 1)); |
1780 | err = -EBUSY; | 1811 | err = -EBUSY; |
1781 | goto ERROR0; | 1812 | goto ERROR0; |
1782 | } | 1813 | } |
1783 | 1814 | ||
1784 | data = kzalloc(sizeof(struct it87_data), GFP_KERNEL); | 1815 | data = kzalloc(sizeof(struct it87_data), GFP_KERNEL); |
1785 | if (!data) { | 1816 | if (!data) { |
1786 | err = -ENOMEM; | 1817 | err = -ENOMEM; |
1787 | goto ERROR1; | 1818 | goto ERROR1; |
1788 | } | 1819 | } |
1789 | 1820 | ||
1790 | data->addr = res->start; | 1821 | data->addr = res->start; |
1791 | data->type = sio_data->type; | 1822 | data->type = sio_data->type; |
1792 | data->revision = sio_data->revision; | 1823 | data->revision = sio_data->revision; |
1793 | data->name = names[sio_data->type]; | 1824 | data->name = names[sio_data->type]; |
1794 | 1825 | ||
1795 | /* Now, we do the remaining detection. */ | 1826 | /* Now, we do the remaining detection. */ |
1796 | if ((it87_read_value(data, IT87_REG_CONFIG) & 0x80) | 1827 | if ((it87_read_value(data, IT87_REG_CONFIG) & 0x80) |
1797 | || it87_read_value(data, IT87_REG_CHIPID) != 0x90) { | 1828 | || it87_read_value(data, IT87_REG_CHIPID) != 0x90) { |
1798 | err = -ENODEV; | 1829 | err = -ENODEV; |
1799 | goto ERROR2; | 1830 | goto ERROR2; |
1800 | } | 1831 | } |
1801 | 1832 | ||
1802 | platform_set_drvdata(pdev, data); | 1833 | platform_set_drvdata(pdev, data); |
1803 | 1834 | ||
1804 | mutex_init(&data->update_lock); | 1835 | mutex_init(&data->update_lock); |
1805 | 1836 | ||
1806 | /* Check PWM configuration */ | 1837 | /* Check PWM configuration */ |
1807 | enable_pwm_interface = it87_check_pwm(dev); | 1838 | enable_pwm_interface = it87_check_pwm(dev); |
1808 | 1839 | ||
1809 | /* Starting with IT8721F, we handle scaling of internal voltages */ | 1840 | /* Starting with IT8721F, we handle scaling of internal voltages */ |
1810 | if (data->type == it8721) { | 1841 | if (has_12mv_adc(data)) { |
1811 | if (sio_data->internal & (1 << 0)) | 1842 | if (sio_data->internal & (1 << 0)) |
1812 | data->in_scaled |= (1 << 3); /* in3 is AVCC */ | 1843 | data->in_scaled |= (1 << 3); /* in3 is AVCC */ |
1813 | if (sio_data->internal & (1 << 1)) | 1844 | if (sio_data->internal & (1 << 1)) |
1814 | data->in_scaled |= (1 << 7); /* in7 is VSB */ | 1845 | data->in_scaled |= (1 << 7); /* in7 is VSB */ |
1815 | if (sio_data->internal & (1 << 2)) | 1846 | if (sio_data->internal & (1 << 2)) |
1816 | data->in_scaled |= (1 << 8); /* in8 is Vbat */ | 1847 | data->in_scaled |= (1 << 8); /* in8 is Vbat */ |
1817 | } | 1848 | } |
1818 | 1849 | ||
1819 | /* Initialize the IT87 chip */ | 1850 | /* Initialize the IT87 chip */ |
1820 | it87_init_device(pdev); | 1851 | it87_init_device(pdev); |
1821 | 1852 | ||
1822 | /* Register sysfs hooks */ | 1853 | /* Register sysfs hooks */ |
1823 | err = sysfs_create_group(&dev->kobj, &it87_group); | 1854 | err = sysfs_create_group(&dev->kobj, &it87_group); |
1824 | if (err) | 1855 | if (err) |
1825 | goto ERROR2; | 1856 | goto ERROR2; |
1826 | 1857 | ||
1827 | if (sio_data->beep_pin) { | 1858 | if (sio_data->beep_pin) { |
1828 | err = sysfs_create_group(&dev->kobj, &it87_group_beep); | 1859 | err = sysfs_create_group(&dev->kobj, &it87_group_beep); |
1829 | if (err) | 1860 | if (err) |
1830 | goto ERROR4; | 1861 | goto ERROR4; |
1831 | } | 1862 | } |
1832 | 1863 | ||
1833 | /* Do not create fan files for disabled fans */ | 1864 | /* Do not create fan files for disabled fans */ |
1834 | fan_group = it87_get_fan_group(data); | 1865 | fan_group = it87_get_fan_group(data); |
1835 | fan_beep_need_rw = 1; | 1866 | fan_beep_need_rw = 1; |
1836 | for (i = 0; i < 5; i++) { | 1867 | for (i = 0; i < 5; i++) { |
1837 | if (!(data->has_fan & (1 << i))) | 1868 | if (!(data->has_fan & (1 << i))) |
1838 | continue; | 1869 | continue; |
1839 | err = sysfs_create_group(&dev->kobj, &fan_group[i]); | 1870 | err = sysfs_create_group(&dev->kobj, &fan_group[i]); |
1840 | if (err) | 1871 | if (err) |
1841 | goto ERROR4; | 1872 | goto ERROR4; |
1842 | 1873 | ||
1843 | if (sio_data->beep_pin) { | 1874 | if (sio_data->beep_pin) { |
1844 | err = sysfs_create_file(&dev->kobj, | 1875 | err = sysfs_create_file(&dev->kobj, |
1845 | it87_attributes_fan_beep[i]); | 1876 | it87_attributes_fan_beep[i]); |
1846 | if (err) | 1877 | if (err) |
1847 | goto ERROR4; | 1878 | goto ERROR4; |
1848 | if (!fan_beep_need_rw) | 1879 | if (!fan_beep_need_rw) |
1849 | continue; | 1880 | continue; |
1850 | 1881 | ||
1851 | /* As we have a single beep enable bit for all fans, | 1882 | /* As we have a single beep enable bit for all fans, |
1852 | * only the first enabled fan has a writable attribute | 1883 | * only the first enabled fan has a writable attribute |
1853 | * for it. */ | 1884 | * for it. */ |
1854 | if (sysfs_chmod_file(&dev->kobj, | 1885 | if (sysfs_chmod_file(&dev->kobj, |
1855 | it87_attributes_fan_beep[i], | 1886 | it87_attributes_fan_beep[i], |
1856 | S_IRUGO | S_IWUSR)) | 1887 | S_IRUGO | S_IWUSR)) |
1857 | dev_dbg(dev, "chmod +w fan%d_beep failed\n", | 1888 | dev_dbg(dev, "chmod +w fan%d_beep failed\n", |
1858 | i + 1); | 1889 | i + 1); |
1859 | fan_beep_need_rw = 0; | 1890 | fan_beep_need_rw = 0; |
1860 | } | 1891 | } |
1861 | } | 1892 | } |
1862 | 1893 | ||
1863 | if (enable_pwm_interface) { | 1894 | if (enable_pwm_interface) { |
1864 | for (i = 0; i < 3; i++) { | 1895 | for (i = 0; i < 3; i++) { |
1865 | if (sio_data->skip_pwm & (1 << i)) | 1896 | if (sio_data->skip_pwm & (1 << i)) |
1866 | continue; | 1897 | continue; |
1867 | err = sysfs_create_group(&dev->kobj, | 1898 | err = sysfs_create_group(&dev->kobj, |
1868 | &it87_group_pwm[i]); | 1899 | &it87_group_pwm[i]); |
1869 | if (err) | 1900 | if (err) |
1870 | goto ERROR4; | 1901 | goto ERROR4; |
1871 | 1902 | ||
1872 | if (!has_old_autopwm(data)) | 1903 | if (!has_old_autopwm(data)) |
1873 | continue; | 1904 | continue; |
1874 | err = sysfs_create_group(&dev->kobj, | 1905 | err = sysfs_create_group(&dev->kobj, |
1875 | &it87_group_autopwm[i]); | 1906 | &it87_group_autopwm[i]); |
1876 | if (err) | 1907 | if (err) |
1877 | goto ERROR4; | 1908 | goto ERROR4; |
1878 | } | 1909 | } |
1879 | } | 1910 | } |
1880 | 1911 | ||
1881 | if (!sio_data->skip_vid) { | 1912 | if (!sio_data->skip_vid) { |
1882 | data->vrm = vid_which_vrm(); | 1913 | data->vrm = vid_which_vrm(); |
1883 | /* VID reading from Super-I/O config space if available */ | 1914 | /* VID reading from Super-I/O config space if available */ |
1884 | data->vid = sio_data->vid_value; | 1915 | data->vid = sio_data->vid_value; |
1885 | err = sysfs_create_group(&dev->kobj, &it87_group_vid); | 1916 | err = sysfs_create_group(&dev->kobj, &it87_group_vid); |
1886 | if (err) | 1917 | if (err) |
1887 | goto ERROR4; | 1918 | goto ERROR4; |
1888 | } | 1919 | } |
1889 | 1920 | ||
1890 | /* Export labels for internal sensors */ | 1921 | /* Export labels for internal sensors */ |
1891 | for (i = 0; i < 3; i++) { | 1922 | for (i = 0; i < 3; i++) { |
1892 | if (!(sio_data->internal & (1 << i))) | 1923 | if (!(sio_data->internal & (1 << i))) |
1893 | continue; | 1924 | continue; |
1894 | err = sysfs_create_file(&dev->kobj, | 1925 | err = sysfs_create_file(&dev->kobj, |
1895 | it87_attributes_label[i]); | 1926 | it87_attributes_label[i]); |
1896 | if (err) | 1927 | if (err) |
1897 | goto ERROR4; | 1928 | goto ERROR4; |
1898 | } | 1929 | } |
1899 | 1930 | ||
1900 | data->hwmon_dev = hwmon_device_register(dev); | 1931 | data->hwmon_dev = hwmon_device_register(dev); |
1901 | if (IS_ERR(data->hwmon_dev)) { | 1932 | if (IS_ERR(data->hwmon_dev)) { |
1902 | err = PTR_ERR(data->hwmon_dev); | 1933 | err = PTR_ERR(data->hwmon_dev); |
1903 | goto ERROR4; | 1934 | goto ERROR4; |
1904 | } | 1935 | } |
1905 | 1936 | ||
1906 | return 0; | 1937 | return 0; |
1907 | 1938 | ||
1908 | ERROR4: | 1939 | ERROR4: |
1909 | it87_remove_files(dev); | 1940 | it87_remove_files(dev); |
1910 | ERROR2: | 1941 | ERROR2: |
1911 | platform_set_drvdata(pdev, NULL); | 1942 | platform_set_drvdata(pdev, NULL); |
1912 | kfree(data); | 1943 | kfree(data); |
1913 | ERROR1: | 1944 | ERROR1: |
1914 | release_region(res->start, IT87_EC_EXTENT); | 1945 | release_region(res->start, IT87_EC_EXTENT); |
1915 | ERROR0: | 1946 | ERROR0: |
1916 | return err; | 1947 | return err; |
1917 | } | 1948 | } |
1918 | 1949 | ||
1919 | static int __devexit it87_remove(struct platform_device *pdev) | 1950 | static int __devexit it87_remove(struct platform_device *pdev) |
1920 | { | 1951 | { |
1921 | struct it87_data *data = platform_get_drvdata(pdev); | 1952 | struct it87_data *data = platform_get_drvdata(pdev); |
1922 | 1953 | ||
1923 | hwmon_device_unregister(data->hwmon_dev); | 1954 | hwmon_device_unregister(data->hwmon_dev); |
1924 | it87_remove_files(&pdev->dev); | 1955 | it87_remove_files(&pdev->dev); |
1925 | 1956 | ||
1926 | release_region(data->addr, IT87_EC_EXTENT); | 1957 | release_region(data->addr, IT87_EC_EXTENT); |
1927 | platform_set_drvdata(pdev, NULL); | 1958 | platform_set_drvdata(pdev, NULL); |
1928 | kfree(data); | 1959 | kfree(data); |
1929 | 1960 | ||
1930 | return 0; | 1961 | return 0; |
1931 | } | 1962 | } |
1932 | 1963 | ||
1933 | /* Must be called with data->update_lock held, except during initialization. | 1964 | /* Must be called with data->update_lock held, except during initialization. |
1934 | We ignore the IT87 BUSY flag at this moment - it could lead to deadlocks, | 1965 | We ignore the IT87 BUSY flag at this moment - it could lead to deadlocks, |
1935 | would slow down the IT87 access and should not be necessary. */ | 1966 | would slow down the IT87 access and should not be necessary. */ |
1936 | static int it87_read_value(struct it87_data *data, u8 reg) | 1967 | static int it87_read_value(struct it87_data *data, u8 reg) |
1937 | { | 1968 | { |
1938 | outb_p(reg, data->addr + IT87_ADDR_REG_OFFSET); | 1969 | outb_p(reg, data->addr + IT87_ADDR_REG_OFFSET); |
1939 | return inb_p(data->addr + IT87_DATA_REG_OFFSET); | 1970 | return inb_p(data->addr + IT87_DATA_REG_OFFSET); |
1940 | } | 1971 | } |
1941 | 1972 | ||
1942 | /* Must be called with data->update_lock held, except during initialization. | 1973 | /* Must be called with data->update_lock held, except during initialization. |
1943 | We ignore the IT87 BUSY flag at this moment - it could lead to deadlocks, | 1974 | We ignore the IT87 BUSY flag at this moment - it could lead to deadlocks, |
1944 | would slow down the IT87 access and should not be necessary. */ | 1975 | would slow down the IT87 access and should not be necessary. */ |
1945 | static void it87_write_value(struct it87_data *data, u8 reg, u8 value) | 1976 | static void it87_write_value(struct it87_data *data, u8 reg, u8 value) |
1946 | { | 1977 | { |
1947 | outb_p(reg, data->addr + IT87_ADDR_REG_OFFSET); | 1978 | outb_p(reg, data->addr + IT87_ADDR_REG_OFFSET); |
1948 | outb_p(value, data->addr + IT87_DATA_REG_OFFSET); | 1979 | outb_p(value, data->addr + IT87_DATA_REG_OFFSET); |
1949 | } | 1980 | } |
1950 | 1981 | ||
1951 | /* Return 1 if and only if the PWM interface is safe to use */ | 1982 | /* Return 1 if and only if the PWM interface is safe to use */ |
1952 | static int __devinit it87_check_pwm(struct device *dev) | 1983 | static int __devinit it87_check_pwm(struct device *dev) |
1953 | { | 1984 | { |
1954 | struct it87_data *data = dev_get_drvdata(dev); | 1985 | struct it87_data *data = dev_get_drvdata(dev); |
1955 | /* Some BIOSes fail to correctly configure the IT87 fans. All fans off | 1986 | /* Some BIOSes fail to correctly configure the IT87 fans. All fans off |
1956 | * and polarity set to active low is sign that this is the case so we | 1987 | * and polarity set to active low is sign that this is the case so we |
1957 | * disable pwm control to protect the user. */ | 1988 | * disable pwm control to protect the user. */ |
1958 | int tmp = it87_read_value(data, IT87_REG_FAN_CTL); | 1989 | int tmp = it87_read_value(data, IT87_REG_FAN_CTL); |
1959 | if ((tmp & 0x87) == 0) { | 1990 | if ((tmp & 0x87) == 0) { |
1960 | if (fix_pwm_polarity) { | 1991 | if (fix_pwm_polarity) { |
1961 | /* The user asks us to attempt a chip reconfiguration. | 1992 | /* The user asks us to attempt a chip reconfiguration. |
1962 | * This means switching to active high polarity and | 1993 | * This means switching to active high polarity and |
1963 | * inverting all fan speed values. */ | 1994 | * inverting all fan speed values. */ |
1964 | int i; | 1995 | int i; |
1965 | u8 pwm[3]; | 1996 | u8 pwm[3]; |
1966 | 1997 | ||
1967 | for (i = 0; i < 3; i++) | 1998 | for (i = 0; i < 3; i++) |
1968 | pwm[i] = it87_read_value(data, | 1999 | pwm[i] = it87_read_value(data, |
1969 | IT87_REG_PWM(i)); | 2000 | IT87_REG_PWM(i)); |
1970 | 2001 | ||
1971 | /* If any fan is in automatic pwm mode, the polarity | 2002 | /* If any fan is in automatic pwm mode, the polarity |
1972 | * might be correct, as suspicious as it seems, so we | 2003 | * might be correct, as suspicious as it seems, so we |
1973 | * better don't change anything (but still disable the | 2004 | * better don't change anything (but still disable the |
1974 | * PWM interface). */ | 2005 | * PWM interface). */ |
1975 | if (!((pwm[0] | pwm[1] | pwm[2]) & 0x80)) { | 2006 | if (!((pwm[0] | pwm[1] | pwm[2]) & 0x80)) { |
1976 | dev_info(dev, "Reconfiguring PWM to " | 2007 | dev_info(dev, "Reconfiguring PWM to " |
1977 | "active high polarity\n"); | 2008 | "active high polarity\n"); |
1978 | it87_write_value(data, IT87_REG_FAN_CTL, | 2009 | it87_write_value(data, IT87_REG_FAN_CTL, |
1979 | tmp | 0x87); | 2010 | tmp | 0x87); |
1980 | for (i = 0; i < 3; i++) | 2011 | for (i = 0; i < 3; i++) |
1981 | it87_write_value(data, | 2012 | it87_write_value(data, |
1982 | IT87_REG_PWM(i), | 2013 | IT87_REG_PWM(i), |
1983 | 0x7f & ~pwm[i]); | 2014 | 0x7f & ~pwm[i]); |
1984 | return 1; | 2015 | return 1; |
1985 | } | 2016 | } |
1986 | 2017 | ||
1987 | dev_info(dev, "PWM configuration is " | 2018 | dev_info(dev, "PWM configuration is " |
1988 | "too broken to be fixed\n"); | 2019 | "too broken to be fixed\n"); |
1989 | } | 2020 | } |
1990 | 2021 | ||
1991 | dev_info(dev, "Detected broken BIOS " | 2022 | dev_info(dev, "Detected broken BIOS " |
1992 | "defaults, disabling PWM interface\n"); | 2023 | "defaults, disabling PWM interface\n"); |
1993 | return 0; | 2024 | return 0; |
1994 | } else if (fix_pwm_polarity) { | 2025 | } else if (fix_pwm_polarity) { |
1995 | dev_info(dev, "PWM configuration looks " | 2026 | dev_info(dev, "PWM configuration looks " |
1996 | "sane, won't touch\n"); | 2027 | "sane, won't touch\n"); |
1997 | } | 2028 | } |
1998 | 2029 | ||
1999 | return 1; | 2030 | return 1; |
2000 | } | 2031 | } |
2001 | 2032 | ||
2002 | /* Called when we have found a new IT87. */ | 2033 | /* Called when we have found a new IT87. */ |
2003 | static void __devinit it87_init_device(struct platform_device *pdev) | 2034 | static void __devinit it87_init_device(struct platform_device *pdev) |
2004 | { | 2035 | { |
2005 | struct it87_sio_data *sio_data = pdev->dev.platform_data; | 2036 | struct it87_sio_data *sio_data = pdev->dev.platform_data; |
2006 | struct it87_data *data = platform_get_drvdata(pdev); | 2037 | struct it87_data *data = platform_get_drvdata(pdev); |
2007 | int tmp, i; | 2038 | int tmp, i; |
2008 | u8 mask; | 2039 | u8 mask; |
2009 | 2040 | ||
2010 | /* For each PWM channel: | 2041 | /* For each PWM channel: |
2011 | * - If it is in automatic mode, setting to manual mode should set | 2042 | * - If it is in automatic mode, setting to manual mode should set |
2012 | * the fan to full speed by default. | 2043 | * the fan to full speed by default. |
2013 | * - If it is in manual mode, we need a mapping to temperature | 2044 | * - If it is in manual mode, we need a mapping to temperature |
2014 | * channels to use when later setting to automatic mode later. | 2045 | * channels to use when later setting to automatic mode later. |
2015 | * Use a 1:1 mapping by default (we are clueless.) | 2046 | * Use a 1:1 mapping by default (we are clueless.) |
2016 | * In both cases, the value can (and should) be changed by the user | 2047 | * In both cases, the value can (and should) be changed by the user |
2017 | * prior to switching to a different mode. | 2048 | * prior to switching to a different mode. |
2018 | * Note that this is no longer needed for the IT8721F and later, as | 2049 | * Note that this is no longer needed for the IT8721F and later, as |
2019 | * these have separate registers for the temperature mapping and the | 2050 | * these have separate registers for the temperature mapping and the |
2020 | * manual duty cycle. */ | 2051 | * manual duty cycle. */ |
2021 | for (i = 0; i < 3; i++) { | 2052 | for (i = 0; i < 3; i++) { |
2022 | data->pwm_temp_map[i] = i; | 2053 | data->pwm_temp_map[i] = i; |
2023 | data->pwm_duty[i] = 0x7f; /* Full speed */ | 2054 | data->pwm_duty[i] = 0x7f; /* Full speed */ |
2024 | data->auto_pwm[i][3] = 0x7f; /* Full speed, hard-coded */ | 2055 | data->auto_pwm[i][3] = 0x7f; /* Full speed, hard-coded */ |
2025 | } | 2056 | } |
2026 | 2057 | ||
2027 | /* Some chips seem to have default value 0xff for all limit | 2058 | /* Some chips seem to have default value 0xff for all limit |
2028 | * registers. For low voltage limits it makes no sense and triggers | 2059 | * registers. For low voltage limits it makes no sense and triggers |
2029 | * alarms, so change to 0 instead. For high temperature limits, it | 2060 | * alarms, so change to 0 instead. For high temperature limits, it |
2030 | * means -1 degree C, which surprisingly doesn't trigger an alarm, | 2061 | * means -1 degree C, which surprisingly doesn't trigger an alarm, |
2031 | * but is still confusing, so change to 127 degrees C. */ | 2062 | * but is still confusing, so change to 127 degrees C. */ |
2032 | for (i = 0; i < 8; i++) { | 2063 | for (i = 0; i < 8; i++) { |
2033 | tmp = it87_read_value(data, IT87_REG_VIN_MIN(i)); | 2064 | tmp = it87_read_value(data, IT87_REG_VIN_MIN(i)); |
2034 | if (tmp == 0xff) | 2065 | if (tmp == 0xff) |
2035 | it87_write_value(data, IT87_REG_VIN_MIN(i), 0); | 2066 | it87_write_value(data, IT87_REG_VIN_MIN(i), 0); |
2036 | } | 2067 | } |
2037 | for (i = 0; i < 3; i++) { | 2068 | for (i = 0; i < 3; i++) { |
2038 | tmp = it87_read_value(data, IT87_REG_TEMP_HIGH(i)); | 2069 | tmp = it87_read_value(data, IT87_REG_TEMP_HIGH(i)); |
2039 | if (tmp == 0xff) | 2070 | if (tmp == 0xff) |
2040 | it87_write_value(data, IT87_REG_TEMP_HIGH(i), 127); | 2071 | it87_write_value(data, IT87_REG_TEMP_HIGH(i), 127); |
2041 | } | 2072 | } |
2042 | 2073 | ||
2043 | /* Temperature channels are not forcibly enabled, as they can be | 2074 | /* Temperature channels are not forcibly enabled, as they can be |
2044 | * set to two different sensor types and we can't guess which one | 2075 | * set to two different sensor types and we can't guess which one |
2045 | * is correct for a given system. These channels can be enabled at | 2076 | * is correct for a given system. These channels can be enabled at |
2046 | * run-time through the temp{1-3}_type sysfs accessors if needed. */ | 2077 | * run-time through the temp{1-3}_type sysfs accessors if needed. */ |
2047 | 2078 | ||
2048 | /* Check if voltage monitors are reset manually or by some reason */ | 2079 | /* Check if voltage monitors are reset manually or by some reason */ |
2049 | tmp = it87_read_value(data, IT87_REG_VIN_ENABLE); | 2080 | tmp = it87_read_value(data, IT87_REG_VIN_ENABLE); |
2050 | if ((tmp & 0xff) == 0) { | 2081 | if ((tmp & 0xff) == 0) { |
2051 | /* Enable all voltage monitors */ | 2082 | /* Enable all voltage monitors */ |
2052 | it87_write_value(data, IT87_REG_VIN_ENABLE, 0xff); | 2083 | it87_write_value(data, IT87_REG_VIN_ENABLE, 0xff); |
2053 | } | 2084 | } |
2054 | 2085 | ||
2055 | /* Check if tachometers are reset manually or by some reason */ | 2086 | /* Check if tachometers are reset manually or by some reason */ |
2056 | mask = 0x70 & ~(sio_data->skip_fan << 4); | 2087 | mask = 0x70 & ~(sio_data->skip_fan << 4); |
2057 | data->fan_main_ctrl = it87_read_value(data, IT87_REG_FAN_MAIN_CTRL); | 2088 | data->fan_main_ctrl = it87_read_value(data, IT87_REG_FAN_MAIN_CTRL); |
2058 | if ((data->fan_main_ctrl & mask) == 0) { | 2089 | if ((data->fan_main_ctrl & mask) == 0) { |
2059 | /* Enable all fan tachometers */ | 2090 | /* Enable all fan tachometers */ |
2060 | data->fan_main_ctrl |= mask; | 2091 | data->fan_main_ctrl |= mask; |
2061 | it87_write_value(data, IT87_REG_FAN_MAIN_CTRL, | 2092 | it87_write_value(data, IT87_REG_FAN_MAIN_CTRL, |
2062 | data->fan_main_ctrl); | 2093 | data->fan_main_ctrl); |
2063 | } | 2094 | } |
2064 | data->has_fan = (data->fan_main_ctrl >> 4) & 0x07; | 2095 | data->has_fan = (data->fan_main_ctrl >> 4) & 0x07; |
2065 | 2096 | ||
2066 | /* Set tachometers to 16-bit mode if needed */ | 2097 | /* Set tachometers to 16-bit mode if needed */ |
2067 | if (has_16bit_fans(data)) { | 2098 | if (has_16bit_fans(data)) { |
2068 | tmp = it87_read_value(data, IT87_REG_FAN_16BIT); | 2099 | tmp = it87_read_value(data, IT87_REG_FAN_16BIT); |
2069 | if (~tmp & 0x07 & data->has_fan) { | 2100 | if (~tmp & 0x07 & data->has_fan) { |
2070 | dev_dbg(&pdev->dev, | 2101 | dev_dbg(&pdev->dev, |
2071 | "Setting fan1-3 to 16-bit mode\n"); | 2102 | "Setting fan1-3 to 16-bit mode\n"); |
2072 | it87_write_value(data, IT87_REG_FAN_16BIT, | 2103 | it87_write_value(data, IT87_REG_FAN_16BIT, |
2073 | tmp | 0x07); | 2104 | tmp | 0x07); |
2074 | } | 2105 | } |
2075 | /* IT8705F only supports three fans. */ | 2106 | /* IT8705F only supports three fans. */ |
2076 | if (data->type != it87) { | 2107 | if (data->type != it87) { |
2077 | if (tmp & (1 << 4)) | 2108 | if (tmp & (1 << 4)) |
2078 | data->has_fan |= (1 << 3); /* fan4 enabled */ | 2109 | data->has_fan |= (1 << 3); /* fan4 enabled */ |
2079 | if (tmp & (1 << 5)) | 2110 | if (tmp & (1 << 5)) |
2080 | data->has_fan |= (1 << 4); /* fan5 enabled */ | 2111 | data->has_fan |= (1 << 4); /* fan5 enabled */ |
2081 | } | 2112 | } |
2082 | } | 2113 | } |
2083 | 2114 | ||
2084 | /* Fan input pins may be used for alternative functions */ | 2115 | /* Fan input pins may be used for alternative functions */ |
2085 | data->has_fan &= ~sio_data->skip_fan; | 2116 | data->has_fan &= ~sio_data->skip_fan; |
2086 | 2117 | ||
2087 | /* Start monitoring */ | 2118 | /* Start monitoring */ |
2088 | it87_write_value(data, IT87_REG_CONFIG, | 2119 | it87_write_value(data, IT87_REG_CONFIG, |
2089 | (it87_read_value(data, IT87_REG_CONFIG) & 0x36) | 2120 | (it87_read_value(data, IT87_REG_CONFIG) & 0x36) |
2090 | | (update_vbat ? 0x41 : 0x01)); | 2121 | | (update_vbat ? 0x41 : 0x01)); |
2091 | } | 2122 | } |
2092 | 2123 | ||
2093 | static void it87_update_pwm_ctrl(struct it87_data *data, int nr) | 2124 | static void it87_update_pwm_ctrl(struct it87_data *data, int nr) |
2094 | { | 2125 | { |
2095 | data->pwm_ctrl[nr] = it87_read_value(data, IT87_REG_PWM(nr)); | 2126 | data->pwm_ctrl[nr] = it87_read_value(data, IT87_REG_PWM(nr)); |
2096 | if (data->type == it8721) { | 2127 | if (has_newer_autopwm(data)) { |
2097 | data->pwm_temp_map[nr] = data->pwm_ctrl[nr] & 0x03; | 2128 | data->pwm_temp_map[nr] = data->pwm_ctrl[nr] & 0x03; |
2098 | data->pwm_duty[nr] = it87_read_value(data, | 2129 | data->pwm_duty[nr] = it87_read_value(data, |
2099 | IT87_REG_PWM_DUTY(nr)); | 2130 | IT87_REG_PWM_DUTY(nr)); |
2100 | } else { | 2131 | } else { |
2101 | if (data->pwm_ctrl[nr] & 0x80) /* Automatic mode */ | 2132 | if (data->pwm_ctrl[nr] & 0x80) /* Automatic mode */ |
2102 | data->pwm_temp_map[nr] = data->pwm_ctrl[nr] & 0x03; | 2133 | data->pwm_temp_map[nr] = data->pwm_ctrl[nr] & 0x03; |
2103 | else /* Manual mode */ | 2134 | else /* Manual mode */ |
2104 | data->pwm_duty[nr] = data->pwm_ctrl[nr] & 0x7f; | 2135 | data->pwm_duty[nr] = data->pwm_ctrl[nr] & 0x7f; |
2105 | } | 2136 | } |
2106 | 2137 | ||
2107 | if (has_old_autopwm(data)) { | 2138 | if (has_old_autopwm(data)) { |
2108 | int i; | 2139 | int i; |
2109 | 2140 | ||
2110 | for (i = 0; i < 5 ; i++) | 2141 | for (i = 0; i < 5 ; i++) |
2111 | data->auto_temp[nr][i] = it87_read_value(data, | 2142 | data->auto_temp[nr][i] = it87_read_value(data, |
2112 | IT87_REG_AUTO_TEMP(nr, i)); | 2143 | IT87_REG_AUTO_TEMP(nr, i)); |
2113 | for (i = 0; i < 3 ; i++) | 2144 | for (i = 0; i < 3 ; i++) |
2114 | data->auto_pwm[nr][i] = it87_read_value(data, | 2145 | data->auto_pwm[nr][i] = it87_read_value(data, |
2115 | IT87_REG_AUTO_PWM(nr, i)); | 2146 | IT87_REG_AUTO_PWM(nr, i)); |
2116 | } | 2147 | } |
2117 | } | 2148 | } |
2118 | 2149 | ||
2119 | static struct it87_data *it87_update_device(struct device *dev) | 2150 | static struct it87_data *it87_update_device(struct device *dev) |
2120 | { | 2151 | { |
2121 | struct it87_data *data = dev_get_drvdata(dev); | 2152 | struct it87_data *data = dev_get_drvdata(dev); |
2122 | int i; | 2153 | int i; |
2123 | 2154 | ||
2124 | mutex_lock(&data->update_lock); | 2155 | mutex_lock(&data->update_lock); |
2125 | 2156 | ||
2126 | if (time_after(jiffies, data->last_updated + HZ + HZ / 2) | 2157 | if (time_after(jiffies, data->last_updated + HZ + HZ / 2) |
2127 | || !data->valid) { | 2158 | || !data->valid) { |
2128 | if (update_vbat) { | 2159 | if (update_vbat) { |
2129 | /* Cleared after each update, so reenable. Value | 2160 | /* Cleared after each update, so reenable. Value |
2130 | returned by this read will be previous value */ | 2161 | returned by this read will be previous value */ |
2131 | it87_write_value(data, IT87_REG_CONFIG, | 2162 | it87_write_value(data, IT87_REG_CONFIG, |
2132 | it87_read_value(data, IT87_REG_CONFIG) | 0x40); | 2163 | it87_read_value(data, IT87_REG_CONFIG) | 0x40); |
2133 | } | 2164 | } |
2134 | for (i = 0; i <= 7; i++) { | 2165 | for (i = 0; i <= 7; i++) { |
2135 | data->in[i] = | 2166 | data->in[i] = |
2136 | it87_read_value(data, IT87_REG_VIN(i)); | 2167 | it87_read_value(data, IT87_REG_VIN(i)); |
2137 | data->in_min[i] = | 2168 | data->in_min[i] = |
2138 | it87_read_value(data, IT87_REG_VIN_MIN(i)); | 2169 | it87_read_value(data, IT87_REG_VIN_MIN(i)); |
2139 | data->in_max[i] = | 2170 | data->in_max[i] = |
2140 | it87_read_value(data, IT87_REG_VIN_MAX(i)); | 2171 | it87_read_value(data, IT87_REG_VIN_MAX(i)); |
2141 | } | 2172 | } |
2142 | /* in8 (battery) has no limit registers */ | 2173 | /* in8 (battery) has no limit registers */ |
2143 | data->in[8] = it87_read_value(data, IT87_REG_VIN(8)); | 2174 | data->in[8] = it87_read_value(data, IT87_REG_VIN(8)); |
2144 | 2175 | ||
2145 | for (i = 0; i < 5; i++) { | 2176 | for (i = 0; i < 5; i++) { |
2146 | /* Skip disabled fans */ | 2177 | /* Skip disabled fans */ |
2147 | if (!(data->has_fan & (1 << i))) | 2178 | if (!(data->has_fan & (1 << i))) |
2148 | continue; | 2179 | continue; |
2149 | 2180 | ||
2150 | data->fan_min[i] = | 2181 | data->fan_min[i] = |
2151 | it87_read_value(data, IT87_REG_FAN_MIN[i]); | 2182 | it87_read_value(data, IT87_REG_FAN_MIN[i]); |
2152 | data->fan[i] = it87_read_value(data, | 2183 | data->fan[i] = it87_read_value(data, |
2153 | IT87_REG_FAN[i]); | 2184 | IT87_REG_FAN[i]); |
2154 | /* Add high byte if in 16-bit mode */ | 2185 | /* Add high byte if in 16-bit mode */ |
2155 | if (has_16bit_fans(data)) { | 2186 | if (has_16bit_fans(data)) { |
2156 | data->fan[i] |= it87_read_value(data, | 2187 | data->fan[i] |= it87_read_value(data, |
2157 | IT87_REG_FANX[i]) << 8; | 2188 | IT87_REG_FANX[i]) << 8; |
2158 | data->fan_min[i] |= it87_read_value(data, | 2189 | data->fan_min[i] |= it87_read_value(data, |
2159 | IT87_REG_FANX_MIN[i]) << 8; | 2190 | IT87_REG_FANX_MIN[i]) << 8; |
2160 | } | 2191 | } |
2161 | } | 2192 | } |
2162 | for (i = 0; i < 3; i++) { | 2193 | for (i = 0; i < 3; i++) { |
2163 | data->temp[i] = | 2194 | data->temp[i] = |
2164 | it87_read_value(data, IT87_REG_TEMP(i)); | 2195 | it87_read_value(data, IT87_REG_TEMP(i)); |
2165 | data->temp_high[i] = | 2196 | data->temp_high[i] = |
2166 | it87_read_value(data, IT87_REG_TEMP_HIGH(i)); | 2197 | it87_read_value(data, IT87_REG_TEMP_HIGH(i)); |
2167 | data->temp_low[i] = | 2198 | data->temp_low[i] = |
2168 | it87_read_value(data, IT87_REG_TEMP_LOW(i)); | 2199 | it87_read_value(data, IT87_REG_TEMP_LOW(i)); |
2169 | } | 2200 | } |
2170 | 2201 | ||
2171 | /* Newer chips don't have clock dividers */ | 2202 | /* Newer chips don't have clock dividers */ |
2172 | if ((data->has_fan & 0x07) && !has_16bit_fans(data)) { | 2203 | if ((data->has_fan & 0x07) && !has_16bit_fans(data)) { |
2173 | i = it87_read_value(data, IT87_REG_FAN_DIV); | 2204 | i = it87_read_value(data, IT87_REG_FAN_DIV); |
2174 | data->fan_div[0] = i & 0x07; | 2205 | data->fan_div[0] = i & 0x07; |
2175 | data->fan_div[1] = (i >> 3) & 0x07; | 2206 | data->fan_div[1] = (i >> 3) & 0x07; |
2176 | data->fan_div[2] = (i & 0x40) ? 3 : 1; | 2207 | data->fan_div[2] = (i & 0x40) ? 3 : 1; |
2177 | } | 2208 | } |
2178 | 2209 | ||
2179 | data->alarms = | 2210 | data->alarms = |
2180 | it87_read_value(data, IT87_REG_ALARM1) | | 2211 | it87_read_value(data, IT87_REG_ALARM1) | |
2181 | (it87_read_value(data, IT87_REG_ALARM2) << 8) | | 2212 | (it87_read_value(data, IT87_REG_ALARM2) << 8) | |
2182 | (it87_read_value(data, IT87_REG_ALARM3) << 16); | 2213 | (it87_read_value(data, IT87_REG_ALARM3) << 16); |
2183 | data->beeps = it87_read_value(data, IT87_REG_BEEP_ENABLE); | 2214 | data->beeps = it87_read_value(data, IT87_REG_BEEP_ENABLE); |
2184 | 2215 | ||
2185 | data->fan_main_ctrl = it87_read_value(data, | 2216 | data->fan_main_ctrl = it87_read_value(data, |
2186 | IT87_REG_FAN_MAIN_CTRL); | 2217 | IT87_REG_FAN_MAIN_CTRL); |
2187 | data->fan_ctl = it87_read_value(data, IT87_REG_FAN_CTL); | 2218 | data->fan_ctl = it87_read_value(data, IT87_REG_FAN_CTL); |
2188 | for (i = 0; i < 3; i++) | 2219 | for (i = 0; i < 3; i++) |
2189 | it87_update_pwm_ctrl(data, i); | 2220 | it87_update_pwm_ctrl(data, i); |
2190 | 2221 | ||
2191 | data->sensor = it87_read_value(data, IT87_REG_TEMP_ENABLE); | 2222 | data->sensor = it87_read_value(data, IT87_REG_TEMP_ENABLE); |
2192 | /* The 8705 does not have VID capability. | 2223 | /* The 8705 does not have VID capability. |
2193 | The 8718 and later don't use IT87_REG_VID for the | 2224 | The 8718 and later don't use IT87_REG_VID for the |
2194 | same purpose. */ | 2225 | same purpose. */ |
2195 | if (data->type == it8712 || data->type == it8716) { | 2226 | if (data->type == it8712 || data->type == it8716) { |
2196 | data->vid = it87_read_value(data, IT87_REG_VID); | 2227 | data->vid = it87_read_value(data, IT87_REG_VID); |
2197 | /* The older IT8712F revisions had only 5 VID pins, | 2228 | /* The older IT8712F revisions had only 5 VID pins, |
2198 | but we assume it is always safe to read 6 bits. */ | 2229 | but we assume it is always safe to read 6 bits. */ |
2199 | data->vid &= 0x3f; | 2230 | data->vid &= 0x3f; |
2200 | } | 2231 | } |
2201 | data->last_updated = jiffies; | 2232 | data->last_updated = jiffies; |
2202 | data->valid = 1; | 2233 | data->valid = 1; |
2203 | } | 2234 | } |
2204 | 2235 | ||
2205 | mutex_unlock(&data->update_lock); | 2236 | mutex_unlock(&data->update_lock); |
2206 | 2237 | ||
2207 | return data; | 2238 | return data; |
2208 | } | 2239 | } |
2209 | 2240 | ||
2210 | static int __init it87_device_add(unsigned short address, | 2241 | static int __init it87_device_add(unsigned short address, |
2211 | const struct it87_sio_data *sio_data) | 2242 | const struct it87_sio_data *sio_data) |
2212 | { | 2243 | { |
2213 | struct resource res = { | 2244 | struct resource res = { |
2214 | .start = address + IT87_EC_OFFSET, | 2245 | .start = address + IT87_EC_OFFSET, |
2215 | .end = address + IT87_EC_OFFSET + IT87_EC_EXTENT - 1, | 2246 | .end = address + IT87_EC_OFFSET + IT87_EC_EXTENT - 1, |
2216 | .name = DRVNAME, | 2247 | .name = DRVNAME, |
2217 | .flags = IORESOURCE_IO, | 2248 | .flags = IORESOURCE_IO, |
2218 | }; | 2249 | }; |
2219 | int err; | 2250 | int err; |
2220 | 2251 | ||
2221 | err = acpi_check_resource_conflict(&res); | 2252 | err = acpi_check_resource_conflict(&res); |
2222 | if (err) | 2253 | if (err) |
2223 | goto exit; | 2254 | goto exit; |
2224 | 2255 | ||
2225 | pdev = platform_device_alloc(DRVNAME, address); | 2256 | pdev = platform_device_alloc(DRVNAME, address); |
2226 | if (!pdev) { | 2257 | if (!pdev) { |
2227 | err = -ENOMEM; | 2258 | err = -ENOMEM; |
2228 | pr_err("Device allocation failed\n"); | 2259 | pr_err("Device allocation failed\n"); |
2229 | goto exit; | 2260 | goto exit; |
2230 | } | 2261 | } |
2231 | 2262 | ||
2232 | err = platform_device_add_resources(pdev, &res, 1); | 2263 | err = platform_device_add_resources(pdev, &res, 1); |
2233 | if (err) { | 2264 | if (err) { |
2234 | pr_err("Device resource addition failed (%d)\n", err); | 2265 | pr_err("Device resource addition failed (%d)\n", err); |
2235 | goto exit_device_put; | 2266 | goto exit_device_put; |
2236 | } | 2267 | } |
2237 | 2268 | ||
2238 | err = platform_device_add_data(pdev, sio_data, | 2269 | err = platform_device_add_data(pdev, sio_data, |
2239 | sizeof(struct it87_sio_data)); | 2270 | sizeof(struct it87_sio_data)); |
2240 | if (err) { | 2271 | if (err) { |
2241 | pr_err("Platform data allocation failed\n"); | 2272 | pr_err("Platform data allocation failed\n"); |
2242 | goto exit_device_put; | 2273 | goto exit_device_put; |
2243 | } | 2274 | } |
2244 | 2275 | ||
2245 | err = platform_device_add(pdev); | 2276 | err = platform_device_add(pdev); |
2246 | if (err) { | 2277 | if (err) { |
2247 | pr_err("Device addition failed (%d)\n", err); | 2278 | pr_err("Device addition failed (%d)\n", err); |
2248 | goto exit_device_put; | 2279 | goto exit_device_put; |
2249 | } | 2280 | } |
2250 | 2281 | ||
2251 | return 0; | 2282 | return 0; |
2252 | 2283 | ||
2253 | exit_device_put: | 2284 | exit_device_put: |
2254 | platform_device_put(pdev); | 2285 | platform_device_put(pdev); |
2255 | exit: | 2286 | exit: |
2256 | return err; | 2287 | return err; |
2257 | } | 2288 | } |
2258 | 2289 | ||
2259 | static int __init sm_it87_init(void) | 2290 | static int __init sm_it87_init(void) |
2260 | { | 2291 | { |
2261 | int err; | 2292 | int err; |
2262 | unsigned short isa_address = 0; | 2293 | unsigned short isa_address = 0; |
2263 | struct it87_sio_data sio_data; | 2294 | struct it87_sio_data sio_data; |
2264 | 2295 | ||
2265 | memset(&sio_data, 0, sizeof(struct it87_sio_data)); | 2296 | memset(&sio_data, 0, sizeof(struct it87_sio_data)); |
2266 | err = it87_find(&isa_address, &sio_data); | 2297 | err = it87_find(&isa_address, &sio_data); |
2267 | if (err) | 2298 | if (err) |
2268 | return err; | 2299 | return err; |
2269 | err = platform_driver_register(&it87_driver); | 2300 | err = platform_driver_register(&it87_driver); |
2270 | if (err) | 2301 | if (err) |
2271 | return err; | 2302 | return err; |
2272 | 2303 | ||
2273 | err = it87_device_add(isa_address, &sio_data); | 2304 | err = it87_device_add(isa_address, &sio_data); |
2274 | if (err) { | 2305 | if (err) { |
2275 | platform_driver_unregister(&it87_driver); | 2306 | platform_driver_unregister(&it87_driver); |
2276 | return err; | 2307 | return err; |
2277 | } | 2308 | } |
2278 | 2309 | ||
2279 | return 0; | 2310 | return 0; |
2280 | } | 2311 | } |
2281 | 2312 | ||
2282 | static void __exit sm_it87_exit(void) | 2313 | static void __exit sm_it87_exit(void) |
2283 | { | 2314 | { |
2284 | platform_device_unregister(pdev); | 2315 | platform_device_unregister(pdev); |
2285 | platform_driver_unregister(&it87_driver); | 2316 | platform_driver_unregister(&it87_driver); |
2286 | } | 2317 | } |
2287 | 2318 | ||
2288 | 2319 | ||
2289 | MODULE_AUTHOR("Chris Gauthron, " | 2320 | MODULE_AUTHOR("Chris Gauthron, " |
2290 | "Jean Delvare <khali@linux-fr.org>"); | 2321 | "Jean Delvare <khali@linux-fr.org>"); |
2291 | MODULE_DESCRIPTION("IT8705F/IT871xF/IT872xF hardware monitoring driver"); | 2322 | MODULE_DESCRIPTION("IT8705F/IT871xF/IT872xF hardware monitoring driver"); |
2292 | module_param(update_vbat, bool, 0); | 2323 | module_param(update_vbat, bool, 0); |
2293 | MODULE_PARM_DESC(update_vbat, "Update vbat if set else return powerup value"); | 2324 | MODULE_PARM_DESC(update_vbat, "Update vbat if set else return powerup value"); |
2294 | module_param(fix_pwm_polarity, bool, 0); | 2325 | module_param(fix_pwm_polarity, bool, 0); |
2295 | MODULE_PARM_DESC(fix_pwm_polarity, | 2326 | MODULE_PARM_DESC(fix_pwm_polarity, |
2296 | "Force PWM polarity to active high (DANGEROUS)"); | 2327 | "Force PWM polarity to active high (DANGEROUS)"); |
2297 | MODULE_LICENSE("GPL"); | 2328 | MODULE_LICENSE("GPL"); |
2298 | 2329 | ||
2299 | module_init(sm_it87_init); | 2330 | module_init(sm_it87_init); |
2300 | module_exit(sm_it87_exit); | 2331 | module_exit(sm_it87_exit); |
2301 | 2332 |