mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-10 01:21:49 +00:00
pit: Move suspend/resume hook callbacks to a deferred task
Putting the suspend/resume hook callbacks on a deferred task allows frequency change notifications to lock mutexes. This is useful in a future change which locks the i2c bus around frequency changes. BRANCH=pit BUG=chrome-os-partner:22093 TEST=With all patches together: - on AP: suspend_stress_test - on EC: battery 10000 50 Change-Id: If5e31040cdc7c95a4c8ba62ee72512cb79617cc9 Signed-off-by: Doug Anderson <dianders@chromium.org> Previous-Reviewed-on: https://chromium-review.googlesource.com/167100 (cherry picked from commit ce31fda8695f4db1fa91f5bb224c781cf17f91c0) Reviewed-on: https://chromium-review.googlesource.com/167147 Reviewed-by: Randall Spangler <rspangler@chromium.org>
This commit is contained in:
committed by
Caroline Tice
parent
a795b1ffe0
commit
fcd388df8e
@@ -236,8 +236,10 @@ static int check_for_power_off_event(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void gaia_suspend_event(enum gpio_signal signal)
|
||||
void gaia_suspend_deferred(void)
|
||||
{
|
||||
int new_ap_suspended;
|
||||
|
||||
if (!ap_on) /* power on/off : not a real suspend / resume */
|
||||
return;
|
||||
|
||||
@@ -245,7 +247,13 @@ void gaia_suspend_event(enum gpio_signal signal)
|
||||
* Note: For Snow, suspend state can only be reliably
|
||||
* determined when the AP is on (crosbug.com/p/13200).
|
||||
*/
|
||||
ap_suspended = !gpio_get_level(GPIO_SUSPEND_L);
|
||||
new_ap_suspended = !gpio_get_level(GPIO_SUSPEND_L);
|
||||
|
||||
/* We never want to call two suspend or two resumes in a row */
|
||||
if (ap_suspended == new_ap_suspended)
|
||||
return;
|
||||
|
||||
ap_suspended = new_ap_suspended;
|
||||
|
||||
if (ap_suspended) {
|
||||
if (lid_is_open())
|
||||
@@ -258,6 +266,13 @@ void gaia_suspend_event(enum gpio_signal signal)
|
||||
powerled_set_state(POWERLED_STATE_ON);
|
||||
hook_notify(HOOK_CHIPSET_RESUME);
|
||||
}
|
||||
|
||||
}
|
||||
DECLARE_DEFERRED(gaia_suspend_deferred);
|
||||
|
||||
void gaia_suspend_event(enum gpio_signal signal)
|
||||
{
|
||||
hook_call_deferred(gaia_suspend_deferred, 0);
|
||||
}
|
||||
|
||||
void gaia_power_event(enum gpio_signal signal)
|
||||
|
||||
Reference in New Issue
Block a user