public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
From: Tony Lindgren <tony@atomide.com>
To: linux-arm-kernel@lists.infradead.org
Cc: Paul Walmsley <paul@pwsan.com>, linux-omap@vger.kernel.org
Subject: [PATCH 07/14] omap: Use getnstimeofday for omap_device
Date: Fri, 16 Oct 2009 16:41:27 -0700	[thread overview]
Message-ID: <20091016234126.2463.85187.stgit@localhost> (raw)
In-Reply-To: <20091016233624.2463.26653.stgit@localhost>

Use getnstimeofday for omap_device

Acked-by: Paul Walmsley <paul@pwsan.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/plat-omap/omap_device.c |   50 ++++++++++++++------------------------
 1 files changed, 19 insertions(+), 31 deletions(-)

diff --git a/arch/arm/plat-omap/omap_device.c b/arch/arm/plat-omap/omap_device.c
index 2c409fc..12513f4 100644
--- a/arch/arm/plat-omap/omap_device.c
+++ b/arch/arm/plat-omap/omap_device.c
@@ -103,21 +103,6 @@
 /* Private functions */
 
 /**
- * _read_32ksynct - read the OMAP 32K sync timer
- *
- * Returns the current value of the 32KiHz synchronization counter.
- * XXX this should be generalized to simply read the system clocksource.
- * XXX this should be moved to a separate synctimer32k.c file
- */
-static u32 _read_32ksynct(void)
-{
-	if (!cpu_class_is_omap2())
-		BUG();
-
-	return __raw_readl(OMAP2_IO_ADDRESS(OMAP_32KSYNCT_BASE + 0x010));
-}
-
-/**
  * _omap_device_activate - increase device readiness
  * @od: struct omap_device *
  * @ignore_lat: increase to latency target (0) or full readiness (1)?
@@ -133,13 +118,13 @@ static u32 _read_32ksynct(void)
  */
 static int _omap_device_activate(struct omap_device *od, u8 ignore_lat)
 {
-	u32 a, b;
+	struct timespec a, b, c;
 
 	pr_debug("omap_device: %s: activating\n", od->pdev.name);
 
 	while (od->pm_lat_level > 0) {
 		struct omap_device_pm_latency *odpl;
-		int act_lat = 0;
+		unsigned long long act_lat = 0;
 
 		od->pm_lat_level--;
 
@@ -149,20 +134,22 @@ static int _omap_device_activate(struct omap_device *od, u8 ignore_lat)
 		    (od->dev_wakeup_lat <= od->_dev_wakeup_lat_limit))
 			break;
 
-		a = _read_32ksynct();
+		getnstimeofday(&a);
 
 		/* XXX check return code */
 		odpl->activate_func(od);
 
-		b = _read_32ksynct();
+		getnstimeofday(&b);
 
-		act_lat = (b - a) >> 15; /* 32KiHz cycles to microseconds */
+		c = timespec_sub(b, a);
+		act_lat = timespec_to_ns(&c) * NSEC_PER_USEC;
 
 		pr_debug("omap_device: %s: pm_lat %d: activate: elapsed time "
-			 "%d usec\n", od->pdev.name, od->pm_lat_level, act_lat);
+			 "%llu usec\n", od->pdev.name, od->pm_lat_level,
+			 act_lat);
 
 		WARN(act_lat > odpl->activate_lat, "omap_device: %s.%d: "
-		     "activate step %d took longer than expected (%d > %d)\n",
+		     "activate step %d took longer than expected (%llu > %d)\n",
 		     od->pdev.name, od->pdev.id, od->pm_lat_level,
 		     act_lat, odpl->activate_lat);
 
@@ -188,13 +175,13 @@ static int _omap_device_activate(struct omap_device *od, u8 ignore_lat)
  */
 static int _omap_device_deactivate(struct omap_device *od, u8 ignore_lat)
 {
-	u32 a, b;
+	struct timespec a, b, c;
 
 	pr_debug("omap_device: %s: deactivating\n", od->pdev.name);
 
 	while (od->pm_lat_level < od->pm_lats_cnt) {
 		struct omap_device_pm_latency *odpl;
-		int deact_lat = 0;
+		unsigned long long deact_lat = 0;
 
 		odpl = od->pm_lats + od->pm_lat_level;
 
@@ -203,23 +190,24 @@ static int _omap_device_deactivate(struct omap_device *od, u8 ignore_lat)
 		     od->_dev_wakeup_lat_limit))
 			break;
 
