When I want to read data from other i2c chips, I use functions defined in /driver/i2c/i2c-dev.c. but there have one question that in /dev/ there has i2c0–i2c6. so i want to know if i open("/dev/i2c-0",O_RDWR), in the hardware which one is the pins for this i2c-0.
Please take a look at http://developer.nvidia.com/embedded/dlc/jetson-tx1-tx2-developer-kit-carrier-board-design-files to see if still any question.
“/dev/i2c-0” on JTX1 corresponds to I2C_GP0, or GEN1_I2C.
Some additional reference documents:
- “Jetson TX1 OEM Product Design Guide” (page 52), http://developer.nvidia.com/embedded/dlc/jetson-tx1-oem-product-design-guide
- “Jetson TX1 Module Pinmux”, http://developer.nvidia.com/embedded/dlc/jetson-tx1-module-pinmux
Sorry, I am still confused about why “/dev/i2c-0” on JTX1 corresponds to I2C_GP0, or GEN1_I2C, after I have read the reference document you mentioned above.
if I want to control I2C_Camera, I still can not find which i2c-X I need to control. In Exynos 4412, the pin_mux of i2c node is defined in Kernel. so i wonder if i can find pin_mux of i2c for TX1 from Kernel combined with reference document.
I2CVI_CLK Bidirectional No Disable CAM_I2C_SCL Camera I2C
I2CVI_DAT Bidirectional No Disable CAM_I2C_SDA
as documents write above, it does not mentiond which i2c-X is used if i want to write APP to contrl I2C_CAM
OK, I know I haven’t been specific enough. Here it is.
Try the following command on JTX1, by which you can find the corresponding hardware register address for each /dev/i2c-?.
ubuntu@tegra-ubuntu:~$ ls -d /sys/bus/platform/devices/*.i2c/i2c-*/ /sys/bus/platform/devices/546c0000.i2c/i2c-6/ /sys/bus/platform/devices/7000c000.i2c/i2c-0/ /sys/bus/platform/devices/7000c400.i2c/i2c-1/ /sys/bus/platform/devices/7000c500.i2c/i2c-2/ /sys/bus/platform/devices/7000c700.i2c/i2c-3/ /sys/bus/platform/devices/7000d000.i2c/i2c-4/ /sys/bus/platform/devices/7000d100.i2c/i2c-5/
This matches what’s been defined in the DTSI (device tree) of JTX1. Take /dev/i2c-0 for example. It corresponds to “i2c1” (line #1306~1315) in the DTSI file.
Next refer to “Tegra X1 (SoC) Technical Reference Manual” (http://developer.nvidia.com/embedded/dlc/tegra-x1-technical-reference-manual). Based on my own reading and understanding, JTX1 has been configured to “Config 1”, or “PinMux = 0”, in the pinmux table (page 609~610). From there I conclude /dev/i2c-0 corresponds to I2C_1 in the table, which in turn corresponds to GEN1_I2C.
By the way, I2C_CAM corresponds to “host1x -> i2c7” in the DTSI file. So it translates to /dev/i2c-6.