diff options
author | Bill Richardson <wfrichar@chromium.org> | 2013-07-31 09:37:58 -0700 |
---|---|---|
committer | ChromeBot <chrome-bot@google.com> | 2013-07-31 12:33:31 -0700 |
commit | 86bef29c3d1411c5dd9c3717432cd0bebb4fe45f (patch) | |
tree | 29061a4eeca21983b7a4fa1a80a55f871b34a724 /common/host_event_commands.c | |
parent | af777297370e971bd4ae64e0e947cb5a1774dbfe (diff) | |
download | chrome-ec-86bef29c3d1411c5dd9c3717432cd0bebb4fe45f.tar.gz |
Abstract polite AP throttling into a function
This wraps the EC_HOST_EVENT_THROTTLE_START/STOP host events in a new
function called host_throttle_cpu(), similar to chipset_throttle_cpu().
That function requests the AP to throttle itself, which is less drastic than
just smacking it down from the EC.
BUG=chrome-os-partner:20805
BRANCH=falco,peppy
TEST=manual
This is a refactoring change only. All boards should still build, all tests
should still pass.
Change-Id: I871cce8f0e13230cb52eeb5e16955266f8461374
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/63909
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'common/host_event_commands.c')
-rw-r--r-- | common/host_event_commands.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/common/host_event_commands.c b/common/host_event_commands.c index 1c13ee1377..4ee11a9de2 100644 --- a/common/host_event_commands.c +++ b/common/host_event_commands.c @@ -83,6 +83,21 @@ static void host_clear_events_b(uint32_t mask) atomic_clear(&events_copy_b, mask); } +/** + * Politely ask the CPU to enable/disable its own throttling. + * + * @param throttle Enable (!=0) or disable(0) throttling + */ +void host_throttle_cpu(int throttle) +{ + if (throttle) + host_set_events(EC_HOST_EVENT_MASK( + EC_HOST_EVENT_THROTTLE_START)); + else + host_set_events(EC_HOST_EVENT_MASK( + EC_HOST_EVENT_THROTTLE_STOP)); +} + /*****************************************************************************/ /* Console commands */ |