platform/core/system/pass.git
2 years agopmqos: Convert pass-pmqos.conf format to json to improve readability 55/261955/5
Chanwoo Choi [Thu, 29 Jul 2021 12:38:13 +0000 (21:38 +0900)]
pmqos: Convert pass-pmqos.conf format to json to improve readability

The legacy pass-pmqos.conf file format is not better on side of readability.
So that change the configuration file format to json style to improve
readability.

Change-Id: I4898d431b1d0f8bc3b50b1d1ea764c87992cdf6c
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agopass: resmon: Remove unused code 30/261530/2
INSUN PYO [Wed, 21 Jul 2021 01:05:55 +0000 (10:05 +0900)]
pass: resmon: Remove unused code

Change-Id: I0e4f5e61fe5ed0ab8a58ec69c02f0115b16a247f
Signed-off-by: INSUN PYO <insun.pyo@samsung.com>
3 years agounittest: Replace system command with dbus signal 89/259989/2 accepted/tizen/unified/20210617.124816 accepted/tizen/unified/20210625.170306 submit/tizen/20210617.074946 submit/tizen/20210625.021026
Chanwoo Choi [Thu, 17 Jun 2021 07:34:01 +0000 (16:34 +0900)]
unittest: Replace system command with dbus signal

system() command causes the security issue. So that fix issue
to replace system command with dbus signal.

Change-Id: I83843697c9b64bd1c14fc54d1e9773dcfbdc5a3b
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
3 years agoscripts: dbus: Allow root to use core d-bus interface 88/259988/1
Chanwoo Choi [Thu, 17 Jun 2021 07:23:14 +0000 (16:23 +0900)]
scripts: dbus: Allow root to use core d-bus interface

Allow 'root' to use core d-bus interface provided by PASS.
The 'root' have to control all d-bus interface without any restrictions.

Change-Id: Ie322e426cbc945209cd9188ffa642444ce69880a
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
3 years agopass: rescon: Add missing lock for scenario_level_list 44/259944/1 accepted/tizen/unified/20210617.124845 submit/tizen/20210617.021704
Chanwoo Choi [Thu, 17 Jun 2021 01:59:01 +0000 (10:59 +0900)]
pass: rescon: Add missing lock for scenario_level_list

scenario_level_list variables should be protected by mutext.
So thath add missing lock for scenario_level_list

Change-Id: Ib4590fd3b76e3e9f6953234cbb1f7b21c7af7520
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
3 years agopass: pmqos: Add new Performance mode 43/254443/1 accepted/tizen/unified/20210303.220406 submit/tizen/20210303.073452
Chanwoo Choi [Wed, 3 Mar 2021 03:56:18 +0000 (12:56 +0900)]
pass: pmqos: Add new Performance mode

Add new 'Performance' mode in order to support the highest performance.
There are always requirements to test the device with high-performance.

Change-Id: I5d2eadefeedd8d0d56e08f37c68fd0664c2ffb8b
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
3 years agopass: unittest: Change install path and test file name 68/253268/4 accepted/tizen/unified/20210215.130901 submit/tizen/20210215.005454
Chanwoo Choi [Mon, 1 Feb 2021 04:43:51 +0000 (13:43 +0900)]
pass: unittest: Change install path and test file name

Change install path and test file name. Tizen 6.5 requires the install
and naming format as  '/usr/bin/hal/[module name]-haltests'.

[Detailed changes]
- /usr/bin/pass_haltests -> /usr/bin/hal/power-haltests
- /usr/bin/pass_gtest    -> /usr/bin/pass-unittests

And replace -ENODEV with -ENOTSUP because hal-api-power uses
the more correct error value of -ENOTSUP.

Change-Id: Ia2c8fd772d10e8b55db4dc66d9ee4f6d2be511e4
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
3 years agopmqos: add AppLaunchHome and HomeScreen 37/253037/4 submit/tizen/20210204.062055 submit/tizen/20210205.012455 submit/tizen/20210208.020913
lokilee73 [Thu, 4 Feb 2021 03:57:45 +0000 (12:57 +0900)]
pmqos: add AppLaunchHome and HomeScreen

Two scenarios are added to support C# APIs.
ex) DevicePmQosAppLaunchHome
    DevicePmQosHomeScreen

Change-Id: I93ffd4fb0f2e91b00ba3fdaeb7b14b00a4eaa444
Signed-off-by: lokilee73 <changjoo.lee@samsung.com>
3 years agopass: rescon: Handle -ENOTSUP error instad of -ENODEV 27/252627/2 accepted/tizen/unified/20210204.134448 submit/tizen/20210201.020414 submit/tizen/20210204.032624
Chanwoo Choi [Mon, 1 Feb 2021 01:32:35 +0000 (10:32 +0900)]
pass: rescon: Handle -ENOTSUP error instad of -ENODEV

The Power HAL API (hal-api-power) uses the -ENOTSUP error when HAL
function is not implemented instead of -ENODEV error. So that
handle -ENOTSUP error instad of -ENODEV

Change-Id: I7637f78d76e2350d95091cf216757b1ce53416e4
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
3 years agopass: resmon: Fix memory leak of udev_monitor in error path 64/252564/1
Seung-Woo Kim [Fri, 29 Jan 2021 09:21:15 +0000 (18:21 +0900)]
pass: resmon: Fix memory leak of udev_monitor in error path

The resmon_uevent_add() has memory leak in error path. Fix the
memory leak.

Change-Id: I53c07b891b888cd1bdd596f872dd204f620d5b7c
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
3 years agoPASS v1.2.0 17/252217/1
Chanwoo Choi [Tue, 26 Jan 2021 01:03:35 +0000 (10:03 +0900)]
PASS v1.2.0

- Changes from v1.1.0
1. Use hal-api-power (/platform/hal/api/power) instead of loading
the HAL backend library directly.

Change-Id: I53d30b334e307f3320346114a61d45889e59a104
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
3 years agopass: Remove hal-api-common dependency 13/251713/1
Chanwoo Choi [Tue, 19 Jan 2021 01:59:40 +0000 (10:59 +0900)]
pass: Remove hal-api-common dependency

/etc/ld.so.conf.d/libhal-api.conf contains the '/usr/lib/hal and
/usr/lib64/hal' path for loading the shard library. So that PASS daemon
doesn't need to specify the dependency of hal-api-common.

Change-Id: I56a254f9d4baa3c5f252c99fdf4f4e7bdb0f5307
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
3 years agopass: hal: Replace HAL interface with hal-api-power 55/251355/5
Chanwoo Choi [Wed, 6 Jan 2021 04:55:33 +0000 (13:55 +0900)]
pass: hal: Replace HAL interface with hal-api-power

Tizen 6.5 provides new HAL API layer to make tizen porting easy.
Power HAL API (hal-api-power) provides HAL C API for controlling
the h/w resources such as CPU/GPU/Memory Bus/Memory devices
and provides HAL interface for HAL backend developer for using
Tizen platform on new h/w device. PASS daemon just calls the Power HAL
API without handling the HAL backend anymore.

Describe the detailed changes as following:
1. Remove self-defined HAL functions and don't open HAL backend library
directly. Instead, use hal-api-power to control the h/w resources.
PASS deamon doesn't need to handle the HAL backend library anymore.

2. Remove pass-hal-devel package because of moving HAL interface
defintion (src/hal/hal.h) into hal-api-power (hal-power-interface.h).

3. Change the open path of pass configuration files.
- /etc/pass/ -> /hal/etc/pass/

Change-Id: I73a1c29c7af000335021faac62157b5342065682
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
3 years agopass: resmon: Fix memory leak of udev_monitor instance 15/250215/1 accepted/tizen/unified/20201223.125047 submit/tizen/20201222.084944
Chanwoo Choi [Tue, 22 Dec 2020 07:09:00 +0000 (16:09 +0900)]
pass: resmon: Fix memory leak of udev_monitor instance

In order to fix the memory leak, jump exception handling code
when error happen.

Change-Id: I0b288b602d61cab6ebdce3c5e53ff808e0b2d001
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
3 years agopass: resmon: Fix memory leak of udev instance 77/249577/1 accepted/tizen/unified/20201216.215928 submit/tizen/20201216.032745
Chanwoo Choi [Tue, 15 Dec 2020 06:21:52 +0000 (15:21 +0900)]
pass: resmon: Fix memory leak of udev instance

In order to fix the memory leak, call udev_device_unref
when error happen.

