Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2ff71258 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/hwmon-2.6

* master.kernel.org:/pub/scm/linux/kernel/git/gregkh/hwmon-2.6: (39 commits)
  hwmon: Remove Yuan Mu's address
  hwmon: Fix unchecked return status, SMSC chips
  hwmon: Fix unchecked return status, batch 6
  w83792d: Fix unchecked return status
  w83l785ts: Fix unchecked return status
  w83781d: Fix unchecked return status
  vt8231: Fix unchecked return status
  Fix unchecked return status, batch 5
  hwmon: Fix unchecked return status, batch 4
  hwmon: Fix unchecked return status, batch 3
  hwmon: Fix unchecked return status, batch 2
  w83627ehf: Fix unchecked return status
  pc87360: Check for error on sysfs files creation
  pc87360: Delete sysfs files on device deletion
  pc87360: Move some code around
  hwmon: Fix unchecked return status, batch 1
  vt1211: Document module parameters
  vt1211: Add documentation
  hwmon: New driver for the VIA VT1211
  w83791d: Documentation update
  ...
parents 6174d0fd 3379ceee
Loading
Loading
Loading
Loading
+47 −14
Original line number Diff line number Diff line
@@ -13,12 +13,25 @@ Supported chips:
                       from Super I/O config space (8 I/O ports)
    Datasheet: Publicly available at the ITE website
               http://www.ite.com.tw/
  * IT8716F
    Prefix: 'it8716'
    Addresses scanned: from Super I/O config space (8 I/O ports)
    Datasheet: Publicly available at the ITE website
               http://www.ite.com.tw/product_info/file/pc/IT8716F_V0.3.ZIP
  * IT8718F
    Prefix: 'it8718'
    Addresses scanned: from Super I/O config space (8 I/O ports)
    Datasheet: Publicly available at the ITE website
               http://www.ite.com.tw/product_info/file/pc/IT8718F_V0.2.zip
               http://www.ite.com.tw/product_info/file/pc/IT8718F_V0%203_(for%20C%20version).zip
  * SiS950   [clone of IT8705F]
    Prefix: 'it87'
    Addresses scanned: from Super I/O config space (8 I/O ports)
    Datasheet: No longer be available

Author: Christophe Gauthron <chrisg@0-in.com>
Authors:
    Christophe Gauthron <chrisg@0-in.com>
    Jean Delvare <khali@linux-fr.org>


Module Parameters
@@ -43,26 +56,46 @@ Module Parameters
Description
-----------

This driver implements support for the IT8705F, IT8712F and SiS950 chips.

This driver also supports IT8712F, which adds SMBus access, and a VID
input, used to report the Vcore voltage of the Pentium processor.
The IT8712F additionally features VID inputs.
This driver implements support for the IT8705F, IT8712F, IT8716F,
IT8718F and SiS950 chips.

These chips are 'Super I/O chips', supporting floppy disks, infrared ports,
joysticks and other miscellaneous stuff. For hardware monitoring, they
include an 'environment controller' with 3 temperature sensors, 3 fan
rotation speed sensors, 8 voltage sensors, and associated alarms.

The IT8712F and IT8716F additionally feature VID inputs, used to report
the Vcore voltage of the processor. The early IT8712F have 5 VID pins,
the IT8716F and late IT8712F have 6. They are shared with other functions
though, so the functionality may not be available on a given system.
The driver dumbly assume it is there.

The IT8718F also features VID inputs (up to 8 pins) but the value is
stored in the Super-I/O configuration space. Due to technical limitations,
this value can currently only be read once at initialization time, so
the driver won't notice and report changes in the VID value. The two
upper VID bits share their pins with voltage inputs (in5 and in6) so you
can't have both on a given board.

The IT8716F, IT8718F and later IT8712F revisions have support for
2 additional fans. They are not yet supported by the driver.

The IT8716F and IT8718F, and late IT8712F and IT8705F also have optional
16-bit tachometer counters for fans 1 to 3. This is better (no more fan
clock divider mess) but not compatible with the older chips and
revisions. For now, the driver only uses the 16-bit mode on the
IT8716F and IT8718F.

Temperatures are measured in degrees Celsius. An alarm is triggered once
when the Overtemperature Shutdown limit is crossed.

Fan rotation speeds are reported in RPM (rotations per minute). An alarm is
triggered if the rotation speed has dropped below a programmable limit. Fan
readings can be divided by a programmable divider (1, 2, 4 or 8) to give the
readings more range or accuracy. Not all RPM values can accurately be
represented, so some rounding is done. With a divider of 2, the lowest
representable value is around 2600 RPM.
triggered if the rotation speed has dropped below a programmable limit. When
16-bit tachometer counters aren't used, fan readings can be divided by
a programmable divider (1, 2, 4 or 8) to give the readings more range or
accuracy. With a divider of 2, the lowest representable value is around
2600 RPM. Not all RPM values can accurately be represented, so some rounding
is done.

Voltage sensors (also known as IN sensors) report their values in volts. An
alarm is triggered if the voltage has crossed a programmable minimum or
@@ -71,9 +104,9 @@ zero'; this is important for negative voltage measurements. All voltage
inputs can measure voltages between 0 and 4.08 volts, with a resolution of
0.016 volt. The battery voltage in8 does not have limit registers.

The VID lines (IT8712F only) encode the core voltage value: the voltage
level your processor should work with. This is hardcoded by the mainboard
and/or processor itself. It is a value in volts.
The VID lines (IT8712F/IT8716F/IT8718F) encode the core voltage value:
the voltage level your processor should work with. This is hardcoded by
the mainboard and/or processor itself. It is a value in volts.

If an alarm triggers, it will remain triggered until the hardware register
is read at least once. This means that the cause for the alarm may already
+52 −0
Original line number Diff line number Diff line
Kernel driver k8temp
====================

Supported chips:
  * AMD K8 CPU
    Prefix: 'k8temp'
    Addresses scanned: PCI space
    Datasheet: http://www.amd.com/us-en/assets/content_type/white_papers_and_tech_docs/32559.pdf

Author: Rudolf Marek
Contact: Rudolf Marek <r.marek@sh.cvut.cz>

Description
-----------

This driver permits reading temperature sensor(s) embedded inside AMD K8 CPUs.
Official documentation says that it works from revision F of K8 core, but
in fact it seems to be implemented for all revisions of K8 except the first
two revisions (SH-B0 and SH-B3).

There can be up to four temperature sensors inside single CPU. The driver
will auto-detect the sensors and will display only temperatures from
implemented sensors.

Mapping of /sys files is as follows:

temp1_input - temperature of Core 0 and "place" 0
temp2_input - temperature of Core 0 and "place" 1
temp3_input - temperature of Core 1 and "place" 0
temp4_input - temperature of Core 1 and "place" 1

Temperatures are measured in degrees Celsius and measurement resolution is
1 degree C. It is expected that future CPU will have better resolution. The
temperature is updated once a second. Valid temperatures are from -49 to
206 degrees C.

Temperature known as TCaseMax was specified for processors up to revision E.
This temperature is defined as temperature between heat-spreader and CPU
case, so the internal CPU temperature supplied by this driver can be higher.
There is no easy way how to measure the temperature which will correlate
with TCaseMax temperature.

For newer revisions of CPU (rev F, socket AM2) there is a mathematically
computed temperature called TControl, which must be lower than TControlMax.

The relationship is following:

temp1_input - TjOffset*2 < TControlMax,

TjOffset is not yet exported by the driver, TControlMax is usually
70 degrees C. The rule of the thumb -> CPU temperature should not cross
60 degrees C too much.
+206 −0
Original line number Diff line number Diff line
Kernel driver vt1211
====================

Supported chips:
  * VIA VT1211
    Prefix: 'vt1211'
    Addresses scanned: none, address read from Super-I/O config space
    Datasheet: Provided by VIA upon request and under NDA

Authors: Juerg Haefliger <juergh@gmail.com>

