How to config csi with yuv422 in tx2?

Hi nvidia:
my board is FPGA (send LVDS data) -> LT9211 (change LVDS to MIPI) -> TX2.
TX2 receive the data format is YUV.
my changes is :

  1. modify the format for yuv:
    diff --git a/drivers/media/platform/tegra/camera/camera_common.c b/drivers/media/platform/tegra/camera/camera_common.c
    index 41f39ea…918cdbd 100644
    — a/drivers/media/platform/tegra/camera/camera_common.c
    +++ b/drivers/media/platform/tegra/camera/camera_common.c
    @@ -71,6 +71,23 @@ static const struct camera_common_colorfmt camera_common_color_fmts = {
    V4L2_COLORSPACE_SRGB,
    V4L2_PIX_FMT_XRGGB10P,
    },
  •   {       MEDIA_BUS_FMT_UYVY8_1X16,
    
  •           V4L2_COLORSPACE_SRGB,
    
  •           V4L2_PIX_FMT_UYVY,
    
  •   },
    
  •   {       MEDIA_BUS_FMT_UYVY8_2X8,
    
  •           V4L2_COLORSPACE_SRGB,
    
  •           V4L2_PIX_FMT_UYVY,
    
  •   },
    
  •   {       MEDIA_BUS_FMT_YUYV10_2X10,
    
  •           V4L2_COLORSPACE_SRGB,
    
  •           V4L2_PIX_FMT_YUYV,
    
  •   },
    
  •   {
    
  •            MEDIA_BUS_FMT_YUYV8_2X8,
    
  •            V4L2_COLORSPACE_SRGB,
    
  •            V4L2_PIX_FMT_YUYV,
    
  •   }, 
    

};

diff --git a/drivers/media/platform/tegra/camera/sensor_common.c b/drivers/media/platform/tegra/camera/sensor_common.c
index fd5ace1…276a29b 100644
— a/drivers/media/platform/tegra/camera/sensor_common.c
+++ b/drivers/media/platform/tegra/camera/sensor_common.c
@@ -135,11 +135,17 @@ static int extract_pixel_format(
*format = V4L2_PIX_FMT_XBGGR10P;
else if (strncmp(pixel_t, “bayer_xrggb10p”, size) == 0)
*format = V4L2_PIX_FMT_XRGGB10P;

  •   else if (strncmp(pixel_t, "uyvy", size) == 0)
    
  •           *format = V4L2_PIX_FMT_UYVY;
    
  •   else if (strncmp(pixel_t, "yuyv", size) == 0)
    
  •           *format = V4L2_PIX_FMT_YUYV; 
    
  •   else if (strncmp(pixel_t, "rgb3", size) == 0)
    
  •           *format = V4L2_PIX_FMT_RGB24;
      else {
              pr_err("%s: Need to extend format%s\n", __func__, pixel_t);
              return -EINVAL;
      }
    
  •   pr_info("%s format 0x%x\n", __func__, *format);
      return 0;
    

}
2. config DTS
mclk_khz = “24000”;
num_lanes = “2”;
tegra_sinterface = “serial_a”;
discontinuous_clk = “no”;
dpcm_enable = “false”;
cil_settletime = “0”;

					active_w = "1920";
					active_h = "1080";
					pixel_t = "YUV422";		// bayer_bggr	RGB24	YUV422
					readout_orientation = "90";
					line_length = "2200";
					inherent_gain = "1";
					mclk_multiplier = "3.09";
					pix_clk_hz = "74250000";

					min_gain_val = "1.0";
					max_gain_val = "16";
					min_hdr_ratio = "1";
					max_hdr_ratio = "64";
					min_framerate = "1.816577";
					max_framerate = "30";
					min_exp_time = "34";
					max_exp_time = "550385";
					embedded_metadata_height = "0";
	3. disable crc check 
	diff --git a/drivers/media/platform/tegra/camera/csi/csi4_fops.c b/drivers/media/platform/tegra/camera/csi/csi4_fops.c

index d64294b…9b1eec6 100644
— a/drivers/media/platform/tegra/camera/csi/csi4_fops.c
+++ b/drivers/media/platform/tegra/camera/csi/csi4_fops.c
@@ -77,8 +77,17 @@ static void csi4_stream_init(struct tegra_csi_channel *chan, int port_num)
csi4_stream_write(chan, port_num, INTR_STATUS, 0x3ffff);
csi4_stream_write(chan, port_num, ERR_INTR_STATUS, 0x7ffff);
csi4_stream_write(chan, port_num, ERROR_STATUS2VI_MASK, 0x0);

  •   csi4_stream_write(chan, port_num, INTR_MASK, 0x0);
    
  •   csi4_stream_write(chan, port_num, ERR_INTR_MASK, 0x0);
    
  •   //csi4_stream_write(chan, port_num, INTR_MASK, 0x0);
    
  •   //csi4_stream_write(chan, port_num, ERR_INTR_MASK, 0x0);
    
  •   csi4_stream_write(chan, port_num, INTR_MASK, PH_ECC_MULTI_BIT_ERR |
    
  •                   PD_CRC_ERR_VC0 | PH_ECC_SINGLE_BIT_ERR_VC0);
    
  •   csi4_stream_write(chan, port_num, ERR_INTR_MASK, PH_ECC_MULTI_BIT_ERR |
    
  •                   PD_CRC_ERR_VC0 | PH_ECC_SINGLE_BIT_ERR_VC0);
    
  •   csi4_stream_write(chan, port_num, ERROR_STATUS2VI_MASK,
    
  •                   CFG_ERR_STATUS2VI_MASK_VC0 |
    
  •                   CFG_ERR_STATUS2VI_MASK_VC1 |
    
  •                   CFG_ERR_STATUS2VI_MASK_VC2 |
    
  •                   CFG_ERR_STATUS2VI_MASK_VC3);
    

}

But the csi receive error data:
dmesg:
[ 83.089793] IPVS: Creating netns size=1424 id=4
[ 167.184598] nvcsi 150c0000.nvcsi: csi4_stream_init: Disable ECC check
[ 168.189066] tegra-vi4 15700000.vi: PXL_SOF syncpt timeout! err = -11
[ 169.193048] tegra-vi4 15700000.vi: PXL_SOF syncpt timeout! err = -11
[ 169.193060] tegra-vi4 15700000.vi: ATOMP_FE syncpt timeout! err = -11
[ 170.205053] tegra-vi4 15700000.vi: PXL_SOF syncpt timeout! err = -11
[ 171.209045] tegra-vi4 15700000.vi: ATOMP_FE syncpt timeout! err = -11
[ 171.209056] tegra-vi4 15700000.vi: PXL_SOF syncpt timeout! err = -11
[ 172.209030] tegra-vi4 15700000.vi: PXL_SOF syncpt timeout! err = -11
[ 173.213049] tegra-vi4 15700000.vi: PXL_SOF syncpt timeout! err = -11
[ 174.217056] tegra-vi4 15700000.vi: PXL_SOF syncpt timeout! err = -11
[ 174.217068] tegra-vi4 15700000.vi: ATOMP_FE syncpt timeout! err = -11
[ 175.229060] tegra-vi4 15700000.vi: PXL_SOF syncpt timeout! err = -11
[ 176.233052] tegra-vi4 15700000.vi: PXL_SOF syncpt timeout! err = -11
[ 176.233063] tegra-vi4 15700000.vi: ATOMP_FE syncpt timeout! err = -11
[ 177.245014] tegra-vi4 15700000.vi: PXL_SOF syncpt timeout! err = -11
[ 178.249073] tegra-vi4 15700000.vi: PXL_SOF syncpt timeout! err = -11
[ 178.249084] tegra-vi4 15700000.vi: ATOMP_FE syncpt timeout! err = -11
[ 179.261069] tegra-vi4 15700000.vi: ATOMP_FE syncpt timeout!