Change-Id: Ic5919eeb07c34e564bf5ad7cf357ff8ae35c2733
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
3 years agopass: pmqos: Change the log level to debug for removing confusion 39/248939/2
Chanwoo Choi [Thu, 3 Dec 2020 10:00:09 +0000 (19:00 +0900)]
pass: pmqos: Change the log level to debug for removing confusion

When the following case, it is not error. But, need to print
the log message for debugging.
- Unknown scearnio for each h/w resource
- Nost supported scenario for each h/w resource
- The some scenario is already locked.

Change-Id: Ib4280a4feae6d7fdfcc35ca1be89526d42be1d1c
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
3 years agopmqos: Edit the unproper expression of pmqos data structure 92/248292/2
Chanwoo Choi [Wed, 25 Nov 2020 05:43:30 +0000 (14:43 +0900)]
pmqos: Edit the unproper expression of pmqos data structure

The pmqos module supports the multiple h/w resources like CPU, GPU, bus
and memory. In order to express the correct meaning, edit the unproper
expression of pmqos data structure from 'pmqos_cpu' and 'pmqos_data'
and change the local variable name from 'cpu' to 'pmqos'.

Change-Id: I25151a22b417c697b74758c531c5d11ab15e5430
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
3 years agoPASS v1.1.0 28/240928/1 accepted/tizen_6.0_unified_hotfix tizen_6.0_hotfix accepted/tizen/6.0/unified/20201030.113832 accepted/tizen/6.0/unified/hotfix/20201103.001924 accepted/tizen/unified/20200831.122528 submit/tizen/20200828.025140 submit/tizen_6.0/20201029.205105 submit/tizen_6.0_hotfix/20201102.192505 submit/tizen_6.0_hotfix/20201103.114805 tizen_6.0.m2_release
Chanwoo Choi [Tue, 28 Apr 2020 01:07:23 +0000 (10:07 +0900)]
PASS v1.1.0

In order to support 'scenario pass_level', the format of pass configuration
are changed. It affects the pass-hal packages. So, it needs to increse
the version up to prevent the confusion between pass and pass-hal packages.

- Changes from v1.0.0
1. Support 'scenario' pass_level' for PMQoS and Thermal Monitor
2. Support 'scenario' with maximum duration and 'mode' without maximum duration
3. Add new 'SetScenario' method
  - org.tizen.system.pass.pmqos.SetScenario
4. Add new 'Doze' mode

Change-Id: I429e79171a22f7e1ce7b3248e04a0e1e1fe33f82
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
3 years agoscripts: pmqos: Add new Doze mode 14/240514/3 accepted/tizen/unified/20200810.123011 submit/tizen/20200810.073747
Chanwoo Choi [Fri, 7 Aug 2020 04:08:23 +0000 (13:08 +0900)]
scripts: pmqos: Add new Doze mode

Add new Doze scenario which handles h/w resources like CPU frequency
when right after LCD off and before entering the suspend-to-RAM
for reducing the idle power-consumption.

[How to hanel 'Doze' mode]
- Enable 'Doze' mode
dbus-send --system --type=method_call --print-reply --reply-timeout=5000 \
--dest=org.tizen.system.pass /Org/Tizen/System/Pass/Pmqos \
org.tizen.system.pass.pmqos.SetScenario \
string:Doze int32:1;

- Disable 'Doze' mode
dbus-send --system --type=method_call --print-reply --reply-timeout=5000 \
--dest=org.tizen.system.pass /Org/Tizen/System/Pass/Pmqos \
org.tizen.system.pass.pmqos.SetScenario \
string:Doze int32:0;

Change-Id: I536acbb36f663e4ad0ffa474f0a0981351428f0e
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
3 years agopmqos: Add support of 'mode' like UltraPowerSaving 13/240513/3
Chanwoo Choi [Fri, 7 Aug 2020 02:16:25 +0000 (11:16 +0900)]
pmqos: Add support of 'mode' like UltraPowerSaving

Priot to that support only 'scenario' with the maximum duration time
in order to prevent the misuse of scenario from client. Additionally,
'mode' is required to change the system status until receiving
the unlock request without any maximum duration time.

So, make 'max_duration_ms' property optional. If some scenario in
/etc/pass/pass-pmqos.conf' don't have the 'max_duration_ms' property
it considers the 'mode'.

Difference of both scenario and mode as following:
1. 'scenario' with the maximum duration time like AppLaunch
  - Lock case
  a. Client send dbus signal with both 'scenario' name and duration
  - Unlock case
  a. Client send dbus signal with both 'scenario' name and 0
  a. When timer with specific duration from client is expired,
     unlock scenario automatically.
  a. When timer with maximum duration is expired,
     unlock scenario automatically.

2. 'mode' without any duration time like UltraPowerSaving
  - Lock case
  a. Client send dbus signal with both 'mode' name and 1
  - Unlock case
  a. Client send dbus signal with both 'mode' name and 0

Change-Id: I02cac0820b3085f7046689aecf8dc679f5f381c4
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
3 years agopmqos: Add new SetScenario method for pmqos dbus interface 12/240512/2
Chanwoo Choi [Thu, 6 Aug 2020 09:57:01 +0000 (18:57 +0900)]
pmqos: Add new SetScenario method for pmqos dbus interface

When add new scenario to pmqos, it have to edit the code.
It is not extensible. In order to improve the extensiblity
without code changes, add new SetScenario method for pmqos dbus interface
as following: When need to add new scenario, just add new scenario info.
to scripts/pass-pmqos.conf (/etc/pass/pass-pmqos.conf) without any code
changes.

[Interface for new SetScenario method of pmqos dbus]
- dbus interface : org.tizen.system.pass.pmqos.SetScenario
- parameter 1: scenario name like AppLaunch
- parameter 2: duration time like 3000 means 3 second

Change-Id: I5ee8da4ec62a9cf1d55ea51f6c7fb8ca9ce7b9e7
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
3 years agopass: Adjust indentation to show current resource statues for readability 11/240511/2
Chanwoo Choi [Thu, 6 Aug 2020 09:14:27 +0000 (18:14 +0900)]
pass: Adjust indentation to show current resource statues for readability

Adjust indentation to show current resource statues and remove unneeded
blank line for readability. And remove unneeded comment and blank line.

Change-Id: Ibb2e660374626b942a2dd14c3bdb59caa5725162
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
3 years agopmqos: Set max_duration_ms for each scenario 10/240510/2
Chanwoo Choi [Thu, 6 Aug 2020 08:40:28 +0000 (17:40 +0900)]
pmqos: Set max_duration_ms for each scenario

Until now, only support global max_duration_ms time. But, if each scenario
need to set the different maximum duration time, it is not supported.

Allow each scenario to set the default maximume duration time.

Change-Id: I6f294ab55d2157c251593c300cb04eefb598b751
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
3 years agopmqos: Fix issue when the part of scenario name is same with supported scenario 31/240531/1
Chanwoo Choi [Fri, 7 Aug 2020 06:22:56 +0000 (15:22 +0900)]
pmqos: Fix issue when the part of scenario name is same with supported scenario

If the part of scenario name sent from client is same with among
the supported scenario name, strncmp() causes the issue.
In order to fix this issue, compare the full scenario name with strcmp():

Change-Id: Ibc712b0b4be2cb752506ac7094b27abd88e587b5
Reported-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
3 years agopmqos: Fix wrong unlocked issue when pmqos list contains only one scenario 30/240530/1
Chanwoo Choi [Fri, 7 Aug 2020 06:03:47 +0000 (15:03 +0900)]
pmqos: Fix wrong unlocked issue when pmqos list contains only one scenario

The pmqos list contains only one scenario like UltraPowerSaving
and when receiving the unmated scenario name like AppLaunch with unlock info
with that duration is zero, the last scenario will be unlocked.

In order to fix this issuse, correct the conditional statement.

Change-Id: Ica2a3a3f44d02dfd07e3cb57e1dab300decee9d0
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
3 years agoscripts: dbus: Allow root to use d-bus interface 43/240143/3
Chanwoo Choi [Tue, 4 Aug 2020 02:05:41 +0000 (11:05 +0900)]
scripts: dbus: Allow root to use d-bus interface

Allow 'root' to use d-bus interface provided by PASS.
The 'root' have to control all d-bus interface without any restrictions.

Change-Id: I18d467f2745741c7c4b990b64210dfd16692d39c
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
4 years agopass: parser: Clean-up code to remove warning from static code analyzer 96/225796/4 accepted/tizen/unified/20200227.121023 submit/tizen/20200227.020232
Chanwoo Choi [Mon, 24 Feb 2020 11:05:21 +0000 (20:05 +0900)]
pass: parser: Clean-up code to remove warning from static code analyzer

Change-Id: I627fc5e55497a34b318273bbb06af2664cdc2b03
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
4 years agopass: parser: Rename parser API for the readability 21/224721/7
Chanwoo Choi [Tue, 11 Feb 2020 07:49:47 +0000 (16:49 +0900)]
pass: parser: Rename parser API for the readability

Rename all parser API from "pass_*()" to "pass_parser_*()"
to improve the readability.

Change-Id: Iade47afa9463093698612bb2d81004ae918695f9
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
4 years agopass: hal: Rename HAL API for the readability 20/224720/7
Chanwoo Choi [Wed, 12 Feb 2020 09:05:47 +0000 (18:05 +0900)]
pass: hal: Rename HAL API for the readability

Rename all HAL API from "pass_*()" to "pass_hal_*()" to improve the
readability. Usually, PASS modules used their own prefix on function name
like 'pass_resmon_*', 'pass_rescon_*'. After that, anyone can know
the kind of PASS module of functions.

Change-Id: I275fc6154eeab2af1d0e6755c3e6ceae762548b6
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
4 years agopass: thermal: Change local variable name for readability 19/224719/7
Chanwoo Choi [Wed, 12 Feb 2020 08:59:54 +0000 (17:59 +0900)]
pass: thermal: Change local variable name for readability

Change local variable name for readability as following
without any behavior changes:
- curr_temp      -> new_temp which is the measured temperature
- timer_interval -> new_timer_interval of new thermal scenario
- scenario       -> new_scenario which is instance of new thermal scenario
- scenario_idx   -> new_scenario_idx which is index of new thernal scenario
- timer_interval_of_scenario is removed due to unneeded

Change-Id: Ie9fed6c3be9e3ad490c2d0eec3a02c839ab6be7d
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
4 years agopass: thermal: Add support for scenario_level for thermal scenario 18/224718/7
Chanwoo Choi [Tue, 11 Feb 2020 12:45:12 +0000 (21:45 +0900)]
pass: thermal: Add support for scenario_level for thermal scenario

Prior to that thermal monitor has been monitoring the temperature
and then decide current thermal scenario like 'Release', 'Warning'.
And send the broadcast dbus message to inform the current thermal scenario
to otther Tizen framework. It didn't support to change the value
of the h/w resource like frequency, the number of online CPU.

Finally, thermal monitor is able to change the value of h/w resource
according to their own 'scenario_level' value on each thermal scenario.

For example with following configuration example,
- If thermal monitor decide the current thermal scenario as 'Release',
  'Release' sceanrio has 'scenario_level=0'. It means that set 'ScenarioLeve0'.
  It allow max_freq as 1.3GHz and max_cpu as 4 core.

- If thermal monitor decide the current thermal scenario as 'Warning',
  'Warning' sceanrio has 'scenario_level=2'. It means that set 'ScenarioLeve2'.
  It allow max_freq as 768MHz and max_cpu as 2 core.

This feature is important for preventing the dangerous overheating of h/w
target and it is very easy to tune up the configuration of thermal monitor
by editing the configuration files under '/etc/pass' path.

[Example of configuraiton file for CPU h/w resource]
(snip)
[ScenarioLevel0]
limit_min_freq=768000
limit_max_freq=1300000
limit_min_cpu=0
limit_max_cpu=4

[ScenarioLevel2]
limit_min_freq=768000
limit_max_freq=768000
limit_min_cpu=0
limit_max_cpu=2

(snip)
[thermal.scenario0]
support=yes
name=Release
temperature=25
timer_interval_ms=5000
scenario_level=0 <- It means 'ScenarioLevel0' is used for 'Release'.
Allow max_freq as 1.3GHz and max_cpu as 4 core.

[thermal.scenario1]
support=yes
name=Warning
temperature=30
timer_interval_ms=3000
scenario_level=2 <- It means 'ScenarioLevel2' is used for 'Warning'.
Allow max_freq as 768MHz and max_cpu as 2 core.

Change-Id: I3a5ff802e68f1452e90d766cfe1f04b4554413fd
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
4 years agopass: rescon: Add support for multiple scenario pass_level 17/224717/7
Chanwoo Choi [Tue, 28 Jan 2020 05:47:44 +0000 (14:47 +0900)]
pass: rescon: Add support for multiple scenario pass_level

PASS provides multiple modules like CPUHP (CPU Hotplug Manager), PMQoS,
Thermal Monitor and so on. Each module requires their own pass_level
in order to change h/w resources such as the number of online CPU,
the minimum/maximum frequency of GPU.

Prior to that, PASS supports only 'pass_level'. If user of PASS want to
set 'AppLaunch' scenario of PMQoS module, PMQoS only requires the range
of 'pass_level' like the minimum and maximum 'pass_level'. It is not enough
to meet the requirements from 'AppLaunch' scenario. Some scenario might
require the more detailed changes than already defined 'pass_level'.

In result of these requirements, add support for new 'scenario pass_level'
for scenarios such as AppLaunch of PMQoS and WarningAction of Thermal
Monitor. 'scenario pass_level' is possible to specify the detailed value
of h/w resources such as the minimum/maximum frequency (limit_(min|max)_freq),
the minimum/maximum number of online CPU (limit_(min|max)_cpu)
and fault_around_bytes for memorh h/w resource.

In order to support the multiple scenario pass_level at the same time,
RESCON (Resource Controller) module adds new following functions and then
delete previous function.

PMQoS will use new functions for supporting the 'scenario pass_level'
and Thermal Monitor will use the new functions for 'scenario pass_level'
for constrainting the h/w resouece to prevent the dangerous overheating.

[Added new functions]
- int pass_rescon_sync(struct pass_resource *res);
- int pass_rescon_set_level_sync(struct pass_resource *res, int level);
- int pass_rescon_set_scenario_level_sync(struct pass_resource *res,
int scenario_level);
- int pass_rescon_unset_scenario_level_sync(struct pass_resource *res,
int scenario_level);
- int pass_rescon_set_scenario_level(struct pass_resource *res,
int scenario_level);
- int pass_rescon_unset_scenario_level(struct pass_resource *res,
int scenario_level);

[Deleted functions]
- int pass_rescon_set_level_scope(struct pass_resource *res, int new_level,
int min_level, int max_level, void *data);

[Deprecated functions. Because these functions are keeping
for the compatibility with legacy feature. It should be used on PMQoS module.]
- int pass_rescon_set_scenario_level_sync_with_data(struct pass_resource *res,
int scenario_level, void *data);
- int pass_rescon_unset_scenario_level_sync_with_data(struct pass_resource *res,
int scenario_level, void *data);

[Exmaple of multiple scenario pass_level on PMQoS and Thermal Monitor modules]
Case 1. AppLaunch scenario of PMQoS ,
- 'AppLaunch' scenario contains 'scenario_level=1' property as following:
[ScenarioLevel1]
limit_min_freq=1300000
limit_max_freq=1300000
limit_min_cpu=3
limit_max_cpu=4

- In result, RESCON (Resource Controller) set h/w resource as following:
The minimum frequency is 1300MHz.
The maximum frequency is 1300MHz.
The minimum number of online CPU is 3.
The maximum number of online CPU is 4.
-> It maintains 1300MHz and three online CPU.

Case 2. Warning scenario of Thermal Monitor,
- 'Warning' scenario contains 'scenario_level=2' property as following:
[ScenarioLevel2]
limit_min_freq=768000
limit_max_freq=1000000
limit_min_cpu=0
limit_max_cpu=2

- In result, RESCON (Resource Controller) set h/w resource as following:
The minimum frequency is 768MHz.
The maximum frequency is 1000MHz.
The minimum number of online CPU has no any constraint.
The maximum number of online CPU is 2.
-> It maintain 768MHz and doesn't turn on more than 2 CPU.

Case 3. AppLaunch scenario of PMQoS + Warning scenario of Thermal Monitor,
- 'AppLaunch' scenario contains 'scenario_level=1' property and
  'Warning' scenario contains 'scenario_level=2' property as following:

[ScenarioLevel1]
limit_min_freq=1300000
limit_max_freq=1300000
limit_min_cpu=3
limit_max_cpu=4

