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

/dts-v1/;

#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/pinctrl/rockchip.h>
#include <dt-bindings/input/rk-input.h>
#include <dt-bindings/sensor-dev.h>
#include <dt-bindings/display/drm_mipi_dsi.h>
#include "rk3566.dtsi"
#include "rk3568-android.dtsi"

/ {
	model = "Rockchip RK3566 RK817 TABLET LP4X Board";
	compatible = "rockchip,rk3566-rk817-tablet", "rockchip,rk3566";

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

		vol-up-key {
			label = "volume up";
			linux,code = <KEY_VOLUMEUP>;
			press-threshold-microvolt = <1750>;
		};

		vol-down-key {
			label = "volume down";
			linux,code = <KEY_VOLUMEDOWN>;
			press-threshold-microvolt = <297500>;
		};
	};

	backlight: backlight {
		compatible = "pwm-backlight";
		pwms = <&pwm4 0 25000 0>;
		brightness-levels = <
			  0  20  20  21  21  22  22  23
			 23  24  24  25  25  26  26  27
			 27  28  28  29  29  30  30  31
			 31  32  32  33  33  34  34  35
			 35  36  36  37  37  38  38  39
			 40  41  42  43  44  45  46  47
			 48  49  50  50  51  52  53  54
			 55  55  56  57  58  59  60  61
			 62  63  64  64  65  65  66  67
			 68  69  70  71  71  72  73  74
			 75  76  77  78  79  79  80  81
			 82  83  84  85  86  86  87  88
			 89  90  91  92  93  94  94  95
			 96  97  98  99 100 101 101 102
			103 104 105 106 107 107 108 109
			110 111 112 113 114 115 115 116
			117 118 119 120 121 122 123 123
			124 125 126 127 128 129 130 130
			131 132 133 134 135 136 136 137
			138 139 140 141 142 143 143 144
			145 146 147 147 148 149 150 151
			152 153 154 155 156 156 157 158
			159 157 158 159 160 161 162 162
			163 164 165 166 167 168 169 169
			170 171 172 173 174 175 175 176
			177 178 179 180 181 182 182 183
			184 185 186 187 188 189 190 190
			191 192 193 194 195 196 197 197
			198 199 200 201 202 203 204 204
			205 206 207 208 209 209 210 211
			212 213 213 214 214 215 215 216
			216 217 217 218 218 219 219 220
		>;
		default-brightness-level = <200>;
	};

	charge-animation {
		compatible = "rockchip,uboot-charge";
		rockchip,uboot-charge-on = <1>;
		rockchip,android-charge-on = <0>;
		rockchip,uboot-low-power-voltage = <3350>;
		rockchip,screen-on-voltage = <3400>;
		status = "okay";
	};

	flash_rgb13h: flash-rgb13h {
		status = "okay";
		compatible = "led,rgb13h";
		label = "gpio-flash";
		pinctrl-names = "default";
		pinctrl-0 = <&flash_led_gpios>;
		led-max-microamp = <20000>;
		flash-max-microamp = <20000>;
		flash-max-timeout-us = <1000000>;
		enable-gpio = <&gpio4 6 GPIO_ACTIVE_HIGH>;
		rockchip,camera-module-index = <0>;
		rockchip,camera-module-facing = "back";
	};

	hdmi_sound: hdmi-sound {
		compatible = "simple-audio-card";
		simple-audio-card,format = "i2s";
		simple-audio-card,mclk-fs = <128>;
		simple-audio-card,name = "rockchip,hdmi";
		status = "okay";

		simple-audio-card,cpu {
				sound-dai = <&i2s0_8ch>;
		};
		simple-audio-card,codec {
				sound-dai = <&hdmi>;
		};
	};

	vccsys: vccsys {
		compatible = "regulator-fixed";
		regulator-name = "vcc3v8_sys";
		regulator-always-on;
		regulator-boot-on;
		regulator-min-microvolt = <3800000>;
		regulator-max-microvolt = <3800000>;
	};

	vcc_camera: vcc-camera-regulator {
		compatible = "regulator-fixed";
		gpio = <&gpio4 RK_PB1 GPIO_ACTIVE_HIGH>;
		pinctrl-names = "default";
		pinctrl-0 = <&camera_rst>;
		regulator-name = "vcc_camera";
		enable-active-high;
		regulator-always-on;
		regulator-boot-on;
	};

	rk817-sound {
		compatible = "rockchip,multicodecs-card";
		rockchip,card-name = "rockchip-rk817";
		hp-det-gpio = <&gpio4 RK_PC4 GPIO_ACTIVE_LOW>;
		io-channels = <&saradc 2>;
		io-channel-names = "adc-detect";
		keyup-threshold-microvolt = <1800000>;
		poll-interval = <100>;
		rockchip,format = "i2s";
		rockchip,mclk-fs = <256>;
		rockchip,cpu = <&i2s1_8ch>;
		rockchip,codec = <&rk817_codec>;
		pinctrl-names = "default";
		pinctrl-0 = <&hp_det>;
		play-pause-key {
			label = "playpause";
			linux,code = <KEY_PLAYPAUSE>;
			press-threshold-microvolt = <2000>;
		};
	};

	sdio_pwrseq: sdio-pwrseq {
		compatible = "mmc-pwrseq-simple";
		clocks = <&rk817 1>;
		clock-names = "ext_clock";
		pinctrl-names = "default";
		pinctrl-0 = <&wifi_enable_h>;

		/*
		 * On the module itself this is one of these (depending
		 * on the actual card populated):
		 * - SDIO_RESET_L_WL_REG_ON
		 * - PDN (power down when low)
		 */
		post-power-on-delay-ms = <200>;
		reset-gpios = <&gpio0 RK_PC0 GPIO_ACTIVE_LOW>;
	};

	vcc_sd: vcc-sd {
		compatible = "regulator-gpio";
		enable-active-low;
		enable-gpio = <&gpio0 RK_PA5 GPIO_ACTIVE_LOW>;
		regulator-min-microvolt = <3300000>;
		regulator-max-microvolt = <3300000>;
		pinctrl-names = "default";
		pinctrl-0 = <&vcc_sd_h>;
		regulator-name = "vcc_sd";
		states = <3300000 0x0
			3300000 0x1>;
	};

	wireless-wlan {
		compatible = "wlan-platdata";
		rockchip,grf = <&grf>;
		wifi_chip_type = "ap6255";
		pinctrl-names = "default";
		pinctrl-0 = <&wifi_host_wake_irq>;
		WIFI,host_wake_irq = <&gpio0 RK_PC4 GPIO_ACTIVE_HIGH>;
		WIFI,poweren_gpio = <&gpio0 RK_PC0 GPIO_ACTIVE_HIGH>;
		status = "okay";
	};

	wireless-bluetooth {
		compatible = "bluetooth-platdata";
		clocks = <&rk817 1>;
		clock-names = "ext_clock";
		//wifi-bt-power-toggle;
		uart_rts_gpios = <&gpio2 RK_PB5 GPIO_ACTIVE_LOW>;
		pinctrl-names = "default", "rts_gpio";
		pinctrl-0 = <&uart1m0_rtsn>;
		pinctrl-1 = <&uart1_gpios>;
		BT,reset_gpio    = <&gpio0 RK_PC1 GPIO_ACTIVE_HIGH>;
		BT,wake_gpio     = <&gpio0 RK_PB4 GPIO_ACTIVE_HIGH>;
		BT,wake_host_irq = <&gpio0 RK_PB3 GPIO_ACTIVE_HIGH>;
		status = "okay";
	};
};

