gpio_to_irq in userspace

455 views
Skip to first unread message

Karthik

unread,
Jan 21, 2010, 4:25:30 AM1/21/10
to Beagle Board
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

Philip Balister

unread,
Jan 21, 2010, 9:05:37 AM1/21/10
to beagl...@googlegroups.com
On Thu, Jan 21, 2010 at 4:25 AM, Karthik <karthiks...@gmail.com> wrote:
> 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


>
> Thanks in advance.
>
> Regards,
> Karthik
>

> --
> You received this message because you are subscribed to the Google Groups "Beagle Board" group.
> To post to this group, send email to beagl...@googlegroups.com.
> To unsubscribe from this group, send email to beagleboard...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/beagleboard?hl=en.
>
>
>
>

Vedurumudi

unread,
Jan 21, 2010, 11:40:42 AM1/21/10
to beagl...@googlegroups.com
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.

Jerry Johns

unread,
Jan 21, 2010, 12:27:58 PM1/21/10
to Beagle Board
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

On Jan 21, 11:40 am, Vedurumudi <svedurum...@gmail.com> wrote:
> 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.
>
> On Thu, Jan 21, 2010 at 8:05 AM, Philip Balister

> <philip.balis...@gmail.com>wrote:
>
>
>
> > On Thu, Jan 21, 2010 at 4:25 AM, Karthik <karthikshanmu...@gmail.com>


> > wrote:
> > > 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
>
> > > Thanks in advance.
>
> > > Regards,
> > > Karthik
>
> > > --
> > > You received this message because you are subscribed to the Google Groups
> > "Beagle Board" group.
> > > To post to this group, send email to beagl...@googlegroups.com.
> > > To unsubscribe from this group, send email to

> > beagleboard...@googlegroups.com<beagleboard%2Bunsubscribe@googlegr oups.com>


> > .
> > > For more options, visit this group at
> >http://groups.google.com/group/beagleboard?hl=en.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Beagle Board" group.
> > To post to this group, send email to beagl...@googlegroups.com.
> > To unsubscribe from this group, send email to

> > beagleboard...@googlegroups.com<beagleboard%2Bunsubscribe@googlegr oups.com>

Philip Balister

unread,
Jan 21, 2010, 4:15:33 PM1/21/10
to beagl...@googlegroups.com
On Thu, Jan 21, 2010 at 12:27 PM, Jerry Johns <jerry...@gmail.com> wrote:
> 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

> To unsubscribe from this group, send email to beagleboard...@googlegroups.com.

Reply all
Reply to author
Forward
0 new messages