[ScenarioLevel2]
limit_min_freq=768000
limit_max_freq=1000000
limit_min_cpu=0
limit_max_cpu=2

- In result, RESCON (Resource Controller) set h/w resource as following:
The minimum frequency is 1000MHz because MAX(1300000, 768000) cannot be
                                 over thatn maximum frequency (1000MHz).
The maximum frequency is 1000MHz.
The minimum number of online CPU is 2.
The maximum number of online CPU is 2.
-> It maintain 1000MHz and doesn't turn on more than 2 CPU.

[ScenarioLevel0]
limit_min_freq=768000
limit_max_freq=1300000
limit_min_cpu=0
limit_max_cpu=4

[ScenarioLevel1]
limit_min_freq=1300000
limit_max_freq=1300000
limit_min_cpu=3
limit_max_cpu=4

[ScenarioLevel2]
limit_min_freq=768000
limit_max_freq=1000000
limit_min_cpu=0
limit_max_cpu=2

[PassScenario]
pass_scenario_support=yes
pass_num_scenarios=1

[Scenario0]
name=AppLaunch
support=yes
scenario_level=1 <- It indicates 'ScenarioLevel1' for AppLaunch scenario.

[thermal]
thermal_support=yes
thermal_number_of_scenario=2
thermal_timer_interval_ms=5000

[thermal.scenario0]
support=yes
name=Release
temperature=25
timer_interval_ms=5000
scenario_level=0

[thermal.scenario1]
support=yes
name=Warning
temperature=30
timer_interval_ms=3000
scenario_level=2 <- It indicates 'ScenarioLevel2' for Warning scenario.

Change-Id: I45e99b1794b85342f29bf0decec6a859f56f8f58
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
4 years agopass: parser: Add support for parsing of scenario pass_level 16/224716/6
Chanwoo Choi [Tue, 28 Jan 2020 05:02:30 +0000 (14:02 +0900)]
pass: parser: Add support for parsing of scenario pass_level

PASS provides multiple modules like CPUHP (CPU Hotplug Manager), PMQoS,
Thermal Monitor and so on. Each module requires their own pass_level
in order to change h/w resources such as the number of online CPU,
the minimum/maximum frequency of GPU.

Prior to that, PASS supports only 'pass_level'. If user of PASS want to
set 'AppLaunch' scenario of PMQoS module, PMQoS only requires the range
of 'pass_level' like the minimum and maximum 'pass_level'. It is not enough
to meet the requirements from 'AppLaunch' scenario. Some scenario might
require the more detailed changes than already defined 'pass_level'.

In result of these requirements, add support for new 'scenario pass_level'
for only scenario such as AppLaunch of PMQoS and WarningAction of Thermal
Monitor. 'scenario pass_level' is possible to specify the detailed value
of h/w resources such as the minimum/maximum frequency (limit_min/max_fre),
the minimum/maximum number of online CPU (limit_min/max_cpu)
and fault_around_bytes for memorh h/w resource.

[Detailed new properties for 'scenario pass_level']
1.
- section name : [pass]
- property name : pass_num_scenario_levels
- property value type : integer
- mandatory or optional : mandatory

2.
- section name : [pass]
- property name : pass_init_scenario_levels
- property value type : integer
- mandatory or optional : mandatory

3.
- section name : [ScenarioLevel%d]
- properties name in section : pass_level and scenario pass_level
are to use common properties.

4.
- section name : [Scenario%d]
- property name : scenario_level
- property value type : integer, it denotes the index of scenario pass_level.
- mandatory or optional : mandatory

For example, usecase of scenario pass_level by AppLaunch PMQoS scenario.
[pass]
pass_num_scenario_levels=2
pass_init_scenario_levels=0

[ScenarioLevel0]
limit_min_freq=400000
limit_max_freq=1300000
limit_min_cpu=1
limit_max_cpu=4

[ScenarioLevel1]
limit_min_freq=800000
limit_max_freq=1300000
limit_min_cpu=4
limit_max_cpu=4

[PassScenario]
pass_scenario_support=yes
pass_num_scenarios=1

[Scenario0]
name=AppLaunch
support=yes
scenario_level=1

Change-Id: I8f058bf68278667ee68b821eb58c972aa298646f
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
4 years agopass: parser: Verify properties of pass_level before using 15/224715/7
Chanwoo Choi [Tue, 28 Jan 2020 04:40:38 +0000 (13:40 +0900)]
pass: parser: Verify properties of pass_level before using

Prior to that there are no any restrictions about adding properties
to pass_level in the configuration file such as /etc/pass/pass-resource-*.conf
for each h/w resource.

Add some restrictions of pass_level as following:
- In case of CPU,
  If there is either limit_min_cpu or limit_max_cpu in pass_level,
  have to add both limit_min_cpu and limit_max_cpu to pass_level.
- In case of CPU/GPU/BUS,
  if there is either limit_min_freq or limit_max_freq in pass_level,
  have to add both limit_min_freq and limit_max_frewq to pass_level.

Change-Id: I899121c433432ad92800f741f2b8df78dc135de0
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
4 years agopass: rescon: Add new 'limit_max_cpu' property for CPU h/w resource 14/224714/1
Chanwoo Choi [Tue, 28 Jan 2020 02:32:41 +0000 (11:32 +0900)]
pass: rescon: Add new 'limit_max_cpu' property for CPU h/w resource

'limit_max_cpu' means the maximum number of online CPU.
If pass_level contains 'limit_max_cpu' value, RESCON (Resource Controller)

And remove the wrong comment from 'limit_min_cpu' comment
because 'limit_max_cpu' and 'limit_min_cpu' are supported
for only PASS_RESOURCE_CPU_ID h/w resource.

Change-Id: Ice6033491532895c8f1e1a71d7229f9362b184bf
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
4 years agopass: thermal: Call resource monitor API directly without redundant function 12/224412/1 accepted/tizen/unified/20200214.050407 submit/tizen/20200213.105841
Chanwoo Choi [Mon, 10 Feb 2020 09:56:52 +0000 (18:56 +0900)]
pass: thermal: Call resource monitor API directly without redundant function

get_thermal_result() is called once. It is possible to be removed
instead of calling resmon (resouce monitor) API directly without
any middle step.

Change-Id: Ib058d540056fe1a8fc7b206fb98c096272c17121
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
4 years agopass: Clean-up minor indentaion to show the scenario name during init step 88/224288/4
Chanwoo Choi [Fri, 7 Feb 2020 10:57:02 +0000 (19:57 +0900)]
pass: Clean-up minor indentaion to show the scenario name during init step

Clean-up indentaion to show the scenario name during init step
without any behavior changes.

[Before]
I/PASS    ( 1110): pmqos.c: pmqos_init_done(498) > Support 'AppLaunch' scenario
I/PASS    ( 1110): pmqos.c: pmqos_init_done(498) > Support 'UltraPowerSaving' scenario
I/PASS    ( 1110): thermal.c: thermal_init_done(139) > Support 'Release' scenario
I/PASS    ( 1110): thermal.c: thermal_init_done(139) > Support 'Warning' scenario
I/PASS    ( 1110): thermal.c: thermal_init_done(139) > Support 'LimitAction' scenario
I/PASS    ( 1110): thermal.c: thermal_init_done(139) > Support 'Shutdown' scenario

[After]
I/PASS    ( 2109): pmqos.c: pmqos_init_done(498) > Support 'AppLaunch       ' pmqos scenario
I/PASS    ( 2109): pmqos.c: pmqos_init_done(498) > Support 'UltraPowerSaving' pmqos scenario
I/PASS    ( 2109): thermal.c: thermal_init_done(139) > Support 'Release     ' thermal scenario
I/PASS    ( 2109): thermal.c: thermal_init_done(139) > Support 'Warning     ' thermal scenario
I/PASS    ( 2109): thermal.c: thermal_init_done(139) > Support 'LimitAction ' thermal scenario
I/PASS    ( 2109): thermal.c: thermal_init_done(139) > Support 'Shutdown    ' thermal scenario

Change-Id: I08223949a76610352475592f02856f07c3f2c69a
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
4 years agopass: thermal: Define thermal_update function to reduce duplicate code 87/224287/4
Chanwoo Choi [Fri, 7 Feb 2020 10:28:55 +0000 (19:28 +0900)]
pass: thermal: Define thermal_update function to reduce duplicate code

