platform/core/system/deviced.git
17 months agodisplay: Remove unused code of key-filter 41/293641/3
youngjae [Thu, 1 Jun 2023 10:08:27 +0000 (19:08 +0900)]
display: Remove unused code of key-filter

Change-Id: Ia90ae16241bfc1bf2c0a427210d03552657d9a3c
Signed-off-by: youngjae <y0.cho@samsung.com>
17 months agodisplay: Remove get_lcd_timeout_from_settings() 87/293487/6
Yunhee Seo [Tue, 30 May 2023 05:49:57 +0000 (14:49 +0900)]
display: Remove get_lcd_timeout_from_settings()

get_lcd_timeout_from_settings initializes timeout value for each display state,
it is called from display_init().
Every plugins needs initializing timeout value, thus it is moved to core.

This function is added to below display.
int display_initialize_display_state_timeout_from_setting(void);
-> This function gets timeout value from setting and sets for each state timeout.

Change-Id: I892672785490d266cae7224909c03d45cf0c07e1
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
17 months agodisplay: plugin: Add handling code to plugin getter/setter 94/293794/1
Yunhee Seo [Fri, 2 Jun 2023 10:58:25 +0000 (19:58 +0900)]
display: plugin: Add handling code to plugin getter/setter

display_plugin_state_get_name() is changed to set NULL,
if there is no state name.
State timeout value can be 0, but getter/setter checks not proper value.
If the timeout value is 0, it should returned.

This patch is necessary because the value is not properly checked.

Change-Id: Ie053c1c31a1f2b70e9f0ce6790c3fa41eea603e8
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
17 months agodisplay: lock: Remove del_state_cond() 74/293474/7
Yunhee Seo [Sat, 27 May 2023 06:21:48 +0000 (15:21 +0900)]
display: lock: Remove del_state_cond()

In the plugins/display/core.c, del_state_cond/del_(normal/dim/off)_cond() was copied to all plugins.
Actually, there is no need to create a function remove cond for each state.
And, del_state_cond() is used to delete the registered pmlock.

These are changes in this patch related to delete cond_head.
1. Remove del_state_cond() which was used as timeout callback funtion.
2. Remove update_lock_timer() which is not necessary.
3. del_state_cond() routine is added to add_node().
4. Change add_node() to
PmLockNode *display_lock_add_pmlock_node(enum state_t s_index, pid_t pid, bool holdkey_block, unsigned int timeout);

Actually, add_callback function not needs pid, state params.
Because PmLockNode already has that pid, state information and callback is added when the PmLockNode is created.
Thus, add callback and pmlock_node handling routine is moved to display-lock.

For reference assert statement, callback function is added under the conditions.
1. When the pmlock is created
2. When the existing pmlock is updated.
Exisiting callback function is removed when the pmlock is updated or removed.

Change-Id: Iace657049934e531a876be971dc42e6114620f7d
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
17 months agodisplay: plugin: Add display_plugin_get_device_flags() 73/293473/6
Yunhee Seo [Fri, 26 May 2023 07:20:07 +0000 (16:20 +0900)]
display: plugin: Add display_plugin_get_device_flags()

The reason why the display_plugin_get_device_flags() is added is as follows
1. device flags was being used in the lcd_on/off_procedure() through get_lcd_on/off_flags()
2. There is no need for the function to be divded to get_lcd_on/off_flags()
3. Also, ambient flags is only used in the wearable plugin.

Thus, display_plugin_get_device_flgas is a combination of get_lcd_on/off_flags().
It provides device flags value to get_lcd_on/off_flags().
However wearable uses ambient flags, so wearable gets own get_device_flags().

Change-Id: Ibcf4825b7028f045b721e6bfe4e429b77746fe69
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
17 months agoshared: Add handling LOG_TAG 74/293674/1
Yunhee Seo [Fri, 2 Jun 2023 02:38:14 +0000 (11:38 +0900)]
shared: Add handling LOG_TAG

In the shared/log.h, LOG_TAG can cause warning when the header files are
included with util.h.

Thus, LOG_TAG should be defined only when it is not defined.

Change-Id: If60ffd179aa393cfed67897366f08a9a77317e29
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
17 months agodisplay: Relocate setting file to core 51/292751/14
Yunhee Seo [Fri, 12 May 2023 08:10:28 +0000 (17:10 +0900)]
display: Relocate setting file to core

As ambient file is moved to core, setting file can be moved to core.

Change-Id: Ia178a7abb18858414826500270023f4d644d0ed6
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
17 months agodisplay: Relocate ambient-mode file to core 47/292747/15
Yunhee Seo [Thu, 11 May 2023 07:08:24 +0000 (16:08 +0900)]
display: Relocate ambient-mode file to core

Ambient-mode file has a lot of dependent on display modules.
Thus, this patch is needed for the next plugin separation works.
To relocate ambient-mode, set_dim_state() is changed to plugin interface call.

This function is added to below display-misc.
int display_plugin_set_dim_state(bool on);

Actually, set_dim_state is only used in the ambient-mode.
The meaning of function name and role is different.
It does not affect setting dim state.
Also, in the code context, there is no transition to DIM status.

Thus, during plugin refactoring work, function name/location should be discussed.

In addition, unused code is removed from plugins except wearable
Because, "INTERNAL_LOCK_AMBIENT" is only used in wearable.

Change-Id: Ic953a1d6bd311d87bdaa7e838bcd15c68d0dc67c
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
17 months agodisplay: misc: Relocate save_display_log()/print_info() to reduce plugin duplication 33/292633/16
Yunhee Seo [Wed, 10 May 2023 07:42:30 +0000 (16:42 +0900)]
display: misc: Relocate save_display_log()/print_info() to reduce plugin duplication

To move display-lock/lock-detector files to core, save_display_log, print_info functions are also relocated.
Because there is a dependence between files and functions.

This function is added to below display-misc.
void display_misc_save_display_log(const char *path);
-> This function is called when the poweroff notify, sighup situation
    or dbus method is called to save display log.

Change-Id: I8d8865aa3fc04ab3ac51e7e3106bdd3f42baf92e
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
17 months agodisplay: display-state-transition: Relocate fuctions related to transition timer... 72/293472/4
Yunhee Seo [Sat, 27 May 2023 08:11:10 +0000 (17:11 +0900)]
display: display-state-transition: Relocate fuctions related to transition timer to reduce plugin duplication

Remove and redefine get_transition_timer()/timeout_handler()/reset_timeout() in plugins/display/core.c

These function are added to below display-state-transition.c
bool display_state_transition_is_there_state_transition_timer(void);
int display_state_transition_reset_state_transition_timeout(int timeout);
-> These are used to add and manage timeout callback for a specific state transition.

In fact, these functions do not actually change the time of the state transition.
They only generate state transitions by adding timeout callbacks.(with timeout parameter)
Thus, "reset" word or function name should be changed during refactoring process.

Change-Id: Icc4b70b7dd6bb30bd5bc5aa56d331cfe9fc726c6
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
17 months agodisplay: plugin: Add wrapper functions related to states 51/293351/10
Yunhee Seo [Tue, 23 May 2023 10:29:20 +0000 (19:29 +0900)]
display: plugin: Add wrapper functions related to states

struct state has functions, timeout value and name for each state.
Remove direct using of struct states and add wrappers.
This is to change the code used directly into a wrapper form to eliminate
dependence and protect struct states data.

Wrapper in this patch is temporary, so it will be changed later.

Change-Id: I1501dab0f3a61810d1ad7e2ebda1cfb54978944a
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
17 months agodisplay: display-state-transition: Relocate trans_table to core 50/293350/10
Yunhee Seo [Wed, 17 May 2023 04:20:28 +0000 (13:20 +0900)]
display: display-state-transition: Relocate trans_table to core

