configuration about raw12 at device-tree

Hello:
I know how to configure raw8 at device-tree,but not sure about raw12,can anyone check it for me? thanks.
we have 4 cameras. each camera use 2 lanes. the CSI2 Speed is 375Mbps/lane . Hs Byte clock is 46.875 Mhz.

ar0134_a@10 {
     				compatible = "nvidia,ar0134a";
				reg = <0x10>;
				devnode = "video0";
				physical_w = "10.0";
				physical_h = "10.0";
				sensor_model ="ar0134a";
				post_crop_frame_drop = "0";
				use_decibel_gain = "false";
				delayed_gain = "false";
				use_sensor_mode_id = "true";

				mode0 {/*mode AR0134_MODE_1280X800_CROP_48FPS*/
					mclk_khz = "24000";
					num_lanes = "2";
					tegra_sinterface = "serial_a";
					discontinuous_clk = "no";
					dpcm_enable = "false";
					cil_settletime = "0";
					dynamic_pixel_bit_depth = "12";
					csi_pixel_bit_depth = "12";
                                        pixel_t="yuv_y12";
					mode_type = "yuv";
					pixel_phase = "y";
					active_w = "1280";
					active_h = "800";
					readout_orientation = "0";
					line_length = "1920";
					inherent_gain = "1";
					mclk_multiplier = "1.954";
					pix_clk_hz = "46875000";

					min_gain_val = "1"; /* dB */
					max_gain_val = "16"; /* dB */
					min_hdr_ratio = "1";
					max_hdr_ratio = "64";
					min_framerate = "1.816577";
					max_framerate = "54";
					min_exp_time = "34";
					max_exp_time = "550385";
					embedded_metadata_height = "0";
				};
                             };

	tegra-camera-platform {
		compatible = "nvidia, tegra-camera-platform";	
		num_csi_lanes = <8>;
		max_lane_speed = <1500000>;
		min_bits_per_pixel = <12>;
		<b>vi_peak_byte_per_pixel</b> = <2>;
		vi_bw_margin_pct = <25>;
		<b>isp_peak_byte_per_pixel</b> = <5>;
		isp_bw_margin_pct = <25>;
               }

Looks like your sensor is YUV type. You can ignore this configure in DT.
Please search for the YUV sensor topics for reference.

my sensor is ar0134,we use the monochrome mode,the output is gray(12bits).

I just not sure about vi_peak_byte_per_pixel and isp_peak_byte_per_pixl ,from the mipi alliance specifition for csi2(page 93), if the format is raw12, 2 pixels will translate with 3 byte.

They are used to calculate the bandwidth you can set it as 3 or more than 3.

can’t get the image use the v4l2-ctl.
commond:

v4l2-ctl --set-fmt-video=width=1280,height=800,pixelformat='Y12'  --stream-mmap --stream-count=10 -d /dev/video0 --stream-to=csi_dump.raw  --verbose

the output:

VIDIOC_QUERYCAP: ok
VIDIOC_G_FMT: ok
VIDIOC_S_FMT: ok
Format Video Capture:
	Width/Height      : 1280/800
	Pixel Format      : 'Y12 '
	Field             : None
	Bytes per Line    : 2560
	Size Image        : 2048000
	Colorspace        : Raw
	Transfer Function : Default (maps to None)
	YCbCr/HSV Encoding: Default (maps to ITU-R 601)
	Quantization      : Default (maps to Full Range)
	Flags             : 
VIDIOC_REQBUFS: ok
VIDIOC_QUERYBUF: ok
VIDIOC_QBUF: ok
VIDIOC_QUERYBUF: ok
VIDIOC_QBUF: ok
VIDIOC_QUERYBUF: ok
VIDIOC_QBUF: ok
VIDIOC_QUERYBUF: ok
VIDIOC_QBUF: ok
VIDIOC_STREAMON: ok
	Index    : 0
	Type     : Video Capture
	Flags    : mapped, done, error
	Field    : None
	Sequence : 0
	Length   : 2048000
	Bytesused: 2048000
	Timestamp: 0.000000s (Monotonic, End-of-Frame)

VIDIOC_DQBUF: failed: Input/output error
VIDIOC_STREAMOFF: ok

dmesg:

[   61.362853] tegra-vi4 15700000.vi: Status:  4 channel:00 frame:0000
[   61.369126] tegra-vi4 15700000.vi:          timestamp sof 80295901184 eof 80295921504 data 0x00000100
[   61.378350] tegra-vi4 15700000.vi:          capture_id 11 stream  0 vchan  0
[   62.360816] tegra-vi4 15700000.vi: PXL_SOF syncpt timeout! err = -11
[   63.364822] tegra-vi4 15700000.vi: ATOMP_FE syncpt timeout!

trace:

# tracer: nop
#
# entries-in-buffer/entries-written: 22/22   #P:4
#
#                              _-----=> irqs-off
#                             / _----=> need-resched
#                            | / _---=> hardirq/softirq
#                            || / _--=> preempt-depth
#                            ||| /     delay
#           TASK-PID   CPU#  ||||    TIMESTAMP  FUNCTION
#              | |       |   ||||       |         |
     kworker/3:3-1443  [003] ...1    61.380802: rtos_queue_peek_from_isr_failed: tstamp:2509047823 queue:0x0b4a3c58
     kworker/3:3-1443  [003] ...1    61.380806: rtcpu_start: tstamp:2509048572
     kworker/3:3-1443  [003] ...1    61.380808: rtcpu_vinotify_handle_msg: tstamp:2509074346 tag:CSIMUX_STREAM channel:0xff frame:0 vi_tstamp:2509073929 data:0x00000001
     kworker/3:3-1443  [003] ...1    61.380808: rtcpu_vinotify_handle_msg: tstamp:2509247469 tag:CHANSEL_PXL_SOF channel:0x00 frame:0 vi_tstamp:2509246912 data:0x00000001
     kworker/3:3-1443  [003] ...1    61.380809: rtcpu_vinotify_handle_msg: tstamp:2509247833 tag:ATOMP_FS channel:0x00 frame:0 vi_tstamp:2509246926 data:0x00000000
     kworker/3:3-1443  [003] ...1    61.380810: rtcpu_vinotify_handle_msg: tstamp:2509247943 tag:CHANSEL_FAULT channel:0x00 frame:0 vi_tstamp:2509247547 data:0x00000100
     kworker/3:3-1443  [003] ...1    61.380810: rtcpu_vinotify_handle_msg: tstamp:2509248810 tag:CHANSEL_LOAD_FRAMED channel:0x01 frame:0 vi_tstamp:2509248073 data:0x08000000
     kworker/3:3-1443  [003] ...1    61.380811: rtcpu_vinotify_handle_msg: tstamp:2509248908 tag:CHANSEL_FAULT_FE channel:0x01 frame:0 vi_tstamp:2509248194 data:0x00000001
     kworker/3:3-1443  [003] ...1    61.380812: rtcpu_vinotify_handle_msg: tstamp:2509249038 tag:ATOMP_FE channel:0x00 frame:0 vi_tstamp:2509248197 data:0x00000000
     kworker/3:3-1443  [003] ...1    61.532831: rtos_queue_peek_from_isr_failed: tstamp:2514048701 queue:0x0b4a3c58
     kworker/3:3-1443  [003] ...1    61.688795: rtos_queue_peek_from_isr_failed: tstamp:2519049208 queue:0x0b4a3c58
     kworker/3:3-1443  [003] ...1    61.844797: rtos_queue_peek_from_isr_failed: tstamp:2524049710 queue:0x0b4a3c58
     kworker/3:3-1443  [003] ...1    62.000793: rtos_queue_peek_from_isr_failed: tstamp:2529050220 queue:0x0b4a3c58
     kworker/3:3-1443  [003] ...1    62.156794: rtos_queue_peek_from_isr_failed: tstamp:2534050725 queue:0x0b4a3c58
     kworker/3:3-1443  [003] ...1    62.364797: rtos_queue_peek_from_isr_failed: tstamp:2539051233 queue:0x0b4a3c58
     kworker/3:3-1443  [003] ...1    62.520804: rtos_queue_peek_from_isr_failed: tstamp:2544051738 queue:0x0b4a3c58
     kworker/3:3-1443  [003] ...1    62.676795: rtos_queue_peek_from_isr_failed: tstamp:2549052249 queue:0x0b4a3c58
     kworker/3:3-1443  [003] ...1    62.832796: rtos_queue_peek_from_isr_failed: tstamp:2554052751 queue:0x0b4a3c58
     kworker/3:3-1443  [003] ...1    62.988796: rtos_queue_peek_from_isr_failed: tstamp:2559053259 queue:0x0b4a3c58
     kworker/3:3-1443  [003] ...1    63.144794: rtos_queue_peek_from_isr_failed: tstamp:2564053764 queue:0x0b4a3c58
     kworker/3:3-1443  [003] ...1    63.300793: rtos_queue_peek_from_isr_failed: tstamp:2569054272 queue:0x0b4a3c58
     kworker/3:3-1443  [003] ...1    63.404798: rtos_queue_peek_from_isr_failed: tstamp:2571989712 queue:0x0b4a3c58

but one time the output is (and just one time):

VIDIOC_QUERYCAP: ok
VIDIOC_G_FMT: ok
VIDIOC_S_FMT: ok
Format Video Capture:
	Width/Height      : 1280/800
	Pixel Format      : 'Y12 '
	Field             : None
	Bytes per Line    : 2560
	Size Image        : 2048000
	Colorspace        : Raw
	Transfer Function : Default (maps to None)
	YCbCr/HSV Encoding: Default (maps to ITU-R 601)
	Quantization      : Default (maps to Full Range)
	Flags             : 
