Lines Matching +full:pin +full:- +full:count
1 // SPDX-License-Identifier: GPL-2.0
24 #include "gpiolib-acpi.h"
26 static int run_edge_events_on_boot = -1;
29 "Run edge _AEI event-handlers at boot: 0=no, 1=yes, -1=auto");
34 "controller@pin combos on which to ignore the ACPI wake flag "
35 "ignore_wake=controller@pin[,controller@pin[,...]]");
40 "controller@pin combos on which to ignore interrupt "
41 "ignore_interrupt=controller@pin[,controller@pin[,...]]");
50 * struct acpi_gpio_event - ACPI GPIO event handler data
52 * @node: list-entry of the events list of the struct acpi_gpio_chip
55 * @pin: GPIO pin number on the struct gpio_chip
60 * @desc: struct gpio_desc for the GPIO pin for this event
66 unsigned int pin; member
76 unsigned int pin; member
95 * struct acpi_gpio_info - ACPI GPIO specific information
99 * @pin_config: pin bias as provided by ACPI
132 if (device_match_acpi_handle(&gc->gpiodev->dev, data)) in acpi_gpiochip_find()
145 if (gc->parent) in acpi_gpiochip_find()
146 return device_match_acpi_handle(gc->parent, data); in acpi_gpiochip_find()
152 * acpi_get_gpiod() - Translate ACPI GPIO pin to GPIO descriptor usable with GPIO API
154 * @pin: ACPI GPIO pin number (0-based, controller-relative)
161 * Specifically returns %-EPROBE_DEFER if the referenced GPIO
165 static struct gpio_desc *acpi_get_gpiod(char *path, unsigned int pin) in acpi_get_gpiod() argument
172 return ERR_PTR(-ENODEV); in acpi_get_gpiod()
177 return ERR_PTR(-EPROBE_DEFER); in acpi_get_gpiod()
183 return gpio_device_get_desc(gdev, pin); in acpi_get_gpiod()
190 acpi_evaluate_object(event->handle, NULL, NULL, NULL); in acpi_gpio_irq_handler()
199 acpi_execute_simple_method(event->handle, NULL, event->pin); in acpi_gpio_irq_handler_evt()
214 if (ares->type != ACPI_RESOURCE_TYPE_GPIO) in acpi_gpio_get_irq_resource()
217 gpio = &ares->data.gpio; in acpi_gpio_get_irq_resource()
218 if (gpio->connection_type != ACPI_RESOURCE_GPIO_TYPE_INT) in acpi_gpio_get_irq_resource()
227 * acpi_gpio_get_io_resource - Fetch details of an ACPI resource if it is a GPIO
240 if (ares->type != ACPI_RESOURCE_TYPE_GPIO) in acpi_gpio_get_io_resource()
243 gpio = &ares->data.gpio; in acpi_gpio_get_io_resource()
244 if (gpio->connection_type != ACPI_RESOURCE_GPIO_TYPE_IO) in acpi_gpio_get_io_resource()
255 struct device *parent = acpi_gpio->chip->parent; in acpi_gpiochip_request_irq()
258 ret = request_threaded_irq(event->irq, NULL, event->handler, in acpi_gpiochip_request_irq()
259 event->irqflags | IRQF_ONESHOT, "ACPI:Event", event); in acpi_gpiochip_request_irq()
261 dev_err(parent, "Failed to setup interrupt handler for %d\n", event->irq); in acpi_gpiochip_request_irq()
265 if (event->irq_is_wake) in acpi_gpiochip_request_irq()
266 enable_irq_wake(event->irq); in acpi_gpiochip_request_irq()
268 event->irq_requested = true; in acpi_gpiochip_request_irq()
270 /* Make sure we trigger the initial state of edge-triggered IRQs */ in acpi_gpiochip_request_irq()
272 (event->irqflags & (IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING))) { in acpi_gpiochip_request_irq()
273 value = gpiod_get_raw_value_cansleep(event->desc); in acpi_gpiochip_request_irq()
274 if (((event->irqflags & IRQF_TRIGGER_RISING) && value == 1) || in acpi_gpiochip_request_irq()
275 ((event->irqflags & IRQF_TRIGGER_FALLING) && value == 0)) in acpi_gpiochip_request_irq()
276 event->handler(event->irq, event); in acpi_gpiochip_request_irq()
284 list_for_each_entry(event, &acpi_gpio->events, node) in acpi_gpiochip_request_irqs()
292 if (agpio->connection_type == ACPI_RESOURCE_GPIO_TYPE_INT) in acpi_gpio_to_gpiod_flags()
295 switch (agpio->io_restriction) { in acpi_gpio_to_gpiod_flags()
302 * and the polarity instead. If the pin is pulled up we assume in acpi_gpio_to_gpiod_flags()
304 * to be low, otherwise we leave pin untouched. For active low in acpi_gpio_to_gpiod_flags()
306 * Documentation/firmware-guide/acpi/gpio-properties.rst. in acpi_gpio_to_gpiod_flags()
308 switch (agpio->pin_config) { in acpi_gpio_to_gpiod_flags()
335 unsigned int pin = agpio->pin_table[index]; in acpi_request_own_gpiod() local
339 desc = gpiochip_request_own_desc(chip, pin, label, polarity, flags); in acpi_request_own_gpiod()
344 ret = gpio_set_debounce_timeout(desc, agpio->debounce_timeout * 10); in acpi_request_own_gpiod()
346 dev_warn(chip->parent, in acpi_request_own_gpiod()
347 "Failed to set debounce-timeout for pin 0x%04X, err %d\n", in acpi_request_own_gpiod()
348 pin, ret); in acpi_request_own_gpiod()
357 unsigned int pin; in acpi_gpio_in_ignore_list() local
367 len = pin_str - controller; in acpi_gpio_in_ignore_list()
370 pin = simple_strtoul(pin_str + 1, &endp, 10); in acpi_gpio_in_ignore_list()
374 if (pin == pin_in) in acpi_gpio_in_ignore_list()
392 unsigned int pin = agpio->pin_table[0]; in acpi_gpio_irq_is_wake() local
394 if (agpio->wake_capable != ACPI_WAKE_CAPABLE) in acpi_gpio_irq_is_wake()
397 if (acpi_gpio_in_ignore_list(ignore_wake, dev_name(parent), pin)) { in acpi_gpio_irq_is_wake()
398 dev_info(parent, "Ignoring wakeup on pin %u\n", pin); in acpi_gpio_irq_is_wake()
410 struct gpio_chip *chip = acpi_gpio->chip; in acpi_gpiochip_alloc_event()
416 unsigned int pin; in acpi_gpiochip_alloc_event() local
422 handle = ACPI_HANDLE(chip->parent); in acpi_gpiochip_alloc_event()
423 pin = agpio->pin_table[0]; in acpi_gpiochip_alloc_event()
425 if (pin <= 255) { in acpi_gpiochip_alloc_event()
428 agpio->triggering == ACPI_EDGE_SENSITIVE ? 'E' : 'L', in acpi_gpiochip_alloc_event()
429 pin); in acpi_gpiochip_alloc_event()
440 if (acpi_gpio_in_ignore_list(ignore_interrupt, dev_name(chip->parent), pin)) { in acpi_gpiochip_alloc_event()
441 dev_info(chip->parent, "Ignoring interrupt on pin %u\n", pin); in acpi_gpiochip_alloc_event()
447 dev_err(chip->parent, in acpi_gpiochip_alloc_event()
448 "Failed to request GPIO for pin 0x%04X, err %ld\n", in acpi_gpiochip_alloc_event()
449 pin, PTR_ERR(desc)); in acpi_gpiochip_alloc_event()
453 ret = gpiochip_lock_as_irq(chip, pin); in acpi_gpiochip_alloc_event()
455 dev_err(chip->parent, in acpi_gpiochip_alloc_event()
456 "Failed to lock GPIO pin 0x%04X as interrupt, err %d\n", in acpi_gpiochip_alloc_event()
457 pin, ret); in acpi_gpiochip_alloc_event()
463 dev_err(chip->parent, in acpi_gpiochip_alloc_event()
464 "Failed to translate GPIO pin 0x%04X to IRQ, err %d\n", in acpi_gpiochip_alloc_event()
465 pin, irq); in acpi_gpiochip_alloc_event()
473 event->irqflags = IRQF_ONESHOT; in acpi_gpiochip_alloc_event()
474 if (agpio->triggering == ACPI_LEVEL_SENSITIVE) { in acpi_gpiochip_alloc_event()
475 if (agpio->polarity == ACPI_ACTIVE_HIGH) in acpi_gpiochip_alloc_event()
476 event->irqflags |= IRQF_TRIGGER_HIGH; in acpi_gpiochip_alloc_event()
478 event->irqflags |= IRQF_TRIGGER_LOW; in acpi_gpiochip_alloc_event()
480 switch (agpio->polarity) { in acpi_gpiochip_alloc_event()
482 event->irqflags |= IRQF_TRIGGER_RISING; in acpi_gpiochip_alloc_event()
485 event->irqflags |= IRQF_TRIGGER_FALLING; in acpi_gpiochip_alloc_event()
488 event->irqflags |= IRQF_TRIGGER_RISING | in acpi_gpiochip_alloc_event()
494 event->handle = evt_handle; in acpi_gpiochip_alloc_event()
495 event->handler = handler; in acpi_gpiochip_alloc_event()
496 event->irq = irq; in acpi_gpiochip_alloc_event()
497 event->irq_is_wake = acpi_gpio_irq_is_wake(chip->parent, agpio); in acpi_gpiochip_alloc_event()
498 event->pin = pin; in acpi_gpiochip_alloc_event()
499 event->desc = desc; in acpi_gpiochip_alloc_event()
501 list_add_tail(&event->node, &acpi_gpio->events); in acpi_gpiochip_alloc_event()
506 gpiochip_unlock_as_irq(chip, pin); in acpi_gpiochip_alloc_event()
514 * acpi_gpiochip_request_interrupts() - Register isr for gpio chip ACPI events
530 if (!chip->parent || !chip->to_irq) in acpi_gpiochip_request_interrupts()
533 handle = ACPI_HANDLE(chip->parent); in acpi_gpiochip_request_interrupts()
550 list_add(&acpi_gpio->deferred_req_irqs_list_entry, in acpi_gpiochip_request_interrupts()
562 * acpi_gpiochip_free_interrupts() - Free GPIO ACPI event interrupts.
575 if (!chip->parent || !chip->to_irq) in acpi_gpiochip_free_interrupts()
578 handle = ACPI_HANDLE(chip->parent); in acpi_gpiochip_free_interrupts()
587 if (!list_empty(&acpi_gpio->deferred_req_irqs_list_entry)) in acpi_gpiochip_free_interrupts()
588 list_del_init(&acpi_gpio->deferred_req_irqs_list_entry); in acpi_gpiochip_free_interrupts()
591 list_for_each_entry_safe_reverse(event, ep, &acpi_gpio->events, node) { in acpi_gpiochip_free_interrupts()
592 if (event->irq_requested) { in acpi_gpiochip_free_interrupts()
593 if (event->irq_is_wake) in acpi_gpiochip_free_interrupts()
594 disable_irq_wake(event->irq); in acpi_gpiochip_free_interrupts()
596 free_irq(event->irq, event); in acpi_gpiochip_free_interrupts()
599 gpiochip_unlock_as_irq(chip, event->pin); in acpi_gpiochip_free_interrupts()
600 gpiochip_free_own_desc(event->desc); in acpi_gpiochip_free_interrupts()
601 list_del(&event->node); in acpi_gpiochip_free_interrupts()
611 adev->driver_gpios = gpios; in acpi_dev_add_driver_gpios()
614 return -EINVAL; in acpi_dev_add_driver_gpios()
621 adev->driver_gpios = NULL; in acpi_dev_remove_driver_gpios()
651 if (!adev || !adev->driver_gpios) in acpi_get_driver_gpio_data()
654 for (gm = adev->driver_gpios; gm->name; gm++) in acpi_get_driver_gpio_data()
655 if (!strcmp(name, gm->name) && gm->data && index < gm->size) { in acpi_get_driver_gpio_data()
656 const struct acpi_gpio_params *par = gm->data + index; in acpi_get_driver_gpio_data()
658 args->fwnode = acpi_fwnode_handle(adev); in acpi_get_driver_gpio_data()
659 args->args[0] = par->crs_entry_index; in acpi_get_driver_gpio_data()
660 args->args[1] = par->line_index; in acpi_get_driver_gpio_data()
661 args->args[2] = par->active_low; in acpi_get_driver_gpio_data()
662 args->nargs = 3; in acpi_get_driver_gpio_data()
664 *quirks = gm->quirks; in acpi_get_driver_gpio_data()
691 * Return %-EINVAL to notify that firmware has different in __acpi_gpio_update_gpiod_flags()
696 ret = -EINVAL; in __acpi_gpio_update_gpiod_flags()
705 struct device *dev = &info->adev->dev; in acpi_gpio_update_gpiod_flags()
709 ret = __acpi_gpio_update_gpiod_flags(&old, info->flags); in acpi_gpio_update_gpiod_flags()
710 if (info->quirks & ACPI_GPIO_QUIRK_NO_IO_RESTRICTION) { in acpi_gpio_update_gpiod_flags()
725 switch (info->pin_config) { in acpi_gpio_update_gpiod_lookup_flags()
739 if (info->polarity == GPIO_ACTIVE_LOW) in acpi_gpio_update_gpiod_lookup_flags()
758 if (ares->type != ACPI_RESOURCE_TYPE_GPIO) in acpi_populate_gpio_lookup()
761 if (!lookup->desc) { in acpi_populate_gpio_lookup()
762 const struct acpi_resource_gpio *agpio = &ares->data.gpio; in acpi_populate_gpio_lookup()
763 bool gpioint = agpio->connection_type == ACPI_RESOURCE_GPIO_TYPE_INT; in acpi_populate_gpio_lookup()
767 if (lookup->info.quirks & ACPI_GPIO_QUIRK_ONLY_GPIOIO && gpioint) in acpi_populate_gpio_lookup()
768 lookup->index++; in acpi_populate_gpio_lookup()
770 if (lookup->n++ != lookup->index) in acpi_populate_gpio_lookup()
773 pin_index = lookup->pin_index; in acpi_populate_gpio_lookup()
774 if (pin_index >= agpio->pin_table_length) in acpi_populate_gpio_lookup()
777 if (lookup->info.quirks & ACPI_GPIO_QUIRK_ABSOLUTE_NUMBER) in acpi_populate_gpio_lookup()
778 desc = gpio_to_desc(agpio->pin_table[pin_index]); in acpi_populate_gpio_lookup()
780 desc = acpi_get_gpiod(agpio->resource_source.string_ptr, in acpi_populate_gpio_lookup()
781 agpio->pin_table[pin_index]); in acpi_populate_gpio_lookup()
782 lookup->desc = desc; in acpi_populate_gpio_lookup()
783 lookup->info.pin_config = agpio->pin_config; in acpi_populate_gpio_lookup()
784 lookup->info.debounce = agpio->debounce_timeout; in acpi_populate_gpio_lookup()
785 lookup->info.gpioint = gpioint; in acpi_populate_gpio_lookup()
786 lookup->info.wake_capable = acpi_gpio_irq_is_wake(&lookup->info.adev->dev, agpio); in acpi_populate_gpio_lookup()
792 * - ACPI_ACTIVE_LOW == GPIO_ACTIVE_LOW in acpi_populate_gpio_lookup()
793 * - ACPI_ACTIVE_HIGH == GPIO_ACTIVE_HIGH in acpi_populate_gpio_lookup()
795 if (lookup->info.gpioint) { in acpi_populate_gpio_lookup()
796 lookup->info.polarity = agpio->polarity; in acpi_populate_gpio_lookup()
797 lookup->info.triggering = agpio->triggering; in acpi_populate_gpio_lookup()
799 lookup->info.polarity = lookup->active_low; in acpi_populate_gpio_lookup()
802 lookup->info.flags = acpi_gpio_to_gpiod_flags(agpio, lookup->info.polarity); in acpi_populate_gpio_lookup()
811 struct acpi_device *adev = lookup->info.adev; in acpi_gpio_resource_lookup()
825 if (!lookup->desc) in acpi_gpio_resource_lookup()
826 return -ENOENT; in acpi_gpio_resource_lookup()
829 *info = lookup->info; in acpi_gpio_resource_lookup()
856 return -EINVAL; in acpi_gpio_property_lookup()
858 return -EPROTO; in acpi_gpio_property_lookup()
860 lookup->index = args.args[0]; in acpi_gpio_property_lookup()
861 lookup->pin_index = args.args[1]; in acpi_gpio_property_lookup()
862 lookup->active_low = !!args.args[2]; in acpi_gpio_property_lookup()
864 lookup->info.adev = to_acpi_device_node(args.fwnode); in acpi_gpio_property_lookup()
865 lookup->info.quirks = quirks; in acpi_gpio_property_lookup()
871 * acpi_get_gpiod_by_index() - get a GPIO descriptor from device resources
891 * Note: if the GPIO resource has multiple entries in the pin list, this
906 dev_dbg(&adev->dev, "GPIO: looking up %s\n", propname); in acpi_get_gpiod_by_index()
913 dev_dbg(&adev->dev, "GPIO: _DSD returned %s %d %u %u\n", in acpi_get_gpiod_by_index()
914 dev_name(&lookup.info.adev->dev), lookup.index, in acpi_get_gpiod_by_index()
917 dev_dbg(&adev->dev, "GPIO: looking up %d in _CRS\n", index); in acpi_get_gpiod_by_index()
926 * acpi_get_gpiod_from_data() - get a GPIO descriptor from ACPI data node
932 * This function uses the property-based GPIO lookup to get to the GPIO
933 * resource with the relevant information from a data-only ACPI firmware node
950 return ERR_PTR(-ENODEV); in acpi_get_gpiod_from_data()
953 return ERR_PTR(-EINVAL); in acpi_get_gpiod_from_data()
974 if (acpi_dev_has_props(adev) || adev->driver_gpios) in acpi_can_fallback_to_crs()
996 if (PTR_ERR(desc) == -EPROBE_DEFER) in __acpi_find_gpio()
1007 return ERR_PTR(-ENOENT); in __acpi_find_gpio()
1027 dev_dbg(&adev->dev, "refusing GpioInt() entry when doing GPIOD_OUT_* lookup\n"); in acpi_find_gpio()
1028 return ERR_PTR(-ENOENT); in acpi_find_gpio()
1037 * acpi_dev_gpio_irq_wake_get_by() - Find GpioInt and translate it to Linux IRQ number
1048 * pin direction according to the flags in GpioInt resource.
1071 /* Ignore -EPROBE_DEFER, it only matters if idx matches */ in acpi_dev_gpio_irq_wake_get_by()
1073 if (IS_ERR(desc) && PTR_ERR(desc) != -EPROBE_DEFER) in acpi_dev_gpio_irq_wake_get_by()
1118 dev_dbg(&adev->dev, "IRQ %d already in use\n", irq); in acpi_dev_gpio_irq_wake_get_by()
1129 return -ENOENT; in acpi_dev_gpio_irq_wake_get_by()
1139 struct gpio_chip *chip = achip->chip; in acpi_gpio_adr_space_handler()
1147 status = acpi_buffer_to_resource(achip->conn_info.connection, in acpi_gpio_adr_space_handler()
1148 achip->conn_info.length, &ares); in acpi_gpio_adr_space_handler()
1152 if (WARN_ON(ares->type != ACPI_RESOURCE_TYPE_GPIO)) { in acpi_gpio_adr_space_handler()
1157 agpio = &ares->data.gpio; in acpi_gpio_adr_space_handler()
1159 if (WARN_ON(agpio->io_restriction == ACPI_IO_RESTRICT_INPUT && in acpi_gpio_adr_space_handler()
1165 length = min_t(u16, agpio->pin_table_length, pin_index + bits); in acpi_gpio_adr_space_handler()
1167 unsigned int pin = agpio->pin_table[i]; in acpi_gpio_adr_space_handler() local
1172 mutex_lock(&achip->conn_lock); in acpi_gpio_adr_space_handler()
1175 list_for_each_entry(conn, &achip->conns, node) { in acpi_gpio_adr_space_handler()
1176 if (conn->pin == pin) { in acpi_gpio_adr_space_handler()
1178 desc = conn->desc; in acpi_gpio_adr_space_handler()
1188 if (!found && agpio->shareable == ACPI_SHARED && in acpi_gpio_adr_space_handler()
1192 list_for_each_entry(event, &achip->events, node) { in acpi_gpio_adr_space_handler()
1193 if (event->pin == pin) { in acpi_gpio_adr_space_handler()
1194 desc = event->desc; in acpi_gpio_adr_space_handler()
1204 mutex_unlock(&achip->conn_lock); in acpi_gpio_adr_space_handler()
1212 mutex_unlock(&achip->conn_lock); in acpi_gpio_adr_space_handler()
1217 conn->pin = pin; in acpi_gpio_adr_space_handler()
1218 conn->desc = desc; in acpi_gpio_adr_space_handler()
1219 list_add_tail(&conn->node, &achip->conns); in acpi_gpio_adr_space_handler()
1222 mutex_unlock(&achip->conn_lock); in acpi_gpio_adr_space_handler()
1237 struct gpio_chip *chip = achip->chip; in acpi_gpiochip_request_regions()
1238 acpi_handle handle = ACPI_HANDLE(chip->parent); in acpi_gpiochip_request_regions()
1241 INIT_LIST_HEAD(&achip->conns); in acpi_gpiochip_request_regions()
1242 mutex_init(&achip->conn_lock); in acpi_gpiochip_request_regions()
1247 dev_err(chip->parent, in acpi_gpiochip_request_regions()
1253 struct gpio_chip *chip = achip->chip; in acpi_gpiochip_free_regions()
1254 acpi_handle handle = ACPI_HANDLE(chip->parent); in acpi_gpiochip_free_regions()
1261 dev_err(chip->parent, in acpi_gpiochip_free_regions()
1266 list_for_each_entry_safe_reverse(conn, tmp, &achip->conns, node) { in acpi_gpiochip_free_regions()
1267 gpiochip_free_own_desc(conn->desc); in acpi_gpiochip_free_regions()
1268 list_del(&conn->node); in acpi_gpiochip_free_regions()
1280 struct gpio_chip *chip = achip->chip; in acpi_gpiochip_parse_own_gpio()
1303 else if (fwnode_property_present(fwnode, "output-low")) in acpi_gpiochip_parse_own_gpio()
1305 else if (fwnode_property_present(fwnode, "output-high")) in acpi_gpiochip_parse_own_gpio()
1308 return ERR_PTR(-EINVAL); in acpi_gpiochip_parse_own_gpio()
1310 fwnode_property_read_string(fwnode, "line-name", name); in acpi_gpiochip_parse_own_gpio()
1317 struct gpio_chip *chip = achip->chip; in acpi_gpiochip_scan_gpios()
1320 device_for_each_child_node(chip->parent, fwnode) { in acpi_gpiochip_scan_gpios()
1327 if (!fwnode_property_present(fwnode, "gpio-hog")) in acpi_gpiochip_scan_gpios()
1337 dev_err(chip->parent, "Failed to hog GPIO\n"); in acpi_gpiochip_scan_gpios()
1350 if (!chip || !chip->parent) in acpi_gpiochip_add()
1353 adev = ACPI_COMPANION(chip->parent); in acpi_gpiochip_add()
1359 dev_err(chip->parent, in acpi_gpiochip_add()
1364 acpi_gpio->chip = chip; in acpi_gpiochip_add()
1365 INIT_LIST_HEAD(&acpi_gpio->events); in acpi_gpiochip_add()
1366 INIT_LIST_HEAD(&acpi_gpio->deferred_req_irqs_list_entry); in acpi_gpiochip_add()
1368 status = acpi_attach_data(adev->handle, acpi_gpio_chip_dh, acpi_gpio); in acpi_gpiochip_add()
1370 dev_err(chip->parent, "Failed to attach ACPI GPIO chip\n"); in acpi_gpiochip_add()
1386 if (!chip || !chip->parent) in acpi_gpiochip_remove()
1389 handle = ACPI_HANDLE(chip->parent); in acpi_gpiochip_remove()
1395 dev_warn(chip->parent, "Failed to retrieve ACPI GPIO chip\n"); in acpi_gpiochip_remove()
1407 const union acpi_object *element = obj->package.elements; in acpi_gpio_package_count()
1408 const union acpi_object *end = element + obj->package.count; in acpi_gpio_package_count()
1409 unsigned int count = 0; in acpi_gpio_package_count() local
1412 switch (element->type) { in acpi_gpio_package_count()
1418 count++; in acpi_gpio_package_count()
1422 return -EPROTO; in acpi_gpio_package_count()
1426 return count; in acpi_gpio_package_count()
1431 unsigned int *count = data; in acpi_find_gpio_count() local
1433 if (ares->type == ACPI_RESOURCE_TYPE_GPIO) in acpi_find_gpio_count()
1434 *count += ares->data.gpio.pin_table_length; in acpi_find_gpio_count()
1440 * acpi_gpio_count - count the GPIOs associated with a firmware node / function
1445 * The number of GPIOs associated with a firmware node / function or %-ENOENT,
1453 int count = -ENOENT; in acpi_gpio_count() local
1461 if (obj->type == ACPI_TYPE_LOCAL_REFERENCE) in acpi_gpio_count()
1462 count = 1; in acpi_gpio_count()
1463 else if (obj->type == ACPI_TYPE_PACKAGE) in acpi_gpio_count()
1464 count = acpi_gpio_package_count(obj); in acpi_gpio_count()
1465 } else if (adev->driver_gpios) { in acpi_gpio_count()
1466 for (gm = adev->driver_gpios; gm->name; gm++) in acpi_gpio_count()
1467 if (strcmp(propname, gm->name) == 0) { in acpi_gpio_count()
1468 count = gm->size; in acpi_gpio_count()
1472 if (count > 0) in acpi_gpio_count()
1477 if (count < 0) { in acpi_gpio_count()
1482 return count; in acpi_gpio_count()
1489 count = crs_count; in acpi_gpio_count()
1491 return count ? count : -ENOENT; in acpi_gpio_count()
1516 * The Minix Neo Z83-4 has a micro-USB-B id-pin handler for
1517 * a non existing micro-USB-B connector which puts the HDMI
1522 DMI_MATCH(DMI_PRODUCT_NAME, "Z83-4"),
1530 * The Terra Pad 1061 has a micro-USB-B id-pin handler, which
1531 * instead of controlling the actual micro-USB-B turns the 5V
1532 * boost for its USB-A connector off. The actual micro-USB-B
1546 * external embedded-controller connected via I2C + an ACPI GPIO
1547 * event handler on INT33FFC:02 pin 12, causing spurious wakeups.
1560 * external embedded-controller connected via I2C + an ACPI GPIO
1561 * event handler on INT33FF:01 pin 0, causing spurious wakeups.
1567 * to press the power-button to wakeup the system. The
1572 DMI_MATCH(DMI_PRODUCT_NAME, "HP x2 Detachable 10-p0XX"),
1581 * external embedded-controller connected via I2C + an ACPI GPIO
1582 * event handler on INT33FC:02 pin 28, causing spurious wakeups.
1585 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
1596 * external embedded-controller connected via I2C + an ACPI GPIO
1597 * event handler on INT33FF:01 pin 0, causing spurious wakeups.
1610 * Interrupt storm caused from edge triggered floating pin
1624 * Spurious wakeups from TP_ATTN# pin
1626 * https://gitlab.freedesktop.org/drm/amd/-/issues/1722#note_1720627
1637 * Spurious wakeups from TP_ATTN# pin
1639 * https://gitlab.freedesktop.org/drm/amd/-/issues/1722#note_1720627
1650 * Spurious wakeups from TP_ATTN# pin
1662 * On the Peaq C1010 2-in-1 INT33FC:00 pin 3 is connected to
1663 * a "dolby" button. At the ACPI level an _AEI event-handler
1668 * So instead the x86-android-tablets code instantiates
1669 * a gpio-keys platform device for it.
1670 * Ignore the _AEI handler for the pin, so that it is not busy.
1682 * Spurious wakeups from TP_ATTN# pin
1684 * https://gitlab.freedesktop.org/drm/amd/-/issues/3073
1688 DMI_MATCH(DMI_PRODUCT_NAME, "G1619-04"),
1704 quirk = id->driver_data; in acpi_gpio_setup_params()
1707 if (quirk && quirk->no_edge_events_on_boot) in acpi_gpio_setup_params()
1713 if (ignore_wake == NULL && quirk && quirk->ignore_wake) in acpi_gpio_setup_params()
1714 ignore_wake = quirk->ignore_wake; in acpi_gpio_setup_params()
1716 if (ignore_interrupt == NULL && quirk && quirk->ignore_interrupt) in acpi_gpio_setup_params()
1717 ignore_interrupt = quirk->ignore_interrupt; in acpi_gpio_setup_params()