Loading drivers/mmc/core/core.c +34 −8 Original line number Diff line number Diff line Loading @@ -613,18 +613,40 @@ static int mmc_devfreq_create_freq_table(struct mmc_host *host) host->card->clk_scaling_lowest, host->card->clk_scaling_highest); /* * Create the frequency table and initialize it with default values. * Initialize it with platform specific frequencies if the frequency * table supplied by platform driver is present, otherwise initialize * it with min and max frequencies supported by the card. */ if (!clk_scaling->freq_table) { pr_debug("%s: no frequency table defined - setting default\n", mmc_hostname(host)); if (clk_scaling->pltfm_freq_table_sz) clk_scaling->freq_table_sz = clk_scaling->pltfm_freq_table_sz; else clk_scaling->freq_table_sz = 2; clk_scaling->freq_table = kzalloc( 2*sizeof(*(clk_scaling->freq_table)), GFP_KERNEL); (clk_scaling->freq_table_sz * sizeof(*(clk_scaling->freq_table))), GFP_KERNEL); if (!clk_scaling->freq_table) return -ENOMEM; clk_scaling->freq_table[0] = host->card->clk_scaling_lowest; clk_scaling->freq_table[1] = host->card->clk_scaling_highest; clk_scaling->freq_table_sz = 2; if (clk_scaling->pltfm_freq_table) { memcpy(clk_scaling->freq_table, clk_scaling->pltfm_freq_table, (clk_scaling->pltfm_freq_table_sz * sizeof(*(clk_scaling->pltfm_freq_table)))); } else { pr_debug("%s: no frequency table defined - setting default\n", mmc_hostname(host)); clk_scaling->freq_table[0] = host->card->clk_scaling_lowest; clk_scaling->freq_table[1] = host->card->clk_scaling_highest; goto out; } } if (host->card->clk_scaling_lowest > clk_scaling->freq_table[0]) Loading Loading @@ -840,7 +862,7 @@ int mmc_resume_clk_scaling(struct mmc_host *host) devfreq_min_clk = host->clk_scaling.freq_table[0]; host->clk_scaling.curr_freq = devfreq_max_clk; if (host->ios.clock < host->card->clk_scaling_highest) if (host->ios.clock < host->clk_scaling.freq_table[max_clk_idx]) host->clk_scaling.curr_freq = devfreq_min_clk; host->clk_scaling.clk_scaling_in_progress = false; Loading Loading @@ -902,6 +924,10 @@ int mmc_exit_clk_scaling(struct mmc_host *host) host->clk_scaling.devfreq = NULL; atomic_set(&host->clk_scaling.devfreq_abort, 1); kfree(host->clk_scaling.freq_table); host->clk_scaling.freq_table = NULL; pr_debug("%s: devfreq was removed\n", mmc_hostname(host)); return 0; Loading drivers/mmc/host/sdhci-msm.c +5 −5 Original line number Diff line number Diff line Loading @@ -1838,12 +1838,12 @@ struct sdhci_msm_pltfm_data *sdhci_msm_populate_pdata(struct device *dev, } if (sdhci_msm_dt_get_array(dev, "qcom,devfreq,freq-table", &msm_host->mmc->clk_scaling.freq_table, &msm_host->mmc->clk_scaling.freq_table_sz, 0)) &msm_host->mmc->clk_scaling.pltfm_freq_table, &msm_host->mmc->clk_scaling.pltfm_freq_table_sz, 0)) pr_debug("%s: no clock scaling frequencies were supplied\n", dev_name(dev)); else if (!msm_host->mmc->clk_scaling.freq_table || !msm_host->mmc->clk_scaling.freq_table_sz) else if (!msm_host->mmc->clk_scaling.pltfm_freq_table || !msm_host->mmc->clk_scaling.pltfm_freq_table_sz) dev_err(dev, "bad dts clock scaling frequencies\n"); /* Loading include/linux/mmc/host.h +2 −0 Original line number Diff line number Diff line Loading @@ -347,7 +347,9 @@ struct mmc_devfeq_clk_scaling { atomic_t devfreq_abort; bool skip_clk_scale_freq_update; int freq_table_sz; int pltfm_freq_table_sz; u32 *freq_table; u32 *pltfm_freq_table; unsigned long total_busy_time_us; unsigned long target_freq; unsigned long curr_freq; Loading Loading
drivers/mmc/core/core.c +34 −8 Original line number Diff line number Diff line Loading @@ -613,18 +613,40 @@ static int mmc_devfreq_create_freq_table(struct mmc_host *host) host->card->clk_scaling_lowest, host->card->clk_scaling_highest); /* * Create the frequency table and initialize it with default values. * Initialize it with platform specific frequencies if the frequency * table supplied by platform driver is present, otherwise initialize * it with min and max frequencies supported by the card. */ if (!clk_scaling->freq_table) { pr_debug("%s: no frequency table defined - setting default\n", mmc_hostname(host)); if (clk_scaling->pltfm_freq_table_sz) clk_scaling->freq_table_sz = clk_scaling->pltfm_freq_table_sz; else clk_scaling->freq_table_sz = 2; clk_scaling->freq_table = kzalloc( 2*sizeof(*(clk_scaling->freq_table)), GFP_KERNEL); (clk_scaling->freq_table_sz * sizeof(*(clk_scaling->freq_table))), GFP_KERNEL); if (!clk_scaling->freq_table) return -ENOMEM; clk_scaling->freq_table[0] = host->card->clk_scaling_lowest; clk_scaling->freq_table[1] = host->card->clk_scaling_highest; clk_scaling->freq_table_sz = 2; if (clk_scaling->pltfm_freq_table) { memcpy(clk_scaling->freq_table, clk_scaling->pltfm_freq_table, (clk_scaling->pltfm_freq_table_sz * sizeof(*(clk_scaling->pltfm_freq_table)))); } else { pr_debug("%s: no frequency table defined - setting default\n", mmc_hostname(host)); clk_scaling->freq_table[0] = host->card->clk_scaling_lowest; clk_scaling->freq_table[1] = host->card->clk_scaling_highest; goto out; } } if (host->card->clk_scaling_lowest > clk_scaling->freq_table[0]) Loading Loading @@ -840,7 +862,7 @@ int mmc_resume_clk_scaling(struct mmc_host *host) devfreq_min_clk = host->clk_scaling.freq_table[0]; host->clk_scaling.curr_freq = devfreq_max_clk; if (host->ios.clock < host->card->clk_scaling_highest) if (host->ios.clock < host->clk_scaling.freq_table[max_clk_idx]) host->clk_scaling.curr_freq = devfreq_min_clk; host->clk_scaling.clk_scaling_in_progress = false; Loading Loading @@ -902,6 +924,10 @@ int mmc_exit_clk_scaling(struct mmc_host *host) host->clk_scaling.devfreq = NULL; atomic_set(&host->clk_scaling.devfreq_abort, 1); kfree(host->clk_scaling.freq_table); host->clk_scaling.freq_table = NULL; pr_debug("%s: devfreq was removed\n", mmc_hostname(host)); return 0; Loading
drivers/mmc/host/sdhci-msm.c +5 −5 Original line number Diff line number Diff line Loading @@ -1838,12 +1838,12 @@ struct sdhci_msm_pltfm_data *sdhci_msm_populate_pdata(struct device *dev, } if (sdhci_msm_dt_get_array(dev, "qcom,devfreq,freq-table", &msm_host->mmc->clk_scaling.freq_table, &msm_host->mmc->clk_scaling.freq_table_sz, 0)) &msm_host->mmc->clk_scaling.pltfm_freq_table, &msm_host->mmc->clk_scaling.pltfm_freq_table_sz, 0)) pr_debug("%s: no clock scaling frequencies were supplied\n", dev_name(dev)); else if (!msm_host->mmc->clk_scaling.freq_table || !msm_host->mmc->clk_scaling.freq_table_sz) else if (!msm_host->mmc->clk_scaling.pltfm_freq_table || !msm_host->mmc->clk_scaling.pltfm_freq_table_sz) dev_err(dev, "bad dts clock scaling frequencies\n"); /* Loading
include/linux/mmc/host.h +2 −0 Original line number Diff line number Diff line Loading @@ -347,7 +347,9 @@ struct mmc_devfeq_clk_scaling { atomic_t devfreq_abort; bool skip_clk_scale_freq_update; int freq_table_sz; int pltfm_freq_table_sz; u32 *freq_table; u32 *pltfm_freq_table; unsigned long total_busy_time_us; unsigned long target_freq; unsigned long curr_freq; Loading