MFD: twl6030-gpadc: set sample type of the twl6030 gpadc conversion request

All fields of the twl6030 gpadc conversion request must be filled
correctly. This patch adds missing initialization of the sample type
to the TWL6030/TWL6032 gpadc and battery drivers.

Change-Id: I5ce38d4cee3f50aa33fb265dbd1785a36580a10c
Signed-off-by: Oleksandr Dmytryshyn <oleksandr.dmytryshyn@ti.com>
Signed-off-by: Quallenauge <Hamsi2k@freenet.de>
twl603x_battery: Fix battery charger restart

Sometimes the TWL603x battery charger driver doesn't
change it's state after faults (e.g. watchdog
expiration). It gives an incorrect information
to user and prevents the restart of charging.
Added setting the flag charger_fault at interrupt
if EXTCHRG_STATZ detected - it's needed to refresh
corresponding variables: charge_status and
charger_source and call twl6030_stop_charger function
to set driver to the right state.
Added clearing of the bit FAULT_WDG. This is needed
for restart after the recurrent watchdog fault.
Also twl6030_stop_usb_charger replaced with more
complex function twl6030_stop_charger. It helps to
stop AC charger as well as USB charger.

Change-Id: Ib7afb62033ff0cc98a4c4d1bd09ca6b6753cc0e2
Signed-off-by: Oleg_Kosheliev <oleg.kosheliev@ti.com>
Signed-off-by: Quallenauge <Hamsi2k@freenet.de>
twl603x_charger: Update charge status when capacity changed

This patch implements the ability to change the charge
status from FULL to DISCHARGING. This transition occurs
when the battery is discharging and depends only on
the change of the charge.
So if the charge status was POWER_SUPPLY_STATUS_FULL
and the battery is discharged from 100% to 99%
we need to change the status to
POWER_SUPPLY_STATUS_DISCHARGING.

Change-Id: Ie1a29db526ecdd36c2b527d5c2a424a16be6a03f
Signed-off-by: Oleg_Kosheliev <oleg.kosheliev@ti.com>
Signed-off-by: Quallenauge <Hamsi2k@freenet.de>
twl063x_battery: Fix restart charging at "charge complete"

When the "charge complete" condition is reached the battery
starts to discharge until the nac (now available charge)
falls by cell->config->recharge value (300mAh or 7.5% by
default). If the charger is unplugged and plugged again
at this condition - the battery will not start charging
even if the charge is about 94%.
This patch will fix it - if plug the charger and the
charge is less than 100% - the battery will start charging.

Change-Id: Ie5283f84eb8e82acf543346d3e8b21dc9ff3775d
Signed-off-by: Oleg_Kosheliev <oleg.kosheliev@ti.com>
Signed-off-by: Quallenauge <Hamsi2k@freenet.de>

Conflicts:
	drivers/power/twl6030_bci_battery.c
twl603x_battery: Remove setting the charger_fault flag

Setting the charger_fault flag if AC charger fault
detected leads to unnecessary call of the
twl6030_stop_charger function.
This patch removes it in ISR.
Setting the charger_fault flag was added by patch
0158b2739a (twl603x_battery: Fix battery
charger restart) to fix charger restart at fault,
the restart succeeds without this flag.

Change-Id: Ibd4bfab75f3d082fb0690d6ba51cdccd22c7a596
Signed-off-by: Oleg_Kosheliev <oleg.kosheliev@ti.com>
Signed-off-by: Quallenauge <Hamsi2k@freenet.de>
twl603x_battery: Enable hi-current charging from USB DCP

This patch enables charging with the current 1500mA
if USB DCP charger is connected.

Change-Id: I55914da48598ed4ae230e578e72d04e154b8f660
Signed-off-by: Oleg_Kosheliev <oleg.kosheliev@ti.com>
Signed-off-by: Quallenauge <Hamsi2k@freenet.de>
Fuel Gauge: Correct the FULL flag conditions

The flag which indicates what the battery is full
should be set not when nac (now available charge)
is equal than fcc (full charge condition) but
when "charge complete" condition is reached.
And this flag should be cleared not when nac
is less than fcc but when the soc (state of charge)
is less than MAX_PERCENTAGE.
This allows to have full = true from "charge complete"
till soc < 100%.

Change-Id: I4672ef7d7d0dbc1e3d76760aedaa6ffbb9d9a024
Signed-off-by: Oleg_Kosheliev <oleg.kosheliev@ti.com>
Signed-off-by: Quallenauge <Hamsi2k@freenet.de>