display: Replace display on/off plugin call with plugin api 23/312723/1
authorYoungjae Cho <y0.cho@samsung.com>
Thu, 13 Jun 2024 05:49:12 +0000 (14:49 +0900)
committerYoungjae Cho <y0.cho@samsung.com>
Thu, 13 Jun 2024 05:50:17 +0000 (14:50 +0900)
Change-Id: Ia845efa9ae0e557a51245487c12a2197ef5a52a9
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
plugins/mobile/display/core.c
plugins/tv/display/core.c
plugins/wearable/display/core.c
src/display/core.h
src/display/display-panel.c
src/display/display-plugin.c
src/display/display-plugin.h

index fcd558087b0fe150f66dc2dbce28aa952ad28569..3616b705ad233bb397541e2b9774ec446e09400a 100644 (file)
@@ -204,12 +204,6 @@ static int display_probe(void *data)
        dp->config = &display_conf;
        init_display_states(dp);
        setup_display_plugin_backlight_ops(dp);
-       dp->lcd_on_procedure = NULL;
-       dp->lcd_off_procedure = NULL;
-       dp->custom_lcd_on = NULL;
-       dp->custom_lcd_off = NULL;
-       dp->display_on_by_reason = NULL;
-       dp->display_off_by_reason = NULL;
        dp->default_saving_mode = NULL;
        dp->proc_change_state = default_proc_change_state;
 
index 2303cb9aa59491af39d22118813e2078e9a853c6..7d8e51554e03445a68ab1966f972bca10b18978f 100644 (file)
@@ -147,12 +147,6 @@ static int display_probe(void *data)
        dp->config = &display_conf;
        init_display_states(dp);
        setup_display_plugin_backlight_ops(dp);
-       dp->lcd_on_procedure = NULL;
-       dp->lcd_off_procedure = NULL;
-       dp->custom_lcd_on = NULL;
-       dp->custom_lcd_off = NULL;
-       dp->display_on_by_reason = NULL;
-       dp->display_off_by_reason = NULL;
        dp->default_saving_mode = NULL;
        dp->proc_change_state = NULL;
 
index db688aeb923e1cc8b5138157d4d6b2cdfdfe6ffe..f195cde4f68f2021af6c4db8f4ebadd43b6b59e2 100644 (file)
@@ -154,6 +154,7 @@ inline struct syscommon_deviced_display_state_info *state_st(enum syscommon_devi
        return &states[state];
 }
 
+/* FIXME: register to plugin .lcd_on_procedure interface */
 static void lcd_on_procedure(int state, enum deviced_event reason)
 {
        int ret;
@@ -206,6 +207,7 @@ static void lcd_on_procedure(int state, enum deviced_event reason)
        display_misc_set_touch_event_blocked(false);
 }
 
