Skip to content

Commit 2ed508c

Browse files
Mayuresh KulkarniRohan Somvanshi
authored andcommitted
arm: tegra: turn off pll-a/p in LP1
- current code does not turn off pll-a/p in LP1 irrespective of voice call status - add a new flag to indicate voice call on-going - use PMC_SCRATCH37 to hold this flag - if it is set, do not turn-off pll-a/p during LP1 - save-restore PMC_SCRATCH37 if it was used to hold the voice call on-going flag - fix few misc formatting issues in tegra3_cpu_clk32k Bug 924817 Signed-off-by: Mayuresh Kulkarni <[email protected]> Reviewed-on: http://git-master/r/85768 (cherry picked from commit 7853981c987ae329620bb54d869016cb74a6c054) Change-Id: Id5348d2eb44a4bacaf00f6d17edceedaef819e29 Reviewed-on: http://git-master/r/94395 Tested-by: Mayuresh Kulkarni <[email protected]> Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Bharat Nihalani <[email protected]>
1 parent ab1f075 commit 2ed508c

File tree

3 files changed

+25
-8
lines changed

3 files changed

+25
-8
lines changed

arch/arm/mach-tegra/pm.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
#include <linux/memblock.h>
4444
#include <linux/console.h>
4545
#include <linux/pm_qos_params.h>
46+
#include <linux/tegra_audio.h>
4647

4748
#include <asm/cacheflush.h>
4849
#include <asm/cpu_pm.h>
@@ -837,13 +838,25 @@ static void tegra_suspend_check_pwr_stats(void)
837838
int tegra_suspend_dram(enum tegra_suspend_mode mode, unsigned int flags)
838839
{
839840
int err = 0;
841+
u32 scratch37 = 0xDEADBEEF;
840842

841843
if (WARN_ON(mode <= TEGRA_SUSPEND_NONE ||
842844
mode >= TEGRA_MAX_SUSPEND_MODE)) {
843845
err = -ENXIO;
844846
goto fail;
845847
}
846848

849+
if (tegra_is_voice_call_active()) {
850+
u32 reg;
851+
852+
/* backup the current value of scratch37 */
853+
scratch37 = readl(pmc + PMC_SCRATCH37);
854+
855+
/* If voice call is active, set a flag in PMC_SCRATCH37 */
856+
reg = TEGRA_POWER_LP1_AUDIO;
857+
pmc_32kwritel(reg, PMC_SCRATCH37);
858+
}
859+
847860
if ((mode == TEGRA_SUSPEND_LP0) && !tegra_pm_irq_lp0_allowed()) {
848861
pr_info("LP0 not used due to unsupported wakeup events\n");
849862
mode = TEGRA_SUSPEND_LP1;
@@ -899,6 +912,10 @@ int tegra_suspend_dram(enum tegra_suspend_mode mode, unsigned int flags)
899912
} else if (mode == TEGRA_SUSPEND_LP1)
900913
*iram_cpu_lp1_mask = 0;
901914

915+
/* if scratch37 was clobbered during LP1, restore it */
916+
if (scratch37 != 0xDEADBEEF)
917+
pmc_32kwritel(scratch37, PMC_SCRATCH37);
918+
902919
restore_cpu_complex(flags);
903920

904921
/* for platforms where the core & CPU power requests are

arch/arm/mach-tegra/sleep-t3.S

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ tegra3_cpu_clk32k:
519519

520520
/* enable PLLM via PMC in LP0 */
521521
ldr r0, [r4, #PMC_PLLP_WB0_OVERRIDE]
522-
orr r0, r0, #((1<<12) | (1 << 11))
522+
orr r0, r0, #((1 << 12) | (1 << 11))
523523
str r0, [r4, #PMC_PLLP_WB0_OVERRIDE]
524524
mov pc, lr
525525

@@ -543,29 +543,28 @@ lp1_clocks_prepare:
543543
add r1, r1, #2
544544
wait_until r1, r7, r9
545545

546-
#if 1
547546
/* switch to CLKS */
548547
mov r0, #0 /* burst policy = 32KHz */
549548
str r0, [r5, #CLK_RESET_SCLK_BURST]
550-
#endif
551549

552550
/* disable PLLM via PMC in LP1 */
553551
ldr r0, [r4, #PMC_PLLP_WB0_OVERRIDE]
554-
bic r0, r0, #(1<<12)
552+
bic r0, r0, #(1 << 12)
555553
str r0, [r4, #PMC_PLLP_WB0_OVERRIDE]
556554
b powerdown_pll_pcx
557555

558556
powerdown_pll_pcx:
559-
/* disable PLLP, PLLA, PLLC, and PLLX in LP0 and LP1 states */
560-
ldr r0, [r4, #PMC_CTRL]
561-
tst r0, #PMC_CTRL_SIDE_EFFECT_LP0
562-
beq powerdown_pll_cx
557+
ldr r11, [r4, #PMC_SCRATCH37] @ load the LP1 flags
558+
tst r11, #TEGRA_POWER_LP1_AUDIO @ check if voice call is going on
559+
bne powerdown_pll_cx @ if yes, do not turn off pll-p/pll-a
560+
563561
ldr r0, [r5, #CLK_RESET_PLLP_BASE]
564562
bic r0, r0, #(1<<30)
565563
str r0, [r5, #CLK_RESET_PLLP_BASE]
566564
ldr r0, [r5, #CLK_RESET_PLLA_BASE]
567565
bic r0, r0, #(1<<30)
568566
str r0, [r5, #CLK_RESET_PLLA_BASE]
567+
569568
powerdown_pll_cx:
570569
ldr r0, [r5, #CLK_RESET_PLLC_BASE]
571570
bic r0, r0, #(1<<30)

arch/arm/mach-tegra/sleep.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
#define USE_TEGRA_DIAG_REG_SAVE 0
3939
#endif
4040

41+
#define TEGRA_POWER_LP1_AUDIO (1 << 25) /* do not turn off pll-p in LP1 */
4142
#define TEGRA_POWER_SDRAM_SELFREFRESH (1 << 26) /* SDRAM is in self-refresh */
4243
#define TEGRA_POWER_HOTPLUG_SHUTDOWN (1 << 27) /* Hotplug shutdown */
4344
#define TEGRA_POWER_CLUSTER_G (1 << 28) /* G CPU */

0 commit comments

Comments
 (0)