RE: Configuring a TWL GPIO pin as an interrupt

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> > I'm interested in bringing headset detection feature for audio. The
> > detection is done through TWL GPIO_2. How can I configure a GPIO pin
> > to generate an interrupt? Is there any API? Could you please point
> > out another driver using that functionality so I can use as reference?

>In the setup() callback for the TWL4030 GPIOs:
> {
>  int GPIO_NUMBER = gpio_base + 2;
> gpio_request(GPIO_NUMBER, "Headset IRQ");
> gpio_direction_input(GPIO_NUMBER);
>  lm8323_board_info.irq = gpio_to_irq(GPIO_NUMBER);
>  ... something registers this board_info ...
>  return 0;
> }
>
> and then later the lm8323 driver will use that IRQ:
>
> request_irq(client->irq, lm8323_irq, flags | IRQF_SHARED, DRIVER_NAME, dev);
>
> that should do it :-)
>
> see that GPIO_NUMBER will be gpio_base + 2, base is board-specific
>
> .... and hence client->irq is also board-specific,
> which is why it needs to be set up

In the particular case of ALSA SoC, could the machine/board driver be a better place to handle all GPIO/IRQ configuration? That driver also contains only board specific code.--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux