Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp2031737ybv; Sun, 23 Feb 2020 21:09:21 -0800 (PST) X-Google-Smtp-Source: APXvYqwyhKRyblPyN6ZJtCW3RcbjMq2qBbhzN+w0/bi5Parm4gIrNqfy3qOLPRiMbVBg+BfhXMuU X-Received: by 2002:a54:448b:: with SMTP id v11mr10964365oiv.74.1582520961575; Sun, 23 Feb 2020 21:09:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582520961; cv=none; d=google.com; s=arc-20160816; b=NpEEcMSKRKM/I2Bbo51Mloo14F1bJl1UdQfTECYbizPnROBKWVf9dlMpyXrrKPNKlq bQXCMLdQzyiZz6c025J3stFZkZCUMXVCbruI3V6QmqGyOaSTuJD5bCU4cnEDQsMv9UJr QS82w9oh7PkUIrLQVZ4rf41b0YVZbsjNNecHLrDoVZWV1fMU94sWm4pAkg4yM2XxVxRA PEEdCDQFVY2WuCfk/5ggC5UNXUZlEhZfpYyimvq25tqz5ju7h58V82j7IP54VX6Qyygj 7sjqXg8aPTrjbe/Kop2GRfgbmCjEADuuxeCHS+l1+goBCB6NjagQ0EwNO1UxlLdrvL9U ta7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Rl9mP7346FmUgsFlfQHPHIgoAbb44S30T/NYsb34Dok=; b=U1aMyAySSZGcpBjvcj4U98MH/+Z4h7rpfDRiMmtde2Mw6ym2fgHOHM0w8pV3Nx2YfM LeIqPRpc7wb8MVw37XVvo54g1GgMtnbenxiz56fHJbDjJCVbC2ebL5yKZ1eT4jyDcpJl lx0d3Ki3+HfMEio0osEmvnnnpAf8ffYiOb55+FlrMbc1b1aHAhUK3IzPTE1WfZ7zIO6M S6XnDNapPScgIxIUTRkaZJJV67RSyDuaEg896WFyxcXUau5PnXXi1E8wFRNHATtpoP7k m49JYrTKD3+I/HYpc0onUBK3ZnaZbgyDaQINFFXRSituP/UyGQkEj1k/cbhw0AwZyrXI y1zw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=Yjy7E5qm; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v9si4397291oie.22.2020.02.23.21.09.09; Sun, 23 Feb 2020 21:09:21 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=Yjy7E5qm; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727187AbgBXFJB (ORCPT + 99 others); Mon, 24 Feb 2020 00:09:01 -0500 Received: from fllv0016.ext.ti.com ([198.47.19.142]:44670 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725809AbgBXFJA (ORCPT ); Mon, 24 Feb 2020 00:09:00 -0500 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 01O58ndh043261; Sun, 23 Feb 2020 23:08:49 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1582520930; bh=Rl9mP7346FmUgsFlfQHPHIgoAbb44S30T/NYsb34Dok=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=Yjy7E5qmMS0MMSI82l1zW2oECvnlG8OX2jdiJVNMjHm+oTMcFneIbnZEjocN4ypC1 lT+yvYAt2aUWeUL33vnkWp8b3Mb+FNRjiIBZbS3/oBtexSaF3lkqJcTokqoDHqf/f3 eepRFrePOoO8Ixp2nZrMs//LRezqWvN3Ip8Gd65E= Received: from DLEE104.ent.ti.com (dlee104.ent.ti.com [157.170.170.34]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTP id 01O58nrW096125; Sun, 23 Feb 2020 23:08:49 -0600 Received: from DLEE112.ent.ti.com (157.170.170.23) by DLEE104.ent.ti.com (157.170.170.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1847.3; Sun, 23 Feb 2020 23:08:49 -0600 Received: from fllv0040.itg.ti.com (10.64.41.20) by DLEE112.ent.ti.com (157.170.170.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1847.3 via Frontend Transport; Sun, 23 Feb 2020 23:08:49 -0600 Received: from uda0131933.dhcp.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0040.itg.ti.com (8.15.2/8.15.2) with ESMTP id 01O58g4o113272; Sun, 23 Feb 2020 23:08:46 -0600 From: Lokesh Vutla To: Tony Lindgren , Daniel Lezcano , Thomas Gleixner CC: Linux OMAP Mailing List , , , Sekhar Nori , Tero Kristo , Lokesh Vutla Subject: [PATCH 1/2] clocksource: timer-ti-dm: Do not restore context on every timer enable Date: Mon, 24 Feb 2020 10:37:52 +0530 Message-ID: <20200224050753.17784-2-lokeshvutla@ti.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20200224050753.17784-1-lokeshvutla@ti.com> References: <20200224050753.17784-1-lokeshvutla@ti.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org omap_dm_timer_enable() restores the entire context(including counter) based on 2 conditions: - If get_context_loss_count is populated and context is lost. - If get_context_loss_count is not populated update unconditionally. Case2 has a side effect of updating the counter register even though context is not lost. When timer is configured in pwm mode, this is causing undesired behaviour in the pwm period. So restore context only if get_context_loss_count is populated and context is actually lost. Signed-off-by: Lokesh Vutla --- drivers/clocksource/timer-ti-dm.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/clocksource/timer-ti-dm.c b/drivers/clocksource/timer-ti-dm.c index 269a994d6a99..40742715ed21 100644 --- a/drivers/clocksource/timer-ti-dm.c +++ b/drivers/clocksource/timer-ti-dm.c @@ -229,15 +229,12 @@ static void omap_dm_timer_enable(struct omap_dm_timer *timer) pm_runtime_get_sync(&timer->pdev->dev); - if (!(timer->capability & OMAP_TIMER_ALWON)) { - if (timer->get_context_loss_count) { - c = timer->get_context_loss_count(&timer->pdev->dev); - if (c != timer->ctx_loss_count) { - omap_timer_restore_context(timer); - timer->ctx_loss_count = c; - } - } else { + if (!(timer->capability & OMAP_TIMER_ALWON) && + timer->get_context_loss_count) { + c = timer->get_context_loss_count(&timer->pdev->dev); + if (c != timer->ctx_loss_count) { omap_timer_restore_context(timer); + timer->ctx_loss_count = c; } } } -- 2.23.0