&bus_npu {
	bus-supply = <&vdd_logic>;
	pvtm-supply = <&vdd_cpu>;
	status = "okay";
};

&cpu0 {
	cpu-supply = <&vdd_cpu>;
};

&csi2_dphy_hw {
	status = "okay";
};

&csi2_dphy0 {
	status = "okay";

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

			mipi_in_ucam0: endpoint@0 {
				reg = <0>;
				remote-endpoint = <&gc2385_out>;
				data-lanes = <1>;
			};
			mipi_in_ucam1: endpoint@1 {
				reg = <1>;
				remote-endpoint = <&ov8858_out>;
				data-lanes = <1 2 3 4>;
			};
		};
		port@1 {
			reg = <1>;
			#address-cells = <1>;
			#size-cells = <0>;

			csidphy0_out: endpoint@0 {
				reg = <0>;
				remote-endpoint = <&isp0_in>;
			};
		};
	};
};

&dfi {
	status = "okay";
};

&dmc {
	center-supply = <&vdd_logic>;
	status = "okay";
};

&dsi0 {
	status = "okay";
	rockchip,lane-rate = <1000>;
	panel@0 {
		compatible = "aoly,sl008pa21y1285-b00", "simple-panel-dsi";
		reg = <0>;

		backlight = <&backlight>;
		//power-supply=<&vcc_3v3>;
		enable-gpios = <&gpio0 RK_PC7 GPIO_ACTIVE_HIGH>;
		reset-gpios = <&gpio0 RK_PC2 GPIO_ACTIVE_LOW>;

		pinctrl-names = "default";
		pinctrl-0 = <&lcd_enable_gpio>, <&lcd_rst_gpio>;

		prepare-delay-ms = <120>;
		reset-delay-ms = <120>;
		init-delay-ms = <120>;
		stbyb-delay-ms = <120>;
		enable-delay-ms = <120>;
		disable-delay-ms = <120>;
		unprepare-delay-ms = <120>;

		width-mm = <229>;
		height-mm = <143>;

		dsi,flags = <(MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST |
			      MIPI_DSI_MODE_LPM | MIPI_DSI_MODE_EOT_PACKET)>;
		dsi,format = <MIPI_DSI_FMT_RGB888>;
		dsi,lanes = <4>;

		panel-init-sequence = [
			23 00 02 B0 01
			23 00 02 C3 0F
			23 00 02 C4 00
			23 00 02 C5 00
			23 00 02 C6 00
			23 00 02 C7 00
			23 00 02 C8 0D
			23 00 02 C9 12
			23 00 02 CA 11
			23 00 02 CD 1D
			23 00 02 CE 1B
			23 00 02 CF 0B
			23 00 02 D0 09
			23 00 02 D1 07
			23 00 02 D2 05
			23 00 02 D3 01
			23 00 02 D7 10
			23 00 02 D8 00
			23 00 02 D9 00
			23 00 02 DA 00
			23 00 02 DB 00
			23 00 02 DC 0E
			23 00 02 DD 12
			23 00 02 DE 11
			23 00 02 E1 1E
			23 00 02 E2 1C
			23 00 02 E3 0C
			23 00 02 E4 0A
			23 00 02 E5 08
			23 00 02 E6 06
			23 00 02 E7 02
			23 00 02 B0 03
			23 00 02 BE 03
			23 00 02 CC 44
			23 00 02 C8 07
			23 00 02 C9 05
			23 00 02 CA 42
			23 00 02 CD 3E
			23 00 02 CF 60
			23 00 02 D2 04
			23 00 02 D3 04
			23 00 02 D4 01
			23 00 02 D5 00
			23 00 02 D6 03
			23 00 02 D7 04
			23 00 02 D9 01
			23 00 02 DB 01
			23 00 02 E4 F0
			23 00 02 E5 0A
			23 00 02 B0 00
			23 00 02 BA 8F// NEW ADD
			23 00 02 BD 63
			23 00 02 C2 08
			23 00 02 C4 10
			23 00 02 B0 02
			23 00 02 C0 00
			23 00 02 C1 0A
			23 00 02 C2 20
			23 00 02 C3 24
			23 00 02 C4 23
			23 00 02 C5 29
			23 00 02 C6 23
			23 00 02 C7 1C
			23 00 02 C8 19
			23 00 02 C9 17
			23 00 02 CA 17
			23 00 02 CB 18
			23 00 02 CC 1A
			23 00 02 CD 1E
			23 00 02 CE 20
			23 00 02 CF 23
			23 00 02 D0 07
			23 00 02 D1 00
			23 00 02 D2 00
			23 00 02 D3 0A
			23 00 02 D4 13
			23 00 02 D5 1C
			23 00 02 D6 1A
			23 00 02 D7 13
			23 00 02 D8 17
			23 00 02 D9 1C
			23 00 02 DA 19
			23 00 02 DB 17
			23 00 02 DC 17
			23 00 02 DD 18
			23 00 02 DE 1A
			23 00 02 DF 1E
			23 00 02 E0 20
			23 00 02 E1 23
			23 00 02 E2 07

			05 78 01 11
			05 32 01 29
		];

		panel-exit-sequence = [
			05 dc 01 28
			05 78 01 10
		];

		display-timings {
			native-mode = <&timing0>;

			timing0: timing0 {
				clock-frequency = <160000000>;
				hactive = <1200>;
				vactive = <1920>;

				hsync-len = <1>;//19
				hback-porch = <60>;//40
				hfront-porch = <80>;//123

				vsync-len = <1>;
				vback-porch = <25>;
				vfront-porch = <35>;

				hsync-active = <0>;
				vsync-active = <0>;
				de-active = <0>;
				pixelclk-active = <1>;
			};
		};

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

			port@0 {
				reg = <0>;
				panel_in_dsi: endpoint {
					remote-endpoint = <&dsi_out_panel>;
				};
			};
		};
	};

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

		port@1 {
			reg = <1>;
			dsi_out_panel: endpoint {
				remote-endpoint = <&panel_in_dsi>;
			};
		};
	};

};

