Support for grayscale sensors is missing

I try to use a grayscale sensor with l4t 28.2.1, but I came to the conclusion that this is not supported :

In drivers/media/platform/tegra/camera/sensor_common.c, extract_pixel_format seems to support only bayer pixel types.
In drivers/media/platform/tegra/camera/vi/vi4_format.h static const struct tegra_video_format vi4_video_formats seems to support only bayer pixel types.

I’d need 8-bits, 10-bits and 12-bits grayscale support.
Is a patch available ?

I then added the following entry to ‘static const struct tegra_video_format vi4_video_formats’ in drivers/media/platform/tegra/camera/vi/vi4_formats.h

static const struct tegra_video_format vi4_video_formats = {
/* RAW 6: TODO */

/* RAW 7: TODO */
TEGRA_VIDEO_FORMAT(RAW8, 8, Y8_1X8, 1, 1, T_L8,
            RAW8, GREY, "GRAY8"),

TEGRA_VIDEO_FORMAT(RAW10, 10, Y10_1X10, 2, 1, T_R16_I,
            RAW10, Y10, "GRAY10"),

/* RAW 8 */
TEGRA_VIDEO_FORMAT(RAW8, 8, SRGGB8_1X8, 1, 1, T_L8,
			RAW8, SRGGB8, "RGRG.. GBGB.."),
TEGRA_VIDEO_FORMAT(RAW8, 8, SGRBG8_1X8, 1, 1, T_L8,
			RAW8, SGRBG8, "GRGR.. BGBG.."),
TEGRA_VIDEO_FORMAT(RAW8, 8, SGBRG8_1X8, 1, 1, T_L8,
			RAW8, SGBRG8, "GBGB.. RGRG.."),
TEGRA_VIDEO_FORMAT(RAW8, 8, SBGGR8_1X8, 1, 1, T_L8,
			RAW8, SBGGR8, "BGBG.. GRGR.."),

}

and New media bus format(s) in camera_common.c:
static const struct camera_common_colorfmt camera_common_color_fmts = {
{
MEDIA_BUS_FMT_Y8_1X8, // Gray 8-bit
V4L2_COLORSPACE_RAW,
V4L2_PIX_FMT_GREY,
},
{
MEDIA_BUS_FMT_Y10_1X10, // Gray 10-bit
V4L2_COLORSPACE_RAW,
V4L2_PIX_FMT_Y10,
},

/*
 * The below two formats are not supported by VI4,
 * keep them at the last to ensure they get discarded
 */
{
	MEDIA_BUS_FMT_XRGGB10P_3X10,
	V4L2_COLORSPACE_SRGB,
	V4L2_PIX_FMT_XRGGB10P,
},

};
last New device-tree pixel formats in sensor_common.c:
static int extract_pixel_format(
const char *pixel_t, u32 *format)
{
else if (strncmp(pixel_t, “bayer_xrggb10p”, size) == 0)
*format = V4L2_PIX_FMT_XRGGB10P;
else if (strncmp(pixel_t, “raw_uyvy”, size) == 0)//shchoi add
*format = V4L2_PIX_FMT_UYVY;
else if (strncmp(pixel_t, “gray”, size) == 0)
*format = V4L2_PIX_FMT_GREY;
else if (strncmp(pixel_t, “y10”, size) == 0)
*format = V4L2_PIX_FMT_Y10;
}

and kernel build and flashing after booting

$ $ v4l2-ctl -d /dev/video0 --list-formats

run and ioctl: VIDIOC_ENUM_FMT is not GREY format.

why???

hello scs2.dxavier,

yap, we did not support grayscale sensors by default.
you should have some implementation to extend support formats, then you’re able to launch it with v4l2src for testing.
we had some progress to bring-up grayscale sensor, please access Topic 1036708 for reference.
thanks