power: Restore SPM compatibility between the implementations

We need to move our SPM implementation into the switch
statement to allow it to co-exist with QC's SPM implementation
which is used for msm8998 only as of now.

Change-Id: I419afefe714d6b464824be397bbe949b6c8a6470
Signed-off-by: Alex Naidis <alex.naidis@linux.com>
This commit is contained in:
Alex Naidis 2018-05-17 00:56:23 +02:00
parent cabbaa5aff
commit 390170a7d5
1 changed files with 12 additions and 14 deletions

View File

@ -212,22 +212,13 @@ int __attribute__ ((weak)) power_hint_override(struct power_module *module, powe
* for Sustained performance mode. * for Sustained performance mode.
*/ */
void __attribute__ ((weak)) toggle_sustained_performance(bool request_enable) void __attribute__ ((weak)) toggle_sustained_performance(bool request_enable)
{} {
ALOGI("Sustained perf power hint not handled in power_hint_override");
}
static void power_hint(struct power_module *module, power_hint_t hint, static void power_hint(struct power_module *module, power_hint_t hint,
void *data) void *data)
{ {
/* Sustained performance mode */
if (hint == POWER_HINT_SUSTAINED_PERFORMANCE) {
pthread_mutex_lock(&sustained_performance_toggle_lock);
/* Execute the change in SPM mode */
toggle_sustained_performance(data);
sustained_performance_mode = data;
pthread_mutex_unlock(&sustained_performance_toggle_lock);
}
/* Check if this hint has been overridden. */ /* Check if this hint has been overridden. */
if (power_hint_override(module, hint, data) == HINT_HANDLED) { if (power_hint_override(module, hint, data) == HINT_HANDLED) {
/* The power_hint has been handled. We can skip the rest. */ /* The power_hint has been handled. We can skip the rest. */
@ -237,9 +228,16 @@ static void power_hint(struct power_module *module, power_hint_t hint,
switch(hint) { switch(hint) {
case POWER_HINT_VSYNC: case POWER_HINT_VSYNC:
break; break;
case POWER_HINT_SUSTAINED_PERFORMANCE: case POWER_HINT_SUSTAINED_PERFORMANCE: {
ALOGI("Sustained perf power hint not handled in power_hint_override"); pthread_mutex_lock(&sustained_performance_toggle_lock);
/* Execute the change in SPM mode */
toggle_sustained_performance(data);
sustained_performance_mode = data;
pthread_mutex_unlock(&sustained_performance_toggle_lock);
break; break;
}
case POWER_HINT_VR_MODE: case POWER_HINT_VR_MODE:
ALOGI("VR mode power hint not handled in power_hint_override"); ALOGI("VR mode power hint not handled in power_hint_override");
break; break;