• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 	/* GPIO used to take device out of reset or to put it into reset. */
51 	struct acpi_gpio reset_gpio;
52 	/* Delay to be inserted after device is taken out of reset. */
53 	unsigned int reset_delay_ms;
54 	/* Delay to be inserted after device is put into reset. */
55 	unsigned int reset_off_delay_ms;
56 	/* GPIO used to enable device. */
57 	struct acpi_gpio enable_gpio;
58 	/* Delay to be inserted after device is enabled. */
59 	unsigned int enable_delay_ms;
60 	/* Delay to be inserted after device is disabled. */
61 	unsigned int enable_off_delay_ms;
62 
63 	/*
64 	 * Define a GPIO that shows the privacy status of the USB device.
65 	 * E.g. On a camera: if it is one, it is recording black frames.
66 	 * E.g. On a mic: if it is one, it is recording white-noise.
67 	 */
68 	struct acpi_gpio privacy_gpio;
69 
70 	/* Write a _STA method that uses the state of the GPIOs to determine if
71 	 * the PowerResource is ON or OFF. If this is false, the _STA method
72 	 * will always return ON.
73 	 */
74 	bool use_gpio_for_status;
75 
76 	/*
77 	 * Generate _DSM method Function 5 to disable USB U1/U2 transition
78 	 * for a port
79 	 */
80 	bool usb_lpm_incapable;
81 };
82 
83 /* Method to get PLD structure from USB device */
84 bool usb_acpi_get_pld(const struct device *usb_device, struct acpi_pld *pld);
85 
86 #endif /* __USB_ACPI_CHIP_H__ */
87