trans_table is used for getting next display state according to event type.
It has following display state for a specific event in the current display state.

To get and set display state, these functions are added to below display-state-transition.
int display_state_transition_get_next_transition_display_state(enum state_t from_state, enum state_t *to_state, int evt_type);
int display_state_transition_set_transition_table_display_state(enum state_t display_state, enum state_t set_state, int evt_type);

Change-Id: I013a63b6059748b58db04e7b52e8366615c6b1ac
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
17 months agodisplay: lock: Relocate custom_holdkey_block variable 32/292632/10
Yunhee Seo [Wed, 10 May 2023 06:38:27 +0000 (15:38 +0900)]
display: lock: Relocate custom_holdkey_block variable

To remove build dependency, custom_holdkey_block variable should be moved to display-lock.
And then, custom_holdkey_block getter/setter is added.
void display_lock_set_custom_holdkey_block(bool blocked);
void display_lock_get_custom_holdkey_block(bool *blocked);

custom_holdkey_block is set through the dbus method dbus_setlcdtimeout.
This variable is used for screenlock, lcdoff process.

Change-Id: If8b19fd66d388271ccc51c327302ed00196097f7
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
17 months agodisplay: Relocate device-interface.h to core 49/293349/3 accepted/tizen/unified/20230613.170758
Yunhee Seo [Wed, 17 May 2023 02:02:26 +0000 (11:02 +0900)]
display: Relocate device-interface.h to core

Delete the code that was unnecessary in "core.h" file.
"core.h" includes "device-interface.h" file.
However, that is not necessary for "core.h".
Also it can cause build warning in terms of including relationships.
Thus, "device-interface.h" is included to other files which were including "core.h"
to remove build dependency.

Change-Id: I3828be74d41a11445d518b2a65e19ab66eb3e6f6
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
17 months agodisplay: misc: Relocate battery_health_changed() to reduce plugin duplication 68/292468/11
Yunhee Seo [Thu, 4 May 2023 05:36:50 +0000 (14:36 +0900)]
display: misc: Relocate battery_health_changed() to reduce plugin duplication

Remove and redefine battery_health_changed() in plugins/display/core.c
-> This function sets battery/dimstay flag and it is called from battery module.

This function is added to below display-misc.
void display_misc_register_battery_health_notifier(void)
void display_misc_unregister_battery_health_notifier(void)
-> register/unregister notifier is added for above notifier callback.

During display plugins refactoriung, this function will be relocated.

Change-Id: Ib48187458ebfdf0e279c5ea373f401260eb1e597
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
17 months agodisplay: misc: Relocate stay_touchscreen_off getter and setter 67/292467/11
Yunhee Seo [Wed, 3 May 2023 01:53:15 +0000 (10:53 +0900)]
display: misc: Relocate stay_touchscreen_off getter and setter

Remove and redefine set_stay_touchscreen_off() to reduce plugin duplication

These functions are added to below display-touchscreen.
void display_misc_set_stay_touchscreen_off(bool on)
-> This function sets stay_touchscreen_off variable
void display_misc_get_stay_touchscreen_off(bool *on)
-> This function gets stay_touchscreen_off value

Change-Id: I09df7229111442affab75c43e70ae2038f82c966
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
17 months agodisplay: Relocate lcd_paneloff_mode getter and setter 66/292466/10
Yunhee Seo [Tue, 2 May 2023 08:05:58 +0000 (17:05 +0900)]
display: Relocate lcd_paneloff_mode getter and setter

Remove and redefine set_lcd_paneloff_mode() to reduce plugin duplication

These functions are added to below display-panel.
void display_panel_set_lcd_paneloff_mode(bool on)
-> This function sets lcd_paneloff_mode
void display_panel_get_lcd_paneloff_mode(bool *on)
-> This function gets lcd_paneloff_mode

Change-Id: Id7abeab34b2b5bb28899665bd65a020e8461cad0
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
17 months agodisplay: Relocate get_pname() to reduce plugin duplication 65/292465/10
Yunhee Seo [Fri, 28 Apr 2023 06:36:37 +0000 (15:36 +0900)]
display: Relocate get_pname() to reduce plugin duplication

Remove and redefine get_pname function in plugins/display/core.c

This function is added to below display-misc.
void display_misc_get_process_name(pid_t pid, char *pname)
-> This function gets process name by pid parameter.

During display plugins refactoring, this function will be relocated.
To use macro value in poll.h, poll.h is relocated to core from plugin-common.
All plugin-common files will be moved to display core during refactoring process.

Change-Id: Iaaa32254bd93ee37f7bf5bfe5edafac4beb5ab83
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
17 months agodisplay: Relocate low_battery_state() to reduce plugin duplication 64/292464/10
Yunhee Seo [Fri, 28 Apr 2023 06:02:46 +0000 (15:02 +0900)]
display: Relocate low_battery_state() to reduce plugin duplication

Remove and redefine low_battery_state function in plugins/display/core.c

This function is added to below display-misc.
bool display_misc_is_low_battery_state(int val)
-> This function checks that val parameter is low battery status or not.

Actually, this function should be located under the battery module.
During refactoring, this function will be relocated.

Change-Id: I2c5d1ddb5df7bba56c4ac88ddcb92b8d0e3a9335
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
17 months agodisplay: Remove unused codes related to AMBIENT in display plugins 63/292463/10
Yunhee Seo [Fri, 28 Apr 2023 01:48:43 +0000 (10:48 +0900)]
display: Remove unused codes related to AMBIENT in display plugins

At first, ambient module is initialized by vconfkey "db/starter/always_on_display".
However, that vconfkey is not exist in profiles except the wearable profile, so
ambient module initialization fails in other profiles.
Furthermore, that vconfkey sets the device flag "AMBIENT_MODE" and "LCD_PHASED_TRANSIT_MODE".
Thus, AMBIENT_MODE/LCD_PHASED_TRANSIT_MODE flags cannot be used in iot-headed/mobile/tv profile.

All the unused codes related to AMBIENT_MODE/LCD_PHASED_TRANSIT_MODE flags will be removed
from iot-headed/mobile/tv plugins.

Change-Id: I6998151e9f1d6d1fc8c8035616a3dd621826e2d9
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
17 months agodisplay: signal: Relocate display_brightness_changed() to reduce plugin duplication 62/292462/10
Yunhee Seo [Thu, 27 Apr 2023 10:37:18 +0000 (19:37 +0900)]
display: signal: Relocate display_brightness_changed() to reduce plugin duplication

Remove and redefine display_brightness_changed function in plugin/display/core.c
-> This function emits brightness signal, when the brightness is set.

This function is added to below display-signal.
void display_signal_register_display_brightness_notifier(void)
void display_signal_unregister_display_brightness_notifier(void)
-> register/unregister notifier is added for above notifier callback.

To avoid "LOG_TAG" redefinition issue, header file including order is changed.

Change-Id: I7118e64c9ed7eb8cd7cff6ce0e12a7873e477805
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
17 months agodisplay: Move plugin-common files to core(src/display) 58/292458/6
Yunhee Seo [Fri, 28 Apr 2023 07:15:40 +0000 (16:15 +0900)]
display: Move plugin-common files to core(src/display)

The source code display-actor.c has been relocated:
 - src/display/plugin-common/display-actor.c
   => src/display/display-actor.c
 - src/display/plugin-common/display-ops.c
   => src/display/display-ops.c
 - src/display/plugin-common/slave-logging.c
   => src/display/slave-logging.c
- src/display/plugin-common/display-signal.c
  => src/display/display-signal.c

To remove display build dependency between plugin and core, thie file is relocated.

