Merge "msm: mdss: enforce bimc smmu gdsc power sequence"

This commit is contained in:
Linux Build Service Account 2017-01-28 08:41:36 -08:00 committed by Gerrit - the friendly Code Review server
commit 95fcfdad6d
2 changed files with 44 additions and 32 deletions

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@ -281,7 +281,7 @@ struct mdss_data_type {
u32 mdp_rev;
struct clk *mdp_clk[MDSS_MAX_CLK];
struct regulator *fs;
struct regulator *venus;
struct regulator *core_gdsc;
struct regulator *vdd_cx;
u32 vdd_cx_min_uv;
u32 vdd_cx_max_uv;

View file

@ -1,7 +1,7 @@
/*
* MDSS MDP Interface (used by framebuffer core)
*
* Copyright (c) 2007-2016, The Linux Foundation. All rights reserved.
* Copyright (c) 2007-2017, The Linux Foundation. All rights reserved.
* Copyright (C) 2007 Google Incorporated
*
* This software is licensed under the terms of the GNU General Public
@ -1794,11 +1794,13 @@ static int mdss_mdp_irq_clk_setup(struct mdss_data_type *mdata)
return -EINVAL;
}
mdata->venus = devm_regulator_get_optional(&mdata->pdev->dev,
"gdsc-venus");
if (IS_ERR_OR_NULL(mdata->venus)) {
mdata->venus = NULL;
pr_debug("unable to get venus gdsc regulator\n");
mdata->core_gdsc = devm_regulator_get_optional(&mdata->pdev->dev,
"gdsc-core");
if (IS_ERR_OR_NULL(mdata->core_gdsc)) {
mdata->core_gdsc = NULL;
pr_err("unable to get core gdsc regulator\n");
} else {
pr_debug("core gdsc regulator found\n");
}
mdata->fs_ena = false;
@ -2370,10 +2372,10 @@ void mdss_mdp_footswitch_ctrl_splash(int on)
if (on) {
mdata->handoff_pending = true;
pr_debug("Enable MDP FS for splash.\n");
if (mdata->venus) {
ret = regulator_enable(mdata->venus);
if (mdata->core_gdsc) {
ret = regulator_enable(mdata->core_gdsc);
if (ret)
pr_err("venus failed to enable\n");
pr_err("core_gdsc failed to enable\n");
}
ret = regulator_enable(mdata->fs);
@ -2387,8 +2389,8 @@ void mdss_mdp_footswitch_ctrl_splash(int on)
mdss_bus_bandwidth_ctrl(false);
mdss_mdp_clk_ctrl(MDP_BLOCK_POWER_OFF);
regulator_disable(mdata->fs);
if (mdata->venus)
regulator_disable(mdata->venus);
if (mdata->core_gdsc)
regulator_disable(mdata->core_gdsc);
mdata->handoff_pending = false;
}
} else {
@ -5059,6 +5061,7 @@ static void mdss_mdp_footswitch_ctrl(struct mdss_data_type *mdata, int on)
{
int ret;
int active_cnt = 0;
bool footswitch_suspend = false;
if (!mdata->fs)
return;
@ -5069,12 +5072,21 @@ static void mdss_mdp_footswitch_ctrl(struct mdss_data_type *mdata, int on)
if (on) {
if (!mdata->fs_ena) {
pr_debug("Enable MDP FS\n");
if (mdata->venus) {
ret = regulator_enable(mdata->venus);
if (mdata->core_gdsc) {
ret = regulator_enable(mdata->core_gdsc);
if (ret)
pr_err("venus failed to enable\n");
pr_err("core_gdsc failed to enable\n");
}
/*
* Advise RPM to not turn MMSS GDSC off, this will
* ensure that GDSC off is maintained during Active
* display and during Idle display
*/
if (mdss_has_quirk(mdata,
MDSS_QUIRK_MMSS_GDSC_COLLAPSE))
mdss_rpm_set_msg_ram(true);
ret = regulator_enable(mdata->fs);
if (ret)
pr_warn("Footswitch failed to enable\n");
@ -5091,13 +5103,6 @@ static void mdss_mdp_footswitch_ctrl(struct mdss_data_type *mdata, int on)
pr_debug("Disable MDP FS\n");
active_cnt = atomic_read(&mdata->active_intf_cnt);
if (active_cnt != 0) {
/*
* Advise RPM to not turn MMSS GDSC off during
* idle case.
*/
if (mdss_has_quirk(mdata,
MDSS_QUIRK_MMSS_GDSC_COLLAPSE))
mdss_rpm_set_msg_ram(true);
/*
* Turning off GDSC while overlays are still
* active.
@ -5109,14 +5114,8 @@ static void mdss_mdp_footswitch_ctrl(struct mdss_data_type *mdata, int on)
pr_debug("idle pc. active overlays=%d\n",
active_cnt);
} else {
/*
* Advise RPM to turn MMSS GDSC off during
* suspend case
*/
if (mdss_has_quirk(mdata,
MDSS_QUIRK_MMSS_GDSC_COLLAPSE))
mdss_rpm_set_msg_ram(false);
footswitch_suspend = true;
mdss_mdp_cx_ctrl(mdata, false);
mdss_mdp_batfet_ctrl(mdata, false);
mdss_mdp_memory_retention_ctrl(
@ -5127,8 +5126,21 @@ static void mdss_mdp_footswitch_ctrl(struct mdss_data_type *mdata, int on)
if (mdata->en_svs_high)
mdss_mdp_config_cx_voltage(mdata, false);
regulator_disable(mdata->fs);
if (mdata->venus)
regulator_disable(mdata->venus);
if (mdata->core_gdsc)
regulator_disable(mdata->core_gdsc);
if (footswitch_suspend) {
/*
* Advise RPM to turn MMSS GDSC off during
* suspend case, do this after the MDSS GDSC
* regulator OFF, so we can ensure that MMSS
* GDSC will go OFF after the MDSS GDSC
* regulator
*/
if (mdss_has_quirk(mdata,
MDSS_QUIRK_MMSS_GDSC_COLLAPSE))
mdss_rpm_set_msg_ram(false);
}
}
mdata->fs_ena = false;
}