Broken every 5th pixel in RAW14 mode

Hi,

I develop a driver which works with our camera via MIPI CSI-2 in RAW14 (0x2D) mode on 4 lanes.
I’ve added all needed definitions for RAW14 format and driver works but when I capture single frame:

v4l2-ctl --set-fmt-video=pixelformat=Y14 --stream-mmap --stream-count=1 -d /dev/video0 --stream-to=capture.raw

the captured frame has “broken” every 5th (sometimes also 6th) pixel in the line. It effects in one- or two-pixel wide vertical lines on the image.

What could be a reason? Any suggestions?

The output status from v4l2-ctl is:

nvidia@tegra-ubuntu:~$ v4l2-ctl --list-formats
ioctl: VIDIOC_ENUM_FMT
        Index       : 0
        Type        : Video Capture
        Pixel Format: 'Y14 '
        Name        : 14-bit Greyscale

        Index       : 1
        Type        : Video Capture
        Pixel Format: 'Y16 '
        Name        : 16-bit Greyscale

        Index       : 2
        Type        : Video Capture
        Pixel Format: 'GREY'
        Name        : 8-bit Greyscale

nvidia@tegra-ubuntu:~$ v4l2-ctl --all
Driver Info (not using libv4l2):
        Driver name   : tegra-video
        Card type     : vi-output, mipi-boson 6-0001
        Bus info      : platform:54080000.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
Priority: 2
Video input : 0 (Camera 0: ok)
Format Video Capture:
        Width/Height      : 320/256
        Pixel Format      : 'Y14 '
        Field             : None
        Bytes per Line    : 768
        Size Image        : 196608
        Colorspace        : sRGB
        Transfer Function : Default
        YCbCr Encoding    : Default
        Quantization      : Default
        Flags             : 

Camera Controls

                     hdr_enable (intmenu): min=0 max=1 default=0 value=0
                    sensor_mode (int64)  : min=0 max=0 step=0 default=0 value=0 flags=read-only
                           gain (int64)  : min=0 max=0 step=0 default=0 value=4194304 flags=read-only
                     frame_rate (int64)  : min=0 max=0 step=0 default=0 value=251658240 flags=read-only
                    bypass_mode (intmenu): min=0 max=1 default=0 value=0
                override_enable (intmenu): min=0 max=1 default=0 value=0
                   height_align (int)    : min=1 max=16 step=1 default=1 value=1
                     size_align (intmenu): min=0 max=2 default=0 value=0
               write_isp_format (bool)   : default=0 value=0
       sensor_signal_properties (u32)    : min=0 max=0 step=0 default=0 flags=read-only, has-payload
        sensor_image_properties (u32)    : min=0 max=0 step=0 default=0 flags=read-only, has-payload
      sensor_control_properties (u32)    : min=0 max=0 step=0 default=0 flags=read-only, has-payload
              sensor_dv_timings (u32)    : min=0 max=0 step=0 default=0 flags=read-only, has-payload
                   sensor_modes (int)    : min=0 max=30 step=1 default=30 value=1 flags=read-only

Probably it could be important I’ve got such errors:

[  538.495056] vi 54080000.vi: tegra_channel_error_status:error 4000 frame 5

which is HPA_UNC_HDR_ERR in CSI_CSI_PIXEL_PARSER_A_STATUS_0 register.
But why most of pixels are received correctly?

The issue has been fixed - there was wrong HW connection one of lanes.

Would you mind sharing what changes you had to make to add 14 bit greyscale support? I have made all of the changes I think that are necessary, but we are still seeing odd behavior.