Commit f5298c3e authored by Asutosh Das's avatar Asutosh Das
Browse files

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: default avatarAsutosh Das <asutoshd@codeaurora.org>
parent 12f4b0b6
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment