Raw Bayer GRBG 12-bit Image Data from CSI-2

I am trying to get the raw bayer grbg 12-bit data from my image sensor from the CSI-2 interface. I run the following command to capture the data to a file:
v4l2-ctl --set-fmt-video=width=1920,height=1080,pixelformat=BA12 --set-ctrl bypass_mode=0 --stream-mmap --stream-count=1 --stream-to=output.raw -d /dev/video0

My image sensor can generate several test patterns. These patterns look okay when viewed with the argus_camera application going through the ISP. However, looking at the raw data output from the above v4l2-ctl command I see places in the raw data where there are 14-bits of data set and not just 12-bits. Why am I not seeing only 12-bits of least significant data for every 2-byte word from the v4l2-ctl command output above?

Does this post from Display bayer CSI camera output without ISP have to do with the issue I’m seeing?

Is there a way to have the raw 12-bit data only use 12-bits instead of 14-bit output?

The link you posted to is indeed why are seeing 14 bit data. If you shift each pixel to the right by 2 bits it will be in the 12 bit format that you’d expect. I don’t know of any easy way to turn this behavior off. I’d be interested to know if there is a way.

modified to add: I like the new features of the forum. Because you linked to something I posted I received an email notification immediately. That’s pretty cool!

I found this picture in the TRM (Figure 198, section 27.10.6 RAW Memory Formats):

It would make more sense to me if all of the RAW formats were shifted to have the valid data put in the MSBit. Why 14-bits? Why the “implied decimal point”?

This layout is design to feed to ISP for more effection.