Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
3ef6aa6
power: Remove powerhintparser
mikeNG Jun 9, 2018
7b914ce
power: Fix a few compiler warnings
javelinanddart Dec 31, 2017
15efc90
power: Use log/log.h instead of utils/Log.h
intervigilium Mar 2, 2018
afa344f
power: Allow device specific hooks for set_interactive
hyperb1iss Mar 28, 2014
5b88ce5
power: Allow devices to write their own platform specific bits
crpalmer Apr 7, 2016
5a16830
power: override encode hint for 8909
Feb 23, 2015
ae59ec1
power: Change the Hi-Speed freq to 800Mhz for camcorder case
Mar 25, 2015
a021b8b
power: Changed the minfreq to 400Mhz for display off scenario.
Feb 23, 2015
9e6a840
power: Fix to handle min freq changes when CPU cores hotplugged.
Jul 22, 2015
6734f65
power: modify return value for display off hint in 8994
dilipgudlur Jan 24, 2015
145cc1c
power: introduce 8992-specific handling
dilipgudlur Jan 28, 2015
88d36d8
power: Enable 4+0 core config for display off cases
dilipgudlur Jun 30, 2015
2e663ce
power: Remove unused arg from power_hint_override/set_interactive_ove…
Rashed97 Dec 30, 2017
ee152ac
power: Remove mutex to hints
moetayuko Jan 18, 2018
3fcf269
power: Add -qti suffix to module name
AtlanPrime Oct 29, 2020
d4bd814
power: clang-format
AtlanPrime Oct 29, 2020
47cc6e9
power: Remove leftover support for msm-dcvs governor
mikeNG Jun 9, 2018
53294f1
power: Remove leftover support for ondemand governor
mikeNG Jun 9, 2018
a658ba6
power: Introduce is_schedutil_governor
mikeNG Sep 30, 2019
937015f
power: Use is_interactive_governor/is_schedutil_governor
intervigilium Mar 2, 2018
be621a5
power: Avoid interaction build errors
mikeNG Mar 25, 2018
9657820
power: Remove unused list utils
mikeNG Jun 9, 2018
c4d84d7
power: Simplify soc_id checks
zwliew Jul 19, 2016
97be9d0
power: Simplify display_hint_sent
zwliew Jun 26, 2016
4d59d02
power: Add back display_boost checks
zwliew Jul 19, 2016
d16a88c
power: Cache SOC ID checks for future queries
zwliew Nov 2, 2018
dc681e9
power: Drop default POWER_HINT_INTERACTION routine
moetayuko Nov 30, 2018
20e0224
power: Use ARRAY_SIZE macro where possible
zwliew Jun 26, 2016
41b6227
power: add back check for ro.vendor.extension_library
github-cygwin Apr 9, 2018
5afc008
power: msm8996: Remove dead code
mikeNG Mar 26, 2018
99be4a2
power: fix sysfs_read/sysfs_write usage
github-cygwin Apr 10, 2018
6cdad0c
power: msm8916: Code clean up
moetayuko Mar 25, 2018
a001d59
power: Compile with -Wall -Wextra -Werror
mikeNG Mar 25, 2018
bbf87da
power: Fix power hal compiler warnings
adriansm Mar 29, 2017
27e2b6e
power: Remove unused camera_hint_ref_count
mikeNG May 25, 2018
2dd6e1b
power: Rename power-8952.c to power-8937.c
mikeNG Oct 6, 2019
b69bd3d
power: msm8952: Remove HBTP support
mikeNG Oct 6, 2019
568728d
power: Find online CPU core and get scaling governor
nicorg2515 Dec 13, 2018
8d97bfb
power: Clean up and fix video encode/decode hint handling
mikeNG Oct 5, 2019
701876b
power: Clean up and fix set_interactive_override
mikeNG Oct 5, 2019
7aff9d3
power: msm8996: Support VR + Sustained performance mode
moetayuko Jan 20, 2018
5395c07
power: Add known perf hint IDs
moetayuko Jan 18, 2018
725f1bd
power: Use declared enums where possible
mikeNG Oct 15, 2019
291ce0e
power: perform_hint_action: return an error code
github-cygwin Aug 26, 2018
ccfe2c4
power: Use monotonic time for interaction boost
weivincewang Jun 8, 2016
c4a21e7
power: Handle launch and interaction hints for perf HAL platforms
BeYkeRYkt Dec 12, 2018
b2adf38
power: Handle launch and interaction hints for legacy platforms
mikeNG Oct 6, 2019
55fa64c
power: msm8916: Drop MIN_FREQ tweak for 8939
nicorg2515 Dec 13, 2018
310c040
power: Allow device specific hooks for setMode, isModeSupported
luk1337 Oct 1, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .clang-format
87 changes: 71 additions & 16 deletions Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -2,45 +2,80 @@ LOCAL_PATH := $(call my-dir)

