Skip to content

pinctrl: rp1: Make IRQ usage set a pin to an input - #7526

Merged
pelwell merged 1 commit into
raspberrypi:rpi-6.18.yfrom
pelwell:is7520
Jul 29, 2026
Merged

pinctrl: rp1: Make IRQ usage set a pin to an input#7526
pelwell merged 1 commit into
raspberrypi:rpi-6.18.yfrom
pelwell:is7520

Conversation

@pelwell

@pelwell pelwell commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

This is a less invasive solution to the problem that requesting that
a GPIO be used as an interrupt from Device Tree (not going via
gpio descriptors) does not automatically make it an input. This can lead
to interrupt storms.

It relies on there being an implementation of the function_is_gpio
method, hence the inclusion of Nicolai's patch from
#7522.

See: #7520

@nbuchwitz

Copy link
Copy Markdown
Contributor

Agreed, this is a cleaner and less instrisive approach.

But .strict = true exposed a problem in rp1.dtsi: spi0's cs-gpios pins (gpio7/8) stay muxed to function = "spi0", so cs-gpios can't claim them and the overlay fails.

nbw@rpicm5-build ~ $ pinctrl get 24    
24: no    pd | -- // GPIO24 = none
nbw@rpicm5-build ~ $ sudo pinctrl set 24 op dl
nbw@rpicm5-build ~ $ pinctrl get 24           
24: op dl pd | lo // GPIO24 = output
nbw@rpicm5-build ~ $ sudo dtoverlay sc16is75x-spi sc16is752 spi0-0 int_pin=24 xtal=14745600
nbw@rpicm5-build ~ $ pinctrl get 24                                                        
24: op dl pd | lo // GPIO24 = output

nbw@rpicm5-build ~ $ sudo dmesg -lwarn,err
[    0.380877] dwc2 1000480000.usb: supply vusb_d not found, using dummy regulator
[    0.380905] dwc2 1000480000.usb: supply vusb_a not found, using dummy regulator
[    2.617280] hci_uart_bcm serial0-0: supply vbat not found, using dummy regulator
[    2.617325] hci_uart_bcm serial0-0: supply vddio not found, using dummy regulator
[    3.197554] raspberrypi-firmware soc@107c000000:firmware: Request 0x00030097 returned status 0x80000001
[    3.218333] Unable to find swap-space signature
[    3.361553] nvme nvme0: using unchecked data buffer
[   46.281111] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /axi/pcie@1000120000/rp1/spi@50000/spidev@0/status
[   46.281128] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /axi/pcie@1000120000/rp1/spi@50000/status
[   46.289400] pinctrl-rp1 1f000d0000.gpio: pin gpio8 already requested by 1f00050000.spi; cannot claim for pinctrl-rp1:577
[   46.289414] pinctrl-rp1 1f000d0000.gpio: error -EINVAL: pin-8 (pinctrl-rp1:577)
[   46.289417] dw_spi_mmio 1f00050000.spi: error -EINVAL: problem registering spi host
[   46.289462] dw_spi_mmio 1f00050000.spi: probe with driver dw_spi_mmio failed with error -22

I've added d9118ca to #7522 and with this, it works:

nbw@rpicm5-build ~ $ pinctrl get 24                                             
24: no    pd | -- // GPIO24 = none
nbw@rpicm5-build ~ $ sudo pinctrl set 24 op dl
nbw@rpicm5-build ~ $ pinctrl get 24    
24: op dl pd | lo // GPIO24 = output
nbw@rpicm5-build ~ $ sudo dtoverlay sc16is75x-spi sc16is752 spi0-0 int_pin=24 xtal=14745600
nbw@rpicm5-build ~ $ pinctrl get 24    
24: ip    pn | lo // GPIO24 = input

nbw@rpicm5-build ~ $ sudo dmesg -lwarn,err                                                 
[    0.279913] dwc2 1000480000.usb: supply vusb_d not found, using dummy regulator
[    0.279941] dwc2 1000480000.usb: supply vusb_a not found, using dummy regulator
[    2.360939] hci_uart_bcm serial0-0: supply vbat not found, using dummy regulator
[    2.360991] hci_uart_bcm serial0-0: supply vddio not found, using dummy regulator
[    2.866494] raspberrypi-firmware soc@107c000000:firmware: Request 0x00030097 returned status 0x80000001
[    2.924515] Unable to find swap-space signature
[    3.046952] nvme nvme0: using unchecked data buffer
[   25.704297] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /axi/pcie@1000120000/rp1/spi@50000/spidev@0/status
[   25.704314] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /axi/pcie@1000120000/rp1/spi@50000/status

Also picked f0d34ae as the remaining drive-by patch from my original PR.

@pelwell

pelwell commented Jul 28, 2026

Copy link
Copy Markdown
Contributor Author

It's issues like this, considering the large number of overlays, that have made me reluctant to enable strict mode in our kernels. But maybe now is the time.

@pelwell

pelwell commented Jul 29, 2026

Copy link
Copy Markdown
Contributor Author

I've started going through all of the overlays now looking for problems. In the meantime, I'd be happy to take the function_is_gpio implementation from your "strict" commit (i.e. without the strict setting) - either as a cut-down version of your commit or just by folding it into mine.

@nbuchwitz

Copy link
Copy Markdown
Contributor

I also had a look and haven't found anything suspicious so far. Anyway Iwill split the commit.

This is a less invasive solution to the problem that requesting that
a GPIO be used as an interrupt from Device Tree (not going via
gpio descriptors) does not automatically make it an input. This can lead
to interrupt storms.

See: raspberrypi#7520

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Co-authored-by: Nicolai Buchwitz <nb@tipi-net.de>
@pelwell
pelwell merged commit 1f128d5 into raspberrypi:rpi-6.18.y Jul 29, 2026
11 of 12 checks passed
popcornmix added a commit to raspberrypi/firmware that referenced this pull request Jul 30, 2026
kernel: overlays: Add ramoops-pi5
See: raspberrypi/linux#7518

kernel: input: goodix: Include I2C details in names for the devices
See: raspberrypi/linux#7506

kernel: misc: rp1-pio: release DMA channel outside pio->lock
See: raspberrypi/linux#7519

kernel: ASoC: hifiberry-studio: add AES CS Mode control (channel status format)
See: raspberrypi/linux#7527

kernel: pinctrl: rp1: Make IRQ usage set a pin to an input
See: raspberrypi/linux#7526

kernel: drm/vc4: Support frame packed stereo modes
See: raspberrypi/linux#7524
popcornmix added a commit to raspberrypi/rpi-firmware that referenced this pull request Jul 30, 2026
kernel: overlays: Add ramoops-pi5
See: raspberrypi/linux#7518

kernel: input: goodix: Include I2C details in names for the devices
See: raspberrypi/linux#7506

kernel: misc: rp1-pio: release DMA channel outside pio->lock
See: raspberrypi/linux#7519

kernel: ASoC: hifiberry-studio: add AES CS Mode control (channel status format)
See: raspberrypi/linux#7527

kernel: pinctrl: rp1: Make IRQ usage set a pin to an input
See: raspberrypi/linux#7526

kernel: drm/vc4: Support frame packed stereo modes
See: raspberrypi/linux#7524
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants