// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
/*
 * Copyright (c) 2021 Rockchip Electronics Co., Ltd.
 *
 */

/dts-v1/;

#include <dt-bindings/usb/pd.h>
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/pwm/pwm.h>
#include <dt-bindings/pinctrl/rockchip.h>
#include <dt-bindings/input/rk-input.h>
#include <dt-bindings/display/drm_mipi_dsi.h>
#include <dt-bindings/display/rockchip_vop.h>
#include <dt-bindings/sensor-dev.h>

#include "rk3588s.dtsi"
#include "rk3588-rk806-single.dtsi"
#include "rk3588-linux.dtsi"

#define M2_SATA_OR_PCIE 1

/ {
	model = "ROC-RK3588S-PC V12(Linux)";
	compatible = "firefly,roc-rk3588s-pc", "firefly,station-m3", "rockchip,rk3588";

	adc_keys: adc-keys {
		status = "okay";
		compatible = "adc-keys";
		io-channels = <&saradc 1>;
		io-channel-names = "buttons";
		keyup-threshold-microvolt = <1800000>;
		poll-interval = <100>;

		recovery-key{
			label = "F12";
			linux,code = <KEY_F12>;
			press-threshold-microvolt = <17000>;
		};
	};

	dp0_sound: dp0-sound {
		status = "okay";
		compatible = "rockchip,hdmi";
		rockchip,card-name= "rockchip-dp0";
		rockchip,mclk-fs = <512>;
		rockchip,cpu = <&spdif_tx2>;
		rockchip,codec = <&dp0 1>;
		rockchip,jack-det;
	};

	es8388_sound: es8388-sound {
		status = "okay";
		compatible = "rockchip,multicodecs-card";
		rockchip,card-name = "rockchip-es8388";
		hp-det-gpio = <&gpio1 RK_PA6 GPIO_ACTIVE_LOW>;
		hp-con-gpio = <&gpio1 RK_PA4 GPIO_ACTIVE_HIGH>;
		hw-ver =<0x1>;
		io-channels = <&saradc 5>;
		io-channel-names = "hw-ver";
		linein-type = <1>;
		rockchip,format = "i2s";
		rockchip,mclk-fs = <384>;
		rockchip,cpu = <&i2s0_8ch>;
		rockchip,codec = <&es8388>;
		rockchip,audio-routing =
			"Headphone", "LOUT2",
			"Headphone", "ROUT2",
			"Speaker", "LOUT1",
			"Speaker", "ROUT1",
			"Headphone", "Headphone Power",
			"Headphone", "Headphone Power",
			"LINPUT1", "Main Mic",
			"RINPUT1", "Main Mic",
			"LINPUT2", "Headset Mic",
			"RINPUT2", "Headset Mic";
		pinctrl-names = "default";
		pinctrl-0 = <&hp_det>;
	};

	fan: pwm-fan {
		compatible = "pwm-fan";
		#cooling-cells = <2>;
		fan-supply = <&vcc12v_dcin>;
		cooling-levels = <60 100 140 160 185 220 255>;
		pwms = <&pwm11 0 50000 1>;
	};

	firefly_leds: leds {
		status = "okay";
		compatible = "gpio-leds";
		pinctrl-names = "default";
		pinctrl-0 =<&leds_gpio>;
		power_led: power {
			label = ":power"; //green led
			linux,default-trigger = "ir-power-click";
			default-state = "on";
			gpios = <&gpio1 RK_PD5 GPIO_ACTIVE_HIGH>;//blue led
		};

		user_led: user {
			label = ":user"; //yellow led
			linux,default-trigger = "ir-user-click";
			default-state = "off";
			gpios = <&gpio3 RK_PB2 GPIO_ACTIVE_HIGH>;//red led
		};

		user1_led: user1 {
			label = ":user1"; 
			default-state = "off";
			gpios = <&gpio3 RK_PC0 GPIO_ACTIVE_HIGH>;//green led
		};
	};

	hdmi0_sound: hdmi0-sound {
		status = "disabled";
		compatible = "rockchip,hdmi";
		rockchip,mclk-fs = <128>;
		rockchip,card-name = "rockchip-hdmi0";
		rockchip,cpu = <&i2s5_8ch>;
		rockchip,codec = <&hdmi0>;
		rockchip,jack-det;
	};

	lcd_rst: lcd_rst {
		status = "disabled";
		compatible = "regulator-fixed";
		regulator-name = "lcd_rst";
		regulator-boot-on;
		regulator-always-on;
		regulator-min-microvolt = <3300000>;
		regulator-max-microvolt = <3300000>;
		enable-active-high;
		gpio = <&gpio1 RK_PA1 GPIO_ACTIVE_HIGH>;
		startup-delay-us = <2000>;
		vin-supply = <&vcc12v_dcin>;
	};

	lcd_en: lcd_en {
		status = "disabled";
		compatible = "regulator-fixed";
		regulator-name = "lcd_en";
		regulator-boot-on;
		regulator-always-on;
		regulator-min-microvolt = <3300000>;
		regulator-max-microvolt = <3300000>;
		enable-active-high;
		gpio = <&gpio1 RK_PB3 GPIO_ACTIVE_HIGH>;
		vin-supply = <&vcc12v_dcin>;
	};

	spdif_tx1_dc: spdif-tx1-dc {
		status = "disabled";
		compatible = "linux,spdif-dit";
		#sound-dai-cells = <0>;
	};

	spdif_tx1_sound: spdif-tx1-sound {
		status = "disabled";
		compatible = "simple-audio-card";
		simple-audio-card,mclk-fs = <128>;
		simple-audio-card,name = "rockchip,spdif-tx1";
		simple-audio-card,cpu {
			sound-dai = <&spdif_tx1>;
		};
		simple-audio-card,codec {
			sound-dai = <&spdif_tx1_dc>;
		};
	};

	test-power {
		status = "okay";
	};

	vcc12v_dcin: vcc12v-dcin {
		compatible = "regulator-fixed";
		regulator-name = "vcc12v_dcin";
		regulator-always-on;
		regulator-boot-on;
		regulator-min-microvolt = <12000000>;
		regulator-max-microvolt = <12000000>;
	};

	vcc3v3_pcie20: vcc3v3-pcie20 {
		compatible = "regulator-fixed";
		regulator-name = "vcc3v3_pcie20";
		regulator-min-microvolt = <3300000>;
		regulator-max-microvolt = <3300000>;
		regulator-always-on;
		enable-active-high;
		gpios = <&gpio1 RK_PD7 GPIO_ACTIVE_HIGH>;
		startup-delay-us = <5000>;
		vin-supply = <&vcc12v_dcin>;
	};

	vcc5v0_host: vcc5v0-host {
		status = "okay";
		compatible = "regulator-fixed";
		regulator-name = "vcc5v0_host";
		regulator-boot-on;
		regulator-always-on;
		reset-delay-us = <200000>;
		startup-delay-us = <1200000>;
		enable-active-high;
		gpio = <&gpio1 RK_PB6 GPIO_ACTIVE_HIGH>;
		pinctrl-names = "default";
		pinctrl-0 = <&vcc5v0_host_en>;
		vin-supply = <&vcc5v0_usb>;
	};

	vcc5v0_sys: vcc5v0-sys {
		compatible = "regulator-fixed";
		regulator-name = "vcc5v0_sys";
		regulator-always-on;
		regulator-boot-on;
		regulator-min-microvolt = <5000000>;
		regulator-max-microvolt = <5000000>;
		vin-supply = <&vcc12v_dcin>;
	};

	vbus5v0_typec_pwr_en: vbus5v0-typec-pwr-en-regulator {
		status = "okay";
		compatible = "regulator-fixed";
		enable-active-high;
		regulator-name = "vbus5v0_typec_pwr_en";
		regulator-min-microvolt = <5000000>;
		regulator-max-microvolt = <5000000>;
		gpio = <&gpio1 RK_PB1 GPIO_ACTIVE_HIGH>;
		vin-supply = <&vcc5v0_usb>;
		pinctrl-names = "default";
		pinctrl-0 = <&typec5v_pwren>;
	};

	vcc5v0_usbdcin: vcc5v0-usbdcin {
		compatible = "regulator-fixed";
		regulator-name = "vcc5v0_usbdcin";
		regulator-always-on;
		regulator-boot-on;
		regulator-min-microvolt = <5000000>;
		regulator-max-microvolt = <5000000>;
		vin-supply = <&vcc12v_dcin>;
	};

	vcc5v0_usb: vcc5v0-usb {
		compatible = "regulator-fixed";
		regulator-name = "vcc5v0_usb";
		regulator-always-on;
		regulator-boot-on;
		regulator-min-microvolt = <5000000>;
		regulator-max-microvolt = <5000000>;
		vin-supply = <&vcc12v_dcin>;
	};

	vcc_1v1_nldo_s3: vcc-1v1-nldo-s3 {
		compatible = "regulator-fixed";
		regulator-name = "vcc_1v1_nldo_s3";
		regulator-always-on;
		regulator-boot-on;
		regulator-min-microvolt = <1100000>;
		regulator-max-microvolt = <1100000>;
		vin-supply = <&vcc5v0_sys>;
	};

	vcc_3v3_sd_s0: vcc-3v3-sd-s0 {
		compatible = "regulator-fixed";
		regulator-name = "vcc_3v3_sd_s0";
		regulator-min-microvolt = <3300000>;
		regulator-max-microvolt = <3300000>;
		gpios = <&gpio1 RK_PA0 GPIO_ACTIVE_LOW>;
		enable-active-low;
		vin-supply = <&vcc_3v3_s3>;
			regulator-state-mem {
			regulator-off-in-suspend;
		};
	};

	vcc_hub_reset: vcc-hub-reset-regulator {
		status = "okay";
		compatible = "regulator-fixed"; 
		regulator-name = "vcc_hub_reset";
		regulator-boot-on;
		regulator-always-on; 
		enable-active-high;
		gpio = <&gpio1 RK_PB0 GPIO_ACTIVE_HIGH>;
	};

};

