Cliff Huang has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/81333?usp=email )
Change subject: mb/google/rex: Add Intel Touch for controller 1 for Rex ......................................................................
mb/google/rex: Add Intel Touch for controller 1 for Rex
GPIO pad configuration for THC1 according to CBI fw_config. ACPI entries in SSDT for ELAN according to CBI fw_config.
THC0 must be enabled when THC1 is enabled. Major rework is required for Rex P1 and P2. minor Rework is needed for EVT. Rex with THC rework won't be able to support UWB and FPCMU. The touch device must be converted to SPI interface. When THC is enabled and the THC rework is in place, the UWB and FPMCU are not supported and need to be disable from the CBI. THC0 will also be provided with ACPI entries when THC1 is enabled. THC1 GPIO pins will be configured for THC according to the CBI TOUCHSCREEN fw_config field. The resistor on the THC-SPI MISO pin should be 100 Ohm.
BUG=b:307775082
TEST=set CBI TOUCHSREEN fw_config to TOUCHSCREEN_THC, FP fw_config to FP_ABSENT, and UWB fw_config to UWB_ABSENT. boot Rex to OS and run lspci to check THC device and check that THC device driver initialization successfully. /sys/class/hidraw/hidraw0/device/input/ should have several inputs enumerated.
Signed-off-by: Cliff Huang cliff.huang@intel.com Change-Id: Id89b5b46d67b90491410d3d08c1a3ae9549b4da5 --- M src/mainboard/google/rex/Kconfig M src/mainboard/google/rex/variants/rex0/fw_config.c M src/mainboard/google/rex/variants/rex0/overridetree.cb 3 files changed, 163 insertions(+), 9 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/33/81333/1
diff --git a/src/mainboard/google/rex/Kconfig b/src/mainboard/google/rex/Kconfig index 880680a..a816ccc 100644 --- a/src/mainboard/google/rex/Kconfig +++ b/src/mainboard/google/rex/Kconfig @@ -88,6 +88,7 @@ select DRIVERS_NXP_UWB_SR1XX select DRIVERS_SOUNDWIRE_CS42L42 select DRIVERS_SOUNDWIRE_MAX98363 + select SOC_INTEL_TOUCH
config BOARD_GOOGLE_MODEL_REX_EC_ISH def_bool n diff --git a/src/mainboard/google/rex/variants/rex0/fw_config.c b/src/mainboard/google/rex/variants/rex0/fw_config.c index 60dd6bf..00f644e 100644 --- a/src/mainboard/google/rex/variants/rex0/fw_config.c +++ b/src/mainboard/google/rex/variants/rex0/fw_config.c @@ -5,6 +5,16 @@ #include <console/console.h> #include <fw_config.h> #include <gpio.h> +#include <halt.h> + +#if CONFIG(SOC_INTEL_TOUCH) +#include <soc/pci_devs.h> +#include <drivers/intel/touch/chip.h> +WEAK_DEV_PTR(touch_0_none); +WEAK_DEV_PTR(touch_1_elan); +WEAK_DEV_PTR(touch_1_generic); +const struct drivers_intel_touch_config *mainboard_get_intel_touch_config(int ctl_idx); +#endif
#define GPIO_PADBASED_OVERRIDE(b, a) gpio_padbased_override(b, a, ARRAY_SIZE(a))
@@ -130,8 +140,42 @@ PAD_CFG_GPO(GPP_B17, 0, DEEP) /* EN_WWAN_PWR */ };
+#if CONFIG(SOC_INTEL_TOUCH) +static const struct pad_config thc1_touch_pads[] = { + /* Proto1&2: With THC rework, UWB connector has been used for THC1 instead */ + // PAD_CFG_GPO_LOCK(GPP_D07, 1, LOCK_CONFIG), /* FPMCU_UWB_MUX_SEL */ + PAD_CFG_GPO(GPP_D07, 0, PWROK), /* FPMCU_UWB_MUX_SEL */ + /* GPP_C01 : [] ==> SOC_TCHSCR_RST_R_L */ + PAD_CFG_GPI(GPP_C01, NONE, DEEP), + /* GPP_C07 : [] ==> SOC_TCHSCR_INT */ + // PAD_NC(GPP_C07, NONE), + PAD_CFG_GPI(GPP_C07, NONE, DEEP), + /* GPP_F11 : NF3: THC1_SPI2_CLK NF5: GSP1_SOC_CLK_R */ + PAD_CFG_NF(GPP_F11, NONE, DEEP, NF3), + /* GPP_F12 : NF3: THC1_SPI2_IO_0 NF5: GSPI1_SOC_DO_FPMCU_DI_R */ + PAD_CFG_NF(GPP_F12, NONE, DEEP, NF3), + /* GPP_F13 : NF3: THC1_SPI2_IO_1 NF5: GSPI1_SOC_DI_FPMCU_DO_LS_R */ + PAD_CFG_NF(GPP_F13, NONE, DEEP, NF3), + /* GPP_F14 : NF3: THC1_SPI2_IO_2 NF8: GSPI0_SOC_DO_TCHSCR_DI NOTE:not used */ + PAD_NC(GPP_F14, NONE), + /* GPP_F15 : NF3: THC1_SPI2_IO_3 NF8: GSPI0_SOC_DI_TCHSCR_DO NOTE:not used */ + PAD_NC(GPP_F15, NONE), + /* GPP_F16 : NF3: THC1_SPI2_RST_B NF8: GSPI0_SOC_TCHSCR_CLK */ + /* NOTE: configure as GPO for reset pin */ + PAD_CFG_GPO(GPP_F16, 1, DEEP), + /* GPP_F17 : NF3: THC1_SPI2_CS_B NF8: GSPI1_SOC_CS_L */ + PAD_CFG_NF(GPP_F17, NONE, DEEP, NF3), + /* GPP_F18 : NF3: THC1_SPI2_INT_B NF8: GSPI0_SOC_TCHSCR_CS_L */ + PAD_CFG_NF(GPP_F18, NONE, DEEP, NF3), +}; +#endif + void fw_config_gpio_padbased_override(struct pad_config *padbased_table) { + bool fw_config_fp_absent; + bool fw_config_uwb_gspi1; + bool fw_config_thc; + if (!fw_config_is_provisioned()) { GPIO_PADBASED_OVERRIDE(padbased_table, i2s_disable_pads); GPIO_PADBASED_OVERRIDE(padbased_table, dmic_disable_pads); @@ -168,25 +212,79 @@ GPIO_PADBASED_OVERRIDE(padbased_table, ish_enable_pads); }
+ fw_config_fp_absent = fw_config_probe(FW_CONFIG(FP, FP_ABSENT)); + fw_config_uwb_gspi1 = fw_config_probe(FW_CONFIG(UWB, UWB_GSPI1)); + fw_config_thc = fw_config_probe(FW_CONFIG(TOUCHSCREEN, TOUCHSCREEN_THC)); + if (fw_config_probe(FW_CONFIG(TOUCHSCREEN, TOUCHSCREEN_I2C))) { printk(BIOS_INFO, "Configure Touchscreen Interrupt for I2C.\n"); GPIO_PADBASED_OVERRIDE(padbased_table, touchscreen_i2c_int_pads); - } else { /* SPI */ + } else if (fw_config_probe(FW_CONFIG(TOUCHSCREEN, TOUCHSCREEN_GSPI))) { printk(BIOS_INFO, "Configure Touchscreen Interrupt for SPI.\n"); GPIO_PADBASED_OVERRIDE(padbased_table, touchscreen_spi_int_pads); +#if CONFIG(SOC_INTEL_TOUCH) + } else if (fw_config_thc) { + if (fw_config_uwb_gspi1) { + printk(BIOS_ERR, "Already enabled for THC1.Cannot have UWB with gspi1! Powering off. Please check HW.\n"); + poweroff(); + } else if (!fw_config_fp_absent) { + printk(BIOS_ERR, "Already enabled for THC1.Cannot have UWB with gspi1! Powering off. Please check HW.\n"); + poweroff(); + } else { + GPIO_PADBASED_OVERRIDE(padbased_table, thc1_touch_pads); + } +#endif }
- if (fw_config_probe(FW_CONFIG(UWB, UWB_GSPI1)) && - fw_config_probe(FW_CONFIG(FP, FP_ABSENT))) { - printk(BIOS_INFO, "Configure GPIOs for UWB over GSPI1.\n"); - GPIO_PADBASED_OVERRIDE(padbased_table, uwb_gspi1_enable_pads); - } else { - printk(BIOS_INFO, "Disabling UWB (absent or misconfigured)\n"); - GPIO_PADBASED_OVERRIDE(padbased_table, uwb_gspi1_disable_pads); - } + if (!fw_config_thc) { + if (fw_config_uwb_gspi1 && fw_config_fp_absent) { + printk(BIOS_INFO, "Configure GPIOs for UWB over GSPI1.\n"); + GPIO_PADBASED_OVERRIDE(padbased_table, uwb_gspi1_enable_pads); + } else { + printk(BIOS_INFO, "Disabling UWB (absent or misconfigured)\n"); + GPIO_PADBASED_OVERRIDE(padbased_table, uwb_gspi1_disable_pads);
+ if (fw_config_uwb_gspi1 && !fw_config_fp_absent) { + /* FPMCU GPIOs is already enabled in gpio.c */ + /* GPP_E10:SOC_FPMCU_INT_L GPP_B11: EN_FP_PWR GPP_C22: FP_BOOT0 GPP_C23:SOC_FP_RST_L */ + } else { + /* FPMCU GPIOs can be disabled here */ + } + } + } if (fw_config_probe(FW_CONFIG(CELLULAR, CELLULAR_ABSENT))) { printk(BIOS_INFO, "Configure GPIOs for no cellular.\n"); GPIO_PADBASED_OVERRIDE(padbased_table, wwan_disable_pads); } } + +#if CONFIG(SOC_INTEL_TOUCH) +const struct drivers_intel_touch_config *mainboard_get_intel_touch_config(int ctl_idx) +{ + const struct drivers_intel_touch_config *touch_config = NULL; + + if (ctl_idx == 0) { + if (is_devfn_enabled(PCI_DEVFN_THC0)) { + printk(BIOS_DEBUG, "THC0 device function is enabled\n"); + /* NOTE: thc0 needs to be enabled when there is sensor connected to thc1 in Rex */ + if (fw_config_probe(FW_CONFIG(TOUCHSCREEN, TOUCHSCREEN_THC))) { + printk(BIOS_DEBUG, "THC1 uses ELAN sensor\n"); + touch_config = config_of(DEV_PTR(touch_0_none)); + } + } + } else if (ctl_idx == 1) { + + if (is_devfn_enabled(PCI_DEVFN_THC1)) { + printk(BIOS_DEBUG, "THC1 device function is enabled\n"); + if (fw_config_probe(FW_CONFIG(TOUCHSCREEN, TOUCHSCREEN_THC))) { + printk(BIOS_DEBUG, "THC1 uses ELAN sensor\n"); + touch_config = config_of(DEV_PTR(touch_1_elan)); + } + } + } else { + printk(BIOS_WARNING, "Only THC0 and THC1 are supported!\n"); + return NULL; + } + return touch_config; +} +#endif diff --git a/src/mainboard/google/rex/variants/rex0/overridetree.cb b/src/mainboard/google/rex/variants/rex0/overridetree.cb index 12068ce..410e393 100644 --- a/src/mainboard/google/rex/variants/rex0/overridetree.cb +++ b/src/mainboard/google/rex/variants/rex0/overridetree.cb @@ -30,10 +30,12 @@ option USB4_HAYDEN_BRIDGE 4 option USB4_ANX7452_V2 5 end + # THC NOTE for P1 and P2:reworked Rex will set the MUX to route to UWB connector for THC1. Use FP_ABSENT. field FP 15 option FP_PRESENT 0 option FP_ABSENT 1 end + # THC NOTE for P1 and P2:reworked Rex use UWB connector for THC1; Use UWB_ABSENT field UWB 16 17 option UWB_ABSENT 0 option UWB_BITBANG 1 @@ -78,6 +80,9 @@ # Enable HDMI in Port B register "ddi_port_B_config" = "0"
+ # THC configuration + register "thc_configuration" = "THC_CONFIG_DOUBLE_CONTROLLER" + # Enable Display Port Configuration register "ddi_ports_config" = "{ [DDI_PORT_A] = DDI_ENABLE_HPD, @@ -811,10 +816,17 @@ end probe DB_SD SD_GL9755S end + + # THC NOTE: + # gspi0 needs to be disabled for Intel HIDSPI touch. The ACPI for + # gspi touch is in: /variants/rex0/include/variant/acpi/hid_spi_elan.asl + # When THC is enabled, this ASL will need to be excluded. device ref gspi0 on probe TOUCHSCREEN TOUCHSCREEN_GSPI end device ref gspi1 on + probe FP FP_PRESENT + probe UWB UWB_GSPI1 chip drivers/spi/acpi register "name" = ""CRFP"" register "hid" = "ACPI_DT_NAMESPACE_HID" @@ -910,5 +922,48 @@ end end end + # THC NOTE: When thc1 is connected to a sensor device, thc0 also needs to be enabled. + # THC NOTE: needs SOC_INTEL_TOUCH + device ref thc0 on + probe TOUCHSCREEN TOUCHSCREEN_THC + chip drivers/intel/touch + register "name" = "INTEL_THC0_NAME" + register "mode" = "THC_HID_SPI_MODE" + register "connected_device" = "TH_SENSOR_NONE" + # register "sensor_dev_name" = "ELAN_DEV_NAME" + # register "connected_device" = "TH_SENSOR_ELAN" + device generic 0 alias touch_0_none on + # NOTE: thc0 needs to be enabled when using thc1 + probe TOUCHSCREEN TOUCHSCREEN_THC + end + end + end + device ref thc1 on + probe TOUCHSCREEN TOUCHSCREEN_THC + chip drivers/intel/touch + register "name" = "INTEL_THC1_NAME" + register "mode" = "THC_HID_SPI_MODE" + register "enable_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_HIGH(GPP_C00)" + register "enable_delay_ms" = "2" + register "enable_off_delay_ms" = "2" + register "reset_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_LOW(GPP_F16)" + register "reset_delay_ms" = "10" + register "reset_off_delay_ms" = "2" + register "rpt_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_HIGH(GPP_C06)" + # register "rpt_delay_ms" = "0" + register "rpt_off_delay_ms" = "2" + + register "wake_on_touch" = "1" + register "wake_irq" = "ACPI_IRQ_WAKE_EDGE_LOW(GPP_VGPIO3_THC1)" + + register "hidspi_flags" = "HIDSPI_WRITE_MODE_SINGLE" + register "hidspi_reset_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_LOW(GPP_F16)" + register "sensor_dev_name" = "ELAN_DEV_NAME" + register "connected_device" = "TH_SENSOR_ELAN" + device generic 0 alias touch_1_elan on + probe TOUCHSCREEN TOUCHSCREEN_THC + end + end + end end end