mirror of
https://github.com/chararomandroid/android_device_samsung_a20
synced 2026-08-21 11:55:31 -04:00
universal7885: Switch to AIDL libperfmgr power HAL
Change-Id: I56928037bf543accb3175ea50c674f80a3f60b99 Signed-off-by: SamarV-121 <samarvispute121@pm.me> Signed-off-by: roynatech2544 <whiteshell2544@naver.com>
This commit is contained in:
parent
0522bd9d3d
commit
5fc20541b8
13 changed files with 191 additions and 514 deletions
179
universal7885-common/configs/power/powerhint.json
Normal file
179
universal7885-common/configs/power/powerhint.json
Normal file
|
|
@ -0,0 +1,179 @@
|
|||
{
|
||||
"Nodes": [
|
||||
{
|
||||
"Name": "CPULittleClusterIOIsBusy",
|
||||
"Path": "/sys/devices/system/cpu/cpu0/cpufreq/interactive/io_is_busy",
|
||||
"Values": [
|
||||
"0",
|
||||
"1"
|
||||
],
|
||||
"DefaultIndex": 0,
|
||||
"ResetOnInit": true
|
||||
},
|
||||
{
|
||||
"Name": "CPUBoostPulse",
|
||||
"Path": "/sys/devices/system/cpu/cpu0/cpufreq/interactive/boostpulse",
|
||||
"Values": [
|
||||
"0",
|
||||
"1"
|
||||
],
|
||||
"DefaultIndex": 0,
|
||||
"ResetOnInit": true
|
||||
},
|
||||
{
|
||||
"Name": "CPUBigClusterIOIsBusy",
|
||||
"Path": "/sys/devices/system/cpu/cpu6/cpufreq/interactive/io_is_busy",
|
||||
"Values": [
|
||||
"0",
|
||||
"1"
|
||||
],
|
||||
"DefaultIndex": 0,
|
||||
"ResetOnInit": true
|
||||
},
|
||||
{
|
||||
"Name": "TouchscreenEnable",
|
||||
"Path": "/sys/class/sec/tsp/input/enabled",
|
||||
"Values": [
|
||||
"1",
|
||||
"0"
|
||||
],
|
||||
"ResetOnInit": true
|
||||
},
|
||||
{
|
||||
"Name": "DoubleTapToWakeEnable",
|
||||
"Path": "/sys/class/sec/tsp/cmd",
|
||||
"Values": [
|
||||
"aot_enable,0",
|
||||
"aot_enable,1"
|
||||
],
|
||||
"DefaultIndex": 0,
|
||||
"ResetOnInit": false
|
||||
},
|
||||
{
|
||||
"Name": "PowerHALMainState",
|
||||
"Path": "vendor.powerhal.state",
|
||||
"Values": [
|
||||
"SUSTAINED_PERFORMANCE",
|
||||
"VR_MODE",
|
||||
"VR_SUSTAINED_PERFORMANCE",
|
||||
""
|
||||
],
|
||||
"Type": "Property"
|
||||
},
|
||||
{
|
||||
"Name": "PowerHALAudioState",
|
||||
"Path": "vendor.powerhal.audio",
|
||||
"Values": [
|
||||
"AUDIO_STREAMING_LOW_LATENCY",
|
||||
""
|
||||
],
|
||||
"Type": "Property"
|
||||
},
|
||||
{
|
||||
"Name": "PowerHALRenderingState",
|
||||
"Path": "vendor.powerhal.rendering",
|
||||
"Values": [
|
||||
"EXPENSIVE_RENDERING",
|
||||
""
|
||||
],
|
||||
"Type": "Property"
|
||||
},
|
||||
{
|
||||
"Name": "PowerHALPerfProfileState",
|
||||
"Path": "vendor.powerhal.perf_profile",
|
||||
"Values": [
|
||||
"POWER_SAVE",
|
||||
"BIAS_POWER_SAVE",
|
||||
"BIAS_PERFORMANCE",
|
||||
"HIGH_PERFORMANCE"
|
||||
],
|
||||
"Type": "Property"
|
||||
}
|
||||
],
|
||||
"Actions": [
|
||||
{
|
||||
"PowerHint": "INTERACTION",
|
||||
"Node": "CPULittleClusterIOIsBusy",
|
||||
"Duration": 0,
|
||||
"Value": "1"
|
||||
},
|
||||
{
|
||||
"PowerHint": "INTERACTION",
|
||||
"Node": "CPUBoostPulse",
|
||||
"Duration": 0,
|
||||
"Value": "1"
|
||||
},
|
||||
{
|
||||
"PowerHint": "INTERACTION",
|
||||
"Node": "CPUBigClusterIOIsBusy",
|
||||
"Duration": 0,
|
||||
"Value": "1"
|
||||
},
|
||||
{
|
||||
"PowerHint": "DOUBLE_TAP_TO_WAKE",
|
||||
"Node": "DoubleTapToWakeEnable",
|
||||
"Duration": 0,
|
||||
"Value": "aot_enable,1"
|
||||
},
|
||||
{
|
||||
"PowerHint": "AUDIO_STREAMING_LOW_LATENCY",
|
||||
"Node": "PowerHALAudioState",
|
||||
"Duration": 0,
|
||||
"Value": "AUDIO_STREAMING_LOW_LATENCY"
|
||||
},
|
||||
{
|
||||
"PowerHint": "SUSTAINED_PERFORMANCE",
|
||||
"Node": "PowerHALMainState",
|
||||
"Duration": 0,
|
||||
"Value": "SUSTAINED_PERFORMANCE"
|
||||
},
|
||||
{
|
||||
"PowerHint": "VR_MODE",
|
||||
"Node": "PowerHALMainState",
|
||||
"Duration": 0,
|
||||
"Value": "VR_MODE"
|
||||
},
|
||||
{
|
||||
"PowerHint": "VR_SUSTAINED_PERFORMANCE",
|
||||
"Node": "PowerHALMainState",
|
||||
"Duration": 0,
|
||||
"Value": "VR_SUSTAINED_PERFORMANCE"
|
||||
},
|
||||
{
|
||||
"PowerHint": "EXPENSIVE_RENDERING",
|
||||
"Node": "PowerHALRenderingState",
|
||||
"Duration": 0,
|
||||
"Value": "EXPENSIVE_RENDERING"
|
||||
},
|
||||
{
|
||||
"PowerHint": "INTERACTIVE",
|
||||
"Node": "TouchscreenEnable",
|
||||
"Duration": 0,
|
||||
"Value": "1"
|
||||
},
|
||||
{
|
||||
"PowerHint": "PROFILE_POWER_SAVE",
|
||||
"Node": "PowerHALPerfProfileState",
|
||||
"Duration": 0,
|
||||
"Value": "POWER_SAVE"
|
||||
},
|
||||
{
|
||||
"PowerHint": "PROFILE_BIAS_POWER_SAVE",
|
||||
"Node": "PowerHALPerfProfileState",
|
||||
"Duration": 0,
|
||||
"Value": "BIAS_POWER_SAVE"
|
||||
},
|
||||
{
|
||||
"PowerHint": "PROFILE_BIAS_PERFORMANCE",
|
||||
"Node": "PowerHALPerfProfileState",
|
||||
"Duration": 0,
|
||||
"Value": "BIAS_PERFORMANCE"
|
||||
},
|
||||
{
|
||||
"PowerHint": "PROFILE_HIGH_PERFORMANCE",
|
||||
"Node": "PowerHALPerfProfileState",
|
||||
"Duration": 0,
|
||||
"Value": "HIGH_PERFORMANCE"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -1,42 +0,0 @@
|
|||
//
|
||||
// Copyright (C) 2020 The LineageOS Project
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
|
||||
cc_binary {
|
||||
name: "android.hardware.power@1.0-service.universal7884B",
|
||||
|
||||
srcs: [
|
||||
"Power.cpp",
|
||||
"service.cpp",
|
||||
],
|
||||
|
||||
local_include_dirs: ["include"],
|
||||
|
||||
shared_libs: [
|
||||
"libbase",
|
||||
"libbinder",
|
||||
"libhidlbase",
|
||||
"libutils",
|
||||
"android.hardware.power@1.0",
|
||||
],
|
||||
|
||||
static_libs: ["libc++fs"],
|
||||
vendor: true,
|
||||
|
||||
init_rc: ["android.hardware.power@1.0-service.universal7884B.rc"],
|
||||
vintf_fragments: ["android.hardware.power@1.0-service.universal7884B.xml"],
|
||||
relative_install_path: "hw",
|
||||
|
||||
}
|
||||
|
|
@ -1,225 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2020 The LineageOS Project
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#define LOG_TAG "android.hardware.power@1.0-service.exynos"
|
||||
|
||||
#include "Power.h"
|
||||
#include <android-base/logging.h>
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include "samsung_lights.h"
|
||||
#include "samsung_power.h"
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace power {
|
||||
namespace V1_0 {
|
||||
namespace implementation {
|
||||
|
||||
/*
|
||||
* Write value to path and close file.
|
||||
*/
|
||||
template <typename T>
|
||||
static void set(const std::string& path, const T& value) {
|
||||
std::ofstream file(path);
|
||||
file << value << std::endl;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
static T get(const std::string& path, const T& def) {
|
||||
std::ifstream file(path);
|
||||
T result;
|
||||
|
||||
file >> result;
|
||||
return file.fail() ? def : result;
|
||||
}
|
||||
|
||||
Return<void> Power::setInteractive(bool interactive) {
|
||||
if (!initialized) {
|
||||
initialize();
|
||||
}
|
||||
|
||||
if (!interactive) {
|
||||
int32_t panel_brightness = get(PANEL_BRIGHTNESS_NODE, -1);
|
||||
|
||||
if (panel_brightness > 0) {
|
||||
LOG(VERBOSE) << "Moving to non-interactive state, but screen is still on,"
|
||||
<< "not disabling input devices";
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
if (!sec_touchscreen.empty()) {
|
||||
set(sec_touchscreen, interactive ? "1" : "0");
|
||||
}
|
||||
|
||||
if (!sec_touchkey.empty()) {
|
||||
if (!interactive) {
|
||||
int button_state = get(sec_touchkey, -1);
|
||||
|
||||
if (button_state < 0) {
|
||||
LOG(ERROR) << "Failed to read touchkey state";
|
||||
goto out;
|
||||
}
|
||||
|
||||
/*
|
||||
* If button_state is 0, the keys have been disabled by another component
|
||||
* (for example lineagehw), which means we don't want them to be enabled when resuming
|
||||
* from suspend.
|
||||
*/
|
||||
if (button_state == 0) {
|
||||
touchkeys_blocked = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!touchkeys_blocked) {
|
||||
set(sec_touchkey, interactive ? "1" : "0");
|
||||
}
|
||||
}
|
||||
|
||||
out:
|
||||
for (const std::string& interactivePath : cpuInteractivePaths) {
|
||||
set(interactivePath + "/io_is_busy", interactive ? "1" : "0");
|
||||
}
|
||||
|
||||
return Void();
|
||||
}
|
||||
|
||||
Return<void> Power::powerHint(PowerHint hint, int32_t data) {
|
||||
if (!initialized) {
|
||||
initialize();
|
||||
}
|
||||
|
||||
switch (hint) {
|
||||
case PowerHint::INTERACTION:
|
||||
case PowerHint::VSYNC:
|
||||
case PowerHint::SUSTAINED_PERFORMANCE:
|
||||
case PowerHint::VR_MODE:
|
||||
case PowerHint::VIDEO_ENCODE:
|
||||
case PowerHint::VIDEO_DECODE:
|
||||
case PowerHint::LAUNCH:
|
||||
sendBoostpulse();
|
||||
break;
|
||||
case PowerHint::LOW_POWER:
|
||||
setProfile(data ? PowerProfile::POWER_SAVE : PowerProfile::BALANCED);
|
||||
break;
|
||||
}
|
||||
return Void();
|
||||
}
|
||||
|
||||
Return<void> Power::setFeature(Feature feature __unused, bool activate __unused) {
|
||||
if (!initialized) {
|
||||
initialize();
|
||||
}
|
||||
|
||||
if (feature == Feature::POWER_FEATURE_DOUBLE_TAP_TO_WAKE) {
|
||||
set("/sys/class/sec/tsp/cmd", activate ? "aot_enable,1" : "aot_enable,0");
|
||||
}
|
||||
|
||||
return Void();
|
||||
}
|
||||
|
||||
Return<void> Power::getPlatformLowPowerStats(getPlatformLowPowerStats_cb _hidl_cb) {
|
||||
_hidl_cb({}, Status::SUCCESS);
|
||||
return Void();
|
||||
}
|
||||
|
||||
void Power::initialize() {
|
||||
findInputNodes();
|
||||
|
||||
current_profile = PowerProfile::BALANCED;
|
||||
|
||||
for (const std::string& interactivePath : cpuInteractivePaths) {
|
||||
hispeed_freqs.emplace_back(get<std::string>(interactivePath + "/hispeed_freq", ""));
|
||||
}
|
||||
|
||||
for (const std::string& sysfsPath : cpuSysfsPaths) {
|
||||
max_freqs.emplace_back(get<std::string>(sysfsPath + "/cpufreq/scaling_max_freq", ""));
|
||||
}
|
||||
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
void Power::findInputNodes() {
|
||||
std::error_code ec;
|
||||
for (auto& de : std::filesystem::directory_iterator("/sys/class/input/", ec)) {
|
||||
/* we are only interested in the input devices that we can access */
|
||||
if (ec || de.path().string().find("/sys/class/input/input") == std::string::npos) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (auto& de2 : std::filesystem::directory_iterator(de.path(), ec)) {
|
||||
if (!ec && de2.path().string().find("/name") != std::string::npos) {
|
||||
std::string content = get<std::string>(de2.path(), "");
|
||||
if (content == "sec_touchkey") {
|
||||
sec_touchkey = de.path().string().append("/enabled");
|
||||
LOG(INFO) << "found sec_touchkey: " << sec_touchkey;
|
||||
} else if (content == "sec_touchscreen") {
|
||||
sec_touchscreen = de.path().string().append("/enabled");
|
||||
LOG(INFO) << "found sec_touchscreen: " << sec_touchscreen;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Power::setProfile(PowerProfile profile) {
|
||||
if (current_profile == profile) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (profile) {
|
||||
case PowerProfile::POWER_SAVE:
|
||||
// Limit to hispeed freq
|
||||
for (int i = 0; i < cpuSysfsPaths.size(); i++) {
|
||||
if (hispeed_freqs.size() > i && !hispeed_freqs.at(i).empty()) {
|
||||
set(cpuSysfsPaths.at(i) + "/cpufreq/scaling_max_freq", hispeed_freqs.at(i));
|
||||
}
|
||||
}
|
||||
break;
|
||||
case PowerProfile::BALANCED:
|
||||
case PowerProfile::HIGH_PERFORMANCE:
|
||||
// Restore normal max freq
|
||||
for (int i = 0; i < cpuSysfsPaths.size(); i++) {
|
||||
if (max_freqs.size() > i && !max_freqs.at(i).empty()) {
|
||||
set(cpuSysfsPaths.at(i) + "/cpufreq/scaling_max_freq", max_freqs.at(i));
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void Power::sendBoostpulse() {
|
||||
// the boostpulse node is only valid for the LITTLE cluster
|
||||
set(cpuInteractivePaths.front() + "/boostpulse", "1");
|
||||
}
|
||||
|
||||
void Power::sendBoost(int duration_us) {
|
||||
set(cpuInteractivePaths.front() + "/boost", "1");
|
||||
|
||||
usleep(duration_us);
|
||||
|
||||
set(cpuInteractivePaths.front() + "/boost", "0");
|
||||
}
|
||||
|
||||
} // namespace implementation
|
||||
} // namespace V1_0
|
||||
} // namespace power
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
|
|
@ -1,75 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2020 The LineageOS Project
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef ANDROID_HARDWARE_POWER_V1_0_POWER_H
|
||||
#define ANDROID_HARDWARE_POWER_V1_0_POWER_H
|
||||
|
||||
#include <android/hardware/power/1.0/IPower.h>
|
||||
#include <hidl/MQDescriptor.h>
|
||||
#include <hidl/Status.h>
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace power {
|
||||
namespace V1_0 {
|
||||
namespace implementation {
|
||||
|
||||
using ::android::sp;
|
||||
using ::android::hardware::hidl_array;
|
||||
using ::android::hardware::hidl_memory;
|
||||
using ::android::hardware::hidl_string;
|
||||
using ::android::hardware::hidl_vec;
|
||||
using ::android::hardware::Return;
|
||||
using ::android::hardware::Void;
|
||||
|
||||
// clang-format off
|
||||
enum PowerProfile {
|
||||
POWER_SAVE = 0,
|
||||
BALANCED,
|
||||
HIGH_PERFORMANCE,
|
||||
MAX
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
struct Power : public IPower {
|
||||
Return<void> setInteractive(bool interactive) override;
|
||||
Return<void> powerHint(PowerHint hint, int32_t data) override;
|
||||
Return<void> setFeature(Feature feature, bool activate) override;
|
||||
Return<void> getPlatformLowPowerStats(getPlatformLowPowerStats_cb _hidl_cb) override;
|
||||
|
||||
private:
|
||||
void initialize();
|
||||
void findInputNodes();
|
||||
void setProfile(PowerProfile profile);
|
||||
void sendBoostpulse();
|
||||
void sendBoost(int duration_us);
|
||||
|
||||
bool initialized;
|
||||
bool touchkeys_blocked;
|
||||
std::string sec_touchkey;
|
||||
std::string sec_touchscreen;
|
||||
PowerProfile current_profile;
|
||||
std::vector<std::string> hispeed_freqs;
|
||||
std::vector<std::string> max_freqs;
|
||||
};
|
||||
|
||||
} // namespace implementation
|
||||
} // namespace V1_0
|
||||
} // namespace power
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
|
||||
#endif // ANDROID_HARDWARE_POWER_V1_0_POWER_H
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
service vendor.power-hal-1-0 /vendor/bin/hw/android.hardware.power@1.0-service.universal7884B
|
||||
class hal
|
||||
user system
|
||||
group system
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
<manifest version="1.0" type="device">
|
||||
<hal format="hidl">
|
||||
<name>android.hardware.power</name>
|
||||
<transport>hwbinder</transport>
|
||||
<version>1.0</version>
|
||||
<interface>
|
||||
<name>IPower</name>
|
||||
<instance>default</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
</manifest>
|
||||
|
|
@ -1,58 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2016 The CyanogenMod Project
|
||||
* Copyright (C) 2017 The LineageOS Project
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef SAMSUNG_LIGHTS_H
|
||||
#define SAMSUNG_LIGHTS_H
|
||||
|
||||
/*
|
||||
* Board specific nodes
|
||||
*
|
||||
* If your kernel exposes these controls in another place, you can either
|
||||
* symlink to the locations given here, or override this header in your
|
||||
* device tree.
|
||||
*/
|
||||
#define PANEL_BRIGHTNESS_NODE "/sys/class/backlight/panel/brightness"
|
||||
#define PANEL_MAX_BRIGHTNESS_NODE "/sys/class/backlight/panel/max_brightness"
|
||||
#define BUTTON_BRIGHTNESS_NODE "/sys/class/sec/sec_touchkey/brightness"
|
||||
#define LED_BLINK_NODE "/sys/class/sec/led/led_blink"
|
||||
#define LED_BLN_NODE "/sys/class/misc/backlightnotification/notification_led"
|
||||
|
||||
// Uncomment to enable variable button brightness
|
||||
//#define VAR_BUTTON_BRIGHTNESS 1
|
||||
|
||||
/*
|
||||
* Brightness adjustment factors
|
||||
*
|
||||
* If one of your device's LEDs is more powerful than the others, use these
|
||||
* values to equalise them. This value is in the range 0.0-1.0.
|
||||
*/
|
||||
#define LED_ADJUSTMENT_R 1.0
|
||||
#define LED_ADJUSTMENT_G 1.0
|
||||
#define LED_ADJUSTMENT_B 1.0
|
||||
|
||||
/*
|
||||
* Light brightness factors
|
||||
*
|
||||
* It might make sense for all colours to be scaled down (for example, if your
|
||||
* LED is too bright). Use these values to adjust the brightness of each
|
||||
* light. This value is within the range 0-255.
|
||||
*/
|
||||
#define LED_BRIGHTNESS_BATTERY 255
|
||||
#define LED_BRIGHTNESS_NOTIFICATION 255
|
||||
#define LED_BRIGHTNESS_ATTENTION 255
|
||||
|
||||
#endif // SAMSUNG_LIGHTS_H
|
||||
|
|
@ -1,39 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2016 The CyanogenMod Project
|
||||
* Copyright (C) 2020 The LineageOS Project
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef SAMSUNG_POWER_H
|
||||
#define SAMSUNG_POWER_H
|
||||
|
||||
/*
|
||||
* Board specific nodes
|
||||
*
|
||||
* If your kernel exposes these controls in another place, you can either
|
||||
* symlink to the locations given here, or override this header in your
|
||||
* device tree.
|
||||
*/
|
||||
|
||||
static const std::vector<std::string> cpuSysfsPaths = {
|
||||
"/sys/devices/system/cpu/cpu0",
|
||||
"/sys/devices/system/cpu/cpu6"
|
||||
};
|
||||
|
||||
static const std::vector<std::string> cpuInteractivePaths = {
|
||||
"/sys/devices/system/cpu/cpu0/cpufreq/interactive",
|
||||
"/sys/devices/system/cpu/cpu6/cpufreq/interactive"
|
||||
};
|
||||
|
||||
#endif // SAMSUNG_POWER_H
|
||||
|
|
@ -1,54 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2020 The LineageOS Project
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#define LOG_TAG "android.hardware.power@1.0-service.exynos"
|
||||
|
||||
#include <android-base/logging.h>
|
||||
#include <hidl/HidlTransportSupport.h>
|
||||
#include <utils/Errors.h>
|
||||
|
||||
#include "Power.h"
|
||||
|
||||
using android::hardware::configureRpcThreadpool;
|
||||
using android::hardware::joinRpcThreadpool;
|
||||
|
||||
using android::hardware::power::V1_0::IPower;
|
||||
using android::hardware::power::V1_0::implementation::Power;
|
||||
|
||||
using android::OK;
|
||||
using android::sp;
|
||||
using android::status_t;
|
||||
|
||||
int main() {
|
||||
sp<Power> power = new Power();
|
||||
status_t status = 0;
|
||||
|
||||
configureRpcThreadpool(1, true);
|
||||
|
||||
status = power->IPower::registerAsService();
|
||||
if (status != OK) {
|
||||
LOG(ERROR) << "Could not register service (IPower) for Power HAL";
|
||||
goto shutdown;
|
||||
}
|
||||
|
||||
LOG(INFO) << "Power HAL service is Ready.";
|
||||
joinRpcThreadpool();
|
||||
|
||||
shutdown:
|
||||
// In normal operation, we don't expect the thread pool to shutdown
|
||||
LOG(ERROR) << "Power HAL failed to join thread pool.";
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -345,13 +345,14 @@ on boot
|
|||
chown system system /sys/devices/system/cpu/cpu0/cpufreq/interactive/boost
|
||||
chmod 0660 /sys/devices/system/cpu/cpu0/cpufreq/interactive/boost
|
||||
chown system system /sys/devices/system/cpu/cpu0/cpufreq/interactive/boostpulse
|
||||
chmod 0660 /sys/devices/system/cpu/cpu0/cpufreq/interactive/boostpulse
|
||||
chown system system /sys/devices/system/cpu/cpu0/cpufreq/interactive/input_boost
|
||||
chmod 0660 /sys/devices/system/cpu/cpu0/cpufreq/interactive/input_boost
|
||||
chown system system /sys/devices/system/cpu/cpu0/cpufreq/interactive/boostpulse_duration
|
||||
chmod 0660 /sys/devices/system/cpu/cpu0/cpufreq/interactive/boostpulse_duration
|
||||
chown system system /sys/devices/system/cpu/cpu0/cpufreq/interactive/io_is_busy
|
||||
chmod 0660 /sys/devices/system/cpu/cpu0/cpufreq/interactive/io_is_busy
|
||||
|
||||
|
||||
chown system system /sys/devices/system/cpu/cpu6/cpufreq/interactive/timer_rate
|
||||
chmod 0660 /sys/devices/system/cpu/cpu6/cpufreq/interactive/timer_rate
|
||||
chown system system /sys/devices/system/cpu/cpu6/cpufreq/interactive/timer_slack
|
||||
|
|
@ -369,6 +370,7 @@ on boot
|
|||
chown system system /sys/devices/system/cpu/cpu6/cpufreq/interactive/boost
|
||||
chmod 0660 /sys/devices/system/cpu/cpu6/cpufreq/interactive/boost
|
||||
chown system system /sys/devices/system/cpu/cpu6/cpufreq/interactive/boostpulse
|
||||
chmod 0660 /sys/devices/system/cpu/cpu6/cpufreq/interactive/boostpulse
|
||||
chown system system /sys/devices/system/cpu/cpu6/cpufreq/interactive/input_boost
|
||||
chmod 0660 /sys/devices/system/cpu/cpu6/cpufreq/interactive/input_boost
|
||||
chown system system /sys/devices/system/cpu/cpu6/cpufreq/interactive/boostpulse_duration
|
||||
|
|
|
|||
|
|
@ -173,7 +173,7 @@
|
|||
/sys/devices/system/cpu/cpu* cpufreq/interactive/go_hispeed_load 0660 system system
|
||||
/sys/devices/system/cpu/cpu* cpufreq/interactive/above_hispeed_delay 0660 system system
|
||||
/sys/devices/system/cpu/cpu* cpufreq/interactive/boost 0660 system system
|
||||
/sys/devices/system/cpu/cpu* cpufreq/interactive/boostpulse 0200 system system
|
||||
/sys/devices/system/cpu/cpu* cpufreq/interactive/boostpulse 0660 system system
|
||||
/sys/devices/system/cpu/cpu* cpufreq/interactive/input_boost 0660 system system
|
||||
/sys/devices/system/cpu/cpu* cpufreq/interactive/boostpulse_duration 0660 system system
|
||||
/sys/devices/system/cpu/cpu* cpufreq/interactive/io_is_busy 0660 system system
|
||||
|
|
|
|||
|
|
@ -208,8 +208,6 @@
|
|||
/(vendor|system/vendor)/bin/hw/gpsd u:object_r:gpsd_exec:s0
|
||||
/(vendor|system/vendor)/bin/hw/macloader u:object_r:macloader_exec:s0
|
||||
/(vendor|system/vendor)/bin/mcDriverDaemon u:object_r:tee_exec:s0
|
||||
/(vendor|system/vendor)/bin/hw/android\.hardware\.power@[0-9]\.[0-9]-service\.universal7884B u:object_r:hal_power_default_exec:s0
|
||||
/(vendor|system/vendor)/bin/hw/android\.hardware\.power\.stats@[0-9]\.[0-9]-service\.mock u:object_r:hal_power_stats_default_exec:s0
|
||||
/(vendor|system/vendor)/bin/hw/android\.hardware\.vibrator@[0-9]\.[0-9]-service\.samsung u:object_r:hal_vibrator_default_exec:s0
|
||||
/(vendor|system/vendor)/bin/hw/android\.hardware\.drm@[0-9]\.[0-9]-service\.clearkey u:object_r:hal_drm_clearkey_exec:s0
|
||||
/(vendor|system/vendor)/bin/hw/android\.hardware\.drm@[0-9]\.[0-9]-service\.widevine u:object_r:hal_drm_widevine_exec:s0
|
||||
|
|
|
|||
|
|
@ -188,7 +188,10 @@ PRODUCT_COPY_FILES += \
|
|||
|
||||
# Power
|
||||
PRODUCT_PACKAGES += \
|
||||
android.hardware.power@1.0-service.universal7884B
|
||||
android.hardware.power-service.samsung-libperfmgr
|
||||
|
||||
PRODUCT_COPY_FILES += \
|
||||
$(LOCAL_PATH)/configs/power/powerhint.json:$(TARGET_COPY_OUT_VENDOR)/etc/powerhint.json
|
||||
|
||||
# Protobuf
|
||||
PRODUCT_PACKAGES += \
|
||||
|
|
@ -248,7 +251,10 @@ PRODUCT_COPY_FILES += \
|
|||
|
||||
# Soong namespaces
|
||||
PRODUCT_SOONG_NAMESPACES += \
|
||||
$(LOCAL_PATH)
|
||||
$(LOCAL_PATH) \
|
||||
hardware/google/interfaces \
|
||||
hardware/google/pixel \
|
||||
hardware/samsung/aidl/power-libperfmgr
|
||||
|
||||
# Thermal
|
||||
PRODUCT_PACKAGES += \
|
||||
|
|
|
|||
Loading…
Reference in a new issue