xref: /linux/Documentation/i2c/summary.rst (revision 7c16f0a4ed1ce7b0dd1c01fc012e5bde89fe7748)
1=============================
2Introduction to I2C and SMBus
3=============================
4
5I²C (pronounce: I squared C and written I2C in the kernel documentation) is
6a protocol developed by Philips. It is a two-wire protocol with variable
7speed (typically up to 400 kHz, high speed modes up to 5 MHz). It provides
8an inexpensive bus for connecting many types of devices with infrequent or
9low bandwidth communications needs. I2C is widely used with embedded
10systems. Some systems use variants that don't meet branding requirements,
11and so are not advertised as being I2C but come under different names,
12e.g. TWI (Two Wire Interface), IIC.
13
14The latest official I2C specification is the `"I²C-bus specification and user
15manual" (UM10204) <https://www.nxp.com/docs/en/user-guide/UM10204.pdf>`_
16published by NXP Semiconductors, version 7 as of this writing.
17
18SMBus (System Management Bus) is based on the I2C protocol, and is mostly
19a subset of I2C protocols and signaling. Many I2C devices will work on an
20SMBus, but some SMBus protocols add semantics beyond what is required to
21achieve I2C branding. Modern PC mainboards rely on SMBus. The most common
22devices connected through SMBus are RAM modules configured using I2C EEPROMs,
23and hardware monitoring chips.
24
25Because the SMBus is mostly a subset of the generalized I2C bus, we can
26use its protocols on many I2C systems. However, there are systems that don't
27meet both SMBus and I2C electrical constraints; and others which can't
28implement all the common SMBus protocol semantics or messages.
29
30
31Terminology
32===========
33
34The I2C bus connects one or more controller chips and one or more target chips.
35
36.. kernel-figure::  i2c_bus.svg
37   :alt:    Simple I2C bus with one controller and 3 targets
38
39   Simple I2C bus
40
41A **controller** chip is a node that starts communications with targets. In the
42Linux kernel implementation it is also called an "adapter" or "bus". Controller
43drivers are usually in the ``drivers/i2c/busses/`` subdirectory.
44
45An **algorithm** contains general code that can be used to implement a whole
46class of I2C controllers. Each specific controller driver either depends on an
47algorithm driver in the ``drivers/i2c/algos/`` subdirectory, or includes its
48own implementation.
49
50A **target** chip is a node that responds to communications when addressed by a
51controller. In the Linux kernel implementation it is also called a "client".
52While targets are usually separate external chips, Linux can also act as a
53target (needs hardware support) and respond to another controller on the bus.
54This is then called a **local target**. In contrast, an external chip is called
55a **remote target**.
56
57Target drivers are kept in a directory specific to the feature they provide,
58for example ``drivers/gpio/`` for GPIO expanders and ``drivers/media/i2c/`` for
59video-related chips.
60
61For the example configuration in the figure above, you will need one driver for
62the I2C controller, and drivers for your I2C targets. Usually one driver for
63each target.
64
65Synonyms
66--------
67
68As mentioned above, the Linux I2C implementation historically uses the terms
69"adapter" for controller and "client" for target. A number of data structures
70have these synonyms in their name. So, when discussing implementation details,
71you should be aware of these terms as well. The official wording is preferred,
72though.
73
74Outdated terminology
75--------------------
76
77In earlier I2C specifications, controller was named "master" and target was
78named "slave". These terms have been obsoleted with v7 of the specification and
79their use is also discouraged by the Linux Kernel Code of Conduct. You may
80still find them in references to documentation which has not been updated. The
81general attitude, however, is to use the inclusive terms: controller and
82target. Work to replace the old terminology in the Linux Kernel is on-going.
83