ifeq ($(call is-vendor-board-platform,QCOM),true)

# HAL module implemenation stored in
# hw/<POWERS_HARDWARE_MODULE_ID>.<ro.hardware>.so
include $(CLEAR_VARS)

LOCAL_MODULE_RELATIVE_PATH := hw
LOCAL_SHARED_LIBRARIES := liblog libcutils libdl libxml2 libbase libutils android.hardware.power-ndk_platform libbinder_ndk
LOCAL_HEADER_LIBRARIES += libutils_headers
LOCAL_HEADER_LIBRARIES += libhardware_headers
LOCAL_SRC_FILES := power-common.c metadata-parser.c utils.c list.c hint-data.c powerhintparser.c Power.cpp main.cpp
LOCAL_C_INCLUDES := external/libxml2/include \
external/icu/icu4c/source/common

LOCAL_SHARED_LIBRARIES := \
liblog \
libcutils \
libdl \
libbase \
libutils \
android.hardware.power-ndk_platform \
libbinder_ndk

LOCAL_HEADER_LIBRARIES := \
libhardware_headers

LOCAL_SRC_FILES := \
power-common.c \
metadata-parser.c \
utils.c \
list.c \
hint-data.c \
Power.cpp \
main.cpp

LOCAL_CFLAGS += -Wall -Wextra -Werror

ifneq ($(BOARD_POWER_CUSTOM_BOARD_LIB),)
LOCAL_WHOLE_STATIC_LIBRARIES += $(BOARD_POWER_CUSTOM_BOARD_LIB)
else

# Include target-specific files.
ifeq ($(call is-board-platform-in-list, msm8974), true)
ifeq ($(call is-board-platform-in-list,msm8960), true)
LOCAL_SRC_FILES += power-8960.c
endif

ifeq ($(call is-board-platform-in-list,msm8974), true)
LOCAL_SRC_FILES += power-8974.c
endif

ifeq ($(call is-board-platform-in-list, msm8226), true)
ifeq ($(call is-board-platform-in-list,msm8226), true)
LOCAL_SRC_FILES += power-8226.c
endif

ifeq ($(call is-board-platform-in-list, msm8610), true)
ifeq ($(call is-board-platform-in-list,msm8610), true)
LOCAL_SRC_FILES += power-8610.c
endif

ifeq ($(call is-board-platform-in-list, apq8084), true)
LOCAL_SRC_FILES += power-8084.c
endif

ifeq ($(call is-board-platform-in-list, msm8994), true)
ifeq ($(call is-board-platform-in-list,msm8909), true)
LOCAL_SRC_FILES += power-8909.c
endif

ifeq ($(call is-board-platform-in-list,msm8916), true)
LOCAL_SRC_FILES += power-8916.c
endif

ifeq ($(call is-board-platform-in-list,msm8992), true)
LOCAL_SRC_FILES += power-8992.c
endif

