17ebd8b66SMauro Carvalho ChehabKernel driver da9052
27ebd8b66SMauro Carvalho Chehab====================
37ebd8b66SMauro Carvalho Chehab
47ebd8b66SMauro Carvalho ChehabSupported chips:
57ebd8b66SMauro Carvalho Chehab
67ebd8b66SMauro Carvalho Chehab  * Dialog Semiconductors DA9052-BC and DA9053-AA/Bx PMICs
77ebd8b66SMauro Carvalho Chehab
87ebd8b66SMauro Carvalho Chehab    Prefix: 'da9052'
97ebd8b66SMauro Carvalho Chehab
107ebd8b66SMauro Carvalho Chehab    Datasheet: Datasheet is not publicly available.
117ebd8b66SMauro Carvalho Chehab
127ebd8b66SMauro Carvalho ChehabAuthors: David Dajun Chen <dchen@diasemi.com>
137ebd8b66SMauro Carvalho Chehab
147ebd8b66SMauro Carvalho ChehabDescription
157ebd8b66SMauro Carvalho Chehab-----------
167ebd8b66SMauro Carvalho Chehab
177ebd8b66SMauro Carvalho ChehabThe DA9052/53 provides an Analogue to Digital Converter (ADC) with 10 bits
187ebd8b66SMauro Carvalho Chehabresolution and track and hold circuitry combined with an analogue input
197ebd8b66SMauro Carvalho Chehabmultiplexer. The analogue input multiplexer will allow conversion of up to 10
207ebd8b66SMauro Carvalho Chehabdifferent inputs. The track and hold circuit ensures stable input voltages at
217ebd8b66SMauro Carvalho Chehabthe input of the ADC during the conversion.
227ebd8b66SMauro Carvalho Chehab
237ebd8b66SMauro Carvalho ChehabThe ADC is used to measure the following inputs:
247ebd8b66SMauro Carvalho Chehab
257ebd8b66SMauro Carvalho Chehab========= ===================================================================
267ebd8b66SMauro Carvalho ChehabChannel 0 VDDOUT - measurement of the system voltage
277ebd8b66SMauro Carvalho ChehabChannel 1 ICH - internal battery charger current measurement
287ebd8b66SMauro Carvalho ChehabChannel 2 TBAT - output from the battery NTC
297ebd8b66SMauro Carvalho ChehabChannel 3 VBAT - measurement of the battery voltage
307ebd8b66SMauro Carvalho ChehabChannel 4 ADC_IN4 - high impedance input (0 - 2.5V)
317ebd8b66SMauro Carvalho ChehabChannel 5 ADC_IN5 - high impedance input (0 - 2.5V)
327ebd8b66SMauro Carvalho ChehabChannel 6 ADC_IN6 - high impedance input (0 - 2.5V)
337ebd8b66SMauro Carvalho ChehabChannel 7 XY - TSI interface to measure the X and Y voltage of the touch
347ebd8b66SMauro Carvalho Chehab	  screen resistive potentiometers
357ebd8b66SMauro Carvalho ChehabChannel 8 Internal Tjunc. - sense (internal temp. sensor)
367ebd8b66SMauro Carvalho ChehabChannel 9 VBBAT - measurement of the backup battery voltage
377ebd8b66SMauro Carvalho Chehab========= ===================================================================
387ebd8b66SMauro Carvalho Chehab
397ebd8b66SMauro Carvalho ChehabBy using sysfs attributes we can measure the system voltage VDDOUT, the battery
407ebd8b66SMauro Carvalho Chehabcharging current ICH, battery temperature TBAT, battery junction temperature
417ebd8b66SMauro Carvalho ChehabTJUNC, battery voltage VBAT and the back up battery voltage VBBAT.
427ebd8b66SMauro Carvalho Chehab
437ebd8b66SMauro Carvalho ChehabVoltage Monitoring
447ebd8b66SMauro Carvalho Chehab------------------
457ebd8b66SMauro Carvalho Chehab
467ebd8b66SMauro Carvalho ChehabVoltages are sampled by a 10 bit ADC.
477ebd8b66SMauro Carvalho Chehab
487ebd8b66SMauro Carvalho ChehabThe battery voltage is calculated as:
497ebd8b66SMauro Carvalho Chehab
507ebd8b66SMauro Carvalho Chehab	Milli volt = ((ADC value * 1000) / 512) + 2500
517ebd8b66SMauro Carvalho Chehab
527ebd8b66SMauro Carvalho ChehabThe backup battery voltage is calculated as:
537ebd8b66SMauro Carvalho Chehab
547ebd8b66SMauro Carvalho Chehab	Milli volt = (ADC value * 2500) / 512;
557ebd8b66SMauro Carvalho Chehab
567ebd8b66SMauro Carvalho ChehabThe voltages on ADC channels 4, 5 and 6 are calculated as:
577ebd8b66SMauro Carvalho Chehab
587ebd8b66SMauro Carvalho Chehab	Milli volt = (ADC value * 2500) / 1023
597ebd8b66SMauro Carvalho Chehab
607ebd8b66SMauro Carvalho ChehabTemperature Monitoring
617ebd8b66SMauro Carvalho Chehab----------------------
627ebd8b66SMauro Carvalho Chehab
637ebd8b66SMauro Carvalho ChehabTemperatures are sampled by a 10 bit ADC.  Junction and battery temperatures
647ebd8b66SMauro Carvalho Chehabare monitored by the ADC channels.
657ebd8b66SMauro Carvalho Chehab
667ebd8b66SMauro Carvalho ChehabThe junction temperature is calculated:
677ebd8b66SMauro Carvalho Chehab
687ebd8b66SMauro Carvalho Chehab	Degrees celsius = 1.708 * (TJUNC_RES - T_OFFSET) - 108.8
697ebd8b66SMauro Carvalho Chehab
707ebd8b66SMauro Carvalho ChehabThe junction temperature attribute is supported by the driver.
717ebd8b66SMauro Carvalho Chehab
727ebd8b66SMauro Carvalho ChehabThe battery temperature is calculated:
737ebd8b66SMauro Carvalho Chehab
747ebd8b66SMauro Carvalho Chehab	Degree Celsius = 1 / (t1 + 1/298) - 273
757ebd8b66SMauro Carvalho Chehab
767ebd8b66SMauro Carvalho Chehabwhere t1 = (1/B)* ln(( ADCval * 2.5)/(R25*ITBAT*255))
777ebd8b66SMauro Carvalho Chehab
787ebd8b66SMauro Carvalho ChehabDefault values of R25, B, ITBAT are 10e3, 3380 and 50e-6 respectively.
79