From 92d96e84c4f115a5b2ffdc2a20b456170b08752a Mon Sep 17 00:00:00 2001 From: Tim Wawrzynczak Date: Tue, 19 May 2020 12:38:43 -0600 Subject: acpi: Add new file for implementing Type-C Connector class The USB Type-C Connector Class in the Linux kernel is not specific to the ChromeOS EC, so this functionality is now split out into a separate file, acpigen_usb.c. Documentation about the kernel side is available at https://www.kernel.org/doc/html/latest/driver-api/usb/typec.html. Change-Id: Ife5b8b517b261e7c0068c862ea65039c20382c5a Signed-off-by: Tim Wawrzynczak Reviewed-on: https://review.coreboot.org/c/coreboot/+/41539 Reviewed-by: Duncan Laurie Tested-by: build bot (Jenkins) --- src/include/acpi/acpigen_usb.h | 61 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 src/include/acpi/acpigen_usb.h (limited to 'src/include/acpi') diff --git a/src/include/acpi/acpigen_usb.h b/src/include/acpi/acpigen_usb.h new file mode 100644 index 0000000000..efc31f349b --- /dev/null +++ b/src/include/acpi/acpigen_usb.h @@ -0,0 +1,61 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#ifndef ACPI_ACPIGEN_USB_H +#define ACPI_ACPIGEN_USB_H + +enum usb_typec_power_role { + TYPEC_POWER_ROLE_SOURCE, + TYPEC_POWER_ROLE_SINK, + TYPEC_POWER_ROLE_DUAL, +}; + +enum usb_typec_try_power_role { + TYPEC_TRY_POWER_ROLE_NONE, + TYPEC_TRY_POWER_ROLE_SINK, + TYPEC_TRY_POWER_ROLE_SOURCE, +}; + +enum usb_typec_data_role { + TYPEC_DATA_ROLE_DFP, + TYPEC_DATA_ROLE_UFP, + TYPEC_DATA_ROLE_DUAL, +}; + +/** + * Configuration required to write out a Type-C Connector ACPI object. + * + * @power_role: DUAL if device supports being both a source and a sink, otherwise choose + * the device's default power role + * @try_power_role: SINK if device supports Try.SNK, SOURCE if device supports Try.SRC, + * otherwise choose NONE + * @data_role: Choose DUAL if device can alternate between UFP (host) & DFP (device), + * otherwise specify UFP or DFP. + * @usb2_port: Reference to the ACPI device that represents the USB2 signals + * @usb3_port: Reference to the ACPI device that represents the USB3 signals + * @usb4_port: Reference to the ACPI device that represents the USB4 signals + * @orientation_switch: Reference to the ACPI device that controls the switching of + * the orientation/polarity for Data and SBU lines. + * @usb_role_switch: Reference to the ACPI device that can select the USB role, + * host or device, for the USB port + * @mode_switch: Reference to the ACPI device that controls routing of data lines to + * various endpoints (xHCI, DP, etc.) on the SoC. + */ +struct typec_connector_class_config { + enum usb_typec_power_role power_role; + enum usb_typec_try_power_role try_power_role; + enum usb_typec_data_role data_role; + const struct device *usb2_port; + const struct device *usb3_port; + const struct device *usb4_port; + const struct device *orientation_switch; + const struct device *usb_role_switch; + const struct device *mode_switch; +}; + +typedef void (*add_custom_dsd_property_cb)(struct acpi_dp *dsd, int port_number); + +void acpigen_write_typec_connector(const struct typec_connector_class_config *config, + int port_number, + add_custom_dsd_property_cb add_custom_dsd_property); + +#endif /* ACPI_ACPIGEN_USB_H */ -- cgit v1.2.3