3abf17c87fe167dc4b5e88f895598a0c83dc2bcc
[platform/core/system/deviced.git] / plugins / tv / display / device-interface.c
1 /*
2  * deviced
3  *
4  * Copyright (c) 2012 - 2015 Samsung Electronics Co., Ltd.
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 #include <stdio.h>
21 #include <stdlib.h>
22 #include <stdbool.h>
23 #include <sys/types.h>
24 #include <sys/stat.h>
25 #include <fcntl.h>
26 #include <string.h>
27 #include <unistd.h>
28 #include <limits.h>
29 #include <math.h>
30 #include <assert.h>
31 #include <errno.h>
32 #include <dlfcn.h>
33 #include <hal/device/hal-display.h>
34
35 #include "ambient-mode.h"
36 #include "core/log.h"
37 #include "shared/devices.h"
38 #include "shared/common.h"
39 #include "shared/device-notifier.h"
40 #include "device-interface.h"
41 #include "vconf.h"
42 #include "core.h"
43 #include "display-panel.h"
44 #include "display-backlight.h"
45 #include "power/power-suspend.h"
46 #include "display-lock.h"
47
48 static struct display_backlight_ops backlight_ops;
49 static const struct display_config *display_conf;
50
51 inline struct display_backlight_ops *get_var_backlight_ops(void)
52 {
53         return &backlight_ops;
54 }
55
56 static struct display_backlight_ops backlight_ops = {
57         .get_lcd_power = display_panel_get_dpms_cached_state,
58         .set_brightness = NULL,
59         .get_brightness = NULL,
60         .transit_state = NULL,
61         .transit_brt = NULL,
62 };
63
64 /* Dummy. Do not consider detached display state */
65 int is_lcdon_blocked(void)
66 {
67         return LCDON_BLOCK_NONE;
68 }
69
70 void setup_display_plugin_backlight_ops(struct display_plugin *dp)
71 {
72         assert(dp);
73
74         dp->backlight = &backlight_ops;
75 }
76
77 static void __CONSTRUCTOR__ initialize(void)
78 {
79         display_conf = get_var_display_config();
80         if (!display_conf)
81                 _E("Failed to get display configuration variable.");
82 }
83