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

/* This file must be included after sc7180-trogdor.dtsi */
#include <arm/cros-ec-keyboard.dtsi>

&ap_sar_sensor {
	compatible = "semtech,sx9324";
	semtech,ph0-pin = <1 3 3>;
	semtech,ph1-pin = <3 1 3>;
	semtech,ph2-pin = <1 3 3>;
	semtech,ph3-pin = <0 0 0>;
	semtech,ph01-resolution = <1024>;
	semtech,ph23-resolution = <1024>;
	semtech,startup-sensor = <1>;
	semtech,ph01-proxraw-strength = <3>;
	semtech,ph23-proxraw-strength = <1>;
	semtech,avg-pos-strength = <128>;
	semtech,input-analog-gain = <0>;
	semtech,cs-idle-sleep = "gnd";

	/delete-property/ svdd-supply;
	vdd-supply = <&pp1800_prox>;
};

/delete-node/&trackpad;
&ap_tp_i2c {
	status = "okay";
	trackpad: trackpad@15 {
		compatible = "hid-over-i2c";
		reg = <0x15>;
		pinctrl-names = "default";
		pinctrl-0 = <&tp_int_odl>;

		interrupt-parent = <&tlmm>;
		interrupts = <0 IRQ_TYPE_EDGE_FALLING>;

		vdd-supply = <&pp3300_fp_tp>;
		post-power-on-delay-ms = <100>;
		hid-descr-addr = <0x0001>;

		wakeup-source;
	};
};

&keyboard_controller {
	function-row-physmap = <
		MATRIX_KEY(0x00, 0x02, 0)	/* T1 */
		MATRIX_KEY(0x03, 0x02, 0)	/* T2 */
		MATRIX_KEY(0x02, 0x02, 0)	/* T3 */
		MATRIX_KEY(0x01, 0x02, 0)	/* T4 */
		MATRIX_KEY(0x03, 0x04, 0)	/* T5 */
		MATRIX_KEY(0x02, 0x04, 0)	/* T6 */
		MATRIX_KEY(0x01, 0x04, 0)	/* T7 */
		MATRIX_KEY(0x02, 0x09, 0)	/* T8 */
		MATRIX_KEY(0x01, 0x09, 0)	/* T9 */
		MATRIX_KEY(0x00, 0x04, 0)	/* T10 */
	>;
	linux,keymap = <
		MATRIX_KEY(0x00, 0x02, KEY_BACK)
		MATRIX_KEY(0x03, 0x02, KEY_REFRESH)
		MATRIX_KEY(0x02, 0x02, KEY_ZOOM)
		MATRIX_KEY(0x01, 0x02, KEY_SCALE)
		MATRIX_KEY(0x03, 0x04, KEY_SYSRQ)
		MATRIX_KEY(0x02, 0x04, KEY_BRIGHTNESSDOWN)
		MATRIX_KEY(0x01, 0x04, KEY_BRIGHTNESSUP)
		MATRIX_KEY(0x02, 0x09, KEY_MUTE)
		MATRIX_KEY(0x01, 0x09, KEY_VOLUMEDOWN)
		MATRIX_KEY(0x00, 0x04, KEY_VOLUMEUP)
		CROS_STD_MAIN_KEYMAP
	>;
};

&panel {
	compatible = "edp-panel";
};

&pp3300_dx_edp {
	gpio = <&tlmm 67 GPIO_ACTIVE_HIGH>;
};

&en_pp3300_dx_edp {
	pins = "gpio67";
};

/* PINCTRL - board-specific pinctrl */

&tlmm {
	gpio-line-names = "TP_INT_ODL",
			  "AP_RAM_ID0",
			  "AP_SKU_ID2",
			  "AP_RAM_ID1",
			  "",
			  "AP_RAM_ID2",
			  "AP_TP_I2C_SDA",
			  "AP_TP_I2C_SCL",
			  "TS_RESET_L",
			  "TS_INT_L",
			  "",
			  "EDP_BRIJ_IRQ",
			  "AP_EDP_BKLTEN",
			  "",
			  "",
			  "EDP_BRIJ_I2C_SDA",
			  "EDP_BRIJ_I2C_SCL",
			  "HUB_RST_L",
			  "",
			  "",
			  "",
			  "",
			  "",
			  "AMP_EN",
			  "P_SENSOR_INT_L",
			  "AP_SAR_SENSOR_SDA",
			  "AP_SAR_SENSOR_SCL",
			  "",
			  "HP_IRQ",
			  "",
			  "",
			  "AP_BRD_ID2",
			  "BRIJ_SUSPEND",
			  "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_BCLK",
			  "AMP_LRCLK",
			  "AMP_DIN",
			  "",
			  "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",
			  "",
			  "",
			  "",
			  "",
			  "",
			  "",
			  "UIM2_DATA",
			  "UIM2_CLK",
			  "UIM2_RST",
			  "UIM2_PRESENT",
			  "UIM1_DATA",
			  "UIM1_CLK",
			  "UIM1_RST",
			  "",
			  "CODEC_PWR_EN",
			  "HUB_EN",
			  "",
			  "",
			  "",
			  "",
			  "",
			  "AP_SKU_ID1",
			  "AP_RST_REQ",
			  "",
			  "AP_BRD_ID1",
			  "AP_EC_INT_L",
			  "",
			  "",
			  "",
			  "",
			  "",
			  "",
			  "",
			  "",
			  "",
			  "EDP_BRIJ_EN",
			  "",
			  "",
			  "",
			  "",
			  "",
			  "",
			  "",
			  "",
			  "",
			  "",
			  "AP_TS_PEN_I2C_SDA",
			  "AP_TS_PEN_I2C_SCL",
			  "DP_HOT_PLUG_DET",
			  "EC_IN_RW_ODL";
};