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

arm64: zynqmp: Add thermal zones

Add some thermal trip points. We can't undervolt the CPUs to save power
when we underclock them, so there isn't really a point in throttling
them until we are about to overheat. As such, the passive trip point is
right below the critical trip point.

The critical trip point is the extended/industrial-grade maximum
junction temperature of 100C minus the maximum temperature sensor error
of 3.5C (in the range -55C to 110C). Automotive- and military-grade
parts can go up to 125C, but as far as I can tell there is no way to
detect them at runtime. Userspace can adjust the trip points at runtime,
but this may not be viable when booting above 100C. I think it's
reasonable to ask automotive/military users to edit their device trees
to bump the trip points, but if that proves to be an issue we can
always go with no default temperatures. However, that wouldn't be too
nice for the majority of extended/industrial users.

Signed-off-by: Sean Anderson <sean.anderson@linux.dev>
Link: https://lore.kernel.org/r/20240812215129.3599832-4-sean.anderson@linux.dev
Signed-off-by: Michal Simek <michal.simek@amd.com>

authored by

Sean Anderson and committed by
Michal Simek
d57df7a7 e279e4b2

+86
+86
arch/arm64/boot/dts/xilinx/zynqmp.dtsi
··· 18 18 #include <dt-bindings/interrupt-controller/irq.h> 19 19 #include <dt-bindings/power/xlnx-zynqmp-power.h> 20 20 #include <dt-bindings/reset/xlnx-zynqmp-resets.h> 21 + #include <dt-bindings/thermal/thermal.h> 21 22 22 23 / { 23 24 compatible = "xlnx,zynqmp"; ··· 37 36 #size-cells = <0>; 38 37 39 38 cpu0: cpu@0 { 39 + #cooling-cells = <2>; 40 40 compatible = "arm,cortex-a53"; 41 41 device_type = "cpu"; 42 42 enable-method = "psci"; ··· 48 46 }; 49 47 50 48 cpu1: cpu@1 { 49 + #cooling-cells = <2>; 51 50 compatible = "arm,cortex-a53"; 52 51 device_type = "cpu"; 53 52 enable-method = "psci"; ··· 59 56 }; 60 57 61 58 cpu2: cpu@2 { 59 + #cooling-cells = <2>; 62 60 compatible = "arm,cortex-a53"; 63 61 device_type = "cpu"; 64 62 enable-method = "psci"; ··· 70 66 }; 71 67 72 68 cpu3: cpu@3 { 69 + #cooling-cells = <2>; 73 70 compatible = "arm,cortex-a53"; 74 71 device_type = "cpu"; 75 72 enable-method = "psci"; ··· 409 404 <&xilinx_ams 21>, <&xilinx_ams 22>, <&xilinx_ams 23>, 410 405 <&xilinx_ams 24>, <&xilinx_ams 25>, <&xilinx_ams 26>, 411 406 <&xilinx_ams 27>, <&xilinx_ams 28>, <&xilinx_ams 29>; 407 + }; 408 + 409 + 410 + tsens_apu: thermal-sensor-apu { 411 + compatible = "generic-adc-thermal"; 412 + #thermal-sensor-cells = <0>; 413 + io-channels = <&xilinx_ams 7>; 414 + io-channel-names = "sensor-channel"; 415 + }; 416 + 417 + tsens_rpu: thermal-sensor-rpu { 418 + compatible = "generic-adc-thermal"; 419 + #thermal-sensor-cells = <0>; 420 + io-channels = <&xilinx_ams 8>; 421 + io-channel-names = "sensor-channel"; 422 + }; 423 + 424 + tsens_pl: thermal-sensor-pl { 425 + compatible = "generic-adc-thermal"; 426 + #thermal-sensor-cells = <0>; 427 + io-channels = <&xilinx_ams 20>; 428 + io-channel-names = "sensor-channel"; 429 + }; 430 + 431 + thermal-zones { 432 + apu-thermal { 433 + polling-delay-passive = <1000>; 434 + polling-delay = <5000>; 435 + thermal-sensors = <&tsens_apu>; 436 + 437 + trips { 438 + apu_passive: passive { 439 + temperature = <93000>; 440 + hysteresis = <3500>; 441 + type = "passive"; 442 + }; 443 + 444 + apu_critical: critical { 445 + temperature = <96500>; 446 + hysteresis = <3500>; 447 + type = "critical"; 448 + }; 449 + }; 450 + 451 + cooling-maps { 452 + map { 453 + trip = <&apu_passive>; 454 + cooling-device = 455 + <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, 456 + <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, 457 + <&cpu2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, 458 + <&cpu3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; 459 + }; 460 + }; 461 + }; 462 + 463 + rpu-thermal { 464 + polling-delay = <10000>; 465 + thermal-sensors = <&tsens_rpu>; 466 + 467 + trips { 468 + critical { 469 + temperature = <96500>; 470 + hysteresis = <3500>; 471 + type = "critical"; 472 + }; 473 + }; 474 + }; 475 + 476 + pl-thermal { 477 + polling-delay = <10000>; 478 + thermal-sensors = <&tsens_pl>; 479 + 480 + trips { 481 + critical { 482 + temperature = <96500>; 483 + hysteresis = <3500>; 484 + type = "critical"; 485 + }; 486 + }; 487 + }; 412 488 }; 413 489 414 490 amba: axi {