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>
This commit is contained in:
Prashant Malani 2022-06-13 21:51:52 +00:00 committed by Felix Held
parent e1e762716c
commit 1e0d2e051b
2 changed files with 22 additions and 0 deletions

View File

@ -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 */

View File

@ -2,6 +2,8 @@
#include <acpi/acpigen.h> #include <acpi/acpigen.h>
#include "chip.h"
static const char *conn_acpi_name(const struct device *dev) static const char *conn_acpi_name(const struct device *dev)
{ {
static char name[5]; static char name[5];
@ -11,6 +13,7 @@ static const char *conn_acpi_name(const struct device *dev)
static void conn_fill_ssdt(const struct device *dev) static void conn_fill_ssdt(const struct device *dev)
{ {
const struct ec_google_chromeec_mux_conn_config *config = dev->chip_info;
const char *name; const char *name;
name = acpi_device_name(dev); name = acpi_device_name(dev);
if (!name) if (!name)
@ -21,6 +24,12 @@ static void conn_fill_ssdt(const struct device *dev)
acpigen_write_name_integer("_ADR", dev->path.generic.id); 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_device_end();
acpigen_write_scope_end(); acpigen_write_scope_end();
} }