5 The following is a summary of the SMBus protocol. It applies to
6 all revisions of the protocol (1.0, 1.1, and 2.0).
7 Certain protocol features which are not supported by
8 this package are briefly described at the end of this document.
10 Some adapters understand only the SMBus (System Management Bus) protocol,
11 which is a subset from the I2C protocol. Fortunately, many devices use
12 only the same subset, which makes it possible to put them on an SMBus.
14 If you write a driver for some I2C device, please try to use the SMBus
15 commands if at all possible (if the device uses only that subset of the
16 I2C protocol). This makes it possible to use the device driver on both
17 SMBus adapters and I2C adapters (the SMBus command set is automatically
18 translated to I2C on I2C adapters, but plain I2C commands can not be
19 handled at all on most pure SMBus adapters).
21 Below is a list of SMBus protocol operations, and the functions executing
22 them. Note that the names used in the SMBus protocol specifications usually
23 don't match these function names. For some of the operations which pass a
24 single data byte, the functions using SMBus protocol operation names execute
25 a different protocol operation entirely.
27 Each transaction type corresponds to a functionality flag. Before calling a
28 transaction function, a device driver should always check (just once) for
29 the corresponding functionality flag to ensure that the underlying I2C
30 adapter supports the transaction in question. See
31 <file:Documentation/i2c/functionality.rst> for the details.
37 =============== =============================================================
40 Rd/Wr (1 bit) : Read/Write bit. Rd equals 1, Wr equals 0.
41 A, NA (1 bit) : Accept and reverse accept bit.
42 Addr (7 bits): I2C 7 bit address. Note that this can be expanded as usual to
43 get a 10 bit I2C address.
44 Comm (8 bits): Command byte, a data byte which often selects a register on
46 Data (8 bits): A plain data byte. Sometimes, I write DataLow, DataHigh
48 Count (8 bits): A data byte containing the length of a block operation.
50 [..]: Data sent by I2C device, as opposed to data sent by the host
52 =============== =============================================================
58 This sends a single bit to the device, at the place of the Rd/Wr bit::
62 Functionality flag: I2C_FUNC_SMBUS_QUICK
65 SMBus Receive Byte: i2c_smbus_read_byte()
66 ==========================================
68 This reads a single byte from a device, without specifying a device
69 register. Some devices are so simple that this interface is enough; for
70 others, it is a shorthand if you want to read the same register as in
71 the previous SMBus command::
73 S Addr Rd [A] [Data] NA P
75 Functionality flag: I2C_FUNC_SMBUS_READ_BYTE
78 SMBus Send Byte: i2c_smbus_write_byte()
79 ========================================
81 This operation is the reverse of Receive Byte: it sends a single byte
82 to a device. See Receive Byte for more information.
86 S Addr Wr [A] Data [A] P
88 Functionality flag: I2C_FUNC_SMBUS_WRITE_BYTE
91 SMBus Read Byte: i2c_smbus_read_byte_data()
92 ============================================
94 This reads a single byte from a device, from a designated register.
95 The register is specified through the Comm byte::
97 S Addr Wr [A] Comm [A] S Addr Rd [A] [Data] NA P
99 Functionality flag: I2C_FUNC_SMBUS_READ_BYTE_DATA
102 SMBus Read Word: i2c_smbus_read_word_data()
103 ============================================
105 This operation is very like Read Byte; again, data is read from a
106 device, from a designated register that is specified through the Comm
107 byte. But this time, the data is a complete word (16 bits)::
109 S Addr Wr [A] Comm [A] S Addr Rd [A] [DataLow] A [DataHigh] NA P
111 Functionality flag: I2C_FUNC_SMBUS_READ_WORD_DATA
113 Note the convenience function i2c_smbus_read_word_swapped is
114 available for reads where the two data bytes are the other way
115 around (not SMBus compliant, but very popular.)
118 SMBus Write Byte: i2c_smbus_write_byte_data()
119 ==============================================
121 This writes a single byte to a device, to a designated register. The
122 register is specified through the Comm byte. This is the opposite of
123 the Read Byte operation.
127 S Addr Wr [A] Comm [A] Data [A] P
129 Functionality flag: I2C_FUNC_SMBUS_WRITE_BYTE_DATA
132 SMBus Write Word: i2c_smbus_write_word_data()
133 ==============================================
135 This is the opposite of the Read Word operation. 16 bits
136 of data is written to a device, to the designated register that is
137 specified through the Comm byte.::
139 S Addr Wr [A] Comm [A] DataLow [A] DataHigh [A] P
141 Functionality flag: I2C_FUNC_SMBUS_WRITE_WORD_DATA
143 Note the convenience function i2c_smbus_write_word_swapped is
144 available for writes where the two data bytes are the other way
145 around (not SMBus compliant, but very popular.)
151 This command selects a device register (through the Comm byte), sends
152 16 bits of data to it, and reads 16 bits of data in return::
154 S Addr Wr [A] Comm [A] DataLow [A] DataHigh [A]
155 S Addr Rd [A] [DataLow] A [DataHigh] NA P
157 Functionality flag: I2C_FUNC_SMBUS_PROC_CALL
160 SMBus Block Read: i2c_smbus_read_block_data()
161 ==============================================
163 This command reads a block of up to 32 bytes from a device, from a
164 designated register that is specified through the Comm byte. The amount
165 of data is specified by the device in the Count byte.
169 S Addr Wr [A] Comm [A]
170 S Addr Rd [A] [Count] A [Data] A [Data] A ... A [Data] NA P
172 Functionality flag: I2C_FUNC_SMBUS_READ_BLOCK_DATA
175 SMBus Block Write: i2c_smbus_write_block_data()
176 ================================================
178 The opposite of the Block Read command, this writes up to 32 bytes to
179 a device, to a designated register that is specified through the
180 Comm byte. The amount of data is specified in the Count byte.
184 S Addr Wr [A] Comm [A] Count [A] Data [A] Data [A] ... [A] Data [A] P
186 Functionality flag: I2C_FUNC_SMBUS_WRITE_BLOCK_DATA
189 SMBus Block Write - Block Read Process Call
190 ===========================================
192 SMBus Block Write - Block Read Process Call was introduced in
193 Revision 2.0 of the specification.
195 This command selects a device register (through the Comm byte), sends
196 1 to 31 bytes of data to it, and reads 1 to 31 bytes of data in return::
198 S Addr Wr [A] Comm [A] Count [A] Data [A] ...
199 S Addr Rd [A] [Count] A [Data] ... A P
201 Functionality flag: I2C_FUNC_SMBUS_BLOCK_PROC_CALL
207 This command is sent from a SMBus device acting as a master to the
208 SMBus host acting as a slave.
209 It is the same form as Write Word, with the command code replaced by the
210 alerting device's address.
214 [S] [HostAddr] [Wr] A [DevAddr] A [DataLow] A [DataHigh] A [P]
216 This is implemented in the following way in the Linux kernel:
218 * I2C bus drivers which support SMBus Host Notify should report
219 I2C_FUNC_SMBUS_HOST_NOTIFY.
220 * I2C bus drivers trigger SMBus Host Notify by a call to
221 i2c_handle_smbus_host_notify().
222 * I2C drivers for devices which can trigger SMBus Host Notify will have
223 client->irq assigned to a Host Notify IRQ if noone else specified an other.
225 There is currently no way to retrieve the data parameter from the client.
228 Packet Error Checking (PEC)
229 ===========================
231 Packet Error Checking was introduced in Revision 1.1 of the specification.
233 PEC adds a CRC-8 error-checking byte to transfers using it, immediately
234 before the terminating STOP.
237 Address Resolution Protocol (ARP)
238 =================================
240 The Address Resolution Protocol was introduced in Revision 2.0 of
241 the specification. It is a higher-layer protocol which uses the
244 ARP adds device enumeration and dynamic address assignment to
245 the protocol. All ARP communications use slave address 0x61 and
246 require PEC checksums.
252 SMBus Alert was introduced in Revision 1.0 of the specification.
254 The SMBus alert protocol allows several SMBus slave devices to share a
255 single interrupt pin on the SMBus master, while still allowing the master
256 to know which slave triggered the interrupt.
258 This is implemented the following way in the Linux kernel:
260 * I2C bus drivers which support SMBus alert should call
261 i2c_setup_smbus_alert() to setup SMBus alert support.
262 * I2C drivers for devices which can trigger SMBus alerts should implement
263 the optional alert() callback.
266 I2C Block Transactions
267 ======================
269 The following I2C block transactions are supported by the
270 SMBus layer and are described here for completeness.
271 They are *NOT* defined by the SMBus specification.
273 I2C block transactions do not limit the number of bytes transferred
274 but the SMBus layer places a limit of 32 bytes.
277 I2C Block Read: i2c_smbus_read_i2c_block_data()
278 ================================================
280 This command reads a block of bytes from a device, from a
281 designated register that is specified through the Comm byte::
283 S Addr Wr [A] Comm [A]
284 S Addr Rd [A] [Data] A [Data] A ... A [Data] NA P
286 Functionality flag: I2C_FUNC_SMBUS_READ_I2C_BLOCK
289 I2C Block Write: i2c_smbus_write_i2c_block_data()
290 ==================================================
292 The opposite of the Block Read command, this writes bytes to
293 a device, to a designated register that is specified through the
294 Comm byte. Note that command lengths of 0, 2, or more bytes are
295 supported as they are indistinguishable from data.
299 S Addr Wr [A] Comm [A] Data [A] Data [A] ... [A] Data [A] P
301 Functionality flag: I2C_FUNC_SMBUS_WRITE_I2C_BLOCK