summaryrefslogtreecommitdiffstats
path: root/power-8998.c
diff options
context:
space:
mode:
authorRashed Abdel-Tawab <rashed@linux.com>2017-11-03 12:44:16 -0700
committerRashed Abdel-Tawab <rashed@linux.com>2017-12-29 23:49:47 +0200
commit00b218507cd75ae86a1ab8d11054a87d8a8f44a3 (patch)
tree1321b7446de4ad9445250b0a4c116fe053685d2b /power-8998.c
parentff139878b0efbbf6c2e611915f48c437dad8defb (diff)
downloadandroid_hardware_qcom_power-00b218507cd75ae86a1ab8d11054a87d8a8f44a3.tar.gz
android_hardware_qcom_power-00b218507cd75ae86a1ab8d11054a87d8a8f44a3.tar.bz2
android_hardware_qcom_power-00b218507cd75ae86a1ab8d11054a87d8a8f44a3.zip
power: Convert to fully binderized 1.1 implementation
Based on commits c043816b3ceb8d8094c13f76341d4c86f09a44d1 and f3e845ce21adf40b4caa8982447b0bf99eeeee81 from AOSP device/google/wahoo. Commit 1: commit: c043816b3ceb8d8094c13f76341d4c86f09a44d1 author: Ahmed ElArabawy <arabawy@google.com> date: Wed Apr 12 09:50:07 2017 -0700 power hal: Add power HAL API 1.1 impl for Wahoo Add a full binderized implementation for Power hal Many subsystems (e.g.wifi) could be living on an independent power island (sourced from VBatt directly) and might even have their own dedicated XTAL to source their clocks. Since these SOCs are capable of autonomously operating (while the platform is in one of the sleep states), they are still drawing power from the VBatt. Hence it is critical to understand the (SOC) level low power statistics as well when the battery level changes and be able to find any correlation in event of unexpected battery drain. This commit adds the support of the Power Hal 1.1 to wahoo based devices(that includes Muskie/walleye). This includes the new api for wlan specific power stats Bug: 29339696 Test: Manual Change-Id: Iee4e38f2d9ced31f8b6a333b535fa1d9a302ec26 Signed-off-by: Ahmed ElArabawy <arabawy@google.com> Commit 2: commit: f3e845ce21adf40b4caa8982447b0bf99eeeee81 author: Ahmed ElArabawy <arabawy@google.com> aate: Wed May 24 15:28:04 2017 +0000 Re-introduce of POWER HAL API 1.1 impl for Wahoo Power HAL 1.1 support for wahoo based devices was initially introduced in CL ag/2098359 However, this caused a regression in application startup times due to a bug in passing parameters for power hints on application launch Hence, that CL was reverted in CL ag/2270791 This commit brings back the support of the Power Hal 1.1 to wahoo based devices. This includes the changes of the original CL as will as a fix for the app startup time regression The fix is similar to that in ag/1767023 (done for power HAL 1.0 default implementation) where a NULL is passed to the powerHint function when the passed data is Zero (instead of passing a pointer to the data). This enable the App Launch power hints to work properly The commit has been tested not to cause that regression Bug: 62040325 Test: Performance Tests along with other tests Change-Id: I29ce38b2de92c2b9ad878b0076288b689695b8a0 Signed-off-by: Ahmed ElArabawy <arabawy@google.com>
Diffstat (limited to 'power-8998.c')
-rw-r--r--power-8998.c14
1 files changed, 2 insertions, 12 deletions
diff --git a/power-8998.c b/power-8998.c
index cf806c9..6dde050 100644
--- a/power-8998.c
+++ b/power-8998.c
@@ -69,7 +69,6 @@ perf_mode_t perf_modes[NUM_PERF_MODES] = { { SUSTAINED_MODE, SUSTAINED_PERF_HINT
{ VR_MODE, VR_MODE_HINT },
{ VR_SUSTAINED_MODE, VR_MODE_SUSTAINED_PERF_HINT } };
-static pthread_mutex_t perf_mode_switch_lock = PTHREAD_MUTEX_INITIALIZER;
static int current_mode = NORMAL_MODE;
static inline int get_perfd_hint_id(perf_mode_type_t type) {
@@ -110,20 +109,16 @@ static int switch_mode(perf_mode_type_t mode) {
static int process_perf_hint(void *data, perf_mode_type_t mode) {
- pthread_mutex_lock(&perf_mode_switch_lock);
-
// enable
if (data){
ALOGI("Enable request for mode: 0x%x", mode);
// check if mode is current mode
if ( current_mode & mode ) {
- pthread_mutex_unlock(&perf_mode_switch_lock);
ALOGD("Mode 0x%x already enabled", mode);
return HINT_HANDLED;
}
// enable requested mode
if ( 0 != switch_mode(current_mode | mode)) {
- pthread_mutex_unlock(&perf_mode_switch_lock);
ALOGE("Couldn't enable mode 0x%x", mode);
return HINT_NONE;
}
@@ -134,13 +129,11 @@ static int process_perf_hint(void *data, perf_mode_type_t mode) {
ALOGI("Disable request for mode: 0x%x", mode);
// check if mode is enabled
if ( !(current_mode & mode) ) {
- pthread_mutex_unlock(&perf_mode_switch_lock);
ALOGD("Mode 0x%x already disabled", mode);
return HINT_HANDLED;
}
//disable requested mode
if ( 0 != switch_mode(current_mode & ~mode)) {
- pthread_mutex_unlock(&perf_mode_switch_lock);
ALOGE("Couldn't disable mode 0x%x", mode);
return HINT_NONE;
}
@@ -148,7 +141,6 @@ static int process_perf_hint(void *data, perf_mode_type_t mode) {
ALOGI("Current mode is 0x%x", current_mode);
}
- pthread_mutex_unlock(&perf_mode_switch_lock);
return HINT_HANDLED;
}
@@ -193,7 +185,7 @@ static int process_video_encode_hint(void *metadata)
return HINT_NONE;
}
-int power_hint_override(struct power_module *UNUSED(module), power_hint_t hint, void *data)
+int power_hint_override(power_hint_t hint, void *data)
{
int ret_val = HINT_NONE;
switch(hint) {
@@ -207,11 +199,9 @@ int power_hint_override(struct power_module *UNUSED(module), power_hint_t hint,
ret_val = process_perf_hint(data, VR_MODE);
break;
case POWER_HINT_INTERACTION:
- pthread_mutex_lock(&perf_mode_switch_lock);
if (current_mode != NORMAL_MODE) {
ret_val = HINT_HANDLED;
}
- pthread_mutex_unlock(&perf_mode_switch_lock);
break;
default:
break;
@@ -219,7 +209,7 @@ int power_hint_override(struct power_module *UNUSED(module), power_hint_t hint,
return ret_val;
}
-int set_interactive_override(struct power_module *UNUSED(module), int UNUSED(on))
+int set_interactive_override(int UNUSED(on))
{
return HINT_HANDLED; /* Don't excecute this code path, not in use */
}