aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/DocBook/drm.tmpl
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>2013-06-22 08:10:59 -0400
committerDave Airlie <airlied@redhat.com>2013-06-28 00:43:05 -0400
commit02b6298541f8a711b3f9cf589f7e508bd5cb99d8 (patch)
tree56f43b7bf2756b491d41334a575840fd31fdc265 /Documentation/DocBook/drm.tmpl
parentda34242e5e0638312130f5bd5d2d277afbc6f806 (diff)
drm: Improve manual IRQ installation documentation
Define the rules for using irqs from drm drivers. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'Documentation/DocBook/drm.tmpl')
-rw-r--r--Documentation/DocBook/drm.tmpl118
1 files changed, 70 insertions, 48 deletions
diff --git a/Documentation/DocBook/drm.tmpl b/Documentation/DocBook/drm.tmpl
index 91ee107d5d0e..a6080941f5e4 100644
--- a/Documentation/DocBook/drm.tmpl
+++ b/Documentation/DocBook/drm.tmpl
@@ -186,11 +186,12 @@
186 <varlistentry> 186 <varlistentry>
187 <term>DRIVER_HAVE_IRQ</term><term>DRIVER_IRQ_SHARED</term> 187 <term>DRIVER_HAVE_IRQ</term><term>DRIVER_IRQ_SHARED</term>
188 <listitem><para> 188 <listitem><para>
189 DRIVER_HAVE_IRQ indicates whether the driver has an IRQ handler. The 189 DRIVER_HAVE_IRQ indicates whether the driver has an IRQ handler
190 DRM core will automatically register an interrupt handler when the 190 managed by the DRM Core. The core will support simple IRQ handler
191 flag is set. DRIVER_IRQ_SHARED indicates whether the device &amp; 191 installation when the flag is set. The installation process is
192 handler support shared IRQs (note that this is required of PCI 192 described in <xref linkend="drm-irq-registration"/>.</para>
193 drivers). 193 <para>DRIVER_IRQ_SHARED indicates whether the device &amp; handler
194 support shared IRQs (note that this is required of PCI drivers).
194 </para></listitem> 195 </para></listitem>
195 </varlistentry> 196 </varlistentry>
196 <varlistentry> 197 <varlistentry>
@@ -344,50 +345,71 @@ char *date;</synopsis>
344 The DRM core tries to facilitate IRQ handler registration and 345 The DRM core tries to facilitate IRQ handler registration and
345 unregistration by providing <function>drm_irq_install</function> and 346 unregistration by providing <function>drm_irq_install</function> and
346 <function>drm_irq_uninstall</function> functions. Those functions only 347 <function>drm_irq_uninstall</function> functions. Those functions only
347 support a single interrupt per device. 348 support a single interrupt per device, devices that use more than one
348 </para> 349 IRQs need to be handled manually.
349 <!--!Fdrivers/char/drm/drm_irq.c drm_irq_install-->
350 <para>
351 Both functions get the device IRQ by calling
352 <function>drm_dev_to_irq</function>. This inline function will call a
353 bus-specific operation to retrieve the IRQ number. For platform devices,
354 <function>platform_get_irq</function>(..., 0) is used to retrieve the
355 IRQ number.
356 </para>
357 <para>
358 <function>drm_irq_install</function> starts by calling the
359 <methodname>irq_preinstall</methodname> driver operation. The operation
360 is optional and must make sure that the interrupt will not get fired by
361 clearing all pending interrupt flags or disabling the interrupt.
362 </para>
363 <para>
364 The IRQ will then be requested by a call to
365 <function>request_irq</function>. If the DRIVER_IRQ_SHARED driver
366 feature flag is set, a shared (IRQF_SHARED) IRQ handler will be
367 requested.
368 </para>
369 <para>
370 The IRQ handler function must be provided as the mandatory irq_handler
371 driver operation. It will get passed directly to
372 <function>request_irq</function> and thus has the same prototype as all
373 IRQ handlers. It will get called with a pointer to the DRM device as the
374 second argument.
375 </para>
376 <para>
377 Finally the function calls the optional
378 <methodname>irq_postinstall</methodname> driver operation. The operation
379 usually enables interrupts (excluding the vblank interrupt, which is
380 enabled separately), but drivers may choose to enable/disable interrupts
381 at a different time.
382 </para>
383 <para>
384 <function>drm_irq_uninstall</function> is similarly used to uninstall an
385 IRQ handler. It starts by waking up all processes waiting on a vblank
386 interrupt to make sure they don't hang, and then calls the optional
387 <methodname>irq_uninstall</methodname> driver operation. The operation
388 must disable all hardware interrupts. Finally the function frees the IRQ
389 by calling <function>free_irq</function>.
390 </para> 350 </para>
351 <sect4>
352 <title>Managed IRQ Registration</title>
353 <para>
354 Both the <function>drm_irq_install</function> and
355 <function>drm_irq_uninstall</function> functions get the device IRQ by
356 calling <function>drm_dev_to_irq</function>. This inline function will
357 call a bus-specific operation to retrieve the IRQ number. For platform
358 devices, <function>platform_get_irq</function>(..., 0) is used to
359 retrieve the IRQ number.
360 </para>
361 <para>
362 <function>drm_irq_install</function> starts by calling the
363 <methodname>irq_preinstall</methodname> driver operation. The operation
364 is optional and must make sure that the interrupt will not get fired by
365 clearing all pending interrupt flags or disabling the interrupt.
366 </para>
367 <para>
368 The IRQ will then be requested by a call to
369 <function>request_irq</function>. If the DRIVER_IRQ_SHARED driver
370 feature flag is set, a shared (IRQF_SHARED) IRQ handler will be
371 requested.
372 </para>
373 <para>
374 The IRQ handler function must be provided as the mandatory irq_handler
375 driver operation. It will get passed directly to
376 <function>request_irq</function> and thus has the same prototype as all
377 IRQ handlers. It will get called with a pointer to the DRM device as the
378 second argument.
379 </para>
380 <para>
381 Finally the function calls the optional
382 <methodname>irq_postinstall</methodname> driver operation. The operation
383 usually enables interrupts (excluding the vblank interrupt, which is
384 enabled separately), but drivers may choose to enable/disable interrupts
385 at a different time.
386 </para>
387 <para>
388 <function>drm_irq_uninstall</function> is similarly used to uninstall an
389 IRQ handler. It starts by waking up all processes waiting on a vblank
390 interrupt to make sure they don't hang, and then calls the optional
391 <methodname>irq_uninstall</methodname> driver operation. The operation
392 must disable all hardware interrupts. Finally the function frees the IRQ
393 by calling <function>free_irq</function>.
394 </para>
395 </sect4>
396 <sect4>
397 <title>Manual IRQ Registration</title>
398 <para>
399 Drivers that require multiple interrupt handlers can't use the managed
400 IRQ registration functions. In that case IRQs must be registered and
401 unregistered manually (usually with the <function>request_irq</function>
402 and <function>free_irq</function> functions, or their devm_* equivalent).
403 </para>
404 <para>
405 When manually registering IRQs, drivers must not set the DRIVER_HAVE_IRQ
406 driver feature flag, and must not provide the
407 <methodname>irq_handler</methodname> driver operation. They must set the
408 <structname>drm_device</structname> <structfield>irq_enabled</structfield>
409 field to 1 upon registration of the IRQs, and clear it to 0 after
410 unregistering the IRQs.
411 </para>
412 </sect4>
391 </sect3> 413 </sect3>
392 <sect3> 414 <sect3>
393 <title>Memory Manager Initialization</title> 415 <title>Memory Manager Initialization</title>