From ad6ae5ba2e0691ddeb4d3846492cca318a574202 Mon Sep 17 00:00:00 2001 From: Chanwoo Choi Date: Mon, 5 Jun 2017 15:08:11 +0900 Subject: [PATCH 01/16] pass-hal: tm2: Add missing LICENSE file and license information This patch adds the missing license information for *.(c|h). and pass-hal-tm2 uses the Apache-2.0 License. Also, this patch adds the LICENSE file for Apache-2.0. Change-Id: Iec366e8a9cbc4ab6b0fb5c37bfae75d2c23205a4 Signed-off-by: Chanwoo Choi --- LICENSE | 203 +++++++++++++++++++++++++++++++++++++++++++++++++++++ src/bus/bus.c | 17 +++++ src/cpu/cpu.c | 17 +++++ src/gpu/gpu.c | 17 +++++ src/shared/sysfs.c | 17 +++++ 5 files changed, 271 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..247c97d --- /dev/null +++ b/LICENSE @@ -0,0 +1,203 @@ +Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/src/bus/bus.c b/src/bus/bus.c index 989b78e..82ca526 100644 --- a/src/bus/bus.c +++ b/src/bus/bus.c @@ -1,3 +1,20 @@ +/* + * PASS (Power Aware System Service) + * + * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #include #include #include diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c index b3a7b77..1683cfe 100644 --- a/src/cpu/cpu.c +++ b/src/cpu/cpu.c @@ -1,3 +1,20 @@ +/* + * PASS (Power Aware System Service) + * + * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #include #include #include diff --git a/src/gpu/gpu.c b/src/gpu/gpu.c index 7954031..aaf9cc4 100644 --- a/src/gpu/gpu.c +++ b/src/gpu/gpu.c @@ -1,3 +1,20 @@ +/* + * PASS (Power Aware System Service) + * + * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #include #include #include diff --git a/src/shared/sysfs.c b/src/shared/sysfs.c index 9217b40..57a168b 100644 --- a/src/shared/sysfs.c +++ b/src/shared/sysfs.c @@ -1,3 +1,20 @@ +/* + * PASS (Power Aware System Service) + * + * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #include #include #include -- 2.7.4 From fdc5fb642199d0011134d48e4fe790f178541056 Mon Sep 17 00:00:00 2001 From: Chanwoo Choi Date: Fri, 9 Jun 2017 17:59:31 +0900 Subject: [PATCH 02/16] pass-hal: tm2: Remove unused scenarios This patch removes the unused scenarios except for AppLaunch and UltraPowerSaving. Change-Id: Ic2f1570bf22bd9d2cc5043ff5bb72d9f2fc0abb7 Signed-off-by: Chanwoo Choi --- scripts/pass-resource0.conf | 228 +------------------------------------------- scripts/pass-resource1.conf | 228 +------------------------------------------- scripts/pass-resource2.conf | 228 +------------------------------------------- scripts/pass-resource3.conf | 228 +------------------------------------------- scripts/pass-resource4.conf | 228 +------------------------------------------- 5 files changed, 20 insertions(+), 1120 deletions(-) diff --git a/scripts/pass-resource0.conf b/scripts/pass-resource0.conf index 2e88730..d4223d4 100644 --- a/scripts/pass-resource0.conf +++ b/scripts/pass-resource0.conf @@ -173,236 +173,16 @@ num_right_cond=0 ############################ [PassScenario] pass_scenario_support=yes -pass_num_scenarios=52 +pass_num_scenarios=2 [Scenario0] name=AppLaunch support=yes - min_level=9 max_level=11 [Scenario1] -name=AppLaunchHome -support=yes - -min_level=9 -max_level=11 - -[Scenario2] -name=BeautyShot -support=no - -[Scenario3] -name=Browser -support=no - -[Scenario4] -name=BrowserDash -support=no - -[Scenario5] -name=BrowserJavaScript -support=yes - -min_level=9 -max_level=11 - -[Scenario6] -name=BrowserLoading -support=no - -[Scenario7] -name=BrowserScroll -support=no - -[Scenario8] -name=CallSound -support=no - -[Scenario9] -name=CameraBurstShot -support=no - -[Scenario10] -name=CameraCaptureAtRec -support=no - -[Scenario11] -name=CameraPreview -support=no - -[Scenario12] -name=CameraSoundAndShot -support=no - -[Scenario13] -name=ContactSearch -support=no - -[Scenario14] -name=Emergency -support=no - -[Scenario15] -name=GalleryScroll -support=no - -[Scenario16] -name=GalleryRotation -support=no - -[Scenario17] -name=GetDefaultLockTime -support=no - -[Scenario18] -name=GpsSerialCno -support=no - -[Scenario19] -name=GpuBoost -support=no - -[Scenario20] -name=GpuWakeup -support=no - -[Scenario21] -name=HomeScreen -support=no - -[Scenario22] -name=ImageViewer -support=no - -[Scenario23] -name=IMEInput -support=no - -[Scenario24] -name=LockScreen -support=no - -[Scenario25] -name=LowBattery -support=no - -[Scenario26] -name=MtpSendFile -support=no - -[Scenario27] -name=MusicPlayLcdOn -support=no - -[Scenario28] -name=PowerSaving -support=no - -[Scenario29] -name=ProcessCrashed -support=no - -[Scenario30] -name=ReservedMode -support=no - -[Scenario31] -name=ScreenMirroring -support=no - -[Scenario32] -name=SmemoZoom -support=no - -[Scenario33] -name=SVoice -support=no - -[Scenario34] -name=WebappLaunch -support=no - -[Scenario35] -name=WifiThroughput -support=no - -[Scenario36] -name=PowerOff -support=no - -[Scenario37] -name=WebAppDrag -support=no - -[Scenario38] -name=WebAppFlick -support=no - -[Scenario39] -name=SensorWakeup -support=no - -[Scenario40] -name=UgLaunch -support=no - -[Scenario41] -name=MusicScroll -support=no - -[Scenario42] -name=FileScroll -support=no - -[Scenario43] -name=VideoScroll -support=no - -[Scenario44] -name=EmailScroll -support=yes - -min_level=9 -max_level=11 - -[Scenario45] -name=ContactScroll -support=no - -[Scenario46] -name=TizenStoreScroll -support=yes - -min_level=9 -max_level=11 - -[Scenario47] -name=CallLogScroll -support=yes - -min_level=9 -max_level=11 - -[Scenario48] -name=MyfilesScroll -support=yes - -min_level=9 -max_level=11 - -[Scenario49] -name=MessageScroll -support=yes - -min_level=9 -max_level=11 - -[Scenario50] -name=SIOP -support=no - -[Scenario51] name=UltraPowerSaving -support=no +support=yes +min_level=0 +max_level=0 diff --git a/scripts/pass-resource1.conf b/scripts/pass-resource1.conf index 040388d..0468abd 100644 --- a/scripts/pass-resource1.conf +++ b/scripts/pass-resource1.conf @@ -221,236 +221,16 @@ num_right_cond=0 ############################ [PassScenario] pass_scenario_support=yes -pass_num_scenarios=52 +pass_num_scenarios=2 [Scenario0] name=AppLaunch support=yes - min_level=9 max_level=11 [Scenario1] -name=AppLaunchHome -support=yes - -min_level=9 -max_level=11 - -[Scenario2] -name=BeautyShot -support=no - -[Scenario3] -name=Browser -support=no - -[Scenario4] -name=BrowserDash -support=no - -[Scenario5] -name=BrowserJavaScript -support=yes - -min_level=9 -max_level=11 - -[Scenario6] -name=BrowserLoading -support=no - -[Scenario7] -name=BrowserScroll -support=no - -[Scenario8] -name=CallSound -support=no - -[Scenario9] -name=CameraBurstShot -support=no - -[Scenario10] -name=CameraCaptureAtRec -support=no - -[Scenario11] -name=CameraPreview -support=no - -[Scenario12] -name=CameraSoundAndShot -support=no - -[Scenario13] -name=ContactSearch -support=no - -[Scenario14] -name=Emergency -support=no - -[Scenario15] -name=GalleryScroll -support=no - -[Scenario16] -name=GalleryRotation -support=no - -[Scenario17] -name=GetDefaultLockTime -support=no - -[Scenario18] -name=GpsSerialCno -support=no - -[Scenario19] -name=GpuBoost -support=no - -[Scenario20] -name=GpuWakeup -support=no - -[Scenario21] -name=HomeScreen -support=no - -[Scenario22] -name=ImageViewer -support=no - -[Scenario23] -name=IMEInput -support=no - -[Scenario24] -name=LockScreen -support=no - -[Scenario25] -name=LowBattery -support=no - -[Scenario26] -name=MtpSendFile -support=no - -[Scenario27] -name=MusicPlayLcdOn -support=no - -[Scenario28] -name=PowerSaving -support=no - -[Scenario29] -name=ProcessCrashed -support=no - -[Scenario30] -name=ReservedMode -support=no - -[Scenario31] -name=ScreenMirroring -support=no - -[Scenario32] -name=SmemoZoom -support=no - -[Scenario33] -name=SVoice -support=no - -[Scenario34] -name=WebappLaunch -support=no - -[Scenario35] -name=WifiThroughput -support=no - -[Scenario36] -name=PowerOff -support=no - -[Scenario37] -name=WebAppDrag -support=no - -[Scenario38] -name=WebAppFlick -support=no - -[Scenario39] -name=SensorWakeup -support=no - -[Scenario40] -name=UgLaunch -support=no - -[Scenario41] -name=MusicScroll -support=no - -[Scenario42] -name=FileScroll -support=no - -[Scenario43] -name=VideoScroll -support=no - -[Scenario44] -name=EmailScroll -support=yes - -min_level=9 -max_level=11 - -[Scenario45] -name=ContactScroll -support=no - -[Scenario46] -name=TizenStoreScroll -support=yes - -min_level=9 -max_level=11 - -[Scenario47] -name=CallLogScroll -support=yes - -min_level=9 -max_level=11 - -[Scenario48] -name=MyfilesScroll -support=yes - -min_level=9 -max_level=11 - -[Scenario49] -name=MessageScroll -support=yes - -min_level=9 -max_level=11 - -[Scenario50] -name=SIOP -support=no - -[Scenario51] name=UltraPowerSaving -support=no +support=yes +min_level=0 +max_level=0 diff --git a/scripts/pass-resource2.conf b/scripts/pass-resource2.conf index e525d7c..ed1c893 100644 --- a/scripts/pass-resource2.conf +++ b/scripts/pass-resource2.conf @@ -24,236 +24,16 @@ limit_min_freq=400000000 ############################ [PassScenario] pass_scenario_support=yes -pass_num_scenarios=52 +pass_num_scenarios=2 [Scenario0] name=AppLaunch support=yes - min_level=3 max_level=3 [Scenario1] -name=AppLaunchHome -support=yes - -min_level=3 -max_level=3 - -[Scenario2] -name=BeautyShot -support=no - -[Scenario3] -name=Browser -support=no - -[Scenario4] -name=BrowserDash -support=no - -[Scenario5] -name=BrowserJavaScript -support=yes - -min_level=3 -max_level=3 - -[Scenario6] -name=BrowserLoading -support=no - -[Scenario7] -name=BrowserScroll -support=no - -[Scenario8] -name=CallSound -support=no - -[Scenario9] -name=CameraBurstShot -support=no - -[Scenario10] -name=CameraCaptureAtRec -support=no - -[Scenario11] -name=CameraPreview -support=no - -[Scenario12] -name=CameraSoundAndShot -support=no - -[Scenario13] -name=ContactSearch -support=no - -[Scenario14] -name=Emergency -support=no - -[Scenario15] -name=GalleryScroll -support=no - -[Scenario16] -name=GalleryRotation -support=no - -[Scenario17] -name=GetDefaultLockTime -support=no - -[Scenario18] -name=GpsSerialCno -support=no - -[Scenario19] -name=GpuBoost -support=no - -[Scenario20] -name=GpuWakeup -support=no - -[Scenario21] -name=HomeScreen -support=no - -[Scenario22] -name=ImageViewer -support=no - -[Scenario23] -name=IMEInput -support=no - -[Scenario24] -name=LockScreen -support=no - -[Scenario25] -name=LowBattery -support=no - -[Scenario26] -name=MtpSendFile -support=no - -[Scenario27] -name=MusicPlayLcdOn -support=no - -[Scenario28] -name=PowerSaving -support=no - -[Scenario29] -name=ProcessCrashed -support=no - -[Scenario30] -name=ReservedMode -support=no - -[Scenario31] -name=ScreenMirroring -support=no - -[Scenario32] -name=SmemoZoom -support=no - -[Scenario33] -name=SVoice -support=no - -[Scenario34] -name=WebappLaunch -support=no - -[Scenario35] -name=WifiThroughput -support=no - -[Scenario36] -name=PowerOff -support=no - -[Scenario37] -name=WebAppDrag -support=no - -[Scenario38] -name=WebAppFlick -support=no - -[Scenario39] -name=SensorWakeup -support=no - -[Scenario40] -name=UgLaunch -support=no - -[Scenario41] -name=MusicScroll -support=no - -[Scenario42] -name=FileScroll -support=no - -[Scenario43] -name=VideoScroll -support=no - -[Scenario44] -name=EmailScroll -support=yes - -min_level=3 -max_level=3 - -[Scenario45] -name=ContactScroll -support=no - -[Scenario46] -name=TizenStoreScroll -support=yes - -min_level=3 -max_level=3 - -[Scenario47] -name=CallLogScroll -support=yes - -min_level=3 -max_level=3 - -[Scenario48] -name=MyfilesScroll -support=yes - -min_level=3 -max_level=3 - -[Scenario49] -name=MessageScroll -support=yes - -min_level=3 -max_level=3 - -[Scenario50] -name=SIOP -support=no - -[Scenario51] name=UltraPowerSaving -support=no +support=yes +min_level=0 +max_level=0 diff --git a/scripts/pass-resource3.conf b/scripts/pass-resource3.conf index 9469f74..2b8b368 100644 --- a/scripts/pass-resource3.conf +++ b/scripts/pass-resource3.conf @@ -27,236 +27,16 @@ limit_min_freq=825000000 ############################ [PassScenario] pass_scenario_support=yes -pass_num_scenarios=52 +pass_num_scenarios=2 [Scenario0] name=AppLaunch support=yes - min_level=4 max_level=4 [Scenario1] -name=AppLaunchHome -support=yes - -min_level=4 -max_level=4 - -[Scenario2] -name=BeautyShot -support=no - -[Scenario3] -name=Browser -support=no - -[Scenario4] -name=BrowserDash -support=no - -[Scenario5] -name=BrowserJavaScript -support=yes - -min_level=4 -max_level=4 - -[Scenario6] -name=BrowserLoading -support=no - -[Scenario7] -name=BrowserScroll -support=no - -[Scenario8] -name=CallSound -support=no - -[Scenario9] -name=CameraBurstShot -support=no - -[Scenario10] -name=CameraCaptureAtRec -support=no - -[Scenario11] -name=CameraPreview -support=no - -[Scenario12] -name=CameraSoundAndShot -support=no - -[Scenario13] -name=ContactSearch -support=no - -[Scenario14] -name=Emergency -support=no - -[Scenario15] -name=GalleryScroll -support=no - -[Scenario16] -name=GalleryRotation -support=no - -[Scenario17] -name=GetDefaultLockTime -support=no - -[Scenario18] -name=GpsSerialCno -support=no - -[Scenario19] -name=GpuBoost -support=no - -[Scenario20] -name=GpuWakeup -support=no - -[Scenario21] -name=HomeScreen -support=no - -[Scenario22] -name=ImageViewer -support=no - -[Scenario23] -name=IMEInput -support=no - -[Scenario24] -name=LockScreen -support=no - -[Scenario25] -name=LowBattery -support=no - -[Scenario26] -name=MtpSendFile -support=no - -[Scenario27] -name=MusicPlayLcdOn -support=no - -[Scenario28] -name=PowerSaving -support=no - -[Scenario29] -name=ProcessCrashed -support=no - -[Scenario30] -name=ReservedMode -support=no - -[Scenario31] -name=ScreenMirroring -support=no - -[Scenario32] -name=SmemoZoom -support=no - -[Scenario33] -name=SVoice -support=no - -[Scenario34] -name=WebappLaunch -support=no - -[Scenario35] -name=WifiThroughput -support=no - -[Scenario36] -name=PowerOff -support=no - -[Scenario37] -name=WebAppDrag -support=no - -[Scenario38] -name=WebAppFlick -support=no - -[Scenario39] -name=SensorWakeup -support=no - -[Scenario40] -name=UgLaunch -support=no - -[Scenario41] -name=MusicScroll -support=no - -[Scenario42] -name=FileScroll -support=no - -[Scenario43] -name=VideoScroll -support=no - -[Scenario44] -name=EmailScroll -support=yes - -min_level=4 -max_level=4 - -[Scenario45] -name=ContactScroll -support=no - -[Scenario46] -name=TizenStoreScroll -support=yes - -min_level=4 -max_level=4 - -[Scenario47] -name=CallLogScroll -support=yes - -min_level=4 -max_level=4 - -[Scenario48] -name=MyfilesScroll -support=yes - -min_level=4 -max_level=4 - -[Scenario49] -name=MessageScroll -support=yes - -min_level=4 -max_level=4 - -[Scenario50] -name=SIOP -support=no - -[Scenario51] name=UltraPowerSaving -support=no +support=yes +min_level=0 +max_level=0 diff --git a/scripts/pass-resource4.conf b/scripts/pass-resource4.conf index e7675b3..18cced1 100644 --- a/scripts/pass-resource4.conf +++ b/scripts/pass-resource4.conf @@ -27,236 +27,16 @@ limit_min_freq=700000000 ############################ [PassScenario] pass_scenario_support=yes -pass_num_scenarios=52 +pass_num_scenarios=2 [Scenario0] name=AppLaunch support=yes - min_level=3 max_level=3 [Scenario1] -name=AppLaunchHome -support=yes - -min_level=3 -max_level=3 - -[Scenario2] -name=BeautyShot -support=no - -[Scenario3] -name=Browser -support=no - -[Scenario4] -name=BrowserDash -support=no - -[Scenario5] -name=BrowserJavaScript -support=yes - -min_level=3 -max_level=3 - -[Scenario6] -name=BrowserLoading -support=no - -[Scenario7] -name=BrowserScroll -support=no - -[Scenario8] -name=CallSound -support=no - -[Scenario9] -name=CameraBurstShot -support=no - -[Scenario10] -name=CameraCaptureAtRec -support=no - -[Scenario11] -name=CameraPreview -support=no - -[Scenario12] -name=CameraSoundAndShot -support=no - -[Scenario13] -name=ContactSearch -support=no - -[Scenario14] -name=Emergency -support=no - -[Scenario15] -name=GalleryScroll -support=no - -[Scenario16] -name=GalleryRotation -support=no - -[Scenario17] -name=GetDefaultLockTime -support=no - -[Scenario18] -name=GpsSerialCno -support=no - -[Scenario19] -name=GpuBoost -support=no - -[Scenario20] -name=GpuWakeup -support=no - -[Scenario21] -name=HomeScreen -support=no - -[Scenario22] -name=ImageViewer -support=no - -[Scenario23] -name=IMEInput -support=no - -[Scenario24] -name=LockScreen -support=no - -[Scenario25] -name=LowBattery -support=no - -[Scenario26] -name=MtpSendFile -support=no - -[Scenario27] -name=MusicPlayLcdOn -support=no - -[Scenario28] -name=PowerSaving -support=no - -[Scenario29] -name=ProcessCrashed -support=no - -[Scenario30] -name=ReservedMode -support=no - -[Scenario31] -name=ScreenMirroring -support=no - -[Scenario32] -name=SmemoZoom -support=no - -[Scenario33] -name=SVoice -support=no - -[Scenario34] -name=WebappLaunch -support=no - -[Scenario35] -name=WifiThroughput -support=no - -[Scenario36] -name=PowerOff -support=no - -[Scenario37] -name=WebAppDrag -support=no - -[Scenario38] -name=WebAppFlick -support=no - -[Scenario39] -name=SensorWakeup -support=no - -[Scenario40] -name=UgLaunch -support=no - -[Scenario41] -name=MusicScroll -support=no - -[Scenario42] -name=FileScroll -support=no - -[Scenario43] -name=VideoScroll -support=no - -[Scenario44] -name=EmailScroll -support=yes - -min_level=3 -max_level=3 - -[Scenario45] -name=ContactScroll -support=no - -[Scenario46] -name=TizenStoreScroll -support=yes - -min_level=3 -max_level=3 - -[Scenario47] -name=CallLogScroll -support=yes - -min_level=3 -max_level=3 - -[Scenario48] -name=MyfilesScroll -support=yes - -min_level=3 -max_level=3 - -[Scenario49] -name=MessageScroll -support=yes - -min_level=3 -max_level=3 - -[Scenario50] -name=SIOP -support=no - -[Scenario51] name=UltraPowerSaving -support=no +support=yes +min_level=0 +max_level=0 -- 2.7.4 From a8ae18e9c2ac5108cf5d8381b43723880dfb012b Mon Sep 17 00:00:00 2001 From: Chanwoo Choi Date: Thu, 15 Jun 2017 18:57:04 +0900 Subject: [PATCH 03/16] pass-hal: tm2: Add pass-hal.conf to change the permission of sysfs nodes The pass-hal-tm2 package handles the many sysfs nodes in order to change the state of h/w resources. All sysfs node should be required to change the permission from root to system_fw because PASS daemon has the system_fw permission. So, this patch adds new pass-hal.conf which contains the permission information for the required sysfs nodes. Change-Id: Iab55cdc120e3283e35f2d97b4f3e887400a2fcfd Signed-off-by: Chanwoo Choi --- CMakeLists.txt | 1 + packaging/pass-hal-tm2.spec | 5 ++++- scripts/pass-hal.conf | 30 ++++++++++++++++++++++++++++++ 3 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 scripts/pass-hal.conf diff --git a/CMakeLists.txt b/CMakeLists.txt index 35033cc..edef99c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,3 +25,4 @@ INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/scripts/pass-resource1.conf DESTINATIO INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/scripts/pass-resource2.conf DESTINATION /etc/pass) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/scripts/pass-resource3.conf DESTINATION /etc/pass) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/scripts/pass-resource4.conf DESTINATION /etc/pass) +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/scripts/pass-hal.conf DESTINATION ${LIB_INSTALL_DIR}/tmpfiles.d) diff --git a/packaging/pass-hal-tm2.spec b/packaging/pass-hal-tm2.spec index c5bed67..fe46ef7 100644 --- a/packaging/pass-hal-tm2.spec +++ b/packaging/pass-hal-tm2.spec @@ -36,13 +36,16 @@ rm -rf %{buildroot} %make_install -%post -p /sbin/ldconfig +%post +/sbin/ldconfig +systemd-tmpfiles /usr/lib/tmpfiles.d/pass-hal.conf --create %postun -p /sbin/ldconfig %files %manifest %{name}.manifest %{_libdir}/pass/*.so +%{_libdir}/tmpfiles.d/pass-hal.conf %config %{_sysconfdir}/pass/pass.conf %config %{_sysconfdir}/pass/pass-resource0.conf diff --git a/scripts/pass-hal.conf b/scripts/pass-hal.conf new file mode 100644 index 0000000..5d823db --- /dev/null +++ b/scripts/pass-hal.conf @@ -0,0 +1,30 @@ +z /sys/devices/system/cpu/*/online 0660 root system_fw - +t /sys/devices/system/cpu/*/online - - - - security.SMACK64="System" +z /sys/devices/system/cpu/*/cpufreq/scaling_available_governors 0440 root system_fw - +t /sys/devices/system/cpu/*/cpufreq/scaling_available_governors - - - - security.SMACK64="System" +z /sys/devices/system/cpu/*/cpufreq/cpuinfo_cur_freq 0440 root system_fw - +t /sys/devices/system/cpu/*/cpufreq/cpuinfo_cur_freq - - - - security.SMACK64="System" +z /sys/devices/system/cpu/*/cpufreq/scaling_governor 0660 root system_fw - +t /sys/devices/system/cpu/*/cpufreq/scaling_governor - - - - security.SMACK64="System" +z /sys/devices/system/cpu/*/cpufreq/scaling_min_freq 0660 root system_fw - +t /sys/devices/system/cpu/*/cpufreq/scaling_min_freq - - - - security.SMACK64="System" +z /sys/devices/system/cpu/*/cpufreq/scaling_max_freq 0660 root system_fw - +t /sys/devices/system/cpu/*/cpufreq/scaling_max_freq - - - - security.SMACK64="System" +z /sys/devices/system/cpu/*/cpufreq/ondemand/up_threshold 0660 root system_fw - +t /sys/devices/system/cpu/*/cpufreq/ondemand/up_threshold - - - - security.SMACK64="System" +z /sys/class/thermal/*/temp 0440 root system_fw - +t /sys/class/thermal/*/temp - - - - security.SMACK64="System" +z /sys/class/thermal/*/policy 0440 root system_fw - +t /sys/class/thermal/*/policy - - - - security.SMACK64="System" +z /sys/kernel/debug/cpufreq/*/load_table 0440 root system_fw - +t /sys/kernel/debug/cpufreq/*/load_table - - - - security.SMACK64="System" +z /sys/kernel/debug/cpufreq/*/load_table 0440 root system_fw - +t /sys/kernel/debug/cpufreq/*/load_table - - - - security.SMACK64="System" +z /sys/devices/platform/soc/*/devfreq/*/cur_freq 0440 root system_fw - +t /sys/devices/platform/soc/*/devfreq/*/cur_freq - - - - security.SMACK64="System" +z /sys/devices/platform/soc/*/devfreq/*/governor 0440 root system_fw - +t /sys/devices/platform/soc/*/devfreq/*/governor - - - - security.SMACK64="System" +z /sys/devices/platform/soc/*/devfreq/*/min_freq 0660 root system_fw - +t /sys/devices/platform/soc/*/devfreq/*/min_freq - - - - security.SMACK64="System" +z /sys/devices/platform/soc/*/devfreq/*/max_freq 0660 root system_fw - +t /sys/devices/platform/soc/*/devfreq/*/max_freq - - - - security.SMACK64="System" -- 2.7.4 From e64bfcb2a383029a6c732835c3be5798967e1ab3 Mon Sep 17 00:00:00 2001 From: Wook Song Date: Thu, 22 Jun 2017 14:43:34 +0900 Subject: [PATCH 04/16] pass-hal: tm2: packaging: Fix bug in applying systemd-tmpfiles This patch changes the path which systemd-tmpfiles uses in %post from /usr/lib to %{_libdir}. Since the defualt path for the libraries is /usr/lib64 for aarch64, the daemon does not work properly with the hard-coded path used before. Change-Id: If18c89efe327ec2afc8ee3d974af269dadf56837 Signed-off-by: Wook Song --- packaging/pass-hal-tm2.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/pass-hal-tm2.spec b/packaging/pass-hal-tm2.spec index fe46ef7..374a548 100644 --- a/packaging/pass-hal-tm2.spec +++ b/packaging/pass-hal-tm2.spec @@ -38,7 +38,7 @@ rm -rf %{buildroot} %post /sbin/ldconfig -systemd-tmpfiles /usr/lib/tmpfiles.d/pass-hal.conf --create +systemd-tmpfiles %{_libdir}/tmpfiles.d/pass-hal.conf --create %postun -p /sbin/ldconfig -- 2.7.4 From 4f5e25ba1dbe3bbfa96d8f63118cc394f3d8f3ed Mon Sep 17 00:00:00 2001 From: Wook Song Date: Tue, 20 Jun 2017 15:33:29 +0900 Subject: [PATCH 05/16] pass-hal: tm2: packaging: Restart daemon after install/uninstall This patch adds bits of code to %post and %postun sections so that the daemon is restarted when the package is installed/uninstalled. Note that the daemon is only restarted in the case of that the daemon is running before the hal package is installed/uninstalled. Change-Id: I89aca56051e44b91fc8bda4c1f47d5e5f260ba45 Signed-off-by: Wook Song --- packaging/pass-hal-tm2.spec | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packaging/pass-hal-tm2.spec b/packaging/pass-hal-tm2.spec index 374a548..3dbec3e 100644 --- a/packaging/pass-hal-tm2.spec +++ b/packaging/pass-hal-tm2.spec @@ -39,8 +39,15 @@ rm -rf %{buildroot} %post /sbin/ldconfig systemd-tmpfiles %{_libdir}/tmpfiles.d/pass-hal.conf --create +if [ -f %{_unitdir}/pass.service ]; then + systemctl | grep pass.service | awk '{if ($3 == "active" && $4 == "running") system("systemctl restart pass.service")}' +fi -%postun -p /sbin/ldconfig +%postun +/sbin/ldconfig +if [ -f %{_unitdir}/pass.service ]; then + systemctl | grep pass.service | awk '{if ($3 == "active" && $4 == "running") system("systemctl restart pass.service")}' +fi %files %manifest %{name}.manifest -- 2.7.4 From 1c0fdf4afa577df0c911f3b81f6ba7ddd288ae55 Mon Sep 17 00:00:00 2001 From: Wook Song Date: Tue, 20 Jun 2017 17:19:26 +0900 Subject: [PATCH 06/16] pass-hal: tm2: Apply the value type change of pass_res_type This patch applies the change of the value type of the entry, "pass_res_type", to each PassResource section of the pass.conf file. Change-Id: I87ec4b72737ba30a3cdbb2446d852db484ff5fe5 Signed-off-by: Wook Song --- scripts/pass.conf | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/pass.conf b/scripts/pass.conf index 9d09bc9..9892cba 100644 --- a/scripts/pass.conf +++ b/scripts/pass.conf @@ -7,7 +7,7 @@ pass_path_compatible=/proc/device-tree/compatible pass_num_resources=5 [PassResource0] -pass_res_type=1 +pass_res_type=cpu pass_res_name=cpu0 pass_path_conf_file=/etc/pass/pass-resource0.conf pass_path_load_table=/sys/kernel/debug/cpufreq/cpu0/load_table @@ -15,7 +15,7 @@ pass_first_cpu=0 pass_num_cpus=4 [PassResource1] -pass_res_type=1 +pass_res_type=cpu pass_res_name=cpu4 pass_path_conf_file=/etc/pass/pass-resource1.conf pass_path_load_table=/sys/kernel/debug/cpufreq/cpu4/load_table @@ -23,16 +23,16 @@ pass_first_cpu=4 pass_num_cpus=4 [PassResource2] -pass_res_type=2 +pass_res_type=bus pass_res_name=soc:memory_bus@0 pass_path_conf_file=/etc/pass/pass-resource2.conf [PassResource3] -pass_res_type=2 +pass_res_type=bus pass_res_name=soc:memory_bus@1 pass_path_conf_file=/etc/pass/pass-resource3.conf [PassResource4] -pass_res_type=3 +pass_res_type=gpu pass_res_name=14ac0000.mali pass_path_conf_file=/etc/pass/pass-resource4.conf -- 2.7.4 From 0215caba63027770004f997c302e1385a58cdfd9 Mon Sep 17 00:00:00 2001 From: Chanwoo Choi Date: Thu, 29 Jun 2017 20:28:50 +0900 Subject: [PATCH 07/16] pass-hal: tm2: Use only /usr/lib/tmpfiles.d path for pass-hal.conf Even if architecture is aarch64, the systemd spec applies the rule files under the /usr/lib/tmpfiles.d. On aarch64, /usr/lib64/tmpfiles.d/pass-hal.conf is not applied. So, this patch changes the path of tmpfiles.d in order to support the PASS on aarch64. So, this patch changes the tmpfiles.d path to support the PASS on aarch64 as following: - /usr/lib64/tmpfiles.d -> /usr/lib/tmpfiles.d Change-Id: Icfa83149960235251b22df2ad7a82671c406c046 Signed-off-by: Chanwoo Choi --- CMakeLists.txt | 2 +- packaging/pass-hal-tm2.spec | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index edef99c..a78b065 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,4 +25,4 @@ INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/scripts/pass-resource1.conf DESTINATIO INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/scripts/pass-resource2.conf DESTINATION /etc/pass) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/scripts/pass-resource3.conf DESTINATION /etc/pass) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/scripts/pass-resource4.conf DESTINATION /etc/pass) -INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/scripts/pass-hal.conf DESTINATION ${LIB_INSTALL_DIR}/tmpfiles.d) +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/scripts/pass-hal.conf DESTINATION /usr/lib/tmpfiles.d) diff --git a/packaging/pass-hal-tm2.spec b/packaging/pass-hal-tm2.spec index 3dbec3e..6905672 100644 --- a/packaging/pass-hal-tm2.spec +++ b/packaging/pass-hal-tm2.spec @@ -38,7 +38,7 @@ rm -rf %{buildroot} %post /sbin/ldconfig -systemd-tmpfiles %{_libdir}/tmpfiles.d/pass-hal.conf --create +systemd-tmpfiles /usr/lib/tmpfiles.d/pass-hal.conf --create if [ -f %{_unitdir}/pass.service ]; then systemctl | grep pass.service | awk '{if ($3 == "active" && $4 == "running") system("systemctl restart pass.service")}' fi @@ -52,7 +52,7 @@ fi %files %manifest %{name}.manifest %{_libdir}/pass/*.so -%{_libdir}/tmpfiles.d/pass-hal.conf +/usr/lib/tmpfiles.d/pass-hal.conf %config %{_sysconfdir}/pass/pass.conf %config %{_sysconfdir}/pass/pass-resource0.conf -- 2.7.4 From cd740cbf75cf947e803cb8bb4049c5fc742bc6ad Mon Sep 17 00:00:00 2001 From: Wook Song Date: Fri, 7 Jul 2017 11:46:18 +0900 Subject: [PATCH 08/16] pass-hal: tm2: Update TMU HAL functions to use pass_res_thermal_name This patch updates all HAL function bodies for TMU to use the new pass_res_thermal_name property of the 'pass.conf' file. Change-Id: I7f9b4507576d0d5e79ce7b503710193501617eab Signed-off-by: Wook Song Reviewed-by: Chanwoo Choi --- src/cpu/cpu.c | 43 +++++++++++-------------------------------- src/gpu/gpu.c | 16 +++++++--------- 2 files changed, 18 insertions(+), 41 deletions(-) diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c index 1683cfe..f05c510 100644 --- a/src/cpu/cpu.c +++ b/src/cpu/cpu.c @@ -50,19 +50,13 @@ #define CPU_ONLINE_STATE_ON 1 #define CPU_ONLINE_STATE_OFF 0 -#define TMU_PATH_PREFIX "/sys/class/thermal/thermal_zone" +#define TMU_PATH_PREFIX "/sys/class/thermal/" #define TMU_TEMP_PATH_SUFFIX "/temp" #define TMU_POLICY_PATH_SUFFIX "/policy" #define TM2_CPU_MIN_NUM 0 #define TM2_CPU_MAX_NUM 7 -#define TM2_CPU_LITTLE_RESNAME "cpu0" -#define TM2_CPU_BIG_RESNAME "cpu4" -#define TM2_CPU_LITTLE_THERMAL_ZONE_NUM 3 -#define TM2_CPU_BIG_THERMAL_ZONE_NUM 0 - - static int tm2_dvfs_get_curr_governor(char *res_name, char *governor) { char path[PATH_MAX]; @@ -327,25 +321,17 @@ static struct pass_resource_hotplug_ops tm2_cpu_hotplus_ops = { .set_online_max_num = NULL, }; -static int tm2_tmu_get_temp(char *res_name) +static int tm2_tmu_get_temp(char *res_thermal_name) { char path[PATH_MAX]; - int tz_num, temp; - int ret; + int temp, ret; - if (!res_name) + if (!res_thermal_name) return -EINVAL; - if (!strcmp(res_name, TM2_CPU_LITTLE_RESNAME)) - tz_num = TM2_CPU_LITTLE_THERMAL_ZONE_NUM; - else if (!strcmp(res_name, TM2_CPU_BIG_RESNAME)) - tz_num = TM2_CPU_BIG_THERMAL_ZONE_NUM; - else - return -EINVAL; - - snprintf(path, PATH_MAX, "%s%d%s", + snprintf(path, PATH_MAX, "%s%s%s", TMU_PATH_PREFIX, - tz_num, + res_thermal_name, TMU_TEMP_PATH_SUFFIX); ret = sysfs_read_int(path, &temp); @@ -355,24 +341,17 @@ static int tm2_tmu_get_temp(char *res_name) return temp; } -static int tm2_tmu_get_policy(char *res_name, char *policy) +static int tm2_tmu_get_policy(char *res_thermal_name, char *policy) { char path[PATH_MAX]; - int ret, tz_num; - - if ((!res_name) || (!policy)) - return -EINVAL; + int ret; - if (!strcmp(res_name, TM2_CPU_LITTLE_RESNAME)) - tz_num = TM2_CPU_LITTLE_THERMAL_ZONE_NUM; - else if (!strcmp(res_name, TM2_CPU_BIG_RESNAME)) - tz_num = TM2_CPU_BIG_THERMAL_ZONE_NUM; - else + if ((!res_thermal_name) || (!policy)) return -EINVAL; - snprintf(path, PATH_MAX, "%s%d%s", + snprintf(path, PATH_MAX, "%s%s%s", TMU_PATH_PREFIX, - tz_num, + res_thermal_name, TMU_POLICY_PATH_SUFFIX); ret = sysfs_read_str(path, policy, BUFF_MAX); diff --git a/src/gpu/gpu.c b/src/gpu/gpu.c index aaf9cc4..46b0dec 100644 --- a/src/gpu/gpu.c +++ b/src/gpu/gpu.c @@ -35,12 +35,10 @@ #define DEVFREQ_GPU_MIN_FREQ_PATH_SUFFIX "/min_freq" #define DEVFREQ_GPU_MAX_FREQ_PATH_SUFFIX "/max_freq" -#define TMU_PATH_PREFIX "/sys/class/thermal/thermal_zone" +#define TMU_PATH_PREFIX "/sys/class/thermal/" #define TMU_TEMP_PATH_SUFFIX "/temp" #define TMU_POLICY_PATH_SUFFIX "/policy" -#define TM2_GPU_THERMAL_ZONE_NUM 2 - static int tm2_dvfs_get_curr_governor(char *res_name, char *governor) { char path[PATH_MAX]; @@ -195,7 +193,7 @@ static struct pass_resource_dvfs_ops tm2_gpu_dvfs_ops = { .get_load_table = NULL, }; -static int tm2_tmu_get_temp(char *res_name) +static int tm2_tmu_get_temp(char *res_thermal_name); { char path[PATH_MAX]; int temp; @@ -204,9 +202,9 @@ static int tm2_tmu_get_temp(char *res_name) if (!res_name) return -EINVAL; - snprintf(path, PATH_MAX, "%s%d%s", + snprintf(path, PATH_MAX, "%s%s%s", TMU_PATH_PREFIX, - TM2_GPU_THERMAL_ZONE_NUM, + res_thermal_name, TMU_TEMP_PATH_SUFFIX); ret = sysfs_read_int(path, &temp); @@ -216,7 +214,7 @@ static int tm2_tmu_get_temp(char *res_name) return temp; } -static int tm2_tmu_get_policy(char *res_name, char *policy) +static int tm2_tmu_get_policy(char *res_thermal_name, char *policy) { char path[PATH_MAX]; int ret; @@ -224,9 +222,9 @@ static int tm2_tmu_get_policy(char *res_name, char *policy) if ((!res_name) || (!policy)) return -EINVAL; - snprintf(path, PATH_MAX, "%s%d%s", + snprintf(path, PATH_MAX, "%s%s%s", TMU_PATH_PREFIX, - TM2_GPU_THERMAL_ZONE_NUM, + res_thermal_name, TMU_POLICY_PATH_SUFFIX); ret = sysfs_read_str(path, policy, BUFF_MAX); -- 2.7.4 From aae2ece3f5fae2d2e2b16f04fb99920680ab2311 Mon Sep 17 00:00:00 2001 From: Wook Song Date: Fri, 7 Jul 2017 11:42:51 +0900 Subject: [PATCH 09/16] pass-hal: tm2: Add pass_res_thermal_name properties for CPU and GPU This patch adds new pass_res_thermal_name properties and their values for the CPU and GPU resources to the 'pass.conf' file. Change-Id: I5a9b257bb668cd4187921377d29c54d7a5376f47 Signed-off-by: Wook Song Reviewed-by: Chanwoo Choi --- scripts/pass.conf | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/pass.conf b/scripts/pass.conf index 9892cba..8575acb 100644 --- a/scripts/pass.conf +++ b/scripts/pass.conf @@ -9,6 +9,7 @@ pass_num_resources=5 [PassResource0] pass_res_type=cpu pass_res_name=cpu0 +pass_res_thermal_name=thermal_zone3 pass_path_conf_file=/etc/pass/pass-resource0.conf pass_path_load_table=/sys/kernel/debug/cpufreq/cpu0/load_table pass_first_cpu=0 @@ -17,6 +18,7 @@ pass_num_cpus=4 [PassResource1] pass_res_type=cpu pass_res_name=cpu4 +pass_res_thermal_name=thermal_zone0 pass_path_conf_file=/etc/pass/pass-resource1.conf pass_path_load_table=/sys/kernel/debug/cpufreq/cpu4/load_table pass_first_cpu=4 @@ -35,4 +37,5 @@ pass_path_conf_file=/etc/pass/pass-resource3.conf [PassResource4] pass_res_type=gpu pass_res_name=14ac0000.mali +pass_res_thermal_name=thermal_zone2 pass_path_conf_file=/etc/pass/pass-resource4.conf -- 2.7.4 From 6d13c951864376c3e5561477de083cd500d0688e Mon Sep 17 00:00:00 2001 From: Chanwoo Choi Date: Fri, 7 Jul 2017 11:20:55 +0900 Subject: [PATCH 10/16] pass-hal: tm2: Remove the specific author information This patch removes the specific author information from HAL_MODULE_STRUCTURE. Change-Id: I6e8f36e957b7d13b18e1be5a4e53d3f25af47915 Signed-off-by: Chanwoo Choi --- src/bus/bus.c | 1 - src/cpu/cpu.c | 1 - src/gpu/gpu.c | 1 - 3 files changed, 3 deletions(-) diff --git a/src/bus/bus.c b/src/bus/bus.c index 82ca526..2463bfc 100644 --- a/src/bus/bus.c +++ b/src/bus/bus.c @@ -226,7 +226,6 @@ HAL_MODULE_STRUCTURE = { .device_version = DEV_VERSION_BUS, .id = PASS_RESOURCE_BUS_ID, .name = PASS_RESOURCE_BUS_NAME, - .author = "Wook Song ", .open = tm2_bus_open, .close = tm2_bus_close, }; diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c index f05c510..9cac0de 100644 --- a/src/cpu/cpu.c +++ b/src/cpu/cpu.c @@ -405,7 +405,6 @@ HAL_MODULE_STRUCTURE = { .device_version = DEV_VERSION_CPU, .id = PASS_RESOURCE_CPU_ID, .name = PASS_RESOURCE_CPU_NAME, - .author = "Wook Song ", .open = tm2_cpu_open, .close = tm2_cpu_close, }; diff --git a/src/gpu/gpu.c b/src/gpu/gpu.c index 46b0dec..3f4d66a 100644 --- a/src/gpu/gpu.c +++ b/src/gpu/gpu.c @@ -277,7 +277,6 @@ HAL_MODULE_STRUCTURE = { .device_version = DEV_VERSION_GPU, .id = PASS_RESOURCE_GPU_ID, .name = PASS_RESOURCE_GPU_NAME, - .author = "Wook Song ", .open = tm2_gpu_open, .close = tm2_gpu_close, }; -- 2.7.4 From 50aa80dddec50a79232f916d088c9d55ebd3f201 Mon Sep 17 00:00:00 2001 From: Chanwoo Choi Date: Fri, 7 Jul 2017 16:38:31 +0900 Subject: [PATCH 11/16] pass-hal: tm2: Fix build error for gpu.c The cd740cbf75cf9 ("pass-hal: tm2: Update TMU HAL functions to use pass_res_thermal_name") patch has the build errors. So, this patch fixes the build error on gpu.c. Change-Id: I92fd86cfbee586638c8d9b2868a85d5ec694c02b Signed-off-by: Chanwoo Choi --- src/gpu/gpu.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gpu/gpu.c b/src/gpu/gpu.c index 3f4d66a..eaa0039 100644 --- a/src/gpu/gpu.c +++ b/src/gpu/gpu.c @@ -193,13 +193,13 @@ static struct pass_resource_dvfs_ops tm2_gpu_dvfs_ops = { .get_load_table = NULL, }; -static int tm2_tmu_get_temp(char *res_thermal_name); +static int tm2_tmu_get_temp(char *res_thermal_name) { char path[PATH_MAX]; int temp; int ret; - if (!res_name) + if (!res_thermal_name) return -EINVAL; snprintf(path, PATH_MAX, "%s%s%s", @@ -219,7 +219,7 @@ static int tm2_tmu_get_policy(char *res_thermal_name, char *policy) char path[PATH_MAX]; int ret; - if ((!res_name) || (!policy)) + if ((!res_thermal_name) || (!policy)) return -EINVAL; snprintf(path, PATH_MAX, "%s%s%s", -- 2.7.4 From 9e123cadb5b6d8ad1163ef0cb63a34f1e26b1fce Mon Sep 17 00:00:00 2001 From: Wook Song Date: Mon, 10 Jul 2017 16:24:43 +0900 Subject: [PATCH 12/16] pass-hal: tm2: Remove tm2-specific define statements for cpu This patch removes the tm2-specific define statements such as TM2_CPU_MIN_NUM and TM2_CPU_MAX_NUM, which were used to check CPU indexes out of range. The reasons why we need to remove this board-specific code are that 1) such CPU indexes out of range would never occur and 2) it is required to standardize the HAL function implementation. Change-Id: I10c96c36975bbe5b33e6102742fac917682616f1 Signed-off-by: Wook Song --- src/cpu/cpu.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c index 9cac0de..18f407e 100644 --- a/src/cpu/cpu.c +++ b/src/cpu/cpu.c @@ -54,9 +54,6 @@ #define TMU_TEMP_PATH_SUFFIX "/temp" #define TMU_POLICY_PATH_SUFFIX "/policy" -#define TM2_CPU_MIN_NUM 0 -#define TM2_CPU_MAX_NUM 7 - static int tm2_dvfs_get_curr_governor(char *res_name, char *governor) { char path[PATH_MAX]; @@ -262,8 +259,6 @@ static int tm2_hotplug_get_online_state(char *res_name, int cpu) if ((!res_name)) return -EINVAL; - if ((cpu < TM2_CPU_MIN_NUM) || (cpu > TM2_CPU_MAX_NUM)) - return -EINVAL; snprintf(path, PATH_MAX, "%s%d%s", CPU_ONLINE_PATH_PREFIX, @@ -284,8 +279,6 @@ static int tm2_hotplug_set_online_state(char *res_name, int cpu, int on) if ((!res_name)) return -EINVAL; - if ((cpu < TM2_CPU_MIN_NUM) || (cpu > TM2_CPU_MAX_NUM)) - return -EINVAL; if ((on != CPU_ONLINE_STATE_ON) && (on != CPU_ONLINE_STATE_OFF)) return -EINVAL; -- 2.7.4 From 366b5218d3a2958ea91f5d84febd96ac877ad183 Mon Sep 17 00:00:00 2001 From: Dongwoo Lee Date: Mon, 31 Jul 2017 16:21:15 +0900 Subject: [PATCH 13/16] pass-hal: tm2: Remove unncessary source code Since TM2 kernel supports standard interface for each resource, standard HAL can replace this specific HAL. After this, PASS HAL for TM2 only provides configuration files. Change-Id: If2f78b2a711ffa5f87797b19afc8edd96bab7700 Signed-off-by: Dongwoo Lee --- CMakeLists.txt | 9 - packaging/pass-hal-tm2.spec | 4 - src/bus/CMakeLists.txt | 24 --- src/bus/bus.c | 231 ------------------------- src/cpu/CMakeLists.txt | 24 --- src/cpu/cpu.c | 403 -------------------------------------------- src/gpu/CMakeLists.txt | 24 --- src/gpu/gpu.c | 282 ------------------------------- src/shared/sysfs.c | 127 -------------- src/shared/sysfs.h | 6 - 10 files changed, 1134 deletions(-) delete mode 100644 src/bus/CMakeLists.txt delete mode 100644 src/bus/bus.c delete mode 100644 src/cpu/CMakeLists.txt delete mode 100644 src/cpu/cpu.c delete mode 100644 src/gpu/CMakeLists.txt delete mode 100644 src/gpu/gpu.c delete mode 100644 src/shared/sysfs.c delete mode 100644 src/shared/sysfs.h diff --git a/CMakeLists.txt b/CMakeLists.txt index a78b065..622008a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,11 +3,6 @@ PROJECT(pass-hal-tm2 C) SET(CMAKE_VERBOSE_MAKEFILE ON) -SET(PKG_MODULES - dlog) -INCLUDE(FindPkgConfig) -pkg_check_modules(pkgs REQUIRED ${PKG_MODULES}) - FOREACH(flag ${pkgs_CFLAGS}) SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") ENDFOREACH(flag) @@ -15,10 +10,6 @@ ENDFOREACH(flag) SET(PREFIX ${CMAKE_INSTALL_PREFIX}) SET(DEST_DIR ${LIB_INSTALL_DIR}/pass) -ADD_SUBDIRECTORY(src/cpu) -ADD_SUBDIRECTORY(src/bus) -ADD_SUBDIRECTORY(src/gpu) - INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/scripts/pass.conf DESTINATION /etc/pass) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/scripts/pass-resource0.conf DESTINATION /etc/pass) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/scripts/pass-resource1.conf DESTINATION /etc/pass) diff --git a/packaging/pass-hal-tm2.spec b/packaging/pass-hal-tm2.spec index 6905672..9f48068 100644 --- a/packaging/pass-hal-tm2.spec +++ b/packaging/pass-hal-tm2.spec @@ -15,9 +15,6 @@ ExclusiveArch: %{arm} aarch64 Requires(post): /sbin/ldconfig Requires(postun): /sbin/ldconfig BuildRequires: cmake -BuildRequires: pkgconfig(dlog) -BuildRequires: pkgconfig(glib-2.0) -BuildRequires: pkgconfig(pass-hal-devel) %description PASS hal for TM2 @@ -51,7 +48,6 @@ fi %files %manifest %{name}.manifest -%{_libdir}/pass/*.so /usr/lib/tmpfiles.d/pass-hal.conf %config %{_sysconfdir}/pass/pass.conf diff --git a/src/bus/CMakeLists.txt b/src/bus/CMakeLists.txt deleted file mode 100644 index 2bca621..0000000 --- a/src/bus/CMakeLists.txt +++ /dev/null @@ -1,24 +0,0 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 2.6) -PROJECT(bus C) - -INCLUDE(FindPkgConfig) -pkg_check_modules(pkgs REQUIRED dlog glib-2.0) - -#HAL version -string(REPLACE "." ";" HAL_VERSION_LIST ${HAL_VERSION}) -list(GET HAL_VERSION_LIST 0 HAL_VERSION_MAJOR) -list(GET HAL_VERSION_LIST 1 HAL_VERSION_MINOR) -list(GET HAL_VERSION_LIST 2 HAL_VERSION_REVISION) -list(GET HAL_VERSION_LIST 3 HAL_VERSION_RELEASE) -add_definitions(-DVER_MAJOR=${HAL_VERSION_MAJOR} -DVER_MINOR=${HAL_VERSION_MINOR}) -add_definitions(-DVER_REVISION=${HAL_VERSION_REVISION} -DVER_RELEASE=${HAL_VERSION_RELEASE}) - -SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden") -SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}") - -SET(SRCS ${PROJECT_NAME}.c - ../shared/sysfs.c) - -ADD_LIBRARY(${PROJECT_NAME} MODULE ${SRCS}) -SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES PREFIX "") -INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${DEST_DIR} COMPONENT RuntimeLibraries) diff --git a/src/bus/bus.c b/src/bus/bus.c deleted file mode 100644 index 2463bfc..0000000 --- a/src/bus/bus.c +++ /dev/null @@ -1,231 +0,0 @@ -/* - * PASS (Power Aware System Service) - * - * Copyright (c) 2017 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the License); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include -#include -#include -#include -#include -#include -#include - -#include "../shared/sysfs.h" - -/* TODO: Version! */ -#define HAL_VERSION MAKE_2B_CODE_4(VER_MAJOR,VER_MINOR,VER_REVISION,VER_RELEASE) -#define DEV_VERSION_BUS MAKE_2B_CODE_2(1,0) - -#define DEVFREQ_BUS_PATH_PREFIX "/sys/class/devfreq/" -#define DEVFREQ_BUS_CURR_GOVERNOR_PATH_SUFFIX "/governor" -#define DEVFREQ_BUS_CURR_FREQ_PATH_SUFFIX "/cur_freq" -#define DEVFREQ_BUS_MIN_FREQ_PATH_SUFFIX "/min_freq" -#define DEVFREQ_BUS_MAX_FREQ_PATH_SUFFIX "/max_freq" - -static int tm2_dvfs_get_curr_governor(char *res_name, char *governor) -{ - char path[PATH_MAX]; - int ret; - - if ((!res_name) || (!governor)) - return -EINVAL; - - snprintf(path, PATH_MAX, "%s%s%s", - DEVFREQ_BUS_PATH_PREFIX, - res_name, - DEVFREQ_BUS_CURR_GOVERNOR_PATH_SUFFIX); - - ret = sysfs_read_str(path, governor, BUFF_MAX); - if (ret < 0) - return ret; - - return 0; -} - -static int tm2_dvfs_set_curr_governor(char *res_name, char *governor) -{ - char path[PATH_MAX]; - int ret; - - if ((!res_name) || (!governor)) - return -EINVAL; - - snprintf(path, PATH_MAX, "%s%s%s", - DEVFREQ_BUS_PATH_PREFIX, - res_name, - DEVFREQ_BUS_CURR_GOVERNOR_PATH_SUFFIX); - - ret = sysfs_write_str(path, governor); - if (ret < 0) - return ret; - - return 0; -} - -static int tm2_dvfs_get_curr_freq(char *res_name) -{ - char path[PATH_MAX]; - int freq, ret; - - if (!res_name) - return -EINVAL; - - snprintf(path, PATH_MAX, "%s%s%s", - DEVFREQ_BUS_PATH_PREFIX, - res_name, - DEVFREQ_BUS_CURR_FREQ_PATH_SUFFIX); - - ret = sysfs_read_int(path, &freq); - if (ret < 0) - return ret; - - return freq; -} - -static int tm2_dvfs_get_min_freq(char *res_name) -{ - char path[PATH_MAX]; - int freq, ret; - - if (!res_name) - return -EINVAL; - - snprintf(path, PATH_MAX, "%s%s%s", - DEVFREQ_BUS_PATH_PREFIX, - res_name, - DEVFREQ_BUS_MIN_FREQ_PATH_SUFFIX); - - ret = sysfs_read_int(path, &freq); - if (ret < 0) - return ret; - - return freq; -} - -static int tm2_dvfs_set_min_freq(char *res_name, int freq) -{ - char path[PATH_MAX]; - int ret; - - if ((!res_name) || (freq < 0)) - return -EINVAL; - - snprintf(path, PATH_MAX, "%s%s%s", - DEVFREQ_BUS_PATH_PREFIX, - res_name, - DEVFREQ_BUS_MIN_FREQ_PATH_SUFFIX); - - ret = sysfs_write_int(path, freq); - if (ret < 0) - return ret; - - return 0; -} - -static int tm2_dvfs_get_max_freq(char *res_name) -{ - char path[PATH_MAX]; - int freq, ret; - - if (!res_name) - return -EINVAL; - - snprintf(path, PATH_MAX, "%s%s%s", - DEVFREQ_BUS_PATH_PREFIX, - res_name, - DEVFREQ_BUS_MAX_FREQ_PATH_SUFFIX); - - ret = sysfs_read_int(path, &freq); - if (ret < 0) - return ret; - - return freq; -} - -static int tm2_dvfs_set_max_freq(char *res_name, int freq) -{ - char path[PATH_MAX]; - int ret; - - if ((!res_name) || (freq < 0)) - return -EINVAL; - - snprintf(path, PATH_MAX, "%s%s%s", - DEVFREQ_BUS_PATH_PREFIX, - res_name, - DEVFREQ_BUS_MAX_FREQ_PATH_SUFFIX); - - ret = sysfs_write_int(path, freq); - if (ret < 0) - return ret; - return 0; -} - - -static struct pass_resource_dvfs_ops tm2_bus_dvfs_ops = { - .get_curr_governor = tm2_dvfs_get_curr_governor, - .set_curr_governor = tm2_dvfs_set_curr_governor, - .get_avail_governor = NULL, - .get_curr_freq = tm2_dvfs_get_curr_freq, - .get_min_freq = tm2_dvfs_get_min_freq, - .set_min_freq = tm2_dvfs_set_min_freq, - .get_max_freq = tm2_dvfs_get_max_freq, - .set_max_freq = tm2_dvfs_set_max_freq, - .get_up_threshold = NULL, - .set_up_threshold = NULL, - .get_load_table = NULL, -}; - -static int tm2_bus_open(char *res_name, struct pass_resource_info *info, - struct pass_resource_common **common) -{ - struct pass_resource_bus *bus_res; - - if (!info) - return -EINVAL; - - /* TODO: Possibility of a memory leak */ - bus_res = calloc(1, sizeof(struct pass_resource_bus)); - if (!bus_res) - return -ENOMEM; - - bus_res->common.info = info; - bus_res->dvfs = tm2_bus_dvfs_ops; - - *common = (struct pass_resource_common *) bus_res; - - return 0; -} - -static int tm2_bus_close(char *res_name, struct pass_resource_common *common) -{ - if (!common) - return -EINVAL; - - free(common); - - return 0; -} - -HAL_MODULE_STRUCTURE = { - .magic = HAL_INFO_TAG, - .hal_version = HAL_VERSION, - .device_version = DEV_VERSION_BUS, - .id = PASS_RESOURCE_BUS_ID, - .name = PASS_RESOURCE_BUS_NAME, - .open = tm2_bus_open, - .close = tm2_bus_close, -}; diff --git a/src/cpu/CMakeLists.txt b/src/cpu/CMakeLists.txt deleted file mode 100644 index 3cd62b8..0000000 --- a/src/cpu/CMakeLists.txt +++ /dev/null @@ -1,24 +0,0 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 2.6) -PROJECT(cpu C) - -INCLUDE(FindPkgConfig) -pkg_check_modules(pkgs REQUIRED dlog glib-2.0) - -#HAL version -string(REPLACE "." ";" HAL_VERSION_LIST ${HAL_VERSION}) -list(GET HAL_VERSION_LIST 0 HAL_VERSION_MAJOR) -list(GET HAL_VERSION_LIST 1 HAL_VERSION_MINOR) -list(GET HAL_VERSION_LIST 2 HAL_VERSION_REVISION) -list(GET HAL_VERSION_LIST 3 HAL_VERSION_RELEASE) -add_definitions(-DVER_MAJOR=${HAL_VERSION_MAJOR} -DVER_MINOR=${HAL_VERSION_MINOR}) -add_definitions(-DVER_REVISION=${HAL_VERSION_REVISION} -DVER_RELEASE=${HAL_VERSION_RELEASE}) - -SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden") -SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}") - -SET(SRCS ${PROJECT_NAME}.c - ../shared/sysfs.c) - -ADD_LIBRARY(${PROJECT_NAME} MODULE ${SRCS}) -SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES PREFIX "") -INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${DEST_DIR} COMPONENT RuntimeLibraries) diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c deleted file mode 100644 index 18f407e..0000000 --- a/src/cpu/cpu.c +++ /dev/null @@ -1,403 +0,0 @@ -/* - * PASS (Power Aware System Service) - * - * Copyright (c) 2017 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the License); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include -#include -#include -#include -#include -#include -#include - -#include "../shared/sysfs.h" - -/* TODO: Version! */ -#define HAL_VERSION MAKE_2B_CODE_4(VER_MAJOR,VER_MINOR,VER_REVISION,VER_RELEASE) -#define DEV_VERSION_CPU MAKE_2B_CODE_2(1,0) - -#define CPUFREQ_PATH_PREFIX "/sys/devices/system/cpu/" -#define CPUFREQ_CURR_GOVERNOR_PATH_SUFFIX "/cpufreq/scaling_governor" -#define CPUFREQ_AVAIL_GOVERNOR_PATH_SUFFIX "/cpufreq/scaling_available_governors" - -/* - * The cpuinfo_cur_freq indicates the actual operating CPU freqeuncy - * and scaling_cur_freq is the CPU frequency set by the CPUFREQ policy. - */ -#define CPUFREQ_CURR_FREQ_PATH_SUFFIX "/cpufreq/cpuinfo_cur_freq" -#define CPUFREQ_MIN_FREQ_PATH_SUFFIX "/cpufreq/scaling_min_freq" -#define CPUFREQ_MAX_FREQ_PATH_SUFFIX "/cpufreq/scaling_max_freq" -#define CPUFREQ_UP_THRESHOLD_PATH_SUFFIX "/cpufreq/ondemand/up_threshold" - -#define LOADTABLE_PATH_PREFIX "/sys/kernel/debug/cpufreq/" -#define LOADTABLE_PATH_SUFFIX "/load_table" - -#define CPU_ONLINE_PATH_PREFIX "/sys/devices/system/cpu/cpu" -#define CPU_ONLINE_PATH_SUFFIX "/online" -#define CPU_ONLINE_STATE_ON 1 -#define CPU_ONLINE_STATE_OFF 0 - -#define TMU_PATH_PREFIX "/sys/class/thermal/" -#define TMU_TEMP_PATH_SUFFIX "/temp" -#define TMU_POLICY_PATH_SUFFIX "/policy" - -static int tm2_dvfs_get_curr_governor(char *res_name, char *governor) -{ - char path[PATH_MAX]; - int ret; - - if ((!res_name) || (!governor)) - return -EINVAL; - - snprintf(path, PATH_MAX, "%s%s%s", - CPUFREQ_PATH_PREFIX, - res_name, - CPUFREQ_CURR_GOVERNOR_PATH_SUFFIX); - - ret = sysfs_read_str(path, governor, BUFF_MAX); - if (ret < 0) - return ret; - - return 0; -} - -static int tm2_dvfs_set_curr_governor(char *res_name, char *governor) -{ - char path[PATH_MAX]; - int ret; - - if ((!res_name) || (!governor)) - return -EINVAL; - - snprintf(path, PATH_MAX, "%s%s%s", - CPUFREQ_PATH_PREFIX, - res_name, - CPUFREQ_CURR_GOVERNOR_PATH_SUFFIX); - - ret = sysfs_write_str(path, governor); - if (ret < 0) - return ret; - - return 0; -} - -static int tm2_dvfs_get_curr_freq(char *res_name) -{ - char path[PATH_MAX]; - int freq, ret; - - if (!res_name) - return -EINVAL; - - snprintf(path, PATH_MAX, "%s%s%s", - CPUFREQ_PATH_PREFIX, - res_name, - CPUFREQ_CURR_FREQ_PATH_SUFFIX); - - ret = sysfs_read_int(path, &freq); - if (ret < 0) - return ret; - - return freq; -} - -static int tm2_dvfs_get_min_freq(char *res_name) -{ - char path[PATH_MAX]; - int freq, ret; - - if (!res_name) - return -EINVAL; - - snprintf(path, PATH_MAX, "%s%s%s", - CPUFREQ_PATH_PREFIX, - res_name, - CPUFREQ_MIN_FREQ_PATH_SUFFIX); - - ret = sysfs_read_int(path, &freq); - if (ret < 0) - return ret; - - return freq; -} - -static int tm2_dvfs_set_min_freq(char *res_name, int freq) -{ - char path[PATH_MAX]; - int ret; - - if ((!res_name) || (freq < 0)) - return -EINVAL; - - snprintf(path, PATH_MAX, "%s%s%s", - CPUFREQ_PATH_PREFIX, - res_name, - CPUFREQ_MIN_FREQ_PATH_SUFFIX); - - ret = sysfs_write_int(path, freq); - if (ret < 0) - return ret; - - return 0; -} - -static int tm2_dvfs_get_max_freq(char *res_name) -{ - char path[PATH_MAX]; - int freq, ret; - - if (!res_name) - return -EINVAL; - - snprintf(path, PATH_MAX, "%s%s%s", - CPUFREQ_PATH_PREFIX, - res_name, - CPUFREQ_MAX_FREQ_PATH_SUFFIX); - - ret = sysfs_read_int(path, &freq); - if (ret < 0) - return ret; - - return freq; -} - -static int tm2_dvfs_set_max_freq(char *res_name, int freq) -{ - char path[PATH_MAX]; - int ret; - - if ((!res_name) || (freq < 0)) - return -EINVAL; - - snprintf(path, PATH_MAX, "%s%s%s", - CPUFREQ_PATH_PREFIX, - res_name, - CPUFREQ_MAX_FREQ_PATH_SUFFIX); - - ret = sysfs_write_int(path, freq); - if (ret < 0) - return ret; - return 0; -} - -static int tm2_dvfs_get_up_threshold(char *res_name) -{ - char path[PATH_MAX]; - int val, ret; - - if (!res_name) - return -EINVAL; - - snprintf(path, PATH_MAX, "%s%s%s", - CPUFREQ_PATH_PREFIX, - res_name, - CPUFREQ_UP_THRESHOLD_PATH_SUFFIX); - - ret = sysfs_read_int(path, &val); - if (ret < 0) - return ret; - - return val; -} - -static int tm2_dvfs_set_up_threshold(char *res_name, int up_threshold) -{ - char path[PATH_MAX]; - int ret; - - if ((!res_name) || (up_threshold < 0)) - return -EINVAL; - - snprintf(path, PATH_MAX, "%s%s%s", - CPUFREQ_PATH_PREFIX, - res_name, - CPUFREQ_UP_THRESHOLD_PATH_SUFFIX); - - ret = sysfs_write_int(path, up_threshold); - if (ret < 0) - return ret; - - return 0; -} - -static int tm2_dvfs_get_load_table(char *res_name, void *pass_cpu_load_table) -{ - return 0; -} - -static struct pass_resource_dvfs_ops tm2_cpu_dvfs_ops = { - .get_curr_governor = tm2_dvfs_get_curr_governor, - .set_curr_governor = tm2_dvfs_set_curr_governor, - .get_avail_governor = NULL, - .get_curr_freq = tm2_dvfs_get_curr_freq, - .get_min_freq = tm2_dvfs_get_min_freq, - .set_min_freq = tm2_dvfs_set_min_freq, - .get_max_freq = tm2_dvfs_get_max_freq, - .set_max_freq = tm2_dvfs_set_max_freq, - .get_up_threshold = tm2_dvfs_get_up_threshold, - .set_up_threshold = tm2_dvfs_set_up_threshold, - .get_load_table = tm2_dvfs_get_load_table, -}; - -static int tm2_hotplug_get_online_state(char *res_name, int cpu) -{ - char path[PATH_MAX]; - int ret, online; - - if ((!res_name)) - return -EINVAL; - - snprintf(path, PATH_MAX, "%s%d%s", - CPU_ONLINE_PATH_PREFIX, - cpu, - CPU_ONLINE_PATH_SUFFIX); - - ret = sysfs_read_int(path, &online); - if (ret < 0) - return ret; - - return online; -} - -static int tm2_hotplug_set_online_state(char *res_name, int cpu, int on) -{ - char path[PATH_MAX]; - int ret; - - if ((!res_name)) - return -EINVAL; - if ((on != CPU_ONLINE_STATE_ON) && (on != CPU_ONLINE_STATE_OFF)) - return -EINVAL; - - /* - * NOTE: Exynos SoC series cannot turn off the CPU0 - * because of h/w design. To prevent the critical problem, - * if someone try to turn off the CPU0, just return without any - * opertaion. - */ - if (on == 0 && cpu == 0) { - _E("cannot turn off the CPU0"); - return 0; - } - - snprintf(path, PATH_MAX, "%s%d%s", - CPU_ONLINE_PATH_PREFIX, - cpu, - CPU_ONLINE_PATH_SUFFIX); - - ret = sysfs_write_int(path, on); - if (ret < 0) - return ret; - - return 0; -} - -static struct pass_resource_hotplug_ops tm2_cpu_hotplus_ops = { - .get_online_state = tm2_hotplug_get_online_state, - .set_online_state = tm2_hotplug_set_online_state, - .get_online_min_num = NULL, - .set_online_min_num = NULL, - .get_online_max_num = NULL, - .set_online_max_num = NULL, -}; - -static int tm2_tmu_get_temp(char *res_thermal_name) -{ - char path[PATH_MAX]; - int temp, ret; - - if (!res_thermal_name) - return -EINVAL; - - snprintf(path, PATH_MAX, "%s%s%s", - TMU_PATH_PREFIX, - res_thermal_name, - TMU_TEMP_PATH_SUFFIX); - - ret = sysfs_read_int(path, &temp); - if (ret < 0) - return ret; - - return temp; -} - -static int tm2_tmu_get_policy(char *res_thermal_name, char *policy) -{ - char path[PATH_MAX]; - int ret; - - if ((!res_thermal_name) || (!policy)) - return -EINVAL; - - snprintf(path, PATH_MAX, "%s%s%s", - TMU_PATH_PREFIX, - res_thermal_name, - TMU_POLICY_PATH_SUFFIX); - - ret = sysfs_read_str(path, policy, BUFF_MAX); - if (ret < 0) - return ret; - - return 0; -} - -static struct pass_resource_tmu_ops tm2_cpu_tmu_ops = { - .get_temp = tm2_tmu_get_temp, - .get_policy = tm2_tmu_get_policy, -}; - -static int tm2_cpu_open(char *res_name, struct pass_resource_info *info, - struct pass_resource_common **common) -{ - struct pass_resource_cpu *cpu_res; - - if (!info) - return -EINVAL; - - /* TODO: Possibility of a memory leak */ - cpu_res = calloc(1, sizeof(struct pass_resource_cpu)); - if (!cpu_res) - return -ENOMEM; - - cpu_res->common.info = info; - cpu_res->dvfs = tm2_cpu_dvfs_ops; - cpu_res->hotplug = tm2_cpu_hotplus_ops; - cpu_res->tmu = tm2_cpu_tmu_ops; - - *common = (struct pass_resource_common *) cpu_res; - - return 0; -} - -static int tm2_cpu_close(char *res_name, struct pass_resource_common *common) -{ - if (!common) - return -EINVAL; - - free(common); - - return 0; -} - -HAL_MODULE_STRUCTURE = { - .magic = HAL_INFO_TAG, - .hal_version = HAL_VERSION, - .device_version = DEV_VERSION_CPU, - .id = PASS_RESOURCE_CPU_ID, - .name = PASS_RESOURCE_CPU_NAME, - .open = tm2_cpu_open, - .close = tm2_cpu_close, -}; diff --git a/src/gpu/CMakeLists.txt b/src/gpu/CMakeLists.txt deleted file mode 100644 index 4425ca0..0000000 --- a/src/gpu/CMakeLists.txt +++ /dev/null @@ -1,24 +0,0 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 2.6) -PROJECT(gpu C) - -INCLUDE(FindPkgConfig) -pkg_check_modules(pkgs REQUIRED dlog glib-2.0) - -#HAL version -string(REPLACE "." ";" HAL_VERSION_LIST ${HAL_VERSION}) -list(GET HAL_VERSION_LIST 0 HAL_VERSION_MAJOR) -list(GET HAL_VERSION_LIST 1 HAL_VERSION_MINOR) -list(GET HAL_VERSION_LIST 2 HAL_VERSION_REVISION) -list(GET HAL_VERSION_LIST 3 HAL_VERSION_RELEASE) -add_definitions(-DVER_MAJOR=${HAL_VERSION_MAJOR} -DVER_MINOR=${HAL_VERSION_MINOR}) -add_definitions(-DVER_REVISION=${HAL_VERSION_REVISION} -DVER_RELEASE=${HAL_VERSION_RELEASE}) - -SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden") -SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}") - -SET(SRCS ${PROJECT_NAME}.c - ../shared/sysfs.c) - -ADD_LIBRARY(${PROJECT_NAME} MODULE ${SRCS}) -SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES PREFIX "") -INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${DEST_DIR} COMPONENT RuntimeLibraries) diff --git a/src/gpu/gpu.c b/src/gpu/gpu.c deleted file mode 100644 index eaa0039..0000000 --- a/src/gpu/gpu.c +++ /dev/null @@ -1,282 +0,0 @@ -/* - * PASS (Power Aware System Service) - * - * Copyright (c) 2017 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the License); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include -#include -#include -#include -#include -#include -#include - -#include "../shared/sysfs.h" - -/* TODO: Version! */ -#define HAL_VERSION MAKE_2B_CODE_4(VER_MAJOR,VER_MINOR,VER_REVISION,VER_RELEASE) -#define DEV_VERSION_GPU MAKE_2B_CODE_2(1,0) - -#define DEVFREQ_GPU_PATH_PREFIX "/sys/class/devfreq/" -#define DEVFREQ_GPU_CURR_GOVERNOR_PATH_SUFFIX "/governor" -#define DEVFREQ_GPU_CURR_FREQ_PATH_SUFFIX "/cur_freq" -#define DEVFREQ_GPU_MIN_FREQ_PATH_SUFFIX "/min_freq" -#define DEVFREQ_GPU_MAX_FREQ_PATH_SUFFIX "/max_freq" - -#define TMU_PATH_PREFIX "/sys/class/thermal/" -#define TMU_TEMP_PATH_SUFFIX "/temp" -#define TMU_POLICY_PATH_SUFFIX "/policy" - -static int tm2_dvfs_get_curr_governor(char *res_name, char *governor) -{ - char path[PATH_MAX]; - int ret; - - if ((!res_name) || (!governor)) - return -EINVAL; - - snprintf(path, PATH_MAX, "%s%s%s", - DEVFREQ_GPU_PATH_PREFIX, - res_name, - DEVFREQ_GPU_CURR_GOVERNOR_PATH_SUFFIX); - - ret = sysfs_read_str(path, governor, BUFF_MAX); - if (ret < 0) - return ret; - - return 0; -} - -static int tm2_dvfs_set_curr_governor(char *res_name, char *governor) -{ - char path[PATH_MAX]; - int ret; - - if ((!res_name) || (!governor)) - return -EINVAL; - - snprintf(path, PATH_MAX, "%s%s%s", - DEVFREQ_GPU_PATH_PREFIX, - res_name, - DEVFREQ_GPU_CURR_GOVERNOR_PATH_SUFFIX); - - ret = sysfs_write_str(path, governor); - if (ret < 0) - return ret; - - return 0; -} - -static int tm2_dvfs_get_curr_freq(char *res_name) -{ - char path[PATH_MAX]; - int freq, ret; - - if (!res_name) - return -EINVAL; - - snprintf(path, PATH_MAX, "%s%s%s", - DEVFREQ_GPU_PATH_PREFIX, - res_name, - DEVFREQ_GPU_CURR_FREQ_PATH_SUFFIX); - - ret = sysfs_read_int(path, &freq); - if (ret < 0) - return ret; - - return freq; -} - -static int tm2_dvfs_get_min_freq(char *res_name) -{ - char path[PATH_MAX]; - int freq, ret; - - if (!res_name) - return -EINVAL; - - snprintf(path, PATH_MAX, "%s%s%s", - DEVFREQ_GPU_PATH_PREFIX, - res_name, - DEVFREQ_GPU_MIN_FREQ_PATH_SUFFIX); - - ret = sysfs_read_int(path, &freq); - if (ret < 0) - return ret; - - return freq; -} - -static int tm2_dvfs_set_min_freq(char *res_name, int freq) -{ - char path[PATH_MAX]; - int ret; - - if ((!res_name) || (freq < 0)) - return -EINVAL; - - snprintf(path, PATH_MAX, "%s%s%s", - DEVFREQ_GPU_PATH_PREFIX, - res_name, - DEVFREQ_GPU_MIN_FREQ_PATH_SUFFIX); - - ret = sysfs_write_int(path, freq); - if (ret < 0) - return ret; - - return 0; -} - -static int tm2_dvfs_get_max_freq(char *res_name) -{ - char path[PATH_MAX]; - int freq, ret; - - if (!res_name) - return -EINVAL; - - snprintf(path, PATH_MAX, "%s%s%s", - DEVFREQ_GPU_PATH_PREFIX, - res_name, - DEVFREQ_GPU_MAX_FREQ_PATH_SUFFIX); - - ret = sysfs_read_int(path, &freq); - if (ret < 0) - return ret; - - return freq; -} - -static int tm2_dvfs_set_max_freq(char *res_name, int freq) -{ - char path[PATH_MAX]; - int ret; - - if ((!res_name) || (freq < 0)) - return -EINVAL; - - snprintf(path, PATH_MAX, "%s%s%s", - DEVFREQ_GPU_PATH_PREFIX, - res_name, - DEVFREQ_GPU_MAX_FREQ_PATH_SUFFIX); - - ret = sysfs_write_int(path, freq); - if (ret < 0) - return ret; - return 0; -} - - -static struct pass_resource_dvfs_ops tm2_gpu_dvfs_ops = { - .get_curr_governor = tm2_dvfs_get_curr_governor, - .set_curr_governor = tm2_dvfs_set_curr_governor, - .get_avail_governor = NULL, - .get_curr_freq = tm2_dvfs_get_curr_freq, - .get_min_freq = tm2_dvfs_get_min_freq, - .set_min_freq = tm2_dvfs_set_min_freq, - .get_max_freq = tm2_dvfs_get_max_freq, - .set_max_freq = tm2_dvfs_set_max_freq, - .get_up_threshold = NULL, - .set_up_threshold = NULL, - .get_load_table = NULL, -}; - -static int tm2_tmu_get_temp(char *res_thermal_name) -{ - char path[PATH_MAX]; - int temp; - int ret; - - if (!res_thermal_name) - return -EINVAL; - - snprintf(path, PATH_MAX, "%s%s%s", - TMU_PATH_PREFIX, - res_thermal_name, - TMU_TEMP_PATH_SUFFIX); - - ret = sysfs_read_int(path, &temp); - if (ret < 0) - return ret; - - return temp; -} - -static int tm2_tmu_get_policy(char *res_thermal_name, char *policy) -{ - char path[PATH_MAX]; - int ret; - - if ((!res_thermal_name) || (!policy)) - return -EINVAL; - - snprintf(path, PATH_MAX, "%s%s%s", - TMU_PATH_PREFIX, - res_thermal_name, - TMU_POLICY_PATH_SUFFIX); - - ret = sysfs_read_str(path, policy, BUFF_MAX); - if (ret < 0) - return ret; - - return 0; -} - -static struct pass_resource_tmu_ops tm2_gpu_tmu_ops = { - .get_temp = tm2_tmu_get_temp, - .get_policy = tm2_tmu_get_policy, -}; - -static int tm2_gpu_open(char *res_name, struct pass_resource_info *info, - struct pass_resource_common **common) -{ - struct pass_resource_gpu *gpu_res; - - if (!info) - return -EINVAL; - - /* TODO: Possibility of a memory leak */ - gpu_res = calloc(1, sizeof(struct pass_resource_gpu)); - if (!gpu_res) - return -ENOMEM; - - gpu_res->common.info = info; - gpu_res->dvfs = tm2_gpu_dvfs_ops; - gpu_res->tmu = tm2_gpu_tmu_ops; - - *common = (struct pass_resource_common *) gpu_res; - - return 0; -} - -static int tm2_gpu_close(char *res_name, struct pass_resource_common *common) -{ - if (!common) - return -EINVAL; - - free(common); - - return 0; -} - -HAL_MODULE_STRUCTURE = { - .magic = HAL_INFO_TAG, - .hal_version = HAL_VERSION, - .device_version = DEV_VERSION_GPU, - .id = PASS_RESOURCE_GPU_ID, - .name = PASS_RESOURCE_GPU_NAME, - .open = tm2_gpu_open, - .close = tm2_gpu_close, -}; diff --git a/src/shared/sysfs.c b/src/shared/sysfs.c deleted file mode 100644 index 57a168b..0000000 --- a/src/shared/sysfs.c +++ /dev/null @@ -1,127 +0,0 @@ -/* - * PASS (Power Aware System Service) - * - * Copyright (c) 2017 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the License); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include -#include -#include -#include -#include -#include - -#include "sysfs.h" - -static int sysfs_read_buf(char *path, char *buf, int len) -{ - int r, fd; - - if ((!path) || (!buf) || (len < 0)) - return -EINVAL; - - fd = open(path, O_RDONLY); - if (fd == -1) - return -ENOENT; - - r = read(fd, buf, len + 1); - close(fd); - - if ((r < 0) || (r > len)) - return -EIO; - - buf[r] = '\0'; - - return 0; -} - -static int sysfs_write_buf(char *path, char *buf) -{ - int w, fd; - - if ((!path) || (!buf)) - return -EINVAL; - - fd = open(path, O_WRONLY); - if (fd == -1) - return -ENOENT; - - w = write(fd, buf, strlen(buf)); - close(fd); - - if (w < 0) - return -EIO; - - return 0; -} - -int sysfs_read_int(char *path, int *val) -{ - char buf[MAX_BUF_SIZE]; - int r; - - if ((!path) || (!val)) - return -EINVAL; - - r = sysfs_read_buf(path, buf, MAX_BUF_SIZE); - if (r < 0) - return r; - - *val = atoi(buf); - return 0; -} - -int sysfs_read_str(char *path, char *str, int len) -{ - int r; - - if ((!path) || (!str) || (len <= 0)) - return -EINVAL; - - r = sysfs_read_buf(path, str, len); - if (r < 0) - return r; - - return 0; -} - -int sysfs_write_int(char *path, int val) -{ - char buf[MAX_BUF_SIZE]; - int w; - - if (!path) - return -EINVAL; - - snprintf(buf, MAX_BUF_SIZE, "%d", val); - w = sysfs_write_buf(path, buf); - if (w < 0) - return w; - - return 0; -} - -int sysfs_write_str(char *path, char *str) -{ - int w; - - if ((!path) || (!str)) - return -EINVAL; - - w = sysfs_write_buf(path, str); - if (w < 0) - return w; - - return 0; -} diff --git a/src/shared/sysfs.h b/src/shared/sysfs.h deleted file mode 100644 index 174804f..0000000 --- a/src/shared/sysfs.h +++ /dev/null @@ -1,6 +0,0 @@ -#define MAX_BUF_SIZE 255 - -int sysfs_read_int(char *path, int *val); -int sysfs_read_str(char *path, char *str, int len); -int sysfs_write_int(char *path, int val); -int sysfs_write_str(char *path, char *str); -- 2.7.4 From de3a1c0b7b4a4c624562029b9c440b69ffd3472e Mon Sep 17 00:00:00 2001 From: Dongwoo Lee Date: Tue, 1 Aug 2017 08:05:52 +0900 Subject: [PATCH 14/16] pass-hal: tm2: Add dependency on PASS and PASS standard HAL Now, pass-hal-tm2 only has configuration files, and all operation is processed in standard HAL. Thus, we should make HAL for TM2 depends on PASS and its standard HAL. To do this, Require for pass-hal-standard is added to RPM spec file. Change-Id: Ia0f738c22fc632fcf9bd4d9ce62f3187064cbb7a Signed-off-by: Dongwoo Lee Signed-off-by: Chanwoo Choi --- packaging/pass-hal-tm2.spec | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packaging/pass-hal-tm2.spec b/packaging/pass-hal-tm2.spec index 9f48068..adce8e6 100644 --- a/packaging/pass-hal-tm2.spec +++ b/packaging/pass-hal-tm2.spec @@ -14,6 +14,8 @@ ExclusiveArch: %{arm} aarch64 Requires(post): /sbin/ldconfig Requires(postun): /sbin/ldconfig +Requires: pass >= 0.0.1 +Requires: pass-hal-standard >= 0.0.1 BuildRequires: cmake %description -- 2.7.4 From f6a2a6188cacbb5d1df5838ba2f706e1007ff536 Mon Sep 17 00:00:00 2001 From: Dongwoo Lee Date: Wed, 9 Aug 2017 15:54:17 +0900 Subject: [PATCH 15/16] pass-hal: tm2: Remove pass-hal.conf PASS HAL for TM2 only provides the specific configuration to standard HAL, and thus accessing files is not performed anymore in TM2 HAL. For this reason, it is better to move the pass-hal.conf into standard HAL. Since this, pass-hal.conf is removed in TM2 HAL, and it can be found in standard HAL. Change-Id: I91b306ba812572cdbe7580fdb25226787333892c Signed-off-by: Dongwoo Lee --- CMakeLists.txt | 1 - packaging/pass-hal-tm2.spec | 2 -- scripts/pass-hal.conf | 30 ------------------------------ 3 files changed, 33 deletions(-) delete mode 100644 scripts/pass-hal.conf diff --git a/CMakeLists.txt b/CMakeLists.txt index 622008a..47f6d89 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,4 +16,3 @@ INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/scripts/pass-resource1.conf DESTINATIO INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/scripts/pass-resource2.conf DESTINATION /etc/pass) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/scripts/pass-resource3.conf DESTINATION /etc/pass) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/scripts/pass-resource4.conf DESTINATION /etc/pass) -INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/scripts/pass-hal.conf DESTINATION /usr/lib/tmpfiles.d) diff --git a/packaging/pass-hal-tm2.spec b/packaging/pass-hal-tm2.spec index adce8e6..ba28c02 100644 --- a/packaging/pass-hal-tm2.spec +++ b/packaging/pass-hal-tm2.spec @@ -37,7 +37,6 @@ rm -rf %{buildroot} %post /sbin/ldconfig -systemd-tmpfiles /usr/lib/tmpfiles.d/pass-hal.conf --create if [ -f %{_unitdir}/pass.service ]; then systemctl | grep pass.service | awk '{if ($3 == "active" && $4 == "running") system("systemctl restart pass.service")}' fi @@ -50,7 +49,6 @@ fi %files %manifest %{name}.manifest -/usr/lib/tmpfiles.d/pass-hal.conf %config %{_sysconfdir}/pass/pass.conf %config %{_sysconfdir}/pass/pass-resource0.conf diff --git a/scripts/pass-hal.conf b/scripts/pass-hal.conf deleted file mode 100644 index 5d823db..0000000 --- a/scripts/pass-hal.conf +++ /dev/null @@ -1,30 +0,0 @@ -z /sys/devices/system/cpu/*/online 0660 root system_fw - -t /sys/devices/system/cpu/*/online - - - - security.SMACK64="System" -z /sys/devices/system/cpu/*/cpufreq/scaling_available_governors 0440 root system_fw - -t /sys/devices/system/cpu/*/cpufreq/scaling_available_governors - - - - security.SMACK64="System" -z /sys/devices/system/cpu/*/cpufreq/cpuinfo_cur_freq 0440 root system_fw - -t /sys/devices/system/cpu/*/cpufreq/cpuinfo_cur_freq - - - - security.SMACK64="System" -z /sys/devices/system/cpu/*/cpufreq/scaling_governor 0660 root system_fw - -t /sys/devices/system/cpu/*/cpufreq/scaling_governor - - - - security.SMACK64="System" -z /sys/devices/system/cpu/*/cpufreq/scaling_min_freq 0660 root system_fw - -t /sys/devices/system/cpu/*/cpufreq/scaling_min_freq - - - - security.SMACK64="System" -z /sys/devices/system/cpu/*/cpufreq/scaling_max_freq 0660 root system_fw - -t /sys/devices/system/cpu/*/cpufreq/scaling_max_freq - - - - security.SMACK64="System" -z /sys/devices/system/cpu/*/cpufreq/ondemand/up_threshold 0660 root system_fw - -t /sys/devices/system/cpu/*/cpufreq/ondemand/up_threshold - - - - security.SMACK64="System" -z /sys/class/thermal/*/temp 0440 root system_fw - -t /sys/class/thermal/*/temp - - - - security.SMACK64="System" -z /sys/class/thermal/*/policy 0440 root system_fw - -t /sys/class/thermal/*/policy - - - - security.SMACK64="System" -z /sys/kernel/debug/cpufreq/*/load_table 0440 root system_fw - -t /sys/kernel/debug/cpufreq/*/load_table - - - - security.SMACK64="System" -z /sys/kernel/debug/cpufreq/*/load_table 0440 root system_fw - -t /sys/kernel/debug/cpufreq/*/load_table - - - - security.SMACK64="System" -z /sys/devices/platform/soc/*/devfreq/*/cur_freq 0440 root system_fw - -t /sys/devices/platform/soc/*/devfreq/*/cur_freq - - - - security.SMACK64="System" -z /sys/devices/platform/soc/*/devfreq/*/governor 0440 root system_fw - -t /sys/devices/platform/soc/*/devfreq/*/governor - - - - security.SMACK64="System" -z /sys/devices/platform/soc/*/devfreq/*/min_freq 0660 root system_fw - -t /sys/devices/platform/soc/*/devfreq/*/min_freq - - - - security.SMACK64="System" -z /sys/devices/platform/soc/*/devfreq/*/max_freq 0660 root system_fw - -t /sys/devices/platform/soc/*/devfreq/*/max_freq - - - - security.SMACK64="System" -- 2.7.4 From 306c76690c074c5a87dd9377c1680137a0a496ff Mon Sep 17 00:00:00 2001 From: Wook Song Date: Wed, 23 Aug 2017 10:29:35 +0900 Subject: [PATCH 16/16] pass-hal: tm2: Change the way to restart daemon after install/uninstall This patch simply changes the way to restart the pass daemon after installing or uninstalling this package. 'awk' is no longer needed. Note that the option 'try-restart' of systemctl is to restart one or more units (in this context, means the pass daemon) if active. Change-Id: I29f996dd05af0d681a1f3ce31f13c835fe5835ea Signed-off-by: Wook Song --- packaging/pass-hal-tm2.spec | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packaging/pass-hal-tm2.spec b/packaging/pass-hal-tm2.spec index ba28c02..f6f0200 100644 --- a/packaging/pass-hal-tm2.spec +++ b/packaging/pass-hal-tm2.spec @@ -13,7 +13,9 @@ Source1: %{name}.manifest ExclusiveArch: %{arm} aarch64 Requires(post): /sbin/ldconfig +Requires(post): /bin/systemctl Requires(postun): /sbin/ldconfig +Requires(postun): /bin/systemctl Requires: pass >= 0.0.1 Requires: pass-hal-standard >= 0.0.1 BuildRequires: cmake @@ -38,13 +40,13 @@ rm -rf %{buildroot} %post /sbin/ldconfig if [ -f %{_unitdir}/pass.service ]; then - systemctl | grep pass.service | awk '{if ($3 == "active" && $4 == "running") system("systemctl restart pass.service")}' + systemctl try-restart pass.service fi %postun /sbin/ldconfig if [ -f %{_unitdir}/pass.service ]; then - systemctl | grep pass.service | awk '{if ($3 == "active" && $4 == "running") system("systemctl restart pass.service")}' + systemctl try-restart pass.service fi %files -- 2.7.4