thermal: intel: int340x_thermal: New IOCTLs for Passive v2 table
authorSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Wed, 24 May 2023 12:51:31 +0000 (05:51 -0700)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 13 Jun 2023 15:57:39 +0000 (17:57 +0200)
commitea197ea2ba572cd350f9fe6224a7d6a8347d91ad
tree25e36fff64c0f66760229f5a8652eae2907ea439
parent858fd168a95c5b9669aac8db6c14a9aeab446375
thermal: intel: int340x_thermal: New IOCTLs for Passive v2 table

Export Passive version 2 table similar to the way _TRT and _ART tables
via IOCTLs.

This removes need for binary utility to read ACPI Passive 2 table by
providing open source support. This table already has open source
implementation in the user space thermald, when the table is part of
data vault exported by the int3400 sysfs.

This table is supported in some older platforms before Ice Lake
generation.

Passive 2 tables contain multiple entries. Each entry has following
fields:

 * Source: Named Reference (String). This is the source device for
   temperature.
 * Target: Named Reference (String). This is the target device to
   control.
 * Priority: Priority of this device compared to others.
 * SamplingPeriod: Time Period in 1/10 of seconds unit.
 * PassiveTemp: Passive Temperature in 1/10 of Kelvin.
 * SourceDomain: Domain for the source (00:Processor, others reserved).
 * ControlKnob: Type of control knob (00:Power Limit 1, others: reserved)
 * Limit: The target state to set on reaching passive temperature.
   This can be a string "max", "min" or a power limit value.
 * LimitStepSize: Step size during activation.
 * UnLimitStepSize: Step size during deactivation.
 * Reserved1: Reserved

Three IOCTLs are added similar to IOCTLs for reading TRT:

ACPI_THERMAL_GET_PSVT_COUNT: Number of passive 2 entries.
ACPI_THERMAL_GET_PSVT_LEN: Total return data size (count x each
  passive 2 entry size).
ACPI_THERMAL_GET_PSVT: Get the data as an array of objects with
  passive 2 entries.

This change is based on original development done by:
Todd Brandt <todd.e.brandt@linux.intel.com>

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
[ rjw: Changelog and subject edits ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/thermal/intel/int340x_thermal/acpi_thermal_rel.c
drivers/thermal/intel/int340x_thermal/acpi_thermal_rel.h