João Paulo Bodanese Posted July 10, 2023 Posted July 10, 2023 (edited) Hello, I'm trying to use pin PC3 as an interrupt, but it returns the error code -22 in the gpio_to_irq() function. In user-space i can use it normally as a GPIO, but I need it to function as an interrupt in a driver. Board: Orange Pi One, Armbian 23.8.0 #define GPIO_PIN 67 #define GPIO_PIN_DESC "GPIO PC3" static int __init mytapp_controller_proc_init(void) { int ret,gpio_irq; uint8_t idx = 0; printk("mytapp_controller_proc_init 444%d\n",GPIO_PIN); msg = kmalloc(PROCFS_MAX_SIZE, GFP_KERNEL); if(!msg){ printk(KERN_ALERT "Error: kmalloc error\n"); return -ENOMEM; } if (gpio_request(GPIO_PIN, GPIO_PIN_DESC)) { printk("GPIO request failure: %s\n", GPIO_PIN_DESC); return -1; } if (gpio_direction_input(GPIO_PIN)) { printk("GPIO set direction input failure %s\n", GPIO_PIN_DESC); return -1; } if ( (gpio_irq = gpio_to_irq(GPIO_PIN)) < 0 ) { printk("GPIO to IRQ mapping failure %s\n", GPIO_PIN_DESC); return -1; } ret = request_irq(gpio_irq, sample_irq, IRQF_TRIGGER_FALLING, "flow_sensor", 0); if (ret < 0) { printk(KERN_ALERT "%s: request_irg failed with %u\n", __func__, ret); return -1; } return 0; } It shows as GPIO IN: root@orangepione:/home/mytapp# cat /sys/kernel/debug/gpio gpiochip0: GPIOs 0-223, parent: platform/1c20800.pinctrl, 1c20800.pinctrl: gpio-15 ( |orangepi:red:status ) out lo gpio-67 ( |GPIO PC3 ) in hi gpio-166 ( |cd ) in lo ACTIVE LOW gpio-204 ( |usb0_id_det ) in hi IRQ gpiochip1: GPIOs 352-383, parent: platform/1f02c00.pinctrl, 1f02c00.pinctrl: gpio-354 ( |usb0-vbus ) out hi gpio-355 ( |sw4 ) in hi IRQ ACTIVE LOW gpio-358 ( |vdd-cpux ) out lo gpio-362 ( |orangepi:green:pwr ) out hi I also tryied PC0 and doesn't work too. The PA3 and works fine. Any ideia? Best regards Edited July 10, 2023 by João Paulo Bodanese 0 Quote
Solution João Paulo Bodanese Posted July 11, 2023 Author Solution Posted July 11, 2023 The Orange Pi One uses the Allwinner H3, and according to its datasheet only the PA and PG pins support EINT. 0 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.