Jump to content

João Paulo Bodanese

Members
  • Posts

    3
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Hi, I need set the PC1 pin as output on a device driver using the new gpiod_export() method. What argument should i pass on the gpiod_get function? struct gpio_desc *gpio; gpio = gpiod_get(NULL, "PC1", GPIOD_OUT_HIGH); if (IS_ERR(gpio)) { printk("Failed to get GPIO: \n"); return PTR_ERR(gpio); } // Export the GPIO ret = gpiod_export(gpio, false); if (ret) { pr_err("Failed to export GPIO: %d\n", ret); return ret; } // Set the direction of the GPIO ret = gpiod_direction_output(gpio, 1); if (ret) { pr_err("Failed to set GPIO direction: %d\n", ret); return ret; } Armbian 23.8 Best regards
  2. The Orange Pi One uses the Allwinner H3, and according to its datasheet only the PA and PG pins support EINT.
  3. 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
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines