Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

Pull thermal control fixes from Rafael Wysocki:
"These fix a few issues related to the MSI IRQs management in the
int340x thermal driver, fix a thermal core issue that may lead to
missing trip point crossing events and update the thermal core
documentation.

Specifics:

- Fix MSI error path cleanup in int340x, allow it to work with a
subset of thermal MSI IRQs if some of them are not working and make
it free all MSI IRQs on module exit (Srinivas Pandruvada)

- Fix a thermal core issue that may lead to missing trip point
crossing events in some cases when thermal_zone_set_trips() is used
and update the thermal core documentation (Rafael Wysocki)"

* tag 'thermal-6.11-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
thermal: core: Update thermal zone registration documentation
thermal: trip: Avoid skipping trips in thermal_zone_set_trips()
thermal: intel: int340x: Free MSI IRQ vectors on module exit
thermal: intel: int340x: Allow limited thermal MSI support
thermal: intel: int340x: Fix kernel warning during MSI cleanup

+54 -44
+30 -35
Documentation/driver-api/thermal/sysfs-api.rst
··· 4 4 5 5 Written by Sujith Thomas <sujith.thomas@intel.com>, Zhang Rui <rui.zhang@intel.com> 6 6 7 - Updated: 2 January 2008 8 - 9 7 Copyright (c) 2008 Intel Corporation 10 8 11 9 ··· 36 38 37 39 :: 38 40 39 - struct thermal_zone_device 40 - *thermal_zone_device_register(char *type, 41 - int trips, int mask, void *devdata, 42 - struct thermal_zone_device_ops *ops, 43 - const struct thermal_zone_params *tzp, 44 - int passive_delay, int polling_delay)) 41 + struct thermal_zone_device * 42 + thermal_zone_device_register_with_trips(const char *type, 43 + const struct thermal_trip *trips, 44 + int num_trips, void *devdata, 45 + const struct thermal_zone_device_ops *ops, 46 + const struct thermal_zone_params *tzp, 47 + unsigned int passive_delay, 48 + unsigned int polling_delay) 45 49 46 - This interface function adds a new thermal zone device (sensor) to 50 + This interface function adds a new thermal zone device (sensor) to the 47 51 /sys/class/thermal folder as `thermal_zone[0-*]`. It tries to bind all the 48 - thermal cooling devices registered at the same time. 52 + thermal cooling devices registered to it at the same time. 49 53 50 54 type: 51 55 the thermal zone type. 52 56 trips: 53 - the total number of trip points this thermal zone supports. 54 - mask: 55 - Bit string: If 'n'th bit is set, then trip point 'n' is writable. 57 + the table of trip points for this thermal zone. 56 58 devdata: 57 59 device private data 58 60 ops: ··· 65 67 .get_temp: 66 68 get the current temperature of the thermal zone. 67 69 .set_trips: 68 - set the trip points window. Whenever the current temperature 69 - is updated, the trip points immediately below and above the 70 - current temperature are found. 71 - .get_mode: 72 - get the current mode (enabled/disabled) of the thermal zone. 73 - 74 - - "enabled" means the kernel thermal management is 75 - enabled. 76 - - "disabled" will prevent kernel thermal driver action 77 - upon trip points so that user applications can take 78 - charge of thermal management. 79 - .set_mode: 80 - set the mode (enabled/disabled) of the thermal zone. 81 - .get_trip_type: 82 - get the type of certain trip point. 83 - .get_trip_temp: 84 - get the temperature above which the certain trip point 85 - will be fired. 70 + set the trip points window. Whenever the current temperature 71 + is updated, the trip points immediately below and above the 72 + current temperature are found. 73 + .change_mode: 74 + change the mode (enabled/disabled) of the thermal zone. 75 + .set_trip_temp: 76 + set the temperature of a given trip point. 77 + .get_crit_temp: 78 + get the critical temperature for this thermal zone. 86 79 .set_emul_temp: 87 - set the emulation temperature which helps in debugging 88 - different threshold temperature points. 80 + set the emulation temperature which helps in debugging 81 + different threshold temperature points. 82 + .get_trend: 83 + get the trend of most recent zone temperature changes. 84 + .hot: 85 + hot trip point crossing handler. 86 + .critical: 87 + critical trip point crossing handler. 89 88 tzp: 90 89 thermal zone platform parameters. 91 90 passive_delay: 92 - number of milliseconds to wait between polls when 93 - performing passive cooling. 91 + number of milliseconds to wait between polls when performing passive 92 + cooling. 94 93 polling_delay: 95 94 number of milliseconds to wait between polls when checking 96 95 whether trip points have been crossed (0 for interrupt driven systems).
+22 -7
drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.c
··· 278 278 279 279 static bool msi_irq; 280 280 281 + static void proc_thermal_free_msi(struct pci_dev *pdev, struct proc_thermal_pci *pci_info) 282 + { 283 + int i; 284 + 285 + for (i = 0; i < MSI_THERMAL_MAX; i++) { 286 + if (proc_thermal_msi_map[i]) 287 + devm_free_irq(&pdev->dev, proc_thermal_msi_map[i], pci_info); 288 + } 289 + 290 + pci_free_irq_vectors(pdev); 291 + } 292 + 281 293 static int proc_thermal_setup_msi(struct pci_dev *pdev, struct proc_thermal_pci *pci_info) 282 294 { 283 - int ret, i, irq; 295 + int ret, i, irq, count; 284 296 285 - ret = pci_alloc_irq_vectors(pdev, 1, MSI_THERMAL_MAX, PCI_IRQ_MSI | PCI_IRQ_MSIX); 286 - if (ret < 0) { 297 + count = pci_alloc_irq_vectors(pdev, 1, MSI_THERMAL_MAX, PCI_IRQ_MSI | PCI_IRQ_MSIX); 298 + if (count < 0) { 287 299 dev_err(&pdev->dev, "Failed to allocate vectors!\n"); 288 - return ret; 300 + return count; 289 301 } 290 302 291 303 dev_info(&pdev->dev, "msi enabled:%d msix enabled:%d\n", pdev->msi_enabled, 292 304 pdev->msix_enabled); 293 305 294 - for (i = 0; i < MSI_THERMAL_MAX; i++) { 306 + for (i = 0; i < count; i++) { 295 307 irq = pci_irq_vector(pdev, i); 296 308 297 309 ret = devm_request_threaded_irq(&pdev->dev, irq, proc_thermal_irq_handler, ··· 322 310 return 0; 323 311 324 312 err_free_msi_vectors: 325 - pci_free_irq_vectors(pdev); 313 + proc_thermal_free_msi(pdev, pci_info); 326 314 327 315 return ret; 328 316 } ··· 409 397 410 398 err_free_vectors: 411 399 if (msi_irq) 412 - pci_free_irq_vectors(pdev); 400 + proc_thermal_free_msi(pdev, pci_info); 413 401 err_ret_tzone: 414 402 thermal_zone_device_unregister(pci_info->tzone); 415 403 err_del_legacy: ··· 430 418 431 419 proc_thermal_mmio_write(pci_info, PROC_THERMAL_MMIO_THRES_0, 0); 432 420 proc_thermal_mmio_write(pci_info, PROC_THERMAL_MMIO_INT_ENABLE_0, 0); 421 + 422 + if (msi_irq) 423 + proc_thermal_free_msi(pdev, pci_info); 433 424 434 425 thermal_zone_device_unregister(pci_info->tzone); 435 426 proc_thermal_mmio_remove(pdev, pci_info->proc_priv);
+2 -2
drivers/thermal/thermal_trip.c
··· 88 88 return; 89 89 90 90 for_each_trip_desc(tz, td) { 91 - if (td->threshold < tz->temperature && td->threshold > low) 91 + if (td->threshold <= tz->temperature && td->threshold > low) 92 92 low = td->threshold; 93 93 94 - if (td->threshold > tz->temperature && td->threshold < high) 94 + if (td->threshold >= tz->temperature && td->threshold < high) 95 95 high = td->threshold; 96 96 } 97 97