thermal_moitor_func() and thermal_get_scenario() functions contains
the same code for deciding the next thermal scenario by using the
thermal raw data. So that define thermal_update() function to reduce
duplicate code from both thermal_moitor_func() and thermal_get_scenario().

Change-Id: Ia0bfef053163a848e657efb36c2dccb232037a04
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
4 years agopass: thermal: Fix bug of interval update until changed first thermal scenario 86/224286/3
Chanwoo Choi [Fri, 7 Feb 2020 08:13:29 +0000 (17:13 +0900)]
pass: thermal: Fix bug of interval update until changed first thermal scenario

The commit 6e9640753a86 ("thermal: Support dbus activation for thermal f/w")
read the temperature and then updated the system early thermal scenario
on thermal_get_scenario() function. When updated the thermal scenario,
have to update the timer interval ('timer_interval_ms' property)
if each thernmal scenaior defines their own timer interval
in configuration file.

But, thermal_get_scenario() has missed the interval update for thermal
monitoring when detecting the ealy thermal scenario on initialization step.
Because each thermal scenario is able to have their own timer interval
('timer_interval_ms' property) for adjusting the timer interval of monitoring.

[Example how to define the thermal scenario information for each h/w resource]
[thermal.scenario1]
support=no
name=Warning
temperature=65
timer_interval_ms=2000

So that in order to fix this bug, update the timer interval of monitoring
when changing the thermal scenario information.

Change-Id: Ib909539ffac357d7a804f726ae43e61a7a044d60
Fixes: 6e9640753a86 ("thermal: Support dbus activation for thermal f/w")
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
4 years agopass: resmon: Fix unneeded g_list_remove call when updating timer interval 93/224393/2
Chanwoo Choi [Mon, 10 Feb 2020 07:31:44 +0000 (16:31 +0900)]
pass: resmon: Fix unneeded g_list_remove call when updating timer interval

The commit 204e36c7c18a ("pass: resmon: Add new Resource Monitor (resmon)
module") added 'resmon_timer_add()' function which support two case as
following:
- case 1: Create timer with timer interval and add created timer to timer_list
- case 2: Update timer interval of already created timer in timer_list

In case 2, resmon_timer_add() had a bug about freeing resource because
don't need to remove a timer from 'resmon->timer_list' by using g_list_remove.

So that in order to fix this issue, do refactor the body of resmon_timer_add().

Change-Id: Iee76e42dd1eb92675e626d91e25f0672477fc3cc
Fixes: 204e36c7c18a ("pass: resmon: Add new Resource Monitor (resmon) module")
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
4 years agounittest: pass_gtest: Use dbus defintion 85/223785/2 accepted/tizen/unified/20200207.122419 submit/tizen/20200206.041536
Chanwoo Choi [Tue, 4 Feb 2020 03:27:59 +0000 (12:27 +0900)]
unittest: pass_gtest: Use dbus defintion

The supported dbus path/interface were defined in gdbus-defintion.sh.
So that use the dbus defintion to remove the potential error.

Change-Id: Icebefcbb58a7d135eda873ed827ea7c2d50e59b3
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
4 years agounittest: pass_gtest: Fix thermal monitor dbus path 84/223784/2
Chanwoo Choi [Tue, 4 Feb 2020 02:28:57 +0000 (11:28 +0900)]
unittest: pass_gtest: Fix thermal monitor dbus path

The commit a33200bbbe14 ("pass: Change DBUS interface of thermal monitor")
changed the Thermal Monitor dbus path/interface as following:
In order to support the unittest of Thermal Monitor, fix the thermal monitor
dbus path.

[Before]
DBUS_THERMAL_INTERFACE "org.tizen.system.pass.monitor.thermal"
DBUS_THERMAL_PATH      "/Org/Tizen/System/Pass/Monitor/Thermal"
[After]
DBUS_THERMAL_INTERFACE "org.tizen.system.thermal"
DBUS_THERMAL_PATH      "/Org/Tizen/System/Thermal"

Change-Id: I6adb48a167bd72b91ba495d099bfa32071ba2b5f
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
4 years agoscripts: Allow telephony to send thermal method_call 29/223729/2 accepted/tizen_5.5_unified accepted/tizen_5.5_unified_wearable_hotfix tizen_5.5 tizen_5.5_wearable_hotfix accepted/tizen/5.5/unified/20200204.125925 accepted/tizen/5.5/unified/wearable/hotfix/20201027.113049 accepted/tizen/unified/20200204.125807 submit/tizen/20200204.012547 submit/tizen_5.5/20200204.013653 submit/tizen_5.5_wearable_hotfix/20201026.184304
Dongwoo Lee [Mon, 3 Feb 2020 08:49:03 +0000 (17:49 +0900)]
scripts: Allow telephony to send thermal method_call

To allow callmgr to send method_call dbus interface for themal,
this patch adds dbus policy.

Change-Id: Ifd06ad37299f6acef32a90b107f15c5ec8119467
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
4 years agopass: pmqos: remove possible stringop-overflow 52/222052/1 accepted/tizen/unified/20200113.130640 submit/tizen/20200110.040829
Seung-Woo Kim [Thu, 9 Jan 2020 08:36:10 +0000 (17:36 +0900)]
pass: pmqos: remove possible stringop-overflow

When parsing and trimming qos scenario name, there can be possible
stringop-overflow. To remove possible overflow, copy string with
strncpy() and then cut 'Lock' or 'Unlock'. Also, remove function,
is_pmqos_locked(), called only once.

Change-Id: I95a4bcde662c3d8390fab0dd661c9ecc84eb407a
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
4 years agopass: resmon: Remove unnecessary check in exit 34/222034/1
Seung-Woo Kim [Thu, 9 Jan 2020 07:37:46 +0000 (16:37 +0900)]
pass: resmon: Remove unnecessary check in exit

After monitor->result is null-checked and it is re-checked.
Remove the unnecessary check routine in resmon_cpuhp_exit().

Change-Id: I345a497fa67ba4ee0334c24327d2f7ea74dd7996
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
4 years agothermal: Fix incompatible-pointer-types 21/222021/1
Seung-Woo Kim [Thu, 9 Jan 2020 05:21:30 +0000 (14:21 +0900)]
thermal: Fix incompatible-pointer-types

After the commit 6e9640753a86 ("thermal: Support dbus activation
for thermal f/w"), function pointer for register_notifier() and
unregister_notifier() type is incompatible. Fix the warning by
casting inside the function.

Change-Id: Iebc590cc1d3d9a7adaca1a896f6313a225ddb6ca
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
4 years agounittest: pass_haltests: Remove dangling-else warnings 16/222016/3
Seung-Woo Kim [Thu, 9 Jan 2020 04:57:35 +0000 (13:57 +0900)]
unittest: pass_haltests: Remove dangling-else warnings

The ASSERT_EQ() macro internal has 'if' statement, so gcc9 gives
dangling-else build warnings for single 'if' statement without
braces before ASSERT_EQ(). Remove The build warnings by adding
explict braces.

Change-Id: I56d955c71c58d2fbd99a18f0983bb5af88cd430e
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
4 years agoCMakeLists: Fix cmake warnings 18/222018/1
Dongwoo Lee [Thu, 9 Jan 2020 05:12:25 +0000 (14:12 +0900)]
CMakeLists: Fix cmake warnings

Since cmake version 3.1, variable reference policy is changed, and
'PREFIX' defined for refer '/usr/' directory cause warnings during
dealing with internal scripts like below:

#if defined(__VISUALDSPVERSION__)
    /* __VISUALDSPVERSION__ = 0xVVRRPP00 */
# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_HEX@(__VISUALDSPVERSION__>>24)
# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_HEX@(__VISUALDSPVERSION__>>16 & 0xFF)
# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_HEX@(__VISUALDSPVERSION__>>8  & 0xFF)
#endif'

To fix it, this changes to not use PREFIX as pre-defined variable no
longer.

Change-Id: Ie62509318b84075b8a03be0e806696b2837ecbd9
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
4 years agopass: Add PMQoS as supported module for nonstandard resource 63/212563/2 accepted/tizen_5.5_unified_mobile_hotfix tizen_5.5_mobile_hotfix tizen_5.5_tv accepted/tizen/5.5/unified/20191031.022608 accepted/tizen/5.5/unified/mobile/hotfix/20201027.090409 accepted/tizen/unified/20190826.000114 submit/tizen/20190823.053814 submit/tizen_5.5/20191031.000004 submit/tizen_5.5_mobile_hotfix/20201026.185104 tizen_5.5.m2_release
Dongwoo Lee [Fri, 23 Aug 2019 04:58:35 +0000 (13:58 +0900)]
pass: Add PMQoS as supported module for nonstandard resource

Since PMQoS is not supported for the nonstandard resource, these
resourced such as trm cannot receive PMQoS events. This patch adds
PMQoS as supported module for nonstandard resource in order to
handle relevant events.

Change-Id: I8377fb4cc1a6a0bf1df7029c9efbbd433a5806a7
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
4 years agothermal: Support dbus activation for thermal f/w 10/210610/6 accepted/tizen/unified/20190731.112548 submit/tizen/20190730.044254
Dongwoo Lee [Tue, 23 Jul 2019 02:07:11 +0000 (11:07 +0900)]
thermal: Support dbus activation for thermal f/w

Since resource monitoring first announce the temperature state a
single seconds later after all initialization over, to support dbus
activation for thermal f/w, temperature should be set during
initialization. To support this feature, current temprature is
retrived in advance while thermal is initialized, and it will be
announced before sd_notify called.

Change-Id: I83dae123a51fbdd953fe467ae408cae1a100c059
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
4 years agocore: sd_notify() when all dbus name is owned 09/210609/3
Dongwoo Lee [Thu, 18 Jul 2019 01:51:12 +0000 (10:51 +0900)]
core: sd_notify() when all dbus name is owned

If pass is waken-up by thermal method call, sd_notify() should be
called after all dbus name is successfully owned including thermal
dbus. To handle this case, this patch refactors name acquired event
callback.

Change-Id: I88549a81aaa38082c3d7e53c995d9f62145a6266
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
4 years agocore: Add support for dbus activation for thermal 27/210827/1
Dongwoo Lee [Thu, 18 Jul 2019 01:51:12 +0000 (10:51 +0900)]
core: Add support for dbus activation for thermal

To support dbus activation by not only pass core but also thermal,
this patch adds dbus activation support.

Change-Id: I50e13d43df9c775ae177a455805af41921f00286
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
4 years agothermal: Change order of initialization 08/210608/2
Dongwoo Lee [Fri, 19 Jul 2019 03:33:55 +0000 (12:33 +0900)]
thermal: Change order of initialization

To prevent race condition, dbus object should be registered before
well-known name is acquired. This patch changes order of initilizing
to fit this precondition.

Change-Id: I9fe60af8ed542155d26cc9c8a5f88eade3b38bb5
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
4 years agocore: Remove unnecessary parameter for booting_done event 07/210607/1
Dongwoo Lee [Thu, 18 Jul 2019 01:58:28 +0000 (10:58 +0900)]
core: Remove unnecessary parameter for booting_done event

Even the late activation process is removed since commit cdf2e4d1139c
("core: Remove late activation process"), the 'boot_done' state is
still passed as a parameter for INIT_DONE event. So, this patch
removes the unnecessary parameter.

Change-Id: I3b7bf1d6cba8080618fd486c7ab5c2db775ae7de
fixes: cdf2e4d1139c ("core: Remove late activation process")
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
5 years agocore: Apply systemd-based dbus activation 48/210148/3
Hyotaek Shim [Mon, 15 Jul 2019 06:13:35 +0000 (15:13 +0900)]
core: Apply systemd-based dbus activation

To activate PASS service immediately when other service requests the
dbus methods of it, this patch applies systemd-based dbus
activation. In addition, to announce PASS startup completion to
systemd, this patch adds notification through 'sd_notify()' call.
Without it, systemd will block PASS activation.

Change-Id: I4bfd6fce55d83aee646405af7bafbc650cb177e5
Signed-off-by: Hyotaek Shim <hyotaek.shim@samsung.com>
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
5 years agocore: Add name acquired event handler parameter to dbus name own API. 47/210147/3
Dongwoo Lee [Mon, 15 Jul 2019 08:07:00 +0000 (17:07 +0900)]
core: Add name acquired event handler parameter to dbus name own API.

To register handler for name acquired event for dbus name own process,
this patch adds it as parameter.

Change-Id: I91ffaf85100e49a80e9654a039ff544b37e210b4
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
5 years agocore: Remove late activation process 46/210146/3
Dongwoo Lee [Tue, 16 Jul 2019 01:43:41 +0000 (10:43 +0900)]
core: Remove late activation process

Since commit 239483e1b802 ("Rearrange pass.service into
delayed.target"), there is no need to wait until systemd become ready
because PASS is now delayed target service and thus it is guaranted
that systemd is always prepared while pass is initialized. So, late
activation for waiting systemd 'booting done' event is now unncessary.
This patch remove callbacks for the event and relevant functions.

Change-Id: I40a775af04ea4c00c7f39bbba5d73d8b59481d39
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
5 years agoRearrange pass.service into delayed.target 26/210026/1
Hyotaek Shim [Mon, 15 Jul 2019 05:55:31 +0000 (14:55 +0900)]
Rearrange pass.service into delayed.target

Change-Id: I520a77645fa93c7ec99bc16cfc5f161b57ab9cb3
Signed-off-by: Hyotaek Shim <hyotaek.shim@samsung.com>
5 years agopass: thermal: Add GetCoolDownStatus DBUS method 39/208239/2 accepted/tizen/unified/20190627.014836 submit/tizen/20190624.013748
Dongwoo Lee [Thu, 20 Jun 2019 06:20:37 +0000 (15:20 +0900)]
pass: thermal: Add GetCoolDownStatus DBUS method

This patch adds a new DBUS method for providing the current status of
CoolDownMode.

 Method description:
 - Destination: org.tizen.system.thermal
 - Path: /Org/Tizen/System/Thermal
 - Interface: org.tizen.system.thermal.GetCoolDownStatus
 - Parameter: IN: none, OUT: string

Change-Id: I89be8758bda57f265f4cb6a03c1a3d6d559aa2f4
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
5 years agopass: thermal: add separate dbus for thermal monitor 91/206791/5 accepted/tizen/unified/20190530.043119 submit/tizen/20190528.074510
Dongwoo Lee [Thu, 23 May 2019 06:56:18 +0000 (15:56 +0900)]
pass: thermal: add separate dbus for thermal monitor

This patch adds separate dbus for thermal monitor, and it owns
well-know name as "org.tizen.system.thermal".

Change-Id: I5a4126e5debb597e7cdb2e722772a4966eb329e0
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
5 years agopass: thermal: Prevent memory leakage 90/206790/2
Dongwoo Lee [Tue, 30 Apr 2019 04:11:39 +0000 (13:11 +0900)]
pass: thermal: Prevent memory leakage

To prevent memory leakage, free allocated memory on error case.

Change-Id: If0c94bc23e47eafff594afb435b909b544708ac3
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
5 years agopass: thermal: Correct thermal action names 00/206800/1
Dongwoo Lee [Mon, 27 May 2019 07:07:05 +0000 (16:07 +0900)]
pass: thermal: Correct thermal action names

This patch correct thermal action names in comments in order to match
into previous changes.

Change-Id: I7931ddc9dc42bf364cb9f020741d063402004c33
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
5 years agoModify pass.conf to add org.tizen.system.thermal 34/206634/4
Hyotaek Shim [Wed, 22 May 2019 08:37:04 +0000 (17:37 +0900)]
Modify pass.conf to add org.tizen.system.thermal

Change-Id: Idb32f28286f7a4aa8fb44539b0e818c6c711cee1
Signed-off-by: Hyotaek Shim <hyotaek.shim@samsung.com>
5 years agopass: Change DBUS interface of thermal monitor 74/203374/1
Dongwoo Lee [Thu, 11 Apr 2019 07:44:13 +0000 (16:44 +0900)]
pass: Change DBUS interface of thermal monitor

This patch changes DBUS interface as following thermal interface
standard like below:
 - Interface: org.tizen.system.thermal
 - Path: /Org/Tizen/System/Thermal
 - Broadcast name: CoolDownModeChanged

Change-Id: Iedf5a1d78536a10829d37e84fadae0e51706f886
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
5 years agopass: core: Remove unused structure 73/203373/1
Dongwoo Lee [Thu, 11 Apr 2019 07:52:36 +0000 (16:52 +0900)]
pass: core: Remove unused structure

Since commit 261812a0492a, struct device_ops default_ops is not used
anymore. This patch removes it to prevent build warning.

Change-Id: I933adf899125ff0f6b078cffb06f7fd6d0ec99ca
Fixes: 261812a0492a ("core: Remove unneeded codesa")
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
5 years agopass: pmqos: print int64_t type on 32/64bit architecture properly 29/195629/1 accepted/tizen/unified/20181217.142346 submit/tizen/20181217.034218
Dongwoo Lee [Mon, 17 Dec 2018 02:06:10 +0000 (11:06 +0900)]
pass: pmqos: print int64_t type on 32/64bit architecture properly

Since int64_t is translating into 'long long int' on 32bit, but
'long int' on 64bit. So, "%lld" cannot satisfying both architectures.
This patch uses PRId64 instead of "%lld" to adjust the format string
as following the corresponding architecture.

Change-Id: Iac0d14ac1ccff7b6fba187fc3205e2c81271727b
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
5 years agopass: Fix type-check errors on dlog output 85/195285/3 accepted/tizen/unified/20181213.142312 submit/tizen/20181213.021117
Dongwoo Lee [Wed, 12 Dec 2018 07:12:06 +0000 (16:12 +0900)]
pass: Fix type-check errors on dlog output

Change-Id: Ib465e5b2a0f77ec81943bebcbd38d4e31a688172
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
5 years agothermal: Add explicit type casting for string output 84/195284/3
Dongwoo Lee [Wed, 12 Dec 2018 07:39:25 +0000 (16:39 +0900)]
thermal: Add explicit type casting for string output

Change-Id: Ide6cf245737097dc9907943a5b9c04ed1de8b4b7
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
5 years agogdbus: Remove meaningless parameter for error description 83/195283/3
Dongwoo Lee [Wed, 12 Dec 2018 07:37:53 +0000 (16:37 +0900)]
gdbus: Remove meaningless parameter for error description

Variable arg has Gvariant* type, but format string is not used properly.
Even it changed to %p properly, just print out address of Gvariant
structure has no meaning. So, this patch get rid of this unnecessary
information.

Change-Id: I54229953dfd66c3ff3219cb08d578472cd1ddb60
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
5 years agopass: Fix wrong format string 17/195117/1 accepted/tizen/unified/20181213.065307 submit/tizen/20181212.005204
Dongwoo Lee [Tue, 11 Dec 2018 01:42:57 +0000 (10:42 +0900)]
pass: Fix wrong format string

Change-Id: I5f58009a26e4a29dbf0031c67981961f5fa1fd91
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
5 years agopass: Fix typo 72/194572/1
Suchang Woo [Tue, 23 Oct 2018 08:14:07 +0000 (17:14 +0900)]
pass: Fix typo

Change-Id: I5cce6c6c2a697e78a5871ad8482b1e1c66209293
Signed-off-by: Suchang Woo <suchang.woo@samsung.com>
5 years agoscripts: pmqos: Add default maximum duration value to keep scenario 70/191670/1
Chanwoo Choi [Fri, 19 Oct 2018 08:02:51 +0000 (17:02 +0900)]
scripts: pmqos: Add default maximum duration value to keep scenario

PMQoS keeps the scenario during the required duration.
But if the required duration is over than defined maximum duration,
PMQoS changes the required duration value by using the defined maximum
duration value. So, specify the default mamximum duration value of PMQoS.

Change-Id: Ieab7d6acfd4bd1cdfff7a2d730776441588b805d
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
5 years agocore: Remove unneeded codes 69/191669/1
Chanwoo Choi [Fri, 19 Oct 2018 08:01:32 +0000 (17:01 +0900)]
core: Remove unneeded codes

Change-Id: I6bc9acdc601e9d9d0b1ac9885c7cf952cde2467f
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
5 years agopass: Fix coverity and svace reported issue 04/191604/1
Chanwoo Choi [Fri, 19 Oct 2018 02:43:04 +0000 (11:43 +0900)]
pass: Fix coverity and svace reported issue

Change-Id: Ic36b58d4cf04023d733360f30cb186bd3a57ce2e
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
5 years agopass: Replace obsolescent ato[if] functions with strto[ld] 03/191603/1
Chanwoo Choi [Thu, 18 Oct 2018 07:40:04 +0000 (16:40 +0900)]
pass: Replace obsolescent ato[if] functions with strto[ld]

Replace obsolescent ato[if] functions with recommended strto[ld]
according to codingy guide[1].

[1] https://wiki.sei.cmu.edu/confluence/display/c/MSC24-C.+Do+not+use+deprecated+or+obsolescent+functions

Change-Id: I23342d7312c1fe77b3734cb23b57948ceac7832b
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
5 years agopass: resmon: Fix potential NULL dereference value 02/191602/1
Chanwoo Choi [Thu, 18 Oct 2018 05:54:46 +0000 (14:54 +0900)]
pass: resmon: Fix potential NULL dereference value

Fix potential NULL dereference value by checking the returned value
from memory allocation functions.

Change-Id: I040f75a36f5ec904da45cd89633bba38e206f5ed
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
5 years agounittest: pass_gtest: Send start d-bus message before testing restart operation 01/191601/1
Chanwoo Choi [Mon, 1 Oct 2018 06:48:45 +0000 (15:48 +0900)]
unittest: pass_gtest: Send start d-bus message before testing restart operation

The unittest of PASS tests the 'restart' opertion. It assume that PASS is
already started before testing the unittest. In order to clarify the test
condition of 'restart' operation, make the state of PASS always start state.
So, send start d-bus message before testing restart operation.

Change-Id: I38eb1b75074c7b47b65665cb687f6be2e1cfc8ce
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
5 years agounittest: pass_gtest: Fix typo and remove unneed blank line 00/191600/1
Chanwoo Choi [Mon, 1 Oct 2018 06:39:19 +0000 (15:39 +0900)]
unittest: pass_gtest: Fix typo and remove unneed blank line

Change-Id: Id0bdbcff81f741e3e39ea97efab1057e83fcff4c
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
5 years agounittest: pass_haltests: Remove unreached return statement and unneeded if statement 99/191599/1
Chanwoo Choi [Mon, 1 Oct 2018 00:36:00 +0000 (09:36 +0900)]
unittest: pass_haltests: Remove unreached return statement and unneeded if statement

ASSERT_EQ() macro is able to check the 'return value' and then if 'return value'
is less than zero, print error message and exit the unittest. It means that
the separate 'if statement' for checking 'return value' is not neeeded
when using ASSERT_EQ().

Also, when using ASSERT_EQ() macro, the unittest don't need to call
'return statement' because ASSERT_EQ() return right now if 'return value'
is error. So, remove unreached return statement.

Change-Id: I2808d033e669a021a5b53226bf44c91241640c9a
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
5 years agopass: Add detailed description for all modules with doxygen style 98/191598/1
Chanwoo Choi [Wed, 12 Sep 2018 07:13:32 +0000 (16:13 +0900)]
pass: Add detailed description for all modules with doxygen style

PASS(Power Aware System Serivce) provides the multiple modules like CPUHP,
PMQoS, Thermal Monitor and defines the various structure/enumeration.
In order to improve the readability and the understanding of each unit,
add the detailed description for all modules/functions/structures/enumerations
by using doxygen[1] style.

[1] http://www.doxygen.nl/

Change-Id: I0444a95fb31b7a1ac20c451dda16dcc8791ae30a
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
5 years agounittest: pass_haltests: Change name of hal unit tests 97/191597/1
Chanwoo Choi [Mon, 10 Sep 2018 06:37:55 +0000 (15:37 +0900)]
unittest: pass_haltests: Change name of hal unit tests

Change name of hal unit tests in order to improve readability.

Change-Id: Idbe24227edb172a9965a017ab75cfac6b4993fe3
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
5 years agounittest: pass_gtest: Change name of unit tests 96/191596/1
Chanwoo Choi [Mon, 10 Sep 2018 06:15:24 +0000 (15:15 +0900)]
unittest: pass_gtest: Change name of unit tests

Change the name of unit tests in order to improve the readability.

Change-Id: Ia18c511a36cbcf2e8c26cf0159901aaab3f32ff8
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
5 years agounittest: Rename haltest binary from pass_hal_gtest to pass_haltests 39/186739/1 accepted/tizen_5.0_unified tizen_5.0 accepted/tizen/5.0/unified/20181102.021359 accepted/tizen/unified/20180814.063323 submit/tizen/20180814.043415 submit/tizen_5.0/20181101.000004
Chanwoo Choi [Tue, 14 Aug 2018 04:23:10 +0000 (13:23 +0900)]
unittest: Rename haltest binary from pass_hal_gtest to pass_haltests

Change-Id: I1b22c4d34c09dfe21ebcd83d111d09f3bb571154
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
5 years agounittest: pass_hal_gtest: Modify path of systemctl command 33/185833/1 accepted/tizen/unified/20180808.063338 submit/tizen/20180803.032812
Chanwoo Choi [Fri, 3 Aug 2018 01:54:22 +0000 (10:54 +0900)]
unittest: pass_hal_gtest: Modify path of systemctl command

To prevent malicious binary by changing path of systemctl,
modify path of systemctl command with absolute path.

Change-Id: I6a7bc842d43f954ac3ac9a1a43684d4de7167155
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
5 years agopass: rescon: Fix issue of init_level setting and remove unneeded pass_hotplug 07/185807/5
Chanwoo Choi [Thu, 2 Aug 2018 07:40:51 +0000 (16:40 +0900)]
pass: rescon: Fix issue of init_level setting and remove unneeded pass_hotplug

RESCON (Resource Controller) module changes the value h/w resource
according to 'init_level' property getting from each h/w resource
configuration. Even if RESCON always is initialized before CPUHP init,
RESCON depends on CPUHP in order to get the limited number of online CPU.

Fix issue of init_level setting during init step by getting
limited_min_cpu value without CPUHP module. And remove unneeded pass_hotplug.

Change-Id: If7f13a7197fe93b41c23688d49370631d6d76e5e
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
5 years agounittest: pass_gtest: Use gdbus-definition.h to remove local definition 06/185806/3
Chanwoo Choi [Thu, 2 Aug 2018 07:23:00 +0000 (16:23 +0900)]
unittest: pass_gtest: Use gdbus-definition.h to remove local definition

Remove local dbus definition and then use gdbus-definition.h which
contains dbus path/interface definition. And changes the path of
systemctl command.

Change-Id: Ic5ec5b36b5c36f9580be93fdc38a53cb15894102
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
5 years agogdbus: Separate gdubs-definition.h from gdbus-util.h 05/185805/2
Chanwoo Choi [Thu, 2 Aug 2018 07:17:51 +0000 (16:17 +0900)]
gdbus: Separate gdubs-definition.h from gdbus-util.h

gdbus-util.h contains the gdbus helper function and dbus path/interface
definitions. Some PASS modules only require the dbus path/interface
definitions with gdbus helper function. So, separate gdubs-definition.h
from gdbus-util.h.

Change-Id: I587c728d3d594adc65778e77bf7933a17acde4c1
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
5 years agopackaging: Add pass-unittest package 17/184817/6 accepted/tizen/unified/20180724.073356 submit/tizen/20180724.000537
Chanwoo Choi [Mon, 23 Jul 2018 09:38:39 +0000 (18:38 +0900)]
packaging: Add pass-unittest package

Add pass-unittest-* package contains 'pass_gtest' command binary
which tests the external d-bus interface.

Change-Id: Ic3a022a63fb5ab1001c1e14544a261f45613a7ec
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
5 years agopackaging: Add pass-haltests package 16/184816/6
Chanwoo Choi [Mon, 23 Jul 2018 01:46:26 +0000 (10:46 +0900)]
packaging: Add pass-haltests package

Add pass-haltests-* package contains 'pass_hal_gtest' command binary
which tests the HAL(Hardware Abstract Layer) interface.

Change-Id: I29687b0021c8a6cfd1d1b97560a25fbb3be70e89
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
5 years agounittest: Add testcase to verify pass daemon 15/184815/6
Dongwoo Lee [Mon, 23 Jul 2018 09:36:58 +0000 (18:36 +0900)]
unittest: Add testcase to verify pass daemon

This patch adds unittest based on gtest test suite.

Change-Id: I72a346720b32eb5941b1af9e4afb46533356bd24
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
5 years agounittest: Add testcase to verify PASS HAL interface 14/184814/6
Chanwoo Choi [Wed, 18 Jul 2018 11:11:56 +0000 (20:11 +0900)]
unittest: Add testcase to verify PASS HAL interface

PASS provides HAL(Hardware Abstract Layer) interface for CPU/GPU/Bus/memory
h/w resources and so on. Add testcase to verify PASS HAL interface.

Change-Id: I2c229b13e303f46007e32cc39f559fb29d8e1b78
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
5 years agopass: hal: Fix error number from EINVAL to EPERM/ENODEV 13/184813/2
Chanwoo Choi [Fri, 20 Jul 2018 04:23:11 +0000 (13:23 +0900)]
pass: hal: Fix error number from EINVAL to EPERM/ENODEV

All HAL functions return '-EINVAL' error number when error happen.
It is necessary to return more correct error value. Return -EPERM value
if HAL(Hardware Abstract Layer) function is not supported according to
h/w resource type and return -ENODEV value if HAL function is not implemented
on HAL package.

Change-Id: I0b0da7429f38aa0362293275849a713e6020a763
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agohal: Move LOG_TAG definition to makefile to remove the duplicate 24/184524/1
Chanwoo Choi [Tue, 17 Jul 2018 09:38:21 +0000 (18:38 +0900)]
hal: Move LOG_TAG definition to makefile to remove the duplicate

Each log header file defines LOG_TAG. It defines LOG_TAG on Makefile
in order to remove the duplicate definitions.

Change-Id: I3b4b08008e259fe3a0c8257ffaad0f291666a0c4
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agoRemove unused macro and definitions from CMakeLists.txt 23/184523/1
Chanwoo Choi [Wed, 18 Jul 2018 05:42:04 +0000 (14:42 +0900)]
Remove unused macro and definitions from CMakeLists.txt

Change-Id: Ib69cb04851a28a646f9682eebae5587a361c00a0
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agogdbus: Move dbus interface definition to one header file 22/184522/1
Chanwoo Choi [Thu, 17 May 2018 04:02:10 +0000 (13:02 +0900)]
gdbus: Move dbus interface definition to one header file

Move dbus interface definition to gdbus-util.h header file
and clean-up code as following:
- Rename dbus definition from PASS_DBUS_BUS_NAME to DBUS_CORE_BUS_NAME
- Use ARRAY_SIZE() macro and then remove unnecessary following definitions:
  : DBUS_CORE_I_NUM_SIGNALS
  : DBUS_PMQOS_I_NUM_SIGNALS

Change-Id: Ic3f78d84b353bfe382330366d10292711de8c5fa
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agopackaging: Remove unused libpass.manifest file 43/184343/1
Chanwoo Choi [Tue, 17 Jul 2018 09:12:13 +0000 (18:12 +0900)]
packaging: Remove unused libpass.manifest file

Change-Id: I62564514c93b12f7211f37427207aa898e315092
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agocore: Remove unused helper functions 62/180962/1
Chanwoo Choi [Fri, 1 Jun 2018 01:25:46 +0000 (10:25 +0900)]
core: Remove unused helper functions

Change-Id: I70c130c7715dab70f11294547889022a44ff93ce
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agopackaging: Remove unneeded package's dependency 87/178687/1 accepted/tizen/unified/20180516.065450 submit/tizen/20180514.060515
Chanwoo Choi [Fri, 11 May 2018 08:50:33 +0000 (17:50 +0900)]
packaging: Remove unneeded package's dependency

Change-Id: I7a641708123de7f02c68aa36685e8cb1fa1aed3c
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agopass: thermal: Fix issue during stop PASS daemon 39/178439/1 accepted/tizen/unified/20180510.134400 submit/tizen/20180510.070432
Chanwoo Choi [Thu, 10 May 2018 05:06:50 +0000 (14:06 +0900)]
pass: thermal: Fix issue during stop PASS daemon

thermal->state indicates the "thermal_support" property in the configuration.
If user doesn't want to use thermal monitor with "thermal_support=no",
thermal->state is 0 (PASS_OFF). It is not error when thermal->state is zero.
Just return zero value instead of error.

Change-Id: I04f76774afb3b811d56dc0ebfb3f0888541e649f
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agoRemove dependency of unneeded libtzplatform-config package 31/178331/2
Chanwoo Choi [Wed, 9 May 2018 10:23:15 +0000 (19:23 +0900)]
Remove dependency of unneeded libtzplatform-config package

Change-Id: Ifd1a7b230ebd138bd3e991221bb7d066a02d0d01
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>