Merge "Fix tzip problem with hybrid packages made by Tizen IDE" into tizen
[platform/core/system/deviced.git] / src / display / device-interface.h
1 /*
2  * deviced
3  *
4  * Copyright (c) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
5  *
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
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
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.
17  */
18
19
20 /**
21  * @file        device-interface.h
22  * @brief       backlight, touch, power devices interface module header
23  */
24 #ifndef __DEVICE_INTERFACE_H__
25 #define __DEVICE_INTERFACE_H__
26
27 #include <stdbool.h>
28 #include "core/devices.h"
29
30 #define FLAG_X_DPMS             0x2
31
32 #define DEFAULT_DISPLAY 0
33
34 #define PM_MAX_BRIGHTNESS       100
35 #define PM_MIN_BRIGHTNESS       1
36 #define PM_DEFAULT_BRIGHTNESS   60
37 #define PM_DIM_BRIGHTNESS       0
38
39 #define PM_LCD_RETRY_CNT        3
40
41 #define DISP_INDEX_SHIFT        16
42 #define DISP_CMD(prop, index)   ((index << DISP_INDEX_SHIFT) | prop)
43
44 #define DEFAULT_DISPLAY_COUNT           1
45 #define DEFAULT_DISPLAY_MAX_BRIGHTNESS  100
46
47 /*
48  * Event type enumeration
49  */
50 enum {
51         EVENT_TIMEOUT = 0,      /*< time out event from timer */
52         EVENT_DEVICE = EVENT_TIMEOUT,   /*< wake up by devices except input devices */
53         EVENT_INPUT,            /*< input event from noti service */
54         EVENT_END,
55 };
56
57 int init_sysfs(unsigned int);
58 int exit_sysfs(void);
59 int display_service_load(void);
60 int display_service_free(void);
61
62 struct _backlight_ops {
63         int (*off)(enum device_flags);
64         int (*dim)(void);
65         int (*on)(enum device_flags);
66         int (*update)(void);
67         int (*standby)(int);
68         int (*set_default_brt)(int level);
69         int (*get_lcd_power)(void);
70         int (*set_custom_status)(bool on);
71         bool (*get_custom_status)(void);
72         int (*save_custom_brightness)(void);
73         int (*custom_update)(void);
74         int (*set_force_brightness)(int level);
75         int (*set_brightness)(int val);
76         int (*get_brightness)(int *val);
77         int (*get_brightness_by_light_sensor)(float lmax, float lmin, float light, int *brt);
78         int (*get_frame_rate)(int *rate);
79         int (*set_frame_rate)(int rate);
80 };
81
82 struct _power_ops {
83         int (*suspend)(void);
84         int (*enable_autosleep)(void);
85         int (*power_lock)(void);
86         int (*power_unlock)(void);
87         int (*get_power_lock_support)(void);
88         int (*check_wakeup_src)(void);
89         int (*get_wakeup_count)(int *cnt);
90         int (*set_wakeup_count)(int cnt);
91 };
92
93 extern struct _backlight_ops backlight_ops;
94 extern struct _power_ops power_ops;
95
96 enum dpms_state {
97         DPMS_ON,       /* In use */
98         DPMS_STANDBY,  /* Blanked, low power */
99         DPMS_SUSPEND,  /* Blanked, lower power */
100         DPMS_OFF,      /* Shut off, awaiting activity */
101 };
102
103 int dpms_set_power(enum dpms_state state);
104 int dpms_get_power(enum dpms_state *state);
105
106 #endif
107