Quantcast
Channel: Forum - Recent Threads
Viewing all articles
Browse latest Browse all 1583

gpio_to_irq() function in RZ/A2M

$
0
0

Dear Team,

i have written below driver to set an gpio pin as input and assign as an  intrrupt pin and the pin is P5_6 894 is the number of gpio, i am calling gpio_to_irq() function it should return me and irq number w.r.t to gpio pin, but it is throwing an error message like this  the value of button irq is -6

please help me out why gpio_to_irq() return with -6 value.

please find the below snippet code.

int init_module(void)
{
int valid;
// -- setup the led gpio as output
printk("module: button interrupt example.\n");
valid=gpio_is_valid(LED);
printk("valid is %d\n",valid);
if(valid < 0)
{
printk("gpio is not valid\n");
return -1;
}
if(gpio_request(LED, "LED") < 0) return -1;
//gpio_direction_output(LED, 1 );
button_irq = gpio_to_irq(LED);
printk("the value of button irq is %d\n",button_irq);
if(button_irq < 0 )
{
return -1;
}
if( request_irq( button_irq, button_isr ,IRQF_TRIGGER_RISING, MY_GPIO_INT_NAME, MY_DEV_NAME)) return -1;
return 0;
printk("gpio set as an input\n");

// -- setup the button gpio as input and request irq
if( request_irq( button_irq, button_isr ,IRQF_TRIGGER_RISING, MY_GPIO_INT_NAME, MY_DEV_NAME)) return -1;
return 0;

}


Viewing all articles
Browse latest Browse all 1583

Trending Articles