1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>Using uio_pdrv_genirq for platform devices</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="The Userspace I/O HOWTO"><link rel="up" href="custom_kernel_module.html" title="Chapter&#160;3.&#160;Writing your own kernel module"><link rel="prev" href="using_uio_pdrv.html" title="Using uio_pdrv for platform devices"><link rel="next" href="using-uio_dmem_genirq.html" title="Using uio_dmem_genirq for platform devices"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Using uio_pdrv_genirq for platform devices</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="using_uio_pdrv.html">Prev</a>&#160;</td><th width="60%" align="center">Chapter&#160;3.&#160;Writing your own kernel module</th><td width="20%" align="right">&#160;<a accesskey="n" href="using-uio_dmem_genirq.html">Next</a></td></tr></table><hr></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="using_uio_pdrv_genirq"></a>Using uio_pdrv_genirq for platform devices</h2></div></div></div><p>
2	Especially in embedded devices, you frequently find chips where the
3	irq pin is tied to its own dedicated interrupt line. In such cases,
4	where you can be really sure the interrupt is not shared, we can take
5	the concept of <code class="varname">uio_pdrv</code> one step further and use a
6	generic interrupt handler. That's what
7	<code class="varname">uio_pdrv_genirq</code> does.
8	</p><p>
9	The setup for this driver is the same as described above for
10	<code class="varname">uio_pdrv</code>, except that you do not implement an
11	interrupt handler. The <code class="varname">.handler</code> element of
12	<code class="varname">struct uio_info</code> must remain
13	<code class="varname">NULL</code>. The  <code class="varname">.irq_flags</code> element
14	must not contain <code class="varname">IRQF_SHARED</code>.
15	</p><p>
16	You will set the <code class="varname">.name</code> element of
17	<code class="varname">struct platform_device</code> to
18	<code class="varname">"uio_pdrv_genirq"</code> to use this driver.
19	</p><p>
20	The generic interrupt handler of <code class="varname">uio_pdrv_genirq</code>
21	will simply disable the interrupt line using
22	<code class="function">disable_irq_nosync()</code>. After doing its work,
23	userspace can reenable the interrupt by writing 0x00000001 to the UIO
24	device file. The driver already implements an
25	<code class="function">irq_control()</code> to make this possible, you must not
26	implement your own.
27	</p><p>
28	Using <code class="varname">uio_pdrv_genirq</code> not only saves a few lines of
29	interrupt handler code. You also do not need to know anything about
30	the chip's internal registers to create the kernel part of the driver.
31	All you need to know is the irq number of the pin the chip is
32	connected to.
33	</p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="using_uio_pdrv.html">Prev</a>&#160;</td><td width="20%" align="center"><a accesskey="u" href="custom_kernel_module.html">Up</a></td><td width="40%" align="right">&#160;<a accesskey="n" href="using-uio_dmem_genirq.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Using uio_pdrv for platform devices&#160;</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">&#160;Using uio_dmem_genirq for platform devices</td></tr></table></div></body></html>
34