Skip to content

genirq: Setting trigger mode 8 for irq num failed (bcm2708_gpio_irq_set_type+0x0/0x68) #408

Closed

Description

@msperl

Hi!

Seems as if (low) level interrupts are not working with the RPI?

Is seems intentional from the code - the question is WHY?
What would be needed to make that work?

Martin

Activity

  1. notro commented on Oct 28, 2013

    @notro
    Contributor

    BCM2708 doesn't support level interrupts as you say, just falling or rising:
    https://github.com/raspberrypi/linux/blob/rpi-3.10.y/arch/arm/mach-bcm2708/bcm2708_gpio.c

    static int bcm2708_gpio_irq_set_type(struct irq_data *d, unsigned type)
    {
            unsigned irq = d->irq;
            struct bcm2708_gpio *gpio = irq_get_chip_data(irq);
    
            if (type & ~(IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING))
                    return -EINVAL;
    
            if (type & IRQ_TYPE_EDGE_RISING) {
                    gpio->rising |= (1 << irq_to_gpio(irq));
            } else {
                    gpio->rising &= ~(1 << irq_to_gpio(irq));
            }
    
            if (type & IRQ_TYPE_EDGE_FALLING) {
                    gpio->falling |= (1 << irq_to_gpio(irq));
            } else {
                    gpio->falling &= ~(1 << irq_to_gpio(irq));
            }
            return 0;
    }

    BCM2835 supports it:
    http://lxr.free-electrons.com/source/drivers/pinctrl/pinctrl-bcm2835.c?v=3.10;a=arm#L578

    static int __bcm2835_gpio_irq_set_type_disabled(struct bcm2835_pinctrl *pc,
            unsigned offset, unsigned int type)
    {
            switch (type) {
            case IRQ_TYPE_NONE:
            case IRQ_TYPE_EDGE_RISING:
            case IRQ_TYPE_EDGE_FALLING:
            case IRQ_TYPE_EDGE_BOTH:
            case IRQ_TYPE_LEVEL_HIGH:
            case IRQ_TYPE_LEVEL_LOW:
                    pc->irq_type[offset] = type;
                    break;
    
            default:
                    return -EINVAL;
            }
            return 0;
    }
    
    static int bcm2835_gpio_irq_set_type(struct irq_data *data, unsigned int type)
    {
    [...]
            if (test_bit(offset, &pc->enabled_irq_map[bank]))
                    ret = __bcm2835_gpio_irq_set_type_enabled(pc, gpio, type);
            else
                    ret = __bcm2835_gpio_irq_set_type_disabled(pc, gpio, type);
    [...]
    }

    BCM2835 ARM Peripherals, Chapter 6 General Purpose I/O (GPIO), Figure 6-1 GPIO Block Diagram, shows that both level and edge triggering is supported by hardware.

    Is seems intentional from the code - the question is WHY?

    I guess that the one who wrote the driver was satisfied with having edge triggering?

    What would be needed to make that work?

    That I don't know. The two drivers have rather different approaches in handling this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions