Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp2535425ybd; Thu, 27 Jun 2019 14:12:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqyFVdmwADc0GVbcVi0O8sNKeJZhB4mRQvQCi4Op74Ggek16QJRzWdLiysO5zGiJQa9U5vG6 X-Received: by 2002:a17:902:1e6:: with SMTP id b93mr7042387plb.295.1561669976557; Thu, 27 Jun 2019 14:12:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561669976; cv=none; d=google.com; s=arc-20160816; b=ks2vt5oUz/2ue7wcqbOztgBJSFmc/yol6D0FMM2BFoS2yBcSFd5KFpp+C9vTROpVbn h3H3Te+gcZUrPLykwg3FQhVm91n9eQEd2GdcLeCV6MhHkoXCMJC5aq27J2EfIegGgT5M NbHBCAQodmXeZqzFsXIpCl7F6SLuZLl+ly6tnXQz2ketDUHuKGop9kSnZbgmDNOHxE2B lbsW31lp1S+PotmmXXgYeXLCXolBT1/vFKtEtXtQl+LdG4FQtWhwggUkFzqb1FwP0nHY 1Ce5pNcx0Uls1wDw/KsRvwp6z4/O1iFTC8uVTY1JtSv4blPzTxiM403rZJfuxLfWUhYY 4yOg== 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=12VJs13OPjF9DGDUp85PAmf8xnTp6sUbGcgLhNyWjKk=; b=07JQiwon2Hdt+J+BjfAp6L5FENjY0z1tlum+h1MCUMgQ9lq+EnI0P0yHFpWvZ8wjnJ m2V3X25xA1P3mJHNqgZ+kn8P6+AJRXK0HobIJdVASsaYwWxDn6f+eaefNEVreg8VWdbt SstHdwt+AXotTjvyrF9dq55YZKBldL4TDUV/o1WP1Nuh1t1rOxyL98YCQ7q/Pt4uSsr1 MyK3ujffxaOzS24hT9U4cuH3pPABwfbdldKWEsHiKe8ScKlEip1UYPIv9j+WKS6NPLgG 7G8i4q+x6W6RfTkXnZID50ZKU/I9uC11zc05RH5b9GM1s/o3dh/hm+fJsPS4oIVfgos+ 9MYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=J735c5q6; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p190si110769pfp.266.2019.06.27.14.12.38; Thu, 27 Jun 2019 14:12:56 -0700 (PDT) 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=@gmail.com header.s=20161025 header.b=J735c5q6; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726657AbfF0VMa (ORCPT + 99 others); Thu, 27 Jun 2019 17:12:30 -0400 Received: from mail-lj1-f194.google.com ([209.85.208.194]:43927 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726565AbfF0VM1 (ORCPT ); Thu, 27 Jun 2019 17:12:27 -0400 Received: by mail-lj1-f194.google.com with SMTP id 16so3775418ljv.10; Thu, 27 Jun 2019 14:12:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=12VJs13OPjF9DGDUp85PAmf8xnTp6sUbGcgLhNyWjKk=; b=J735c5q6XCcWq/wBeoa+K9ELgOTwtM1t+MGpI3UlCOToqIWBiwQ+AsYc2KZrEOxMrB y2iDjLSR7kLn9XM58fHfuqzH+qhy38Zoo5EG81WaZOAkhXZiF+jsGMp/oE6VpfGG50MN QDZ8QirP5XBXFes2Q8yc+jwMuEpo/+VnNcg8D+bDlKMAYw5IjA2pNIEKzYMdL6znI/bm SZmiNBgmf09DsIBDXEWZSJTEIZJ+yVURqKWCUOgGup1nrs2zCLkY+H2iNLW6DLW8gK1O PO5ksXGQuJPZy9sAMHCFYQ2M8ul1TlXA7mu8N0Rimp1vRWPK/2W00oDIXWZHWxO4BdNV +EPg== 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:mime-version:content-transfer-encoding; bh=12VJs13OPjF9DGDUp85PAmf8xnTp6sUbGcgLhNyWjKk=; b=Ro0wMSOL4u1KeukL2OKmrej4lyNkzCPtxcrRCXNsUC5vakhQtlOij6I2NFiQd9I4WU Y/eLLW8G9nWFECx0ZZ8ELuKmBVSx8ocEsXxOdqJWKnNiFkmhAnfZK55exbXRRDciU/UW gbe3DkrS2yDgq0H/BQWeThexZQ7ESUVIKQ8SG8Jp68E5ZVXGGvDU9w/BIVNvN9f7s+81 L/A8cXN4WpTObfTfLF1Tes3Eg5jFuuiZyInCgtFD2t+srfQtHSz3E7tK4UVtaVX2T+nK DwLwkooTYmH2QEYByOXLX4dgCyRW5Bfr05NjMbsTMS7R64BNTfiBNSJBKp84KHZ/6f+g O70Q== X-Gm-Message-State: APjAAAXM4kK4+qlSE8rCq6lZeI9vggma4sQM5m2vT3iTNykZ53YU8fBA tTXx97MkgbgbWKPcLuJdeAt/HMLy X-Received: by 2002:a2e:9a19:: with SMTP id o25mr4048763lji.63.1561669945700; Thu, 27 Jun 2019 14:12:25 -0700 (PDT) Received: from localhost.localdomain (ppp91-79-162-197.pppoe.mtu-net.ru. [91.79.162.197]) by smtp.gmail.com with ESMTPSA id p29sm30485ljp.87.2019.06.27.14.12.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 27 Jun 2019 14:12:24 -0700 (PDT) From: Dmitry Osipenko To: Thierry Reding , MyungJoo Ham , Kyungmin Park , Chanwoo Choi , Jonathan Hunter , Tomeu Vizoso Cc: linux-pm@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 02/22] PM / devfreq: tegra30: Keep interrupt disabled while governor is stopped Date: Fri, 28 Jun 2019 00:10:55 +0300 Message-Id: <20190627211115.21138-3-digetx@gmail.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190627211115.21138-1-digetx@gmail.com> References: <20190627211115.21138-1-digetx@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There is no real need to keep interrupt always-enabled, will be nicer to keep it disabled while governor is inactive. Suggested-by: Thierry Reding Signed-off-by: Dmitry Osipenko --- drivers/devfreq/tegra30-devfreq.c | 43 ++++++++++++++++--------------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/drivers/devfreq/tegra30-devfreq.c b/drivers/devfreq/tegra30-devfreq.c index a27300f40b0b..5e2b133babdd 100644 --- a/drivers/devfreq/tegra30-devfreq.c +++ b/drivers/devfreq/tegra30-devfreq.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -416,8 +417,6 @@ static void tegra_actmon_start(struct tegra_devfreq *tegra) { unsigned int i; - disable_irq(tegra->irq); - actmon_writel(tegra, ACTMON_SAMPLING_PERIOD - 1, ACTMON_GLB_PERIOD_CTRL); @@ -442,8 +441,6 @@ static void tegra_actmon_stop(struct tegra_devfreq *tegra) } actmon_write_barrier(tegra); - - enable_irq(tegra->irq); } static int tegra_devfreq_target(struct device *dev, unsigned long *freq, @@ -552,6 +549,12 @@ static int tegra_governor_event_handler(struct devfreq *devfreq, { struct tegra_devfreq *tegra = dev_get_drvdata(devfreq->dev.parent); + /* + * Couple device with the governor early as it is needed at + * the moment of governor's start (used by ISR). + */ + tegra->devfreq = devfreq; + switch (event) { case DEVFREQ_GOV_START: devfreq_monitor_start(devfreq); @@ -586,10 +589,11 @@ static struct devfreq_governor tegra_devfreq_governor = { static int tegra_devfreq_probe(struct platform_device *pdev) { - struct tegra_devfreq *tegra; struct tegra_devfreq_device *dev; - unsigned int i; + struct tegra_devfreq *tegra; + struct devfreq *devfreq; unsigned long rate; + unsigned int i; int err; tegra = devm_kzalloc(&pdev->dev, sizeof(*tegra), GFP_KERNEL); @@ -625,6 +629,16 @@ static int tegra_devfreq_probe(struct platform_device *pdev) } tegra->irq = err; + irq_set_status_flags(tegra->irq, IRQ_NOAUTOEN); + + err = devm_request_threaded_irq(&pdev->dev, tegra->irq, NULL, + actmon_thread_isr, IRQF_ONESHOT, + "tegra-devfreq", tegra); + if (err) { + dev_err(&pdev->dev, "Interrupt request failed: %d\n", err); + return err; + } + reset_control_assert(tegra->reset); err = clk_prepare_enable(tegra->clock); @@ -672,28 +686,15 @@ static int tegra_devfreq_probe(struct platform_device *pdev) } tegra_devfreq_profile.initial_freq = clk_get_rate(tegra->emc_clock); - tegra->devfreq = devfreq_add_device(&pdev->dev, - &tegra_devfreq_profile, - "tegra_actmon", - NULL); + devfreq = devfreq_add_device(&pdev->dev, &tegra_devfreq_profile, + "tegra_actmon", NULL); if (IS_ERR(tegra->devfreq)) { err = PTR_ERR(tegra->devfreq); goto remove_governor; } - err = devm_request_threaded_irq(&pdev->dev, tegra->irq, NULL, - actmon_thread_isr, IRQF_ONESHOT, - "tegra-devfreq", tegra); - if (err) { - dev_err(&pdev->dev, "Interrupt request failed: %d\n", err); - goto remove_devfreq; - } - return 0; -remove_devfreq: - devfreq_remove_device(tegra->devfreq); - remove_governor: devfreq_remove_governor(&tegra_devfreq_governor); -- 2.22.0