power_supply/MFD: twl4030_charger: Allow charger to control the regulator that feeds it. The charger needs usb3v1 to be running, so add a new consumer to keep it running. This allows the charger to draw current even when the USB driver has powered down. [notasas@gmail.com: rebased to our tree, fixed a warning] Acked-by: Tero Kristo <t-kristo@ti.com> Signed-off-by: NeilBrown <neilb@suse.de>
bq27x00_battery: Check current after reading flags It appears bq27500 has a threshold for DSG flag (60mA by default according to the manual) after which it no longer sets DSG bit. This means we have to check current to avoid misreporting that we are charging when we are really discharging, which currently happens in lower power states. As flags register is read in bq27x00_update, do current direction check there.
bq27x00_battery: Fix flag register read When reading flags, bq27x00_read() argument is inverted and causes reads 2 of bytes for bq27200 and 1 byte for bq27500, while their register sizes are 1 and 2 bytes respectively. This causes bq27500 upper flag bits always to be returned as 0, causing full charge state to never be reported correctly, so fix it. Cc: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Grazvydas Ignotas <notasas@gmail.com> Acked-by: Pali Rohár <pali.rohar@gmail.com> Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
bq27x00 - don't report power-supply change so often. A power_supply_changed should only be reported on significant changes such as transition between charging and not. Incremental changes such as charge increasing should not be reported - that can easily be polled for. [notasas@gmail.com: refreshed for Pali Rohár's patches] Signed-off-by: NeilBrown <neilb@suse.de>
bq27x00_battery: Fix OOPS caused by unregistring bq27x00 driver * power_supply_unregister call bq27x00_battery_get_property which call bq27x00_battery_poll * make sure that bq27x00_battery_poll will not call schedule_delayed_work again after unregister (which cause OOPS) Signed-off-by: Pali Rohár <pali.rohar@gmail.com> Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
bq27x00_battery: Report -ENODATA if bq27000 battery was not calibrated * CI (Capacity Inaccurate) flag is set after full reset on bq27000 battery * when is set, all capacity properties should be reported incorrectly, because there was no learning cycle and battery was not calibrated * instead reporting incorrect values, report -ENODATA Signed-off-by: Pali Rohár <pali.rohar@gmail.com> Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
bq27x00_battery: Do not cache current_now value for bq27000 batery * This prevent reporting old current_now value for bq27000 * Also ask for current flags, to make sure that current_now will be reported with correct signature Signed-off-by: Pali Rohár <pali.rohar@gmail.com> Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>