4 * Copyright (c) 2020 Samsung Electronics Co., Ltd.
6 * Licensed under the Apache License, Version 2.0 (the License);
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
19 #ifndef __DEVICED_POWER_SUSPEND_H__
20 #define __DEVICED_POWER_SUSPEND_H__
22 #include "display/core.h"
24 #define POWER_AUTOSLEEP_PATH "/sys/power/autosleep"
25 #define POWER_LOCK_PATH "/sys/power/wake_lock"
26 #define POWER_UNLOCK_PATH "/sys/power/wake_unlock"
27 #define POWER_WAKEUP_PATH "/sys/power/wakeup_count"
28 #define POWER_STATE_PATH "/sys/power/state"
30 #define FREEZER_VITAL_WAKEUP_CGROUP "/sys/fs/cgroup/freezer/vital_wakeup/freezer.state"
32 #define SET_SUSPEND_TIME 0.5
40 * Vital state enumeration
43 VITAL_SLEEP, /* suspend state */
44 VITAL_WAKEUP, /* resume state */
51 PM_LOG_KEY_PRESS = PM_LOG_MIN, /* key log */
52 PM_LOG_KEY_LONG_PRESS,
54 PM_LOG_LCD_ON, /* lcd log */
55 PM_LOG_LCD_ON_COMPLETE,
60 PM_LOG_LCD_OFF_COMPLETE,
62 PM_LOG_LCD_CONTROL_FAIL,
68 extern bool timeout_sleep_support;
71 void pm_history_init(void);
72 void pm_history_save(enum pm_log_type log_type, int code);
73 void pm_history_print(int fd, int count);
75 bool vital_mode(void);
76 int vital_state_changed(void *data);
78 int power_enable_autosleep(void);
79 int power_disable_autosleep(void);
80 int power_acquire_wakelock(void);
81 int power_release_wakelock(void);
82 int pm_get_power_lock(void);
83 int pm_get_power_lock_support(void);
84 int check_wakeup_src(void);
85 int get_wakeup_count(int *cnt);
86 int set_wakeup_count(int cnt);
87 int suspend_other_process(int type);
88 void power_suspend_init(void);
89 #endif /* __DEVICED_POWER_SUSPEND_H__ */