Luca Ceresoli | f6fcefa | 2020-01-29 16:19:51 +0100 | [diff] [blame] | 1 | ================== |
| 2 | The SMBus Protocol |
| 3 | ================== |
David Brownell | 1a31a88 | 2008-05-11 20:37:05 +0200 | [diff] [blame] | 4 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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. |
| 9 | |
| 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. |
David Brownell | 1a31a88 | 2008-05-11 20:37:05 +0200 | [diff] [blame] | 13 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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). |
| 20 | |
David Brownell | 1a31a88 | 2008-05-11 20:37:05 +0200 | [diff] [blame] | 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. |
| 26 | |
Jean Delvare | a168178 | 2012-12-16 21:11:55 +0100 | [diff] [blame] | 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 |
Mauro Carvalho Chehab | 25edd3a | 2021-06-16 08:27:33 +0200 | [diff] [blame] | 30 | adapter supports the transaction in question. See |
| 31 | Documentation/i2c/functionality.rst for the details. |
Jean Delvare | a168178 | 2012-12-16 21:11:55 +0100 | [diff] [blame] | 32 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 33 | |
| 34 | Key to symbols |
| 35 | ============== |
| 36 | |
Mauro Carvalho Chehab | ccf988b | 2019-07-26 09:51:16 -0300 | [diff] [blame] | 37 | =============== ============================================================= |
Luca Ceresoli | 026c0fe | 2020-01-29 16:19:38 +0100 | [diff] [blame] | 38 | S Start condition |
Miquel Raynal | bed68f4 | 2021-11-15 12:08:18 +0100 | [diff] [blame] | 39 | Sr Repeated start condition, used to switch from write to |
| 40 | read mode. |
Luca Ceresoli | 026c0fe | 2020-01-29 16:19:38 +0100 | [diff] [blame] | 41 | P Stop condition |
| 42 | Rd/Wr (1 bit) Read/Write bit. Rd equals 1, Wr equals 0. |
Luca Ceresoli | 9e89d61 | 2020-01-29 16:19:39 +0100 | [diff] [blame] | 43 | A, NA (1 bit) Acknowledge (ACK) and Not Acknowledge (NACK) bit |
Luca Ceresoli | 026c0fe | 2020-01-29 16:19:38 +0100 | [diff] [blame] | 44 | Addr (7 bits) I2C 7 bit address. Note that this can be expanded as usual to |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 45 | get a 10 bit I2C address. |
Luca Ceresoli | 026c0fe | 2020-01-29 16:19:38 +0100 | [diff] [blame] | 46 | Comm (8 bits) Command byte, a data byte which often selects a register on |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 47 | the device. |
Luca Ceresoli | 026c0fe | 2020-01-29 16:19:38 +0100 | [diff] [blame] | 48 | Data (8 bits) A plain data byte. Sometimes, I write DataLow, DataHigh |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 49 | for 16 bit data. |
Luca Ceresoli | 026c0fe | 2020-01-29 16:19:38 +0100 | [diff] [blame] | 50 | Count (8 bits) A data byte containing the length of a block operation. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 51 | |
Luca Ceresoli | 026c0fe | 2020-01-29 16:19:38 +0100 | [diff] [blame] | 52 | [..] Data sent by I2C device, as opposed to data sent by the host |
Mauro Carvalho Chehab | ccf988b | 2019-07-26 09:51:16 -0300 | [diff] [blame] | 53 | adapter. |
| 54 | =============== ============================================================= |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 55 | |
| 56 | |
Jean Delvare | 67c2e66 | 2008-07-14 22:38:23 +0200 | [diff] [blame] | 57 | SMBus Quick Command |
| 58 | =================== |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 59 | |
Mauro Carvalho Chehab | ccf988b | 2019-07-26 09:51:16 -0300 | [diff] [blame] | 60 | This sends a single bit to the device, at the place of the Rd/Wr bit:: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 61 | |
Daniel Schaefer | a576512 | 2020-06-14 20:23:55 +0200 | [diff] [blame] | 62 | S Addr Rd/Wr [A] P |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 63 | |
Jean Delvare | a168178 | 2012-12-16 21:11:55 +0100 | [diff] [blame] | 64 | Functionality flag: I2C_FUNC_SMBUS_QUICK |
| 65 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 66 | |
Luca Ceresoli | 3c13f1f | 2020-01-29 16:19:40 +0100 | [diff] [blame] | 67 | SMBus Receive Byte |
| 68 | ================== |
| 69 | |
| 70 | Implemented by i2c_smbus_read_byte() |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 71 | |
| 72 | This reads a single byte from a device, without specifying a device |
| 73 | register. Some devices are so simple that this interface is enough; for |
| 74 | others, it is a shorthand if you want to read the same register as in |
Mauro Carvalho Chehab | ccf988b | 2019-07-26 09:51:16 -0300 | [diff] [blame] | 75 | the previous SMBus command:: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 76 | |
Mauro Carvalho Chehab | ccf988b | 2019-07-26 09:51:16 -0300 | [diff] [blame] | 77 | S Addr Rd [A] [Data] NA P |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 78 | |
Jean Delvare | a168178 | 2012-12-16 21:11:55 +0100 | [diff] [blame] | 79 | Functionality flag: I2C_FUNC_SMBUS_READ_BYTE |
| 80 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 81 | |
Luca Ceresoli | 3c13f1f | 2020-01-29 16:19:40 +0100 | [diff] [blame] | 82 | SMBus Send Byte |
| 83 | =============== |
| 84 | |
| 85 | Implemented by i2c_smbus_write_byte() |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 86 | |
David Brownell | 1a31a88 | 2008-05-11 20:37:05 +0200 | [diff] [blame] | 87 | This operation is the reverse of Receive Byte: it sends a single byte |
| 88 | to a device. See Receive Byte for more information. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 89 | |
Mauro Carvalho Chehab | ccf988b | 2019-07-26 09:51:16 -0300 | [diff] [blame] | 90 | :: |
| 91 | |
| 92 | S Addr Wr [A] Data [A] P |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 93 | |
Jean Delvare | a168178 | 2012-12-16 21:11:55 +0100 | [diff] [blame] | 94 | Functionality flag: I2C_FUNC_SMBUS_WRITE_BYTE |
| 95 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 96 | |
Luca Ceresoli | 3c13f1f | 2020-01-29 16:19:40 +0100 | [diff] [blame] | 97 | SMBus Read Byte |
| 98 | =============== |
| 99 | |
| 100 | Implemented by i2c_smbus_read_byte_data() |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 101 | |
| 102 | This reads a single byte from a device, from a designated register. |
Mauro Carvalho Chehab | ccf988b | 2019-07-26 09:51:16 -0300 | [diff] [blame] | 103 | The register is specified through the Comm byte:: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 104 | |
Miquel Raynal | bed68f4 | 2021-11-15 12:08:18 +0100 | [diff] [blame] | 105 | S Addr Wr [A] Comm [A] Sr Addr Rd [A] [Data] NA P |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 106 | |
Jean Delvare | a168178 | 2012-12-16 21:11:55 +0100 | [diff] [blame] | 107 | Functionality flag: I2C_FUNC_SMBUS_READ_BYTE_DATA |
| 108 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 109 | |
Luca Ceresoli | 3c13f1f | 2020-01-29 16:19:40 +0100 | [diff] [blame] | 110 | SMBus Read Word |
| 111 | =============== |
| 112 | |
| 113 | Implemented by i2c_smbus_read_word_data() |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 114 | |
David Brownell | 1a31a88 | 2008-05-11 20:37:05 +0200 | [diff] [blame] | 115 | This operation is very like Read Byte; again, data is read from a |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 116 | device, from a designated register that is specified through the Comm |
Mauro Carvalho Chehab | ccf988b | 2019-07-26 09:51:16 -0300 | [diff] [blame] | 117 | byte. But this time, the data is a complete word (16 bits):: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 118 | |
Miquel Raynal | bed68f4 | 2021-11-15 12:08:18 +0100 | [diff] [blame] | 119 | S Addr Wr [A] Comm [A] Sr Addr Rd [A] [DataLow] A [DataHigh] NA P |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 120 | |
Jean Delvare | a168178 | 2012-12-16 21:11:55 +0100 | [diff] [blame] | 121 | Functionality flag: I2C_FUNC_SMBUS_READ_WORD_DATA |
| 122 | |
Luca Ceresoli | b36cbb7 | 2020-01-29 16:19:41 +0100 | [diff] [blame] | 123 | Note the convenience function i2c_smbus_read_word_swapped() is |
Jonathan Cameron | 06a6784 | 2011-10-30 13:47:25 +0100 | [diff] [blame] | 124 | available for reads where the two data bytes are the other way |
| 125 | around (not SMBus compliant, but very popular.) |
| 126 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 127 | |
Luca Ceresoli | 3c13f1f | 2020-01-29 16:19:40 +0100 | [diff] [blame] | 128 | SMBus Write Byte |
| 129 | ================ |
| 130 | |
| 131 | Implemented by i2c_smbus_write_byte_data() |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 132 | |
| 133 | This writes a single byte to a device, to a designated register. The |
| 134 | register is specified through the Comm byte. This is the opposite of |
David Brownell | 1a31a88 | 2008-05-11 20:37:05 +0200 | [diff] [blame] | 135 | the Read Byte operation. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 136 | |
Mauro Carvalho Chehab | ccf988b | 2019-07-26 09:51:16 -0300 | [diff] [blame] | 137 | :: |
| 138 | |
| 139 | S Addr Wr [A] Comm [A] Data [A] P |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 140 | |
Jean Delvare | a168178 | 2012-12-16 21:11:55 +0100 | [diff] [blame] | 141 | Functionality flag: I2C_FUNC_SMBUS_WRITE_BYTE_DATA |
| 142 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 143 | |
Luca Ceresoli | 3c13f1f | 2020-01-29 16:19:40 +0100 | [diff] [blame] | 144 | SMBus Write Word |
| 145 | ================ |
| 146 | |
| 147 | Implemented by i2c_smbus_write_word_data() |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 148 | |
David Brownell | 1a31a88 | 2008-05-11 20:37:05 +0200 | [diff] [blame] | 149 | This is the opposite of the Read Word operation. 16 bits |
Luca Ceresoli | 414a596 | 2020-01-29 16:19:42 +0100 | [diff] [blame] | 150 | of data are written to a device, to the designated register that is |
Luca Ceresoli | c7148b05 | 2020-01-29 16:19:43 +0100 | [diff] [blame] | 151 | specified through the Comm byte:: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 152 | |
Mauro Carvalho Chehab | ccf988b | 2019-07-26 09:51:16 -0300 | [diff] [blame] | 153 | S Addr Wr [A] Comm [A] DataLow [A] DataHigh [A] P |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 154 | |
Jean Delvare | a168178 | 2012-12-16 21:11:55 +0100 | [diff] [blame] | 155 | Functionality flag: I2C_FUNC_SMBUS_WRITE_WORD_DATA |
| 156 | |
Luca Ceresoli | b36cbb7 | 2020-01-29 16:19:41 +0100 | [diff] [blame] | 157 | Note the convenience function i2c_smbus_write_word_swapped() is |
Jonathan Cameron | 06a6784 | 2011-10-30 13:47:25 +0100 | [diff] [blame] | 158 | available for writes where the two data bytes are the other way |
| 159 | around (not SMBus compliant, but very popular.) |
| 160 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 161 | |
Luca Ceresoli | 3c13f1f | 2020-01-29 16:19:40 +0100 | [diff] [blame] | 162 | SMBus Process Call |
| 163 | ================== |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 164 | |
| 165 | This command selects a device register (through the Comm byte), sends |
Mauro Carvalho Chehab | ccf988b | 2019-07-26 09:51:16 -0300 | [diff] [blame] | 166 | 16 bits of data to it, and reads 16 bits of data in return:: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 167 | |
Mauro Carvalho Chehab | ccf988b | 2019-07-26 09:51:16 -0300 | [diff] [blame] | 168 | S Addr Wr [A] Comm [A] DataLow [A] DataHigh [A] |
Miquel Raynal | bed68f4 | 2021-11-15 12:08:18 +0100 | [diff] [blame] | 169 | Sr Addr Rd [A] [DataLow] A [DataHigh] NA P |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 170 | |
Jean Delvare | a168178 | 2012-12-16 21:11:55 +0100 | [diff] [blame] | 171 | Functionality flag: I2C_FUNC_SMBUS_PROC_CALL |
| 172 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 173 | |
Luca Ceresoli | 3c13f1f | 2020-01-29 16:19:40 +0100 | [diff] [blame] | 174 | SMBus Block Read |
| 175 | ================ |
| 176 | |
| 177 | Implemented by i2c_smbus_read_block_data() |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 178 | |
Mauro Carvalho Chehab | ccf988b | 2019-07-26 09:51:16 -0300 | [diff] [blame] | 179 | This command reads a block of up to 32 bytes from a device, from a |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 180 | designated register that is specified through the Comm byte. The amount |
| 181 | of data is specified by the device in the Count byte. |
| 182 | |
Mauro Carvalho Chehab | ccf988b | 2019-07-26 09:51:16 -0300 | [diff] [blame] | 183 | :: |
| 184 | |
| 185 | S Addr Wr [A] Comm [A] |
Miquel Raynal | bed68f4 | 2021-11-15 12:08:18 +0100 | [diff] [blame] | 186 | Sr Addr Rd [A] [Count] A [Data] A [Data] A ... A [Data] NA P |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 187 | |
Jean Delvare | a168178 | 2012-12-16 21:11:55 +0100 | [diff] [blame] | 188 | Functionality flag: I2C_FUNC_SMBUS_READ_BLOCK_DATA |
| 189 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 190 | |
Luca Ceresoli | 3c13f1f | 2020-01-29 16:19:40 +0100 | [diff] [blame] | 191 | SMBus Block Write |
| 192 | ================= |
| 193 | |
| 194 | Implemented by i2c_smbus_write_block_data() |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 195 | |
Mauro Carvalho Chehab | ccf988b | 2019-07-26 09:51:16 -0300 | [diff] [blame] | 196 | The opposite of the Block Read command, this writes up to 32 bytes to |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 197 | a device, to a designated register that is specified through the |
| 198 | Comm byte. The amount of data is specified in the Count byte. |
| 199 | |
Mauro Carvalho Chehab | ccf988b | 2019-07-26 09:51:16 -0300 | [diff] [blame] | 200 | :: |
| 201 | |
| 202 | S Addr Wr [A] Comm [A] Count [A] Data [A] Data [A] ... [A] Data [A] P |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 203 | |
Jean Delvare | a168178 | 2012-12-16 21:11:55 +0100 | [diff] [blame] | 204 | Functionality flag: I2C_FUNC_SMBUS_WRITE_BLOCK_DATA |
| 205 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 206 | |
David Brownell | 1a31a88 | 2008-05-11 20:37:05 +0200 | [diff] [blame] | 207 | SMBus Block Write - Block Read Process Call |
| 208 | =========================================== |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 209 | |
David Brownell | 1a31a88 | 2008-05-11 20:37:05 +0200 | [diff] [blame] | 210 | SMBus Block Write - Block Read Process Call was introduced in |
| 211 | Revision 2.0 of the specification. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 212 | |
| 213 | This command selects a device register (through the Comm byte), sends |
Mauro Carvalho Chehab | ccf988b | 2019-07-26 09:51:16 -0300 | [diff] [blame] | 214 | 1 to 31 bytes of data to it, and reads 1 to 31 bytes of data in return:: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 215 | |
Mauro Carvalho Chehab | ccf988b | 2019-07-26 09:51:16 -0300 | [diff] [blame] | 216 | S Addr Wr [A] Comm [A] Count [A] Data [A] ... |
Miquel Raynal | bed68f4 | 2021-11-15 12:08:18 +0100 | [diff] [blame] | 217 | Sr Addr Rd [A] [Count] A [Data] ... A P |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 218 | |
Jean Delvare | a168178 | 2012-12-16 21:11:55 +0100 | [diff] [blame] | 219 | Functionality flag: I2C_FUNC_SMBUS_BLOCK_PROC_CALL |
| 220 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 221 | |
| 222 | SMBus Host Notify |
| 223 | ================= |
| 224 | |
| 225 | This command is sent from a SMBus device acting as a master to the |
| 226 | SMBus host acting as a slave. |
| 227 | It is the same form as Write Word, with the command code replaced by the |
| 228 | alerting device's address. |
| 229 | |
Mauro Carvalho Chehab | ccf988b | 2019-07-26 09:51:16 -0300 | [diff] [blame] | 230 | :: |
| 231 | |
| 232 | [S] [HostAddr] [Wr] A [DevAddr] A [DataLow] A [DataHigh] A [P] |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 233 | |
Benjamin Tissoires | e456cd3 | 2016-06-09 16:53:48 +0200 | [diff] [blame] | 234 | This is implemented in the following way in the Linux kernel: |
Mauro Carvalho Chehab | ccf988b | 2019-07-26 09:51:16 -0300 | [diff] [blame] | 235 | |
Benjamin Tissoires | 4d5538f | 2016-10-13 14:10:40 +0200 | [diff] [blame] | 236 | * I2C bus drivers which support SMBus Host Notify should report |
| 237 | I2C_FUNC_SMBUS_HOST_NOTIFY. |
| 238 | * I2C bus drivers trigger SMBus Host Notify by a call to |
| 239 | i2c_handle_smbus_host_notify(). |
| 240 | * I2C drivers for devices which can trigger SMBus Host Notify will have |
| 241 | client->irq assigned to a Host Notify IRQ if noone else specified an other. |
| 242 | |
| 243 | There is currently no way to retrieve the data parameter from the client. |
Benjamin Tissoires | e456cd3 | 2016-06-09 16:53:48 +0200 | [diff] [blame] | 244 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 245 | |
| 246 | Packet Error Checking (PEC) |
| 247 | =========================== |
David Brownell | 1a31a88 | 2008-05-11 20:37:05 +0200 | [diff] [blame] | 248 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 249 | Packet Error Checking was introduced in Revision 1.1 of the specification. |
| 250 | |
David Brownell | 1a31a88 | 2008-05-11 20:37:05 +0200 | [diff] [blame] | 251 | PEC adds a CRC-8 error-checking byte to transfers using it, immediately |
| 252 | before the terminating STOP. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 253 | |
| 254 | |
| 255 | Address Resolution Protocol (ARP) |
| 256 | ================================= |
David Brownell | 1a31a88 | 2008-05-11 20:37:05 +0200 | [diff] [blame] | 257 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 258 | The Address Resolution Protocol was introduced in Revision 2.0 of |
| 259 | the specification. It is a higher-layer protocol which uses the |
| 260 | messages above. |
| 261 | |
| 262 | ARP adds device enumeration and dynamic address assignment to |
| 263 | the protocol. All ARP communications use slave address 0x61 and |
| 264 | require PEC checksums. |
| 265 | |
| 266 | |
Jean Delvare | b5527a7 | 2010-03-02 12:23:42 +0100 | [diff] [blame] | 267 | SMBus Alert |
| 268 | =========== |
| 269 | |
| 270 | SMBus Alert was introduced in Revision 1.0 of the specification. |
| 271 | |
| 272 | The SMBus alert protocol allows several SMBus slave devices to share a |
| 273 | single interrupt pin on the SMBus master, while still allowing the master |
| 274 | to know which slave triggered the interrupt. |
| 275 | |
| 276 | This is implemented the following way in the Linux kernel: |
Mauro Carvalho Chehab | ccf988b | 2019-07-26 09:51:16 -0300 | [diff] [blame] | 277 | |
Jean Delvare | b5527a7 | 2010-03-02 12:23:42 +0100 | [diff] [blame] | 278 | * I2C bus drivers which support SMBus alert should call |
Wolfram Sang | ed68052 | 2020-02-28 18:12:20 +0100 | [diff] [blame] | 279 | i2c_new_smbus_alert_device() to install SMBus alert support. |
Jean Delvare | b5527a7 | 2010-03-02 12:23:42 +0100 | [diff] [blame] | 280 | * I2C drivers for devices which can trigger SMBus alerts should implement |
| 281 | the optional alert() callback. |
| 282 | |
| 283 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 284 | I2C Block Transactions |
| 285 | ====================== |
David Brownell | 1a31a88 | 2008-05-11 20:37:05 +0200 | [diff] [blame] | 286 | |
Luca Ceresoli | 95b8377 | 2020-01-29 16:19:44 +0100 | [diff] [blame] | 287 | The following I2C block transactions are similar to the SMBus Block Read |
| 288 | and Write operations, except these do not have a Count byte. They are |
| 289 | supported by the SMBus layer and are described here for completeness, but |
| 290 | they are *NOT* defined by the SMBus specification. |
David Brownell | 1a31a88 | 2008-05-11 20:37:05 +0200 | [diff] [blame] | 291 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 292 | I2C block transactions do not limit the number of bytes transferred |
| 293 | but the SMBus layer places a limit of 32 bytes. |
| 294 | |
| 295 | |
Luca Ceresoli | 3c13f1f | 2020-01-29 16:19:40 +0100 | [diff] [blame] | 296 | I2C Block Read |
| 297 | ============== |
| 298 | |
| 299 | Implemented by i2c_smbus_read_i2c_block_data() |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 300 | |
Mauro Carvalho Chehab | ccf988b | 2019-07-26 09:51:16 -0300 | [diff] [blame] | 301 | This command reads a block of bytes from a device, from a |
| 302 | designated register that is specified through the Comm byte:: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 303 | |
Mauro Carvalho Chehab | ccf988b | 2019-07-26 09:51:16 -0300 | [diff] [blame] | 304 | S Addr Wr [A] Comm [A] |
Miquel Raynal | bed68f4 | 2021-11-15 12:08:18 +0100 | [diff] [blame] | 305 | Sr Addr Rd [A] [Data] A [Data] A ... A [Data] NA P |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 306 | |
Jean Delvare | a168178 | 2012-12-16 21:11:55 +0100 | [diff] [blame] | 307 | Functionality flag: I2C_FUNC_SMBUS_READ_I2C_BLOCK |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 308 | |
| 309 | |
Luca Ceresoli | 3c13f1f | 2020-01-29 16:19:40 +0100 | [diff] [blame] | 310 | I2C Block Write |
| 311 | =============== |
| 312 | |
| 313 | Implemented by i2c_smbus_write_i2c_block_data() |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 314 | |
Mauro Carvalho Chehab | ccf988b | 2019-07-26 09:51:16 -0300 | [diff] [blame] | 315 | The opposite of the Block Read command, this writes bytes to |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 316 | a device, to a designated register that is specified through the |
| 317 | Comm byte. Note that command lengths of 0, 2, or more bytes are |
| 318 | supported as they are indistinguishable from data. |
| 319 | |
Mauro Carvalho Chehab | ccf988b | 2019-07-26 09:51:16 -0300 | [diff] [blame] | 320 | :: |
| 321 | |
| 322 | S Addr Wr [A] Comm [A] Data [A] Data [A] ... [A] Data [A] P |
Jean Delvare | a168178 | 2012-12-16 21:11:55 +0100 | [diff] [blame] | 323 | |
| 324 | Functionality flag: I2C_FUNC_SMBUS_WRITE_I2C_BLOCK |