display: Replace powersaving mode with plugin api 90/313090/1
authorYoungjae Cho <y0.cho@samsung.com>
Mon, 17 Jun 2024 09:09:46 +0000 (18:09 +0900)
committerYoungjae Cho <y0.cho@samsung.com>
Wed, 19 Jun 2024 04:38:01 +0000 (13:38 +0900)
Change-Id: I40ac2bd8f713369bcd0ac6d6b94d464efb2af705
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/display-plugin.c
src/display/display-plugin.h
src/display/display.c

index 0bf4035dd79d50a1f125b301a154a2b749125194..43622a4ffda96f966f511ac537f5028b3385b75e 100644 (file)
@@ -146,7 +146,6 @@ static int display_probe(void *data)
 
        dp->config = &display_conf;
        init_display_states(dp);
-       dp->default_saving_mode = NULL;
        dp->proc_change_state = NULL;
 
        return 0;
index 642088d0c5315bb0027504af10a82aeaae0c28b0..f562cb0032269b148a807cef1135fb092b8d4b4c 100644 (file)
@@ -145,7 +145,6 @@ static int display_probe(void *data)
 
        dp->config = &display_conf;
        init_display_states(dp);
-       dp->default_saving_mode = NULL;
        dp->proc_change_state = NULL;
 
        return 0;
index 4eb907663b06ba73f9608b995dbab8578f40e1a3..2c36319d47bc0556c55f8871755f11a57e9d6011 100644 (file)
@@ -705,6 +705,9 @@ go_lcd_off:
        return 0;
 }
 
+/**
+ * FIXME: Register to plugin interface .set_powersaving_mode
+ */
 static void default_saving_mode(int onoff)
 {
        if (onoff) {
@@ -852,7 +855,6 @@ static int display_probe(void *data)
         * 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;
 
        return 0;
index ceace0abb793b98cd277db2ba26240b6f2ab3cb2..bff05d4d8df9e09741b5fb70d214dad88cb32ba5 100644 (file)
@@ -45,16 +45,6 @@ int display_plugin_auto_brightness_control(enum brightness_request_e request, in
        return 0;
 }
 
-int display_plugin_set_power_save_mode_flag(int onoff)
-{
-       if (g_display_plugin.default_saving_mode) {
-               g_display_plugin.default_saving_mode(onoff);
-               return 0;
-       }
-
-       return -EOPNOTSUPP;
-}
-
 /* FIXME: Below functions are temorary to separtate display state transition functions */
 int display_plugin_state_do_default_trans(enum syscommon_deviced_display_state state, int evt)
 {
index 7b7ac13d9fd10dbcca0d59edf09332d762690692..084b2c0039abb0c9ed8c46ebc3f1466576e6e5f8 100644 (file)
@@ -58,7 +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);
-       void (*default_saving_mode) (int onoff);
        int (*proc_change_state) (unsigned int cond, pid_t pid);
        int (*set_autobrightness_min) (int val, char *name);
        void (*reset_autobrightness_min) (GDBusConnection *conn, const gchar *sender,
@@ -72,7 +71,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_set_power_save_mode_flag(int onoff);
 
 /* FIXME: function names will be redefined */
 int display_plugin_state_do_default_trans(enum syscommon_deviced_display_state state, int evt);
index af5d9b3bd74c6279cb01dfaa2734c245821b3d46..e19ae13dae2dd22c08ea6fe564bf37c2f174a2e2 100644 (file)
@@ -218,8 +218,17 @@ void display_set_power_save_mode_flag(int onoff)
        int ret;
        enum syscommon_deviced_display_state current;
 
-       if (display_plugin_set_power_save_mode_flag(onoff) == 0)
+       ret = syscommon_plugin_deviced_display_set_powersaving_mode(onoff);
+       if (ret == -ENOTSUP) {
+               _D("Take default operation as there is no found plugin backend");
+       } else if (ret == -EOPNOTSUPP) {
+               _D("Take default operation as there is no found plugin backend operation");
+       } else if (ret < 0) {
+               _E("Failed to plugin operation, ret=%d", ret);
                return;
+       } else {
+               return;
+       }
 
        if (onoff)
                set_pm_status_flag(PWRSV_FLAG);