From: Yunhee Seo Date: Fri, 17 Feb 2023 07:33:47 +0000 (+0900) Subject: display: Add display_panel_set_dpms_state function X-Git-Tag: accepted/tizen/unified/20230330.025600~31 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F94%2F288494%2F14;p=platform%2Fcore%2Fsystem%2Fdeviced.git display: Add display_panel_set_dpms_state function To move plugin functions without plugin dependency, this temporary function is needed. int display_panel_set_dpms_state(int dpms_on, enum device_flags flags) -> This function replaces the bl_onoff function of plugins. Change-Id: I0720781ba1cb2afeda5e461c1d979d4a9f2ceb4d Signed-off-by: Yunhee Seo --- diff --git a/plugins/iot-headed/display/device-interface.c b/plugins/iot-headed/display/device-interface.c index 4e7b22d..8e9ad6b 100644 --- a/plugins/iot-headed/display/device-interface.c +++ b/plugins/iot-headed/display/device-interface.c @@ -46,6 +46,7 @@ #include "display/display.h" #include "display/display-lock.h" #include "display/display-backlight.h" +#include "display/display-panel.h" #define TOUCH_ON 1 #define TOUCH_OFF 0 @@ -94,22 +95,6 @@ void dpms_set_running_state(int val) dpms_running_state = val; } -static int bl_onoff(int on, enum device_flags flags) -{ - dpms_set_state(on); - -#ifdef ENABLE_PM_LOG - if (on == DPMS_ON) - pm_history_save(PM_LOG_LCD_ON_COMPLETE, get_pm_cur_state()); - else if (on == DPMS_OFF || on == DPMS_FORCE_OFF) - pm_history_save(PM_LOG_LCD_OFF_COMPLETE, get_pm_cur_state()); - else - pm_history_save(PM_LOG_LCD_CONTROL_FAIL, on); -#endif - - return 0; -} - static int bl_brt(int brightness, int delay) { int ret = -1; @@ -227,7 +212,7 @@ static int backlight_on(enum device_flags flags) _I("[DPMS XLIB Backlight] LCD on %#x cnt:%d", flags, cnt); cnt++; - ret = bl_onoff(DPMS_ON, flags); + ret = display_panel_set_dpms_state(DPMS_ON, flags); #ifdef ENABLE_PM_LOG pm_history_save(PM_LOG_LCD_ON, get_pm_cur_state()); #endif @@ -255,9 +240,9 @@ static int backlight_off(enum device_flags flags) LCD_PHASED_MIN_BRIGHTNESS, LCD_PHASED_CHANGE_STEP); if (flags & FORCE_OFF_MODE) - ret = bl_onoff(DPMS_FORCE_OFF, flags); + ret = display_panel_set_dpms_state(DPMS_FORCE_OFF, flags); else - ret = bl_onoff(DPMS_OFF, flags); + ret = display_panel_set_dpms_state(DPMS_OFF, flags); #ifdef ENABLE_PM_LOG pm_history_save(PM_LOG_LCD_OFF, get_pm_cur_state()); @@ -354,7 +339,7 @@ static int backlight_standby(int force) if ((dpms_get_cached_state() == DPMS_ON) || force) { _I("LCD standby"); - ret = bl_onoff(DPMS_STANDBY, 0); + ret = display_panel_set_dpms_state(DPMS_STANDBY, 0); } return ret; diff --git a/plugins/mobile/display/device-interface.c b/plugins/mobile/display/device-interface.c index 9bfb003..8ee2752 100644 --- a/plugins/mobile/display/device-interface.c +++ b/plugins/mobile/display/device-interface.c @@ -45,6 +45,7 @@ #include "display/display.h" #include "display/display-lock.h" #include "display/display-backlight.h" +#include "display/display-panel.h" #include "power/power-boot.h" #include "power/power-suspend.h" @@ -93,22 +94,6 @@ void dpms_set_running_state(int val) dpms_running_state = val; } -static int bl_onoff(int on, enum device_flags flags) -{ - dpms_set_state(on); - -#ifdef ENABLE_PM_LOG - if (on == DPMS_ON) - pm_history_save(PM_LOG_LCD_ON_COMPLETE, get_pm_cur_state()); - else if (on == DPMS_OFF || on == DPMS_FORCE_OFF) - pm_history_save(PM_LOG_LCD_OFF_COMPLETE, get_pm_cur_state()); - else - pm_history_save(PM_LOG_LCD_CONTROL_FAIL, on); -#endif - - return 0; -} - static int bl_brt(int brightness, int delay) { int ret = -1; @@ -226,7 +211,7 @@ static int backlight_on(enum device_flags flags) _I("[DPMS XLIB Backlight] LCD on %#x cnt:%d", flags, cnt); cnt++; - ret = bl_onoff(DPMS_ON, flags); + ret = display_panel_set_dpms_state(DPMS_ON, flags); #ifdef ENABLE_PM_LOG pm_history_save(PM_LOG_LCD_ON, get_pm_cur_state()); #endif @@ -254,9 +239,9 @@ static int backlight_off(enum device_flags flags) LCD_PHASED_MIN_BRIGHTNESS, LCD_PHASED_CHANGE_STEP); if (flags & FORCE_OFF_MODE) - ret = bl_onoff(DPMS_FORCE_OFF, flags); + ret = display_panel_set_dpms_state(DPMS_FORCE_OFF, flags); else - ret = bl_onoff(DPMS_OFF, flags); + ret = display_panel_set_dpms_state(DPMS_OFF, flags); #ifdef ENABLE_PM_LOG pm_history_save(PM_LOG_LCD_OFF, get_pm_cur_state()); @@ -353,7 +338,7 @@ static int backlight_standby(int force) if ((dpms_get_cached_state() == DPMS_ON) || force) { _I("LCD standby"); - ret = bl_onoff(DPMS_STANDBY, 0); + ret = display_panel_set_dpms_state(DPMS_STANDBY, 0); } return ret; diff --git a/plugins/tv/display/device-interface.c b/plugins/tv/display/device-interface.c index 89081e0..41eea37 100644 --- a/plugins/tv/display/device-interface.c +++ b/plugins/tv/display/device-interface.c @@ -42,6 +42,7 @@ #include "vconf.h" #include "core.h" #include "display/display-dpms.h" +#include "display/display-panel.h" #include "display/display.h" #include "display/display-backlight.h" #include "power/power-suspend.h" @@ -94,22 +95,6 @@ void dpms_set_running_state(int val) dpms_running_state = val; } -static int bl_onoff(int on, enum device_flags flags) -{ - dpms_set_state(on); - -#ifdef ENABLE_PM_LOG - if (on == DPMS_ON) - pm_history_save(PM_LOG_LCD_ON_COMPLETE, get_pm_cur_state()); - else if (on == DPMS_OFF || on == DPMS_FORCE_OFF) - pm_history_save(PM_LOG_LCD_OFF_COMPLETE, get_pm_cur_state()); - else - pm_history_save(PM_LOG_LCD_CONTROL_FAIL, on); -#endif - - return 0; -} - static int bl_brt(int brightness, int delay) { int ret = -1; @@ -227,7 +212,7 @@ static int backlight_on(enum device_flags flags) _I("[DPMS XLIB Backlight] LCD on %#x cnt:%d", flags, cnt); cnt++; - ret = bl_onoff(DPMS_ON, flags); + ret = display_panel_set_dpms_state(DPMS_ON, flags); #ifdef ENABLE_PM_LOG pm_history_save(PM_LOG_LCD_ON, get_pm_cur_state()); #endif @@ -255,9 +240,9 @@ static int backlight_off(enum device_flags flags) LCD_PHASED_MIN_BRIGHTNESS, LCD_PHASED_CHANGE_STEP); if (flags & FORCE_OFF_MODE) - ret = bl_onoff(DPMS_FORCE_OFF, flags); + ret = display_panel_set_dpms_state(DPMS_FORCE_OFF, flags); else - ret = bl_onoff(DPMS_OFF, flags); + ret = display_panel_set_dpms_state(DPMS_OFF, flags); #ifdef ENABLE_PM_LOG pm_history_save(PM_LOG_LCD_OFF, get_pm_cur_state()); @@ -354,7 +339,7 @@ static int backlight_standby(int force) if ((dpms_get_cached_state() == DPMS_ON) || force) { _I("LCD standby"); - ret = bl_onoff(DPMS_STANDBY, 0); + ret = display_panel_set_dpms_state(DPMS_STANDBY, 0); } return ret; diff --git a/plugins/wearable/display/device-interface.c b/plugins/wearable/display/device-interface.c index e9d442a..4cd6cb1 100644 --- a/plugins/wearable/display/device-interface.c +++ b/plugins/wearable/display/device-interface.c @@ -45,6 +45,7 @@ #include "display/display.h" #include "display/display-lock.h" #include "display/display-backlight.h" +#include "display/display-panel.h" #include "battery-monitor.h" #include "battery/power-supply.h" #include "power/power-suspend.h" @@ -106,22 +107,6 @@ void dpms_set_running_state(int val) dpms_running_state = val; } -static int bl_onoff(int on, enum device_flags flags) -{ - dpms_set_state(on); - -#ifdef ENABLE_PM_LOG - if (on == DPMS_ON) - pm_history_save(PM_LOG_LCD_ON_COMPLETE, get_pm_cur_state()); - else if (on == DPMS_OFF || on == DPMS_FORCE_OFF) - pm_history_save(PM_LOG_LCD_OFF_COMPLETE, get_pm_cur_state()); - else - pm_history_save(PM_LOG_LCD_CONTROL_FAIL, on); -#endif - - return 0; -} - static int bl_brt(int brightness, int delay) { int ret = -1; @@ -238,7 +223,7 @@ static int backlight_on(enum device_flags flags) _I("[DPMS XLIB Backlight] LCD on %#x cnt:%d", flags, cnt); cnt++; - ret = bl_onoff(DPMS_ON, flags); + ret = display_panel_set_dpms_state(DPMS_ON, flags); #ifdef ENABLE_PM_LOG pm_history_save(PM_LOG_LCD_ON, get_pm_cur_state()); #endif @@ -266,9 +251,9 @@ static int backlight_off(enum device_flags flags) LCD_PHASED_MIN_BRIGHTNESS, LCD_PHASED_CHANGE_STEP); if (flags & FORCE_OFF_MODE) - ret = bl_onoff(DPMS_FORCE_OFF, flags); + ret = display_panel_set_dpms_state(DPMS_FORCE_OFF, flags); else - ret = bl_onoff(DPMS_OFF, flags); + ret = display_panel_set_dpms_state(DPMS_OFF, flags); #ifdef ENABLE_PM_LOG pm_history_save(PM_LOG_LCD_OFF, get_pm_cur_state()); @@ -365,7 +350,7 @@ static int backlight_standby(int force) if ((dpms_get_cached_state() == DPMS_ON) || force) { _I("LCD standby"); - ret = bl_onoff(DPMS_STANDBY, 0); + ret = display_panel_set_dpms_state(DPMS_STANDBY, 0); } return ret; diff --git a/src/display/display-panel.c b/src/display/display-panel.c index 9d65416..ec7d96d 100644 --- a/src/display/display-panel.c +++ b/src/display/display-panel.c @@ -17,14 +17,33 @@ */ #include "shared/log.h" -#include "display-panel.h" +#include "power/power-suspend.h" #include "display.h" +#include "display-dpms.h" +#include "display-panel.h" #define MAX_WHITE_BALANCE_GAIN 2047 #define MAX_WHITE_BALANCE_OFFSET 2047 #define DEFAULT_WHITE_BALANCE_GAIN 1024 #define DEFAULT_WHITE_BALANCE_OFFSET 0 +/* FIXME: This function is for temporary use, should be fixed after plugin refactoring */ +int display_panel_set_dpms_state(int dpms_on, enum device_flags flags) +{ + dpms_set_state(dpms_on); + +#ifdef ENABLE_PM_LOG + if (dpms_on == DPMS_ON) + pm_history_save(PM_LOG_LCD_ON_COMPLETE, get_pm_cur_state()); + else if (dpms_on == DPMS_OFF || dpms_on == DPMS_FORCE_OFF) + pm_history_save(PM_LOG_LCD_OFF_COMPLETE, get_pm_cur_state()); + else + pm_history_save(PM_LOG_LCD_CONTROL_FAIL, dpms_on); +#endif + + return 0; +} + int display_panel_set_white_balance(enum hal_display_white_balance white_balance_type, int value) { diff --git a/src/display/display-panel.h b/src/display/display-panel.h index efe6e45..7ca5d63 100644 --- a/src/display/display-panel.h +++ b/src/display/display-panel.h @@ -21,6 +21,9 @@ #include +#include "shared/devices.h" + +int display_panel_set_dpms_state(int dpms_on, enum device_flags flags); int display_panel_set_white_balance(enum hal_display_white_balance white_balance_type, int value); int display_panel_get_white_balance(enum hal_display_white_balance white_balance_type, int* out_val);