&chosen {
	bootargs = "earlycon=uart8250,mmio32,0xfeb50000 console=ttyFIQ0 coherent_pool=1m irqchip.gicv3_pseudo_nmi=0";
};

&av1d {
	status = "okay";
};

&av1d_mmu {
	status = "okay";
};

/* default use sata3.0 , pcie2.0 optional*/
&combphy0_ps {
	status = "okay";
};

/* usb3.0 */
&combphy2_psu {
	status = "okay";
};

&cpu_l0 {
	cpu-supply = <&vdd_cpu_lit_s0>;
	mem-supply = <&vdd_cpu_lit_mem_s0>;
};

&cpu_b0 {
	cpu-supply = <&vdd_cpu_big0_s0>;
	mem-supply = <&vdd_cpu_big0_mem_s0>;
};

&cpu_b2 {
	cpu-supply = <&vdd_cpu_big1_s0>;
	mem-supply = <&vdd_cpu_big1_mem_s0>;
};

&display_subsystem {
       clocks = <&hdptxphy_hdmi_clk0>;
       clock-names = "hdmi0_phy_pll";
};

&dp0 {
	status = "okay";
};

&dp0_in_vp2 {
	status = "okay";
};

&gmac1 {
	status = "okay";
	/* Use rgmii-rxid mode to disable rx delay inside Soc */
	phy-mode = "rgmii-rxid";
	clock_in_out = "output";

 	snps,reset-gpio = <&gpio0 RK_PD3 GPIO_ACTIVE_LOW>;
	snps,reset-active-low;
	/* Reset time is 20ms, 100ms for rtl8211f */
	snps,reset-delays-us = <0 20000 100000>;

	pinctrl-names = "default";
	pinctrl-0 = <&gmac1_miim
			&gmac1_tx_bus2
			&gmac1_rx_bus2
			&gmac1_rgmii_clk
			&gmac1_rgmii_bus>;

	tx_delay = <0x43>;
	//rx_delay = <0x4f>;

	phy-handle = <&rgmii_phy1>;
};