VIDIOC_REQBUFS: ok
VIDIOC_QUERYBUF: ok
VIDIOC_QBUF: ok
VIDIOC_QUERYBUF: ok
VIDIOC_QBUF: ok
VIDIOC_QUERYBUF: ok
VIDIOC_QBUF: ok
VIDIOC_QUERYBUF: ok
VIDIOC_QBUF: ok
VIDIOC_STREAMON: ok
	Index    : 0
	Type     : Video Capture
	Flags    : mapped, done, error
	Field    : None
	Sequence : 0
	Length   : 2048000
	Bytesused: 2048000
	Timestamp: 0.000000s (Monotonic, End-of-Frame)

	Index    : 1
	Type     : Video Capture
	Flags    : mapped, done, error
	Field    : None
	Sequence : 1
	Length   : 2048000
	Bytesused: 2048000
	Timestamp: 0.000000s (Monotonic, End-of-Frame)

	Index    : 2
	Type     : Video Capture
	Flags    : mapped, done
	Field    : None
	Sequence : 2
	Length   : 2048000
	Bytesused: 2048000
	Timestamp: 0.000000s (Monotonic, End-of-Frame)

VIDIOC_STREAMOFF: ok

my dts is:

ar0134_a@10 {
         				compatible = "nvidia,ar0134a";
    				reg = <0x10>;
    				devnode = "video0";
    				physical_w = "10.0";
    				physical_h = "10.0";
    				sensor_model ="ar0134a";
    				post_crop_frame_drop = "0";
    				use_decibel_gain = "false";
    				delayed_gain = "false";
    				use_sensor_mode_id = "true";

    				mode0 {/*mode AR0134_MODE_1280X800_CROP_48FPS*/
    					mclk_khz = "24000";
    					num_lanes = "2";
    					tegra_sinterface = "serial_a";
    					discontinuous_clk = "no";
    					dpcm_enable = "false";
    					cil_settletime = "0";
    					dynamic_pixel_bit_depth = "12";
    					csi_pixel_bit_depth = "12";
                                            pixel_t="yuv_y12";
    					mode_type = "yuv";
    					pixel_phase = "y";
    					active_w = "1280";
    					active_h = "800";
    					readout_orientation = "0";
    					line_length = "1280";
    					inherent_gain = "1";
    					mclk_multiplier = "1.954";
    					pix_clk_hz = "46875000";

    					min_gain_val = "1"; /* dB */
    					max_gain_val = "16"; /* dB */
    					min_hdr_ratio = "1";
    					max_hdr_ratio = "64";
    					min_framerate = "1.816577";
    					max_framerate = "54";
    					min_exp_time = "34";
    					max_exp_time = "550385";
    					embedded_metadata_height = "0";
    				};
                                 };

    	tegra-camera-platform {
    		compatible = "nvidia, tegra-camera-platform";	
    		num_csi_lanes = <8>;
    		max_lane_speed = <1500000>;
    		min_bits_per_pixel = <12>;
    		vi_peak_byte_per_pixel = <3>;
    		vi_bw_margin_pct = <25>;
    		isp_peak_byte_per_pixel = <3>;
    		isp_bw_margin_pct = <25>;
                   }
I have faced the problem many weeks.
I mean the "PXL_SOF syncpt timeout! err = -11 ,  status 4".  dqbuf failed.

our data process is  ar0134--->tc358748a--->tx2.I extended the tx2's code about raw8 and raw12. 

the tc358748a has two mode: debug mode and work(normal) mode.

I let tc358748a enter debug mode to output raw8 data (1280*800),I can get the picture successfully from v4l2 interface.but when the tc358748a enter work mode,I just can get 768*800,if the width bigger than 768,I will faced the "status 4, dqbuf failed".
It seems my configuration & extended about raw8 are all right,because I can get the tc358748a's debug mode output(1280*800),but toshiba(tc358748a)'s FAE let me change the csi configuration of tx2's.so I have this question:

[url]https://devtalk.nvidia.com/default/topic/1039416/change-mipi-csi-2s-configuration/?offset=1#5281198[/url]

why we use raw8,because raw8 more simple than raw12.our goal is raw12.

The trace show the short line. That could be the data type is incorrect or the output width is less as expect.
Did you modify the VI/CSI driver to support this sensor’s output pixel format?

If the debug mode can work for you there’s no any thing can do on Tegra side.
You need to have Toshiba work with sensor vendor to figure it out.

I think so,so I reading the mipi alliance specification now.

can anyone tell me where is the code about mipi csi’d-phy ? I want to insert some printk to debug the tx358748xbg.

the ways we can used to debug are limited. we have no mipi analyzer,and the frequency of our oscilloscope is just 100Mhz.

from the oscilloscope,It seems that the tx358748xbg has translate the correct 1280 byte data successfully.