linux-device-driverembedded-linuxdavinci

DM6446 GPIO Bank 0 request_irq returns -22


I'm trying to set up an interrupt-handler in my driver for DM6446 GPIO BANK 0 interrupt.But request_irq returns -22.I know the Interrupt number for GPIO BANK-0 from the data sheet which states it to be 56.Following are the settings for GPIO in my code.I want to get interrupt on GPIO-10.

while((REG_VAL(PTSTAT) & 0x1) != 0);            // Wait for power state transtion to finish     
REG_VAL(MDCTL26) =  0x00000203;                  //To enable GPIO module and EMURSITE BIT as stated in sprue14 for state transition
REG_VAL(PTCMD) = 0x1;           // Start power state transition for ALWAYSON
while((REG_VAL(PTSTAT) & 0x1) != 0);            // Wait for power state transtion to finish 
REG_VAL(PINMUX0) = REG_VAL(PINMUX0) &  0x80000000;             //Disbale other Functionlaity on BANK 0 pins 
printk(KERN_DEBUG "I2C: PINMUX0 = %x\n",REG_VAL(PINMUX0));

REG_VAL(DIR01)   =  REG_VAL(DIR01) | 0xFFFFFFFF;              //Set direction as input for GPIO 0 and 10
REG_VAL(BINTEN)  =  REG_VAL(BINTEN) | 0x00000001;             //Enable Interrupt for GPIO Bank 0
REG_VAL(SET_RIS_TRIG01)   =  REG_VAL(SET_RIS_TRIG01) | 0x00000401; // Enable rising edge interrupt of GPIO BANK 0  PIN 0 PIN 10
REG_VAL(CLR_FAL_TRIG01)   =  REG_VAL(CLR_FAL_TRIG01) | 0x00000401; // Disable falling edge interrupt of Bank 0
 Result = request_irq(56,Gpio_Interrupt_Handler,0,"gpio",I2C_MAJOR);
if(Result < 0)
{
    printk(KERN_ALERT "UNABLE TO REQUEST GPIO IRQ %d ",Result);
}

A little help shall be appreciated. Thank you.

I have tried the gpio_to_irq as well for PIN-10 of BANK-0 but it returns irq no to be 72 but DM6446 has interrupt number upto 63 only in Data sheet.


Solution

  • I got it. If i use gpio_to_irq, It will return a valid IRQ number but different than the interrupt number(which i guess is also called IRQ number) specified in data sheet of Processor.If I see the /proc/interrupts, it will have an entry of that IRQ returned form gpio_to_irq but under GPIO type not the processor's Interrupt controller, which in my case for ARM shall be AINTC.All other interrupts are of AINTC type. Moreover, Even if request_irq succeeds with interrupt number stated in data sheet,/proc/stat will report interrupts at both IRQ numbers i.e. AINTC and GPIO type.