trace:
root@tegra-ubuntu:/home/nvidia# cat /sys/kernel/debug/tracing/trace

tracer: nop

entries-in-buffer/entries-written: 103/103 #P:4

_-----=> irqs-off

/ _----=> need-resched

| / _—=> hardirq/softirq

|| / _–=> preempt-depth

||| / delay

TASK-PID CPU# |||| TIMESTAMP FUNCTION

| | | |||| | |

 kworker/3:1-113   [003] ...1   167.220908: rtos_queue_peek_from_isr_failed: tstamp:5334422373 queue:0x0b4a3c58
 kworker/3:1-113   [003] ...1   167.220916: rtcpu_start: tstamp:5334424277
 kworker/3:1-113   [003] ...1   167.220919: rtcpu_vinotify_handle_msg: tstamp:5334789986 tag:CSIMUX_STREAM channel:0xff frame:0 vi_tstamp:1039822218 data:0x00000001
 kworker/3:1-113   [003] ...1   167.272975: rtcpu_vinotify_handle_msg: tstamp:5335850302 tag:CHANSEL_SHORT_FRAME channel:0x01 frame:4897 vi_tstamp:1040882395 data:0x00000001
 kworker/3:1-113   [003] ...1   167.272988: rtcpu_vinotify_handle_msg: tstamp:5335850469 tag:ATOMP_FE channel:0x00 frame:4897 vi_tstamp:1040882398 data:0x00000001
 kworker/3:1-113   [003] ...1   167.376949: rtos_queue_peek_from_isr_failed: tstamp:5339423516 queue:0x0b4a3c58
 kworker/3:1-113   [003] ...1   167.533103: rtos_queue_peek_from_isr_failed: tstamp:5344424010 queue:0x0b4a3c58
 kworker/3:1-113   [003] ...1   167.688947: rtos_queue_peek_from_isr_failed: tstamp:5349424514 queue:0x0b4a3c58
 kworker/3:1-113   [003] ...1   167.844956: rtos_queue_peek_from_isr_failed: tstamp:5354425019 queue:0x0b4a3c58
 kworker/3:1-113   [003] ...1   168.001046: rtos_queue_peek_from_isr_failed: tstamp:5359425533 queue:0x0b4a3c58
 kworker/3:1-113   [003] ...1   168.156965: rtos_queue_peek_from_isr_failed: tstamp:5364426050 queue:0x0b4a3c58
 kworker/3:1-113   [003] ...1   168.260998: rtcpu_vinotify_handle_msg: tstamp:5368142044 tag:CHANSEL_SHORT_FRAME channel:0x01 frame:4928 vi_tstamp:1073173931 data:0x00000001
 kworker/3:1-113   [003] ...1   168.261016: rtcpu_vinotify_handle_msg: tstamp:5368142554 tag:ATOMP_FE channel:0x00 frame:4928 vi_tstamp:1073173934 data:0x00000001
 kworker/3:1-113   [003] ...1   168.312962: rtos_queue_peek_from_isr_failed: tstamp:5369426545 queue:0x0b4a3c58
 kworker/3:1-113   [003] ...1   168.468953: rtos_queue_peek_from_isr_failed: tstamp:5374427050 queue:0x0b4a3c58
 kworker/3:1-113   [003] ...1   168.624987: rtos_queue_peek_from_isr_failed: tstamp:5379427555 queue:0x0b4a3c58
 kworker/3:1-113   [003] ...1   168.780954: rtos_queue_peek_from_isr_failed: tstamp:5384428065 queue:0x0b4a3c58

Can you have any idea for me?

The trace log show the resolution (high) not as expect. “CHANSEL_SHORT_FRAME”

thanks.
Can you explain how to Analysis the “CHANSEL_SHORT_FRAME”?
Why this “CHANSEL_SHORT_FRAME channel:0x01 frame:4897 vi_tstamp:1040882395 data:0x00000001” indicate the resolution (high) not as expect?

Have a check below link

https://elinux.org/Jetson_TX2/28.1_Camera_BringUp