gpio_to_irq in userspace

Hi,

I am writing a user space driver which needs to handle a interrupt.
Now, I need to the irq number for a specific GPIO, where do I find
this information.

The gpio_to_irq function exists only in kernel space.

Thanks in advance.

Regards,
Karthik

Hi,

I am writing a user space driver which needs to handle a interrupt.
Now, I need to the irq number for a specific GPIO, where do I find
this information.

The gpio_to_irq function exists only in kernel space.

User space drivers cannot use interrupts.

You might look into the UIO driver:

http://www.kernel.org/doc/htmldocs/uio-howto.html

Philip

Thats intersting. Im yet to read the howto pointed to by Philip, but as a first thought I was thinking maybe you can setup a kernel driver that schedules a tasklet which inturn sends a software signal to your user-space driver/program. I’m not sure if that (sending a signal from a kernel-tasklet to a user-space app) works, but just a thought.

-Sri.

This doesn't have to be difficult - write a simple driver that takes
that GPIO_TO_IRQ line, registers an ISR handler for a specific action
(edge or level), have an ioctl that when invoked from user-space, does
a wait_for_completion (synchronization event) that gets 'completed' by
the ISR handler when its invoked - this will give you the
functionality from user-space to block on interruptible GPIO.

Jerry

This doesn't have to be difficult - write a simple driver that takes
that GPIO_TO_IRQ line, registers an ISR handler for a specific action
(edge or level), have an ioctl that when invoked from user-space, does
a wait_for_completion (synchronization event) that gets 'completed' by
the ISR handler when its invoked - this will give you the
functionality from user-space to block on interruptible GPIO.

Read the UIO docs ..... This is pretty much what it does.

Philip