display: Add display_panel_set_dpms_state function 94/288494/14
authorYunhee Seo <yuni.seo@samsung.com>
Fri, 17 Feb 2023 07:33:47 +0000 (16:33 +0900)
committeryunhee <yuni.seo@samsung.com>
Mon, 20 Mar 2023 06:56:10 +0000 (15:56 +0900)
To move plugin functions without plugin dependency, this temporary function is needed.

int display_panel_set_dpms_state(int dpms_on, enum device_flags flags)
-> This function replaces the bl_onoff function of plugins.

Change-Id: I0720781ba1cb2afeda5e461c1d979d4a9f2ceb4d
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
plugins/iot-headed/display/device-interface.c
plugins/mobile/display/device-interface.c
plugins/tv/display/device-interface.c
plugins/wearable/display/device-interface.c
src/display/display-panel.c
src/display/display-panel.h

index 4e7b22d..8e9ad6b 100644 (file)
@@ -46,6 +46,7 @@
 #include "display/display.h"
 #include "display/display-lock.h"
 #include "display/display-backlight.h"
+#include "display/display-panel.h"
 
 #define TOUCH_ON       1
 #define TOUCH_OFF      0
@@ -94,22 +95,6 @@ void dpms_set_running_state(int val)
        dpms_running_state = val;
 }
 
-static int bl_onoff(int on, enum device_flags flags)
-{
-       dpms_set_state(on);
-
-#ifdef ENABLE_PM_LOG
-       if (on == DPMS_ON)
-               pm_history_save(PM_LOG_LCD_ON_COMPLETE, get_pm_cur_state());
-       else if (on == DPMS_OFF || on == DPMS_FORCE_OFF)
-               pm_history_save(PM_LOG_LCD_OFF_COMPLETE, get_pm_cur_state());
-       else
-               pm_history_save(PM_LOG_LCD_CONTROL_FAIL, on);
-#endif
-
-       return 0;
-}
-
 static int bl_brt(int brightness, int delay)
 {
        int ret = -1;
@@ -227,7 +212,7 @@ static int backlight_on(enum device_flags flags)
        _I("[DPMS XLIB Backlight] LCD on %#x cnt:%d", flags, cnt);
 
        cnt++;
-       ret = bl_onoff(DPMS_ON, flags);
+       ret = display_panel_set_dpms_state(DPMS_ON, flags);
 #ifdef ENABLE_PM_LOG
        pm_history_save(PM_LOG_LCD_ON, get_pm_cur_state());
 #endif
@@ -255,9 +240,9 @@ static int backlight_off(enum device_flags flags)
                    LCD_PHASED_MIN_BRIGHTNESS, LCD_PHASED_CHANGE_STEP);
 
        if (flags & FORCE_OFF_MODE)
-               ret = bl_onoff(DPMS_FORCE_OFF, flags);
+               ret = display_panel_set_dpms_state(DPMS_FORCE_OFF, flags);
        else
-               ret = bl_onoff(DPMS_OFF, flags);
+               ret = display_panel_set_dpms_state(DPMS_OFF, flags);
 
 #ifdef ENABLE_PM_LOG
        pm_history_save(PM_LOG_LCD_OFF, get_pm_cur_state());
@@ -354,7 +339,7 @@ static int backlight_standby(int force)
 
        if ((dpms_get_cached_state() == DPMS_ON) || force) {
                _I("LCD standby");
-               ret = bl_onoff(DPMS_STANDBY, 0);
+               ret = display_panel_set_dpms_state(DPMS_STANDBY, 0);
        }
 
        return ret;
index 9bfb003..8ee2752 100644 (file)
@@ -45,6 +45,7 @@
 #include "display/display.h"
 #include "display/display-lock.h"
 #include "display/display-backlight.h"
+#include "display/display-panel.h"
 #include "power/power-boot.h"
 #include "power/power-suspend.h"
 
@@ -93,22 +94,6 @@ void dpms_set_running_state(int val)
        dpms_running_state = val;
 }
 
