From: SeokYeon Hwang Date: Tue, 19 Nov 2013 05:21:19 +0000 (+0900) Subject: maru_pm: Add suspend / wakeup notifier. X-Git-Tag: TizenStudio_2.0_p2.3~463 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F59%2F12559%2F1;p=sdk%2Femulator%2Fqemu.git maru_pm: Add suspend / wakeup notifier. Add suspend / wakeup notifier to tell sdb. Change-Id: I038f70f7a97cc3b60fab357a7c637c754aa035f9 Signed-off-by: SeokYeon Hwang --- diff --git a/tizen/src/guest_server.h b/tizen/src/guest_server.h index 81d46de..e869584 100644 --- a/tizen/src/guest_server.h +++ b/tizen/src/guest_server.h @@ -40,7 +40,7 @@ void shutdown_guest_server( void ); gchar *get_tizen_sdk_data_path(void); -#define STATE_RESUME 0 +#define STATE_RUNNING 0 #define STATE_SUSPEND 1 void notify_all_sdb_clients(int state); diff --git a/tizen/src/hw/maru_pm.c b/tizen/src/hw/maru_pm.c index a9da1a9..9bb2b68 100644 --- a/tizen/src/hw/maru_pm.c +++ b/tizen/src/hw/maru_pm.c @@ -31,6 +31,7 @@ #include "sysemu/sysemu.h" #include "debug_ch.h" +#include "guest_server.h" /* define debug channel */ MULTI_DEBUG_CHANNEL(tizen, maru_pm); @@ -38,6 +39,9 @@ MULTI_DEBUG_CHANNEL(tizen, maru_pm); ACPIREGS *maru_pm_ar; acpi_update_sci_fn maru_pm_update_sci; +static Notifier maru_suspend; +static Notifier maru_wakeup; + void resume(void) { TRACE("resume called.\n"); @@ -45,8 +49,21 @@ void resume(void) maru_pm_update_sci(maru_pm_ar); } +static void maru_notify_suspend(Notifier *notifier, void *data) { + notify_all_sdb_clients(STATE_SUSPEND); +} + +static void maru_notify_wakeup(Notifier *notifier, void *data) { + notify_all_sdb_clients(STATE_RUNNING); +} + void acpi_maru_pm_init(ACPIREGS *ar, acpi_update_sci_fn update_sci) { maru_pm_ar = ar; qemu_system_wakeup_enable(QEMU_WAKEUP_REASON_OTHER, 1); maru_pm_update_sci = update_sci; + + maru_suspend.notify = maru_notify_suspend; + maru_wakeup.notify = maru_notify_wakeup; + qemu_register_suspend_notifier(&maru_suspend); + qemu_register_wakeup_notifier(&maru_wakeup); }