xref: /freebsd/sys/contrib/device-tree/Bindings/thermal/nvidia,tegra124-soctherm.txt (revision b97ee269eae3cbaf35c18f51a459aea581c2a7dc)
1c66ec88fSEmmanuel VadotTegra124 SOCTHERM thermal management system
2c66ec88fSEmmanuel Vadot
3c66ec88fSEmmanuel VadotThe SOCTHERM IP block contains thermal sensors, support for polled
4c66ec88fSEmmanuel Vadotor interrupt-based thermal monitoring, CPU and GPU throttling based
5c66ec88fSEmmanuel Vadoton temperature trip points, and handling external overcurrent
6c66ec88fSEmmanuel Vadotnotifications. It is also used to manage emergency shutdown in an
7c66ec88fSEmmanuel Vadotoverheating situation.
8c66ec88fSEmmanuel Vadot
9c66ec88fSEmmanuel VadotRequired properties :
10c66ec88fSEmmanuel Vadot- compatible : For Tegra124, must contain "nvidia,tegra124-soctherm".
11c66ec88fSEmmanuel Vadot  For Tegra132, must contain "nvidia,tegra132-soctherm".
12c66ec88fSEmmanuel Vadot  For Tegra210, must contain "nvidia,tegra210-soctherm".
13c66ec88fSEmmanuel Vadot- reg : Should contain at least 2 entries for each entry in reg-names:
14c66ec88fSEmmanuel Vadot  - SOCTHERM register set
15c66ec88fSEmmanuel Vadot  - Tegra CAR register set: Required for Tegra124 and Tegra210.
16c66ec88fSEmmanuel Vadot  - CCROC register set: Required for Tegra132.
17c66ec88fSEmmanuel Vadot- reg-names :  Should contain at least 2 entries:
18c66ec88fSEmmanuel Vadot  - soctherm-reg
19c66ec88fSEmmanuel Vadot  - car-reg
20c66ec88fSEmmanuel Vadot  - ccroc-reg
21c66ec88fSEmmanuel Vadot- interrupts : Defines the interrupt used by SOCTHERM
22c66ec88fSEmmanuel Vadot- clocks : Must contain an entry for each entry in clock-names.
23c66ec88fSEmmanuel Vadot  See ../clocks/clock-bindings.txt for details.
24c66ec88fSEmmanuel Vadot- clock-names : Must include the following entries:
25c66ec88fSEmmanuel Vadot  - tsensor
26c66ec88fSEmmanuel Vadot  - soctherm
27c66ec88fSEmmanuel Vadot- resets : Must contain an entry for each entry in reset-names.
28c66ec88fSEmmanuel Vadot  See ../reset/reset.txt for details.
29c66ec88fSEmmanuel Vadot- reset-names : Must include the following entries:
30c66ec88fSEmmanuel Vadot  - soctherm
31c66ec88fSEmmanuel Vadot- #thermal-sensor-cells : Should be 1. For a description of this property, see
32c66ec88fSEmmanuel Vadot     Documentation/devicetree/bindings/thermal/thermal-sensor.yaml.
33c66ec88fSEmmanuel Vadot    See <dt-bindings/thermal/tegra124-soctherm.h> for a list of valid values
34c66ec88fSEmmanuel Vadot    when referring to thermal sensors.
35c66ec88fSEmmanuel Vadot- throttle-cfgs: A sub-node which is a container of configuration for each
36c66ec88fSEmmanuel Vadot    hardware throttle events. These events can be set as cooling devices.
37c66ec88fSEmmanuel Vadot  * throttle events: Sub-nodes must be named as "light" or "heavy".
38c66ec88fSEmmanuel Vadot      Properties:
39c66ec88fSEmmanuel Vadot      - nvidia,priority: Each throttles has its own throttle settings, so the
40c66ec88fSEmmanuel Vadot        SW need to set priorities for various throttle, the HW arbiter can select
41c66ec88fSEmmanuel Vadot        the final throttle settings.
42c66ec88fSEmmanuel Vadot        Bigger value indicates higher priority, In general, higher priority
43c66ec88fSEmmanuel Vadot        translates to lower target frequency. SW needs to ensure that critical
44c66ec88fSEmmanuel Vadot        thermal alarms are given higher priority, and ensure that there is
45c66ec88fSEmmanuel Vadot        no race if priority of two vectors is set to the same value.
46c66ec88fSEmmanuel Vadot        The range of this value is 1~100.
47c66ec88fSEmmanuel Vadot      - nvidia,cpu-throt-percent: This property is for Tegra124 and Tegra210.
48c66ec88fSEmmanuel Vadot        It is the throttling depth of pulse skippers, it's the percentage
49c66ec88fSEmmanuel Vadot        throttling.
50c66ec88fSEmmanuel Vadot      - nvidia,cpu-throt-level: This property is only for Tegra132, it is the
51c66ec88fSEmmanuel Vadot        level of pulse skippers, which used to throttle clock frequencies. It
52c66ec88fSEmmanuel Vadot        indicates cpu clock throttling depth, and the depth can be programmed.
53c66ec88fSEmmanuel Vadot        Must set as following values:
54c66ec88fSEmmanuel Vadot        TEGRA_SOCTHERM_THROT_LEVEL_LOW, TEGRA_SOCTHERM_THROT_LEVEL_MED
55c66ec88fSEmmanuel Vadot        TEGRA_SOCTHERM_THROT_LEVEL_HIGH, TEGRA_SOCTHERM_THROT_LEVEL_NONE
56c66ec88fSEmmanuel Vadot      - nvidia,gpu-throt-level: This property is for Tegra124 and Tegra210.
57c66ec88fSEmmanuel Vadot        It is the level of pulse skippers, which used to throttle clock
58c66ec88fSEmmanuel Vadot        frequencies. It indicates gpu clock throttling depth and can be
59c66ec88fSEmmanuel Vadot        programmed to any of the following values which represent a throttling
60c66ec88fSEmmanuel Vadot        percentage:
61c66ec88fSEmmanuel Vadot        TEGRA_SOCTHERM_THROT_LEVEL_NONE (0%)
62c66ec88fSEmmanuel Vadot        TEGRA_SOCTHERM_THROT_LEVEL_LOW (50%),
63c66ec88fSEmmanuel Vadot        TEGRA_SOCTHERM_THROT_LEVEL_MED (75%),
64c66ec88fSEmmanuel Vadot        TEGRA_SOCTHERM_THROT_LEVEL_HIGH (85%).
65c66ec88fSEmmanuel Vadot      - #cooling-cells: Should be 1. This cooling device only support on/off state.
66c66ec88fSEmmanuel Vadot        For a description of this property see:
67c66ec88fSEmmanuel Vadot	Documentation/devicetree/bindings/thermal/thermal-cooling-devices.yaml
68c66ec88fSEmmanuel Vadot
69c66ec88fSEmmanuel Vadot      Optional properties: The following properties are T210 specific and
70c66ec88fSEmmanuel Vadot      valid only for OCx throttle events.
71c66ec88fSEmmanuel Vadot      - nvidia,count-threshold: Specifies the number of OC events that are
72c66ec88fSEmmanuel Vadot        required for triggering an interrupt. Interrupts are not triggered if
73c66ec88fSEmmanuel Vadot        the property is missing. A value of 0 will interrupt on every OC alarm.
74c66ec88fSEmmanuel Vadot      - nvidia,polarity-active-low: Configures the polarity of the OC alaram
75c66ec88fSEmmanuel Vadot        signal. If present, this means assert low, otherwise assert high.
76c66ec88fSEmmanuel Vadot      - nvidia,alarm-filter: Number of clocks to filter event. When the filter
77c66ec88fSEmmanuel Vadot        expires (which means the OC event has not occurred for a long time),
78c66ec88fSEmmanuel Vadot        the counter is cleared and filter is rearmed. Default value is 0.
79c66ec88fSEmmanuel Vadot      - nvidia,throttle-period-us: Specifies the number of uSec for which
80c66ec88fSEmmanuel Vadot        throttling is engaged after the OC event is deasserted. Default value
81c66ec88fSEmmanuel Vadot        is 0.
82c66ec88fSEmmanuel Vadot
83c66ec88fSEmmanuel VadotOptional properties:
84c66ec88fSEmmanuel Vadot- nvidia,thermtrips : When present, this property specifies the temperature at
85c66ec88fSEmmanuel Vadot  which the soctherm hardware will assert the thermal trigger signal to the
86c66ec88fSEmmanuel Vadot  Power Management IC, which can be configured to reset or shutdown the device.
87c66ec88fSEmmanuel Vadot  It is an array of pairs where each pair represents a tsensor id followed by a
88c66ec88fSEmmanuel Vadot  temperature in milli Celcius. In the absence of this property the critical
89c66ec88fSEmmanuel Vadot  trip point will be used for thermtrip temperature.
90c66ec88fSEmmanuel Vadot
91c66ec88fSEmmanuel VadotNote:
92c66ec88fSEmmanuel Vadot- the "critical" type trip points will be used to set the temperature at which
93c66ec88fSEmmanuel Vadotthe SOC_THERM hardware will assert a thermal trigger if the "nvidia,thermtrips"
94c66ec88fSEmmanuel Vadotproperty is missing. When the thermtrips property is present, the breach of a
95c66ec88fSEmmanuel Vadotcritical trip point is reported back to the thermal framework to implement
96c66ec88fSEmmanuel Vadotsoftware shutdown.
97c66ec88fSEmmanuel Vadot
98c66ec88fSEmmanuel Vadot- the "hot" type trip points will be set to SOC_THERM hardware as the throttle
99*b97ee269SEmmanuel Vadottemperature. Once the temperature of this thermal zone is higher
100c66ec88fSEmmanuel Vadotthan it, it will trigger the HW throttle event.
101c66ec88fSEmmanuel Vadot
102c66ec88fSEmmanuel VadotExample :
103c66ec88fSEmmanuel Vadot
104c66ec88fSEmmanuel Vadot	soctherm@700e2000 {
105c66ec88fSEmmanuel Vadot		compatible = "nvidia,tegra124-soctherm";
106c66ec88fSEmmanuel Vadot		reg = <0x0 0x700e2000 0x0 0x600  /* SOC_THERM reg_base */
107c66ec88fSEmmanuel Vadot			0x0 0x60006000 0x0 0x400 /* CAR reg_base */
108c66ec88fSEmmanuel Vadot		reg-names = "soctherm-reg", "car-reg";
109c66ec88fSEmmanuel Vadot		interrupts = <GIC_SPI 48 IRQ_TYPE_LEVEL_HIGH>;
110c66ec88fSEmmanuel Vadot		clocks = <&tegra_car TEGRA124_CLK_TSENSOR>,
111c66ec88fSEmmanuel Vadot			<&tegra_car TEGRA124_CLK_SOC_THERM>;
112c66ec88fSEmmanuel Vadot		clock-names = "tsensor", "soctherm";
113c66ec88fSEmmanuel Vadot		resets = <&tegra_car 78>;
114c66ec88fSEmmanuel Vadot		reset-names = "soctherm";
115c66ec88fSEmmanuel Vadot
116c66ec88fSEmmanuel Vadot		#thermal-sensor-cells = <1>;
117c66ec88fSEmmanuel Vadot
118c66ec88fSEmmanuel Vadot		nvidia,thermtrips = <TEGRA124_SOCTHERM_SENSOR_CPU 102500
119c66ec88fSEmmanuel Vadot				     TEGRA124_SOCTHERM_SENSOR_GPU 103000>;
120c66ec88fSEmmanuel Vadot
121c66ec88fSEmmanuel Vadot		throttle-cfgs {
122c66ec88fSEmmanuel Vadot			/*
123c66ec88fSEmmanuel Vadot			 * When the "heavy" cooling device triggered,
124c66ec88fSEmmanuel Vadot			 * the HW will skip cpu clock's pulse in 85% depth,
125c66ec88fSEmmanuel Vadot			 * skip gpu clock's pulse in 85% level
126c66ec88fSEmmanuel Vadot			 */
127c66ec88fSEmmanuel Vadot			throttle_heavy: heavy {
128c66ec88fSEmmanuel Vadot				nvidia,priority = <100>;
129c66ec88fSEmmanuel Vadot				nvidia,cpu-throt-percent = <85>;
130c66ec88fSEmmanuel Vadot				nvidia,gpu-throt-level = <TEGRA_SOCTHERM_THROT_LEVEL_HIGH>;
131c66ec88fSEmmanuel Vadot
132c66ec88fSEmmanuel Vadot				#cooling-cells = <1>;
133c66ec88fSEmmanuel Vadot			};
134c66ec88fSEmmanuel Vadot
135c66ec88fSEmmanuel Vadot			/*
136c66ec88fSEmmanuel Vadot			 * When the "light" cooling device triggered,
137c66ec88fSEmmanuel Vadot			 * the HW will skip cpu clock's pulse in 50% depth,
138c66ec88fSEmmanuel Vadot			 * skip gpu clock's pulse in 50% level
139c66ec88fSEmmanuel Vadot			 */
140c66ec88fSEmmanuel Vadot			throttle_light: light {
141c66ec88fSEmmanuel Vadot				nvidia,priority = <80>;
142c66ec88fSEmmanuel Vadot				nvidia,cpu-throt-percent = <50>;
143c66ec88fSEmmanuel Vadot				nvidia,gpu-throt-level = <TEGRA_SOCTHERM_THROT_LEVEL_LOW>;
144c66ec88fSEmmanuel Vadot
145c66ec88fSEmmanuel Vadot				#cooling-cells = <1>;
146c66ec88fSEmmanuel Vadot			};
147c66ec88fSEmmanuel Vadot
148c66ec88fSEmmanuel Vadot			/*
149c66ec88fSEmmanuel Vadot			 * If these two devices are triggered in same time, the HW throttle
150c66ec88fSEmmanuel Vadot			 * arbiter will select the highest priority as the final throttle
151c66ec88fSEmmanuel Vadot			 * settings to skip cpu pulse.
152c66ec88fSEmmanuel Vadot			 */
153c66ec88fSEmmanuel Vadot
154c66ec88fSEmmanuel Vadot			throttle_oc1: oc1 {
155c66ec88fSEmmanuel Vadot				nvidia,priority = <50>;
156c66ec88fSEmmanuel Vadot				nvidia,polarity-active-low;
157c66ec88fSEmmanuel Vadot				nvidia,count-threshold = <100>;
158c66ec88fSEmmanuel Vadot				nvidia,alarm-filter = <5100000>;
159c66ec88fSEmmanuel Vadot				nvidia,throttle-period-us = <0>;
160c66ec88fSEmmanuel Vadot				nvidia,cpu-throt-percent = <75>;
161c66ec88fSEmmanuel Vadot				nvidia,gpu-throt-level =
162c66ec88fSEmmanuel Vadot						<TEGRA_SOCTHERM_THROT_LEVEL_MED>;
163c66ec88fSEmmanuel Vadot                        };
164c66ec88fSEmmanuel Vadot		};
165c66ec88fSEmmanuel Vadot	};
166c66ec88fSEmmanuel Vadot
167c66ec88fSEmmanuel VadotExample: referring to Tegra132's "reg", "reg-names" and "throttle-cfgs" :
168c66ec88fSEmmanuel Vadot
169c66ec88fSEmmanuel Vadot	soctherm@700e2000 {
170c66ec88fSEmmanuel Vadot		compatible = "nvidia,tegra132-soctherm";
171c66ec88fSEmmanuel Vadot		reg = <0x0 0x700e2000 0x0 0x600  /* SOC_THERM reg_base */
172c66ec88fSEmmanuel Vadot			0x0 0x70040000 0x0 0x200>; /* CCROC reg_base */;
173c66ec88fSEmmanuel Vadot		reg-names = "soctherm-reg", "ccroc-reg";
174c66ec88fSEmmanuel Vadot
175c66ec88fSEmmanuel Vadot		throttle-cfgs {
176c66ec88fSEmmanuel Vadot			/*
177c66ec88fSEmmanuel Vadot			 * When the "heavy" cooling device triggered,
178c66ec88fSEmmanuel Vadot			 * the HW will skip cpu clock's pulse in HIGH level
179c66ec88fSEmmanuel Vadot			 */
180c66ec88fSEmmanuel Vadot			throttle_heavy: heavy {
181c66ec88fSEmmanuel Vadot				nvidia,priority = <100>;
182c66ec88fSEmmanuel Vadot				nvidia,cpu-throt-level = <TEGRA_SOCTHERM_THROT_LEVEL_HIGH>;
183c66ec88fSEmmanuel Vadot
184c66ec88fSEmmanuel Vadot				#cooling-cells = <1>;
185c66ec88fSEmmanuel Vadot			};
186c66ec88fSEmmanuel Vadot
187c66ec88fSEmmanuel Vadot			/*
188c66ec88fSEmmanuel Vadot			 * When the "light" cooling device triggered,
189c66ec88fSEmmanuel Vadot			 * the HW will skip cpu clock's pulse in MED level
190c66ec88fSEmmanuel Vadot			 */
191c66ec88fSEmmanuel Vadot			throttle_light: light {
192c66ec88fSEmmanuel Vadot				nvidia,priority = <80>;
193c66ec88fSEmmanuel Vadot				nvidia,cpu-throt-level = <TEGRA_SOCTHERM_THROT_LEVEL_MED>;
194c66ec88fSEmmanuel Vadot
195c66ec88fSEmmanuel Vadot				#cooling-cells = <1>;
196c66ec88fSEmmanuel Vadot			};
197c66ec88fSEmmanuel Vadot
198c66ec88fSEmmanuel Vadot			/*
199c66ec88fSEmmanuel Vadot			 * If these two devices are triggered in same time, the HW throttle
200c66ec88fSEmmanuel Vadot			 * arbiter will select the highest priority as the final throttle
201c66ec88fSEmmanuel Vadot			 * settings to skip cpu pulse.
202c66ec88fSEmmanuel Vadot			 */
203c66ec88fSEmmanuel Vadot
204c66ec88fSEmmanuel Vadot		};
205c66ec88fSEmmanuel Vadot	};
206c66ec88fSEmmanuel Vadot
207c66ec88fSEmmanuel VadotExample: referring to thermal sensors :
208c66ec88fSEmmanuel Vadot
209c66ec88fSEmmanuel Vadot       thermal-zones {
210c66ec88fSEmmanuel Vadot                cpu {
211c66ec88fSEmmanuel Vadot                        polling-delay-passive = <1000>;
212c66ec88fSEmmanuel Vadot                        polling-delay = <1000>;
213c66ec88fSEmmanuel Vadot
214c66ec88fSEmmanuel Vadot                        thermal-sensors =
215c66ec88fSEmmanuel Vadot                                <&soctherm TEGRA124_SOCTHERM_SENSOR_CPU>;
216c66ec88fSEmmanuel Vadot
217c66ec88fSEmmanuel Vadot			trips {
218c66ec88fSEmmanuel Vadot				cpu_shutdown_trip: shutdown-trip {
219c66ec88fSEmmanuel Vadot					temperature = <102500>;
220c66ec88fSEmmanuel Vadot					hysteresis = <1000>;
221c66ec88fSEmmanuel Vadot					type = "critical";
222c66ec88fSEmmanuel Vadot				};
223c66ec88fSEmmanuel Vadot
224c66ec88fSEmmanuel Vadot				cpu_throttle_trip: throttle-trip {
225c66ec88fSEmmanuel Vadot					temperature = <100000>;
226c66ec88fSEmmanuel Vadot					hysteresis = <1000>;
227c66ec88fSEmmanuel Vadot					type = "hot";
228c66ec88fSEmmanuel Vadot				};
229c66ec88fSEmmanuel Vadot			};
230c66ec88fSEmmanuel Vadot
231c66ec88fSEmmanuel Vadot			cooling-maps {
232c66ec88fSEmmanuel Vadot				map0 {
233c66ec88fSEmmanuel Vadot					trip = <&cpu_throttle_trip>;
234c66ec88fSEmmanuel Vadot					cooling-device = <&throttle_heavy 1 1>;
235c66ec88fSEmmanuel Vadot				};
236c66ec88fSEmmanuel Vadot			};
237c66ec88fSEmmanuel Vadot                };
238c66ec88fSEmmanuel Vadot	};
239