From 3b0236d6ccf5a4f191d8c682c83f6687a2415aa0 Mon Sep 17 00:00:00 2001 From: Youngtae Lee Date: Tue, 15 May 2018 10:18:40 +0900 Subject: [PATCH] samsung: emc: change timer add condition. If req_mode and cur_mode is same, skip adding timer Change-Id: I80ba564f705c131609e0b96ff99126a4495ae3dd Signed-off-by: Youngtae Lee --- drivers/soc/samsung/exynos-emc.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/soc/samsung/exynos-emc.c b/drivers/soc/samsung/exynos-emc.c index 47ab39a08ce3..a167975f79f4 100644 --- a/drivers/soc/samsung/exynos-emc.c +++ b/drivers/soc/samsung/exynos-emc.c @@ -514,16 +514,20 @@ static void emc_request_mode_change(struct emc_mode *target_mode) static void emc_irq_work(struct irq_work *irq_work) { + /* + * If req_mode is changed before mode change latency, + * cancel requesting mode change + */ if (hrtimer_active(&emc.timer)) hrtimer_cancel(&emc.timer); - /* - * In order to change state, same mode should be remained - * at least chamge_ms time - */ + /* if req_mode and cur_mode is same, skip the mode change */ + if (emc.req_mode == emc.cur_mode) + return; + trace_emc_start_timer(emc.req_mode->name, emc.req_mode->change_latency); - /* It tries to change mode only if it keeps same mode as change_latency */ + /* emc change applying req_mode after keeps same mode as change_latency */ hrtimer_start(&emc.timer, ms_to_ktime(emc.req_mode->change_latency), HRTIMER_MODE_REL); -- 2.20.1