Import 2.4.0-test2pre7
[davej-history.git] / Documentation / i2c / smbus-protocol
blob9f024396dc956a41b48cf8a4a9934d1c2655b9cc
1 Some adapters understand only the SMBus (System Management Bus) protocol,
2 which is a subset from the I2C protocol. Fortunately, many devices use
3 only the same subset, which makes it possible to put them on an SMBus.
4 If you write a driver for some I2C device, please try to use the SMBus
5 commands if at all possible (if the device uses only that subset of the
6 I2C protocol). This makes it possible to use the device driver on both
7 SMBus adapters and I2C adapters (the SMBus command set is automatically
8 translated to I2C on I2C adapters, but plain I2C commands can not be
9 handled at all on a pure SMBus adapter).
11 Below is a list of SMBus commands.
13 Key to symbols
14 ==============
16 S     (1 bit) : Start bit
17 P     (1 bit) : Stop bit
18 Rd/Wr (1 bit) : Read/Write bit. Rd equals 1, Wr equals 0.
19 A, NA (1 bit) : Accept and reverse accept bit. 
20 Addr  (7 bits): I2C 7 bit address. Note that this can be expanded as usual to 
21                 get a 10 bit I2C address.
22 Comm  (8 bits): Command byte, a data byte which often selects a register on
23                 the device.
24 Data  (8 bits): A plain data byte. Sometimes, I write DataLow, DataHigh
25                 for 16 bit data.
26 Count (8 bits): A data byte containing the length of a block operation.
28 [..]: Data sent by I2C device, as opposed to data sent by the host adapter.
31 SMBus Write Quick
32 =================
34 This sends a single byte to the device, at the place of the Rd/Wr bit.
35 There is no equivalent Read Quick command.
37 A Addr Rd/Wr [A] P
40 SMBus Read Byte
41 ===============
43 This reads a single byte from a device, without specifying a device
44 register. Some devices are so simple that this interface is enough; for
45 others, it is a shorthand if you want to read the same register as in
46 the previous SMBus command.
48 S Addr Rd [A] [Data] NA P
51 SMBus Write Byte
52 ================
54 This is the reverse of Read Byte: it sends a single byte to a device.
55 See Read Byte for more information.
57 S Addr Wr [A] Data NA P
60 SMBus Read Byte Data
61 ====================
63 This reads a single byte from a device, from a designated register.
64 The register is specified through the Comm byte.
66 S Addr Wr [A] Comm [A] S Addr Rd [A] [Data] NA P
69 SMBus Read Word Data
70 ====================
72 This command is very like Read Byte Data; again, data is read from a
73 device, from a designated register that is specified through the Comm
74 byte. But this time, the data is a complete word (16 bits).
76 S Addr Wr [A] Comm [A] S Addr Rd [A] [DataLow] A [DataHigh] NA P
79 SMBus Write Byte Data
80 =====================
82 This writes a single byte to a device, to a designated register. The
83 register is specified through the Comm byte. This is the opposite of
84 the Read Byte Data command.
86 S Addr Wr [A] Comm [A] Data [A] P
89 SMBus Write Word Data
90 =====================
92 This is the opposite operation of the Read Word Data command. 16 bits
93 of data is read from a device, from a designated register that is 
94 specified through the Comm byte. 
96 S Addr Wr [A] Comm [A] DataLow [A] DataHigh [A] P
99 SMBus Process Call
100 ==================
102 This command selects a device register (through the Comm byte), sends
103 16 bits of data to it, and reads 16 bits of data in return.
105 S Addr Wr [A] Comm [A] DataLow [A] DataHigh [A] 
106                              S Addr Rd [A] [DataLow] A [DataHigh] NA P
109 SMBus Block Read
110 ================
112 This command reads a block of upto 32 bytes from a device, from a 
113 designated register that is specified through the Comm byte. The amount
114 of data is specified by the device in the Count byte.
116 S Addr Wr [A] Comm [A] 
117            S Addr Rd [A] [Count] A [Data] A [Data] A ... A [Data] NA P
120 SMBus Block Write
121 =================
123 The opposite of the Block Read command, this writes upto 32 bytes to 
124 a device, to a designated register that is specified through the
125 Comm byte. The amount of data is specified in the Count byte.
127 S Addr Wr [A] Comm [A] Count [A] Data [A] Data [A] ... [A] Data [A] P