Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 76 additions & 0 deletions Documentation/devicetree/bindings/thermal/spacemit,k1-thermal.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/thermal/spacemit,k1-thermal.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: SpacemiT K1 Thermal Sensor Unit

description:
The SpacemiT K1 Thermal Sensor Unit (TSU) monitors the temperature of
the SoC using multiple internal sensors (e.g., soc, package, gpu, clusters).

maintainers:
- Shuwei Wu <[email protected]>

$ref: thermal-sensor.yaml#

properties:
compatible:
const: spacemit,k1-thermal

reg:
maxItems: 1

clocks:
items:
- description: Core clock for thermal sensor
- description: Bus clock for thermal sensor

clock-names:
items:
- const: core
- const: bus

interrupts:
maxItems: 1

resets:
items:
- description: Reset for the thermal sensor

"#thermal-sensor-cells":
const: 1
description:
The first cell indicates the sensor ID.
0 = soc
1 = package
2 = gpu
3 = cluster0
4 = cluster1

required:
- compatible
- reg
- clocks
- clock-names
- interrupts
- resets
- "#thermal-sensor-cells"

additionalProperties: false

examples:
- |
#include <dt-bindings/clock/spacemit,k1-syscon.h>

thermal@d4018000 {
compatible = "spacemit,k1-thermal";
reg = <0xd4018000 0x100>;
clocks = <&syscon_apbc CLK_TSEN>,
<&syscon_apbc CLK_TSEN_BUS>;
clock-names = "core", "bus";
interrupts = <61>;
resets = <&syscon_apbc RESET_TSEN>;
#thermal-sensor-cells = <1>;
};
101 changes: 101 additions & 0 deletions arch/riscv/boot/dts/spacemit/k1.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,96 @@
};
};

thermal-zones {
soc-thermal {
polling-delay-passive = <0>;
polling-delay = <0>;
thermal-sensors = <&thermal 0>;

trips {
soc-crit {
temperature = <115000>;
hysteresis = <0>;
type = "critical";
};
};
};

package-thermal {
polling-delay-passive = <0>;
polling-delay = <0>;
thermal-sensors = <&thermal 1>;

trips {
package-crit {
temperature = <115000>;
hysteresis = <0>;
type = "critical";
};
};
};

gpu-thermal {
polling-delay-passive = <100>;
polling-delay = <0>;
thermal-sensors = <&thermal 2>;

trips {
gpu-alert {
temperature = <85000>;
hysteresis = <2000>;
type = "passive";
};

gpu-crit {
temperature = <115000>;
hysteresis = <0>;
type = "critical";
};
};
};

cluster0-thermal {
polling-delay-passive = <100>;
polling-delay = <0>;
thermal-sensors = <&thermal 3>;

trips {
cluster0-alert {
temperature = <85000>;
hysteresis = <2000>;
type = "passive";
};

cluster0-crit {
temperature = <115000>;
hysteresis = <0>;
type = "critical";
};
};
};

cluster1-thermal {
polling-delay-passive = <100>;
polling-delay = <0>;
thermal-sensors = <&thermal 4>;

trips {
cluster1-alert {
temperature = <85000>;
hysteresis = <2000>;
type = "passive";
};

cluster1-crit {
temperature = <115000>;
hysteresis = <0>;
type = "critical";
};
};
};
};

soc {
compatible = "simple-bus";
interrupt-parent = <&plic>;
Expand Down Expand Up @@ -369,6 +459,17 @@
#reset-cells = <1>;
};

thermal: thermal@d4018000 {
compatible = "spacemit,k1-thermal";
reg = <0x0 0xd4018000 0x0 0x100>;
clocks = <&syscon_apbc CLK_TSEN>,
<&syscon_apbc CLK_TSEN_BUS>;
clock-names = "core", "bus";
interrupts = <61>;
resets = <&syscon_apbc RESET_TSEN>;
#thermal-sensor-cells = <1>;
};

gpio: gpio@d4019000 {
compatible = "spacemit,k1-gpio";
reg = <0x0 0xd4019000 0x0 0x100>;
Expand Down
14 changes: 14 additions & 0 deletions drivers/thermal/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,20 @@ config SPRD_THERMAL
Support for the Spreadtrum thermal sensor driver in the Linux thermal
framework.

config K1_THERMAL
tristate "SpacemiT K1 thermal sensor driver"
depends on ARCH_SPACEMIT || COMPILE_TEST
help
This driver provides support for the thermal sensor unit (TSU)
integrated in the SpacemiT K1 SoC.

The TSU monitors temperatures for five thermal zones: soc, package,
gpu, cluster0, and cluster1. It supports reporting temperature
values and handling high/low threshold interrupts.

Say Y here if you want to enable thermal monitoring on SpacemiT K1.
If compiled as a module, it will be called k1_thermal.

config KHADAS_MCU_FAN_THERMAL
tristate "Khadas MCU controller FAN cooling support"
depends on OF
Expand Down
1 change: 1 addition & 0 deletions drivers/thermal/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ obj-$(CONFIG_GENERIC_ADC_THERMAL) += thermal-generic-adc.o
obj-$(CONFIG_UNIPHIER_THERMAL) += uniphier_thermal.o
obj-$(CONFIG_AMLOGIC_THERMAL) += amlogic_thermal.o
obj-$(CONFIG_SPRD_THERMAL) += sprd_thermal.o
obj-$(CONFIG_K1_THERMAL) += k1_thermal.o
obj-$(CONFIG_KHADAS_MCU_FAN_THERMAL) += khadas_mcu_fan.o
obj-$(CONFIG_LOONGSON2_THERMAL) += loongson2_thermal.o
obj-$(CONFIG_THERMAL_CORE_TESTING) += testing/
Loading
Loading