From 36606a9254a18753299ec05dd2bb9062faf92963 Mon Sep 17 00:00:00 2001 From: Youngtae Lee Date: Thu, 14 Jun 2018 14:47:16 +0900 Subject: [PATCH] samsung: emc: Fix bug that max_constraints violation bug. This fxixes bug that current and real frequency is higher than max frequency. Change-Id: I3d488b642cea350e6dcc7d84eab9389d34639555 Signed-off-by: Youngtae Lee --- drivers/soc/samsung/exynos-emc.c | 17 ++++++++++------- include/soc/samsung/exynos-emc.h | 2 +- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/drivers/soc/samsung/exynos-emc.c b/drivers/soc/samsung/exynos-emc.c index 0e8ed77f5cc9..19ba035a96aa 100644 --- a/drivers/soc/samsung/exynos-emc.c +++ b/drivers/soc/samsung/exynos-emc.c @@ -210,7 +210,7 @@ int emc_verify_constraints(void) { struct cpufreq_policy *policy; struct emc_domain *domain; - unsigned int cpu; + unsigned int cpu, cur_freq; domain = emc_get_boost_domain(); cpu = cpumask_first(&domain->cpus); @@ -224,7 +224,7 @@ int emc_verify_constraints(void) /* check policy max */ if (policy->max > emc.max_freq) { cpufreq_cpu_put(policy); - pr_warn("EMC: max constraints is not yet applyied(emc_max(%d) < cur_max(%d)\n", + pr_warn("EMC: constraints isn't yet applyied(emc_max(%lu) < cur_max(%d)\n", emc.max_freq, policy->max); return 0; } @@ -232,9 +232,12 @@ int emc_verify_constraints(void) check_real_freq: /* check whether real cpu freq within max constraints or not */ - if (exynos_cpufreq_get(cpu) > emc.max_freq) - panic("EMC(%s): real frequency(%d) is higher than max(%d)\n", - __func__, exynos_cpufreq_get(cpu), emc.max_freq); + cur_freq = exynos_cpufreq_get_locked(cpu); + if (cur_freq > emc.max_freq) { + pr_warn("EMC(%s: cur freq(%d) is higher than max(%lu), retring...\n", + __func__, cur_freq, emc.max_freq); + return 0; + } return 1; } @@ -816,7 +819,7 @@ static int emc_cpu_on_callback(unsigned int cpu) } int emc_cpu_pre_on_callback(unsigned int cpu) { - emc_update_pre_mask(cpu, false); + emc_update_pre_mask(cpu, true); return 0; } @@ -1280,7 +1283,7 @@ static void emc_print_inform(void) scnprintf(buf, sizeof(buf), "%*pbl", cpumask_pr_args(&mode->boost_cpus)); pr_info("mode%d boost_cpus: %s\n", i, buf); - pr_info("mode%d ldsum_thr: %u\n", mode->ldsum_thr); + pr_info("mode%d ldsum_thr: %u\n", i, mode->ldsum_thr); pr_info("mode%d cal-id: %u\n", i, mode->cal_id); pr_info("mode%d max_freq: %u\n", i, mode->max_freq); pr_info("mode%d change_latency: %u\n", i, mode->change_latency); diff --git a/include/soc/samsung/exynos-emc.h b/include/soc/samsung/exynos-emc.h index 595d934c6312..e666a6663898 100644 --- a/include/soc/samsung/exynos-emc.h +++ b/include/soc/samsung/exynos-emc.h @@ -26,7 +26,7 @@ static inline void emc_check_available_freq(struct cpumask *cpus, unsigned int t static inline int emc_cpu_pre_off_callback(unsigned int cpu) { return 0; }; #endif -unsigned int exynos_cpufreq_get(unsigned int cpu); +unsigned int exynos_cpufreq_get_locked(unsigned int cpu); #endif /* __EXYNOS_MODE_CHANGER_H */ -- 2.20.1