2024-12-16 02:08 AM
Hi STM Community !!
We use the STM32MP1 on our board.
We use the gpio feature for an IRQ in our system.
We use it in a kernel module.
With the Ecosystem v5, it worked perfectly, but we used
#define PIN_FPGA_INTA (16 + 10)
static struct gpio gpio_irq_pps = {PIN_FPGA_INTA, GPIOF_IN, "IRQ PPS FPGA"};
...
if (gpio_request_one(gpio_irq_pps.gpio, gpio_irq_pps.flags, gpio_irq_pps.label)) {
printk("Fail of gpio_request for PPS_INT(B10 pin) :( \n");
}
irq_num_pps = gpio_to_irq(gpio_irq_pps.gpio);
if (irq_num_pps < 0) {
printk("Fail to use GPIO B10 as PPS Interrupt :( \n");
gpio_free(PIN_FPGA_INTA);
}
// set interrupt for PPS
ret = request_irq(irq_num_pps, pps_irq_handler, IRQF_TRIGGER_FALLING, "pnt_fpga_int_a", NULL);
if (ret != 0) {
printk("Interrupt Request Failed for INT_PPS: %d\n", ret);
gpio_free(PIN_FPGA_INTA);
} else
printk("Interrupt PPS OK\n");
...
Now, in the Ecosystem v6, we need to move to new gpiod kernel functions, because gpio_* functions are deprecated.
So, in the DTS In the DTS we have :
/ {
...
my_gpio {
fpga_inta-gpios = <&gpiob 10 GPIO_PULL_UP>;
fpga_intb-gpios = <&gpiob 11 GPIO_PULL_UP>;
}
...
};
We tried to use :
struct gpio_desc *gpio_pps;
gpio_pps = gpio_to_desc(PIN_FPGA_INTA);
or
gpio_pps = gpiod_get(NULL, "PB10", GPIOD_IN);
but each time these functions return no gpio.
Have you an idea ?
thanks for your help.