Files
OpenCellular/driver
Nicolas Boichat f14879eae1 charger/isl923x: Protect CONTROL1 read-modify-write with a mutex
CONTROL1 bits can be modified from multiple tasks:
 - charger_enable_otg_power (charger or pd task)
 - charger_discharge_on_ac (host command or console)
 - charger_enable/disable_psys (chipset task)
 - print_amon_bmon (console)

Since we use I2C read, modify, then I2C write access pattern,
there is a small chance of races between these accesses:
let's protect them with a mutex.

Also, the current code sometimes uses charger_get_option/set_option
instead of manipulating CONTROL0 directly: fix those to regain
a bit of the extra code size caused by the mutex.

BRANCH=none
BUG=b:67029560
TEST=Flash lux, battery charges, amon works fine.
TEST=Flash elm, battery charges.

Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>

Change-Id: If375d9922db53dd582582bfa44d6218fe0b416ec
Reviewed-on: https://chromium-review.googlesource.com/848486
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2018-01-04 21:52:05 -08:00
..
2017-12-13 22:33:22 -08:00
2018-01-03 16:54:31 -08:00
2017-07-13 15:08:42 -07:00
2018-01-03 16:54:31 -08:00
2015-06-18 19:07:00 +00:00
2015-06-18 19:07:00 +00:00
2017-02-13 21:15:16 -08:00
2017-02-13 21:15:16 -08:00
2017-10-31 21:49:24 -07:00
2017-10-31 21:49:24 -07:00
2016-08-24 17:40:52 -07:00