]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
Revert "Revert "ARM: tegra: pm: turn off VDEC partition in LP1""
authorAllen Yu <alleny@nvidia.com>
Thu, 24 Apr 2014 07:47:11 +0000 (15:47 +0800)
committerSimone Willett <swillett@nvidia.com>
Sat, 26 Apr 2014 02:24:53 +0000 (19:24 -0700)
This reverts commit 193e70e3a74bb167e4a443329dc0bd3cf0fcd7a0.

VDE partition has to be left on before entering LP0, otherwise
secure content playback may be corrupted after resuming from LP0.
So we unpowergate vde in the dependent change. This change turn
off vde partition specifically for LP1 case to save power.

Bug 1502013

Change-Id: Ibf1dcb40a33cb52f9366e250452a54ae43fcb67a
Signed-off-by: Allen Yu <alleny@nvidia.com>
Reviewed-on: http://git-master/r/401253
Reviewed-by: Hunk Lin <hulin@nvidia.com>
Tested-by: Praveen Kumar Reddy M.V. <pkreddy@nvidia.com>
Reviewed-by: Todd Poynter <tpoynter@nvidia.com>
arch/arm/mach-tegra/pm.c
arch/arm64/mach-tegra/pm.c

index 7c2d8cbaca1912fe84e5a2f7c8f5ab4430d15238..d4ebe9d38a13da6f401af304f9c107ca22917c29 100644 (file)
@@ -1375,14 +1375,24 @@ int tegra_enter_lp0(unsigned long sleep_time)
 }
 #endif
 
+static void tegra_suspend_powergate_control(int partid, bool turn_off)
+{
+       if (turn_off)
+               tegra_powergate_partition(partid);
+       else
+               tegra_unpowergate_partition(partid);
+}
+
 int tegra_suspend_dram(enum tegra_suspend_mode mode, unsigned int flags)
 {
        int err = 0;
        u32 scratch37 = 0xDEADBEEF;
        u32 reg;
+
 #if defined(CONFIG_ARCH_TEGRA_14x_SOC)
        u32 enter_state = 0;
 #endif
+       bool tegra_suspend_vde_powergated = false;
 
        if (WARN_ON(mode <= TEGRA_SUSPEND_NONE ||
                mode >= TEGRA_MAX_SUSPEND_MODE)) {
@@ -1411,6 +1421,15 @@ int tegra_suspend_dram(enum tegra_suspend_mode mode, unsigned int flags)
        if ((mode == TEGRA_SUSPEND_LP0) || (mode == TEGRA_SUSPEND_LP1))
                tegra_suspend_check_pwr_stats();
 
+       /* turn off VDE partition in LP1 */
+       if (mode == TEGRA_SUSPEND_LP1 &&
+               tegra_powergate_is_powered(TEGRA_POWERGATE_VDEC)) {
+               pr_info("turning off partition %s in LP1\n",
+                       tegra_powergate_get_name(TEGRA_POWERGATE_VDEC));
+               tegra_suspend_powergate_control(TEGRA_POWERGATE_VDEC, true);
+               tegra_suspend_vde_powergated = true;
+       }
+
        tegra_common_suspend();
 
        tegra_pm_set(mode);
@@ -1552,6 +1571,13 @@ int tegra_suspend_dram(enum tegra_suspend_mode mode, unsigned int flags)
 
        tegra_common_resume();
 
+       /* turn on VDE partition in LP1 */
+       if (mode == TEGRA_SUSPEND_LP1 && tegra_suspend_vde_powergated) {
+               pr_info("turning on partition %s in LP1\n",
+                       tegra_powergate_get_name(TEGRA_POWERGATE_VDEC));
+               tegra_suspend_powergate_control(TEGRA_POWERGATE_VDEC, false);
+       }
+
 fail:
        return err;
 }
index 8cc2f6b09aa08cb8257c07b575cdc9641ca03291..c5ee44b91d19a66e4cf18029a139f44b7c1b0d0e 100644 (file)
@@ -582,12 +582,22 @@ static void tegra_suspend_check_pwr_stats(void)
        return;
 }
 
+static void tegra_suspend_powergate_control(int partid, bool turn_off)
+{
+       if (turn_off)
+               tegra_powergate_partition(partid);
+       else
+               tegra_unpowergate_partition(partid);
+}
+
 int tegra_suspend_dram(enum tegra_suspend_mode mode, unsigned int flags)
 {
        int err = 0;
        u32 scratch37 = 0xDEADBEEF;
        u32 reg;
 
+       bool tegra_suspend_vde_powergated = false;
+
        if (WARN_ON(mode <= TEGRA_SUSPEND_NONE ||
                mode >= TEGRA_MAX_SUSPEND_MODE)) {
                err = -ENXIO;
@@ -602,6 +612,15 @@ int tegra_suspend_dram(enum tegra_suspend_mode mode, unsigned int flags)
        if ((mode == TEGRA_SUSPEND_LP0) || (mode == TEGRA_SUSPEND_LP1))
                tegra_suspend_check_pwr_stats();
 
+       /* turn off VDE partition in LP1 */
+       if (mode == TEGRA_SUSPEND_LP1 &&
+               tegra_powergate_is_powered(TEGRA_POWERGATE_VDEC)) {
+               pr_info("turning off partition %s in LP1\n",
+                       tegra_powergate_get_name(TEGRA_POWERGATE_VDEC));
+               tegra_suspend_powergate_control(TEGRA_POWERGATE_VDEC, true);
+               tegra_suspend_vde_powergated = true;
+       }
+
        tegra_common_suspend();
 
        tegra_pm_set(mode);
@@ -669,6 +688,13 @@ int tegra_suspend_dram(enum tegra_suspend_mode mode, unsigned int flags)
 
        tegra_common_resume();
 
+       /* turn on VDE partition in LP1 */
+       if (mode == TEGRA_SUSPEND_LP1 && tegra_suspend_vde_powergated) {
+               pr_info("turning on partition %s in LP1\n",
+                       tegra_powergate_get_name(TEGRA_POWERGATE_VDEC));
+               tegra_suspend_powergate_control(TEGRA_POWERGATE_VDEC, false);
+       }
+
 fail:
        return err;
 }