iio: adc: cpcap: Fix default register values and battery temperature
authorTony Lindgren <tony@atomide.com>
Tue, 23 May 2017 00:51:44 +0000 (17:51 -0700)
committerJonathan Cameron <jic23@kernel.org>
Sat, 3 Jun 2017 07:43:15 +0000 (08:43 +0100)
commit3f9f3a1a1451f4f389423dae4b5404b1abd48025
treec5113dcf248346c03ef2c6b0966617cf51f56a32
parent57d14635f976404fac165047389ff0dbe83bcd5b
iio: adc: cpcap: Fix default register values and battery temperature

Looking at the register dumps from Android kernel on droid 4, I noticed
the values with the mainline kernel don't match. Let's fix this by
initializing the ADC registers to what Android does.

For getting correct values from the battery thermistor, we need to
toggle the CPCAP_BIT_THERMBIAS_EN when measuring battery temperature
to get correct battery temperatures. And looks like we also need to
wait a little bit before reading the battery temperature as otherwise
the results are inaccurate.

Cc: Marcel Partap <mpartap@gmx.net>
Cc: Michael Scott <michael.scott@linaro.org>
Cc: Sebastian Reichel <sre@kernel.org>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
drivers/iio/adc/cpcap-adc.c