display: Move getter and setter panel mode from plugins to core display module 03/288603/10
authorYunhee Seo <yuni.seo@samsung.com>
Mon, 20 Feb 2023 07:50:57 +0000 (16:50 +0900)
committeryunhee <yuni.seo@samsung.com>
Mon, 20 Mar 2023 07:00:18 +0000 (16:00 +0900)
Remove and redefine panel mode getter/setter.
These functions are added below display-panel.

int display_panel_set_panel_mode(enum display_panel_mode mode);
int display_panel_get_panel_mode(enum display_panel_mode *mode);
-> With display_panel_mode enum type, it is possible to get and set panel mode type.

Change-Id: Ideb2a6867e79ae7f9e7a51cb6386edcc32244cf4
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/device-interface.h
src/display/display-panel.c
src/display/display-panel.h

index 6510fb1..98f0063 100644 (file)
@@ -449,53 +449,6 @@ static int get_brightness_by_light_sensor(float lmax, float lmin, float light, i
        return 0;
 }
 
-static int get_panel_mode(enum display_panel_mode *mode)
-{
-       int ret;
-       enum display_panel_mode val;
-
-       if (!display_dev_available) {
-               _E("There is no display device.");
-               return -ENOENT;
-       }
-
-       ret = hal_device_display_get_panel_mode(&val);
-       if (ret < 0) {
-               if (ret == -ENODEV)
-                       _E("Get panel mode is not supported.");
-               else
-                       _E("Failed to get panel mode(%d)", ret);
-
-               return ret;
-       }
-
-       *mode = val;
-
-       return 0;
-}
-
-static int set_panel_mode(enum display_panel_mode mode)
-{
-       int ret;
-
-       if (!display_dev_available) {
-               _E("There is no display device.");
-               return -ENOENT;
-       }
-
-       ret = hal_device_display_set_panel_mode(mode);
-       if (ret < 0) {
-               if (ret == -ENODEV)
-                       _E("Set panel mode is not supported.");
-               else
-                       _E("Failed to set panel mode(%d)", ret);
-
-               return ret;
-       }
-
-       return 0;
-}
-
 static int get_frame_rate(int *rate)
 {
        if (!rate)
@@ -656,8 +609,6 @@ static struct _backlight_ops backlight_ops = {
        .get_brightness = get_brightness,
        .restore_brightness_func = restore_brightness_func,
        .get_brightness_by_light_sensor = get_brightness_by_light_sensor,
-       .get_panel_mode = get_panel_mode,
-       .set_panel_mode = set_panel_mode,
        .get_frame_rate = get_frame_rate,
        .set_frame_rate = set_frame_rate,
        .transit_state = backlight_transit_state,
index d29eec4..bf4fab3 100644 (file)
@@ -448,53 +448,6 @@ static int get_brightness_by_light_sensor(float lmax, float lmin, float light, i
        return 0;
 }
 
-static int get_panel_mode(enum display_panel_mode *mode)
-{
-       int ret;
-       enum display_panel_mode val;
-
-       if (!display_dev_available) {
-               _E("There is no display device.");
-               return -ENOENT;
-       }
-
-       ret = hal_device_display_get_panel_mode(&val);
-       if (ret < 0) {
-               if (ret == -ENODEV)
-                       _E("Get panel mode is not supported.");
-               else
-                       _E("Failed to get panel mode(%d)", ret);
-
-               return ret;
-       }
-
-       *mode = val;
-
-       return 0;
-}
-
-static int set_panel_mode(enum display_panel_mode mode)
-{
-       int ret;
-
-       if (!display_dev_available) {
-               _E("There is no display device.");
-               return -ENOENT;
-       }
-
-       ret = hal_device_display_set_panel_mode(mode);
-       if (ret < 0) {
-               if (ret == -ENODEV)
-                       _E("Set panel mode is not supported.");
-               else
-                       _E("Failed to set panel mode(%d)", ret);
-
-               return ret;
-       }
-
-       return 0;
-}
-
 static int get_frame_rate(int *rate)
 {
        if (!rate)
@@ -655,8 +608,6 @@ static struct _backlight_ops backlight_ops = {
        .get_brightness = get_brightness,
        .restore_brightness_func = restore_brightness_func,
        .get_brightness_by_light_sensor = get_brightness_by_light_sensor,
-       .get_panel_mode = get_panel_mode,
-       .set_panel_mode = set_panel_mode,
        .get_frame_rate = get_frame_rate,
        .set_frame_rate = set_frame_rate,
        .transit_state = backlight_transit_state,
index a08e78d..f38cdb3 100644 (file)
@@ -449,53 +449,6 @@ static int get_brightness_by_light_sensor(float lmax, float lmin, float light, i
        return 0;
 }
 
-static int get_panel_mode(enum display_panel_mode *mode)
-{
-       int ret;
-       enum display_panel_mode val;
-
-       if (!display_dev_available) {
-               _E("There is no display device.");
-               return -ENOENT;
-       }
-
-       ret = hal_device_display_get_panel_mode(&val);
-       if (ret < 0) {
-               if (ret == -ENODEV)
-                       _E("Get panel mode is not supported.");
-               else
-                       _E("Failed to get panel mode(%d)", ret);
-
-               return ret;
-       }
-
-       *mode = val;
-
-       return 0;
-}
-
-static int set_panel_mode(enum display_panel_mode mode)
-{
-       int ret;
-
-       if (!display_dev_available) {
-               _E("There is no display device.");
-               return -ENOENT;
-       }
-
-       ret = hal_device_display_set_panel_mode(mode);
-       if (ret < 0) {
-               if (ret == -ENODEV)
-                       _E("Set panel mode is not supported.");
-               else
-                       _E("Failed to set panel mode(%d)", ret);
-
-               return ret;
-       }
-
-       return 0;
-}
-
 static int get_frame_rate(int *rate)
 {
        if (!rate)
@@ -656,8 +609,6 @@ static struct _backlight_ops backlight_ops = {
        .get_brightness = get_brightness,
        .restore_brightness_func = restore_brightness_func,
        .get_brightness_by_light_sensor = get_brightness_by_light_sensor,
-       .get_panel_mode = get_panel_mode,
-       .set_panel_mode = set_panel_mode,
        .get_frame_rate = get_frame_rate,
        .set_frame_rate = set_frame_rate,
        .transit_state = backlight_transit_state,
index f4b152d..4fe1a14 100644 (file)
@@ -461,53 +461,6 @@ static int get_brightness_by_light_sensor(float lmax, float lmin, float light, i
        return 0;
 }
 
-static int get_panel_mode(enum display_panel_mode *mode)
-{
-       int ret;
-       enum display_panel_mode val;
-
-       if (!display_dev_available) {
-               _E("There is no display device.");
-               return -ENOENT;
-       }
-
-       ret = hal_device_display_get_panel_mode(&val);
-       if (ret < 0) {
-               if (ret == -ENODEV)
-                       _E("Get panel mode is not supported.");
-               else
-                       _E("Failed to get panel mode(%d)", ret);
-
-               return ret;
-       }
-
-       *mode = val;
-
-       return 0;
-}
-
-static int set_panel_mode(enum display_panel_mode mode)
-{
-       int ret;
-
-       if (!display_dev_available) {
-               _E("There is no display device.");
-               return -ENOENT;
-       }
-
-       ret = hal_device_display_set_panel_mode(mode);
-       if (ret < 0) {
-               if (ret == -ENODEV)
-                       _E("Set panel mode is not supported.");
-               else
-                       _E("Failed to set panel mode(%d)", ret);
-
-               return ret;
-       }
-
-       return 0;
-}
-
 static int get_frame_rate(int *rate)
 {
        if (!rate)
@@ -721,8 +674,6 @@ static struct _backlight_ops backlight_ops = {
        .get_brightness = get_brightness,
        .restore_brightness_func = restore_brightness_func,
        .get_brightness_by_light_sensor = get_brightness_by_light_sensor,
-       .get_panel_mode = get_panel_mode,
-       .set_panel_mode = set_panel_mode,
        .get_frame_rate = get_frame_rate,
        .set_frame_rate = set_frame_rate,
        .transit_state = backlight_transit_state,
index 7e7478f..1a33208 100644 (file)
@@ -80,8 +80,6 @@ struct _backlight_ops {
        int (*get_brightness_raw)(int *val);
        void (*restore_brightness_func)(void);
        int (*get_brightness_by_light_sensor)(float lmax, float lmin, float light, int *brt);
-       int (*get_panel_mode)(enum display_panel_mode *mode);
-       int (*set_panel_mode)(enum display_panel_mode mode);
        int (*get_frame_rate)(int *rate);
        int (*set_frame_rate)(int rate);
        int (*transit_state)(int state);
index 704aa46..8c88db2 100644 (file)
@@ -161,4 +161,54 @@ int display_panel_get_image_effect(enum display_image_effect *effect)
        *effect = val;
 
        return 0;
+}
+
+/* FIXME: This function is deprecated, should be fixed after plugin refactoring */
+int display_panel_set_panel_mode(enum display_panel_mode mode)
+{
+       int ret;
+
+       if (!display_is_hal_backend_available()) {
+               _E("There is no display device.");
+               return -ENOENT;
+       }
+
+       ret = hal_device_display_set_panel_mode(mode);
+       if (ret < 0) {
+               if (ret == -ENODEV)
+                       _E("Set panel mode is not supported.");
+               else
+                       _E("Failed to set panel mode(%d)", ret);
+               return ret;
+       }
+
+       return 0;
+}
+
+/* FIXME: This function is deprecated, should be fixed after plugin refactoring */
+int display_panel_get_panel_mode(enum display_panel_mode *mode)
+{
+       int ret;
+       enum display_panel_mode val;
+
+       if (!mode)
+               return -EINVAL;
+
+       if (!display_is_hal_backend_available()) {
+               _E("There is no display device.");
+               return -ENOENT;
+       }
+
+       ret = hal_device_display_get_panel_mode(&val);
+       if (ret < 0) {
+               if (ret == -ENODEV)
+                       _E("Get panel mode is not supported.");
+               else
+                       _E("Failed to get panel mode(%d)", ret);
+               return ret;
+       }
+
+       *mode = val;
+
+       return 0;
 }
\ No newline at end of file
index b81d42c..eb92707 100644 (file)
@@ -29,5 +29,7 @@ int display_panel_get_white_balance(enum hal_display_white_balance white_balance
 /* Deprecated functions */
 int display_panel_set_image_effect(enum display_image_effect effect);
 int display_panel_get_image_effect(enum display_image_effect *effect);
+int display_panel_set_panel_mode(enum display_panel_mode mode);
+int display_panel_get_panel_mode(enum display_panel_mode *mode);
 
 #endif /* __DISPLAY_PANEL_H__ */
\ No newline at end of file