diff options
author | Yunhee Seo <yuni.seo@samsung.com> | 2024-04-08 19:10:17 +0900 |
---|---|---|
committer | Yunhee Seo <yuni.seo@samsung.com> | 2024-04-15 14:45:57 +0900 |
commit | 2ca2167f98167c6b9357ded0fa0510bf4a9876f8 (patch) | |
tree | 6af60568c6b032ab038ffb62e6cc55ab68250245 | |
parent | 79466929b5ddaff25061632bbdaf885130fba832 (diff) | |
download | device-2ca2167f98167c6b9357ded0fa0510bf4a9876f8.tar.gz device-2ca2167f98167c6b9357ded0fa0510bf4a9876f8.tar.bz2 device-2ca2167f98167c6b9357ded0fa0510bf4a9876f8.zip |
device-display: Add get backend logic
When the hal device display module api is called before loading hal-backend,
it should be handled with hal_device_display_get_backend().
This was removed as applying HAL ABI versioning,
however this logic is necessary.
Change-Id: I3ed1b67e3ea8fada9ae394d717e66f5c3f6d216f
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
-rw-r--r-- | src/hal-api-device-display.c | 148 |
1 files changed, 148 insertions, 0 deletions
diff --git a/src/hal-api-device-display.c b/src/hal-api-device-display.c index 1025872..f07d9b0 100644 --- a/src/hal-api-device-display.c +++ b/src/hal-api-device-display.c @@ -58,14 +58,22 @@ int hal_device_display_put_backend(void) free(hal_device_display_funcs); hal_device_display_funcs = NULL; + return 0; } int hal_device_display_get_max_brightness(int *brightness) { + int ret = 0; + if (!brightness) return -EINVAL; + if (!hal_device_display_funcs) { + if ((ret = hal_device_display_get_backend()) < 0) + return ret; + } + if (!hal_device_display_funcs || !hal_device_display_funcs->get_max_brightness) return -ENOTSUP; @@ -75,9 +83,16 @@ int hal_device_display_get_max_brightness(int *brightness) int hal_device_display_get_brightness(int *brightness) { + int ret = 0; + if (!brightness) return -EINVAL; + if (!hal_device_display_funcs) { + if ((ret = hal_device_display_get_backend()) < 0) + return ret; + } + if (!hal_device_display_funcs || !hal_device_display_funcs->get_brightness) return -ENOTSUP; @@ -87,6 +102,13 @@ int hal_device_display_get_brightness(int *brightness) int hal_device_display_set_brightness(int brightness) { + int ret = 0; + + if (!hal_device_display_funcs) { + if ((ret = hal_device_display_get_backend()) < 0) + return ret; + } + if (!hal_device_display_funcs || !hal_device_display_funcs->set_brightness) return -ENOTSUP; @@ -96,6 +118,13 @@ int hal_device_display_set_brightness(int brightness) int hal_device_display_set_multi_brightness(int brightness, int step, int delay) { + int ret = 0; + + if (!hal_device_display_funcs) { + if ((ret = hal_device_display_get_backend()) < 0) + return ret; + } + if (!hal_device_display_funcs || !hal_device_display_funcs->set_multi_brightness) return -ENOTSUP; @@ -105,9 +134,16 @@ int hal_device_display_set_multi_brightness(int brightness, int step, int delay) int hal_device_display_get_auto_brightness(float lmax, float lmin, float light, int *brightness) { + int ret = 0; + if (!brightness) return -EINVAL; + if (!hal_device_display_funcs) { + if ((ret = hal_device_display_get_backend()) < 0) + return ret; + } + if (!hal_device_display_funcs || !hal_device_display_funcs->get_auto_brightness) return -ENOTSUP; @@ -117,9 +153,16 @@ int hal_device_display_get_auto_brightness(float lmax, float lmin, float light, int hal_device_display_get_state(hal_device_display_state_e *state) { + int ret = 0; + if (!state) return -EINVAL; + if (!hal_device_display_funcs) { + if ((ret = hal_device_display_get_backend()) < 0) + return ret; + } + if (!hal_device_display_funcs || !hal_device_display_funcs->get_state) return -ENOTSUP; @@ -129,6 +172,13 @@ int hal_device_display_get_state(hal_device_display_state_e *state) int hal_device_display_set_state(hal_device_display_state_e state) { + int ret = 0; + + if (!hal_device_display_funcs) { + if ((ret = hal_device_display_get_backend()) < 0) + return ret; + } + if (!hal_device_display_funcs || !hal_device_display_funcs->set_state) return -ENOTSUP; @@ -138,9 +188,16 @@ int hal_device_display_set_state(hal_device_display_state_e state) int hal_device_display_get_image_effect(hal_device_display_image_effect_e *effect) { + int ret = 0; + if (!effect) return -EINVAL; + if (!hal_device_display_funcs) { + if ((ret = hal_device_display_get_backend()) < 0) + return ret; + } + if (!hal_device_display_funcs || !hal_device_display_funcs->get_image_effect) return -ENOTSUP; @@ -150,6 +207,13 @@ int hal_device_display_get_image_effect(hal_device_display_image_effect_e *effec int hal_device_display_set_image_effect(hal_device_display_image_effect_e effect) { + int ret = 0; + + if (!hal_device_display_funcs) { + if ((ret = hal_device_display_get_backend()) < 0) + return ret; + } + if (!hal_device_display_funcs || !hal_device_display_funcs->set_image_effect) return -ENOTSUP; @@ -159,9 +223,16 @@ int hal_device_display_set_image_effect(hal_device_display_image_effect_e effect int hal_device_display_get_panel_mode(hal_device_display_panel_mode_e *mode) { + int ret = 0; + if (!mode) return -EINVAL; + if (!hal_device_display_funcs) { + if ((ret = hal_device_display_get_backend()) < 0) + return ret; + } + if (!hal_device_display_funcs || !hal_device_display_funcs->get_panel_mode) return -ENOTSUP; @@ -171,6 +242,13 @@ int hal_device_display_get_panel_mode(hal_device_display_panel_mode_e *mode) int hal_device_display_set_panel_mode(hal_device_display_panel_mode_e mode) { + int ret = 0; + + if (!hal_device_display_funcs) { + if ((ret = hal_device_display_get_backend()) < 0) + return ret; + } + if (!hal_device_display_funcs || !hal_device_display_funcs->set_panel_mode) return -ENOTSUP; @@ -180,9 +258,16 @@ int hal_device_display_set_panel_mode(hal_device_display_panel_mode_e mode) int hal_device_display_get_aod_mode(hal_device_display_aod_mode_e *mode) { + int ret = 0; + if (!mode) return -EINVAL; + if (!hal_device_display_funcs) { + if ((ret = hal_device_display_get_backend()) < 0) + return ret; + } + if (!hal_device_display_funcs || !hal_device_display_funcs->get_aod_mode) return -ENOTSUP; @@ -192,6 +277,13 @@ int hal_device_display_get_aod_mode(hal_device_display_aod_mode_e *mode) int hal_device_display_get_aod_brightness(int *max, int *normal, int *min, int *charging) { + int ret = 0; + + if (!hal_device_display_funcs) { + if ((ret = hal_device_display_get_backend()) < 0) + return ret; + } + if (!hal_device_display_funcs || !hal_device_display_funcs->get_aod_brightness) return -ENOTSUP; @@ -201,9 +293,16 @@ int hal_device_display_get_aod_brightness(int *max, int *normal, int *min, int * int hal_device_display_get_max_frame_rate(int *rate) { + int ret = 0; + if (!rate) return -EINVAL; + if (!hal_device_display_funcs) { + if ((ret = hal_device_display_get_backend()) < 0) + return ret; + } + if (!hal_device_display_funcs || !hal_device_display_funcs->get_max_frame_rate) return -ENOTSUP; @@ -213,9 +312,16 @@ int hal_device_display_get_max_frame_rate(int *rate) int hal_device_display_get_min_frame_rate(int *rate) { + int ret = 0; + if (!rate) return -EINVAL; + if (!hal_device_display_funcs) { + if ((ret = hal_device_display_get_backend()) < 0) + return ret; + } + if (!hal_device_display_funcs || !hal_device_display_funcs->get_min_frame_rate) return -ENOTSUP; @@ -225,9 +331,16 @@ int hal_device_display_get_min_frame_rate(int *rate) int hal_device_display_get_frame_rate(int *rate) { + int ret = 0; + if (!rate) return -EINVAL; + if (!hal_device_display_funcs) { + if ((ret = hal_device_display_get_backend()) < 0) + return ret; + } + if (!hal_device_display_funcs || !hal_device_display_funcs->get_frame_rate) return -ENOTSUP; @@ -237,6 +350,13 @@ int hal_device_display_get_frame_rate(int *rate) int hal_device_display_set_frame_rate(int rate) { + int ret = 0; + + if (!hal_device_display_funcs) { + if ((ret = hal_device_display_get_backend()) < 0) + return ret; + } + if (!hal_device_display_funcs || !hal_device_display_funcs->set_frame_rate) return -ENOTSUP; @@ -246,6 +366,13 @@ int hal_device_display_set_frame_rate(int rate) int hal_device_display_set_white_balance(hal_device_display_white_balance_e white_balance_type, int value) { + int ret = 0; + + if (!hal_device_display_funcs) { + if ((ret = hal_device_display_get_backend()) < 0) + return ret; + } + if (!hal_device_display_funcs || !hal_device_display_funcs->set_white_balance) return -ENOTSUP; @@ -255,9 +382,16 @@ int hal_device_display_set_white_balance(hal_device_display_white_balance_e whit int hal_device_display_get_white_balance(hal_device_display_white_balance_e white_balance_type, int* value) { + int ret = 0; + if (!value) return -EINVAL; + if (!hal_device_display_funcs) { + if ((ret = hal_device_display_get_backend()) < 0) + return ret; + } + if (!hal_device_display_funcs || !hal_device_display_funcs->get_white_balance) return -ENOTSUP; @@ -267,9 +401,16 @@ int hal_device_display_get_white_balance(hal_device_display_white_balance_e whit int hal_device_display_get_rotation_angle(int display_index, hal_device_display_rotation_angle_e *angle) { + int ret = 0; + if (!angle) return -EINVAL; + if (!hal_device_display_funcs) { + if ((ret = hal_device_display_get_backend()) < 0) + return ret; + } + if (!hal_device_display_funcs || !hal_device_display_funcs->get_rotation_angle) return -ENOTSUP; @@ -281,6 +422,13 @@ int hal_device_display_set_rotation_angle(int display_index, hal_device_display_rotation_angle_e angle, hal_device_display_rotation_direction_e direction) { + int ret = 0; + + if (!hal_device_display_funcs) { + if ((ret = hal_device_display_get_backend()) < 0) + return ret; + } + if (!hal_device_display_funcs || !hal_device_display_funcs->set_rotation_angle) return -ENOTSUP; |