Commit 3c1b9ac7 authored by André Almeida's avatar André Almeida Committed by Mauro Carvalho Chehab
Browse files

media: vimc: Remove or modify stream checks



Change the way subdevices check if the stream is running. Verify the stream
pointer instead of src_frame. This makes easier to get rid of the void* and
u8* that points to frames in the subdevices structs.

Remove checks that s_stream does on subdevices. They are redundant since
the Media Controller Framework doesn't allow two streaming on the same
media pipeline at the same time.

Signed-off-by: default avatarAndré Almeida <andrealmeid@collabora.com>
Acked-by: default avatarHelen Koike <helen.koike@collabora.com>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
parent 84060c65
Loading
Loading
Loading
Loading
+1 −4
Original line number Original line Diff line number Diff line
@@ -270,7 +270,7 @@ static int vimc_deb_set_fmt(struct v4l2_subdev *sd,


	if (fmt->which == V4L2_SUBDEV_FORMAT_ACTIVE) {
	if (fmt->which == V4L2_SUBDEV_FORMAT_ACTIVE) {
		/* Do not change the format while stream is on */
		/* Do not change the format while stream is on */
		if (vdeb->src_frame)
		if (vdeb->ved.stream)
			return -EBUSY;
			return -EBUSY;


		sink_fmt = &vdeb->sink_fmt;
		sink_fmt = &vdeb->sink_fmt;
@@ -337,9 +337,6 @@ static int vimc_deb_s_stream(struct v4l2_subdev *sd, int enable)
		const struct v4l2_format_info *pix_info;
		const struct v4l2_format_info *pix_info;
		unsigned int frame_size;
		unsigned int frame_size;


		if (vdeb->src_frame)
			return 0;

		/* We only support translating bayer to RGB24 */
		/* We only support translating bayer to RGB24 */
		if (src_pixelformat != V4L2_PIX_FMT_RGB24) {
		if (src_pixelformat != V4L2_PIX_FMT_RGB24) {
			dev_err(vdeb->dev,
			dev_err(vdeb->dev,
+2 −5
Original line number Original line Diff line number Diff line
@@ -158,7 +158,7 @@ static int vimc_sca_set_fmt(struct v4l2_subdev *sd,


	if (fmt->which == V4L2_SUBDEV_FORMAT_ACTIVE) {
	if (fmt->which == V4L2_SUBDEV_FORMAT_ACTIVE) {
		/* Do not change the format while stream is on */
		/* Do not change the format while stream is on */
		if (vsca->src_frame)
		if (vsca->ved.stream)
			return -EBUSY;
			return -EBUSY;


		sink_fmt = &vsca->sink_fmt;
		sink_fmt = &vsca->sink_fmt;
@@ -213,9 +213,6 @@ static int vimc_sca_s_stream(struct v4l2_subdev *sd, int enable)
		const struct v4l2_format_info *pix_info;
		const struct v4l2_format_info *pix_info;
		unsigned int frame_size;
		unsigned int frame_size;


		if (vsca->src_frame)
			return 0;

		if (!vimc_sca_is_pixfmt_supported(pixelformat)) {
		if (!vimc_sca_is_pixfmt_supported(pixelformat)) {
			dev_err(vsca->dev, "pixfmt (0x%08x) is not supported\n",
			dev_err(vsca->dev, "pixfmt (0x%08x) is not supported\n",
				pixelformat);
				pixelformat);
@@ -337,7 +334,7 @@ static void *vimc_sca_process_frame(struct vimc_ent_device *ved,
						    ved);
						    ved);


	/* If the stream in this node is not active, just return */
	/* If the stream in this node is not active, just return */
	if (!vsca->src_frame)
	if (!ved->stream)
		return ERR_PTR(-EINVAL);
		return ERR_PTR(-EINVAL);


	vimc_sca_fill_src_frame(vsca, sink_frame);
	vimc_sca_fill_src_frame(vsca, sink_frame);
+1 −5
Original line number Original line Diff line number Diff line
@@ -141,7 +141,7 @@ static int vimc_sen_set_fmt(struct v4l2_subdev *sd,


	if (fmt->which == V4L2_SUBDEV_FORMAT_ACTIVE) {
	if (fmt->which == V4L2_SUBDEV_FORMAT_ACTIVE) {
		/* Do not change the format while stream is on */
		/* Do not change the format while stream is on */
		if (vsen->frame)
		if (vsen->ved.stream)
			return -EBUSY;
			return -EBUSY;


		mf = &vsen->mbus_format;
		mf = &vsen->mbus_format;
@@ -197,10 +197,6 @@ static int vimc_sen_s_stream(struct v4l2_subdev *sd, int enable)
		const struct v4l2_format_info *pix_info;
		const struct v4l2_format_info *pix_info;
		unsigned int frame_size;
		unsigned int frame_size;


		if (vsen->kthread_sen)
			/* tpg is already executing */
			return 0;

		/* Calculate the frame size */
		/* Calculate the frame size */
		pix_info = v4l2_format_info(pixelformat);
		pix_info = v4l2_format_info(pixelformat);
		frame_size = vsen->mbus_format.width * pix_info->bpp[0] *
		frame_size = vsen->mbus_format.width * pix_info->bpp[0] *