linux/drivers/acpi/thermal.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 *  acpi_thermal.c - ACPI Thermal Zone Driver ($Revision: 41 $)
 *
 *  Copyright (C) 2001, 2002 Andy Grover <[email protected]>
 *  Copyright (C) 2001, 2002 Paul Diefenbaugh <[email protected]>
 *
 *  This driver fully implements the ACPI thermal policy as described in the
 *  ACPI 2.0 Specification.
 *
 *  TBD: 1. Implement passive cooling hysteresis.
 *       2. Enhance passive cooling (CPU) states/limit interface to support
 *          concepts of 'multiple limiters', upper/lower limits, etc.
 */

#define pr_fmt(fmt)

#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/dmi.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/types.h>
#include <linux/jiffies.h>
#include <linux/kmod.h>
#include <linux/reboot.h>
#include <linux/device.h>
#include <linux/thermal.h>
#include <linux/acpi.h>
#include <linux/workqueue.h>
#include <linux/uaccess.h>
#include <linux/units.h>

#include "internal.h"

#define ACPI_THERMAL_CLASS
#define ACPI_THERMAL_DEVICE_NAME
#define ACPI_THERMAL_NOTIFY_TEMPERATURE
#define ACPI_THERMAL_NOTIFY_THRESHOLDS
#define ACPI_THERMAL_NOTIFY_DEVICES
#define ACPI_THERMAL_NOTIFY_CRITICAL
#define ACPI_THERMAL_NOTIFY_HOT
#define ACPI_THERMAL_MODE_ACTIVE

#define ACPI_THERMAL_MAX_ACTIVE
#define ACPI_THERMAL_MAX_LIMIT_STR_LEN

#define ACPI_THERMAL_TRIP_PASSIVE

#define ACPI_THERMAL_MAX_NR_TRIPS

/*
 * This exception is thrown out in two cases:
 * 1.An invalid trip point becomes invalid or a valid trip point becomes invalid
 *   when re-evaluating the AML code.
 * 2.TODO: Devices listed in _PSL, _ALx, _TZD may change.
 *   We need to re-bind the cooling devices of a thermal zone when this occurs.
 */
#define ACPI_THERMAL_TRIPS_EXCEPTION(tz, str)

static int act;
module_param(act, int, 0644);
MODULE_PARM_DESC();

static int crt;
module_param(crt, int, 0644);
MODULE_PARM_DESC();

static int tzp;
module_param(tzp, int, 0444);
MODULE_PARM_DESC();

static int off;
module_param(off, int, 0);
MODULE_PARM_DESC();

static int psv;
module_param(psv, int, 0644);
MODULE_PARM_DESC();

static struct workqueue_struct *acpi_thermal_pm_queue;

struct acpi_thermal_trip {};

struct acpi_thermal_passive {};

struct acpi_thermal_active {};

struct acpi_thermal_trips {};

struct acpi_thermal {};

/* --------------------------------------------------------------------------
                             Thermal Zone Management
   -------------------------------------------------------------------------- */

static int acpi_thermal_get_temperature(struct acpi_thermal *tz)
{}

static int acpi_thermal_get_polling_frequency(struct acpi_thermal *tz)
{}

static int acpi_thermal_temp(struct acpi_thermal *tz, int temp_deci_k)
{}

static bool acpi_thermal_trip_valid(struct acpi_thermal_trip *acpi_trip)
{}

static int active_trip_index(struct acpi_thermal *tz,
			     struct acpi_thermal_trip *acpi_trip)
{}

static long get_passive_temp(struct acpi_thermal *tz)
{}

static long get_active_temp(struct acpi_thermal *tz, int index)
{}

static void acpi_thermal_update_trip(struct acpi_thermal *tz,
				     const struct thermal_trip *trip)
{}

static bool update_trip_devices(struct acpi_thermal *tz,
				struct acpi_thermal_trip *acpi_trip,
				int index, bool compare)
{}

static void acpi_thermal_update_trip_devices(struct acpi_thermal *tz,
					     const struct thermal_trip *trip)
{}

struct adjust_trip_data {};

static int acpi_thermal_adjust_trip(struct thermal_trip *trip, void *data)
{}

static void acpi_queue_thermal_check(struct acpi_thermal *tz)
{}

static void acpi_thermal_trips_update(struct acpi_thermal *tz, u32 event)
{}

static int acpi_thermal_get_critical_trip(struct acpi_thermal *tz)
{}

