@@ -89,6 +89,30 @@ struct acpi_gpio_chip {
8989 struct list_head deferred_req_irqs_list_entry ;
9090};
9191
92+ /**
93+ * struct acpi_gpio_info - ACPI GPIO specific information
94+ * @adev: reference to ACPI device which consumes GPIO resource
95+ * @flags: GPIO initialization flags
96+ * @gpioint: if %true this GPIO is of type GpioInt otherwise type is GpioIo
97+ * @pin_config: pin bias as provided by ACPI
98+ * @polarity: interrupt polarity as provided by ACPI
99+ * @triggering: triggering type as provided by ACPI
100+ * @wake_capable: wake capability as provided by ACPI
101+ * @debounce: debounce timeout as provided by ACPI
102+ * @quirks: Linux specific quirks as provided by struct acpi_gpio_mapping
103+ */
104+ struct acpi_gpio_info {
105+ struct acpi_device * adev ;
106+ enum gpiod_flags flags ;
107+ bool gpioint ;
108+ int pin_config ;
109+ int polarity ;
110+ int triggering ;
111+ bool wake_capable ;
112+ unsigned int debounce ;
113+ unsigned int quirks ;
114+ };
115+
92116/*
93117 * For GPIO chips which call acpi_gpiochip_request_interrupts() before late_init
94118 * (so builtin drivers) we register the ACPI GpioInt IRQ handlers from a
@@ -670,8 +694,8 @@ __acpi_gpio_update_gpiod_flags(enum gpiod_flags *flags, enum gpiod_flags update)
670694 return ret ;
671695}
672696
673- int
674- acpi_gpio_update_gpiod_flags ( enum gpiod_flags * flags , struct acpi_gpio_info * info )
697+ static int acpi_gpio_update_gpiod_flags ( enum gpiod_flags * flags ,
698+ struct acpi_gpio_info * info )
675699{
676700 struct device * dev = & info -> adev -> dev ;
677701 enum gpiod_flags old = * flags ;
@@ -690,8 +714,8 @@ acpi_gpio_update_gpiod_flags(enum gpiod_flags *flags, struct acpi_gpio_info *inf
690714 return ret ;
691715}
692716
693- int acpi_gpio_update_gpiod_lookup_flags (unsigned long * lookupflags ,
694- struct acpi_gpio_info * info )
717+ static int acpi_gpio_update_gpiod_lookup_flags (unsigned long * lookupflags ,
718+ struct acpi_gpio_info * info )
695719{
696720 switch (info -> pin_config ) {
697721 case ACPI_PIN_CONFIG_PULLUP :
@@ -1005,7 +1029,8 @@ struct gpio_desc *acpi_find_gpio(struct fwnode_handle *fwnode,
10051029 * @fwnode: pointer to an ACPI firmware node to get the GPIO information from
10061030 * @propname: Property name of the GPIO
10071031 * @index: index of GpioIo/GpioInt resource (starting from %0)
1008- * @info: info pointer to fill in (optional)
1032+ * @lflags: bitmask of gpio_lookup_flags GPIO_* values
1033+ * @dflags: gpiod initialization flags
10091034 *
10101035 * If @fwnode is an ACPI device object, call acpi_get_gpiod_by_index() for it.
10111036 * Otherwise (i.e. it is a data-only non-device object), use the property-based
@@ -1017,15 +1042,25 @@ struct gpio_desc *acpi_find_gpio(struct fwnode_handle *fwnode,
10171042 */
10181043struct gpio_desc * acpi_node_get_gpiod (struct fwnode_handle * fwnode ,
10191044 const char * propname , int index ,
1020- struct acpi_gpio_info * info )
1045+ unsigned long * lflags ,
1046+ enum gpiod_flags * dflags )
10211047{
1048+ struct acpi_gpio_info info ;
10221049 struct acpi_device * adev ;
1050+ struct gpio_desc * desc ;
10231051
10241052 adev = to_acpi_device_node (fwnode );
10251053 if (adev )
1026- return acpi_get_gpiod_by_index (adev , propname , index , info );
1054+ desc = acpi_get_gpiod_by_index (adev , propname , index , & info );
1055+ else
1056+ desc = acpi_get_gpiod_from_data (fwnode , propname , index , & info );
10271057
1028- return acpi_get_gpiod_from_data (fwnode , propname , index , info );
1058+ if (!IS_ERR (desc )) {
1059+ acpi_gpio_update_gpiod_flags (dflags , & info );
1060+ acpi_gpio_update_gpiod_lookup_flags (lflags , & info );
1061+ }
1062+
1063+ return desc ;
10291064}
10301065
10311066/**
0 commit comments