Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp1875208ybd; Sun, 23 Jun 2019 18:58:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqweU07Z2pFqc58irs6uONzfePmR3ninbuPdSOutd7A2i8tdJ+DILXBv3k4tzvS+wpTeU8ne X-Received: by 2002:a17:902:8509:: with SMTP id bj9mr30471510plb.79.1561341483292; Sun, 23 Jun 2019 18:58:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561341483; cv=none; d=google.com; s=arc-20160816; b=VO0jwhH3YCD/n2/KKxWB/KwrwDjBF6cS1Z3MjBCPOdajiQxbrT2jYM35Qpt7EXaew/ /lV/h74xv+PnXZ9NyMnwbYlKxldX138AmhLmisiqitZ+jMmBvHqYZL2D1evFJua1OaQ4 jFLkX4j1o8lFPLFSe7f5TQjk8BKsL1c9EkVHKUN7xiQAWk9tOjQMlDMbDzKhqsz2xsPW pYi2/WS62nsxjgd3hPBFVuTxB/nBWBwX59npSX/wzBJY4sdc/cE7Zxf3WmUyP0ExAJ8p Zo6CmvTLflNy9AGkNg0jqnEet/eXuhAWDJ0YpqG2HEe4Eyj4VglB+bsYa5Tmi4j2wE/D 8f5A== 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=pV5FdcPTSttSNilu3xNSfhA13rB7Fsv+D3UEkNB3Vao=; b=fV8weVTJOckgZy8JFp5w0nEzfBIlVakdmNI8GUjRc6F2Z6NAfLIBlweMG8lcVpXYK1 2LQZM7O6xwflwiVuGTO7AMFBrMCoCCsvgbGuKHIUxdcqveYKsxr/aLjZ+R4q7h/5/vwy 67UF3uVWpki+lnI/OdIvhW5HZSclH9P4eQIYMT/jmTUyBoz2+PsFUnYAf1LxZ7nxt6Do WiCiMXoj37Xwxkf+VRM5t1zGNlB2KKfb6OEShJ7nThGQnw63YA7u71vK4SolgEj6A2/c nq+voVfxU/2/8Ob+4xg0Oc4FHrNjp7wrtDeoDv/IaMhrm7NiIUyH8qAWdRT8YFnFt7Un vylg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=j2nVHNaU; 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 d9si9057769pgj.505.2019.06.23.18.57.46; Sun, 23 Jun 2019 18:58:03 -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=j2nVHNaU; 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 S1726674AbfFXB50 (ORCPT + 99 others); Sun, 23 Jun 2019 21:57:26 -0400 Received: from mail-lf1-f67.google.com ([209.85.167.67]:34995 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726304AbfFXB5Z (ORCPT ); Sun, 23 Jun 2019 21:57:25 -0400 Received: by mail-lf1-f67.google.com with SMTP id a25so8779735lfg.2; Sun, 23 Jun 2019 18:57:23 -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=pV5FdcPTSttSNilu3xNSfhA13rB7Fsv+D3UEkNB3Vao=; b=j2nVHNaUaDmfaQ1v1oLYjsmWH4Df86NddlNnTBVZhahWGH9Zc67quvXy3RLaAd0Pir ggQdukCgt0XpA265FRrSxiGfdna2OAN1QQke71K6IxsCI3xmUX8VzGedX6a2TnuYn3JE pxMrQgt5fjZVg+W0uaNQY4L3Hq7FXf5FsB/PZ91+L9TJ8DSHg+uKpqXaKWtB3O9Uowl1 4yJOpwpxg3O90trBwwKW8SOicbyrNfjRBkR8Xw619Kx9txpoTG8/WWmefBRkHfECNLTc 62Aaa1UEWhH+uSiTSjC5gPT0AiZrjyBoeeqZGkLy6Grcf66W4youuigcOACjMRNYq57F kxFw== 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=pV5FdcPTSttSNilu3xNSfhA13rB7Fsv+D3UEkNB3Vao=; b=I1X7ig1xmtIDoT0FvT2kDwuXtK7bvyex1a+uVv4RxhdxEbFxIYlkytMPPyN4aKg7EX O19VV34wk8ADb43/eY1WAQBuPPSJox2qxTOi+o6Fyix7Afhh8YH/QmUyUU+0oRSlwpqj /5JbNKkXv75RlWCx3HgKE7hZ8YSskw5nKCsy5z2ejv/917knPqHVPlYXOQ2/4ejLWrGv 8MUMZOTUA1dwXsTWlb4FEA+9FidAIrKvxtqlsasaUWxrC17i2kAwgLG9kzZBsPqxTdXS +woFOCG4vRX49+oq2Pm6YPRfZaupOvD/iHEalCbTfkRwPfN4octYzdBGsaLvDmJNO43l AsWg== X-Gm-Message-State: APjAAAUJjAs6WDBeIAtKoCt+CKh6XRtTcSIKJ2zXj4KNF5yB6OEi/7wb juAGWUOhgR1yQe4mA6c+7AJI60OI X-Received: by 2002:a19:f808:: with SMTP id a8mr10291071lff.29.1561326516944; Sun, 23 Jun 2019 14:48:36 -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 m17sm1460029lfb.9.2019.06.23.14.48.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 23 Jun 2019 14:48:36 -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 v1 02/11] PM / devfreq: tegra30: Keep interrupt disabled while governor is stopped Date: Mon, 24 Jun 2019 00:46:49 +0300 Message-Id: <20190623214658.11680-3-digetx@gmail.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190623214658.11680-1-digetx@gmail.com> References: <20190623214658.11680-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 where appropriate. 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