// SPDX-License-Identifier: GPL-2.0
/*
 * SDM845 LG G7 (judyln) device tree.
 *
 * Copyright (c) 2022, The Linux Foundation. All rights reserved.
 */

/dts-v1/;

#include "sdm845-lg-common.dtsi"

/ {
	model = "LG G7 ThinQ";
	compatible = "lg,judyln", "qcom,sdm845";

	chosen {
		framebuffer {
			compatible = "simple-framebuffer";
			memory-region = <&framebuffer_mem>;
			width = <1440>;
			height = <3120>;
			stride = <(1440 * 4)>;
			format = "a8r8g8b8";
		};
	};

	/* Additional ThinQ key */
	gpio-keys {
		pinctrl-0 = <&vol_up_pin_a &thinq_key_default>;

		key-thinq {
			label = "ThinQ";
			linux,code = <KEY_ASSISTANT>;
			interrupt-parent = <&tlmm>;
			interrupts = <89 IRQ_TYPE_LEVEL_LOW>;
		};
	};

	battery: battery {
		compatible = "simple-battery";

		charge-full-design-microamp-hours = <3000000>;
		voltage-min-design-microvolt = <3200000>;
		voltage-max-design-microvolt = <4400000>;
	};
};

&adsp_pas {
	firmware-name = "qcom/sdm845/LG/judyln/adsp.mbn";
};

&bluetooth {
	/*
	 * This path is relative to the qca/
	 * subdir under lib/firmware.
	 */
	firmware-name = "judyln/crnv21.bin";
};

&cdsp_pas {
	firmware-name = "qcom/sdm845/LG/judyln/cdsp.mbn";
};

&gpu_zap_shader {
	firmware-name = "qcom/sdm845/LG/judyln/a630_zap.mbn";
};

&ipa {
	firmware-name = "qcom/sdm845/LG/judyln/ipa_fws.mbn";
};

&mdss {
	status = "okay";
};

&mdss_dsi0 {
	vdda-supply = <&vdda_mipi_dsi0_1p2>;

	status = "okay";

	display_panel: panel@0 {
		reg = <0>;
		compatible = "lg,sw49410-lh609qh1", "lg,sw49410";

		backlight = <&pmi8998_wled>;
		reset-gpios = <&tlmm 6 GPIO_ACTIVE_LOW>;
		width-mm = <65>;
		height-mm = <140>;

		vsp-supply = <&lab>;
		vsn-supply = <&ibb>;

		pinctrl-0 = <&sde_dsi_active &sde_te_active_sleep>;
		pinctrl-1 = <&sde_dsi_sleep &sde_te_active_sleep>;
		pinctrl-names = "default", "sleep";

		port {
			panel_in: endpoint {
				remote-endpoint = <&mdss_dsi0_out>;
			};
		};
	};
};

&mdss_dsi0_phy {
	vdds-supply = <&vdda_mipi_dsi0_pll>;

	status = "okay";
};

&mdss_dsi0_out {
	data-lanes = <0 1 2 3>;
	remote-endpoint = <&panel_in>;
	qcom,te-source = "mdp_vsync_e";
};

&ibb {
	regulator-min-microvolt = <5500000>;
	regulator-max-microvolt = <5500000>;
	regulator-over-current-protection;
	regulator-pull-down;
	regulator-soft-start;
	qcom,discharge-resistor-kohms = <300>;
};

&lab {
	regulator-min-microvolt = <5500000>;
	regulator-max-microvolt = <5500000>;
	regulator-over-current-protection;
	regulator-pull-down;
	regulator-soft-start;
};

&mss_pil {
	firmware-name = "qcom/sdm845/LG/judyln/mba.mbn", "qcom/sdm845/LG/judyln/modem.mbn";
};

&pmi8998_charger {
	monitored-battery = <&battery>;

	status = "okay";
};

&tlmm {
	thinq_key_default: thinq-key-default-state {
		pins = "gpio89";
		function = "gpio";

		drive-strength = <2>;
		bias-pull-up;
	};

	sde_dsi_active: sde-dsi-active-state {
		pins = "gpio6";
		function = "gpio";
		drive-strength = <8>;
		bias-disable;
	};

	sde_dsi_sleep: sde-dsi-sleep-state {
		pins = "gpio6";
		function = "gpio";
		drive-strength = <2>;
		bias-pull-down;
	};

	sde_te_active_sleep: sde-te-active-sleep-state {
		pins = "gpio10";
		function = "mdp_vsync";
		drive-strength = <2>;
		bias-pull-down;
	};
};

&venus {
	firmware-name = "qcom/sdm845/LG/judyln/venus.mbn";
};

&wifi {
	qcom,calibration-variant = "lg_judyln";
};