I am a bit confused with behavior of Jetson TX2 when loading drivers for camera.
Here is definition of IMX274 in device tree:
i2c@3180000 {
reg = <0x0 0x3180000 0x0 0x100>;
dmas = <0x19 0x17 0x19 0x17>;
interrupts = <0x0 0x1b 0x4>;
compatible = "nvidia,tegra186-i2c";
clock-names = "div-clk", "parent", "slow-clk";
reset-names = "i2c";
clock-frequency = <0x61a80>;
scl-gpio = <0x12 0x72 0x0>;
sda-gpio = <0x12 0x73 0x0>;
clocks = <0xd 0x4b 0xd 0x10d 0xd 0x5c>;
resets = <0xd 0x15>;
status = "okay";
#address-cells = <0x1>;
phandle = <0x7c>;
#stream-id-cells = <0x1>;
#size-cells = <0x0>;
dma-names = "rx", "tx";
linux,phandle = <0x7c>;
imx274_a@1a {
reg = <0x1a>;
mclk = "extperiph1";
devnode = "video0";
avdd-reg = "vana";
compatible = "nvidia,imx274";
clock-names = "extperiph1", "pllp_grtba";
reset-gpios = <0x12 0x8d 0x0>;
physical_h = "2.738";
physical_w = "3.674";
clocks = <0xd 0x59 0xd 0x10d>;
vana-supply = <0x1a>;
sensor_model = "imx274";
iovdd-reg = "vif";
delayed_gain = "true";
vif-supply = <0x1a>;
dvdd-reg = "vdig";
vdig-supply = <0x1a>;
mode0 {
...
}
ports {
#address-cells = <0x1>;
#size-cells = <0x0>;
port@0 {
reg = <0x0>;
endpoint {
bus-width = <0x4>;
remote-endpoint = <0x1d>;
phandle = <0x94>;
csi-port = <0x0>;
linux,phandle = <0x94>;
};
};
};
};
i2c2 is an alias for i2c@3180000 therefore I expect to see the device on bus 2. An sure I can see it on a bus with address 0x57
.
nvidia@tegra-ubuntu:~/kernel/kernel$ sudo i2cdetect -r -y 2
[sudo] password for nvidia:
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- UU -- -- -- -- --
20: -- -- -- -- UU -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- 57 -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
Here comes the first question. How does kernel identifies type of i2c device on a bus? I thought that field reg
is used, but 0x1a in device tree is clearly different from 0x57 on a bus.
Secondly, as I can see module is compatible with the following drivers: compatible = "nvidia,imx274";
However device driver is different:
nvidia@tegra-ubuntu:~/kernel/kernel$ sudo v4l2-ctl -D -d /dev/video0
Driver Info (not using libv4l2):
Driver name : tegra-video
Card type : vi-output, imx274 2-001a
Bus info : platform:15700000.vi:0
Driver version: 4.4.38
Capabilities : 0x84200001
Video Capture
Streaming
Extended Pix Format
Device Capabilities
Device Caps : 0x04200001
Video Capture
Streaming
Extended Pix Format
Therefore it seems for me that wrong driver is loaded for some reasons, it it true or I am just missing something? However it is still possible to capture image with argus.
i2cdetect
does only probe randomly, without knowing the device tree, so no magic here. And are you sure aboutcompatible = "nvidia,imx274"
, not"sony,imx274"
? Isn't that a Sony driver?i2cdetect
can probe for devices independent from actual devices being present or higher-level drivers being loaded. Mainly just trying each address and checking for an ACK. 2) To my knowledge, thecompatible
is checked against identifiers different from the driver name. A driver can call itselffoo
but get triggered bycompatible,bar