(b.tv_sec * 1000000 + b.tv_usec)) \
/ 1000)
-struct display_config display_conf = {
+static struct display_config display_conf = {
.lock_wait_time = LOCK_SCREEN_WATING_TIME,
.longpress_interval = LONG_PRESS_INTERVAL,
.lightsensor_interval = SAMPLING_INTERVAL,
.face_detection = NULL,
};
+inline struct display_config* get_display_config()
+{
+ return &display_conf;
+}
+
inline struct state* state_st(enum state_t state)
{
return &states[state];
static int dpms_running_state = DPMS_SETTING_DONE;
static struct display_device *display_dev;
static guint release_timer;
+static struct display_config *display_conf;
inline struct _backlight_ops *get_backlight_ops(void)
{
static int set_default_brt(int level)
{
if (level < PM_MIN_BRIGHTNESS || level > PM_MAX_BRIGHTNESS)
- level = display_conf.pm_default_brightness;
+ level = display_conf->pm_default_brightness;
default_brightness = level;
if (state == DPMS_OFF) {
start = brt;
- end = display_conf.aod_enter_level;
+ end = display_conf->aod_enter_level;
/*
* The value of backlight_ops.get_brightness is system brightness.
*/
get_brightness(&val);
- if (val > display_conf.aod_enter_level)
- backlight_ops.transit_brt(start, end, display_conf.brightness_change_step);
+ if (val > display_conf->aod_enter_level)
+ backlight_ops.transit_brt(start, end, display_conf->brightness_change_step);
} else {
/* prevent transit effect when another effect is already executed */
- if (brt != display_conf.aod_enter_level) {
+ if (brt != display_conf->aod_enter_level) {
_W("effect is already executed brt(%d) aod_level(%d)",
- brt, display_conf.aod_enter_level);
+ brt, display_conf->aod_enter_level);
return 0;
}
- start = display_conf.aod_enter_level;
+ start = display_conf->aod_enter_level;
end = default_brightness;
- backlight_ops.transit_brt(start, end, display_conf.brightness_change_step);
+ backlight_ops.transit_brt(start, end, display_conf->brightness_change_step);
}
return 0;
return 0;
}
+
+static void __CONSTRUCTOR__ initialize(void)
+{
+ display_conf = get_display_config();
+ if (!display_conf)
+ _E("Failed to get display configuration.");
+}
+
int ignore = true;
static int value = KEY_RELEASED;
unsigned int caps;
+ struct display_config *display_conf = get_display_config();
+ if (!display_conf) {
+ _E("Failed to get display configuration.");
+ return ignore;
+ }
caps = display_get_caps(DISPLAY_ACTOR_POWER_KEY);
case KEY_RELEASED:
check_key_pair(pinput->code, pinput->value, &value);
- if (!display_conf.powerkey_doublepress) {
+ if (!display_conf->powerkey_doublepress) {
if (display_has_caps(caps, DISPLAY_CAPA_LCDOFF))
lcdoff_powerkey();
else
if (key_combination == KEY_COMBINATION_POWERKEY) {
/* add long key timer */
longkey_timeout_id = g_timeout_add_seconds(
- display_conf.longpress_interval,
+ display_conf->longpress_interval,
longkey_pressed_cb, NULL);
/* add long key restore timer */
longkey_restore_id = g_timeout_add_seconds(
break;
case KEY_BEING_PRESSED:
if (timediff_usec(pressed_time, pinput->time) >
- (display_conf.longpress_interval * USEC_PER_SEC))
+ (display_conf->longpress_interval * USEC_PER_SEC))
longkey_pressed();
break;
}
(b.tv_sec * 1000000 + b.tv_usec)) \
/ 1000)
-struct display_config display_conf = {
+static struct display_config display_conf = {
.lock_wait_time = LOCK_SCREEN_WATING_TIME,
.longpress_interval = LONG_PRESS_INTERVAL,
.lightsensor_interval = SAMPLING_INTERVAL,
.face_detection = NULL,
};
+inline struct display_config* get_display_config()
+{
+ return &display_conf;
+}
+
inline struct state* state_st(enum state_t state)
{
return &states[state];
static int dpms_running_state = DPMS_SETTING_DONE;
static struct display_device *display_dev;
static guint release_timer;
+static struct display_config *display_conf;
inline struct _backlight_ops *get_backlight_ops(void)
{
static int set_default_brt(int level)
{
if (level < PM_MIN_BRIGHTNESS || level > PM_MAX_BRIGHTNESS)
- level = display_conf.pm_default_brightness;
+ level = display_conf->pm_default_brightness;
default_brightness = level;
if (state == DPMS_OFF) {
start = brt;
- end = display_conf.aod_enter_level;
+ end = display_conf->aod_enter_level;
/*
* The value of backlight_ops.get_brightness is system brightness.
*/
get_brightness(&val);
- if (val > display_conf.aod_enter_level)
- backlight_ops.transit_brt(start, end, display_conf.brightness_change_step);
+ if (val > display_conf->aod_enter_level)
+ backlight_ops.transit_brt(start, end, display_conf->brightness_change_step);
} else {
/* prevent transit effect when another effect is already executed */
- if (brt != display_conf.aod_enter_level) {
+ if (brt != display_conf->aod_enter_level) {
_W("effect is already executed brt(%d) aod_level(%d)",
- brt, display_conf.aod_enter_level);
+ brt, display_conf->aod_enter_level);
return 0;
}
- start = display_conf.aod_enter_level;
+ start = display_conf->aod_enter_level;
end = default_brightness;
- backlight_ops.transit_brt(start, end, display_conf.brightness_change_step);
+ backlight_ops.transit_brt(start, end, display_conf->brightness_change_step);
}
return 0;
return 0;
}
+
+static void __CONSTRUCTOR__ initialize(void)
+{
+ display_conf = get_display_config();
+ if (!display_conf)
+ _E("Failed to get display configuration.");
+}
+
int ignore = true;
static int value = KEY_RELEASED;
unsigned int caps;
+ struct display_config *display_conf = get_display_config();
+ if (!display_conf) {
+ _E("Failed to get display configuration.");
+ return ignore;
+ }
caps = display_get_caps(DISPLAY_ACTOR_POWER_KEY);
case KEY_RELEASED:
check_key_pair(pinput->code, pinput->value, &value);
- if (!display_conf.powerkey_doublepress) {
+ if (!display_conf->powerkey_doublepress) {
if (display_has_caps(caps, DISPLAY_CAPA_LCDOFF))
lcdoff_powerkey();
else
if (key_combination == KEY_COMBINATION_POWERKEY) {
/* add long key timer */
longkey_timeout_id = g_timeout_add(
- display_conf.longpress_interval,
+ display_conf->longpress_interval,
longkey_pressed_cb, NULL);
/* add long key restore timer */
longkey_restore_id = g_timeout_add_seconds(
break;
case KEY_BEING_PRESSED:
if (timediff_usec(pressed_time, pinput->time) >
- (display_conf.longpress_interval * USEC_PER_MSEC))
+ (display_conf->longpress_interval * USEC_PER_MSEC))
longkey_pressed();
break;
}
(b.tv_sec * 1000000 + b.tv_usec)) \
/ 1000)
-struct display_config display_conf = {
+static struct display_config display_conf = {
.lock_wait_time = LOCK_SCREEN_WATING_TIME,
.longpress_interval = LONG_PRESS_INTERVAL,
.lightsensor_interval = SAMPLING_INTERVAL,
.face_detection = NULL,
};
+inline struct display_config* get_display_config()
+{
+ return &display_conf;
+}
+
inline struct state* state_st(enum state_t state)
{
return &states[state];
static int dpms_running_state = DPMS_SETTING_DONE;
static struct display_device *display_dev;
static guint release_timer;
+static struct display_config *display_conf;
inline struct _backlight_ops *get_backlight_ops(void)
{
static int set_default_brt(int level)
{
if (level < PM_MIN_BRIGHTNESS || level > PM_MAX_BRIGHTNESS)
- level = display_conf.pm_default_brightness;
+ level = display_conf->pm_default_brightness;
default_brightness = level;
if (state == DPMS_OFF) {
start = brt;
- end = display_conf.aod_enter_level;
+ end = display_conf->aod_enter_level;
/*
* The value of backlight_ops.get_brightness is system brightness.
*/
get_brightness(&val);
- if (val > display_conf.aod_enter_level)
- backlight_ops.transit_brt(start, end, display_conf.brightness_change_step);
+ if (val > display_conf->aod_enter_level)
+ backlight_ops.transit_brt(start, end, display_conf->brightness_change_step);
} else {
/* prevent transit effect when another effect is already executed */
- if (brt != display_conf.aod_enter_level) {
+ if (brt != display_conf->aod_enter_level) {
_W("effect is already executed brt(%d) aod_level(%d)",
- brt, display_conf.aod_enter_level);
+ brt, display_conf->aod_enter_level);
return 0;
}
- start = display_conf.aod_enter_level;
+ start = display_conf->aod_enter_level;
end = default_brightness;
- backlight_ops.transit_brt(start, end, display_conf.brightness_change_step);
+ backlight_ops.transit_brt(start, end, display_conf->brightness_change_step);
}
return 0;
return 0;
}
+
+static void __CONSTRUCTOR__ initialize(void)
+{
+ display_conf = get_display_config();
+ if (!display_conf)
+ _E("Failed to get display configuration.");
+}
+
int ignore = true;
static int value = KEY_RELEASED;
unsigned int caps;
+ struct display_config *display_conf = get_display_config();
+ if(!display_conf) {
+ _E("Failed to get display configuration.");
+ return ignore;
+ }
caps = display_get_caps(DISPLAY_ACTOR_POWER_KEY);
case KEY_RELEASED:
check_key_pair(pinput->code, pinput->value, &value);
- if (!display_conf.powerkey_doublepress) {
+ if (!display_conf->powerkey_doublepress) {
if (display_has_caps(caps, DISPLAY_CAPA_LCDOFF))
lcdoff_powerkey();
else
if (key_combination == KEY_COMBINATION_POWERKEY) {
/* add long key timer */
longkey_timeout_id = g_timeout_add_seconds(
- display_conf.longpress_interval,
+ display_conf->longpress_interval,
longkey_pressed_cb, NULL);
/* add long key restore timer */
longkey_restore_id = g_timeout_add_seconds(
break;
case KEY_BEING_PRESSED:
if (timediff_usec(pressed_time, pinput->time) >
- (display_conf.longpress_interval * USEC_PER_SEC))
+ (display_conf->longpress_interval * USEC_PER_SEC))
longkey_pressed();
break;
}
static void change_brightness_transit(int start, int end)
{
+ struct display_config *display_conf = get_display_config();
+ if(!display_conf) {
+ _E("Failed to get display configuration.");
+ return ;
+ }
backlight_ops->transit_brt(start, end,
- display_conf.brightness_change_step);
+ display_conf->brightness_change_step);
}
static void set_brightness_level(int level)
(b.tv_sec * 1000000 + b.tv_usec)) \
/ 1000)
-struct display_config display_conf = {
+static struct display_config display_conf = {
.lock_wait_time = LOCK_SCREEN_WATING_TIME,
.longpress_interval = LONG_PRESS_INTERVAL,
.lightsensor_interval = SAMPLING_INTERVAL,
.face_detection = NULL,
};
+inline struct display_config *get_display_config()
+{
+ return &display_conf;
+}
+
inline struct state *state_st(enum state_t state)
{
return &states[state];
static int aod_normal_level = -1;
static int aod_min_level = -1;
static int aod_charging_level = -1;
+static struct display_config *display_conf;
inline struct _backlight_ops *get_backlight_ops(void)
{
static int set_default_brt(int level)
{
if (level < PM_MIN_BRIGHTNESS || level > PM_MAX_BRIGHTNESS)
- level = display_conf.pm_default_brightness;
+ level = display_conf->pm_default_brightness;
default_brightness = level;
else if (aod_min_level > 0 && val >= aod_min_level)
aod_brightness_level = aod_min_level;
else
- aod_brightness_level = display_conf.aod_enter_level;
+ aod_brightness_level = display_conf->aod_enter_level;
} else {
if (aod_max_level > 0 && val >= aod_max_level)
aod_brightness_level = aod_max_level;
else if (aod_min_level > 0 && val >= aod_min_level)
aod_brightness_level = aod_min_level;
else
- aod_brightness_level = display_conf.aod_enter_level;
+ aod_brightness_level = display_conf->aod_enter_level;
}
if (val > aod_brightness_level) {
_D("backlight transit start %d end %d DPMS OFF", start, aod_brightness_level);
- backlight_ops.transit_brt(start, aod_brightness_level, display_conf.brightness_change_step);
+ backlight_ops.transit_brt(start, aod_brightness_level, display_conf->brightness_change_step);
}
} else {
/* prevent transit effect when another effect is already executed */
start = aod_brightness_level;
end = default_brightness;
_D("backlight transit start %d end %d DPMS ON", start, end);
- backlight_ops.transit_brt(start, end, display_conf.brightness_change_step);
+ backlight_ops.transit_brt(start, end, display_conf->brightness_change_step);
}
return 0;
return 0;
}
+
+static void __CONSTRUCTOR__ initialize(void)
+{
+ display_conf = get_display_config();
+ if (!display_conf)
+ _E("Failed to get display configuration.");
+}
+
int ignore = true;
static int value = KEY_RELEASED;
unsigned int caps;
+ struct display_config *display_conf = get_display_config();
+ if (!display_conf) {
+ _E("Failed to get display configuration.");
+ return ignore;
+ }
caps = display_get_caps(DISPLAY_ACTOR_POWER_KEY);
case KEY_RELEASED:
check_key_pair(pinput->code, pinput->value, &value);
- if (!display_conf.powerkey_doublepress) {
+ if (!display_conf->powerkey_doublepress) {
if (display_has_caps(caps, DISPLAY_CAPA_LCDOFF))
lcdoff_powerkey();
else
if (key_combination == KEY_COMBINATION_POWERKEY) {
/* add long key timer */
longkey_timeout_id = g_timeout_add(
- display_conf.longpress_interval,
+ display_conf->longpress_interval,
longkey_pressed_cb, NULL);
/* add long key restore timer */
longkey_restore_id = g_timeout_add_seconds(
break;
case KEY_BEING_PRESSED:
if (timediff_usec(pressed_time, pinput->time) >
- (display_conf.longpress_interval * USEC_PER_MSEC))
+ (display_conf->longpress_interval * USEC_PER_MSEC))
longkey_pressed();
break;
}
/* light sensor */
static float lmax, lmin;
+static struct display_config *display_conf;
static bool update_working_position(void)
{
int ret;
float x, y, z, pitch, realg;
- if (!display_conf.accel_sensor_on)
+ if (!display_conf->accel_sensor_on)
return false;
ret = sensor_listener_read_data(accel_listener, &data);
if (tmp_value != value) {
if (!setting && min_brightness == PM_MIN_BRIGHTNESS &&
- display_conf.accel_sensor_on == true) {
+ display_conf->accel_sensor_on == true) {
position = update_working_position();
if (!position && (old > light)) {
_D("It's not working position, "
int diff, step;
diff = value - tmp_value;
- if (abs(diff) < display_conf.brightness_change_step)
+ if (abs(diff) < display_conf->brightness_change_step)
step = (diff > 0 ? 1 : -1);
else
step = (int)ceil(diff /
- (float)display_conf.brightness_change_step);
+ (float)display_conf->brightness_change_step);
_D("%d", step);
while (tmp_value != value) {
fault_count = 0;
- if (display_conf.continuous_sampling &&
+ if (display_conf->continuous_sampling &&
!check_brightness_changed(value) &&
!setting)
return true;
display_info.update_auto_brightness(true);
alc_timeout_id =
- g_timeout_add_seconds(display_conf.lightsensor_interval,
+ g_timeout_add_seconds(display_conf->lightsensor_interval,
alc_handler, NULL);
}
goto error;
}
- if (!display_conf.accel_sensor_on)
+ if (!display_conf->accel_sensor_on)
goto success;
/* accelerometer sensor */
sensor_destroy_listener(light_listener);
light_listener = 0;
}
- if (display_conf.accel_sensor_on && accel_listener > 0) {
+ if (display_conf->accel_sensor_on && accel_listener > 0) {
sensor_listener_stop(accel_listener);
sensor_destroy_listener(accel_listener);
accel_listener = 0;
}
/* accelerometer sensor*/
- if (display_conf.accel_sensor_on && accel_listener > 0) {
+ if (display_conf->accel_sensor_on && accel_listener > 0) {
sensor_listener_stop(accel_listener);
sensor_destroy_listener(accel_listener);
accel_listener = 0;
display_info.update_auto_brightness(true);
alc_timeout_id =
- g_timeout_add_seconds(display_conf.lightsensor_interval,
+ g_timeout_add_seconds(display_conf->lightsensor_interval,
alc_handler, NULL);
} else if (status == SETTING_BRIGHTNESS_AUTOMATIC_PAUSE) {
_I("Auto brightness paused.");
ret = get_setting_brightness(&default_brt);
if (ret != 0 || (default_brt < PM_MIN_BRIGHTNESS || default_brt > PM_MAX_BRIGHTNESS)) {
_I("Failed to read vconf value for brightness.");
- brt = display_conf.pm_default_brightness;
+ brt = display_conf->pm_default_brightness;
if (default_brt < PM_MIN_BRIGHTNESS || default_brt > PM_MAX_BRIGHTNESS) {
ret = vconf_set_int(VCONFKEY_SETAPPL_LCD_BRIGHTNESS, brt);
if (ret < 0)
backlight_ops = get_backlight_ops();
if (!backlight_ops)
_E("Failed to get backlight operator.");
+
+ display_conf = get_display_config();
+ if (!display_conf)
+ _E("Failed to get display configuration.");
}
* Global variables
* display_conf : configuration of display
*/
-extern struct display_config display_conf;
+struct display_config* get_display_config();
/*
* @brief Display Extension features
GVariant *param, GDBusMethodInvocation *invocation, gpointer user_data)
{
int app, val, ret, control;
+ struct display_config *display_conf = get_display_config();
+ if (!display_conf) {
+ _E("Failed to get display configuration.");
+ ret = -EINVAL;
+ goto error;
+ }
g_variant_get(param, "(ii)", &app, &val);
- if (app < 0 || app >= ARRAY_SIZE(display_conf.framerate_app) || val < 0) {
+ if (app < 0 || app >= ARRAY_SIZE(display_conf->framerate_app) || val < 0) {
ret = -EINVAL;
goto error;
}
- if (!display_conf.framerate_app[app]) {
+ if (!display_conf->framerate_app[app]) {
_I("This case(%d) is not support in this target", app);
ret = -EPERM;
goto error;
}
- control = display_conf.control_display;
+ control = display_conf->control_display;
if (control)
backlight_ops->off(NORMAL_MODE);
PmLockNode *n;
GVariant *v = NULL;
time_t now;
+ struct display_config *display_conf = get_display_config();
+ if (!display_conf) {
+ _E("Failed to get display configuration.");
+ return NULL;
+ }
n = (PmLockNode *) malloc(sizeof(PmLockNode));
if (n == NULL) {
if (pid < INTERNAL_LOCK_BASE) {
v = g_variant_new("(ii)", s_index, pid);
if (v) {
- warning_id = g_timeout_add_seconds(display_conf.lockcheck_timeout,
+ warning_id = g_timeout_add_seconds(display_conf->lockcheck_timeout,
pmlock_check, (void *)v);
} else {
_E("Failed to make GVariant.");
struct libinput_event_keyboard *k;
unsigned int time;
int fd = 0;
+ struct display_config *display_conf = get_display_config();
+ if(!display_conf) {
+ _E("Failed to get display configuration.");
+ return;
+ }
if (!pm_callback)
return;
break;
case LIBINPUT_EVENT_TOUCH_MOTION:
case LIBINPUT_EVENT_TOUCH_FRAME:
- if (touch_event_blocked() && !ambient_get_state() && !display_conf.touch_wakeup)
+ if (touch_event_blocked() && !ambient_get_state() && !display_conf->touch_wakeup)
return;
input.type = EV_ABS;
input.value = KEY_BEING_PRESSED;
static int custom_on_timeout = 0;
static int custom_normal_timeout = 0;
static int custom_dim_timeout = 0;
+static struct display_config *display_conf;
int (*update_pm_setting) (int key_idx, int val);
return;
}
- if (!display_conf.dimming || ambient_get_condition()) {
+ if (!display_conf->dimming || ambient_get_condition()) {
*dim_timeout = LCD_MIN_DIM_TIMEOUT;
return;
}
return changed;
}
- if (display_conf.dimming)
+ if (display_conf->dimming)
custom_dim_timeout = (double)timeout * LCD_DIM_RATIO;
else
custom_dim_timeout = LCD_MIN_DIM_TIMEOUT;
if (!disp_plgn) {
_E("Failed to get display plugin.");
}
+
+ display_conf = get_display_config();
+ if (!display_conf)
+ _E("Failed to get display configuration.");
}