Commit 642ac63d authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab
Browse files

media: drivers/staging/media: don't set description for ENUM_FMT



The V4L2 core sets the format description and flags for the driver in order
to ensure consistent naming.

So drop the strscpy of the description in drivers. Also remove any
description strings in driver-internal structures since those are
no longer needed.

Note that bcm2835-camera.c: the formats array still stores the flags
field for compressed formats since that information is used elsewhere
in the driver. But enum_fmt doesn't use it anymore, since the core
will set the COMPRESSED flag correctly.

Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Reviewed-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
parent 2169e6da
Loading
Loading
Loading
Loading
+19 −21
Original line number Diff line number Diff line
@@ -31,61 +31,61 @@
static struct iss_format_info formats[] = {
	{ MEDIA_BUS_FMT_Y8_1X8, MEDIA_BUS_FMT_Y8_1X8,
	  MEDIA_BUS_FMT_Y8_1X8, MEDIA_BUS_FMT_Y8_1X8,
	  V4L2_PIX_FMT_GREY, 8, "Greyscale 8 bpp", },
	  V4L2_PIX_FMT_GREY, 8, },
	{ MEDIA_BUS_FMT_Y10_1X10, MEDIA_BUS_FMT_Y10_1X10,
	  MEDIA_BUS_FMT_Y10_1X10, MEDIA_BUS_FMT_Y8_1X8,
	  V4L2_PIX_FMT_Y10, 10, "Greyscale 10 bpp", },
	  V4L2_PIX_FMT_Y10, 10, },
	{ MEDIA_BUS_FMT_Y12_1X12, MEDIA_BUS_FMT_Y10_1X10,
	  MEDIA_BUS_FMT_Y12_1X12, MEDIA_BUS_FMT_Y8_1X8,
	  V4L2_PIX_FMT_Y12, 12, "Greyscale 12 bpp", },
	  V4L2_PIX_FMT_Y12, 12, },
	{ MEDIA_BUS_FMT_SBGGR8_1X8, MEDIA_BUS_FMT_SBGGR8_1X8,
	  MEDIA_BUS_FMT_SBGGR8_1X8, MEDIA_BUS_FMT_SBGGR8_1X8,
	  V4L2_P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GBRG10_1X10, MEDIA_BUS_FMT_SGBRG8_1X8,
	  V4L2_PIX_FMT_SGBRG10, 10, "GBRG Bayer 10 bpp", },
	  V4L2_PIX_FMT_SGBRG10, 10, },
	{ MEDIA_BUS_FMT_SGRBG10_1X10, MEDIA_BUS_FMT_SGRBG10_1X10,
	  MEDIA_BUS_FMT_SGRBG10_1X10, MEDIA_BUS_FMT_SGRBG8_1X8,
	  V4L2_PIX_FMT_SGRBG10, 10, "GRBG Bayer 10 bpp", },
	  V4L2_PIX_FMT_SGRBG10, 10, },
	{ MEDIA_BUS_FMT_SRGGB10_1X10, MEDIA_BUS_FMT_SRGGB10_1X10,
	  MEDIA_BUS_FMT_SRGGB10_1X10, MEDIA_BUS_FMT_SRGGB8_1X8,
	  V4L2_PIX_FMT_SRGGB10, 10, "RGGB Bayer 10 bpp", },
	  V4L2_PIX_FMT_SRGGB10, 10, },
	{ MEDIA_BUS_FMT_SBGGR12_1X12, MEDIA_BUS_FMT_SBGGR10_1X10,
	  MEDIA_BUS_FMT_SBGGR12_1X12, MEDIA_BUS_FMT_SBGGR8_1X8,
	  V4L2_PIX_FMT_SBGGR12, 12, "BGGR Bayer 12 bpp", },
	  V4L2_PIX_FMT_SBGGR12, 12, },
	{ MEDIA_BUS_FMT_SGBRG12_1X12, MEDIA_BUS_FMT_SGBRG10_1X10,
	  MEDIA_BUS_FMT_SGBRG12_1X12, MEDIA_BUS_FMT_SGBRG8_1X8,
	  V4L2_PIX_FMT_SGBRG12, 12, "GBRG Bayer 12 bpp", },
	  V4L2_PIX_FMT_SGBRG12, 12, },
	{ MEDIA_BUS_FMT_SGRBG12_1X12, MEDIA_BUS_FMT_SGRBG10_1X10,
	  MEDIA_BUS_FMT_SGRBG12_1X12, MEDIA_BUS_FMT_SGRBG8_1X8,
	  V4L2_PIX_FMT_SGRBG12, 12, "GRBG Bayer 12 bpp", },
	  V4L2_PIX_FMT_SGRBG12, 12, },
	{ MEDIA_BUS_FMT_SRGGB12_1X12, MEDIA_BUS_FMT_SRGGB10_1X10,
	  MEDIA_BUS_FMT_SRGGB12_1X12, MEDIA_BUS_FMT_SRGGB8_1X8,
	  V4L2_PIX_FMT_SRGGB12, 12, "RGGB Bayer 12 bpp", },
	  V4L2_PIX_FMT_SRGGB12, 12, },
	{ MEDIA_BUS_FMT_UYVY8_1X16, MEDIA_BUS_FMT_UYVY8_1X16,
	  MEDIA_BUS_FMT_UYVY8_1X16, 0,
	  V4L2_PIX_FMT_UYVY, 16, "YUV 4:2:2 (UYVY)", },
	  V4L2_PIX_FMT_UYVY, 16, },
	{ MEDIA_BUS_FMT_YUYV8_1X16, MEDIA_BUS_FMT_YUYV8_1X16,
	  MEDIA_BUS_FMT_YUYV8_1X16, 0,
	  V4L2_PIX_FMT_YUYV, 16, "YUV 4:2:2 (YUYV)", },
	  V4L2_PIX_FMT_YUYV, 16, },
	{ MEDIA_BUS_FMT_YUYV8_1_5X8, MEDIA_BUS_FMT_YUYV8_1_5X8,
	  MEDIA_BUS_FMT_YUYV8_1_5X8, 0,
	  V4L2_PIX_FMT_NV12, 8, "YUV 4:2:0 (NV12)", },
	  V4L2_PIX_FMT_NV12, 8, },
};

const struct iss_format_info *
@@ -563,8 +563,6 @@ iss_video_enum_format(struct file *file, void *fh, struct v4l2_fmtdesc *f)

		if (index == 0) {
			f->pixelformat = info->pixelformat;
			strscpy(f->description, info->description,
				sizeof(f->description));
			return 0;
		}

+0 −2
Original line number Diff line number Diff line
@@ -36,7 +36,6 @@ struct v4l2_pix_format;
 *	shifted to be 8 bits per pixel. =0 if format is not shiftable.
 * @pixelformat: V4L2 pixel format FCC identifier
 * @bpp: Bits per pixel
 * @description: Human-readable format description
 */
struct iss_format_info {
	u32 code;
@@ -45,7 +44,6 @@ struct iss_format_info {
	u32 flavor;
	u32 pixelformat;
	unsigned int bpp;
	const char *description;
};

enum iss_pipeline_stream_state {
+0 −2
Original line number Diff line number Diff line
@@ -869,8 +869,6 @@ static int soc_camera_enum_fmt_vid_cap(struct file *file, void *priv,

	format = icd->user_formats[f->index].host_fmt;

	if (format->name)
		strscpy(f->description, format->name, sizeof(f->description));
	f->pixelformat = format->fourcc;
	return 0;
}
+0 −29
Original line number Diff line number Diff line
@@ -75,34 +75,27 @@ static const struct v4l2_fract
/* video formats */
static struct mmal_fmt formats[] = {
	{
		.name = "4:2:0, planar, YUV",
		.fourcc = V4L2_PIX_FMT_YUV420,
		.flags = 0,
		.mmal = MMAL_ENCODING_I420,
		.depth = 12,
		.mmal_component = COMP_CAMERA,
		.ybbp = 1,
		.remove_padding = 1,
	}, {
		.name = "4:2:2, packed, YUYV",
		.fourcc = V4L2_PIX_FMT_YUYV,
		.flags = 0,
		.mmal = MMAL_ENCODING_YUYV,
		.depth = 16,
		.mmal_component = COMP_CAMERA,
		.ybbp = 2,
		.remove_padding = 0,
	}, {
		.name = "RGB24 (LE)",
		.fourcc = V4L2_PIX_FMT_RGB24,
		.flags = 0,
		.mmal = MMAL_ENCODING_RGB24,
		.depth = 24,
		.mmal_component = COMP_CAMERA,
		.ybbp = 3,
		.remove_padding = 0,
	}, {
		.name = "JPEG",
		.fourcc = V4L2_PIX_FMT_JPEG,
		.flags = V4L2_FMT_FLAG_COMPRESSED,
		.mmal = MMAL_ENCODING_JPEG,
@@ -111,7 +104,6 @@ static struct mmal_fmt formats[] = {
		.ybbp = 0,
		.remove_padding = 0,
	}, {
		.name = "H264",
		.fourcc = V4L2_PIX_FMT_H264,
		.flags = V4L2_FMT_FLAG_COMPRESSED,
		.mmal = MMAL_ENCODING_H264,
@@ -120,7 +112,6 @@ static struct mmal_fmt formats[] = {
		.ybbp = 0,
		.remove_padding = 0,
	}, {
		.name = "MJPEG",
		.fourcc = V4L2_PIX_FMT_MJPEG,
		.flags = V4L2_FMT_FLAG_COMPRESSED,
		.mmal = MMAL_ENCODING_MJPEG,
@@ -129,72 +120,56 @@ static struct mmal_fmt formats[] = {
		.ybbp = 0,
		.remove_padding = 0,
	}, {
		.name = "4:2:2, packed, YVYU",
		.fourcc = V4L2_PIX_FMT_YVYU,
		.flags = 0,
		.mmal = MMAL_ENCODING_YVYU,
		.depth = 16,
		.mmal_component = COMP_CAMERA,
		.ybbp = 2,
		.remove_padding = 0,
	}, {
		.name = "4:2:2, packed, VYUY",
		.fourcc = V4L2_PIX_FMT_VYUY,
		.flags = 0,
		.mmal = MMAL_ENCODING_VYUY,
		.depth = 16,
		.mmal_component = COMP_CAMERA,
		.ybbp = 2,
		.remove_padding = 0,
	}, {
		.name = "4:2:2, packed, UYVY",
		.fourcc = V4L2_PIX_FMT_UYVY,
		.flags = 0,
		.mmal = MMAL_ENCODING_UYVY,
		.depth = 16,
		.mmal_component = COMP_CAMERA,
		.ybbp = 2,
		.remove_padding = 0,
	}, {
		.name = "4:2:0, planar, NV12",
		.fourcc = V4L2_PIX_FMT_NV12,
		.flags = 0,
		.mmal = MMAL_ENCODING_NV12,
		.depth = 12,
		.mmal_component = COMP_CAMERA,
		.ybbp = 1,
		.remove_padding = 1,
	}, {
		.name = "RGB24 (BE)",
		.fourcc = V4L2_PIX_FMT_BGR24,
		.flags = 0,
		.mmal = MMAL_ENCODING_BGR24,
		.depth = 24,
		.mmal_component = COMP_CAMERA,
		.ybbp = 3,
		.remove_padding = 0,
	}, {
		.name = "4:2:0, planar, YVU",
		.fourcc = V4L2_PIX_FMT_YVU420,
		.flags = 0,
		.mmal = MMAL_ENCODING_YV12,
		.depth = 12,
		.mmal_component = COMP_CAMERA,
		.ybbp = 1,
		.remove_padding = 1,
	}, {
		.name = "4:2:0, planar, NV21",
		.fourcc = V4L2_PIX_FMT_NV21,
		.flags = 0,
		.mmal = MMAL_ENCODING_NV21,
		.depth = 12,
		.mmal_component = COMP_CAMERA,
		.ybbp = 1,
		.remove_padding = 1,
	}, {
		.name = "RGB32 (BE)",
		.fourcc = V4L2_PIX_FMT_BGR32,
		.flags = 0,
		.mmal = MMAL_ENCODING_BGRA,
		.depth = 32,
		.mmal_component = COMP_CAMERA,
@@ -716,9 +691,7 @@ static int vidioc_enum_fmt_vid_overlay(struct file *file, void *priv,

	fmt = &formats[f->index];

	strlcpy((char *)f->description, fmt->name, sizeof(f->description));
	f->pixelformat = fmt->fourcc;
	f->flags = fmt->flags;

	return 0;
}
@@ -919,9 +892,7 @@ static int vidioc_enum_fmt_vid_cap(struct file *file, void *priv,

	fmt = &formats[f->index];

	strlcpy((char *)f->description, fmt->name, sizeof(f->description));
	f->pixelformat = fmt->fourcc;
	f->flags = fmt->flags;

	return 0;
}
+0 −1
Original line number Diff line number Diff line
@@ -26,7 +26,6 @@ struct mmal_msg_context;

/* mapping between v4l and mmal video modes */
struct mmal_fmt {
	char  *name;
	u32   fourcc;          /* v4l2 format id */
	int   flags;           /* v4l2 flags field */
	u32   mmal;
Loading