4 * Copyright (c) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
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.
22 * @brief Power manager main loop header file
24 #ifndef __POWER_MANAGER_H__
25 #define __POWER_MANAGER_H__
28 #include "device-interface.h"
31 #define WITHOUT_STARTNOTI 0x1
32 #define MASK_BIT 0x7 /* 111 */
33 #define MASK_DIM 0x1 /* 001 */
34 #define MASK_OFF 0x2 /* 010 */
35 #define MASK_SLP 0x4 /* 100 */
37 #define VCALL_FLAG 0x00000001
38 #define LOWBT_FLAG 0x00000100
39 #define CHRGR_FLAG 0x00000200
40 #define PWRSV_FLAG 0x00000400
41 #define SMAST_FLAG 0x00001000
42 #define BRTCH_FLAG 0x00002000
43 #define PWROFF_FLAG 0x00004000
44 #define DIMSTAY_FLAG 0x00008000
46 #define DEFAULT_NORMAL_TIMEOUT 30000
47 #define DEFAULT_DIM_TIMEOUT 5000
48 #define DEFAULT_OFF_TIMEOUT 1000
50 #define MASK32 0xffffffff
52 #define CHECK_OPS(d, op) (d != NULL && d->op != NULL)
55 #define MAX_LOG_COUNT 250
59 PM_LOG_KEY_PRESS = PM_LOG_MIN, /* key log */
60 PM_LOG_KEY_LONG_PRESS,
62 PM_LOG_LCD_ON, /* lcd log */
72 void pm_history_save(enum pm_log_type, int);
75 extern unsigned int pm_status_flag;
82 S_NORMAL, /*< normal state */
83 S_LCDDIM, /*< LCD dimming */
84 S_LCDOFF, /*< LCD off */
85 S_SLEEP, /*< system suspend */
91 * pm_cur_state : current state
92 * states : state definitions
93 * trans_table : state transition table
99 * @brief State structure
102 enum state_t state; /**< state number */
103 int (*trans) (int evt); /**< transition function pointer */
104 int (*action) (int timeout); /**< enter action */
105 int (*check) (int next); /**< transition check function */
110 * @brief Configuration structure
112 struct display_config {
113 double lock_wait_time;
114 double longpress_interval;
115 double lightsensor_interval;
117 int brightness_change_step;
118 int hbm_lux_threshold;
120 int framerate_app[4];
122 int powerkey_doublepress;
125 int continuous_sampling;
130 * display_conf : configuration of display
132 extern struct display_config display_conf;
135 * @brief Display Extension features
137 struct display_function_info {
138 void (*update_auto_brightness)(bool);
139 int (*set_autobrightness_min)(int, char *);
140 int (*reset_autobrightness_min)(char *, enum watch_id);
141 int (*face_detection)(int, int, int);
144 extern struct display_function_info display_info;
146 struct display_keyfilter_ops {
149 int (*check)(int, char[], int);
150 void (*set_powerkey_ignore)(int);
151 int (*powerkey_lcdoff)(void);
152 void (*backlight_enable)(bool);
155 extern const struct display_keyfilter_ops *keyfilter_ops;
157 /* If the bit in a condition variable is set,
158 * we cannot transit the state until clear this bit. */
161 int check_processes(enum state_t prohibit_state);
162 extern struct state state[S_END];
163 int reset_lcd_timeout(char *name, enum watch_id id);
164 int check_lcdoff_lock_state(void);