Skip to content

gpiolib: GPIO line irq_set_affinity helper

Liang Hao linux-gpio lkml llvm oe-kbuild-all 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 1 replyIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2gpiolib: Add irq_set_affinity helper for GPIO line IRQsdrivers/gpio/gpiolib.c include/linux/gpio/driver.h+84 -00 replies
2/2gpio: dwapb: Use gpiolib irq_set_affinity helperdrivers/gpio/gpio-dwapb.c+1 -01 reply

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/2] gpiolib: GPIO line irq_set_affinity helper

Hi,

Several GPIO irqchips omit irq_chip->irq_set_affinity on line IRQs, so user writes to /proc/irq/<gpio-line>/smp_affinity* fail. The helper covers hierarchical domains with parent_data and chained gpio_irq_chips that use parent_handler and parent virqs without parent_data on the line.

This series adds a shared helper so drivers can expose affinity on GPIO line IRQs: the mask is applied on the parent interrupt, and the line IRQ reflects the result for proc and validation. Product init or resume scripts that restore per-line affinity depend on a line-level callback; without it those writes never reach the parent.

Patch 1 adds gpiochip_irq_set_affinity() and GPIOCHIP_IRQ_AFFINITY_HELPERS:
hierarchical lines use irq_chip_set_affinity_parent(); chained lines resolve the parent virq from gpio_irq_chip and call the parent irq_chip->irq_set_affinity() directly. Unknown parent: -EINVAL.

Patch 2 enables the macro on gpio-dwapb (snps,dw-apb-gpio, DT chained).

Tested on arm64: sysfs GPIO export + edge, write child gpiolib virq smp_affinity_list/smp_affinity — fails without the series, succeeds and reads back with it.

Thanks,
Liang Hao

Liang Hao (2):
gpiolib: Add irq_set_affinity helper for GPIO line IRQs
gpio: dwapb: Use gpiolib irq_set_affinity helper

 drivers/gpio/gpio-dwapb.c   |  1 +
 drivers/gpio/gpiolib.c      | 79 +++++++++++++++++++++++++++++++++++++
 include/linux/gpio/driver.h |  5 +++
 3 files changed, 85 insertions(+)
Signature · 1 line
2.54.0 (Apple Git-157)