From patchwork Fri Sep 16 05:49:17 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Norris X-Patchwork-Id: 9335029 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6953D601C2 for ; Fri, 16 Sep 2016 05:50:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 58CC329EA8 for ; Fri, 16 Sep 2016 05:50:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4AEC929EBC; Fri, 16 Sep 2016 05:50:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id F0F2029EA8 for ; Fri, 16 Sep 2016 05:50:11 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bkm2K-0002bL-IH; Fri, 16 Sep 2016 05:50:08 +0000 Received: from mail-pa0-x22b.google.com ([2607:f8b0:400e:c03::22b]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bkm25-0002KQ-FO for linux-rockchip@lists.infradead.org; Fri, 16 Sep 2016 05:49:55 +0000 Received: by mail-pa0-x22b.google.com with SMTP id oz2so18423735pac.2 for ; Thu, 15 Sep 2016 22:49:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id; bh=DJrLa77FJoyPHkRs7AO/Ht6FURzcL5RnrkDqb2+KsKE=; b=EZRXx2wUzEFsqRbvwN1hrQU6V4QI2pEKsqvpuuKpS3yIgC0MhqzqZHL6xirHG5nG13 HxKzpDpNueY+OooFwRnzjKI3Dq+ADMg/N16lyQa8+k8Dx6DkNV05yVOUQLKKCdwwZoRK QZAJ1xNhCZIX8XXxHcCbSskfJyRqobyh+HXAU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=DJrLa77FJoyPHkRs7AO/Ht6FURzcL5RnrkDqb2+KsKE=; b=VvS7cLLGS65uyUFxI/0gA1VfaU4TnT3ei+ttyGziuqJj5R3XHBF+rYJEPoF8Dkcwdt yesbY49mO5Z6KQG1+TUTjJfL/rlwfz6mJkHyrVas11GC89KpePmzuY4xx/lM4wBRqR7B T34aBlkP68CImx5WE+4inm0MCcXyBkq1JeZvwwtxawE8X81PxOQiMiOPuCLZ1x9PKucy wFAgBeesTY1c4EUO0h990jwBSNb3JzTNDMc97ZYtsd58XgjKWxuAfr1xziE76emkyMDp imxApV8y9+lXtWSxCwFrSp98AhK0ywpScqlA0JzHutmp6EwmjBVX18tVWrLbkfKhyZTZ Yaow== X-Gm-Message-State: AE9vXwPKoUTLOjKFwXyOeO+Z8eqt+Q/EI1fiuAZ3/evyHO3C+oucEIj/w7v4sOZsbEAKdOQK X-Received: by 10.66.251.131 with SMTP id zk3mr6680322pac.176.1474004972230; Thu, 15 Sep 2016 22:49:32 -0700 (PDT) Received: from briannorris-glaptop2.roam.corp.google.com ([103.29.142.67]) by smtp.gmail.com with ESMTPSA id 70sm16077338pfn.46.2016.09.15.22.49.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 15 Sep 2016 22:49:31 -0700 (PDT) From: Brian Norris To: Daniel Lezcano , Thomas Gleixner Subject: [PATCH] clocksource: arm_arch_timer: Don't assume clock runs in suspend Date: Fri, 16 Sep 2016 13:49:17 +0800 Message-Id: <20160916054917.16930-1-briannorris@chromium.org> X-Mailer: git-send-email 2.8.1.340.g018a5d0.dirty X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160915_224953_664020_94C895F6 X-CRM114-Status: GOOD ( 12.55 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Marc Zyngier , Brian Norris , Stephen Boyd , linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Since commit 4fbcdc813fb9 ("clocksource: arm_arch_timer: Use clocksource for suspend timekeeping"), this driver assumes that the ARM architected timer keeps running in suspend. This is not the case for some ARM SoCs, depending on the HW state used for system suspend. Let's not assume that all SoCs support this, and instead only support this if the device tree explicitly tells us it's "always on". In all other cases, just fall back to the RTC. This should be relatively harmless. It seems fair to key the system-suspend behavior off the same property used for C3STOP, since if the timer doesn't keep context for CPU sleep, it likely doesn't for system sleep either. Signed-off-by: Brian Norris --- drivers/clocksource/arm_arch_timer.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c index 57700541f951..e28677a34f02 100644 --- a/drivers/clocksource/arm_arch_timer.c +++ b/drivers/clocksource/arm_arch_timer.c @@ -490,7 +490,7 @@ static struct clocksource clocksource_counter = { .rating = 400, .read = arch_counter_read, .mask = CLOCKSOURCE_MASK(56), - .flags = CLOCK_SOURCE_IS_CONTINUOUS | CLOCK_SOURCE_SUSPEND_NONSTOP, + .flags = CLOCK_SOURCE_IS_CONTINUOUS, }; static struct cyclecounter cyclecounter = { @@ -526,6 +526,8 @@ static void __init arch_counter_register(unsigned type) clocksource_counter.name = "arch_mem_counter"; } + if (!arch_timer_c3stop) + clocksource_counter.flags |= CLOCK_SOURCE_SUSPEND_NONSTOP; start_count = arch_timer_read_counter(); clocksource_register_hz(&clocksource_counter, arch_timer_rate); cyclecounter.mult = clocksource_counter.mult;