Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'gpio-v5.5-3' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio

Pull GPIO fixes from Linus Walleij:
"Here is a host of GPIO fixes for the v5.5 series. The ACPI fix is
especially important, see summary below and in the commit for details:

- Select GPIOLIB_IRQCHIP on the max77620 GPIO expander

- Fix context restore in the Zynq driver

- Create a new ACPI quirk handler for disabling wakeups on
problematic hardware.

- Fix a coding style issue on the mockup device"

* tag 'gpio-v5.5-3' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio:
gpiolib: acpi: Add honor_wakeup module-option + quirk mechanism
gpiolib: acpi: Turn dmi_system_id table into a generic quirk table
gpio: zynq: Fix for bug in zynq_gpio_restore_context API
gpio: max77620: Add missing dependency on GPIOLIB_IRQCHIP
gpio: mockup: fix coding style

+54 -10
+1
drivers/gpio/Kconfig
··· 1148 1148 config GPIO_MAX77620 1149 1149 tristate "GPIO support for PMIC MAX77620 and MAX20024" 1150 1150 depends on MFD_MAX77620 1151 + select GPIOLIB_IRQCHIP 1151 1152 help 1152 1153 GPIO driver for MAX77620 and MAX20024 PMIC from Maxim Semiconductor. 1153 1154 MAX77620 PMIC has 8 pins that can be configured as GPIOs. The
+2 -2
drivers/gpio/gpio-mockup.c
··· 156 156 mutex_lock(&chip->lock); 157 157 158 158 if (test_bit(FLAG_REQUESTED, &desc->flags) && 159 - !test_bit(FLAG_IS_OUT, &desc->flags)) { 159 + !test_bit(FLAG_IS_OUT, &desc->flags)) { 160 160 curr = __gpio_mockup_get(chip, offset); 161 161 if (curr == value) 162 162 goto out; ··· 165 165 irq_type = irq_get_trigger_type(irq); 166 166 167 167 if ((value == 1 && (irq_type & IRQ_TYPE_EDGE_RISING)) || 168 - (value == 0 && (irq_type & IRQ_TYPE_EDGE_FALLING))) 168 + (value == 0 && (irq_type & IRQ_TYPE_EDGE_FALLING))) 169 169 irq_sim_fire(sim, offset); 170 170 } 171 171
+5 -3
drivers/gpio/gpio-zynq.c
··· 684 684 unsigned int bank_num; 685 685 686 686 for (bank_num = 0; bank_num < gpio->p_data->max_bank; bank_num++) { 687 + writel_relaxed(ZYNQ_GPIO_IXR_DISABLE_ALL, gpio->base_addr + 688 + ZYNQ_GPIO_INTDIS_OFFSET(bank_num)); 687 689 writel_relaxed(gpio->context.datalsw[bank_num], 688 690 gpio->base_addr + 689 691 ZYNQ_GPIO_DATA_LSW_OFFSET(bank_num)); ··· 695 693 writel_relaxed(gpio->context.dirm[bank_num], 696 694 gpio->base_addr + 697 695 ZYNQ_GPIO_DIRM_OFFSET(bank_num)); 698 - writel_relaxed(gpio->context.int_en[bank_num], 699 - gpio->base_addr + 700 - ZYNQ_GPIO_INTEN_OFFSET(bank_num)); 701 696 writel_relaxed(gpio->context.int_type[bank_num], 702 697 gpio->base_addr + 703 698 ZYNQ_GPIO_INTTYPE_OFFSET(bank_num)); ··· 704 705 writel_relaxed(gpio->context.int_any[bank_num], 705 706 gpio->base_addr + 706 707 ZYNQ_GPIO_INTANY_OFFSET(bank_num)); 708 + writel_relaxed(~(gpio->context.int_en[bank_num]), 709 + gpio->base_addr + 710 + ZYNQ_GPIO_INTEN_OFFSET(bank_num)); 707 711 } 708 712 } 709 713
+46 -5
drivers/gpio/gpiolib-acpi.c
··· 21 21 #include "gpiolib.h" 22 22 #include "gpiolib-acpi.h" 23 23 24 + #define QUIRK_NO_EDGE_EVENTS_ON_BOOT 0x01l 25 + #define QUIRK_NO_WAKEUP 0x02l 26 + 24 27 static int run_edge_events_on_boot = -1; 25 28 module_param(run_edge_events_on_boot, int, 0444); 26 29 MODULE_PARM_DESC(run_edge_events_on_boot, 27 30 "Run edge _AEI event-handlers at boot: 0=no, 1=yes, -1=auto"); 31 + 32 + static int honor_wakeup = -1; 33 + module_param(honor_wakeup, int, 0444); 34 + MODULE_PARM_DESC(honor_wakeup, 35 + "Honor the ACPI wake-capable flag: 0=no, 1=yes, -1=auto"); 28 36 29 37 /** 30 38 * struct acpi_gpio_event - ACPI GPIO event handler data ··· 289 281 event->handle = evt_handle; 290 282 event->handler = handler; 291 283 event->irq = irq; 292 - event->irq_is_wake = agpio->wake_capable == ACPI_WAKE_CAPABLE; 284 + event->irq_is_wake = honor_wakeup && agpio->wake_capable == ACPI_WAKE_CAPABLE; 293 285 event->pin = pin; 294 286 event->desc = desc; 295 287 ··· 1317 1309 /* We must use _sync so that this runs after the first deferred_probe run */ 1318 1310 late_initcall_sync(acpi_gpio_handle_deferred_request_irqs); 1319 1311 1320 - static const struct dmi_system_id run_edge_events_on_boot_blacklist[] = { 1312 + static const struct dmi_system_id gpiolib_acpi_quirks[] = { 1321 1313 { 1322 1314 /* 1323 1315 * The Minix Neo Z83-4 has a micro-USB-B id-pin handler for ··· 1327 1319 .matches = { 1328 1320 DMI_MATCH(DMI_SYS_VENDOR, "MINIX"), 1329 1321 DMI_MATCH(DMI_PRODUCT_NAME, "Z83-4"), 1330 - } 1322 + }, 1323 + .driver_data = (void *)QUIRK_NO_EDGE_EVENTS_ON_BOOT, 1331 1324 }, 1332 1325 { 1333 1326 /* ··· 1340 1331 .matches = { 1341 1332 DMI_MATCH(DMI_SYS_VENDOR, "Wortmann_AG"), 1342 1333 DMI_MATCH(DMI_PRODUCT_NAME, "TERRA_PAD_1061"), 1343 - } 1334 + }, 1335 + .driver_data = (void *)QUIRK_NO_EDGE_EVENTS_ON_BOOT, 1336 + }, 1337 + { 1338 + /* 1339 + * Various HP X2 10 Cherry Trail models use an external 1340 + * embedded-controller connected via I2C + an ACPI GPIO 1341 + * event handler. The embedded controller generates various 1342 + * spurious wakeup events when suspended. So disable wakeup 1343 + * for its handler (it uses the only ACPI GPIO event handler). 1344 + * This breaks wakeup when opening the lid, the user needs 1345 + * to press the power-button to wakeup the system. The 1346 + * alternative is suspend simply not working, which is worse. 1347 + */ 1348 + .matches = { 1349 + DMI_MATCH(DMI_SYS_VENDOR, "HP"), 1350 + DMI_MATCH(DMI_PRODUCT_NAME, "HP x2 Detachable 10-p0XX"), 1351 + }, 1352 + .driver_data = (void *)QUIRK_NO_WAKEUP, 1344 1353 }, 1345 1354 {} /* Terminating entry */ 1346 1355 }; 1347 1356 1348 1357 static int acpi_gpio_setup_params(void) 1349 1358 { 1359 + const struct dmi_system_id *id; 1360 + long quirks = 0; 1361 + 1362 + id = dmi_first_match(gpiolib_acpi_quirks); 1363 + if (id) 1364 + quirks = (long)id->driver_data; 1365 + 1350 1366 if (run_edge_events_on_boot < 0) { 1351 - if (dmi_check_system(run_edge_events_on_boot_blacklist)) 1367 + if (quirks & QUIRK_NO_EDGE_EVENTS_ON_BOOT) 1352 1368 run_edge_events_on_boot = 0; 1353 1369 else 1354 1370 run_edge_events_on_boot = 1; 1371 + } 1372 + 1373 + if (honor_wakeup < 0) { 1374 + if (quirks & QUIRK_NO_WAKEUP) 1375 + honor_wakeup = 0; 1376 + else 1377 + honor_wakeup = 1; 1355 1378 } 1356 1379 1357 1380 return 0;