
/ {
	test-power {
		status = "disabled";
	};
	

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

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

	rk817: pmic@20 {
		compatible = "rockchip,rk817";
		reg = <0x20>;
		interrupt-parent = <&gpio0>;
		interrupts = <17 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_rst>, <&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 = <1>;

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

		pwrkey {
			status = "okay";
		};

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

			rk817_ts_gpio1: rk817_ts_gpio1 {
				pins = "gpio_ts";
				function = "pin_fun1";
				/* output-low; */
				/* input-enable; */
			};

			rk817_gt_gpio2: rk817_gt_gpio2 {
				pins = "gpio_gt";
				function = "pin_fun1";
			};

			rk817_pin_ts: rk817_pin_ts {
				pins = "gpio_ts";
				function = "pin_fun0";
			};

			rk817_pin_gt: rk817_pin_gt {
				pins = "gpio_gt";
				function = "pin_fun0";
			};

			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 = <850000>;
				regulator-max-microvolt = <1350000>;
				regulator-ramp-delay = <6001>;
				regulator-initial-mode = <0x2>;
				regulator-name = "vdd_logic";
				regulator-state-mem {
					regulator-on-in-suspend;
					regulator-suspend-microvolt = <950000>;
				};
			};

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

			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_3v0: DCDC_REG4 {
				regulator-always-on;
				regulator-boot-on;
				regulator-min-microvolt = <3000000>;
				regulator-max-microvolt = <3000000>;
				regulator-initial-mode = <0x2>;
				regulator-name = "vcc_3v0";
				regulator-state-mem {
					regulator-off-in-suspend;
					regulator-suspend-microvolt = <3000000>;
				};
			};

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

			vcc1v8_soc: LDO_REG2 {
				regulator-always-on;
				regulator-boot-on;
				regulator-min-microvolt = <1800000>;
				regulator-max-microvolt = <1800000>;

				regulator-name = "vcc1v8_soc";
				regulator-state-mem {
					regulator-on-in-suspend;
					regulator-suspend-microvolt = <1800000>;
				};
			};

			vdd1v0_soc: LDO_REG3 {
				regulator-always-on;
				regulator-boot-on;
				regulator-min-microvolt = <1000000>;
				regulator-max-microvolt = <1000000>;

				regulator-name = "vcc1v0_soc";
				regulator-state-mem {
					regulator-on-in-suspend;
					regulator-suspend-microvolt = <1000000>;
				};
			};

			vcc3v0_pmu: LDO_REG4 {
				regulator-always-on;
				regulator-boot-on;
				regulator-min-microvolt = <3000000>;
				regulator-max-microvolt = <3000000>;

				regulator-name = "vcc3v0_pmu";
				regulator-state-mem {
					regulator-on-in-suspend;
					regulator-suspend-microvolt = <3000000>;

				};
			};

			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-on-in-suspend;
					regulator-suspend-microvolt = <3300000>;
				};
			};

			vcc_sd: LDO_REG6 {
				regulator-min-microvolt = <3300000>;
				regulator-max-microvolt = <3300000>;

				regulator-name = "vcc_sd";
				regulator-state-mem {
					regulator-on-in-suspend;
					regulator-suspend-microvolt = <3300000>;

				};
			};

			vcc2v8_dvp: LDO_REG7 {
				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;
					regulator-suspend-microvolt = <2800000>;
				};
			};

			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-on-in-suspend;
					regulator-suspend-microvolt = <1800000>;
				};
			};

			vdd1v5_dvp: LDO_REG9 {
				regulator-always-on;
				regulator-boot-on;
				regulator-min-microvolt = <1500000>;
				regulator-max-microvolt = <1500000>;

				regulator-name = "vdd1v5_dvp";
				regulator-state-mem {
					regulator-off-in-suspend;
					regulator-suspend-microvolt = <1500000>;
				};
			};

			dcdc_boost: BOOST {
				regulator-always-on;
				regulator-boot-on;
				regulator-min-microvolt = <4700000>;
				regulator-max-microvolt = <5400000>;
				regulator-name = "boost";
			};

			otg_switch: OTG_SWITCH {
				regulator-name = "otg_switch";
			};
		};

		battery {
			status = "okay";
			compatible = "rk817,battery";
			ocv_table = <3300 3337 3374 3411 3447 3485 3524
                                     3561 3598 3635 3672 3709 3746 3785
                                     3822 3859 3896 3933 3970 4007 4050>;
			design_capacity = <5000>;
			design_qmax = <5500>;
			bat_res = <100>;
			sleep_enter_current = <300>;
			sleep_exit_current = <300>;
			sleep_filter_current = <100>;
			power_off_thresd = <3300>;
			zero_algorithm_vol = <3850>;
			max_soc_offset = <60>;
			monitor_sec = <5>;
			sample_res = <10>;
			virtual_power = <0>;  //test mode, 1 to force report 66%

                        //rpdzkj add  Mandatory configuration under the condition of no battery, the power connected to external DC is 0, and 50% is reported
                        dc_rpdzkj_psy = <1>;     //强制配置无电池情况下接外部DC电量为0上报50%   1:enable  0:not
		};

		charger {
			status = "okay";
			compatible = "rk817,charger";
			min_input_voltage = <4500>;
			max_input_current = <3000>;//1500
			max_chrg_current = <1000>;//2000
			max_chrg_voltage = <4350>;
			chrg_term_mode = <0>;
			chrg_finish_cur = <300>;
			virtual_power = <0>;
			dc_det_adc = <0>;
		//	extcon = <&u2phy>;   //otg charging

			//power_dc2otg = <1>;
                	//dc_det_gpio = <&gpio4 RK_PB6 GPIO_ACTIVE_HIGH>;    //可配置pins 读取dc转3.3V以下电压做dc充电检测脚
                	//rpdzkj add    Configure external DC to detect and report charging status
                	rpdzkj_dc_vbus = <1>;     //配置外部DC检测上报充电状态 1:enable  0:not
		};

		rk817_codec: codec {
			#sound-dai-cells = <0>;
			compatible = "rockchip,rk817-codec";
			clocks = <&cru SCLK_I2S1_OUT>;
			clock-names = "mclk";
			pinctrl-names = "default";
			pinctrl-0 = <&i2s1_2ch_mclk>;
			hp-volume = <20>;
			spk-volume = <3>;
			status = "okay";
		};
	};
};

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

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

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

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

&pmu_io_domains {
        status = "okay";

        pmuio1-supply = <&vcc3v0_pmu>;
        pmuio2-supply = <&vcc3v0_pmu>;
};

&io_domains {
        status = "okay";
	
	vccio1-supply = <&vcc1v8_soc>;
        vccio2-supply = <&vccio_sd>;
        vccio3-supply = <&vcc1v8_dvp>;
        vccio4-supply = <&vcc_3v0>;
        vccio5-supply = <&vcc_3v0>;
        vccio6-supply = <&vcc1v8_soc>;
};