&dsi0_in_vp0 {
	status = "disabled";
};

&dsi0_in_vp1 {
	status = "okay";
};

&gpu {
	mali-supply = <&vdd_gpu>;
	status = "okay";
};

&hdmi {
	status = "okay";
};

&hdmi_in_vp0 {
	status = "okay";
};

&hdmi_in_vp1 {
	status = "disabled";
};

&hdmi_sound {
	status = "okay";
};

&i2c0 {
	status = "okay";

	vdd_cpu: tcs4525@1c {
		compatible = "tcs,tcs4525";
		reg = <0x1c>;
		vin-supply = <&vccsys>;
		regulator-compatible = "fan53555-reg";
		regulator-name = "vdd_cpu";
		regulator-min-microvolt = <712500>;
		regulator-max-microvolt = <1390000>;
		regulator-init-microvolt = <900000>;
		regulator-ramp-delay = <2300>;
		fcs,suspend-voltage-selector = <1>;
		regulator-boot-on;
		regulator-always-on;
		regulator-state-mem {
			regulator-off-in-suspend;
		};
	};

	rk817: pmic@20 {
		compatible = "rockchip,rk817";
		reg = <0x20>;
		interrupt-parent = <&gpio0>;
		interrupts = <3 IRQ_TYPE_LEVEL_LOW>;

		pinctrl-names = "default", "pmic-sleep",
				"pmic-power-off", "pmic-reset";
		pinctrl-0 = <&pmic_int>;
		pinctrl-1 = <&soc_slppin_slp>, <&rk817_slppin_slp>;
		pinctrl-2 = <&soc_slppin_gpio>, <&rk817_slppin_pwrdn>;
		pinctrl-3 = <&soc_slppin_gpio>, <&rk817_slppin_rst>;
		rockchip,system-power-controller;
		wakeup-source;
		#clock-cells = <1>;
		clock-output-names = "rk808-clkout1", "rk808-clkout2";
		//fb-inner-reg-idxs = <2>;
		/* 1: rst regs (default in codes), 0: rst the pmic */
		pmic-reset-func = <0>;
		/* not save the PMIC_POWER_EN register in uboot */
		not-save-power-en = <1>;

		vcc1-supply = <&vccsys>;
		vcc2-supply = <&vccsys>;
		vcc3-supply = <&vccsys>;
		vcc4-supply = <&vccsys>;
		vcc5-supply = <&vccsys>;
		vcc6-supply = <&vccsys>;
		vcc7-supply = <&vccsys>;
		vcc8-supply = <&vccsys>;
		vcc9-supply = <&dcdc_boost>;

		pwrkey {
			status = "okay";
		};

		pinctrl_rk8xx: pinctrl_rk8xx {
			gpio-controller;
			#gpio-cells = <2>;

			rk817_slppin_null: rk817_slppin_null {
				pins = "gpio_slp";
				function = "pin_fun0";
			};

			rk817_slppin_slp: rk817_slppin_slp {
				pins = "gpio_slp";
				function = "pin_fun1";
			};

			rk817_slppin_pwrdn: rk817_slppin_pwrdn {
				pins = "gpio_slp";
				function = "pin_fun2";
			};

			rk817_slppin_rst: rk817_slppin_rst {
				pins = "gpio_slp";
				function = "pin_fun3";
			};
		};

		regulators {
			vdd_logic: DCDC_REG1 {
				regulator-always-on;
				regulator-boot-on;
				regulator-min-microvolt = <500000>;
				regulator-max-microvolt = <1350000>;
				regulator-init-microvolt = <900000>;
				regulator-ramp-delay = <6001>;
				regulator-initial-mode = <0x2>;
				regulator-name = "vdd_logic";
				regulator-state-mem {
					regulator-off-in-suspend;
					regulator-suspend-microvolt = <900000>;
				};
			};

			vdd_gpu: DCDC_REG2 {
				regulator-always-on;
				regulator-boot-on;
				regulator-min-microvolt = <500000>;
				regulator-max-microvolt = <1350000>;
				regulator-init-microvolt = <900000>;
				regulator-ramp-delay = <6001>;
				regulator-initial-mode = <0x2>;
				regulator-name = "vdd_gpu";
				regulator-state-mem {
					regulator-off-in-suspend;
				};
			};

			vcc_ddr: DCDC_REG3 {
				regulator-always-on;
				regulator-boot-on;
				regulator-initial-mode = <0x2>;
				regulator-name = "vcc_ddr";
				regulator-state-mem {
					regulator-on-in-suspend;
				};
			};

			vcc_3v3: DCDC_REG4 {
				regulator-always-on;
				regulator-boot-on;
				regulator-min-microvolt = <3300000>;
				regulator-max-microvolt = <3300000>;
				regulator-initial-mode = <0x2>;
				regulator-name = "vcc_3v3";
				regulator-state-mem {
					regulator-on-in-suspend;
					regulator-suspend-microvolt = <3300000>;
				};
			};

			vcca1v8_pmu: LDO_REG1 {
				regulator-always-on;
				regulator-boot-on;
				regulator-min-microvolt = <1800000>;
				regulator-max-microvolt = <1800000>;
				regulator-name = "vcca1v8_pmu";
				regulator-state-mem {
					regulator-on-in-suspend;
					regulator-suspend-microvolt = <1800000>;
				};
			};

			vdda_0v9: LDO_REG2 {
				regulator-always-on;
				regulator-boot-on;
				regulator-min-microvolt = <900000>;
				regulator-max-microvolt = <900000>;
				regulator-name = "vdda_0v9";
				regulator-state-mem {
					regulator-off-in-suspend;
				};
			};

			vdda0v9_pmu: LDO_REG3 {
				regulator-always-on;
				regulator-boot-on;
				regulator-min-microvolt = <900000>;
				regulator-max-microvolt = <900000>;
				regulator-name = "vdda0v9_pmu";
				regulator-state-mem {
					regulator-on-in-suspend;
					regulator-suspend-microvolt = <900000>;
				};
			};

			vccio_acodec: LDO_REG4 {
				regulator-always-on;
				regulator-boot-on;
				regulator-min-microvolt = <3300000>;
				regulator-max-microvolt = <3300000>;
				regulator-name = "vccio_acodec";
				regulator-state-mem {
					regulator-off-in-suspend;
				};
			};

			vccio_sd: LDO_REG5 {
				regulator-always-on;
				regulator-boot-on;
				regulator-min-microvolt = <1800000>;
				regulator-max-microvolt = <3300000>;
				regulator-name = "vccio_sd";
				regulator-state-mem {
					regulator-off-in-suspend;
				};
			};

			vcc3v3_pmu: LDO_REG6 {
				regulator-always-on;
				regulator-boot-on;
				regulator-min-microvolt = <3300000>;
				regulator-max-microvolt = <3300000>;
				regulator-name = "vcc3v3_pmu";
				regulator-state-mem {
					regulator-on-in-suspend;
					regulator-suspend-microvolt = <3000000>;
				};
			};

			vcc_1v8: LDO_REG7 {
				regulator-always-on;
				regulator-boot-on;
				regulator-min-microvolt = <1800000>;
				regulator-max-microvolt = <1800000>;
				regulator-name = "vcc_1v8";
				regulator-state-mem {
					regulator-off-in-suspend;
				};
			};

			vcc1v8_dvp: LDO_REG8 {
				regulator-always-on;
				regulator-boot-on;
				regulator-min-microvolt = <1800000>;
				regulator-max-microvolt = <1800000>;
				regulator-name = "vcc1v8_dvp";
				regulator-state-mem {
					regulator-off-in-suspend;
				};
			};

			vcc2v8_dvp: LDO_REG9 {
				regulator-always-on;
				regulator-boot-on;
				regulator-min-microvolt = <2800000>;
				regulator-max-microvolt = <2800000>;
				regulator-name = "vcc2v8_dvp";
				regulator-state-mem {
					regulator-off-in-suspend;
				};
			};

			dcdc_boost: BOOST {
				regulator-always-on;
				regulator-boot-on;
				regulator-min-microvolt = <5000000>;
				regulator-max-microvolt = <5000000>;
				regulator-name = "boost";
				regulator-state-mem {
					regulator-off-in-suspend;
				};
			};

			otg_switch: OTG_SWITCH {
				regulator-name = "otg_switch";
				regulator-state-mem {
					regulator-off-in-suspend;
				};
			};
		};

		battery {
			compatible = "rk817,battery";
			ocv_table = <3400 3513 3578 3687 3734 3752 3763
				     3766 3771 3784 3804 3836 3885 3925
				     3962 4005 4063 4114 4169 4227 4303>;
			design_capacity = <5000>;
			design_qmax = <5500>;
			bat_res = <100>;
			sleep_enter_current = <150>;
			sleep_exit_current = <180>;
			sleep_filter_current = <100>;
			power_off_thresd = <3350>;
			zero_algorithm_vol = <3850>;
			max_soc_offset = <60>;
			monitor_sec = <5>;
			sample_res = <10>;
			virtual_power = <0>;
		};

		charger {
			compatible = "rk817,charger";
			min_input_voltage = <4500>;
			max_input_current = <1500>;
			max_chrg_current = <2000>;
			max_chrg_voltage = <4300>;
			chrg_term_mode = <0>;
			chrg_finish_cur = <300>;
			virtual_power = <0>;
			dc_det_adc = <0>;
			extcon = <&usb2phy0>;
		};

		rk817_codec: codec {
			#sound-dai-cells = <0>;
			compatible = "rockchip,rk817-codec";
			clocks = <&cru I2S1_MCLKOUT>;
			clock-names = "mclk";
			assigned-clocks = <&cru I2S1_MCLKOUT>, <&cru I2S1_MCLK_TX_IOE>;
			assigned-clock-rates = <12288000>;
			assigned-clock-parents = <&cru I2S1_MCLKOUT_TX>, <&cru I2S1_MCLKOUT_TX>;
			pinctrl-names = "default";
			pinctrl-0 = <&i2s1m0_mclk>;
			hp-volume = <20>;
			spk-volume = <3>;
			out-l2spk-r2hp;
			spk-ctl-gpios = <&gpio0 RK_PA6 GPIO_ACTIVE_HIGH>;
			status = "okay";
		};
	};
};

