Remove and redefine display blink functions.
These functions are added to below display-backlight.
void display_backlight_set_blink(int timeout)
-> This function set display blink behavior by adding timeout callback.
void display_backlight_unset_blink(void)
-> This function remove blink callback function after DUMP_MODE_WAITING_TIME time.
Change-Id: Iafe293ff9ff8ad65b971885bfd949e037bcffa40
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
#define LCD_PHASED_MAX_BRIGHTNESS 100
#define LCD_PHASED_DELAY 10000 /* microsecond */
-#define DUMP_MODE_WAITING_TIME 600000 /* milisecond */
#define DISPLAY_HAL_LIB_PATH "/usr/lib/libdisplay-hal.so"
static int force_brightness;
static int dpms_running_state = DPMS_SETTING_DONE;
static bool display_dev_available = false;
-static guint release_timer;
static const struct display_config *display_conf;
inline struct _backlight_ops *get_var_backlight_ops(void)
return 0;
}
-static gboolean blink_cb(gpointer data)
-{
- static bool flag;
-
- set_brightness(flag ? PM_MAX_BRIGHTNESS : PM_MIN_BRIGHTNESS);
-
- flag = !flag;
-
- return G_SOURCE_CONTINUE;
-}
-
-static void blink(int timeout)
-{
- static guint timer;
-
- if (timer) {
- g_source_remove(timer);
- timer = 0;
- }
-
- if (timeout < 0) {
- _E("timeout value is invalid %d", timeout);
- return;
- }
-
- if (timeout == 0) {
- display_backlight_update_by_default_brightness();
- return;
- }
-
- timer = g_timeout_add(timeout, blink_cb, NULL);
-}
-
-static gboolean release_blink_cb(gpointer data)
-{
- blink(0);
-
- release_timer = 0;
- return G_SOURCE_REMOVE;
-}
-
-static void release_blink(void)
-{
- if (release_timer) {
- g_source_remove(release_timer);
- release_timer = 0;
- }
-
- release_timer = g_timeout_add(DUMP_MODE_WAITING_TIME, release_blink_cb, NULL);
-}
-
static void restore_brightness_func(void)
{
backlight_ops.set_brightness = set_brightness;
.restore_brightness_func = restore_brightness_func,
.transit_state = backlight_transit_state,
.transit_brt = change_brightness,
- .blink = blink,
- .release_blink = release_blink,
};
int display_service_load(void)
#define LCD_PHASED_MAX_BRIGHTNESS 100
#define LCD_PHASED_DELAY 10000 /* microsecond */
-#define DUMP_MODE_WAITING_TIME 600000 /* milisecond */
#define DISPLAY_HAL_LIB_PATH "/usr/lib/libdisplay-hal.so"
static int force_brightness;
static int dpms_running_state = DPMS_SETTING_DONE;
static bool display_dev_available = false;
-static guint release_timer;
static const struct display_config *display_conf;
inline struct _backlight_ops *get_var_backlight_ops(void)
return 0;
}
-static gboolean blink_cb(gpointer data)
-{
- static bool flag;
-
- set_brightness(flag ? PM_MAX_BRIGHTNESS : PM_MIN_BRIGHTNESS);
-
- flag = !flag;
-
- return G_SOURCE_CONTINUE;
-}
-
-static void blink(int timeout)
-{
- static guint timer;
-
- if (timer) {
- g_source_remove(timer);
- timer = 0;
- }
-
- if (timeout < 0) {
- _E("timeout value is invalid %d", timeout);
- return;
- }
-
- if (timeout == 0) {
- display_backlight_update_by_default_brightness();
- return;
- }
-
- timer = g_timeout_add(timeout, blink_cb, NULL);
-}
-
-static gboolean release_blink_cb(gpointer data)
-{
- blink(0);
-
- release_timer = 0;
- return G_SOURCE_REMOVE;
-}
-
-static void release_blink(void)
-{
- if (release_timer) {
- g_source_remove(release_timer);
- release_timer = 0;
- }
-
- release_timer = g_timeout_add(DUMP_MODE_WAITING_TIME, release_blink_cb, NULL);
-}
-
static void restore_brightness_func(void)
{
backlight_ops.set_brightness = set_brightness;
.restore_brightness_func = restore_brightness_func,
.transit_state = backlight_transit_state,
.transit_brt = change_brightness,
- .blink = blink,
- .release_blink = release_blink,
};
int display_service_load(void)
#define LCD_PHASED_MAX_BRIGHTNESS 100
#define LCD_PHASED_DELAY 10000 /* microsecond */
-#define DUMP_MODE_WAITING_TIME 600000 /* milisecond */
#define DISPLAY_HAL_LIB_PATH "/usr/lib/libdisplay-hal.so"
static int force_brightness;
static int dpms_running_state = DPMS_SETTING_DONE;
static bool display_dev_available = false;
-static guint release_timer;
static const struct display_config *display_conf;
inline struct _backlight_ops *get_var_backlight_ops(void)
return 0;
}
-static gboolean blink_cb(gpointer data)
-{
- static bool flag;
-
- set_brightness(flag ? PM_MAX_BRIGHTNESS : PM_MIN_BRIGHTNESS);
-
- flag = !flag;
-
- return G_SOURCE_CONTINUE;
-}
-
-static void blink(int timeout)
-{
- static guint timer;
-
- if (timer) {
- g_source_remove(timer);
- timer = 0;
- }
-
- if (timeout < 0) {
- _E("timeout value is invalid %d", timeout);
- return;
- }
-
- if (timeout == 0) {
- display_backlight_update_by_default_brightness();
- return;
- }
-
- timer = g_timeout_add(timeout, blink_cb, NULL);
-}
-
-static gboolean release_blink_cb(gpointer data)
-{
- blink(0);
-
- release_timer = 0;
- return G_SOURCE_REMOVE;
-}
-
-static void release_blink(void)
-{
- if (release_timer) {
- g_source_remove(release_timer);
- release_timer = 0;
- }
-
- release_timer = g_timeout_add(DUMP_MODE_WAITING_TIME, release_blink_cb, NULL);
-}
-
static void restore_brightness_func(void)
{
backlight_ops.set_brightness = set_brightness;
.restore_brightness_func = restore_brightness_func,
.transit_state = backlight_transit_state,
.transit_brt = change_brightness,
- .blink = blink,
- .release_blink = release_blink,
};
int display_service_load(void)
#define LCD_PHASED_MAX_BRIGHTNESS 100
#define LCD_PHASED_DELAY 10000 /* microsecond */
-#define DUMP_MODE_WAITING_TIME 600000 /* milisecond */
#define DISPLAY_HAL_LIB_PATH "/usr/lib/libdisplay-hal.so"
static int force_brightness;
static int dpms_running_state = DPMS_SETTING_DONE;
static bool display_dev_available = false;
-static guint release_timer;
static int aod_max_level = -1;
static int aod_normal_level = -1;
static int aod_min_level = -1;
return 0;
}
-static gboolean blink_cb(gpointer data)
-{
- static bool flag;
-
- set_brightness(flag ? PM_MAX_BRIGHTNESS : PM_MIN_BRIGHTNESS);
-
- flag = !flag;
-
- return G_SOURCE_CONTINUE;
-}
-
-static void blink(int timeout)
-{
- static guint timer;
-
- if (timer) {
- g_source_remove(timer);
- timer = 0;
- }
-
- if (timeout < 0) {
- _E("timeout value is invalid %d", timeout);
- return;
- }
-
- if (timeout == 0) {
- display_backlight_update_by_default_brightness();
- return;
- }
-
- timer = g_timeout_add(timeout, blink_cb, NULL);
-}
-
-static gboolean release_blink_cb(gpointer data)
-{
- blink(0);
-
- release_timer = 0;
- return G_SOURCE_REMOVE;
-}
-
-static void release_blink(void)
-{
- if (release_timer) {
- g_source_remove(release_timer);
- release_timer = 0;
- }
-
- release_timer = g_timeout_add(DUMP_MODE_WAITING_TIME, release_blink_cb, NULL);
-}
-
static void restore_brightness_func(void)
{
backlight_ops.set_brightness = set_brightness;
.restore_brightness_func = restore_brightness_func,
.transit_state = backlight_transit_state,
.transit_brt = change_brightness,
- .blink = blink,
- .release_blink = release_blink,
/* auto-test only function */
.get_brightness_raw = get_brightness, /* always fetch brightness from node even LBM mode */
};
void (*restore_brightness_func)(void);
int (*transit_state)(int state);
void (*transit_brt)(int start, int end, int step);
- void (*blink)(int timeout);
- void (*release_blink)(void);
};
struct _backlight_ops *get_var_backlight_ops(void);
#include "display-backlight.h"
#include "display-dpms.h"
+#define DUMP_MODE_WAITING_TIME 600000 /* milisecond */
+
static const struct display_config *display_conf;
static struct _backlight_ops *backlight_ops;
static int default_brightness;
static int custom_brightness;
static bool g_custom_status;
+static guint release_timer;
/* FIXME: This function is for temporary use, should be fixed after plugin refactoring */
int display_backlight_get_max_brightness(int *max_brightness)
return 0;
}
+static gboolean blink_cb(gpointer data)
+{
+ static bool flag;
+
+ backlight_ops->set_brightness(flag ? PM_MAX_BRIGHTNESS : PM_MIN_BRIGHTNESS);
+ flag = !flag;
+
+ return G_SOURCE_CONTINUE;
+}
+
+void display_backlight_set_blink(int timeout)
+{
+ static guint blink_timer;
+
+ if (blink_timer) {
+ g_source_remove(blink_timer);
+ blink_timer = 0;
+ }
+
+ if (timeout < 0) {
+ _W("timeout value is invalid %d", timeout);
+ return;
+ }
+
+ if (timeout == 0) {
+ display_backlight_update_by_default_brightness();
+ return;
+ }
+
+ blink_timer = g_timeout_add(timeout, blink_cb, NULL);
+}
+
+static gboolean release_blink_cb(gpointer data)
+{
+ display_backlight_set_blink(0);
+
+ release_timer = 0;
+ return G_SOURCE_REMOVE;
+}
+
+void display_backlight_unset_blink(void)
+{
+ if (release_timer) {
+ g_source_remove(release_timer);
+ release_timer = 0;
+ }
+
+ release_timer = g_timeout_add(DUMP_MODE_WAITING_TIME, release_blink_cb, NULL);
+}
+
/* FIXME: This code structure should be changed to plugin api call, after plugin refactoting*/
static void __CONSTRUCTOR__ initialize(void)
{
int display_backlight_update_by_custom_brightness(void);
int display_backlight_get_brightness_by_light_sensor(float lmax, float lmin,
float light, int *brightness);
+void display_backlight_set_blink(int timeout);
+void display_backlight_unset_blink(void);
#endif /* __DISPLAY_BACKLIGHT_H__ */
\ No newline at end of file
if (disp_plgn->pm_lock_internal)
disp_plgn->pm_lock_internal(INTERNAL_LOCK_DUMPMODE, LCD_OFF,
STAY_CUR_STATE, DUMP_MODE_WATING_TIME);
- backlight_ops->release_blink();
+ display_backlight_unset_blink();
} else if (!strcmp(on, "off")) {
if (disp_plgn->pm_unlock_internal)
disp_plgn->pm_unlock_internal(INTERNAL_LOCK_DUMPMODE, LCD_OFF, PM_SLEEP_MARGIN);
- backlight_ops->blink(0);
+ display_backlight_set_blink(0);
} else if (!strcmp(on, "blink")) {
- backlight_ops->blink(500);
+ display_backlight_set_blink(500);
} else {
ret = -EINVAL;
}