ifeq ($(call is-board-platform-in-list,msm8994), true)
LOCAL_SRC_FILES += power-8994.c
endif

ifeq ($(call is-board-platform-in-list, msm8996), true)
ifeq ($(call is-board-platform-in-list,msm8996), true)
LOCAL_SRC_FILES += power-8996.c
endif

ifeq ($(call is-board-platform-in-list,msm8937), true)
LOCAL_SRC_FILES += power-8952.c
LOCAL_SRC_FILES += power-8937.c
endif

ifeq ($(call is-board-platform-in-list,msm8952), true)
Expand Down Expand Up @@ -75,6 +110,18 @@ ifeq ($(call is-board-platform-in-list,msmnile), true)
LOCAL_SRC_FILES += power-msmnile.c
endif

endif # End of board specific list

ifneq ($(TARGET_POWERHAL_MODE_EXT),)
LOCAL_CFLAGS += -DMODE_EXT
LOCAL_SRC_FILES += ../../../../$(TARGET_POWERHAL_MODE_EXT)
endif

ifneq ($(TARGET_POWERHAL_SET_INTERACTIVE_EXT),)
LOCAL_CFLAGS += -DSET_INTERACTIVE_EXT
LOCAL_SRC_FILES += ../../../../$(TARGET_POWERHAL_SET_INTERACTIVE_EXT)
endif

ifneq ($(TARGET_TAP_TO_WAKE_NODE),)
LOCAL_CFLAGS += -DTAP_TO_WAKE_NODE=\"$(TARGET_TAP_TO_WAKE_NODE)\"
endif
Expand All @@ -83,12 +130,20 @@ ifeq ($(TARGET_USES_INTERACTION_BOOST),true)
LOCAL_CFLAGS += -DINTERACTION_BOOST
endif

LOCAL_MODULE := android.hardware.power-service
LOCAL_INIT_RC := android.hardware.power-service.rc
ifeq ($(call is-board-platform-in-list,trinket), true)
LOCAL_MODULE := power.qcom
LOCAL_MODULE_TAGS := optional
LOCAL_VENDOR_MODULE := true
include $(BUILD_SHARED_LIBRARY)
else
LOCAL_MODULE := android.hardware.power-service-qti
LOCAL_INIT_RC := android.hardware.power-service-qti.rc
LOCAL_MODULE_TAGS := optional
LOCAL_CFLAGS += -Wno-unused-parameter -Wno-unused-variable
LOCAL_VENDOR_MODULE := true
LOCAL_VINTF_FRAGMENTS := power.xml

include $(BUILD_EXECUTABLE)
endif

endif
29 changes: 22 additions & 7 deletions Power.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#define LOG_TAG "QTI PowerHAL"
#define LOG_TAG "android.hardware.power-service-qti"

#include "Power.h"

Expand All @@ -41,9 +41,9 @@
#include <android/binder_process.h>

using ::aidl::android::hardware::power::BnPower;
using ::aidl::android::hardware::power::Boost;
using ::aidl::android::hardware::power::IPower;
using ::aidl::android::hardware::power::Mode;
using ::aidl::android::hardware::power::Boost;

