linux/drivers/acpi/processor_thermal.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * processor_thermal.c - Passive cooling submodule of the ACPI processor driver
 *
 *  Copyright (C) 2001, 2002 Andy Grover <[email protected]>
 *  Copyright (C) 2001, 2002 Paul Diefenbaugh <[email protected]>
 *  Copyright (C) 2004       Dominik Brodowski <[email protected]>
 *  Copyright (C) 2004  Anil S Keshavamurthy <[email protected]>
 *  			- Added processor hotplug support
 */

#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/cpufreq.h>
#include <linux/acpi.h>
#include <acpi/processor.h>
#include <linux/uaccess.h>

#include "internal.h"

#ifdef CONFIG_CPU_FREQ

/* If a passive cooling situation is detected, primarily CPUfreq is used, as it
 * offers (in most cases) voltage scaling in addition to frequency scaling, and
 * thus a cubic (instead of linear) reduction of energy. Also, we allow for
 * _any_ cpufreq driver and not only the acpi-cpufreq driver.
 */

#define CPUFREQ_THERMAL_MIN_STEP

static int cpufreq_thermal_max_step __read_mostly =;

/*
 * Minimum throttle percentage for processor_thermal cooling device.
 * The processor_thermal driver uses it to calculate the percentage amount by
 * which cpu frequency must be reduced for each cooling state. This is also used
 * to calculate the maximum number of throttling steps or cooling states.
 */
static int cpufreq_thermal_reduction_pctg __read_mostly =;

static DEFINE_PER_CPU(unsigned int, cpufreq_thermal_reduction_step);

#define reduction_step(cpu)

/*
 * Emulate "per package data" using per cpu data (which should really be
 * provided elsewhere)
 *
 * Note we can lose a CPU on cpu hotunplug, in this case we forget the state
 * temporarily. Fortunately that's not a big issue here (I hope)
 */
static int phys_package_first_cpu(int cpu)
{}

static int cpu_has_cpufreq(unsigned int cpu)
{}

static int cpufreq_get_max_state(unsigned int cpu)
{}

static int cpufreq_get_cur_state(unsigned int cpu)
{}

static int cpufreq_set_cur_state(unsigned int cpu, int state)
{}

static void acpi_thermal_cpufreq_config(void)
{}

void acpi_thermal_cpufreq_init(struct cpufreq_policy *policy)
{}

void acpi_thermal_cpufreq_exit(struct cpufreq_policy *policy)
{}
#else				/* ! CONFIG_CPU_FREQ */
static int cpufreq_get_max_state(unsigned int cpu)
{
	return 0;
}

static int cpufreq_get_cur_state(unsigned int cpu)
{
	return 0;
}

static int cpufreq_set_cur_state(unsigned int cpu, int state)
{
	return 0;
}

#endif

/* thermal cooling device callbacks */
static int acpi_processor_max_state(struct acpi_processor *pr)
{}
static int
processor_get_max_state(struct thermal_cooling_device *cdev,
			unsigned long *state)
{}

static int
processor_get_cur_state(struct thermal_cooling_device *cdev,
			unsigned long *cur_state)
{}

static int
processor_set_cur_state(struct thermal_cooling_device *cdev,
			unsigned long state)
{}

const struct thermal_cooling_device_ops processor_cooling_ops =;

int acpi_processor_thermal_init(struct acpi_processor *pr,
				struct acpi_device *device)
{}

void acpi_processor_thermal_exit(struct acpi_processor *pr,
				 struct acpi_device *device)
{}