ec/google/chromeec: Add property to denote mux mode switch

On some systems, the Chrome EC controls both the USB Type-C mux as well
as the retimer. Introduce a boolean property "mode-switch" to denote
switches which act as a mode-switch.

BUG=b:235834631
TEST=None
BRANCH=None

Signed-off-by: Prashant Malani <pmalani@chromium.org>
Change-Id: If209a8529ff7ec424f23fd96875ac95a1fe6267d
Reviewed-on: https://review.coreboot.org/c/coreboot/+/65116
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
diff --git a/src/ec/google/chromeec/mux/conn/chip.h b/src/ec/google/chromeec/mux/conn/chip.h
new file mode 100644
index 0000000..953b625
--- /dev/null
+++ b/src/ec/google/chromeec/mux/conn/chip.h
@@ -0,0 +1,13 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#ifndef EC_GOOGLE_CHROMEEC_MUX_CONN_CHIP_H
+#define EC_GOOGLE_CHROMEEC_MUX_CONN_CHIP_H
+
+struct ec_google_chromeec_mux_conn_config {
+	/* When set to true, this signifies that the mux device
+	 * is used as a Type-C mode switch in addition to
+	 * a retimer switch. */
+	bool mode_switch;
+};
+
+#endif /* EC_GOOGLE_CHROMEEC_MUX_CONN_CHIP_H */
diff --git a/src/ec/google/chromeec/mux/conn/conn.c b/src/ec/google/chromeec/mux/conn/conn.c
index 43f5595..cb7478a 100644
--- a/src/ec/google/chromeec/mux/conn/conn.c
+++ b/src/ec/google/chromeec/mux/conn/conn.c
@@ -2,6 +2,8 @@
 
 #include <acpi/acpigen.h>
 
+#include "chip.h"
+
 static const char *conn_acpi_name(const struct device *dev)
 {
 	static char name[5];
@@ -11,6 +13,7 @@
 
 static void conn_fill_ssdt(const struct device *dev)
 {
+	const struct ec_google_chromeec_mux_conn_config *config = dev->chip_info;
 	const char *name;
 	name = acpi_device_name(dev);
 	if (!name)
@@ -21,6 +24,12 @@
 
 	acpigen_write_name_integer("_ADR", dev->path.generic.id);
 
+	if (config && config->mode_switch) {
+		struct acpi_dp *dsd = acpi_dp_new_table("_DSD");
+		acpi_dp_add_integer(dsd, "mode-switch", 1);
+		acpi_dp_write(dsd);
+	}
+
 	acpigen_write_device_end();
 	acpigen_write_scope_end();
 }