// SPDX-License-Identifier: (GPL-2.0+ or MIT)

/dts-v1/;

#include "sun300iw1p1.dtsi"

/{
	board = "V821", "V821-Avaota F1";
	compatible = "allwinner,v821", "riscv,sun300iw1p1";
	aliases {
	};

	reg_vdd_cpu: vdd-cpu {
		compatible = "regulator-fixed";
		regulator-name = "vdd_cpu";
		regulator-min-microvolt = <920000>;
		regulator-max-microvolt = <920000>;
		regulator-always-on;
		regulator-boot-on;
		status = "okay";
	};

	/* used for hib & ultra standby poweron source enable mask */
	/* bit 0 ~ bit 7 - pl 0 ~pl 7 */
	/* bit 9 rtc alarm0 */
	/* bit 10 rtc alarm1 */
	/* bit 11 wakeuptimer */
	/* bit 12 wlan, keep 0 because hib has no wlan and ultra wakes up by wlan on remote core */
	poweron-source {
		hib_poweron_source  = <0x000007FF>;
		ultra_poweron_source  = <0x000007FF>;
	};

	reserved-memory {
		rv_ddr_reserved: rvddrreserved@81000000 {
			reg = <0x0 0x81000000 0x0 0x200000>;
			no-map;
		};
		/*
		* The name should be "vdev%dbuffer".
		* Its size should be not less than
		*     RPMSG_BUF_SIZE * (num of buffers in a vring) * 2
		*   = 512 * (num of buffers in a vring) * 2
		*/
		rv_vdev0buffer: vdev0buffer@81200000 {
			compatible = "shared-dma-pool";
			reg = <0x0 0x81200000 0x0 0x40000>;
			no-map;
		};
		/*
		* The name should be "vdev%dvring%d".
		* The size of each should be not less than
		*     PAGE_ALIGN(vring_size(num, align))
		*   = PAGE_ALIGN(16 * num + 6 + 2 * num + (pads for align) + 6 + 8 * num)
		*
		* (Please refer to the vring layout in include/uapi/linux/virtio_ring.h)
		*/
		rv_vdev0vring0: vdev0vring0@81240000 {
			reg = <0x0 0x81240000 0x0 0x2000>;
			no-map;
		};

		rv_vdev0vring1: vdev0vring1@81242000 {
			reg = <0x0 0x81242000 0x0 0x2000>;
			no-map;
		};

		e907_mem_fw: e907_mem_fw@81244000 {
			/* boot0 & uboot0 load elf addr */
			reg = <0x0 0x81244000 0x0 0x00200000>;
		};

		e907_share_irq_table: share_irq_table@81644000 {
			reg = <0x0 0x81644000 0x0 0x2000>;
			no-map;
		};

		e907_rpbuf_reserved:e907_rpbuf@81646000 {
			compatible = "shared-dma-pool";
			reg = <0x0 0x81646000 0x0 0x8000>;
			no-map;
		};

		size_pool {
			reg = <0 0x82000000 0 0x01400000>;
		};

		linux,cma {
			size = <0x0 0x400000>;
		};
	};

	reserved-irq {
		share-e907 {
			arch-name = "e907";
			memory-region = <&e907_share_irq_table>;
			/* defined by sun300iw1-share-irq-dt.h */
			share-irq =
					<1    0x1    E907_PA_IRQ_NUM    A27_PA_IRQ_NUM    0x00000000>,
					<3    0x3    E907_PC_IRQ_NUM    A27_PC_IRQ_NUM    0x00000000>,
					<4    0x4    E907_PD_IRQ_NUM    A27_PD_IRQ_NUM    0x00000000>,
					<12   0xc    E907_PL_IRQ_NUM    A27_PL_IRQ_NUM    0x00000000>;
		};
	};

	hifbypass: hifbypass {
		compatible = "allwinner,sun300wi-sip-wifi";
		interrupts-extended = <&plic0 160 IRQ_TYPE_LEVEL_HIGH>;
		clocks = <&aon_ccu CLK_DCXO>;
		clock-names = "hosc";
		status = "disabled";
	};

	rpbuf_controller0: rpbuf_controller0@0 {
		compatible = "allwinner,rpbuf-controller";
		remoteproc = <&e907_rproc>;
		ctrl_id = <0>;
		memory-region = <&e907_rpbuf_reserved>;
		status = "okay";
	};

	rpbuf_xradio: rpbuf_xradio@0 {
		compatible = "allwinner,rpbuf-xradio";
		rpbuf = <&rpbuf_controller0>;
		status = "okay";
	};

	heap_size_pool@0{
		compatible = "allwinner,size_pool";
		heap-name = "size_pool";
		heap-id = <0x7>;
		heap-base = <0x82000000>;
		heap-size = <0x01400000>;
		heap-type = "ion_size_pool";
		thrs = <100>;
		sizes = <0 20480>;
		fall_to_big_pool = <1>;
	};

	gpio-motor@0 {
		compatible = "allwinner,gpio-motor";
		ab-pin-black = <&pio PD 12 GPIO_ACTIVE_HIGH>;
		ab-pin-yellow = <&pio PD 13 GPIO_ACTIVE_HIGH>;
		ab-pin-brown = <&pio PD 14 GPIO_ACTIVE_HIGH>;
		ab-pin-blue = <&pio PD 15 GPIO_ACTIVE_HIGH>;
		cd-pin-black = <&pio PD 16 GPIO_ACTIVE_HIGH>;
		cd-pin-yellow = <&pio PD 17 GPIO_ACTIVE_HIGH>;
		cd-pin-brown = <&pio PD 18 GPIO_ACTIVE_HIGH>;
		cd-pin-blue = <&pio PD 19 GPIO_ACTIVE_HIGH>;
		status = "disabled";
	};

	ae350_standby_debug:ae350_standby_debug@1 {
		compatible = "allwinner,sun300iw1-ae350-standby-debug";
		mboxes = <&msgbox 2>;
		mbox-names = "ae350-notify";
		status = "okay";
	};
};

