mmc: msm_sdcc: adapt sdcc driver to new clock apis
Turning on/off a clock involves a lot of steps. Depending on the clock and
its state, the steps to turn it on/off might involve sending the request
to RPM, changing voltages, enabling the source PLLs, register writes, etc.
Some of these steps take a lot of time and the some of them are really
fast.
The current APIs (clk_enable/disable()) have the requirement that they be
callable from atomic context to allow clocks to be turned on in any
situation (IRQ handlers, inside spinlocks, etc).
While this allows for a very simple API for users of clocks, it has the
negative impact of forcing the clock driver to do the slow steps of
turning on/off a clock with spinlocks held and busy waiting for
them to finish.
By splitting, these steps into the 4 new APIs
(clk_prepare/clk_enable & clk_disable/clk_unprepare)
instead of the 2 current APIs, it allows the clock driver to perform
the slow steps with a mutex lock held and removes the need to busy
wait for the slow steps to finish.
clk_prepare - might sleep
clk_enable - can be called from atomic context
clk_unprepare - might sleep
clk_disable - can be called from atomic context
clk_set_rate - might sleep
This change ensures:
1. The older clock APIs are replaced by the new
clock APIs.
clk_enable replaced by
clk_prepare_enable
clk_disable replaced by
clk_disable_unprepare
2. No clock APIs are invoked in atomic context.
CRs-Fixed: 349546
Change-Id: Ibfa63e46809d64bfa8ea470aa1103d784619b1c7
Signed-off-by: Asutosh Das <asutoshd@codeaurora.org>
diff --git a/drivers/mmc/host/msm_sdcc.h b/drivers/mmc/host/msm_sdcc.h
index 832e437..406af4f 100644
--- a/drivers/mmc/host/msm_sdcc.h
+++ b/drivers/mmc/host/msm_sdcc.h
@@ -399,6 +399,7 @@
bool sdcc_irq_disabled;
bool sdcc_suspended;
bool sdio_wakeupirq_disabled;
+ struct mutex clk_mutex;
};
int msmsdcc_set_pwrsave(struct mmc_host *mmc, int pwrsave);