From patchwork Wed Jun 13 11:32:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baolin Wang X-Patchwork-Id: 928837 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-tegra-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="bZJ4yF8M"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 415Pn15qKzz9s3C for ; Wed, 13 Jun 2018 21:35:01 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935316AbeFMLdg (ORCPT ); Wed, 13 Jun 2018 07:33:36 -0400 Received: from mail-pg0-f65.google.com ([74.125.83.65]:36710 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935444AbeFMLdd (ORCPT ); Wed, 13 Jun 2018 07:33:33 -0400 Received: by mail-pg0-f65.google.com with SMTP id m5-v6so1150258pgd.3 for ; Wed, 13 Jun 2018 04:33:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=qOl0Hf/KoVxPAWSJiEHR+kwcAVrdVGSBzW6sJ8SSmik=; b=bZJ4yF8MMucwePX4a2IL1gLw8HXA4kU2ZXmm73QuocsMJp+baefw2Ul6QlDdUiuluL r27hCR61+zLb0kh9JNg814I/JuiMAWUR4JtblPFzDxjaC/L9A24KcXAJZ4SfUqDZwYQv X2ahTQwc6puDorhfLWf/IvIjAvFFtPVsZccnU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=qOl0Hf/KoVxPAWSJiEHR+kwcAVrdVGSBzW6sJ8SSmik=; b=fb6arFGOSyTZe4TLRleptMRGs1jHEnhqNt97sjI69ivU92sfO/KnPRQ+JSrxjGvQEL LKRAEzjaFKfC8R1VOgapa1rXFHdEOrnoxjgDE8FevC1utB4/EJ3CWQKbMw3I5C5b5Sm4 l9O9aETiTpG/mkGo9VlsddyY3Tuw+nIkl/HK94Sv96r3ZNXOqqTHSaR5xGHKAqvNG+B3 9GmFT3vB7QzkGT2Nwt7MVrk9LnTBjzrzKd6dha2P4RZJ1MeyP2nDkg1eBqLDFyURj3w1 wMCw+us7KhPJhkDhp1A9U0s7Lq+21sdTvphZ6q413j9msagAz+ThhlIvhKw27b3bHNR8 6PQw== X-Gm-Message-State: APt69E1CgWh4HHSZozVf9dOB35IDQr6GrIIUC/xFhLdifCQjsh11hC9x gK1mJlmAYn3rhjzn79e33WPc0w== X-Google-Smtp-Source: ADUXVKINz/wNoQcpZCTDZY+xayVngHHgW9EdBNYT61OV0qlmcQh3uTmF7SWiVOG4iF1FqqufI18Jvw== X-Received: by 2002:a62:f551:: with SMTP id n78-v6mr4618811pfh.200.1528889612370; Wed, 13 Jun 2018 04:33:32 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([117.18.48.102]) by smtp.gmail.com with ESMTPSA id h8-v6sm2745370pgq.35.2018.06.13.04.33.24 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 13 Jun 2018 04:33:31 -0700 (PDT) From: Baolin Wang To: tglx@linutronix.de, john.stultz@linaro.org, daniel.lezcano@linaro.org, arnd@arndb.de, tony@atomide.com, aaro.koskinen@iki.fi, linux@armlinux.org.uk, mark.rutland@arm.com, marc.zyngier@arm.com Cc: baolin.wang@linaro.org, broonie@kernel.org, paulmck@linux.vnet.ibm.com, mlichvar@redhat.com, rdunlap@infradead.org, kstewart@linuxfoundation.org, gregkh@linuxfoundation.org, pombredanne@nexb.com, thierry.reding@gmail.com, jonathanh@nvidia.com, heiko@sntech.de, linus.walleij@linaro.org, viresh.kumar@linaro.org, mingo@kernel.org, hpa@zytor.com, peterz@infradead.org, douly.fnst@cn.fujitsu.com, len.brown@intel.com, rajvi.jingar@intel.com, alexandre.belloni@bootlin.com, x86@kernel.org, linux-arm-kernel@lists.infradead.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org Subject: [PATCH 4/8] clocksource: arm_arch_timer: Register the persistent clock Date: Wed, 13 Jun 2018 19:32:31 +0800 Message-Id: <5b450836ee0db88de27d47e43368de02c550425b.1528878545.git.baolin.wang@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: In-Reply-To: References: Sender: linux-tegra-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-tegra@vger.kernel.org Register the persistent clock to compensate the suspend time for OS time, if the ARM counter clocksource will not be stopped in suspend state. Signed-off-by: Baolin Wang --- drivers/clocksource/Kconfig | 1 + drivers/clocksource/arm_arch_timer.c | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig index 7f11c6c..5e51fcf 100644 --- a/drivers/clocksource/Kconfig +++ b/drivers/clocksource/Kconfig @@ -308,6 +308,7 @@ config ARC_TIMERS_64BIT config ARM_ARCH_TIMER bool + select PERSISTENT_CLOCK select TIMER_OF if OF select TIMER_ACPI if ACPI diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c index 57cb2f0..671be63 100644 --- a/drivers/clocksource/arm_arch_timer.c +++ b/drivers/clocksource/arm_arch_timer.c @@ -32,6 +32,7 @@ #include #include +#include #undef pr_fmt #define pr_fmt(fmt) "arch_timer: " fmt @@ -950,6 +951,15 @@ static void __init arch_counter_register(unsigned type) /* 56 bits minimum, so we assume worst case rollover */ sched_clock_register(arch_timer_read_counter, 56, arch_timer_rate); + + /* + * Register the persistent clock if the clocksource will not be stopped + * in suspend state. + */ + if (!arch_counter_suspend_stop) + persistent_clock_init_and_register(arch_timer_read_counter, + CLOCKSOURCE_MASK(56), + arch_timer_rate, 0); } static void arch_timer_stop(struct clock_event_device *clk)