Change-Id: Ia6e5e2e1771ee4ebdb84339dcda55973e6888241
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
17 months agoextcon: Trivial typo fix 79/292879/2
Marek Szyprowski [Tue, 16 May 2023 09:25:03 +0000 (11:25 +0200)]
extcon: Trivial typo fix

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: I369e56a03947bc50b05c799e6ff937c7bba62e20

17 months agocore: Change to register signal handler with glib 27/293027/2
TaeminYeom [Thu, 18 May 2023 07:33:32 +0000 (16:33 +0900)]
core: Change to register signal handler with glib

Using standard signal handler can make deadlock in terminating progress.
When standard signal handler is called dispatching g_main_context,
glib attempts to lock g_main_context again.
To prevent this situation, it is needed to use glib signal handler function.

Change-Id: If2e2fa1c3ebc4bbc7a00b11b3c7f42a9e4fd36ee
Signed-off-by: TaeminYeom <taemin.yeom@samsung.com>
17 months agobattery: Move plugin iot-headless battery to core 46/291546/29
TaeminYeom [Tue, 18 Apr 2023 05:26:33 +0000 (14:26 +0900)]
battery: Move plugin iot-headless battery to core

In plugin iot-headless battery, there are battery charger event handler codes.
But all of them are functions, not policy depending some profiles.
So, they are can be used in common devices.

And the element "action" and "user_data" are removed because they were
planned to be used in power transition, but now they are not used.

Change-Id: I7a7a9281e7d2da5f6838ed302d2a7a330f57ebf3
Signed-off-by: TaeminYeom <taemin.yeom@samsung.com>
17 months agobattery: Rename config.c to battery-parser.c 04/292104/8
TaeminYeom [Thu, 27 Apr 2023 07:26:20 +0000 (16:26 +0900)]
battery: Rename config.c to battery-parser.c

To unify the name of file and function with below format, change them.

file: [module]-[name].c
function: [moudle]-[verb]-[noun]

Change-Id: I870e9bf78262157901fc80758f7412d6298ecc9d
Signed-off-by: TaeminYeom <taemin.yeom@samsung.com>
17 months agobattery: Divide "display_changed" plugin interface 50/291850/10
TaeminYeom [Mon, 24 Apr 2023 01:23:25 +0000 (10:23 +0900)]
battery: Divide "display_changed" plugin interface

In battery notificaion plugin, there was a function "display_changed"
used as a getter and setter duplicated about display state in
mobile and wearable battery plugin.
To divide the role of getting and setting display state
and they can be used in common devices, it is moved to core.

The role of setting display state in battery moudle is included in
new function "handle_display_state_changed", and it calls plugin interface
"launch_health_popup_by_display_state".

Previous "display_changed" is deleted from mobile battery plugin.
In wearable, the role of "display_changed" is moved to new function
"launch_health_popup_by_display_state". And it consists of the action
when display state is changed.

Change-Id: I1f63502ba36f10fcf93c99987c9ce132295397aa
Signed-off-by: TaeminYeom <taemin.yeom@samsung.com>
18 months agobattery: Divide "update_ovp" plugin interface 61/291861/7
TaeminYeom [Mon, 24 Apr 2023 07:09:49 +0000 (16:09 +0900)]
battery: Divide "update_ovp" plugin interface

When there is a battery over voltage protection change, update_ovp is called.
But the parts of update_ovp can be applied in common devices,
so move some of the codes to the function "check_abnormal_status" in core.

Also, there was little difference policy between wearable and mobile profile,
in checking previous notification status. Unify them to wearable's policy.

Change-Id: I210f0c094f4d0b8c356eb21d59da6e49d5de2d47
Signed-off-by: TaeminYeom <taemin.yeom@samsung.com>
19 months agopower: Rename enable/disable autosleep to init/exit 20/290520/5 accepted/tizen/unified/20230330.025600
Youngjae Cho [Tue, 28 Mar 2023 05:39:41 +0000 (14:39 +0900)]
power: Rename enable/disable autosleep to init/exit

The functions below has been renamed:
 - power_enable_autosleep() => power_init_autosleep()
 - power_disable_autosleep() => power_exit_autosleep()

Those functions are only executed once, after booting done and before
shutting down. Therefore the name init/exit is much proper than
enable/disable. In addition, for the power_init_autosleep(), it has
changed to acquire mainlock before writing "mem" on the
/sys/power/autosleep. This prevents system from going suspend just
after the writing "mem" on /sys/power/autosleep.

Change-Id: Iafe5b4a3507ef983edaaa68735858c57577e24f8
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
19 months agodisplay: Provide DPMS wrapper via display-panel 20/290420/6
Youngjae Cho [Fri, 24 Mar 2023 04:04:30 +0000 (13:04 +0900)]
display: Provide DPMS wrapper via display-panel

Technically DPMS is subject to display-panel. Therefore added wrapper
for DPMS at display-panel.c.
 - dpms_get_cached_state()
    => display_panel_get_dpms_cached_state()
 - dpms_init()
    => display_panel_init_dpms()
 - dpms_exit()
    => display_panel_exit_dpms()
 - register_dpms_checklist()
    => display_panel_register_dpms_checklist()

And those existing DPMS functions have been restricted that it is
unable to be accessed from external object file. Plugins who want
deviced service for DPMS must not use DPMS function directly but use
wrapper provided by display-panel.h.

Change-Id: I8359b9b60981be14a03f8b7f89284f0b93596a24
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
19 months agodisplay: Move plugin display-panel.c to core 84/290384/3
Youngjae Cho [Fri, 24 Mar 2023 01:19:48 +0000 (10:19 +0900)]
display: Move plugin display-panel.c to core

The source code display-panel.c has been relocated:
 - src/display/plugin-common/display-panel.c
   => src/display/display-panel.c

Change-Id: I2798e3645e99ee7dd62a14b69ea4be11ab3b12e9
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
19 months agodisplay: Move plugin display-dpms.c to core 79/290379/3
Youngjae Cho [Fri, 24 Mar 2023 00:48:44 +0000 (09:48 +0900)]
display: Move plugin display-dpms.c to core

The source code display-dpms.c has been relocated:
 - src/display/plugin-common/display-dpms.c
   => src/display/display-dpms.c

The enum dpms_state has been relocated:
 - src/display/plugin-common/device-interface.h
   => src/display/display-dpms.h

Change-Id: I194b04061a7f404951f564e13cabdc7ca30a6296
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
19 months agodisplay: Move plugin display-backlight.c to core 25/290325/5
Youngjae Cho [Thu, 23 Mar 2023 05:49:47 +0000 (14:49 +0900)]
display: Move plugin display-backlight.c to core

The source code display-backlight.c has been relocated:
 - src/display/plugin-common/display-backlight.c
   => src/display/display-backlight.c

The struct _backlight_ops has been relocated:
 - src/display/plugin-common/device-interface.h: struct _backlight_ops
   => src/display/display-backlight.h: struct display_backlight_ops

Currently, the display_backlight_ops is utilized by plugin and it is
registered to display_plugin. Add wrapper for each member function so
that the deviced core can invoke matching plugin function if exist.
 - display_plugin_backlight_get_lcd_power()
 - display_plugin_backlight_set_brightness()
 - display_plugin_backlight_get_brightness()
 - display_plugin_backlight_transit_state()
 - display_plugin_backlight_transit_brightness()

Change-Id: Ieb93fd50bd9df968d6a3a77556134ea297e60d42
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
19 months agodisplay: Move plugin get_var_display_conf() to core 35/290235/8
Youngjae Cho [Wed, 22 Mar 2023 04:22:41 +0000 (13:22 +0900)]
display: Move plugin get_var_display_conf() to core

Instead of get_var_display_config(), declare 'g_display_plugin.config'.
 - plugin/*/display/core.c: get_var_display_config()
   => src/display/display-config.c: g_display_plugin.config

Fixed existing code into two way in case of 'g_display_plugin.config'
has not been initialized:
 - If there has been logic that handling
   (g_display_plugin.config == NULL), then followed that logic.
 - Otherwise, added assert(g_display_plugin.config). It can spot error
   that could be derived from later patches.

This only has been applied to those code that will be a part of display
core, that is, codes under src/display/plugin-common. The codes that
stays in plugin work the way they used to.

Change-Id: I7f65d149298358e2c9116a504fdda952fb9c3963
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
19 months agodisplay: Move plugin struct display_plugin to core 24/290324/4
Youngjae Cho [Thu, 23 Mar 2023 00:54:16 +0000 (09:54 +0900)]
display: Move plugin struct display_plugin to core

The struct display_plugin has been relocated:
 - src/display/plugin-common/display-ops.h
   => src/display/display-plugin.h

Added wrapper for each member variable/function of the structure.
Those wrapper access/invoke matching plugin variable/function if exist.
 - display_plugin_handle()
 - display_plugin_pm_lock_internal()
 - display_plugin_pm_unlock_internal()
 - display_plugin_pm_change_internal()
 - display_plugin_update_pm_setting()
 - display_plugin_get_lock_screen_state()
 - display_plugin_get_system_wakeup_flag()
 - display_plugin_set_system_wakeup_flag()
 - display_plugin_device_flags_to_string()
 - display_plugin_auto_brightness_control()

The structure's member would grow as more plugin code will move to
the display core. Later, this struct display_plugin and wrapper can
be replaced by plugin-api-deviced.

Change-Id: I2ebc6b77b647764cbc1d4ceb55d17fdc2fee6af1
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
19 months agodisplay: Move plugin display_dimstay_check() to core 34/290234/6
Youngjae Cho [Tue, 21 Mar 2023 07:38:50 +0000 (16:38 +0900)]
display: Move plugin display_dimstay_check() to core

The display_dimstay_check() has bee relocated:
 - plugins/*/display/device-interface.c => src/display/display.c

Change-Id: Ifd8a23ab255d091495d6de25a8d35c933b9c8b39
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
19 months agodisplay: Move plugin display.c to core 33/290233/6
Youngjae Cho [Tue, 21 Mar 2023 05:48:56 +0000 (14:48 +0900)]
display: Move plugin display.c to core

The list lcdon_ops has been renamed to display_dependent_device_ops and
related operation has been added.
 - display_start_dependent_device()
 - display_stop_dependent_device()
 - display_register_dependent_device()
 - display_unregister_dependent_device()
Each operation replaces the previous lcdon_ops code.

The enum brightness_request_e has been moved to display-ops.h that
contains operation of auto_brightness_control.

Change-Id: I04b2b28d42938743fcbe0654461274127b95f010
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
19 months agodisplay: Move plugin config-parser to core 32/290232/6
Youngjae Cho [Tue, 21 Mar 2023 03:59:47 +0000 (12:59 +0900)]
display: Move plugin config-parser to core

The display_load_config() has been relocated:
 - display/plugin-common/display.c => display/display-config.c

Change-Id: I82f495090f6814342ce3081b9477c72bd7cf863b
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
19 months agocore: Disable probe() as well as init() in case of disable_auto_init 23/290323/4
Youngjae Cho [Thu, 23 Mar 2023 01:08:06 +0000 (10:08 +0900)]
core: Disable probe() as well as init() in case of disable_auto_init

The disable_auto_init was orignally intended to prevent a module from
being initialized automatically by the deviced's initializing process.
Instead, it gives its initialization responsibility to another module.
Commonly, a pair of core module and its subordinate plugin module use
this disable_auto_init feature. Core module is declared without
disable_auto_init whereas plugin module is declared with it. In this
manner, the core module is automatically initialized by the deviced,
and it triggers its plugin module that wouldn't have been initialized
automatically by the deviced. In this sense, keeping order between core
and plugin module, it is proper to prevent probe() as well as init()
for module declared with disable_auto_init.

Change-Id: Idb9af18342ac205962b50b4188bd8cf965a5be40
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
19 months agodisplay: Initialize display core device 31/290231/4
Youngjae Cho [Tue, 21 Mar 2023 01:21:16 +0000 (10:21 +0900)]
display: Initialize display core device

The display device is now added to the deviced core translation unit.
The existing display plugin devices are changed not to be initialized
by default. Instead its initialization is triggered by display core
device.

Change-Id: I864b8f7aa594c56076286e2d7d7516bee11f2245
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
19 months agodisplay: Relocate display plugin code before separating them into core 30/290230/3
Youngjae Cho [Tue, 21 Mar 2023 00:26:43 +0000 (09:26 +0900)]
display: Relocate display plugin code before separating them into core

Temporarily relocate header and source code:
 - src/display -> src/display/plugin-common

All display code are actually included in translation unit of plugin and
built into plugin shared lib. Move them into display/plugin-common in
advance. And later, separate them from plugin translation unit. The
directory, src/display, will comprise display core code, not plugin code.
 - src/display/plugin-common:
    Temporary directory for display plugin code. Those code will move
    into src/display.
 - src/display:
    Directory for display core code.

Change-Id: I56831630db97d553e6803167e610cfa3d5371168
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
19 months agodisplay: Remove unused code 29/290229/3
Youngjae Cho [Mon, 20 Mar 2023 10:00:42 +0000 (19:00 +0900)]
display: Remove unused code

Removed unused get_var_backlight_ops() and MAX() macro.

Change-Id: I872e077f68a5e14153130eef57a3123657fbd4df
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
19 months agodisplay: backlight: Relocate display_backlight_change_brightness_by_dpms_state()... 14/289414/8
Yunhee Seo [Tue, 7 Mar 2023 08:25:47 +0000 (17:25 +0900)]
display: backlight: Relocate display_backlight_change_brightness_by_dpms_state() to reduce plugin duplication

Remove and redefine backlight_transit_state function in backlight_ops.

This function is added to below display-backlight.
int display_backlight_change_brightness_by_dpms_state(enum dpms_state state)
-> In AOD mode, this function changes brightness smoothly.

Change-Id: Iee3e16ad023fc71a3d1fccbf96dcabfbc156401c
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
19 months agodisplay: backlight: Remove restore_brightness_func() to reduce plugin duplication. 05/289205/9
Yunhee Seo [Thu, 2 Mar 2023 11:12:30 +0000 (20:12 +0900)]
display: backlight: Remove restore_brightness_func() to reduce plugin duplication.

restore_brightness_func() was used only for wearable plugin.
It changed set/get/change_brightness functions in backlight_ops depends on lbm mode.

To remove duplicated and redundant code, this functions is removed.
Also, add function changing code to wearable plugin profile.

Change-Id: If4d4d95b5123716fabf7379dca4fdcbc441f5278
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
19 months agodisplay: backlight: Relocate display_backlight_set/get/change_brightness() to reduce... 02/289202/9
Yunhee Seo [Thu, 2 Mar 2023 10:53:27 +0000 (19:53 +0900)]
display: backlight: Relocate display_backlight_set/get/change_brightness() to reduce plugin duplication

Remove and redefine functions in the backlight_ops.
- set_brightness, get_brightness, transit_brt, get_brightness_raw
Wearable profile can have two status of get_brightness lbm_get_brightness/(default)get_brightness
That's why get_brightness_raw was put in backlight_ops to always call (default)get_brightness.
get_brightness_raw can be replaced by display_backlight_get_brightness.

These functions are added to below diplay-backlight.
int display_backlight_set_brightness(int brightness)
int display_backlight_get_brightness(int *brightness)
void display_backlight_change_brightness(int start, int end, int step)
-> With these functions, it is possible to get and set brightness through HAL.
int display_backlight_get_brightness_by_plugin_profile(int *brightness)
-> This function is temporary, it is for handling wearable profile dependency.
    To keep original code intent, this is necessary for functions that are dependent on wearable profile.

Change-Id: I0c9cb7675c39094576dd7e42d66d46a29da4144b
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
19 months agodisplay: Change get_lcd_power() to dpms_get_cached_state() 65/289165/9
Yunhee Seo [Thu, 2 Mar 2023 07:29:09 +0000 (16:29 +0900)]
display: Change get_lcd_power() to dpms_get_cached_state()

To move plugin functions without plugin dependency,
get_lcd_power() should be replaced by dpms_get_cached_state().
However, touchscreen module is dependent on display module build.
Thus, this get_lcd_power() will be changed after resolving build dependency.

Change-Id: I4d58f852cf3da29fe58df4fe3f8b69d954c77959
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
19 months agodisplay: Move set brightness with delay function from plugins to core display module 80/288980/9
Yunhee Seo [Mon, 27 Feb 2023 06:30:14 +0000 (15:30 +0900)]
display: Move set brightness with delay function from plugins to core display module

Move plugin static function to core(display module).
This is for moving backlight_ops functions related to brightess without dependency.

int display_backlight_set_brightness_with_delay(int brightness, int delay)
-> This function replaces the static bl_brt function located in plugins.

Change-Id: I4f20da84514cb29e74482980143d09c41354e31b
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
19 months agodisplay: Move force_brightness getter and setter from plugin to core display module 49/288949/9
Yunhee Seo [Mon, 27 Feb 2023 01:59:44 +0000 (10:59 +0900)]
display: Move force_brightness getter and setter from plugin to core display module

Remove and redefine force_brightness getter/setter.
These functions are added below display-backlight.

int display_backlight_set_force_brightness(int brightness)
void display_backlight_get_force_brightness(int *brightness)
-> With these functions, it is possible to get and set for_brightness value.

Change-Id: Ibf93bfd10ac13a462759107598ea95d5c915e610
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
19 months agodisplay: Move display get dpms state function from plugin to core display module 44/288944/10
Yunhee Seo [Fri, 24 Feb 2023 09:40:55 +0000 (18:40 +0900)]
display: Move display get dpms state function from plugin to core display module

Remove and redefine display dpms state function.
These functions are added to below display-panel.

int display_panel_get_dpms_state(void)
-> This function returns dpms state and replaces get_lcd_power_node located in plugins.
void display_panel_set_dpms_running_state(int val)
-> This function initialize dpms_running_state

Change-Id: I34e29e3477113d2f19835c0782303334ba0d870f
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
19 months agodisplay: Move display blink functions from plugin to core display module 07/288907/9
Yunhee Seo [Fri, 24 Feb 2023 08:17:58 +0000 (17:17 +0900)]
display: Move display blink functions from plugin to core display module

Remove and redefine display blink functions.
These functions are added to below display-backlight.

void display_backlight_set_blink(int timeout)
-> This function set display blink behavior by adding timeout callback.
void display_backlight_unset_blink(void)
-> This function remove blink callback function after DUMP_MODE_WAITING_TIME time.

Change-Id: Iafe293ff9ff8ad65b971885bfd949e037bcffa40
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
19 months agodisplay: Move get_brightness_by_light_sensor function from plugin to core display... 06/288906/8
Yunhee Seo [Fri, 24 Feb 2023 02:31:19 +0000 (11:31 +0900)]
display: Move get_brightness_by_light_sensor function from plugin to core display module

Remove and redefine get_brightness_by_light_sensor function.
This function is added to below display-backlight.

int display_backlight_get_brightness_by_light_sensor(float lmax, float lmin,
float light, int *brightness)
-> This function replaces get_brightness_by_light_sensor function located in plugins.

Change-Id: Ibe17d746276c2f2ca3ba7b233c88c259471aaebe
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
19 months agodisplay: Move custom_brightness setter and update function from plugin to core displa... 91/288791/11
Yunhee Seo [Thu, 23 Feb 2023 06:47:25 +0000 (15:47 +0900)]
display: Move custom_brightness setter and update function from plugin to core display module

Remove and redefine custom_brightness setter and update function.
These functions are added to below display-backlight.

void display_backlight_set_custom_brightness(int brightness)
-> This function set custom_brightness value.
int display_backlight_update_by_custom_brightness(void)
-> If the conditions are met, this function updates brightness with custom_brightness value.

Change-Id: I4c3662fbdfff4a4b17224ac3af74c4cac1503303
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
19 months agodisplay: Move brightness update function plugin to core display module 87/288787/10
Yunhee Seo [Thu, 23 Feb 2023 05:21:07 +0000 (14:21 +0900)]
display: Move brightness update function plugin to core display module

Remove and redefine backlight_update function.
This function is added below display-backlight.

int display_backlight_update_by_default_brightness(void)
-> This function replaces backlight_update function located in plugins.

Change-Id: I47e2b84a5157beebfc020a62b4508af0f85b52e4
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
19 months agodisplay: Move custom_status getter and setter from plugin to core display module 57/288757/11
Yunhee Seo [Wed, 22 Feb 2023 10:13:07 +0000 (19:13 +0900)]
display: Move custom_status getter and setter from plugin to core display module

Remove and redefine custom_status getter/setter.
These functions are added below display-backlight.

void display_backlight_set_custom_status(bool on)
void display_backlight_get_custom_status(bool *on)
-> With these functions, it is possible to get and set custom status.

Change-Id: I353fd29d0d9fcc00504070f42d472c2bb89f3511
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
19 months agodisplay: Move functions related to display status(on/off/dim/standby) 22/288722/15
Yunhee Seo [Wed, 22 Feb 2023 05:52:18 +0000 (14:52 +0900)]
display: Move functions related to display status(on/off/dim/standby)
from plugin to core display module

Remove and redefine display status change functions.
These functions are added below display-panel/display-backlight.

int display_panel_set_panel_state_by_on_state(enum device_flags flags)
int display_panel_set_panel_state_by_off_state(enum device_flags flags)
int display_panel_set_panel_state_by_standby_state(bool standby_on)
int display_backlight_set_brightness_by_dim_brightness(void)
-> With these functions, it is possible to change display panel/backlight status.

Change-Id: I4313046c610410ccef82ac18fda1e334960330b1
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
19 months agodisplay: Move default_brightness getter and setter from plugin to core display module 19/288719/12
Yunhee Seo [Wed, 22 Feb 2023 05:20:53 +0000 (14:20 +0900)]
display: Move default_brightness getter and setter from plugin to core display module

Remove and redefine default brightness getter/setter.
These functions are added below display-backlight.

int display_backlight_set_default_brightness(int brightness)
int display_backlight_get_default_brightness(int *brightness)
-> With these functions, it is possible to get and set default brightness value.

Change-Id: Iaa851094abf051f2fe15c64ff8e94376cc2b6382
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
19 months agodisplay: Move getter and setter display frame rate from plugins to core display module 08/288608/8
Yunhee Seo [Mon, 20 Feb 2023 08:23:16 +0000 (17:23 +0900)]
display: Move getter and setter display frame rate from plugins to core display module

Remove and redefine frame rate getter/setter.
These functions are added below display-panel.

int display_panel_set_frame_rate(int frame_rate);
int display_panel_get_frame_rate(int *frame_rate);
-> With these getter and setter, it is possible to get and set display frame rate value.

Change-Id: Ie12367bbc0177fdfc3119ec059b75ce89f9055d6
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
19 months agodisplay: Move getter and setter panel mode from plugins to core display module 03/288603/10
Yunhee Seo [Mon, 20 Feb 2023 07:50:57 +0000 (16:50 +0900)]
display: Move getter and setter panel mode from plugins to core display module

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>
19 months agodisplay: Move image effect functions from plugins to core display module 99/288599/10
Yunhee Seo [Mon, 20 Feb 2023 05:54:19 +0000 (14:54 +0900)]
display: Move image effect functions from plugins to core display module

Remove and redefine functions related to display image effect.
These functions are added below display-panel.

int display_panel_set_image_effect(enum display_image_effect effect);
int display_panel_get_image_effect(enum display_image_effect *effect);
-> With display_image_effect enum type, it is possible to get and set image effect type.

Change-Id: I479aa296053ef75b18b4e4b2c3f93e40ecc03191
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
19 months agodisplay: Add display_panel_set_dpms_state function 94/288494/14
Yunhee Seo [Fri, 17 Feb 2023 07:33:47 +0000 (16:33 +0900)]
display: Add display_panel_set_dpms_state function

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>
19 months agodisplay: Add functions related to brightness 08/288508/12
Yunhee Seo [Fri, 17 Feb 2023 08:26:45 +0000 (17:26 +0900)]
display: Add functions related to brightness

Move plugin static functions to core(display module).
This is for moving backlight_ops functions related to brightess without dependency.

int display_backlight_get_max_brightness(int *max_brightness)
-> This function replaces the get_max_brightness function located in plugins.

int display_backlight_get_normalized_brightness(int raw_brightness,
int *normalized_brightness)
-> This function replaces the get_brt_normalized function located in plugins.

Change-Id: I7452f90075ef63acdc8f595fe99d47e0bfe4f4a1
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
19 months agodisplay: Remove unused s-cover(HALL IC) code 72/289972/4
Youngjae Cho [Thu, 16 Mar 2023 09:51:02 +0000 (18:51 +0900)]
display: Remove unused s-cover(HALL IC) code

Change-Id: If57090427d93e3465264ba9366374cd197ba6a23
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
19 months agodisplay: Remove unused code 71/289971/3
Youngjae Cho [Thu, 16 Mar 2023 09:36:22 +0000 (18:36 +0900)]
display: Remove unused code

Change-Id: I4a4a48848d0b9e164f2c820c6086bf653b316b3f
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
19 months agopower: Use strncpy to avoid the potential problem 00/289800/4 accepted/tizen/unified/20230316.101444
Yunhee Seo [Tue, 14 Mar 2023 08:54:34 +0000 (17:54 +0900)]
power: Use strncpy to avoid the potential problem

sscanf function is detected as risky function in static analysis.
Thus, change the sscanf function to strncpy function.

Change-Id: I44b883eeaeea401dc251577f2bbced4f9ee8c72c
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
20 months agopower: Relocate resuming device_notify() properly 06/289606/1
Youngjae Cho [Fri, 10 Mar 2023 01:53:52 +0000 (10:53 +0900)]
power: Relocate resuming device_notify() properly

The resuming notify should be broadcasted after completely finishing
wakeup transition. In other words, broadcasting should be held when a
transition is waiting for being confirmed by user program. In this
context, it is proper to relocate device_notify() to resume_echo_mem(),
which is invoked on finishing wakeup transition.

Change-Id: I0c924d5667b749f79e95f04b62c69e499ffb7058
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
20 months agopower: Wake unlock in case of cancelling transition 06/288406/2
Youngjae Cho [Thu, 16 Feb 2023 06:36:14 +0000 (15:36 +0900)]
power: Wake unlock in case of cancelling transition

Properly unlock the secondary wakelock when cancelling transition.
Currently there is no scenario for cancelling wakeup transition though,
it is important when it comes to undoing wakeup and trying to go sleep
again.

Change-Id: I5c4cc65d6bf8453919e0a2624603b8c04f574eb7
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
20 months agodisplay: Add support to select the DPMS type 42/288242/6 accepted/tizen/unified/20230220.174453
TaeminYeom [Tue, 14 Feb 2023 03:18:58 +0000 (12:18 +0900)]
display: Add support to select the DPMS type

DPMS (Display Power Management Signaling) is typically done by
requesting window manager. But some devices don't support window manager
and previous DPMS code was written assuming exiting window manager.
So, to support none window manager devices, dpms_ops struct is added.
According to DPMS type configuration, DPMS function can be bypassed.
If a new DPMS function is created later, it can be supported by connecting to dpms_ops.

[New added configuration]
- DisplayDPMSType
  : Indicates the type of DPMS. (window_manager or none)
    Default value is window_manager

Change-Id: I8a9f254102086b3e22c9498c1604e45c5053b60e
Signed-off-by: TaeminYeom <taemin.yeom@samsung.com>
20 months agodisplay: Change DPMS init and exit fucntion name 20/288320/3
TaeminYeom [Wed, 15 Feb 2023 03:00:27 +0000 (12:00 +0900)]
display: Change DPMS init and exit fucntion name

For consistent naming rule with other DPMS function,
change the names.

init_dpms -> dpms_init
exit_dpms -> dpms_exit
add_timer_for_init_dpms -> add_timer_for_dpms_init
delayed_init_done_dpms -> delayed_dpms_init_done

Change-Id: I1de2c9741526238d33c03e815f2ff73fa2a13f9f
Signed-off-by: TaeminYeom <taemin.yeom@samsung.com>
20 months agodisplay: Change get_var_display_config return type to const 77/288477/2
TaeminYeom [Wed, 15 Feb 2023 08:22:26 +0000 (17:22 +0900)]
display: Change get_var_display_config return type to const

To prevent modify display config static struct in other file.
If it wanted to be modified later, setter will have to be added.

Change-Id: I477fc8476981f18d92509dfb6b2c0783cc7df734
Signed-off-by: TaeminYeom <taemin.yeom@samsung.com>
20 months agodisplay: Move white_balance_ops functions from plugins to core display module 00/288400/6
Yunhee Seo [Thu, 16 Feb 2023 06:16:07 +0000 (15:16 +0900)]
display: Move white_balance_ops functions from plugins to core display module

Remove and redefine functions related to display white balance work.
Because white balancing is common for display.
Thus, these functions are added below display-panel.

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)
-> With hal_display_white_balance enum type, it is possible to get and set white_balance values.

Change-Id: I10213315d109e47f0e8c3a58382648ccef3ca2d1
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
20 months agodisplay: Add display hal-backend check function 93/288393/7
Yunhee Seo [Thu, 16 Feb 2023 05:32:53 +0000 (14:32 +0900)]
display: Add display hal-backend check function

Before plugin to core centralization, display hal backend check is needed.
To move functions without plugin dependency, this temporary function is necessary.
With this, plugin functions can be moved to core(deviced/src/display module).
These functions will be modified during plugin to core centralization.

void display_set_hal_backend_available(bool display_check_hal_backend)
-> With this, while plugin probing, deviced core can know whether hal_backend is
available or not.
bool display_check_hal_backend_available(void)
-> This function is for replacing the display_dev_available variable of plugins.

Change-Id: I1e926da29ab097e08533f73136a2f928daca9167
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
20 months agodisplay: change sleep reason to DISPLAY_OFF_TIMEOUT 14/288214/2 accepted/tizen/unified/20230215.100730
Youngjae Cho [Tue, 14 Feb 2023 01:11:34 +0000 (10:11 +0900)]
display: change sleep reason to DISPLAY_OFF_TIMEOUT

Technically, the sleep request of display plugin is triggered by timer,
not by display off itself.
  1. Display off, display state is changed to S_LCDOFF.
  2. Start timer, 300ms.
  3. On expiring the timer, display state is changed to S_SLEEP.
  4. The display plugin requests power module to change its state to
     DEVICED_POWER_STATE_SLEEP.
Therefore, it is proper to use enum DISPLAY_OFF_TIMEOUT instead of
just DISPLAY_OFF.

Change-Id: I93e6d092ebcc23e09db61f65d8f0b7e4dc5aac7e
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
20 months agopower: skip echo mem if there is pending transition 05/288005/4
Youngjae Cho [Thu, 9 Feb 2023 02:33:52 +0000 (11:33 +0900)]
power: skip echo mem if there is pending transition

For echo mem, there could be some pending transitions when it comes to
enter suspend. This is because transition is asynchronously processed.
That is, if there were another transition request during a sleep
transition, the sleep transition should be skipped and take the next
transition immediately. Otherwise, the next transition will handled
after wakeup, which is indefinite.

Change-Id: Ia09a1d1162e21710538f6e9ce7bd1fb3e9c43d0f
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
20 months agopower: add transient scenario from START to SLEEP 04/288004/3
Youngjae Cho [Wed, 8 Feb 2023 09:50:34 +0000 (18:50 +0900)]
power: add transient scenario from START to SLEEP

Transient scenario for suspending from START to SLEEP has been added.
  DEVICED_POWER_STATE_START
              |
              V
  DEVICED_POWER_TRANSIENT_STATE_SUSPENDING_EARLY
              |
              V
  DEVICED_POWER_TRANSIENT_STATE_SUSPENDING
              |
              V
  DEVICED_POWER_TRANSIENT_STATE_SUSPENDING_LATE
              |
              V
  DEVICED_POWER_STATE_SLEEP

Change-Id: I814defb0245e94302746918fa5392ed3a08c64b3
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
20 months agopower: separate action_for_state() callback 03/288003/3
Youngjae Cho [Wed, 8 Feb 2023 09:17:17 +0000 (18:17 +0900)]
power: separate action_for_state() callback

Separated the callback action_for_state() into two type
 - pre_action_state()
 - post_action_state()
Literally, it only differs when the time it is invoked based on
completing transition, one is before and the other is after finishing
transition.

 It is necessary for echo mem. Previously, the action_for_state()
always invoked 'right before' transition completion. As it is echo mem,
system is forced to go suspend within the action_for_state() callback.
After resuming from the suspend, the processing thread still be in the
action_for_state(), which is still not having completed sleep transition.
As a result, a system is waking up but the internal power state is about
to be changed to sleep state. This is contradiction and causes various
undesirable behavior.
 To address it, move echo mem to post_action_state(). Unlike the
previous action_for_state(), the post_action_state() is invoked 'after'
the completion of transition. That is, it is natural that waking up
within the post_action_state() as it already has been finished sleep
transition. Thus it won't change the internal state to sleep anymore.

Change-Id: I49e12a19538bdb4241cba34fd536c942257ccaec
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
20 months agopower: remove unused code 02/288002/3
Youngjae Cho [Thu, 9 Feb 2023 02:55:25 +0000 (11:55 +0900)]
power: remove unused code

Change-Id: I7f77684552998c5ba5810143cfde854bd56105d2
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
20 months agopower: get wakeup_reason by calling hal-api 91/288191/2
Youngjae Cho [Mon, 13 Feb 2023 08:46:11 +0000 (17:46 +0900)]
power: get wakeup_reason by calling hal-api

As the previous patch,
 - power: update wakeup reason immediately after wakeup
has changed not to maintain wakeup reason after resume, it is necessary
to access it via hal-api for every request for wakeup reason.

Change-Id: Ibf2aebb5b542dd1d55f799be0fbaddf65a6a8e7c
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
20 months agopower: update wakeup reason immediately after wakeup 01/288001/2
Youngjae Cho [Wed, 8 Feb 2023 03:40:14 +0000 (12:40 +0900)]
power: update wakeup reason immediately after wakeup

The wakeup reason would be utilized by callback of device_notify().
Therefore update it on resuming. To prevent the wakeup reason from
lingering, reset it by 0 before returning the function.

Change-Id: I149b2999f14a1c2461098506bd64a242d66937fd
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
21 months agoinput: add input config file parsing code for touchscreen 85/287885/1 accepted/tizen/unified/20230209.111259
Yunhee Seo [Tue, 7 Feb 2023 09:28:18 +0000 (18:28 +0900)]
input: add input config file parsing code for touchscreen

Add input config file parsing code for touchscreen input type.

Change-Id: I6b9623760e082ea33b86fa0e4c4eaf3d429a2b38
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
21 months agodisplay: add function for broadcasting pmlock state 80/287780/7
Yunhee Seo [Mon, 6 Feb 2023 05:14:50 +0000 (14:14 +0900)]
display: add function for broadcasting pmlock state

Add functions to inform/get pmlock state.
When the pmlock node is changed(locked or unlocked), signal will be emitted.
Also, It is possible to get pmlock state with below dbus method.

1. Get pmlock lock state
path: /Org/Tizen/System/DeviceD/Display
interface: org.tizen.system.deviced.display
member: PmlockGetLockState
parameter: "(i)", power lock type to get lock status of pmlock state
return: "(i)", value which means locked or unlocked of pmlock state

Change-Id: I35fe5e882cc22616190a56d18155fcde7aa1b968
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
21 months agopower: clarify notion of action callback function 52/287552/5
Youngjae Cho [Tue, 31 Jan 2023 09:06:59 +0000 (18:06 +0900)]
power: clarify notion of action callback function

The callback, action_for_state(), now denotes jobs that are necessary
before the target state, that is, it is kind of to-do list for entering
the state.

To this end, the name has been slightnly changed from action_on_state(),
which implies it is invoked right 'after' the state change, to
action_for_state(), which emphasizes it is invoked 'before' the state.

In addition, the position where the variable 'current' is updated has
been relocated to fit into the concept of action_for_state(). That is,
it is updated after the callback.

Change-Id: I47698ce9147c155c0d5e30feed0a60d65d69031b
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
21 months agopower: introduce transition cancelling 26/287126/5
Youngjae Cho [Fri, 20 Jan 2023 06:25:07 +0000 (15:25 +0900)]
power: introduce transition cancelling

Cancelling transition reserves a new transition that undoing the ongoing
transition. That is, the power state will return to the previous state
after finishing the ongoing transition. Additionally with that
reservation, it discards all the pending transitions except one that is
to the poweroff/reboot/exit state.

Change-Id: Ib05841fa91162109db1c05b2f5e0a3e7edd3b90c
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
21 months agopower: change variable name for clear meaning 51/287551/3
Youngjae Cho [Thu, 26 Jan 2023 02:35:27 +0000 (11:35 +0900)]
power: change variable name for clear meaning

Change-Id: Ib6342fa303d95a8597a08cb4a1f483f390dc9b75
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
21 months agousb-gadget: Handle more than one extcon reporting USB cable 62/287062/3
Marek Szyprowski [Thu, 19 Jan 2023 07:30:10 +0000 (08:30 +0100)]
usb-gadget: Handle more than one extcon reporting USB cable

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: I0c26ac4ecb13f1cd6d0c464a105e1e333b411806

21 months agotools: devicectl: add handling code to return check 33/287333/3 accepted/tizen/unified/20230206.093845 accepted/tizen/unified/20230206.094000
Yunhee Seo [Fri, 27 Jan 2023 01:35:06 +0000 (10:35 +0900)]
tools: devicectl: add handling code to return check

Add handling code to resolve issue reported by static analysis.

Change-Id: I357c4169783b51423c6216a8b7808fbc051bce44
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
21 months agopower: add handling code to return check 23/287323/2
Yunhee Seo [Thu, 26 Jan 2023 11:19:11 +0000 (20:19 +0900)]
power: add handling code to return check

Add handling code to resolve issue reported by static analysis.

