public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
From: Nicolas Chauvet <kwizart@gmail.com>
To: Thierry Reding <thierry.reding@gmail.com>,
	Jonathan Hunter <jonathanh@nvidia.com>,
	Zhang Rui <rui.zhang@intel.com>,
	Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: linux-tegra@vger.kernel.org, linux-pm@vger.kernel.org,
	Nicolas Chauvet <kwizart@gmail.com>,
	stable@vger.kernel.org
Subject: [PATCH v2 6/6] thermal: tegra: Avoid setting edp_irq when not relevant
Date: Sun, 27 Sep 2020 17:09:56 +0200	[thread overview]
Message-ID: <20200927150956.34609-7-kwizart@gmail.com> (raw)
In-Reply-To: <20200927150956.34609-1-kwizart@gmail.com>

According to the binding, the edp_irq is not available on tegra124/132

This commit moves the initialization of tegra->edp_irq after the
introduced has_edp_irq condition. This will have the following effects:
 - soctherm_interrupts_init will not return prematurely with unfinished
thermal_irq initialization on tegra124 and tegra132
 - edp_irq initialization will be done only when relevant

As a result, this will clear the following error on jetson-tk1 :
  kernel: tegra_soctherm 700e2000.thermal-sensor: IRQ index 1 not found

v2:
    * Use .has_edp_irq boolean instead of of_compatible
    * Switch subject prefix to use thermal instead of ARM

Fixes: 4a04beb1bf2e (thermal: tegra: add support for EDP IRQ)
Cc: stable@vger.kernel.org
Signed-off-by: Nicolas Chauvet <kwizart@gmail.com>
---
 drivers/thermal/tegra/soctherm.c          | 38 +++++++++++++----------
 drivers/thermal/tegra/soctherm.h          |  1 +
 drivers/thermal/tegra/tegra124-soctherm.c |  1 +
 drivers/thermal/tegra/tegra132-soctherm.c |  1 +
 drivers/thermal/tegra/tegra210-soctherm.c |  1 +
 5 files changed, 26 insertions(+), 16 deletions(-)

diff --git a/drivers/thermal/tegra/soctherm.c b/drivers/thermal/tegra/soctherm.c
index 66e0639da4bf..0c79e033e7ea 100644
--- a/drivers/thermal/tegra/soctherm.c
+++ b/drivers/thermal/tegra/soctherm.c
@@ -2025,12 +2025,6 @@ static int soctherm_interrupts_init(struct platform_device *pdev,
 		return 0;
 	}
 