using ::ndk::ScopedAStatus;
using ::ndk::SharedRefBase;
Expand All @@ -54,13 +54,23 @@ namespace hardware {
namespace power {
namespace impl {

#ifdef MODE_EXT
extern bool isDeviceSpecificModeSupported(Mode type, bool* _aidl_return);
extern bool setDeviceSpecificMode(Mode type, bool enabled);
#endif

void setInteractive(bool interactive) {
set_interactive(interactive ? 1:0);
set_interactive(interactive ? 1 : 0);
}

ndk::ScopedAStatus Power::setMode(Mode type, bool enabled) {
LOG(INFO) << "Power setMode: " << static_cast<int32_t>(type) << " to: " << enabled;
switch(type){
#ifdef MODE_EXT
if (setDeviceSpecificMode(type, enabled)) {
return ndk::ScopedAStatus::ok();
}
#endif
switch (type) {
#ifdef TAP_TO_WAKE_NODE
case Mode::DOUBLE_TAP_TO_WAKE:
::android::base::WriteStringToFile(enabled ? "1" : "0", TAP_TO_WAKE_NODE, true);
Expand Down Expand Up @@ -99,7 +109,13 @@ ndk::ScopedAStatus Power::setMode(Mode type, bool enabled) {
ndk::ScopedAStatus Power::isModeSupported(Mode type, bool* _aidl_return) {
LOG(INFO) << "Power isModeSupported: " << static_cast<int32_t>(type);

switch(type){
#ifdef MODE_EXT
if (isDeviceSpecificModeSupported(type, _aidl_return)) {
return ndk::ScopedAStatus::ok();
}
#endif

switch (type) {
#ifdef TAP_TO_WAKE_NODE
case Mode::DOUBLE_TAP_TO_WAKE:
#endif
Expand All @@ -116,8 +132,7 @@ ndk::ScopedAStatus Power::isModeSupported(Mode type, bool* _aidl_return) {
}

ndk::ScopedAStatus Power::setBoost(Boost type, int32_t durationMs) {
LOG(INFO) << "Power setBoost: " << static_cast<int32_t>(type)
<< ", duration: " << durationMs;
LOG(INFO) << "Power setBoost: " << static_cast<int32_t>(type) << ", duration: " << durationMs;
return ndk::ScopedAStatus::ok();
}

Expand Down
14 changes: 6 additions & 8 deletions Power.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,12 @@ namespace power {
namespace impl {

class Power : public BnPower {
public:
Power() : BnPower(){
power_init();
}
ndk::ScopedAStatus setMode(Mode type, bool enabled) override;
ndk::ScopedAStatus isModeSupported(Mode type, bool* _aidl_return) override;
ndk::ScopedAStatus setBoost(Boost type, int32_t durationMs) override;
ndk::ScopedAStatus isBoostSupported(Boost type, bool* _aidl_return) override;
public:
Power() : BnPower() { power_init(); }
ndk::ScopedAStatus setMode(Mode type, bool enabled) override;
ndk::ScopedAStatus isModeSupported(Mode type, bool* _aidl_return) override;
ndk::ScopedAStatus setBoost(Boost type, int32_t durationMs) override;
ndk::ScopedAStatus isBoostSupported(Boost type, bool* _aidl_return) override;
};

} // namespace impl
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
service vendor.power /vendor/bin/hw/android.hardware.power-service
service vendor.power /vendor/bin/hw/android.hardware.power-service-qti
class hal
user system
group system
13 changes: 6 additions & 7 deletions hint-data.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,20 @@
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#include <utils/Log.h>

#include "hint-data.h"

int hint_compare(struct hint_data *first_hint,
struct hint_data *other_hint) {
int hint_compare(struct hint_data* first_hint, struct hint_data* other_hint) {
if (first_hint == other_hint) {
return 0;
} else if ((first_hint && other_hint) &&
(first_hint->hint_id == other_hint->hint_id)) {
} else if ((first_hint && other_hint) && (first_hint->hint_id == other_hint->hint_id)) {
return 0;
} else {
return 1;
}
}

void hint_dump(struct hint_data *hint)
{
/*ALOGI("hint_id: %lu", hint->hint_id);*/
void hint_dump(struct hint_data* hint) {
ALOGV("hint_id: %lu", hint->hint_id);
}
49 changes: 24 additions & 25 deletions hint-data.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,33 +28,33 @@
*/

/* Default use-case hint IDs */
#define DEFAULT_VIDEO_ENCODE_HINT_ID (0x0A00)
#define DEFAULT_VIDEO_DECODE_HINT_ID (0x0B00)
#define DISPLAY_STATE_HINT_ID (0x0C00)
#define DISPLAY_STATE_HINT_ID_2 (0x0D00)
#define CAM_PREVIEW_HINT_ID (0x0E00)
#define SUSTAINED_PERF_HINT_ID (0x0F00)
#define VR_MODE_HINT_ID (0x1000)
#define VR_MODE_SUSTAINED_PERF_HINT_ID (0x1001)
#define DEFAULT_VIDEO_ENCODE_HINT_ID (0x0A00)
#define DEFAULT_VIDEO_DECODE_HINT_ID (0x0B00)
#define DISPLAY_STATE_HINT_ID (0x0C00)
#define DISPLAY_STATE_HINT_ID_2 (0x0D00)
#define CAM_PREVIEW_HINT_ID (0x0E00)
#define SUSTAINED_PERF_HINT_ID (0x0F00)
#define VR_MODE_HINT_ID (0x1000)
#define VR_MODE_SUSTAINED_PERF_HINT_ID (0x1001)

#define AOSP_DELTA (0x1200)
#define AOSP_DELTA (0x1200)

#define VSYNC_HINT AOSP_DELTA + POWER_HINT_VSYNC
#define INTERACTION_HINT AOSP_DELTA + POWER_HINT_INTERACTION
#define VIDEO_DECODE_HINT AOSP_DELTA + POWER_HINT_VIDEO_DECODE
#define VIDEO_ENCODE_HINT AOSP_DELTA + POWER_HINT_VIDEO_ENCODE
#define LOW_POWER_HINT AOSP_DELTA + POWER_HINT_LOW_POWER
#define SUSTAINED_PERF_HINT AOSP_DELTA + POWER_HINT_SUSTAINED_PERFORMANCE
#define VR_MODE_HINT AOSP_DELTA + POWER_HINT_VR_MODE
#define LAUNCH_HINT AOSP_DELTA + POWER_HINT_LAUNCH
#define DISABLE_TOUCH_HINT AOSP_DELTA + POWER_HINT_DISABLE_TOUCH
#define VSYNC_HINT AOSP_DELTA + POWER_HINT_VSYNC
#define INTERACTION_HINT AOSP_DELTA + POWER_HINT_INTERACTION
#define VIDEO_DECODE_HINT AOSP_DELTA + POWER_HINT_VIDEO_DECODE
#define VIDEO_ENCODE_HINT AOSP_DELTA + POWER_HINT_VIDEO_ENCODE
#define LOW_POWER_HINT AOSP_DELTA + POWER_HINT_LOW_POWER
#define SUSTAINED_PERF_HINT AOSP_DELTA + POWER_HINT_SUSTAINED_PERFORMANCE
#define VR_MODE_HINT AOSP_DELTA + POWER_HINT_VR_MODE
#define LAUNCH_HINT AOSP_DELTA + POWER_HINT_LAUNCH
#define DISABLE_TOUCH_HINT AOSP_DELTA + POWER_HINT_DISABLE_TOUCH

//update NUM_HINTS if hints are added to AOSP
#define NUM_HINTS (POWER_HINT_DISABLE_TOUCH +1)
// update NUM_HINTS if hints are added to AOSP
#define NUM_HINTS (POWER_HINT_DISABLE_TOUCH + 1)

#define VR_MODE_SUSTAINED_PERF_HINT (0x1301)
#define VR_MODE_SUSTAINED_PERF_HINT (0x1301)

struct hint_handles{
struct hint_handles {
int handle;
int ref_count;
};
Expand All @@ -64,6 +64,5 @@ struct hint_data {
unsigned long perflock_handle;
};

int hint_compare(struct hint_data *first_hint,
struct hint_data *other_hint);
void hint_dump(struct hint_data *hint);
int hint_compare(struct hint_data* first_hint, struct hint_data* other_hint);
void hint_dump(struct hint_data* hint);
Loading