/dts-v1/;
/plugin/;

#include <dt-bindings/gpio/gpio.h>
#include "diwali-audio-overlay.dtsi"

/ {
	model = "Qualcomm Technologies, Inc. Diwali IDP";
	compatible = "qcom,diwali-idp", "qcom,diwali", "qcom,idp";
	qcom,msm-id = <506 0x10000>, <547 0x10000>, <564 0x10000>;
	qcom,board-id = <34 0>;
	xiaomi,miboard-id = <0x9 0>;
};

&wsa_macro {
	status = "disabled";
};

&wcd938x_codec {
	qcom,cdc-micbias1-mv = <2750>;
	qcom,cdc-micbias2-mv = <2750>;
	qcom,cdc-micbias3-mv = <2750>;
	qcom,cdc-micbias4-mv = <2750>;
};

&waipio_snd {
	qcom,audio-routing = "AMIC1", "Analog Mic1",
		"AMIC1", "MIC BIAS1",
		"AMIC2", "Analog Mic2",
		"AMIC2", "MIC BIAS2",
		"AMIC3", "Analog Mic3",
		"AMIC3", "MIC BIAS3",
		"AMIC4", "Analog Mic4",
		"AMIC4", "MIC BIAS3",
		"AMIC5", "Analog Mic5",
		"AMIC5", "MIC BIAS4",
		"VA AMIC1", "Analog Mic1",
		"VA AMIC1", "VA MIC BIAS1",
		"VA AMIC2", "Analog Mic2",
		"VA AMIC2", "VA MIC BIAS2",
		"VA AMIC3", "Analog Mic3",
		"VA AMIC3", "VA MIC BIAS3",
		"VA AMIC4", "Analog Mic4",
		"VA AMIC4", "VA MIC BIAS3",
		"VA AMIC5", "Analog Mic5",
		"VA AMIC5", "VA MIC BIAS4",
		"TX DMIC0", "Digital Mic0",
		"Digital Mic0", "MIC BIAS3",
		"TX DMIC1", "Digital Mic1",
		"Digital Mic1", "MIC BIAS3",
		"TX DMIC2", "Digital Mic2",
		"Digital Mic2", "MIC BIAS1",
		"TX DMIC3", "Digital Mic3",
		"Digital Mic3", "MIC BIAS1",
		"IN1_HPHL", "HPHL_OUT",
		"IN2_HPHR", "HPHR_OUT",
		"IN3_AUX", "AUX_OUT",
		"RX_TX DEC0_INP", "TX DEC0 MUX",
		"RX_TX DEC1_INP", "TX DEC1 MUX",
		"RX_TX DEC2_INP", "TX DEC2 MUX",
		"RX_TX DEC3_INP", "TX DEC3 MUX",
		"TX SWR_INPUT", "WCD_TX_OUTPUT",
		"VA SWR_INPUT", "VA_SWR_CLK",
		"VA SWR_INPUT", "WCD_TX_OUTPUT",
		"VA_AIF1 CAP", "VA_SWR_CLK",
		"VA_AIF2 CAP", "VA_SWR_CLK",
		"VA_AIF3 CAP", "VA_SWR_CLK",
		"VA DMIC0", "Digital Mic0",
		"VA DMIC1", "Digital Mic1",
		"VA DMIC2", "Digital Mic2",
		"VA DMIC3", "Digital Mic3",
		"Digital Mic0", "VA MIC BIAS3",
		"Digital Mic1", "VA MIC BIAS3",
		"Digital Mic2", "VA MIC BIAS1",
		"Digital Mic3", "VA MIC BIAS1";
	qcom,msm-mbhc-usbc-audio-supported = <1>;
	qcom,msm-mbhc-hphl-swh = <0>;
	qcom,msm-mbhc-gnd-swh = <0>;
	qcom,wsa-max-devs = <0>;
	qcom,uart-audio-sw-gpio = <&sbu_uart_en>;
	qcom,pri-mi2s-gpios = <&pri_mi2s_pinctrl>;
	qcom,ext-disp-audio-rx = <0>;
};

&wsa_swr_gpios {
	status = "disabled";
};

&wsa2_swr_gpios {
	status = "disabled";
};

&cdc_dmic01_gpios {
	status = "disabled";
};

&cdc_dmic23_gpios {
	status = "disabled";
};

&cdc_dmic45_gpios {
	status = "disabled";
};

&cdc_dmic67_gpios {
	status = "disabled";
};

&wsa_spkr_en1 {
	status = "disabled";
};

&wsa_spkr_en2 {
	status = "disabled";
};

&soc {
	sbu_uart_en: msm_cdc_pinctrl@50 {
		compatible = "qcom,msm-cdc-pinctrl";
		pinctrl-names = "aud_active", "aud_sleep";
		pinctrl-0 = <&sbu_uart_en_active_ziyi>;
		pinctrl-1 = <&sbu_uart_en_idle_ziyi>;
		#gpio-cells = <0>;
	};
};

&tlmm {
	sbu_uart_en_idle_ziyi: uart_audio_en_idle_ziyi {
		mux {
			pins = "gpio50";
			function = "gpio";
		};

		config {
			pins = "gpio50";
			drive-strength = <2>;
			bias-pull-down;
			output-low;
		};
	};

	sbu_uart_en_active_ziyi: uart_audio_en_active_ziyi {
		mux {
			pins = "gpio50";
			function = "gpio";
		};

		config {
			pins = "gpio50";
			drive-strength = <2>;
			bias-disable;
			output-high;
		};
	};

	aw882xx_int_active: aw882xx_int_active {
		mux {
			pins = "gpio153";
			function = "gpio";
		};

		config {
			pins = "gpio153";
			drive-strength = <2>;
			bias-pull-up;
			input-enable;
		};
	};

	aw882xx_int_suspend: aw882xx_int_suspend {
		mux {
			pins = "gpio153";
			function = "gpio";
		};

		config {
			pins = "gpio153";
			drive-strength = <2>;
			bias-pull-up;
			input-enable;
		};
	};

	awinic_gpio_reset: awinic_gpio_reset {
		mux {
			pins = "gpio146";
			function = "gpio";
		};

		config {
			pins = "gpio146";
			drive-strength = <2>;
			bias-disable;
			output-low;
		};
	};

	awinic_gpio_reset_output_high: awinic_gpio_reset_output_high {
		mux {
			pins = "gpio146";
			function = "gpio";
		};

		config {
			pins = "gpio146";
			drive-strength = <2>;
			bias-disable;
			output-high;
		};
	};

	awinic_gpio_int: awinic_gpio_int {
		mux {
			pins = "gpio10";
			function = "gpio";
		};

		config {
			pins = "gpio10";
			drive-strength = <2>;
			bias-pull-up;
			input-enable;
		};
	};

	fsa4480_typec_en_idle: fsa4480_typec_en_idle {
		mux {
			pins = "gpio147";
			function = "gpio";
		};

		config {
			pins = "gpio147";
			drive-strength = <2>;
			bias-pull-down;
			output-low;
		};
	};

	fsa4480_typec_en_active: fsa4480_typec_en_active {
		mux {
			pins = "gpio147";
			function = "gpio";
		};

		config {
			pins = "gpio147";
			drive-strength = <2>;
			bias-disable;
			output-high;
		};
	};
};

&lpass_cdc {
	qcom,num-macros = <3>;
};

&spf_core_platform {
	pri_mi2s_pinctrl: pri_mi2s_pinctrl {
		compatible = "qcom,msm-cdc-pinctrl";
		pinctrl-names = "aud_active", "aud_sleep";
		pinctrl-0 = <&pri_mi2s_sck_active &pri_mi2s_ws_active &pri_mi2s_sd0_active &pri_mi2s_sd1_active>;
		pinctrl-1 = <&pri_mi2s_sck_sleep &pri_mi2s_ws_sleep &pri_mi2s_sd0_sleep &pri_mi2s_sd1_sleep>;
		#gpio-cells = <0>;
		status = "ok";
	};
};

&qupv3_se13_i2c {
	status = "ok";

	aw882xx_smartpa@35 {
		compatible = "awinic,aw882xx_smartpa";
		reg = <0x35>;
		irq-gpio = <&tlmm 153 0x2008>;
		pinctrl-names = "default", "sleep";
		pinctrl-0 = <&aw882xx_int_active>;
		pinctrl-1 = <&aw882xx_int_suspend>;
		dc-flag = <0>;
		sound-channel = <0>;
		aw-cali-mode = "aw_none";
		status = "ok";
	};
};

&qupv3_se1_i2c {
	status = "ok";

	awinic_haptic@58 {
		compatible = "awinic,awinic_haptic";
		reg = <0x5a>;
		aw8622x_i2c_addr = <0x58>;
		reset-gpio = <&tlmm 146 GPIO_ACTIVE_HIGH>;
		irq-gpio = <&tlmm 10 GPIO_ACTIVE_HIGH>;
		pinctrl-names = "awinic_reset_reset", "awinic_reset_active", "awinic_interrupt_active";
		pinctrl-0 = <&awinic_gpio_reset>;
		pinctrl-1 = <&awinic_gpio_reset_output_high>;
		pinctrl-2 = <&awinic_gpio_int>;
		aw8624_vib_f0_pre = <2050>;
		aw8624_vib_f0_cali_percen = <7>;
		aw8624_vib_cont_drv_lev = <106>;
		aw8624_vib_cont_drv_lvl_ov = <155>;
		aw8624_vib_cont_td = <0xf06c>;
		aw8624_vib_cont_zc_thr = <0x08f8>;
		aw8624_vib_cont_num_brk = <3>;
		aw8624_vib_f0_coeff = <260>;
		aw8624_vib_duration_time = <0x0f 0x3c 0 0 0>;
		aw8624_vib_brake_ram_config = <0x01 0x01 0x5a 0x3c 0x14 0x03 0x01 0x03 0x01 0x01 0x5a 0x3c 0x1e 0x05 0x01 0x03 0x00 0x00 0x32 0x28 0x19 0x00 0x05 0x03>;
		aw8624_vib_brake_cont_config = <0x01 0x01 0x5a 0x2a 0x14 0x05 0x02 0x02 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00>;
		aw8624_vib_f0_trace_parameter = <9 5 1 15>;
		aw8624_vib_bemf_config = <0 0x08 0x03 0xf8 >;
		aw8624_vib_sw_brake = <0x2c>;
		aw8624_vib_wavseq = <0 1 1 2 0 0 0 0 0 0 0 0 0 0 0 0>;
		aw8624_vib_wavloop = <0 6 1 15 0 0 0 0 0 0>;
		aw8624_vib_td_brake = <0xa6e0 0xa6e0 0xa6e0>;
		aw8624_vib_tset = <17>;
		aw8624_vib_func_parameter1 = <1>;
		aw8624_vib_gain_flag = <1>;
		aw8624_vib_r_spare = <0x68>;
		aw8624_vib_bstdbg = <0x30 0xeb 0xd4 0 0 0>;
		aw8622x_vib_mode = <0>;
		aw8622x_vib_f0_pre = <0x802>;
		aw8622x_vib_f0_cali_percen = <7>;
		aw8622x_vib_cont_drv1_lvl = <127>;
		aw8622x_vib_cont_drv2_lvl = <54>;
		aw8622x_vib_cont_brk_time = <6>;
		aw8622x_vib_cont_tset = <6>;
		aw8622x_vib_cont_bemf_set = <2>;
		aw8622x_vib_cont_drv_width = <106>;
		aw8622x_vib_cont_wait_num = <6>;
		aw8622x_vib_cont_brk_gain = <8>;
		aw8622x_vib_cont_drv1_time = <4>;
		aw8622x_vib_cont_drv2_time = <20>;
		aw8622x_vib_cont_track_margin = <18>;
		aw8622x_vib_sine_array = <0x05 0xb2 0xff 0xef>;
		aw8622x_vib_d2s_gain = <5>;
		aw8622x_vib_prctmode = <0x2d 0x3e 0x3f>;
		vib_effect_id_boundary = <10>;
		vib_effect_max = <193>;
		vib_rtp_time = <20 20 20 20 40 20 20 20 20 20
				20 20 20 20 20 20 20 20 20 20 20
				24058 11520 14770 40341 22060 16745 15166 10590 17260 16923
				16000 9920 14420 12000 18000 7860 19400 12600 31992 18581
				30093 39836 19500 8530 9692 2000 16820 18782 14223 1034
				1161  2096 874 1606 795 1788 859 1260 1668 2254
				1852 5126 1931 1204 890 1803 1822 1325 2607 1015
				890 208 676 679 850 357 380 1140 457 1176
				1400 328 1500 100 150 100 341 100 249 704
				100 1000 479 100 1 1089 1 2103 23181 1
				620 100 466 178 1 100 785 124 140 414
				97 39 462 165 152 295 1 64 4088 965
				931 308 3584 4583 4289 100 70 1 1656 89
				56 76 56 51 681 1 36 1 1
				83 129 216 87 128 215 227 534 312 90
				299 1109 686 395 10500 5648 6708 618 749 701
				814 2610 200 200 300 200 200 300 200 200
				300 516 286 200 200 200 400 1200 200 400
				200 200 350 200 400 250 300 200 250 200
				300 600 23200 1 1 1 1 1 1 1>;
		status = "okay";

		wf_0 {
			/*CLICK*/
			qcom,effect-id = <0>;
			qcom,wf-vmax-mv = <3600>;
			qcom,wf-pattern = [3e 3e];
			qcom,wf-brake-pattern = [02 01 00 00];
			qcom,wf-play-rate-us = <20000>;
		};

		wf_1 {
			/*DOUBLE CLICK*/
			qcom,effect-id = <1>;
			qcom,wf-vmax-mv = <3600>;
			qcom,wf-pattern = [7e 3e];
			qcom,wf-brake-pattern = [03 01 00 00];
			qcom,wf-play-rate-us = <20000>;
		};

		wf_2 {
			/*TICK*/
			qcom,effect-id = <2>;
			qcom,wf-vmax-mv = <3600>;
			qcom,wf-pattern = [7e 3e];
			qcom,wf-brake-pattern = [02 01 00 00];
			qcom,wf-play-rate-us = <20000>;
		};

		wf_3 {
			/*THUD*/
			qcom,effect-id = <3>;
			qcom,wf-vmax-mv = <3600>;
			qcom,wf-pattern = [3e 3e];
			qcom,wf-brake-pattern = [02 01 00 00];
			qcom,wf-play-rate-us = <20000>;
		};

		wf_4 {
			/*POP*/
			qcom,effect-id = <4>;
			qcom,wf-vmax-mv = <3600>;
			qcom,wf-pattern = [3e 3e];
			qcom,wf-brake-pattern = [02 01 00 00];
			qcom,wf-play-rate-us = <28000>;
		};

		wf_5 {
			/*HEAVY CLICK*/
			qcom,effect-id = <5>;
			qcom,wf-vmax-mv = <3600>;
			qcom,wf-pattern = [7e 7e 7e];
			qcom,wf-brake-pattern = [03 03 01 00];
			qcom,wf-play-rate-us = <20000>;
		};

		wf_6 {
			/*id 6*/
			qcom,effect-id = <6>;
			qcom,wf-vmax-mv = <3600>;
			qcom,wf-pattern = [3e 3e];
			qcom,wf-brake-pattern = [02 01 00 00];
			qcom,wf-play-rate-us = <20000>;
		};

		wf_7 {
			/*id 7*/
			qcom,effect-id = <7>;
			qcom,wf-vmax-mv = <3600>;
			qcom,wf-pattern = [3e 3e];
			qcom,wf-brake-pattern = [02 01 00 00];
			qcom,wf-play-rate-us = <20000>;
		};

		wf_8 {
			/*id 8*/
			qcom,effect-id = <8>;
			qcom,wf-vmax-mv = <3600>;
			qcom,wf-pattern = [3e 3e];
			qcom,wf-brake-pattern = [02 01 00 00];
			qcom,wf-play-rate-us = <20000>;
		};

		wf_9 {
			/*id 9*/
			qcom,effect-id = <9>;
			qcom,wf-vmax-mv = <3600>;
			qcom,wf-pattern = [3e 3e];
			qcom,wf-brake-pattern = [02 01 00 00];
			qcom,wf-play-rate-us = <20000>;
		};
	};
};

&fsa4480 {
	fsatypec-gpios = <&tlmm 147 GPIO_ACTIVE_HIGH>;
	pinctrl-names = "default", "sleep";
	pinctrl-0 = <&fsa4480_typec_en_active>;
	pinctrl-1 = <&fsa4480_typec_en_idle>;
};
