// SPDX-License-Identifier: GPL-2.0
/dts-v1/;

#include "tegra30-lg-x3.dtsi"

/ {
	model = "LG Optimus 4X HD";
	compatible = "lge,p880", "nvidia,tegra30";

	aliases {
		mmc1 = &sdmmc3; /* uSD slot */
	};

	pinmux@70000868 {
		state_default: pinmux {
			/* WLAN SDIO pinmux */
			host_wlan_wake {
				nvidia,pins = "pu4";
				nvidia,function = "pwm1";
				nvidia,pull = <TEGRA_PIN_PULL_NONE>;
				nvidia,tristate = <TEGRA_PIN_ENABLE>;
				nvidia,enable-input = <TEGRA_PIN_ENABLE>;
			};

			/* GNSS UART-B pinmux */
			uartb_rxd {
				nvidia,pins = "uart2_rxd_pc3";
				nvidia,function = "uartb";
				nvidia,pull = <TEGRA_PIN_PULL_NONE>;
				nvidia,tristate = <TEGRA_PIN_DISABLE>;
				nvidia,enable-input = <TEGRA_PIN_ENABLE>;
			};
			uartb_txd {
				nvidia,pins = "uart2_txd_pc2";
				nvidia,function = "uartb";
				nvidia,pull = <TEGRA_PIN_PULL_NONE>;
				nvidia,tristate = <TEGRA_PIN_DISABLE>;
				nvidia,enable-input = <TEGRA_PIN_DISABLE>;
			};
			gps_reset {
				nvidia,pins = "kb_row7_pr7";
				nvidia,function = "kbc";
				nvidia,pull = <TEGRA_PIN_PULL_UP>;
				nvidia,tristate = <TEGRA_PIN_DISABLE>;
				nvidia,enable-input = <TEGRA_PIN_DISABLE>;
			};

			/* MicroSD pinmux */
			sdmmc3_clk {
				nvidia,pins = "sdmmc3_clk_pa6";
				nvidia,function = "sdmmc3";
				nvidia,pull = <TEGRA_PIN_PULL_NONE>;
				nvidia,tristate = <TEGRA_PIN_DISABLE>;
				nvidia,enable-input = <TEGRA_PIN_ENABLE>;
			};
			sdmmc3_data {
				nvidia,pins = "sdmmc3_cmd_pa7",
						"sdmmc3_dat0_pb7",
						"sdmmc3_dat1_pb6",
						"sdmmc3_dat2_pb5",
						"sdmmc3_dat3_pb4";
				nvidia,function = "sdmmc3";
				nvidia,pull = <TEGRA_PIN_PULL_UP>;
				nvidia,tristate = <TEGRA_PIN_DISABLE>;
				nvidia,enable-input = <TEGRA_PIN_ENABLE>;
			};
			microsd_detect {
				nvidia,pins = "clk2_out_pw5";
				nvidia,function = "rsvd2";
				nvidia,pull = <TEGRA_PIN_PULL_UP>;
				nvidia,tristate = <TEGRA_PIN_DISABLE>;
				nvidia,enable-input = <TEGRA_PIN_ENABLE>;
			};

			/* GPIO keys pinmux */
			volume_up {
				nvidia,pins = "ulpi_data6_po7";
				nvidia,function = "spi2";
				nvidia,pull = <TEGRA_PIN_PULL_UP>;
				nvidia,tristate = <TEGRA_PIN_DISABLE>;
				nvidia,enable-input = <TEGRA_PIN_ENABLE>;
			};

			/* Sensors pinmux */
			current_alert_irq {
				nvidia,pins = "uart2_rts_n_pj6";
				nvidia,function = "uartb";
				nvidia,pull = <TEGRA_PIN_PULL_UP>;
				nvidia,tristate = <TEGRA_PIN_DISABLE>;
				nvidia,enable-input = <TEGRA_PIN_ENABLE>;
			};

			/* AUDIO pinmux */
			sub_mic_ldo {
				nvidia,pins = "gmi_cs7_n_pi6";
				nvidia,function = "gmi";
				nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
				nvidia,tristate = <TEGRA_PIN_DISABLE>;
				nvidia,enable-input = <TEGRA_PIN_DISABLE>;
			};
		};
	};

	spi@7000dc00 {
		bridge-spi@2 {
			/*
			 * JDI 4.57" 720x1280 DX12D100VM0EAA MIPI DSI panel
			 */
			panel@0 {
				compatible = "jdi,dx12d100vm0eaa";
				reg = <0>;

				reset-gpios = <&gpio TEGRA_GPIO(W, 0) GPIO_ACTIVE_LOW>;

				vdd-supply = <&vcc_3v0_lcd>;
				vddio-supply = <&iovcc_1v8_lcd>;

				backlight = <&backlight>;

				port {
					panel_input: endpoint {
						remote-endpoint = <&bridge_output>;
					};
				};
			};
		};
	};

	sdmmc3: mmc@78000400  {
		status = "okay";
		bus-width = <4>;

		cd-gpios = <&gpio TEGRA_GPIO(W, 5) GPIO_ACTIVE_LOW>;

		vmmc-supply = <&vdd_usd>;
		vqmmc-supply = <&vdd_1v8_vio>;
	};

	gpio-keys {
		key-volume-up {
			label = "Volume Up";
			gpios = <&gpio TEGRA_GPIO(O, 7) GPIO_ACTIVE_LOW>;
			linux,code = <KEY_UP>;
		};
	};
};
