mmc: core: Update the logic of controlling clk scaling through sysfs
mmc clock scaling can be disabled/enabled through sysfs. The present logic in this path deregisters/registers with devfreq every time. Instead of this, we can simply suspend/resume the clock scaling when requested for disabling/enabling clock scaling. This patch updates the mentioned logic. With original logic, observed deadlock between devfreq registration and cmdqd thread in low memory conditions. The updated logic fixes this deadlock condition aswell. Change-Id: Ifee1ffbe24b13b8f5dc1c9f0579ce9ddf4b4faf3 Signed-off-by: Veerabhadrarao Badiganti <vbadigan@codeaurora.org>
This commit is contained in:
parent
0abd412d83
commit
4c2bdc5879
1 changed files with 6 additions and 6 deletions
|
@ -653,19 +653,19 @@ static ssize_t store_enable(struct device *dev,
|
||||||
mmc_get_card(host->card);
|
mmc_get_card(host->card);
|
||||||
|
|
||||||
if (!value) {
|
if (!value) {
|
||||||
/*turning off clock scaling*/
|
/* Suspend the clock scaling and mask host capability */
|
||||||
mmc_exit_clk_scaling(host);
|
if (host->clk_scaling.enable)
|
||||||
|
mmc_suspend_clk_scaling(host);
|
||||||
host->caps2 &= ~MMC_CAP2_CLK_SCALE;
|
host->caps2 &= ~MMC_CAP2_CLK_SCALE;
|
||||||
host->clk_scaling.state = MMC_LOAD_HIGH;
|
host->clk_scaling.state = MMC_LOAD_HIGH;
|
||||||
/* Set to max. frequency when disabling */
|
/* Set to max. frequency when disabling */
|
||||||
mmc_clk_update_freq(host, host->card->clk_scaling_highest,
|
mmc_clk_update_freq(host, host->card->clk_scaling_highest,
|
||||||
host->clk_scaling.state);
|
host->clk_scaling.state);
|
||||||
} else if (value) {
|
} else if (value) {
|
||||||
/* starting clock scaling, will restart in case started */
|
/* Unmask host capability and resume scaling */
|
||||||
host->caps2 |= MMC_CAP2_CLK_SCALE;
|
host->caps2 |= MMC_CAP2_CLK_SCALE;
|
||||||
if (host->clk_scaling.enable)
|
if (!host->clk_scaling.enable)
|
||||||
mmc_exit_clk_scaling(host);
|
mmc_resume_clk_scaling(host);
|
||||||
mmc_init_clk_scaling(host);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mmc_put_card(host->card);
|
mmc_put_card(host->card);
|
||||||
|
|
Loading…
Add table
Reference in a new issue