Hello,
I am trying to port imx291 camer driver on L4T28.1 kernel (TX2).
my camera sensor is connected on csi-4/5(4-lane) port and use external osillator(37.125).
I am using main platform device tree as below
I filled out the camera sensor characteristics, but I am not sure some of them are correct such as line_length.
I couldn’t find the value on datasheet.
I think that ‘active_w’, ‘active_h’,‘embedded_metadata_height’ values are correct
#define CAM0_RST_L TEGRA_MAIN_GPIO(R, 1)
#define CAM0_PWDN TEGRA_MAIN_GPIO(R, 0)
#define CAM1_RST_L TEGRA_MAIN_GPIO(R, 1)
#define CAM1_PWDN TEGRA_MAIN_GPIO(N, 2)
/ {
tegra-camera-platform {
tpg_max_iso = <3916800>;
};
/* set camera gpio direction to output */
gpio@2200000 {
camera-control-output-low {
gpio-hog;
output-low;
gpios = <CAM0_RST_L 0 CAM0_PWDN 0
CAM1_RST_L 0 CAM1_PWDN 0>;
label = "cam0-rst", "cam0-pwdn",
"cam1-rst", "cam1-pwdn";
};
};
/* all cameras are disabled by default */
host1x {
vi@15700000 {
num-channels = <1>;
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
status = "okay";
reg = <0>;
my_vi_in0: endpoint {
status = "okay";
csi-port = <4>;
bus-width = <4>;
remote-endpoint = <&my_csi_out0>;
};
};
};
};
nvcsi@150c0000 {
num-channels = <1>;
#address-cells = <1>;
#size-cells = <0>;
channel@0 {
status = "okay";
reg = <0>;
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
status = "okay";
reg = <0>;
my_csi_in0: endpoint@0 {
status = "okay";
csi-port = <4>;
bus-width = <4>;
remote-endpoint = <&my_imx291_out0>;
};
};
port@1 {
status = "okay";
reg = <1>;
my_csi_out0: endpoint@1 {
status = "okay";
remote-endpoint = <&my_vi_in0>;
};
};
};
};
};
};
i2c@c240000 {
imx291_a@1a {
status = "okay";
compatible = "nvidia,imx291";
/* Define any required hw resources needed by driver */
/* ie. clocks, io pins, power sources */
clocks = <&tegra_car TEGRA186_CLK_EXTPERIPH1>,
<&tegra_car TEGRA186_CLK_PLLP_OUT0>;
clock-names = "extperiph1", "pllp_grtba";
mclk = "extperiph1";
reset-gpios = <&tegra_main_gpio CAM0_RST_L GPIO_ACTIVE_HIGH>;
pwdn-gpios = <&tegra_main_gpio CAM0_PWDN GPIO_ACTIVE_HIGH>;
reg = <0x1a>;
devnode = "video0";
/* Physical dimensions of sensor */
physical_w = "12.0";
physical_h = "9.3";
mode0 {/*mode IMX291_MODE_1920X1080_30FPS*/
mclk_khz = "37125";
num_lanes = "4";
tegra_sinterface = "serial_e";
discontinuous_clk = "no";
dpcm_enable = "false";
cil_settletime = "0";
active_w = "1937";
active_h = "1097";
pixel_t = "bayer_bggr";
readout_orientation = "0";
line_length = "2640";
inherent_gain = "1";
mclk_multiplier = "4";
pix_clk_hz = "148500000";
min_gain_val = "0"; /* dB */
max_gain_val = "48"; /* dB */
min_hdr_ratio = "1";
max_hdr_ratio = "1";
min_framerate = "1.5";
max_framerate = "30";
min_exp_time = "30";
max_exp_time = "660000";
embedded_metadata_height = "1";
};
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>;
my_imx291_out0: endpoint {
csi-port = <4>;
bus-width = <4>;
remote-endpoint = <&my_csi_in0>;
};
};
};
};
};
tegra-camera-platform {
compatible = "nvidia, tegra-camera-platform";
num_csi_lanes = <4>;
max_lane_speed = <1500000>;
min_bits_per_pixel = <10>;
vi_peak_byte_per_pixel = <2>;
vi_bw_margin_pct = <25>;
max_pixel_rate = <750000>;
isp_peak_byte_per_pixel = <5>;
isp_bw_margin_pct = <25>;
modules {
cam_module0: module0 {
status = "okay";
badge = "my_rear_imx291";
position = "rear";
orientation = "0";
cam_module0_drivernode0: drivernode0 {
status = "okay";
/* Declare PCL support driver (classically known as guid) */
pcl_id = "v4l2_sensor";
/* Driver v4l2 device name */
devname = "imx291 1-001a";
/* Declare the device-tree hierarchy to driver instance */
proc-device-tree = "/proc/device-tree/i2c@c240000/imx291_a@1a";
};
};
};
};
};
the device node(/dev/video0) created successfully during kernel booting and dmesg seems good.
My imx291 driver only support 1920*1080@30 and It seems that the osilloscope show correct signalling on csi2 data lie.
I was trying to capture raw image but the command fails.
root@tegra-ubuntu:/home/nvidia# v4l2-ctl -d /dev/video0 --set-ctrl bypass_mode=0 --stream-mmap --stream-count=1 --stream-to=test.raw
[ 212.992709] [imx291] power on
[ 213.016079] [imx291] get fmt
[ 213.520860] tegra_mipi_cal 3990000.mipical: Mipi cal timeout,val:8861, lanes:3000000
[ 213.528665] tegra_mipi_cal 3990000.mipical: MIPI_CAL_CTRL 0x04 0x2a000010
[ 213.537013] tegra_mipi_cal 3990000.mipical: CIL_MIPI_CAL_STATUS 0x0c 0x00008861
[ 213.545363] tegra_mipi_cal 3990000.mipical: CIL_MIPI_CAL_STATUS_2 0x10 0x00000000
[ 213.553689] tegra_mipi_cal 3990000.mipical: CILA_MIPI_CAL_CONFIG 0x18 0x00000000
[ 213.562084] tegra_mipi_cal 3990000.mipical: CILB_MIPI_CAL_CONFIG 0x1c 0x00000000
[ 213.570435] tegra_mipi_cal 3990000.mipical: CILC_MIPI_CAL_CONFIG 0x20 0x00000000
[ 213.578771] tegra_mipi_cal 3990000.mipical: CILD_MIPI_CAL_CONFIG 0x24 0x00000000
[ 213.587120] tegra_mipi_cal 3990000.mipical: CILE_MIPI_CAL_CONFIG 0x28 0x00200000
[ 213.595439] tegra_mipi_cal 3990000.mipical: CILF_MIPI_CAL_CONFIG 0x2c 0x00200000
[ 213.603742] tegra_mipi_cal 3990000.mipical: DSIA_MIPI_CAL_CONFIG 0x3c 0x00000200
[ 213.612041] tegra_mipi_cal 3990000.mipical: DSIB_MIPI_CAL_CONFIG 0x40 0x00000200
[ 213.620352] tegra_mipi_cal 3990000.mipical: DSIC_MIPI_CAL_CONFIG 0x44 0x00000200
[ 213.628648] tegra_mipi_cal 3990000.mipical: DSID_MIPI_CAL_CONFIG 0x48 0x00000200
[ 213.636939] tegra_mipi_cal 3990000.mipical: MIPI_BIAS_PAD_CFG0 0x5c 0x00000000
[ 213.645228] tegra_mipi_cal 3990000.mipical: MIPI_BIAS_PAD_CFG1 0x60 0x00000000
[ 213.653510] tegra_mipi_cal 3990000.mipical: MIPI_BIAS_PAD_CFG2 0x64 0x00010010
[ 213.661788] tegra_mipi_cal 3990000.mipical: DSIA_MIPI_CAL_CONFIG_2 0x68 0x00000002
[ 213.670076] tegra_mipi_cal 3990000.mipical: DSIB_MIPI_CAL_CONFIG_2 0x6c 0x00000002
[ 213.678351] tegra_mipi_cal 3990000.mipical: DSIC_MIPI_CAL_CONFIG_2 0x74 0x00000002
[ 213.686636] tegra_mipi_cal 3990000.mipical: DSID_MIPI_CAL_CONFIG_2 0x78 0x00000002
[ 213.694949] [imx291] s_stream on mode[0]
[ 214.820685] tegra-vi4 15700000.vi: PXL_SOF syncpt timeout! err = -11
[ 215.827459] tegra-vi4 15700000.vi: PXL_SOF syncpt timeout! err = -11
<[ 216.834176] tegra-vi4 15700000.vi: PXL_SOF syncpt timeout! err = -11
[ 217.840651] tegra-vi4 15700000.vi: ATOMP_FE syncpt timeout!
[ 217.846736] [imx291] s_stream off mode[0]
root@tegra-ubuntu:/home/nvidia# cat /sys/kernel/debug/tracing/trace
# tracer: nop
#
# entries-in-buffer/entries-written: 26/26 #P:4
#
# _-----=> irqs-off
# / _----=> need-resched
# | / _---=> hardirq/softirq
# || / _--=> preempt-depth
# ||| / delay
# TASK-PID CPU# |||| TIMESTAMP FUNCTION
# | | | |||| | |
kworker/4:0-1771 [004] ...1 2023.148266: rtos_queue_peek_from_isr_failed: tstamp:63525590569 queue:0x0b4a3c58
kworker/4:0-1771 [004] ...1 2023.148274: rtcpu_start: tstamp:63525591953
kworker/4:0-1771 [004] ...1 2023.304433: rtos_queue_peek_from_isr_failed: tstamp:63530591466 queue:0x0b4a3c58
kworker/4:0-1771 [004] ...1 2023.460567: rtos_queue_peek_from_isr_failed: tstamp:63535591971 queue:0x0b4a3c58
kworker/4:0-1771 [004] ...1 2023.673973: rtos_queue_peek_from_isr_failed: tstamp:63540592485 queue:0x0b4a3c58
kworker/4:0-1771 [004] ...1 2023.781887: rtos_queue_peek_from_isr_failed: tstamp:63545592966 queue:0x0b4a3c58
kworker/4:0-1771 [004] ...1 2023.936973: rtos_queue_peek_from_isr_failed: tstamp:63550593498 queue:0x0b4a3c58
kworker/4:0-1771 [004] ...1 2023.989018: rtcpu_vinotify_handle_msg: tstamp:63550710601 tag:ATOMP_FS channel:0x00 frame:1 vi_tstamp:3421168022 data:0x00000000
kworker/4:0-1771 [004] ...1 2023.989022: rtcpu_vinotify_handle_msg: tstamp:63550721696 tag:CHANSEL_PXL_SOF channel:0x00 frame:1 vi_tstamp:3421179120 data:0x00000001
kworker/4:0-1771 [004] ...1 2023.989023: rtcpu_vinotify_handle_msg: tstamp:63550722358 tag:CHANSEL_FAULT channel:0x00 frame:1 vi_tstamp:3421179786 data:0x00000100
kworker/4:0-1771 [004] ...1 2023.989025: rtcpu_vinotify_handle_msg: tstamp:63550723284 tag:CHANSEL_LOAD_FRAMED channel:0x10 frame:1 vi_tstamp:3421180359 data:0x08000000
kworker/4:0-1771 [004] ...1 2023.989027: rtcpu_vinotify_handle_msg: tstamp:63550723415 tag:CHANSEL_FAULT_FE channel:0x10 frame:1 vi_tstamp:3421180361 data:0x00000001
kworker/4:0-1771 [004] ...1 2023.989028: rtcpu_vinotify_handle_msg: tstamp:63550723591 tag:ATOMP_FE channel:0x00 frame:1 vi_tstamp:3421180364 data:0x00000000
kworker/4:0-1771 [004] ...1 2024.145174: rtos_queue_peek_from_isr_failed: tstamp:63555594000 queue:0x0b4a3c58
kworker/4:0-1771 [004] ...1 2024.301306: rtos_queue_peek_from_isr_failed: tstamp:63560594504 queue:0x0b4a3c58
kworker/4:0-1771 [004] ...1 2024.457440: rtos_queue_peek_from_isr_failed: tstamp:63565595011 queue:0x0b4a3c58
kworker/4:0-1771 [004] ...1 2024.613578: rtos_queue_peek_from_isr_failed: tstamp:63570595515 queue:0x0b4a3c58
kworker/4:0-1771 [004] ...1 2024.769703: rtos_queue_peek_from_isr_failed: tstamp:63575596032 queue:0x0b4a3c58
kworker/4:0-1771 [004] ...1 2024.925831: rtos_queue_peek_from_isr_failed: tstamp:63580596531 queue:0x0b4a3c58
kworker/4:0-1771 [004] ...1 2025.082008: rtos_queue_peek_from_isr_failed: tstamp:63585597036 queue:0x0b4a3c58
kworker/4:0-1771 [004] ...1 2025.238103: rtos_queue_peek_from_isr_failed: tstamp:63590597550 queue:0x0b4a3c58
kworker/4:0-1771 [004] ...1 2025.394226: rtos_queue_peek_from_isr_failed: tstamp:63595598053 queue:0x0b4a3c58
kworker/4:0-1771 [004] ...1 2025.550374: rtos_queue_peek_from_isr_failed: tstamp:63600598558 queue:0x0b4a3c58
kworker/4:0-1771 [004] ...1 2025.706506: rtos_queue_peek_from_isr_failed: tstamp:63605599065 queue:0x0b4a3c58
kworker/4:0-1771 [004] ...1 2025.862635: rtos_queue_peek_from_isr_failed: tstamp:63610599571 queue:0x0b4a3c58
kworker/4:0-1771 [004] ...1 2025.966732: rtos_queue_peek_from_isr_failed: tstamp:63613587831 queue:0x0b4a3c58
Any help would be appreciated.