4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: DongGi Jang <dg0402.jang@samsung.com>
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
23 #include "device_engine.h"
24 #include "device_plugin.h"
27 #define PROPERTY_MASK 0x0F
28 #define INDEX_SHIFT_CNT 4
30 static int get_video_prop(int prop, int *val)
32 int _prop = prop & PROPERTY_MASK;
33 int _index = prop >> 4;
34 int _max_disp_cnt = -1;
35 int power_saving_stat = -1;
36 int power_saving_display_stat = -1;
38 DBG("Property: %d, Index: %d", _prop, _index);
39 if (0 > plugin_intf->OEM_sys_get_display_count(&_max_disp_cnt)) {
40 ERR("Get display count failed");
44 if (_index >= _max_disp_cnt) {
45 ERR("Invalid Argument: display index > max display count");
50 case DISPLAY_PROP_BRIGHTNESS:
51 /* check power saving */
52 vconf_get_bool(VCONFKEY_SETAPPL_PWRSV_SYSMODE_STATUS, &power_saving_stat);
53 if (power_saving_stat == 1)
54 vconf_get_bool(VCONFKEY_SETAPPL_PWRSV_CUSTMODE_DISPLAY, &power_saving_display_stat);
55 if (power_saving_display_stat != 1)
56 power_saving_display_stat = 0;
57 return plugin_intf->OEM_sys_get_backlight_brightness(_index, val, power_saving_display_stat);
58 case DISPLAY_PROP_MIN_BRIGHTNESS:
59 return plugin_intf->OEM_sys_get_backlight_min_brightness(_index, val);
60 case DISPLAY_PROP_MAX_BRIGHTNESS:
61 return plugin_intf->OEM_sys_get_backlight_max_brightness(_index, val);
62 case DISPLAY_PROP_ONOFF:
63 return plugin_intf->OEM_sys_get_lcd_power(_index, val);
64 case DISPLAY_PROP_GAMMA:
65 /* TODO: not supported yet */
66 DBG("Gamma is not supported");
68 case DISPLAY_PROP_DISPLAY_COUNT:
71 case DISPLAY_PROP_ACL_CONTROL:
72 return plugin_intf->OEM_sys_get_backlight_acl_control(_index, val);
73 case DISPLAY_PROP_IMAGE_ENHANCE_MODE:
74 return plugin_intf->OEM_sys_get_image_enhance_mode(val);
75 case DISPLAY_PROP_IMAGE_ENHANCE_SCENARIO:
76 return plugin_intf->OEM_sys_get_image_enhance_scenario(val);
77 case DISPLAY_PROP_IMAGE_ENHANCE_TONE:
78 return plugin_intf->OEM_sys_get_image_enhance_tone(val);
79 case DISPLAY_PROP_IMAGE_ENHANCE_OUTDOOR:
80 return plugin_intf->OEM_sys_get_image_enhance_outdoor(val);
81 case DISPLAY_PROP_IMAGE_ENHANCE_INFO:
82 return plugin_intf->OEM_sys_image_enhance_info(val);
88 static int set_video_prop(int prop, int val)
90 int _prop = prop & PROPERTY_MASK;
91 int _index = prop >> 4;
92 int _max_disp_cnt = -1;
93 int power_saving_stat = -1;
94 int power_saving_display_stat = -1;
96 DBG("Property: %d, Index: %d", _prop, _index);
97 if (0 > plugin_intf->OEM_sys_get_display_count(&_max_disp_cnt)) {
98 ERR("Get display count failed");
102 if (_index >= _max_disp_cnt) {
103 ERR("Invalid Argument: display index > max display count");
108 case DISPLAY_PROP_BRIGHTNESS:
109 /* check power saving */
110 vconf_get_bool(VCONFKEY_SETAPPL_PWRSV_SYSMODE_STATUS, &power_saving_stat);
111 if (power_saving_stat == 1)
112 vconf_get_bool(VCONFKEY_SETAPPL_PWRSV_CUSTMODE_DISPLAY, &power_saving_display_stat);
113 if (power_saving_display_stat != 1)
114 power_saving_display_stat = 0;
115 return plugin_intf->OEM_sys_set_backlight_brightness(_index, val, power_saving_display_stat);
116 case DISPLAY_PROP_ONOFF:
117 return plugin_intf->OEM_sys_set_lcd_power(_index, val);
118 case DISPLAY_PROP_GAMMA:
119 /* TODO:not supported yet */
120 DBG("Gamma is not supported");
122 case DISPLAY_PROP_ACL_CONTROL:
123 return plugin_intf->OEM_sys_set_backlight_acl_control(_index, val);
124 case DISPLAY_PROP_IMAGE_ENHANCE_MODE:
125 return plugin_intf->OEM_sys_set_image_enhance_mode(val);
126 case DISPLAY_PROP_IMAGE_ENHANCE_SCENARIO:
127 return plugin_intf->OEM_sys_set_image_enhance_scenario(val);
128 case DISPLAY_PROP_IMAGE_ENHANCE_TONE:
129 return plugin_intf->OEM_sys_set_image_enhance_tone(val);
130 case DISPLAY_PROP_IMAGE_ENHANCE_OUTDOOR:
131 return plugin_intf->OEM_sys_set_image_enhance_outdoor(val);
137 static struct device video_prop = {
139 .set_int = set_video_prop,
140 .get_int = get_video_prop,
141 .devtype = DEVTYPE_DISPLAY0
144 static void __attribute__ ((constructor)) module_init()
146 add_dev(&video_prop);