This driver is based on the driver for kernel 2.4 by Mark D. Studebaker and
its port to kernel 2.6 by Lars Ekman.

Thanks to Joseph Chan and Fiona Gatt from VIA for providing documentation and
technical support.


Module Parameters
-----------------

* uch_config: int	Override the BIOS default universal channel (UCH)
			configuration for channels 1-5.
			Legal values are in the range of 0-31. Bit 0 maps to
			UCH1, bit 1 maps to UCH2 and so on. Setting a bit to 1
			enables the thermal input of that particular UCH and
			setting a bit to 0 enables the voltage input.

* int_mode: int		Override the BIOS default temperature interrupt mode.
			The only possible value is 0 which forces interrupt
			mode 0. In this mode, any pending interrupt is cleared
			when the status register is read but is regenerated as
			long as the temperature stays above the hysteresis
			limit.

Be aware that overriding BIOS defaults might cause some unwanted side effects!


Description
-----------

The VIA VT1211 Super-I/O chip includes complete hardware monitoring
capabilities. It monitors 2 dedicated temperature sensor inputs (temp1 and
temp2), 1 dedicated voltage (in5) and 2 fans. Additionally, the chip
implements 5 universal input channels (UCH1-5) that can be individually
programmed to either monitor a voltage or a temperature.

This chip also provides manual and automatic control of fan speeds (according
to the datasheet). The driver only supports automatic control since the manual
mode doesn't seem to work as advertised in the datasheet. In fact I couldn't
get manual mode to work at all! Be aware that automatic mode hasn't been
tested very well (due to the fact that my EPIA M10000 doesn't have the fans
connected to the PWM outputs of the VT1211 :-().

The following table shows the relationship between the vt1211 inputs and the
sysfs nodes.

Sensor          Voltage Mode   Temp Mode   Default Use (from the datasheet)
------          ------------   ---------   --------------------------------
Reading 1                      temp1       Intel thermal diode
Reading 3                      temp2       Internal thermal diode
UCH1/Reading2   in0            temp3       NTC type thermistor
UCH2            in1            temp4       +2.5V
UCH3            in2            temp5       VccP (processor core)
UCH4            in3            temp6       +5V
UCH5            in4            temp7       +12V
+3.3V           in5                        Internal VCC (+3.3V)


Voltage Monitoring
------------------

Voltages are sampled by an 8-bit ADC with a LSB of ~10mV. The supported input
range is thus from 0 to 2.60V. Voltage values outside of this range need
external scaling resistors. This external scaling needs to be compensated for
via compute lines in sensors.conf, like:

compute inx @*(1+R1/R2), @/(1+R1/R2)

The board level scaling resistors according to VIA's recommendation are as
follows. And this is of course totally dependent on the actual board
implementation :-) You will have to find documentation for your own
motherboard and edit sensors.conf accordingly.

                                      Expected
Voltage       R1     R2     Divider   Raw Value
-----------------------------------------------
+2.5V         2K     10K    1.2       2083 mV
VccP          ---    ---    1.0       1400 mV (1)
+5V           14K    10K    2.4       2083 mV
+12V          47K    10K    5.7       2105 mV
+3.3V (int)   2K     3.4K   1.588     3300 mV (2)
+3.3V (ext)   6.8K   10K    1.68      1964 mV

(1) Depending on the CPU (1.4V is for a VIA C3 Nehemiah).
(2) R1 and R2 for 3.3V (int) are internal to the VT1211 chip and the driver
    performs the scaling and returns the properly scaled voltage value.

Each measured voltage has an associated low and high limit which triggers an
alarm when crossed.


Temperature Monitoring
----------------------

Temperatures are reported in millidegree Celsius. Each measured temperature
has a high limit which triggers an alarm if crossed. There is an associated
hysteresis value with each temperature below which the temperature has to drop
before the alarm is cleared (this is only true for interrupt mode 0). The
interrupt mode can be forced to 0 in case the BIOS doesn't do it
automatically. See the 'Module Parameters' section for details.

