| 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | |
| 3 | #ifndef __USB_ACPI_CHIP_H__ |
| 4 | #define __USB_ACPI_CHIP_H__ |
| 5 | |
| 6 | #include <acpi/acpi_device.h> |
| 7 | #include <acpi/acpi.h> |
| 8 | #include <acpi/acpi_pld.h> |
| 9 | |
| 10 | struct drivers_usb_acpi_config { |
| 11 | const char *desc; |
| 12 | |
| 13 | /* |
| 14 | * Physical ports that are user visible |
| 15 | * |
| 16 | * UPC_TYPE_A |
| 17 | * UPC_TYPE_MINI_AB |
| 18 | * UPC_TYPE_EXPRESSCARD |
| 19 | * UPC_TYPE_USB3_A |
| 20 | * UPC_TYPE_USB3_B |
| 21 | * UPC_TYPE_USB3_MICRO_B |
| 22 | * UPC_TYPE_USB3_MICRO_AB |
| 23 | * UPC_TYPE_USB3_POWER_B |
| 24 | * UPC_TYPE_C_USB2_ONLY |
| 25 | * UPC_TYPE_C_USB2_SS_SWITCH |
| 26 | * UPC_TYPE_C_USB2_SS |
| 27 | * |
| 28 | * Non-visible ports or special devices |
| 29 | * |
| 30 | * UPC_TYPE_PROPRIETARY |
| 31 | * UPC_TYPE_INTERNAL |
| 32 | * UPC_TYPE_UNUSED |
| 33 | * UPC_TYPE_HUB |
| 34 | */ |
| 35 | enum acpi_upc_type type; |
| 36 | |
| 37 | /* Group peer ports */ |
| 38 | struct acpi_pld_group group; |
| 39 | |
| 40 | /* |
| 41 | * Define a custom physical location for the port. |
| 42 | * If enabled, this takes precedence over the 'group' field. |
| 43 | */ |
| 44 | bool use_custom_pld; |
| 45 | struct acpi_pld custom_pld; |
| 46 | |
| 47 | /* Does the device have a power resource? */ |
| 48 | bool has_power_resource; |
| 49 | |
| 50 | /* Intel Bluetooth */ |
| 51 | bool is_intel_bluetooth; |
| 52 | bool cnvi_bt_audio_offload; |
| 53 | |
| 54 | /* GPIO used to take device out of reset or to put it into reset. */ |
| 55 | struct acpi_gpio reset_gpio; |
| 56 | /* Delay to be inserted after device is taken out of reset. */ |
| 57 | unsigned int reset_delay_ms; |
| 58 | /* Delay to be inserted after device is put into reset. */ |
| 59 | unsigned int reset_off_delay_ms; |
| 60 | /* GPIO used to enable device. */ |
| 61 | struct acpi_gpio enable_gpio; |
| 62 | /* Delay to be inserted after device is enabled. */ |
| 63 | unsigned int enable_delay_ms; |
| 64 | /* Delay to be inserted after device is disabled. */ |
| 65 | unsigned int enable_off_delay_ms; |
| 66 | |
| 67 | /* |
| 68 | * Define a GPIO that shows the privacy status of the USB device. |
| 69 | * E.g. On a camera: if it is one, it is recording black frames. |
| 70 | * E.g. On a mic: if it is one, it is recording white-noise. |
| 71 | */ |
| 72 | struct acpi_gpio privacy_gpio; |
| 73 | |
| 74 | /* Write a _STA method that uses the state of the GPIOs to determine if |
| 75 | * the PowerResource is ON or OFF. If this is false, the _STA method |
| 76 | * will always return ON. |
| 77 | */ |
| 78 | bool use_gpio_for_status; |
| 79 | |
| 80 | /* |
| 81 | * Generate _DSM method Function 5 to disable USB U1/U2 transition |
| 82 | * for a port |
| 83 | */ |
| 84 | bool usb_lpm_incapable; |
| 85 | }; |
| 86 | |
| 87 | /* Method to get PLD structure from USB device */ |
| 88 | bool usb_acpi_get_pld(const struct device *usb_device, struct acpi_pld *pld); |
| 89 | |
| 90 | /* Intel Bluetooth */ |
| 91 | void acpi_device_intel_bt(const struct acpi_gpio *enable_gpio, |
| 92 | const struct acpi_gpio *reset_gpio, |
| 93 | bool audio_offload); |
| 94 | |
| 95 | void acpi_device_intel_bt_common(const struct acpi_gpio *enable_gpio, |
| 96 | const struct acpi_gpio *reset_gpio); |
| 97 | |
| 98 | #endif /* __USB_ACPI_CHIP_H__ */ |