1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 #ifndef ACPI_ACPIGEN_USB_H
4 #define ACPI_ACPIGEN_USB_H
6 #include <acpi/acpi_pld.h>
8 enum usb_typec_power_role
{
9 TYPEC_POWER_ROLE_SOURCE
,
10 TYPEC_POWER_ROLE_SINK
,
11 TYPEC_POWER_ROLE_DUAL
,
14 enum usb_typec_try_power_role
{
15 TYPEC_TRY_POWER_ROLE_NONE
,
16 TYPEC_TRY_POWER_ROLE_SINK
,
17 TYPEC_TRY_POWER_ROLE_SOURCE
,
20 enum usb_typec_data_role
{
27 * Configuration required to write out a Type-C Connector ACPI object.
29 * @power_role: DUAL if device supports being both a source and a sink, otherwise choose
30 * the device's default power role
31 * @try_power_role: SINK if device supports Try.SNK, SOURCE if device supports Try.SRC,
32 * otherwise choose NONE
33 * @data_role: Choose DUAL if device can alternate between UFP (host) & DFP (device),
34 * otherwise specify UFP or DFP.
35 * @usb2_port: Reference to the ACPI device that represents the USB2 signals
36 * @usb3_port: Reference to the ACPI device that represents the USB3 signals
37 * @usb4_port: Reference to the ACPI device that represents the USB4 signals
38 * @orientation_switch: Reference to the ACPI device that controls the switching of
39 * the orientation/polarity for Data and SBU lines.
40 * @usb_role_switch: Reference to the ACPI device that can select the USB role,
41 * host or device, for the USB port
42 * @mode_switch: Reference to the ACPI device that controls routing of data lines to
43 * various endpoints (xHCI, DP, etc.) on the SoC.
44 * @retimer_switch: Reference to the ACPI device that controls the configuration
45 * of the retimer in the Type C signal chain.
46 * @pld: Reference to PLD information.
48 struct typec_connector_class_config
{
49 enum usb_typec_power_role power_role
;
50 enum usb_typec_try_power_role try_power_role
;
51 enum usb_typec_data_role data_role
;
52 const struct device
*usb2_port
;
53 const struct device
*usb3_port
;
54 const struct device
*usb4_port
;
55 const struct device
*orientation_switch
;
56 const struct device
*usb_role_switch
;
57 const struct device
*mode_switch
;
58 const struct device
*retimer_switch
;
59 const struct acpi_pld
*pld
;
62 typedef void (*add_custom_dsd_property_cb
)(struct acpi_dp
*dsd
, int port_number
);
64 void acpigen_write_typec_connector(const struct typec_connector_class_config
*config
,
66 add_custom_dsd_property_cb add_custom_dsd_property
);
68 #endif /* ACPI_ACPIGEN_USB_H */