* [PATCH 0/2] Add clock post-rate-change notifier
@ 2008-06-20 23:13 Paul Walmsley
2008-06-20 23:13 ` [PATCH 1/2] add common post-rate-change notifier code Paul Walmsley
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: Paul Walmsley @ 2008-06-20 23:13 UTC (permalink / raw)
To: linux-omap
This series adds a clock rate change notifier to the OMAP clock
framework. Currently only post-rate-change notification is
implemented, although pre-rate-change notification is in the works.
Clock post-rate-change notifiers are intended for drivers that need to
be notified when other code (such as power management code) changes
their clock's rate. DSPBridge is apparently one such user, but
drivers for UART, MCSPI, etc. are also candidates for these notifiers.
Drivers should use these notifiers by adding function pointers for
clk_notifier_register() and clk_notifier_unregister() to their
platform_data structure. Ensure that the function pointers are not
NULL before calling, since non-OMAP platforms may not support this
notifier:
if (pdata->clk_notifier_register)
(*pdata->clk_notifier_register)(clk, &test_nb);
The callback code must not call back into the clock framework nor
sleep, as the clock framework spinlock is held for the duration of the
callbacks. Callback functions should be short and lightweight.
...
A few implementation notes. Upon request, an alternate design was
also investigated based on the existing CPUFreq notifiers. That
design was set aside, due to the following problems:
- CPUFreq notifier callbacks can sleep. This will break the clock
framework, since it calls the notifier inside a spinlock.
- Identifying the changed clock from the callback would require a new
platform_data-based function in the clock framework, since struct
cpufreq_freqs has no good way to pass it.
- CPUFreq notifiers depend on CPUFreq, which not everyone uses.
There was also some concern expressed that separate CPUFreq notifiers
and clk rate notifiers could race. (That would only apply to the
clocks that are changed by CPUFreq, and any clocks downstream from
it.) This doesn't appear to be a problem in practice, since CPUFreq
post-rate notifiers can only start after the clk post-rate notifiers
have completed and exited the clock framework.
The current implementation has been moderately tested with multiple
clock notifiers on both DPLLs and a downstream clock on 3430SDP. Also
compile-tested for N800.
- Paul
text data bss dec hex filename
3404721 158888 108176 3671785 3806e9 vmlinux.3430sdp.orig
3405361 158896 108176 3672433 380971 vmlinux.3430sdp.patched
arch/arm/mach-omap2/clock.c | 37 ++++++++--
arch/arm/mach-omap2/clock24xx.c | 42 ++++++++++-
arch/arm/mach-omap2/clock34xx.c | 10 +++
arch/arm/plat-omap/clock.c | 144 +++++++++++++++++++++++++++++++++++++
include/asm-arm/arch-omap/clock.h | 21 +++++
5 files changed, 246 insertions(+), 8 deletions(-)
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/2] add common post-rate-change notifier code
2008-06-20 23:13 [PATCH 0/2] Add clock post-rate-change notifier Paul Walmsley
@ 2008-06-20 23:13 ` Paul Walmsley
2008-06-20 23:14 ` [PATCH 2/2] implement clock dynamic notifier array Paul Walmsley
` (2 subsequent siblings)
3 siblings, 0 replies; 7+ messages in thread
From: Paul Walmsley @ 2008-06-20 23:13 UTC (permalink / raw)
To: linux-omap
Add the infrastructure necessary to support clock post-rate-change notifiers
in the OMAP clock framework. This includes:
- adding the clk_notify_post_rate_chg() function, which will trigger a
notifier call chain when a clock rate is changed (but which currently
does nothing); and
- adding calls to clk_notify_post_rate_chg() everywhere clk->rate is
assigned (mostly *_recalc() functions).
This patch has no functional effect by itself; the actual notifier
implementation follows in a separate patch.
One item to note is that the post-rate-change notifier is called even
if the new clock rate is identical to the old rate. This is because
the process of changing the rate may have temporarily disabled or
glitched the clock or one of its parents, and some devices may be
sensitive to such changes.
Signed-off-by: Paul Walmsley <paul@pwsan.com>
---
arch/arm/mach-omap2/clock.c | 37 +++++++++++++++++++++++++++------
arch/arm/mach-omap2/clock24xx.c | 42 +++++++++++++++++++++++++++++++++++--
arch/arm/mach-omap2/clock34xx.c | 10 +++++++++
arch/arm/plat-omap/clock.c | 32 ++++++++++++++++++++++++++++
include/asm-arm/arch-omap/clock.h | 21 +++++++++++++++++++
5 files changed, 134 insertions(+), 8 deletions(-)
diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c
index ed15868..bd3c1f8 100644
--- a/arch/arm/mach-omap2/clock.c
+++ b/arch/arm/mach-omap2/clock.c
@@ -165,10 +165,15 @@ u32 omap2_get_dpll_rate(struct clk *clk)
*/
void omap2_fixed_divisor_recalc(struct clk *clk)
{
+ unsigned long orig_rate;
+
WARN_ON(!clk->fixed_div);
+ orig_rate = clk->rate;
clk->rate = clk->parent->rate / clk->fixed_div;
+ clk_notify_post_rate_chg(clk, orig_rate, clk->rate);
+
if (clk->flags & RATE_PROPAGATES)
propagate_rate(clk);
}
@@ -376,6 +381,7 @@ int omap2_clk_enable(struct clk *clk)
void omap2_clksel_recalc(struct clk *clk)
{
u32 div = 0;
+ unsigned long orig_rate;
pr_debug("clock: recalc'ing clksel clk %s\n", clk->name);
@@ -385,10 +391,13 @@ void omap2_clksel_recalc(struct clk *clk)
if (clk->rate == (clk->parent->rate / div))
return;
+ orig_rate = clk->rate;
clk->rate = clk->parent->rate / div;
pr_debug("clock: new clock rate is %ld (div %d)\n", clk->rate, div);
+ clk_notify_post_rate_chg(clk, orig_rate, clk->rate);
+
if (clk->flags & RATE_PROPAGATES)
propagate_rate(clk);
}
@@ -662,6 +671,8 @@ int omap2_clksel_set_rate(struct clk *clk, unsigned long rate)
wmb();
}
+ /* post-rate-change notifier will be called by omap2_clk_set_rate() */
+
return 0;
}
@@ -670,20 +681,30 @@ int omap2_clksel_set_rate(struct clk *clk, unsigned long rate)
int omap2_clk_set_rate(struct clk *clk, unsigned long rate)
{
int ret = -EINVAL;
-
- pr_debug("clock: set_rate for clock %s to rate %ld\n", clk->name, rate);
+ unsigned long orig_rate;
/* CONFIG_PARTICIPANT clocks are changed only in sets via the
rate table mechanism, driven by mpu_speed */
if (clk->flags & CONFIG_PARTICIPANT)
return -EINVAL;
+ if (!clk->set_rate)
+ return -EINVAL;
+
+ orig_rate = clk->rate;
+
+ pr_debug("clock: set_rate for clock %s from %ld Hz to %ld Hz\n",
+ clk->name, orig_rate, rate);
+
/* dpll_ck, core_ck, virt_prcm_set; plus all clksel clocks */
- if (clk->set_rate)
- ret = clk->set_rate(clk, rate);
+ ret = clk->set_rate(clk, rate);
- if (ret == 0 && (clk->flags & RATE_PROPAGATES))
- propagate_rate(clk);
+ if (ret == 0) {
+ clk_notify_post_rate_chg(clk, orig_rate, rate);
+
+ if (clk->flags & RATE_PROPAGATES)
+ propagate_rate(clk);
+ }
return ret;
}
@@ -732,6 +753,7 @@ int omap2_clk_set_parent(struct clk *clk, struct clk *new_parent)
{
void __iomem *src_addr;
u32 field_val, field_mask, reg_val, parent_div;
+ unsigned long orig_rate;
if (clk->flags & CONFIG_PARTICIPANT)
return -EINVAL;
@@ -765,11 +787,14 @@ int omap2_clk_set_parent(struct clk *clk, struct clk *new_parent)
clk->parent = new_parent;
/* CLKSEL clocks follow their parents' rates, divided by a divisor */
+ orig_rate = clk->rate;
clk->rate = new_parent->rate;
if (parent_div > 0)
clk->rate /= parent_div;
+ clk_notify_post_rate_chg(clk, orig_rate, clk->rate);
+
pr_debug("clock: set parent of %s to %s (new rate %ld)\n",
clk->name, clk->parent->name, clk->rate);
diff --git a/arch/arm/mach-omap2/clock24xx.c b/arch/arm/mach-omap2/clock24xx.c
index 54cc6e1..e001549 100644
--- a/arch/arm/mach-omap2/clock24xx.c
+++ b/arch/arm/mach-omap2/clock24xx.c
@@ -172,11 +172,22 @@ static long omap2_dpllcore_round_rate(unsigned long target_rate)
static void omap2_dpllcore_recalc(struct clk *clk)
{
+ unsigned long orig_rate;
+
+ orig_rate = clk->rate;
clk->rate = omap2_get_dpll_rate_24xx(clk);
+ clk_notify_post_rate_chg(clk, orig_rate, clk->rate);
+
propagate_rate(clk);
}
+/*
+ * XXX REVISIT: This code needs to keep track of the underlying struct
+ * clocks that it is changing, so it can call post-rate-change notifiers
+ * on them. This function probably should be rewritten to use the clock
+ * fw.
+ */
static int omap2_reprogram_dpllcore(struct clk *clk, unsigned long rate)
{
u32 cur_rate, low, mult, div, valid_rate, done_rate;
@@ -259,7 +270,14 @@ dpll_exit:
*/
static void omap2_table_mpu_recalc(struct clk *clk)
{
+ unsigned long orig_rate;
+
+ orig_rate = clk->rate;
clk->rate = curr_prcm_set->mpu_speed;
+
+ clk_notify_post_rate_chg(clk, orig_rate, clk->rate);
+
+ /* No rate propagation since table clocks have no children */
}
/*
@@ -294,7 +312,14 @@ static long omap2_round_to_table_rate(struct clk *clk, unsigned long rate)
return highest_rate;
}
-/* Sets basic clocks based on the specified rate */
+/*
+ * Sets basic clocks based on the specified rate
+ *
+ * XXX REVISIT: This code needs to keep track of the underlying struct
+ * clocks that it is changing, so it can call post-rate-change notifiers
+ * on them. This function probably should be rewritten to use the clock
+ * fw.
+ */
static int omap2_select_table_rate(struct clk *clk, unsigned long rate)
{
u32 cur_rate, done_rate, bypass = 0, tmp;
@@ -353,7 +378,8 @@ static int omap2_select_table_rate(struct clk *clk, unsigned long rate)
cm_write_mod_reg(prcm->cm_clksel_gfx, GFX_MOD, CM_CLKSEL);
/* Major subsystem dividers */
- tmp = cm_read_mod_reg(CORE_MOD, CM_CLKSEL1) & OMAP24XX_CLKSEL_DSS2_MASK;
+ tmp = cm_read_mod_reg(CORE_MOD, CM_CLKSEL1) &
+ OMAP24XX_CLKSEL_DSS2_MASK;
cm_write_mod_reg(prcm->cm_clksel1_core | tmp, CORE_MOD,
CM_CLKSEL1);
@@ -460,13 +486,25 @@ static u32 omap2_get_sysclkdiv(void)
static void omap2_osc_clk_recalc(struct clk *clk)
{
+ unsigned long orig_rate;
+
+ orig_rate = clk->rate;
clk->rate = omap2_get_apll_clkin() * omap2_get_sysclkdiv();
+
+ clk_notify_post_rate_chg(clk, orig_rate, clk->rate);
+
propagate_rate(clk);
}
static void omap2_sys_clk_recalc(struct clk *clk)
{
+ unsigned long orig_rate;
+
+ orig_rate = clk->rate;
clk->rate = clk->parent->rate / omap2_get_sysclkdiv();
+
+ clk_notify_post_rate_chg(clk, orig_rate, clk->rate);
+
propagate_rate(clk);
}
diff --git a/arch/arm/mach-omap2/clock34xx.c b/arch/arm/mach-omap2/clock34xx.c
index 408b51a..7b89b61 100644
--- a/arch/arm/mach-omap2/clock34xx.c
+++ b/arch/arm/mach-omap2/clock34xx.c
@@ -53,8 +53,13 @@
*/
static void omap3_dpll_recalc(struct clk *clk)
{
+ unsigned long orig_rate;
+
+ orig_rate = clk->rate;
clk->rate = omap2_get_dpll_rate(clk);
+ clk_notify_post_rate_chg(clk, orig_rate, clk->rate);
+
propagate_rate(clk);
}
@@ -500,6 +505,7 @@ static void omap3_clkoutx2_recalc(struct clk *clk)
const struct dpll_data *dd;
u32 v;
struct clk *pclk;
+ unsigned long orig_rate;
/* Walk up the parents of clk, looking for a DPLL */
pclk = clk->parent;
@@ -513,6 +519,8 @@ static void omap3_clkoutx2_recalc(struct clk *clk)
WARN_ON(!dd->control_reg || !dd->enable_mask);
+ orig_rate = clk->rate;
+
v = __raw_readl(dd->control_reg) & dd->enable_mask;
v >>= __ffs(dd->enable_mask);
if (v != DPLL_LOCKED)
@@ -520,6 +528,8 @@ static void omap3_clkoutx2_recalc(struct clk *clk)
else
clk->rate = clk->parent->rate * 2;
+ clk_notify_post_rate_chg(clk, orig_rate, clk->rate);
+
if (clk->flags & RATE_PROPAGATES)
propagate_rate(clk);
}
diff --git a/arch/arm/plat-omap/clock.c b/arch/arm/plat-omap/clock.c
index c2e741d..421d076 100644
--- a/arch/arm/plat-omap/clock.c
+++ b/arch/arm/plat-omap/clock.c
@@ -254,10 +254,16 @@ __setup("mpurate=", omap_clk_setup);
/* Used for clocks that always have same value as the parent clock */
void followparent_recalc(struct clk *clk)
{
+ unsigned long orig_rate;
+
if (clk == NULL || IS_ERR(clk))
return;
+ orig_rate = clk->rate;
clk->rate = clk->parent->rate;
+
+ clk_notify_post_rate_chg(clk, orig_rate, clk->rate);
+
if (unlikely(clk->flags & RATE_PROPAGATES))
propagate_rate(clk);
}
@@ -373,6 +379,32 @@ void clk_init_cpufreq_table(struct cpufreq_frequency_table **table)
EXPORT_SYMBOL(clk_init_cpufreq_table);
#endif
+/**
+ * clk_notify_post_rate_chg - call post-clk-rate-change notifier chain
+ * @clk: struct clk * that is changing rate
+ * @old_rate: old rate
+ * @new_rate: new rate
+ *
+ * Triggers a notifier call chain on the post-clk-rate-change notifier
+ * for clock 'clk'. Passes a pointer to the struct clk and the
+ * previous and current rates to the notifier callback. Intended to be
+ * called by internal clock code only. No return value.
+ */
+void clk_notify_post_rate_chg(struct clk *clk, unsigned long old_rate,
+ unsigned long new_rate)
+{
+ struct clk_notifier *cn;
+ struct clk_notifier_data cnd;
+
+ cnd.clk = clk;
+ cnd.old_rate = old_rate;
+ cnd.new_rate = new_rate;
+
+ /* XXX Call notifier here */
+
+}
+
+
/*-------------------------------------------------------------------------*/
#ifdef CONFIG_OMAP_RESET_CLOCKS
diff --git a/include/asm-arm/arch-omap/clock.h b/include/asm-arm/arch-omap/clock.h
index bfaf7b6..e3c9aeb 100644
--- a/include/asm-arm/arch-omap/clock.h
+++ b/include/asm-arm/arch-omap/clock.h
@@ -10,6 +10,8 @@
* published by the Free Software Foundation.
*/
+#include <linux/notifier.h>
+
#ifndef __ARCH_ARM_OMAP_CLOCK_H
#define __ARCH_ARM_OMAP_CLOCK_H
@@ -58,6 +60,19 @@ struct dpll_data {
#endif
+struct clk_notifier {
+ struct clk *clk;
+ struct atomic_notifier_head notifier_head;
+ struct list_head node;
+};
+
+struct clk_notifier_data {
+ struct clk *clk;
+ unsigned long old_rate;
+ unsigned long new_rate;
+};
+
+
struct clk {
struct list_head node;
struct module *owner;
@@ -121,6 +136,10 @@ extern void clk_allow_idle(struct clk *clk);
extern void clk_deny_idle(struct clk *clk);
extern int clk_get_usecount(struct clk *clk);
extern void clk_enable_init_clocks(void);
+extern int clk_notifier_register(struct clk *clk, struct notifier_block *nb);
+extern int clk_notifier_unregister(struct clk *clk, struct notifier_block *nb);
+extern void clk_notify_post_rate_chg(struct clk *clk, unsigned long old_rate,
+ unsigned long new_rate);
#ifdef CONFIG_CPU_FREQ
extern void clk_init_cpufreq_table(struct cpufreq_frequency_table **table);
#endif
@@ -161,6 +180,8 @@ extern void clk_init_cpufreq_table(struct cpufreq_frequency_table **table);
#define RATE_IN_24XX (RATE_IN_242X | RATE_IN_243X)
+/* Clk rate change notifier callback type */
+#define CLK_POST_RATE_CHANGE 1
/* CM_CLKSEL2_PLL.CORE_CLK_SRC options (24XX) */
#define CORE_CLK_SRC_32K 0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/2] implement clock dynamic notifier array
2008-06-20 23:13 [PATCH 0/2] Add clock post-rate-change notifier Paul Walmsley
2008-06-20 23:13 ` [PATCH 1/2] add common post-rate-change notifier code Paul Walmsley
@ 2008-06-20 23:14 ` Paul Walmsley
2008-06-26 13:52 ` [PATCH 0/2] Add clock post-rate-change notifier Tony Lindgren
2008-07-21 10:49 ` Rajendra Nayak
3 siblings, 0 replies; 7+ messages in thread
From: Paul Walmsley @ 2008-06-20 23:14 UTC (permalink / raw)
To: linux-omap
This patch implements the remaining code for notification of clock
rate changes via the clock framework:
- a notifier registration function, clk_notifier_register()
- a notifier unregistration function, clk_notifier_unregister()
- the clk_notify_post_rate_chg() call-chain function, has been fleshed out
The implementation is via an atomic notifier, called with the clockfw
spinlock held. Callback functions must not sleep and must not re-enter
the clock framework, and should execute quickly.
In the medium-term future, there are likely to be few users of these
notifiers. So, rather than storing one notifier per struct clk,
notifiers are stored in a separate, dynamically allocated list,
effectively trading execution speed (in terms of a sequential scan of
the notifier list) for memory savings. The implementation is
completely hidden from the callbacks and is easily changed if
necessary.
Signed-off-by: Paul Walmsley <paul@pwsan.com>
---
arch/arm/plat-omap/clock.c | 118 +++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 115 insertions(+), 3 deletions(-)
diff --git a/arch/arm/plat-omap/clock.c b/arch/arm/plat-omap/clock.c
index 421d076..354f45f 100644
--- a/arch/arm/plat-omap/clock.c
+++ b/arch/arm/plat-omap/clock.c
@@ -22,6 +22,7 @@
#include <linux/mutex.h>
#include <linux/platform_device.h>
#include <linux/cpufreq.h>
+#include <linux/notifier.h>
#include <linux/debugfs.h>
#include <asm/io.h>
@@ -34,6 +35,8 @@ static DEFINE_SPINLOCK(clockfw_lock);
static struct clk_functions *arch_clock;
+static LIST_HEAD(clk_notifier_list);
+
/*-------------------------------------------------------------------------
* Standard clock functions defined in include/linux/clk.h
*-------------------------------------------------------------------------*/
@@ -380,6 +383,110 @@ EXPORT_SYMBOL(clk_init_cpufreq_table);
#endif
/**
+<<<<<<< current:arch/arm/plat-omap/clock.c
+=======
+ * clk_notifier_register - add a clock rate change notifier
+ * @clk: struct clk * to watch for rate echanges
+ * @nb: struct notifier_block * with callback info
+ *
+ * Request notification after a frequency change on clock 'clk'. This
+ * uses an atomic notifier. The callback will be called with
+ * interrupts disabled; therefore callback code should be very
+ * lightweight. Callback code must not call back into the clock
+ * framework. Callback code will be passed the previous and new rate
+ * of the clock.
+ *
+ * clk_notifier_register() must be called from process
+ * context. Returns -EINVAL if called with null arguments, -ENOMEM
+ * upon allocation failure; otherwise, passes along the return value
+ * of atomic_notifier_chain_register().
+ */
+int clk_notifier_register(struct clk *clk, struct notifier_block *nb)
+{
+ struct clk_notifier *cn = NULL, *cn_new = NULL;
+ int r;
+ unsigned long flags;
+
+ if (!clk || !nb)
+ return -EINVAL;
+
+ /* Allocate this here speculatively so we can avoid GFP_ATOMIC */
+ cn_new = kzalloc(sizeof(struct clk_notifier), GFP_KERNEL);
+ if (!cn_new)
+ return -ENOMEM;
+
+ spin_lock_irqsave(&clockfw_lock, flags);
+
+ list_for_each_entry(cn, &clk_notifier_list, node) {
+ if (cn->clk == clk)
+ break;
+ }
+
+ if (cn->clk != clk) {
+ cn_new->clk = clk;
+ ATOMIC_INIT_NOTIFIER_HEAD(&cn_new->notifier_head);
+
+ list_add(&cn_new->node, &clk_notifier_list);
+ cn = cn_new;
+ } else {
+ kfree(cn_new); /* didn't need it after all */
+ }
+
+ r = atomic_notifier_chain_register(&cn->notifier_head, nb);
+
+ spin_unlock_irqrestore(&clockfw_lock, flags);
+
+ return r;
+}
+
+/**
+ * clk_notifier_unregister - remove a clock rate change notifier
+ * @clk: struct clk *
+ * @nb: struct notifier_block * with callback info
+ *
+ * Request no further notification for frequency changes on clock
+ * 'clk'. This function presently does not release memory allocated
+ * by its corresponding _register function; see inline comments for
+ * more informations. Returns -EINVAL if called with null arguments;
+ * otherwise, passes along the return value of
+ * atomic_notifier_chain_unregister().
+ */
+int clk_notifier_unregister(struct clk *clk, struct notifier_block *nb)
+{
+ struct clk_notifier *cn = NULL;
+ int r = -EINVAL;
+ unsigned long flags;
+
+ if (!clk || !nb)
+ return -EINVAL;
+
+ spin_lock_irqsave(&clockfw_lock, flags);
+
+ list_for_each_entry(cn, &clk_notifier_list, node) {
+ if (cn->clk == clk)
+ break;
+ }
+
+ if (cn->clk == clk) {
+ r = atomic_notifier_chain_unregister(&cn->notifier_head, nb);
+
+ /*
+ * XXX unfortunately it seems that there is no polite
+ * way to test if a notifier has zero users. So once
+ * a post-notifier has been registered on a clock,
+ * that struct clk_notifier will not be freed, even if
+ * all of its users unregister.
+ */
+ } else {
+ r = -ENOENT;
+ }
+
+ spin_unlock_irqrestore(&clockfw_lock, flags);
+
+ return r;
+}
+
+/**
* clk_notify_post_rate_chg - call post-clk-rate-change notifier chain
* @clk: struct clk * that is changing rate
* @old_rate: old rate
@@ -400,11 +507,16 @@ void clk_notify_post_rate_chg(struct clk *clk, unsigned long old_rate,
cnd.old_rate = old_rate;
cnd.new_rate = new_rate;
- /* XXX Call notifier here */
-
+ list_for_each_entry(cn, &clk_notifier_list, node) {
+ if (cn->clk == clk) {
+ atomic_notifier_call_chain(&cn->notifier_head,
+ CLK_POST_RATE_CHANGE,
+ &cnd);
+ break;
+ }
+ }
}
-
/*-------------------------------------------------------------------------*/
#ifdef CONFIG_OMAP_RESET_CLOCKS
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 0/2] Add clock post-rate-change notifier
2008-06-20 23:13 [PATCH 0/2] Add clock post-rate-change notifier Paul Walmsley
2008-06-20 23:13 ` [PATCH 1/2] add common post-rate-change notifier code Paul Walmsley
2008-06-20 23:14 ` [PATCH 2/2] implement clock dynamic notifier array Paul Walmsley
@ 2008-06-26 13:52 ` Tony Lindgren
2008-07-21 10:49 ` Rajendra Nayak
3 siblings, 0 replies; 7+ messages in thread
From: Tony Lindgren @ 2008-06-26 13:52 UTC (permalink / raw)
To: Paul Walmsley; +Cc: linux-omap
* Paul Walmsley <paul@pwsan.com> [080621 02:16]:
>
> This series adds a clock rate change notifier to the OMAP clock
> framework. Currently only post-rate-change notification is
> implemented, although pre-rate-change notification is in the works.
>
> Clock post-rate-change notifiers are intended for drivers that need to
> be notified when other code (such as power management code) changes
> their clock's rate. DSPBridge is apparently one such user, but
> drivers for UART, MCSPI, etc. are also candidates for these notifiers.
>
> Drivers should use these notifiers by adding function pointers for
> clk_notifier_register() and clk_notifier_unregister() to their
> platform_data structure. Ensure that the function pointers are not
> NULL before calling, since non-OMAP platforms may not support this
> notifier:
>
> if (pdata->clk_notifier_register)
> (*pdata->clk_notifier_register)(clk, &test_nb);
>
> The callback code must not call back into the clock framework nor
> sleep, as the clock framework spinlock is held for the duration of the
> callbacks. Callback functions should be short and lightweight.
>
> ...
>
> A few implementation notes. Upon request, an alternate design was
> also investigated based on the existing CPUFreq notifiers. That
> design was set aside, due to the following problems:
>
> - CPUFreq notifier callbacks can sleep. This will break the clock
> framework, since it calls the notifier inside a spinlock.
>
> - Identifying the changed clock from the callback would require a new
> platform_data-based function in the clock framework, since struct
> cpufreq_freqs has no good way to pass it.
>
> - CPUFreq notifiers depend on CPUFreq, which not everyone uses.
>
> There was also some concern expressed that separate CPUFreq notifiers
> and clk rate notifiers could race. (That would only apply to the
> clocks that are changed by CPUFreq, and any clocks downstream from
> it.) This doesn't appear to be a problem in practice, since CPUFreq
> post-rate notifiers can only start after the clk post-rate notifiers
> have completed and exited the clock framework.
>
> The current implementation has been moderately tested with multiple
> clock notifiers on both DPLLs and a downstream clock on 3430SDP. Also
> compile-tested for N800.
Let's run these by linux-arm-kernel and linux-pm lists before we apply.
Tony
>
>
> - Paul
>
>
> text data bss dec hex filename
> 3404721 158888 108176 3671785 3806e9 vmlinux.3430sdp.orig
> 3405361 158896 108176 3672433 380971 vmlinux.3430sdp.patched
>
> arch/arm/mach-omap2/clock.c | 37 ++++++++--
> arch/arm/mach-omap2/clock24xx.c | 42 ++++++++++-
> arch/arm/mach-omap2/clock34xx.c | 10 +++
> arch/arm/plat-omap/clock.c | 144 +++++++++++++++++++++++++++++++++++++
> include/asm-arm/arch-omap/clock.h | 21 +++++
> 5 files changed, 246 insertions(+), 8 deletions(-)
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: [PATCH 0/2] Add clock post-rate-change notifier
2008-06-20 23:13 [PATCH 0/2] Add clock post-rate-change notifier Paul Walmsley
` (2 preceding siblings ...)
2008-06-26 13:52 ` [PATCH 0/2] Add clock post-rate-change notifier Tony Lindgren
@ 2008-07-21 10:49 ` Rajendra Nayak
2008-07-23 5:09 ` Paul Walmsley
2008-07-23 17:09 ` Koen Kooi
3 siblings, 2 replies; 7+ messages in thread
From: Rajendra Nayak @ 2008-07-21 10:49 UTC (permalink / raw)
To: 'Paul Walmsley', linux-omap
Hi Paul,
> -----Original Message-----
> From: linux-omap-owner@vger.kernel.org
> [mailto:linux-omap-owner@vger.kernel.org] On Behalf Of Paul Walmsley
> Sent: Saturday, June 21, 2008 4:44 AM
> To: linux-omap@vger.kernel.org
> Subject: [PATCH 0/2] Add clock post-rate-change notifier
>
>
> This series adds a clock rate change notifier to the OMAP clock
> framework. Currently only post-rate-change notification is
> implemented, although pre-rate-change notification is in the works.
Was there any patch set posted after this with pre-rate change notifications
support?
I am currently working on CPUFreq patches and CPUFreq requires a pre notification
to be able to update jiffies/BogoMips.
regards,
Rajendra
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: [PATCH 0/2] Add clock post-rate-change notifier
2008-07-21 10:49 ` Rajendra Nayak
@ 2008-07-23 5:09 ` Paul Walmsley
2008-07-23 17:09 ` Koen Kooi
1 sibling, 0 replies; 7+ messages in thread
From: Paul Walmsley @ 2008-07-23 5:09 UTC (permalink / raw)
To: Rajendra Nayak; +Cc: linux-omap
Hello Rajendra,
On Mon, 21 Jul 2008, Rajendra Nayak wrote:
> > -----Original Message-----
> > From: linux-omap-owner@vger.kernel.org
> > [mailto:linux-omap-owner@vger.kernel.org] On Behalf Of Paul Walmsley
> > Sent: Saturday, June 21, 2008 4:44 AM
> > To: linux-omap@vger.kernel.org
> > Subject: [PATCH 0/2] Add clock post-rate-change notifier
> >
> >
> > This series adds a clock rate change notifier to the OMAP clock
> > framework. Currently only post-rate-change notification is
> > implemented, although pre-rate-change notification is in the works.
>
> Was there any patch set posted after this with pre-rate change notifications
> support?
No, it isn't quite ready yet. Will try to prioritize it for your use.
But, see below...
> I am currently working on CPUFreq patches and CPUFreq requires a pre notification
> to be able to update jiffies/BogoMips.
Could you explain further what you're trying to do? For example, in the
interim, would it be possible to create a custom set_rate function for
mpu_ck that would call the existing CPUFreq pre-rate-change notifier?
- Paul
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 0/2] Add clock post-rate-change notifier
2008-07-21 10:49 ` Rajendra Nayak
2008-07-23 5:09 ` Paul Walmsley
@ 2008-07-23 17:09 ` Koen Kooi
1 sibling, 0 replies; 7+ messages in thread
From: Koen Kooi @ 2008-07-23 17:09 UTC (permalink / raw)
To: Rajendra Nayak; +Cc: linux-omap
[-- Attachment #1: Type: text/plain, Size: 1178 bytes --]
Op 21 jul 2008, om 12:49 heeft Rajendra Nayak het volgende geschreven:
> Hi Paul,
>
>> -----Original Message-----
>> From: linux-omap-owner@vger.kernel.org
>> [mailto:linux-omap-owner@vger.kernel.org] On Behalf Of Paul Walmsley
>> Sent: Saturday, June 21, 2008 4:44 AM
>> To: linux-omap@vger.kernel.org
>> Subject: [PATCH 0/2] Add clock post-rate-change notifier
>>
>>
>> This series adds a clock rate change notifier to the OMAP clock
>> framework. Currently only post-rate-change notification is
>> implemented, although pre-rate-change notification is in the works.
>
> Was there any patch set posted after this with pre-rate change
> notifications
> support?
>
> I am currently working on CPUFreq patches and CPUFreq requires a pre
> notification
> to be able to update jiffies/BogoMips.
Are your omap3 cpufreq patches available for testing? I'm very
interested in getting cpufreq running on the beagleboard.
regards,
Koen
>
>
> regards,
> Rajendra
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-
> omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 186 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2008-07-23 17:09 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-20 23:13 [PATCH 0/2] Add clock post-rate-change notifier Paul Walmsley
2008-06-20 23:13 ` [PATCH 1/2] add common post-rate-change notifier code Paul Walmsley
2008-06-20 23:14 ` [PATCH 2/2] implement clock dynamic notifier array Paul Walmsley
2008-06-26 13:52 ` [PATCH 0/2] Add clock post-rate-change notifier Tony Lindgren
2008-07-21 10:49 ` Rajendra Nayak
2008-07-23 5:09 ` Paul Walmsley
2008-07-23 17:09 ` Koen Kooi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox