Skip to content

Commit d1d3a1a

Browse files
committed
ARM: rockchip: set correct stabilization thresholds in suspend
Currently the stabilization thresholds for the oscillator and external pmu are statically set to 30ms based on a 32kHz clock rate. This leaves out the case when we don't switch to the 32kHz clock when only entering the shallow suspend mode where the logic keeps running. So, set the correct threshold after we have determined if we switch to the 32kHz clock or stay with the 24MHz one. Also set the oscillator- stabilization to 0 if it is kept running during suspend, as it of course does not need to stabilize then. Reported-by: Chris Zhong <[email protected]> Signed-off-by: Heiko Stuebner <[email protected]> Reviewed-by: Chris Zhong <[email protected]> Tested-by: Chris Zhong <[email protected]> Reviewed-by: Douglas Anderson <[email protected]>
1 parent 41fe6a0 commit d1d3a1a

File tree

2 files changed

+19
-7
lines changed

2 files changed

+19
-7
lines changed

arch/arm/mach-rockchip/pm.c

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,13 +145,32 @@ static void rk3288_slp_mode_set(int level)
145145

146146
mode_set1 |= BIT(PMU_CLR_ALIVE) | BIT(PMU_CLR_BUS) |
147147
BIT(PMU_CLR_PERI) | BIT(PMU_CLR_DMA);
148+
149+
/*
150+
* In deep suspend we use PMU_PMU_USE_LF to let the rk3288
151+
* switch its main clock supply to the alternative 32kHz
152+
* source. Therefore set 30ms on a 32kHz clock for pmic
153+
* stabilization. Similar 30ms on 24MHz for the other
154+
* mode below.
155+
*/
156+
regmap_write(pmu_regmap, RK3288_PMU_STABL_CNT, 32 * 30);
157+
158+
/* only wait for stabilization, if we turned the osc off */
159+
regmap_write(pmu_regmap, RK3288_PMU_OSC_CNT,
160+
osc_disable ? 32 * 30 : 0);
148161
} else {
149162
/*
150163
* arm off, logic normal
151164
* if pmu_clk_core_src_gate_en is not set,
152165
* wakeup will be error
153166
*/
154167
mode_set |= BIT(PMU_CLK_CORE_SRC_GATE_EN);
168+
169+
/* 30ms on a 24MHz clock for pmic stabilization */
170+
regmap_write(pmu_regmap, RK3288_PMU_STABL_CNT, 24000 * 30);
171+
172+
/* oscillator is still running, so no need to wait */
173+
regmap_write(pmu_regmap, RK3288_PMU_OSC_CNT, 0);
155174
}
156175

157176
regmap_write(pmu_regmap, RK3288_PMU_PWRMODE_CON, mode_set);
@@ -262,9 +281,6 @@ static int rk3288_suspend_init(struct device_node *np)
262281
memcpy(rk3288_bootram_base, rockchip_slp_cpu_resume,
263282
rk3288_bootram_sz);
264283

265-
regmap_write(pmu_regmap, RK3288_PMU_OSC_CNT, OSC_STABL_CNT_THRESH);
266-
regmap_write(pmu_regmap, RK3288_PMU_STABL_CNT, PMU_STABL_CNT_THRESH);
267-
268284
return 0;
269285
}
270286

arch/arm/mach-rockchip/pm.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,6 @@ static inline void rockchip_suspend_init(void)
6262
/* PMU_WAKEUP_CFG1 bits */
6363
#define PMU_ARMINT_WAKEUP_EN BIT(0)
6464

65-
/* wait 30ms for OSC stable and 30ms for pmic stable */
66-
#define OSC_STABL_CNT_THRESH (32 * 30)
67-
#define PMU_STABL_CNT_THRESH (32 * 30)
68-
6965
enum rk3288_pwr_mode_con {
7066
PMU_PWR_MODE_EN = 0,
7167
PMU_CLK_CORE_SRC_GATE_EN,

0 commit comments

Comments
 (0)