-static int bl_onoff(int on, enum device_flags flags)
-{
-       dpms_set_state(on);
-
-#ifdef ENABLE_PM_LOG
-       if (on == DPMS_ON)
-               pm_history_save(PM_LOG_LCD_ON_COMPLETE, get_pm_cur_state());
-       else if (on == DPMS_OFF || on == DPMS_FORCE_OFF)
-               pm_history_save(PM_LOG_LCD_OFF_COMPLETE, get_pm_cur_state());
-       else
-               pm_history_save(PM_LOG_LCD_CONTROL_FAIL, on);
-#endif
-
-       return 0;
-}
-
 static int bl_brt(int brightness, int delay)
 {
        int ret = -1;
@@ -226,7 +211,7 @@ static int backlight_on(enum device_flags flags)
        _I("[DPMS XLIB Backlight] LCD on %#x cnt:%d", flags, cnt);
 
        cnt++;
-       ret = bl_onoff(DPMS_ON, flags);
+       ret = display_panel_set_dpms_state(DPMS_ON, flags);
 #ifdef ENABLE_PM_LOG
        pm_history_save(PM_LOG_LCD_ON, get_pm_cur_state());
 #endif
@@ -254,9 +239,9 @@ static int backlight_off(enum device_flags flags)
                    LCD_PHASED_MIN_BRIGHTNESS, LCD_PHASED_CHANGE_STEP);
 
        if (flags & FORCE_OFF_MODE)
-               ret = bl_onoff(DPMS_FORCE_OFF, flags);
+               ret = display_panel_set_dpms_state(DPMS_FORCE_OFF, flags);
        else
-               ret = bl_onoff(DPMS_OFF, flags);
+               ret = display_panel_set_dpms_state(DPMS_OFF, flags);
 
 #ifdef ENABLE_PM_LOG
        pm_history_save(PM_LOG_LCD_OFF, get_pm_cur_state());
@@ -353,7 +338,7 @@ static int backlight_standby(int force)
 
        if ((dpms_get_cached_state() == DPMS_ON) || force) {
                _I("LCD standby");
-               ret = bl_onoff(DPMS_STANDBY, 0);
+               ret = display_panel_set_dpms_state(DPMS_STANDBY, 0);
        }
 
        return ret;
index 89081e0..41eea37 100644 (file)
@@ -42,6 +42,7 @@
 #include "vconf.h"
 #include "core.h"
 #include "display/display-dpms.h"
+#include "display/display-panel.h"
 #include "display/display.h"
 #include "display/display-backlight.h"
 #include "power/power-suspend.h"
@@ -94,22 +95,6 @@ void dpms_set_running_state(int val)
        dpms_running_state = val;
 }
 
-static int bl_onoff(int on, enum device_flags flags)
-{
-       dpms_set_state(on);
-
-#ifdef ENABLE_PM_LOG
-       if (on == DPMS_ON)
-               pm_history_save(PM_LOG_LCD_ON_COMPLETE, get_pm_cur_state());
-       else if (on == DPMS_OFF || on == DPMS_FORCE_OFF)
-               pm_history_save(PM_LOG_LCD_OFF_COMPLETE, get_pm_cur_state());
-       else
-               pm_history_save(PM_LOG_LCD_CONTROL_FAIL, on);
-#endif
-
-       return 0;
-}
-
 static int bl_brt(int brightness, int delay)
 {
        int ret = -1;
@@ -227,7 +212,7 @@ static int backlight_on(enum device_flags flags)
        _I("[DPMS XLIB Backlight] LCD on %#x cnt:%d", flags, cnt);
 
        cnt++;
-       ret = bl_onoff(DPMS_ON, flags);
+       ret = display_panel_set_dpms_state(DPMS_ON, flags);
 #ifdef ENABLE_PM_LOG
        pm_history_save(PM_LOG_LCD_ON, get_pm_cur_state());
 #endif
@@ -255,9 +240,9 @@ static int backlight_off(enum device_flags flags)
                    LCD_PHASED_MIN_BRIGHTNESS, LCD_PHASED_CHANGE_STEP);
 
        if (flags & FORCE_OFF_MODE)
-               ret = bl_onoff(DPMS_FORCE_OFF, flags);
+               ret = display_panel_set_dpms_state(DPMS_FORCE_OFF, flags);
        else
-               ret = bl_onoff(DPMS_OFF, flags);
+               ret = display_panel_set_dpms_state(DPMS_OFF, flags);
 
 #ifdef ENABLE_PM_LOG
        pm_history_save(PM_LOG_LCD_OFF, get_pm_cur_state());
@@ -354,7 +339,7 @@ static int backlight_standby(int force)
 
        if ((dpms_get_cached_state() == DPMS_ON) || force) {
                _I("LCD standby");
-               ret = bl_onoff(DPMS_STANDBY, 0);
+               ret = display_panel_set_dpms_state(DPMS_STANDBY, 0);
        }
 
        return ret;
