From 5c624f2e0582f024806f21b78174f39a27608e51 Mon Sep 17 00:00:00 2001 From: Youngjae Cho Date: Tue, 21 Mar 2023 16:38:50 +0900 Subject: [PATCH] display: Move plugin display_dimstay_check() to core The display_dimstay_check() has bee relocated: - plugins/*/display/device-interface.c => src/display/display.c Change-Id: Ifd8a23ab255d091495d6de25a8d35c933b9c8b39 Signed-off-by: Youngjae Cho --- plugins/iot-headed/display/device-interface.c | 11 ----------- plugins/mobile/display/device-interface.c | 11 ----------- plugins/tv/display/device-interface.c | 11 ----------- plugins/wearable/display/device-interface.c | 8 -------- src/display/display.c | 13 +++++++++++++ src/display/display.h | 12 ++++++++++++ src/display/plugin-common/core.h | 11 ----------- src/display/plugin-common/device-interface.h | 1 - src/display/plugin-common/display-backlight.c | 2 -- 9 files changed, 25 insertions(+), 55 deletions(-) diff --git a/plugins/iot-headed/display/device-interface.c b/plugins/iot-headed/display/device-interface.c index 2a2c497..011d6ef 100644 --- a/plugins/iot-headed/display/device-interface.c +++ b/plugins/iot-headed/display/device-interface.c @@ -79,17 +79,6 @@ bool display_dev_ready(void) return display_dev_available; } -bool display_dimstay_check(void) -{ - if (get_pm_status_flag() & DIM_FLAG) - return true; - - if ((get_pm_status_flag() & PWRSV_FLAG) && !(get_pm_status_flag() & BRTCH_FLAG)) - return true; - - return false; -} - static struct _backlight_ops backlight_ops = { .get_lcd_power = dpms_get_cached_state, .set_brightness = NULL, diff --git a/plugins/mobile/display/device-interface.c b/plugins/mobile/display/device-interface.c index 8726b08..3e450dc 100644 --- a/plugins/mobile/display/device-interface.c +++ b/plugins/mobile/display/device-interface.c @@ -78,17 +78,6 @@ bool display_dev_ready(void) return display_dev_available; } -bool display_dimstay_check(void) -{ - if (get_pm_status_flag() & DIM_FLAG) - return true; - - if ((get_pm_status_flag() & PWRSV_FLAG) && !(get_pm_status_flag() & BRTCH_FLAG)) - return true; - - return false; -} - static struct _backlight_ops backlight_ops = { .get_lcd_power = dpms_get_cached_state, .set_brightness = NULL, diff --git a/plugins/tv/display/device-interface.c b/plugins/tv/display/device-interface.c index 10dc227..a8f98e8 100644 --- a/plugins/tv/display/device-interface.c +++ b/plugins/tv/display/device-interface.c @@ -79,17 +79,6 @@ bool display_dev_ready(void) return display_dev_available; } -bool display_dimstay_check(void) -{ - if (get_pm_status_flag() & DIM_FLAG) - return true; - - if ((get_pm_status_flag() & PWRSV_FLAG) && !(get_pm_status_flag() & BRTCH_FLAG)) - return true; - - return false; -} - static struct _backlight_ops backlight_ops = { .get_lcd_power = dpms_get_cached_state, .set_brightness = NULL, diff --git a/plugins/wearable/display/device-interface.c b/plugins/wearable/display/device-interface.c index 0054982..929be3d 100644 --- a/plugins/wearable/display/device-interface.c +++ b/plugins/wearable/display/device-interface.c @@ -92,14 +92,6 @@ bool display_dev_ready(void) return display_dev_available; } -bool display_dimstay_check(void) -{ - if (get_pm_status_flag() & DIM_FLAG) - return true; - - return false; -} - static int set_brightness(int val) { int max, ret; diff --git a/src/display/display.c b/src/display/display.c index 32dd285..9bb1789 100644 --- a/src/display/display.c +++ b/src/display/display.c @@ -142,6 +142,19 @@ void display_unregister_dependent_device(void) SYS_G_LIST_REMOVE_LIST(display_dependent_device_ops, l); } +/* FIXME: display_dimstay_check function should be changed to plugin api call. + * Only the wearable profile had the first condition only, checking DIM_FLAG. */ +bool display_dimstay_check(void) +{ + if (pm_status_flag & DIM_FLAG) + return true; + + if ((pm_status_flag & PWRSV_FLAG) && !(pm_status_flag & BRTCH_FLAG)) + return true; + + return false; +} + static int display_probe(void *data) { display_plugin_device_ops = find_device("display-plugin"); diff --git a/src/display/display.h b/src/display/display.h index c947535..3ad974a 100644 --- a/src/display/display.h +++ b/src/display/display.h @@ -22,6 +22,17 @@ #include #include "shared/devices.h" +#define VCALL_FLAG 0x00000001 +#define LOWBT_FLAG 0x00000100 +#define CHRGR_FLAG 0x00000200 +#define PWRSV_FLAG 0x00000400 +#define BRTCH_FLAG 0x00002000 +#define PWROFF_FLAG 0x00004000 +#define DIMSTAY_FLAG 0x00008000 +#define DIM_FLAG 0x00010000 +#define BATTERY_FLAG 0x00020000 +#define COOLDOWN_FLAG 0x00040000 + enum display_init_direction_e { DISPLAY_INIT_DIRECTION_HORIZONTAL, DISPLAY_INIT_DIRECTION_VERTICAL, @@ -43,5 +54,6 @@ void display_start_dependent_device(unsigned long flags); void display_stop_dependent_device(unsigned long flags); void display_register_dependent_device(const struct device_ops *ops); void display_unregister_dependent_device(void); +bool display_dimstay_check(void); #endif //__DISPLAY_H__ diff --git a/src/display/plugin-common/core.h b/src/display/plugin-common/core.h index 0d83d1a..5bd9836 100644 --- a/src/display/plugin-common/core.h +++ b/src/display/plugin-common/core.h @@ -37,17 +37,6 @@ #define MASK_DIM 0x2 /* 010 */ #define MASK_OFF 0x4 /* 100 */ -#define VCALL_FLAG 0x00000001 -#define LOWBT_FLAG 0x00000100 -#define CHRGR_FLAG 0x00000200 -#define PWRSV_FLAG 0x00000400 -#define BRTCH_FLAG 0x00002000 -#define PWROFF_FLAG 0x00004000 -#define DIMSTAY_FLAG 0x00008000 -#define DIM_FLAG 0x00010000 -#define BATTERY_FLAG 0x00020000 -#define COOLDOWN_FLAG 0x00040000 - #define DEFAULT_NORMAL_TIMEOUT 30 #define DIM_MASK 0x000f0000 diff --git a/src/display/plugin-common/device-interface.h b/src/display/plugin-common/device-interface.h index 6fb6581..a069429 100644 --- a/src/display/plugin-common/device-interface.h +++ b/src/display/plugin-common/device-interface.h @@ -80,7 +80,6 @@ enum dpms_state { }; bool display_dev_ready(void); -bool display_dimstay_check(void); void dpms_set_running_state(int val); enum lcdon_block_state { diff --git a/src/display/plugin-common/display-backlight.c b/src/display/plugin-common/display-backlight.c index c65e2bb..51fe33c 100644 --- a/src/display/plugin-common/display-backlight.c +++ b/src/display/plugin-common/display-backlight.c @@ -320,7 +320,6 @@ int display_backlight_set_brightness_by_dim_brightness(void) return ret; } -/* FIXME: display_dimstay_check function should be changed to plugin api call */ int display_backlight_update_by_default_brightness(void) { int ret = 0; @@ -349,7 +348,6 @@ void display_backlight_set_custom_brightness(int brightness) custom_brightness = brightness; } -/* FIXME: display_dimstay_check function should be changed to plugin api call */ int display_backlight_update_by_custom_brightness(void) { int ret = 0; -- 2.7.4