+/* FIXME: register to plugin .lcd_off_procedure interface */
 static void lcd_off_procedure(enum deviced_event reason)
 {
        /*
@@ -252,6 +254,7 @@ static inline bool check_lcd_is_on(void)
        return true;
 }
 
+__attribute__((unused))
 static gboolean timer_refresh_cb(gpointer data)
 {
        struct syscommon_deviced_display_state_info *st;
@@ -282,7 +285,9 @@ static gboolean timer_refresh_cb(gpointer data)
        return 0;
 }
 
-int custom_lcdon(int timeout)
+/* FIXME: register to plugin .custom_lcd_on interface */
+__attribute__((unused))
+static int custom_lcdon(int timeout)
 {
        struct syscommon_deviced_display_state_info *st;
        int ret, update;
@@ -323,7 +328,9 @@ int custom_lcdon(int timeout)
        return 0;
 }
 
-int custom_lcdoff(enum deviced_event reason)
+/* FIXME: register to plugin .custom_lcd_off interface */
+__attribute__((unused))
+static int custom_lcdoff(enum deviced_event reason)
 {
        struct syscommon_deviced_display_state_info *st;
 
@@ -361,7 +368,9 @@ int custom_lcdoff(enum deviced_event reason)
        return 0;
 }
 
-int display_on_by_reason(const char *reason, int timeout)
+/* FIXME: register to plugin .on_by_reason interface */
+__attribute__((unused))
+static int display_on_by_reason(const char *reason, int timeout)
 {
        struct syscommon_deviced_display_state_info *st;
        int _reason;
@@ -402,7 +411,8 @@ int display_on_by_reason(const char *reason, int timeout)
        return 0;
 }
 
-int display_off_by_reason(const char *reason)
+/* FIXME: register to plugin .off_by_reason interface */
+static int display_off_by_reason(const char *reason)
 {
        struct syscommon_deviced_display_state_info *st;
        int _reason;
@@ -834,12 +844,16 @@ static int display_probe(void *data)
        dp->config = &display_conf;
        init_display_states(dp);
        setup_display_plugin_backlight_ops(dp);
-       dp->lcd_on_procedure = lcd_on_procedure;
-       dp->lcd_off_procedure = lcd_off_procedure;
-       dp->custom_lcd_on = custom_lcdon;
-       dp->custom_lcd_off = custom_lcdoff;
-       dp->display_on_by_reason = display_on_by_reason;
-       dp->display_off_by_reason = display_off_by_reason;
+       /**
+        * FIXME: They should be connected via plugin interfaces
+        *
+        * dp->lcd_on_procedure = lcd_on_procedure;
+        * dp->lcd_off_procedure = lcd_off_procedure;
+        * dp->custom_lcd_on = custom_lcdon;
+        * dp->custom_lcd_off = custom_lcdoff;
+        * dp->display_on_by_reason = display_on_by_reason;
+        * dp->display_off_by_reason = display_off_by_reason;
+        */
        dp->default_saving_mode = default_saving_mode;
        dp->proc_change_state = default_proc_change_state;
 
index 3b1e456fde761f044b3630379d7784e1a0acd260..7378d2e440bf153571d57a8cab524563e05d08c5 100644 (file)
@@ -77,7 +77,6 @@ void set_lock_screen_bg_state(bool state);
 
 /* core.c */
 int delete_condition(enum syscommon_deviced_display_state state);
-int custom_lcdoff(enum deviced_event reason);
 
 /* auto-brightness.c */
 void set_brightness_changed_state(void);
index a4a8beac101d36f085ebe98370ba7044a08ebce0..e9b5ffef3310368383074a71cdbb6fd133b954e0 100644 (file)
@@ -236,8 +236,15 @@ void display_panel_get_lcd_paneloff_mode(bool *on)
 
 void display_panel_lcd_on_procedure(int state, enum deviced_event reason)
 {
-       if (display_plugin_lcd_on_procedure(state, reason) == 0)
+       int ret;
+
+       ret = syscommon_plugin_deviced_display_lcd_on_procedure(state, reason);
+       if (ret == 0)
+               return;
+
+       if (ret != -EOPNOTSUPP)
                return;
+
        /*
         * Display on procedure
         * step 1. leave doze
@@ -283,7 +290,13 @@ void display_panel_lcd_on_procedure(int state, enum deviced_event reason)
 
 void display_panel_lcd_off_procedure(enum deviced_event reason)
 {
-       if (display_plugin_lcd_off_procedure(reason) == 0)
+       int ret;
+
+       ret = syscommon_plugin_deviced_display_lcd_off_procedure(reason);
+       if (ret == 0)
+               return;
+
+       if (ret != -EOPNOTSUPP)
                return;
        /*
         * Display off procedure
@@ -360,9 +373,15 @@ static gboolean timer_refresh_cb(gpointer data)
 
 int display_panel_custom_lcd_on(int timeout)
 {
-       if (display_plugin_custom_lcd_on(timeout) == 0)
+       int ret;
+
+       ret = syscommon_plugin_deviced_display_custom_lcd_on(timeout);
+       if (ret == 0)
                return 0;
 
+       if (ret != -EOPNOTSUPP)
+               return ret;
+
        if (timeout <= 0)
                return -EINVAL;
 
@@ -382,9 +401,15 @@ int display_panel_custom_lcd_on(int timeout)
 
 int display_panel_custom_lcd_off(enum deviced_event reason)
 {
-       if (display_plugin_custom_lcd_off(reason) == 0)
+       int ret;
+
+       ret = syscommon_plugin_deviced_display_custom_lcd_off(reason);
+       if (ret == 0)
                return 0;
 
+       if (ret != -EOPNOTSUPP)
+               return ret;
+
        /* check holdkey block flag in lock node */
        if (display_lock_is_state_locked(SYSCOMMON_DEVICED_DISPLAY_STATE_ON) || display_lock_is_state_locked(SYSCOMMON_DEVICED_DISPLAY_STATE_DIM)) {
                /*
@@ -420,10 +445,15 @@ int display_panel_display_turn_on_by_reason(const char *reason, int timeout)
 {
        int _reason;
        int str_len;
+       int ret;
 
-       if (display_plugin_display_on_by_reason(reason, timeout) == 0)
+       ret = syscommon_plugin_deviced_display_on_by_reason(reason, timeout);
+       if (ret == 0)
                return 0;
 
+       if (ret != -EOPNOTSUPP)
+               return ret;
+
        if (!reason)
                return -EINVAL;
 
@@ -459,10 +489,15 @@ int display_panel_display_turn_off_by_reason(const char *reason)
 {
        enum deviced_event _reason;
        int str_len;
+       int ret;
 
-       if (display_plugin_display_off_by_reason(reason) == 0)
+       ret = syscommon_plugin_deviced_display_off_by_reason(reason);
+       if (ret == 0)
                return 0;
 
+       if (ret != -EOPNOTSUPP)
+               return ret;
+
        if (!reason)
                return -EINVAL;
 
index 1490210d018142dc1f0e2d8c1da766ac5aa99a03..e8e6eb67ae542ce4172fc717f05155825ed07f65 100644 (file)
@@ -45,66 +45,6 @@ int display_plugin_auto_brightness_control(enum brightness_request_e request, in
        return 0;
 }
 
-int display_plugin_lcd_on_procedure(int state, enum deviced_event reason)
-{
-       if (g_display_plugin.lcd_on_procedure) {
-               g_display_plugin.lcd_on_procedure(state, reason);
-               return 0;
-       }
-
-       return -EOPNOTSUPP;
-}
-
-int display_plugin_lcd_off_procedure(enum deviced_event reason)
-{
-       if (g_display_plugin.lcd_off_procedure) {
-               g_display_plugin.lcd_off_procedure(reason);
-               return 0;
-       }
-
-       return -EOPNOTSUPP;
-}
-
-int display_plugin_custom_lcd_on(int timeout)
-{
-       if (g_display_plugin.custom_lcd_on) {
-               g_display_plugin.custom_lcd_on(timeout);
-               return 0;
-       }
-
-       return -EOPNOTSUPP;
-}
-
-int display_plugin_custom_lcd_off(enum deviced_event reason)
-{
-       if (g_display_plugin.custom_lcd_off) {
-               g_display_plugin.custom_lcd_off(reason);
-               return 0;
-       }
-
-       return -EOPNOTSUPP;
-}
-
-int display_plugin_display_on_by_reason(const char *reason, int timeout)
-{
-       if (g_display_plugin.display_on_by_reason) {
-               g_display_plugin.display_on_by_reason(reason, timeout);
-               return 0;
-       }
-
-       return -EOPNOTSUPP;
-}
-
-int display_plugin_display_off_by_reason(const char *reason)
-{
-       if (g_display_plugin.display_off_by_reason) {
-               g_display_plugin.display_off_by_reason(reason);
-               return 0;
-       }
-
-       return -EOPNOTSUPP;
-}
-
 int display_plugin_set_power_save_mode_flag(int onoff)
 {
        if (g_display_plugin.default_saving_mode) {
index 2f3ad9d00101252a419c3c57d4d1977d569bd97d..b431759b83b590460fa3c4ef7220a24e20d8a325 100644 (file)
@@ -58,13 +58,6 @@ enum brightness_request_e {
 struct display_plugin {
        bool system_wakeup_flag;
        int (*auto_brightness_control) (enum brightness_request_e request, int set_brightness);
-       /* FIXME: function names will be redefined */
-       void (*lcd_on_procedure) (int state, enum deviced_event reason);
-       void (*lcd_off_procedure) (enum deviced_event reason);
-       int (*custom_lcd_on) (int timeout);
-       int (*custom_lcd_off) (enum deviced_event reason);
-       int (*display_on_by_reason) (const char *reason, int timeout);
-       int (*display_off_by_reason) (const char *reason);
        void (*default_saving_mode) (int onoff);
        int (*proc_change_state) (unsigned int cond, pid_t pid);
        int (*set_autobrightness_min) (int val, char *name);
@@ -80,12 +73,6 @@ extern struct display_plugin g_display_plugin;
 int display_plugin_get_system_wakeup_flag(bool *flag);
 int display_plugin_set_system_wakeup_flag(bool flag);
 int display_plugin_auto_brightness_control(enum brightness_request_e request, int set_brightness);
-int display_plugin_lcd_on_procedure(int state, enum deviced_event reason);
-int display_plugin_lcd_off_procedure(enum deviced_event reason);
-int display_plugin_custom_lcd_on(int timeout);
-int display_plugin_custom_lcd_off(enum deviced_event reason);
-int display_plugin_display_on_by_reason(const char *reason, int timeout);
-int display_plugin_display_off_by_reason(const char *reason);
 int display_plugin_set_power_save_mode_flag(int onoff);
 
 int display_plugin_backlight_set_brightness(int brightness);