From patchwork Mon May 14 08:55:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "\(Exiting\) Baolin Wang" X-Patchwork-Id: 135691 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp1483931lji; Mon, 14 May 2018 01:56:39 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpkqsWnPcDe/YkD50GVWi5siFCpiCXBmSfyGQNR+jd9lMr+M0RjlqI2+EtyqbXlWcEDnxno X-Received: by 2002:a62:3745:: with SMTP id e66-v6mr9511345pfa.43.1526288199715; Mon, 14 May 2018 01:56:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526288199; cv=none; d=google.com; s=arc-20160816; b=0ghkrfCQnFuTImBQV88RZcdyqJhxecPvkcSKxAOLoe51ZvXz/g4pY3tb/dL5NfA8BJ kmGG1bnJjef1V7WKpGXaYVvd2dBeM+7dyHk+znaioVUznW9Y0iqVeRzMOkEFPAr8Brrd 6uX3VouRoaOT270/WrBPb9NlL8Z44Rehocxmi1xWU6TpRkT2VospeMuDB0y8cgdz69Qh fR0R+gEbDg3XWUeOLoOSlfvbHTLjHIKLMQt6z6Z5RuzRoz0XSFxmZEnjGADOx3TijZae wBgx4LzIuqHCZYQcdvbdLBIK0hgobjm/v1xDL6DT2G8yBSZ5iEP7i90plHJgih/8wbnF xV/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=NdTVm6s/SJ/+b7++NO8SpLVqKE1EBmqR0A6Zlp8v4I4=; b=N+SpdiftaAGhmd2xTP7oWy7LOwssnP6MU6fgdvsRNot18TxSBShsiFGWBJ1M9cUh5L ZWBPDgQAuFSYrwRbzepGCz/DE8ia6n0IXNVjnwJgXSrcd4lkEAQ1bXEd6lZCP/4K/pX9 qV8NSVnSvzKEu3J5IZ7g1JBAnZDPlXlyiBc+zGMAaTBUGPWvUC6QXayQ7WUYGfBng699 1roYUqoThQzJTJUkSFmErX4u4jbs1MvH/7kbdFT8Ik0VijjSEAXCpJ/bXJWFRJT2PlZG f+paurQaQwNLXzeSOPIDoNAVxydFNiLOdvB9oNcUts3VTTSILd9b2dqatW9w/+wDBUtY JUEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=XNU2+vEU; spf=pass (google.com: best guess record for domain of linux-omap-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-omap-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f59-v6si9464172plf.38.2018.05.14.01.56.39; Mon, 14 May 2018 01:56:39 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-omap-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=XNU2+vEU; spf=pass (google.com: best guess record for domain of linux-omap-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-omap-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752175AbeENI4h (ORCPT + 5 others); Mon, 14 May 2018 04:56:37 -0400 Received: from mail-pl0-f65.google.com ([209.85.160.65]:43355 "EHLO mail-pl0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752161AbeENI4d (ORCPT ); Mon, 14 May 2018 04:56:33 -0400 Received: by mail-pl0-f65.google.com with SMTP id c41-v6so1753447plj.10 for ; Mon, 14 May 2018 01:56:33 -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=2Qu1jnyodM33FX6lpiVLTbtDw5ni5cVDxwCgCDaodfs=; b=XNU2+vEU9pkOF50orsNJJ5kxL+oDeoSRglRc+u/p7NKdFFCyrSamXC91u8InWTxbEA uqTUvbStGgLkCr1QJI/DEgrgD7izDGiCMg3m70gbvdZcH4NB5gksohRNSyIMuRd1dpxq TuMOzFm2p1lR13tKYEb3VqKGGeH7sUVEDTymU= 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=2Qu1jnyodM33FX6lpiVLTbtDw5ni5cVDxwCgCDaodfs=; b=pa/c9JSF0NLpbdOwPRPxK58V/qSpbinJoU9QGRT24G01nMnSDbxsL1nLnmMJwizelT /8E5v2RZYdphJgdk0qesDd62viUmDOu7rh78FJKygRY2xra01BTijWEeR9+XTa6wam4z 4bSaGHDgIzd3n2OYUlplQGCG5eJiWQDkXJf1npSTAAt5btHM/HRCVXei5PZWT/PUugb7 iHZob0+VQJt8CXNrk2N7uwiauXO+8FuGXYHdkVniGeFhrnabMHceGBevLtdHV/yEEJ5K YSrpxHFkws/vmNLyT18Jg5wfi5ABLhn8/5sENZXkxAynoJqEM0/cVWzd+QtKuifekd04 KNMQ== X-Gm-Message-State: ALKqPwcaT32j0BmI7QyjdD8rVNvyOwTwiRpqvtzaCD5mLPIal/1gmjgi McjUzN1AmADd4YDxqLwXBJYDNg== X-Received: by 2002:a17:902:76c3:: with SMTP id j3-v6mr5763144plt.15.1526288193314; Mon, 14 May 2018 01:56:33 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([117.18.48.102]) by smtp.gmail.com with ESMTPSA id x71-v6sm23308158pfe.47.2018.05.14.01.56.25 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 14 May 2018 01:56:32 -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: [RFC PATCH 03/10] arm: omap: Convert 32K counter to use persistent clock Date: Mon, 14 May 2018 16:55:29 +0800 Message-Id: X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: In-Reply-To: References: Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org We have introduced the persistent clock framework to support the OS time compensating from persistent clock, so this patch converts the 32k counter to use persistent clock framework to save lots of duplicate code. Signed-off-by: Baolin Wang --- arch/arm/plat-omap/Kconfig | 1 + arch/arm/plat-omap/counter_32k.c | 44 ++++++-------------------------------- 2 files changed, 8 insertions(+), 37 deletions(-) -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/arch/arm/plat-omap/Kconfig b/arch/arm/plat-omap/Kconfig index afc1a1d..0e4e385 100644 --- a/arch/arm/plat-omap/Kconfig +++ b/arch/arm/plat-omap/Kconfig @@ -1,5 +1,6 @@ # SPDX-License-Identifier: GPL-2.0 config ARCH_OMAP + select PERSISTENT_CLOCK bool if ARCH_OMAP diff --git a/arch/arm/plat-omap/counter_32k.c b/arch/arm/plat-omap/counter_32k.c index 2438b96..5d52f7c 100644 --- a/arch/arm/plat-omap/counter_32k.c +++ b/arch/arm/plat-omap/counter_32k.c @@ -19,8 +19,7 @@ #include #include #include - -#include +#include #include @@ -44,33 +43,6 @@ static u64 notrace omap_32k_read_sched_clock(void) } /** - * omap_read_persistent_clock64 - Return time from a persistent clock. - * - * Reads the time from a source which isn't disabled during PM, the - * 32k sync timer. Convert the cycles elapsed since last read into - * nsecs and adds to a monotonically increasing timespec64. - */ -static struct timespec64 persistent_ts; -static cycles_t cycles; -static unsigned int persistent_mult, persistent_shift; - -static void omap_read_persistent_clock64(struct timespec64 *ts) -{ - unsigned long long nsecs; - cycles_t last_cycles; - - last_cycles = cycles; - cycles = sync32k_cnt_reg ? readl_relaxed(sync32k_cnt_reg) : 0; - - nsecs = clocksource_cyc2ns(cycles - last_cycles, - persistent_mult, persistent_shift); - - timespec64_add_ns(&persistent_ts, nsecs); - - *ts = persistent_ts; -} - -/** * omap_init_clocksource_32k - setup and register counter 32k as a * kernel clocksource * @pbase: base addr of counter_32k module @@ -95,13 +67,6 @@ int __init omap_init_clocksource_32k(void __iomem *vbase) else sync32k_cnt_reg = vbase + OMAP2_32KSYNCNT_CR_OFF_LOW; - /* - * 120000 rough estimate from the calculations in - * __clocksource_update_freq_scale. - */ - clocks_calc_mult_shift(&persistent_mult, &persistent_shift, - 32768, NSEC_PER_SEC, 120000); - ret = clocksource_mmio_init(sync32k_cnt_reg, "32k_counter", 32768, 250, 32, clocksource_mmio_readl_up); if (ret) { @@ -110,7 +75,12 @@ int __init omap_init_clocksource_32k(void __iomem *vbase) } sched_clock_register(omap_32k_read_sched_clock, 32, 32768); - register_persistent_clock(NULL, omap_read_persistent_clock64); + /* + * 120000 rough estimate from the calculations in + * __clocksource_update_freq_scale. + */ + persistent_clock_init_and_register(omap_32k_read_sched_clock, + CLOCKSOURCE_MASK(32), 32768, 120000); pr_info("OMAP clocksource: 32k_counter at 32768 Hz\n"); return 0; From patchwork Mon May 14 08:55:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "\(Exiting\) Baolin Wang" X-Patchwork-Id: 135696 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp1484443lji; Mon, 14 May 2018 01:57:27 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpWGo2yK45Y3oq0F2N8X6Yl4rWP8fDVC01z8SrGrlZROrt2/OZEvqKN26kkU35ZZpNqNkmK X-Received: by 2002:a62:df4c:: with SMTP id u73-v6mr9506033pfg.10.1526288247356; Mon, 14 May 2018 01:57:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526288247; cv=none; d=google.com; s=arc-20160816; b=G/FKQdUNN0izNaEG8T5G/6pigBMZ0zfQ4EEcPSdc3lrOZq5VRhxviW1sexRxAhad6o 7hgolDUQohPXNJxXnX0XwvT1juvKmB/aWWiA2yEA50msFm8xe8rffk7Pj4HHEN6cDlEe IqNmNqOTdsPomf76gFeLgZN1q0nu2I866guEO5/q59ogXBRNbby6ZYpd0nLD4sKN02tb YtkIyc4hSzG7llFSjK7GtO1DdCngiIfXkJwz5Q+nHSWfgfVAAy++K18RMHXXlga9AWzg bwDff83LMjyjMUZIdMupx+Gry3dsnStgJvvuKT9Bq3cOJlJaNjUqRoiG10ATi5QzFlkP 8Y9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=ipcMlGNia7amteO8OQNKq3Ewfq5MORgNEU61l6D6TdQ=; b=JKXlKZGDiCKQ1iZzYK3G8MnSGXBuRuVCLQw8pWp1xWSx0YA+Hc7bpbbbGqerM+moi+ 7ywUJi10eLuU58L+bU2Z+gA0REfIUjBZpKNVJCZo7KOXXWDlXXn/PQ3TQVkkzQaq0AQa 5kJfppKLzE5gWO4CPaGxoIuViYbboiPKZmo/m/ttNWZz6Gu104enUp+dpiJQc/lEKJ85 8XWjUwLw26uktH6X3dm7m5QNwoe8r0wVNMaphlKpPWGKaU8vHmhE1a8QbbY4I0i4LW6C j0a/jq0DT59faxf0RqsVb+Dcw8xYQvOBThId8FbgThmPl0DXuiYkc2W5JKNCOWy3gGbN DbeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=W92MFS1W; spf=pass (google.com: best guess record for domain of linux-omap-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-omap-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 5-v6si9106266plc.203.2018.05.14.01.57.27; Mon, 14 May 2018 01:57:27 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-omap-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=W92MFS1W; spf=pass (google.com: best guess record for domain of linux-omap-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-omap-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752402AbeENI5Z (ORCPT + 5 others); Mon, 14 May 2018 04:57:25 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:35905 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752384AbeENI5X (ORCPT ); Mon, 14 May 2018 04:57:23 -0400 Received: by mail-pf0-f194.google.com with SMTP id w129-v6so5693365pfd.3 for ; Mon, 14 May 2018 01:57:23 -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=8amEPfYJHI7TtKp1hNI+LYrHxqnx9lRqWmjNtNhRjpI=; b=W92MFS1W6eJtyRhcwAA2RRxegjesV1rp4xyLBjtwSWiRBX54z29PqUnsY6uVmvNljb 6iij3/XwQJMmSfv6o+GJl6RTXcFy2JDnly4bCfW4uDrVJdURsx/ovVa/DkOi7Ecjzhhi jIkz6PRayCVoT/wWQXtcMaZadOJ6RDztvebCA= 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=8amEPfYJHI7TtKp1hNI+LYrHxqnx9lRqWmjNtNhRjpI=; b=s+8dxBzEP7/NiFcMd1FdDA9rP1Q+jjxNYmx9qYw0Tu/eQVQQhLYxoBn7t21vPWwEGZ bhBK+0s4iBswYaVNGExBKFLBs+GikRm3j3jEj6RvDdqJBIXeyfJ4wdmcHhy4yIecygJn HiVDG7qakYJmhLxqxK9sGthiE+pEGgzFWF6ChYGvll+1+Xodwq6zsPIITDz0QM8cchv6 BzBtrr5OdLaXlauhk/QH/xQnmaJzdIh9+B5cibeY8I7C4rZDe9Lo3SRMsmgAVHD+hqfQ BsD23a9rnqkIKPIibPWpXQ1dIeoAE2tHlTbjaAVC/aU4fa28MSEyewdLl/LW3t5zfIpO eoxA== X-Gm-Message-State: ALKqPwcctaF7n4MU2rIAYzUUF03uabPTTUZSLEHem+5m6jmkUHBXx2sc FGRLG8E28Q+QQCEQ1MIqJBW32g== X-Received: by 2002:a63:9c3:: with SMTP id 186-v6mr6770775pgj.357.1526288242779; Mon, 14 May 2018 01:57:22 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([117.18.48.102]) by smtp.gmail.com with ESMTPSA id x71-v6sm23308158pfe.47.2018.05.14.01.57.13 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 14 May 2018 01:57:22 -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: [RFC PATCH 08/10] clocksource: time-pistachio: Register the persistent clock Date: Mon, 14 May 2018 16:55:34 +0800 Message-Id: X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: In-Reply-To: References: Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org Since the timer on pistachio platform is always available, we can register it as one persistent clock to compensate the suspend time for the OS time. Signed-off-by: Baolin Wang --- drivers/clocksource/Kconfig | 1 + drivers/clocksource/time-pistachio.c | 3 +++ 2 files changed, 4 insertions(+) -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig index ed19757..b45be75 100644 --- a/drivers/clocksource/Kconfig +++ b/drivers/clocksource/Kconfig @@ -255,6 +255,7 @@ config CLKSRC_PISTACHIO bool "Clocksource for Pistachio SoC" if COMPILE_TEST depends on HAS_IOMEM select TIMER_OF + select PERSISTENT_CLOCK help Enables the clocksource for the Pistachio SoC. diff --git a/drivers/clocksource/time-pistachio.c b/drivers/clocksource/time-pistachio.c index a2dd85d..5c3eb71 100644 --- a/drivers/clocksource/time-pistachio.c +++ b/drivers/clocksource/time-pistachio.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -212,6 +213,8 @@ static int __init pistachio_clksrc_of_init(struct device_node *node) raw_spin_lock_init(&pcs_gpt.lock); sched_clock_register(pistachio_read_sched_clock, 32, rate); + persistent_clock_init_and_register(pistachio_read_sched_clock, + CLOCKSOURCE_MASK(32), rate, 0); return clocksource_register_hz(&pcs_gpt.cs, rate); } TIMER_OF_DECLARE(pistachio_gptimer, "img,pistachio-gptimer", From patchwork Mon May 14 08:55:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "\(Exiting\) Baolin Wang" X-Patchwork-Id: 135698 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp1484698lji; Mon, 14 May 2018 01:57:48 -0700 (PDT) X-Google-Smtp-Source: AB8JxZome4csnlSnSffsSIH2bt7gmBYFtl8cLPL6VceazEe8d+QpdDqLSn16cG/dz7B+fVMCjMkk X-Received: by 2002:a17:902:7487:: with SMTP id h7-v6mr8807491pll.154.1526288268725; Mon, 14 May 2018 01:57:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526288268; cv=none; d=google.com; s=arc-20160816; b=P1hrpoNoUJXVN0fp07At5VdvAhqIdZR8cauFjnd54Giy1FqfPthjGXe+WT0gBJ8UnU CxGoy5ZFAVunMpHqK8vKImQydI/96F9x1E7qvA8fbU48nMwtCL/h0xKzPWcjEi1UR4O2 FbmqYWaSBbfnHvvBlRO9gJy9vBJGv5Mor0/vnu4dovF8j/DO+eB4A4NRPwmKjZqIbt6E wuGEdNhGLqJL6wTHuy1epaEvIkpPNVF1PXKlmEZlqmHF+hmX4wolV+8COZYRtWghhdVd UWvup2dsK1tM4fm0WAOM4le+e/ddUPVf4Mrnq7p6raIm46KpOC4UHFV8O+FnFtq+8d4u Bhcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=LAzSfz/p/aEVNQoPcW/L+Zrjx/SAnB3wjvrxhc9PO+E=; b=Pgea0xZojqR1ijVzKkUQRTHzJMWsh98tfvPjaZy1CU9MuHME8qo2brVVBntDDsK1gm SkHw/DuWvBFlDwCRww+a6GvG3XTYm70ryCuEznosWQ28giiT3YMIFAfNo3D1bJ4vuu8H Q2RwPm3llJvn2SLtkkAMg1mkvQwVLUsolvC9CBDLrm8PU3Bz8wSGPH2t/Pa0j53JVAIi ZtuPaPQ/rfT/cOOg2aqf9wTrO5OEqKRstL4+cdVU4/S4/Zd0DHP0Bg4HMCmDG9wgzrjP umU4OrUj/w0Ya8lMaz68cjtt0QS4FXq2mjJYqrvEDkomA2Ng+dMRIYkxuMpOh5c8AKM4 kkqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=S3M7cEnx; spf=pass (google.com: best guess record for domain of linux-omap-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-omap-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k13-v6si7251152pgt.285.2018.05.14.01.57.48; Mon, 14 May 2018 01:57:48 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-omap-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=S3M7cEnx; spf=pass (google.com: best guess record for domain of linux-omap-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-omap-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752084AbeENI5q (ORCPT + 5 others); Mon, 14 May 2018 04:57:46 -0400 Received: from mail-pl0-f66.google.com ([209.85.160.66]:40721 "EHLO mail-pl0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752047AbeENI5o (ORCPT ); Mon, 14 May 2018 04:57:44 -0400 Received: by mail-pl0-f66.google.com with SMTP id t12-v6so6981349plo.7 for ; Mon, 14 May 2018 01:57:44 -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=sSEMab6IMNQz3/RjvLiWiFX+Zq0WYBiRrZjP2qAXMUY=; b=S3M7cEnxZRj3XZAA0deHFLTu6i/658UiAOzK3xugklP42QwqR0i4lXVFdJmegRujfx 91gtG1iFaMttC3Vh67DJVGgkEEcQfffiDv6CS9RpepOQJvHTAksZ9Zr0KiejdiLMmX5y SY0oyLGX/XuPzckONQ7lqzXGpdmi45nk/7aMg= 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=sSEMab6IMNQz3/RjvLiWiFX+Zq0WYBiRrZjP2qAXMUY=; b=QGAKqDLew/Wm2SHxCJZNQM4KWWWuWZfpIur82/zu8pzm4N7EWN1DAUAXP69VrWm7/+ C2j5E5CjPDXkDmsNiXKdBev+dOwTeaHPoV9NTlTZCTtE+DME45o250AKBAPHE8i8P3K6 5Y9/2/SsoEw/5+ZhlUbK075hUr7x6Q4QeTgzBJT5QaFgEOgSpJJl70h5ERYhLWdBr44B gOx0L8ITTVgN2A6cw/6Yd6P9U1RfyZ8MGou6jWQaxZPrGS4pz0fHcDEaFcyMLORtRWKi hxaz8V/m7lXqeBHVFwqQyA+tcG347DouAtSPpe9vLZw15YRFw7MIQOmS9jHYP3/ngSpr QVZg== X-Gm-Message-State: ALKqPwdC6XJglgIE692RcYhW2S39wQZH2zT6C/91pVWo4shBR6AS/f1A WRNgZuO7oZNg2FQpComd5uQ+4A== X-Received: by 2002:a17:902:d24:: with SMTP id 33-v6mr8923909plu.22.1526288263753; Mon, 14 May 2018 01:57:43 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([117.18.48.102]) by smtp.gmail.com with ESMTPSA id x71-v6sm23308158pfe.47.2018.05.14.01.57.33 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 14 May 2018 01:57:43 -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: [RFC PATCH 10/10] time: timekeeping: Remove time compensating from nonstop clocksources Date: Mon, 14 May 2018 16:55:36 +0800 Message-Id: X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: In-Reply-To: References: Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org Since we have converted all nonstop clocksources to use persistent clock, thus we can simplify the time compensating by removing the nonstop clocksources. Now we can compensate the suspend time for the OS time from the persistent clock or rtc device. Signed-off-by: Baolin Wang --- kernel/time/timekeeping.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index 49cbcee..48d2a80 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -1666,7 +1666,6 @@ void timekeeping_inject_sleeptime64(struct timespec64 *delta) void timekeeping_resume(void) { struct timekeeper *tk = &tk_core.timekeeper; - struct clocksource *clock = tk->tkr_mono.clock; unsigned long flags; struct timespec64 ts_new, ts_delta; u64 cycle_now; @@ -1682,27 +1681,17 @@ void timekeeping_resume(void) /* * After system resumes, we need to calculate the suspended time and - * compensate it for the OS time. There are 3 sources that could be - * used: Nonstop clocksource during suspend, persistent clock and rtc - * device. + * compensate it for the OS time. There are 2 sources that could be + * used: persistent clock and rtc device. * * One specific platform may have 1 or 2 or all of them, and the * preference will be: - * suspend-nonstop clocksource -> persistent clock -> rtc + * persistent clock -> rtc * The less preferred source will only be tried if there is no better * usable source. The rtc part is handled separately in rtc core code. */ cycle_now = tk_clock_read(&tk->tkr_mono); - if ((clock->flags & CLOCK_SOURCE_SUSPEND_NONSTOP) && - cycle_now > tk->tkr_mono.cycle_last) { - u64 nsec, cyc_delta; - - cyc_delta = clocksource_delta(cycle_now, tk->tkr_mono.cycle_last, - tk->tkr_mono.mask); - nsec = mul_u64_u32_shr(cyc_delta, clock->mult, clock->shift); - ts_delta = ns_to_timespec64(nsec); - sleeptime_injected = true; - } else if (timespec64_compare(&ts_new, &timekeeping_suspend_time) > 0) { + if (timespec64_compare(&ts_new, &timekeeping_suspend_time) > 0) { ts_delta = timespec64_sub(ts_new, timekeeping_suspend_time); sleeptime_injected = true; }