-		a = _read_32ksynct();
+		getnstimeofday(&a);
 
 		/* XXX check return code */
 		odpl->deactivate_func(od);
 
-		b = _read_32ksynct();
+		getnstimeofday(&b);
 
-		deact_lat = (b - a) >> 15; /* 32KiHz cycles to microseconds */
+		c = timespec_sub(b, a);
+		deact_lat = timespec_to_ns(&c) * NSEC_PER_USEC;
 
 		pr_debug("omap_device: %s: pm_lat %d: deactivate: elapsed time "
-			 "%d usec\n", od->pdev.name, od->pm_lat_level,
+			 "%llu usec\n", od->pdev.name, od->pm_lat_level,
 			 deact_lat);
 
 		WARN(deact_lat > odpl->deactivate_lat, "omap_device: %s.%d: "
-		     "deactivate step %d took longer than expected (%d > %d)\n",
-		     od->pdev.name, od->pdev.id, od->pm_lat_level,
-		     deact_lat, odpl->deactivate_lat);
+		     "deactivate step %d took longer than expected "
+		     "(%llu > %d)\n", od->pdev.name, od->pdev.id,
+		     od->pm_lat_level, deact_lat, odpl->deactivate_lat);
 
 		od->dev_wakeup_lat += odpl->activate_lat;
 


  parent reply	other threads:[~2009-10-16 23:41 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-16 23:40 [PATCH 00/14] Use ioremap for omap, split OMAP2_IO_ADDRESS for more space Tony Lindgren
2009-10-16 23:40 ` [PATCH 01/14] omap: Change low-level serial init to use ioremap Tony Lindgren
2009-10-16 23:40 ` [PATCH 02/14] omap: Use ioremap in irq.c Tony Lindgren
2009-10-16 23:40 ` [PATCH 03/14] omap: Use ioremap in dma.c Tony Lindgren
2009-10-16 23:40 ` [PATCH 04/14] omap: Use ioremap in dmtimer.c Tony Lindgren
2009-10-16 23:41 ` [PATCH 05/14] omap: Use ioremap in gpio.c Tony Lindgren
2009-10-17  8:10   ` Russell King - ARM Linux
2009-10-17 16:13     ` Tony Lindgren
2009-10-19  0:19       ` Tony Lindgren
2009-10-16 23:41 ` [PATCH 06/14] omap: Use ioremap in omap_hwmod.c Tony Lindgren
2009-10-16 23:41 ` Tony Lindgren [this message]
2009-10-16 23:41 ` [PATCH 08/14] omap: Use ioremap for omap4 L4 code Tony Lindgren
2009-10-16 23:46   ` Tony Lindgren
2009-10-17 10:48     ` Shilimkar, Santosh
2009-10-17 16:19       ` Tony Lindgren
2009-10-19  0:24         ` Tony Lindgren
2009-10-19  7:27           ` Shilimkar, Santosh
2009-10-19 17:12             ` Tony Lindgren
2009-10-19 17:21               ` Aguirre Rodriguez, Sergio Alberto
2009-10-19 17:38                 ` Tony Lindgren
2009-10-19 18:07                   ` Aguirre Rodriguez, Sergio Alberto
2009-10-20  6:34               ` Shilimkar, Santosh
2009-10-16 23:41 ` [PATCH 09/14] omap: Use ioremap in dispc.c Tony Lindgren
2009-10-16 23:42 ` [PATCH 10/14] omap: Split OMAP2_IO_ADDRESS to L3 and L4 Tony Lindgren
2009-10-16 23:42 ` [PATCH 11/14] omap: Remap L3, L4 to get more kernel io address space Tony Lindgren
2009-10-20  0:20   ` Tony Lindgren
2009-10-20  6:32     ` Shilimkar, Santosh
2009-10-16 23:42 ` [PATCH 12/14] omap: Move SRAM map to claim more io space Tony Lindgren
2009-10-16 23:42 ` [PATCH 13/14] omap: Fix DEBUG_LL UART io address Tony Lindgren
2009-10-16 23:42 ` [PATCH 14/14] omap: Add OMAP4 L3 and L4 peripherals Tony Lindgren

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=20091016234126.2463.85187.stgit@localhost \
    --to=tony@atomide.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=paul@pwsan.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox