From patchwork Tue Nov 17 23:41:13 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Hilman X-Patchwork-Id: 60855 X-Patchwork-Delegate: khilman@deeprootsystems.com Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id nAHNfOkM025120 for ; Tue, 17 Nov 2009 23:41:24 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756286AbZKQXlM (ORCPT ); Tue, 17 Nov 2009 18:41:12 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1756301AbZKQXlM (ORCPT ); Tue, 17 Nov 2009 18:41:12 -0500 Received: from mail-pw0-f42.google.com ([209.85.160.42]:60402 "EHLO mail-pw0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756271AbZKQXlL (ORCPT ); Tue, 17 Nov 2009 18:41:11 -0500 Received: by pwi3 with SMTP id 3so312285pwi.21 for ; Tue, 17 Nov 2009 15:41:17 -0800 (PST) Received: by 10.115.103.26 with SMTP id f26mr12551113wam.198.1258501275909; Tue, 17 Nov 2009 15:41:15 -0800 (PST) Received: from localhost ([216.254.16.51]) by mx.google.com with ESMTPS id 21sm2483231pzk.7.2009.11.17.15.41.15 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 17 Nov 2009 15:41:15 -0800 (PST) From: Kevin Hilman To: linux-omap@vger.kernel.org Cc: Jon Hunter Subject: [PATCH v2] OMAP: timekeeping: time should not stop during suspend Date: Tue, 17 Nov 2009 15:41:13 -0800 Message-Id: <1258501273-17595-1-git-send-email-khilman@deeprootsystems.com> X-Mailer: git-send-email 1.6.5.1 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org diff --git a/arch/arm/plat-omap/common.c b/arch/arm/plat-omap/common.c index cc050b3..8057966 100644 --- a/arch/arm/plat-omap/common.c +++ b/arch/arm/plat-omap/common.c @@ -172,6 +172,25 @@ unsigned long long sched_clock(void) clocksource_32k.mult, clocksource_32k.shift); } +/** + * read_persistent_clock - Return time from the persistent clock. + * + * Reads the time from a source which isn't disabled during PM: 32k sync + * Returns a timespec with tv_sec=0 and tv_nsec=0 if unsupported. + * + */ +void read_persistent_clock(struct timespec *ts) +{ + unsigned long long nsecs; + cycle_t cycles; + + ts->tv_sec = ts->tv_nsec = 0; + cycles = clocksource_32k.read(&clocksource_32k); + nsecs = clocksource_cyc2ns(cycles, + clocksource_32k.mult, clocksource_32k.shift); + timespec_add_ns(ts, nsecs); +} + static int __init omap_init_clocksource_32k(void) { static char err[] __initdata = KERN_ERR