1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * Copyright (c) 2015, The Linux Foundation. All rights reserved.
4 * Copyright (c) 2024, Linaro Ltd.
5 */
6
7/dts-v1/;
8
9#include "msm8916-pm8916.dtsi"
10#include <dt-bindings/gpio/gpio.h>
11#include <dt-bindings/input/input.h>
12#include <dt-bindings/leds/common.h>
13#include <dt-bindings/pinctrl/qcom,pmic-gpio.h>
14#include <dt-bindings/pinctrl/qcom,pmic-mpp.h>
15#include <dt-bindings/sound/apq8016-lpass.h>
16
17/ {
18	model = "Schneider Electric HMIBSC Board";
19	compatible = "schneider,apq8016-hmibsc", "qcom,apq8016";
20
21	aliases {
22		i2c1 = &blsp_i2c6;
23		i2c3 = &blsp_i2c4;
24		i2c4 = &blsp_i2c3;
25		mmc0 = &sdhc_1; /* eMMC */
26		mmc1 = &sdhc_2; /* SD card */
27		serial0 = &blsp_uart1;
28		serial1 = &blsp_uart2;
29		spi0 = &blsp_spi5;
30		usid0 = &pm8916_0;
31	};
32
33	chosen {
34		stdout-path = "serial0";
35	};
36
37	hdmi-out {
38		compatible = "hdmi-connector";
39		type = "a";
40
41		port {
42			hdmi_con: endpoint {
43				remote-endpoint = <&adv7533_out>;
44			};
45		};
46	};
47
48	gpio-keys {
49		compatible = "gpio-keys";
50		autorepeat;
51		pinctrl-0 = <&msm_key_volp_n_default>;
52		pinctrl-names = "default";
53
54		button {
55			label = "Volume Up";
56			linux,code = <KEY_VOLUMEUP>;
57			gpios = <&tlmm 107 GPIO_ACTIVE_LOW>;
58		};
59	};
60
61	leds {
62		compatible = "gpio-leds";
63		pinctrl-0 = <&pm8916_mpps_leds>;
64		pinctrl-names = "default";
65
66		led-1 {
67			function = LED_FUNCTION_WLAN;
68			color = <LED_COLOR_ID_YELLOW>;
69			gpios = <&pm8916_mpps 2 GPIO_ACTIVE_HIGH>;
70			linux,default-trigger = "phy0tx";
71			default-state = "off";
72		};
73
74		led-2 {
75			function = LED_FUNCTION_BLUETOOTH;
76			color = <LED_COLOR_ID_BLUE>;
77			gpios = <&pm8916_mpps 3 GPIO_ACTIVE_HIGH>;
78			linux,default-trigger = "bluetooth-power";
79			default-state = "off";
80		};
81	};
82
83	memory@80000000 {
84		reg = <0 0x80000000 0 0x40000000>;
85	};
86
87	reserved-memory {
88		ramoops@bff00000 {
89			compatible = "ramoops";
90			reg = <0x0 0xbff00000 0x0 0x100000>;
91			record-size = <0x20000>;
92			console-size = <0x20000>;
93			ftrace-size = <0x20000>;
94			ecc-size = <16>;
95		};
96	};
97
98	usb-hub {
99		compatible = "smsc,usb3503";
100		reset-gpios = <&pm8916_gpios 1 GPIO_ACTIVE_LOW>;
101		initial-mode = <1>;
102	};
103
104	usb_id: usb-id {
105		compatible = "linux,extcon-usb-gpio";
106		id-gpios = <&tlmm 110 GPIO_ACTIVE_HIGH>;
107		pinctrl-0 = <&usb_id_default>;
108		pinctrl-names = "default";
109	};
110};
111
112&blsp_i2c3 {
113	status = "okay";
114
115	eeprom@50 {
116		compatible = "atmel,24c32";
117		reg = <0x50>;
118	};
119};
120
121&blsp_i2c4 {
122	status = "okay";
123
124	adv_bridge: bridge@39 {
125		compatible = "adi,adv7533";
126		reg = <0x39>;
127		interrupts-extended = <&tlmm 31 IRQ_TYPE_EDGE_FALLING>;
128
129		adi,dsi-lanes = <4>;
130		clocks = <&rpmcc RPM_SMD_BB_CLK2>;
131		clock-names = "cec";
132		pd-gpios = <&tlmm 32 GPIO_ACTIVE_HIGH>;
133
134		avdd-supply = <&pm8916_l6>;
135		a2vdd-supply = <&pm8916_l6>;
136		dvdd-supply = <&pm8916_l6>;
137		pvdd-supply = <&pm8916_l6>;
138		v1p2-supply = <&pm8916_l6>;
139		v3p3-supply = <&pm8916_l17>;
140
141		pinctrl-0 = <&adv7533_int_active &adv7533_switch_active>;
142		pinctrl-1 = <&adv7533_int_suspend &adv7533_switch_suspend>;
143		pinctrl-names = "default","sleep";
144		#sound-dai-cells = <0>;
145
146		ports {
147			#address-cells = <1>;
148			#size-cells = <0>;
149
150			port@0 {
151				reg = <0>;
152				adv7533_in: endpoint {
153					remote-endpoint = <&mdss_dsi0_out>;
154				};
155			};
156
157			port@1 {
158				reg = <1>;
159				adv7533_out: endpoint {
160					remote-endpoint = <&hdmi_con>;
161				};
162			};
163		};
164	};
165};
166
167&blsp_i2c6 {
168	status = "okay";
169
170	rtc@30 {
171		compatible = "sii,s35390a";
172		reg = <0x30>;
173	};
174
175	eeprom@50 {
176		compatible = "atmel,24c256";
177		reg = <0x50>;
178	};
179};
180
181&blsp_spi5 {
182	cs-gpios = <&tlmm 18 GPIO_ACTIVE_LOW>;
183	status = "okay";
184
185	tpm@0 {
186		compatible = "infineon,slb9670", "tcg,tpm_tis-spi";
187		reg = <0>;
188		spi-max-frequency = <500000>;
189	};
190};
191
192&blsp_uart1 {
193	label = "UART0";
194	status = "okay";
195};
196
197&blsp_uart2 {
198	label = "UART1";
199	status = "okay";
200};
201
202&lpass {
203	status = "okay";
204};
205
206&mdss {
207	status = "okay";
208};
209
210&mdss_dsi0_out {
211	data-lanes = <0 1 2 3>;
212	remote-endpoint = <&adv7533_in>;
213};
214
215&pm8916_codec {
216	qcom,mbhc-vthreshold-low = <75 150 237 450 500>;
217	qcom,mbhc-vthreshold-high = <75 150 237 450 500>;
218	status = "okay";
219};
220
221&pm8916_gpios {
222	gpio-line-names =
223		"USB_HUB_RESET_N_PM",
224		"USB_SW_SEL_PM",
225		"NC",
226		"NC";
227
228	usb_hub_reset_pm: usb-hub-reset-pm-state {
229		pins = "gpio1";
230		function = PMIC_GPIO_FUNC_NORMAL;
231		input-disable;
232		output-high;
233	};
234
235	usb_hub_reset_pm_device: usb-hub-reset-pm-device-state {
236		pins = "gpio1";
237		function = PMIC_GPIO_FUNC_NORMAL;
238		input-disable;
239		output-low;
240	};
241
242	usb_sw_sel_pm: usb-sw-sel-pm-state {
243		pins = "gpio2";
244		function = PMIC_GPIO_FUNC_NORMAL;
245		power-source = <PM8916_GPIO_VPH>;
246		input-disable;
247		output-high;
248	};
249
250	usb_sw_sel_pm_device: usb-sw-sel-pm-device-state {
251		pins = "gpio2";
252		function = PMIC_GPIO_FUNC_NORMAL;
253		power-source = <PM8916_GPIO_VPH>;
254		input-disable;
255		output-low;
256	};
257};
258
259&pm8916_mpps {
260	gpio-line-names =
261		"NC",
262		"WLAN_LED_CTRL",
263		"BT_LED_CTRL",
264		"NC";
265
266	pm8916_mpps_leds: pm8916-mpps-state {
267		pins = "mpp2", "mpp3";
268		function = "digital";
269		output-low;
270	};
271};
272
273&pm8916_resin {
274	linux,code = <KEY_POWER>;
275	status = "okay";
276};
277
278&pm8916_rpm_regulators {
279	pm8916_l17: l17 {
280		regulator-min-microvolt = <3300000>;
281		regulator-max-microvolt = <3300000>;
282	};
283};
284
285&sdhc_1 {
286	status = "okay";
287};
288
289&sdhc_2 {
290	pinctrl-0 = <&sdc2_default &sdc2_cd_default>;
291	pinctrl-1 = <&sdc2_sleep &sdc2_cd_default>;
292	pinctrl-names = "default", "sleep";
293	cd-gpios = <&tlmm 38 GPIO_ACTIVE_LOW>;
294	status = "okay";
295};
296
297&sound {
298	pinctrl-0 = <&cdc_pdm_default &sec_mi2s_default>;
299	pinctrl-1 = <&cdc_pdm_sleep &sec_mi2s_sleep>;
300	pinctrl-names = "default", "sleep";
301	model = "HMIBSC";
302	audio-routing =
303		"AMIC2", "MIC BIAS Internal2",
304		"AMIC3", "MIC BIAS External1";
305	status = "okay";
306
307	quaternary-dai-link {
308		link-name = "ADV7533";
309		cpu {
310			sound-dai = <&lpass MI2S_QUATERNARY>;
311		};
312		codec {
313			sound-dai = <&adv_bridge 0>;
314		};
315	};
316
317	primary-dai-link {
318		link-name = "WCD";
319		cpu {
320			sound-dai = <&lpass MI2S_PRIMARY>;
321		};
322		codec {
323			sound-dai = <&lpass_codec 0>, <&pm8916_codec 0>;
324		};
325	};
326
327	tertiary-dai-link {
328		link-name = "WCD-Capture";
329		cpu {
330			sound-dai = <&lpass MI2S_TERTIARY>;
331		};
332		codec {
333			sound-dai = <&lpass_codec 1>, <&pm8916_codec 1>;
334		};
335	};
336};
337
338&tlmm {
339	pinctrl-0 = <&uart1_mux0_rs232_high &uart1_mux1_rs232_low>;
340	pinctrl-names = "default";
341
342	adv7533_int_active: adv533-int-active-state {
343		pins = "gpio31";
344		function = "gpio";
345		drive-strength = <16>;
346		bias-disable;
347	};
348
349	adv7533_int_suspend: adv7533-int-suspend-state {
350		pins = "gpio31";
351		function = "gpio";
352		drive-strength = <2>;
353		bias-disable;
354	};
355
356	adv7533_switch_active: adv7533-switch-active-state {
357		pins = "gpio32";
358		function = "gpio";
359		drive-strength = <16>;
360		bias-disable;
361	};
362
363	adv7533_switch_suspend: adv7533-switch-suspend-state {
364		pins = "gpio32";
365		function = "gpio";
366		drive-strength = <2>;
367		bias-disable;
368	};
369
370	msm_key_volp_n_default: msm-key-volp-n-default-state {
371		pins = "gpio107";
372		function = "gpio";
373		drive-strength = <8>;
374		bias-pull-up;
375	};
376
377	sdc2_cd_default: sdc2-cd-default-state {
378		pins = "gpio38";
379		function = "gpio";
380		drive-strength = <2>;
381		bias-disable;
382	};
383
384	/*
385	 * UART1 being the debug console supports various modes of
386	 * operation (RS-232/485/422) controlled via GPIOs configured
387	 * mux as follows:
388	 *
389	 *   gpio100    gpio99    UART mode
390	 *   0          0         loopback
391	 *   0          1         RS-232
392	 *   1          0         RS-485
393	 *   1          1         RS-422
394	 *
395	 * The default mode configured here is RS-232 mode.
396	 */
397	uart1_mux0_rs232_high: uart1-mux0-rs232-state {
398		bootph-all;
399		pins = "gpio99";
400		function = "gpio";
401		drive-strength = <16>;
402		bias-disable;
403		output-high;
404	};
405
406	uart1_mux1_rs232_low: uart1-mux1-rs232-state {
407		bootph-all;
408		pins = "gpio100";
409		function = "gpio";
410		drive-strength = <16>;
411		bias-disable;
412		output-low;
413	};
414
415	usb_id_default: usb-id-default-state {
416		pins = "gpio110";
417		function = "gpio";
418		drive-strength = <8>;
419		bias-pull-up;
420	};
421};
422
423&usb {
424	extcon = <&usb_id>, <&usb_id>;
425	pinctrl-0 = <&usb_sw_sel_pm &usb_hub_reset_pm>;
426	pinctrl-1 = <&usb_sw_sel_pm_device &usb_hub_reset_pm_device>;
427	pinctrl-names = "default", "device";
428	status = "okay";
429};
430
431&usb_hs_phy {
432	extcon = <&usb_id>;
433};
434
435&wcnss {
436	firmware-name = "qcom/apq8016/wcnss.mbn";
437	status = "okay";
438};
439
440&wcnss_ctrl {
441	firmware-name = "qcom/apq8016/WCNSS_qcom_wlan_nv_sbc.bin";
442};
443
444&wcnss_iris {
445	compatible = "qcom,wcn3620";
446};
447
448&wcnss_mem {
449	status = "okay";
450};
451
452/* PINCTRL - additions to nodes defined in msm8916.dtsi */
453
454/*
455 * 2mA drive strength is not enough when connecting multiple
456 * I2C devices with different pull up resistors.
457 */
458&blsp_i2c4_default {
459	drive-strength = <16>;
460};
461
462&blsp_i2c6_default {
463	drive-strength = <16>;
464};
465
466&blsp_uart1_default {
467	bootph-all;
468};
469
470/* Enable CoreSight */
471&cti0 { status = "okay"; };
472&cti1 { status = "okay"; };
473&cti12 { status = "okay"; };
474&cti13 { status = "okay"; };
475&cti14 { status = "okay"; };
476&cti15 { status = "okay"; };
477&debug0 { status = "okay"; };
478&debug1 { status = "okay"; };
479&debug2 { status = "okay"; };
480&debug3 { status = "okay"; };
481&etf { status = "okay"; };
482&etm0 { status = "okay"; };
483&etm1 { status = "okay"; };
484&etm2 { status = "okay"; };
485&etm3 { status = "okay"; };
486&etr { status = "okay"; };
487&funnel0 { status = "okay"; };
488&funnel1 { status = "okay"; };
489&replicator { status = "okay"; };
490&stm { status = "okay"; };
491&tpiu { status = "okay"; };
492