I am currently trying to recompile the device tree after some concerns were brought up regarding the source of our original device tree.
The file tegra186-tx2nx-lt6911uxc.dtsi was added as an included file in hardware/nvidia/platform/t18x/common/kernel-dts/t18x-common-platforms/tegra186-quill-common.dtsi. When I try to compile the device tree using the make command make -C kernel/kernel-4.9/ ARCH=arm64 O=$TEGRA_KERNEL_OUT LOCALVERSION=-tegra CROSS_COMPILE=${TOOLCHAIN_PREFIX} -j$(nproc) dtbs I get the following syntax errors:
Error: /opt/Linux_for_Tegra/source/public/kernel/kernel-4.9/../../hardware/nvidia/platform/t18x/common/kernel-dts/t18x-common-platforms/tegra186-tx2nx-lt6911uxc.dtsi:13.38-39 syntax error
FATAL ERROR: Unable to parse input tree
Error: /opt/Linux_for_Tegra/source/public/kernel/kernel-4.9/../../hardware/nvidia/platform/t18x/common/kernel-dts/t18x-common-platforms/tegra186-tx2nx-lt6911uxc.dtsi:13.38-39 syntax error
FATAL ERROR: Unable to parse input tree
I read this as there being an issue on line 13, which is where I set the reset GPIO. reset-gpio = <&tegra_main_gpio TEGRA186_MAIN_GPIO(N, 1) GPIO_ACTIVE_LOW>;
Is this the incorrect syntax, or am I missing something else?
That definitely makes sense. I went and included what I expected to be the relevant gpio files for the TX2 NX and tried recompiling, but ran into similar errors. So I’m not certain what include file I could be missing.
Please see the full dtsi file tegra186-tx2nx-lt6911uxc.dtsi:
#define LT6911_EN "okay"
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/gpio/tegra186-gpio.h>
/ {
i2c@3180000 {
clock-frequency = <100000>;
lt6911uxc_a@2b {
compatible = "nvidia,lt6911uxc";
reg = <0x2b>;
status = "okay";
devnode = "video0";
/* Reset */
reset-gpio = <&tegra_main_gpio TEGRA186_MAIN_GPIO(N, 1) GPIO_ACTIVE_LOW>;
/* Interrupt */
interrupt-parent = <&tegra_main_gpio>;
interrupts = <&tegra_main_gpio TEGRA186_MAIN_GPIO(E, 2) IRQ_TYPE_LEVEL_HIGH>;
mclk = <&tegra_main_gpio TEGRA186_MAIN_GPIO(J, 3)>;
set_mode_delay_ms = "5000";
port@0 {
ret = <0>;
status = "okay";
hdmi2csi_lt6911_out0: endpoint {
status = "okay";
port-index = <0>;
bus-width = <4>;
remote-endpoint = <&hdmi2csi_csi_in0>;
};
};
};
};
host1x {
/* Delete existing VI node to avoid conflicts */
/delete-node/ vi;
vi@15c10000 {
num-channels = <1>;
status = LT6911_EN;
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
status = LT6911_EN;
reg = <0>;
hdmi2csi_vi_in0: endpoint {
status = LT6911_EN;
port-index =<0>;
bus-width = <4>;
remote-endpoint = <&hdmi2csi_csi_out0>;
};
};
};
};
nvcsi@15a00000 {
num-channels = <1>;
#address-cells = <1>;
#size-cells = <0>;
status = LT6911_EN;
channel@0 {
status = LT6911_EN;
reg = <0>;
discontinuous_clk = "no";
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
status = LT6911_EN;
reg = <0>;
hdmi2csi_csi_in0: endpoint@0 {
status = LT6911_EN;
port-index = <0>;
bus-width = <4>;
remote-endpoint = <&hdmi2csi_lt6911_out0>;
};
};
port@1 {
status = LT6911_EN;
reg = <1>;
hdmi2csi_csi_out0: endpoint@1 {
status = LT6911_EN;
remote-endpoint = <&hdmi2csi_vi_in0>;
};
};
};
};
};
};
tegra-camera-platform {
compatible = "nvidia, tegra-camera-platform";
/**
* Physical settings to calculate max ISO BW
*
* num_csi_lanes = <>;
* Total number of CSI lanes when all cameras are active
*
* max_lane_speed = <>;
* Max lane speed in Kbit/s
*
* min_bits_per_pixel = <>;
* Min bits per pixel
*
* vi_peak_byte_per_pixel = <>;
* Max byte per pixel for the VI ISO case
*
* vi_bw_margin_pct = <>;
* Vi bandwidth margin in percentage
*
* max_pixel_rate = <>;
* Max pixel rate in Kpixel/s for the ISP ISO case
*
* isp_peak_byte_per_pixel = <>;
* Max byte per pixel for the ISP ISO case
*
* isp_bw_margin_pct = <>;
* Isp bandwidth margin in percentage
*/
num_csi_lanes = <8>;
max_lane_speed = <2500000>;
min_bits_per_pixel = <16>;
vi_peak_byte_per_pixel = <3>;
vi_bw_margin_pct = <25>;
isp_peak_byte_per_pixel = <3>;
isp_bw_margin_pct = <25>;
status = LT6911_EN;
/**
* The general guideline for naming badge_info contains 3 parts, and is as follows,
* The first part is the camera_board_id for the module; if the module is in a FFD
* platform, then use the platform name for this part.
* The second part contains the position of the module, ex. “rear” or “front”.
* The third part contains the last 6 characters of a part number which is found
* in the module's specsheet from the vender.
*/
modules {
module0 {
status = LT6911_EN;
badge = "hdmi2csi_left_6911";
position = "left";
orientation = "1";
drivernode0 {
/* Declare PCL support driver (classically known as guid) */
pcl_id = "v4l2_sensor";
/* Driver v4l2 device name */
devname = "lt6911uxc 2-002b";
/* Declare the device-tree hierarchy to driver instance */
proc-device-tree = "/proc/device-tree/i2c@3180000/lt6911uxc_a@2b";
};
};
};
};
};
From what I can tell, the issue was due to where the function calls for TEGRA186_MAIN_GPIO() were located.
By defining those function calls at the top of the file (see the #define section in the code below) as different names, the compile went through without issue. Commented out in the code are the original definitions (reset-gpio, interrupts, and mclk).
@JerryChang I did not see any note in the documentation specifying that GPIO pins should be defined outside of the main code body in a .dtsi file, so I don’t know if this is a bug or just some idiosyncrasy I worked around. Do you have any insight as to whether this is expected functionality?