&i2c2 {
	status = "okay";
	pinctrl-0 = <&i2c2m1_xfer>;

	dw9714: dw9714@c {
		compatible = "dongwoon,dw9714";
		status = "okay";
		reg = <0x0c>;
		rockchip,camera-module-index = <0>;
		rockchip,vcm-start-current = <10>;
		rockchip,vcm-rated-current = <85>;
		rockchip,vcm-step-mode = <5>;
		rockchip,camera-module-facing = "back";
	};

	gc2385: gc2385@37 {
		compatible = "galaxycore,gc2385";
		status = "okay";
		reg = <0x37>;
		clocks = <&cru CLK_CIF_OUT>;
		clock-names = "xvclk";
		power-domains = <&power RK3568_PD_VI>;
		pinctrl-names = "rockchip,camera_default";
		pinctrl-0 = <&cif_clk>;

		//reset pin control by hardware,used this pin switch to mipi input
		//1->2LANE(LANE 0&1) FRONT camera, 0->4LANE REAR camera
		reset-gpios = <&gpio4 17 GPIO_ACTIVE_LOW>;
		pwdn-gpios = <&gpio4 10 GPIO_ACTIVE_HIGH>;
		rockchip,camera-module-index = <1>;
		rockchip,camera-module-facing = "front";
		rockchip,camera-module-name = "HS5885-BNSM1018-V01";
		rockchip,camera-module-lens-name = "default";
		port {
			gc2385_out: endpoint {
				remote-endpoint = <&mipi_in_ucam0>;
				data-lanes = <1>;
			};
		};
	};

	ov8858: ov8858@36 {
		status = "okay";
		compatible = "ovti,ov8858";
		reg = <0x36>;
		clocks = <&cru CLK_CAM0_OUT>;
		clock-names = "xvclk";
		power-domains = <&power RK3568_PD_VI>;
		pinctrl-names = "rockchip,camera_default", "rockchip,camera_sleep";
		pinctrl-0 = <&cam_clkout0>;
		pinctrl-1 = <&cam_sleep>;
		//reset pin control by hardware,used this pin switch to mipi input
		//1->2LANE(LANE 0&1) FRONT camera, 0->4LANE REAR camera
		reset-gpios = <&gpio4 17 GPIO_ACTIVE_LOW>;
		pwdn-gpios = <&gpio4 11 GPIO_ACTIVE_HIGH>;
		rockchip,camera-module-index = <0>;
		rockchip,camera-module-facing = "back";
		rockchip,camera-module-name = "HS5885-BNSM1018-V01";
		rockchip,camera-module-lens-name = "default";
		flash-leds = <&flash_rgb13h>;
		lens-focus = <&dw9714>;
		port {
			ov8858_out: endpoint {
				remote-endpoint = <&mipi_in_ucam1>;
				data-lanes = <1 2 3 4>;
			};
		};
	};
};

&i2c3 {
	status = "okay";
	pinctrl-names = "default";
	pinctrl-0 = <&i2c3m1_xfer>;
	clock-frequency = <400000>;
	i2c-scl-rising-time-ns = <138>;
	i2c-scl-falling-time-ns = <4>;

	ts@40 {
		compatible = "gslX680-pad";
		reg = <0x40>;
		touch-gpio = <&gpio3 RK_PB0 IRQ_TYPE_LEVEL_HIGH>;
		reset-gpio = <&gpio3 RK_PB1 IRQ_TYPE_LEVEL_HIGH>;
		pinctrl-names = "default";
		pinctrl-0 = <&tp_gpio>;
		screen_max_x = <1200>;
		screen_max_y = <1920>;
		revert_x = <0>;
		revert_y = <1>;
		revert_xy = <0>;
		chip_id = <1>;
		status = "okay";
	};
};

&i2c5 {
	status = "okay";
	clock-frequency = <400000>;
	i2c-scl-rising-time-ns = <144>;
	i2c-scl-falling-time-ns = <4>;

	sensor@18 {
		compatible = "gs_sc7a20";
		reg = <0x18>;
		type = <SENSOR_TYPE_ACCEL>;
		irq_enable = <0>;
		pinctrl-names = "default";
		pinctrl-0 = <&sensor_gpio>;
		irq-gpio = <&gpio3 RK_PA2 IRQ_TYPE_EDGE_RISING>;
		poll_delay_ms = <10>;
		layout = <1>;
	};
};

&i2s0_8ch {
	status = "okay";
};

&i2s1_8ch {
	status = "okay";
	rockchip,clk-trcm = <1>;
	pinctrl-names = "default";
	pinctrl-0 = <&i2s1m0_sclktx
		     &i2s1m0_lrcktx
		     &i2s1m0_sdi0
		     &i2s1m0_sdo0>;
};

&iep {
	status = "okay";
};

&iep_mmu {
	status = "okay";
};

&jpegd {
	status = "okay";
};

&jpegd_mmu {
	status = "okay";
};

&video_phy0 {
	status = "okay";
};

&mpp_srv {
	status = "okay";
};

&nandc0 {
	status = "okay";
};

&pinctrl {
	cam {
		cam_clkout0: cam-clkout0 {
			rockchip,pins =
				/* cam_clkout0 */
				<4 RK_PA7 1 &pcfg_pull_none>;
		};

		cam_sleep: cam-sleep {
			rockchip,pins =
				/* cam_sleep */
				<4 RK_PA7 RK_FUNC_GPIO &pcfg_pull_none>;
		};

		camera_rst: camera-rst {
			rockchip,pins =
				/* front camera reset */
				<4 RK_PB0 RK_FUNC_GPIO &pcfg_pull_none>,
				/* back camra reset */
				<4 RK_PB1 RK_FUNC_GPIO &pcfg_pull_none>;
		};

		flash_led_gpios: flash-led {
			rockchip,pins =
				/* flash led enable */
				<4 RK_PA6 RK_FUNC_GPIO &pcfg_pull_none>;
		};
	};

	tp {
		tp_gpio: tp-gpio {
			rockchip,pins = <3 RK_PB0 RK_FUNC_GPIO &pcfg_pull_up>,
					<3 RK_PB1 RK_FUNC_GPIO &pcfg_pull_none>;
		};
	};

	headphone {
		hp_det: hp-det {
			rockchip,pins = <4 RK_PC4 RK_FUNC_GPIO &pcfg_pull_down>;
		};
	};

	lcd {
		lcd_rst_gpio: lcd-rst-gpio {
			rockchip,pins = <0 RK_PC2 RK_FUNC_GPIO &pcfg_pull_none>;
		};

		lcd_enable_gpio: lcd-enable-gpio {
			rockchip,pins = <0 RK_PC7 RK_FUNC_GPIO &pcfg_pull_none>;
		};

	};

	pmic {
		pmic_int: pmic_int {
			rockchip,pins =
				<0 RK_PA3 RK_FUNC_GPIO &pcfg_pull_up>;
		};

		soc_slppin_gpio: soc_slppin_gpio {
			rockchip,pins =
				<0 RK_PA2 RK_FUNC_GPIO &pcfg_output_low>;
		};

		soc_slppin_slp: soc_slppin_slp {
			rockchip,pins =
				<0 RK_PA2 1 &pcfg_pull_none>;
		};

		soc_slppin_rst: soc_slppin_rst {
			rockchip,pins =
				<0 RK_PA2 2 &pcfg_pull_none>;
		};
	};

	sensor {
		sensor_gpio: sensor-gpio {
			rockchip,pins = <3 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>;
		};
	};

	sdio-pwrseq {
		wifi_enable_h: wifi-enable-h {
			rockchip,pins = <0 RK_PC0 RK_FUNC_GPIO &pcfg_pull_none>;
		};
	};

	vcc_sd {
		vcc_sd_h: vcc-sd-h {
			rockchip,pins = <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_none>;
		};
	};

	wireless-wlan {
		wifi_host_wake_irq: wifi-host-wake-irq {
			rockchip,pins = <0 RK_PC4 RK_FUNC_GPIO &pcfg_pull_down>;
		};
	};

	wireless-bluetooth {
		uart1_gpios: uart1-gpios {
			rockchip,pins = <2 RK_PB5 RK_FUNC_GPIO &pcfg_pull_none>;
		};
	};
};

