1// SPDX-License-Identifier: BSD-3-Clause
2/*
3 * Copyright (C) 2022 Luca Weiss <luca.weiss@fairphone.com>
4 */
5
6#include <dt-bindings/iio/qcom,spmi-vadc.h>
7#include <dt-bindings/interrupt-controller/irq.h>
8#include <dt-bindings/spmi/spmi.h>
9
10/ {
11	thermal-zones {
12		pm7250b-thermal {
13			polling-delay-passive = <100>;
14			polling-delay = <0>;
15
16			thermal-sensors = <&pm7250b_temp>;
17
18			trips {
19				trip0 {
20					temperature = <95000>;
21					hysteresis = <0>;
22					type = "passive";
23				};
24
25				trip1 {
26					temperature = <115000>;
27					hysteresis = <0>;
28					type = "hot";
29				};
30
31				trip2 {
32					temperature = <145000>;
33					hysteresis = <0>;
34					type = "critical";
35				};
36			};
37		};
38	};
39};
40
41&spmi_bus {
42	pmic@2 {
43		compatible = "qcom,pm7250b", "qcom,spmi-pmic";
44		reg = <0x2 SPMI_USID>;
45		#address-cells = <1>;
46		#size-cells = <0>;
47
48		pm7250b_temp: temp-alarm@2400 {
49			compatible = "qcom,spmi-temp-alarm";
50			reg = <0x2400>;
51			interrupts = <0x2 0x24 0x0 IRQ_TYPE_EDGE_BOTH>;
52			io-channels = <&pm7250b_adc ADC5_DIE_TEMP>;
53			io-channel-names = "thermal";
54			#thermal-sensor-cells = <0>;
55		};
56
57		pm7250b_adc: adc@3100 {
58			compatible = "qcom,spmi-adc5";
59			reg = <0x3100>;
60			#address-cells = <1>;
61			#size-cells = <0>;
62			#io-channel-cells = <1>;
63			interrupts = <0x2 0x31 0x0 IRQ_TYPE_EDGE_RISING>;
64
65			channel@0 {
66				reg = <ADC5_REF_GND>;
67				qcom,pre-scaling = <1 1>;
68				label = "ref_gnd";
69			};
70
71			channel@1 {
72				reg = <ADC5_1P25VREF>;
73				qcom,pre-scaling = <1 1>;
74				label = "vref_1p25";
75			};
76
77			channel@2 {
78				reg = <ADC5_DIE_TEMP>;
79				qcom,pre-scaling = <1 1>;
80				label = "die_temp";
81			};
82
83			channel@7 {
84				reg = <ADC5_USB_IN_I>;
85				qcom,pre-scaling = <1 1>;
86				label = "usb_in_i_uv";
87			};
88
89			channel@8 {
90				reg = <ADC5_USB_IN_V_16>;
91				qcom,pre-scaling = <1 16>;
92				label = "usb_in_v_div_16";
93			};
94
95			channel@9 {
96				reg = <ADC5_CHG_TEMP>;
97				qcom,pre-scaling = <1 1>;
98				label = "chg_temp";
99			};
100
101			channel@e {
102				reg = <ADC5_AMUX_THM2>;
103				qcom,hw-settle-time = <200>;
104				qcom,pre-scaling = <1 1>;
105				label = "smb1390_therm";
106			};
107
108			channel@1e {
109				reg = <ADC5_MID_CHG_DIV6>;
110				qcom,pre-scaling = <1 6>;
111				label = "chg_mid";
112			};
113
114			channel@4b {
115				reg = <ADC5_BAT_ID_100K_PU>;
116				qcom,hw-settle-time = <200>;
117				qcom,pre-scaling = <1 1>;
118				qcom,ratiometric;
119				label = "bat_id";
120			};
121
122			channel@83 {
123				reg = <ADC5_VPH_PWR>;
124				qcom,pre-scaling = <1 3>;
125				label = "vph_pwr";
126			};
127
128			channel@84 {
129				reg = <ADC5_VBAT_SNS>;
130				qcom,pre-scaling = <1 3>;
131				label = "vbat_sns";
132			};
133
134			channel@99 {
135				reg = <ADC5_SBUx>;
136				qcom,pre-scaling = <1 3>;
137				label = "chg_sbux";
138			};
139		};
140
141		pm7250b_adc_tm: adc-tm@3500 {
142			compatible = "qcom,spmi-adc-tm5";
143			reg = <0x3500>;
144			interrupts = <0x2 0x35 0x0 IRQ_TYPE_EDGE_RISING>;
145			#thermal-sensor-cells = <1>;
146			#address-cells = <1>;
147			#size-cells = <0>;
148			status = "disabled";
149		};
150
151		pm7250b_gpios: pinctrl@c000 {
152			compatible = "qcom,pm7250b-gpio", "qcom,spmi-gpio";
153			reg = <0xc000>;
154			gpio-controller;
155			gpio-ranges = <&pm7250b_gpios 0 0 12>;
156			#gpio-cells = <2>;
157			interrupt-controller;
158			#interrupt-cells = <2>;
159		};
160	};
161
162	pmic@3 {
163		compatible = "qcom,pm7250b", "qcom,spmi-pmic";
164		reg = <0x3 SPMI_USID>;
165		#address-cells = <1>;
166		#size-cells = <0>;
167	};
168};
169