// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
/*
 * Google Quackingstick board device tree source
 *
 * Copyright 2021 Google LLC.
 */

/dts-v1/;

#include "sc7180-trogdor.dtsi"

/* This board only has 1 USB Type-C port. */
/delete-node/ &usb_c1;

/ {
	ppvar_lcd: ppvar-lcd-regulator {
		compatible = "regulator-fixed";
		regulator-name = "ppvar_lcd";

		gpio = <&tlmm 88 GPIO_ACTIVE_HIGH>;
		enable-active-high;
		pinctrl-names = "default";
		pinctrl-0 = <&ppvar_lcd_en>;

		vin-supply = <&pp5000_a>;
	};

	v1p8_disp: v1p8-disp-regulator {
		compatible = "regulator-fixed";
		regulator-name = "v1p8_disp";

		gpio = <&tlmm 86 GPIO_ACTIVE_HIGH>;
		enable-active-high;
		pinctrl-names = "default";
		pinctrl-0 = <&pp1800_disp_on>;

		vin-supply = <&pp3300_a>;
	};
};

&backlight {
	pwms = <&cros_ec_pwm 0>;
};

&camcc {
	status = "okay";
};

&cros_ec {
	keyboard-controller {
		compatible = "google,cros-ec-keyb-switches";
	};
};

&gpio_keys {
	status = "okay";
};

&i2c4 {
	status = "okay";
	clock-frequency = <400000>;

	ap_ts: touchscreen@10 {
		compatible = "hid-over-i2c";
		reg = <0x10>;
		pinctrl-names = "default";
		pinctrl-0 = <&ts_int_l>, <&ts_reset_l>;

		interrupt-parent = <&tlmm>;
		interrupts = <9 IRQ_TYPE_LEVEL_LOW>;

		post-power-on-delay-ms = <20>;
		hid-descr-addr = <0x0001>;

		vdd-supply = <&pp3300_ts>;
	};
};

&mdss_dsi0 {
	panel: panel@0 {
		/* Compatible will be filled in per-board */
		reg = <0>;
		enable-gpios = <&tlmm 87 GPIO_ACTIVE_HIGH>;
		pinctrl-names = "default";
		pinctrl-0 = <&lcd_rst>;
		avdd-supply = <&ppvar_lcd>;
		pp1800-supply = <&v1p8_disp>;
		pp3300-supply = <&pp3300_dx_edp>;
		backlight = <&backlight>;
		rotation = <270>;

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

	ports {
		port@1 {
			endpoint {
				remote-endpoint = <&panel_in>;
				data-lanes = <0 1 2 3>;
			};
		};
	};
};

&sdhc_2 {
	status = "okay";
};

&pp1800_uf_cam {
	status = "okay";
};

&pp1800_wf_cam {
	status = "okay";
};

&pp2800_uf_cam {
	status = "okay";
};

&pp2800_wf_cam {
	status = "okay";
};

/*
 * No eDP on this board but it's logically the same signal so just give it
 * a new name and assign the proper GPIO.
 */
pp3300_disp_on: &pp3300_dx_edp {
	gpio = <&tlmm 67 GPIO_ACTIVE_HIGH>;
};

/* PINCTRL - modifications to sc7180-trogdor.dtsi */

/*
 * No eDP on this board but it's logically the same signal so just give it
 * a new name and assign the proper GPIO.
 */

tp_en: &en_pp3300_dx_edp {
	pins = "gpio67";
};

/* PINCTRL - board-specific pinctrl */

&tlmm {
	gpio-line-names = "HUB_RST_L",
			  "AP_RAM_ID0",
			  "AP_SKU_ID2",
			  "AP_RAM_ID1",
			  "",
			  "AP_RAM_ID2",
			  "UF_CAM_EN",
			  "WF_CAM_EN",
			  "TS_RESET_L",
			  "TS_INT_L",
			  "",
			  "",
			  "AP_EDP_BKLTEN",
			  "UF_CAM_MCLK",
			  "WF_CAM_CLK",
			  "EDP_BRIJ_I2C_SDA",
			  "EDP_BRIJ_I2C_SCL",
			  "UF_CAM_SDA",
			  "UF_CAM_SCL",
			  "WF_CAM_SDA",
			  "WF_CAM_SCL",
			  "",
			  "",
			  "AMP_EN",
			  "P_SENSOR_INT_L",
			  "AP_SAR_SENSOR_SDA",
			  "AP_SAR_SENSOR_SCL",
			  "",
			  "HP_IRQ",
			  "WF_CAM_RST_L",
			  "UF_CAM_RST_L",
			  "AP_BRD_ID2",
			  "",
			  "AP_BRD_ID0",
			  "AP_H1_SPI_MISO",
			  "AP_H1_SPI_MOSI",
			  "AP_H1_SPI_CLK",
			  "AP_H1_SPI_CS_L",
			  "",
			  "",
			  "",
			  "",
			  "H1_AP_INT_ODL",
			  "",
			  "UART_AP_TX_DBG_RX",
			  "UART_DBG_TX_AP_RX",
			  "HP_I2C_SDA",
			  "HP_I2C_SCL",
			  "FORCED_USB_BOOT",
			  "",
			  "",
			  "AMP_DIN",
			  "PEN_DET_ODL",
			  "HP_BCLK",
			  "HP_LRCLK",
			  "HP_DOUT",
			  "HP_DIN",
			  "HP_MCLK",
			  "AP_SKU_ID0",
			  "AP_EC_SPI_MISO",
			  "AP_EC_SPI_MOSI",
			  "AP_EC_SPI_CLK",
			  "AP_EC_SPI_CS_L",
			  "AP_SPI_CLK",
			  "AP_SPI_MOSI",
			  "AP_SPI_MISO",
			  /*
			   * AP_FLASH_WP_L is crossystem ABI. Schematics
			   * call it BIOS_FLASH_WP_L.
			   */
			  "AP_FLASH_WP_L",
			  "EN_PP3300_DX_EDP",
			  "AP_SPI_CS0_L",
			  "SD_CD_ODL",
			  "",
			  "",
			  "",
			  "",
			  "",
			  "UIM2_DATA",
			  "UIM2_CLK",
			  "UIM2_RST",
			  "UIM2_PRESENT_L",
			  "UIM1_DATA",
			  "UIM1_CLK",
			  "UIM1_RST",
			  "",
			  "CODEC_PWR_EN",
			  "HUB_EN",
			  "",
			  "PP1800_DISP_ON",
			  "LCD_RST",
			  "PPVAR_LCD_EN",
			  "",
			  "AP_SKU_ID1",
			  "AP_RST_REQ",
			  "",
			  "AP_BRD_ID1",
			  "AP_EC_INT_L",
			  "",
			  "",
			  "",
			  "",
			  "",
			  "",
			  "",
			  "",
			  "",
			  "",
			  "",
			  "",
			  "",
			  "",
			  "",
			  "",
			  "",
			  "",
			  "",
			  "",
			  "AP_TS_I2C_SDA",
			  "AP_TS_I2C_SCL",
			  "DP_HOT_PLUG_DET",
			  "EC_IN_RW_ODL";

	lcd_rst: lcd-rst-state {
		pins = "gpio87";
		function = "gpio";
		drive-strength = <2>;
		bias-disable;
	};

	ppvar_lcd_en: ppvar-lcd-en-state {
		pins = "gpio88";
		function = "gpio";
		drive-strength = <2>;
		bias-disable;
	};

	pp1800_disp_on: pp1800-disp-on-state {
		pins = "gpio86";
		function = "gpio";
		drive-strength = <2>;
		bias-disable;
	};
};