From: Yunhee Seo Date: Fri, 24 Feb 2023 09:40:55 +0000 (+0900) Subject: display: Move display get dpms state function from plugin to core display module X-Git-Tag: accepted/tizen/unified/20230330.025600~20 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ce501b6cd3f7ef9232273604b6266f4587c96da7;p=platform%2Fcore%2Fsystem%2Fdeviced.git display: Move display get dpms state function from plugin to core display module Remove and redefine display dpms state function. These functions are added to below display-panel. int display_panel_get_dpms_state(void) -> This function returns dpms state and replaces get_lcd_power_node located in plugins. void display_panel_set_dpms_running_state(int val) -> This function initialize dpms_running_state Change-Id: I34e29e3477113d2f19835c0782303334ba0d870f Signed-off-by: Yunhee Seo --- diff --git a/plugins/iot-headed/display/device-interface.c b/plugins/iot-headed/display/device-interface.c index e93dedd..05bd53b 100644 --- a/plugins/iot-headed/display/device-interface.c +++ b/plugins/iot-headed/display/device-interface.c @@ -69,7 +69,6 @@ static struct _backlight_ops backlight_ops; static int force_brightness; -static int dpms_running_state = DPMS_SETTING_DONE; static bool display_dev_available = false; static const struct display_config *display_conf; @@ -83,11 +82,6 @@ bool display_dev_ready(void) return display_dev_available; } -void dpms_set_running_state(int val) -{ - dpms_running_state = val; -} - static int bl_brt(int brightness, int delay) { int ret = -1; @@ -103,35 +97,6 @@ static int bl_brt(int brightness, int delay) return ret; } -static int get_lcd_power_node(void) -{ - int ret; - enum display_state val; - - ret = hal_device_display_get_state(&val); - if (ret < 0) - return ret; - - if (val == DISPLAY_ON && ambient_get_state()) - return DPMS_OFF; - - if (dpms_running_state != DPMS_SETTING_DONE) - return dpms_running_state; - - switch (val) { - case DISPLAY_ON: - return DPMS_ON; - case DISPLAY_STANDBY: - return DPMS_STANDBY; - case DISPLAY_SUSPEND: - return DPMS_SUSPEND; - case DISPLAY_OFF: - return DPMS_OFF; - default: - return -EINVAL; - } -} - bool display_dimstay_check(void) { if (get_pm_status_flag() & DIM_FLAG) @@ -321,7 +286,6 @@ static void restore_brightness_func(void) static struct _backlight_ops backlight_ops = { .get_lcd_power = dpms_get_cached_state, - .get_lcd_power_node = get_lcd_power_node, .set_force_brightness = set_force_brightness, .set_brightness = set_brightness, .get_brightness = get_brightness, diff --git a/plugins/mobile/display/device-interface.c b/plugins/mobile/display/device-interface.c index b967e3d..3f77a77 100644 --- a/plugins/mobile/display/device-interface.c +++ b/plugins/mobile/display/device-interface.c @@ -68,7 +68,6 @@ static struct _backlight_ops backlight_ops; static int force_brightness; -static int dpms_running_state = DPMS_SETTING_DONE; static bool display_dev_available = false; static const struct display_config *display_conf; @@ -82,11 +81,6 @@ bool display_dev_ready(void) return display_dev_available; } -void dpms_set_running_state(int val) -{ - dpms_running_state = val; -} - static int bl_brt(int brightness, int delay) { int ret = -1; @@ -102,35 +96,6 @@ static int bl_brt(int brightness, int delay) return ret; } -static int get_lcd_power_node(void) -{ - int ret; - enum display_state val; - - ret = hal_device_display_get_state(&val); - if (ret < 0) - return ret; - - if (val == DISPLAY_ON && ambient_get_state()) - return DPMS_OFF; - - if (dpms_running_state != DPMS_SETTING_DONE) - return dpms_running_state; - - switch (val) { - case DISPLAY_ON: - return DPMS_ON; - case DISPLAY_STANDBY: - return DPMS_STANDBY; - case DISPLAY_SUSPEND: - return DPMS_SUSPEND; - case DISPLAY_OFF: - return DPMS_OFF; - default: - return -EINVAL; - } -} - bool display_dimstay_check(void) { if (get_pm_status_flag() & DIM_FLAG) @@ -320,7 +285,6 @@ static void restore_brightness_func(void) static struct _backlight_ops backlight_ops = { .get_lcd_power = dpms_get_cached_state, - .get_lcd_power_node = get_lcd_power_node, .set_force_brightness = set_force_brightness, .set_brightness = set_brightness, .get_brightness = get_brightness, diff --git a/plugins/tv/display/device-interface.c b/plugins/tv/display/device-interface.c index 2382b31..2a672b6 100644 --- a/plugins/tv/display/device-interface.c +++ b/plugins/tv/display/device-interface.c @@ -69,7 +69,6 @@ static struct _backlight_ops backlight_ops; static int force_brightness; -static int dpms_running_state = DPMS_SETTING_DONE; static bool display_dev_available = false; static const struct display_config *display_conf; @@ -83,11 +82,6 @@ bool display_dev_ready(void) return display_dev_available; } -void dpms_set_running_state(int val) -{ - dpms_running_state = val; -} - static int bl_brt(int brightness, int delay) { int ret = -1; @@ -103,35 +97,6 @@ static int bl_brt(int brightness, int delay) return ret; } -static int get_lcd_power_node(void) -{ - int ret; - enum display_state val; - - ret = hal_device_display_get_state(&val); - if (ret < 0) - return ret; - - if (val == DISPLAY_ON && ambient_get_state()) - return DPMS_OFF; - - if (dpms_running_state != DPMS_SETTING_DONE) - return dpms_running_state; - - switch (val) { - case DISPLAY_ON: - return DPMS_ON; - case DISPLAY_STANDBY: - return DPMS_STANDBY; - case DISPLAY_SUSPEND: - return DPMS_SUSPEND; - case DISPLAY_OFF: - return DPMS_OFF; - default: - return -EINVAL; - } -} - bool display_dimstay_check(void) { if (get_pm_status_flag() & DIM_FLAG) @@ -321,7 +286,6 @@ static void restore_brightness_func(void) static struct _backlight_ops backlight_ops = { .get_lcd_power = dpms_get_cached_state, - .get_lcd_power_node = get_lcd_power_node, .set_force_brightness = set_force_brightness, .set_brightness = set_brightness, .get_brightness = get_brightness, diff --git a/plugins/wearable/display/device-interface.c b/plugins/wearable/display/device-interface.c index 5fa17b0..33af6f4 100644 --- a/plugins/wearable/display/device-interface.c +++ b/plugins/wearable/display/device-interface.c @@ -75,7 +75,6 @@ static struct _backlight_ops backlight_ops; static struct battery_plugin *battery_plgn; static int force_brightness; -static int dpms_running_state = DPMS_SETTING_DONE; static bool display_dev_available = false; static int aod_max_level = -1; static int aod_normal_level = -1; @@ -95,11 +94,6 @@ bool display_dev_ready(void) return display_dev_available; } -void dpms_set_running_state(int val) -{ - dpms_running_state = val; -} - static int bl_brt(int brightness, int delay) { int ret = -1; @@ -115,37 +109,6 @@ static int bl_brt(int brightness, int delay) return ret; } -static int get_lcd_power_node(void) -{ - int ret; - enum display_state val; - - ret = hal_device_display_get_state(&val); - if (ret < 0) - return ret; - - if (val == DISPLAY_ON && ambient_get_state()) - return DPMS_OFF; - - if (dpms_running_state != DPMS_SETTING_DONE) - return dpms_running_state; - - switch (val) { - case DISPLAY_ON: - return DPMS_ON; - case DISPLAY_STANDBY: - return DPMS_STANDBY; - case DISPLAY_SUSPEND: - return DPMS_SUSPEND; - case DISPLAY_OFF: - return DPMS_OFF; - case DISPLAY_DETACH: - return DPMS_DETACH; - default: - return -EINVAL; - } -} - bool display_dimstay_check(void) { if (get_pm_status_flag() & DIM_FLAG) @@ -386,7 +349,6 @@ static void restore_brightness_func(void) static struct _backlight_ops backlight_ops = { .get_lcd_power = dpms_get_cached_state, - .get_lcd_power_node = get_lcd_power_node, .set_force_brightness = set_force_brightness, .set_brightness = set_brightness, .get_brightness = get_brightness, diff --git a/src/display/device-interface.h b/src/display/device-interface.h index 2158463..f75dd54 100644 --- a/src/display/device-interface.h +++ b/src/display/device-interface.h @@ -62,7 +62,6 @@ int display_service_free(void); struct _backlight_ops { int (*get_lcd_power)(void); - int (*get_lcd_power_node)(void); int (*set_force_brightness)(int level); int (*set_brightness)(int val); int (*get_brightness)(int *val); diff --git a/src/display/display-panel.c b/src/display/display-panel.c index 6c99b5c..f9e49d6 100644 --- a/src/display/display-panel.c +++ b/src/display/display-panel.c @@ -18,6 +18,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" @@ -31,6 +32,8 @@ #define LCD_PHASED_MIN_BRIGHTNESS 1 #define LCD_PHASED_CHANGE_STEP 5 +static int dpms_running_state = DPMS_SETTING_DONE; + static struct _backlight_ops *backlight_ops; /* FIXME: This function is for temporary use, should be fixed after plugin refactoring */ @@ -179,6 +182,44 @@ int display_panel_set_panel_state_by_standby_state(bool standby_on) return ret; } +/* FIXME: This function is deprecated, should be fixed after plugin refactoring */ +void display_panel_set_dpms_running_state(int val) +{ + dpms_running_state = val; +} + +/* FIXME: This function is deprecated, should be fixed after plugin refactoring */ +int display_panel_get_dpms_state(void) +{ + int ret; + enum display_state val; + + ret = hal_device_display_get_state(&val); + if (ret < 0) + return ret; + + if (val == DISPLAY_ON && ambient_get_state()) + return DPMS_OFF; + + if (dpms_running_state != DPMS_SETTING_DONE) + return dpms_running_state; + + switch (val) { + case DISPLAY_ON: + return DPMS_ON; + case DISPLAY_STANDBY: + return DPMS_STANDBY; + case DISPLAY_SUSPEND: + return DPMS_SUSPEND; + case DISPLAY_OFF: + return DPMS_OFF; + case DISPLAY_DETACH: + return DPMS_DETACH; + default: + return -EINVAL; + } +} + /* 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) { diff --git a/src/display/display-panel.h b/src/display/display-panel.h index eabe41e..795962c 100644 --- a/src/display/display-panel.h +++ b/src/display/display-panel.h @@ -36,5 +36,7 @@ int display_panel_set_panel_mode(enum display_panel_mode mode); 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); +void display_panel_set_dpms_running_state(int val); #endif /* __DISPLAY_PANEL_H__ */ \ No newline at end of file