common: Change minfreq to 499.2Mhz during display off scenario.
1.Changes to set CPU0 min freq for 8952 target as below:. Display off case : set to 499.2Mhz Display on case : set to 960Mhz. 2.Changes to set CPU0 and CPU4 interactive timer rate values Display off cases : Set cpu0 and cpu4 to 50ms. Change-Id: I833da462ab4db033a33051ed9499ea75b13f5d9f
This commit is contained in:
parent
662bd317c2
commit
82739ef25a
|
@ -35,6 +35,10 @@ ifeq ($(call is-board-platform-in-list, msm8996), true)
|
|||
LOCAL_SRC_FILES += power-8996.c
|
||||
endif
|
||||
|
||||
ifeq ($(call is-board-platform-in-list,msm8952), true)
|
||||
LOCAL_SRC_FILES += power-8952.c
|
||||
endif
|
||||
|
||||
ifeq ($(TARGET_USES_INTERACTION_BOOST),true)
|
||||
LOCAL_CFLAGS += -DINTERACTION_BOOST
|
||||
endif
|
||||
|
|
|
@ -136,6 +136,26 @@ enum INTERACTIVE_TIMER_RATE_LVL {
|
|||
TR_MS_20 = 0xEFD,
|
||||
};
|
||||
|
||||
/* This timer rate applicable to cpu0
|
||||
across 8939/8952 series chipset */
|
||||
enum INTERACTIVE_TIMER_RATE_LVL_CPU0_8939 {
|
||||
TR_MS_CPU0_500 = 0x30CD,
|
||||
TR_MS_CPU0_100 = 0x30F5,
|
||||
TR_MS_CPU0_50 = 0x30FA,
|
||||
TR_MS_CPU0_30 = 0x30FC,
|
||||
TR_MS_CPU0_20 = 0x30FD,
|
||||
};
|
||||
|
||||
/* This timer rate applicable to cpu4
|
||||
across 8939/8952 series chipset */
|
||||
enum INTERACTIVE_TIMER_RATE_LVL_CPU4_8939 {
|
||||
TR_MS_CPU4_500 = 0x3BCD,
|
||||
TR_MS_CPU4_100 = 0x3BF5,
|
||||
TR_MS_CPU4_50 = 0x3BFA,
|
||||
TR_MS_CPU4_30 = 0x3BFC,
|
||||
TR_MS_CPU4_20 = 0x3BFD,
|
||||
};
|
||||
|
||||
enum INTERACTIVE_HISPEED_FREQ_LVL {
|
||||
HS_FREQ_1026 = 0xF0A,
|
||||
};
|
||||
|
|
|
@ -0,0 +1,139 @@
|
|||
/*
|
||||
* Copyright (c) 2015, 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 <errno.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <dlfcn.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define LOG_TAG "QTI PowerHAL"
|
||||
#include <utils/Log.h>
|
||||
#include <hardware/hardware.h>
|
||||
#include <hardware/power.h>
|
||||
|
||||
#include "utils.h"
|
||||
#include "metadata-defs.h"
|
||||
#include "hint-data.h"
|
||||
#include "performance.h"
|
||||
#include "power-common.h"
|
||||
|
||||
#define MIN_FREQ_CPU0_DISP_OFF 499200
|
||||
#define MIN_FREQ_CPU0_DISP_ON 960000
|
||||
|
||||
static int saved_interactive_mode = -1;
|
||||
static int slack_node_rw_failed = 0;
|
||||
static int display_hint_sent;
|
||||
|
||||
|
||||
int power_hint_override(struct power_module *module, power_hint_t hint,
|
||||
void *data)
|
||||
{
|
||||
|
||||
switch(hint) {
|
||||
case POWER_HINT_VSYNC:
|
||||
break;
|
||||
case POWER_HINT_INTERACTION:
|
||||
{
|
||||
int resources[] = {0x702, 0x20F, 0x30F};
|
||||
int duration = 3000;
|
||||
|
||||
interaction(duration, sizeof(resources)/sizeof(resources[0]), resources);
|
||||
}
|
||||
return HINT_HANDLED;
|
||||
case POWER_HINT_VIDEO_ENCODE: /* Do nothing for encode case */
|
||||
return HINT_HANDLED;
|
||||
case POWER_HINT_VIDEO_DECODE: /*Do nothing for encode case */
|
||||
return HINT_HANDLED;
|
||||
}
|
||||
return HINT_NONE;
|
||||
}
|
||||
|
||||
int set_interactive_override(struct power_module *module, int on)
|
||||
{
|
||||
char governor[80];
|
||||
char tmp_str[NODE_MAX];
|
||||
struct video_encode_metadata_t video_encode_metadata;
|
||||
int rc;
|
||||
|
||||
ALOGI("Got set_interactive hint");
|
||||
|
||||
if (get_scaling_governor(governor, sizeof(governor)) == -1) {
|
||||
ALOGE("Can't obtain scaling governor.");
|
||||
|
||||
return HINT_HANDLED;
|
||||
}
|
||||
|
||||
if (!on) {
|
||||
/* Display off. */
|
||||
if ((strncmp(governor, INTERACTIVE_GOVERNOR, strlen(INTERACTIVE_GOVERNOR)) == 0) &&
|
||||
(strlen(governor) == strlen(INTERACTIVE_GOVERNOR))) {
|
||||
int resource_values[] = {TR_MS_CPU0_50,TR_MS_CPU4_50, THREAD_MIGRATION_SYNC_OFF};
|
||||
|
||||
/* Set CPU0 MIN FREQ to 499.2Mhz avoid extra peak power
|
||||
impact in volume key press */
|
||||
snprintf(tmp_str, NODE_MAX, "%d", MIN_FREQ_CPU0_DISP_OFF);
|
||||
if (sysfs_write(SCALING_MIN_FREQ, tmp_str) != 0) {
|
||||
if(!slack_node_rw_failed) {
|
||||
ALOGE("Failed to write to %s",SCALING_MIN_FREQ );
|
||||
}
|
||||
rc = 1;
|
||||
}
|
||||
if (!display_hint_sent) {
|
||||
perform_hint_action(DISPLAY_STATE_HINT_ID,
|
||||
resource_values, sizeof(resource_values)/sizeof(resource_values[0]));
|
||||
display_hint_sent = 1;
|
||||
}
|
||||
} /* Perf time rate set for CORE0,CORE4 8952 target*/
|
||||
|
||||
} else {
|
||||
/* Display on. */
|
||||
if ((strncmp(governor, INTERACTIVE_GOVERNOR, strlen(INTERACTIVE_GOVERNOR)) == 0) &&
|
||||
(strlen(governor) == strlen(INTERACTIVE_GOVERNOR))) {
|
||||
|
||||
/* Recovering MIN_FREQ in display ON case */
|
||||
snprintf(tmp_str, NODE_MAX, "%d", MIN_FREQ_CPU0_DISP_ON);
|
||||
if (sysfs_write(SCALING_MIN_FREQ, tmp_str) != 0) {
|
||||
if(!slack_node_rw_failed) {
|
||||
ALOGE("Failed to write to %s",SCALING_MIN_FREQ );
|
||||
}
|
||||
rc = 1;
|
||||
}
|
||||
undo_hint_action(DISPLAY_STATE_HINT_ID);
|
||||
display_hint_sent = 0;
|
||||
}
|
||||
}
|
||||
saved_interactive_mode = !!on;
|
||||
return HINT_HANDLED;
|
||||
}
|
||||
|
Loading…
Reference in New Issue