18c2ecf20Sopenharmony_ci* Temperature Sensor ADC (TSADC) on rockchip SoCs
28c2ecf20Sopenharmony_ci
38c2ecf20Sopenharmony_ciRequired properties:
48c2ecf20Sopenharmony_ci- compatible : should be "rockchip,<name>-tsadc"
58c2ecf20Sopenharmony_ci   "rockchip,px30-tsadc":   found on PX30 SoCs
68c2ecf20Sopenharmony_ci   "rockchip,rv1108-tsadc": found on RV1108 SoCs
78c2ecf20Sopenharmony_ci   "rockchip,rk3228-tsadc": found on RK3228 SoCs
88c2ecf20Sopenharmony_ci   "rockchip,rk3288-tsadc": found on RK3288 SoCs
98c2ecf20Sopenharmony_ci   "rockchip,rk3328-tsadc": found on RK3328 SoCs
108c2ecf20Sopenharmony_ci   "rockchip,rk3368-tsadc": found on RK3368 SoCs
118c2ecf20Sopenharmony_ci   "rockchip,rk3399-tsadc": found on RK3399 SoCs
128c2ecf20Sopenharmony_ci- reg : physical base address of the controller and length of memory mapped
138c2ecf20Sopenharmony_ci	region.
148c2ecf20Sopenharmony_ci- interrupts : The interrupt number to the cpu. The interrupt specifier format
158c2ecf20Sopenharmony_ci	       depends on the interrupt controller.
168c2ecf20Sopenharmony_ci- clocks : Must contain an entry for each entry in clock-names.
178c2ecf20Sopenharmony_ci- clock-names : Shall be "tsadc" for the converter-clock, and "apb_pclk" for
188c2ecf20Sopenharmony_ci		the peripheral clock.
198c2ecf20Sopenharmony_ci- resets : Must contain an entry for each entry in reset-names.
208c2ecf20Sopenharmony_ci	   See ../reset/reset.txt for details.
218c2ecf20Sopenharmony_ci- reset-names : Must include the name "tsadc-apb".
228c2ecf20Sopenharmony_ci- pinctrl-names : The pin control state names;
238c2ecf20Sopenharmony_ci- pinctrl-0 : The "init" pinctrl state, it will be set before device probe.
248c2ecf20Sopenharmony_ci- pinctrl-1 : The "default" pinctrl state, it will be set after reset the
258c2ecf20Sopenharmony_ci	      TSADC controller.
268c2ecf20Sopenharmony_ci- pinctrl-2 : The "sleep" pinctrl state, it will be in for suspend.
278c2ecf20Sopenharmony_ci- #thermal-sensor-cells : Should be 1. See Documentation/devicetree/bindings/thermal/thermal-sensor.yaml for a description.
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ciOptional properties:
308c2ecf20Sopenharmony_ci- rockchip,hw-tshut-temp : The hardware-controlled shutdown temperature value.
318c2ecf20Sopenharmony_ci- rockchip,hw-tshut-mode : The hardware-controlled shutdown mode 0:CRU 1:GPIO.
328c2ecf20Sopenharmony_ci- rockchip,hw-tshut-polarity : The hardware-controlled active polarity 0:LOW
338c2ecf20Sopenharmony_ci			       1:HIGH.
348c2ecf20Sopenharmony_ci- rockchip,grf : The phandle of the syscon node for the general register file.
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ciExiample:
378c2ecf20Sopenharmony_citsadc: tsadc@ff280000 {
388c2ecf20Sopenharmony_ci	compatible = "rockchip,rk3288-tsadc";
398c2ecf20Sopenharmony_ci	reg = <0xff280000 0x100>;
408c2ecf20Sopenharmony_ci	interrupts = <GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>;
418c2ecf20Sopenharmony_ci	clocks = <&cru SCLK_TSADC>, <&cru PCLK_TSADC>;
428c2ecf20Sopenharmony_ci	clock-names = "tsadc", "apb_pclk";
438c2ecf20Sopenharmony_ci	resets = <&cru SRST_TSADC>;
448c2ecf20Sopenharmony_ci	reset-names = "tsadc-apb";
458c2ecf20Sopenharmony_ci	pinctrl-names = "init", "default", "sleep";
468c2ecf20Sopenharmony_ci	pinctrl-0 = <&otp_gpio>;
478c2ecf20Sopenharmony_ci	pinctrl-1 = <&otp_out>;
488c2ecf20Sopenharmony_ci	pinctrl-2 = <&otp_gpio>;
498c2ecf20Sopenharmony_ci	#thermal-sensor-cells = <1>;
508c2ecf20Sopenharmony_ci	rockchip,hw-tshut-temp = <95000>;
518c2ecf20Sopenharmony_ci	rockchip,hw-tshut-mode = <0>;
528c2ecf20Sopenharmony_ci	rockchip,hw-tshut-polarity = <0>;
538c2ecf20Sopenharmony_ci};
548c2ecf20Sopenharmony_ci
558c2ecf20Sopenharmony_ciExample: referring to thermal sensors:
568c2ecf20Sopenharmony_cithermal-zones {
578c2ecf20Sopenharmony_ci	cpu_thermal: cpu_thermal {
588c2ecf20Sopenharmony_ci		polling-delay-passive = <1000>; /* milliseconds */
598c2ecf20Sopenharmony_ci		polling-delay = <5000>; /* milliseconds */
608c2ecf20Sopenharmony_ci
618c2ecf20Sopenharmony_ci		/* sensor	ID */
628c2ecf20Sopenharmony_ci		thermal-sensors = <&tsadc	1>;
638c2ecf20Sopenharmony_ci
648c2ecf20Sopenharmony_ci		trips {
658c2ecf20Sopenharmony_ci			cpu_alert0: cpu_alert {
668c2ecf20Sopenharmony_ci				temperature = <70000>; /* millicelsius */
678c2ecf20Sopenharmony_ci				hysteresis = <2000>; /* millicelsius */
688c2ecf20Sopenharmony_ci				type = "passive";
698c2ecf20Sopenharmony_ci			};
708c2ecf20Sopenharmony_ci			cpu_crit: cpu_crit {
718c2ecf20Sopenharmony_ci				temperature = <90000>; /* millicelsius */
728c2ecf20Sopenharmony_ci				hysteresis = <2000>; /* millicelsius */
738c2ecf20Sopenharmony_ci				type = "critical";
748c2ecf20Sopenharmony_ci			};
758c2ecf20Sopenharmony_ci		};
768c2ecf20Sopenharmony_ci
778c2ecf20Sopenharmony_ci		cooling-maps {
788c2ecf20Sopenharmony_ci			map0 {
798c2ecf20Sopenharmony_ci				trip = <&cpu_alert0>;
808c2ecf20Sopenharmony_ci				cooling-device =
818c2ecf20Sopenharmony_ci				    <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
828c2ecf20Sopenharmony_ci			};
838c2ecf20Sopenharmony_ci		};
848c2ecf20Sopenharmony_ci	};
858c2ecf20Sopenharmony_ci};
86