Change-Id: I960daea8e8c670579bf2ab0b98cfb5a5842a9b68
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
21 months agoplugin: iot-headless: input: add handling code to return check 22/287322/3
Yunhee Seo [Thu, 26 Jan 2023 11:03:28 +0000 (20:03 +0900)]
plugin: iot-headless: input: add handling code to return check

Add handling code to resolve issue reported by static analysis.

Change-Id: Ice9db999cfbd4de35de504dd773fa782a61eca51
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
21 months agoplugin: iot-headless: display: add handling code to return check 21/287321/2
Yunhee Seo [Thu, 26 Jan 2023 10:50:04 +0000 (19:50 +0900)]
plugin: iot-headless: display: add handling code to return check

Add handling code to resolve issue reported by static analysis.

Change-Id: I761e84429ad3372a029a7daedd2ef430a1472c23
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
21 months agoinput: add handling code to avoid memory leak issue 93/287293/2
Yunhee Seo [Thu, 26 Jan 2023 07:36:54 +0000 (16:36 +0900)]
input: add handling code to avoid memory leak issue

Clean-up the reported issue by static analysis.

Change-Id: I474f8974943b74eec769a6dfd2c7199261d6155d
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
21 months agoinput: add DEVICE_INPUT_TYPE_ALL enum type handling
Yunhee Seo [Wed, 18 Jan 2023 02:12:43 +0000 (11:12 +0900)]
input: add DEVICE_INPUT_TYPE_ALL enum type handling

Add DEVICE_INPUT_TYPE_ALL handling code which was omitted.
With this, it is possible to get all kinds of device ids.

Change-Id: I24a6f4706214fb2963ac6e7a4ad3ae8a4ff58ffb
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
21 months agotouchscreen: clean-up uninitialized variable warning by static analysis
Yunhee Seo [Thu, 19 Jan 2023 06:24:23 +0000 (15:24 +0900)]
touchscreen: clean-up uninitialized variable warning by static analysis

Add return code to avoid reaching uninitialized enum variable "state".

Change-Id: Idce5e24bc2c979c350629b8e413494dd62003cf5
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
21 months agoinput: clean-up the useless code and add handling code 04/286904/3
Yunhee Seo [Mon, 16 Jan 2023 11:07:13 +0000 (20:07 +0900)]
input: clean-up the useless code and add handling code

add detecting existence of config file and parsing fail condition,
also added input device manager exit condition check
remove useless header line

Change-Id: I16e5e3c82947f444251156e3305067d536a0ece7
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
21 months agoinput: clean-up the reported warning by static analysis 98/286898/6 accepted/tizen/unified/20230118.172020
Yunhee Seo [Mon, 16 Jan 2023 09:57:51 +0000 (18:57 +0900)]
input: clean-up the reported warning by static analysis

improve code reported warning by static analysis
to avoid memory leak, build warning, unexpected return value issues

Change-Id: Ic9c3435c6515e645b52cdbc5feca223f918f6443
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
21 months agoinput: add the dbus interface and input config parser 47/286547/11 accepted/tizen/unified/20230117.140510
Yunhee Seo [Mon, 9 Jan 2023 14:18:46 +0000 (23:18 +0900)]
input: add the dbus interface and input config parser

Add input device information dbus methods
Input event on/off option can be handled by device id number.
With config file, user can set the customed input devices
and input-parser will mananging input devices from it.

[InputDeivce] format which is in input.conf
InputDeviceType -> hal_deivce_input_type
InputDeviceId -> id number which exist under the /sys/class/input/inputXX path
InputDeviceName -> device name
InputDeviceDefault -> yes/no

Input dbus methods
1. Get input devices
    path: /Org/Tizen/System/DeviceD/Input
    interface: org.tizen.system.deviced.input
    member: InputGetDevices
    parameter: "(i)", input device type to get device id list
    return: "(ai)", get int device id list on success, empty list on error.

2. Get default device
    path: /Org/Tizen/System/DeviceD/Input
    interface: org.tizen.system.deviced.input
    member: InputGetDefaultDevice
    parameter: "(i)", input device type to get default devicd id
    return: "(i)", get device id value on success, negative on error.

3. Get device name
    path: /Org/Tizen/System/DeviceD/Input
    interface: org.tizen.system.deviced.input
    member: InputGetDeviceName
    parameter: "(i)", input device id to get device name
    return: "(is)", (ret_val, ret_dev_name)
        negative ret_val means error, otherwise success.

Change-Id: I0977c29f538f432cb5ab82e610130698ce7ad5b9
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
22 months agodisplay: remove rotation dbus method in headless profile 05/286405/5 accepted/tizen/unified/20230110.164119
TaeminYeom [Thu, 5 Jan 2023 08:13:41 +0000 (17:13 +0900)]
display: remove rotation dbus method in headless profile

Display rotation API cannot be used in headless profile
because display feature is false.
So, these methods should be removed.

removed dbus method:
  dbus_getrotationangle
  dbus_setrotationangle

Change-Id: I10c029136f5e2fa456aac8f839c4dab3532fa1f2
Signed-off-by: TaeminYeom <taemin.yeom@samsung.com>
22 months agodisplay: Add init direction in rotation angle 09/286309/8
TaeminYeom [Tue, 3 Jan 2023 10:53:48 +0000 (19:53 +0900)]
display: Add init direction in rotation angle

init direction means the display direction of degree 0.
It is needed to know physical display state by app.

When deviced boot, it parses the conf file "/etc/deviced/display.conf"
and it saves the initial display is horizontal or vertical.

changed dbus method:
dbus_getrotationangle
  path: "/Org/Tizen/System/DeviceD/Display"
  interace: "org.tizen.system.deviced.display"
  member: "GetRotationAngle"
  paremeter: "(i)", display index to get rotation angle.
  return: "(iii)", 0 on success, negative on error.
enum display rotation angle to get.
enum display initial direction.

added configuration property:
  DisplayInitDirection : "horizontal" or "vertical"

Change-Id: I9a45d06b712a04d79e8614bac5880d4be6fe4fd3
Signed-off-by: TaeminYeom <taemin.yeom@samsung.com>
22 months agopower: apply suspend to ram by echo mem 60/286260/5 accepted/tizen/unified/20230104.172227
Youngjae Cho [Tue, 3 Jan 2023 02:33:31 +0000 (11:33 +0900)]
power: apply suspend to ram by echo mem

Change-Id: Ia68f749de8010ba7fbbb0ae8a29ec8f6d6de7ccf
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
22 months agopower: move broadcast suspend/resume into power module 43/286243/2
Youngjae Cho [Mon, 2 Jan 2023 10:58:27 +0000 (19:58 +0900)]
power: move broadcast suspend/resume into power module

Change-Id: I3a9499947866716154dadc1a415578630c60ad7b
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
22 months agoinput: relocate dbus interface initialization 19/286219/6
Yunhee Seo [Mon, 2 Jan 2023 02:11:11 +0000 (11:11 +0900)]
input: relocate dbus interface initialization

Previous input dbus interface was initialized by input plugin part.
Thus, input dbus interface initialization part is moved to core input module.

Change-Id: Ie786e15b49b20d30e35719e5f5f26dd0a492a4e8
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
22 months agodevicectl: add suspend/resume command 79/286079/2 accepted/tizen/unified/20230103.054905
Youngjae Cho [Tue, 27 Dec 2022 08:25:51 +0000 (17:25 +0900)]
devicectl: add suspend/resume command

Usage: devicectl power suspend|resume reason(int)
 #) devicectl power suspend 12345
 #) devicectl power resume 2000

The value reason can be an any integer and the devicectl doesn't test
it is valid reason or not. Therefore some listeners of suspend/resume
event might malfunction as they receive a wierd reason.

Change-Id: I62c66e0a8034f9884fd006404991330902ecca21
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>