Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp2215905rwi; Fri, 28 Oct 2022 04:36:36 -0700 (PDT) X-Google-Smtp-Source: AMsMyM51izyTRkAxmXd6GqDc3kJTCbYTQ59IrUkfmPVMitixBJoHK8VgJB+ELh24Hvgdw5EezbiL X-Received: by 2002:a17:902:d2d2:b0:182:a32f:5ba1 with SMTP id n18-20020a170902d2d200b00182a32f5ba1mr54815790plc.88.1666956995950; Fri, 28 Oct 2022 04:36:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666956995; cv=none; d=google.com; s=arc-20160816; b=DqpNmBhBv9mE57td8rXiiDrUPnA1O3mLLz1sp3x0cWcF9OYk7J4qSJfT9QDa09T4mJ ajEUnaHZeCxJzpFe13b/8TyzAMakvqfG+Fb/RTzoew7F6Rs4qRAhcq1uKX1JM6H0CySy UeqIuXwM2zFxxmdwgXWFxqQJ1L3feVnHcxQCgs6yIbEDo+3b9bySfRxtive5qjAJhpst W28P2MQalYtbMVpC8JY8U/h8KixvDC1MQPcvwbJZ6Che8AGIJgt0b+0LKZjtk0nLZNjc FuhBYWjThBnoQCee8bYazAWC3Hb6AR9gulgc5BvLYFWX44jMG792SEbIq5D3ciDJotSu mvDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=X7zZ7t2Q7/sd1DMqQw0yVyagOnlwwgXn1qIG0DqzLkQ=; b=hd2ZnzXeqK+zMXLU03Gfv0E4BEgheUtVOMK4SxN/TDZBki+CO/ECnt4288kItZ1EpL 1e0mIBP21JI2FNpmMVr40oRaf0n+uPAO8ATjwioOOHJB906sC1Z+p1KbH25lWWi5szz8 JZ8Owcmtzfc7aFBWV1V1RiK1bk6pISwN85JFYmR/D7CBZpmATbLU6io8YzGd+XBB6Iiw bzrYZ+hTX4PCfpqZ2/d4dZuqON1WTQ5P4Ngi1srfw3q5E/Aocp4SC+YjkyIDuDcJMMa/ 4xA0Y4yM2mUYsn/k7zKUHjZIsaayNcOUgrteXsF9H85ITJhMrPi/66vrTLVSh/zdSZZY H1xg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k4-20020a056a00134400b0056b972a8cfasi5654206pfu.121.2022.10.28.04.36.22; Fri, 28 Oct 2022 04:36:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230036AbiJ1Kir (ORCPT + 99 others); Fri, 28 Oct 2022 06:38:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45326 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230448AbiJ1KiS (ORCPT ); Fri, 28 Oct 2022 06:38:18 -0400 Received: from muru.com (muru.com [72.249.23.125]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 91A581C73D8; Fri, 28 Oct 2022 03:38:17 -0700 (PDT) Received: from hillo.muru.com (localhost [127.0.0.1]) by muru.com (Postfix) with ESMTP id 0056A8061; Fri, 28 Oct 2022 10:28:52 +0000 (UTC) From: Tony Lindgren To: Daniel Lezcano , Thomas Gleixner Cc: Grygorii Strashko , Keerthy , Ladislav Michl , Nishanth Menon , Suman Anna , Vignesh Raghavendra , linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH] clocksource/drivers/timer-ti-dm: Clear settings on probe and free Date: Fri, 28 Oct 2022 13:38:13 +0300 Message-Id: <20221028103813.40783-1-tony@atomide.com> X-Mailer: git-send-email 2.37.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Clear the timer control register on driver probe and omap_dm_timer_free(). Otherwise we assume the consumer driver takes care of properly initializing timer interrupts on PWM driver module reload for example. AFAIK this is not currently needed as a fix, I just happened to run into this while cleaning up things. Signed-off-by: Tony Lindgren --- drivers/clocksource/timer-ti-dm.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/clocksource/timer-ti-dm.c b/drivers/clocksource/timer-ti-dm.c --- a/drivers/clocksource/timer-ti-dm.c +++ b/drivers/clocksource/timer-ti-dm.c @@ -633,6 +633,8 @@ static struct omap_dm_timer *omap_dm_timer_request_by_node(struct device_node *n static int omap_dm_timer_free(struct omap_dm_timer *cookie) { struct dmtimer *timer; + struct device *dev; + int rc; timer = to_dmtimer(cookie); if (unlikely(!timer)) @@ -640,6 +642,17 @@ static int omap_dm_timer_free(struct omap_dm_timer *cookie) WARN_ON(!timer->reserved); timer->reserved = 0; + + dev = &timer->pdev->dev; + rc = pm_runtime_resume_and_get(dev); + if (rc) + return rc; + + /* Clear timer configuration */ + dmtimer_write(timer, OMAP_TIMER_CTRL_REG, 0); + + pm_runtime_put_sync(dev); + return 0; } @@ -1135,6 +1148,10 @@ static int omap_dm_timer_probe(struct platform_device *pdev) goto err_disable; } __omap_dm_timer_init_regs(timer); + + /* Clear timer configuration */ + dmtimer_write(timer, OMAP_TIMER_CTRL_REG, 0); + pm_runtime_put(dev); } -- 2.37.3