EC: Support CPU throttling for multiple sources |
||||
Issue descriptionAs for now EC only asks CPU to throttle for over-temperature. There are two types: (1) When temp hits EC_TEMP_THRESH_WARN, EC does 'soft throttling' by sending host event EC_HOST_EVENT_THROTTLE_START to AP, but AP seems to ignore them for now. (2) When temp hits EC_TEMP_THRESH_HIGH, EC does 'hard throttling' by asserting GPIO_CPU_PROCHOT to CPU. However, in some new boards, we need to throttle for other sources like over-battery-discharge-current and low-battery. On EC side, we should support CPU throttling for these new sources. On AP side, we should fix soft throttling and make sure it reacts right to EC_HOST_EVENT_THROTTLE_START / EC_HOST_EVENT_THROTTLE_STOP.
,
May 11 2018
The following revision refers to this bug: https://chromium.googlesource.com/chromiumos/platform/ec/+/bf62593ebd4dead8553ca5615290fe372198e846 commit bf62593ebd4dead8553ca5615290fe372198e846 Author: Philip Chen <philipchen@google.com> Date: Fri May 11 02:41:04 2018 charge_state_v2: Throttle AP in high battery discharge current When EC sees discharge current hit BAT_MAX_DISCHG_CURRENT, we kick off a timer and ask AP to throttle. Then EC keeps monitoring discharge current. If the current doesn't drop below BAT_MAX_DISCHG_CURRENT - BAT_OCP_HYSTERESIS, we restart the timer and notify AP again, which shouldn't happen unless AP misses or ignores the first notification. When the timer expires, which means EC hasn't seen over-current for BAT_OCP_TIMEOUT_US, we ask AP to stop throttling. BUG=b:74321682, chromium:838754 BRANCH=scarlet TEST=manually test on scarlet, confirm EC sends EC_HOST_EVENT_THROTTLE_START and EC_HOST_EVENT_THROTTLE_STOP host events when entering/exiting OCP. Change-Id: I1e55fc23249596d8afec52a3885655ca9c1f2151 Signed-off-by: Philip Chen <philipchen@google.com> Reviewed-on: https://chromium-review.googlesource.com/994188 Commit-Ready: Philip Chen <philipchen@chromium.org> Tested-by: Philip Chen <philipchen@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Matthias Kaehlcke <mka@chromium.org> [modify] https://crrev.com/bf62593ebd4dead8553ca5615290fe372198e846/include/throttle_ap.h [modify] https://crrev.com/bf62593ebd4dead8553ca5615290fe372198e846/include/config.h [modify] https://crrev.com/bf62593ebd4dead8553ca5615290fe372198e846/common/charge_state_v2.c [modify] https://crrev.com/bf62593ebd4dead8553ca5615290fe372198e846/common/build.mk
,
May 11 2018
The following revision refers to this bug: https://chromium.googlesource.com/chromiumos/platform/ec/+/b8e30a7c27e69cb9a33cd54d279cf539981abc48 commit b8e30a7c27e69cb9a33cd54d279cf539981abc48 Author: Philip Chen <philipchen@google.com> Date: Fri May 11 04:42:51 2018 charge_state_v2: Throttle AP in high battery discharge current When EC sees discharge current hit BAT_MAX_DISCHG_CURRENT, we kick off a timer and ask AP to throttle. Then EC keeps monitoring discharge current. If the current doesn't drop below BAT_MAX_DISCHG_CURRENT - BAT_OCP_HYSTERESIS, we restart the timer and notify AP again, which shouldn't happen unless AP misses or ignores the first notification. When the timer expires, which means EC hasn't seen over-current for BAT_OCP_TIMEOUT_US, we ask AP to stop throttling. Fixed the conflict in common/charge_state_v2.c due to the lack of CL:977431 in this branch. BUG=b:74321682, chromium:838754 BRANCH=scarlet TEST=manually test on scarlet, confirm EC sends EC_HOST_EVENT_THROTTLE_START and EC_HOST_EVENT_THROTTLE_STOP host events when entering/exiting OCP. Original-change-Id: I1e55fc23249596d8afec52a3885655ca9c1f2151 Signed-off-by: Philip Chen <philipchen@google.com> Reviewed-on: https://chromium-review.googlesource.com/994188 Commit-Ready: Philip Chen <philipchen@chromium.org> Tested-by: Philip Chen <philipchen@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Matthias Kaehlcke <mka@chromium.org> Change-Id: Icd0121770946c70438c4744209529cd03aaa5dfc Reviewed-on: https://chromium-review.googlesource.com/1055268 Reviewed-by: Philip Chen <philipchen@chromium.org> Commit-Queue: Philip Chen <philipchen@chromium.org> Trybot-Ready: Philip Chen <philipchen@chromium.org> [modify] https://crrev.com/b8e30a7c27e69cb9a33cd54d279cf539981abc48/include/throttle_ap.h [modify] https://crrev.com/b8e30a7c27e69cb9a33cd54d279cf539981abc48/include/config.h [modify] https://crrev.com/b8e30a7c27e69cb9a33cd54d279cf539981abc48/common/charge_state_v2.c [modify] https://crrev.com/b8e30a7c27e69cb9a33cd54d279cf539981abc48/common/build.mk
,
May 21 2018
The following revision refers to this bug: https://chromium.googlesource.com/chromiumos/platform/ec/+/a2c6a58f40a8990c1f20ed76b9a7a01760fb9171 commit a2c6a58f40a8990c1f20ed76b9a7a01760fb9171 Author: Philip Chen <philipchen@google.com> Date: Mon May 21 03:13:09 2018 charge_state_v2: Throttle AP in low battery voltage When EC sees voltage drops below BAT_LOW_VOLTAGE_THRESH, we kick off a timer and ask AP to throttle. When the timer expires which means EC hasn't seen under-voltage for BAT_UVP_TIMEOUT_US, we ask AP to stop throttling. We reset the throttling status and do nothing when AP is off (S5). BUG=b:73050145, chromium:838754 BRANCH=scarlet TEST=manually test on scarlet, confirm EC sends EC_HOST_EVENT_THROTTLE_START and EC_HOST_EVENT_THROTTLE_STOP host events when entering/exiting UVP. Change-Id: Ia760989f760f95549f7a8a8acb1d01de23feab5a Signed-off-by: Philip Chen <philipchen@google.com> Reviewed-on: https://chromium-review.googlesource.com/1067257 Reviewed-by: Philip Chen <philipchen@chromium.org> Commit-Queue: Philip Chen <philipchen@chromium.org> Tested-by: Philip Chen <philipchen@chromium.org> [modify] https://crrev.com/a2c6a58f40a8990c1f20ed76b9a7a01760fb9171/include/throttle_ap.h [modify] https://crrev.com/a2c6a58f40a8990c1f20ed76b9a7a01760fb9171/include/config.h [modify] https://crrev.com/a2c6a58f40a8990c1f20ed76b9a7a01760fb9171/common/charge_state_v2.c [modify] https://crrev.com/a2c6a58f40a8990c1f20ed76b9a7a01760fb9171/common/build.mk
,
May 22 2018
The following revision refers to this bug: https://chromium.googlesource.com/chromiumos/platform/ec/+/453647e21a9e584cd0ee8567efef3d81371ae27f commit 453647e21a9e584cd0ee8567efef3d81371ae27f Author: Philip Chen <philipchen@google.com> Date: Tue May 22 01:19:22 2018 charge_state_v2: Throttle AP in low battery voltage When EC sees voltage drops below BAT_LOW_VOLTAGE_THRESH, we kick off a timer and ask AP to throttle. When the timer expires which means EC hasn't seen under-voltage for BAT_UVP_TIMEOUT_US, we ask AP to stop throttling. We reset the throttling status and do nothing when AP is off (S5). BUG=b:73050145, chromium:838754 BRANCH=scarlet TEST=manually test on scarlet, confirm EC sends EC_HOST_EVENT_THROTTLE_START and EC_HOST_EVENT_THROTTLE_STOP host events when entering/exiting UVP. Change-Id: Ia760989f760f95549f7a8a8acb1d01de23feab5a Signed-off-by: Philip Chen <philipchen@google.com> Reviewed-on: https://chromium-review.googlesource.com/1064983 Commit-Ready: Philip Chen <philipchen@chromium.org> Tested-by: Philip Chen <philipchen@chromium.org> Reviewed-by: David Schneider <dnschneid@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org> [modify] https://crrev.com/453647e21a9e584cd0ee8567efef3d81371ae27f/include/throttle_ap.h [modify] https://crrev.com/453647e21a9e584cd0ee8567efef3d81371ae27f/include/config.h [modify] https://crrev.com/453647e21a9e584cd0ee8567efef3d81371ae27f/common/charge_state_v2.c [modify] https://crrev.com/453647e21a9e584cd0ee8567efef3d81371ae27f/common/build.mk
,
May 30 2018
,
May 30 2018
The following revision refers to this bug: https://chromium.googlesource.com/chromiumos/platform/ec/+/ce57911110baa5c3ae8a196572d274097fd19992 commit ce57911110baa5c3ae8a196572d274097fd19992 Author: Philip Chen <philipchen@google.com> Date: Wed May 30 08:02:40 2018 charge_state_v2: Add a hysteresis for under-voltage throttling There is a potential loop: (1) We throttle AP when we see under-voltage. (2) VBAT bumps because throttling starts. From our experiment, AP throttling saves ~1A, and thus VBAT increases by ~80mV. (3) VBAT hasn't hit BAT_LOW_VOLTAGE_THRESH for BAT_UVP_TIMEOUT_US, so we stop throttling. (4) VBAT again drops below BAT_LOW_VOLTAGE_THRESH. (5) Go back to (1). So let's introduce a hysteresis to under-voltage throttling. We stop throttling only when we are confident that even if we stop throttling, the battery voltage will stay above BAT_LOW_VOLTAGE_THRESH. BUG=b:73050145, chromium:838754 BRANCH=scarlet TEST=manually test on scarlet Change-Id: Ic0c17a7d37d5d6ee38c7b19f9b65d17421e55cbc Signed-off-by: Philip Chen <philipchen@google.com> Reviewed-on: https://chromium-review.googlesource.com/1070568 Commit-Ready: Philip Chen <philipchen@chromium.org> Tested-by: Philip Chen <philipchen@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org> [modify] https://crrev.com/ce57911110baa5c3ae8a196572d274097fd19992/common/charge_state_v2.c
,
May 30 2018
The following revision refers to this bug: https://chromium.googlesource.com/chromiumos/platform/ec/+/642affe9dbbf8f9c641e4aaf0a5d718640b17d30 commit 642affe9dbbf8f9c641e4aaf0a5d718640b17d30 Author: Philip Chen <philipchen@google.com> Date: Wed May 30 18:15:57 2018 charge_state_v2: Add a hysteresis for under-voltage throttling There is a potential loop: (1) We throttle AP when we see under-voltage. (2) VBAT bumps because throttling starts. From our experiment, AP throttling saves ~1A, and thus VBAT increases by ~80mV. (3) VBAT hasn't hit BAT_LOW_VOLTAGE_THRESH for BAT_UVP_TIMEOUT_US, so we stop throttling. (4) VBAT again drops below BAT_LOW_VOLTAGE_THRESH. (5) Go back to (1). So let's introduce a hysteresis to under-voltage throttling. We stop throttling only when we are confident that even if we stop throttling, the battery voltage will stay above BAT_LOW_VOLTAGE_THRESH. BUG=b:73050145, chromium:838754 BRANCH=scarlet TEST=manually test on scarlet Change-Id: Ic0c17a7d37d5d6ee38c7b19f9b65d17421e55cbc Signed-off-by: Philip Chen <philipchen@google.com> Reviewed-on: https://chromium-review.googlesource.com/1077687 Reviewed-by: Philip Chen <philipchen@chromium.org> Commit-Queue: Philip Chen <philipchen@chromium.org> Tested-by: Philip Chen <philipchen@chromium.org> [modify] https://crrev.com/642affe9dbbf8f9c641e4aaf0a5d718640b17d30/common/charge_state_v2.c
,
Jul 10
EC support for under-voltage and over-current throttling is in place. Closing the issue now. |
||||
►
Sign in to add a comment |
||||
Comment 1 by philipchen@chromium.org
, May 2 2018