diff options
Diffstat (limited to 'drivers/thermal')
-rw-r--r-- | drivers/thermal/gov_bang_bang.c | 57 | ||||
-rw-r--r-- | drivers/thermal/gov_user_space.c | 12 | ||||
-rw-r--r-- | drivers/thermal/intel/Kconfig | 4 | ||||
-rw-r--r-- | drivers/thermal/intel/int340x_thermal/Kconfig | 4 | ||||
-rw-r--r-- | drivers/thermal/intel/int340x_thermal/int3400_thermal.c | 2 | ||||
-rw-r--r-- | drivers/thermal/intel/int340x_thermal/int3403_thermal.c | 1 | ||||
-rw-r--r-- | drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c | 1 | ||||
-rw-r--r-- | drivers/thermal/intel/int340x_thermal/processor_thermal_device.h | 1 | ||||
-rw-r--r-- | drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.c | 4 | ||||
-rw-r--r-- | drivers/thermal/thermal_core.c | 10 | ||||
-rw-r--r-- | drivers/thermal/thermal_core.h | 2 | ||||
-rw-r--r-- | drivers/thermal/thermal_of.c | 1 | ||||
-rw-r--r-- | drivers/thermal/thermal_thresholds.c | 68 |
13 files changed, 87 insertions, 80 deletions
diff --git a/drivers/thermal/gov_bang_bang.c b/drivers/thermal/gov_bang_bang.c index 97f3d819852b..51951967d67f 100644 --- a/drivers/thermal/gov_bang_bang.c +++ b/drivers/thermal/gov_bang_bang.c @@ -7,6 +7,27 @@ * Based on step_wise.c with following Copyrights: * Copyright (C) 2012 Intel Corp * Copyright (C) 2012 Durgadoss R <durgadoss.r@intel.com> + * + * Regulation Logic: a two point regulation, deliver cooling state depending + * on the previous state shown in this diagram: + * + * Fan: OFF ON + * + * | + * | + * trip_temp: +---->+ + * | | ^ + * | | | + * | | Temperature + * (trip_temp - hyst): +<----+ + * | + * | + * | + * + * * If the fan is not running and temperature exceeds trip_temp, the fan + * gets turned on. + * * In case the fan is running, temperature must fall below + * (trip_temp - hyst) so that the fan gets turned off again. */ #include <linux/thermal.h> @@ -34,36 +55,14 @@ static void bang_bang_set_instance_target(struct thermal_instance *instance, } /** - * bang_bang_control - controls devices associated with the given zone + * bang_bang_trip_crossed - controls devices associated with the given zone * @tz: thermal_zone_device * @trip: the trip point - * @crossed_up: whether or not the trip has been crossed on the way up - * - * Regulation Logic: a two point regulation, deliver cooling state depending - * on the previous state shown in this diagram: - * - * Fan: OFF ON - * - * | - * | - * trip_temp: +---->+ - * | | ^ - * | | | - * | | Temperature - * (trip_temp - hyst): +<----+ - * | - * | - * | - * - * * If the fan is not running and temperature exceeds trip_temp, the fan - * gets turned on. - * * In case the fan is running, temperature must fall below - * (trip_temp - hyst) so that the fan gets turned off again. - * + * @upward: whether or not the trip has been crossed on the way up */ -static void bang_bang_control(struct thermal_zone_device *tz, - const struct thermal_trip *trip, - bool crossed_up) +static void bang_bang_trip_crossed(struct thermal_zone_device *tz, + const struct thermal_trip *trip, + bool upward) { const struct thermal_trip_desc *td = trip_to_trip_desc(trip); struct thermal_instance *instance; @@ -75,7 +74,7 @@ static void bang_bang_control(struct thermal_zone_device *tz, tz->temperature, trip->hysteresis); list_for_each_entry(instance, &td->thermal_instances, trip_node) - bang_bang_set_instance_target(instance, crossed_up); + bang_bang_set_instance_target(instance, upward); } static void bang_bang_manage(struct thermal_zone_device *tz) @@ -123,7 +122,7 @@ static void bang_bang_update_tz(struct thermal_zone_device *tz, static struct thermal_governor thermal_gov_bang_bang = { .name = "bang_bang", - .trip_crossed = bang_bang_control, + .trip_crossed = bang_bang_trip_crossed, .manage = bang_bang_manage, .update_tz = bang_bang_update_tz, }; diff --git a/drivers/thermal/gov_user_space.c b/drivers/thermal/gov_user_space.c index 75137b419eb2..ef95cf7d65ef 100644 --- a/drivers/thermal/gov_user_space.c +++ b/drivers/thermal/gov_user_space.c @@ -23,16 +23,16 @@ static int user_space_bind(struct thermal_zone_device *tz) } /** - * notify_user_space - Notifies user space about thermal events + * user_space_trip_crossed - Notify user space about trip crossing events * @tz: thermal_zone_device * @trip: trip point - * @crossed_up: whether or not the trip has been crossed on the way up + * @upward: whether or not the trip has been crossed on the way up * * This function notifies the user space through UEvents. */ -static void notify_user_space(struct thermal_zone_device *tz, - const struct thermal_trip *trip, - bool crossed_up) +static void user_space_trip_crossed(struct thermal_zone_device *tz, + const struct thermal_trip *trip, + bool upward) { char *thermal_prop[5]; int i; @@ -52,7 +52,7 @@ static void notify_user_space(struct thermal_zone_device *tz, static struct thermal_governor thermal_gov_user_space = { .name = "user_space", - .trip_crossed = notify_user_space, + .trip_crossed = user_space_trip_crossed, .bind_to_tz = user_space_bind, }; THERMAL_GOVERNOR_DECLARE(thermal_gov_user_space); diff --git a/drivers/thermal/intel/Kconfig b/drivers/thermal/intel/Kconfig index a31f2f32996a..e0268fac7093 100644 --- a/drivers/thermal/intel/Kconfig +++ b/drivers/thermal/intel/Kconfig @@ -21,8 +21,8 @@ config INTEL_TCC config X86_PKG_TEMP_THERMAL tristate "X86 package temperature thermal driver" - depends on X86_THERMAL_VECTOR - select THERMAL_GOV_USER_SPACE + depends on X86_THERMAL_VECTOR && NET + select THERMAL_NETLINK select INTEL_TCC default m help diff --git a/drivers/thermal/intel/int340x_thermal/Kconfig b/drivers/thermal/intel/int340x_thermal/Kconfig index e76b13e44d03..4c699f0896b5 100644 --- a/drivers/thermal/intel/int340x_thermal/Kconfig +++ b/drivers/thermal/intel/int340x_thermal/Kconfig @@ -5,8 +5,8 @@ config INT340X_THERMAL tristate "ACPI INT340X thermal drivers" - depends on X86_64 && ACPI && PCI - select THERMAL_GOV_USER_SPACE + depends on X86_64 && ACPI && PCI && NET + select THERMAL_NETLINK select ACPI_THERMAL_REL select ACPI_FAN select ACPI_THERMAL_LIB diff --git a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c index 8660ef2175be..0e07693ecf59 100644 --- a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c +++ b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c @@ -521,7 +521,6 @@ static struct thermal_zone_device_ops int3400_thermal_ops = { }; static struct thermal_zone_params int3400_thermal_params = { - .governor_name = "user_space", .no_hwmon = true, }; @@ -690,6 +689,7 @@ static const struct acpi_device_id int3400_thermal_match[] = { {"INTC1042", 0}, {"INTC1068", 0}, {"INTC10A0", 0}, + {"INTC10D4", 0}, {} }; diff --git a/drivers/thermal/intel/int340x_thermal/int3403_thermal.c b/drivers/thermal/intel/int340x_thermal/int3403_thermal.c index 04aa0afb3b1d..5a925a8df7b3 100644 --- a/drivers/thermal/intel/int340x_thermal/int3403_thermal.c +++ b/drivers/thermal/intel/int340x_thermal/int3403_thermal.c @@ -275,6 +275,7 @@ static const struct acpi_device_id int3403_device_ids[] = { {"INTC1062", 0}, {"INTC1069", 0}, {"INTC10A1", 0}, + {"INTC10D5", 0}, {"", 0}, }; MODULE_DEVICE_TABLE(acpi, int3403_device_ids); diff --git a/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c b/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c index 31ed338eb83c..8dca6a6aceca 100644 --- a/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c +++ b/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c @@ -105,7 +105,6 @@ static int int340x_thermal_read_trips(struct acpi_device *zone_adev, } static struct thermal_zone_params int340x_thermal_params = { - .governor_name = "user_space", .no_hwmon = true, }; diff --git a/drivers/thermal/intel/int340x_thermal/processor_thermal_device.h b/drivers/thermal/intel/int340x_thermal/processor_thermal_device.h index d5eca6db2c00..ba2d89d3024c 100644 --- a/drivers/thermal/intel/int340x_thermal/processor_thermal_device.h +++ b/drivers/thermal/intel/int340x_thermal/processor_thermal_device.h @@ -30,6 +30,7 @@ #define PCI_DEVICE_ID_INTEL_RPL_THERMAL 0xA71D #define PCI_DEVICE_ID_INTEL_SKL_THERMAL 0x1903 #define PCI_DEVICE_ID_INTEL_TGL_THERMAL 0x9A03 +#define PCI_DEVICE_ID_INTEL_PTL_THERMAL 0xB01D struct power_config { u32 index; diff --git a/drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.c b/drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.c index 145d471546d5..a55aaa8cef42 100644 --- a/drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.c +++ b/drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.c @@ -272,7 +272,6 @@ static const struct thermal_zone_device_ops tzone_ops = { }; static struct thermal_zone_params tzone_params = { - .governor_name = "user_space", .no_hwmon = true, }; @@ -495,6 +494,9 @@ static const struct pci_device_id proc_thermal_pci_ids[] = { PROC_THERMAL_FEATURE_DVFS | PROC_THERMAL_FEATURE_DLVR | PROC_THERMAL_FEATURE_WT_HINT) }, { PCI_DEVICE_DATA(INTEL, RPL_THERMAL, PROC_THERMAL_FEATURE_RAPL | PROC_THERMAL_FEATURE_FIVR | PROC_THERMAL_FEATURE_DVFS | PROC_THERMAL_FEATURE_WT_REQ) }, + { PCI_DEVICE_DATA(INTEL, PTL_THERMAL, PROC_THERMAL_FEATURE_RAPL | + PROC_THERMAL_FEATURE_DLVR | PROC_THERMAL_FEATURE_MSI_SUPPORT | + PROC_THERMAL_FEATURE_WT_HINT | PROC_THERMAL_FEATURE_POWER_FLOOR) }, { }, }; diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index 19a3894ad752..2328ac0d8561 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -453,23 +453,23 @@ static void move_to_trips_invalid(struct thermal_zone_device *tz, static void thermal_governor_trip_crossed(struct thermal_governor *governor, struct thermal_zone_device *tz, const struct thermal_trip *trip, - bool crossed_up) + bool upward) { if (trip->type == THERMAL_TRIP_HOT || trip->type == THERMAL_TRIP_CRITICAL) return; if (governor->trip_crossed) - governor->trip_crossed(tz, trip, crossed_up); + governor->trip_crossed(tz, trip, upward); } static void thermal_trip_crossed(struct thermal_zone_device *tz, struct thermal_trip_desc *td, struct thermal_governor *governor, - bool crossed_up) + bool upward) { const struct thermal_trip *trip = &td->trip; - if (crossed_up) { + if (upward) { if (trip->type == THERMAL_TRIP_PASSIVE) tz->passive++; else if (trip->type == THERMAL_TRIP_CRITICAL || @@ -486,7 +486,7 @@ static void thermal_trip_crossed(struct thermal_zone_device *tz, thermal_notify_tz_trip_down(tz, trip); thermal_debug_tz_trip_down(tz, trip); } - thermal_governor_trip_crossed(governor, tz, trip, crossed_up); + thermal_governor_trip_crossed(governor, tz, trip, upward); } void thermal_zone_set_trip_hyst(struct thermal_zone_device *tz, diff --git a/drivers/thermal/thermal_core.h b/drivers/thermal/thermal_core.h index be271e7c8f41..09866f0ce765 100644 --- a/drivers/thermal/thermal_core.h +++ b/drivers/thermal/thermal_core.h @@ -56,7 +56,7 @@ struct thermal_governor { void (*unbind_from_tz)(struct thermal_zone_device *tz); void (*trip_crossed)(struct thermal_zone_device *tz, const struct thermal_trip *trip, - bool crossed_up); + bool upward); void (*manage)(struct thermal_zone_device *tz); void (*update_tz)(struct thermal_zone_device *tz, enum thermal_notify_event reason); diff --git a/drivers/thermal/thermal_of.c b/drivers/thermal/thermal_of.c index fab11b98ca49..5ab4ce4daaeb 100644 --- a/drivers/thermal/thermal_of.c +++ b/drivers/thermal/thermal_of.c @@ -160,6 +160,7 @@ static struct device_node *of_thermal_zone_find(struct device_node *sensor, int return ERR_PTR(ret); } + of_node_put(sensor_specs.np); if ((sensor == sensor_specs.np) && id == (sensor_specs.args_count ? sensor_specs.args[0] : 0)) { pr_debug("sensor %pOFn id=%d belongs to %pOFn\n", sensor, id, child); diff --git a/drivers/thermal/thermal_thresholds.c b/drivers/thermal/thermal_thresholds.c index d9b2a0bb44fc..38f5fd0e8930 100644 --- a/drivers/thermal/thermal_thresholds.c +++ b/drivers/thermal/thermal_thresholds.c @@ -69,58 +69,60 @@ static struct user_threshold *__thermal_thresholds_find(const struct list_head * return NULL; } -static bool __thermal_threshold_is_crossed(struct user_threshold *threshold, int temperature, - int last_temperature, int direction, - int *low, int *high) +static bool thermal_thresholds_handle_raising(struct list_head *thresholds, int temperature, + int last_temperature) { + struct user_threshold *t; - if (temperature >= threshold->temperature) { - if (threshold->temperature > *low && - THERMAL_THRESHOLD_WAY_DOWN & threshold->direction) - *low = threshold->temperature; + list_for_each_entry(t, thresholds, list_node) { - if (last_temperature < threshold->temperature && - threshold->direction & direction) - return true; - } else { - if (threshold->temperature < *high && THERMAL_THRESHOLD_WAY_UP - & threshold->direction) - *high = threshold->temperature; + if (!(t->direction & THERMAL_THRESHOLD_WAY_UP)) + continue; - if (last_temperature >= threshold->temperature && - threshold->direction & direction) + if (temperature >= t->temperature && + last_temperature < t->temperature) return true; } return false; } -static bool thermal_thresholds_handle_raising(struct list_head *thresholds, int temperature, - int last_temperature, int *low, int *high) +static bool thermal_thresholds_handle_dropping(struct list_head *thresholds, int temperature, + int last_temperature) { struct user_threshold *t; - list_for_each_entry(t, thresholds, list_node) { - if (__thermal_threshold_is_crossed(t, temperature, last_temperature, - THERMAL_THRESHOLD_WAY_UP, low, high)) + list_for_each_entry_reverse(t, thresholds, list_node) { + + if (!(t->direction & THERMAL_THRESHOLD_WAY_DOWN)) + continue; + + if (temperature <= t->temperature && + last_temperature > t->temperature) return true; } return false; } -static bool thermal_thresholds_handle_dropping(struct list_head *thresholds, int temperature, - int last_temperature, int *low, int *high) +static void thermal_threshold_find_boundaries(struct list_head *thresholds, int temperature, + int *low, int *high) { struct user_threshold *t; - list_for_each_entry_reverse(t, thresholds, list_node) { - if (__thermal_threshold_is_crossed(t, temperature, last_temperature, - THERMAL_THRESHOLD_WAY_DOWN, low, high)) - return true; + list_for_each_entry(t, thresholds, list_node) { + if (temperature < t->temperature && + (t->direction & THERMAL_THRESHOLD_WAY_UP) && + *high > t->temperature) + *high = t->temperature; } - return false; + list_for_each_entry_reverse(t, thresholds, list_node) { + if (temperature > t->temperature && + (t->direction & THERMAL_THRESHOLD_WAY_DOWN) && + *low < t->temperature) + *low = t->temperature; + } } void thermal_thresholds_handle(struct thermal_zone_device *tz, int *low, int *high) @@ -132,6 +134,8 @@ void thermal_thresholds_handle(struct thermal_zone_device *tz, int *low, int *hi lockdep_assert_held(&tz->lock); + thermal_threshold_find_boundaries(thresholds, temperature, low, high); + /* * We need a second update in order to detect a threshold being crossed */ @@ -151,12 +155,12 @@ void thermal_thresholds_handle(struct thermal_zone_device *tz, int *low, int *hi * - decreased : thresholds are crossed the way down */ if (temperature > last_temperature) { - if (thermal_thresholds_handle_raising(thresholds, temperature, - last_temperature, low, high)) + if (thermal_thresholds_handle_raising(thresholds, + temperature, last_temperature)) thermal_notify_threshold_up(tz); } else { - if (thermal_thresholds_handle_dropping(thresholds, temperature, - last_temperature, low, high)) + if (thermal_thresholds_handle_dropping(thresholds, + temperature, last_temperature)) thermal_notify_threshold_down(tz); } } |