&gpu {
	status = "okay";
	mali-supply = <&vdd_gpu_s0>;
	mem-supply = <&vdd_gpu_mem_s0>;
};

/* hdmi0 */
&hdmi0 {
	status = "okay";
	enable-gpios = <&gpio4 RK_PB2 GPIO_ACTIVE_HIGH>;
};

&hdmi0_in_vp0 {
	status = "okay";
};

&hdmi0_sound {
	status = "okay";
};

&hdptxphy_hdmi0 {
	status = "okay";
};

&hdptxphy_hdmi_clk0 {
       status = "okay";
};

&i2c0 {
	status = "okay";
	pinctrl-0 = <&i2c0m2_xfer>;

	vdd_cpu_big0_s0: vdd_cpu_big0_mem_s0: rk8602@42 {
		compatible = "rockchip,rk8602";
		reg = <0x42>;
		vin-supply = <&vcc5v0_sys>;
		regulator-compatible = "rk860x-reg";
		regulator-name = "vdd_cpu_big0_s0";
		regulator-min-microvolt = <550000>;
		regulator-max-microvolt = <1050000>;
		regulator-ramp-delay = <2300>;
		rockchip,suspend-voltage-selector = <1>;
		regulator-boot-on;
		regulator-always-on;
		regulator-state-mem {
			regulator-off-in-suspend;
		};
	};

	vdd_cpu_big1_s0: vdd_cpu_big1_mem_s0: rk8603@43 {
		compatible = "rockchip,rk8603";
		reg = <0x43>;
		vin-supply = <&vcc5v0_sys>;
		regulator-compatible = "rk860x-reg";
		regulator-name = "vdd_cpu_big1_s0";
		regulator-min-microvolt = <550000>;
		regulator-max-microvolt = <1050000>;
		regulator-ramp-delay = <2300>;
		rockchip,suspend-voltage-selector = <1>;
		regulator-boot-on;
		regulator-always-on;
		regulator-state-mem {
			regulator-off-in-suspend;
		};
	};
};

