lpm-levels: Disable RIMPS timer based PLL/RAIL feature timer

This patch disables the RIMPS timer based PLL/RAIL trigger
timer in core C4 exit so that it stops the RIMPS from ticking
timer when core C4 exit happen before this timer expires.

Change-Id: I74b3e2222dc3ef5ba0fdebd71b7e86201016fc42
Signed-off-by: Raghavendra Kakarla <rkakarla@codeaurora.org>
This commit is contained in:
Raghavendra Kakarla 2020-10-30 19:41:33 +05:30
commit e21730c492

View file

@ -274,6 +274,23 @@ static uint32_t get_next_event(struct lpm_cpu *cpu)
return ktime_to_us(ktime_sub(next_event, ktime_get()));
}
static void disable_rimps_timer(struct lpm_cpu *cpu)
{
uint32_t ctrl_val;
if (!cpu->rimps_tmr_base)
return;
spin_lock(&cpu->cpu_lock);
ctrl_val = readl_relaxed(cpu->rimps_tmr_base + TIMER_CTRL);
writel_relaxed(ctrl_val & ~(TIMER_CONTROL_EN),
cpu->rimps_tmr_base + TIMER_CTRL);
/* Ensure the write is complete before returning. */
wmb();
spin_unlock(&cpu->cpu_lock);
}
static void program_rimps_timer(struct lpm_cpu *cpu)
{
uint32_t ctrl_val, next_event;
@ -1467,6 +1484,8 @@ static int lpm_cpuidle_enter(struct cpuidle_device *dev,
success = (ret == 0);
exit:
if (idx == cpu->nlevels - 1)
disable_rimps_timer(cpu);
end_time = ktime_to_ns(ktime_get());
lpm_stats_cpu_exit(idx, end_time, success);
@ -1729,6 +1748,7 @@ static int lpm_suspend_enter(suspend_state_t state)
cpu_prepare(lpm_cpu, idx, false);
cluster_prepare(cluster, cpumask, idx, false, 0);
disable_rimps_timer(lpm_cpu);
ret = psci_enter_sleep(lpm_cpu, idx, false);
success = (ret == 0);