linux-tegra.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sumit Gupta <sumitg@nvidia.com>
To: <rafael@kernel.org>, <rui.zhang@intel.com>, <lenb@kernel.org>,
	<treding@nvidia.com>, <jonathanh@nvidia.com>,
	<linux-acpi@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<linux-tegra@vger.kernel.org>
Cc: <sumitg@nvidia.com>, <sanjayc@nvidia.com>,
	<ksitaraman@nvidia.com>, <srikars@nvidia.com>,
	<jbrasen@nvidia.com>, <bbasu@nvidia.com>
Subject: [Patch v2 1/2] ACPI: thermal: Add Thermal fast Sampling Period (_TFP) support
Date: Wed, 13 Sep 2023 22:16:58 +0530	[thread overview]
Message-ID: <20230913164659.9345-2-sumitg@nvidia.com> (raw)
In-Reply-To: <20230913164659.9345-1-sumitg@nvidia.com>

From: Jeff Brasen <jbrasen@nvidia.com>

Add support of "Thermal fast Sampling Period (_TFP)" for Passive cooling.
As per [1], _TFP overrides the "Thermal Sampling Period (_TSP)" if both
are present in a Thermal zone.

[1] ACPI Specification 6.4 - section 11.4.17. _TFP (Thermal fast Sampling
    Period)"

Signed-off-by: Jeff Brasen <jbrasen@nvidia.com>
Signed-off-by: Sumit Gupta <sumitg@nvidia.com>
---
 drivers/acpi/thermal.c | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c
index f14e68266ccd..d0bbf42cae9c 100644
--- a/drivers/acpi/thermal.c
+++ b/drivers/acpi/thermal.c
@@ -102,7 +102,7 @@ struct acpi_thermal_passive {
 	struct acpi_handle_list devices;
 	unsigned long tc1;
 	unsigned long tc2;
-	unsigned long tsp;
+	unsigned long passive_delay;
 };
 
 struct acpi_thermal_active {
@@ -287,11 +287,17 @@ static void __acpi_thermal_trips_update(struct acpi_thermal *tz, int flag)
 					tz->trips.passive.tc2 = tmp;
 
 				status = acpi_evaluate_integer(tz->device->handle,
-							       "_TSP", NULL, &tmp);
-				if (ACPI_FAILURE(status))
-					tz->trips.passive.trip.valid = false;
-				else
-					tz->trips.passive.tsp = tmp;
+							       "_TFP", NULL, &tmp);
+				if (ACPI_FAILURE(status)) {
+					status = acpi_evaluate_integer(tz->device->handle,
+								       "_TSP", NULL, &tmp);
+					if (ACPI_FAILURE(status))
+						tz->trips.passive.trip.valid = false;
+					else
+						tz->trips.passive.passive_delay = tmp * 100;
+				} else {
+					tz->trips.passive.passive_delay = tmp;
+				}
 			}
 		}
 	}
@@ -683,7 +689,6 @@ static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz)
 {
 	struct acpi_thermal_trip *acpi_trip;
 	struct thermal_trip *trip;
-	int passive_delay = 0;
 	int trip_count = 0;
 	int result;
 	int i;
@@ -694,10 +699,8 @@ static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz)
 	if (tz->trips.hot.valid)
 		trip_count++;
 
-	if (tz->trips.passive.trip.valid) {
+	if (tz->trips.passive.trip.valid)
 		trip_count++;
-		passive_delay = tz->trips.passive.tsp * 100;
-	}
 
 	for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE && tz->trips.active[i].trip.valid; i++)
 		trip_count++;
@@ -746,7 +749,7 @@ static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz)
 								   0, tz,
 								   &acpi_thermal_zone_ops,
 								   NULL,
-								   passive_delay,
+								   tz->trips.passive.passive_delay,
 								   tz->polling_frequency * 100);
 	if (IS_ERR(tz->thermal_zone)) {
 		result = PTR_ERR(tz->thermal_zone);
-- 
2.17.1


  reply	other threads:[~2023-09-13 16:48 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-13 16:46 [Patch v2 0/2] Add support for _TFP and change throttle pctg Sumit Gupta
2023-09-13 16:46 ` Sumit Gupta [this message]
2023-09-13 16:46 ` [Patch v2 2/2] ACPI: processor: reduce CPUFREQ thermal reduction pctg for Tegra241 Sumit Gupta
2023-09-14  2:09   ` kernel test robot
2023-09-19 11:27     ` Sumit Gupta
2023-09-19 13:54       ` Rafael J. Wysocki
2023-09-19 16:59         ` Sumit Gupta
2023-09-14  2:51   ` kernel test robot
2023-09-14  4:39   ` kernel test robot
2023-10-03 19:37   ` Rafael J. Wysocki
2023-10-06 15:14     ` Sumit Gupta

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=20230913164659.9345-2-sumitg@nvidia.com \
    --to=sumitg@nvidia.com \
    --cc=bbasu@nvidia.com \
    --cc=jbrasen@nvidia.com \
    --cc=jonathanh@nvidia.com \
    --cc=ksitaraman@nvidia.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=rui.zhang@intel.com \
    --cc=sanjayc@nvidia.com \
    --cc=srikars@nvidia.com \
    --cc=treding@nvidia.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;
as well as URLs for NNTP newsgroup(s).