&i2c2 {
	status = "okay";

	vdd_npu_s0: vdd_npu_mem_s0: rk8602@42 {
		compatible = "rockchip,rk8602";
		reg = <0x42>;
		vin-supply = <&vcc5v0_sys>;
		regulator-compatible = "rk860x-reg";
		regulator-name = "vdd_npu_s0";
		regulator-min-microvolt = <550000>;
		regulator-max-microvolt = <950000>;
		regulator-ramp-delay = <2300>;
		rockchip,suspend-voltage-selector = <1>;
		regulator-boot-on;
		regulator-always-on;
		regulator-state-mem {
			regulator-off-in-suspend;
		};
	};
};

&i2c2 {
	status = "okay";
	clock-frequency = <400000>; // For others Display Port Screen
	pinctrl-names = "default";
	pinctrl-0 = <&i2c2m0_xfer>;

	hym8563: hym8563@51 {
		status = "okay";
		compatible = "haoyu,hym8563";
		reg = <0x51>;
		#clock-cells = <0>;
		clock-frequency = <32768>;
		clock-output-names = "hym8563";
		pinctrl-names = "default";
		pinctrl-0 = <&hym8563_int>;
		interrupt-parent = <&gpio0>;
		interrupts = <RK_PB0 IRQ_TYPE_LEVEL_LOW>;
		wakeup-source;
	};

	usbc0: fusb302@22 {
		status = "okay";
		compatible = "fcs,fusb302";
		reg = <0x22>;
		interrupt-parent = <&gpio0>;
		interrupts = <RK_PC4 IRQ_TYPE_LEVEL_LOW>;
		pinctrl-names = "default";
		pinctrl-0 = <&usbc0_int>;
		vbus-supply = <&vbus5v0_typec_pwr_en>;

		ports {
			#address-cells = <1>;
			#size-cells = <0>;

			port@0 {
				reg = <0>;
				usbc0_role_sw: endpoint@0 {
					remote-endpoint = <&dwc3_0_role_switch>;
				};
			};
		};

		usb_con: connector {
			compatible = "usb-c-connector";
			label = "USB-C";
			data-role = "dual";
			power-role = "dual";
			try-power-role = "sink";
			op-sink-microwatt = <1000000>;
			sink-pdos =
				<PDO_FIXED(5000, 1000, PDO_FIXED_USB_COMM)>;
			source-pdos =
				<PDO_FIXED(5000, 3000, PDO_FIXED_USB_COMM)>;

			altmodes {
				#address-cells = <1>;
				#size-cells = <0>;

				altmode@0 {
					reg = <0>;
					svid = <0xff01>;
					vdo = <0xffffffff>;
				};
			};

			ports {
				#address-cells = <1>;
				#size-cells = <0>;

				port@0 {
					reg = <0>;
					usbc0_orien_sw: endpoint {
						remote-endpoint = <&usbdp_phy0_orientation_switch>;
					};
				};

				port@1 {
					reg = <1>;
					dp_altmode_mux: endpoint {
						remote-endpoint = <&usbdp_phy0_dp_altmode_mux>;
					};
				};
			};
		};
	};
};

