samsung: emc: change timer add condition.
authorYoungtae Lee <yt0729.lee@samsung.com>
Tue, 15 May 2018 01:18:40 +0000 (10:18 +0900)
committerlakkyung.jung <lakkyung.jung@samsung.com>
Mon, 23 Jul 2018 05:59:17 +0000 (14:59 +0900)
If req_mode and cur_mode is same, skip adding timer

Change-Id: I80ba564f705c131609e0b96ff99126a4495ae3dd
Signed-off-by: Youngtae Lee <yt0729.lee@samsung.com>
drivers/soc/samsung/exynos-emc.c

index 47ab39a08ce3d552f8c6ab646975e531f74f6ca2..a167975f79f4096cd09d15a2f8c4c5d081566ec1 100644 (file)
@@ -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);