&pmu_io_domains {
	status = "okay";
	pmuio1-supply = <&vcc3v3_pmu>;
	pmuio2-supply = <&vcc_3v3>;
	vccio1-supply = <&vccio_acodec>;
	vccio3-supply = <&vccio_sd>;
	vccio4-supply = <&vcc_3v3>;
	vccio5-supply = <&vcc_3v3>;
	vccio6-supply = <&vcc_3v3>;
	vccio7-supply = <&vcc_3v3>;
};

&pwm4 {
	status = "okay";
};

&rk_rga {
	status = "okay";
};

&rkisp {
	status = "okay";
};

&rkisp_mmu {
	status = "okay";
};

&rkisp_vir0 {
	status = "okay";

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

		isp0_in: endpoint@0 {
			reg = <0>;
			remote-endpoint = <&csidphy0_out>;
		};
	};
};

&rkvdec {
	status = "okay";
};

&rkvdec_mmu {
	status = "okay";
};

&rkvenc {
	status = "okay";
};

&rkvenc_mmu {
	status = "okay";
};

&route_dsi0 {
	status = "okay";
	connect = <&vp1_out_dsi0>;
};

&route_hdmi {
	status = "okay";
	connect = <&vp0_out_hdmi>;
};

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

&sdhci {
	bus-width = <8>;
	no-sdio;
	no-sd;
	non-removable;
	max-frequency = <200000000>;
	status = "okay";
};

&sdmmc0 {
	max-frequency = <150000000>;
	no-sdio;
	no-mmc;
	bus-width = <4>;
	cap-mmc-highspeed;
	cap-sd-highspeed;
	disable-wp;
	sd-uhs-sdr104;
	vmmc-supply = <&vcc_sd>;
	vqmmc-supply = <&vccio_sd>;
	pinctrl-names = "default";
	pinctrl-0 = <&sdmmc0_bus4 &sdmmc0_clk &sdmmc0_cmd &sdmmc0_det>;
	status = "okay";
};

&sdmmc1 {
	max-frequency = <150000000>;
	no-sd;
	no-mmc;
	bus-width = <4>;
	disable-wp;
	cap-sd-highspeed;
	cap-sdio-irq;
	keep-power-in-suspend;
	mmc-pwrseq = <&sdio_pwrseq>;
	non-removable;
	pinctrl-names = "default";
	pinctrl-0 = <&sdmmc1_bus4 &sdmmc1_cmd &sdmmc1_clk>;
	sd-uhs-sdr104;
	rockchip,default-sample-phase = <90>;
	status = "okay";
};

&tsadc {
	status = "okay";
};

&uart1 {
	status = "okay";
	pinctrl-names = "default";
	pinctrl-0 = <&uart1m0_xfer &uart1m0_ctsn>;
};

&u2phy0_otg {
	status = "okay";
};

&usb2phy0 {
	status = "okay";
};

&usbdrd_dwc3 {
	status = "okay";
};

&usbdrd30 {
	status = "okay";
};

&vdpu {
	status = "okay";
};

&vdpu_mmu {
	status = "okay";
};

&vepu {
	status = "okay";
};

&vepu_mmu {
	status = "okay";
};

&vop {
	status = "okay";
	assigned-clocks = <&cru DCLK_VOP0>, <&cru DCLK_VOP1>;
	assigned-clock-parents = <&pmucru PLL_HPLL>, <&cru PLL_VPLL>;
};

&vop_mmu {
	status = "okay";
};