static int acpi_thermal_get_hot_trip(struct acpi_thermal *tz)
{}

static bool passive_trip_params_init(struct acpi_thermal *tz)
{}

static bool acpi_thermal_init_trip(struct acpi_thermal *tz, int index)
{}

static void acpi_thermal_get_trip_points(struct acpi_thermal *tz)
{}

/* sys I/F for generic thermal sysfs support */

static int thermal_get_temp(struct thermal_zone_device *thermal, int *temp)
{}

static int thermal_get_trend(struct thermal_zone_device *thermal,
			     const struct thermal_trip *trip,
			     enum thermal_trend *trend)
{}

static void acpi_thermal_zone_device_hot(struct thermal_zone_device *thermal)
{}

static void acpi_thermal_zone_device_critical(struct thermal_zone_device *thermal)
{}

static bool acpi_thermal_should_bind_cdev(struct thermal_zone_device *thermal,
					  const struct thermal_trip *trip,
					  struct thermal_cooling_device *cdev,
					  struct cooling_spec *c)
{}

static const struct thermal_zone_device_ops acpi_thermal_zone_ops =;

static int acpi_thermal_zone_sysfs_add(struct acpi_thermal *tz)
{}

static void acpi_thermal_zone_sysfs_remove(struct acpi_thermal *tz)
{}

static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz,
					      const struct thermal_trip *trip_table,
					      unsigned int trip_count,
					      int passive_delay)
{}

static void acpi_thermal_unregister_thermal_zone(struct acpi_thermal *tz)
{}


/* --------------------------------------------------------------------------
                                 Driver Interface
   -------------------------------------------------------------------------- */

static void acpi_thermal_notify(acpi_handle handle, u32 event, void *data)
{}

/*
 * On some platforms, the AML code has dependency about
 * the evaluating order of _TMP and _CRT/_HOT/_PSV/_ACx.
 * 1. On HP Pavilion G4-1016tx, _TMP must be invoked after
 *    /_CRT/_HOT/_PSV/_ACx, or else system will be power off.
 * 2. On HP Compaq 6715b/6715s, the return value of _PSV is 0
 *    if _TMP has never been evaluated.
 *
 * As this dependency is totally transparent to OS, evaluate
 * all of them once, in the order of _CRT/_HOT/_PSV/_ACx,
 * _TMP, before they are actually used.
 */
static void acpi_thermal_aml_dependency_fix(struct acpi_thermal *tz)
{}

/*
 * The exact offset between Kelvin and degree Celsius is 273.15. However ACPI
 * handles temperature values with a single decimal place. As a consequence,
 * some implementations use an offset of 273.1 and others use an offset of
 * 273.2. Try to find out which one is being used, to present the most
 * accurate and visually appealing number.
 *
 * The heuristic below should work for all ACPI thermal zones which have a
 * critical trip point with a value being a multiple of 0.5 degree Celsius.
 */
static void acpi_thermal_guess_offset(struct acpi_thermal *tz, long crit_temp)
{}

static void acpi_thermal_check_fn(struct work_struct *work)
{}

static void acpi_thermal_free_thermal_zone(struct acpi_thermal *tz)
{}

static int acpi_thermal_add(struct acpi_device *device)
{}

static void acpi_thermal_remove(struct acpi_device *device)
{}

#ifdef CONFIG_PM_SLEEP
static int acpi_thermal_suspend(struct device *dev)
{}

static int acpi_thermal_resume(struct device *dev)
{}
#else
#define acpi_thermal_suspend
#define acpi_thermal_resume
#endif
static SIMPLE_DEV_PM_OPS(acpi_thermal_pm, acpi_thermal_suspend, acpi_thermal_resume);

static const struct acpi_device_id  thermal_device_ids[] =;
MODULE_DEVICE_TABLE(acpi, thermal_device_ids);

static struct acpi_driver acpi_thermal_driver =;

static int thermal_act(const struct dmi_system_id *d)
{}

static int thermal_nocrt(const struct dmi_system_id *d)
{}

static int thermal_tzp(const struct dmi_system_id *d)
{}

static int thermal_psv(const struct dmi_system_id *d)
{}

static const struct dmi_system_id thermal_dmi_table[] __initconst =;

static int __init acpi_thermal_init(void)
{}

static void __exit acpi_thermal_exit(void)
{}

module_init();
module_exit(acpi_thermal_exit);

MODULE_IMPORT_NS();
MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();