&rtc_pio {
	uart0_pins_default: uart0_pins@0 {
		pins = "PL4", "PL5";
		function = "uart0";
	};

	uart0_pins_sleep: uart0_pins@1 {
		pins = "PL4", "PL5";
		function = "io_disabled";
	};

	uart3_pins_default: uart3_pins@0 {
		pins = "PL2", "PL3";
		function = "uart3";
	};

	uart3_pins_sleep: uart3_pins@1 {
		pins = "PL2", "PL3";
		function = "io_disabled";
	};
};

&pio {
	uart1_pins_default: uart1_pins@0 {
		pins = "PD7", "PD8", "PD9", "PD10";
		function = "uart1";
	};

	uart1_pins_sleep: uart1_pins@1 {
		pins = "PD7", "PD8", "PD9", "PD10";
		function = "io_disabled";
	};

	uart2_pins_default: uart2_pins@0 {
		pins = "PA5", "PA6", "PA7", "PA8";
		function = "uart2";
	};

	uart2_pins_sleep: uart2_pins@1 {
		pins = "PA5", "PA6", "PA7", "PA8";
		function = "io_disabled";
	};

	gmac0_pins_default: gmac_pins@0 {
		pins = "PD1", "PD2", "PD3",
			"PD4", "PD5", "PD6", "PD7",
			"PD8", "PD9", "PD10", "PD11";
		function = "rmii";
		allwinner,drive = <3>;
		bias-pull-up;
	};

	gmac0_pins_sleep: gmac_pins@1 {
		pins = "PD1", "PD2", "PD3",
			"PD4", "PD5", "PD6", "PD7",
			"PD8", "PD9", "PD10", "PD11";
		function = "io_disabled";
	};

	pwm8_pins_active: pwm8@0 {
		pins = "PD18";
		function = "pwm0_8";
	};
	pwm8_pins_sleep: pwm8@1 {
		pins = "PD18";
		function = "gpio_in";
		bias-pull-down;
	};
	pwm9_pins_active: pwm9@0 {
		pins = "PD19";
		function = "pwm0_9";
	};
	pwm9_pins_sleep: pwm9@1 {
		pins = "PD19";
		function = "gpio_in";
		bias-pull-down;
	};

	twi0_pins_default: twi0@0 {
		pins = "PA3", "PA4";
		function = "twi0";
		allwinner,drive = <0>;
		bias-pull-up;
	};

	twi0_pins_sleep: twi0@1 {
		pins = "PA3", "PA4";
		function = "gpio_in";
	};

	spi0_pins_default: spi0@0 {
		pins = "PC9", "PC8", "PC11"; /* clk, mosi, miso */
		function = "spi0";
		allwinner,drive = <0>;
	};

	spi0_pins_cs: spi0@1 {
		pins = "PC6", "PC7", "PC10"; /* wp, hold, cs */
		function = "spi0";
		allwinner,drive = <0>;
		bias-pull-up;
	};

	spi0_pins_sleep: spi0@2 {
		pins = "PC6", "PC7", "PC9", "PC8", "PC11", "PC10";
		function = "io_disabled";
	};

	sdc0_pins_a: sdc0@0 {
		pins = "PC0", "PC1", "PC2",
				"PC3", "PC5";
		function = "sdc0";
		allwinner,drive = <3>;
		bias-pull-up;
	};

	sdc0_pins_c: sdc0@2 {
		pins = "PC0", "PC1", "PC2",
				"PC3", "PC4", "PC5";
		function = "gpio_in";
	};

	sdc0_pins_d: sdc0@3 {
		pins = "PC4";
		function = "sdc0";
		allwinner,drive = <3>;
		bias-disable;
	};

	/* for uboot card probe */
	sdc0_pins_uboot: sdc0@4 {
		allwinner,pins = "PC0", "PC1", "PC2",
				"PC3", "PC4", "PC5";
		allwinner,function = "sdc0";
		allwinner,muxsel = <2>;
		allwinner,drive = <3>;
		allwinner,pull = <1>;
		power-source = <3300>;
	};

	spif_pins_default: spif@0 {
		pins = "PC9", "PC8", "PC11"; /* clk, mosi, miso */
		function = "spif";
		allwinner,drive = <1>;
	};

	spif_pins_cs: spif@1 {
		pins = "PC6", "PC7", "PC10"; /* wp, hold, cs */
		function = "spif";
		allwinner,drive = <1>;
		bias-pull-up;
	};

	spif_pins_sleep: spif@2 {
		pins = "PC6", "PC7", "PC9", "PC8", "PC11", "PC10";
		function = "io_disabled";
	};

	/* I2S0 individual pin definitions for MAX98357A */
	i2s0_bclk_pin: i2s0_bclk@0 {
		pins = "PD12";
		function = "i2s0_bclk";
		drive-strength = <20>;
		bias-disable;
	};

	i2s0_lrck_pin: i2s0_lrck@0 {
		pins = "PD13";
		function = "i2s0_lrck";
		drive-strength = <20>;
		bias-disable;
	};

	i2s0_dout0_pin: i2s0_dout0@0 {
		pins = "PD15";
		function = "i2s0_dout0";
		drive-strength = <20>;
		bias-disable;
	};

	i2s0_pins_b: i2s0_pins@1 {
		pins = "PD12", "PD13", "PD15";
		function = "gpio_in";
	};
};

&soc {
	card0_boot_para@0 {
		device_type = "card0_boot_para";
		card_ctrl = <0x0>;
		card_high_speed = <0x1>;
		card_line = <0x4>;
		pinctrl-0 = <&sdc0_pins_uboot>;
		clk_type = "typ1";
	};
	addr_mgt: addr_mgt {
		compatible = "allwinner,sunxi-addr_mgt";
		type_addr_wifi = <0x0>;
		type_addr_bt   = <0x0>;
		type_addr_eth  = <0x0>;
		status = "okay";
	};
};

&hwspinlock {
	status = "okay";
};

&uart0 {
	pinctrl-names = "default", "sleep";
	pinctrl-0 = <&uart0_pins_default>;
	pinctrl-1 = <&uart0_pins_sleep>;
	status = "okay";
};

&uart1 {
	pinctrl-names = "default", "sleep";
	pinctrl-0 = <&uart1_pins_default>;
	pinctrl-1 = <&uart1_pins_sleep>;
	status = "disabled";
};

&uart2 {
	pinctrl-names = "default", "sleep";
	pinctrl-0 = <&uart2_pins_default>;
	pinctrl-1 = <&uart2_pins_sleep>;
	status = "disabled";
};

&uart3 {
	pinctrl-names = "default", "sleep";
	pinctrl-0 = <&uart3_pins_default>;
	pinctrl-1 = <&uart3_pins_sleep>;
	status = "disabled";
};

&twi0 {
	clock-frequency = <400000>;
	pinctrl-0 = <&twi0_pins_default>;
	pinctrl-1 = <&twi0_pins_sleep>;
	pinctrl-names = "default", "sleep";
	/* For stability and backwards compatibility, we recommend setting 'twi_drv_used' to 1 */
	twi_drv_used = <1>;
	status = "okay";
};

&soc_pmu0 {
	status = "okay";
};

&sdc0 {
	pinctrl-names = "default", "sleep";
	pinctrl-0 = <&sdc0_pins_a &sdc0_pins_d>;
	pinctrl-1 = <&sdc0_pins_c>;
	bus-width = <4>;
	cd-used-24M;
	cd-gpios = <&pio PC 15 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
	/*non-removable;*/
	/*broken-cd;*/
	/*cd-inverted*/
	/*data3-detect;*/
	cap-sd-highspeed;
	/*sd-uhs-sdr50;*/
	/*sd-uhs-ddr50;*/
	/*sd-uhs-sdr104;*/
	no-sdio;
	no-mmc;
	/*sunxi-power-save-mode;*/
	sunxi-dis-signal-vol-sw;
	max-frequency = <50000000>;
	ctl-spec-caps = <0x8>;
	status = "okay";
};

&pwm0_8 {
	pinctrl-names = "active", "sleep";
	pinctrl-0 = <&pwm8_pins_active>;
	pinctrl-1 = <&pwm8_pins_sleep>;
	status = "disabled";
};

