device-drivers.tmpl 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
  3. "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" []>
  4. <book id="LinuxDriversAPI">
  5. <bookinfo>
  6. <title>Linux Device Drivers</title>
  7. <legalnotice>
  8. <para>
  9. This documentation is free software; you can redistribute
  10. it and/or modify it under the terms of the GNU General Public
  11. License as published by the Free Software Foundation; either
  12. version 2 of the License, or (at your option) any later
  13. version.
  14. </para>
  15. <para>
  16. This program is distributed in the hope that it will be
  17. useful, but WITHOUT ANY WARRANTY; without even the implied
  18. warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  19. See the GNU General Public License for more details.
  20. </para>
  21. <para>
  22. You should have received a copy of the GNU General Public
  23. License along with this program; if not, write to the Free
  24. Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  25. MA 02111-1307 USA
  26. </para>
  27. <para>
  28. For more details see the file COPYING in the source
  29. distribution of Linux.
  30. </para>
  31. </legalnotice>
  32. </bookinfo>
  33. <toc></toc>
  34. <chapter id="Basics">
  35. <title>Driver Basics</title>
  36. <sect1><title>Driver Entry and Exit points</title>
  37. !Iinclude/linux/init.h
  38. </sect1>
  39. <sect1><title>Atomic and pointer manipulation</title>
  40. !Iarch/x86/include/asm/atomic.h
  41. </sect1>
  42. <sect1><title>Delaying, scheduling, and timer routines</title>
  43. !Iinclude/linux/sched.h
  44. !Ekernel/sched/core.c
  45. !Ikernel/sched/cpupri.c
  46. !Ikernel/sched/fair.c
  47. !Iinclude/linux/completion.h
  48. !Ekernel/time/timer.c
  49. </sect1>
  50. <sect1><title>Wait queues and Wake events</title>
  51. !Iinclude/linux/wait.h
  52. !Ekernel/sched/wait.c
  53. </sect1>
  54. <sect1><title>High-resolution timers</title>
  55. !Iinclude/linux/ktime.h
  56. !Iinclude/linux/hrtimer.h
  57. !Ekernel/time/hrtimer.c
  58. </sect1>
  59. <sect1><title>Workqueues and Kevents</title>
  60. !Iinclude/linux/workqueue.h
  61. !Ekernel/workqueue.c
  62. </sect1>
  63. <sect1><title>Internal Functions</title>
  64. !Ikernel/exit.c
  65. !Ikernel/signal.c
  66. !Iinclude/linux/kthread.h
  67. !Ekernel/kthread.c
  68. </sect1>
  69. <sect1><title>Kernel objects manipulation</title>
  70. <!--
  71. X!Iinclude/linux/kobject.h
  72. -->
  73. !Elib/kobject.c
  74. </sect1>
  75. <sect1><title>Kernel utility functions</title>
  76. !Iinclude/linux/kernel.h
  77. !Ekernel/printk/printk.c
  78. !Ekernel/panic.c
  79. !Ekernel/sys.c
  80. !Ekernel/rcu/srcu.c
  81. !Ekernel/rcu/tree.c
  82. !Ekernel/rcu/tree_plugin.h
  83. !Ekernel/rcu/update.c
  84. </sect1>
  85. <sect1><title>Device Resource Management</title>
  86. !Edrivers/base/devres.c
  87. </sect1>
  88. </chapter>
  89. <chapter id="devdrivers">
  90. <title>Device drivers infrastructure</title>
  91. <sect1><title>The Basic Device Driver-Model Structures </title>
  92. !Iinclude/linux/device.h
  93. </sect1>
  94. <sect1><title>Device Drivers Base</title>
  95. !Idrivers/base/init.c
  96. !Edrivers/base/driver.c
  97. !Edrivers/base/core.c
  98. !Edrivers/base/syscore.c
  99. !Edrivers/base/class.c
  100. !Idrivers/base/node.c
  101. !Edrivers/base/firmware_class.c
  102. !Edrivers/base/transport_class.c
  103. <!-- Cannot be included, because
  104. attribute_container_add_class_device_adapter
  105. and attribute_container_classdev_to_container
  106. exceed allowed 44 characters maximum
  107. X!Edrivers/base/attribute_container.c
  108. -->
  109. !Edrivers/base/dd.c
  110. <!--
  111. X!Edrivers/base/interface.c
  112. -->
  113. !Iinclude/linux/platform_device.h
  114. !Edrivers/base/platform.c
  115. !Edrivers/base/bus.c
  116. </sect1>
  117. <sect1><title>Device Drivers DMA Management</title>
  118. !Edrivers/dma-buf/dma-buf.c
  119. !Edrivers/dma-buf/fence.c
  120. !Edrivers/dma-buf/seqno-fence.c
  121. !Iinclude/linux/fence.h
  122. !Iinclude/linux/seqno-fence.h
  123. !Edrivers/dma-buf/reservation.c
  124. !Iinclude/linux/reservation.h
  125. !Edrivers/base/dma-coherent.c
  126. !Edrivers/base/dma-mapping.c
  127. </sect1>
  128. <sect1><title>Device Drivers Power Management</title>
  129. !Edrivers/base/power/main.c
  130. </sect1>
  131. <sect1><title>Device Drivers ACPI Support</title>
  132. <!-- Internal functions only
  133. X!Edrivers/acpi/sleep/main.c
  134. X!Edrivers/acpi/sleep/wakeup.c
  135. X!Edrivers/acpi/motherboard.c
  136. X!Edrivers/acpi/bus.c
  137. -->
  138. !Edrivers/acpi/scan.c
  139. !Idrivers/acpi/scan.c
  140. <!-- No correct structured comments
  141. X!Edrivers/acpi/pci_bind.c
  142. -->
  143. </sect1>
  144. <sect1><title>Device drivers PnP support</title>
  145. !Idrivers/pnp/core.c
  146. <!-- No correct structured comments
  147. X!Edrivers/pnp/system.c
  148. -->
  149. !Edrivers/pnp/card.c
  150. !Idrivers/pnp/driver.c
  151. !Edrivers/pnp/manager.c
  152. !Edrivers/pnp/support.c
  153. </sect1>
  154. <sect1><title>Userspace IO devices</title>
  155. !Edrivers/uio/uio.c
  156. !Iinclude/linux/uio_driver.h
  157. </sect1>
  158. </chapter>
  159. <chapter id="parportdev">
  160. <title>Parallel Port Devices</title>
  161. !Iinclude/linux/parport.h
  162. !Edrivers/parport/ieee1284.c
  163. !Edrivers/parport/share.c
  164. !Idrivers/parport/daisy.c
  165. </chapter>
  166. <chapter id="message_devices">
  167. <title>Message-based devices</title>
  168. <sect1><title>Fusion message devices</title>
  169. !Edrivers/message/fusion/mptbase.c
  170. !Idrivers/message/fusion/mptbase.c
  171. !Edrivers/message/fusion/mptscsih.c
  172. !Idrivers/message/fusion/mptscsih.c
  173. !Idrivers/message/fusion/mptctl.c
  174. !Idrivers/message/fusion/mptspi.c
  175. !Idrivers/message/fusion/mptfc.c
  176. !Idrivers/message/fusion/mptlan.c
  177. </sect1>
  178. </chapter>
  179. <chapter id="snddev">
  180. <title>Sound Devices</title>
  181. !Iinclude/sound/core.h
  182. !Esound/sound_core.c
  183. !Iinclude/sound/pcm.h
  184. !Esound/core/pcm.c
  185. !Esound/core/device.c
  186. !Esound/core/info.c
  187. !Esound/core/rawmidi.c
  188. !Esound/core/sound.c
  189. !Esound/core/memory.c
  190. !Esound/core/pcm_memory.c
  191. !Esound/core/init.c
  192. !Esound/core/isadma.c
  193. !Esound/core/control.c
  194. !Esound/core/pcm_lib.c
  195. !Esound/core/hwdep.c
  196. !Esound/core/pcm_native.c
  197. !Esound/core/memalloc.c
  198. <!-- FIXME: Removed for now since no structured comments in source
  199. X!Isound/sound_firmware.c
  200. -->
  201. </chapter>
  202. <chapter id="mediadev">
  203. <title>Media Devices</title>
  204. <sect1><title>Video2Linux devices</title>
  205. !Iinclude/media/tuner.h
  206. !Iinclude/media/tuner-types.h
  207. !Iinclude/media/tveeprom.h
  208. !Iinclude/media/v4l2-async.h
  209. !Iinclude/media/v4l2-ctrls.h
  210. !Iinclude/media/v4l2-dv-timings.h
  211. !Iinclude/media/v4l2-event.h
  212. !Iinclude/media/v4l2-flash-led-class.h
  213. !Iinclude/media/v4l2-mediabus.h
  214. !Iinclude/media/v4l2-mem2mem.h
  215. !Iinclude/media/v4l2-of.h
  216. !Iinclude/media/v4l2-subdev.h
  217. !Iinclude/media/videobuf2-core.h
  218. !Iinclude/media/videobuf2-v4l2.h
  219. !Iinclude/media/videobuf2-memops.h
  220. </sect1>
  221. <sect1><title>Digital TV (DVB) devices</title>
  222. !Idrivers/media/dvb-core/dvb_ca_en50221.h
  223. !Idrivers/media/dvb-core/dvb_frontend.h
  224. !Idrivers/media/dvb-core/dvb_math.h
  225. !Idrivers/media/dvb-core/dvb_ringbuffer.h
  226. !Idrivers/media/dvb-core/dvbdev.h
  227. <sect1><title>Digital TV Demux API</title>
  228. <para>The kernel demux API defines a driver-internal interface for
  229. registering low-level, hardware specific driver to a hardware
  230. independent demux layer. It is only of interest for Digital TV
  231. device driver writers. The header file for this API is named
  232. <constant>demux.h</constant> and located in
  233. <constant>drivers/media/dvb-core</constant>.</para>
  234. <para>The demux API should be implemented for each demux in the
  235. system. It is used to select the TS source of a demux and to manage
  236. the demux resources. When the demux client allocates a resource via
  237. the demux API, it receives a pointer to the API of that
  238. resource.</para>
  239. <para>Each demux receives its TS input from a DVB front-end or from
  240. memory, as set via this demux API. In a system with more than one
  241. front-end, the API can be used to select one of the DVB front-ends
  242. as a TS source for a demux, unless this is fixed in the HW platform.
  243. The demux API only controls front-ends regarding to their connections
  244. with demuxes; the APIs used to set the other front-end parameters,
  245. such as tuning, are not defined in this document.</para>
  246. <para>The functions that implement the abstract interface demux should
  247. be defined static or module private and registered to the Demux
  248. core for external access. It is not necessary to implement every
  249. function in the struct <constant>dmx_demux</constant>. For example,
  250. a demux interface might support Section filtering, but not PES
  251. filtering. The API client is expected to check the value of any
  252. function pointer before calling the function: the value of NULL means
  253. that the &#8220;function is not available&#8221;.</para>
  254. <para>Whenever the functions of the demux API modify shared data,
  255. the possibilities of lost update and race condition problems should
  256. be addressed, e.g. by protecting parts of code with mutexes.</para>
  257. <para>Note that functions called from a bottom half context must not
  258. sleep. Even a simple memory allocation without using GFP_ATOMIC can
  259. result in a kernel thread being put to sleep if swapping is needed.
  260. For example, the Linux kernel calls the functions of a network device
  261. interface from a bottom half context. Thus, if a demux API function
  262. is called from network device code, the function must not sleep.
  263. </para>
  264. </sect1>
  265. <section id="demux_callback_api">
  266. <title>Demux Callback API</title>
  267. <para>This kernel-space API comprises the callback functions that
  268. deliver filtered data to the demux client. Unlike the other DVB
  269. kABIs, these functions are provided by the client and called from
  270. the demux code.</para>
  271. <para>The function pointers of this abstract interface are not
  272. packed into a structure as in the other demux APIs, because the
  273. callback functions are registered and used independent of each
  274. other. As an example, it is possible for the API client to provide
  275. several callback functions for receiving TS packets and no
  276. callbacks for PES packets or sections.</para>
  277. <para>The functions that implement the callback API need not be
  278. re-entrant: when a demux driver calls one of these functions,
  279. the driver is not allowed to call the function again before
  280. the original call returns. If a callback is triggered by a
  281. hardware interrupt, it is recommended to use the Linux
  282. &#8220;bottom half&#8221; mechanism or start a tasklet instead of
  283. making the callback function call directly from a hardware
  284. interrupt.</para>
  285. <para>This mechanism is implemented by
  286. <link linkend='API-dmx-ts-cb'>dmx_ts_cb()</link> and
  287. <link linkend='API-dmx-section-cb'>dmx_section_cb()</link>.</para>
  288. </section>
  289. !Idrivers/media/dvb-core/demux.h
  290. </sect1>
  291. <sect1><title>Remote Controller devices</title>
  292. !Iinclude/media/rc-core.h
  293. !Iinclude/media/lirc_dev.h
  294. </sect1>
  295. <sect1><title>Media Controller devices</title>
  296. !Iinclude/media/media-device.h
  297. !Iinclude/media/media-devnode.h
  298. !Iinclude/media/media-entity.h
  299. </sect1>
  300. </chapter>
  301. <chapter id="uart16x50">
  302. <title>16x50 UART Driver</title>
  303. !Edrivers/tty/serial/serial_core.c
  304. !Edrivers/tty/serial/8250/8250_core.c
  305. </chapter>
  306. <chapter id="fbdev">
  307. <title>Frame Buffer Library</title>
  308. <para>
  309. The frame buffer drivers depend heavily on four data structures.
  310. These structures are declared in include/linux/fb.h. They are
  311. fb_info, fb_var_screeninfo, fb_fix_screeninfo and fb_monospecs.
  312. The last three can be made available to and from userland.
  313. </para>
  314. <para>
  315. fb_info defines the current state of a particular video card.
  316. Inside fb_info, there exists a fb_ops structure which is a
  317. collection of needed functions to make fbdev and fbcon work.
  318. fb_info is only visible to the kernel.
  319. </para>
  320. <para>
  321. fb_var_screeninfo is used to describe the features of a video card
  322. that are user defined. With fb_var_screeninfo, things such as
  323. depth and the resolution may be defined.
  324. </para>
  325. <para>
  326. The next structure is fb_fix_screeninfo. This defines the
  327. properties of a card that are created when a mode is set and can't
  328. be changed otherwise. A good example of this is the start of the
  329. frame buffer memory. This "locks" the address of the frame buffer
  330. memory, so that it cannot be changed or moved.
  331. </para>
  332. <para>
  333. The last structure is fb_monospecs. In the old API, there was
  334. little importance for fb_monospecs. This allowed for forbidden things
  335. such as setting a mode of 800x600 on a fix frequency monitor. With
  336. the new API, fb_monospecs prevents such things, and if used
  337. correctly, can prevent a monitor from being cooked. fb_monospecs
  338. will not be useful until kernels 2.5.x.
  339. </para>
  340. <sect1><title>Frame Buffer Memory</title>
  341. !Edrivers/video/fbdev/core/fbmem.c
  342. </sect1>
  343. <!--
  344. <sect1><title>Frame Buffer Console</title>
  345. X!Edrivers/video/console/fbcon.c
  346. </sect1>
  347. -->
  348. <sect1><title>Frame Buffer Colormap</title>
  349. !Edrivers/video/fbdev/core/fbcmap.c
  350. </sect1>
  351. <!-- FIXME:
  352. drivers/video/fbgen.c has no docs, which stuffs up the sgml. Comment
  353. out until somebody adds docs. KAO
  354. <sect1><title>Frame Buffer Generic Functions</title>
  355. X!Idrivers/video/fbgen.c
  356. </sect1>
  357. KAO -->
  358. <sect1><title>Frame Buffer Video Mode Database</title>
  359. !Idrivers/video/fbdev/core/modedb.c
  360. !Edrivers/video/fbdev/core/modedb.c
  361. </sect1>
  362. <sect1><title>Frame Buffer Macintosh Video Mode Database</title>
  363. !Edrivers/video/fbdev/macmodes.c
  364. </sect1>
  365. <sect1><title>Frame Buffer Fonts</title>
  366. <para>
  367. Refer to the file lib/fonts/fonts.c for more information.
  368. </para>
  369. <!-- FIXME: Removed for now since no structured comments in source
  370. X!Ilib/fonts/fonts.c
  371. -->
  372. </sect1>
  373. </chapter>
  374. <chapter id="input_subsystem">
  375. <title>Input Subsystem</title>
  376. <sect1><title>Input core</title>
  377. !Iinclude/linux/input.h
  378. !Edrivers/input/input.c
  379. !Edrivers/input/ff-core.c
  380. !Edrivers/input/ff-memless.c
  381. </sect1>
  382. <sect1><title>Multitouch Library</title>
  383. !Iinclude/linux/input/mt.h
  384. !Edrivers/input/input-mt.c
  385. </sect1>
  386. <sect1><title>Polled input devices</title>
  387. !Iinclude/linux/input-polldev.h
  388. !Edrivers/input/input-polldev.c
  389. </sect1>
  390. <sect1><title>Matrix keyboars/keypads</title>
  391. !Iinclude/linux/input/matrix_keypad.h
  392. </sect1>
  393. <sect1><title>Sparse keymap support</title>
  394. !Iinclude/linux/input/sparse-keymap.h
  395. !Edrivers/input/sparse-keymap.c
  396. </sect1>
  397. </chapter>
  398. <chapter id="spi">
  399. <title>Serial Peripheral Interface (SPI)</title>
  400. <para>
  401. SPI is the "Serial Peripheral Interface", widely used with
  402. embedded systems because it is a simple and efficient
  403. interface: basically a multiplexed shift register.
  404. Its three signal wires hold a clock (SCK, often in the range
  405. of 1-20 MHz), a "Master Out, Slave In" (MOSI) data line, and
  406. a "Master In, Slave Out" (MISO) data line.
  407. SPI is a full duplex protocol; for each bit shifted out the
  408. MOSI line (one per clock) another is shifted in on the MISO line.
  409. Those bits are assembled into words of various sizes on the
  410. way to and from system memory.
  411. An additional chipselect line is usually active-low (nCS);
  412. four signals are normally used for each peripheral, plus
  413. sometimes an interrupt.
  414. </para>
  415. <para>
  416. The SPI bus facilities listed here provide a generalized
  417. interface to declare SPI busses and devices, manage them
  418. according to the standard Linux driver model, and perform
  419. input/output operations.
  420. At this time, only "master" side interfaces are supported,
  421. where Linux talks to SPI peripherals and does not implement
  422. such a peripheral itself.
  423. (Interfaces to support implementing SPI slaves would
  424. necessarily look different.)
  425. </para>
  426. <para>
  427. The programming interface is structured around two kinds of driver,
  428. and two kinds of device.
  429. A "Controller Driver" abstracts the controller hardware, which may
  430. be as simple as a set of GPIO pins or as complex as a pair of FIFOs
  431. connected to dual DMA engines on the other side of the SPI shift
  432. register (maximizing throughput). Such drivers bridge between
  433. whatever bus they sit on (often the platform bus) and SPI, and
  434. expose the SPI side of their device as a
  435. <structname>struct spi_master</structname>.
  436. SPI devices are children of that master, represented as a
  437. <structname>struct spi_device</structname> and manufactured from
  438. <structname>struct spi_board_info</structname> descriptors which
  439. are usually provided by board-specific initialization code.
  440. A <structname>struct spi_driver</structname> is called a
  441. "Protocol Driver", and is bound to a spi_device using normal
  442. driver model calls.
  443. </para>
  444. <para>
  445. The I/O model is a set of queued messages. Protocol drivers
  446. submit one or more <structname>struct spi_message</structname>
  447. objects, which are processed and completed asynchronously.
  448. (There are synchronous wrappers, however.) Messages are
  449. built from one or more <structname>struct spi_transfer</structname>
  450. objects, each of which wraps a full duplex SPI transfer.
  451. A variety of protocol tweaking options are needed, because
  452. different chips adopt very different policies for how they
  453. use the bits transferred with SPI.
  454. </para>
  455. !Iinclude/linux/spi/spi.h
  456. !Fdrivers/spi/spi.c spi_register_board_info
  457. !Edrivers/spi/spi.c
  458. </chapter>
  459. <chapter id="i2c">
  460. <title>I<superscript>2</superscript>C and SMBus Subsystem</title>
  461. <para>
  462. I<superscript>2</superscript>C (or without fancy typography, "I2C")
  463. is an acronym for the "Inter-IC" bus, a simple bus protocol which is
  464. widely used where low data rate communications suffice.
  465. Since it's also a licensed trademark, some vendors use another
  466. name (such as "Two-Wire Interface", TWI) for the same bus.
  467. I2C only needs two signals (SCL for clock, SDA for data), conserving
  468. board real estate and minimizing signal quality issues.
  469. Most I2C devices use seven bit addresses, and bus speeds of up
  470. to 400 kHz; there's a high speed extension (3.4 MHz) that's not yet
  471. found wide use.
  472. I2C is a multi-master bus; open drain signaling is used to
  473. arbitrate between masters, as well as to handshake and to
  474. synchronize clocks from slower clients.
  475. </para>
  476. <para>
  477. The Linux I2C programming interfaces support only the master
  478. side of bus interactions, not the slave side.
  479. The programming interface is structured around two kinds of driver,
  480. and two kinds of device.
  481. An I2C "Adapter Driver" abstracts the controller hardware; it binds
  482. to a physical device (perhaps a PCI device or platform_device) and
  483. exposes a <structname>struct i2c_adapter</structname> representing
  484. each I2C bus segment it manages.
  485. On each I2C bus segment will be I2C devices represented by a
  486. <structname>struct i2c_client</structname>. Those devices will
  487. be bound to a <structname>struct i2c_driver</structname>,
  488. which should follow the standard Linux driver model.
  489. (At this writing, a legacy model is more widely used.)
  490. There are functions to perform various I2C protocol operations; at
  491. this writing all such functions are usable only from task context.
  492. </para>
  493. <para>
  494. The System Management Bus (SMBus) is a sibling protocol. Most SMBus
  495. systems are also I2C conformant. The electrical constraints are
  496. tighter for SMBus, and it standardizes particular protocol messages
  497. and idioms. Controllers that support I2C can also support most
  498. SMBus operations, but SMBus controllers don't support all the protocol
  499. options that an I2C controller will.
  500. There are functions to perform various SMBus protocol operations,
  501. either using I2C primitives or by issuing SMBus commands to
  502. i2c_adapter devices which don't support those I2C operations.
  503. </para>
  504. !Iinclude/linux/i2c.h
  505. !Fdrivers/i2c/i2c-boardinfo.c i2c_register_board_info
  506. !Edrivers/i2c/i2c-core.c
  507. </chapter>
  508. <chapter id="hsi">
  509. <title>High Speed Synchronous Serial Interface (HSI)</title>
  510. <para>
  511. High Speed Synchronous Serial Interface (HSI) is a
  512. serial interface mainly used for connecting application
  513. engines (APE) with cellular modem engines (CMT) in cellular
  514. handsets.
  515. HSI provides multiplexing for up to 16 logical channels,
  516. low-latency and full duplex communication.
  517. </para>
  518. !Iinclude/linux/hsi/hsi.h
  519. !Edrivers/hsi/hsi.c
  520. </chapter>
  521. <chapter id="pwm">
  522. <title>Pulse-Width Modulation (PWM)</title>
  523. <para>
  524. Pulse-width modulation is a modulation technique primarily used to
  525. control power supplied to electrical devices.
  526. </para>
  527. <para>
  528. The PWM framework provides an abstraction for providers and consumers
  529. of PWM signals. A controller that provides one or more PWM signals is
  530. registered as <structname>struct pwm_chip</structname>. Providers are
  531. expected to embed this structure in a driver-specific structure. This
  532. structure contains fields that describe a particular chip.
  533. </para>
  534. <para>
  535. A chip exposes one or more PWM signal sources, each of which exposed
  536. as a <structname>struct pwm_device</structname>. Operations can be
  537. performed on PWM devices to control the period, duty cycle, polarity
  538. and active state of the signal.
  539. </para>
  540. <para>
  541. Note that PWM devices are exclusive resources: they can always only be
  542. used by one consumer at a time.
  543. </para>
  544. !Iinclude/linux/pwm.h
  545. !Edrivers/pwm/core.c
  546. </chapter>
  547. </book>