Thermal control updates for 6.6-rc1

- Make the ACPI thermal driver use its own Notify() handler (Michal
    Wilczynski).
 
  - Rework the ACPI thermal driver to use a table of generic trip point
    structures on top of the internal representation of trip points and
    remove thermal zone callbacks that are not necessary any more from
    that driver (Rafael Wysocki).
 
  - Fix a few issues in the Intel DTS IOSF thermal driver, clean up code
    in it and make it pass tables of generic trip point structures to the
    core during thermal zone registration (Rafael Wysocki).
 
  - Drop a redundant check from the Intel DTS IOSF thermal driver's
    "remove" routine (Zhang Rui).
 
  - Use module_platform_driver() to replace an open-coded counterpart of
    it in the int340x thermal driver (Yang Yingliang).
 
  - Fix possible uninitialized value access in __thermal_of_bind() and
    __thermal_of_unbind() (Peng Fan).
 
  - Make the int3400 driver use thermal zone device wrappers (Daniel
    Lezcano).
 
  - Remove redundant thermal zone state check from the int340x thermal
    driver (Daniel Lezcano).
 
  - Drop non-functional nocrt parameter from ACPI thermal (Mario
    Limonciello).
 
  - Explicitly include correct DT includes in the thermal core and
    drivers (Rob Herring).
 -----BEGIN PGP SIGNATURE-----
 
 iQJGBAABCAAwFiEE4fcc61cGeeHD/fCwgsRv/nhiVHEFAmTslOkSHHJqd0Byand5
 c29ja2kubmV0AAoJEILEb/54YlRxgzUP/06PJ6ogjXb7iUVcs1Loeg01oWNlTAgB
 6/b8WE0qp9d4BKg2IpXVTRiE7MifyaHOJZdAQVJc7r2qJx6QcHypi1ttDvlx6qQx
 DovGPz3EoF4pr3uYLu8u12u07YhvHNByv6Bqh4UxPbVRS7ekTh2Vw1mdGSJA/ciO
 J8FP5nPy+r8cFLjJZmYaM0RKPdCAaPIpxhevg7xuF5d+EnLTXkqFwlUc5ZpMqKxn
 cFrweV825lWj0BhQ4TBZ7jtgWAZQ2SClnzy90w2bKs6ocOkoDvQp6W1TNoxVM2Iz
 bKZ61O3gkTUtETmTW/Cdi4sGmfeV+mZrF4MnhE3YGlD8SXIiYWK7qMOdm8Szio+L
 GD6f9wymcV/vBRoIHQXU2DnPcNB4xz1Fr9YouOdrLR4B/s2/OCha0xQg+ez9W8JB
 XYJgdXdWLPVvMn6JPD/m4JmpcmcB3Jxvp+DgtCBN6XVhZk/Y7I8AOOVPYCnidCfo
 omFNAZquxTlgOSWFPqVz9JU1FT5QeSal3Cg7bBVHM6zS72kkMVKrcr+3BnqNkW8h
 LlWaMLHimqBdbaFToXWmG3D20PE+b6vNeaeRgUDH+Ryo5ZI/qSKd4W5sp3nd631o
 5T90XvAwHTIlH2jgE7FdKOsC104wI6PFj1PWhFvqrDgqgalDvXHiT0q6EMn0GhsU
 0FJ50rLCni9a
 =fHwc
 -----END PGP SIGNATURE-----

