1 Feb 2011 11:54
Re: Locking in the clk API, part 2: clk_prepare/clk_unprepare
Uwe Kleine-König <u.kleine-koenig <at> pengutronix.de>
2011-02-01 10:54:49 GMT
2011-02-01 10:54:49 GMT
Hello Jeremy, On Tue, Feb 01, 2011 at 05:11:29PM +0800, Jeremy Kerr wrote: > > I suggested that clk_prepare() be callable only from non-atomic contexts, > > and do whatever's required to ensure that the clock is available. That > > may end up enabling the clock as a result. > > I think that clk_prepare/clk_unprepare looks like the most promising solution, > so will try to get some preliminary patches done. Here's what I'm planning: > > ----- > > The changes to the API are essentially: > > 1) Document clk_enable/clk_disable as callable from atomic contexts, and > so clock implementations must not sleep within this function. > > 2) For clock implementations that may sleep to turn on a clock, we add a > new pair of functions to the clock API: clk_prepare and clk_unprepare. > > These will provide hooks for the clock implmentation to do any sleepable > work (eg, wait for PLLs to settle) in preparation for a later clk_enable. > > For the most common clock implemntation cases (where clocks can be enabled > atomically), these functions will be a no-op, and all of the enable/disable > work can be done in clk_enable/clk_disable. > > For implementations where clocks require blocking on enable/disable, most > of the work will be done in clk_prepare/clk_unprepare. The clk_enable > and clk_disable functions may be no-ops.(Continue reading)
RSS Feed