display: Provide DPMS wrapper via display-panel 20/290420/6
authorYoungjae Cho <y0.cho@samsung.com>
Fri, 24 Mar 2023 04:04:30 +0000 (13:04 +0900)
committerYoungjae Cho <y0.cho@samsung.com>
Mon, 27 Mar 2023 04:51:06 +0000 (13:51 +0900)
Technically DPMS is subject to display-panel. Therefore added wrapper
for DPMS at display-panel.c.
 - dpms_get_cached_state()
    => display_panel_get_dpms_cached_state()
 - dpms_init()
    => display_panel_init_dpms()
 - dpms_exit()
    => display_panel_exit_dpms()
 - register_dpms_checklist()
    => display_panel_register_dpms_checklist()

And those existing DPMS functions have been restricted that it is
unable to be accessed from external object file. Plugins who want
deviced service for DPMS must not use DPMS function directly but use
wrapper provided by display-panel.h.

Change-Id: I8359b9b60981be14a03f8b7f89284f0b93596a24
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
30 files changed:
plugins/iot-headed/display/core.c
plugins/iot-headed/display/device-interface.c
plugins/iot-headed/display/key-filter.c
plugins/mobile/display/core.c
plugins/mobile/display/device-interface.c
plugins/mobile/display/key-filter.c
plugins/tv/display/core.c
plugins/tv/display/device-interface.c
plugins/tv/display/key-filter.c
plugins/wearable/display/core.c
plugins/wearable/display/device-interface.c
plugins/wearable/display/display-handler.c
plugins/wearable/display/hbm.c
plugins/wearable/display/key-filter.c
plugins/wearable/display/swim.c
src/display/display-backlight.c
src/display/display-backlight.h
src/display/display-config.c
src/display/display-config.h
src/display/display-dpms.c
src/display/display-dpms.h
src/display/display-panel.c
src/display/display-panel.h
src/display/display.h
src/display/plugin-common/ambient-mode.c
src/display/plugin-common/core.h
src/display/plugin-common/display-lock.c
src/power/power-suspend.c
src/shared/common.h
src/touchscreen/touchscreen.c

index c27e1f6..64c3bcf 100644 (file)
@@ -63,7 +63,6 @@
 #include "power/power-doze.h"
 #include "device-interface.h"
 #include "display-plugin.h"
-#include "display-dpms.h"
 #include "display-signal.h"
 #include "display-lock.h"
 #include "display-backlight.h"
@@ -325,7 +324,7 @@ void lcd_on_procedure(int state, enum device_flags flag)
        _I("[lcdstep] 0x%lx", flags);
 
        if (flags & AMBIENT_MODE) {
-               if (ambient_get_state() == false && dpms_get_cached_state() == DPMS_ON)
+               if (ambient_get_state() == false && display_panel_get_dpms_cached_state() == DPMS_ON)
                        return;
                ambient_set_state(false);
        }
@@ -687,7 +686,7 @@ void lcd_on_direct(enum device_flags flags)
 
 static inline bool check_lcd_is_on(void)
 {
-       if (dpms_get_cached_state() != DPMS_ON)
+       if (display_panel_get_dpms_cached_state() != DPMS_ON)
                return false;
 
        return true;
@@ -760,7 +759,7 @@ int custom_lcdoff(enum device_flags flag)
        }
 
        _I("custom lcd off by flag(%d)", flag);
-       if (dpms_get_cached_state() == DPMS_ON)
+       if (display_panel_get_dpms_cached_state() == DPMS_ON)
                lcd_off_procedure(flag);
 
        if (set_custom_lcdon_timeout(0) == true)
@@ -848,7 +847,7 @@ int display_off_by_reason(const char *reason)
        }
 
        _I("platform lcd off by %s", reason);
-       if (dpms_get_cached_state() == DPMS_ON)
+       if (display_panel_get_dpms_cached_state() == DPMS_ON)
                lcd_off_procedure(flag);
 
        /* state transition */
@@ -898,7 +897,7 @@ static int default_proc_change_state(unsigned int cond, pid_t pid)
                default_proc_change_state_action(next, -1);
                break;
        case S_LCDOFF:
-               if (dpms_get_cached_state() == DPMS_ON)
+               if (display_panel_get_dpms_cached_state() == DPMS_ON)
                        lcd_off_procedure(LCD_OFF_BY_EVENT);
                if (set_custom_lcdon_timeout(0))
                        update_display_time();
@@ -1444,11 +1443,11 @@ static int default_action(int timeout)
                if ((get_pm_old_state() != S_SLEEP) && (get_pm_old_state() != S_LCDOFF)) {
                        stop_lock_timer();
                        /* lcd off state : turn off the backlight */
-                       if (dpms_get_cached_state() == DPMS_ON)
+                       if (display_panel_get_dpms_cached_state() == DPMS_ON)
                                lcd_off_procedure(LCD_OFF_BY_TIMEOUT);
                }
 
-               if (dpms_get_cached_state() == DPMS_ON
+               if (display_panel_get_dpms_cached_state() == DPMS_ON
                    || lcd_paneloff_mode)
                        lcd_off_procedure(LCD_OFF_BY_TIMEOUT);
                break;
@@ -1457,7 +1456,7 @@ static int default_action(int timeout)
                if ((get_pm_old_state() != S_SLEEP) && (get_pm_old_state() != S_LCDOFF))
                        stop_lock_timer();
 
-               if (dpms_get_cached_state() == DPMS_ON)
+               if (display_panel_get_dpms_cached_state() == DPMS_ON)
                        lcd_off_procedure(LCD_OFF_BY_TIMEOUT);
 
                if (!pm_get_power_lock_support()) {
@@ -1644,7 +1643,7 @@ static int update_setting(int key_idx, int val)
                /* LCD on if lock screen show before waiting time */
                if ((get_pm_cur_state() == S_NORMAL) &&
                    val == VCONFKEY_IDLE_LOCK &&
-                   dpms_get_cached_state() != DPMS_ON &&
+                   display_panel_get_dpms_cached_state() != DPMS_ON &&
                        is_lcdon_blocked() == LCDON_BLOCK_NONE)
                        lcd_on_procedure(LCD_NORMAL, LCD_ON_BY_EVENT);
                stop_lock_timer();
@@ -1872,7 +1871,7 @@ static int battery_health_changed(void *data)
                set_pm_status_flag(DIMSTAY_FLAG);
        }
 
-       if (dpms_get_cached_state() == DPMS_ON)
+       if (display_panel_get_dpms_cached_state() == DPMS_ON)
                display_backlight_update_by_default_brightness();
 
        return 0;
@@ -1882,7 +1881,7 @@ static gboolean delayed_dpms_init_done(gpointer data)
 {
        int timeout;
 
-       if (!dpms_init())
+       if (!display_panel_init_dpms())
                return G_SOURCE_CONTINUE;
 
        switch (get_pm_cur_state()) {
@@ -1913,7 +1912,7 @@ static void add_timer_for_dpms_init(void)
 {
        guint id = g_timeout_add(500/* milliseconds */, delayed_dpms_init_done, NULL);
        if (id == 0)
-               _E("Failed to add dpms_init timeout.");
+               _E("Failed to add display_panel_init_dpms timeout.");
 }
 
 /**
@@ -2100,7 +2099,7 @@ static void display_init(void *data)
                check_seed_status();
 
                /* In smd test, TSP should be turned off if display panel is not existed. */
-               if (dpms_get_cached_state() == -ENOENT) {
+               if (display_panel_get_dpms_cached_state() == -ENOENT) {
                        _I("Display panel is not existed.");
                        lcd_direct_control(DPMS_OFF, NORMAL_MODE);
                        exit_lcd_operation();
@@ -2110,7 +2109,7 @@ static void display_init(void *data)
                 * since display manager can be launched later than deviced.
                 * In the case, display cannot be turned on at the first booting */
                // wm_ready = check_wm_ready();
-               if (dpms_init()) {
+               if (display_panel_init_dpms()) {
                        if (is_lcdon_blocked() != LCDON_BLOCK_NONE)
                                lcd_off_procedure(LCD_OFF_BY_EVENT);
                        else
index beaa035..95a4e79 100644 (file)
@@ -42,7 +42,6 @@
 #include "device-interface.h"
 #include "vconf.h"
 #include "core.h"
-#include "display-dpms.h"
 #include "display-lock.h"
 #include "display-backlight.h"
 #include "display-panel.h"
@@ -80,7 +79,7 @@ bool display_dev_ready(void)
 }
 
 static struct display_backlight_ops backlight_ops = {
-       .get_lcd_power = dpms_get_cached_state,
+       .get_lcd_power = display_panel_get_dpms_cached_state,
        .set_brightness = NULL,
        .get_brightness = NULL,
        .transit_state = NULL,
@@ -140,7 +139,7 @@ int exit_sysfs(void)
 
        display_backlight_update_by_default_brightness();
 
-       dpms_exit();
+       display_panel_exit_dpms();
 
        ops = find_device("touchscreen");
        if (!check_default(ops))
index 0d8067b..8b9b03e 100644 (file)
@@ -32,6 +32,7 @@
 #include "core.h"
 #include "poll.h"
 #include "display-actor.h"
+#include "display-panel.h"
 #include "display-backlight.h"
 #include "display-ops.h"
 #include "display-config.h"
@@ -211,7 +212,7 @@ static inline bool switch_on_lcd(enum device_flags flags)
        if (current_state_in_on())
                return false;
 
-       if (dpms_get_cached_state() == DPMS_ON) {
+       if (display_panel_get_dpms_cached_state() == DPMS_ON) {
                if (ambient_get_state() == false)
                        return false;
        }
@@ -231,7 +232,7 @@ static inline void switch_off_lcd(void)
        if (!current_state_in_on())
                return;
 
-       if (dpms_get_cached_state() == DPMS_OFF)
+       if (display_panel_get_dpms_cached_state() == DPMS_OFF)
                return;
 
        broadcast_lcdoff_by_powerkey();
@@ -358,7 +359,7 @@ static int decide_lcdoff(void)
 {
        /* It's not needed if it's already LCD off state */
        if (!current_state_in_on() &&
-           dpms_get_cached_state() != DPMS_ON)
+           display_panel_get_dpms_cached_state() != DPMS_ON)
                return false;
 
        /*
index 61e551c..cd5a1d5 100644 (file)
@@ -62,7 +62,6 @@
 #include "power/power-doze.h"
 #include "device-interface.h"
 #include "display-plugin.h"
-#include "display-dpms.h"
 #include "proximity.h"
 #include "display-info.h"
 #include "display-signal.h"
@@ -332,7 +331,7 @@ void lcd_on_procedure(int state, enum device_flags flag)
        _I("[lcdstep] 0x%lx", flags);
 
        if (flags & AMBIENT_MODE) {
-               if (ambient_get_state() == false && dpms_get_cached_state() == DPMS_ON)
+               if (ambient_get_state() == false && display_panel_get_dpms_cached_state() == DPMS_ON)
                        return;
                ambient_set_state(false);
        }
@@ -694,7 +693,7 @@ void lcd_on_direct(enum device_flags flags)
 
 static inline bool check_lcd_is_on(void)
 {
-       if (dpms_get_cached_state() != DPMS_ON)
+       if (display_panel_get_dpms_cached_state() != DPMS_ON)
                return false;
 
        return true;
@@ -767,7 +766,7 @@ int custom_lcdoff(enum device_flags flag)
        }
 
        _I("custom lcd off by flag(%d)", flag);
-       if (dpms_get_cached_state() == DPMS_ON)
+       if (display_panel_get_dpms_cached_state() == DPMS_ON)
                lcd_off_procedure(flag);
 
        if (set_custom_lcdon_timeout(0) == true)
@@ -855,7 +854,7 @@ int display_off_by_reason(const char *reason)
        }
 
        _I("platform lcd off by %s", reason);
-       if (dpms_get_cached_state() == DPMS_ON)
+       if (display_panel_get_dpms_cached_state() == DPMS_ON)
                lcd_off_procedure(flag);
 
        /* state transition */
@@ -905,7 +904,7 @@ static int default_proc_change_state(unsigned int cond, pid_t pid)
                default_proc_change_state_action(next, -1);
                break;
        case S_LCDOFF:
-               if (dpms_get_cached_state() == DPMS_ON) {
+               if (display_panel_get_dpms_cached_state() == DPMS_ON) {
                        if (get_proximity_state() == SENSOR_PROXIMITY_NEAR)
                                lcd_off_procedure(LCD_OFF_BY_PROXIMITY);
                        else
@@ -1454,11 +1453,11 @@ static int default_action(int timeout)
                if ((get_pm_old_state() != S_SLEEP) && (get_pm_old_state() != S_LCDOFF)) {
                        stop_lock_timer();
                        /* lcd off state : turn off the backlight */
-                       if (dpms_get_cached_state() == DPMS_ON)
+                       if (display_panel_get_dpms_cached_state() == DPMS_ON)
                                lcd_off_procedure(LCD_OFF_BY_TIMEOUT);
                }
 
-               if (dpms_get_cached_state() == DPMS_ON
+               if (display_panel_get_dpms_cached_state() == DPMS_ON
                    || lcd_paneloff_mode)
                        lcd_off_procedure(LCD_OFF_BY_TIMEOUT);
                break;
@@ -1467,7 +1466,7 @@ static int default_action(int timeout)
                if ((get_pm_old_state() != S_SLEEP) && (get_pm_old_state() != S_LCDOFF))
                        stop_lock_timer();
 
-               if (dpms_get_cached_state() == DPMS_ON)
+               if (display_panel_get_dpms_cached_state() == DPMS_ON)
                        lcd_off_procedure(LCD_OFF_BY_TIMEOUT);
 
                if (!pm_get_power_lock_support()) {
@@ -1654,7 +1653,7 @@ static int update_setting(int key_idx, int val)
                /* LCD on if lock screen show before waiting time */
                if ((get_pm_cur_state() == S_NORMAL) &&
                    val == VCONFKEY_IDLE_LOCK &&
-                   dpms_get_cached_state() != DPMS_ON &&
+                   display_panel_get_dpms_cached_state() != DPMS_ON &&
                        is_lcdon_blocked() == LCDON_BLOCK_NONE)
                        lcd_on_procedure(LCD_NORMAL, LCD_ON_BY_EVENT);
                stop_lock_timer();
@@ -1882,7 +1881,7 @@ static int battery_health_changed(void *data)
                set_pm_status_flag(DIMSTAY_FLAG);
        }
 
-       if (dpms_get_cached_state() == DPMS_ON)
+       if (display_panel_get_dpms_cached_state() == DPMS_ON)
                display_backlight_update_by_default_brightness();
 
        return 0;
@@ -1892,7 +1891,7 @@ static gboolean delayed_dpms_init_done(gpointer data)
 {
        int timeout;
 
-       if (!dpms_init())
+       if (!display_panel_init_dpms())
                return G_SOURCE_CONTINUE;
 
        switch (get_pm_cur_state()) {
@@ -1923,7 +1922,7 @@ static void add_timer_for_dpms_init(void)
 {
        guint id = g_timeout_add(500/* milliseconds */, delayed_dpms_init_done, NULL);
        if (id == 0)
-               _E("Failed to add dpms_init timeout.");
+               _E("Failed to add display_panel_init_dpms timeout.");
 }
 
 /**
@@ -2106,7 +2105,7 @@ static void display_init(void *data)
                check_seed_status();
 
                /* In smd test, TSP should be turned off if display panel is not existed. */
-               if (dpms_get_cached_state() == -ENOENT) {
+               if (display_panel_get_dpms_cached_state() == -ENOENT) {
                        _I("Display panel is not existed.");
                        lcd_direct_control(DPMS_OFF, NORMAL_MODE);
                        exit_lcd_operation();
@@ -2116,7 +2115,7 @@ static void display_init(void *data)
                 * since display manager can be launched later than deviced.
                 * In the case, display cannot be turned on at the first booting */
                // wm_ready = check_wm_ready();
-               if (dpms_init()) {
+               if (display_panel_init_dpms()) {
                        if (is_lcdon_blocked() != LCDON_BLOCK_NONE)
                                lcd_off_procedure(LCD_OFF_BY_EVENT);
                        else
index 7834acb..aa1bc85 100644 (file)
@@ -41,7 +41,6 @@
 #include "device-interface.h"
 #include "vconf.h"
 #include "core.h"
-#include "display-dpms.h"
 #include "display-lock.h"
 #include "display-backlight.h"
 #include "display-panel.h"
@@ -79,7 +78,7 @@ bool display_dev_ready(void)
 }
 
 static struct display_backlight_ops backlight_ops = {
-       .get_lcd_power = dpms_get_cached_state,
+       .get_lcd_power = display_panel_get_dpms_cached_state,
        .set_brightness = NULL,
        .get_brightness = NULL,
        .transit_state = NULL,
@@ -155,7 +154,7 @@ int exit_sysfs(void)
 
        display_backlight_update_by_default_brightness();
 
-       dpms_exit();
+       display_panel_exit_dpms();
 
        ops = find_device("touchscreen");
        if (!check_default(ops))
index c5bcb9e..85437e4 100644 (file)
@@ -32,6 +32,7 @@
 #include "core.h"
 #include "poll.h"
 #include "display-actor.h"
+#include "display-panel.h"
 #include "display-backlight.h"
 #include "display-ops.h"
 #include "display-config.h"
@@ -200,7 +201,7 @@ static inline bool switch_on_lcd(enum device_flags flags)
        if (current_state_in_on())
                return false;
 
-       if (dpms_get_cached_state() == DPMS_ON) {
+       if (display_panel_get_dpms_cached_state() == DPMS_ON) {
                if (ambient_get_state() == false)
                        return false;
        }
@@ -220,7 +221,7 @@ static inline void switch_off_lcd(void)
        if (!current_state_in_on())
                return;
 
-       if (dpms_get_cached_state() == DPMS_OFF)
+       if (display_panel_get_dpms_cached_state() == DPMS_OFF)
                return;
 
        broadcast_lcdoff_by_powerkey();
@@ -347,7 +348,7 @@ static int decide_lcdoff(void)
 {
        /* It's not needed if it's already LCD off state */
        if (!current_state_in_on() &&
-           dpms_get_cached_state() != DPMS_ON)
+           display_panel_get_dpms_cached_state() != DPMS_ON)
                return false;
 
        /*
@@ -410,7 +411,7 @@ static bool key_check_display_on(void)
        if (current_state_in_on())
                return false;
 
-       if (dpms_get_cached_state() == DPMS_ON) {
+       if (display_panel_get_dpms_cached_state() == DPMS_ON) {
                _W("display power was on");
                return false;
        }
@@ -424,7 +425,7 @@ static gboolean display_on_cb(void *data)
                return G_SOURCE_REMOVE;
 
        displayon_by_powerkey_timeout_id = 0;
-       if (dpms_get_cached_state() != DPMS_ON ||
+       if (display_panel_get_dpms_cached_state() != DPMS_ON ||
            current_state_in_on() == false) {
                broadcast_lcdon_by_powerkey();
                lcd_on_direct(LCD_ON_BY_POWER_KEY);
@@ -497,7 +498,7 @@ static int process_power_key(struct input_event *pinput)
                        ignore = true;
 
                        if (!displayon_by_powerkey_timeout_id &&
-                               dpms_get_cached_state() != DPMS_ON &&
+                               display_panel_get_dpms_cached_state() != DPMS_ON &&
                                key_combination != COMBINATION_TORCH) {
                                displayon_by_powerkey_timeout_id = g_timeout_add(
                                                100,
index 817e868..04adbff 100644 (file)
@@ -62,7 +62,6 @@
 #include "power/power-doze.h"
 #include "device-interface.h"
 #include "display-plugin.h"
-#include "display-dpms.h"
 #include "display-signal.h"
 #include "display-lock.h"
 #include "display-backlight.h"
@@ -325,7 +324,7 @@ void lcd_on_procedure(int state, enum device_flags flag)
        _I("[lcdstep] 0x%lx", flags);
 
        if (flags & AMBIENT_MODE) {
-               if (ambient_get_state() == false && dpms_get_cached_state() == DPMS_ON)
+               if (ambient_get_state() == false && display_panel_get_dpms_cached_state() == DPMS_ON)
                        return;
                ambient_set_state(false);
        }
@@ -687,7 +686,7 @@ void lcd_on_direct(enum device_flags flags)
 
 static inline bool check_lcd_is_on(void)
 {
-       if (dpms_get_cached_state() != DPMS_ON)
+       if (display_panel_get_dpms_cached_state() != DPMS_ON)
                return false;
 
        return true;
@@ -760,7 +759,7 @@ int custom_lcdoff(enum device_flags flag)
        }
 
        _I("custom lcd off by flag(%d)", flag);
-       if (dpms_get_cached_state() == DPMS_ON)
+       if (display_panel_get_dpms_cached_state() == DPMS_ON)
                lcd_off_procedure(flag);
 
        if (set_custom_lcdon_timeout(0) == true)
@@ -848,7 +847,7 @@ int display_off_by_reason(const char *reason)
        }
 
        _I("platform lcd off by %s", reason);
-       if (dpms_get_cached_state() == DPMS_ON)
+       if (display_panel_get_dpms_cached_state() == DPMS_ON)
                lcd_off_procedure(flag);
 
        /* state transition */
@@ -898,7 +897,7 @@ static int default_proc_change_state(unsigned int cond, pid_t pid)
                default_proc_change_state_action(next, -1);
                break;
        case S_LCDOFF:
-               if (dpms_get_cached_state() == DPMS_ON)
+               if (display_panel_get_dpms_cached_state() == DPMS_ON)
                        lcd_off_procedure(LCD_OFF_BY_EVENT);
                if (set_custom_lcdon_timeout(0))
                        update_display_time();
@@ -1444,11 +1443,11 @@ static int default_action(int timeout)
                if ((get_pm_old_state() != S_SLEEP) && (get_pm_old_state() != S_LCDOFF)) {
                        stop_lock_timer();
                        /* lcd off state : turn off the backlight */
-                       if (dpms_get_cached_state() == DPMS_ON)
+                       if (display_panel_get_dpms_cached_state() == DPMS_ON)
                                lcd_off_procedure(LCD_OFF_BY_TIMEOUT);
                }
 
-               if (dpms_get_cached_state() == DPMS_ON
+               if (display_panel_get_dpms_cached_state() == DPMS_ON
                    || lcd_paneloff_mode)
                        lcd_off_procedure(LCD_OFF_BY_TIMEOUT);
                break;
@@ -1457,7 +1456,7 @@ static int default_action(int timeout)
                if ((get_pm_old_state() != S_SLEEP) && (get_pm_old_state() != S_LCDOFF))
                        stop_lock_timer();
 
-               if (dpms_get_cached_state() == DPMS_ON)
+               if (display_panel_get_dpms_cached_state() == DPMS_ON)
                        lcd_off_procedure(LCD_OFF_BY_TIMEOUT);
 
                if (!pm_get_power_lock_support()) {
@@ -1644,7 +1643,7 @@ static int update_setting(int key_idx, int val)
                /* LCD on if lock screen show before waiting time */
                if ((get_pm_cur_state() == S_NORMAL) &&
                    val == VCONFKEY_IDLE_LOCK &&
-                   dpms_get_cached_state() != DPMS_ON &&
+                   display_panel_get_dpms_cached_state() != DPMS_ON &&
                        is_lcdon_blocked() == LCDON_BLOCK_NONE)
                        lcd_on_procedure(LCD_NORMAL, LCD_ON_BY_EVENT);
                stop_lock_timer();
@@ -1872,7 +1871,7 @@ static int battery_health_changed(void *data)
                set_pm_status_flag(DIMSTAY_FLAG);
        }
 
-       if (dpms_get_cached_state() == DPMS_ON)
+       if (display_panel_get_dpms_cached_state() == DPMS_ON)
                display_backlight_update_by_default_brightness();
 
        return 0;
@@ -1882,7 +1881,7 @@ static gboolean delayed_dpms_init_done(gpointer data)
 {
        int timeout;
 
-       if (!dpms_init())
+       if (!display_panel_init_dpms())
                return G_SOURCE_CONTINUE;
 
        switch (get_pm_cur_state()) {
@@ -1913,7 +1912,7 @@ static void add_timer_for_dpms_init(void)
 {
        guint id = g_timeout_add(500/* milliseconds */, delayed_dpms_init_done, NULL);
        if (id == 0)
-               _E("Failed to add dpms_init timeout.");
+               _E("Failed to add display_panel_init_dpms timeout.");
 }
 
 /**
@@ -2097,7 +2096,7 @@ static void display_init(void *data)
                check_seed_status();
 
                /* In smd test, TSP should be turned off if display panel is not existed. */
-               if (dpms_get_cached_state() == -ENOENT) {
+               if (display_panel_get_dpms_cached_state() == -ENOENT) {
                        _I("Display panel is not existed.");
                        lcd_direct_control(DPMS_OFF, NORMAL_MODE);
                        exit_lcd_operation();
@@ -2107,7 +2106,7 @@ static void display_init(void *data)
                 * since display manager can be launched later than deviced.
                 * In the case, display cannot be turned on at the first booting */
                // wm_ready = check_wm_ready();
-               if (dpms_init()) {
+               if (display_panel_init_dpms()) {
                        if (is_lcdon_blocked() != LCDON_BLOCK_NONE)
                                lcd_off_procedure(LCD_OFF_BY_EVENT);
                        else
index d56931b..c9d13b7 100644 (file)
@@ -41,7 +41,6 @@
 #include "device-interface.h"
 #include "vconf.h"
 #include "core.h"
-#include "display-dpms.h"
 #include "display-panel.h"
 #include "display-backlight.h"
 #include "power/power-suspend.h"
@@ -80,7 +79,7 @@ bool display_dev_ready(void)
 }
 
 static struct display_backlight_ops backlight_ops = {
-       .get_lcd_power = dpms_get_cached_state,
+       .get_lcd_power = display_panel_get_dpms_cached_state,
        .set_brightness = NULL,
        .get_brightness = NULL,
        .transit_state = NULL,
@@ -140,7 +139,7 @@ int exit_sysfs(void)
 
        display_backlight_update_by_default_brightness();
 
-       dpms_exit();
+       display_panel_exit_dpms();
 
        ops = find_device("touchscreen");
        if (!check_default(ops))
index 6ea8b30..d758a95 100644 (file)
@@ -32,6 +32,7 @@
 #include "core.h"
 #include "poll.h"
 #include "display-actor.h"
+#include "display-panel.h"
 #include "display-backlight.h"
 #include "display-ops.h"
 #include "display-config.h"
@@ -211,7 +212,7 @@ static inline bool switch_on_lcd(enum device_flags flags)
        if (current_state_in_on())
                return false;
 
-       if (dpms_get_cached_state() == DPMS_ON) {
+       if (display_panel_get_dpms_cached_state() == DPMS_ON) {
                if (ambient_get_state() == false)
                        return false;
        }
@@ -231,7 +232,7 @@ static inline void switch_off_lcd(void)
        if (!current_state_in_on())
                return;
 
-       if (dpms_get_cached_state() == DPMS_OFF)
+       if (display_panel_get_dpms_cached_state() == DPMS_OFF)
                return;
 
        broadcast_lcdoff_by_powerkey();
@@ -358,7 +359,7 @@ static int decide_lcdoff(void)
 {
        /* It's not needed if it's already LCD off state */
        if (!current_state_in_on() &&
-           dpms_get_cached_state() != DPMS_ON)
+           display_panel_get_dpms_cached_state() != DPMS_ON)
                return false;
 
        /*
index 55db6fd..4e82dfa 100644 (file)
@@ -63,7 +63,6 @@
 #include "power/power-doze.h"
 #include "device-interface.h"
 #include "display-plugin.h"
-#include "display-dpms.h"
 #include "display-info.h"
 #include "battery-monitor.h"
 #include "display-signal.h"
@@ -544,7 +543,7 @@ void lcd_on_procedure(int state, enum device_flags flag)
        _I("[lcdstep] 0x%lx", flags);
 
        if (flags & AMBIENT_MODE) {
-               if (ambient_get_state() == false && dpms_get_cached_state() == DPMS_ON)
+               if (ambient_get_state() == false && display_panel_get_dpms_cached_state() == DPMS_ON)
                        return;
                ambient_set_state(false);
        }
@@ -906,7 +905,7 @@ void lcd_on_direct(enum device_flags flags)
 
 static inline bool check_lcd_is_on(void)
 {
-       if (dpms_get_cached_state() != DPMS_ON)
+       if (display_panel_get_dpms_cached_state() != DPMS_ON)
                return false;
 
        return true;
@@ -1007,7 +1006,7 @@ int custom_lcdoff(enum device_flags flag)
        }
 
        _I("custom lcd off by flag(%d)", flag);
-       if (dpms_get_cached_state() == DPMS_ON)
+       if (display_panel_get_dpms_cached_state() == DPMS_ON)
                lcd_off_procedure(flag);
 
        if (set_custom_lcdon_timeout(0) == true)
@@ -1100,7 +1099,7 @@ int display_off_by_reason(const char *reason)
        }
 
        _I("platform lcd off by %s", reason);
-       if (dpms_get_cached_state() == DPMS_ON)
+       if (display_panel_get_dpms_cached_state() == DPMS_ON)
                lcd_off_procedure(flag);
 
        /* state transition */
@@ -1150,7 +1149,7 @@ static int default_proc_change_state(unsigned int cond, pid_t pid)
                default_proc_change_state_action(next, -1);
                break;
        case S_LCDOFF:
-               if (dpms_get_cached_state() == DPMS_ON)
+               if (display_panel_get_dpms_cached_state() == DPMS_ON)
                        lcd_off_procedure(LCD_OFF_BY_EVENT);
                if (set_custom_lcdon_timeout(0))
                        update_display_time();
@@ -1716,11 +1715,11 @@ static int default_action(int timeout)
                if ((get_pm_old_state() != S_SLEEP) && (get_pm_old_state() != S_LCDOFF)) {
                        stop_lock_timer();
                        /* lcd off state : turn off the backlight */
-                       if (dpms_get_cached_state() == DPMS_ON)
+                       if (display_panel_get_dpms_cached_state() == DPMS_ON)
                                lcd_off_procedure(LCD_OFF_BY_TIMEOUT);
                }
 
-               if (dpms_get_cached_state() == DPMS_ON
+               if (display_panel_get_dpms_cached_state() == DPMS_ON
                    || lcd_paneloff_mode)
                        lcd_off_procedure(LCD_OFF_BY_TIMEOUT);
                break;
@@ -1729,7 +1728,7 @@ static int default_action(int timeout)
                if ((get_pm_old_state() != S_SLEEP) && (get_pm_old_state() != S_LCDOFF))
                        stop_lock_timer();
 
-               if (dpms_get_cached_state() == DPMS_ON)
+               if (display_panel_get_dpms_cached_state() == DPMS_ON)
                        lcd_off_procedure(LCD_OFF_BY_TIMEOUT);
 
                if (!pm_get_power_lock_support()) {
@@ -1912,7 +1911,7 @@ static int update_setting(int key_idx, int val)
                /* LCD on if lock screen show before waiting time */
                if ((get_pm_cur_state() == S_NORMAL) &&
                    val == VCONFKEY_IDLE_LOCK &&
-                   dpms_get_cached_state() != DPMS_ON &&
+                   display_panel_get_dpms_cached_state() != DPMS_ON &&
                        is_lcdon_blocked() == LCDON_BLOCK_NONE)
                        lcd_on_procedure(LCD_NORMAL, LCD_ON_BY_EVENT);
                stop_lock_timer();
@@ -2135,12 +2134,12 @@ static int battery_health_changed(void *data)
        if (health == HEALTH_GOOD) {
                clear_pm_status_flag(BATTERY_FLAG);
                clear_pm_status_flag(DIMSTAY_FLAG);
-               if (dpms_get_cached_state() == DPMS_ON)
+               if (display_panel_get_dpms_cached_state() == DPMS_ON)
                        auto_brightness_restore();
        } else if (health == HEALTH_LOW || health == HEALTH_HIGH || health == HEALTH_OVP) {
                set_pm_status_flag(BATTERY_FLAG);
                set_pm_status_flag(DIMSTAY_FLAG);
-               if (dpms_get_cached_state() == DPMS_ON)
+               if (display_panel_get_dpms_cached_state() == DPMS_ON)
                        display_backlight_update_by_default_brightness();
        }
 
@@ -2171,7 +2170,7 @@ static gboolean delayed_dpms_init_done(gpointer data)
 {
        int timeout;
 
-       if (!dpms_init())
+       if (!display_panel_init_dpms())
                return G_SOURCE_CONTINUE;
 
        switch (get_pm_cur_state()) {
@@ -2202,7 +2201,7 @@ static void add_timer_for_dpms_init(void)
 {
        guint id = g_timeout_add(500/* milliseconds */, delayed_dpms_init_done, NULL);
        if (id == 0)
-               _E("Failed to add dpms_init timeout.");
+               _E("Failed to add display_panel_init_dpms timeout.");
 }
 
 /**
@@ -2423,7 +2422,7 @@ static void display_init(void *data)
                check_seed_status();
 
                /* In smd test, TSP should be turned off if display panel is not existed. */
-               if (dpms_get_cached_state() == -ENOENT) {
+               if (display_panel_get_dpms_cached_state() == -ENOENT) {
                        _I("Display panel is not existed.");
                        lcd_direct_control(DPMS_OFF, NORMAL_MODE);
                        exit_lcd_operation();
@@ -2433,7 +2432,7 @@ static void display_init(void *data)
                 * since display manager can be launched later than deviced.
                 * In the case, display cannot be turned on at the first booting */
                // wm_ready = check_wm_ready();
-               if (dpms_init()) {
+               if (display_panel_init_dpms()) {
                        if (is_lcdon_blocked() != LCDON_BLOCK_NONE)
                                lcd_off_procedure(LCD_OFF_BY_EVENT);
                        else
index 8f2a9c8..2e06e43 100644 (file)
@@ -41,7 +41,6 @@
 #include "device-interface.h"
 #include "vconf.h"
 #include "core.h"
-#include "display-dpms.h"
 #include "display-lock.h"
 #include "display-backlight.h"
 #include "display-panel.h"
@@ -225,7 +224,7 @@ static int backlight_transit_state(int state)
 }
 
 static struct display_backlight_ops backlight_ops = {
-       .get_lcd_power = dpms_get_cached_state,
+       .get_lcd_power = display_panel_get_dpms_cached_state,
        .set_brightness = set_brightness,
        .get_brightness = NULL,
        .transit_state = backlight_transit_state,
@@ -261,7 +260,7 @@ int display_service_free(void)
 
 int is_lcdon_blocked(void)
 {
-       int state = dpms_get_cached_state();
+       int state = display_panel_get_dpms_cached_state();
 
        if ((state == DPMS_DETACH) || (state == -EINVAL))
                return LCDON_BLOCK_WHEN_DISPLAY_DETACHED;
@@ -300,7 +299,7 @@ int exit_sysfs(void)
 
        display_backlight_update_by_default_brightness();
 
-       dpms_exit();
+       display_panel_exit_dpms();
 
        ops = find_device("touchscreen");
        if (!check_default(ops))
index b544866..04e63c0 100644 (file)
@@ -30,6 +30,7 @@
 #include "shared/common.h"
 #include "shared/devices.h"
 #include "display-actor.h"
+#include "display-panel.h"
 #include "display-backlight.h"
 #include "display-ops.h"
 #include "display-info.h"
@@ -57,7 +58,7 @@ static gboolean lcdon_from_aod_cb(gpointer data)
        autobrt_timer = 0;
 
        /* If it is still not turned on, do not apply auto brightness */
-       if (dpms_get_cached_state() != DPMS_ON)
+       if (display_panel_get_dpms_cached_state() != DPMS_ON)
                return G_SOURCE_REMOVE;
 
        display_backlight_change_brightness_by_dpms_state(DPMS_ON);
index f670d2f..2c6e9b5 100644 (file)
@@ -26,7 +26,7 @@
 #include "util.h"
 #include "core.h"
 #include "display-ops.h"
-#include "display-dpms.h"
+#include "display-panel.h"
 #include "shared/common.h"
 #include "shared/device-notifier.h"
 
@@ -408,7 +408,7 @@ static void hbm_init(void *data)
        register_notifier(DEVICE_NOTIFIER_LCD, display_state_changed);
 
        /* double check to guarantee HBMOFF before DPMS OFF */
-       register_dpms_checklist(DPMS_OFF, dpms_check_hbm_off);
+       display_panel_register_dpms_checklist(DPMS_OFF, dpms_check_hbm_off);
 }
 
 static void hbm_exit(void *data)
index 1a219c6..4c0ca45 100644 (file)
@@ -33,6 +33,7 @@
 #include "poll.h"
 #include "display-actor.h"
 #include "display-ops.h"
+#include "display-panel.h"
 #include "display-backlight.h"
 #include "display-config.h"
 #include "shared/common.h"
@@ -207,7 +208,7 @@ static inline bool switch_on_lcd(enum device_flags flags)
        if (current_state_in_on())
                return false;
 
-       if (dpms_get_cached_state() == DPMS_ON) {
+       if (display_panel_get_dpms_cached_state() == DPMS_ON) {
                if (ambient_get_state() == false)
                        return false;
        }
@@ -227,7 +228,7 @@ static inline void switch_off_lcd(void)
        if (!current_state_in_on())
                return;
 
-       if (dpms_get_cached_state() == DPMS_OFF)
+       if (display_panel_get_dpms_cached_state() == DPMS_OFF)
                return;
 
        broadcast_lcdoff_by_powerkey();
@@ -354,7 +355,7 @@ static int decide_lcdoff(void)
 {
        /* It's not needed if it's already LCD off state */
        if (!current_state_in_on() &&
-           dpms_get_cached_state() != DPMS_ON)
+           display_panel_get_dpms_cached_state() != DPMS_ON)
                return false;
 
        /*
index f8b3b57..92dc037 100644 (file)
@@ -23,6 +23,7 @@
 #include "core.h"
 #include "util.h"
 #include "display-ops.h"
+#include "display-panel.h"
 #include "shared/plugin.h"
 
 #include <libsyscommon/libgdbus.h>
@@ -91,7 +92,7 @@ static void swimmode_signal_handler(GDBusConnection  *conn,
 
        _I("Request swim mode state %d by %d", val, pid);
 
-       if (dpms_get_cached_state() != DPMS_ON) {
+       if (display_panel_get_dpms_cached_state() != DPMS_ON) {
                if (disp_plgn->pm_change_internal)
                        disp_plgn->pm_change_internal(INTERNAL_LOCK_SWIM, S_NORMAL);
                lcd_state = true;
index 96fd72c..8af9e77 100644 (file)
@@ -26,7 +26,7 @@
 #include "core.h"
 #include "display.h"
 #include "display-backlight.h"
-#include "display-dpms.h"
+#include "display-panel.h"
 #include "display-plugin.h"
 
 #define DUMP_MODE_WAITING_TIME         600000  /* milisecond */
index 914193c..7d35d19 100644 (file)
@@ -19,7 +19,7 @@
 #ifndef __DISPLAY_BACKLIGHT_H__
 #define __DISPLAY_BACKLIGHT_H__
 
-#include "display-dpms.h"
+#include "display-panel.h"
 
 struct display_backlight_ops {
        int (*get_lcd_power)(void);
index 9c57647..1025b6c 100644 (file)
@@ -19,7 +19,7 @@
 #include <stdbool.h>
 #include <libsyscommon/ini-parser.h>
 
-#include "display-dpms.h"
+#include "display-panel.h"
 #include "display.h"
 #include "deviced/dd-display.h"
 
index 77361c4..71c060b 100644 (file)
@@ -20,7 +20,7 @@
 #define __DISPLAY_CONFIG_H__
 
 #include <stdbool.h>
-#include "display-dpms.h"
+#include "display-panel.h"
 
 #define DISPLAY_CONF_FILE      "/etc/deviced/display.conf"
 /*
index 4124ef7..8e69b9a 100644 (file)
@@ -460,7 +460,8 @@ static void check_dpms_checklist(int mode)
                        checker();
 }
 
-void __register_dpms_checklist(int mode, void (*checker)(void), const char *caller)
+DD_INTERNAL
+void register_dpms_checklist(int mode, void (*checker)(void), const char *caller)
 {
        if (!checker)
                return;
@@ -625,12 +626,14 @@ static int none_dpms_get_cached_state(void) { return dpms_cache; }
 static bool none_dpms_init(void) { return true; }
 static void none_dpms_exit(void) {}
 
+DD_INTERNAL
 void dpms_set_state(int on)
 {
        if (g_dpms_ops.set_state)
                g_dpms_ops.set_state(on);
 }
 
+DD_INTERNAL
 int dpms_get_state(void)
 {
        if (g_dpms_ops.get_state)
@@ -638,6 +641,7 @@ int dpms_get_state(void)
        return -EINVAL;
 }
 
+DD_INTERNAL
 int dpms_get_cached_state(void)
 {
        if (g_dpms_ops.get_cached_state)
@@ -645,6 +649,7 @@ int dpms_get_cached_state(void)
        return -EINVAL;
 }
 
+DD_INTERNAL
 bool dpms_init(void)
 {
        if (!g_display_plugin.config) {
@@ -678,6 +683,7 @@ bool dpms_init(void)
        return false;
 }
 
+DD_INTERNAL
 void dpms_exit(void)
 {
        if (g_dpms_ops.exit)
index b7b89f7..2c8802b 100644 (file)
@@ -38,7 +38,6 @@ int dpms_get_state(void);
 int dpms_get_cached_state(void);
 bool dpms_init(void);
 void dpms_exit(void);
-void __register_dpms_checklist(int mode, void (*checker)(void), const char *caller);
-#define register_dpms_checklist(mode, checker) __register_dpms_checklist(mode, checker, __func__)
+void register_dpms_checklist(int mode, void (*checker)(void), const char *caller);
 
 #endif /* __DISPLAY_DPMS_H__ */
index a05cd06..66ea2c0 100644 (file)
@@ -19,9 +19,7 @@
 #include "shared/log.h"
 #include "power/power-suspend.h"
 #include "ambient-mode.h"
-//#include "display.h"
 #include "display-backlight.h"
-#include "display-dpms.h"
 #include "display-panel.h"
 
 #define MAX_WHITE_BALANCE_GAIN                 2047
@@ -223,6 +221,26 @@ int display_panel_get_dpms_state(void)
        }
 }
 
+int display_panel_get_dpms_cached_state(void)
+{
+       return dpms_get_cached_state();
+}
+
+bool display_panel_init_dpms(void)
+{
+       return dpms_init();
+}
+
+void display_panel_exit_dpms(void)
+{
+       dpms_exit();
+}
+
+void __display_panel_register_dpms_checklist(int mode, void (*checker)(void), const char *caller)
+{
+       register_dpms_checklist(mode, checker, caller);
+}
+
 /* FIXME: This function is used for only wearable profile, should be fixed after plugin refactoring */
 int display_panel_set_image_effect(enum display_image_effect effect)
 {
index 795962c..c00ae6e 100644 (file)
@@ -21,6 +21,7 @@
 
 #include <hal/device/hal-display.h>
 
+#include "display-dpms.h"
 #include "shared/devices.h"
 
 int display_panel_set_dpms_state(int dpms_on, enum device_flags flags);
@@ -37,6 +38,13 @@ int display_panel_get_panel_mode(enum display_panel_mode *mode);
 int display_panel_set_frame_rate(int frame_rate);
 int display_panel_get_frame_rate(int *frame_rate);
 int display_panel_get_dpms_state(void);
+
+int display_panel_get_dpms_cached_state(void);
+bool display_panel_init_dpms(void);
+void display_panel_exit_dpms(void);
+void __display_panel_register_dpms_checklist(int mode, void (*checker)(void), const char *caller);
+#define display_panel_register_dpms_checklist(mode, checker) __display_panel_register_dpms_checklist(mode, checker, __func__)
+
 void display_panel_set_dpms_running_state(int val);
 
-#endif /* __DISPLAY_PANEL_H__ */
\ No newline at end of file
+#endif /* __DISPLAY_PANEL_H__ */
index 4c48cfe..c8943dc 100644 (file)
@@ -20,7 +20,7 @@
 #define __DISPLAY_H__
 
 #include <stdbool.h>
-#include "display-dpms.h"
+#include "display-panel.h"
 #include "shared/devices.h"
 
 #define VCALL_FLAG             0x00000001
index 581d9b3..5f464b4 100644 (file)
@@ -87,7 +87,7 @@ static void ambient_set_condition(keynode_t *key_nodes, void *data)
 
        val = vconf_keynode_get_bool(key_nodes);
        if (val != ambient_condition) {
-               if (dpms_get_cached_state() != DPMS_ON)
+               if (display_panel_get_dpms_cached_state() != DPMS_ON)
                        if (disp_plgn->pm_lock_internal)
                                disp_plgn->pm_change_internal(INTERNAL_LOCK_PM, LCD_NORMAL);
        }
@@ -139,7 +139,7 @@ void ambient_check_invalid_state(pid_t pid)
 
        if (is_emulator()) {
                /* In emulator, deviced does not turn off the display. */
-               if (dpms_get_cached_state() == DPMS_ON)
+               if (display_panel_get_dpms_cached_state() == DPMS_ON)
                        return;
        }
 
index 5bd9836..c112da5 100644 (file)
@@ -27,7 +27,6 @@
 #include "poll.h"
 #include "device-interface.h"
 #include "setting.h"
-#include "display-dpms.h"
 #include "display.h"
 #include "display-config.h"
 
index 901f58c..747b876 100644 (file)
@@ -28,6 +28,7 @@
 #include "display-signal.h"
 #include "lock-detector.h"
 #include "display-lock.h"
+#include "display-panel.h"
 #include "display-config.h"
 #include "shared/log-macro.h"
 #include "shared/apps.h"
@@ -179,7 +180,7 @@ static gboolean default_pmlock_check(void *data)
        state = node->state;
        pid = node->pid;
 
-       if (state == S_LCDOFF && dpms_get_cached_state() == DPMS_ON) {
+       if (state == S_LCDOFF && display_panel_get_dpms_cached_state() == DPMS_ON) {
                _D("Lcd state is PM_LCD_POWER_ON");
                return G_SOURCE_CONTINUE;
        }
index f1d97ef..12ec794 100644 (file)
@@ -38,7 +38,6 @@
 #include "shared/device-notifier.h"
 #include "shared/time.h"
 #include "vconf.h"
-#include "display-dpms.h"
 #include "display.h"
 #include "power.h"
 #include "power-boot.h"
index 1d2cdb0..627700c 100644 (file)
@@ -35,6 +35,10 @@ extern "C" {
 #define API __attribute__ ((visibility("default")))
 #endif
 
+#ifndef DD_INTERNAL
+#define DD_INTERNAL __attribute__ ((visibility("hidden")))
+#endif
+
 #ifndef DEPRECATED
 #define DEPRECATED __attribute__ ((deprecated))
 #endif
index 9a67045..90a34cc 100644 (file)
@@ -29,6 +29,7 @@
 #include "battery/power-supply.h"
 #include "core.h"
 #include "display-ops.h"
+#include "display-panel.h"
 #include "display-plugin.h"
 #include "display-config.h"
 #include "power/power-boot.h"
@@ -63,12 +64,7 @@ static void touchscreen_wakeup_status(keynode_t *key, void *data)
 
        g_display_plugin.config->touch_wakeup = vconf_keynode_get_bool(key);
 
-       /**
-        * FIXME: display_plugin_backlight_get_lcd_power() should be changed to
-        * dpms_get_cached_state() function.
-        * After deviding src/display module and plugin display module from build.
-       */
-       if (display_plugin_backlight_get_lcd_power() != DPMS_ON) {
+       if (display_panel_get_dpms_cached_state() != DPMS_ON) {
                if (g_display_plugin.config->touch_wakeup)
                        touchscreen_start(NORMAL_MODE);
                else
@@ -172,7 +168,8 @@ static int touchscreen_execute(void *data)
 
 static int touchscreen_start(enum device_flags flags)
 {
-       int state, ret;
+       int state = -1;
+       int ret;
 
        if (touchscreen_enable != DEVICE_OPS_STATUS_START)
                return 0;
@@ -186,13 +183,7 @@ static int touchscreen_start(enum device_flags flags)
         */
        ret = touchscreen_set_state(TOUCHSCREEN_ON);
 
-       state = -1;
-       /**
-        * FIXME: display_plugin_backlight_get_lcd_power() should be changed to
-        * dpms_get_cached_state() function.
-        * After deviding src/display module and plugin display module from build.
-       */
-       state = display_plugin_backlight_get_lcd_power();
+       state = display_panel_get_dpms_cached_state();
 
        if (state == DPMS_OFF)
                touchscreen_powersaving(POWERSAVING_ON);