#define PALM_STR "palm"
#define UNKNOWN_STR "unknown"
-#define PM_WAKEUP 0
-#define PM_SUSPEND 1
-
extern void init_pm_internal();
extern void init_save_userlock(void);
{
if (pm_get_power_lock_support()
&& (get_pm_cur_state() == S_SLEEP)) {
- broadcast_pm_wakeup();
power_acquire_wakelock();
set_pm_cur_state(S_NORMAL);
}
if ((get_pm_cur_state() != get_pm_old_state()) && (get_pm_cur_state() != S_SLEEP)) {
if (pm_get_power_lock_support()) {
- broadcast_pm_wakeup();
power_acquire_wakelock();
}
set_setting_pmstate(get_pm_cur_state());
#ifdef ENABLE_PM_LOG
pm_history_save(PM_LOG_SLEEP, get_pm_cur_state());
#endif
- broadcast_pm_suspend();
if (pm_get_power_lock_support()) {
power_enable_autosleep();
if (flags & WITHOUT_STARTNOTI) { /* start without noti */
_I("Start Power managing without noti");
if (pm_get_power_lock_support()) {
- broadcast_pm_wakeup();
power_acquire_wakelock();
}
/*
#define PALM_STR "palm"
#define UNKNOWN_STR "unknown"
-#define PM_WAKEUP 0
-#define PM_SUSPEND 1
-
extern void init_pm_internal();
extern void init_save_userlock(void);
{
if (pm_get_power_lock_support()
&& (get_pm_cur_state() == S_SLEEP)) {
- broadcast_pm_wakeup();
power_acquire_wakelock();
set_pm_cur_state(S_NORMAL);
}
if ((get_pm_cur_state() != get_pm_old_state()) && (get_pm_cur_state() != S_SLEEP)) {
if (pm_get_power_lock_support()) {
- broadcast_pm_wakeup();
power_acquire_wakelock();
}
set_setting_pmstate(get_pm_cur_state());
#ifdef ENABLE_PM_LOG
pm_history_save(PM_LOG_SLEEP, get_pm_cur_state());
#endif
- broadcast_pm_suspend();
if (pm_get_power_lock_support()) {
power_enable_autosleep();
if (flags & WITHOUT_STARTNOTI) { /* start without noti */
_I("Start Power managing without noti");
if (pm_get_power_lock_support()) {
- broadcast_pm_wakeup();
power_acquire_wakelock();
}
/*
#define PALM_STR "palm"
#define UNKNOWN_STR "unknown"
-#define PM_WAKEUP 0
-#define PM_SUSPEND 1
-
extern void init_pm_internal();
extern void init_save_userlock(void);
{
if (pm_get_power_lock_support()
&& (get_pm_cur_state() == S_SLEEP)) {
- broadcast_pm_wakeup();
power_acquire_wakelock();
set_pm_cur_state(S_NORMAL);
}
if ((get_pm_cur_state() != get_pm_old_state()) && (get_pm_cur_state() != S_SLEEP)) {
if (pm_get_power_lock_support()) {
- broadcast_pm_wakeup();
power_acquire_wakelock();
}
set_setting_pmstate(get_pm_cur_state());
#ifdef ENABLE_PM_LOG
pm_history_save(PM_LOG_SLEEP, get_pm_cur_state());
#endif
- broadcast_pm_suspend();
if (pm_get_power_lock_support()) {
power_enable_autosleep();
if (flags & WITHOUT_STARTNOTI) { /* start without noti */
_I("Start Power managing without noti");
if (pm_get_power_lock_support()) {
- broadcast_pm_wakeup();
power_acquire_wakelock();
}
/*
if (pm_get_power_lock_support()
&& (get_pm_cur_state() == S_SLEEP)) {
- broadcast_pm_wakeup();
power_acquire_wakelock();
set_pm_cur_state(S_NORMAL);
}
if ((get_pm_cur_state() != get_pm_old_state()) && (get_pm_cur_state() != S_SLEEP)) {
if (pm_get_power_lock_support()) {
- broadcast_pm_wakeup();
power_acquire_wakelock();
}
set_setting_pmstate(get_pm_cur_state());
#ifdef ENABLE_PM_LOG
pm_history_save(PM_LOG_SLEEP, get_pm_cur_state());
#endif
- broadcast_pm_suspend();
if (pm_get_power_lock_support()) {
power_enable_autosleep();
if (flags & WITHOUT_STARTNOTI) { /* start without noti */
_I("Start Power managing without noti");
if (pm_get_power_lock_support()) {
- broadcast_pm_wakeup();
power_acquire_wakelock();
}
/*
#include "display-signal.h"
#include "poll.h"
#include "shared/plugin.h"
+#include "shared/time.h"
#define ACTIVE_ACT "active"
#define INACTIVE_ACT "inactive"
};
static struct display_plugin *disp_plgn;
-static int pmstate_suspend = PM_SUSPEND;
static long displayoff_time;
-void broadcast_pm_suspend(void)
-{
- int ret;
- long now;
-
- if (pmstate_suspend)
- return;
-
- _D("PM will be changed to sleep.");
-
- pmstate_suspend = PM_SUSPEND;
- now = clock_gettime_to_long();
- ret = gdbus_signal_emit(NULL,
- DEVICED_PATH_DISPLAY,
- DEVICED_INTERFACE_DISPLAY,
- "sleep",
- g_variant_new("(t)", (guint64)now));
- if (ret < 0)
- _E("Failed to send dbus signal sleep.");
-}
-
-void broadcast_pm_wakeup(void)
-{
- int ret;
- long now;
-
- if (!pmstate_suspend)
- return;
-
- _D("PM is changed to wakeup.");
-
- pmstate_suspend = PM_WAKEUP;
- now = clock_gettime_to_long();
- ret = gdbus_signal_emit(NULL,
- DEVICED_PATH_DISPLAY,
- DEVICED_INTERFACE_DISPLAY,
- "wakeup",
- g_variant_new("(t)", (guint64)now));
- if (ret < 0)
- _E("Failed to send dbus signal wakeup.");
-
-}
-
void broadcast_lcd_on(enum signal_type type, enum device_flags flags)
{
const char *str;
#ifndef __DISPLAY_SIGNAL_H__
#define __DISPLAY_SIGNAL_H__
-#include <time.h>
#include <libsyscommon/libgdbus.h>
#include "util.h"
#include "shared/devices.h"
#include "shared/device-notifier.h"
-static inline long clock_gettime_to_long(void)
-{
- struct timespec now;
- int ret;
-
- ret = clock_gettime(CLOCK_REALTIME, &now);
-
- if (ret < 0) {
- _E("Failed to clock gettime!");
- return 0;
- }
-
- return SEC_TO_MSEC(now.tv_sec) + NSEC_TO_MSEC(now.tv_nsec);
-}
-
-#define PM_WAKEUP 0
-#define PM_SUSPEND 1
-
enum signal_type {
SIGNAL_INVALID = 0,
SIGNAL_PRE,
SIGNAL_MAX,
};
-void broadcast_pm_suspend(void);
-void broadcast_pm_wakeup(void);
void broadcast_lcd_on(enum signal_type type, enum device_flags flags);
void broadcast_lcd_off(enum signal_type type, enum device_flags flags);
void broadcast_lcd_off_late(enum device_flags flags);
#include "shared/devices.h"
#include "shared/common.h"
#include "shared/device-notifier.h"
+#include "shared/time.h"
#include "vconf.h"
#include "display/display-dpms.h"
#include "display/display.h"
bool timeout_sleep_support = false;
+
+// Leave it for backward compatability. As the signal was implemented when distinction
+// between power and display is unclear, path and interface is related with display.
+// Since tizen 7.0, it is able to receive suspend/resume event using device power-internal API,
+// which is irrelevent with this signal.
+static void power_broadcast_suspend(void)
+{
+ int ret;
+ long now;
+
+ _D("PM will be changed to sleep.");
+
+ now = clock_gettime_to_long();
+ ret = gdbus_signal_emit(NULL,
+ DEVICED_PATH_DISPLAY,
+ DEVICED_INTERFACE_DISPLAY,
+ "sleep",
+ g_variant_new("(t)", (guint64)now));
+ if (ret < 0)
+ _E("Failed to send dbus signal sleep.");
+}
+
+// Leave it for backward compatability. As the signal was implemented when distinction
+// between power and display is unclear, path and interface is related with display.
+// Since tizen 7.0, it is able to receive suspend/resume event using device power-internal API,
+// which is irrelevent with this signal.
+static void power_broadcast_wakeup(void)
+{
+ int ret;
+ long now;
+
+ _D("PM is changed to wakeup.");
+
+ now = clock_gettime_to_long();
+ ret = gdbus_signal_emit(NULL,
+ DEVICED_PATH_DISPLAY,
+ DEVICED_INTERFACE_DISPLAY,
+ "wakeup",
+ g_variant_new("(t)", (guint64)now));
+ if (ret < 0)
+ _E("Failed to send dbus signal wakeup.");
+}
+
void pm_history_init()
{
memset(pm_history_log, 0x0, sizeof(pm_history_log));
{
int ret_val;
+ power_broadcast_suspend();
_I("system suspend");
ret_val = sys_set_str(POWER_STATE_PATH, "mem");
_I("System resume: %d", ret_val);
+ power_broadcast_wakeup();
ret_val = update_wakeup_reason();
if (ret_val < 0) {
if (mainlock_status == POWER_LOCK)
return 0;
+ power_broadcast_wakeup();
+
_I("system power lock");
suspend_other_process(VITAL_WAKEUP);
mainlock_status = POWER_LOCK;
if (mainlock_status == POWER_UNLOCK)
return 0;
+ power_broadcast_suspend();
+
_I("system power unlock");
suspend_other_process(VITAL_SLEEP);
mainlock_status = POWER_UNLOCK;
--- /dev/null
+#include <time.h>
+
+#include "log-macro.h"
+#include "common.h"
+
+long clock_gettime_to_long(void)
+{
+ struct timespec now;
+ int ret;
+
+ ret = clock_gettime(CLOCK_REALTIME, &now);
+
+ if (ret < 0) {
+ _E("Failed to clock gettime!");
+ return 0;
+ }
+
+ return SEC_TO_MSEC(now.tv_sec) + NSEC_TO_MSEC(now.tv_nsec);
+}
+
--- /dev/null
+#ifndef __DD_TIME_H__
+#define __DD_TIME_H__
+
+long clock_gettime_to_long(void);
+
+#endif //__DD_TIME_H__