Thread (16 messages) 16 messages, 3 authors, 2021-10-08

Re: [PATCH v3 1/2] gpio: mlxbf2: Introduce IRQ support

From: Linus Walleij <hidden>
Date: 2021-09-24 23:48:18
Also in: linux-acpi, linux-gpio, lkml

On Fri, Sep 24, 2021 at 1:46 PM Andrew Lunn [off-list ref] wrote:
quoted
+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?
No, and I agree it looks weird.

There must be some explanation, what does the datasheet say?

Yours,
Linus Walleij
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help