All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paul Walmsley <paul@pwsan.com>
To: Tero Kristo <tero.kristo@nokia.com>
Cc: linux-omap@vger.kernel.org
Subject: Re: [PATCHv4 1/8] OMAP3: Clockdomain: Added API for checking if HWSUP is enabled
Date: Mon, 1 Feb 2010 15:10:40 -0700 (MST)	[thread overview]
Message-ID: <alpine.DEB.2.00.1002011502070.20004@utopia.booyaka.com> (raw)
In-Reply-To: <1264182951-9205-2-git-send-email-tero.kristo@nokia.com>

Hi Tero,

On Fri, 22 Jan 2010, Tero Kristo wrote:

> From: Tero Kristo <tero.kristo@nokia.com>
> 
> omap2_clkdm_get_hwsup(clkdm) can be used to check if automatic HW
> transitions for the domain are enabled or not. This is needed for the
> powerdomain code that adds support for INACTIVE state, as it needs to
> disable HWSUP on the fly for ON state, and re-enable it after returning
> to some other state.
> 
> Signed-off-by: Tero Kristo <tero.kristo@nokia.com>

An updated patch with some revisions is below.  Please let me know if 
there's something that still should be changed.  The revisions are:

1. Split the if-statement expressions up into separate lines per 
CodingStyle

2. Rename omap2_clkdm_get_hwsup() to omap2_clkdm_read_hwsup() to follow 
the general practice in this file and powerdomain.c that functions with 
'_get_' in the name read configuration data, and functions with '_read_' 
read from the hardware (or a cache of the hardware register)

3. Add OMAP4 support

4. Added the extra asterisk in the comment body to indicate 
kerneldoc-format comment

5. Updated patch to apply after the current round of 2.6.34 changes


regards,

- Paul

>From fc2f8ad184e012a5574e1110c359354d247a1709 Mon Sep 17 00:00:00 2001
From: Tero Kristo <tero.kristo@nokia.com>
Date: Mon, 1 Feb 2010 13:41:26 -0700
Subject: [PATCH] OMAP3: Clockdomain: Added API for checking if HWSUP is enabled

omap2_clkdm_read_hwsup(clkdm) can be used to check if automatic HW
transitions for the domain are enabled or not. This is needed for the
powerdomain code that adds support for INACTIVE state, as it needs to
disable HWSUP on the fly for ON state, and re-enable it after returning
to some other state.

Signed-off-by: Tero Kristo <tero.kristo@nokia.com>
[paul@pwsan.com: added kerneldoc comment magic start; changed function
 name to omap2_clkdm_read_hwsup(); broke up expressions in function
 body; added OMAP4 support]
Signed-off-by: Paul Walmsley <paul@pwsan.com>
---
 arch/arm/mach-omap2/clockdomain.c             |   30 +++++++++++++++++++++++++
 arch/arm/plat-omap/include/plat/clockdomain.h |    1 +
 2 files changed, 31 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/clockdomain.c b/arch/arm/mach-omap2/clockdomain.c
index a38a615..8dce3c9 100644
--- a/arch/arm/mach-omap2/clockdomain.c
+++ b/arch/arm/mach-omap2/clockdomain.c
@@ -868,6 +868,36 @@ int omap2_clkdm_wakeup(struct clockdomain *clkdm)
 }
 
 /**
+ * omap2_clkdm_read_hwsup - read the hwsup idle transition bit
+ * @clkdm: struct clockdomain *
+ *
+ * Checks whether hardware is allowed to switch the clockdomain @clkdm
+ * automatically into active or idle states. Returns -EINVAL if @clkdm
+ * is NULL; otherwise, 1 if hardware auto-idle is enabled, 0 if not.
+ */
+int omap2_clkdm_read_hwsup(struct clockdomain *clkdm)
+{
+	u32 u, v;
+
+	if (!clkdm)
+		return -EINVAL;
+
+	u = cm_read_mod_reg(clkdm->pwrdm.ptr->prcm_offs, CM_CLKSTCTRL);
+	u &= clkdm->clktrctrl_mask;
+
+	if (cpu_is_omap24xx())
+		v = OMAP24XX_CLKSTCTRL_ENABLE_AUTO;
+	else if (cpu_is_omap34xx() || cpu_is_omap44xx())
+		v = OMAP34XX_CLKSTCTRL_ENABLE_AUTO;
+	else
+		BUG();
+
+	v <<= __ffs(clkdm->clktrctrl_mask);
+
+	return (u == v) ? 1 : 0;
+}
+
+/**
  * omap2_clkdm_allow_idle - enable hwsup idle transitions for clkdm
  * @clkdm: struct clockdomain *
  *
diff --git a/arch/arm/plat-omap/include/plat/clockdomain.h b/arch/arm/plat-omap/include/plat/clockdomain.h
index ba0a6c0..9d25f4e 100644
--- a/arch/arm/plat-omap/include/plat/clockdomain.h
+++ b/arch/arm/plat-omap/include/plat/clockdomain.h
@@ -129,6 +129,7 @@ int clkdm_del_sleepdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2);
 int clkdm_read_sleepdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2);
 int clkdm_clear_all_sleepdeps(struct clockdomain *clkdm);
 
+int omap2_clkdm_read_hwsup(struct clockdomain *clkdm);
 void omap2_clkdm_allow_idle(struct clockdomain *clkdm);
 void omap2_clkdm_deny_idle(struct clockdomain *clkdm);
 
-- 
1.6.6.rc2.5.g49666


  parent reply	other threads:[~2010-02-01 22:10 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-22 17:55 [PATCHv4 0/8] Idle status patches revisited Tero Kristo
2010-01-22 17:55 ` [PATCHv4 1/8] OMAP3: Clockdomain: Added API for checking if HWSUP is enabled Tero Kristo
2010-01-22 17:55   ` [PATCHv4 2/8] OMAP: Powerdomains: Add support for INACTIVE state on pwrdm level Tero Kristo
2010-01-22 17:55     ` [PATCHv4 3/8] OMAP3: PM: Added support for INACTIVE and ON states for powerdomains Tero Kristo
2010-01-22 17:55       ` [PATCHv4 4/8] OMAP3: CPUidle: Fixed support for ON / INACTIVE states Tero Kristo
2010-01-22 17:55         ` [PATCHv4 5/8] OMAP3: PM: Removed pwrdm state hacking from omap_sram_idle Tero Kristo
2010-01-22 17:55           ` [PATCHv4 6/8] OMAP3: Clock: Added IDLEST definitions for SGX Tero Kristo
2010-01-22 17:55             ` [PATCHv4 7/8] OMAP: Powerdomains: Add support for checking if pwrdm/clkdm can idle Tero Kristo
2010-01-22 17:55               ` [PATCHv4 8/8] OMAP3: CPUidle: Added peripheral pwrdm checks into bm check Tero Kristo
2010-02-01 22:02             ` [PATCHv4 6/8] OMAP3: Clock: Added IDLEST definitions for SGX Paul Walmsley
2010-02-02  8:03     ` [PATCHv4 2/8] OMAP: Powerdomains: Add support for INACTIVE state on pwrdm level Paul Walmsley
2010-02-02  9:26       ` Tero.Kristo
2010-02-01 22:10   ` Paul Walmsley [this message]
2010-02-02  8:39     ` [PATCHv4 1/8] OMAP3: Clockdomain: Added API for checking if HWSUP is enabled Tero.Kristo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.00.1002011502070.20004@utopia.booyaka.com \
    --to=paul@pwsan.com \
    --cc=linux-omap@vger.kernel.org \
    --cc=tero.kristo@nokia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.