platform/core/system/deviced.git
10 months agobitmap: Replace bitmap with that of the libsyscommon 86/295986/2
Youngjae Cho [Mon, 17 Jul 2023 01:19:26 +0000 (10:19 +0900)]
bitmap: Replace bitmap with that of the libsyscommon

Change-Id: I701b7102f466f6f16dae6ce499fc04a0218b5c68
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
10 months agodisplay: Add omitted code to display-panel 23/295923/1
Yunhee Seo [Mon, 17 Jul 2023 07:50:23 +0000 (16:50 +0900)]
display: Add omitted code to display-panel

Add lcd_on_timeval initizalization code.
Because of this, the reset timeout value calculation was not accurate.

Change-Id: I2361ed311da06589911e456481977d87426971fb
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
10 months agodisplay: Remove duplicated display_exit codes 28/295828/2
Yunhee Seo [Fri, 14 Jul 2023 06:47:46 +0000 (15:47 +0900)]
display: Remove duplicated display_exit codes

display all plugins follow same display_exit logic.
There is no need to keep same logic code except specific profile code logic.
Thus display_exit() logic is moved to display.c.

Change-Id: I48b00e9289dbac9adc14b7d619f7e5f3ff81b853
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
10 months agodisplay: Relocate display hal-backend loader/unloader 27/295827/2
Yunhee Seo [Fri, 14 Jul 2023 07:25:10 +0000 (16:25 +0900)]
display: Relocate display hal-backend loader/unloader

display_service_load/display_service_free() is used as display hal-backend loader/unloader.
However, display core should treat hal-backend using during display probe,exit process.
Thus, display_service_load/display_service_free() are removed.

Also, display_set_hal_backend_available() is removed.
Because display core(display.c) only decides whether the display hal-backend using or not.

Change-Id: I6533145b0d558c2bae831eee1ea04ab313f286ac
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
10 months agodisplay: Relocate display initialization code 07/295807/6
Yunhee Seo [Thu, 13 Jul 2023 03:44:35 +0000 (12:44 +0900)]
display: Relocate display initialization code

Except for a specific profile, unnecessarily duplicated codes are erased.
And same code is moved to display.c.

Change-Id: I35c6e0693fb1e9581ecefa1f03db9fa71681084f
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
10 months agodisplay: Remove poll.c 06/295706/4
Yunhee Seo [Wed, 12 Jul 2023 10:06:31 +0000 (19:06 +0900)]
display: Remove poll.c

poll.c file has legacy functions pm_change_internal/pm_lock_internal/pm_unlock_internal()
These functions are usually called from external requests like key-event, dbus method, etc.
pm_lock_internal/pm_unlock_internal() gets specific display state lock/unlock.
pm_change_internal() requests state transition according to specific condition.
This file has to be erased, and then inner functions are relocated.

These are new functions to be added.
display-lock
- int display_lock_request_lock_with_option(pid_t pid, int s_bits, int flag, int timeout);
- int display_lock_request_unlock_with_option(pid_t pid, int s_bits, int flag);
    -> These replace pm_lock_internal/pm_unlock_intenral().

display-state-transition
- int display_state_transition_request_state_transition_with_option(pid_t pid, int s_bits);
    -> This replaces pm_change_internal().

display-util
- int display_util_get_display_state(int s_bits);
    -> This extracts display state from s_bits.

Change-Id: Ied90f5a7f132f3bfcba1ecf1eef8faa02c728e31
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
10 months agodisplay: Remove unncessary display_backlight_get_brightness_by_plugin_profile() 35/295635/2 accepted/tizen/unified/20230714.164920 accepted/tizen/unified/riscv/20230718.003638
Yunhee Seo [Tue, 11 Jul 2023 10:23:49 +0000 (19:23 +0900)]
display: Remove unncessary display_backlight_get_brightness_by_plugin_profile()

As display functions are relocated and refactored, this function became unnecessary.

Change-Id: Id0ef55c6f116bc8cba3db97c4487c6e67cbeee5c
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
10 months agodisplay: Refactor display_plugin_get_device_flags() 34/295634/2
Yunhee Seo [Tue, 11 Jul 2023 09:30:52 +0000 (18:30 +0900)]
display: Refactor display_plugin_get_device_flags()

To make display-plugin independent without any other file dependence,
display_plugin_get_device_flags() is refactored.

This function is added to display-util
- int display_util_get_device_flags(unsigned long *device_flags);
    -> This function sets display flag value and return.

Change-Id: I1ad7f1ebb3838a0bca7aa74623f9e6ee3da4299a
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
10 months agodisplay: Relocate delayed_init_done 33/295633/2
Yunhee Seo [Mon, 10 Jul 2023 06:28:18 +0000 (15:28 +0900)]
display: Relocate delayed_init_done

delayed_init_done is used from all plugins with the same logic.
This function is used to unlock INTERNAL_LOCK_BOOTING after display initialization.
Because INTERNAL_LOCK_BOOTING is caught while display is initialized.

