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 da9052
^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)   * Dialog Semiconductors DA9052-BC and DA9053-AA/Bx PMICs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8)     Prefix: 'da9052'
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)     Datasheet: Datasheet is not publicly available.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) Authors: David Dajun Chen <dchen@diasemi.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) Description
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) -----------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) The DA9052/53 provides an Analogue to Digital Converter (ADC) with 10 bits
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) resolution and track and hold circuitry combined with an analogue input
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) multiplexer. The analogue input multiplexer will allow conversion of up to 10
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) different inputs. The track and hold circuit ensures stable input voltages at
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) the input of the ADC during the conversion.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) The ADC is used to measure the following inputs:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) ========= ===================================================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) Channel 0 VDDOUT - measurement of the system voltage
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) Channel 1 ICH - internal battery charger current measurement
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) Channel 2 TBAT - output from the battery NTC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) Channel 3 VBAT - measurement of the battery voltage
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) Channel 4 ADC_IN4 - high impedance input (0 - 2.5V)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) Channel 5 ADC_IN5 - high impedance input (0 - 2.5V)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) Channel 6 ADC_IN6 - high impedance input (0 - 2.5V)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) Channel 7 XY - TSI interface to measure the X and Y voltage of the touch
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) 	  screen resistive potentiometers
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) Channel 8 Internal Tjunc. - sense (internal temp. sensor)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) Channel 9 VBBAT - measurement of the backup battery voltage
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) ========= ===================================================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) By using sysfs attributes we can measure the system voltage VDDOUT, the battery
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) charging current ICH, battery temperature TBAT, battery junction temperature
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) TJUNC, battery voltage VBAT and the back up battery voltage VBBAT.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) Voltage Monitoring
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) ------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) Voltages are sampled by a 10 bit ADC.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) The battery voltage is calculated as:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) 	Milli volt = ((ADC value * 1000) / 512) + 2500
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) The backup battery voltage is calculated as:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) 	Milli volt = (ADC value * 2500) / 512;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) The voltages on ADC channels 4, 5 and 6 are calculated as:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) 	Milli volt = (ADC value * 2500) / 1023
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) Temperature Monitoring
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) ----------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) Temperatures are sampled by a 10 bit ADC.  Junction and battery temperatures
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) are monitored by the ADC channels.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) The junction temperature is calculated:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) 	Degrees celsius = 1.708 * (TJUNC_RES - T_OFFSET) - 108.8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) The junction temperature attribute is supported by the driver.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) The battery temperature is calculated:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) 	Degree Celsius = 1 / (t1 + 1/298) - 273
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) where t1 = (1/B)* ln(( ADCval * 2.5)/(R25*ITBAT*255))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) Default values of R25, B, ITBAT are 10e3, 3380 and 50e-6 respectively.