[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YU26lIUayYXU/x9l@lunn.ch>
Date: Fri, 24 Sep 2021 13:46:28 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Asmaa Mnebhi <asmaa@...dia.com>
Cc: andy.shevchenko@...il.com, linux-gpio@...r.kernel.org,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-acpi@...r.kernel.org, kuba@...nel.org,
linus.walleij@...aro.org, bgolaszewski@...libre.com,
davem@...emloft.net, rjw@...ysocki.net, davthompson@...dia.com
Subject: Re: [PATCH v3 1/2] gpio: mlxbf2: Introduce IRQ support
> +static int
> +mlxbf2_gpio_irq_set_type(struct irq_data *irqd, unsigned int type)
> +{
> + struct gpio_chip *gc = irq_data_get_irq_chip_data(irqd);
> + struct mlxbf2_gpio_context *gs = gpiochip_get_data(gc);
> + int offset = irqd_to_hwirq(irqd);
> + unsigned long flags;
> + bool fall = false;
> + bool rise = false;
> + u32 val;
> +
> + switch (type & IRQ_TYPE_SENSE_MASK) {
> + case IRQ_TYPE_EDGE_BOTH:
> + case IRQ_TYPE_LEVEL_MASK:
> + fall = true;
> + rise = true;
> + break;
> + case IRQ_TYPE_EDGE_RISING:
> + case IRQ_TYPE_LEVEL_HIGH:
> + rise = true;
> + break;
> + case IRQ_TYPE_EDGE_FALLING:
> + case IRQ_TYPE_LEVEL_LOW:
> + fall = true;
> + break;
> + default:
> + return -EINVAL;
> + }
I'm still not convinced this is correct. Rising edge is different to
high. Rising edge only ever interrupts once, level keeps interrupting
until the source is cleared. You cannot store the four different
options in two bits.
Linus, have you seen anything like this before?
Andrew
Powered by blists - more mailing lists