index e9d442a..4cd6cb1 100644 (file)
@@ -45,6 +45,7 @@
 #include "display/display.h"
 #include "display/display-lock.h"
 #include "display/display-backlight.h"
+#include "display/display-panel.h"
 #include "battery-monitor.h"
 #include "battery/power-supply.h"
 #include "power/power-suspend.h"
@@ -106,22 +107,6 @@ void dpms_set_running_state(int val)
        dpms_running_state = val;
 }
 
-static int bl_onoff(int on, enum device_flags flags)
-{
-       dpms_set_state(on);
-
-#ifdef ENABLE_PM_LOG
-       if (on == DPMS_ON)
-               pm_history_save(PM_LOG_LCD_ON_COMPLETE, get_pm_cur_state());
-       else if (on == DPMS_OFF || on == DPMS_FORCE_OFF)
-               pm_history_save(PM_LOG_LCD_OFF_COMPLETE, get_pm_cur_state());
-       else
-               pm_history_save(PM_LOG_LCD_CONTROL_FAIL, on);
-#endif
-
-       return 0;
-}
-
 static int bl_brt(int brightness, int delay)
 {
        int ret = -1;
@@ -238,7 +223,7 @@ static int backlight_on(enum device_flags flags)
        _I("[DPMS XLIB Backlight] LCD on %#x cnt:%d", flags, cnt);
 
        cnt++;
-       ret = bl_onoff(DPMS_ON, flags);
+       ret = display_panel_set_dpms_state(DPMS_ON, flags);
 #ifdef ENABLE_PM_LOG
        pm_history_save(PM_LOG_LCD_ON, get_pm_cur_state());
 #endif
@@ -266,9 +251,9 @@ static int backlight_off(enum device_flags flags)
                    LCD_PHASED_MIN_BRIGHTNESS, LCD_PHASED_CHANGE_STEP);
 
        if (flags & FORCE_OFF_MODE)
-               ret = bl_onoff(DPMS_FORCE_OFF, flags);
+               ret = display_panel_set_dpms_state(DPMS_FORCE_OFF, flags);
        else
-               ret = bl_onoff(DPMS_OFF, flags);
+               ret = display_panel_set_dpms_state(DPMS_OFF, flags);
 
 #ifdef ENABLE_PM_LOG
        pm_history_save(PM_LOG_LCD_OFF, get_pm_cur_state());
@@ -365,7 +350,7 @@ static int backlight_standby(int force)
 
        if ((dpms_get_cached_state() == DPMS_ON) || force) {
                _I("LCD standby");
-               ret = bl_onoff(DPMS_STANDBY, 0);
+               ret = display_panel_set_dpms_state(DPMS_STANDBY, 0);
        }
 
        return ret;
index 9d65416..ec7d96d 100644 (file)
  */
 
 #include "shared/log.h"
-#include "display-panel.h"
+#include "power/power-suspend.h"
 #include "display.h"
+#include "display-dpms.h"
+#include "display-panel.h"
 
 #define MAX_WHITE_BALANCE_GAIN                 2047
 #define MAX_WHITE_BALANCE_OFFSET               2047
 #define DEFAULT_WHITE_BALANCE_GAIN             1024
 #define DEFAULT_WHITE_BALANCE_OFFSET           0
 
+/* FIXME: This function is for temporary use, should be fixed after plugin refactoring */
+int display_panel_set_dpms_state(int dpms_on, enum device_flags flags)
+{
+       dpms_set_state(dpms_on);
+
+#ifdef ENABLE_PM_LOG
+       if (dpms_on == DPMS_ON)
+               pm_history_save(PM_LOG_LCD_ON_COMPLETE, get_pm_cur_state());
+       else if (dpms_on == DPMS_OFF || dpms_on == DPMS_FORCE_OFF)
+               pm_history_save(PM_LOG_LCD_OFF_COMPLETE, get_pm_cur_state());
+       else
+               pm_history_save(PM_LOG_LCD_CONTROL_FAIL, dpms_on);
+#endif
+
+       return 0;
+}
+
 int display_panel_set_white_balance(enum hal_display_white_balance white_balance_type,
                                        int value)
 {
index efe6e45..7ca5d63 100644 (file)
@@ -21,6 +21,9 @@
 
 #include <hal/device/hal-display.h>
 
+#include "shared/devices.h"
+
+int display_panel_set_dpms_state(int dpms_on, enum device_flags flags);
 int display_panel_set_white_balance(enum hal_display_white_balance white_balance_type, int value);
 int display_panel_get_white_balance(enum hal_display_white_balance white_balance_type, int* out_val);