Commit 7f2145b0 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux

Pull thermal updates from Zhang Rui:
 "The latest Thermal Management updates for v4.9-rc3:

   - Fix a regression introduced by commit
     b721ca0d(thermal/powerclamp: remove cpu whitelist), that
     powerclamp driver checks cpu support in a wrong way. From: Eric
     Ernst.

   - Fix a problem that intel_pch_thermal driver misses passive trip
     point when the PCH thermal device has an ACPI companion device
     associated. From: Srinivas Pandruvada.

   - Add missing support for Haswell PCH thermal sensor. From: Srinivas
     Pandruvada"

* 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux:
  thermal/powerclamp: correct cpu support check
  thermal: intel_pch_thermal: Enable Haswell PCH
  thermal: intel_pch_thermal: Add an ACPI passive trip
parents 55bea71e 3105f234
...@@ -20,10 +20,13 @@ ...@@ -20,10 +20,13 @@
#include <linux/types.h> #include <linux/types.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/acpi.h>
#include <linux/thermal.h> #include <linux/thermal.h>
#include <linux/pm.h> #include <linux/pm.h>
/* Intel PCH thermal Device IDs */ /* Intel PCH thermal Device IDs */
#define PCH_THERMAL_DID_HSW_1 0x9C24 /* Haswell PCH */
#define PCH_THERMAL_DID_HSW_2 0x8C24 /* Haswell PCH */
#define PCH_THERMAL_DID_WPT 0x9CA4 /* Wildcat Point */ #define PCH_THERMAL_DID_WPT 0x9CA4 /* Wildcat Point */
#define PCH_THERMAL_DID_SKL 0x9D31 /* Skylake PCH */ #define PCH_THERMAL_DID_SKL 0x9D31 /* Skylake PCH */
...@@ -66,9 +69,53 @@ struct pch_thermal_device { ...@@ -66,9 +69,53 @@ struct pch_thermal_device {
unsigned long crt_temp; unsigned long crt_temp;
int hot_trip_id; int hot_trip_id;
unsigned long hot_temp; unsigned long hot_temp;
int psv_trip_id;
unsigned long psv_temp;
bool bios_enabled; bool bios_enabled;
}; };
#ifdef CONFIG_ACPI
/*
* On some platforms, there is a companion ACPI device, which adds
* passive trip temperature using _PSV method. There is no specific
* passive temperature setting in MMIO interface of this PCI device.
*/
static void pch_wpt_add_acpi_psv_trip(struct pch_thermal_device *ptd,
int *nr_trips)
{
struct acpi_device *adev;
ptd->psv_trip_id = -1;
adev = ACPI_COMPANION(&ptd->pdev->dev);
if (adev) {
unsigned long long r;
acpi_status status;
status = acpi_evaluate_integer(adev->handle, "_PSV", NULL,
&r);
if (ACPI_SUCCESS(status)) {
unsigned long trip_temp;
trip_temp = DECI_KELVIN_TO_MILLICELSIUS(r);
if (trip_temp) {
ptd->psv_temp = trip_temp;
ptd->psv_trip_id = *nr_trips;
++(*nr_trips);
}
}
}
}
#else
static void pch_wpt_add_acpi_psv_trip(struct pch_thermal_device *ptd,
int *nr_trips)
{
ptd->psv_trip_id = -1;
}
#endif
static int pch_wpt_init(struct pch_thermal_device *ptd, int *nr_trips) static int pch_wpt_init(struct pch_thermal_device *ptd, int *nr_trips)
{ {
u8 tsel; u8 tsel;
...@@ -119,6 +166,8 @@ static int pch_wpt_init(struct pch_thermal_device *ptd, int *nr_trips) ...@@ -119,6 +166,8 @@ static int pch_wpt_init(struct pch_thermal_device *ptd, int *nr_trips)
++(*nr_trips); ++(*nr_trips);
} }
pch_wpt_add_acpi_psv_trip(ptd, nr_trips);
return 0; return 0;
} }
...@@ -194,6 +243,8 @@ static int pch_get_trip_type(struct thermal_zone_device *tzd, int trip, ...@@ -194,6 +243,8 @@ static int pch_get_trip_type(struct thermal_zone_device *tzd, int trip,
*type = THERMAL_TRIP_CRITICAL; *type = THERMAL_TRIP_CRITICAL;
else if (ptd->hot_trip_id == trip) else if (ptd->hot_trip_id == trip)
*type = THERMAL_TRIP_HOT; *type = THERMAL_TRIP_HOT;
else if (ptd->psv_trip_id == trip)
*type = THERMAL_TRIP_PASSIVE;
else else
return -EINVAL; return -EINVAL;
...@@ -208,6 +259,8 @@ static int pch_get_trip_temp(struct thermal_zone_device *tzd, int trip, int *tem ...@@ -208,6 +259,8 @@ static int pch_get_trip_temp(struct thermal_zone_device *tzd, int trip, int *tem
*temp = ptd->crt_temp; *temp = ptd->crt_temp;
else if (ptd->hot_trip_id == trip) else if (ptd->hot_trip_id == trip)
*temp = ptd->hot_temp; *temp = ptd->hot_temp;
else if (ptd->psv_trip_id == trip)
*temp = ptd->psv_temp;
else else
return -EINVAL; return -EINVAL;
...@@ -242,6 +295,11 @@ static int intel_pch_thermal_probe(struct pci_dev *pdev, ...@@ -242,6 +295,11 @@ static int intel_pch_thermal_probe(struct pci_dev *pdev,
ptd->ops = &pch_dev_ops_wpt; ptd->ops = &pch_dev_ops_wpt;
dev_name = "pch_skylake"; dev_name = "pch_skylake";
break; break;
case PCH_THERMAL_DID_HSW_1:
case PCH_THERMAL_DID_HSW_2:
ptd->ops = &pch_dev_ops_wpt;
dev_name = "pch_haswell";
break;
default: default:
dev_err(&pdev->dev, "unknown pch thermal device\n"); dev_err(&pdev->dev, "unknown pch thermal device\n");
return -ENODEV; return -ENODEV;
...@@ -324,6 +382,8 @@ static int intel_pch_thermal_resume(struct device *device) ...@@ -324,6 +382,8 @@ static int intel_pch_thermal_resume(struct device *device)
static struct pci_device_id intel_pch_thermal_id[] = { static struct pci_device_id intel_pch_thermal_id[] = {
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCH_THERMAL_DID_WPT) }, { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCH_THERMAL_DID_WPT) },
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCH_THERMAL_DID_SKL) }, { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCH_THERMAL_DID_SKL) },
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCH_THERMAL_DID_HSW_1) },
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCH_THERMAL_DID_HSW_2) },
{ 0, }, { 0, },
}; };
MODULE_DEVICE_TABLE(pci, intel_pch_thermal_id); MODULE_DEVICE_TABLE(pci, intel_pch_thermal_id);
......
...@@ -669,20 +669,10 @@ static struct thermal_cooling_device_ops powerclamp_cooling_ops = { ...@@ -669,20 +669,10 @@ static struct thermal_cooling_device_ops powerclamp_cooling_ops = {
.set_cur_state = powerclamp_set_cur_state, .set_cur_state = powerclamp_set_cur_state,
}; };
static const struct x86_cpu_id intel_powerclamp_ids[] __initconst = {
{ X86_VENDOR_INTEL, X86_FAMILY_ANY, X86_MODEL_ANY, X86_FEATURE_MWAIT },
{ X86_VENDOR_INTEL, X86_FAMILY_ANY, X86_MODEL_ANY, X86_FEATURE_ARAT },
{ X86_VENDOR_INTEL, X86_FAMILY_ANY, X86_MODEL_ANY, X86_FEATURE_NONSTOP_TSC },
{ X86_VENDOR_INTEL, X86_FAMILY_ANY, X86_MODEL_ANY, X86_FEATURE_CONSTANT_TSC},
{}
};
MODULE_DEVICE_TABLE(x86cpu, intel_powerclamp_ids);
static int __init powerclamp_probe(void) static int __init powerclamp_probe(void)
{ {
if (!x86_match_cpu(intel_powerclamp_ids)) { if (!boot_cpu_has(X86_FEATURE_MWAIT)) {
pr_err("Intel powerclamp does not run on family %d model %d\n", pr_err("CPU does not support MWAIT");
boot_cpu_data.x86, boot_cpu_data.x86_model);
return -ENODEV; return -ENODEV;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment