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

/dts-v1/;
#include <dt-bindings/pwm/pwm.h>
#include <dt-bindings/sensor-dev.h>
#include "rk3399.dtsi"
#include "rk3399-android.dtsi"
#include "rk3399-opp.dtsi"
#include "rk3399-vop-clk-set.dtsi"
#include <dt-bindings/display/mipi_dsi.h>

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

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

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

	backlight: backlight {
		compatible = "pwm-backlight";
		pwms = <&pwm0 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  51  52  53  54  55
			 56  57  58  59  60  61  62  63
			 64  65  66  67  68  69  70  71
			 72  73  74  75  76  77  78  79
			 80  81  82  83  84  85  86  87
			 88  89  90  91  92  93  94  95
			 96  97  98  99 100 101 102 103
			104 105 106 107 108 109 110 111
			112 113 114 115 116 117 118 119
			120 121 122 123 124 125 126 127
			128 129 130 131 132 133 134 135
			136 137 138 139 140 141 142 143
			144 145 146 147 148 149 150 151
			152 153 154 155 156 157 158 159
			160 161 162 163 164 165 166 167
			168 169 170 171 172 173 174 175
			176 177 178 179 180 181 182 183
			184 185 186 187 188 189 190 191
			192 193 194 195 196 197 198 199
			200 201 202 203 204 205 206 207
			208 209 210 211 212 213 214 215
			216 217 218 219 220 221 222 223
			224 225 226 227 228 229 230 231
			232 233 234 235 236 237 238 239
			240 241 242 243 244 245 246 247
			248 249 250 251 252 253 254 255
		>;
		default-brightness-level = <200>;
	};

	es8316-sound {
		compatible = "simple-audio-card";
		simple-audio-card,format = "i2s";
		simple-audio-card,name = "rockchip,es8316-codec";
		simple-audio-card,mclk-fs = <256>;
		simple-audio-card,widgets =
			"Microphone", "Mic Jack",
			"Headphone", "Headphone Jack";
		simple-audio-card,routing =
			"Mic Jack", "MICBIAS1",
			"IN1P", "Mic Jack",
			"Headphone Jack", "HPOL",
			"Headphone Jack", "HPOR";
		simple-audio-card,cpu {
			sound-dai = <&i2s0>;
			system-clock-frequency = <11289600>;
		};
		simple-audio-card,codec {
			sound-dai = <&es8316>;
			system-clock-frequency = <11289600>;
		};
	};

	rk_headset: rk-headset {
		compatible = "rockchip_headset";
		headset_gpio = <&gpio4 RK_PD4 GPIO_ACTIVE_LOW>;
		pinctrl-names = "default";
		pinctrl-0 = <&hp_det>;
		io-channels = <&saradc 2>;
	};

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

	sdio_pwrseq: sdio-pwrseq {
		compatible = "mmc-pwrseq-simple";
		clocks = <&rk808 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)
		 */
		reset-gpios = <&gpio0 RK_PB2 GPIO_ACTIVE_LOW>;
	};

	vcc_sys: vcc-sys {
		compatible = "regulator-fixed";
		regulator-name = "vcc_sys";
		regulator-always-on;
		regulator-boot-on;
		regulator-min-microvolt = <3900000>;
		regulator-max-microvolt = <3900000>;
	};

	vcc3v3_sys: vcc3v3-sys {
		compatible = "regulator-fixed";
		regulator-name = "vcc3v3_sys";
		regulator-always-on;
		regulator-boot-on;
		regulator-min-microvolt = <3300000>;
		regulator-max-microvolt = <3300000>;
	};

	vcc5v0_host: vcc5v0-host-regulator {
		compatible = "regulator-fixed";
		gpio = <&gpio4 RK_PD1 GPIO_ACTIVE_HIGH>;
		pinctrl-names = "default";
		pinctrl-0 = <&host_vbus_drv>;
		regulator-name = "vcc5v0_host";
		regulator-min-microvolt = <5000000>;
		regulator-max-microvolt = <5000000>;
		regulator-always-on;
		enable-active-high;
	};

	vdd_log: vdd-log {
		compatible = "pwm-regulator";
		pwms = <&pwm2 0 25000 1>;
		rockchip,pwm_id= <2>;
		rockchip,pwm_voltage = <900000>;
		regulator-name = "vdd_log";
		regulator-min-microvolt = <750000>;
		regulator-max-microvolt = <1350000>;
		regulator-always-on;
		regulator-boot-on;
	};

	xin32k: xin32k {
		compatible = "fixed-clock";
		clock-frequency = <32768>;
		clock-output-names = "xin32k";
		#clock-cells = <0>;
	};

	wireless-wlan {
		compatible = "wlan-platdata";
		rockchip,grf = <&grf>;
		wifi_chip_type = "ap6255";
		sdio_vref = <1800>;
		WIFI,host_wake_irq = <&gpio0 RK_PA3 GPIO_ACTIVE_HIGH>;
		status = "okay";
	};

	wireless-bluetooth {
		compatible = "bluetooth-platdata";
		clocks = <&rk808 1>;
		clock-names = "ext_clock";
		uart_rts_gpios = <&gpio2 RK_PC3 GPIO_ACTIVE_LOW>;
		pinctrl-names = "default", "rts_gpio";
		pinctrl-0 = <&uart0_rts>, <&bt_reset_gpio>, <&bt_wake_gpio>, <&bt_irq_gpio>;
		pinctrl-1 = <&uart0_gpios>;
		BT,reset_gpio    = <&gpio0 RK_PB1 GPIO_ACTIVE_HIGH>;
		BT,wake_gpio     = <&gpio2 RK_PD2 GPIO_ACTIVE_HIGH>;
		BT,wake_host_irq = <&gpio0 RK_PA4 GPIO_ACTIVE_HIGH>;
		status = "okay";
	};
};

&cdn_dp {
	status = "okay";
	extcon = <&fusb0>;
	phys = <&tcphy0_dp>;
};

&cpu_l0 {
	cpu-supply = <&vdd_cpu_l>;
};

&cpu_l1 {
	cpu-supply = <&vdd_cpu_l>;
};

&cpu_l2 {
	cpu-supply = <&vdd_cpu_l>;
};

&cpu_l3 {
	cpu-supply = <&vdd_cpu_l>;
};

&cpu_b0 {
	cpu-supply = <&vdd_cpu_b>;
};

&cpu_b1 {
	cpu-supply = <&vdd_cpu_b>;
};

&dfi {
	status = "okay";
};

&dmc {
	status = "okay";
	center-supply = <&vdd_center>;
	upthreshold = <20>;
	downdifferential = <10>;
	system-status-freq = <
		/*system status         freq(KHz)*/
		SYS_STATUS_NORMAL       856000
		SYS_STATUS_REBOOT       856000
		SYS_STATUS_SUSPEND      416000
		SYS_STATUS_VIDEO_1080P  416000
		SYS_STATUS_VIDEO_4K     666000
		SYS_STATUS_VIDEO_4K_10B 856000
		SYS_STATUS_PERFORMANCE  856000
		SYS_STATUS_BOOST        856000
		SYS_STATUS_DUALVIEW     856000
		SYS_STATUS_ISP          856000
	>;
	vop-bw-dmc-freq = <
	/* min_bw(MB/s) max_bw(MB/s) freq(KHz) */
		0       762      328000
		763     3012     666000
		3013    99999    856000
	>;

	auto-min-freq = <328000>;
	auto-freq-en = <1>;
};

&dmc_opp_table {
		compatible = "operating-points-v2";

		opp-200000000 {
			opp-hz = /bits/ 64 <200000000>;
			opp-microvolt = <900000>;
			status = "disabled";
		};
		opp-300000000 {
			opp-hz = /bits/ 64 <300000000>;
			opp-microvolt = <900000>;
			status = "disabled";
		};
		opp-328000000 {
			opp-hz = /bits/ 64 <328000000>;
			opp-microvolt = <900000>;
		};
		opp-400000000 {
			opp-hz = /bits/ 64 <400000000>;
			opp-microvolt = <900000>;
			status = "disabled";
		};
		opp-416000000 {
			opp-hz = /bits/ 64 <416000000>;
			opp-microvolt = <900000>;
		};
		opp-528000000 {
			opp-hz = /bits/ 64 <528000000>;
			opp-microvolt = <900000>;
			status = "disabled";
		};
		opp-600000000 {
			opp-hz = /bits/ 64 <600000000>;
			opp-microvolt = <900000>;
			status = "disabled";
		};
		opp-666000000 {
			opp-hz = /bits/ 64 <666000000>;
			opp-microvolt = <900000>;
		};
		opp-800000000 {
			opp-hz = /bits/ 64 <800000000>;
			opp-microvolt = <900000>;
			status = "disabled";
		};
		opp-856000000 {
			opp-hz = /bits/ 64 <856000000>;
			opp-microvolt = <900000>;
		};
		opp-928000000 {
			opp-hz = /bits/ 64 <928000000>;
			opp-microvolt = <900000>;
			status = "disabled";
		};
};
&dp_in_vopb {
	status = "disabled";
};

&dsi {
	status = "okay";
	rockchip,lane-rate = <1000>;
	dsi_panel: panel@0 {
		status = "okay";
		compatible = "simple-panel-dsi";
		reg = <0>;
		backlight = <&backlight>;
		reset-gpios = <&gpio3 RK_PA4 GPIO_ACTIVE_LOW>;
		pinctrl-names = "default";
		pinctrl-0 = <&lcd_rst_gpio>;
		reset-delay-ms = <60>;
		enable-delay-ms = <60>;
		prepare-delay-ms = <60>;
		unprepare-delay-ms = <60>;
		disable-delay-ms = <60>;
		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 = [
			15 05 02 8F A5
			15 14 02 01 00
			15 05 02 8F A5
			15 00 02 83 AA
			15 00 02 84 11
			15 00 02 A9 4B
			15 00 02 83 00
			15 00 02 84 00
			15 00 02 8F 00
		];

		disp_timings: display-timings {
			native-mode = <&timing0>;
			timing0: timing0 {
				clock-frequency = <150000000>;
				hactive = <1200>;
				hfront-porch = <80>;
				hback-porch = <60>;
				hsync-len = <1>;
				vactive = <1920>;
				vfront-porch = <35>;
				vback-porch = <25>;
				vsync-len = <1>;
				hsync-active = <0>;
				vsync-active = <0>;
				de-active = <0>;
				pixelclk-active = <0>;
			};
		};

		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>;
			};
		};
	};
};

&dsi_in_vopl {
	status = "disabled";
};

&emmc_phy {
	status = "okay";
};

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

&hdmi {
	status = "okay";
};

&hdmi_dp_sound {
	status = "okay";
};

&hdmi_in_vopb {
	status = "disabled";
};

&i2c0 {
	status = "okay";
	i2c-scl-rising-time-ns = <180>;
	i2c-scl-falling-time-ns = <30>;
	clock-frequency = <400000>;

	vdd_cpu_b: syr837@40 {
		compatible = "silergy,syr827";
		reg = <0x40>;
		vin-supply = <&vcc_sys>;
		regulator-compatible = "fan53555-reg";
		pinctrl-0 = <&vsel1_gpio>;
		vsel-gpios = <&gpio1 RK_PC1 GPIO_ACTIVE_HIGH>;
		regulator-name = "vdd_cpu_b";
		regulator-min-microvolt = <712500>;
		regulator-max-microvolt = <1500000>;
		regulator-ramp-delay = <1000>;
		fcs,suspend-voltage-selector = <1>;
		regulator-always-on;
		regulator-initial-state = <3>;
		regulator-state-mem {
			regulator-off-in-suspend;
		};
	};

	vdd_gpu: syr828@41 {
		compatible = "silergy,syr828";
		status = "okay";
		reg = <0x41>;
		vin-supply = <&vcc_sys>;
		regulator-compatible = "fan53555-reg";
		pinctrl-0 = <&vsel2_gpio>;
		vsel-gpios = <&gpio1 RK_PB6 GPIO_ACTIVE_HIGH>;
		regulator-name = "vdd_gpu";
		regulator-min-microvolt = <735000>;
		regulator-max-microvolt = <1400000>;
		regulator-ramp-delay = <1000>;
		fcs,suspend-voltage-selector = <1>;
		regulator-always-on;
		regulator-boot-on;
		regulator-state-mem {
			regulator-off-in-suspend;
		};
	};

	rk808: pmic@1b {
		compatible = "rockchip,rk808";
		reg = <0x1b>;
		interrupt-parent = <&gpio1>;
		interrupts = <RK_PC5 IRQ_TYPE_LEVEL_LOW>;
		pinctrl-0 = <&pmic_int_l>;
		rockchip,system-power-controller;
		wakeup-source;
		#clock-cells = <1>;
		clock-output-names = "rk808-clkout1", "rk808-clkout2";
		vcc1-supply = <&vcc3v3_sys>;
		vcc2-supply = <&vcc3v3_sys>;
		vcc3-supply = <&vcc3v3_sys>;
		vcc4-supply = <&vcc3v3_sys>;
		vcc6-supply = <&vcc3v3_sys>;
		vcc7-supply = <&vcc3v3_sys>;
		vcc8-supply = <&vcc3v3_sys>;
		vcc9-supply = <&vcc3v3_sys>;
		vcc10-supply = <&vcc3v3_sys>;
		vcc11-supply = <&vcc3v3_sys>;
		vcc12-supply = <&vcc3v3_sys>;
		vddio-supply = <&vcc1v8_pmu>;

		regulators {

			vdd_center: DCDC_REG1 {
				regulator-always-on;
				regulator-boot-on;
				regulator-min-microvolt = <750000>;
				regulator-max-microvolt = <1350000>;
				regulator-ramp-delay = <6001>;
				regulator-name = "vdd_center";
				regulator-state-mem {
					regulator-off-in-suspend;
				};
			};
			vdd_cpu_l: DCDC_REG2 {
				regulator-always-on;
				regulator-boot-on;
				regulator-min-microvolt = <750000>;
				regulator-max-microvolt = <1350000>;
				regulator-ramp-delay = <6001>;
				regulator-name = "vdd_cpu_l";
				regulator-state-mem {
					regulator-off-in-suspend;
				};
			};
			vcc_ddr: DCDC_REG3 {
				regulator-always-on;
				regulator-boot-on;
				regulator-name = "vcc_ddr";
				regulator-state-mem {
					regulator-on-in-suspend;
				};
			};
			vcc_1v8: DCDC_REG4 {
				regulator-always-on;
				regulator-boot-on;
				regulator-min-microvolt = <1800000>;
				regulator-max-microvolt = <1800000>;
				regulator-name = "vcc_1v8";
				regulator-state-mem {
				regulator-on-in-suspend;
					regulator-suspend-microvolt = <1800000>;
				};
			};
			vcc1v8_dvp: LDO_REG1 {
				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;
				};
			};
			vcc3v0_tp: LDO_REG2 {
				regulator-always-on;
				regulator-boot-on;
				regulator-min-microvolt = <3000000>;
				regulator-max-microvolt = <3000000>;
				regulator-name = "vcc3v0_tp";
				regulator-state-mem {
					regulator-on-in-suspend;
				};
			};
			vcc1v8_pmu: LDO_REG3 {
				regulator-always-on;
				regulator-boot-on;
				regulator-min-microvolt = <1800000>;
				regulator-max-microvolt = <1800000>;
				regulator-name = "vcc1v8_pmu";
				regulator-state-mem {
					regulator-on-in-suspend;
					regulator-suspend-microvolt = <1800000>;
				};
			};
			vcc_sd: LDO_REG4 {
				regulator-always-on;
				regulator-boot-on;
				regulator-min-microvolt = <3000000>;
				regulator-max-microvolt = <3000000>;
				regulator-name = "vcc_sd";
				regulator-state-mem {
					regulator-on-in-suspend;
					regulator-suspend-microvolt = <3000000>;
				};
			};
			vcca3v0_codec: LDO_REG5 {
				regulator-always-on;
				regulator-boot-on;
				regulator-min-microvolt = <3000000>;
				regulator-max-microvolt = <3000000>;
				regulator-name = "vcca3v0_codec";
				regulator-state-mem {
					regulator-off-in-suspend;
				};
			};
			vcc_1v5: LDO_REG6 {
				regulator-always-on;
				regulator-boot-on;
				regulator-min-microvolt = <1500000>;
				regulator-max-microvolt = <1500000>;
				regulator-name = "vcc_1v5";
				regulator-state-mem {
					regulator-on-in-suspend;
					regulator-suspend-microvolt = <1500000>;
				};
			};
			vcca1v8_codec: LDO_REG7 {
				regulator-always-on;
				regulator-boot-on;
				regulator-min-microvolt = <1800000>;
				regulator-max-microvolt = <1800000>;
				regulator-name = "vcca1v8_codec";
				regulator-state-mem {
					regulator-off-in-suspend;
				};
			};
			vcc_3v0: LDO_REG8 {
				regulator-always-on;
				regulator-boot-on;
				regulator-min-microvolt = <3000000>;
				regulator-max-microvolt = <3000000>;
				regulator-name = "vcc_3v0";
				regulator-state-mem {
					regulator-on-in-suspend;
					regulator-suspend-microvolt = <3000000>;
				};
			};
			vcc3v3_s3: SWITCH_REG1 {
				regulator-always-on;
				regulator-boot-on;
				regulator-name = "vcc3v3_s3";
				regulator-state-mem {
					regulator-off-in-suspend;
				};
			};
			vcc3v3_s0: SWITCH_REG2 {
				regulator-boot-on;
				regulator-always-on;
				regulator-name = "vcc3v3_s0";
				regulator-state-mem {
					regulator-off-in-suspend;
				};
			};
		};
	};
};

