Revert "driver: lpm-workarounds: disable/enable L2 low power modes"
This reverts 'commit 9890d1939491 ("driver: lpm-workarounds: disable/enable L2 low power modes")' as power regression seen with disabling L2 low power modes. Change-Id: I2a4fea67a62065c64bfa7ec3af8a20a18480dd13 Signed-off-by: Maulik Shah <mkshah@codeaurora.org>
This commit is contained in:
parent
7587ddd6e4
commit
f0104a2aa0
|
@ -202,44 +202,6 @@ static int lpm_cpu_callback(struct notifier_block *cpu_nb,
|
|||
return NOTIFY_OK;
|
||||
}
|
||||
|
||||
void lpm_cluster_mode_disable(void)
|
||||
{
|
||||
struct list_head *list;
|
||||
int i;
|
||||
|
||||
list_for_each(list, &lpm_root_node->child) {
|
||||
struct lpm_cluster *n;
|
||||
|
||||
n = list_entry(list, typeof(*n), list);
|
||||
if (!n)
|
||||
return;
|
||||
for (i = 0; i < n->nlevels; i++) {
|
||||
struct lpm_level_avail *l = &n->levels[i].available;
|
||||
|
||||
l->idle_enabled = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void lpm_cluster_mode_enable(void)
|
||||
{
|
||||
struct list_head *list;
|
||||
int i;
|
||||
|
||||
list_for_each(list, &lpm_root_node->child) {
|
||||
struct lpm_cluster *n;
|
||||
|
||||
n = list_entry(list, typeof(*n), list);
|
||||
if (!n)
|
||||
return;
|
||||
for (i = 0; i < n->nlevels; i++) {
|
||||
struct lpm_level_avail *l = &n->levels[i].available;
|
||||
|
||||
l->idle_enabled = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static enum hrtimer_restart lpm_hrtimer_cb(struct hrtimer *h)
|
||||
{
|
||||
return HRTIMER_NORESTART;
|
||||
|
|
|
@ -115,8 +115,6 @@ bool lpm_cpu_mode_allow(unsigned int cpu,
|
|||
unsigned int mode, bool from_idle);
|
||||
bool lpm_cluster_mode_allow(struct lpm_cluster *cluster,
|
||||
unsigned int mode, bool from_idle);
|
||||
void lpm_cluster_mode_enable(void);
|
||||
void lpm_cluster_mode_disable(void);
|
||||
|
||||
extern struct lpm_cluster *lpm_root_node;
|
||||
|
||||
|
|
|
@ -23,16 +23,11 @@
|
|||
#include <linux/regulator/rpm-smd-regulator.h>
|
||||
#include <linux/msm_thermal.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/power_supply.h>
|
||||
#include <linux/cpu.h>
|
||||
#include <soc/qcom/scm.h>
|
||||
#include "lpm-levels.h"
|
||||
|
||||
#define L2_HS_STS_SET 0x200
|
||||
#define BATT_LOW_THRESHOLD 15
|
||||
|
||||
static struct power_supply lpm_wa_psy;
|
||||
static const char name[] = "lpm";
|
||||
static struct work_struct lpm_wa_work;
|
||||
static struct workqueue_struct *lpm_wa_wq;
|
||||
static bool skip_l2_spm;
|
||||
|
@ -48,20 +43,7 @@ cpumask_t l1_l2_offline_mask;
|
|||
cpumask_t offline_mask;
|
||||
struct resource *l1_l2_gcc_res;
|
||||
uint32_t l2_status = -1;
|
||||
static int prev_battery_percentage = 100;
|
||||
|
||||
static int lpm_battery_get_property(struct power_supply *psy,
|
||||
enum power_supply_property prop,
|
||||
union power_supply_propval *val)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
static int lpm_battery_set_property(struct power_supply *psy,
|
||||
enum power_supply_property prop,
|
||||
const union power_supply_propval *val)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
static int lpm_wa_callback(struct notifier_block *cpu_nb,
|
||||
unsigned long action, void *hcpu)
|
||||
{
|
||||
|
@ -94,67 +76,6 @@ static struct notifier_block __refdata lpm_wa_nblk = {
|
|||
.notifier_call = lpm_wa_callback,
|
||||
};
|
||||
|
||||
static void lpm_dynamic_clock_gating_workaround(void)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
cpumask_copy(&curr_req.offline_mask, &l1_l2_offline_mask);
|
||||
ret = devmgr_client_request_mitigation(
|
||||
hotplug_handle,
|
||||
HOTPLUG_MITIGATION_REQ,
|
||||
&curr_req);
|
||||
if (ret) {
|
||||
pr_err("hotplug request failed. err:%d\n", ret);
|
||||
return;
|
||||
}
|
||||
|
||||
if (cpumask_equal(&offline_mask, &l1_l2_offline_mask))
|
||||
queue_work(lpm_wa_wq, &lpm_wa_work);
|
||||
}
|
||||
|
||||
static void lpm_supply_callback(struct power_supply *psy)
|
||||
{
|
||||
|
||||
static struct power_supply *lpm_psy;
|
||||
int battery_percentage = 0;
|
||||
union power_supply_propval ret = {0,};
|
||||
static bool l2_enable = true;
|
||||
|
||||
if (!lpm_psy)
|
||||
lpm_psy = power_supply_get_by_name("battery");
|
||||
if (lpm_psy) {
|
||||
battery_percentage = lpm_psy->get_property(lpm_psy,
|
||||
POWER_SUPPLY_PROP_CAPACITY, &ret);
|
||||
battery_percentage = ret.intval;
|
||||
|
||||
if (prev_battery_percentage == battery_percentage)
|
||||
return;
|
||||
|
||||
if (battery_percentage < BATT_LOW_THRESHOLD) {
|
||||
if (l2_enable == false) {
|
||||
prev_battery_percentage = battery_percentage;
|
||||
return;
|
||||
}
|
||||
lpm_cluster_mode_disable();
|
||||
l2_enable = false;
|
||||
} else {
|
||||
if (enable_dynamic_clock_gating == true &&
|
||||
store_clock_gating == true)
|
||||
lpm_dynamic_clock_gating_workaround();
|
||||
|
||||
if (l2_enable == true) {
|
||||
prev_battery_percentage = battery_percentage;
|
||||
return;
|
||||
}
|
||||
|
||||
lpm_cluster_mode_enable();
|
||||
l2_enable = true;
|
||||
|
||||
}
|
||||
prev_battery_percentage = battery_percentage;
|
||||
}
|
||||
}
|
||||
|
||||
static void process_lpm_workarounds(struct work_struct *w)
|
||||
{
|
||||
int ret = 0, status = 0, cpu = 0;
|
||||
|
@ -229,11 +150,19 @@ static ssize_t store_clock_gating_enabled(struct kobject *kobj,
|
|||
return count;
|
||||
}
|
||||
|
||||
store_clock_gating = true;
|
||||
if (prev_battery_percentage < BATT_LOW_THRESHOLD)
|
||||
cpumask_copy(&curr_req.offline_mask, &l1_l2_offline_mask);
|
||||
ret = devmgr_client_request_mitigation(
|
||||
hotplug_handle,
|
||||
HOTPLUG_MITIGATION_REQ,
|
||||
&curr_req);
|
||||
if (ret) {
|
||||
pr_err("hotplug request failed. err:%d\n", ret);
|
||||
return count;
|
||||
}
|
||||
|
||||
lpm_dynamic_clock_gating_workaround();
|
||||
store_clock_gating = true;
|
||||
if (cpumask_equal(&offline_mask, &l1_l2_offline_mask))
|
||||
queue_work(lpm_wa_wq, &lpm_wa_work);
|
||||
|
||||
return count;
|
||||
}
|
||||
|
@ -249,8 +178,6 @@ static int lpm_wa_probe(struct platform_device *pdev)
|
|||
struct resource *res = NULL;
|
||||
unsigned long cpu_mask = 0;
|
||||
char *key;
|
||||
struct power_supply *lpm_psy;
|
||||
union power_supply_propval val = {0,};
|
||||
|
||||
|
||||
skip_l2_spm = of_property_read_bool(pdev->dev.of_node,
|
||||
|
@ -265,21 +192,6 @@ static int lpm_wa_probe(struct platform_device *pdev)
|
|||
"qcom,lpm-wa-dynamic-clock-gating");
|
||||
if (!enable_dynamic_clock_gating)
|
||||
return ret;
|
||||
|
||||
lpm_wa_psy.name = name;
|
||||
lpm_wa_psy.type = POWER_SUPPLY_TYPE_BMS;
|
||||
lpm_wa_psy.get_property = lpm_battery_get_property;
|
||||
lpm_wa_psy.set_property = lpm_battery_set_property;
|
||||
lpm_wa_psy.num_properties = 0;
|
||||
lpm_wa_psy.external_power_changed = lpm_supply_callback;
|
||||
ret = power_supply_register(&pdev->dev, &lpm_wa_psy);
|
||||
lpm_psy = power_supply_get_by_name("battery");
|
||||
if (lpm_psy) {
|
||||
prev_battery_percentage = lpm_psy->get_property(lpm_psy,
|
||||
POWER_SUPPLY_PROP_CAPACITY, &val);
|
||||
prev_battery_percentage = val.intval;
|
||||
}
|
||||
|
||||
is_l1_l2_gcc_secure = of_property_read_bool(pdev->dev.of_node,
|
||||
"qcom,l1-l2-gcc-secure");
|
||||
|
||||
|
|
|
@ -560,8 +560,7 @@ static const struct of_device_id fg_match_table[] = {
|
|||
static char *fg_supplicants[] = {
|
||||
"battery",
|
||||
"bcl",
|
||||
"fg_adc",
|
||||
"lpm"
|
||||
"fg_adc"
|
||||
};
|
||||
|
||||
#define DEBUG_PRINT_BUFFER_SIZE 64
|
||||
|
|
Loading…
Reference in New Issue