kernel-api.tmpl 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653
  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="LinuxKernelAPI">
  5. <bookinfo>
  6. <title>The Linux Kernel API</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. !Iinclude/asm-x86/atomic_32.h
  41. !Iinclude/asm-x86/unaligned.h
  42. </sect1>
  43. <sect1><title>Delaying, scheduling, and timer routines</title>
  44. !Iinclude/linux/sched.h
  45. !Ekernel/sched.c
  46. !Ekernel/timer.c
  47. </sect1>
  48. <sect1><title>High-resolution timers</title>
  49. !Iinclude/linux/ktime.h
  50. !Iinclude/linux/hrtimer.h
  51. !Ekernel/hrtimer.c
  52. </sect1>
  53. <sect1><title>Workqueues and Kevents</title>
  54. !Ekernel/workqueue.c
  55. </sect1>
  56. <sect1><title>Internal Functions</title>
  57. !Ikernel/exit.c
  58. !Ikernel/signal.c
  59. !Iinclude/linux/kthread.h
  60. !Ekernel/kthread.c
  61. </sect1>
  62. <sect1><title>Kernel objects manipulation</title>
  63. <!--
  64. X!Iinclude/linux/kobject.h
  65. -->
  66. !Elib/kobject.c
  67. </sect1>
  68. <sect1><title>Kernel utility functions</title>
  69. !Iinclude/linux/kernel.h
  70. !Ekernel/printk.c
  71. !Ekernel/panic.c
  72. !Ekernel/sys.c
  73. !Ekernel/rcupdate.c
  74. </sect1>
  75. <sect1><title>Device Resource Management</title>
  76. !Edrivers/base/devres.c
  77. </sect1>
  78. </chapter>
  79. <chapter id="adt">
  80. <title>Data Types</title>
  81. <sect1><title>Doubly Linked Lists</title>
  82. !Iinclude/linux/list.h
  83. </sect1>
  84. </chapter>
  85. <chapter id="libc">
  86. <title>Basic C Library Functions</title>
  87. <para>
  88. When writing drivers, you cannot in general use routines which are
  89. from the C Library. Some of the functions have been found generally
  90. useful and they are listed below. The behaviour of these functions
  91. may vary slightly from those defined by ANSI, and these deviations
  92. are noted in the text.
  93. </para>
  94. <sect1><title>String Conversions</title>
  95. !Ilib/vsprintf.c
  96. !Elib/vsprintf.c
  97. </sect1>
  98. <sect1><title>String Manipulation</title>
  99. <!-- All functions are exported at now
  100. X!Ilib/string.c
  101. -->
  102. !Elib/string.c
  103. </sect1>
  104. <sect1><title>Bit Operations</title>
  105. !Iinclude/asm-x86/bitops_32.h
  106. </sect1>
  107. </chapter>
  108. <chapter id="kernel-lib">
  109. <title>Basic Kernel Library Functions</title>
  110. <para>
  111. The Linux kernel provides more basic utility functions.
  112. </para>
  113. <sect1><title>Bitmap Operations</title>
  114. !Elib/bitmap.c
  115. !Ilib/bitmap.c
  116. </sect1>
  117. <sect1><title>Command-line Parsing</title>
  118. !Elib/cmdline.c
  119. </sect1>
  120. <sect1 id="crc"><title>CRC Functions</title>
  121. !Elib/crc7.c
  122. !Elib/crc16.c
  123. !Elib/crc-itu-t.c
  124. !Elib/crc32.c
  125. !Elib/crc-ccitt.c
  126. </sect1>
  127. </chapter>
  128. <chapter id="mm">
  129. <title>Memory Management in Linux</title>
  130. <sect1><title>The Slab Cache</title>
  131. !Iinclude/linux/slab.h
  132. !Emm/slab.c
  133. </sect1>
  134. <sect1><title>User Space Memory Access</title>
  135. !Iinclude/asm-x86/uaccess_32.h
  136. !Earch/x86/lib/usercopy_32.c
  137. </sect1>
  138. <sect1><title>More Memory Management Functions</title>
  139. !Emm/readahead.c
  140. !Emm/filemap.c
  141. !Emm/memory.c
  142. !Emm/vmalloc.c
  143. !Imm/page_alloc.c
  144. !Emm/mempool.c
  145. !Emm/dmapool.c
  146. !Emm/page-writeback.c
  147. !Emm/truncate.c
  148. </sect1>
  149. </chapter>
  150. <chapter id="ipc">
  151. <title>Kernel IPC facilities</title>
  152. <sect1><title>IPC utilities</title>
  153. !Iipc/util.c
  154. </sect1>
  155. </chapter>
  156. <chapter id="kfifo">
  157. <title>FIFO Buffer</title>
  158. <sect1><title>kfifo interface</title>
  159. !Iinclude/linux/kfifo.h
  160. !Ekernel/kfifo.c
  161. </sect1>
  162. </chapter>
  163. <chapter id="relayfs">
  164. <title>relay interface support</title>
  165. <para>
  166. Relay interface support
  167. is designed to provide an efficient mechanism for tools and
  168. facilities to relay large amounts of data from kernel space to
  169. user space.
  170. </para>
  171. <sect1><title>relay interface</title>
  172. !Ekernel/relay.c
  173. !Ikernel/relay.c
  174. </sect1>
  175. </chapter>
  176. <chapter id="modload">
  177. <title>Module Support</title>
  178. <sect1><title>Module Loading</title>
  179. !Ekernel/kmod.c
  180. </sect1>
  181. <sect1><title>Inter Module support</title>
  182. <para>
  183. Refer to the file kernel/module.c for more information.
  184. </para>
  185. <!-- FIXME: Removed for now since no structured comments in source
  186. X!Ekernel/module.c
  187. -->
  188. </sect1>
  189. </chapter>
  190. <chapter id="hardware">
  191. <title>Hardware Interfaces</title>
  192. <sect1><title>Interrupt Handling</title>
  193. !Ekernel/irq/manage.c
  194. </sect1>
  195. <sect1><title>DMA Channels</title>
  196. !Ekernel/dma.c
  197. </sect1>
  198. <sect1><title>Resources Management</title>
  199. !Ikernel/resource.c
  200. !Ekernel/resource.c
  201. </sect1>
  202. <sect1><title>MTRR Handling</title>
  203. !Earch/x86/kernel/cpu/mtrr/main.c
  204. </sect1>
  205. <sect1><title>PCI Support Library</title>
  206. !Edrivers/pci/pci.c
  207. !Edrivers/pci/pci-driver.c
  208. !Edrivers/pci/remove.c
  209. !Edrivers/pci/pci-acpi.c
  210. !Edrivers/pci/search.c
  211. !Edrivers/pci/msi.c
  212. !Edrivers/pci/bus.c
  213. <!-- FIXME: Removed for now since no structured comments in source
  214. X!Edrivers/pci/hotplug.c
  215. -->
  216. !Edrivers/pci/probe.c
  217. !Edrivers/pci/rom.c
  218. </sect1>
  219. <sect1><title>PCI Hotplug Support Library</title>
  220. !Edrivers/pci/hotplug/pci_hotplug_core.c
  221. </sect1>
  222. <sect1><title>MCA Architecture</title>
  223. <sect2><title>MCA Device Functions</title>
  224. <para>
  225. Refer to the file arch/x86/kernel/mca_32.c for more information.
  226. </para>
  227. <!-- FIXME: Removed for now since no structured comments in source
  228. X!Earch/x86/kernel/mca_32.c
  229. -->
  230. </sect2>
  231. <sect2><title>MCA Bus DMA</title>
  232. !Iinclude/asm-x86/mca_dma.h
  233. </sect2>
  234. </sect1>
  235. </chapter>
  236. <chapter id="firmware">
  237. <title>Firmware Interfaces</title>
  238. <sect1><title>DMI Interfaces</title>
  239. !Edrivers/firmware/dmi_scan.c
  240. </sect1>
  241. <sect1><title>EDD Interfaces</title>
  242. !Idrivers/firmware/edd.c
  243. </sect1>
  244. </chapter>
  245. <chapter id="security">
  246. <title>Security Framework</title>
  247. !Isecurity/security.c
  248. </chapter>
  249. <chapter id="audit">
  250. <title>Audit Interfaces</title>
  251. !Ekernel/audit.c
  252. !Ikernel/auditsc.c
  253. !Ikernel/auditfilter.c
  254. </chapter>
  255. <chapter id="accounting">
  256. <title>Accounting Framework</title>
  257. !Ikernel/acct.c
  258. </chapter>
  259. <chapter id="pmfuncs">
  260. <title>Power Management</title>
  261. !Ekernel/power/pm.c
  262. </chapter>
  263. <chapter id="devdrivers">
  264. <title>Device drivers infrastructure</title>
  265. <sect1><title>Device Drivers Base</title>
  266. <!--
  267. X!Iinclude/linux/device.h
  268. -->
  269. !Edrivers/base/driver.c
  270. !Edrivers/base/core.c
  271. !Edrivers/base/class.c
  272. !Edrivers/base/firmware_class.c
  273. !Edrivers/base/transport_class.c
  274. <!-- Cannot be included, because
  275. attribute_container_add_class_device_adapter
  276. and attribute_container_classdev_to_container
  277. exceed allowed 44 characters maximum
  278. X!Edrivers/base/attribute_container.c
  279. -->
  280. !Edrivers/base/sys.c
  281. <!--
  282. X!Edrivers/base/interface.c
  283. -->
  284. !Edrivers/base/platform.c
  285. !Edrivers/base/bus.c
  286. </sect1>
  287. <sect1><title>Device Drivers Power Management</title>
  288. !Edrivers/base/power/main.c
  289. </sect1>
  290. <sect1><title>Device Drivers ACPI Support</title>
  291. <!-- Internal functions only
  292. X!Edrivers/acpi/sleep/main.c
  293. X!Edrivers/acpi/sleep/wakeup.c
  294. X!Edrivers/acpi/motherboard.c
  295. X!Edrivers/acpi/bus.c
  296. -->
  297. !Edrivers/acpi/scan.c
  298. !Idrivers/acpi/scan.c
  299. <!-- No correct structured comments
  300. X!Edrivers/acpi/pci_bind.c
  301. -->
  302. </sect1>
  303. <sect1><title>Device drivers PnP support</title>
  304. !Idrivers/pnp/core.c
  305. <!-- No correct structured comments
  306. X!Edrivers/pnp/system.c
  307. -->
  308. !Edrivers/pnp/card.c
  309. !Idrivers/pnp/driver.c
  310. !Edrivers/pnp/manager.c
  311. !Edrivers/pnp/support.c
  312. </sect1>
  313. <sect1><title>Userspace IO devices</title>
  314. !Edrivers/uio/uio.c
  315. !Iinclude/linux/uio_driver.h
  316. </sect1>
  317. </chapter>
  318. <chapter id="blkdev">
  319. <title>Block Devices</title>
  320. !Eblock/blk-core.c
  321. !Iblock/blk-core.c
  322. !Eblock/blk-map.c
  323. !Iblock/blk-sysfs.c
  324. !Eblock/blk-settings.c
  325. !Eblock/blk-exec.c
  326. !Eblock/blk-barrier.c
  327. !Eblock/blk-tag.c
  328. !Iblock/blk-tag.c
  329. </chapter>
  330. <chapter id="chrdev">
  331. <title>Char devices</title>
  332. !Efs/char_dev.c
  333. </chapter>
  334. <chapter id="miscdev">
  335. <title>Miscellaneous Devices</title>
  336. !Edrivers/char/misc.c
  337. </chapter>
  338. <chapter id="parportdev">
  339. <title>Parallel Port Devices</title>
  340. !Iinclude/linux/parport.h
  341. !Edrivers/parport/ieee1284.c
  342. !Edrivers/parport/share.c
  343. !Idrivers/parport/daisy.c
  344. </chapter>
  345. <chapter id="message_devices">
  346. <title>Message-based devices</title>
  347. <sect1><title>Fusion message devices</title>
  348. !Edrivers/message/fusion/mptbase.c
  349. !Idrivers/message/fusion/mptbase.c
  350. !Edrivers/message/fusion/mptscsih.c
  351. !Idrivers/message/fusion/mptscsih.c
  352. !Idrivers/message/fusion/mptctl.c
  353. !Idrivers/message/fusion/mptspi.c
  354. !Idrivers/message/fusion/mptfc.c
  355. !Idrivers/message/fusion/mptlan.c
  356. </sect1>
  357. <sect1><title>I2O message devices</title>
  358. !Iinclude/linux/i2o.h
  359. !Idrivers/message/i2o/core.h
  360. !Edrivers/message/i2o/iop.c
  361. !Idrivers/message/i2o/iop.c
  362. !Idrivers/message/i2o/config-osm.c
  363. !Edrivers/message/i2o/exec-osm.c
  364. !Idrivers/message/i2o/exec-osm.c
  365. !Idrivers/message/i2o/bus-osm.c
  366. !Edrivers/message/i2o/device.c
  367. !Idrivers/message/i2o/device.c
  368. !Idrivers/message/i2o/driver.c
  369. !Idrivers/message/i2o/pci.c
  370. !Idrivers/message/i2o/i2o_block.c
  371. !Idrivers/message/i2o/i2o_scsi.c
  372. !Idrivers/message/i2o/i2o_proc.c
  373. </sect1>
  374. </chapter>
  375. <chapter id="snddev">
  376. <title>Sound Devices</title>
  377. !Iinclude/sound/core.h
  378. !Esound/sound_core.c
  379. !Iinclude/sound/pcm.h
  380. !Esound/core/pcm.c
  381. !Esound/core/device.c
  382. !Esound/core/info.c
  383. !Esound/core/rawmidi.c
  384. !Esound/core/sound.c
  385. !Esound/core/memory.c
  386. !Esound/core/pcm_memory.c
  387. !Esound/core/init.c
  388. !Esound/core/isadma.c
  389. !Esound/core/control.c
  390. !Esound/core/pcm_lib.c
  391. !Esound/core/hwdep.c
  392. !Esound/core/pcm_native.c
  393. !Esound/core/memalloc.c
  394. <!-- FIXME: Removed for now since no structured comments in source
  395. X!Isound/sound_firmware.c
  396. -->
  397. </chapter>
  398. <chapter id="uart16x50">
  399. <title>16x50 UART Driver</title>
  400. !Iinclude/linux/serial_core.h
  401. !Edrivers/serial/serial_core.c
  402. !Edrivers/serial/8250.c
  403. </chapter>
  404. <chapter id="fbdev">
  405. <title>Frame Buffer Library</title>
  406. <para>
  407. The frame buffer drivers depend heavily on four data structures.
  408. These structures are declared in include/linux/fb.h. They are
  409. fb_info, fb_var_screeninfo, fb_fix_screeninfo and fb_monospecs.
  410. The last three can be made available to and from userland.
  411. </para>
  412. <para>
  413. fb_info defines the current state of a particular video card.
  414. Inside fb_info, there exists a fb_ops structure which is a
  415. collection of needed functions to make fbdev and fbcon work.
  416. fb_info is only visible to the kernel.
  417. </para>
  418. <para>
  419. fb_var_screeninfo is used to describe the features of a video card
  420. that are user defined. With fb_var_screeninfo, things such as
  421. depth and the resolution may be defined.
  422. </para>
  423. <para>
  424. The next structure is fb_fix_screeninfo. This defines the
  425. properties of a card that are created when a mode is set and can't
  426. be changed otherwise. A good example of this is the start of the
  427. frame buffer memory. This "locks" the address of the frame buffer
  428. memory, so that it cannot be changed or moved.
  429. </para>
  430. <para>
  431. The last structure is fb_monospecs. In the old API, there was
  432. little importance for fb_monospecs. This allowed for forbidden things
  433. such as setting a mode of 800x600 on a fix frequency monitor. With
  434. the new API, fb_monospecs prevents such things, and if used
  435. correctly, can prevent a monitor from being cooked. fb_monospecs
  436. will not be useful until kernels 2.5.x.
  437. </para>
  438. <sect1><title>Frame Buffer Memory</title>
  439. !Edrivers/video/fbmem.c
  440. </sect1>
  441. <!--
  442. <sect1><title>Frame Buffer Console</title>
  443. X!Edrivers/video/console/fbcon.c
  444. </sect1>
  445. -->
  446. <sect1><title>Frame Buffer Colormap</title>
  447. !Edrivers/video/fbcmap.c
  448. </sect1>
  449. <!-- FIXME:
  450. drivers/video/fbgen.c has no docs, which stuffs up the sgml. Comment
  451. out until somebody adds docs. KAO
  452. <sect1><title>Frame Buffer Generic Functions</title>
  453. X!Idrivers/video/fbgen.c
  454. </sect1>
  455. KAO -->
  456. <sect1><title>Frame Buffer Video Mode Database</title>
  457. !Idrivers/video/modedb.c
  458. !Edrivers/video/modedb.c
  459. </sect1>
  460. <sect1><title>Frame Buffer Macintosh Video Mode Database</title>
  461. !Edrivers/video/macmodes.c
  462. </sect1>
  463. <sect1><title>Frame Buffer Fonts</title>
  464. <para>
  465. Refer to the file drivers/video/console/fonts.c for more information.
  466. </para>
  467. <!-- FIXME: Removed for now since no structured comments in source
  468. X!Idrivers/video/console/fonts.c
  469. -->
  470. </sect1>
  471. </chapter>
  472. <chapter id="input_subsystem">
  473. <title>Input Subsystem</title>
  474. !Iinclude/linux/input.h
  475. !Edrivers/input/input.c
  476. !Edrivers/input/ff-core.c
  477. !Edrivers/input/ff-memless.c
  478. </chapter>
  479. <chapter id="spi">
  480. <title>Serial Peripheral Interface (SPI)</title>
  481. <para>
  482. SPI is the "Serial Peripheral Interface", widely used with
  483. embedded systems because it is a simple and efficient
  484. interface: basically a multiplexed shift register.
  485. Its three signal wires hold a clock (SCK, often in the range
  486. of 1-20 MHz), a "Master Out, Slave In" (MOSI) data line, and
  487. a "Master In, Slave Out" (MISO) data line.
  488. SPI is a full duplex protocol; for each bit shifted out the
  489. MOSI line (one per clock) another is shifted in on the MISO line.
  490. Those bits are assembled into words of various sizes on the
  491. way to and from system memory.
  492. An additional chipselect line is usually active-low (nCS);
  493. four signals are normally used for each peripheral, plus
  494. sometimes an interrupt.
  495. </para>
  496. <para>
  497. The SPI bus facilities listed here provide a generalized
  498. interface to declare SPI busses and devices, manage them
  499. according to the standard Linux driver model, and perform
  500. input/output operations.
  501. At this time, only "master" side interfaces are supported,
  502. where Linux talks to SPI peripherals and does not implement
  503. such a peripheral itself.
  504. (Interfaces to support implementing SPI slaves would
  505. necessarily look different.)
  506. </para>
  507. <para>
  508. The programming interface is structured around two kinds of driver,
  509. and two kinds of device.
  510. A "Controller Driver" abstracts the controller hardware, which may
  511. be as simple as a set of GPIO pins or as complex as a pair of FIFOs
  512. connected to dual DMA engines on the other side of the SPI shift
  513. register (maximizing throughput). Such drivers bridge between
  514. whatever bus they sit on (often the platform bus) and SPI, and
  515. expose the SPI side of their device as a
  516. <structname>struct spi_master</structname>.
  517. SPI devices are children of that master, represented as a
  518. <structname>struct spi_device</structname> and manufactured from
  519. <structname>struct spi_board_info</structname> descriptors which
  520. are usually provided by board-specific initialization code.
  521. A <structname>struct spi_driver</structname> is called a
  522. "Protocol Driver", and is bound to a spi_device using normal
  523. driver model calls.
  524. </para>
  525. <para>
  526. The I/O model is a set of queued messages. Protocol drivers
  527. submit one or more <structname>struct spi_message</structname>
  528. objects, which are processed and completed asynchronously.
  529. (There are synchronous wrappers, however.) Messages are
  530. built from one or more <structname>struct spi_transfer</structname>
  531. objects, each of which wraps a full duplex SPI transfer.
  532. A variety of protocol tweaking options are needed, because
  533. different chips adopt very different policies for how they
  534. use the bits transferred with SPI.
  535. </para>
  536. !Iinclude/linux/spi/spi.h
  537. !Fdrivers/spi/spi.c spi_register_board_info
  538. !Edrivers/spi/spi.c
  539. </chapter>
  540. <chapter id="i2c">
  541. <title>I<superscript>2</superscript>C and SMBus Subsystem</title>
  542. <para>
  543. I<superscript>2</superscript>C (or without fancy typography, "I2C")
  544. is an acronym for the "Inter-IC" bus, a simple bus protocol which is
  545. widely used where low data rate communications suffice.
  546. Since it's also a licensed trademark, some vendors use another
  547. name (such as "Two-Wire Interface", TWI) for the same bus.
  548. I2C only needs two signals (SCL for clock, SDA for data), conserving
  549. board real estate and minimizing signal quality issues.
  550. Most I2C devices use seven bit addresses, and bus speeds of up
  551. to 400 kHz; there's a high speed extension (3.4 MHz) that's not yet
  552. found wide use.
  553. I2C is a multi-master bus; open drain signaling is used to
  554. arbitrate between masters, as well as to handshake and to
  555. synchronize clocks from slower clients.
  556. </para>
  557. <para>
  558. The Linux I2C programming interfaces support only the master
  559. side of bus interactions, not the slave side.
  560. The programming interface is structured around two kinds of driver,
  561. and two kinds of device.
  562. An I2C "Adapter Driver" abstracts the controller hardware; it binds
  563. to a physical device (perhaps a PCI device or platform_device) and
  564. exposes a <structname>struct i2c_adapter</structname> representing
  565. each I2C bus segment it manages.
  566. On each I2C bus segment will be I2C devices represented by a
  567. <structname>struct i2c_client</structname>. Those devices will
  568. be bound to a <structname>struct i2c_driver</structname>,
  569. which should follow the standard Linux driver model.
  570. (At this writing, a legacy model is more widely used.)
  571. There are functions to perform various I2C protocol operations; at
  572. this writing all such functions are usable only from task context.
  573. </para>
  574. <para>
  575. The System Management Bus (SMBus) is a sibling protocol. Most SMBus
  576. systems are also I2C conformant. The electrical constraints are
  577. tighter for SMBus, and it standardizes particular protocol messages
  578. and idioms. Controllers that support I2C can also support most
  579. SMBus operations, but SMBus controllers don't support all the protocol
  580. options that an I2C controller will.
  581. There are functions to perform various SMBus protocol operations,
  582. either using I2C primitives or by issuing SMBus commands to
  583. i2c_adapter devices which don't support those I2C operations.
  584. </para>
  585. !Iinclude/linux/i2c.h
  586. !Fdrivers/i2c/i2c-boardinfo.c i2c_register_board_info
  587. !Edrivers/i2c/i2c-core.c
  588. </chapter>
  589. </book>