&i2c1 {
	status = "okay";
	i2c-scl-rising-time-ns = <140>;
	i2c-scl-falling-time-ns = <30>;

	es8316: es8316@11 {
		#sound-dai-cells = <0>;
		compatible = "everest,es8316";
		reg = <0x11>;
		clocks = <&cru SCLK_I2S_8CH_OUT>;
		clock-names = "mclk";
		pinctrl-names = "default";
		pinctrl-0 = <&i2s_8ch_mclk>;
		spk-con-gpio = <&gpio0 RK_PB3 GPIO_ACTIVE_HIGH>;
		extcon = <&rk_headset>;
	};
};

&i2c4 {
	status = "okay";
	i2c-scl-rising-time-ns = <345>;
	i2c-scl-falling-time-ns = <11>;
	clock-frequency = <100000>;

	bq25700: bq25700@6b {
		compatible = "ti,bq25703";
		reg = <0x6b>;
		extcon = <&fusb0>;
		interrupt-parent = <&gpio1>;
		interrupts = <RK_PC7 IRQ_TYPE_LEVEL_LOW>;
		pinctrl-names = "default";
		pinctrl-0 = <&charger_ok>;
		ti,charge-current = <1500000>;
		ti,max-charge-voltage = <8704000>;
		ti,max-input-voltage = <20000000>;
		ti,max-input-current = <6000000>;
		ti,input-current-sdp = <500000>;
		ti,input-current-dcp = <2000000>;
		ti,input-current-cdp = <2000000>;
		ti,input-current-dc = <2000000>;
		ti,minimum-sys-voltage = <6700000>;
		ti,otg-voltage = <5000000>;
		ti,otg-current = <500000>;
		ti,input-current = <500000>;
		pd-charge-only = <0>;
		typec0-enable-gpios = <&gpio1 RK_PA3 GPIO_ACTIVE_LOW>;
		status = "okay";
	};

	cw2015: cw2015@62 {
		status = "okay";
		compatible = "cw201x";
		reg = <0x62>;
		bat_config_info = <0x15 0xA8 0x5D 0x5D 0x59 0x55 0x57 0x50
				   0x4B 0x4F 0x55 0x53 0x43 0x37 0x2F 0x28
				   0x21 0x18 0x15 0x17 0x27 0x43 0x57 0x4F
				   0x13 0x5E 0x0A 0xE1 0x19 0x31 0x3C 0x46
				   0x4C 0x52 0x50 0x54 0x44 0x1E 0x7E 0x4C
				   0x1C 0x4A 0x52 0x87 0x8F 0x91 0x94 0x52
				   0x82 0x8C 0x92 0x96 0x00 0xAD 0xFB 0xCB
				   0x2F 0x7D 0x72 0xA5 0xB5 0xC1 0x1C 0x09>;
		monitor_sec = <2>;
		virtual_power = <0>;
		divider_res1 = <200>;
		divider_res2 = <200>;
	};

	fusb0: fusb30x@22 {
		compatible = "fairchild,fusb302";
		reg = <0x22>;
		pinctrl-names = "default";
		pinctrl-0 = <&fusb0_int>;
		vbus-5v-gpios = <&gpio1 RK_PD0 GPIO_ACTIVE_HIGH>;
		int-n-gpios = <&gpio1 RK_PA2 GPIO_ACTIVE_HIGH>;
		discharge-gpios = <&gpio0 RK_PB4 GPIO_ACTIVE_HIGH>;
		charge-dev = <&bq25700>;
		support-uboot-charge = <1>;
		port-num = <0>;
		status = "okay";
	};

	kxtj: kxtj2@0e {
		status = "okay";
		compatible = "gs_kxtj9";
		pinctrl-names = "default";
		pinctrl-0 = <&kxtj2_irq_gpio>;
		reg = <0x0e>;
		irq-gpio = <&gpio1 RK_PC6 IRQ_TYPE_EDGE_RISING>;
		type = <SENSOR_TYPE_ACCEL>;
		irq_enable = <0>;
		poll_delay_ms = <30>;
		power-off-in-suspend = <1>;
		layout = <5>;
	};
};

