mirror of
https://github.com/torvalds/linux.git
synced 2024-11-16 09:02:00 +00:00
OMAP: clock: Add allow_idle/deny_idle support in clkops
On OMAP various clock nodes (dpll's, mx post dividers, interface clocks) support hardware level autogating which can be controlled from software. Support such functionality by adding two new function pointer allow_idle and deny_idle in the clkops structure. These function pointers can be populated for any clock node which supports hardware level autogating. Also add 2 new functions (omap_clk_enable_autoidle_all and omap_clk_disable_autoidle_all) which can be called from architecture specific PM core code, if hardware level autogating (for all supported clock nodes) is to be enabled or disabled. Signed-off-by: Rajendra Nayak <rnayak@ti.com> [paul@pwsan.com: use spinlock rather than mutex due to race; renamed functions; functions now return ints] Signed-off-by: Paul Walmsley <paul@pwsan.com>
This commit is contained in:
parent
5a2926b880
commit
58e846fe78
@ -335,6 +335,38 @@ struct clk *omap_clk_get_by_name(const char *name)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int omap_clk_enable_autoidle_all(void)
|
||||
{
|
||||
struct clk *c;
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(&clockfw_lock, flags);
|
||||
|
||||
list_for_each_entry(c, &clocks, node)
|
||||
if (c->ops->allow_idle)
|
||||
c->ops->allow_idle(c);
|
||||
|
||||
spin_unlock_irqrestore(&clockfw_lock, flags);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int omap_clk_disable_autoidle_all(void)
|
||||
{
|
||||
struct clk *c;
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(&clockfw_lock, flags);
|
||||
|
||||
list_for_each_entry(c, &clocks, node)
|
||||
if (c->ops->deny_idle)
|
||||
c->ops->deny_idle(c);
|
||||
|
||||
spin_unlock_irqrestore(&clockfw_lock, flags);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Low level helpers
|
||||
*/
|
||||
|
@ -25,6 +25,8 @@ struct clockdomain;
|
||||
* @disable: fn ptr that enables the current clock in hardware
|
||||
* @find_idlest: function returning the IDLEST register for the clock's IP blk
|
||||
* @find_companion: function returning the "companion" clk reg for the clock
|
||||
* @allow_idle: fn ptr that enables autoidle for the current clock in hardware
|
||||
* @deny_idle: fn ptr that disables autoidle for the current clock in hardware
|
||||
*
|
||||
* A "companion" clk is an accompanying clock to the one being queried
|
||||
* that must be enabled for the IP module connected to the clock to
|
||||
@ -42,6 +44,8 @@ struct clkops {
|
||||
u8 *, u8 *);
|
||||
void (*find_companion)(struct clk *, void __iomem **,
|
||||
u8 *);
|
||||
void (*allow_idle)(struct clk *);
|
||||
void (*deny_idle)(struct clk *);
|
||||
};
|
||||
|
||||
#ifdef CONFIG_ARCH_OMAP2PLUS
|
||||
@ -293,6 +297,8 @@ extern void clk_init_cpufreq_table(struct cpufreq_frequency_table **table);
|
||||
extern void clk_exit_cpufreq_table(struct cpufreq_frequency_table **table);
|
||||
#endif
|
||||
extern struct clk *omap_clk_get_by_name(const char *name);
|
||||
extern int omap_clk_enable_autoidle_all(void);
|
||||
extern int omap_clk_disable_autoidle_all(void);
|
||||
|
||||
extern const struct clkops clkops_null;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user