summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorVijay Hiremath <vijay.p.hiremath@intel.com>2016-01-27 11:43:05 -0800
committerchrome-bot <chrome-bot@chromium.org>2016-02-02 23:48:33 -0800
commit33fe5e437da4233f6a716c6eab2f44620efef1d7 (patch)
tree3f5260943b0f1a9ec4fa25b5d9909f5ff59bdfd3 /common
parent0c50cae42e40911428899131fbca54dcfd565da7 (diff)
downloadchrome-ec-33fe5e437da4233f6a716c6eab2f44620efef1d7.tar.gz
charger/Kunimitsu: Fix for boot from cut-off battery
Battery in cut-off mode wakes when voltage is applied to the PACK and takes approximately 2 to 3 seconds to initialize before capable of providing the power. Hence made the battery present status to BP_NO in case of cut-off mode. Once the battery is ready new status is updated as BP_YES. When the battery status changes from BP_NO to BP_YES, charger input current is set to board specific charger input current which is not sufficient to boot the AP hence the system reboots. To avoid this issue, added code to write charger manager negotiated current to charger input current when the battery status changes from BP_NO to BP_YES. BRANCH=none BUG=chrome-os-partner:49224 TEST=Manually tested on Kunimitsu. Used console command 'cutoff' to put the battery in cut-off mode. Inserted the adopter to wake the system, system doesn't reboot & the battery charges. Change-Id: Ia5a1457506b4bef0b3dd27993e4b60ae64c8f746 Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/322430 Commit-Ready: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org> Reviewed-by: Shawn N <shawnn@chromium.org>
Diffstat (limited to 'common')
-rw-r--r--common/charge_manager.c9
-rw-r--r--common/charge_state_v2.c9
2 files changed, 16 insertions, 2 deletions
diff --git a/common/charge_manager.c b/common/charge_manager.c
index 392cd74040..6a17d9ee4a 100644
--- a/common/charge_manager.c
+++ b/common/charge_manager.c
@@ -810,6 +810,15 @@ int charge_manager_get_active_charge_port(void)
}
/**
+ * Return the charger current (mA) value.
+ */
+int charge_manager_get_charger_current(void)
+{
+ return (charge_current != CHARGE_CURRENT_UNINITIALIZED) ?
+ charge_current : 0;
+}
+
+/**
* Return the power limit (uW) set by charge manager.
*/
int charge_manager_get_power_limit_uw(void)
diff --git a/common/charge_state_v2.c b/common/charge_state_v2.c
index 4401aa54bb..93e817d359 100644
--- a/common/charge_state_v2.c
+++ b/common/charge_state_v2.c
@@ -564,9 +564,14 @@ DECLARE_HOOK(HOOK_INIT, charger_init, HOOK_PRIO_DEFAULT);
int get_desired_input_current(enum battery_present batt_present,
const struct charger_info * const info)
{
- if (batt_present == BP_YES || system_is_locked())
+ if (batt_present == BP_YES || system_is_locked()) {
+#ifdef CONFIG_CHARGE_MANAGER
+ return MAX(CONFIG_CHARGER_INPUT_CURRENT,
+ charge_manager_get_charger_current());
+#else
return CONFIG_CHARGER_INPUT_CURRENT;
- else
+#endif
+ } else
return info->input_current_max;
}