On Tue, 23 Apr 2024 20:25:14 +0300 Andy Shevchenko <andy.shevchenko@xxxxxxxxx> wrote: > On Tue, Apr 23, 2024 at 06:57:04PM +0200, Marek Behún wrote: > > On Tue, 23 Apr 2024 19:43:41 +0300 > > Andy Shevchenko <andy.shevchenko@xxxxxxxxx> wrote: > > > On Tue, Apr 23, 2024 at 7:32 PM Marek Behún <kabel@xxxxxxxxxx> wrote: > > > > On Tue, 23 Apr 2024 18:58:19 +0300 > > > > Andy Shevchenko <andy@xxxxxxxxxx> wrote: > > > > > On Thu, Apr 18, 2024 at 02:11:12PM +0200, Marek Behún wrote: > > ... > > > > > > > + irq_idx = omnia_int_to_gpio_idx[__bf_shf(INT_TRNG)]; > > > > > > + irq = devm_irq_create_mapping(dev, mcu->gc.irq.domain, irq_idx); > > > > > > + if (irq < 0) > > > > > > + return dev_err_probe(dev, irq, "Cannot map TRNG IRQ\n"); > > > > > > > > > > This looks like some workaround against existing gpiod_to_irq(). Why do you > > > > > need this? > > > > > > > > Hmmm, I thought that would not work because that line is only valid > > > > as an IRQ, not as a GPIO (this is enforced via the valid_mask member of > > > > gpio_chip and gpio_irq_chip). > > > > > > > > But looking at the code of gpiolib, if I do > > > > irq = gpiod_to_irq(gpiochip_get_desc(gc, irq_idx)); > > > > the valid_mask is not enforced anywhere. > > > > > > Which one? GPIO has two: one per GPIO realm and one for IRQ domain. > > > > The GPIO line validity is not enforced. The IRQ line validity is > > enforced in the gpiochip_to_irq() method. > > Okay, but does it work for you as expected then? > > If not, we should fix GPIO library to have gpiod_to_irq() to work as expected. Yes, it does. I am going to send a new version in a few minutes. Marek