Hello,
I am working on a driver for a camera. Till now I set up the I2C driver and so far so good, the drivers compile.
Since the sensor is outputting in LVDS mode, I have to convert it to CSI-2 using an FPGA.
the sensor’s controls (XCLR, Slave address, Trigger, Master/Slave mode, etc) are driven by an I2C to GPIO expander (a similar TI chip used in the dev carrier board B04/C02).
I use two sensors, both attached on the same I2C bus (since both can have a different slave address).
My dtsi in hardware\nvidia\platform\t18x\common\kernel-dts\t18x-common-platforms</i> looks like this:
#include <t18x-common-modules/tegra186-camera-imx392-dual.dtsi>
#include "dt-bindings/clock/tegra186-clock.h"
#define CAM0_RST_L TEGRA_MAIN_GPIO(R, 5)
#define CAM0_PWDN TEGRA_MAIN_GPIO(R, 0)
#define CAM1_RST_L TEGRA_MAIN_GPIO(R, 1)
#define CAM1_PWDN TEGRA_MAIN_GPIO(L, 6)
#define CAMERA_I2C_MUX_BUS(x) (0x1E + x)
/* camera control gpio definitions */
/ {
i2c@3180000 {
tca9539_74: tca9539@74 { // Carrier board
compatible = "ti,tca9539";
gpio-controller;
#gpio-cells = <2>;
reg = <0x74>;
vcc-supply = <&en_vdd_cam>;
tca9539_74_outlow {
gpio-hog;
gpios = <0 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 0 10 0 11 0 12 0 13 0 14 0 15 0>;
output-low;
label = "tca9539_74_outlow_0",
"tca9539_74_outlow_1",
"tca9539_74_outlow_2",
"tca9539_74_outlow_3",
"tca9539_74_outlow_4",
"tca9539_74_outlow_5",
"tca9539_74_outlow_6",
"tca9539_74_outlow_7";
"tca9539_74_outlow_8";
"tca9539_74_outlow_9";
"tca9539_74_outlow_10";
"tca9539_74_outlow_11";
"tca9539_74_outlow_12";
"tca9539_74_outlow_13";
"tca9539_74_outlow_14";
"tca9539_74_outlow_15";
};
tca9539_74_outhigh {
status = "disabled";
};
tca9539_74_input {
status = "disabled";
};
};
tca9546_70: tca9546@70 { // TCA9546 internal?
compatible = "nxp,pca9546"; // PCA9546?
reg = <0x70>;
#address-cells = <1>;
#size-cells = <0>;
vcc-supply = <&en_vdd_cam>;
skip_mux_detect;
force_bus_start = <CAMERA_I2C_MUX_BUS(0)>;
i2c@0 {
reg = <0>;
i2c-mux,deselect-on-exit;
#address-cells = <1>;
#size-cells = <0>;
imx392_a@36 {
clocks = <&tegra_car TEGRA186_CLK_EXTPERIPH1>,
<&tegra_car TEGRA186_CLK_PLLP_OUT0>;
mclk = "extperiph1";
vif-supply = <&en_vdd_cam>;
};
imx392_a@37 {
clocks = <&tegra_car TEGRA186_CLK_EXTPERIPH1>,
<&tegra_car TEGRA186_CLK_PLLP_OUT0>;
mclk = "extperiph1";
vif-supply = <&en_vdd_cam>;
};
};
};
};
};
The part that I don’t really understand in this table is this the definition of the tca9546 and why “nxp,pca9546” is in the compatible tag of a TI chip. (I copied this from another sensor dtsi, it seems like all of them use it)
Next is the compiling:
Error: /home/travis/build/USERNAME/jetson-camera/build/Linux_for_Tegra/sources/kernel/kernel-4.9/../../hardware/nvidia/platform/t18x/common/kernel-dts/t18x-common-platforms/tegra186-quill-camera-imx392-dual.dtsi:12.1-2 syntax error
FATAL ERROR: Unable to parse input tree
What is wrong with the start? It’s exactly like all other sensors.
At last, how do I get control over the I2C to GPIO expander? Where do I define it’s settings when the sensors are turned on? (for example, when XCLR needs to become a high signal, when the Oscillator needs to start oscillating, setting up the slave address for each sensor, etc)?