Commit dcec3c8c authored by Jonathan Corbet's avatar Jonathan Corbet

docs: split up the driver book

We don't need to keep it as a single large file anymore; split it up so
that it is easier to manage and the individual sections can be read
directly as plain files.
Signed-off-by: default avatarJonathan Corbet <corbet@lwn.net>
parent 47cb398d
Driver Basics
=============
Driver Entry and Exit points
----------------------------
.. kernel-doc:: include/linux/init.h
:internal:
Atomic and pointer manipulation
-------------------------------
.. kernel-doc:: arch/x86/include/asm/atomic.h
:internal:
Delaying, scheduling, and timer routines
----------------------------------------
.. kernel-doc:: include/linux/sched.h
:internal:
.. kernel-doc:: kernel/sched/core.c
:export:
.. kernel-doc:: kernel/sched/cpupri.c
:internal:
.. kernel-doc:: kernel/sched/fair.c
:internal:
.. kernel-doc:: include/linux/completion.h
:internal:
.. kernel-doc:: kernel/time/timer.c
:export:
Wait queues and Wake events
---------------------------
.. kernel-doc:: include/linux/wait.h
:internal:
.. kernel-doc:: kernel/sched/wait.c
:export:
High-resolution timers
----------------------
.. kernel-doc:: include/linux/ktime.h
:internal:
.. kernel-doc:: include/linux/hrtimer.h
:internal:
.. kernel-doc:: kernel/time/hrtimer.c
:export:
Workqueues and Kevents
----------------------
.. kernel-doc:: include/linux/workqueue.h
:internal:
.. kernel-doc:: kernel/workqueue.c
:export:
Internal Functions
------------------
.. kernel-doc:: kernel/exit.c
:internal:
.. kernel-doc:: kernel/signal.c
:internal:
.. kernel-doc:: include/linux/kthread.h
:internal:
.. kernel-doc:: kernel/kthread.c
:export:
Kernel objects manipulation
---------------------------
.. kernel-doc:: lib/kobject.c
:export:
Kernel utility functions
------------------------
.. kernel-doc:: include/linux/kernel.h
:internal:
.. kernel-doc:: kernel/printk/printk.c
:export:
.. kernel-doc:: kernel/panic.c
:export:
.. kernel-doc:: kernel/sys.c
:export:
.. kernel-doc:: kernel/rcu/srcu.c
:export:
.. kernel-doc:: kernel/rcu/tree.c
:export:
.. kernel-doc:: kernel/rcu/tree_plugin.h
:export:
.. kernel-doc:: kernel/rcu/update.c
:export:
Device Resource Management
--------------------------
.. kernel-doc:: drivers/base/devres.c
:export:
Frame Buffer Library
====================
The frame buffer drivers depend heavily on four data structures. These
structures are declared in include/linux/fb.h. They are fb_info,
fb_var_screeninfo, fb_fix_screeninfo and fb_monospecs. The last
three can be made available to and from userland.
fb_info defines the current state of a particular video card. Inside
fb_info, there exists a fb_ops structure which is a collection of
needed functions to make fbdev and fbcon work. fb_info is only visible
to the kernel.
fb_var_screeninfo is used to describe the features of a video card
that are user defined. With fb_var_screeninfo, things such as depth
and the resolution may be defined.
The next structure is fb_fix_screeninfo. This defines the properties
of a card that are created when a mode is set and can't be changed
otherwise. A good example of this is the start of the frame buffer
memory. This "locks" the address of the frame buffer memory, so that it
cannot be changed or moved.
The last structure is fb_monospecs. In the old API, there was little
importance for fb_monospecs. This allowed for forbidden things such as
setting a mode of 800x600 on a fix frequency monitor. With the new API,
fb_monospecs prevents such things, and if used correctly, can prevent a
monitor from being cooked. fb_monospecs will not be useful until
kernels 2.5.x.
Frame Buffer Memory
-------------------
.. kernel-doc:: drivers/video/fbdev/core/fbmem.c
:export:
Frame Buffer Colormap
---------------------
.. kernel-doc:: drivers/video/fbdev/core/fbcmap.c
:export:
Frame Buffer Video Mode Database
--------------------------------
.. kernel-doc:: drivers/video/fbdev/core/modedb.c
:internal:
.. kernel-doc:: drivers/video/fbdev/core/modedb.c
:export:
Frame Buffer Macintosh Video Mode Database
------------------------------------------
.. kernel-doc:: drivers/video/fbdev/macmodes.c
:export:
Frame Buffer Fonts
------------------
Refer to the file lib/fonts/fonts.c for more information.
========================================
The Linux driver implementer's API guide
========================================
The kernel offers a wide variety of interfaces to support the development
of device drivers. This document is an only somewhat organized collection
of some of those interfaces — it will hopefully get better over time! The
available subsections can be seen below.
.. class:: toc-title
Table of contents
.. toctree::
:maxdepth: 2
basics
infrastructure
message-based
sound
frame-buffer
input
serial-interfaces
miscellaneous
Device drivers infrastructure
=============================
The Basic Device Driver-Model Structures
----------------------------------------
.. kernel-doc:: include/linux/device.h
:internal:
Device Drivers Base
-------------------
.. kernel-doc:: drivers/base/init.c
:internal:
.. kernel-doc:: drivers/base/driver.c
:export:
.. kernel-doc:: drivers/base/core.c
:export:
.. kernel-doc:: drivers/base/syscore.c
:export:
.. kernel-doc:: drivers/base/class.c
:export:
.. kernel-doc:: drivers/base/node.c
:internal:
.. kernel-doc:: drivers/base/firmware_class.c
:export:
.. kernel-doc:: drivers/base/transport_class.c
:export:
.. kernel-doc:: drivers/base/dd.c
:export:
.. kernel-doc:: include/linux/platform_device.h
:internal:
.. kernel-doc:: drivers/base/platform.c
:export:
.. kernel-doc:: drivers/base/bus.c
:export:
Buffer Sharing and Synchronization
----------------------------------
The dma-buf subsystem provides the framework for sharing buffers for
hardware (DMA) access across multiple device drivers and subsystems, and
for synchronizing asynchronous hardware access.
This is used, for example, by drm "prime" multi-GPU support, but is of
course not limited to GPU use cases.
The three main components of this are: (1) dma-buf, representing a
sg_table and exposed to userspace as a file descriptor to allow passing
between devices, (2) fence, which provides a mechanism to signal when
one device as finished access, and (3) reservation, which manages the
shared or exclusive fence(s) associated with the buffer.
dma-buf
~~~~~~~
.. kernel-doc:: drivers/dma-buf/dma-buf.c
:export:
.. kernel-doc:: include/linux/dma-buf.h
:internal:
reservation
~~~~~~~~~~~
.. kernel-doc:: drivers/dma-buf/reservation.c
:doc: Reservation Object Overview
.. kernel-doc:: drivers/dma-buf/reservation.c
:export:
.. kernel-doc:: include/linux/reservation.h
:internal:
fence
~~~~~
.. kernel-doc:: drivers/dma-buf/fence.c
:export:
.. kernel-doc:: include/linux/fence.h
:internal:
.. kernel-doc:: drivers/dma-buf/seqno-fence.c
:export:
.. kernel-doc:: include/linux/seqno-fence.h
:internal:
.. kernel-doc:: drivers/dma-buf/fence-array.c
:export:
.. kernel-doc:: include/linux/fence-array.h
:internal:
.. kernel-doc:: drivers/dma-buf/reservation.c
:export:
.. kernel-doc:: include/linux/reservation.h
:internal:
.. kernel-doc:: drivers/dma-buf/sync_file.c
:export:
.. kernel-doc:: include/linux/sync_file.h
:internal:
Device Drivers DMA Management
-----------------------------
.. kernel-doc:: drivers/base/dma-coherent.c
:export:
.. kernel-doc:: drivers/base/dma-mapping.c
:export:
Device Drivers Power Management
-------------------------------
.. kernel-doc:: drivers/base/power/main.c
:export:
Device Drivers ACPI Support
---------------------------
.. kernel-doc:: drivers/acpi/scan.c
:export:
.. kernel-doc:: drivers/acpi/scan.c
:internal:
Device drivers PnP support
--------------------------
.. kernel-doc:: drivers/pnp/core.c
:internal:
.. kernel-doc:: drivers/pnp/card.c
:export:
.. kernel-doc:: drivers/pnp/driver.c
:internal:
.. kernel-doc:: drivers/pnp/manager.c
:export:
.. kernel-doc:: drivers/pnp/support.c
:export:
Userspace IO devices
--------------------
.. kernel-doc:: drivers/uio/uio.c
:export:
.. kernel-doc:: include/linux/uio_driver.h
:internal:
Input Subsystem
===============
Input core
----------
.. kernel-doc:: include/linux/input.h
:internal:
.. kernel-doc:: drivers/input/input.c
:export:
.. kernel-doc:: drivers/input/ff-core.c
:export:
.. kernel-doc:: drivers/input/ff-memless.c
:export:
Multitouch Library
------------------
.. kernel-doc:: include/linux/input/mt.h
:internal:
.. kernel-doc:: drivers/input/input-mt.c
:export:
Polled input devices
--------------------
.. kernel-doc:: include/linux/input-polldev.h
:internal:
.. kernel-doc:: drivers/input/input-polldev.c
:export:
Matrix keyboards/keypads
------------------------
.. kernel-doc:: include/linux/input/matrix_keypad.h
:internal:
Sparse keymap support
---------------------
.. kernel-doc:: include/linux/input/sparse-keymap.h
:internal:
.. kernel-doc:: drivers/input/sparse-keymap.c
:export:
Message-based devices
=====================
Fusion message devices
----------------------
.. kernel-doc:: drivers/message/fusion/mptbase.c
:export:
.. kernel-doc:: drivers/message/fusion/mptbase.c
:internal:
.. kernel-doc:: drivers/message/fusion/mptscsih.c
:export:
.. kernel-doc:: drivers/message/fusion/mptscsih.c
:internal:
.. kernel-doc:: drivers/message/fusion/mptctl.c
:internal:
.. kernel-doc:: drivers/message/fusion/mptspi.c
:internal:
.. kernel-doc:: drivers/message/fusion/mptfc.c
:internal:
.. kernel-doc:: drivers/message/fusion/mptlan.c
:internal:
Parallel Port Devices
=====================
.. kernel-doc:: include/linux/parport.h
:internal:
.. kernel-doc:: drivers/parport/ieee1284.c
:export:
.. kernel-doc:: drivers/parport/share.c
:export:
.. kernel-doc:: drivers/parport/daisy.c
:internal:
16x50 UART Driver
=================
.. kernel-doc:: drivers/tty/serial/serial_core.c
:export:
.. kernel-doc:: drivers/tty/serial/8250/8250_core.c
:export:
Pulse-Width Modulation (PWM)
============================
Pulse-width modulation is a modulation technique primarily used to
control power supplied to electrical devices.
The PWM framework provides an abstraction for providers and consumers of
PWM signals. A controller that provides one or more PWM signals is
registered as :c:type:`struct pwm_chip <pwm_chip>`. Providers
are expected to embed this structure in a driver-specific structure.
This structure contains fields that describe a particular chip.
A chip exposes one or more PWM signal sources, each of which exposed as
a :c:type:`struct pwm_device <pwm_device>`. Operations can be
performed on PWM devices to control the period, duty cycle, polarity and
active state of the signal.
Note that PWM devices are exclusive resources: they can always only be
used by one consumer at a time.
.. kernel-doc:: include/linux/pwm.h
:internal:
.. kernel-doc:: drivers/pwm/core.c
:export:
====================
Linux Device Drivers
====================
Driver Basics
=============
Driver Entry and Exit points
----------------------------
.. kernel-doc:: include/linux/init.h
:internal:
Atomic and pointer manipulation
-------------------------------
.. kernel-doc:: arch/x86/include/asm/atomic.h
:internal:
Delaying, scheduling, and timer routines
----------------------------------------
.. kernel-doc:: include/linux/sched.h
:internal:
.. kernel-doc:: kernel/sched/core.c
:export:
.. kernel-doc:: kernel/sched/cpupri.c
:internal:
.. kernel-doc:: kernel/sched/fair.c
:internal:
.. kernel-doc:: include/linux/completion.h
:internal:
.. kernel-doc:: kernel/time/timer.c
:export:
Wait queues and Wake events
---------------------------
.. kernel-doc:: include/linux/wait.h
:internal:
.. kernel-doc:: kernel/sched/wait.c
:export:
High-resolution timers
----------------------
.. kernel-doc:: include/linux/ktime.h
:internal:
.. kernel-doc:: include/linux/hrtimer.h
:internal:
.. kernel-doc:: kernel/time/hrtimer.c
:export:
Workqueues and Kevents
----------------------
.. kernel-doc:: include/linux/workqueue.h
:internal:
.. kernel-doc:: kernel/workqueue.c
:export:
Internal Functions
------------------
.. kernel-doc:: kernel/exit.c
:internal:
.. kernel-doc:: kernel/signal.c
:internal:
.. kernel-doc:: include/linux/kthread.h
:internal:
.. kernel-doc:: kernel/kthread.c
:export:
Kernel objects manipulation
---------------------------
.. kernel-doc:: lib/kobject.c
:export:
Kernel utility functions
------------------------
.. kernel-doc:: include/linux/kernel.h
:internal:
.. kernel-doc:: kernel/printk/printk.c
:export:
.. kernel-doc:: kernel/panic.c
:export:
.. kernel-doc:: kernel/sys.c
:export:
.. kernel-doc:: kernel/rcu/srcu.c
:export:
.. kernel-doc:: kernel/rcu/tree.c
:export:
.. kernel-doc:: kernel/rcu/tree_plugin.h
:export:
.. kernel-doc:: kernel/rcu/update.c
:export:
Device Resource Management
--------------------------
.. kernel-doc:: drivers/base/devres.c
:export:
Device drivers infrastructure
=============================
The Basic Device Driver-Model Structures
----------------------------------------
.. kernel-doc:: include/linux/device.h
:internal:
Device Drivers Base
-------------------
.. kernel-doc:: drivers/base/init.c
:internal:
.. kernel-doc:: drivers/base/driver.c
:export:
.. kernel-doc:: drivers/base/core.c
:export:
.. kernel-doc:: drivers/base/syscore.c
:export:
.. kernel-doc:: drivers/base/class.c
:export:
.. kernel-doc:: drivers/base/node.c
:internal:
.. kernel-doc:: drivers/base/firmware_class.c
:export:
.. kernel-doc:: drivers/base/transport_class.c
:export:
.. kernel-doc:: drivers/base/dd.c
:export:
.. kernel-doc:: include/linux/platform_device.h
:internal:
.. kernel-doc:: drivers/base/platform.c
:export:
.. kernel-doc:: drivers/base/bus.c
:export:
Buffer Sharing and Synchronization
----------------------------------
The dma-buf subsystem provides the framework for sharing buffers for
hardware (DMA) access across multiple device drivers and subsystems, and
for synchronizing asynchronous hardware access.
This is used, for example, by drm "prime" multi-GPU support, but is of
course not limited to GPU use cases.
The three main components of this are: (1) dma-buf, representing a
sg_table and exposed to userspace as a file descriptor to allow passing
between devices, (2) fence, which provides a mechanism to signal when
one device as finished access, and (3) reservation, which manages the
shared or exclusive fence(s) associated with the buffer.
dma-buf
~~~~~~~
.. kernel-doc:: drivers/dma-buf/dma-buf.c
:export:
.. kernel-doc:: include/linux/dma-buf.h
:internal:
reservation
~~~~~~~~~~~
.. kernel-doc:: drivers/dma-buf/reservation.c
:doc: Reservation Object Overview
.. kernel-doc:: drivers/dma-buf/reservation.c
:export:
.. kernel-doc:: include/linux/reservation.h
:internal:
fence
~~~~~
.. kernel-doc:: drivers/dma-buf/fence.c
:export:
.. kernel-doc:: include/linux/fence.h
:internal:
.. kernel-doc:: drivers/dma-buf/seqno-fence.c
:export:
.. kernel-doc:: include/linux/seqno-fence.h
:internal:
.. kernel-doc:: drivers/dma-buf/fence-array.c
:export:
.. kernel-doc:: include/linux/fence-array.h
:internal:
.. kernel-doc:: drivers/dma-buf/reservation.c
:export:
.. kernel-doc:: include/linux/reservation.h
:internal:
.. kernel-doc:: drivers/dma-buf/sync_file.c
:export:
.. kernel-doc:: include/linux/sync_file.h
:internal:
Device Drivers DMA Management
-----------------------------
.. kernel-doc:: drivers/base/dma-coherent.c
:export:
.. kernel-doc:: drivers/base/dma-mapping.c
:export:
Device Drivers Power Management
-------------------------------
.. kernel-doc:: drivers/base/power/main.c
:export:
Device Drivers ACPI Support
---------------------------
.. kernel-doc:: drivers/acpi/scan.c
:export:
.. kernel-doc:: drivers/acpi/scan.c
:internal:
Device drivers PnP support
--------------------------
.. kernel-doc:: drivers/pnp/core.c
:internal:
.. kernel-doc:: drivers/pnp/card.c
:export:
.. kernel-doc:: drivers/pnp/driver.c
:internal:
.. kernel-doc:: drivers/pnp/manager.c
:export:
.. kernel-doc:: drivers/pnp/support.c
:export:
Userspace IO devices
--------------------
.. kernel-doc:: drivers/uio/uio.c
:export:
.. kernel-doc:: include/linux/uio_driver.h
:internal:
Parallel Port Devices
=====================
.. kernel-doc:: include/linux/parport.h
:internal:
.. kernel-doc:: drivers/parport/ieee1284.c
:export:
.. kernel-doc:: drivers/parport/share.c
:export:
.. kernel-doc:: drivers/parport/daisy.c
:internal:
Message-based devices
=====================
Fusion message devices
----------------------
.. kernel-doc:: drivers/message/fusion/mptbase.c
:export:
.. kernel-doc:: drivers/message/fusion/mptbase.c
:internal:
.. kernel-doc:: drivers/message/fusion/mptscsih.c
:export:
.. kernel-doc:: drivers/message/fusion/mptscsih.c
:internal:
.. kernel-doc:: drivers/message/fusion/mptctl.c
:internal:
.. kernel-doc:: drivers/message/fusion/mptspi.c
:internal:
.. kernel-doc:: drivers/message/fusion/mptfc.c
:internal:
.. kernel-doc:: drivers/message/fusion/mptlan.c
:internal:
Sound Devices
=============
.. kernel-doc:: include/sound/core.h
:internal:
.. kernel-doc:: sound/sound_core.c
:export:
.. kernel-doc:: include/sound/pcm.h
:internal:
.. kernel-doc:: sound/core/pcm.c
:export:
.. kernel-doc:: sound/core/device.c
:export:
.. kernel-doc:: sound/core/info.c
:export:
.. kernel-doc:: sound/core/rawmidi.c
:export:
.. kernel-doc:: sound/core/sound.c
:export:
.. kernel-doc:: sound/core/memory.c
:export:
.. kernel-doc:: sound/core/pcm_memory.c
:export:
.. kernel-doc:: sound/core/init.c
:export:
.. kernel-doc:: sound/core/isadma.c
:export:
.. kernel-doc:: sound/core/control.c
:export:
.. kernel-doc:: sound/core/pcm_lib.c
:export:
.. kernel-doc:: sound/core/hwdep.c
:export:
.. kernel-doc:: sound/core/pcm_native.c
:export:
.. kernel-doc:: sound/core/memalloc.c
:export:
16x50 UART Driver
=================
.. kernel-doc:: drivers/tty/serial/serial_core.c
:export:
.. kernel-doc:: drivers/tty/serial/8250/8250_core.c
:export:
Frame Buffer Library
====================
The frame buffer drivers depend heavily on four data structures. These
structures are declared in include/linux/fb.h. They are fb_info,
fb_var_screeninfo, fb_fix_screeninfo and fb_monospecs. The last
three can be made available to and from userland.
fb_info defines the current state of a particular video card. Inside
fb_info, there exists a fb_ops structure which is a collection of
needed functions to make fbdev and fbcon work. fb_info is only visible
to the kernel.
fb_var_screeninfo is used to describe the features of a video card
that are user defined. With fb_var_screeninfo, things such as depth
and the resolution may be defined.
The next structure is fb_fix_screeninfo. This defines the properties
of a card that are created when a mode is set and can't be changed
otherwise. A good example of this is the start of the frame buffer
memory. This "locks" the address of the frame buffer memory, so that it
cannot be changed or moved.
The last structure is fb_monospecs. In the old API, there was little
importance for fb_monospecs. This allowed for forbidden things such as
setting a mode of 800x600 on a fix frequency monitor. With the new API,
fb_monospecs prevents such things, and if used correctly, can prevent a
monitor from being cooked. fb_monospecs will not be useful until
kernels 2.5.x.
Frame Buffer Memory
-------------------
.. kernel-doc:: drivers/video/fbdev/core/fbmem.c
:export:
Frame Buffer Colormap
---------------------
.. kernel-doc:: drivers/video/fbdev/core/fbcmap.c
:export:
Frame Buffer Video Mode Database
--------------------------------
.. kernel-doc:: drivers/video/fbdev/core/modedb.c
:internal:
.. kernel-doc:: drivers/video/fbdev/core/modedb.c
:export:
Frame Buffer Macintosh Video Mode Database
------------------------------------------
.. kernel-doc:: drivers/video/fbdev/macmodes.c
:export:
Frame Buffer Fonts
------------------
Refer to the file lib/fonts/fonts.c for more information.
Input Subsystem
===============
Input core
----------
.. kernel-doc:: include/linux/input.h
:internal:
.. kernel-doc:: drivers/input/input.c
:export:
.. kernel-doc:: drivers/input/ff-core.c
:export:
.. kernel-doc:: drivers/input/ff-memless.c
:export:
Multitouch Library
------------------
.. kernel-doc:: include/linux/input/mt.h
:internal:
.. kernel-doc:: drivers/input/input-mt.c
:export:
Polled input devices
--------------------
.. kernel-doc:: include/linux/input-polldev.h
:internal:
.. kernel-doc:: drivers/input/input-polldev.c
:export:
Matrix keyboards/keypads
------------------------
.. kernel-doc:: include/linux/input/matrix_keypad.h
:internal:
Sparse keymap support
---------------------
.. kernel-doc:: include/linux/input/sparse-keymap.h
:internal:
.. kernel-doc:: drivers/input/sparse-keymap.c
:export:
Serial Peripheral Interface (SPI)
=================================
......@@ -627,28 +113,3 @@ engines (CMT) in cellular handsets. HSI provides multiplexing for up to
.. kernel-doc:: drivers/hsi/hsi_core.c
:export:
Pulse-Width Modulation (PWM)
============================
Pulse-width modulation is a modulation technique primarily used to
control power supplied to electrical devices.
The PWM framework provides an abstraction for providers and consumers of
PWM signals. A controller that provides one or more PWM signals is
registered as :c:type:`struct pwm_chip <pwm_chip>`. Providers
are expected to embed this structure in a driver-specific structure.
This structure contains fields that describe a particular chip.
A chip exposes one or more PWM signal sources, each of which exposed as
a :c:type:`struct pwm_device <pwm_device>`. Operations can be
performed on PWM devices to control the period, duty cycle, polarity and
active state of the signal.
Note that PWM devices are exclusive resources: they can always only be
used by one consumer at a time.
.. kernel-doc:: include/linux/pwm.h
:internal:
.. kernel-doc:: drivers/pwm/core.c
:export:
Sound Devices
=============
.. kernel-doc:: include/sound/core.h
:internal:
.. kernel-doc:: sound/sound_core.c
:export:
.. kernel-doc:: include/sound/pcm.h
:internal:
.. kernel-doc:: sound/core/pcm.c
:export:
.. kernel-doc:: sound/core/device.c
:export:
.. kernel-doc:: sound/core/info.c
:export:
.. kernel-doc:: sound/core/rawmidi.c
:export:
.. kernel-doc:: sound/core/sound.c
:export:
.. kernel-doc:: sound/core/memory.c
:export:
.. kernel-doc:: sound/core/pcm_memory.c
:export:
.. kernel-doc:: sound/core/init.c
:export:
.. kernel-doc:: sound/core/isadma.c
:export:
.. kernel-doc:: sound/core/control.c
:export:
.. kernel-doc:: sound/core/pcm_lib.c
:export:
.. kernel-doc:: sound/core/hwdep.c
:export:
.. kernel-doc:: sound/core/pcm_native.c
:export:
.. kernel-doc:: sound/core/memalloc.c
:export:
......@@ -13,7 +13,7 @@ Contents:
kernel-documentation
dev-tools/tools
driver-api/drivers
driver-api/index
media/index
gpu/index
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment