added a lot of printk output to ease writing of emulator
[linux-2.4.21-pre4.git] / Documentation / i2c / smbus-protocol
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).
10
11 Below is a list of SMBus commands.
12
13 Key to symbols
14 ==============
15
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.
27
28 [..]: Data sent by I2C device, as opposed to data sent by the host adapter.
29
30
31 SMBus Write Quick
32 =================
33
34 This sends a single bit to the device, at the place of the Rd/Wr bit.
35 There is no equivalent Read Quick command.
36
37 A Addr Rd/Wr [A] P
38
39
40 SMBus Read Byte
41 ===============
42
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.
47
48 S Addr Rd [A] [Data] NA P
49
50
51 SMBus Write Byte
52 ================
53
54 This is the reverse of Read Byte: it sends a single byte to a device.
55 See Read Byte for more information.
56
57 S Addr Wr [A] Data NA P
58
59
60 SMBus Read Byte Data
61 ====================
62
63 This reads a single byte from a device, from a designated register.
64 The register is specified through the Comm byte.
65
66 S Addr Wr [A] Comm [A] S Addr Rd [A] [Data] NA P
67
68
69 SMBus Read Word Data
70 ====================
71
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).
75
76 S Addr Wr [A] Comm [A] S Addr Rd [A] [DataLow] A [DataHigh] NA P
77
78
79 SMBus Write Byte Data
80 =====================
81
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.
85
86 S Addr Wr [A] Comm [A] Data [A] P
87
88
89 SMBus Write Word Data
90 =====================
91
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. 
95
96 S Addr Wr [A] Comm [A] DataLow [A] DataHigh [A] P
97
98
99 SMBus Process Call
100 ==================
101
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.
104
105 S Addr Wr [A] Comm [A] DataLow [A] DataHigh [A] 
106                              S Addr Rd [A] [DataLow] A [DataHigh] NA P
107
108
109 SMBus Block Read
110 ================
111
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.
115
116 S Addr Wr [A] Comm [A] 
117            S Addr Rd [A] [Count] A [Data] A [Data] A ... A [Data] NA P
118
119
120 SMBus Block Write
121 =================
122
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.
126
127 S Addr Wr [A] Comm [A] Count [A] Data [A] Data [A] ... [A] Data [A] P