Files
linux/drivers/acpi/fan.h
Linus Torvalds 619f4edc8d Merge tag 'thermal-6.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull thermal control updates from Rafael Wysocki:
 "These add Nova Lake processor support to the Intel thermal drivers and
  DPTF code, update thermal control documentation, simplify the ACPI
  DPTF code related to thermal control, add QCS8300 compatible to the
  tsens thermal DT bindings, add DT bindings for NXP i.MX91 thermal
  module and add support for it to the imx91 thermal driver, update a
  few other thermal drivers and fix a format string issue in a thermal
  utility:

   - Add Nova Lake processor thermal device to the int340x
     processor_thermal driver, add DLVR support for Nova Lake to it, add
     Nova Lake support to the ACPI DPTF code, document thermal
     throttling on Intel platforms, and update workload type hint
     interface documentation (Srinivas Pandruvada)

   - Remove int340x thermal scan handler from the ACPI DPTF code because
     it turned out to be unnecessary (Slawomir Rosek)

   - Clean up the Intel int340x thermal driver (Kaushlendra Kumar)

   - Document the RZ/V2H TSU DT bindings (Ovidiu Panait)

   - Document the Kaanapali Temperature Sensor (Manaf Meethalavalappu
     Pallikunhi)

   - Document R-Car Gen4 and RZ/G2 support in driver comment (Marek
     Vasut)

   - Convert to DEFINE_SIMPLE_DEV_PM_OPS() in R-Car [Gen3] (Geert
     Uytterhoeven)

   - Fix format string bug in thermal-engine (Malaya Kumar Rout)

   - Make ipq5018 tsens standalone compatible (George Moussalem)

   - Add the QCS8300 compatible for QCom Tsens (Gaurav Kohli)

   - Add support for the NXP i.MX91 thermal module, including the DT
     bindings (Pengfei Li)"

* tag 'thermal-6.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
  thermal/drivers/imx91: Add support for i.MX91 thermal monitoring unit
  dt-bindings: thermal: fsl,imx91-tmu: add bindings for NXP i.MX91 thermal module
  dt-bindings: thermal: tsens: Add QCS8300 compatible
  dt-bindings: thermal: qcom-tsens: make ipq5018 tsens standalone compatible
  tools/thermal/thermal-engine: Fix format string bug in thermal-engine
  docs: driver-api/thermal/intel_dptf: Add new workload type hint
  thermal/drivers/rcar_gen3: Convert to DEFINE_SIMPLE_DEV_PM_OPS()
  thermal/drivers/rcar: Convert to DEFINE_SIMPLE_DEV_PM_OPS()
  Documentation: thermal: Document thermal throttling on Intel platforms
  ACPI: DPTF: Support Nova Lake
  thermal: intel: int340x: Add DLVR support for Nova Lake
  thermal: int340x: processor_thermal: Add Nova Lake processor thermal device
  thermal: intel: int340x: Replace sprintf() with sysfs_emit()
  thermal: intel: int340x: Use symbolic constant for UUID comparison
  thermal/drivers/rcar_gen3: Document R-Car Gen4 and RZ/G2 support in driver comment
  dt-bindings: thermal: qcom-tsens: document the Kaanapali Temperature Sensor
  dt-bindings: thermal: r9a09g047-tsu: Document RZ/V2H TSU
  ACPI: DPTF: Remove int340x thermal scan handler
  thermal: intel: Select INT340X_THERMAL from INTEL_SOC_DTS_THERMAL
2025-12-02 17:49:12 -08:00

115 lines
3.2 KiB
C

/* SPDX-License-Identifier: GPL-2.0-only */
/*
* ACPI fan device IDs are shared between the fan driver and the device power
* management code.
*
* Add new device IDs before the generic ACPI fan one.
*/
#ifndef _ACPI_FAN_H_
#define _ACPI_FAN_H_
#include <linux/kconfig.h>
#include <linux/limits.h>
#define ACPI_FAN_DEVICE_IDS \
{"INT3404", }, /* Fan */ \
{"INTC1044", }, /* Fan for Tiger Lake generation */ \
{"INTC1048", }, /* Fan for Alder Lake generation */ \
{"INTC1063", }, /* Fan for Meteor Lake generation */ \
{"INTC106A", }, /* Fan for Lunar Lake generation */ \
{"INTC10A2", }, /* Fan for Raptor Lake generation */ \
{"INTC10D6", }, /* Fan for Panther Lake generation */ \
{"INTC10FE", }, /* Fan for Wildcat Lake generation */ \
{"INTC10F5", }, /* Fan for Nova Lake generation */ \
{"PNP0C0B", } /* Generic ACPI fan */
#define ACPI_FPS_NAME_LEN 20
struct acpi_fan_fps {
u64 control;
u64 trip_point;
u64 speed;
u64 noise_level;
u64 power;
char name[ACPI_FPS_NAME_LEN];
struct device_attribute dev_attr;
};
struct acpi_fan_fif {
u8 revision;
u8 fine_grain_ctrl;
u8 step_size;
u8 low_speed_notification;
};
struct acpi_fan_fst {
u64 revision;
u64 control;
u64 speed;
};
struct acpi_fan {
acpi_handle handle;
bool acpi4;
bool has_fst;
struct acpi_fan_fif fif;
struct acpi_fan_fps *fps;
int fps_count;
/* A value of 0 means that trippoint-related functions are not supported */
u32 fan_trip_granularity;
#if IS_REACHABLE(CONFIG_HWMON)
struct device *hdev;
#endif
struct thermal_cooling_device *cdev;
struct device_attribute fst_speed;
struct device_attribute fine_grain_control;
};
/**
* acpi_fan_speed_valid - Check if fan speed value is valid
* @speeed: Speed value returned by the ACPI firmware
*
* Check if the fan speed value returned by the ACPI firmware is valid. This function is
* necessary as ACPI firmware implementations can return 0xFFFFFFFF to signal that the
* ACPI fan does not support speed reporting. Additionally, some buggy ACPI firmware
* implementations return a value larger than the 32-bit integer value defined by
* the ACPI specification when using placeholder values. Such invalid values are also
* detected by this function.
*
* Returns: True if the fan speed value is valid, false otherwise.
*/
static inline bool acpi_fan_speed_valid(u64 speed)
{
return speed < U32_MAX;
}
/**
* acpi_fan_power_valid - Check if fan power value is valid
* @power: Power value returned by the ACPI firmware
*
* Check if the fan power value returned by the ACPI firmware is valid.
* See acpi_fan_speed_valid() for details.
*
* Returns: True if the fan power value is valid, false otherwise.
*/
static inline bool acpi_fan_power_valid(u64 power)
{
return power < U32_MAX;
}
int acpi_fan_get_fst(acpi_handle handle, struct acpi_fan_fst *fst);
int acpi_fan_create_attributes(struct acpi_device *device);
void acpi_fan_delete_attributes(struct acpi_device *device);
#if IS_REACHABLE(CONFIG_HWMON)
int devm_acpi_fan_create_hwmon(struct device *dev);
void acpi_fan_notify_hwmon(struct device *dev);
#else
static inline int devm_acpi_fan_create_hwmon(struct device *dev) { return 0; };
static inline void acpi_fan_notify_hwmon(struct device *dev) { };
#endif
#endif