mb/google/nissa/var/craask: Disable pen garage and WFC based on fw_config

BUG=b:229938024
TEST=emerge-nissa coreboot

Signed-off-by: Tyler Wang <tyler.wang@quanta.corp-partner.google.com>
Change-Id: Ib5770f02a6d524417be6723f7f70aa80d9452f62
Reviewed-on: https://review.coreboot.org/c/coreboot/+/64417
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Reka Norman <rekanorman@chromium.org>
diff --git a/src/mainboard/google/brya/variants/craask/fw_config.c b/src/mainboard/google/brya/variants/craask/fw_config.c
index ad27969..6c2d23e 100644
--- a/src/mainboard/google/brya/variants/craask/fw_config.c
+++ b/src/mainboard/google/brya/variants/craask/fw_config.c
@@ -21,6 +21,21 @@
 	PAD_NC(GPP_F12, NONE),
 };
 
+static const struct pad_config wfc_disable_pads[] = {
+	/* D3  : WCAM_RST_L */
+	PAD_NC(GPP_D3, NONE),
+	/* D15 : EN_PP2800_WCAM_X */
+	PAD_NC(GPP_D15, NONE),
+	/* D16 : EN_PP1800_PP1200_WCAM_X */
+	PAD_NC(GPP_D16, NONE),
+	/* 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),
+};
+
 static void fw_config_handle(void *unused)
 {
 	if (fw_config_probe(FW_CONFIG(DB_USB, DB_1C_LTE))) {
@@ -30,5 +45,10 @@
 		printk(BIOS_INFO, "Disable LTE-related GPIO pins on craask.\n");
 		gpio_configure_pads(lte_disable_pads, ARRAY_SIZE(lte_disable_pads));
 	}
+
+	if (fw_config_probe(FW_CONFIG(WFC, WFC_ABSENT))) {
+		printk(BIOS_INFO, "Disable MIPI WFC GPIO pins.\n");
+		gpio_configure_pads(wfc_disable_pads, ARRAY_SIZE(wfc_disable_pads));
+	}
 }
 BOOT_STATE_INIT_ENTRY(BS_DEV_ENABLE, BS_ON_ENTRY, fw_config_handle, NULL);
diff --git a/src/mainboard/google/brya/variants/craask/overridetree.cb b/src/mainboard/google/brya/variants/craask/overridetree.cb
index 997ec2d..4f2ae5d 100644
--- a/src/mainboard/google/brya/variants/craask/overridetree.cb
+++ b/src/mainboard/google/brya/variants/craask/overridetree.cb
@@ -1,8 +1,16 @@
 fw_config
 	field DB_USB 0 1
-		option DB_NONE		0
-		option DB_1C_1A		1
-		option DB_1C_LTE	2
+		option DB_NONE			0
+		option DB_1C_1A			1
+		option DB_1C_LTE		2
+	end
+	field WFC 2 3
+		option WFC_ABSENT		0
+		option WFC_MIPI_OVTI5675	1
+	end
+	field STYLUS 4
+		option STYLUS_ABSENT		0
+		option STYLUS_PRESENT		1
 	end
 end
 
@@ -36,6 +44,7 @@
 				register "cio2_prt[0]" = "1"
 				device generic 0 on end
 			end
+			probe WFC WFC_MIPI_OVTI5675
 		end
 		device ref i2c1 on
 			chip drivers/i2c/hid
@@ -66,7 +75,9 @@
 				register "key.linux_code" = "SW_PEN_INSERTED"
 				register "key.linux_input_type" = "EV_SW"
 				register "key.label" = ""pen_eject""
-				device generic 0 on end
+				device generic 0 on
+					probe STYLUS STYLUS_PRESENT
+				end
 			end
 		end
 		device ref i2c2 on
@@ -159,7 +170,9 @@
 				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_MIPI_OVTI5675
+				end
 			end
 			chip drivers/intel/mipi_camera
 				register "acpi_uid" = "3"
@@ -170,7 +183,9 @@
 				register "pr0" = ""\\_SB.PCI0.I2C2.CAM0.PRIC""
 				register "vcm_compat" = ""dongwoon,dw9714""
 
-				device i2c 0C on end
+				device i2c 0C on
+					probe WFC WFC_MIPI_OVTI5675
+				end
 			end
 			chip drivers/intel/mipi_camera
 				register "acpi_hid" = "ACPI_DT_NAMESPACE_HID"
@@ -187,7 +202,9 @@
 				register "nvm_width" = "0x10"
 				register "nvm_compat" = ""atmel,24c08""
 
-				device i2c 50 on end
+				device i2c 50 on
+					probe WFC WFC_MIPI_OVTI5675
+				end
 			end
 		end
 		device ref i2c3 on