Merge tag 'thermal-6.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull thermal control updates from Rafael Wysocki:
 "These rework the Intel DTS IOSF and the ACPI thermal drivers to pass
  tables of generic trip point structures to the core during
  initialization and make some requisite modifications in the thermal
  core, fix a few issues elsewhere and clean up code.

  This includes changes that are present in the ACPI updates too,
  because they involve both ACPI and the thermal core. The list of
  specific changes below is limited to thermal control, however.

  Specifics:

   - Make the ACPI thermal driver use its own Notify() handler (Michal
     Wilczynski)

   - Rework the ACPI thermal driver to use a table of generic trip point
     structures on top of the internal representation of trip points and
     remove thermal zone callbacks that are not necessary any more from
     that driver (Rafael Wysocki)

   - Fix a few issues in the Intel DTS IOSF thermal driver, clean up
     code in it and make it pass tables of generic trip point structures
     to the core during thermal zone registration (Rafael Wysocki)

   - Drop a redundant check from the Intel DTS IOSF thermal driver's
     "remove" routine (Zhang Rui)

   - Use module_platform_driver() to replace an open-coded counterpart
     of it in the int340x thermal driver (Yang Yingliang)

   - Fix possible uninitialized value access in __thermal_of_bind() and
     __thermal_of_unbind() (Peng Fan)

   - Make the int3400 driver use thermal zone device wrappers (Daniel
     Lezcano)

   - Remove redundant thermal zone state check from the int340x thermal
     driver (Daniel Lezcano)

   - Drop non-functional nocrt parameter from ACPI thermal (Mario
     Limonciello)

   - Explicitly include correct DT includes in the thermal core and
     drivers (Rob Herring)"

* tag 'thermal-6.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
  thermal: intel: intel_soc_dts_iosf: Remove redundant check
  thermal: intel: int340x: simplify the code with module_platform_driver()
  thermal/of: Fix potential uninitialized value access
  thermal: intel: intel_soc_dts_iosf: Use struct thermal_trip
  thermal: intel: intel_soc_dts_iosf: Rework critical trip setup
  thermal: intel: intel_soc_dts_iosf: Add helper for resetting trip points
  thermal: intel: intel_soc_dts_iosf: Change initialization ordering
  thermal: intel: intel_soc_dts_iosf: Pass sensors to update_trip_temp()
  thermal: intel: intel_soc_dts_iosf: Untangle update_trip_temp()
  thermal: intel: intel_soc_dts_iosf: Always assume notification support
  thermal: intel: intel_soc_dts_iosf: Drop redundant symbol definition
  thermal: intel: intel_soc_dts_iosf: Always use 2 trips
  thermal: Explicitly include correct DT includes
  thermal/drivers/int340x: Do not check the thermal zone state
  thermal/drivers/int3400: Use thermal zone device wrappers
This commit is contained in:
Linus Torvalds 2023-08-28 18:26:45 -07:00
Родитель ccc5e98177 d08122864e
Коммит 36534782b5
29 изменённых файлов: 123 добавлений и 205 удалений

Просмотреть файл

@ -22,8 +22,6 @@
#include <linux/mfd/syscon.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/of_device.h>
#include <linux/platform_device.h>
#include <linux/regmap.h>
#include <linux/thermal.h>

Просмотреть файл

@ -15,8 +15,8 @@
#include <linux/kernel.h>
#include <linux/mfd/syscon.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/of_device.h>
#include <linux/regmap.h>
#include <linux/thermal.h>

Просмотреть файл

@ -17,8 +17,8 @@
#include <linux/interrupt.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/of_device.h>
#include <linux/thermal.h>
#define AVS_TMON_STATUS 0x00

Просмотреть файл

@ -13,9 +13,9 @@
#include <linux/delay.h>
#include <linux/interrupt.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/io.h>
#include <linux/of_device.h>
#include <linux/thermal.h>
#define HI6220_TEMP0_LAG (0x0)

Просмотреть файл

@ -12,7 +12,6 @@
#include <linux/module.h>
#include <linux/nvmem-consumer.h>
#include <linux/of.h>
#include <linux/of_device.h>
#include <linux/platform_device.h>
#include <linux/slab.h>
#include <linux/thermal.h>

Просмотреть файл

@ -8,7 +8,6 @@
#include <linux/firmware/imx/sci.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_device.h>
#include <linux/platform_device.h>
#include <linux/slab.h>
#include <linux/thermal.h>

Просмотреть файл

@ -11,7 +11,7 @@
#include <linux/mfd/syscon.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_device.h>
#include <linux/platform_device.h>
#include <linux/regmap.h>
#include <linux/thermal.h>
#include <linux/nvmem-consumer.h>

Просмотреть файл

@ -15,6 +15,7 @@
#define INT3400_THERMAL_TABLE_CHANGED 0x83
#define INT3400_ODVP_CHANGED 0x88
#define INT3400_KEEP_ALIVE 0xA0
#define INT3400_FAKE_TEMP (20 * 1000) /* faked temp sensor with 20C */
enum int3400_thermal_uuid {
INT3400_THERMAL_ACTIVE = 0,
@ -453,6 +454,7 @@ static void int3400_notify(acpi_handle handle,
void *data)
{
struct int3400_thermal_priv *priv = data;
struct device *dev;
char *thermal_prop[5];
int therm_event;
@ -475,12 +477,14 @@ static void int3400_notify(acpi_handle handle,
return;
}
thermal_prop[0] = kasprintf(GFP_KERNEL, "NAME=%s", priv->thermal->type);
thermal_prop[1] = kasprintf(GFP_KERNEL, "TEMP=%d", priv->thermal->temperature);
dev = thermal_zone_device(priv->thermal);
thermal_prop[0] = kasprintf(GFP_KERNEL, "NAME=%s", thermal_zone_device_type(priv->thermal));
thermal_prop[1] = kasprintf(GFP_KERNEL, "TEMP=%d", INT3400_FAKE_TEMP);
thermal_prop[2] = kasprintf(GFP_KERNEL, "TRIP=");
thermal_prop[3] = kasprintf(GFP_KERNEL, "EVENT=%d", therm_event);
thermal_prop[4] = NULL;
kobject_uevent_env(&priv->thermal->device.kobj, KOBJ_CHANGE, thermal_prop);
kobject_uevent_env(&dev->kobj, KOBJ_CHANGE, thermal_prop);
kfree(thermal_prop[0]);
kfree(thermal_prop[1]);
kfree(thermal_prop[2]);
@ -490,7 +494,7 @@ static void int3400_notify(acpi_handle handle,
static int int3400_thermal_get_temp(struct thermal_zone_device *thermal,
int *temp)
{
*temp = 20 * 1000; /* faked temp sensor with 20C */
*temp = INT3400_FAKE_TEMP;
return 0;
}
@ -499,32 +503,28 @@ static int int3400_thermal_change_mode(struct thermal_zone_device *thermal,
{
struct int3400_thermal_priv *priv = thermal_zone_device_priv(thermal);
int result = 0;
int enabled;
if (!priv)
return -EINVAL;
if (mode != thermal->mode) {
int enabled;
enabled = mode == THERMAL_DEVICE_ENABLED;
enabled = mode == THERMAL_DEVICE_ENABLED;
if (priv->os_uuid_mask) {
if (!enabled) {
priv->os_uuid_mask = 0;
result = set_os_uuid_mask(priv, priv->os_uuid_mask);
}
goto eval_odvp;
if (priv->os_uuid_mask) {
if (!enabled) {
priv->os_uuid_mask = 0;
result = set_os_uuid_mask(priv, priv->os_uuid_mask);
}
if (priv->current_uuid_index < 0 ||
priv->current_uuid_index >= INT3400_THERMAL_MAXIMUM_UUID)
return -EINVAL;
result = int3400_thermal_run_osc(priv->adev->handle,
int3400_thermal_uuids[priv->current_uuid_index],
&enabled);
goto eval_odvp;
}
if (priv->current_uuid_index < 0 ||
priv->current_uuid_index >= INT3400_THERMAL_MAXIMUM_UUID)
return -EINVAL;
result = int3400_thermal_run_osc(priv->adev->handle,
int3400_thermal_uuids[priv->current_uuid_index],
&enabled);
eval_odvp:
evaluate_odvp(priv);

Просмотреть файл

@ -70,18 +70,7 @@ static struct platform_driver int3401_driver = {
},
};
static int __init proc_thermal_init(void)
{
return platform_driver_register(&int3401_driver);
}
static void __exit proc_thermal_exit(void)
{
platform_driver_unregister(&int3401_driver);
}
module_init(proc_thermal_init);
module_exit(proc_thermal_exit);
module_platform_driver(int3401_driver);
MODULE_AUTHOR("Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>");
MODULE_DESCRIPTION("Processor Thermal Reporting Device Driver");

Просмотреть файл

@ -59,7 +59,7 @@ static int proc_thermal_pci_probe(struct pci_dev *pdev,
* ACPI/MSR. So we don't want to fail for auxiliary DTSs.
*/
proc_priv->soc_dts = intel_soc_dts_iosf_init(
INTEL_SOC_DTS_INTERRUPT_MSI, 2, 0);
INTEL_SOC_DTS_INTERRUPT_MSI, false, 0);
if (!IS_ERR(proc_priv->soc_dts) && pdev->irq) {
ret = pci_enable_msi(pdev);

Просмотреть файл

@ -37,44 +37,11 @@
/* DTS encoding for TJ MAX temperature */
#define SOC_DTS_TJMAX_ENCODING 0x7F
/* Only 2 out of 4 is allowed for OSPM */
#define SOC_MAX_DTS_TRIPS 2
/* Mask for two trips in status bits */
#define SOC_DTS_TRIP_MASK 0x03
/* DTS0 and DTS 1 */
#define SOC_MAX_DTS_SENSORS 2
static int sys_get_trip_temp(struct thermal_zone_device *tzd, int trip,
int *temp)
{
int status;
u32 out;
struct intel_soc_dts_sensor_entry *dts;
struct intel_soc_dts_sensors *sensors;
dts = thermal_zone_device_priv(tzd);
sensors = dts->sensors;
mutex_lock(&sensors->dts_update_lock);
status = iosf_mbi_read(BT_MBI_UNIT_PMC, MBI_REG_READ,
SOC_DTS_OFFSET_PTPS, &out);
mutex_unlock(&sensors->dts_update_lock);
if (status)
return status;
out = (out >> (trip * 8)) & SOC_DTS_TJMAX_ENCODING;
if (!out)
*temp = 0;
else
*temp = sensors->tj_max - out * 1000;
return 0;
}
static int update_trip_temp(struct intel_soc_dts_sensor_entry *dts,
int thres_index, int temp,
enum thermal_trip_type trip_type)
static int update_trip_temp(struct intel_soc_dts_sensors *sensors,
int thres_index, int temp)
{
int status;
u32 temp_out;
@ -85,7 +52,6 @@ static int update_trip_temp(struct intel_soc_dts_sensor_entry *dts,
u32 store_te_out;
u32 te_out;
u32 int_enable_bit = SOC_DTS_TE_APICA_ENABLE;
struct intel_soc_dts_sensors *sensors = dts->sensors;
if (sensors->intr_type == INTEL_SOC_DTS_INTERRUPT_MSI)
int_enable_bit |= SOC_DTS_TE_MSI_ENABLE;
@ -148,8 +114,6 @@ static int update_trip_temp(struct intel_soc_dts_sensor_entry *dts,
if (status)
goto err_restore_te_out;
dts->trip_types[thres_index] = trip_type;
return 0;
err_restore_te_out:
iosf_mbi_write(BT_MBI_UNIT_PMC, MBI_REG_WRITE,
@ -165,6 +129,22 @@ err_restore_ptps:
return status;
}
static int configure_trip(struct intel_soc_dts_sensor_entry *dts,
int thres_index, enum thermal_trip_type trip_type,
int temp)
{
int ret;
ret = update_trip_temp(dts->sensors, thres_index, temp);
if (ret)
return ret;
dts->trips[thres_index].temperature = temp;
dts->trips[thres_index].type = trip_type;
return 0;
}
static int sys_set_trip_temp(struct thermal_zone_device *tzd, int trip,
int temp)
{
@ -176,23 +156,12 @@ static int sys_set_trip_temp(struct thermal_zone_device *tzd, int trip,
return -EINVAL;
mutex_lock(&sensors->dts_update_lock);
status = update_trip_temp(dts, trip, temp,
dts->trip_types[trip]);
status = update_trip_temp(sensors, trip, temp);
mutex_unlock(&sensors->dts_update_lock);
return status;
}
static int sys_get_trip_type(struct thermal_zone_device *tzd,
int trip, enum thermal_trip_type *type)
{
struct intel_soc_dts_sensor_entry *dts = thermal_zone_device_priv(tzd);
*type = dts->trip_types[trip];
return 0;
}
static int sys_get_curr_temp(struct thermal_zone_device *tzd,
int *temp)
{
@ -217,8 +186,6 @@ static int sys_get_curr_temp(struct thermal_zone_device *tzd,
static struct thermal_zone_device_ops tzone_ops = {
.get_temp = sys_get_curr_temp,
.get_trip_temp = sys_get_trip_temp,
.get_trip_type = sys_get_trip_type,
.set_trip_temp = sys_set_trip_temp,
};
@ -245,22 +212,18 @@ static int soc_dts_enable(int id)
static void remove_dts_thermal_zone(struct intel_soc_dts_sensor_entry *dts)
{
if (dts) {
iosf_mbi_write(BT_MBI_UNIT_PMC, MBI_REG_WRITE,
SOC_DTS_OFFSET_ENABLE, dts->store_status);
thermal_zone_device_unregister(dts->tzone);
}
iosf_mbi_write(BT_MBI_UNIT_PMC, MBI_REG_WRITE,
SOC_DTS_OFFSET_ENABLE, dts->store_status);
thermal_zone_device_unregister(dts->tzone);
}
static int add_dts_thermal_zone(int id, struct intel_soc_dts_sensor_entry *dts,
bool notification_support, int trip_cnt,
int read_only_trip_cnt)
bool critical_trip)
{
int writable_trip_cnt = SOC_MAX_DTS_TRIPS;
char name[10];
unsigned long trip;
int trip_count = 0;
int trip_mask = 0;
int writable_trip_cnt = 0;
int trip_mask;
unsigned long ptps;
u32 store_ptps;
unsigned long i;
@ -273,11 +236,11 @@ static int add_dts_thermal_zone(int id, struct intel_soc_dts_sensor_entry *dts,
goto err_ret;
dts->id = id;
if (notification_support) {
trip_count = min(SOC_MAX_DTS_TRIPS, trip_cnt);
writable_trip_cnt = trip_count - read_only_trip_cnt;
trip_mask = GENMASK(writable_trip_cnt - 1, 0);
}
if (critical_trip)
writable_trip_cnt--;
trip_mask = GENMASK(writable_trip_cnt - 1, 0);
/* Check if the writable trip we provide is not used by BIOS */
ret = iosf_mbi_read(BT_MBI_UNIT_PMC, MBI_REG_READ,
@ -290,13 +253,12 @@ static int add_dts_thermal_zone(int id, struct intel_soc_dts_sensor_entry *dts,
trip_mask &= ~BIT(i / 8);
}
dts->trip_mask = trip_mask;
dts->trip_count = trip_count;
snprintf(name, sizeof(name), "soc_dts%d", id);
dts->tzone = thermal_zone_device_register(name,
trip_count,
trip_mask,
dts, &tzone_ops,
NULL, 0, 0);
dts->tzone = thermal_zone_device_register_with_trips(name, dts->trips,
SOC_MAX_DTS_TRIPS,
trip_mask,
dts, &tzone_ops,
NULL, 0, 0);
if (IS_ERR(dts->tzone)) {
ret = PTR_ERR(dts->tzone);
goto err_ret;
@ -316,26 +278,6 @@ err_ret:
return ret;
}
int intel_soc_dts_iosf_add_read_only_critical_trip(
struct intel_soc_dts_sensors *sensors, int critical_offset)
{
int i, j;
for (i = 0; i < SOC_MAX_DTS_SENSORS; ++i) {
struct intel_soc_dts_sensor_entry *entry = &sensors->soc_dts[i];
int temp = sensors->tj_max - critical_offset;
unsigned long count = entry->trip_count;
unsigned long mask = entry->trip_mask;
j = find_first_zero_bit(&mask, count);
if (j < count)
return update_trip_temp(entry, j, temp, THERMAL_TRIP_CRITICAL);
}
return -EINVAL;
}
EXPORT_SYMBOL_GPL(intel_soc_dts_iosf_add_read_only_critical_trip);
void intel_soc_dts_iosf_interrupt_handler(struct intel_soc_dts_sensors *sensors)
{
u32 sticky_out;
@ -371,12 +313,17 @@ void intel_soc_dts_iosf_interrupt_handler(struct intel_soc_dts_sensors *sensors)
}
EXPORT_SYMBOL_GPL(intel_soc_dts_iosf_interrupt_handler);
struct intel_soc_dts_sensors *intel_soc_dts_iosf_init(
enum intel_soc_dts_interrupt_type intr_type, int trip_count,
int read_only_trip_count)
static void dts_trips_reset(struct intel_soc_dts_sensors *sensors, int dts_index)
{
configure_trip(&sensors->soc_dts[dts_index], 0, 0, 0);
configure_trip(&sensors->soc_dts[dts_index], 1, 0, 0);
}
struct intel_soc_dts_sensors *
intel_soc_dts_iosf_init(enum intel_soc_dts_interrupt_type intr_type,
bool critical_trip, int crit_offset)
{
struct intel_soc_dts_sensors *sensors;
bool notification;
int tj_max;
int ret;
int i;
@ -384,9 +331,6 @@ struct intel_soc_dts_sensors *intel_soc_dts_iosf_init(
if (!iosf_mbi_available())
return ERR_PTR(-ENODEV);
if (!trip_count || read_only_trip_count > trip_count)
return ERR_PTR(-EINVAL);
tj_max = intel_tcc_get_tjmax(-1);
if (tj_max < 0)
return ERR_PTR(tj_max);
@ -399,37 +343,46 @@ struct intel_soc_dts_sensors *intel_soc_dts_iosf_init(
mutex_init(&sensors->dts_update_lock);
sensors->intr_type = intr_type;
sensors->tj_max = tj_max * 1000;
if (intr_type == INTEL_SOC_DTS_INTERRUPT_NONE)
notification = false;
else
notification = true;
for (i = 0; i < SOC_MAX_DTS_SENSORS; ++i) {
enum thermal_trip_type trip_type;
int temp;
sensors->soc_dts[i].sensors = sensors;
ret = add_dts_thermal_zone(i, &sensors->soc_dts[i],
notification, trip_count,
read_only_trip_count);
ret = configure_trip(&sensors->soc_dts[i], 0,
THERMAL_TRIP_PASSIVE, 0);
if (ret)
goto err_free;
goto err_reset_trips;
if (critical_trip) {
trip_type = THERMAL_TRIP_CRITICAL;
temp = sensors->tj_max - crit_offset;
} else {
trip_type = THERMAL_TRIP_PASSIVE;
temp = 0;
}
ret = configure_trip(&sensors->soc_dts[i], 1, trip_type, temp);
if (ret)
goto err_reset_trips;
}
for (i = 0; i < SOC_MAX_DTS_SENSORS; ++i) {
ret = update_trip_temp(&sensors->soc_dts[i], 0, 0,
THERMAL_TRIP_PASSIVE);
if (ret)
goto err_remove_zone;
ret = update_trip_temp(&sensors->soc_dts[i], 1, 0,
THERMAL_TRIP_PASSIVE);
ret = add_dts_thermal_zone(i, &sensors->soc_dts[i], critical_trip);
if (ret)
goto err_remove_zone;
}
return sensors;
err_remove_zone:
for (i = 0; i < SOC_MAX_DTS_SENSORS; ++i)
remove_dts_thermal_zone(&sensors->soc_dts[i]);
err_free:
err_reset_trips:
for (i = 0; i < SOC_MAX_DTS_SENSORS; i++)
dts_trips_reset(sensors, i);
kfree(sensors);
return ERR_PTR(ret);
}
@ -440,9 +393,8 @@ void intel_soc_dts_iosf_exit(struct intel_soc_dts_sensors *sensors)
int i;
for (i = 0; i < SOC_MAX_DTS_SENSORS; ++i) {
update_trip_temp(&sensors->soc_dts[i], 0, 0, 0);
update_trip_temp(&sensors->soc_dts[i], 1, 0, 0);
remove_dts_thermal_zone(&sensors->soc_dts[i]);
dts_trips_reset(sensors, i);
}
kfree(sensors);
}

Просмотреть файл

@ -12,6 +12,9 @@
/* DTS0 and DTS 1 */
#define SOC_MAX_DTS_SENSORS 2
/* Only 2 out of 4 is allowed for OSPM */
#define SOC_MAX_DTS_TRIPS 2
enum intel_soc_dts_interrupt_type {
INTEL_SOC_DTS_INTERRUPT_NONE,
INTEL_SOC_DTS_INTERRUPT_APIC,
@ -26,8 +29,7 @@ struct intel_soc_dts_sensor_entry {
int id;
u32 store_status;
u32 trip_mask;
u32 trip_count;
enum thermal_trip_type trip_types[2];
struct thermal_trip trips[SOC_MAX_DTS_TRIPS];
struct thermal_zone_device *tzone;
struct intel_soc_dts_sensors *sensors;
};
@ -40,12 +42,11 @@ struct intel_soc_dts_sensors {
struct intel_soc_dts_sensor_entry soc_dts[SOC_MAX_DTS_SENSORS];
};
struct intel_soc_dts_sensors *intel_soc_dts_iosf_init(
enum intel_soc_dts_interrupt_type intr_type, int trip_count,
int read_only_trip_count);
struct intel_soc_dts_sensors *
intel_soc_dts_iosf_init(enum intel_soc_dts_interrupt_type intr_type,
bool critical_trip, int crit_offset);
void intel_soc_dts_iosf_exit(struct intel_soc_dts_sensors *sensors);
void intel_soc_dts_iosf_interrupt_handler(
struct intel_soc_dts_sensors *sensors);
int intel_soc_dts_iosf_add_read_only_critical_trip(
struct intel_soc_dts_sensors *sensors, int critical_offset);
#endif

Просмотреть файл

@ -51,7 +51,8 @@ static int __init intel_soc_thermal_init(void)
return -ENODEV;
/* Create a zone with 2 trips with marked as read only */
soc_dts = intel_soc_dts_iosf_init(INTEL_SOC_DTS_INTERRUPT_APIC, 2, 1);
soc_dts = intel_soc_dts_iosf_init(INTEL_SOC_DTS_INTERRUPT_APIC, true,
crit_offset);
if (IS_ERR(soc_dts)) {
err = PTR_ERR(soc_dts);
return err;
@ -88,21 +89,7 @@ static int __init intel_soc_thermal_init(void)
}
}
err = intel_soc_dts_iosf_add_read_only_critical_trip(soc_dts,
crit_offset);
if (err)
goto error_trips;
return 0;
error_trips:
if (soc_dts_thres_irq) {
free_irq(soc_dts_thres_irq, soc_dts);
acpi_unregister_gsi(soc_dts_thres_gsi);
}
intel_soc_dts_iosf_exit(soc_dts);
return err;
}
static void __exit intel_soc_thermal_exit(void)

Просмотреть файл

@ -11,7 +11,7 @@
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_platform.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
#include <linux/thermal.h>
#include <linux/types.h>

Просмотреть файл

@ -10,10 +10,10 @@
#include <linux/module.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
#include <linux/err.h>
#include <linux/types.h>
#include <linux/of_platform.h>
#include <linux/io.h>
#include <linux/thermal.h>
#include <linux/of.h>

Просмотреть файл

@ -15,7 +15,6 @@
#include <linux/nvmem-consumer.h>
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/of_device.h>
#include <linux/platform_device.h>
#include <linux/slab.h>
#include <linux/io.h>

Просмотреть файл

@ -13,7 +13,7 @@
#include <linux/iopoll.h>
#include <linux/kernel.h>
#include <linux/nvmem-consumer.h>
#include <linux/of_device.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/reset.h>
#include <linux/thermal.h>

Просмотреть файл

@ -14,7 +14,6 @@
#include <linux/interrupt.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_device.h>
#include <linux/platform_device.h>
#include <linux/regmap.h>
#include <linux/thermal.h>

Просмотреть файл

@ -10,7 +10,6 @@
#include <linux/interrupt.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_device.h>
#include <linux/platform_device.h>
#include <linux/regmap.h>
#include <linux/thermal.h>

Просмотреть файл

@ -11,7 +11,7 @@
#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/module.h>
#include <linux/of_device.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
#include <linux/thermal.h>

Просмотреть файл

@ -11,7 +11,7 @@
#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/module.h>
#include <linux/of_device.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
#include <linux/reboot.h>

Просмотреть файл

@ -9,8 +9,8 @@
#include <linux/io.h>
#include <linux/iopoll.h>
#include <linux/math.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h>
#include <linux/of_device.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
#include <linux/reset.h>

Просмотреть файл

@ -15,7 +15,7 @@
#include <linux/io.h>
#include <linux/interrupt.h>
#include <linux/module.h>
#include <linux/of_device.h>
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/of_irq.h>
#include <linux/platform_device.h>

Просмотреть файл

@ -6,7 +6,7 @@
#include <linux/iopoll.h>
#include <linux/module.h>
#include <linux/nvmem-consumer.h>
#include <linux/of_device.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/slab.h>
#include <linux/thermal.h>

Просмотреть файл

@ -14,8 +14,6 @@
#include <linux/iopoll.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/of_device.h>
#include <linux/platform_device.h>
#include <linux/thermal.h>

Просмотреть файл

@ -14,7 +14,7 @@
#include <linux/interrupt.h>
#include <linux/module.h>
#include <linux/nvmem-consumer.h>
#include <linux/of_device.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/regmap.h>
#include <linux/reset.h>

Просмотреть файл

@ -18,7 +18,7 @@
#include <linux/iopoll.h>
#include <linux/math.h>
#include <linux/module.h>
#include <linux/of_device.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/pm.h>
#include <linux/reset.h>

Просмотреть файл

@ -10,8 +10,7 @@
#include <linux/err.h>
#include <linux/export.h>
#include <linux/of_device.h>
#include <linux/of_platform.h>
#include <linux/of.h>
#include <linux/slab.h>
#include <linux/thermal.h>
#include <linux/types.h>
@ -292,13 +291,13 @@ static int __thermal_of_unbind(struct device_node *map_np, int index, int trip_i
ret = of_parse_phandle_with_args(map_np, "cooling-device", "#cooling-cells",
index, &cooling_spec);
of_node_put(cooling_spec.np);
if (ret < 0) {
pr_err("Invalid cooling-device entry\n");
return ret;
}
of_node_put(cooling_spec.np);
if (cooling_spec.args_count < 2) {
pr_err("wrong reference to cooling device, missing limits\n");
return -EINVAL;
@ -325,13 +324,13 @@ static int __thermal_of_bind(struct device_node *map_np, int index, int trip_id,
ret = of_parse_phandle_with_args(map_np, "cooling-device", "#cooling-cells",
index, &cooling_spec);
of_node_put(cooling_spec.np);
if (ret < 0) {
pr_err("Invalid cooling-device entry\n");
return ret;
}
of_node_put(cooling_spec.np);
if (cooling_spec.args_count < 2) {
pr_err("wrong reference to cooling device, missing limits\n");
return -EINVAL;

Просмотреть файл

@ -12,7 +12,6 @@
#include <linux/mfd/syscon.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_device.h>
#include <linux/platform_device.h>
#include <linux/regmap.h>
#include <linux/thermal.h>