display: Move custom_brightness setter and update function from plugin to core displa...
[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 <hal/device/hal-display.h>
29 #include "shared/devices.h"
30
31 #define FLAG_X_DPMS             0x2
32
33 #define DEFAULT_DISPLAY 0
34
35 #define PM_MAX_BRIGHTNESS       100
36 #define PM_MIN_BRIGHTNESS       1
37 #define PM_DIM_BRIGHTNESS       0
38
39 #define DISP_INDEX_SHIFT        16
40 #define DISP_CMD(prop, index)   ((index << DISP_INDEX_SHIFT) | prop)
41
42 #define DEFAULT_DISPLAY_COUNT           1
43 #define DEFAULT_DISPLAY_MAX_BRIGHTNESS  100
44 #define DEFAULT_DISPLAY_MAX_DIM_BRIGHTNESS  50
45
46 #define DPMS_SETTING_DONE       -1
47
48 /*
49  * Event type enumeration
50  */
51 enum {
52         EVENT_TIMEOUT = 0,      /*< time out event from timer */
53         EVENT_DEVICE = EVENT_TIMEOUT,   /*< wake up by devices except input devices */
54         EVENT_INPUT,            /*< input event from noti service */
55         EVENT_END,
56 };
57
58 int init_sysfs(unsigned int);
59 int exit_sysfs(void);
60 int display_service_load(void);
61 int display_service_free(void);
62
63 struct _backlight_ops {
64         int (*get_lcd_power)(void);
65         int (*get_lcd_power_node)(void);
66         int (*set_force_brightness)(int level);
67         int (*set_brightness)(int val);
68         int (*get_brightness)(int *val);
69         int (*get_brightness_raw)(int *val);
70         void (*restore_brightness_func)(void);
71         int (*get_brightness_by_light_sensor)(float lmax, float lmin, float light, int *brt);
72         int (*transit_state)(int state);
73         void (*transit_brt)(int start, int end, int step);
74         void (*blink)(int timeout);
75         void (*release_blink)(void);
76 };
77
78 struct _backlight_ops *get_var_backlight_ops(void);
79
80 enum dpms_state {
81         DPMS_ON,       /* In use */
82         DPMS_STANDBY,  /* Blanked, low power */
83         DPMS_SUSPEND,  /* Blanked, lower power */
84         DPMS_OFF,      /* Shut off, awaiting activity */
85         DPMS_FORCE_OFF,/* Force Shut off */
86         DPMS_DETACH,   /* Display detached */
87 };
88
89 bool display_dev_ready(void);
90 bool display_dimstay_check(void);
91 void dpms_set_running_state(int val);
92
93 enum lcdon_block_state {
94         LCDON_BLOCK_NONE = 0,
95         LCDON_BLOCK_WHEN_DISPLAY_DETACHED,
96         LCDON_BLOCK_DURING_SILENT_BOOT,
97 };
98 int is_lcdon_blocked(void);
99
100 #endif
101