summaryrefslogtreecommitdiff
path: root/src/ec/google/chromeec/ec_acpi.c
diff options
context:
space:
mode:
authorTim Wawrzynczak <twawrzynczak@chromium.org>2020-06-01 20:07:45 -0600
committerPatrick Georgi <pgeorgi@google.com>2020-06-08 06:41:11 +0000
commit16ef59e81ee74fdf24ea14827a5dee4d5ff42381 (patch)
tree0d179605d561533cf8fade4e4d99931498e4fdad /src/ec/google/chromeec/ec_acpi.c
parent95b4ece0fe4a0855f20bfb7bdf868c56f6b41ae6 (diff)
ec/google/chromeec: Append connector device to *-switch properties
The orientation, etc. -switch properties are supposed to use the connector device (underneath the MUX device) that belongs to the port number in question. This patch finds the CONx device and uses that to pass to the acpigen API. BUG=b:154620502 TEST=on Volteer, dump SSDT and verify the *-switch properties point to \_SB.PCI0.PNC.MUX.CON0 and CON1 Change-Id: Ie65c2d750f3d9f83285e0e4cc9642110c804bbad Signed-off-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Reviewed-on: https://review.coreboot.org/c/coreboot/+/42045 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Nick Vaccaro <nvaccaro@google.com>
Diffstat (limited to 'src/ec/google/chromeec/ec_acpi.c')
-rw-r--r--src/ec/google/chromeec/ec_acpi.c30
1 files changed, 27 insertions, 3 deletions
diff --git a/src/ec/google/chromeec/ec_acpi.c b/src/ec/google/chromeec/ec_acpi.c
index 0dbaa9c456..8c80382b18 100644
--- a/src/ec/google/chromeec/ec_acpi.c
+++ b/src/ec/google/chromeec/ec_acpi.c
@@ -124,6 +124,22 @@ static void add_port_location(struct acpi_dp *dsd, int port_number)
port_location_to_str(port_caps.port_location));
}
+static int con_id_to_match;
+
+/* A callback to match a port's connector for dev_find_matching_device_on_bus */
+static bool match_connector(DEVTREE_CONST struct device *dev)
+{
+ if (CONFIG(DRIVERS_INTEL_PMC)) {
+ extern struct chip_operations drivers_intel_pmc_mux_con_ops;
+
+ return (dev->chip_ops == &drivers_intel_pmc_mux_con_ops &&
+ dev->path.type == DEVICE_PATH_GENERIC &&
+ dev->path.generic.id == con_id_to_match);
+ }
+
+ return false;
+}
+
static void fill_ssdt_typec_device(const struct device *dev)
{
int rv;
@@ -132,6 +148,7 @@ static void fill_ssdt_typec_device(const struct device *dev)
struct device *usb3_port;
struct device *usb4_port;
const struct device *mux;
+ const struct device *con;
if (google_chromeec_get_num_pd_ports(&num_ports))
return;
@@ -147,7 +164,14 @@ static void fill_ssdt_typec_device(const struct device *dev)
if (rv)
continue;
+ /* Get the MUX device, and find the matching connector on its bus */
+ con = NULL;
mux = soc_get_pmc_mux_device(i);
+ if (mux) {
+ con_id_to_match = i;
+ con = dev_find_matching_device_on_bus(mux->link_list, match_connector);
+ }
+
usb2_port = NULL;
usb3_port = NULL;
usb4_port = NULL;
@@ -160,9 +184,9 @@ static void fill_ssdt_typec_device(const struct device *dev)
.usb2_port = usb2_port,
.usb3_port = usb3_port,
.usb4_port = usb4_port,
- .orientation_switch = mux,
- .usb_role_switch = mux,
- .mode_switch = mux,
+ .orientation_switch = con,
+ .usb_role_switch = con,
+ .mode_switch = con,
};
acpigen_write_typec_connector(&config, i, add_port_location);