Hello JerryChang,
as my sensor is a pure grayscale sensor, I managed to tell that to the kernel to get
s_data->sensor_props->sensor_modes[0].image_properties.pixel_format = V4L2_PIX_FMT_Y12;
This is modeled after what extract_pixel_format does for other sensor formats
after that, my kernel simply crashes :
[ 4.138854] Unable to handle kernel NULL pointer dereference at virtual address 00000010
...
[ 4.138934] PC is at tegra_channel_update_format+0x14/0xa0
[ 4.138944] LR is at tegra_channel_s_ctrl+0x19c/0x230
I then added the following entry to ‘static const struct tegra_video_format vi2_video_formats’ in drivers/media/platform/tegra/camera/vi/vi2_formats.h :
TEGRA_VIDEO_FORMAT(RAW12, 12, Y12_1X12, 2, 1, T_R16_I,
RAW12, Y12, "GRAY12"),
With that, I can start linux and list formats :
nvidia@tegra-ubuntu:~$ v4l2-ctl --list-formats
ioctl: VIDIOC_ENUM_FMT
Index : 0
Type : Video Capture
Pixel Format: 'Y12 '
Name : 12-bit Greyscale
nvidia@tegra-ubuntu:~$
I can also run the command from comment #4, with either RG12 or Y12 as format; that gives me per frame a size of 1920x1080x2 (2 bytes per pixel), but this is clearly not the raw output from my sensor as I can recognize a repeated pattern in the images, which is not in the observed scene.
v4l2src is unusable for Y12; it accepts only GRAY8, GRAY16_BE and GRAY16_LE, so I added other entries to static const struct tegra_video_format vi2_video_formats :
TEGRA_VIDEO_FORMAT(RAW12, 12, Y12_1X12, 1, 1, T_L8,
RAW12, GREY, "GRAY8"),
TEGRA_VIDEO_FORMAT(RAW12, 12, Y12_1X12, 2, 1, T_R16_I,
RAW12, Y16, "GRAY16"),
I now have
nvidia@tegra-ubuntu:~$ v4l2-ctl --list-formats
ioctl: VIDIOC_ENUM_FMT
Index : 0
Type : Video Capture
Pixel Format: 'GREY'
Name : 8-bit Greyscale
Index : 1
Type : Video Capture
Pixel Format: 'Y16 '
Name : 16-bit Greyscale
nvidia@tegra-ubuntu:~$
That makes v4l2src happy, but the images I get with either v4l2-ctl or a ‘gst-launch-1.0 v4l2src’ pipeline are still garbled.