-	tegra->edp_irq = platform_get_irq(pdev, 1);
-	if (tegra->edp_irq < 0) {
-		dev_dbg(&pdev->dev, "get 'edp_irq' failed.\n");
-		return 0;
-	}
-
 	ret = devm_request_threaded_irq(&pdev->dev,
 					tegra->thermal_irq,
 					soctherm_thermal_isr,
@@ -2043,16 +2037,28 @@ static int soctherm_interrupts_init(struct platform_device *pdev,
 		return ret;
 	}
 
-	ret = devm_request_threaded_irq(&pdev->dev,
-					tegra->edp_irq,
-					soctherm_edp_isr,
-					soctherm_edp_isr_thread,
-					IRQF_ONESHOT,
-					"soctherm_edp",
-					tegra);
-	if (ret < 0) {
-		dev_err(&pdev->dev, "request_irq 'edp_irq' failed.\n");
-		return ret;
+	/* Initialize edp_irq when available */
+	if (tegra->soc->has_edp_irq) {
+		/* get IRQ */
+
+		tegra->edp_irq = platform_get_irq(pdev, 1);
+		if (tegra->edp_irq < 0) {
+			dev_dbg(&pdev->dev, "get 'edp_irq' failed.\n");
+			return 0;
+		}
+
+		/* request IRQ */
+		ret = devm_request_threaded_irq(&pdev->dev,
+						tegra->edp_irq,
+						soctherm_edp_isr,
+						soctherm_edp_isr_thread,
+						IRQF_ONESHOT,
+						"soctherm_edp",
+						tegra);
+		if (ret < 0) {
+			dev_err(&pdev->dev, "request_irq 'edp_irq' failed.\n");
+			return ret;
+		}
 	}
 
 	return 0;
diff --git a/drivers/thermal/tegra/soctherm.h b/drivers/thermal/tegra/soctherm.h
index 70501e73d586..b93cfdd06e5d 100644
--- a/drivers/thermal/tegra/soctherm.h
+++ b/drivers/thermal/tegra/soctherm.h
@@ -128,6 +128,7 @@ struct tegra_soctherm_soc {
 	const int thresh_grain;
 	const unsigned int bptt;
 	const bool use_ccroc;
+	const bool has_edp_irq;
 	struct tsensor_group_thermtrips *thermtrips;
 };
 
diff --git a/drivers/thermal/tegra/tegra124-soctherm.c b/drivers/thermal/tegra/tegra124-soctherm.c
index 20ad27f4d1a1..c8c8231f6cdd 100644
--- a/drivers/thermal/tegra/tegra124-soctherm.c
+++ b/drivers/thermal/tegra/tegra124-soctherm.c
@@ -216,4 +216,5 @@ const struct tegra_soctherm_soc tegra124_soctherm = {
 	.thresh_grain = TEGRA124_THRESH_GRAIN,
 	.bptt = TEGRA124_BPTT,
 	.use_ccroc = false,
+	.has_edp_irq = false,
 };
diff --git a/drivers/thermal/tegra/tegra132-soctherm.c b/drivers/thermal/tegra/tegra132-soctherm.c
index b76308fdad9e..1bc9481de5fc 100644
--- a/drivers/thermal/tegra/tegra132-soctherm.c
+++ b/drivers/thermal/tegra/tegra132-soctherm.c
@@ -216,4 +216,5 @@ const struct tegra_soctherm_soc tegra132_soctherm = {
 	.thresh_grain = TEGRA132_THRESH_GRAIN,
 	.bptt = TEGRA132_BPTT,
 	.use_ccroc = true,
+	.has_edp_irq = false,
 };
diff --git a/drivers/thermal/tegra/tegra210-soctherm.c b/drivers/thermal/tegra/tegra210-soctherm.c
index d0ff793f18c5..2b09c8a811d0 100644
--- a/drivers/thermal/tegra/tegra210-soctherm.c
+++ b/drivers/thermal/tegra/tegra210-soctherm.c
@@ -224,5 +224,6 @@ const struct tegra_soctherm_soc tegra210_soctherm = {
 	.thresh_grain = TEGRA210_THRESH_GRAIN,
 	.bptt = TEGRA210_BPTT,
 	.use_ccroc = false,
+	.has_edp_irq = true,
 	.thermtrips = tegra210_tsensor_thermtrips,
 };
-- 
2.25.4


  parent reply	other threads:[~2020-09-27 15:10 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-27 15:09 [PATCH v2 0/6] thermal: tegra: soctherm bugfixes Nicolas Chauvet
2020-09-27 15:09 ` [PATCH v2 1/6] ARM: tegra: Add missing gpu-throt-level to tegra124 soctherm Nicolas Chauvet
2020-09-27 15:09 ` [PATCH v2 2/6] ARM: tegra: Add missing hot temperatures to tegra124 thermal-zones Nicolas Chauvet
2020-09-27 15:09 ` [PATCH v2 3/6] arm64: tegra: Add missing hot temperatures to tegra132 thermal-zones Nicolas Chauvet
2020-09-27 15:09 ` [PATCH v2 4/6] arm64: tegra: Add missing gpu-throt-level to tegra210 soctherm Nicolas Chauvet
2020-09-27 15:09 ` [PATCH v2 5/6] arm64: tegra: Add missing hot temperatures to tegra210 thermal-zones Nicolas Chauvet
2020-09-27 15:09 ` Nicolas Chauvet [this message]
2020-11-19 19:15   ` [PATCH v2 6/6] thermal: tegra: Avoid setting edp_irq when not relevant Jon Hunter
2020-11-19 11:00 ` [PATCH v2 0/6] thermal: tegra: soctherm bugfixes Nicolas Chauvet
2020-11-19 11:04   ` Daniel Lezcano
2020-11-20 15:07     ` Thierry Reding
2020-11-20 16:14 ` Thierry Reding

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200927150956.34609-7-kwizart@gmail.com \
    --to=kwizart@gmail.com \
    --cc=daniel.lezcano@linaro.org \
    --cc=jonathanh@nvidia.com \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=rui.zhang@intel.com \
    --cc=stable@vger.kernel.org \
    --cc=thierry.reding@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox