pass-hal: rpi: Convert script format to json to improve readability 53/261953/3 accepted/tizen/unified/20210809.061431 submit/tizen/20210809.032652
authorChanwoo Choi <cw00.choi@samsung.com>
Tue, 27 Jul 2021 05:39:07 +0000 (14:39 +0900)
committerChanwoo Choi <cw00.choi@samsung.com>
Mon, 2 Aug 2021 07:28:46 +0000 (16:28 +0900)
The legacy .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: I378d14bfae6f0ae3bbb58362e2eda0212cef6b11
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
CMakeLists.txt
packaging/pass-hal-rpi.spec
scripts/pass-cpu0.conf [deleted file]
scripts/pass-cpu0.json [new file with mode: 0644]
scripts/pass-memory.conf [deleted file]
scripts/pass-memory.json [new file with mode: 0644]
scripts/pass.conf [deleted file]
scripts/pass.json [new file with mode: 0644]

index ed1e85a..d9822df 100644 (file)
@@ -28,9 +28,9 @@ ADD_LIBRARY(${LIBRARY_NAME} SHARED ${SRCS})
 TARGET_LINK_LIBRARIES(${LIBRARY_NAME} ${pkgs_LDFLAGS} -ldl)
 
 SET(CONF_FILES
-       ${CMAKE_CURRENT_SOURCE_DIR}/scripts/pass.conf
-       ${CMAKE_CURRENT_SOURCE_DIR}/scripts/pass-cpu0.conf
-       ${CMAKE_CURRENT_SOURCE_DIR}/scripts/pass-memory.conf)
+       ${CMAKE_CURRENT_SOURCE_DIR}/scripts/pass.json
+       ${CMAKE_CURRENT_SOURCE_DIR}/scripts/pass-cpu0.json
+       ${CMAKE_CURRENT_SOURCE_DIR}/scripts/pass-memory.json)
 INSTALL(FILES ${CONF_FILES} DESTINATION /hal/etc/pass)
 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/scripts/pass-hal.conf DESTINATION /hal/lib/tmpfiles.d)
 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE DESTINATION ${HAL_LICENSEDIR}/${PROJECT_NAME})
