diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-12-13 09:00:28 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-12-13 09:00:28 -0800 |
commit | 9346116d148595a28fe3521f81ac8e14d93239c3 (patch) | |
tree | b56004a1b71089e3a185464d0baad2e22c53dfa6 /drivers/thermal/intel_pch_thermal.c | |
parent | b8d2798f32785398fcd1c48ea80c0c6c5ab88537 (diff) | |
parent | 0faf7dd5a947006978b549dfe29a01b710becf4a (diff) | |
download | blackbird-op-linux-9346116d148595a28fe3521f81ac8e14d93239c3.tar.gz blackbird-op-linux-9346116d148595a28fe3521f81ac8e14d93239c3.zip |
Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux
Pull thermal management updates from Zhang Rui:
- Thermal core code reorganization and cleanup. Two new files are
created for thermal sysfs I/F code and thermal helper functions
(Eduardo Valentin).
- Sanitize hotplug and locking for x86_pkg_temp driver (Thomas
Gleixner)
- Update MAINTAINER file for pwm-fan driver and Samsung thermal driver
(Lukasz Majewski)
- Fix module auto-load for max77620, tango and db8500 thermal driver
(Javier Martinez Canillas)
- Fix a bug that thermal hwmon sysfs I/F returns wrong critical trip
point temperature value (Krzysztof Kozlowski)
- Add Skylake PCH 100 series support for intel_pch_thermal driver
(OGAWA Hirofumi)
- Small fixes and cleanups for platform thermal drivers (Julia Lawall,
Luis Henriques, Leo Yan, Stephen Boyd, Shawn Lin, Javi Merino and
Lukasz Luba)
* 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux: (76 commits)
MAINTAINERS: Samsung: Update maintainer for PWM FAN and SAMSUNG THERMAL
thermal/x86 pkg temp: Convert to hotplug state machine
thermal/x86_pkg_temp: Sanitize package management
thermal/x86_pkg_temp: Move work into package struct
thermal/x86_pkg_temp: Move work scheduled flag into package struct
thermal/x86_pkg_temp: Sanitize locking
thermal/x86_pkg_temp: Cleanup code some more
thermal/x86_pkg_temp: Cleanup namespace
thermal/x86_pkg_temp: Get rid of ref counting
thermal/x86_pkg_temp: Sanitize callback (de)initialization
thermal/x86_pkg_temp: Replace open coded cpu search
thermal/x86_pkg_temp: Remove redundant package search
thermal/x86_pkg_temp: Cleanup thermal interrupt handling
thermal: hwmon: Properly report critical temperature in sysfs
devfreq_cooling: pass a pointer to devfreq in the power model callbacks
devfreq_cooling: make the structs devfreq_cooling_xxx visible for all
dt-bindings: rockchip-thermal: fix the misleading description
thermal: rockchip: improve the warning log
thermal: db8500: Fix module autoload
thermal: tango: Fix module autoload
...
Diffstat (limited to 'drivers/thermal/intel_pch_thermal.c')
-rw-r--r-- | drivers/thermal/intel_pch_thermal.c | 64 |
1 files changed, 39 insertions, 25 deletions
diff --git a/drivers/thermal/intel_pch_thermal.c b/drivers/thermal/intel_pch_thermal.c index 19bf2028e508..2b49e8d0fe9e 100644 --- a/drivers/thermal/intel_pch_thermal.c +++ b/drivers/thermal/intel_pch_thermal.c @@ -29,6 +29,7 @@ #define PCH_THERMAL_DID_HSW_2 0x8C24 /* Haswell PCH */ #define PCH_THERMAL_DID_WPT 0x9CA4 /* Wildcat Point */ #define PCH_THERMAL_DID_SKL 0x9D31 /* Skylake PCH */ +#define PCH_THERMAL_DID_SKL_H 0xA131 /* Skylake PCH 100 series */ /* Wildcat Point-LP PCH Thermal registers */ #define WPT_TEMP 0x0000 /* Temperature */ @@ -273,37 +274,44 @@ static struct thermal_zone_device_ops tzd_ops = { .get_trip_temp = pch_get_trip_temp, }; +enum board_ids { + board_hsw, + board_wpt, + board_skl, +}; + +static const struct board_info { + const char *name; + const struct pch_dev_ops *ops; +} board_info[] = { + [board_hsw] = { + .name = "pch_haswell", + .ops = &pch_dev_ops_wpt, + }, + [board_wpt] = { + .name = "pch_wildcat_point", + .ops = &pch_dev_ops_wpt, + }, + [board_skl] = { + .name = "pch_skylake", + .ops = &pch_dev_ops_wpt, + }, +}; static int intel_pch_thermal_probe(struct pci_dev *pdev, const struct pci_device_id *id) { + enum board_ids board_id = id->driver_data; + const struct board_info *bi = &board_info[board_id]; struct pch_thermal_device *ptd; int err; int nr_trips; - char *dev_name; ptd = devm_kzalloc(&pdev->dev, sizeof(*ptd), GFP_KERNEL); if (!ptd) return -ENOMEM; - switch (pdev->device) { - case PCH_THERMAL_DID_WPT: - ptd->ops = &pch_dev_ops_wpt; - dev_name = "pch_wildcat_point"; - break; - case PCH_THERMAL_DID_SKL: - ptd->ops = &pch_dev_ops_wpt; - dev_name = "pch_skylake"; - 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: - dev_err(&pdev->dev, "unknown pch thermal device\n"); - return -ENODEV; - } + ptd->ops = bi->ops; pci_set_drvdata(pdev, ptd); ptd->pdev = pdev; @@ -331,11 +339,11 @@ static int intel_pch_thermal_probe(struct pci_dev *pdev, if (err) goto error_cleanup; - ptd->tzd = thermal_zone_device_register(dev_name, nr_trips, 0, ptd, + ptd->tzd = thermal_zone_device_register(bi->name, nr_trips, 0, ptd, &tzd_ops, NULL, 0, 0); if (IS_ERR(ptd->tzd)) { dev_err(&pdev->dev, "Failed to register thermal zone %s\n", - dev_name); + bi->name); err = PTR_ERR(ptd->tzd); goto error_cleanup; } @@ -380,10 +388,16 @@ static int intel_pch_thermal_resume(struct device *device) } 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_SKL) }, - { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCH_THERMAL_DID_HSW_1) }, - { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCH_THERMAL_DID_HSW_2) }, + { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCH_THERMAL_DID_HSW_1), + .driver_data = board_hsw, }, + { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCH_THERMAL_DID_HSW_2), + .driver_data = board_hsw, }, + { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCH_THERMAL_DID_WPT), + .driver_data = board_wpt, }, + { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCH_THERMAL_DID_SKL), + .driver_data = board_skl, }, + { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCH_THERMAL_DID_SKL_H), + .driver_data = board_skl, }, { 0, }, }; MODULE_DEVICE_TABLE(pci, intel_pch_thermal_id); |