All temperature channels except temp2 are external. Temp2 is the VT1211
internal thermal diode and the driver does all the scaling for temp2 and
returns the temperature in millidegree Celsius. For the external channels
temp1 and temp3-temp7, scaling depends on the board implementation and needs
to be performed in userspace via sensors.conf.

Temp1 is an Intel-type thermal diode which requires the following formula to
convert between sysfs readings and real temperatures:

compute temp1 (@-Offset)/Gain, (@*Gain)+Offset

According to the VIA VT1211 BIOS porting guide, the following gain and offset
values should be used:

Diode Type      Offset   Gain
----------      ------   ----
Intel CPU       88.638   0.9528
                65.000   0.9686   *)
VIA C3 Ezra     83.869   0.9528
VIA C3 Ezra-T   73.869   0.9528

*) This is the formula from the lm_sensors 2.10.0 sensors.conf file. I don't
know where it comes from or how it was derived, it's just listed here for
completeness.

Temp3-temp7 support NTC thermistors. For these channels, the driver returns
the voltages as seen at the individual pins of UCH1-UCH5. The voltage at the
pin (Vpin) is formed by a voltage divider made of the thermistor (Rth) and a
scaling resistor (Rs):

Vpin = 2200 * Rth / (Rs + Rth)   (2200 is the ADC max limit of 2200 mV)

The equation for the thermistor is as follows (google it if you want to know
more about it):

Rth = Ro * exp(B * (1 / T - 1 / To))   (To is 298.15K (25C) and Ro is the
                                        nominal resistance at 25C)

Mingling the above two equations and assuming Rs = Ro and B = 3435 yields the
following formula for sensors.conf:

compute tempx 1 / (1 / 298.15 - (` (2200 / @ - 1)) / 3435) - 273.15,
              2200 / (1 + (^ (3435 / 298.15 - 3435 / (273.15 + @))))


Fan Speed Control
-----------------

The VT1211 provides 2 programmable PWM outputs to control the speeds of 2
fans. Writing a 2 to any of the two pwm[1-2]_enable sysfs nodes will put the
PWM controller in automatic mode. There is only a single controller that
controls both PWM outputs but each PWM output can be individually enabled and
disabled.

Each PWM has 4 associated distinct output duty-cycles: full, high, low and
off. Full and off are internally hard-wired to 255 (100%) and 0 (0%),
respectively. High and low can be programmed via
pwm[1-2]_auto_point[2-3]_pwm. Each PWM output can be associated with a
different thermal input but - and here's the weird part - only one set of
thermal thresholds exist that controls both PWMs output duty-cycles. The
thermal thresholds are accessible via pwm[1-2]_auto_point[1-4]_temp. Note
that even though there are 2 sets of 4 auto points each, they map to the same
registers in the VT1211 and programming one set is sufficient (actually only
the first set pwm1_auto_point[1-4]_temp is writable, the second set is
read-only).

PWM Auto Point             PWM Output Duty-Cycle
------------------------------------------------
pwm[1-2]_auto_point4_pwm   full speed duty-cycle (hard-wired to 255)
pwm[1-2]_auto_point3_pwm   high speed duty-cycle
pwm[1-2]_auto_point2_pwm   low speed duty-cycle
pwm[1-2]_auto_point1_pwm   off duty-cycle (hard-wired to 0)

Temp Auto Point             Thermal Threshold
---------------------------------------------
pwm[1-2]_auto_point4_temp   full speed temp
pwm[1-2]_auto_point3_temp   high speed temp
pwm[1-2]_auto_point2_temp   low speed temp
pwm[1-2]_auto_point1_temp   off temp

Long story short, the controller implements the following algorithm to set the
PWM output duty-cycle based on the input temperature:

Thermal Threshold             Output Duty-Cycle
                    (Rising Temp)           (Falling Temp)
----------------------------------------------------------
                    full speed duty-cycle   full speed duty-cycle
full speed temp
                    high speed duty-cycle   full speed duty-cycle
high speed temp
                    low speed duty-cycle    high speed duty-cycle
low speed temp
                    off duty-cycle          low speed duty-cycle
off temp
+85 −0
Original line number Diff line number Diff line
Kernel driver w83627ehf
=======================

Supported chips:
  * Winbond W83627EHF/EHG (ISA access ONLY)
    Prefix: 'w83627ehf'
    Addresses scanned: ISA address retrieved from Super I/O registers
    Datasheet: http://www.winbond-usa.com/products/winbond_products/pdfs/PCIC/W83627EHF_%20W83627EHGb.pdf

Authors:
        Jean Delvare <khali@linux-fr.org>
        Yuan Mu (Winbond)
        Rudolf Marek <r.marek@sh.cvut.cz>

Description
-----------

This driver implements support for the Winbond W83627EHF and W83627EHG
super I/O chips. We will refer to them collectively as Winbond chips.

The chips implement three temperature sensors, five fan rotation
speed sensors, ten analog voltage sensors, alarms with beep warnings (control
unimplemented), and some automatic fan regulation strategies (plus manual
fan control mode).

Temperatures are measured in degrees Celsius and measurement resolution is 1
degC for temp1 and 0.5 degC for temp2 and temp3. An alarm is triggered when
the temperature gets higher than high limit; it stays on until the temperature
falls below the Hysteresis value.

Fan rotation speeds are reported in RPM (rotations per minute). An alarm is
triggered if the rotation speed has dropped below a programmable limit. Fan
readings can be divided by a programmable divider (1, 2, 4, 8, 16, 32, 64 or
128) to give the readings more range or accuracy. The driver sets the most
suitable fan divisor itself. Some fans might not be present because they
share pins with other functions.

Voltage sensors (also known as IN sensors) report their values in millivolts.
An alarm is triggered if the voltage has crossed a programmable minimum
or maximum limit.

The driver supports automatic fan control mode known as Thermal Cruise.
In this mode, the chip attempts to keep the measured temperature in a
predefined temperature range. If the temperature goes out of range, fan
is driven slower/faster to reach the predefined range again.

The mode works for fan1-fan4. Mapping of temperatures to pwm outputs is as
follows:

temp1 -> pwm1
temp2 -> pwm2
temp3 -> pwm3
prog  -> pwm4 (the programmable setting is not supported by the driver)

/sys files
----------

pwm[1-4] - this file stores PWM duty cycle or DC value (fan speed) in range:
	   0 (stop) to 255 (full)

pwm[1-4]_enable - this file controls mode of fan/temperature control:
	* 1 Manual Mode, write to pwm file any value 0-255 (full speed)
	* 2 Thermal Cruise

Thermal Cruise mode
-------------------

If the temperature is in the range defined by:

pwm[1-4]_target    - set target temperature, unit millidegree Celcius
		     (range 0 - 127000)
pwm[1-4]_tolerance - tolerance, unit millidegree Celcius (range 0 - 15000)

there are no changes to fan speed. Once the temperature leaves the interval,
fan speed increases (temp is higher) or decreases if lower than desired.
There are defined steps and times, but not exported by the driver yet.

pwm[1-4]_min_output - minimum fan speed (range 1 - 255), when the temperature
                      is below defined range.
pwm[1-4]_stop_time  - how many milliseconds [ms] must elapse to switch
                      corresponding fan off. (when the temperature was below
                      defined range).

Note: last two functions are influenced by other control bits, not yet exported
      by the driver, so a change might not have any effect.
+38 −31
Original line number Diff line number Diff line
@@ -5,7 +5,7 @@ Supported chips:
  * Winbond W83791D
    Prefix: 'w83791d'
    Addresses scanned: I2C 0x2c - 0x2f
    Datasheet: http://www.winbond-usa.com/products/winbond_products/pdfs/PCIC/W83791Da.pdf
    Datasheet: http://www.winbond-usa.com/products/winbond_products/pdfs/PCIC/W83791D_W83791Gb.pdf

Author: Charles Spirakis <bezaur@gmail.com>

@@ -20,6 +20,9 @@ Credits:
    Chunhao Huang <DZShen@Winbond.com.tw>,
    Rudolf Marek <r.marek@sh.cvut.cz>

Additional contributors:
    Sven Anders <anders@anduras.de>

Module Parameters
-----------------

@@ -46,7 +49,8 @@ Module Parameters
Description
-----------

This driver implements support for the Winbond W83791D chip.
This driver implements support for the Winbond W83791D chip. The W83791G
chip appears to be the same as the W83791D but is lead free.

Detection of the chip can sometimes be foiled because it can be in an
internal state that allows no clean access (Bank with ID register is not
@@ -71,34 +75,36 @@ Voltage sensors (also known as IN sensors) report their values in millivolts.
An alarm is triggered if the voltage has crossed a programmable minimum
or maximum limit.

Alarms are provided as output from a "realtime status register". The
following bits are defined:

bit - alarm on:
0  - Vcore
1  - VINR0
2  - +3.3VIN
3  - 5VDD
4  - temp1
5  - temp2
6  - fan1
7  - fan2
8  - +12VIN
9  - -12VIN
10 - -5VIN
11 - fan3
12 - chassis
13 - temp3
14 - VINR1
15 - reserved
16 - tart1
17 - tart2
18 - tart3
19 - VSB
20 - VBAT
21 - fan4
22 - fan5
23 - reserved
The bit ordering for the alarm "realtime status register" and the
"beep enable registers" are different.

in0 (VCORE)  :  alarms: 0x000001 beep_enable: 0x000001
in1 (VINR0)  :  alarms: 0x000002 beep_enable: 0x002000 <== mismatch
in2 (+3.3VIN):  alarms: 0x000004 beep_enable: 0x000004
in3 (5VDD)   :  alarms: 0x000008 beep_enable: 0x000008
in4 (+12VIN) :  alarms: 0x000100 beep_enable: 0x000100
in5 (-12VIN) :  alarms: 0x000200 beep_enable: 0x000200
in6 (-5VIN)  :  alarms: 0x000400 beep_enable: 0x000400
in7 (VSB)    :  alarms: 0x080000 beep_enable: 0x010000 <== mismatch
in8 (VBAT)   :  alarms: 0x100000 beep_enable: 0x020000 <== mismatch
in9 (VINR1)  :  alarms: 0x004000 beep_enable: 0x004000
temp1        :  alarms: 0x000010 beep_enable: 0x000010
temp2        :  alarms: 0x000020 beep_enable: 0x000020
temp3        :  alarms: 0x002000 beep_enable: 0x000002 <== mismatch
fan1         :  alarms: 0x000040 beep_enable: 0x000040
fan2         :  alarms: 0x000080 beep_enable: 0x000080
fan3         :  alarms: 0x000800 beep_enable: 0x000800
fan4         :  alarms: 0x200000 beep_enable: 0x200000
fan5         :  alarms: 0x400000 beep_enable: 0x400000
tart1        :  alarms: 0x010000 beep_enable: 0x040000 <== mismatch
tart2        :  alarms: 0x020000 beep_enable: 0x080000 <== mismatch
tart3        :  alarms: 0x040000 beep_enable: 0x100000 <== mismatch
case_open    :  alarms: 0x001000 beep_enable: 0x001000
user_enable  :  alarms: -------- beep_enable: 0x800000

*** NOTE: It is the responsibility of user-space code to handle the fact
that the beep enable and alarm bits are in different positions when using that
feature of the chip.

When an alarm goes off, you can be warned by a beeping signal through your
computer speaker. It is possible to enable all beeping globally, or only
@@ -109,5 +115,6 @@ often will do no harm, but will return 'old' values.

W83791D TODO:
---------------
Provide a patch for per-file alarms as discussed on the mailing list
Provide a patch for per-file alarms and beep enables as defined in the hwmon
	documentation (Documentation/hwmon/sysfs-interface)
Provide a patch for smart-fan control (still need appropriate motherboard/fans)
Loading