From d39ec577a6b154ddc1643728e54a093f3e667b80 Mon Sep 17 00:00:00 2001 From: Ananth Raghavan Subramanian Date: Sat, 8 Sep 2018 19:47:41 -0700 Subject: power: Introducing PowerHAL binderized service Moving from the default implementation to a binderized service with no wrapping. Now using 1.2 implementation of the IPower interface. Change-Id: Ibefd916544f51545e6889684a051b2ecc5867fe2 --- Android.mk | 9 +- Power.cpp | 102 ++++++++++++++++++ Power.h | 74 +++++++++++++ android.hardware.power@1.2-service.rc | 4 + power-common.c | 135 +++++++++++++++++++++++ power-common.h | 21 +++- power-msmnile.c | 6 +- power.c | 197 ---------------------------------- service.cpp | 81 ++++++++++++++ 9 files changed, 424 insertions(+), 205 deletions(-) create mode 100644 Power.cpp create mode 100644 Power.h create mode 100644 android.hardware.power@1.2-service.rc create mode 100644 power-common.c delete mode 100644 power.c create mode 100644 service.cpp diff --git a/Android.mk b/Android.mk index adeb75c..877187d 100644 --- a/Android.mk +++ b/Android.mk @@ -7,10 +7,10 @@ ifeq ($(call is-vendor-board-platform,QCOM),true) include $(CLEAR_VARS) LOCAL_MODULE_RELATIVE_PATH := hw -LOCAL_SHARED_LIBRARIES := liblog libcutils libdl libxml2 +LOCAL_SHARED_LIBRARIES := liblog libcutils libdl libxml2 libbase libhidlbase libhidltransport libutils android.hardware.power@1.2 LOCAL_HEADER_LIBRARIES += libutils_headers LOCAL_HEADER_LIBRARIES += libhardware_headers -LOCAL_SRC_FILES := power.c metadata-parser.c utils.c list.c hint-data.c powerhintparser.c +LOCAL_SRC_FILES := power-common.c metadata-parser.c utils.c list.c hint-data.c powerhintparser.c service.cpp Power.cpp LOCAL_C_INCLUDES := external/libxml2/include \ external/icu/icu4c/source/common @@ -79,10 +79,11 @@ ifeq ($(TARGET_USES_INTERACTION_BOOST),true) LOCAL_CFLAGS += -DINTERACTION_BOOST endif -LOCAL_MODULE := power.qcom +LOCAL_MODULE := android.hardware.power@1.2-service +LOCAL_INIT_RC := android.hardware.power@1.2-service.rc LOCAL_MODULE_TAGS := optional LOCAL_CFLAGS += -Wno-unused-parameter -Wno-unused-variable LOCAL_VENDOR_MODULE := true -include $(BUILD_SHARED_LIBRARY) +include $(BUILD_EXECUTABLE) endif diff --git a/Power.cpp b/Power.cpp new file mode 100644 index 0000000..81c0a85 --- /dev/null +++ b/Power.cpp @@ -0,0 +1,102 @@ +/* + * Copyright (c) 2019, The Linux Foundation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#define LOG_TAG "QTI PowerHAL" + +#include +#include +#include "Power.h" +#include "power-common.h" + +namespace android { +namespace hardware { +namespace power { +namespace V1_2 { +namespace implementation { + +using ::android::hardware::power::V1_0::Feature; +using ::android::hardware::power::V1_0::PowerHint; +using ::android::hardware::power::V1_0::PowerStatePlatformSleepState; +using ::android::hardware::power::V1_0::Status; +using ::android::hardware::power::V1_1::PowerStateSubsystem; +using ::android::hardware::hidl_vec; +using ::android::hardware::Return; +using ::android::hardware::Void; + +Power::Power() { + power_init(); +} + +Return Power::setInteractive(bool interactive) { + set_interactive(interactive ? 1:0); + return Void(); +} + +Return Power::powerHint(PowerHint_1_0 hint, int32_t data) { + + power_hint(static_cast(hint), data ? (&data) : NULL); + return Void(); +} + +Return Power::setFeature(Feature feature, bool activate) { + return Void(); +} + +Return Power::getPlatformLowPowerStats(getPlatformLowPowerStats_cb _hidl_cb) { + + hidl_vec states; + states.resize(0); + + _hidl_cb(states, Status::SUCCESS); + return Void(); +} + +Return Power::getSubsystemLowPowerStats(getSubsystemLowPowerStats_cb _hidl_cb) { + + hidl_vec subsystems; + + _hidl_cb(subsystems, Status::SUCCESS); + return Void(); +} + +Return Power::powerHintAsync(PowerHint_1_0 hint, int32_t data) { + + return powerHint(hint, data); +} + +Return Power::powerHintAsync_1_2(PowerHint_1_2 hint, int32_t data) { + + return powerHint(static_cast (hint), data); +} + +} // namespace implementation +} // namespace V1_2 +} // namespace power +} // namespace hardware +} // namespace android diff --git a/Power.h b/Power.h new file mode 100644 index 0000000..a787590 --- /dev/null +++ b/Power.h @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2019, The Linux Foundation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ANDROID_HARDWARE_POWER_V1_2_POWER_H +#define ANDROID_HARDWARE_POWER_V1_2_POWER_H + +#include +#include +#include +#include + +namespace android { +namespace hardware { +namespace power { +namespace V1_2 { +namespace implementation { + +using ::android::hardware::power::V1_0::Feature; +using PowerHint_1_0 = ::android::hardware::power::V1_0::PowerHint; +using PowerHint_1_2 = ::android::hardware::power::V1_2::PowerHint; +using ::android::hardware::power::V1_2::IPower; +using ::android::hardware::Return; +using ::android::hardware::Void; + +struct Power : public IPower { + // Methods from ::android::hardware::power::V1_0::IPower follow. + + Power(); + + Return setInteractive(bool interactive) override; + Return powerHint(PowerHint_1_0 hint, int32_t data) override; + Return setFeature(Feature feature, bool activate) override; + Return getPlatformLowPowerStats(getPlatformLowPowerStats_cb _hidl_cb) override; + + // Methods from ::android::hardware::power::V1_1::IPower follow + Return getSubsystemLowPowerStats(getSubsystemLowPowerStats_cb _hidl_cb) override; + Return powerHintAsync(PowerHint_1_0 hint, int32_t data) override; + // Methods from ::android::hardware::power::V1_2::IPower follow + Return powerHintAsync_1_2(PowerHint_1_2 hint, int32_t data) override; +}; + +} // namespace implementation +} // namespace V1_2 +} // namespace power +} // namespace hardware +} // namespace android + +#endif // ANDROID_HARDWARE_POWER_V1_2_POWER_H diff --git a/android.hardware.power@1.2-service.rc b/android.hardware.power@1.2-service.rc new file mode 100644 index 0000000..8a1c347 --- /dev/null +++ b/android.hardware.power@1.2-service.rc @@ -0,0 +1,4 @@ +service vendor.power-hal-1-2 /vendor/bin/hw/android.hardware.power@1.2-service + class hal + user system + group system diff --git a/power-common.c b/power-common.c new file mode 100644 index 0000000..0101bea --- /dev/null +++ b/power-common.c @@ -0,0 +1,135 @@ +/* + * Copyright (c) 2012-2019, The Linux Foundation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#define LOG_NIDEBUG 0 + +#include +#include +#include +#include +#include +#include +#include +#include + +#define LOG_TAG "QTI PowerHAL" +#include +#include +#include + +#include "utils.h" +#include "hint-data.h" +#include "performance.h" +#include "power-common.h" + +static struct hint_handles handles[NUM_HINTS]; + +void power_init() +{ + ALOGI("Initing"); + + for (int i=0; i 0) + handles[hint].ref_count++; + } + else + if (handles[hint].handle > 0) + if (--handles[hint].ref_count == 0) { + release_request(handles[hint].handle); + handles[hint].handle = 0; + } + else + ALOGE("Lock for hint: %X was not acquired, cannot be released", hint); + break; + } +} + +int __attribute__ ((weak)) set_interactive_override(int on) +{ + return HINT_NONE; +} + +void set_interactive(int on) +{ + if (!on) { + /* Send Display OFF hint to perf HAL */ + perf_hint_enable(VENDOR_HINT_DISPLAY_OFF, 0); + } else { + /* Send Display ON hint to perf HAL */ + perf_hint_enable(VENDOR_HINT_DISPLAY_ON, 0); + } + + if (set_interactive_override(on) == HINT_HANDLED) { + return; + } + + ALOGI("Got set_interactive hint"); +} diff --git a/power-common.h b/power-common.h index e374e46..697302a 100644 --- a/power-common.h +++ b/power-common.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018 The Linux Foundation. All rights reserved. + * Copyright (c) 2013, 2018-2019 The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -26,6 +26,13 @@ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#ifndef __POWER_COMMON_H__ +#define __POWER_COMMON_H__ + +#ifdef __cplusplus +extern "C" { +#endif + #define NODE_MAX (64) #define SCALING_GOVERNOR_PATH "/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor" @@ -42,9 +49,21 @@ #define HINT_HANDLED (0) #define HINT_NONE (-1) +#include + enum CPU_GOV_CHECK { CPU0 = 0, CPU1 = 1, CPU2 = 2, CPU3 = 3 }; + +void power_init(void); +void power_hint(power_hint_t hint, void *data); +void set_interactive(int on); + +#ifdef __cplusplus +} +#endif + +#endif //__POWER_COMMON_H___ diff --git a/power-msmnile.c b/power-msmnile.c index 27a8d25..7000079 100644 --- a/power-msmnile.c +++ b/power-msmnile.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, The Linux Foundation. All rights reserved. + * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -48,7 +48,7 @@ static int display_fd; #define SYS_DISPLAY_PWR "/sys/kernel/hbtp/display_pwr" -int set_interactive_override(struct power_module *module, int on) +int set_interactive_override(int on) { static const char *display_on = "1"; static const char *display_off = "0"; @@ -94,7 +94,7 @@ int set_interactive_override(struct power_module *module, int on) void interaction(int duration, int num_args, int opt_list[]); -int power_hint_override(struct power_module *module, power_hint_t hint, void *data) +int power_hint_override(power_hint_t hint, void *data) { int ret_val = HINT_NONE; switch(hint) { diff --git a/power.c b/power.c deleted file mode 100644 index 2206fa9..0000000 --- a/power.c +++ /dev/null @@ -1,197 +0,0 @@ -/* - * Copyright (c) 2012-2018, The Linux Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of The Linux Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#define LOG_NIDEBUG 0 - -#include -#include -#include -#include -#include -#include -#include -#include - -#define LOG_TAG "QTI PowerHAL" -#include -#include -#include - -#include "utils.h" -#include "hint-data.h" -#include "performance.h" -#include "power-common.h" - -static struct hint_handles handles[NUM_HINTS]; - -static int power_device_open(const hw_module_t* module, const char* name, - hw_device_t** device); - -static struct hw_module_methods_t power_module_methods = { - .open = power_device_open, -}; - -static void power_init(struct power_module *module) -{ - ALOGI("Initing"); - - for (int i=0; i 0) - handles[hint].ref_count++; - } - else - if (handles[hint].handle > 0) - if (--handles[hint].ref_count == 0) { - release_request(handles[hint].handle); - handles[hint].handle = 0; - } - else - ALOGE("Lock for hint: %X was not acquired, cannot be released", hint); - break; - } -} - -int __attribute__ ((weak)) set_interactive_override(struct power_module *module, int on) -{ - return HINT_NONE; -} - -void set_interactive(struct power_module *module, int on) -{ - if (!on) { - /* Send Display OFF hint to perf HAL */ - perf_hint_enable(VENDOR_HINT_DISPLAY_OFF, 0); - } else { - /* Send Display ON hint to perf HAL */ - perf_hint_enable(VENDOR_HINT_DISPLAY_ON, 0); - } - - if (set_interactive_override(module, on) == HINT_HANDLED) { - return; - } - - ALOGI("Got set_interactive hint"); -} - -static int power_device_open(const hw_module_t* module, const char* name, - hw_device_t** device) -{ - int status = -EINVAL; - if (module && name && device) { - if (!strcmp(name, POWER_HARDWARE_MODULE_ID)) { - power_module_t *dev = (power_module_t *)malloc(sizeof(*dev)); - - if(dev) { - memset(dev, 0, sizeof(*dev)); - - if(dev) { - /* initialize the fields */ - dev->common.module_api_version = POWER_MODULE_API_VERSION_0_2; - dev->common.tag = HARDWARE_DEVICE_TAG; - dev->init = power_init; - dev->powerHint = power_hint; - dev->setInteractive = set_interactive; - /* At the moment we support 0.2 APIs */ - dev->setFeature = NULL, - dev->get_number_of_platform_modes = NULL, - dev->get_platform_low_power_stats = NULL, - dev->get_voter_list = NULL, - *device = (hw_device_t*)dev; - status = 0; - } else { - status = -ENOMEM; - } - } - else { - status = -ENOMEM; - } - } - } - - return status; -} - -struct power_module HAL_MODULE_INFO_SYM = { - .common = { - .tag = HARDWARE_MODULE_TAG, - .module_api_version = POWER_MODULE_API_VERSION_0_2, - .hal_api_version = HARDWARE_HAL_API_VERSION, - .id = POWER_HARDWARE_MODULE_ID, - .name = "QTI Power HAL", - .author = "QTI", - .methods = &power_module_methods, - }, - - .init = power_init, - .powerHint = power_hint, - .setInteractive = set_interactive, -}; diff --git a/service.cpp b/service.cpp new file mode 100644 index 0000000..902c661 --- /dev/null +++ b/service.cpp @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2019, The Linux Foundation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#define LOG_TAG "android.hardware.power@1.2-service" + +#include +#include +#include +#include "Power.h" + +using android::sp; +using android::status_t; +using android::OK; + +// libhwbinder: +using android::hardware::configureRpcThreadpool; +using android::hardware::joinRpcThreadpool; + +// Generated HIDL files +using android::hardware::power::V1_2::IPower; +using android::hardware::power::V1_2::implementation::Power; + +int main() { + + status_t status; + android::sp service = nullptr; + + ALOGI("Power HAL Service 1.2 is starting."); + + service = new Power(); + if (service == nullptr) { + ALOGE("Can not create an instance of Power HAL interface."); + + goto shutdown; + } + + configureRpcThreadpool(1, true /*callerWillJoin*/); + + status = service->registerAsService(); + if (status != OK) { + ALOGE("Could not register service for Power HAL(%d).", status); + goto shutdown; + } + + ALOGI("Power Service is ready"); + joinRpcThreadpool(); + //Should not pass this line + +shutdown: + // In normal operation, we don't expect the thread pool to exit + + ALOGE("Power Service is shutting down"); + return 1; +} + -- cgit v1.2.3 From 91ecb1518676e515c6ebbb3d87a8a99b44ffc07d Mon Sep 17 00:00:00 2001 From: Ananth Raghavan Subramanian Date: Wed, 1 May 2019 13:50:53 -0700 Subject: power: Add config and makefiles Added product and board makefiles. Moved powerhint XMLs to this project. Change-Id: I3d36f29f69f09166f84d2e42a6480cb590b04d2d --- config/kona/powerhint.xml | 54 +++++++++ config/msmnile/powerhint.xml | 274 +++++++++++++++++++++++++++++++++++++++++++ power-vendor-board.mk | 1 + power-vendor-product.mk | 10 ++ 4 files changed, 339 insertions(+) create mode 100644 config/kona/powerhint.xml create mode 100644 config/msmnile/powerhint.xml create mode 100644 power-vendor-board.mk create mode 100644 power-vendor-product.mk diff --git a/config/kona/powerhint.xml b/config/kona/powerhint.xml new file mode 100644 index 0000000..fa338f5 --- /dev/null +++ b/config/kona/powerhint.xml @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + diff --git a/config/msmnile/powerhint.xml b/config/msmnile/powerhint.xml new file mode 100644 index 0000000..71e9db1 --- /dev/null +++ b/config/msmnile/powerhint.xml @@ -0,0 +1,274 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/power-vendor-board.mk b/power-vendor-board.mk new file mode 100644 index 0000000..23d97aa --- /dev/null +++ b/power-vendor-board.mk @@ -0,0 +1 @@ +TARGET_USES_NON_LEGACY_POWERHAL := true diff --git a/power-vendor-product.mk b/power-vendor-product.mk new file mode 100644 index 0000000..c0dfbc5 --- /dev/null +++ b/power-vendor-product.mk @@ -0,0 +1,10 @@ +#Power product definitions +PRODUCT_PACKAGES += android.hardware.power@1.2-impl +PRODUCT_PACKAGES += android.hardware.power@1.2-service + +#Powerhint File +ifeq ($(TARGET_BOARD_PLATFORM),msmnile) +PRODUCT_COPY_FILES += vendor/qcom/opensource/power/config/msmnile/powerhint.xml:$(TARGET_COPY_OUT_VENDOR)/etc/powerhint.xml +else ifeq ($(TARGET_BOARD_PLATFORM),kona) +PRODUCT_COPY_FILES += vendor/qcom/opensource/power/config/kona/powerhint.xml:$(TARGET_COPY_OUT_VENDOR)/etc/powerhint.xml +endif -- cgit v1.2.3 From 2731f95e03f6e7d3a6448560bf1e4c300c9f5cdd Mon Sep 17 00:00:00 2001 From: Ananth Raghavan Subramanian Date: Tue, 28 May 2019 11:40:44 -0700 Subject: power: Modify definitions of Perf client calls Now conforms to the exact definition in the shared perf library Change-Id: I6f92140b42800072283c2f3a52e6814fc0f1d5d2 --- utils.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/utils.c b/utils.c index 66c45e0..f7f2251 100644 --- a/utils.c +++ b/utils.c @@ -52,11 +52,12 @@ char scaling_gov_path[4][80] ={ #define PERF_HAL_PATH "libqti-perfd-client.so" static void *qcopt_handle; -static int (*perf_lock_acq)(unsigned long handle, int duration, +static int (*perf_lock_acq)(int handle, int duration, int list[], int numArgs); -static int (*perf_lock_rel)(unsigned long handle); -static int (*perf_hint)(int, char *, int, int); +static int (*perf_lock_rel)(int handle); +static int (*perf_hint)(int, const char *, int, int); static struct list_node active_hint_list_head; +const char *pkg = "QTI PowerHAL"; static void *get_qcopt_handle() { @@ -253,7 +254,7 @@ int perf_hint_enable(int hint_id , int duration) if (qcopt_handle) { if (perf_hint) { - lock_handle = perf_hint(hint_id, NULL, duration, -1); + lock_handle = perf_hint(hint_id, pkg, duration, -1); if (lock_handle == -1) ALOGE("Failed to acquire lock for hint_id: %X.", hint_id); } -- cgit v1.2.3