Thus, delayed_init_done is moved to display.c

Change-Id: Id6e23dd5b10de8d20edce22715972a829c95b49e
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
10 months agodisplay: Remove util.h/plugin-common 32/295632/2
Yunhee Seo [Mon, 10 Jul 2023 02:40:35 +0000 (11:40 +0900)]
display: Remove util.h/plugin-common

util.h is used from display plugins for Power manager logging.
The concept of power manager that exist as legacy while refactoring
should be eliminated.
By deleting util.h, the dependency problem is solved and the plugin-common
is also erased.
Also, util.h can be replaced by display-util.h and log.h in the display core.

Change-Id: Ic9630ff0a8ef50190d1abab9ce5a86956b714c8a
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
10 months agopower: Remove unsafe function 63/294963/5 accepted/tizen/unified/20230710.153956
Yunhee Seo [Thu, 29 Jun 2023 06:25:15 +0000 (15:25 +0900)]
power: Remove unsafe function

To resolve build warning, strncpy is replaced by snprintf.

Change-Id: I780b09d61807f889991c89766c3560c097bc509b
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
10 months agodisplay: Fix static analysis issue 62/294962/4
Yunhee Seo [Thu, 29 Jun 2023 06:04:32 +0000 (15:04 +0900)]
display: Fix static analysis issue

Fix logical error code

Change-Id: I8fe1338ac833385577ea8e515745d8a44c226b63
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
10 months agodisplay: Relocate display-dbus.c to core 61/294961/5
Yunhee Seo [Thu, 29 Jun 2023 05:36:23 +0000 (14:36 +0900)]
display: Relocate display-dbus.c to core

As remove dependecies, display-dbus.c is relocated to display core side.

Change-Id: Ia46963a15f27e99c0e3cb2402af3a50cb934e96c
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
10 months agoAdd ISU package 27/294127/7
Adam Michalski [Tue, 13 Jun 2023 15:52:56 +0000 (17:52 +0200)]
Add ISU package

The following changes have been made for ISU:
* isu/isu.cfg - ISU configuration file.
    [isu] section:
        `name` and `version` have been filled by using the #NAME# and #VERSION#
        patterns that in turn will be replaced by the `%isu_package` RPM macro
        into the name and version of the RPM package.
        `system_service` is the systemd service name and must be the same as the
        original one.
    [files] section:
        contains a list of all files that should be added to the ISU package.
        Since we only want to replace the binary, there is only one file here.
* isu/deviced.service - modified ISU service file.
    Compared to the original 'deviced.service' the following changes have been
    made for ISU:
    - `EnvironmentFile=/etc/isu/service-common.inc` - to include ISU-specific
      variables
    - `ExecStart=` has been changed to launch sandbox application with default
      parameters (`ISU_SANDBOX_INVOCATION`), ISU-provided
      `#ISU_RUN_PATH#/deviced/rootfs/usr/bin/deviced` is visible as
      `/usr/bin/deviced` in the sandbox
    - `NotifyAccess=all` has been set as there is one intermediate process
      (`isu-sandbox`) between `systemd` and `/usr/bin/deviced`
* isu/CMakeLists.txt - CMake config file for the ISU.
    Added installing ISU config file and the service file to the appropriate
    locations (/etc/isu/*)
* CMakeLists.txt - main config file for CMake.
    We've added the `isu` subdirectory where we placed the isu configuration
    file and the modified service file that will run `dlog` in a sandboxed
    environment.
* packaging/deviced.spec - main `deviced` RPM spec file.
    We've made the following changes:
    - added `Requires: %{name}-isu = %{version}-%{release}` tag in the main
      spec section which will cause the ISU package to be installed when the
      original package is installed.
    - added the `%isu_package` macro invocation right before the `%prep` section
      which will cause the configuration to be placed in the correct location
      with all ISU-related files packaged into the `*-isu` RPM package.

Change-Id: Ib4ede1ff59a0a6be23b7414926672e772c2ac1d5

10 months agodisplay: Remove display_info interface
Yunhee Seo [Wed, 28 Jun 2023 07:44:59 +0000 (16:44 +0900)]
display: Remove display_info interface

display_info interface is only used in the wearable plugins.
Thus there is no reason why display_info should exist in all display plugins.
Furthermore, it is hard to figure out above interface usage and role.
Delete display_info to eliminate the dependence between core and display plugins.

During refactoring, the wearable plugin codes must be cleaned up later.

Change-Id: I3caa44fb213cd70416435b02214f0bc0c26edddd
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
10 months agoFix the build error using gcc 13 accepted/tizen_unified_dev accepted/tizen/unified/dev/20230726.115933
SangYoun Kwak [Tue, 4 Jul 2023 07:59:41 +0000 (16:59 +0900)]
Fix the build error using gcc 13

In the function "cfs_set_gadget_config" from
src/usb-gadget/usb-gadget-cfs-ops.c, it concatenates two strings and
stores it into a buffer(named instance) using snprintf.

In this situation, the gcc-13 compiler complains about: the length of
concatenated string can be greater than the size of the buffer, so
it should be handled.

It is already handled by checking the length of the two strings but the
compiler don't know about it.

To fix this situation, codes for checking the return value of snprintf
have been added.

Change-Id: I6195e72dd2f88bfeb72fb53b19227d2e08d03afb
Signed-off-by: SangYoun Kwak <sy.kwak@samsung.com>
10 months agodisplay: Relocate lcd_uevent_changed() 87/294887/3
Yunhee Seo [Wed, 28 Jun 2023 05:37:42 +0000 (14:37 +0900)]
display: Relocate lcd_uevent_changed()

lcd_uevent_ops is registered from all display plugin initialization.
It controls touchscreen_ops stop/start through uevent.
All the plugins have same lcd_uevent_changed() logic.
Thus it is relocated to display core.

Change-Id: Ie42b11f6f20e77463ea81dcf72aee662d368c5d5
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
10 months agodisplay: Relocate __device_flags_to_string() from plugins to core 71/294871/4
Yunhee Seo [Wed, 28 Jun 2023 04:09:03 +0000 (13:09 +0900)]
display: Relocate __device_flags_to_string() from plugins to core

__device_flags_to_string() is used for getting string name according to device_flags.
These functions have same logic, thus it is relocated to display-util.

This function is added to display-util.
- int display_util_get_device_flags_name(enum device_flags flags, const char **flag_name);
    -> It replaces __device_flags_to_string().

Change-Id: Ia84ae6d7ff71419e22b700c12a7bca4e76413293
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
10 months agodisplay: Relocate SIGHUP handler 70/294870/4
Yunhee Seo [Wed, 28 Jun 2023 02:12:33 +0000 (11:12 +0900)]
display: Relocate SIGHUP handler

When the deviced gets SIGHUP, display calls pm_save_logdump().
Move SIGHUP handler to the core because there is no reason for the same handler to exist
in the all plugins.

Change-Id: I794de3869520229ef87c8c6a4b4e3d3695d82214
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
10 months agodisplay: Remove check_seed_status() 29/294829/5
Yunhee Seo [Tue, 27 Jun 2023 07:30:45 +0000 (16:30 +0900)]
display: Remove check_seed_status()

The check_seed_status() name and role is unclear.
Thus it is removed and devided to 3 funcs.

These functions are added to display core.
- void display_set_initial_brightness(void);
    -> It checks default brightness and set initial brightness value.
- void display_set_initial_battery_flag(void);
    -> It checks battery status and set battery status to pm_status_flag.
- void display_set_initial_lockscreen_status(void);
    -> It checks lockscreen state and set initial lockscreen timeout value.

To relocate these, this function is added to display-plugin.
- int display_plugin_config_get_pm_default_brightness(int *pm_default_brightness);

Change-Id: Ia1be19b5c0d5643e42c5c56a5b8df9483d25ad9b
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
10 months agodisplay: Relocate poll.c from display/plugin-common to display core 09/294809/6
Yunhee Seo [Tue, 27 Jun 2023 02:29:26 +0000 (11:29 +0900)]
display: Relocate poll.c from display/plugin-common to display core

To devide display/plugin-common and display core, all plugin-common files should be moved to core.
By eliminating dependence, poll.c relocation has become possible.

Change-Id: I6fa77229f23b16ff0ac89e8790aa020d8f9566b9
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
10 months agodisplay: Remove poll_callback() from all display plugins 08/294808/6
Yunhee Seo [Tue, 27 Jun 2023 02:02:25 +0000 (11:02 +0900)]
display: Remove poll_callback() from all display plugins

The role of poll_callback() is only causing transition according to the conditions.
To replace this function, poll_callback() is separated into two funcs and added.

These are added to display-state-transition.
- int display_state_transition_do_state_transition_by_input_poll_event(void);
- int display_state_transition_do_state_transition_by_pm_control_event(PMMsg *data);
    -> It causes display state transition by a specific trigger condition.

To refactor these functions, this function is also added to display.
- bool display_is_display_ops_started_status(void);
    -> It checks if display ops status is DEVICE_OPS_STATUS_START or not.

Change-Id: I3833e7881101bfd81c7855b14ffdf4aa74a590bf
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
10 months agodisplay: Relocate proc_condition_funcs() 01/294801/5
Yunhee Seo [Mon, 26 Jun 2023 07:15:28 +0000 (16:15 +0900)]
display: Relocate proc_condition_funcs()

There are three functions to get display lock, unlock, state transition by external request.
proc_condition_lock()/proc_condition_unlock()/proc_condition()
Those functions rules are all the same, so they are relocated.

This function is added to display-lock.
- int display_lock_proc_condition(PMMsg *data);

Change-Id: I10dc0f14d3e7b2bc52a0c11fb1e256c986191eec
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
10 months agodisplay: Relocate default_proc_change_state()/default_proc_change_state_action() 00/294800/5
Yunhee Seo [Mon, 26 Jun 2023 07:29:40 +0000 (16:29 +0900)]
display: Relocate default_proc_change_state()/default_proc_change_state_action()

Above two functions are used for display-lock related functions.
default_proc_change_state_action() sets pm_cur_state and occurs state_action.
default_proc_change_state() occurs next state action when the specific condition is met.

These functions are added to display-plugin.
- bool display_plugin_state_is_there_proc_change_state(void);
- int display_plugin_state_proc_change_state(unsigned int cond, pid_t pid);

These functions are added to display-state-transition.
- void display_state_transition_do_proc_change_state_action(enum state_t next, int timeout);
- int display_state_transition_do_proc_change_state(unsigned int cond, pid_t pid);

Newly added functions should also be refactored.

Change-Id: I85476642bb4b4c4fc5c607ce6ce0591736d1a014
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
10 months agodisplay: Remove battery plugin using from display plugin 56/294756/5
Yunhee Seo [Mon, 26 Jun 2023 05:38:31 +0000 (14:38 +0900)]
display: Remove battery plugin using from display plugin

display plugin used get_charging_status() from initialization steps.
To use that function, display plugin loaded battery plugin.
However, that function is not exist in the battery plugin.
Thus, that function loading and accessing is useless work.

Also, loading battery plugin from the display plugin structure should be removed.

This function is added to display-misc.
- void display_misc_set_battery_charging_status_flag(void);
    -> It checks battery charging status and sets CHRGR_FLAG.
    -> This function should be relocated during battery plugin refactoring.

Change-Id: I943768785b654a660982a3017cafd0e41b7b94ed
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
10 months agodisplay: Relocate auto-brightness.c from display core to wearable plugin 55/294355/3
Yunhee Seo [Fri, 16 Jun 2023 08:10:30 +0000 (17:10 +0900)]
display: Relocate auto-brightness.c from display core to wearable plugin

The function of auto-brightness.c is only used by wearable plugin.
Thus auto-brightness.c file is moved to wearable/display module.

Change-Id: I301801f9325d6a09969070499a14dd0c38b0ba17
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
10 months agodisplay: Relocate update_setting() from plugins to core 13/294313/3
Yunhee Seo [Fri, 16 Jun 2023 03:41:49 +0000 (12:41 +0900)]
display: Relocate update_setting() from plugins to core

update_setting() is called from display init() and it updates pm related setting.
Actually, this function does a lot of work according to the incoming key value.
Also, it is necessary to change the initialization way, so it will be refactored after relocation.

To relocate, wrapper functions are added below display-plugin.
- bool display_plugin_is_there_update_pm_setting(void);
- int display_plugin_is_lcd_on_blocked(void);
- int display_plugin_set_power_save_mode_flag(int onoff);
    -> This wrapper is added for wearable plugin.

New function is added below display/setting
- int display_setting_update_pm_setting(int key_idx, int val);
    -> This is temporary function, it will be refactored.

Change-Id: I90564168f72df733e887e231fa8262a7a83f86ac
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
10 months agodisplay: Relocate set_lcd_timeout()/reset_lcd_timeout() 73/294273/4
Yunhee Seo [Thu, 15 Jun 2023 07:51:24 +0000 (16:51 +0900)]
display: Relocate set_lcd_timeout()/reset_lcd_timeout()

set_lcd_timeout(), reset_lcd_timeout() is only used by dbus_setlcdtimeout call.
However, it is unclear where it is being used.
Furthermore, those functions' work flow overlap with set custom timeout, state transition.

Thus, these functions are moved to display-dbus.c
After that, it will be refactored.

Change-Id: Iad32a524cc4fc8d8548258766236921be22dc94f
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
10 months agodisplay: Relocate delayed_dpms_init_done() from plugins to core 71/294271/4
Yunhee Seo [Thu, 15 Jun 2023 07:25:10 +0000 (16:25 +0900)]
display: Relocate delayed_dpms_init_done() from plugins to core

During display init, it is necessary to add a timer to wait for dpms initialization.
Also, that work should be handled in the display.c

Thus, this function is added below display.c
void display_add_timer_for_wating_dpms_init(void);
    -> This replaces add_timer_for_dpms_init()

Change-Id: Icfcc248b54899608a6a0c483df0ae572e0112798
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
10 months agodisplay: Relocate power_saving_func() from plugins to core 64/294264/4
Yunhee Seo [Thu, 15 Jun 2023 07:08:12 +0000 (16:08 +0900)]
display: Relocate power_saving_func() from plugins to core

power_saving_func() sets PWRSV_FLAG.
Actually, this work should be moved to display.c

This function is added below display.c
- void display_set_power_save_mode_flag(int onoff);
    -> This replaces power_saving_func()

Change-Id: I9e803ab97ab02b9ddf64519aadd6c373167d0aa4
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
10 months agodisplay: Relocate power related static function from plugins to core 63/294263/3
Yunhee Seo [Thu, 15 Jun 2023 06:55:28 +0000 (15:55 +0900)]
display: Relocate power related static function from plugins to core

power_resume_from_echomem_callback(), poweroff_triggered_callback()
These power notifier callback should be registered/unregistered from display.c

There is no reason to exist in plugins.
It is desirable to be managed in display.c

Change-Id: I0d9078bb7e48d05d40a752a071153c74898db890
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
10 months agodisplay: Relocate display_on/off_by_reason() 28/294228/4
Yunhee Seo [Wed, 14 Jun 2023 11:08:52 +0000 (20:08 +0900)]
display: Relocate display_on/off_by_reason()

display_on/off_by_reason() is used by dbus_changestatebyreason call.
1. Set display on/off reason to the flag.
2. Check if it is possible to go to lcd_on/off procedure.
   If possible, go to the lcd on/off procedure.
3. After that, update current, before display state and do action about S_NORMAL/S_LCDOFF.

For relocating these, the string of device operation declaration has also been moved to shared/devices.h
There is no reason for the same string to exist in all plugins.

New functions are added below display-panel.
- int display_panel_display_turn_on_by_reason(const char *reason, int timeout);
- int display_panel_display_turn_off_by_reason(const char *reason);
    -> These replace display_on/off_by_reason()

Change-Id: Ia22ee6295fa138c3742be62c3bbc2c357716caf5
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
10 months agodisplay: Relocate custom_lcd_on/off() 27/294227/3
Yunhee Seo [Wed, 14 Jun 2023 11:02:40 +0000 (20:02 +0900)]
display: Relocate custom_lcd_on/off()

custom_lcd_on/off() is used by dbus_customlcdon/off call.
These update custom timeout value and go to S_NORMAL/S_LCDOFF display state.

New functions added below display-panel.
- int display_panel_custom_lcd_on(int timeout);
- int display_panel_custom_lcd_off(enum device_flags flag);
    -> These replace custom_lcd_on/off().

Change-Id: Ie6e28ade1a05212f97c4feb87ea70955ff2cddc0
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
10 months agodisplay: Relocate lcd_on_direct() 02/294202/6
Yunhee Seo [Wed, 14 Jun 2023 07:17:34 +0000 (16:17 +0900)]
display: Relocate lcd_on_direct()

lcd_on_direct() is used to lcd turn on directly by key-event, proc_change_state.. etc.
It is called under the specific condition.

To relocate lcd_on_direct(), update_display_locktime() is also relocated.

For wearable plugin, this wrapper is added.
- int display_plugin_lcd_on_procedure(int state, enum device_flags flag);

New functions are added below display-state-transition
- void display_state_transition_update_lock_screen_timeout(int timeout);
    -> This function sets lock screen timeout value and update.
       It replaces update_display_locktime()

New function is added below display-panel
- void display_panel_lcd_on_direct(enum device_flags flags);
    -> This replaces lcd_on_direct()

Change-Id: I5628e230ec0fcc9a0ff36b31966ffbda85d92d69
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
11 months agodisplay: Refactor display lock 03/294303/5
Youngjae Cho [Fri, 16 Jun 2023 01:39:49 +0000 (10:39 +0900)]
display: Refactor display lock

Hide display_lock data, which was PmLockNdoe before, into display-lock.c.
And display-lock.c has changed to support and can be controlled only by
the below functions.

---------------------------------------------------------------------
 Removed                       | Newly Added
---------------------------------------------------------------------
 display_lock_add_pmlock_node  | display_lock_request_lock
---------------------------------------------------------------------
 -                             | display_lock_update_lock
---------------------------------------------------------------------
 del_node                      | display_lock_release_lock
---------------------------------------------------------------------
 delete_condition              | display_lock_release_lock_all
---------------------------------------------------------------------
 check_processes               | -
---------------------------------------------------------------------
 get_trans_cnodition           | -
---------------------------------------------------------------------
 makeup_trans_condition        | -
---------------------------------------------------------------------
 check_lock_state              | display_lock_is_state_locked
---------------------------------------------------------------------

Change-Id: I82de53ecfbc4119bc6de5b030342859f8fb6ed9c
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
11 months agodisplay: Make diaplay lock data private 12/294112/5
Youngjae Cho [Tue, 13 Jun 2023 07:50:59 +0000 (16:50 +0900)]
display: Make diaplay lock data private

Changed list name 'cond_head' to 'g_display_lock_list'. Previously, the
list had been exposed to another module using get_cond_head(). Remove
the function to protect the data from being accessed oustide of the
display-lock.c. Instead, the display-lock.c now provides services that
the other module has done using get_cond_head(). Currently, the only
below function has been added for display-misc.c.
 - display_lock_print_lock_info()

All existing get_cond_head() has been replaced by proper functions.

Change-Id: I4e4603f44c6613d71bb0b1e05abe6d45ae4a39c5
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
11 months agodisplay: Remove unused holdkeyblock code 85/294085/6
Youngjae Cho [Tue, 13 Jun 2023 03:36:07 +0000 (12:36 +0900)]
display: Remove unused holdkeyblock code

Change-Id: I28ad71cca7b84f459adf333765ac213e6eb31929
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
11 months agodisplay: Relocate default_action() 43/294143/5
Yunhee Seo [Wed, 14 Jun 2023 01:54:25 +0000 (10:54 +0900)]
display: Relocate default_action()

For relocating default_action(), there are some changes.

1. Add device_ops_status getter/setter temporarily.
2. Add lcd on time update and calculation functions.
3. Remove state action functions from the display-plugin.
   -> Since default_action() has relocated, these functions no longer need to exist.

New functions in the display
- void display_set_display_ops_status(enum device_ops_status dev_ops_status);
- int display_get_display_ops_status(enum device_ops_status *dev_ops_status);
    -> device_ops_status is set during the display init, probe, exit...

New functions in the display-panel
- void display_panel_update_lcd_on_timeval(void);
- int display_panel_calculate_diff_time_between_lcd_on_direct_and_state_action(int *diff_time);
    -> These functions update lcd_on time and caculate the time difference
       between lcd_on_direct and do_state_action.

New function in the display-state-transition
- int display_state_transition_do_state_action(int timeout);
    -> This function is usually called after the display state changed.
       It handles the rest of the work for changed display state.

Change-Id: If6ccd5f5cbcae21ed87db473596bdc3c71ddb86f
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
11 months agodisplay: Remove unused killable-daemon code 00/294200/2
Youngjae Cho [Wed, 14 Jun 2023 06:38:34 +0000 (15:38 +0900)]
display: Remove unused killable-daemon code

Change-Id: Idffac4921c3b147ec3fced2525c92eb8e3444f52
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
11 months agoinput: Simplify input_plugin_init()/input_plugin_exit() 24/294124/1
Youngjae Cho [Tue, 13 Jun 2023 11:15:19 +0000 (20:15 +0900)]
input: Simplify input_plugin_init()/input_plugin_exit()

Change-Id: Ifaf1a2e359b8f639a05836e32ff351b58940ffae
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
11 months agoMerge "display: Relocate lcd_on/off_procedure()" into tizen
Chanwoo Choi [Tue, 13 Jun 2023 09:04:54 +0000 (09:04 +0000)]
Merge "display: Relocate lcd_on/off_procedure()" into tizen

11 months agoMerge "display: Relocate touch_event_blocked()" into tizen
Chanwoo Choi [Tue, 13 Jun 2023 09:04:52 +0000 (09:04 +0000)]
Merge "display: Relocate touch_event_blocked()" into tizen

11 months agoMerge "display: Remove lcd_on_expired()/stop_lock_timer()/check_lock_screen()" into...
Chanwoo Choi [Tue, 13 Jun 2023 09:04:50 +0000 (09:04 +0000)]
Merge "display: Remove lcd_on_expired()/stop_lock_timer()/check_lock_screen()" into tizen

11 months agoinput: Define plugin interface for input 63/294063/5
Youngjae Cho [Mon, 12 Jun 2023 09:08:09 +0000 (18:08 +0900)]
input: Define plugin interface for input

Input plugin must implement interface provided by input-plugin-interface.h
with symbol name INPUT_PLUGIN_INTERFACE_SYMBOL. The input core dlopen()
and dlsym() with that symbol, initializing or exiting input plugin within
the deviced core execution.

Change-Id: Id279db971cb0351b609a022de02a51672242c0b6
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
11 months agodisplay: Relocate lcd_on/off_procedure() 07/294107/2
Yunhee Seo [Tue, 13 Jun 2023 02:00:03 +0000 (11:00 +0900)]
display: Relocate lcd_on/off_procedure()

lcd_on/off_procedure() rules are same in all plugins except wearable.
Thus, duplicated codes are removed and relocated to display-panel.

These functions are added below display-panel.
- void display_panel_lcd_on_procedure(int state, enum device_flags flag);
    -> This replaces lcd_on_procedure(), it works to turn on lcd.
- void display_panel_lcd_off_procedure(enum device_flags flag);
    -> This replaces lcd_off_procedure(), it works to turn off lcd.
- bool display_panel_is_lcd_on_state_broadcasted(void);
    -> With this, It is possible to know if the lcd_on/off_procedure() done.
       This is used as flag of lcd on/off process.

This function is added below display-plugin.
- int display_plugin_lcd_off_procedure(enum device_flags flag);
    -> This is for wearable plugin, there is lcd_off_procedure() use case in the key-filter.c

Change-Id: I1a7f8268df4d45d0585fe7c8a93981cc7be4268c
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
11 months agodisplay: Relocate touch_event_blocked() 06/294106/1
Yunhee Seo [Mon, 12 Jun 2023 12:46:48 +0000 (21:46 +0900)]
display: Relocate touch_event_blocked()

touch_event_blocked() checks touch event blocking during lcd_on/off_procedure().
For relocating lcd_on/off_procedure(), touch_event_blocked() is also relocated.

This functions are added below display-misc.
- int display_misc_set_touch_event_blocked(bool blocked);
- bool display_misc_is_touch_event_blocked(void);
    -> This replaces touch_event_blocked()

Change-Id: Icaa609ad4a4e168663dd85556dea2c448b5747bd
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
11 months agodisplay: Remove lcd_on_expired()/stop_lock_timer()/check_lock_screen() 05/294105/1
Yunhee Seo [Mon, 12 Jun 2023 11:43:41 +0000 (20:43 +0900)]
display: Remove lcd_on_expired()/stop_lock_timer()/check_lock_screen()

These functions are used when the EVENT_INPUT occurs from the below situation,
S_SLEEP/S_LCDOFF --> EVENT_INPUT --> S_NORMAL

check_lock_screen() checks lock_screen state, If lock_screen is not launched,
this adds timeout callback for lcd_on_procedure().
stop_lock_timer() removes callback from above description.
lcd_on_expired() is callback for lcd_on_procedure() after timeout.

Simply, that functions checks lock screen status, and then If lock screen is not launched,
go to lcd_on_procedure after timeout value.

However, according to the default_action code logic, it goes to lcd_on_procedure()
regardless of check_lock_screen().
Also, meaningless lcd_on_procedure() call occurs.

Thus, lcd_on_expired()/stop_lock_timer()/check_lock_screen() is removed.

Change-Id: Ie82889e951678260ac10e1b7c86546040aff3fc8
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
11 months agoMerge "input: Remove unused code of input-dbus from plugin" into tizen
Chanwoo Choi [Tue, 13 Jun 2023 02:28:12 +0000 (02:28 +0000)]
Merge "input: Remove unused code of input-dbus from plugin" into tizen

11 months agoinput: Remove unused code of input-dbus from plugin 62/294062/3
Youngjae Cho [Mon, 12 Jun 2023 08:03:04 +0000 (17:03 +0900)]
input: Remove unused code of input-dbus from plugin

Change-Id: I28af8d7611c138eab106b748fea3d9efc38b5e90
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
11 months agodisplay: state-transition: Relocate default_trans() 79/293879/7
Yunhee Seo [Wed, 7 Jun 2023 07:29:32 +0000 (16:29 +0900)]
display: state-transition: Relocate default_trans()

default_trans() was used for display state transition.
1. It gets next display state and checks if the state transition is possible or not.
2. And then, it updates old/current display state.
3. Finally, it goes to next state transition or default_action if possible.

These functions are added below display-state-transition.
- int display_state_transition_do_state_transition(enum state_t state, int evt_type);
    -> This replaces default_trans()
- bool display_state_transition_is_display_state_support_transition(enum state_t state);
    -> This function checks if state is support to do state transition related job.
       For example,
         1. checking state transition condition
         2. do state transition
         3. do state action
    To check these, this function is added.

Change-Id: Icc58965838e30fde2871c1c69596ffbed43e60f2
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
11 months agodisplay: state-transition: Relocate check_lcdoff_direct() 15/293915/4
Yunhee Seo [Thu, 8 Jun 2023 01:49:19 +0000 (10:49 +0900)]
display: state-transition: Relocate check_lcdoff_direct()

check_lcdoff_direct() is used to check if display state can go to S_LCDOFF.
All plugins follows same policy of this function.

Thus, this function is added below display-state-transition.
- bool display_state_transition_is_possible_to_go_lcdoff(void);
    -> This replaces check_lcdoff_direct().

Also, new function is added below display-plugin.
- int display_plugin_config_get_dimming(int *dimming);
    -> It gets dimming config value from the conf file.
To confirm going to S_LCDOFF state, dimming value must also be checked.
So, display_plugin_config_get_dimming() is added too.

Change-Id: I19545fa1d6e7592a938a24e0b130302d88d81e02
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
11 months agodisplay: state-transition: Relocate update_lcdoff_source() 78/293878/4
Yunhee Seo [Wed, 7 Jun 2023 08:34:39 +0000 (17:34 +0900)]
display: state-transition: Relocate update_lcdoff_source()

update_lcdoff_source() is used for setting lcdoff reason.
This function is called when the display state goes to lcdoff state.
Same code was copied and used in all plugins.

Thus, this function is added below display-state-transition
int display_state_transition_update_lcdoff_reason(int source);
-> This function sets the lcdoff reason to VCONFKEY_PM_LCDOFF_SOURCE.

Change-Id: Idc857d4b52502612eaccb01373d984815806a153
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
11 months agodisplay: Remove unused macros 29/293929/1
Yunhee Seo [Thu, 8 Jun 2023 08:16:47 +0000 (17:16 +0900)]
display: Remove unused macros

There are many macros that have not been deleted when certain functions
or codes are deleted before.
Thus, remove unsed macros in the display plugins.

Change-Id: I9a4e2b3b03082bae9fe57021281886651a107444
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
11 months agodisplay: state-transition: Add break statement 28/293928/1
Yunhee Seo [Thu, 8 Jun 2023 06:33:16 +0000 (15:33 +0900)]
display: state-transition: Add break statement

Add missing break statement for code improvement,
It is reported by svace/coverity code analysis.

Change-Id: If73d9b09de7cd6f2885be38938a80213c62e4c53
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
11 months agoinput: Make core be responsible for parsing instead of plugin 48/293748/9
Youngjae Cho [Thu, 1 Jun 2023 10:00:57 +0000 (19:00 +0900)]
input: Make core be responsible for parsing instead of plugin

 Previously, The input core was just polling input event, and plugin
was responsible for parsing and handling that event. The 'parsing' here
means converting libinput data structure into that of the deviced. All
plugins had followed same parsing logic, which had been able to become
a part of the core module. Therefore, the input core now has changed to
parse input event as well as polling. To pass parsed event to plugin,
the input core provides two function, which can be utilized by plugin
for registering callbacks.
 - int input_register_event_callback()
 - int input_unregister_event_callback()

With this change, plugin can now only focus on event handling, putting
parsing aside.

Change-Id: I872b22ef5c33c23f9be8b804f4a0dc92848483c9
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
11 months agoearjack: Properly detect initial state if more than one extcon exists 80/292880/4
Marek Szyprowski [Tue, 16 May 2023 09:33:42 +0000 (11:33 +0200)]
earjack: Properly detect initial state if more than one extcon exists

Add the same logic as for USB cable in commit c9dee14b ("usb-gadget:
Handle more than one extcon reporting USB cable") to properly detect
initial jack state if it has been reported by more than one extcon
device.

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

11 months agodisplay: state-transition: Remove default_check() 12/293812/6
Yunhee Seo [Mon, 5 Jun 2023 10:24:02 +0000 (19:24 +0900)]
display: state-transition: Remove default_check()

default_check() was used for checking state transition condition.
If there is any pmlock of the state checked which is not background status,
it is impossible to move next state.
default_check() follows same policy from all plugins.
To move from current display state to next display state, this function is necessary.

Thus, this function is added below display-state-transition.
int display_state_transition_check_state_transition_condition(enum state_t cur_state, enum state_t next_state);

Change-Id: I06adb467ac81a04596f22a7b0fe9b06c3b72d248
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
11 months agodisplay: state-transition: Remove update_display_time() 95/293795/7
Yunhee Seo [Wed, 31 May 2023 06:32:49 +0000 (15:32 +0900)]
display: state-transition: Remove update_display_time()

display states can have various timeout values depending on the policy.
update_display_time() was used for updating timeout values
accoring to the priority.

In this context, display state transition occurs after a "timeout".

This function is added below display-state-transition.
void display_state_transition_update_display_state_timeout_by_priority(void);
-> This updates timeout values depending on the policy.
1. If there are custom timeout values, then updates to that values.
2. If lockscreen is being displayed,
   then the screen timeout value will be set to lock_screen_timeout.
3. Lastly, timeout value will be set to default setting value.

To support this, getter/setter is added for specific timeout values.

Change-Id: I6cf483f17402948546d364a172334a95890238c5
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
11 months agodisplay: Remove set_dim_state() from plugins. 67/293667/5
Yunhee Seo [Tue, 30 May 2023 11:58:47 +0000 (20:58 +0900)]
display: Remove set_dim_state() from plugins.

set_dim_state() was only used in ambient_set_condition().
ambient_set_condition() works at only in the wearable device.
Thus, set_dim_state() is removed from iot-headed/mobile/wearable.
set_dim_state() is changed to static in the wearable plugin.

Change-Id: Ic3882436288e815bb765b9cd471c874246217ace
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
11 months agodisplay: led: Separate touchled control from key-filter 42/293642/3
youngjae [Thu, 1 Jun 2023 10:52:42 +0000 (19:52 +0900)]
display: led: Separate touchled control from key-filter

Request for controlling touchled is now directly delivered to touchled
module instead of being delivered via key-filter. To this end, the
touchled module provides function below.
 - touchled_control_backlight(enum touchled_opt)

Change-Id: I1f90ea18c85bf65f80bdf03d2ef6128c15d99765
Signed-off-by: youngjae <y0.cho@samsung.com>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
11 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>
12 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

12 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>
12 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>
12 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>
12 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>
12 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>