&i2c5 {
	status = "okay";
	i2c-scl-rising-time-ns = <150>;
	i2c-scl-falling-time-ns = <30>;
	clock-frequency = <100000>;

	gslx680: gslx680@40 {
		compatible = "gslX680_tve";
		reg = <0x40>;
		pinctrl-names = "default";
		pinctrl-0 = <&tp_irq_gpio>;
		touch-gpio = <&gpio3 RK_PB0 IRQ_TYPE_EDGE_RISING>;
		reset-gpio = <&gpio4 RK_PC6 GPIO_ACTIVE_LOW>;
		max-x = <1200>;
		max-y = <1920>;
		tp-size = <80>;
		tp-supply = <&vcc3v0_tp>;
		status = "okay";
	};
};

&i2s0 {
	status = "okay";
	rockchip,i2s-broken-burst-len;
	rockchip,playback-channels = <8>;
	rockchip,capture-channels = <8>;
	#sound-dai-cells = <0>;
};

&i2s2 {
	#sound-dai-cells = <0>;
	status = "okay";
};

&io_domains {
	status = "okay";
	bt656-supply = <&vcc1v8_dvp>;
	audio-supply = <&vcca1v8_codec>;
	sdmmc-supply = <&vcc_sd>;
	gpio1830-supply = <&vcc_3v0>;
};

&isp0_mmu {
	status = "okay";
};

&isp1_mmu {
	status = "okay";
};

&pinctrl {

	charger {
		charger_ok: charge-ok {
			rockchip,pins =
				<1 RK_PC7 RK_FUNC_GPIO &pcfg_pull_up>;
		};
	};

	fusb30x {
		fusb0_int: fusb0-int {
			rockchip,pins =
				<1 RK_PA2 RK_FUNC_GPIO &pcfg_pull_up>,
				<0 RK_PB4 RK_FUNC_GPIO &pcfg_pull_up>;
			};
	};

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

	kxtj2 {
		kxtj2_irq_gpio: kxtj2-irq-gpio {
			rockchip,pins = <1 RK_PC6 RK_FUNC_GPIO &pcfg_pull_none>;
		};
	};

	lcd_rst {
		lcd_rst_gpio: lcd-rst-gpio {
			rockchip,pins = <3 RK_PA4 RK_FUNC_GPIO &pcfg_pull_none>;
		};
	};

	pmic {
		pmic_int_l: pmic-int-l {
			rockchip,pins =
				<1 RK_PC5 RK_FUNC_GPIO &pcfg_pull_up>;
		};
		vsel1_gpio: vsel1-gpio {
			rockchip,pins =
				<1 RK_PC1 RK_FUNC_GPIO &pcfg_pull_down>;
		};
		vsel2_gpio: vsel2-gpio {
			rockchip,pins =
				<1 RK_PB6 RK_FUNC_GPIO &pcfg_pull_down>;
		};
	};

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

	tp_irq {
		tp_irq_gpio: tp-irq-gpio {
			rockchip,pins = <3 RK_PB0 RK_FUNC_GPIO &pcfg_pull_up>;
		};
	};

	usb2 {
		host_vbus_drv: host-vbus-drv {
			rockchip,pins =
				<4 RK_PD1 RK_FUNC_GPIO &pcfg_pull_none>;
		};
	};

	wireless-bluetooth {
		uart0_gpios: uart0-gpios {
			rockchip,pins = <2 RK_PC3 RK_FUNC_GPIO &pcfg_pull_none>;
		};

		bt_reset_gpio: bt-reset-gpio {
			rockchip,pins = <0 RK_PB1 RK_FUNC_GPIO &pcfg_pull_none>;
		};

		bt_wake_gpio: bt-wake-gpio {
			rockchip,pins = <2 RK_PD2 RK_FUNC_GPIO &pcfg_pull_none>;
		};

		bt_irq_gpio: bt-irq-gpio {
			rockchip,pins = <0 RK_PA4 RK_FUNC_GPIO &pcfg_pull_down>;
		};
	};
};

