Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

[media] v4l2: replace s_mbus_fmt by set_fmt in bridge drivers



Replace all calls to s_mbus_fmt in bridge drivers by calls to the
set_fmt pad op.

Remove the old try/s_mbus_fmt video ops since they are now no longer used.

Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Cc: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Acked-by: default avatarPrabhakar Lad <prabhakar.csengg@gmail.com>
Acked-by: default avatarScott Jiang <scott.jiang.linux@gmail.com>
Cc: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent 5eab4983
Loading
Loading
Loading
Loading
+8 −5
Original line number Original line Diff line number Diff line
@@ -93,13 +93,16 @@ static int cx18_s_video_encoding(struct cx2341x_handler *cxhdl, u32 val)
{
{
	struct cx18 *cx = container_of(cxhdl, struct cx18, cxhdl);
	struct cx18 *cx = container_of(cxhdl, struct cx18, cxhdl);
	int is_mpeg1 = val == V4L2_MPEG_VIDEO_ENCODING_MPEG_1;
	int is_mpeg1 = val == V4L2_MPEG_VIDEO_ENCODING_MPEG_1;
	struct v4l2_mbus_framefmt fmt;
	struct v4l2_subdev_format format = {
		.which = V4L2_SUBDEV_FORMAT_ACTIVE,
	};
	struct v4l2_mbus_framefmt *fmt = &format.format;


	/* fix videodecoder resolution */
	/* fix videodecoder resolution */
	fmt.width = cxhdl->width / (is_mpeg1 ? 2 : 1);
	fmt->width = cxhdl->width / (is_mpeg1 ? 2 : 1);
	fmt.height = cxhdl->height;
	fmt->height = cxhdl->height;
	fmt.code = MEDIA_BUS_FMT_FIXED;
	fmt->code = MEDIA_BUS_FMT_FIXED;
	v4l2_subdev_call(cx->sd_av, video, s_mbus_fmt, &fmt);
	v4l2_subdev_call(cx->sd_av, pad, set_fmt, NULL, &format);
	return 0;
	return 0;
}
}


+7 −5
Original line number Original line Diff line number Diff line
@@ -267,7 +267,9 @@ static int cx18_s_fmt_vid_cap(struct file *file, void *fh,
{
{
	struct cx18_open_id *id = fh2id(fh);
	struct cx18_open_id *id = fh2id(fh);
	struct cx18 *cx = id->cx;
	struct cx18 *cx = id->cx;
	struct v4l2_mbus_framefmt mbus_fmt;
	struct v4l2_subdev_format format = {
		.which = V4L2_SUBDEV_FORMAT_ACTIVE,
	};
	struct cx18_stream *s = &cx->streams[id->type];
	struct cx18_stream *s = &cx->streams[id->type];
	int ret;
	int ret;
	int w, h;
	int w, h;
@@ -296,10 +298,10 @@ static int cx18_s_fmt_vid_cap(struct file *file, void *fh,
		s->vb_bytes_per_line = 1440; /* Packed */
		s->vb_bytes_per_line = 1440; /* Packed */
	}
	}


	mbus_fmt.width = cx->cxhdl.width = w;
	format.format.width = cx->cxhdl.width = w;
	mbus_fmt.height = cx->cxhdl.height = h;
	format.format.height = cx->cxhdl.height = h;
	mbus_fmt.code = MEDIA_BUS_FMT_FIXED;
	format.format.code = MEDIA_BUS_FMT_FIXED;
	v4l2_subdev_call(cx->sd_av, video, s_mbus_fmt, &mbus_fmt);
	v4l2_subdev_call(cx->sd_av, pad, set_fmt, NULL, &format);
	return cx18_g_fmt_vid_cap(file, fh, fmt);
	return cx18_g_fmt_vid_cap(file, fh, fmt);
}
}


