Lines Matching +full:channel +full:- +full:7

1 .. SPDX-License-Identifier: GPL-2.0
18 useful and essential to use ``i2c-tools`` for the purpose of development and
22 ---------------
28 -------------
41 start with ``i2c-`` are I2C buses, which may be either physical or logical. The
48 0-0008 0-0061 1-0028 3-0043 4-0036 4-0041 i2c-1 i2c-3
49 0-000c 0-0066 2-0049 4-000b 4-0040 i2c-0 i2c-2 i2c-4
51 ``i2c-2`` is an I2C bus whose number is 2, and ``2-0049`` is an I2C device
60 -----------------------------
71 -----------------------
75 the lowest register addresses may be called ``I2C-0``.
78 ---------------
85 an abstraction of a channel behind an I2C MUX. In case it is an abstraction of a
86 MUX channel, whenever we access an I2C device via a such logical bus, the kernel
87 will switch the I2C MUX for you to the proper channel as part of the
91 ----------------
97 ------
102 section ``aliases``. See ``arch/arm/boot/dts/nuvoton-npcm730-gsj.dts``
122 i2c-7 (physical I2C bus controller 7)
123 `-- 7-0071 (4-channel I2C MUX at 0x71)
124 |-- i2c-60 (channel-0)
125 |-- i2c-73 (channel-1)
126 | |-- 73-0040 (I2C sensor device with hwmon directory)
127 | |-- 73-0070 (I2C MUX at 0x70, exists in DTS, but failed to probe)
128 | `-- 73-0072 (8-channel I2C MUX at 0x72)
129 | |-- i2c-78 (channel-0)
130 | |-- ... (channel-1...6, i2c-79...i2c-84)
131 | `-- i2c-85 (channel-7)
132 |-- i2c-86 (channel-2)
133 `-- i2c-203 (channel-3)
136 ----------------------------------------
140 command ``ls -l`` or ``readlink``.
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.
165 abstracts an I2C MUX channel under the parent bus.
169 $ readlink /sys/bus/i2c/devices/i2c-73/device
170 ../../i2c-7
171 $ readlink /sys/bus/i2c/devices/i2c-73/mux_device
172 ../7-0071
174 ``i2c-73`` is a logical bus fanout by an I2C MUX under ``i2c-7``
177 switch the I2C MUX addressed 0x71 to the proper channel for you as part of the
181 ----------------------------------
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
189 8-channel MUX at address 0x72 behind the channel 1 of the 0x71 MUX. Let us
190 navigate through Sysfs and find out the logical I2C bus number of the channel 3
193 First of all, let us go to the directory of ``i2c-7``::
195 ~$ cd /sys/bus/i2c/devices/i2c-7
196 /sys/bus/i2c/devices/i2c-7$ ls
197 7-0071 i2c-60 name subsystem
198 delete_device i2c-73 new_device uevent
199 device i2c-86 of_node
200 i2c-203 i2c-dev power
202 There, we see the 0x71 MUX as ``7-0071``. Go inside it::
204 /sys/bus/i2c/devices/i2c-7$ cd 7-0071/
205 /sys/bus/i2c/devices/i2c-7/7-0071$ ls -l
206 channel-0 channel-3 modalias power
207 channel-1 driver name subsystem
208 channel-2 idle_state of_node uevent
210 Read the link ``channel-1`` using ``readlink`` or ``ls -l``::
212 /sys/bus/i2c/devices/i2c-7/7-0071$ readlink channel-1
213 ../i2c-73
215 We find out that the channel 1 of 0x71 MUX on ``i2c-7`` is assigned
217 Let us continue the journey to directory ``i2c-73`` in either ways::
219 # cd to i2c-73 under I2C Sysfs root
220 /sys/bus/i2c/devices/i2c-7/7-0071$ cd /sys/bus/i2c/devices/i2c-73
221 /sys/bus/i2c/devices/i2c-73$
223 # cd the channel symbolic link
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$
231 Either ways, you will end up in the directory of ``i2c-73``. Similar to above,
235 /sys/bus/i2c/devices/i2c-73$ ls
236 73-0040 device i2c-83 new_device
237 73-004e i2c-78 i2c-84 of_node
238 73-0050 i2c-79 i2c-85 power
239 73-0070 i2c-80 i2c-dev subsystem
240 73-0072 i2c-81 mux_device uevent
241 delete_device i2c-82 name
242 /sys/bus/i2c/devices/i2c-73$ cd 73-0072
243 /sys/bus/i2c/devices/i2c-73/73-0072$ ls
244 channel-0 channel-4 driver of_node
245 channel-1 channel-5 idle_state power
246 channel-2 channel-6 modalias subsystem
247 channel-3 channel-7 name uevent
248 /sys/bus/i2c/devices/i2c-73/73-0072$ readlink channel-3
249 ../i2c-81
251 There, we find out the logical I2C bus number of the channel 3 of the 0x72 MUX
253 issue ``i2c-tools`` commands.
256 `i2cdetect -l
257 <https://manpages.debian.org/unstable/i2c-tools/i2cdetect.8.en.html>`_
265 $ i2cdetect -l | grep -e '\-73' -e _7 | sort -V
266 i2c-7 i2c npcm_i2c_7 I2C adapter
267 i2c-73 i2c i2c-7-mux (chan_id 1) I2C adapter
268 i2c-78 i2c i2c-73-mux (chan_id 0) I2C adapter
269 i2c-79 i2c i2c-73-mux (chan_id 1) I2C adapter
270 i2c-80 i2c i2c-73-mux (chan_id 2) I2C adapter
271 i2c-81 i2c i2c-73-mux (chan_id 3) I2C adapter
272 i2c-82 i2c i2c-73-mux (chan_id 4) I2C adapter
273 i2c-83 i2c i2c-73-mux (chan_id 5) I2C adapter
274 i2c-84 i2c i2c-73-mux (chan_id 6) I2C adapter
275 i2c-85 i2c i2c-73-mux (chan_id 7) I2C adapter
278 -----------------------------
283 example, if the system has ``i2c-15`` as the highest logical bus number, and a
284 4-channel MUX is applied successfully, we will have ``i2c-16`` for the
285 MUX channel 0, and all the way to ``i2c-19`` for the MUX channel 3.
290 ``arch/arm/boot/dts/aspeed-bmc-facebook-wedge400.dts``
292 In the above example, there is an 8-channel I2C MUX at address 0x70 on physical
293 I2C bus 2. The channel 2 of the MUX is defined as ``imux18`` in DTS,
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.
308 of ``${bus}-${addr}``. The ``${bus}`` part in the name is a logical I2C bus
313 ----------------------------
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
331 /sys/bus/i2c/devices/i2c-73$ readlink -f 73-0072/driver
338 /sys/bus/i2c/devices/i2c-73$ ls 73-0070/driver
339 ls: 73-0070/driver: No such file or directory
340 /sys/bus/i2c/devices/i2c-73$ dmesg | grep 73-0070
341 pca954x 73-0070: probe failed
342 pca954x 73-0070: probe failed
348 --------------
351 will have symbolic link ``channel-*`` inside its device directory.
354 /sys/bus/i2c/devices/i2c-73$ ls -l 73-0072/channel-*
355 lrwxrwxrwx ... 73-0072/channel-0 -> ../i2c-78
356 lrwxrwxrwx ... 73-0072/channel-1 -> ../i2c-79
357 lrwxrwxrwx ... 73-0072/channel-2 -> ../i2c-80
358 lrwxrwxrwx ... 73-0072/channel-3 -> ../i2c-81
359 lrwxrwxrwx ... 73-0072/channel-4 -> ../i2c-82
360 lrwxrwxrwx ... 73-0072/channel-5 -> ../i2c-83
361 lrwxrwxrwx ... 73-0072/channel-6 -> ../i2c-84
362 lrwxrwxrwx ... 73-0072/channel-7 -> ../i2c-85
365 -------------------------
372 /sys/bus/i2c/devices/i2c-73/73-0040/hwmon/hwmon17$ ls
382 ../hwmon/sysfs-interface.rst
385 ------------------------------------
387 Refer to section "Method 4: Instantiate from user-space" of instantiating-devices.rst