Gabriel Sartori

GPIO and IRQs

Discussion created by Gabriel Sartori on Jul 4, 2012
Latest reply on Feb 9, 2014 by Craig McQueen

Hi,

  I have two buttons plugged in my board.

  I would like to create a input driver for them. I am trying to use the gpio-keys driver.

 

  In the file ../arch/arm/mach-mx28/device.c I have added the above code.

 

  #if defined(CONFIG_KEYBOARD_GPIO)

#define MXS_KEY_BTN_0   MXS_PIN_TO_GPIO(PINID_SAIF0_SDATA0)
#define MXS_KEY_BTN_1   MXS_PIN_TO_GPIO(PINID_SAIF1_SDATA0)

#define KEY_BTN_0       0
#define KEY_BTN_1       1

static struct gpio_keys_button mxs_buttons[] = {

{
.code = KEY_BTN_0,
.gpio = MXS_KEY_BTN_0,
.desc = "User button 0",
.active_low = 0,
},

{
.code = KEY_BTN_1,
.gpio = MXS_KEY_BTN_1,
.desc = "User button 1",
.active_low = 0,
}
};

static struct gpio_keys_platform_data mxs_button_data = {
.buttons = mxs_buttons,
.nbuttons = ARRAY_SIZE(mxs_buttons),
};

static struct platform_device mxs_gpio_buttons = {
.name = "gpio-keys",
.id = -1,
.dev = {
.platform_data = &mxs_button_data,
},
};

static void __init mx28_init_btn(void)
{
        platform_device_register(&mxs_gpio_buttons);
}
#else
static void mx28_init_btn(void)
{
}
#endif

And then I added the mx28_init_btn in the mx28_device_init.

I did not get any compiling messages but in the boot it gives me a message telling that I failed to request_irq 247.

How can I tell kernel to request the IRQ_GPIO0 for the GPIO 247, for example?

 

I hope I was clear enough.

Thanks in advance.

 

Gabriel Sartori

Outcomes