&i2c3 {
	status = "okay";
	es8388: es8388@11 {
		status = "okay";
		#sound-dai-cells = <0>;
		compatible = "everest,es8388", "everest,es8323";
		reg = <0x11>;
		clocks = <&mclkout_i2s0>;
		clock-names = "mclk";
		assigned-clocks = <&mclkout_i2s0>;
		assigned-clock-rates = <12288000>;
		pinctrl-names = "default";
		pinctrl-0 = <&i2s0_mclk>;
	};
};

&i2c4 {
	status = "okay";
	pinctrl-names = "default";
	pinctrl-0 = <&i2c4m3_xfer>;
};

&i2c5 {
	status = "disabled";
};

&i2c6 {
	status = "okay";
   	pinctrl-names = "default";
    pinctrl-0 = <&i2c6m3_xfer>;
};

&i2s0_8ch {
	status = "okay";
	pinctrl-0 = <&i2s0_lrck
				&i2s0_sclk
				&i2s0_sdi0
				&i2s0_sdo0>;
};

&i2s5_8ch {
	status = "okay";
};

&soc_thermal {
	sustainable-power = <5000>; /* milliwatts */
	polling-delay = <1000>;
	polling-delay-passive = <2000>;
	trips {
		trip0: trip-point@0 {
			temperature = <55000>;
			hysteresis = <5000>;
			type = "active";
		};
		trip1: trip-point@1 {
			temperature = <60000>;
			hysteresis = <5000>;
			type = "active";
		};
		trip2: trip-point@2 {
			temperature = <65000>;
			hysteresis = <5000>;
			type = "active";
		};
		trip3: trip-point@3 {
			temperature = <70000>;
			hysteresis = <5000>;
			type = "active";
		};
		trip4: trip-point@4 {
			temperature = <75000>;
			hysteresis = <5000>;
			type = "active";
		};
		pcritical: trip-point@5 {
			temperature = <80000>;
			hysteresis = <1000>;
			type = "active";
		};
	};
	cooling-maps {
		map0 {
			trip = <&trip0>;
			cooling-device = <&fan 0 1>;
			contribution = <1024>;
		};
		map1 {
			trip = <&trip1>;
			cooling-device = <&fan 1 2>;
			contribution = <1024>;
		};
		map2 {
			trip = <&trip2>;
			cooling-device = <&fan 2 3>;
			contribution = <1024>;
		};
		map3 {
			trip = <&trip3>;
			cooling-device = <&fan 3 4>;
			contribution = <1024>;
		};
		map4 {
			trip = <&trip4>;
			cooling-device = <&fan 4 5>;
			contribution = <1024>;
		};
		map5 {
			trip = <&pcritical>;
			cooling-device = <&fan 5 6>;
			contribution = <1024>;
		};
	};
};

&iep {
	status = "okay";
};

&iep_mmu {
	status = "okay";
};

&jpegd {
	status = "okay";
};

&jpegd_mmu {
	status = "okay";
};

&jpege_ccu {
	status = "okay";
};

&jpege0 {
	status = "okay";
};

&jpege0_mmu {
	status = "okay";
};

&jpege1 {
	status = "okay";
};

&jpege1_mmu {
	status = "okay";
};

&jpege2 {
	status = "okay";
};

&jpege2_mmu {
	status = "okay";
};

&jpege3 {
	status = "okay";
};

&jpege3_mmu {
	status = "okay";
};

&mdio1 {
	rgmii_phy1: phy@1 {
		compatible = "ethernet-phy-ieee802.3-c22";
		reg = <0x1>;
	};
};

&mpp_srv {
	status = "okay";
};

&pwm11 {
	status = "okay";
	pinctrl-0 = <&pwm11m3_pins>;
};

&rga3_core0 {
	status = "okay";
};

&rga3_0_mmu {
	status = "okay";
};

&rga3_core1 {
	status = "okay";
};

&rga3_1_mmu {
	status = "okay";
};

&rga2 {
	status = "okay";
};

&rknpu {
	status = "okay";
	rknpu-supply = <&vdd_npu_s0>;
	mem-supply = <&vdd_npu_mem_s0>;
};

&rknpu_mmu {
	status = "okay";
};

&rkvdec_ccu {
	status = "okay";
};

&rkvdec0 {
	status = "okay";
};

&rkvdec0_mmu {
	status = "okay";
};

&rkvdec1 {
	status = "okay";
};

&rkvdec1_mmu {
	status = "okay";
};

&rkvenc_ccu {
	status = "okay";
};

&rkvenc0 {
	status = "okay";
};

&rkvenc0_mmu {
	status = "okay";
};

&rkvenc1 {
	status = "okay";
};

&rkvenc1_mmu {
	status = "okay";
};

&rockchip_suspend {
	status = "okay";
	rockchip,sleep-debug-en = <0>;
	rockchip,sleep-mode-config = <
		(0
		| RKPM_SLP_ARMOFF_DDRPD
		)
	>;
	rockchip,wakeup-config = <
		(0
		| RKPM_GPIO_WKUP_EN
		| RKPM_USB_WKUP_EN
		)
	>;

};

&route_hdmi0{
	status = "okay";
};

&saradc {
	status = "okay";
	vref-supply = <&vcc_1v8_s0>;
};

&sdhci {
	status = "okay";
	bus-width = <8>;
	no-sdio;
	no-sd;
	non-removable;
	max-frequency = <200000000>;
	mmc-hs400-1_8v;
	mmc-hs400-enhanced-strobe;
};

&sdmmc {
	status = "okay";
	max-frequency = <150000000>;
	no-sdio;
	no-mmc;
	bus-width = <4>;
	cap-mmc-highspeed;
	cap-sd-highspeed;
	disable-wp;
	sd-uhs-sdr104;
	vmmc-supply = <&vcc_3v3_sd_s0>;
	vqmmc-supply = <&vccio_sd_s0>;
};

&spdif_tx2{
	status = "okay";
};

/* spi1 */
&spi1 {
	status = "okay";
	pinctrl-names = "default";
	pinctrl-0 = <&spi1m2_cs0 &spi1m2_pins>;
	num-cs = <1>;
};

/* PMIC spi2 */
&spi2 {
	pinctrl-names = "default";
	pinctrl-0 = <&spi2m2_cs0 &spi2m2_pins>;
	num-cs = <1>;
};

&tsadc {
	status = "okay";
};

//usb
&usbdp_phy0 {
	status = "okay";
	orientation-switch;
	svid = <0xff01>;
	sbu1-dc-gpios = <&gpio4 RK_PB5 GPIO_ACTIVE_HIGH>;
	sbu2-dc-gpios = <&gpio4 RK_PA7 GPIO_ACTIVE_HIGH>;

	port {
		#address-cells = <1>;
		#size-cells = <0>;
		usbdp_phy0_orientation_switch: endpoint@0 {
			reg = <0>;
			remote-endpoint = <&usbc0_orien_sw>;
		};

		usbdp_phy0_dp_altmode_mux: endpoint@1 {
			reg = <1>;
			remote-endpoint = <&dp_altmode_mux>;
		};
	};
};

&usbdrd_dwc3_0 {
	status = "okay";
	dr_mode = "otg";
	usb-role-switch;
	port {
		#address-cells = <1>;
		#size-cells = <0>;
		dwc3_0_role_switch: endpoint@0 {
			reg = <0>;
			remote-endpoint = <&usbc0_role_sw>;
		};
	};
};

&u2phy0 {
	status = "okay";
};

&u2phy2 {
	status = "okay";
};

&u2phy3 {
	status = "okay";
};

&u2phy0_otg {
	status = "okay";
	rockchip,typec-vbus-det; 
};

&u2phy2_host {
	status = "okay";
	phy-supply = <&vcc5v0_host>; 
};

&u2phy3_host {
	status = "okay";
	phy-supply = <&vcc5v0_host>; 
};

/* uart7 */
&uart7{
	status = "okay";
	pinctrl-0 = <&uart7m2_xfer>;
};

&usb_host0_ehci {
	status = "okay";
};

&usb_host0_ohci {
	status = "okay";
};

&usb_host1_ehci {
	status = "okay";
};

&usb_host1_ohci {
	status = "okay";
};

&usbdp_phy0_dp {
	status = "okay";
};

&usbdp_phy0_u3 {
	status = "okay";
};

&usbdrd3_0 {
	status = "okay";
};

&usbhost3_0 {
	status = "okay";
};

&usbhost_dwc3_0 {
	status = "okay";
	dr_mode = "host";
};

&vdpu {
	status = "okay";
};

&vdpu_mmu {
	status = "okay";
};

&vop {
	status = "okay";
};

&vop_mmu {
	status = "okay";
};

/* vp0 & vp1 splice for 8K output */
&vp0 {
	rockchip,plane-mask = <(1 << ROCKCHIP_VOP2_CLUSTER0 | 1 << ROCKCHIP_VOP2_ESMART0)>;
	rockchip,primary-plane = <ROCKCHIP_VOP2_ESMART0>;
	assigned-clocks = <&cru ACLK_VOP>;
	assigned-clock-rates = <800000000>;
};

&vp1 {
	rockchip,plane-mask = <(1 << ROCKCHIP_VOP2_CLUSTER1 | 1 << ROCKCHIP_VOP2_ESMART1)>;
	rockchip,primary-plane = <ROCKCHIP_VOP2_ESMART1>;
};

&vp2 {
	rockchip,plane-mask = <(1 << ROCKCHIP_VOP2_CLUSTER2 | 1 << ROCKCHIP_VOP2_ESMART2)>;
	rockchip,primary-plane = <ROCKCHIP_VOP2_ESMART2>;
};

&vp3 {
	rockchip,plane-mask = <(1 << ROCKCHIP_VOP2_CLUSTER3 | 1 << ROCKCHIP_VOP2_ESMART3)>;
	rockchip,primary-plane = <ROCKCHIP_VOP2_ESMART3>;
};

#if M2_SATA_OR_PCIE
&sata0 {
	status = "okay";
    pinctrl-names = "default";
    pinctrl-0 = <&sata_reset>;
};
#else
&pcie2x1l2 {
	status = "okay";
	reset-gpios = <&gpio3 RK_PD1 GPIO_ACTIVE_HIGH>;
	vpcie3v3-supply = <&vcc3v3_pcie20>;
};
#endif

&pinctrl {
	leds {
		leds_gpio: leds-gpio {
			rockchip,pins =
				/* led_user */
				<3 RK_PB2 RK_FUNC_GPIO &pcfg_pull_none>,
				/* led_power */
				<1 RK_PD5 RK_FUNC_GPIO &pcfg_pull_none>,
				/* led_user1 */
				<3 RK_PC0 RK_FUNC_GPIO &pcfg_pull_none>;
		};
	};

	headphone {
		hp_det: hp-det {
			rockchip,pins = <1 RK_PA6 RK_FUNC_GPIO &pcfg_pull_none>;
		};
	};

	hym8563 {
		hym8563_int: hym8563-int {
			rockchip,pins = <0 RK_PB0 RK_FUNC_GPIO &pcfg_pull_up>;
		};
	};

	usb {
		vcc5v0_host_en: vcc5v0-host-en {
			rockchip,pins = <1 RK_PB6 RK_FUNC_GPIO &pcfg_pull_none>;
		};
	};

	usb-typec {
		usbc0_int: usbc0-int {
			rockchip,pins = <0 RK_PC4 RK_FUNC_GPIO &pcfg_pull_up>;
		};

		typec5v_pwren: typec5v-pwren {
			rockchip,pins = <1 RK_PB1 RK_FUNC_GPIO &pcfg_pull_none>;
		};
	};
#if M2_SATA_OR_PCIE
	sata {
		sata_reset:sata-reset{
			rockchip,pins = <3 RK_PD1 RK_FUNC_GPIO &pcfg_pull_up>;
		};
	};
#endif
};

// for fan when deep sleep
&vdd_log_s0{
       regulator-state-mem {
               regulator-on-in-suspend;
               regulator-suspend-microvolt = <750000>;
       };
};

&avcc_1v8_s0{
       regulator-state-mem {
               regulator-on-in-suspend;
			   regulator-suspend-microvolt = <1800000>;
       };
};

&vcc_1v8_s0{
       regulator-state-mem {
               regulator-on-in-suspend;
               regulator-suspend-microvolt = <1800000>;
       };
};

// for usb wakeup when deep sleep
&avdd_0v75_s0{
		regulator-min-microvolt = <750000>;
		regulator-max-microvolt = <750000>;
		regulator-state-mem {
			regulator-on-in-suspend;
			regulator-suspend-microvolt = <750000>;
		};
};

&vcc_3v3_s0{
		regulator-state-mem {
			regulator-on-in-suspend;
			regulator-suspend-microvolt = <3300000>;
		};
};
