From patchwork Mon Nov 12 23:00:07 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Walmsley X-Patchwork-Id: 12819 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id D9FD523E01 for ; Mon, 12 Nov 2012 23:00:09 +0000 (UTC) Received: from mail-ie0-f180.google.com (mail-ie0-f180.google.com [209.85.223.180]) by fiordland.canonical.com (Postfix) with ESMTP id 38011A1817D for ; Mon, 12 Nov 2012 23:00:09 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id e10so9492464iej.11 for ; Mon, 12 Nov 2012 15:00:08 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:date:from :to:cc:subject:in-reply-to:message-id:references:user-agent :mime-version:content-type:x-gm-message-state; bh=Tm/a5pOSIIwt87xCOwpJ1XhP/gaeNGVHmgI1sdNCIcs=; b=Gw5aLUN5Z8UwL8NthwbFnEgLwFnXY/TM+fHDzW95J29DG7BPkhXwdjpF0d8YSQZbAg AqqbBXkLypE8iKv57b4SxI+JhhI5bv5bu8kTpexXLFz8LY/ezcgg3pg1zYW7RL/3Z2MX jAsts+OZMBO1HtGJR3HMLxHa7bF9t/hGTQkVa2eg9F7pykv2lN882rfaQUMiD5pi2jHc vbJEWNFnqeXtahSOliclethsA6bOP8WixsM2HJSPKKhi5yUDCr9sU+qBr3FYbaNXhzkP iHsc0Zd1uoKLQ9HPFU9kuZ3YIcGHwt7KXPNVleIUsRq/r6pTpfvImPXOpICe33uR0Glk wtzw== Received: by 10.50.152.137 with SMTP id uy9mr9240697igb.62.1352761208610; Mon, 12 Nov 2012 15:00:08 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.67.148 with SMTP id n20csp435090igt; Mon, 12 Nov 2012 15:00:08 -0800 (PST) Received: by 10.50.155.162 with SMTP id vx2mr9251489igb.61.1352761208125; Mon, 12 Nov 2012 15:00:08 -0800 (PST) Received: from utopia.booyaka.com (utopia.booyaka.com. [74.50.51.50]) by mx.google.com with ESMTPS id xt1si10650963igb.64.2012.11.12.15.00.07 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 12 Nov 2012 15:00:08 -0800 (PST) Received-SPF: neutral (google.com: 74.50.51.50 is neither permitted nor denied by best guess record for domain of paul@pwsan.com) client-ip=74.50.51.50; Authentication-Results: mx.google.com; spf=neutral (google.com: 74.50.51.50 is neither permitted nor denied by best guess record for domain of paul@pwsan.com) smtp.mail=paul@pwsan.com Received: (qmail 3398 invoked by uid 1019); 12 Nov 2012 23:00:07 -0000 Date: Mon, 12 Nov 2012 23:00:07 +0000 (UTC) From: Paul Walmsley To: Mike Turquette cc: rnayak@ti.com, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, patches@linaro.org Subject: Re: [PATCH 07/26] ARM: OMAP: clock: list all clk_hw_omap clks to enable/disable autoidle In-Reply-To: <1352337181-29427-8-git-send-email-mturquette@ti.com> Message-ID: References: <1352337181-29427-1-git-send-email-mturquette@ti.com> <1352337181-29427-8-git-send-email-mturquette@ti.com> User-Agent: Alpine 2.00 (DEB 1167 2008-08-23) MIME-Version: 1.0 X-Gm-Message-State: ALoCoQluxFgj3UnvwPMHiCmVgEox8x6mD5QOAuNuW+R+ABBejIBXMOTCr+kXH0+054t4yBg6rfHw Added kerneldoc to the non-trivial new functions added by this patch, as is local policy. Updated patch below. - Paul From: Rajendra Nayak Date: Fri, 1 Jun 2012 14:02:49 +0530 Subject: [PATCH] ARM: OMAP: clock: list all clk_hw_omap clks to enable/disable autoidle Platforms can call omap2_init_clk_hw_omap_clocks() to register a clock using clk_hw_omap. omap2_clk_enable_autoidle_all() and omap2_clk_disable_autoidle_all() can then be used to run through all the clocks which support autoidle to enable/disable them. Signed-off-by: Rajendra Nayak Signed-off-by: Mike Turquette [paul@pwsan.com: added kerneldoc on non-trivial new functions] Signed-off-by: Paul Walmsley --- arch/arm/mach-omap2/clock.c | 59 +++++++++++++++++++++++++++++++++++++++++++ arch/arm/mach-omap2/clock.h | 3 +++ arch/arm/mach-omap2/io.c | 27 ++++++++++++++++++++ 3 files changed, 89 insertions(+) diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c index 72d7105..c64203e 100644 --- a/arch/arm/mach-omap2/clock.c +++ b/arch/arm/mach-omap2/clock.c @@ -66,6 +66,7 @@ static DEFINE_SPINLOCK(clockfw_lock); #endif #ifdef CONFIG_COMMON_CLK +static LIST_HEAD(clk_hw_omap_clocks); /* * Used for clocks that have the same value as the parent clock, @@ -521,6 +522,64 @@ static int __init omap_clk_setup(char *str) } __setup("mpurate=", omap_clk_setup); +/** + * omap2_init_clk_hw_omap_clocks - initialize an OMAP clock + * @clk: struct clk * to initialize + * + * Add an OMAP clock @clk to the internal list of OMAP clocks. Used + * temporarily for autoidle handling, until this support can be + * integrated into the common clock framework code in some way. No + * return value. + */ +void omap2_init_clk_hw_omap_clocks(struct clk *clk) +{ + struct clk_hw_omap *c; + + if (__clk_get_flags(clk) & CLK_IS_BASIC) + return; + + c = to_clk_hw_omap(__clk_get_hw(clk)); + list_add(&c->node, &clk_hw_omap_clocks); +} + +/** + * omap2_clk_enable_autoidle_all - enable autoidle on all OMAP clocks that + * support it + * + * Enable clock autoidle on all OMAP clocks that have allow_idle + * function pointers associated with them. This function is intended + * to be temporary until support for this is added to the common clock + * code. Returns 0. + */ +int omap2_clk_enable_autoidle_all(void) +{ + struct clk_hw_omap *c; + + list_for_each_entry(c, &clk_hw_omap_clocks, node) + if (c->ops && c->ops->allow_idle) + c->ops->allow_idle(c); + return 0; +} + +/** + * omap2_clk_disable_autoidle_all - disable autoidle on all OMAP clocks that + * support it + * + * Disable clock autoidle on all OMAP clocks that have allow_idle + * function pointers associated with them. This function is intended + * to be temporary until support for this is added to the common clock + * code. Returns 0. + */ +int omap2_clk_disable_autoidle_all(void) +{ + struct clk_hw_omap *c; + + list_for_each_entry(c, &clk_hw_omap_clocks, node) + if (c->ops && c->ops->deny_idle) + c->ops->deny_idle(c); + return 0; +} + const struct clk_hw_omap_ops clkhwops_wait = { .find_idlest = omap2_clk_dflt_find_idlest, .find_companion = omap2_clk_dflt_find_companion, diff --git a/arch/arm/mach-omap2/clock.h b/arch/arm/mach-omap2/clock.h index 6800d5f..20a3be7 100644 --- a/arch/arm/mach-omap2/clock.h +++ b/arch/arm/mach-omap2/clock.h @@ -535,6 +535,9 @@ void omap2_clk_dflt_find_companion(struct clk_hw_omap *clk, void omap2_clk_dflt_find_idlest(struct clk_hw_omap *clk, void __iomem **idlest_reg, u8 *idlest_bit, u8 *idlest_val); +void omap2_init_clk_hw_omap_clocks(struct clk *clk); +int omap2_clk_enable_autoidle_all(void); +int omap2_clk_disable_autoidle_all(void); #else int omap2_dflt_clk_enable(struct clk *clk); void omap2_dflt_clk_disable(struct clk *clk); diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c index c3472bd..41c6013 100644 --- a/arch/arm/mach-omap2/io.c +++ b/arch/arm/mach-omap2/io.c @@ -407,6 +407,9 @@ void __init omap2420_init_late(void) omap_mux_late_init(); omap2_common_pm_late_init(); omap2_pm_init(); +#ifdef CONFIG_COMMON_CLK + omap2_clk_enable_autoidle_all(); +#endif } #endif @@ -436,6 +439,9 @@ void __init omap2430_init_late(void) omap_mux_late_init(); omap2_common_pm_late_init(); omap2_pm_init(); +#ifdef CONFIG_COMMON_CLK + omap2_clk_enable_autoidle_all(); +#endif } #endif @@ -509,6 +515,9 @@ void __init omap3_init_late(void) omap_mux_late_init(); omap2_common_pm_late_init(); omap3_pm_init(); +#ifdef CONFIG_COMMON_CLK + omap2_clk_enable_autoidle_all(); +#endif } void __init omap3430_init_late(void) @@ -516,6 +525,9 @@ void __init omap3430_init_late(void) omap_mux_late_init(); omap2_common_pm_late_init(); omap3_pm_init(); +#ifdef CONFIG_COMMON_CLK + omap2_clk_enable_autoidle_all(); +#endif } void __init omap35xx_init_late(void) @@ -523,6 +535,9 @@ void __init omap35xx_init_late(void) omap_mux_late_init(); omap2_common_pm_late_init(); omap3_pm_init(); +#ifdef CONFIG_COMMON_CLK + omap2_clk_enable_autoidle_all(); +#endif } void __init omap3630_init_late(void) @@ -530,6 +545,9 @@ void __init omap3630_init_late(void) omap_mux_late_init(); omap2_common_pm_late_init(); omap3_pm_init(); +#ifdef CONFIG_COMMON_CLK + omap2_clk_enable_autoidle_all(); +#endif } void __init am35xx_init_late(void) @@ -537,6 +555,9 @@ void __init am35xx_init_late(void) omap_mux_late_init(); omap2_common_pm_late_init(); omap3_pm_init(); +#ifdef CONFIG_COMMON_CLK + omap2_clk_enable_autoidle_all(); +#endif } void __init ti81xx_init_late(void) @@ -544,6 +565,9 @@ void __init ti81xx_init_late(void) omap_mux_late_init(); omap2_common_pm_late_init(); omap3_pm_init(); +#ifdef CONFIG_COMMON_CLK + omap2_clk_enable_autoidle_all(); +#endif } #endif @@ -597,6 +621,9 @@ void __init omap4430_init_late(void) omap_mux_late_init(); omap2_common_pm_late_init(); omap4_pm_init(); +#ifdef CONFIG_COMMON_CLK + omap2_clk_enable_autoidle_all(); +#endif } #endif