Lines Matching +full:i2c +full:- +full:arbitrator
2 I2C muxes and complex topologies
5 There are a couple of reasons for building more complex I2C topologies
6 than a straight-forward I2C bus with one adapter and one or more devices.
16 from the I2C bus, at least most of the time, and sits behind a gate
19 Several types of hardware components such as I2C muxes, I2C gates and I2C
22 These components are represented as I2C adapter trees by Linux, where
25 I2C transfers, and all adapters with a parent are part of an "i2c-mux"
26 object (quoted, since it can also be an arbitrator or a gate).
29 an I2C transfer on one of its child adapters. The mux driver can
39 There are two variants of locking available to I2C muxes, they can be
40 mux-locked or parent-locked muxes.
43 Mux-locked muxes
44 ----------------
46 Mux-locked muxes does not lock the entire parent adapter during the
47 full select-transfer-deselect transaction, only the muxes on the parent
48 adapter are locked. Mux-locked muxes are mostly interesting if the
49 select and/or deselect operations must use I2C transfers to complete
51 full transaction, unrelated I2C transfers may interleave the different
55 Mux-locked Example
60 .----------. .--------.
61 .--------. | mux- |-----| dev D1 |
62 | root |--+--| locked | '--------'
63 '--------' | | mux M1 |--. .--------.
64 | '----------' '--| dev D2 |
65 | .--------. '--------'
66 '--| dev D3 |
67 '--------'
71 1. Someone issues an I2C transfer to D1.
73 3. M1 calls ->select to ready the mux.
74 4. M1 (presumably) does some I2C transfers as part of its select.
75 These transfers are normal I2C transfers that locks the parent
77 5. M1 feeds the I2C transfer from step 1 to its parent adapter as a
78 normal I2C transfer that locks the parent adapter.
79 6. M1 calls ->deselect, if it has one.
80 7. Same rules as in step 4, but for ->deselect.
87 Mux-locked caveats
90 When using a mux-locked mux, be aware of the following restrictions:
93 If you build a topology with a mux-locked mux being the parent
94 of a parent-locked mux, this might break the expectation from the
95 parent-locked mux that the root adapter is locked during the
100 mux-locked muxes that are not siblings, when there are address
102 non-sibling muxes.
104 I.e. the select-transfer-deselect transaction targeting e.g. device
105 address 0x42 behind mux-one may be interleaved with a similar
106 operation targeting device address 0x42 behind mux-two. The
108 be that mux-one and mux-two should not be selected simultaneously,
109 but mux-locked muxes do not guarantee that in all topologies.
112 A mux-locked mux cannot be used by a driver for auto-closing
114 number (one, in most cases) of I2C transfers. Unrelated I2C transfers
118 If any non-I2C operation in the mux driver changes the I2C mux state,
121 behind the mux, when an unrelated I2C transfer is in flight during
122 the non-I2C mux-changing operation.
125 Parent-locked muxes
126 -------------------
128 Parent-locked muxes lock the parent adapter during the full select-
129 transfer-deselect transaction. The implication is that the mux driver
130 has to ensure that any and all I2C transfers through that parent
131 adapter during the transaction are unlocked I2C transfers (using e.g.
134 Parent-locked Example
139 .----------. .--------.
140 .--------. | parent- |-----| dev D1 |
141 | root |--+--| locked | '--------'
142 '--------' | | mux M1 |--. .--------.
143 | '----------' '--| dev D2 |
144 | .--------. '--------'
145 '--| dev D3 |
146 '--------'
150 1. Someone issues an I2C transfer to D1.
153 4. M1 calls ->select to ready the mux.
154 5. If M1 does any I2C transfers (on this root adapter) as part of
155 its select, those transfers must be unlocked I2C transfers so
157 6. M1 feeds the I2C transfer from step 1 to the root adapter as an
158 unlocked I2C transfer, so that it does not deadlock the parent
160 7. M1 calls ->deselect, if it has one.
161 8. Same rules as in step 5, but for ->deselect.
168 Parent-locked Caveats
171 When using a parent-locked mux, be aware of the following restrictions:
174 If you build a topology with a parent-locked mux being the child
177 and the actual transfer (e.g. if the child mux is auto-closing
178 and the parent mux issues I2C transfers as part of its select).
179 This is especially the case if the parent mux is mux-locked, but
180 it may also happen if the parent mux is parent-locked.
184 pinctrl, regmap or iio, it is essential that any I2C transfers
193 Parent-locked mux as parent of parent-locked mux
194 ------------------------------------------------
198 .----------. .----------. .--------.
199 .--------. | parent- |-----| parent- |-----| dev D1 |
200 | root |--+--| locked | | locked | '--------'
201 '--------' | | mux M1 |--. | mux M2 |--. .--------.
202 | '----------' | '----------' '--| dev D2 |
203 | .--------. | .--------. '--------'
204 '--| dev D4 | '--| dev D3 |
205 '--------' '--------'
212 This topology is bad if M2 is an auto-closing mux and M1->select
213 issues any unlocked I2C transfers on the root adapter that may leak
217 Mux-locked mux as parent of mux-locked mux
218 ------------------------------------------
222 .----------. .----------. .--------.
223 .--------. | mux- |-----| mux- |-----| dev D1 |
224 | root |--+--| locked | | locked | '--------'
225 '--------' | | mux M1 |--. | mux M2 |--. .--------.
226 | '----------' | '----------' '--| dev D2 |
227 | .--------. | .--------. '--------'
228 '--| dev D4 | '--| dev D3 |
229 '--------' '--------'
240 Mux-locked mux as parent of parent-locked mux
241 ---------------------------------------------
245 .----------. .----------. .--------.
246 .--------. | mux- |-----| parent- |-----| dev D1 |
247 | root |--+--| locked | | locked | '--------'
248 '--------' | | mux M1 |--. | mux M2 |--. .--------.
249 | '----------' | '----------' '--| dev D2 |
250 | .--------. | .--------. '--------'
251 '--| dev D4 | '--| dev D3 |
252 '--------' '--------'
261 be no I2C transfers during its calls to ->select and ->deselect, and
263 as partial I2C transfers, i.e. garbage or worse. This might cause
266 The topology is especially troublesome if M2 is an auto-closing
268 prematurely, as might any I2C transfers part of M1->select.
271 auto-closing, the topology is fine.
274 Parent-locked mux as parent of mux-locked mux
275 ---------------------------------------------
279 .----------. .----------. .--------.
280 .--------. | parent- |-----| mux- |-----| dev D1 |
281 | root |--+--| locked | | locked | '--------'
282 '--------' | | mux M1 |--. | mux M2 |--. .--------.
283 | '----------' | '----------' '--| dev D2 |
284 | .--------. | .--------. '--------'
285 '--| dev D4 | '--| dev D3 |
286 '--------' '--------'
291 any point, just as is expected for mux-locked muxes.
298 Two mux-locked sibling muxes
299 ----------------------------
303 .--------.
304 .----------. .--| dev D1 |
305 | mux- |--' '--------'
306 .--| locked | .--------.
307 | | mux M1 |-----| dev D2 |
308 | '----------' '--------'
309 | .----------. .--------.
310 .--------. | | mux- |-----| dev D3 |
311 | root |--+--| locked | '--------'
312 '--------' | | mux M2 |--. .--------.
313 | '----------' '--| dev D4 |
314 | .--------. '--------'
315 '--| dev D5 |
316 '--------'
322 Two parent-locked sibling muxes
323 -------------------------------
327 .--------.
328 .----------. .--| dev D1 |
329 | parent- |--' '--------'
330 .--| locked | .--------.
331 | | mux M1 |-----| dev D2 |
332 | '----------' '--------'
333 | .----------. .--------.
334 .--------. | | parent- |-----| dev D3 |
335 | root |--+--| locked | '--------'
336 '--------' | | mux M2 |--. .--------.
337 | '----------' '--| dev D4 |
338 | .--------. '--------'
339 '--| dev D5 |
340 '--------'
346 Mux-locked and parent-locked sibling muxes
347 ------------------------------------------
351 .--------.
352 .----------. .--| dev D1 |
353 | mux- |--' '--------'
354 .--| locked | .--------.
355 | | mux M1 |-----| dev D2 |
356 | '----------' '--------'
357 | .----------. .--------.
358 .--------. | | parent- |-----| dev D3 |
359 | root |--+--| locked | '--------'
360 '--------' | | mux M2 |--. .--------.
361 | '----------' '--| dev D4 |
362 | .--------. '--------'
363 '--| dev D5 |
364 '--------'
374 Whether a device is mux-locked or parent-locked depends on its
377 In drivers/i2c/muxes/:
380 i2c-arb-gpio-challenge Parent-locked
381 i2c-mux-gpio Normally parent-locked, mux-locked iff
383 same I2C root adapter that they mux.
384 i2c-mux-gpmux Normally parent-locked, mux-locked iff
385 specified in device-tree.
386 i2c-mux-ltc4306 Mux-locked
387 i2c-mux-mlxcpld Parent-locked
388 i2c-mux-pca9541 Parent-locked
389 i2c-mux-pca954x Parent-locked
390 i2c-mux-pinctrl Normally parent-locked, mux-locked iff
392 by the same I2C root adapter that they mux.
393 i2c-mux-reg Parent-locked
399 gyro/mpu3050 Mux-locked
400 imu/inv_mpu6050/ Mux-locked
406 dvb-frontends/lgdt3306a Mux-locked
407 dvb-frontends/m88ds3103 Parent-locked
408 dvb-frontends/rtl2830 Parent-locked
409 dvb-frontends/rtl2832 Mux-locked
410 dvb-frontends/si2168 Mux-locked
411 usb/cx231xx/ Parent-locked