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 adm1026
^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)   * Analog Devices ADM1026
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)     Prefix: 'adm1026'
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9)     Addresses scanned: I2C 0x2c, 0x2d, 0x2e
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11)     Datasheet: Publicly available at the Analog Devices website
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) 	       https://www.onsemi.com/PowerSolutions/product.do?id=ADM1026
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) Authors:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) 	- Philip Pokorny <ppokorny@penguincomputing.com> for Penguin Computing
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) 	- Justin Thiessen <jthiessen@penguincomputing.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) Module Parameters
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) -----------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) * gpio_input: int array (min = 1, max = 17)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23)     List of GPIO pins (0-16) to program as inputs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) * gpio_output: int array (min = 1, max = 17)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26)     List of GPIO pins (0-16) to program as outputs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) * gpio_inverted: int array (min = 1, max = 17)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29)     List of GPIO pins (0-16) to program as inverted
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) * gpio_normal: int array (min = 1, max = 17)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32)     List of GPIO pins (0-16) to program as normal/non-inverted
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) * gpio_fan: int array (min = 1, max = 8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35)     List of GPIO pins (0-7) to program as fan tachs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) Description
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) -----------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) This driver implements support for the Analog Devices ADM1026. Analog
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) Devices calls it a "complete thermal system management controller."
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) The ADM1026 implements three (3) temperature sensors, 17 voltage sensors,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 16 general purpose digital I/O lines, eight (8) fan speed sensors (8-bit),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) an analog output and a PWM output along with limit, alarm and mask bits for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) all of the above. There is even 8k bytes of EEPROM memory on chip.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) Temperatures are measured in degrees Celsius. There are two external
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) sensor inputs and one internal sensor. Each sensor has a high and low
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) limit. If the limit is exceeded, an interrupt (#SMBALERT) can be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) generated. The interrupts can be masked. In addition, there are over-temp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) limits for each sensor. If this limit is exceeded, the #THERM output will
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) be asserted. The current temperature and limits have a resolution of 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) degree.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) Fan rotation speeds are reported in RPM (rotations per minute) but measured
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) in counts of a 22.5kHz internal clock. Each fan has a high limit which
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) corresponds to a minimum fan speed. If the limit is exceeded, an interrupt
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) can be generated. Each fan can be programmed to divide the reference clock
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) by 1, 2, 4 or 8. Not all RPM values can accurately be represented, so some
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) rounding is done. With a divider of 8, the slowest measurable speed of a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) two pulse per revolution fan is 661 RPM.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) There are 17 voltage sensors. An alarm is triggered if the voltage has
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) crossed a programmable minimum or maximum limit. Note that minimum in this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) case always means 'closest to zero'; this is important for negative voltage
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) measurements. Several inputs have integrated attenuators so they can measure
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) higher voltages directly. 3.3V, 5V, 12V, -12V and battery voltage all have
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) dedicated inputs. There are several inputs scaled to 0-3V full-scale range
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) for SCSI terminator power. The remaining inputs are not scaled and have
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) a 0-2.5V full-scale range. A 2.5V or 1.82V reference voltage is provided
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) for negative voltage measurements.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) If an alarm triggers, it will remain triggered until the hardware register
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) is read at least once. This means that the cause for the alarm may already
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) have disappeared! Note that in the current implementation, all hardware
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) registers are read whenever any data is read (unless it is less than 2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) seconds since the last update). This means that you can easily miss
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) once-only alarms.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) The ADM1026 measures continuously. Analog inputs are measured about 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) times a second. Fan speed measurement time depends on fan speed and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) divisor. It can take as long as 1.5 seconds to measure all fan speeds.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) The ADM1026 has the ability to automatically control fan speed based on the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) temperature sensor inputs. Both the PWM output and the DAC output can be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) used to control fan speed. Usually only one of these two outputs will be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) used. Write the minimum PWM or DAC value to the appropriate control
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) register. Then set the low temperature limit in the tmin values for each
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) temperature sensor. The range of control is fixed at 20 °C, and the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) largest difference between current and tmin of the temperature sensors sets
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) the control output. See the datasheet for several example circuits for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) controlling fan speed with the PWM and DAC outputs. The fan speed sensors
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) do not have PWM compensation, so it is probably best to control the fan
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) voltage from the power lead rather than on the ground lead.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) The datasheet shows an example application with VID signals attached to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) GPIO lines. Unfortunately, the chip may not be connected to the VID lines
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) in this way. The driver assumes that the chips *is* connected this way to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) get a VID voltage.