&pwm0_9 {
	pinctrl-names = "active", "sleep";
	pinctrl-0 = <&pwm9_pins_active>;
	pinctrl-1 = <&pwm9_pins_sleep>;
	status = "disabled";
};

&spi0 {
	pinctrl-0 = <&spi0_pins_default &spi0_pins_cs>;
	pinctrl-1 = <&spi0_pins_sleep>;
	pinctrl-names = "default", "sleep";
	sunxi,spi-bus-mode = <SUNXI_SPI_BUS_NOR>;
	sunxi,spi-cs-mode = <SUNXI_SPI_CS_SOFT>;
	status = "disabled";

	dmas;
	dma-names;
	spi_board0 {
		device_type = "spi_board0";
		compatible = "spi-nor";
		spi-max-frequency = <100000000>;
		m25p,fast-read = <1>;
		/*individual_lock;*/
		reg = <0x0>;
		spi-rx-bus-width = <4>;
		spi-tx-bus-width = <4>;
		status = "disabled";
	};
};

&spif0 {
	clock-frequency = <100000000>;
	pinctrl-0 = <&spif_pins_default &spif_pins_cs>;
	pinctrl-1 = <&spif_pins_sleep>;
	pinctrl-names = "default", "sleep";
	spif-rx-bus-width = <0x4>;
	spif-tx-bus-width = <0x4>;
	//prefetch_read_mode_enabled;	/* choose prefect read mode */
	dtr_mode_enabled;				/* choose double edge trigger mode */
	io_mode_enabled;				/* 1_x_x && x_x_x mode */
	status = "okay";

	spif-nor  {
		device_type = "spi_board0";
		compatible = "spif-nor";
		spi-max-frequency = <0x5f5e100>;
		reg = <0x0>;
		status = "disabled";
	};
};

&mdio0 {
	status = "disabled";
	phy0: ethernet-phy@0 {
		/* JL11x1 */
		compatible = "ethernet-phy-id937c.4024",
			"ethernet-phy-ieee802.3-c22";
		reg = <0>;
		max-speed = <100>;  /* Max speed capability for rmii */
		reset-gpios = <&pio PC 16 GPIO_ACTIVE_LOW>;
		/* PHY datasheet rst time */
		reset-assert-us = <200000>;
		reset-deassert-us = <150000>;
		status = "disabled";
	};
};

&gmac0 {
	phy-mode = "rmii";
	pinctrl-names = "default", "sleep";
	pinctrl-0 = <&gmac0_pins_default>;
	pinctrl-1 = <&gmac0_pins_sleep>;
	sunxi,phy-clk-type = <0>;
	phy-handle = <&phy0>;
	tx-delay = <0>;
	rx-delay = <0>;
	status = "disabled";
};

