mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-12-29 18:11:05 +00:00
In the function bd9995x_battery_charging_profile_settings, the current values for trickle, precharge, and fastcharge were being set. Fastcharge current level was being set via charger_set_current(PD_MAX_CURRENT_MA). By calling this function with a non-zero parameter, charging will always be enabled. In addition, PD_MAX_CURRENT_MA is an input current limit and doesn't neceassrily apply to the fastcharge current level which would be read from the fuel gauge. The other side effect is that by enabling charging, VSYS is being set to battery->voltage_min which reverts VSYS being set to battery->voltage_max in the init routine. Per Rohm, all charging profile registers should be set prior to enabling charging. On Coral, enabling charging at this point was leading to VSYS collapse when no battery was connected or a fully depleted battery case. I also believe that enabling charging here exacerbates other issues we've been running into with low battery startup cases. BUG=b:64388515 BRANCH=eve TEST=On Coral tested both no battery a fully depleted battery cases. Verified that without the call to charger_set_current() that VSYS consistently collapses and that after removing this call, the start up was stable and the battery begins charging. Change-Id: Ice20ed5d8147fe9ad8faa754286a2ec8a784f8d8 Signed-off-by: Scott Collyer <scollyer@google.com> Reviewed-on: https://chromium-review.googlesource.com/602493 Commit-Ready: Scott Collyer <scollyer@chromium.org> Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Shawn N <shawnn@chromium.org>