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 adt7470
^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)   * Analog Devices ADT7470
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8)     Prefix: 'adt7470'
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)     Addresses scanned: I2C 0x2C, 0x2E, 0x2F
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)     Datasheet: Publicly available at the Analog Devices website
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) Author: Darrick J. Wong
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) Description
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) -----------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) This driver implements support for the Analog Devices ADT7470 chip.  There may
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) be other chips that implement this interface.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) The ADT7470 uses the 2-wire interface compatible with the SMBus 2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) specification. Using an analog to digital converter it measures up to ten (10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) external temperatures. It has four (4) 16-bit counters for measuring fan speed.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) There are four (4) PWM outputs that can be used to control fan speed.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) A sophisticated control system for the PWM outputs is designed into the ADT7470
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) that allows fan speed to be adjusted automatically based on any of the ten
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) temperature sensors. Each PWM output is individually adjustable and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) programmable. Once configured, the ADT7470 will adjust the PWM outputs in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) response to the measured temperatures with further host intervention.  This
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) feature can also be disabled for manual control of the PWM's.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) Each of the measured inputs (temperature, fan speed) has corresponding high/low
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) limit values. The ADT7470 will signal an ALARM if any measured value exceeds
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) either limit.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) The ADT7470 samples all inputs continuously.  A kernel thread is started up for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) the purpose of periodically querying the temperature sensors, thus allowing the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) automatic fan pwm control to set the fan speed.  The driver will not read the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) registers more often than once every 5 seconds.  Further, configuration data is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) only read once per minute.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) Special Features
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) ----------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) The ADT7470 has a 8-bit ADC and is capable of measuring temperatures with 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) degC resolution.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) The Analog Devices datasheet is very detailed and describes a procedure for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) determining an optimal configuration for the automatic PWM control.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) Configuration Notes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) -------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) Besides standard interfaces driver adds the following:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) * PWM Control
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) * pwm#_auto_point1_pwm and pwm#_auto_point1_temp and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) * pwm#_auto_point2_pwm and pwm#_auto_point2_temp -
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63)   - point1: Set the pwm speed at a lower temperature bound.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64)   - point2: Set the pwm speed at a higher temperature bound.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) The ADT7470 will scale the pwm between the lower and higher pwm speed when
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) the temperature is between the two temperature boundaries.  PWM values range
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) from 0 (off) to 255 (full speed).  Fan speed will be set to maximum when the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) temperature sensor associated with the PWM control exceeds
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) pwm#_auto_point2_temp.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) The driver also allows control of the PWM frequency:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) * pwm1_freq
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) The PWM frequency is rounded to the nearest one of:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) * 11.0 Hz
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) * 14.7 Hz
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) * 22.1 Hz
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) * 29.4 Hz
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) * 35.3 Hz
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) * 44.1 Hz
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) * 58.8 Hz
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) * 88.2 Hz
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) * 1.4 kHz
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) * 22.5 kHz
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) Notes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) -----
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) The temperature inputs no longer need to be read periodically from userspace in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) order for the automatic pwm algorithm to run.  This was the case for earlier
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) versions of the driver.