-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Description
Describe the bug
I am porting a gpio irq driver, working on rpi4/cm4 to rpi5/cm5.
Here is the code snippet to request the gpio:
/// gpio setup returns irq number
static int gpio_config(MYCONTEXT* md,int gpio) {
int ret;
int irqno;
IRQCONTEXT* imd;
if ( (gpio<0) || (gpio>=NUM_GPIOS)) {
return -1;
}
imd=&md->irq_ctx[gpio];
imd->gpio_no=gpio;
ret=gpio_request(gpio,&imd->desc[0]);
if (ret) {
printk(KERN_ERR "GPIO request failure: %s ret=%d\n", &imd->desc[0],ret);
return ret;
}
irqno = gpio_to_irq(gpio);
if ( irqno < 0 ) {
printk(KERN_ERR "GPIO to IRQ mapping failure %s irqno=%d\n", &imd->desc[0],irqno);
return -1;
}
imd->irq_number=irqno;
printk(KERN_NOTICE "Mapped gpio %d to intr no %d\n", gpio,irqno);
return irqno;
}If I call the routine with gpio=26 and descr. string "GPIO26", I get the following error return from gpio request:
root@rasp-cm5-000:/projects/rtflex# journalctl -k -f
Dec 18 12:37:26 rasp-cm5-000 kernel: gpioirq - registered Device number, Major: 90
Dec 18 12:38:58 rasp-cm5-000 kernel: Open was called!
Dec 18 12:38:58 rasp-cm5-000 kernel: gpioirq: IOCTL, command=1074283049(40084229), type=66, nr=41, dir=1, size=8, arg=7fffceedfc58
Dec 18 12:38:58 rasp-cm5-000 kernel: GPIO request failure: GPIO26 ret=-517
On rpi4/cm4 with older kernels this will work.
What went wrong ?
Steps to reproduce the behaviour
Try to request GPIO Pin in a kernel mode driver.
Device (s)
Raspberry Pi CM5
System
Raspberry Pi reference 2025-10-01
Generated using pi-gen, https://github.com/RPi-Distro/pi-gen, 7dadcf1fc5ce1648ab09409ab978831690c9a955, stage4
2025/11/05 17:37:18
Copyright (c) 2012 Broadcom
version 57db150d (release) (embedded)
Linux rasp-cm5-000 6.12.47+rpt-rpi-2712 #1 SMP PREEMPT Debian 1:6.12.47-1+rpt1 (2025-09-16) aarch64 GNU/Linux
facing the problem also on RPI5 and also with older kernel 6.13.37
Logs
No response
Additional context
No response