1<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Chapter 11. I2C and SMBus Subsystem</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="Linux Device Drivers"><link rel="up" href="index.html" title="Linux Device Drivers"><link rel="prev" href="API-spi-write-then-read.html" title="spi_write_then_read"><link rel="next" href="API-struct-i2c-driver.html" title="struct i2c_driver"></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">Chapter 11. I<sup>2</sup>C and SMBus Subsystem</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="API-spi-write-then-read.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="API-struct-i2c-driver.html">Next</a></td></tr></table><hr></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="i2c"></a>Chapter 11. I<sup>2</sup>C and SMBus Subsystem</h1></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl class="toc"><dt><span class="refentrytitle"><a href="API-struct-i2c-driver.html"><span class="phrase">struct i2c_driver</span></a></span><span class="refpurpose"> — 
2  represent an I2C device driver
3 </span></dt><dt><span class="refentrytitle"><a href="API-struct-i2c-client.html"><span class="phrase">struct i2c_client</span></a></span><span class="refpurpose"> — 
4     represent an I2C slave device
5 </span></dt><dt><span class="refentrytitle"><a href="API-struct-i2c-board-info.html"><span class="phrase">struct i2c_board_info</span></a></span><span class="refpurpose"> — 
6     template for device creation
7 </span></dt><dt><span class="refentrytitle"><a href="API-I2C-BOARD-INFO.html"><span class="phrase">I2C_BOARD_INFO</span></a></span><span class="refpurpose"> — 
8     macro used to list an i2c device and its address
9 </span></dt><dt><span class="refentrytitle"><a href="API-struct-i2c-algorithm.html"><span class="phrase">struct i2c_algorithm</span></a></span><span class="refpurpose"> — 
10     represent I2C transfer method
11 </span></dt><dt><span class="refentrytitle"><a href="API-struct-i2c-bus-recovery-info.html"><span class="phrase">struct i2c_bus_recovery_info</span></a></span><span class="refpurpose"> — 
12     I2C bus recovery information
13 </span></dt><dt><span class="refentrytitle"><a href="API-struct-i2c-adapter-quirks.html"><span class="phrase">struct i2c_adapter_quirks</span></a></span><span class="refpurpose"> — 
14     describe flaws of an i2c adapter
15 </span></dt><dt><span class="refentrytitle"><a href="API-module-i2c-driver.html"><span class="phrase">module_i2c_driver</span></a></span><span class="refpurpose"> — 
16     Helper macro for registering a I2C driver
17 </span></dt><dt><span class="refentrytitle"><a href="API-i2c-register-board-info.html"><span class="phrase">i2c_register_board_info</span></a></span><span class="refpurpose"> — 
18  statically declare I2C devices
19 </span></dt><dt><span class="refentrytitle"><a href="API-i2c-verify-client.html"><span class="phrase">i2c_verify_client</span></a></span><span class="refpurpose"> — 
20  return parameter as i2c_client, or NULL
21 </span></dt><dt><span class="refentrytitle"><a href="API-i2c-lock-adapter.html"><span class="phrase">i2c_lock_adapter</span></a></span><span class="refpurpose"> — 
22     Get exclusive access to an I2C bus segment
23 </span></dt><dt><span class="refentrytitle"><a href="API-i2c-unlock-adapter.html"><span class="phrase">i2c_unlock_adapter</span></a></span><span class="refpurpose"> — 
24     Release exclusive access to an I2C bus segment
25 </span></dt><dt><span class="refentrytitle"><a href="API-i2c-new-device.html"><span class="phrase">i2c_new_device</span></a></span><span class="refpurpose"> — 
26     instantiate an i2c device
27 </span></dt><dt><span class="refentrytitle"><a href="API-i2c-unregister-device.html"><span class="phrase">i2c_unregister_device</span></a></span><span class="refpurpose">
28     reverse effect of i2c_new_device
29 </span></dt><dt><span class="refentrytitle"><a href="API-i2c-new-dummy.html"><span class="phrase">i2c_new_dummy</span></a></span><span class="refpurpose"> — 
30     return a new i2c device bound to a dummy driver
31 </span></dt><dt><span class="refentrytitle"><a href="API-i2c-verify-adapter.html"><span class="phrase">i2c_verify_adapter</span></a></span><span class="refpurpose"> — 
32     return parameter as i2c_adapter or NULL
33 </span></dt><dt><span class="refentrytitle"><a href="API-i2c-add-adapter.html"><span class="phrase">i2c_add_adapter</span></a></span><span class="refpurpose"> — 
34     declare i2c adapter, use dynamic bus number
35 </span></dt><dt><span class="refentrytitle"><a href="API-i2c-add-numbered-adapter.html"><span class="phrase">i2c_add_numbered_adapter</span></a></span><span class="refpurpose"> — 
36     declare i2c adapter, use static bus number
37 </span></dt><dt><span class="refentrytitle"><a href="API-i2c-del-adapter.html"><span class="phrase">i2c_del_adapter</span></a></span><span class="refpurpose"> — 
38     unregister I2C adapter
39 </span></dt><dt><span class="refentrytitle"><a href="API-i2c-del-driver.html"><span class="phrase">i2c_del_driver</span></a></span><span class="refpurpose"> — 
40     unregister I2C driver
41 </span></dt><dt><span class="refentrytitle"><a href="API-i2c-use-client.html"><span class="phrase">i2c_use_client</span></a></span><span class="refpurpose"> — 
42     increments the reference count of the i2c client structure
43 </span></dt><dt><span class="refentrytitle"><a href="API-i2c-release-client.html"><span class="phrase">i2c_release_client</span></a></span><span class="refpurpose"> — 
44     release a use of the i2c client structure
45 </span></dt><dt><span class="refentrytitle"><a href="API---i2c-transfer.html"><span class="phrase">__i2c_transfer</span></a></span><span class="refpurpose"> — 
46     unlocked flavor of i2c_transfer
47 </span></dt><dt><span class="refentrytitle"><a href="API-i2c-transfer.html"><span class="phrase">i2c_transfer</span></a></span><span class="refpurpose"> — 
48     execute a single or combined I2C message
49 </span></dt><dt><span class="refentrytitle"><a href="API-i2c-master-send.html"><span class="phrase">i2c_master_send</span></a></span><span class="refpurpose"> — 
50     issue a single I2C message in master transmit mode
51 </span></dt><dt><span class="refentrytitle"><a href="API-i2c-master-recv.html"><span class="phrase">i2c_master_recv</span></a></span><span class="refpurpose"> — 
52     issue a single I2C message in master receive mode
53 </span></dt><dt><span class="refentrytitle"><a href="API-i2c-smbus-read-byte.html"><span class="phrase">i2c_smbus_read_byte</span></a></span><span class="refpurpose"> — 
54     SMBus <span class="quote">“<span class="quote">receive byte</span>”</span> protocol
55 </span></dt><dt><span class="refentrytitle"><a href="API-i2c-smbus-write-byte.html"><span class="phrase">i2c_smbus_write_byte</span></a></span><span class="refpurpose"> — 
56     SMBus <span class="quote">“<span class="quote">send byte</span>”</span> protocol
57 </span></dt><dt><span class="refentrytitle"><a href="API-i2c-smbus-read-byte-data.html"><span class="phrase">i2c_smbus_read_byte_data</span></a></span><span class="refpurpose"> — 
58     SMBus <span class="quote">“<span class="quote">read byte</span>”</span> protocol
59 </span></dt><dt><span class="refentrytitle"><a href="API-i2c-smbus-write-byte-data.html"><span class="phrase">i2c_smbus_write_byte_data</span></a></span><span class="refpurpose"> — 
60     SMBus <span class="quote">“<span class="quote">write byte</span>”</span> protocol
61 </span></dt><dt><span class="refentrytitle"><a href="API-i2c-smbus-read-word-data.html"><span class="phrase">i2c_smbus_read_word_data</span></a></span><span class="refpurpose"> — 
62     SMBus <span class="quote">“<span class="quote">read word</span>”</span> protocol
63 </span></dt><dt><span class="refentrytitle"><a href="API-i2c-smbus-write-word-data.html"><span class="phrase">i2c_smbus_write_word_data</span></a></span><span class="refpurpose"> — 
64     SMBus <span class="quote">“<span class="quote">write word</span>”</span> protocol
65 </span></dt><dt><span class="refentrytitle"><a href="API-i2c-smbus-read-block-data.html"><span class="phrase">i2c_smbus_read_block_data</span></a></span><span class="refpurpose"> — 
66     SMBus <span class="quote">“<span class="quote">block read</span>”</span> protocol
67 </span></dt><dt><span class="refentrytitle"><a href="API-i2c-smbus-write-block-data.html"><span class="phrase">i2c_smbus_write_block_data</span></a></span><span class="refpurpose"> — 
68     SMBus <span class="quote">“<span class="quote">block write</span>”</span> protocol
69 </span></dt><dt><span class="refentrytitle"><a href="API-i2c-smbus-xfer.html"><span class="phrase">i2c_smbus_xfer</span></a></span><span class="refpurpose"> — 
70     execute SMBus protocol operations
71 </span></dt><dt><span class="refentrytitle"><a href="API-i2c-smbus-read-i2c-block-data-or-emulated.html"><span class="phrase">i2c_smbus_read_i2c_block_data_or_emulated</span></a></span><span class="refpurpose"> — 
72     read block or emulate
73 </span></dt></dl></div><p>
74	I<sup>2</sup>C (or without fancy typography, "I2C")
75	is an acronym for the "Inter-IC" bus, a simple bus protocol which is
76	widely used where low data rate communications suffice.
77	Since it's also a licensed trademark, some vendors use another
78	name (such as "Two-Wire Interface", TWI) for the same bus.
79	I2C only needs two signals (SCL for clock, SDA for data), conserving
80	board real estate and minimizing signal quality issues.
81	Most I2C devices use seven bit addresses, and bus speeds of up
82	to 400 kHz; there's a high speed extension (3.4 MHz) that's not yet
83	found wide use.
84	I2C is a multi-master bus; open drain signaling is used to
85	arbitrate between masters, as well as to handshake and to
86	synchronize clocks from slower clients.
87     </p><p>
88	The Linux I2C programming interfaces support only the master
89	side of bus interactions, not the slave side.
90	The programming interface is structured around two kinds of driver,
91	and two kinds of device.
92	An I2C "Adapter Driver" abstracts the controller hardware; it binds
93	to a physical device (perhaps a PCI device or platform_device) and
94	exposes a <span class="structname">struct i2c_adapter</span> representing
95	each I2C bus segment it manages.
96	On each I2C bus segment will be I2C devices represented by a
97	<span class="structname"><a class="link" href="API-struct-i2c-client.html" title="struct i2c_client">struct i2c_client</a></span>.  Those devices will
98	be bound to a <span class="structname"><a class="link" href="API-struct-i2c-driver.html" title="struct i2c_driver">struct i2c_driver</a></span>,
99	which should follow the standard Linux driver model.
100	(At this writing, a legacy model is more widely used.)
101	There are functions to perform various I2C protocol operations; at
102	this writing all such functions are usable only from task context.
103     </p><p>
104	The System Management Bus (SMBus) is a sibling protocol.  Most SMBus
105	systems are also I2C conformant.  The electrical constraints are
106	tighter for SMBus, and it standardizes particular protocol messages
107	and idioms.  Controllers that support I2C can also support most
108	SMBus operations, but SMBus controllers don't support all the protocol
109	options that an I2C controller will.
110	There are functions to perform various SMBus protocol operations,
111	either using I2C primitives or by issuing SMBus commands to
112	i2c_adapter devices which don't support those I2C operations.
113     </p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="API-spi-write-then-read.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="API-struct-i2c-driver.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><span class="phrase">spi_write_then_read</span> </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> <span class="phrase">struct i2c_driver</span></td></tr></table></div></body></html>
114