Lines Matching +full:i2c +full:- +full:bus +full:- +full:name
2 Implementing I2C device drivers
5 This is a small guide for those who want to write kernel drivers for I2C
19 it for non-exported symbols too. We will use the prefix ``foo_`` in this
28 routines, and should be zero-initialized except for fields with data you
29 provide. A client structure holds device-specific information like the
30 driver model device node, and its I2C address.
40 MODULE_DEVICE_TABLE(i2c, foo_idtable);
44 .name = "foo",
56 The name field is the driver name, and must not contain spaces. It
57 should match the module name (if the driver can be compiled as a module),
59 another name for the module. If the driver name doesn't match the module
60 name, the module won't be automatically loaded (hotplug/coldplug).
62 All other fields are for call-back functions which will be explained
70 structure at all. You should use this to keep device-specific data.
81 to NULL in remove() or if probe() failed anymore. The i2c-core does this
94 For some cases, it will be easier to call the I2C functions directly,
95 but many chips have some kind of register-value idea that can easily
103 if (reg < 0x10) /* byte-sized register */
105 else /* word-sized register */
111 if (reg == 0x10) /* Impossible to write - driver error! */
112 return -EINVAL;
113 else if (reg < 0x10) /* byte-sized register */
115 else /* word-sized register */
123 The Linux I2C stack was originally written to support access to hardware
125 that were more appropriate to SMBus (and PCs) than to I2C. One of these
130 As Linux and its I2C stack became more widely used in embedded systems
132 problematic. Drivers for I2C devices that issue interrupts need more (and
139 ---------------------
141 System infrastructure, typically board-specific initialization code or
142 boot firmware, reports what I2C devices exist. For example, there may be
143 a table, in the kernel or from the boot loader, identifying I2C devices
144 and linking them to board-specific configuration information about IRQs
146 create i2c_client objects for each I2C device.
148 I2C device drivers using this binding model work just like any other
162 The probe function is called when an entry in the id_table name field
163 matches the device's name. If the probe function needs that entry, it
172 ---------------
174 If you know for a fact that an I2C device is connected to a given I2C bus,
176 structure with the device address and driver name, and calling
183 Sometimes you know that a device is connected to a given I2C bus, but you
186 models, and I2C device addresses change from one model to the next. In
189 of possible I2C addresses to probe. A device is created for the first
195 happens in the I2C bus driver. You may want to save the returned i2c_client
200 ----------------
204 (typically using device-specific, dedicated identification registers),
206 quickly. Keep in mind that the I2C protocol doesn't include any
209 semantics associated to bus transfers, which means that the same
216 ---------------
218 Each I2C device which has been created using i2c_new_client_device()
221 called automatically before the underlying I2C bus itself is removed,
261 /* Substitute your own name and email address */
263 MODULE_DESCRIPTION("Driver for Barf Inc. Foo I2C devices");
265 /* a few non-GPL license types are also allowed */
272 If your I2C device needs special handling when entering a system low
273 power state -- like putting a transceiver into a low power mode, or
274 activating a system wakeup mechanism -- do that by implementing the
280 I2C messaging to the device being suspended or resumed (since their
281 parent I2C adapter is active when these calls are issued, and IRQs
288 If your I2C device needs special handling when the system shuts down
289 or reboots (including kexec) -- like turning something off -- use a
294 I2C messaging.
300 A generic ioctl-like function call back is supported. You will seldom
309 to do this. You can find all of them in <linux/i2c.h>.
311 If you can choose between plain I2C communication and SMBus level
313 commands, but only some of them understand plain I2C!
316 Plain I2C communication
317 -----------------------
326 contains the I2C address, so you do not have to include it. The second
343 You can read the file i2c-protocol.rst for more information about the
344 actual I2C protocol.
348 -------------------
379 These ones were removed from i2c-core because they had no users, but could
393 You can read the file smbus-protocol.rst for more information about the