Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 34540b28 authored by Venkat Gopalakrishnan's avatar Venkat Gopalakrishnan
Browse files

mmc: host: Set max frequency when disabling clock scaling



The mmc host needs to perform at its peak when clock scaling
is disabled, hence switch the frequency to max.

CRs-fixed: 981387
Change-Id: Ie959b8e565ee2dad53cdd9d913bcb8696519d7ca
Signed-off-by: default avatarVenkat Gopalakrishnan <venkatg@codeaurora.org>
parent 67928fab
Loading
Loading
Loading
Loading
+9 −4
Original line number Diff line number Diff line
@@ -566,11 +566,16 @@ static ssize_t store_enable(struct device *dev,
	if (!host || kstrtoul(buf, 0, &value))
		return -EINVAL;

	mmc_claim_host(host);
	if (!value && host->clk_scaling.enable) {
		/*turnning off clock scaling*/
	mmc_get_card(host->card);

	if (!value) {
		/*turning off clock scaling*/
		mmc_exit_clk_scaling(host);
		host->caps2 &= ~MMC_CAP2_CLK_SCALE;
		host->clk_scaling.state = MMC_LOAD_HIGH;
		/* Set to max. frequency when disabling */
		mmc_clk_update_freq(host, host->card->clk_scaling_highest,
					host->clk_scaling.state);
	} else if (value) {
		/* starting clock scaling, will restart in case started */
		host->caps2 |= MMC_CAP2_CLK_SCALE;
@@ -579,7 +584,7 @@ static ssize_t store_enable(struct device *dev,
		mmc_init_clk_scaling(host);
	}

	mmc_release_host(host);
	mmc_put_card(host->card);

	return count;
}