&vind0 {
	csi_top = <200000000>;
	status = "okay";

	csi0: csi@45820000 {
		pinctrl-names = "csi_sm-default","csi_sm-sleep";
		pinctrl-0 = <>;
		pinctrl-1 = <>;
	};

	csi1: csi@45821000 {
		pinctrl-names = "default","sleep";
		pinctrl-0 = <&ncsi_bt656_pins_a>;
		pinctrl-1 = <&ncsi_bt656_pins_b>;
		status = "disabled";
	};

	tdm0: tdm@45908000 {
		work_mode = <0x0>;
	};

	isp00:isp@45900000 {
		work_mode = <0x0>;
		ldci_select = <0x1>;
	};

	isp01:isp@458ffffc {
		status = "disabled";
		ldci_select = <0x1>;
	};

	isp10:isp@4 {
		status = "disabled";
	};

	scaler00:scaler@45910000 {
		work_mode = <0x0>;
		status = "okay";
	};

	scaler01:scaler@4590fffc {
		work_mode = <0xff>;
		status = "disabled";
	};

	scaler10:scaler@45910400 {
		work_mode = <0x0>;
		status = "okay";
	};

	scaler11:scaler@459103fc {
		work_mode = <0xff>;
		status = "disabled";
	};

	actuator0: actuator@2108180 {
		device_type = "actuator0";
		actuator0_slave = <0x18>;
		actuator0_af_pwdn = <>;
		actuator0_afvdd = "afvcc-csi";
		actuator0_afvdd_vol = <2800000>;
		status = "disabled";
		actuator0_name;
	};

	flash0: flash@2108190 {
		device_type = "flash0";
		flash0_type = <2>;
		flash0_en = <>;
		flash0_mode = <>;
		flash0_flvdd = "";
		flash0_flvdd_vol = <>;
		device_id = <0>;
		status = "disabled";
	};

	sensor0: sensor@5812000 {
		device_type = "sensor0";
		sensor0_mname = "gc2083_mipi";
		sensor0_twi_cci_id = <0>;
		sensor0_twi_addr = <0x6e>;
		sensor0_mclk_id = <0>;
		sensor0_pos = "rear";
		sensor0_isp_used = <1>;
		sensor0_fmt = <1>;
		sensor0_stby_mode = <0>;
		sensor0_vflip = <0>;
		sensor0_hflip = <0>;
		sensor0_iovdd-supply = <>;
		sensor0_iovdd_vol = <>;
		sensor0_avdd-supply = <>;
		sensor0_avdd_vol = <>;
		sensor0_dvdd-supply = <>;
		sensor0_dvdd_vol = <>;
		sensor0_power_en = <>;
		sensor0_reset = <&pio PA 2 GPIO_ACTIVE_LOW>;
		sensor0_pwdn = <>;
		status = "okay";
		act_handle = <>;
	};

	sensor1: sensor@5812010 {
		device_type = "sensor1";
		sensor1_mname = "gc1084_mipi_2";
		sensor1_twi_cci_id = <0>;
		sensor1_twi_addr = <0x7e>;
		sensor1_mclk_id = <1>;
		sensor1_pos = "front";
		sensor1_isp_used = <1>;
		sensor1_fmt = <1>;
		sensor1_stby_mode = <0>;
		sensor1_vflip = <0>;
		sensor1_hflip = <0>;
		sensor1_iovdd-supply = <>;
		sensor1_iovdd_vol = <>;
		sensor1_avdd-supply = <>;
		sensor1_avdd_vol = <>;
		sensor1_dvdd-supply = <>;
		sensor1_dvdd_vol = <>;
		sensor1_power_en = <>;
		sensor1_reset = <&pio PD 13 GPIO_ACTIVE_LOW>;
		status = "disabled";
	};

	sensor_list0:sensor_list@200b820 {
		sensor00_mname = "gc5035_mipi";
		sensor00_twi_addr = <0x6c>;
		sensor00_type = <1>;
		sensor00_hflip = <0>;
		sensor00_vflip = <0>;
		sensor00_act_used = <1>;
		sensor00_act_name = "dw9714_act";
		sensor00_act_twi_addr = <0x18>;
		sensor01_mname = "ov5675_mipi";
		sensor01_twi_addr = <0x6c>;
		sensor01_type = <1>;
		sensor01_hflip = <0>;
		sensor01_vflip = <0>;
		sensor01_act_used = <1>;
		sensor01_act_name = "dw9714_act";
		sensor01_act_twi_addr = <0x18>;
		sensor02_mname = "sp5409_mipi";
		sensor02_twi_addr = <0x78>;
		sensor02_type = <1>;
		sensor02_hflip = <0>;
		sensor02_vflip = <0>;
		sensor02_act_used = <1>;
		sensor02_act_name = "dw9714_act";
		sensor02_act_twi_addr = <0x18>;
		status = "disabled";
	};

	sensor_list1:sensor_list@200b830 {
		sensor10_mname = "gc02m2_mipi";
		sensor10_twi_addr = <0x20>;
		sensor10_type = <1>;
		sensor10_hflip = <0>;
		sensor10_vflip = <0>;
		sensor10_act_used = <0>;
		sensor10_act_name = "";
		sensor10_act_twi_addr = <>;
		sensor11_mname = "ov02a10_mipi";
		sensor11_twi_addr = <0x7a>;
		sensor11_type = <1>;
		sensor11_hflip = <1>;
		sensor11_vflip = <0>;
		sensor11_act_used = <0>;
		sensor11_act_name = "";
		sensor11_act_twi_addr = <>;
		sensor12_mname = "gc030a_mipi";
		sensor12_twi_addr = <0x42>;
		sensor12_type = <1>;
		sensor12_hflip = <0>;
		sensor12_vflip = <0>;
		sensor12_act_used = <0>;
		sensor12_act_name = "";
		sensor12_act_twi_addr = <>;
		status = "disabled";
	};

	vinc00:vinc@45830000 {
		vinc0_csi_sel = <0>;
		vinc0_mipi_sel = <0>;
		vinc0_isp_sel = <0>;
		vinc0_isp_tx_ch = <0>;
		vinc0_tdm_rx_sel = <0>;
		vinc0_rear_sensor_sel = <0>;
		vinc0_front_sensor_sel = <0>;
		vinc0_sensor_list = <0>;
		work_mode = <0x0>;
		status = "okay";
	};

	vinc01:vinc@4582fffc {
		vinc1_csi_sel = <1>;
		vinc1_mipi_sel = <1>;
		vinc1_isp_sel = <1>;
		vinc1_isp_tx_ch = <0>;
		vinc1_tdm_rx_sel = <1>;
		vinc1_rear_sensor_sel = <0>;
		vinc1_front_sensor_sel = <0>;
		vinc1_sensor_list = <0>;
		status = "disabled";
	};

	vinc10:vinc@45831000 {
		vinc4_csi_sel = <0>;
		vinc4_mipi_sel = <0>;
		vinc4_isp_sel = <0>;
		vinc4_isp_tx_ch = <0>;
		vinc4_tdm_rx_sel = <0>;
		vinc4_rear_sensor_sel = <0>;
		vinc4_front_sensor_sel = <0>;
		vinc4_sensor_list = <0>;
		work_mode = <0x0>;
		status = "okay";
	};

	vinc11:vinc@45830ffc {
		vinc5_csi_sel = <1>;
		vinc5_mipi_sel = <1>;
		vinc5_isp_sel = <1>;
		vinc5_isp_tx_ch = <0>;
		vinc5_tdm_rx_sel = <1>;
		vinc5_rear_sensor_sel = <0>;
		vinc5_front_sensor_sel = <0>;
		vinc5_sensor_list = <0>;
		status = "disabled";
	};

};

&msgbox {
	status = "okay";
};

/* audio dirver module -> audio codec */

&codec {
	tx-hub-en;
	rx-sync-en;

	dac-vol	= <63>;		/* default value:63 range:0->63 */
	dacl-vol	= <160>;	/* default value:160 range:0->255 */
	adc-vol		= <160>;	/* default value:160 range:0->255 */
	lineout-gain	= <31>;		/* default value:31 range:0->31 */
	mic-gain	= <31>;		/* default value:31 range:0->31 */
	adcdelaytime	= <0>;	/* default value:0 range:0,5,10,20,30 */

	pa-pin-max	= <1>;
	pa-pin-0	= <&pio PC 15 GPIO_ACTIVE_HIGH>;
	pa-pin-level-0	= <1>;
	pa-pin-msleep-0	= <0>;

	rglt-max	= <0>;
	//rglt0-mode	= "AUDIO";
	//rglt0-voltage	= <1800000>;
	//rglt1-mode	= "PMU";
	//rglt1-voltage	= <3300000>;
	//rglt1-supply	= <&reg_dldo1>;

	status = "okay";
};

&codec_plat {
	status = "okay";
};

&codec_mach {
	status = "okay";
	soundcard-mach,cpu {
		sound-dai = <&codec_plat>;
	};
	soundcard-mach,codec {
		sound-dai = <&codec>;
	};
};

/* audio dirver module -> I2S/PCM */
&i2s0_plat {
	tdm-num		= <0>;

	/* "tx-pin"
	* 1. tx pin enable setting.
	* 2. we can set it like tx_pin = <3 0> - enable tx_pin0 and tx_pin3.
	*
	* "rx-pin"
	* 1. rx pin enable setting.
	* 2. we can set it like rx_pin = <1 2> - enable rx_pin1 and rx_pin2.
	*
	* "tx-pin-chmap"
	* 1. tx pin channel map setting.
	* 2. the subscript of value corresponds to the channel number.
	* 3. the value corresponds to slot number.
	* 4. we can use it like tx-pin1-chmap = <1 2 ... 15> to set pin1 channel map.
	* 5. if enabled the pin, but not set "tx-pin-chmap", default set <0 1 2 ...>.
	* 6. if the count of value is less than 16, then missing member will be set 0.
	*
	* rxfifo map
	* 1. "rxfifo-pinmap" - set the corresponding pin.
	* 2. "rxfifo-chmap" - set the corresponding slot.
	* 3. we can use it like rxfifo-pinmap = <0 1 2>; rxfifo-chmap = <1 2 14>; to set rxfifo map.
	* 4. the count of value of "rxfifo-pinmap" can != the count of value of "rxfifo-pinmap",
	*    then missing member would be set 0.
	*/
	tx-pin		= <0>;
	rx-pin		= <0>;
	/* tx-pin0-chmap = <0 1 5>; */
	/* rxfifo-pinmap = <0 0>; */
	/* rxfifo-chmap = <0 1>; */

	pinctrl-used;
	pinctrl-names	= "default","sleep";
	pinctrl-0	= <&i2s0_bclk_pin &i2s0_lrck_pin &i2s0_dout0_pin>;
	pinctrl-1	= <&i2s0_pins_b>;
	tx-hub-en;
	rx-sync-en;
	status		= "okay";
};

