Skip to content

Commit

Permalink
hwmon: Driver for DA9052/53 PMIC
Browse files Browse the repository at this point in the history
The DA9052 PMIC provides an Analogue to Digital Converter with 10 bits
resolution and 10 channels.

This patch monitors the DA9052 PMIC's ADC channels mostly for battery
parameters like battery temperature, junction temperature, battery
current etc.

This patch is functionally tested on Samsung SMDKV6410

Signed-off-by: David Dajun Chen <dchen@diasemi.com>
Signed-off-by: Ashish Jangam <ashish.jangam@kpitcummins.com>
[Guenter Roeck: __init --> __devinit for probe function]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
  • Loading branch information
Ashish Jangam authored and groeck committed Jul 22, 2012
1 parent 62867d4 commit e41f643
Show file tree
Hide file tree
Showing 4 changed files with 416 additions and 0 deletions.
61 changes: 61 additions & 0 deletions Documentation/hwmon/da9052
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
Supported chips:
* Dialog Semiconductors DA9052-BC and DA9053-AA/Bx PMICs
Prefix: 'da9052'
Datasheet: Datasheet is not publicly available.

Authors: David Dajun Chen <dchen@diasemi.com>

Description
-----------

The DA9052/53 provides an Analogue to Digital Converter (ADC) with 10 bits
resolution and track and hold circuitry combined with an analogue input
multiplexer. The analogue input multiplexer will allow conversion of up to 10
different inputs. The track and hold circuit ensures stable input voltages at
the input of the ADC during the conversion.

The ADC is used to measure the following inputs:
Channel 0: VDDOUT - measurement of the system voltage
Channel 1: ICH - internal battery charger current measurement
Channel 2: TBAT - output from the battery NTC
Channel 3: VBAT - measurement of the battery voltage
Channel 4: ADC_IN4 - high impedance input (0 - 2.5V)
Channel 5: ADC_IN5 - high impedance input (0 - 2.5V)
Channel 6: ADC_IN6 - high impedance input (0 - 2.5V)
Channel 7: XY - TSI interface to measure the X and Y voltage of the touch
screen resistive potentiometers
Channel 8: Internal Tjunc. - sense (internal temp. sensor)
Channel 9: VBBAT - measurement of the backup battery voltage

By using sysfs attributes we can measure the system voltage VDDOUT, the battery
charging current ICH, battery temperature TBAT, battery junction temperature
TJUNC, battery voltage VBAT and the back up battery voltage VBBAT.

Voltage Monitoring
------------------

Voltages are sampled by a 10 bit ADC.

The battery voltage is calculated as:
Milli volt = ((ADC value * 1000) / 512) + 2500

The backup battery voltage is calculated as:
Milli volt = (ADC value * 2500) / 512;

The voltages on ADC channels 4, 5 and 6 are calculated as:
Milli volt = (ADC value * 2500) / 1023

Temperature Monitoring
----------------------

Temperatures are sampled by a 10 bit ADC. Junction and battery temperatures
are monitored by the ADC channels.

The junction temperature is calculated:
Degrees celsius = 1.708 * (TJUNC_RES - T_OFFSET) - 108.8
The junction temperature attribute is supported by the driver.

The battery temperature is calculated:
Degree Celcius = 1 / (t1 + 1/298)- 273
where t1 = (1/B)* ln(( ADCval * 2.5)/(R25*ITBAT*255))
Default values of R25, B, ITBAT are 10e3, 3380 and 50e-6 respectively.
10 changes: 10 additions & 0 deletions drivers/hwmon/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,16 @@ config SENSORS_DS1621
This driver can also be built as a module. If so, the module
will be called ds1621.

config SENSORS_DA9052_ADC
tristate "Dialog DA9052/DA9053 ADC"
depends on PMIC_DA9052
help
Say y here to support the ADC found on Dialog Semiconductor
DA9052-BC and DA9053-AA/Bx PMICs.

This driver can also be built as module. If so, the module
will be called da9052-hwmon.

config SENSORS_EXYNOS4_TMU
tristate "Temperature sensor on Samsung EXYNOS4"
depends on ARCH_EXYNOS4
Expand Down
1 change: 1 addition & 0 deletions drivers/hwmon/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ obj-$(CONFIG_SENSORS_APPLESMC) += applesmc.o
obj-$(CONFIG_SENSORS_ASC7621) += asc7621.o
obj-$(CONFIG_SENSORS_ATXP1) += atxp1.o
obj-$(CONFIG_SENSORS_CORETEMP) += coretemp.o
obj-$(CONFIG_SENSORS_DA9052_ADC)+= da9052-hwmon.o
obj-$(CONFIG_SENSORS_DME1737) += dme1737.o
obj-$(CONFIG_SENSORS_DS620) += ds620.o
obj-$(CONFIG_SENSORS_DS1621) += ds1621.o
Expand Down
Loading

0 comments on commit e41f643

Please sign in to comment.