Lines Matching full:bus

12 kernel abstracts the MUX channels into logical I2C bus numbers. However, there
13 is a gap of knowledge to map from the I2C bus physical number and MUX topology
14 to logical I2C bus number. This doc is aimed to fill in this gap, so the
38 so you can find the I2C Sysfs under ``/sys/bus/i2c/devices``
43 the first number is I2C bus number, and the second number is I2C address.
47 blueline:/sys/bus/i2c/devices $ ls
51 ``i2c-2`` is an I2C bus whose number is 2, and ``2-0049`` is an I2C device
52 on bus 2 address 0x49 bound with a kernel driver.
59 (Physical) I2C Bus Controller
63 physical I2C bus controllers. The controllers are hardware and physical, and the
65 controllers. Linux kernel has I2C bus drivers under source directory
70 I2C Bus Physical Number
73 For each physical I2C bus controller, the system vendor may assign a physical
74 number to each controller. For example, the first I2C bus controller which has
77 Logical I2C Bus
80 Every I2C bus number you see in Linux I2C Sysfs is a logical I2C bus with a
84 Each logical I2C bus may be an abstraction of a physical I2C bus controller, or
86 MUX channel, whenever we access an I2C device via a such logical bus, the kernel
90 Physical I2C Bus
93 If the logical I2C bus is a direct abstraction of a physical I2C bus controller,
94 let us call it a physical I2C bus.
100 design of a board. It is actually possible to rename the I2C bus physical number
101 to a different number in logical I2C bus level in Device Tree Source (DTS) under
106 bus physical number the same as their corresponding logical I2C bus number,
110 bus has a number same as their I2C bus physical number.
112 Walk through Logical I2C Bus
122 i2c-7 (physical I2C bus controller 7)
135 Distinguish Physical and Logical I2C Bus
138 One simple way to distinguish between a physical I2C bus and a logical I2C bus,
139 is to read the symbolic link ``device`` under the I2C bus directory by using
143 in logical I2C bus directory which is fanned out from another I2C bus.
145 this logical I2C bus.
148 physical I2C bus, directly abstracting a physical I2C bus controller. For
151 $ readlink /sys/bus/i2c/devices/i2c-7/device
153 $ ls /sys/bus/i2c/devices/i2c-7/mux_device
154 ls: /sys/bus/i2c/devices/i2c-7/mux_device: No such file or directory
156 In this case, ``i2c-7`` is a physical I2C bus, so it does not have the symbolic
159 mean the physical I2C bus controller 7 of the system.
161 On the other hand, if the symbolic link points to another I2C bus, the I2C bus
162 presented by the current directory has to be a logical bus. The I2C bus pointed
163 by the link is the parent bus which may be either a physical I2C bus or a
164 logical one. In this case, the I2C bus presented by the current directory
165 abstracts an I2C MUX channel under the parent bus.
169 $ readlink /sys/bus/i2c/devices/i2c-73/device
171 $ readlink /sys/bus/i2c/devices/i2c-73/mux_device
174 ``i2c-73`` is a logical bus fanout by an I2C MUX under ``i2c-7``
176 Whenever we access an I2C device with bus 73, the kernel will always
180 Finding out Logical I2C Bus Number
183 In this section, we will describe how to find out the logical I2C bus number
187 In this example, we have a system which has a physical I2C bus 7 and not renamed
188 in DTS. There is a 4-channel MUX at address 0x71 on that bus. There is another
190 navigate through Sysfs and find out the logical I2C bus number of the channel 3
195 ~$ cd /sys/bus/i2c/devices/i2c-7
196 /sys/bus/i2c/devices/i2c-7$ ls
204 /sys/bus/i2c/devices/i2c-7$ cd 7-0071/
205 /sys/bus/i2c/devices/i2c-7/7-0071$ ls -l
212 /sys/bus/i2c/devices/i2c-7/7-0071$ readlink channel-1
216 with a logical I2C bus number of 73.
220 /sys/bus/i2c/devices/i2c-7/7-0071$ cd /sys/bus/i2c/devices/i2c-73
221 /sys/bus/i2c/devices/i2c-73$
224 /sys/bus/i2c/devices/i2c-7/7-0071$ cd channel-1
225 /sys/bus/i2c/devices/i2c-7/7-0071/channel-1$
228 /sys/bus/i2c/devices/i2c-7/7-0071$ cd ../i2c-73
229 /sys/bus/i2c/devices/i2c-7/i2c-73$
232 we can now find the 0x72 MUX and what logical I2C bus numbers
235 /sys/bus/i2c/devices/i2c-73$ ls
242 /sys/bus/i2c/devices/i2c-73$ cd 73-0072
243 /sys/bus/i2c/devices/i2c-73/73-0072$ ls
248 /sys/bus/i2c/devices/i2c-73/73-0072$ readlink channel-3
251 There, we find out the logical I2C bus number of the channel 3 of the 0x72 MUX
277 Pinned Logical I2C Bus Number
281 successfully probed, the kernel will assign the MUX channels with a logical bus
282 number based on the current biggest logical bus number incrementally. For
283 example, if the system has ``i2c-15`` as the highest logical bus number, and a
288 logical I2C bus number in the DTS. This doc will not go through the details on
293 I2C bus 2. The channel 2 of the MUX is defined as ``imux18`` in DTS,
294 and pinned to logical I2C bus number 18 with the line of ``i2c18 = &imux18;``
297 Take it further, it is possible to design a logical I2C bus number schema that
299 can pin the fanout channels of a MUX on bus 3 to start at 30. So 30 will be the
300 logical bus number of the channel 0 of the MUX on bus 3, and 37 will be the
301 logical bus number of the channel 7 of the MUX on bus 3.
306 In previous sections, we mostly covered the I2C bus. In this section, let us see
308 of ``${bus}-${addr}``. The ``${bus}`` part in the name is a logical I2C bus
319 /sys/bus/i2c/devices/i2c-73$ cat 73-0040/name
321 /sys/bus/i2c/devices/i2c-73$ cat 73-0070/name
323 /sys/bus/i2c/devices/i2c-73$ cat 73-0072/name
329 /sys/bus/i2c/devices/i2c-73$ readlink -f 73-0040/driver
330 /sys/bus/i2c/drivers/ina2xx
331 /sys/bus/i2c/devices/i2c-73$ readlink -f 73-0072/driver
332 /sys/bus/i2c/drivers/pca954x
338 /sys/bus/i2c/devices/i2c-73$ ls 73-0070/driver
340 /sys/bus/i2c/devices/i2c-73$ dmesg | grep 73-0070
352 These symbolic links point to their logical I2C bus directories::
354 /sys/bus/i2c/devices/i2c-73$ ls -l 73-0072/channel-*
372 /sys/bus/i2c/devices/i2c-73/73-0040/hwmon/hwmon17$ ls