public inbox for linux-acpi@vger.kernel.org
 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>
Cc: <sumitg@nvidia.com>, <sanjayc@nvidia.com>,
	<ksitaraman@nvidia.com>, <srikars@nvidia.com>,
	<jbrasen@nvidia.com>, <bbasu@nvidia.com>
Subject: [Patch 1/2] ACPI: thermal: Add Thermal fast Sampling Period (_TFP) support
Date: Thu, 17 Aug 2023 15:00:10 +0530	[thread overview]
Message-ID: <20230817093011.1378-2-sumitg@nvidia.com> (raw)
In-Reply-To: <20230817093011.1378-1-sumitg@nvidia.com>

From: Jeff Brasen <jbrasen@nvidia.com>

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

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

diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c
index f9f6ebb08fdb..5dee3722509c 100644
--- a/drivers/acpi/thermal.c
+++ b/drivers/acpi/thermal.c
@@ -111,7 +111,7 @@ struct acpi_thermal_passive {
 	unsigned long temperature;
 	unsigned long tc1;
 	unsigned long tc2;
-	unsigned long tsp;
+	unsigned long sampling_period;
 	bool valid;
 };
 
@@ -289,11 +289,18 @@ static int 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.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.valid = false;
+					else
+						tz->trips.passive.sampling_period = tmp * 100;
+
+				} else {
+					tz->trips.passive.sampling_period = tmp;
+				}
 			}
 		}
 	}
@@ -765,7 +772,7 @@ static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz)
 	if (tz->trips.passive.valid)
 		tz->thermal_zone = thermal_zone_device_register("acpitz", trips, 0, tz,
 								&acpi_thermal_zone_ops, NULL,
-								tz->trips.passive.tsp * 100,
+								tz->trips.passive.sampling_period,
 								tz->polling_frequency * 100);
 	else
 		tz->thermal_zone =
-- 
2.17.1


  reply	other threads:[~2023-08-17  9:31 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-17  9:30 [Patch 0/2] Add support for _TFP and configurable throttle pctg Sumit Gupta
2023-08-17  9:30 ` Sumit Gupta [this message]
2023-08-18 18:33   ` [Patch 1/2] ACPI: thermal: Add Thermal fast Sampling Period (_TFP) support Rafael J. Wysocki
2023-08-21 11:48     ` Sumit Gupta
2023-08-17  9:30 ` [Patch 2/2] ACPI: processor: Add support to configure CPUFREQ reduction pctg Sumit Gupta
2023-08-18 18:40   ` Rafael J. Wysocki
2023-08-21 13:24     ` Sumit Gupta
2023-08-21 17:09       ` Rafael J. Wysocki
2023-08-24 13:18         ` 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=20230817093011.1378-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=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