index 9c686e6..258b94d 100644 (file)
@@ -56,6 +56,6 @@ fi
 %{_hal_licensedir}/%{name}/LICENSE
 %{_hal_libdir}/*.so
 /hal/lib/tmpfiles.d/pass-hal.conf
-%config %{_hal_sysconfdir}/pass/pass.conf
-%config %{_hal_sysconfdir}/pass/pass-cpu0.conf
-%config %{_hal_sysconfdir}/pass/pass-memory.conf
+%config %{_hal_sysconfdir}/pass/pass.json
+%config %{_hal_sysconfdir}/pass/pass-cpu0.json
+%config %{_hal_sysconfdir}/pass/pass-memory.json
diff --git a/scripts/pass-cpu0.conf b/scripts/pass-cpu0.conf
deleted file mode 100644 (file)
index 637e17f..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-[Pass]
-pass_support=1
-pass_gov_type=1
-
-pass_num_scenario_levels=3
-pass_init_scenario_level=0
-
-####################################################
-### Scenario Level for PMQoS and Thermal Monitor ###
-####################################################
-[ScenarioLevel0]
-limit_min_freq=600000
-limit_max_freq=1500000
-
-[ScenarioLevel1]
-limit_min_freq=1500000
-limit_max_freq=1500000
-
-[ScenarioLevel2]
-limit_min_freq=600000
-limit_max_freq=600000
-
-#########################
-### Scenario of PMQoS ###
-#########################
-[PassScenario]
-pass_scenario_support=yes
-pass_num_scenarios=3
-
-[Scenario0]
-name=AppLaunch
-support=yes
-scenario_level=1
-
-[Scenario1]
-name=UltraPowerSaving
-support=yes
-scenario_level=2
-
-[Scenario2]
-name=Performance
-support=yes
-scenario_level=1
-
-########################
-### Thermal Monitor  ###
-########################
-
-# Following action name are defiend on Tizen platform.
-# The 'temperature' of thermal.scenario must be defined in descending order.
-# If you change the following name, doesn't guarantee the compatibility.
-# - Release, Warning, LimitAction, Shutdown
-
-[thermal]
-thermal_support=yes
-thermal_number_of_scenario=4
-thermal_timer_interval_ms=5000
-
-[thermal.scenario0]
-support=yes
-name=Release
-temperature=73
-timer_interval_ms=5000
-scenario_level=0
-
-[thermal.scenario1]
-support=yes
-name=Warning
-temperature=77
-timer_interval_ms=3000
-
-[thermal.scenario2]
-support=yes
-name=LimitAction
-temperature=80
-timer_interval_ms=1000
-scenario_level=2
-
-[thermal.scenario3]
-support=yes
-name=Shutdown
-temperature=85
-timer_interval_ms=1000
-scenario_level=2
diff --git a/scripts/pass-cpu0.json b/scripts/pass-cpu0.json
new file mode 100644 (file)
index 0000000..fd535d0
--- /dev/null
@@ -0,0 +1,64 @@
+{
+       "support"                       : true,
+       "init_level"                    : 0,
+       "level_list"                    :
+       [
+               {
+                       "level"                         : 0,
+                       "dvfs,minimum_frequency_khz"    : 600000,
+                       "dvfs,maximum_frequency_khz"    : 1500000
+               }, {
+                       "level"                         : 1,
+                       "dvfs,minimum_frequency_khz"    : 1500000,
+                       "dvfs,maximum_frequency_khz"    : 1500000
+               }, {
+                       "level"                         : 2,
+                       "dvfs,minimum_frequency_khz"    : 600000,
+                       "dvfs,maximum_frequency_khz"    : 600000
+               }
+       ],
+
+       "pmqos_support"                 : true,
+       "pmqos_scenario_list":
+       [
+               {
+                       "name"          : "AppLaunch",
+                       "target_level"  : 1
+               }, {
+                       "name"          : "UltraPowerSaving",
+                       "target_level"  : 2
+               }, {
+                       "name"          : "Performance",
+                       "target_level"  : 1
+               }
+       ],
+
+       "thermal_support"               : true,
+       "thermal_timer_interval_ms"     : 5000,
+       "thermal_scenario_list":
+       [
+               {
+                       "name"                  : "Release",
+                       "temperature"           : 73,
+                       "timer_interval_ms"     : 5000,
+                       "target_level"          : 0
+               }, {
+                       "name"                  : "Warning",
+                       "temperature"           : 77,
+                       "timer_interval_ms"     : 3000,
+                       "target_level"          : 0
+               }, {
+                       "name"                  : "LimitAction",
+                       "temperature"           : 80,
+                       "timer_interval_ms"     : 1000,
+                       "target_level"          : 2
+               }, {
+                       "name"                  : "Shutdown",
+                       "temperature"           : 85,
+                       "timer_interval_ms"     : 1000,
+                       "target_level"          : 2
+               }
+       ],
+
+       "cpuhp_support"                 : false
+}
diff --git a/scripts/pass-memory.conf b/scripts/pass-memory.conf
deleted file mode 100644 (file)
index b3494b3..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-[Pass]
-pass_support=1
-pass_gov_type=0
-
-pass_num_scenario_levels=2
-pass_init_scenario_level=0
-
-####################################################
-### Scenario Level for PMQoS and Thermal Monitor ###
-####################################################
-[ScenarioLevel0]
-fault_around_bytes=4096
-
-[ScenarioLevel1]
-fault_around_bytes=65536
-
-#########################
-### Scenario of PMQoS ###
-#########################
-[PassScenario]
-pass_scenario_support=yes
-pass_num_scenarios=2
-
-[Scenario0]
-name=AppLaunch
-support=yes
-scenario_level=0
-
-[Scenario1]
-name=UltraPowerSaving
-support=yes
-scenario_level=0
-
-[Scenario1]
-name=Performance
-support=yes
-scenario_level=1
diff --git a/scripts/pass-memory.json b/scripts/pass-memory.json
new file mode 100644 (file)
index 0000000..4099313
--- /dev/null
@@ -0,0 +1,33 @@
+{
+       "support"               : true,
+       "init_level"            : 0,
+       "level_list"            :
+       [
+               {
+                       "level"                         : 0,
+                       "memory,fault_around_bytes"     : 4096
+               }, {
+                       "level"                         : 1,
+                       "memory,fault_around_bytes"     : 65536
+               }
+       ],
+
+       "pmqos_support"         : true,
+       "pmqos_scenario_list"   :
+       [
+               {
+                       "name"          : "AppLaunch",
+                       "target_level"  : 0
+               }, {
+                       "name"          : "UltraPowerSaving",
+                       "target_level"  : 0
+               }, {
+                       "name"          : "Performance",
+                       "target_level"  : 1
+               }
+       ],
+
+       "thermal_support"       : false,
+
+       "cpuhp_support"         : false
+}
diff --git a/scripts/pass.conf b/scripts/pass.conf
deleted file mode 100644 (file)
index 3f52562..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-# Default pass.conf
-# - If you want to use PASS(Power Aware System Service), you have to create
-# new 'pass-[target type].conf' configuration file.
-[PassResource]
-pass_compatible=raspberrypi,4-model-b
-pass_path_compatible=/proc/device-tree/compatible
-pass_num_resources=2
-
-[PassResource0]
-pass_res_type=cpu
-pass_res_name=cpu0
-pass_res_thermal_name=thermal_zone0
-pass_path_conf_file=/hal/etc/pass/pass-cpu0.conf
-pass_first_cpu=0
-pass_num_cpus=4
-
-[PassResource1]
-pass_res_type=memory
-pass_res_name=memory
-pass_path_conf_file=/hal/etc/pass/pass-memory.conf
diff --git a/scripts/pass.json b/scripts/pass.json
new file mode 100644 (file)
index 0000000..8c9937f
--- /dev/null
@@ -0,0 +1,20 @@
+{
+       "board_name"            : "raspberrypi,4-model-b",
+       "board_name_path"       : "/proc/device-tree/compatible",
+       "device_list"           :
+       [
+               {
+                       "device_type"           : "cpu",
+                       "device_name"           : "cpu0",
+                       "device_config_path"    : "/hal/etc/pass/pass-cpu0.json",
+                       "thermal_device_name"   : "thermal_zone0",
+                       "cpu,number_of_cpus"    : 4,
+                       "cpu,first_cpu"         : 0,
+                       "cpu,cpu_load_path"     : null
+               }, {
+                       "device_type"           : "memory",
+                       "device_name"           : "memory",
+                       "device_config_path"    : "/hal/etc/pass/pass-memory.json"
+               }
+       ]
+}