+7 −5
Original line number Original line Diff line number Diff line
@@ -581,7 +581,9 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
	struct v4l2_format *f)
	struct v4l2_format *f)
{
{
	struct cx23885_dev *dev = video_drvdata(file);
	struct cx23885_dev *dev = video_drvdata(file);
	struct v4l2_mbus_framefmt mbus_fmt;
	struct v4l2_subdev_format format = {
		.which = V4L2_SUBDEV_FORMAT_ACTIVE,
	};
	int err;
	int err;


	dprintk(2, "%s()\n", __func__);
	dprintk(2, "%s()\n", __func__);
@@ -600,10 +602,10 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
	dev->field	= f->fmt.pix.field;
	dev->field	= f->fmt.pix.field;
	dprintk(2, "%s() width=%d height=%d field=%d\n", __func__,
	dprintk(2, "%s() width=%d height=%d field=%d\n", __func__,
		dev->width, dev->height, dev->field);
		dev->width, dev->height, dev->field);
	v4l2_fill_mbus_format(&mbus_fmt, &f->fmt.pix, MEDIA_BUS_FMT_FIXED);
	v4l2_fill_mbus_format(&format.format, &f->fmt.pix, MEDIA_BUS_FMT_FIXED);
	call_all(dev, video, s_mbus_fmt, &mbus_fmt);
	call_all(dev, pad, set_fmt, NULL, &format);
	v4l2_fill_pix_format(&f->fmt.pix, &mbus_fmt);
	v4l2_fill_pix_format(&f->fmt.pix, &format.format);
	/* s_mbus_fmt overwrites f->fmt.pix.field, restore it */
	/* set_fmt overwrites f->fmt.pix.field, restore it */
	f->fmt.pix.field = dev->field;
	f->fmt.pix.field = dev->field;
	return 0;
	return 0;
}
}
+7 −5
Original line number Original line Diff line number Diff line
@@ -64,13 +64,15 @@ static int ivtv_s_video_encoding(struct cx2341x_handler *cxhdl, u32 val)
{
{
	struct ivtv *itv = container_of(cxhdl, struct ivtv, cxhdl);
	struct ivtv *itv = container_of(cxhdl, struct ivtv, cxhdl);
	int is_mpeg1 = val == V4L2_MPEG_VIDEO_ENCODING_MPEG_1;
	int is_mpeg1 = val == V4L2_MPEG_VIDEO_ENCODING_MPEG_1;
	struct v4l2_mbus_framefmt fmt;
	struct v4l2_subdev_format format = {
		.which = V4L2_SUBDEV_FORMAT_ACTIVE,
	};


	/* fix videodecoder resolution */
	/* fix videodecoder resolution */
	fmt.width = cxhdl->width / (is_mpeg1 ? 2 : 1);
	format.format.width = cxhdl->width / (is_mpeg1 ? 2 : 1);
	fmt.height = cxhdl->height;
	format.format.height = cxhdl->height;
	fmt.code = MEDIA_BUS_FMT_FIXED;
	format.format.code = MEDIA_BUS_FMT_FIXED;
	v4l2_subdev_call(itv->sd_video, video, s_mbus_fmt, &fmt);
	v4l2_subdev_call(itv->sd_video, pad, set_fmt, NULL, &format);
	return 0;
	return 0;
}
}


+7 −5
Original line number Original line Diff line number Diff line
@@ -581,7 +581,9 @@ static int ivtv_s_fmt_vid_cap(struct file *file, void *fh, struct v4l2_format *f
{
{
	struct ivtv_open_id *id = fh2id(fh);
	struct ivtv_open_id *id = fh2id(fh);
	struct ivtv *itv = id->itv;
	struct ivtv *itv = id->itv;
	struct v4l2_mbus_framefmt mbus_fmt;
	struct v4l2_subdev_format format = {
		.which = V4L2_SUBDEV_FORMAT_ACTIVE,
	};
	int ret = ivtv_try_fmt_vid_cap(file, fh, fmt);
	int ret = ivtv_try_fmt_vid_cap(file, fh, fmt);
	int w = fmt->fmt.pix.width;
	int w = fmt->fmt.pix.width;
	int h = fmt->fmt.pix.height;
	int h = fmt->fmt.pix.height;
@@ -599,10 +601,10 @@ static int ivtv_s_fmt_vid_cap(struct file *file, void *fh, struct v4l2_format *f
	itv->cxhdl.height = h;
	itv->cxhdl.height = h;
	if (v4l2_ctrl_g_ctrl(itv->cxhdl.video_encoding) == V4L2_MPEG_VIDEO_ENCODING_MPEG_1)
	if (v4l2_ctrl_g_ctrl(itv->cxhdl.video_encoding) == V4L2_MPEG_VIDEO_ENCODING_MPEG_1)
		fmt->fmt.pix.width /= 2;
		fmt->fmt.pix.width /= 2;
	mbus_fmt.width = fmt->fmt.pix.width;
	format.format.width = fmt->fmt.pix.width;
	mbus_fmt.height = h;
	format.format.height = h;
	mbus_fmt.code = MEDIA_BUS_FMT_FIXED;
	format.format.code = MEDIA_BUS_FMT_FIXED;
	v4l2_subdev_call(itv->sd_video, video, s_mbus_fmt, &mbus_fmt);
	v4l2_subdev_call(itv->sd_video, pad, set_fmt, NULL, &format);
	return ivtv_g_fmt_vid_cap(file, fh, fmt);
	return ivtv_g_fmt_vid_cap(file, fh, fmt);
}
}


Loading