&i2s0_mach {
	soundcard-mach,format		= "i2s";
	soundcard-mach,frame-master	= <&i2s0_cpu>;
	soundcard-mach,bitclock-master	= <&i2s0_cpu>;
	/* soundcard-mach,frame-inversion; */
	/* soundcard-mach,bitclock-inversion; */
	soundcard-mach,slot-num		= <2>;
	soundcard-mach,slot-width	= <32>;
	status		= "okay";
	i2s0_cpu: soundcard-mach,cpu {
		sound-dai = <&i2s0_plat>;
		/* note: pll freq = 24.576M or 22.5792M * pll-fs */
		soundcard-mach,pll-fs	= <1>;
		/* note:
		* "mclk-fs"
		* if not defined it or equal to 0, disable mclk.
		*
		* "mclk-fp" (if defined "mclk-fs")
		* 1. if not defined "mclk-fp", mclk_freq = mclk-fs * sample_rate;
		* 2. if defined "mclk-fp" but no value, mclk_freq = mclk-fs * 11.2896M or 12.288M;
		* 3. if defined "mclk-fp" with 2 value, like: mclk-fp = <val1 val2>;
		*    it means: mclk_freq(44.1k fp) = mclk-fs * val1;
		*              mclk_freq(48k fp)   = mclk-fs * val2.
		*/
	};
	i2s0_codec: soundcard-mach,codec {
		sound-dai = <&max98357a>;
	};
};

&e907_rproc {
	firmware-name = "amp_rv0.bin";
	mboxes = <&msgbox 0>;
	mbox-names = "arm-kick";
	auto-boot;
	skip-shutdown;
	fw-region = <&e907_mem_fw>;
	memory-region = <&rv_ddr_reserved>, <&rv_vdev0buffer>, <&rv_vdev0vring0>, <&rv_vdev0vring1>, <&e907_share_irq_table>;
	fw-partitions = "riscv0", "riscv0-r";
	fw-partition-sectors = <2432>;
	memory-mappings =
	/* < DA         len             PA >    */
	/* SRAM ISP */
	< 0x2000000        0xa800        0x2000000 >,
	/* SRAM VE */
	< 0x200a800        0x17400       0x200a800 >,
	/* SRAM WIFI */
	< 0x68000000       0x1000000     0x68000000 >,
	/* DRAM */
	< 0x80000000       0x0fffffff    0x80000000 >;
	stop-record-reg = <0x4a00020c>;

	share-irq = "e907";
	status = "okay";

	rproc_wdt: rproc_wdt@0 {
		timeout_ms = <6000>;
		try_times = <1>;
		reset_type = <0x2>;
		panic_on_timeout = <1>;
		status = "okay";
	};
};
/*
*usb_port_type: usb mode: 0-device, 1-host, 2-otg.
*usb_detect_type: usb hotplug detect mode. 0-none, 1-vbus/id detect, 2-id/dpdm detect.
*usb_detect_mode: 0-thread scan, 1-id gpio interrupt.
*usb_id_gpio: gpio for id detect.
*usb_det_vbus_gpio: gpio for id detect. gpio or "axp_ctrl";
*usb_wakeup_suspend：0-SUPER_STANDBY, 1-USB_STANDBY.
*/
&usbc0 {
	device_type = "usbc0";
	usb_port_type = <0x0>;
	usb_detect_type = <0x0>;
	usb_detect_mode = <0x0>;
	//usb_id_gpio;
	//usb_det_vbus_gpio;
	//usb_det_vbus_gpio = "axp_ctrl";
	//det_vbus_supply;
	usb_regulator_io = "nocare";
	usb_wakeup_suspend = <0x0>;
	usb_luns = <0x3>;
	usb_serial_unique = <0x0>;
	usb_serial_number = "20080411";
	status = "okay";
};

&udc {
	//det_vbus_supply = <&gpio_charger>;
	status = "okay";
};

&ehci0 {
	//drvvbus-supply = <&reg_usb_vbus>;
	status = "okay";
};

&ohci0 {
	//drvvbus-supply = <&reg_usb_vbus>;
	status = "okay";
};

&gpadc0 {
	channel_num = <4>;
	channel_select = <0x3>;
	channel_data_select = <0x0>;
	channel_compare_select = <0x0>;
	channel_cld_select = <0x0>;
	channel_chd_select = <0x0>;
	channel0_compare_lowdata = <1700000>;
	channel0_compare_higdata = <1200000>;
	channel1_compare_lowdata = <460000>;
	channel1_compare_higdata = <1200000>;
	status = "okay";
};

/*----------------------------------------------------------------------------------
disp init configuration

disp_mode             (0:screen0<screen0,fb0>)
screenx_output_type   (0:none; 1:lcd; 2:tv; 3:hdmi;5:vdpo)
screenx_output_mode   (used for hdmi output, 0:480i 1:576i 2:480p 3:576p 4:720p50)
					(5:720p60 6:1080i50 7:1080i60 8:1080p24 9:1080p50 10:1080p60)
screenx_output_format (for hdmi, 0:RGB 1:yuv444 2:yuv422 3:yuv420)
screenx_output_bits   (for hdmi, 0:8bit 1:10bit 2:12bit 2:16bit)
screenx_output_eotf   (for hdmi, 0:reserve 4:SDR 16:HDR10 18:HLG)
screenx_output_cs     (for hdmi, 0:undefined  257:BT709 260:BT601  263:BT2020)
screenx_output_dvi_hdmi (for hdmi, 0:undefined 1:dvi mode 2:hdmi mode)
screen0_output_range   (for hdmi, 0:default 1:full 2:limited)
screen0_output_scan    (for hdmi, 0:no data 1:overscan 2:underscan)
screen0_output_aspect_ratio  (for hdmi, 8-same as original picture 9-4:3 10-16:9 11-14:9)
fbx format            (4:RGB655 5:RGB565 6:RGB556 7:ARGB1555 8:RGBA5551 9:RGB888 10:ARGB8888 12:ARGB4444)
fbx pixel sequence    (0:ARGB 1:BGRA 2:ABGR 3:RGBA)
fb0_scaler_mode_enable(scaler mode enable, used FE)
fbx_width,fbx_height  (framebuffer horizontal/vertical pixels, fix to output resolution while equal 0)
lcdx_backlight        (lcd init backlight,the range:[0,256],default:197
lcdx_yy               (lcd init screen bright/contrast/saturation/hue, value:0~100, default:50/50/57/50)
lcd0_contrast         (LCD contrast, 0~100)
lcd0_saturation       (LCD saturation, 0~100)
lcd0_hue              (LCD hue, 0~100)
framebuffer software rotation setting:
disp_rotation_used:   (0:disable; 1:enable,you must set fbX_width to lcd_y,
set fbX_height to lcd_x)
degreeX:              (X:screen index; 0:0 degree; 1:90 degree; 3:270 degree)
degreeX_Y:            (X:screen index; Y:layer index 0~15; 0:0 degree; 1:90 degree; 3:270 degree)
devX_output_type : config output type in bootGUI framework in UBOOT-2018.
				(0:none; 1:lcd; 2:tv; 4:hdmi;)
devX_output_mode : config output resolution(see include/video/sunxi_display2.h) of bootGUI framework in UBOOT-2018
devX_screen_id   : config display index of bootGUI framework in UBOOT-2018
devX_do_hpd      : whether do hpd detectation or not in UBOOT-2018
chn_cfg_mode     : Hardware DE channel allocation config. 0:single display with 6
				channel, 1:dual display with 4 channel in main display and 2 channel in second
				display, 2:dual display with 3 channel in main display and 3 channel in second
				in display.
----------------------------------------------------------------------------------*/
&disp {
	disp_init_enable         = <1>;
	disp_mode                = <0>;

	screen0_output_type      = <7>;
	screen0_output_mode      = <4>;
	screen0_to_lcd_index     = <0>;

	screen1_output_type      = <3>;
	screen1_output_mode      = <10>;
	screen1_to_lcd_index     = <2>;

	screen1_output_format    = <0>;
	screen1_output_bits      = <0>;
	screen1_output_eotf      = <4>;
	screen1_output_cs        = <257>;
	screen1_output_dvi_hdmi  = <2>;
	screen1_output_range     = <2>;
	screen1_output_scan      = <0>;
	screen1_output_aspect_ratio = <8>;

	fb_format                = <0>;
	fb_num                   = <1>;
	fb_debug                 = <1>;
	/*<disp channel layer zorder>*/
	fb0_map                  = <0 0 0 16>;
	fb0_width                = <320>;
	fb0_height               = <192>;
	/*<disp channel layer zorder>*/
	fb1_map                  = <0 2 0 16>;
	fb1_width                = <300>;
	fb1_height               = <300>;
	/*<disp channel layer zorder>*/
	fb2_map                  = <1 0 0 16>;
	fb2_width                = <1280>;
	fb2_height               = <720>;
	/*<disp channel layer zorder>*/
	fb3_map                  = <1 1 0 16>;
	fb3_width                = <300>;
	fb3_height               = <300>;

	chn_cfg_mode             = <1>;
	disp_para_zone           = <1>;
};

/*------------------------------------------
ircut_pin_a   : IRCUT PIN+
ircut_pin_b   : IRCUT PIN-
ircut_pin_drv : Set the driver strength for the IR cut pins
ircut_open    : Define the GPIO states for opening the IR cut <ircut_pin_a ircut_pin_b>
hold_time     : Set the hold time for the IR cut operation (in milliseconds)
--------------------------------------------*/
&ircut {
	ircut_pin_a = <&pio PD 22 GPIO_ACTIVE_HIGH>;
	ircut_pin_b = <&pio PD 23 GPIO_ACTIVE_HIGH>;
	ircut_pin_drv = <3>;
	ircut_open = <GPIO_ACTIVE_HIGH GPIO_ACTIVE_LOW>;
	hold_time = <100>;
	status = "okay";
};

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

/ {
	max98357a: max98357a {
		#sound-dai-cells = <0>;
		compatible = "maxim,max98357a";
		status = "okay";
	};
};
