• Home
  • Raw
  • Download

Lines Matching +full:i2c +full:- +full:bus

2 How to instantiate I2C devices
5 Unlike PCI or USB devices, I2C devices are not enumerated at the hardware
7 I2C bus segment, and what address these devices are using. For this
8 reason, the kernel code must instantiate I2C devices explicitly. There are
12 Method 1: Declare the I2C devices statically
13 --------------------------------------------
15 This method is appropriate when the I2C bus is a system bus as is the case
16 for many embedded systems. On such systems, each I2C bus has a number which
17 is known in advance. It is thus possible to pre-declare the I2C devices
18 which live on this bus.
23 When the I2C bus in question is registered, the I2C devices will be
24 instantiated automatically by i2c-core. The devices will be automatically
25 unbound and destroyed when the I2C bus they sit on goes away (if ever).
28 Declare the I2C devices via devicetree
31 On platforms using devicetree, the declaration of I2C devices is done in
36 i2c1: i2c@400a0000 {
38 clock-frequency = <100000>;
47 gpio-controller;
48 #gpio-cells = <2>;
53 Here, two devices are attached to the bus using a speed of 100kHz. For
58 Declare the I2C devices via ACPI
61 ACPI can also describe I2C devices. There is special documentation for this
62 which is currently located at :doc:`../firmware-guide/acpi/enumeration`.
65 Declare the I2C devices in board files
70 code. Instantiating I2C devices via board files is done with an array of
99 The above code declares 3 devices on I2C bus 1, including their respective
104 --------------------------------------------
106 This method is appropriate when a larger device uses an I2C bus for
109 main chip by the means of an I2C bus. You won't know the number of the I2C
110 bus in advance, so the method 1 described above can't be used. Instead,
111 you can instantiate your I2C devices explicitly. This is done by filling
123 efx->board_info.hwmon_client =
124 i2c_new_client_device(&efx->i2c_adap, &sfe4001_hwmon_info);
129 The above code instantiates 1 I2C device on the I2C bus which is on the
132 A variant of this is when you don't know for sure if an I2C device is
159 The above code instantiates up to 1 I2C device on the I2C bus which is on
164 The driver which instantiated the I2C device is responsible for destroying
170 Method 3: Probe an I2C bus for certain devices
171 ----------------------------------------------
173 Sometimes you do not have enough information about an I2C device, not even
182 In that case, I2C devices are neither declared nor instantiated
183 explicitly. Instead, i2c-core will probe for such devices as soon as their
184 drivers are loaded, and if any is found, an I2C device will be
188 * The I2C device driver must implement the detect() method, which
197 I2C devices instantiated as a result of such a successful probe will be
199 or when the underlying I2C bus is itself destroyed, whichever happens
202 Those of you familiar with the I2C subsystem of 2.4 kernels and early 2.6
206 * Probing is only one way to instantiate I2C devices now, while it was the
210 * I2C buses must now explicitly say which I2C driver classes can probe
211 them (by the means of the class bitfield), while all I2C buses were
221 Method 4: Instantiate from user-space
222 -------------------------------------
224 In general, the kernel should know which I2C devices are connected and
227 interface is made of 2 attribute files which are created in every I2C bus
230 instantiate, respectively delete, an I2C device.
232 File ``new_device`` takes 2 parameters: the name of the I2C device (a
233 string) and the address of the I2C device (a number, typically expressed
236 File ``delete_device`` takes a single parameter: the address of the I2C
237 device. As no two devices can live at the same address on a given I2C
243 # echo eeprom 0x50 > /sys/bus/i2c/devices/i2c-3/new_device
245 While this interface should only be used when in-kernel device declaration
248 * The I2C driver usually detects devices (method 3 above) but the bus
251 * The I2C driver usually detects devices, but your device lives at an
253 * The I2C driver usually detects devices, but your device is not detected,
256 * You are developing a driver on a test board, where you soldered the I2C
259 This interface is a replacement for the force_* module parameters some I2C
260 drivers implement. Being implemented in i2c-core rather than in each