From 03454835bd490ca76104710eeb75536ce84f8839 Mon Sep 17 00:00:00 2001 From: Ram Prakash Gupta Date: Mon, 12 Oct 2020 17:39:23 +0530 Subject: [PATCH] mmc: core: Fix clk scaling when card max freq below 50MHz When card max supported clk frequency is less than 50MHz, driver registers scale up frequency as 0 and scale down frequency as max card supported clk frequency. So read/write during high load performace is dropping. Ideally in this scenario, clk scaling could be disabled by skipping registration with devfreq, but userspace might see scaling supported for some card and its not supported for another which might create confusion. Hence keeping low and high, clk scaling frequency as same, and scaling would be skipped when devfreq attempts to scale the clk. Change-Id: I25977bdff4275c4ebec7309952029f43e0d2455f Signed-off-by: Ram Prakash Gupta --- drivers/mmc/core/core.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index e412e0ce7a09..0f5d781d051b 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -612,6 +612,12 @@ static int mmc_devfreq_create_freq_table(struct mmc_host *host) break; } + if (mmc_card_sd(host->card) && (clk_scaling->freq_table_sz < 2)) { + clk_scaling->freq_table[clk_scaling->freq_table_sz] = + host->card->clk_scaling_highest; + clk_scaling->freq_table_sz++; + } + out: /** * devfreq requires unsigned long type freq_table while the