Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Documentation: i2c: improve section about flags mangling the protocol

Sort the entries alphabetically. Make the introductory paragraph more
precise. Skip useless 'Flag' introduction from the entries. Remove
trailing white spaces from the file. Add missing I2C_M_STOP entry.

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>

+20 -15
+20 -15
Documentation/i2c/i2c-protocol
··· 6 6 S (1 bit) : Start bit 7 7 P (1 bit) : Stop bit 8 8 Rd/Wr (1 bit) : Read/Write bit. Rd equals 1, Wr equals 0. 9 - A, NA (1 bit) : Accept and reverse accept bit. 10 - Addr (7 bits): I2C 7 bit address. Note that this can be expanded as usual to 9 + A, NA (1 bit) : Accept and reverse accept bit. 10 + Addr (7 bits): I2C 7 bit address. Note that this can be expanded as usual to 11 11 get a 10 bit I2C address. 12 12 Comm (8 bits): Command byte, a data byte which often selects a register on 13 13 the device. ··· 49 49 Modified transactions 50 50 ===================== 51 51 52 - The following modifications to the I2C protocol can also be generated, 53 - with the exception of I2C_M_NOSTART these are usually only needed to 54 - work around device issues: 52 + The following modifications to the I2C protocol can also be generated by 53 + setting these flags for i2c messages. With the exception of I2C_M_NOSTART, they 54 + are usually only needed to work around device issues: 55 55 56 - Flag I2C_M_NOSTART: 56 + I2C_M_IGNORE_NAK: 57 + Normally message is interrupted immediately if there is [NA] from the 58 + client. Setting this flag treats any [NA] as [A], and all of 59 + message is sent. 60 + These messages may still fail to SCL lo->hi timeout. 61 + 62 + I2C_M_NO_RD_ACK: 63 + In a read message, master A/NA bit is skipped. 64 + 65 + I2C_M_NOSTART: 57 66 In a combined transaction, no 'S Addr Wr/Rd [A]' is generated at some 58 67 point. For example, setting I2C_M_NOSTART on the second partial message 59 68 generates something like: ··· 76 67 I2C device but may also be used between direction changes by some 77 68 rare devices. 78 69 79 - Flags I2C_M_REV_DIR_ADDR 70 + I2C_M_REV_DIR_ADDR: 80 71 This toggles the Rd/Wr flag. That is, if you want to do a write, but 81 72 need to emit an Rd instead of a Wr, or vice versa, you set this 82 73 flag. For example: 83 74 S Addr Rd [A] Data [A] Data [A] ... [A] Data [A] P 84 75 85 - Flags I2C_M_IGNORE_NAK 86 - Normally message is interrupted immediately if there is [NA] from the 87 - client. Setting this flag treats any [NA] as [A], and all of 88 - message is sent. 89 - These messages may still fail to SCL lo->hi timeout. 90 - 91 - Flags I2C_M_NO_RD_ACK 92 - In a read message, master A/NA bit is skipped. 76 + I2C_M_STOP: 77 + Force a stop condition (P) after the message. Some I2C related protocols 78 + like SCCB require that. Normally, you really don't want to get interrupted 79 + between the messages of one transfer.