&pmu_io_domains {
	status = "okay";
	pmu1830-supply = <&vcc_1v8>;
};

&pwm0 {
	status = "okay";
};

&pwm2 {
	status = "okay";
	pinctrl-names = "active";
	pinctrl-0 = <&pwm2_pin_pull_down>;
};

&rockchip_suspend {
	status = "okay";
	rockchip,sleep-debug-en = <1>;
	rockchip,sleep-mode-config = <
		(0
		| RKPM_SLP_ARMPD
		| RKPM_SLP_PERILPPD
		| RKPM_SLP_DDR_RET
		| RKPM_SLP_PLLPD
		| RKPM_SLP_CENTER_PD
		| RKPM_SLP_OSC_DIS
		| RKPM_SLP_AP_PWROFF
		)
	>;
	rockchip,wakeup-config = <
		(0
		| RKPM_GPIO_WKUP_EN
		)
	>;
	rockchip,pwm-regulator-config = <
		(0
		| PWM2_REGULATOR_EN
		)
	>;
	rockchip,power-ctrl =
		<&gpio1 RK_PC1 GPIO_ACTIVE_HIGH>,
		<&gpio1 RK_PB6 GPIO_ACTIVE_HIGH>;
};

&route_dsi {
	status = "okay";
	logo,mode = "center";
};

&saradc {
	status = "okay";
};

&sdhci {
	bus-width = <8>;
	mmc-hs400-1_8v;
	no-sdio;
	no-sd;
	non-removable;
	keep-power-in-suspend;
	mmc-hs400-enhanced-strobe;
	status = "okay";
};

&sdio0 {
	clock-frequency = <100000000>;
	clock-freq-min-max = <200000 100000000>;
	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;
	num-slots = <1>;
	pinctrl-names = "default";
	pinctrl-0 = <&sdio0_bus4 &sdio0_cmd &sdio0_clk>;
	sd-uhs-sdr104;
	status = "okay";
};

&sdmmc {
	clock-frequency = <50000000>;
	clock-freq-min-max = <400000 150000000>;
	no-sdio;
	no-mmc;
	bus-width = <4>;
	cap-mmc-highspeed;
	cap-sd-highspeed;
	disable-wp;
	num-slots = <1>;
	//sd-uhs-sdr104;
	vqmmc-supply = <&vcc_sd>;
	pinctrl-names = "default";
	pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_cd &sdmmc_bus4>;
	status = "okay";
};

&tcphy0 {
	extcon = <&fusb0>;
	status = "okay";
};

&tsadc {
	rockchip,hw-tshut-mode = <1>; /* tshut mode 0:CRU 1:GPIO */
	rockchip,hw-tshut-polarity = <1>; /* tshut polarity 0:LOW 1:HIGH */
	status = "okay";
};

&u2phy0 {
	status = "okay";
	extcon = <&fusb0>;

	u2phy0_otg: otg-port {
		status = "okay";
	};

	u2phy0_host: host-port {
		phy-supply = <&vcc5v0_host>;
		status = "okay";
	};
};

&uart0 {
	pinctrl-names = "default";
	pinctrl-0 = <&uart0_xfer &uart0_cts>;
	status = "okay";
};

&uart2 {
	status = "disabled";
};

&usb_host0_ehci {
	status = "okay";
};

&usb_host0_ohci {
	status = "okay";
};

&usbdrd3_0 {
	status = "okay";
};

&usbdrd_dwc3_0 {
	status = "okay";
	extcon = <&fusb0>;
};

&vopb {
	assigned-clocks = <&cru DCLK_VOP0_DIV>;
	assigned-clock-parents = <&cru PLL_CPLL>;
};

&vopl {
	assigned-clocks = <&cru DCLK_VOP1_DIV>;
	assigned-clock-parents = <&cru PLL_VPLL>;
};
