From 121214c318609282f287f4d0dc6298eee304bfb4 Mon Sep 17 00:00:00 2001 From: Youngjae Cho Date: Fri, 24 Mar 2023 09:48:44 +0900 Subject: [PATCH] display: Move plugin display-dpms.c to core The source code display-dpms.c has been relocated: - src/display/plugin-common/display-dpms.c => src/display/display-dpms.c The enum dpms_state has been relocated: - src/display/plugin-common/device-interface.h => src/display/display-dpms.h Change-Id: I194b04061a7f404951f564e13cabdc7ca30a6296 Signed-off-by: Youngjae Cho --- src/display/display-backlight.c | 5 ++--- src/display/display-backlight.h | 5 +++-- src/display/display-config.h | 4 ++-- src/display/{plugin-common => }/display-dpms.c | 0 src/display/{plugin-common => }/display-dpms.h | 19 ++++++++++++++----- src/display/display.c | 8 +++----- src/display/display.h | 3 ++- src/display/plugin-common/device-interface.h | 9 --------- 8 files changed, 26 insertions(+), 27 deletions(-) rename src/display/{plugin-common => }/display-dpms.c (100%) rename src/display/{plugin-common => }/display-dpms.h (81%) diff --git a/src/display/display-backlight.c b/src/display/display-backlight.c index f60dadb..96fd72c 100644 --- a/src/display/display-backlight.c +++ b/src/display/display-backlight.c @@ -245,9 +245,8 @@ void display_backlight_change_brightness(int start, int end, int step) } /* FIXME: display_backlight_get_brightness is duplicated, this code structure should be changed */ -/* It was operated only AOD enter & leave. - * Change its parameter type to enum dpms_state when the display-dpms comes into the core. */ -int display_backlight_change_brightness_by_dpms_state(int state) +/* It was operated only AOD enter & leave. */ +int display_backlight_change_brightness_by_dpms_state(enum dpms_state state) { int brt, val; int start, end; diff --git a/src/display/display-backlight.h b/src/display/display-backlight.h index 69e9ec0..914193c 100644 --- a/src/display/display-backlight.h +++ b/src/display/display-backlight.h @@ -19,6 +19,8 @@ #ifndef __DISPLAY_BACKLIGHT_H__ #define __DISPLAY_BACKLIGHT_H__ +#include "display-dpms.h" + struct display_backlight_ops { int (*get_lcd_power)(void); int (*set_brightness)(int val); @@ -34,8 +36,7 @@ int display_backlight_set_brightness(int brightness); int display_backlight_get_brightness(int *brightness); int display_backlight_get_brightness_by_plugin_profile(int *brightness); void display_backlight_change_brightness(int start, int end, int step); -/* FIXME: The parameter was originally type of enum dpms_state */ -int display_backlight_change_brightness_by_dpms_state(int state); +int display_backlight_change_brightness_by_dpms_state(enum dpms_state state); int display_backlight_set_default_brightness(int brightness); int display_backlight_get_default_brightness(int *brightness); int display_backlight_update_by_default_brightness(void); diff --git a/src/display/display-config.h b/src/display/display-config.h index 9c90bb2..77361c4 100644 --- a/src/display/display-config.h +++ b/src/display/display-config.h @@ -20,6 +20,7 @@ #define __DISPLAY_CONFIG_H__ #include +#include "display-dpms.h" #define DISPLAY_CONF_FILE "/etc/deviced/display.conf" /* @@ -56,8 +57,7 @@ struct display_config { bool touch_wakeup; bool display_on_usb_conn_changed; - /* FIXME: After extrancting display-dpms from plugin, restore its type to enum display_dpms_type */ - int display_dpms_type; + enum display_dpms_type display_dpms_type; }; int display_load_config(struct display_config *config); diff --git a/src/display/plugin-common/display-dpms.c b/src/display/display-dpms.c similarity index 100% rename from src/display/plugin-common/display-dpms.c rename to src/display/display-dpms.c diff --git a/src/display/plugin-common/display-dpms.h b/src/display/display-dpms.h similarity index 81% rename from src/display/plugin-common/display-dpms.h rename to src/display/display-dpms.h index f1a970e..b7b89f7 100644 --- a/src/display/plugin-common/display-dpms.h +++ b/src/display/display-dpms.h @@ -19,6 +19,20 @@ #ifndef __DISPLAY_DPMS_H__ #define __DISPLAY_DPMS_H__ +enum dpms_state { + DPMS_ON, /* In use */ + DPMS_STANDBY, /* Blanked, low power */ + DPMS_SUSPEND, /* Blanked, lower power */ + DPMS_OFF, /* Shut off, awaiting activity */ + DPMS_FORCE_OFF,/* Force Shut off */ + DPMS_DETACH, /* Display detached */ +}; + +enum display_dpms_type { + DISPLAY_DPMS_TYPE_NONE, + DISPLAY_DPMS_TYPE_WINDOW_MANAGER, +}; + void dpms_set_state(int on); int dpms_get_state(void); int dpms_get_cached_state(void); @@ -27,9 +41,4 @@ 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__) -enum display_dpms_type { - DISPLAY_DPMS_TYPE_NONE, - DISPLAY_DPMS_TYPE_WINDOW_MANAGER, -}; - #endif /* __DISPLAY_DPMS_H__ */ diff --git a/src/display/display.c b/src/display/display.c index 8798d7d..469bc7f 100644 --- a/src/display/display.c +++ b/src/display/display.c @@ -77,19 +77,17 @@ inline void set_display_init_direction(enum display_init_direction_e display_ini g_display_init_direction = display_init_direction; } -/* FIXME: The first parameter was type enum dpms_state. - * After extracting display-dpms from plugin, restore its type to enum dpms_state. */ -void lcd_direct_control(int dpms_state, int flags) +void lcd_direct_control(enum dpms_state dpms_state, int flags) { const struct device_ops *ops = NULL; GList *l = NULL; switch (dpms_state) { - case 0: /* FIXME: DPMS_ON */ + case DPMS_ON: SYS_G_LIST_FOREACH(display_dependent_device_ops, l, ops) ops->start(flags); break; - case 3: /* FIXME: DPMS_OFF */ + case DPMS_OFF: SYS_G_LIST_FOREACH(display_dependent_device_ops, l, ops) ops->stop(flags); break; diff --git a/src/display/display.h b/src/display/display.h index 3ad974a..4c48cfe 100644 --- a/src/display/display.h +++ b/src/display/display.h @@ -20,6 +20,7 @@ #define __DISPLAY_H__ #include +#include "display-dpms.h" #include "shared/devices.h" #define VCALL_FLAG 0x00000001 @@ -38,7 +39,7 @@ enum display_init_direction_e { DISPLAY_INIT_DIRECTION_VERTICAL, }; -void lcd_direct_control(int dpms_state, int flags); /* FIXME: The first parameter was type enum dpms_state */ +void lcd_direct_control(enum dpms_state dpms_state, int flags); int get_pm_cur_state(void); int get_pm_old_state(void); void set_pm_cur_state(int cur_state); diff --git a/src/display/plugin-common/device-interface.h b/src/display/plugin-common/device-interface.h index 8393ddd..f286464 100644 --- a/src/display/plugin-common/device-interface.h +++ b/src/display/plugin-common/device-interface.h @@ -64,15 +64,6 @@ int display_service_free(void); struct display_backlight_ops *get_var_backlight_ops(void); -enum dpms_state { - DPMS_ON, /* In use */ - DPMS_STANDBY, /* Blanked, low power */ - DPMS_SUSPEND, /* Blanked, lower power */ - DPMS_OFF, /* Shut off, awaiting activity */ - DPMS_FORCE_OFF,/* Force Shut off */ - DPMS_DETACH, /* Display detached */ -}; - bool display_dev_ready(void); void dpms_set_running_state(int val); -- 2.7.4