Jonathan Corbet | 5e99578 | 2016-09-06 07:15:24 -0600 | [diff] [blame^] | 1 | I\ :sup:`2`\ C and SMBus Subsystem |
| 2 | ================================== |
| 3 | |
| 4 | I\ :sup:`2`\ C (or without fancy typography, "I2C") is an acronym for |
| 5 | the "Inter-IC" bus, a simple bus protocol which is widely used where low |
| 6 | data rate communications suffice. Since it's also a licensed trademark, |
| 7 | some vendors use another name (such as "Two-Wire Interface", TWI) for |
| 8 | the same bus. I2C only needs two signals (SCL for clock, SDA for data), |
| 9 | conserving board real estate and minimizing signal quality issues. Most |
| 10 | I2C devices use seven bit addresses, and bus speeds of up to 400 kHz; |
| 11 | there's a high speed extension (3.4 MHz) that's not yet found wide use. |
| 12 | I2C is a multi-master bus; open drain signaling is used to arbitrate |
| 13 | between masters, as well as to handshake and to synchronize clocks from |
| 14 | slower clients. |
| 15 | |
| 16 | The Linux I2C programming interfaces support only the master side of bus |
| 17 | interactions, not the slave side. The programming interface is |
| 18 | structured around two kinds of driver, and two kinds of device. An I2C |
| 19 | "Adapter Driver" abstracts the controller hardware; it binds to a |
| 20 | physical device (perhaps a PCI device or platform_device) and exposes a |
| 21 | :c:type:`struct i2c_adapter <i2c_adapter>` representing each |
| 22 | I2C bus segment it manages. On each I2C bus segment will be I2C devices |
| 23 | represented by a :c:type:`struct i2c_client <i2c_client>`. |
| 24 | Those devices will be bound to a :c:type:`struct i2c_driver |
| 25 | <i2c_driver>`, which should follow the standard Linux driver |
| 26 | model. (At this writing, a legacy model is more widely used.) There are |
| 27 | functions to perform various I2C protocol operations; at this writing |
| 28 | all such functions are usable only from task context. |
| 29 | |
| 30 | The System Management Bus (SMBus) is a sibling protocol. Most SMBus |
| 31 | systems are also I2C conformant. The electrical constraints are tighter |
| 32 | for SMBus, and it standardizes particular protocol messages and idioms. |
| 33 | Controllers that support I2C can also support most SMBus operations, but |
| 34 | SMBus controllers don't support all the protocol options that an I2C |
| 35 | controller will. There are functions to perform various SMBus protocol |
| 36 | operations, either using I2C primitives or by issuing SMBus commands to |
| 37 | i2c_adapter devices which don't support those I2C operations. |
| 38 | |
| 39 | .. kernel-doc:: include/linux/i2c.h |
| 40 | :internal: |
| 41 | |
| 42 | .. kernel-doc:: drivers/i2c/i2c-boardinfo.c |
| 43 | :functions: i2c_register_board_info |
| 44 | |
| 45 | .. kernel-doc:: drivers/i2c/i2c-core.c |
| 46 | :export: |