From 52d0ec25eedc06ceff2f661544ffd6ad44369198 Mon Sep 17 00:00:00 2001 From: Ian Feng Date: Thu, 21 Jul 2022 16:28:12 +0800 Subject: mb/google/nissa/var/xivu: Disable WFC and pen garage based on fw_config Use fw_config Bit 0 and Bit 1 to control: Bit 0 = 0 --> enable WFC Bit 0 = 1 --> disable WFC Bit 1 = 0 --> enable pen garage wake Bit 1 = 1 --> disable pen garage wake BUG=b:238045498 TEST=emerge-nissa coreboot chromeos-bootimage Signed-off-by: Ian Feng Change-Id: I85bc4753bfd16fd460286aa2b3bb5f3341049f61 Reviewed-on: https://review.coreboot.org/c/coreboot/+/66043 Tested-by: build bot (Jenkins) Reviewed-by: Reka Norman --- .../google/brya/variants/xivu/Makefile.inc | 1 + .../google/brya/variants/xivu/fw_config.c | 32 ++++++++++++++++++++++ .../google/brya/variants/xivu/overridetree.cb | 25 +++++++++++++++-- 3 files changed, 55 insertions(+), 3 deletions(-) create mode 100644 src/mainboard/google/brya/variants/xivu/fw_config.c (limited to 'src/mainboard/google/brya/variants/xivu') diff --git a/src/mainboard/google/brya/variants/xivu/Makefile.inc b/src/mainboard/google/brya/variants/xivu/Makefile.inc index d38141ca24..8ae0e3b61c 100644 --- a/src/mainboard/google/brya/variants/xivu/Makefile.inc +++ b/src/mainboard/google/brya/variants/xivu/Makefile.inc @@ -3,4 +3,5 @@ bootblock-y += gpio.c romstage-y += gpio.c +ramstage-$(CONFIG_FW_CONFIG) += fw_config.c ramstage-y += gpio.c diff --git a/src/mainboard/google/brya/variants/xivu/fw_config.c b/src/mainboard/google/brya/variants/xivu/fw_config.c new file mode 100644 index 0000000000..0bf0626bdb --- /dev/null +++ b/src/mainboard/google/brya/variants/xivu/fw_config.c @@ -0,0 +1,32 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#include +#include +#include +#include +#include + +static const struct pad_config wfc_disable_pads[] = { + /* D3 : WCAM_RST_L */ + PAD_NC_LOCK(GPP_D3, NONE, LOCK_CONFIG), + /* D15 : EN_PP2800_WCAM_X */ + PAD_NC_LOCK(GPP_D15, NONE, LOCK_CONFIG), + /* D16 : EN_PP1800_PP1200_WCAM_X */ + PAD_NC_LOCK(GPP_D16, NONE, LOCK_CONFIG), + /* H22 : WCAM_MCLK_R */ + PAD_NC(GPP_H22, NONE), + /* R6 : DMIC_WCAM_CLK_R */ + PAD_NC(GPP_R6, NONE), + /* R7 : DMIC_WCAM_DATA */ + PAD_NC(GPP_R7, NONE), +}; + +void fw_config_gpio_padbased_override(struct pad_config *padbased_table) +{ + if (fw_config_probe(FW_CONFIG(WFC, WFC_ABSENT))) { + printk(BIOS_INFO, "Disable MIPI WFC GPIO pins.\n"); + gpio_padbased_override(padbased_table, wfc_disable_pads, + ARRAY_SIZE(wfc_disable_pads)); + } + +} diff --git a/src/mainboard/google/brya/variants/xivu/overridetree.cb b/src/mainboard/google/brya/variants/xivu/overridetree.cb index 9268434463..6442e35043 100644 --- a/src/mainboard/google/brya/variants/xivu/overridetree.cb +++ b/src/mainboard/google/brya/variants/xivu/overridetree.cb @@ -1,3 +1,14 @@ +fw_config + field WFC 0 + option WFC_PRESENT 0 + option WFC_ABSENT 1 + end + field STYLUS 1 + option STYLUS_PRESENT 0 + option STYLUS_ABSENT 1 + end +end + chip soc/intel/alderlake register "sagv" = "SaGv_Enabled" @@ -40,6 +51,7 @@ chip soc/intel/alderlake register "cio2_prt[0]" = "2" device generic 0 on end end + probe WFC WFC_PRESENT end device ref i2c1 on chip drivers/i2c/hid @@ -73,6 +85,7 @@ chip soc/intel/alderlake register "key.linux_input_type" = "EV_SW" register "key.label" = ""pen_eject"" device generic 0 on + probe STYLUS STYLUS_PRESENT end end end @@ -117,7 +130,9 @@ chip soc/intel/alderlake register "off_seq.ops[2]" = "SEQ_OPS_GPIO_DISABLE(1, 0)" register "off_seq.ops[3]" = "SEQ_OPS_GPIO_DISABLE(0, 0)" - device i2c 36 on end + device i2c 36 on + probe WFC WFC_PRESENT + end end chip drivers/intel/mipi_camera register "acpi_uid" = "3" @@ -128,7 +143,9 @@ chip soc/intel/alderlake register "pr0" = ""\\_SB.PCI0.I2C2.CAM0.PRIC"" register "vcm_compat" = ""dongwoon,dw9714"" - device i2c 0C on end + device i2c 0C on + probe WFC WFC_PRESENT + end end chip drivers/intel/mipi_camera register "acpi_hid" = "ACPI_DT_NAMESPACE_HID" @@ -145,7 +162,9 @@ chip soc/intel/alderlake register "nvm_width" = "0x10" register "nvm_compat" = ""atmel,24c08"" - device i2c 50 on end + device i2c 50 on + probe WFC WFC_PRESENT + end end end device ref i2c3 on -- cgit v1.2.3