[PATCH 0/2] OMAP clock: implement clock rate/parent change notifiers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

This series allows core code and driver code to register for
notification when a clock's rate or parent changes.  This is currently
used by driver code that must be notified whenever power management
code (e.g., CPUFreq) causes system rate changes that affect the driver's
clock.

There are three notifier messages: 

1. a pre-change notifier, called before the change; 

2. a post-change notifier, called after the change; and

3. an abort notifier, called if the change fails for any reason after
   the pre-change notifier callbacks have run.

Since the implementation uses a blocking notifier, notifier code may
block waiting for devices to quiesce; but long delays here will reduce
the effectiveness of DVFS.  Since notifier callbacks are called with
clocks_mutex held, callback code must not re-enter the clock framework.

Pre-change notifiers are passed the current clock rate and the desired
clock rate, so drivers can adjust any internal dividers appropriately.
(To minimize performance and memory usage impact, post-change
notifiers are passed only the desired clock rate, i.e., the clock rate
after the rate change.)  The notifiers are called even if the clock
rate is the same before and after the change.  This is because
reprogramming a clock's parent or rate may briefly disrupt the clock.

The interface to the notifiers is via:

int clk_notifier_register(struct clk *clk, struct notifier_block *nb);
int clk_notifier_unregister(struct clk *clk, struct notifier_block *nb);

Until prototypes for these functions are made available in
include/linux/clk.h, drivers should pass function pointers to
clk_notifier_register() and clk_notifier_unregister() via their
platform_data struct.

This series is a collaboration between Tero Kristo
<tero.kristo@xxxxxxxxx> and Paul Walmsley <paul@xxxxxxxxx> and several
others. Hiroshi Doyu <Hiroshi.DOYU@xxxxxxxxx> tracked down and fixed a
bug where blocking_notifier_chain_*() were called while interrupts
were disabled.  Nishanth Menon <nm@xxxxxx> found and fixed a bug in
the clk_notifier_unregister() path, where a list_del() was missing.
And thanks to Jouni Högander <jouni.hogander@xxxxxxxxx> for comments
and review during the evolution of these patches.

Registration and callbacks on rate change and parent change tested on
BeagleBoard (OMAP3530 ES2.1).

Comments welcomed.

---

   text    data     bss     dec     hex filename
3439981  175136  111800 3726917  38de45 vmlinux.beagle.orig
3441545  176000  111800 3729345  38e7c1 vmlinux.beagle


 arch/arm/mach-omap2/clock.c             |   30 ++++
 arch/arm/mach-omap2/clock.h             |    1 
 arch/arm/mach-omap2/clock24xx.c         |    1 
 arch/arm/mach-omap2/clock34xx.c         |    1 
 arch/arm/plat-omap/clock.c              |  256 +++++++++++++++++++++++++++++++
 arch/arm/plat-omap/include/mach/clock.h |   68 ++++++++
 6 files changed, 357 insertions(+), 0 deletions(-)


--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux