Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) Kernel driver w83792d
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) =====================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4) Supported chips:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)   * Winbond W83792D
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8)     Prefix: 'w83792d'
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10)     Addresses scanned: I2C 0x2c - 0x2f
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12)     Datasheet: http://www.winbond.com.tw
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) Author: Shane Huang (Winbond)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) Updated: Roger Lucas
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) Module Parameters
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) -----------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) * init int
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22)     (default 1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24)     Use 'init=0' to bypass initializing the chip.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25)     Try this if your computer crashes when you load the module.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) * force_subclients=bus,caddr,saddr,saddr
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28)     This is used to force the i2c addresses for subclients of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29)     a certain chip. Example usage is `force_subclients=0,0x2f,0x4a,0x4b`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30)     to force the subclients of chip 0x2f on bus 0 to i2c addresses
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31)     0x4a and 0x4b.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) Description
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) -----------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) This driver implements support for the Winbond W83792AD/D.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) Detection of the chip can sometimes be foiled because it can be in an
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) internal state that allows no clean access (Bank with ID register is not
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) currently selected). If you know the address of the chip, use a 'force'
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) parameter; this will put it into a more well-behaved state first.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) The driver implements three temperature sensors, seven fan rotation speed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) sensors, nine voltage sensors, and two automatic fan regulation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) strategies called: Smart Fan I (Thermal Cruise mode) and Smart Fan II.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) The driver also implements up to seven fan control outputs: pwm1-7.  Pwm1-7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) can be configured to PWM output or Analogue DC output via their associated
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) pwmX_mode. Outputs pwm4 through pwm7 may or may not be present depending on
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) how the W83792AD/D was configured by the BIOS.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) Automatic fan control mode is possible only for fan1-fan3.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) For all pwmX outputs, a value of 0 means minimum fan speed and a value of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 255 means maximum fan speed.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) Temperatures are measured in degrees Celsius and measurement resolution is 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) degC for temp1 and 0.5 degC for temp2 and temp3. An alarm is triggered when
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) the temperature gets higher than the Overtemperature Shutdown value; it stays
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) on until the temperature falls below the Hysteresis value.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) Fan rotation speeds are reported in RPM (rotations per minute). An alarm is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) triggered if the rotation speed has dropped below a programmable limit. Fan
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) readings can be divided by a programmable divider (1, 2, 4, 8, 16, 32, 64 or
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 128) to give the readings more range or accuracy.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) Voltage sensors (also known as IN sensors) report their values in millivolts.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) An alarm is triggered if the voltage has crossed a programmable minimum
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) or maximum limit.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) Alarms are provided as output from "realtime status register". Following bits
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) are defined:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) ==== ==========
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) bit   alarm on
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) ==== ==========
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 0    in0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 1    in1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 2    temp1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 3    temp2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 4    temp3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 5    fan1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 6    fan2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 7    fan3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 8    in2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 9    in3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 10   in4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 11   in5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 12   in6
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 13   VID change
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 14   chassis
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 15   fan7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 16   tart1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 17   tart2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 18   tart3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 19   in7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 20   in8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 21   fan4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 22   fan5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 23   fan6
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) ==== ==========
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) Tart will be asserted while target temperature cannot be achieved after 3 minutes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) of full speed rotation of corresponding fan.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) In addition to the alarms described above, there is a CHAS alarm on the chips
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) which triggers if your computer case is open (This one is latched, contrary
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) to realtime alarms).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) The chips only update values each 3 seconds; reading them more often will
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) do no harm, but will return 'old' values.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) W83792D PROBLEMS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) ----------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) Known problems:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 	- This driver is only for Winbond W83792D C version device, there
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 	  are also some motherboards with B version W83792D device. The
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 	  calculation method to in6-in7(measured value, limits) is a little
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 	  different between C and B version. C or B version can be identified
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 	  by CR[0x49h].
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 	- The function of vid and vrm has not been finished, because I'm NOT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 	  very familiar with them. Adding support is welcome.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 	- The function of chassis open detection needs more tests.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 	- If you have ASUS server board and chip was not found: Then you will
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 	  need to upgrade to latest (or beta) BIOS. If it does not help please
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 	  contact us.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) Fan control
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) -----------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) Manual mode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) -----------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) Works as expected. You just need to specify desired PWM/DC value (fan speed)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) in appropriate pwm# file.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) Thermal cruise
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) --------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) In this mode, W83792D provides the Smart Fan system to automatically control
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) fan speed to keep the temperatures of CPU and the system within specific
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) range. At first a wanted temperature and interval must be set. This is done
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) via thermal_cruise# file. The tolerance# file serves to create T +- tolerance
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) interval. The fan speed will be lowered as long as the current temperature
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) remains below the thermal_cruise# +- tolerance# value. Once the temperature
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) exceeds the high limit (T+tolerance), the fan will be turned on with a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) specific speed set by pwm# and automatically controlled its PWM duty cycle
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) with the temperature varying. Three conditions may occur:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) (1) If the temperature still exceeds the high limit, PWM duty
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) cycle will increase slowly.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) (2) If the temperature goes below the high limit, but still above the low
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) limit (T-tolerance), the fan speed will be fixed at the current speed because
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) the temperature is in the target range.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) (3) If the temperature goes below the low limit, PWM duty cycle will decrease
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) slowly to 0 or a preset stop value until the temperature exceeds the low
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) limit. (The preset stop value handling is not yet implemented in driver)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) Smart Fan II
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) ------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) W83792D also provides a special mode for fan. Four temperature points are
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) available. When related temperature sensors detects the temperature in preset
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) temperature region (sf2_point@_fan# +- tolerance#) it will cause fans to run
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) on programmed value from sf2_level@_fan#. You need to set four temperatures
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) for each fan.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) /sys files
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) ----------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) pwm[1-7]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 	- this file stores PWM duty cycle or DC value (fan speed) in range:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 	    0 (stop) to 255 (full)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) pwm[1-3]_enable
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 	- this file controls mode of fan/temperature control:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 	    * 0 Disabled
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 	    * 1 Manual mode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 	    * 2 Smart Fan II
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 	    * 3 Thermal Cruise
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) pwm[1-7]_mode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 	- Select PWM or DC mode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 	    * 0 DC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 	    * 1 PWM
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) thermal_cruise[1-3]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 	- Selects the desired temperature for cruise (degC)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) tolerance[1-3]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 	- Value in degrees of Celsius (degC) for +- T
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) sf2_point[1-4]_fan[1-3]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 	- four temperature points for each fan for Smart Fan II
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) sf2_level[1-3]_fan[1-3]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 	- three PWM/DC levels for each fan for Smart Fan II