mmc: core: Initialize the devfreq table with default frequencies
Initialize the clock scaling frequency table with the platform specific frequencies while preparing it. So that the frequencies supported by the card can be compared against the frequencies supported by the platform and then the table can be updated with the optimal frequencies to match with both card and platform. Without resetting these values to default values, this table contains the frequencies updated for the last used card. These old values would be used instead of platform-specific values to compare against the frequencies of the newly inserted card. This can result in limiting the max frequency to a lower frequency than what actually card can support. Say if an high-speed card is used first and then a ultra-high-speed card, the max scaling frequency would get set to the max of high-speed card instead of max of the ultra-high-speed card. Change-Id: I09a36e36c189e1d1fc317d798a0e3ff899f4e560 Signed-off-by: Veerabhadrarao Badiganti <vbadigan@codeaurora.org>
This commit is contained in:
parent
70bc2b791f
commit
1cc23bd6d0
1 changed files with 33 additions and 7 deletions
|
@ -616,17 +616,39 @@ static int mmc_devfreq_create_freq_table(struct mmc_host *host)
|
||||||
host->card->clk_scaling_lowest,
|
host->card->clk_scaling_lowest,
|
||||||
host->card->clk_scaling_highest);
|
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) {
|
if (!clk_scaling->freq_table) {
|
||||||
pr_debug("%s: no frequency table defined - setting default\n",
|
if (clk_scaling->pltfm_freq_table_sz)
|
||||||
mmc_hostname(host));
|
clk_scaling->freq_table_sz =
|
||||||
|
clk_scaling->pltfm_freq_table_sz;
|
||||||
|
else
|
||||||
|
clk_scaling->freq_table_sz = 2;
|
||||||
|
|
||||||
clk_scaling->freq_table = kzalloc(
|
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)
|
if (!clk_scaling->freq_table)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
clk_scaling->freq_table[0] = host->card->clk_scaling_lowest;
|
|
||||||
clk_scaling->freq_table[1] = host->card->clk_scaling_highest;
|
if (clk_scaling->pltfm_freq_table) {
|
||||||
clk_scaling->freq_table_sz = 2;
|
memcpy(clk_scaling->freq_table,
|
||||||
goto out;
|
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 >
|
if (host->card->clk_scaling_lowest >
|
||||||
|
@ -895,6 +917,10 @@ int mmc_exit_clk_scaling(struct mmc_host *host)
|
||||||
|
|
||||||
host->clk_scaling.devfreq = NULL;
|
host->clk_scaling.devfreq = NULL;
|
||||||
atomic_set(&host->clk_scaling.devfreq_abort, 1);
|
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));
|
pr_debug("%s: devfreq was removed\n", mmc_hostname(host));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Add table
Reference in a new issue