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

Commit f2ed459d authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Mauro Carvalho Chehab
Browse files

[media] v4l: vsp1: Make the userspace API optional



The R-Car Gen3 SoCs include VSP instances dedicated to the DU that will
be controlled entirely by the rcar-du-drm driver through the KMS API. To
support that use case make the userspace V4L2 API optional.

Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent c618b185
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -50,6 +50,7 @@ struct vsp1_platform_data {
	unsigned int uds_count;
	unsigned int uds_count;
	unsigned int wpf_count;
	unsigned int wpf_count;
	unsigned int num_bru_inputs;
	unsigned int num_bru_inputs;
	bool uapi;
};
};


struct vsp1_device {
struct vsp1_device {
+28 −18
Original line number Original line Diff line number Diff line
@@ -143,6 +143,9 @@ static int vsp1_create_links(struct vsp1_device *vsp1)
			return ret;
			return ret;
	}
	}


	if (!vsp1->pdata.uapi)
		return 0;

	for (i = 0; i < vsp1->pdata.rpf_count; ++i) {
	for (i = 0; i < vsp1->pdata.rpf_count; ++i) {
		struct vsp1_rwpf *rpf = vsp1->rpf[i];
		struct vsp1_rwpf *rpf = vsp1->rpf[i];


@@ -267,7 +270,6 @@ static int vsp1_create_entities(struct vsp1_device *vsp1)
	}
	}


	for (i = 0; i < vsp1->pdata.rpf_count; ++i) {
	for (i = 0; i < vsp1->pdata.rpf_count; ++i) {
		struct vsp1_video *video;
		struct vsp1_rwpf *rpf;
		struct vsp1_rwpf *rpf;


		rpf = vsp1_rpf_create(vsp1, i);
		rpf = vsp1_rpf_create(vsp1, i);
@@ -279,7 +281,9 @@ static int vsp1_create_entities(struct vsp1_device *vsp1)
		vsp1->rpf[i] = rpf;
		vsp1->rpf[i] = rpf;
		list_add_tail(&rpf->entity.list_dev, &vsp1->entities);
		list_add_tail(&rpf->entity.list_dev, &vsp1->entities);


		video = vsp1_video_create(vsp1, rpf);
		if (vsp1->pdata.uapi) {
			struct vsp1_video *video = vsp1_video_create(vsp1, rpf);

			if (IS_ERR(video)) {
			if (IS_ERR(video)) {
				ret = PTR_ERR(video);
				ret = PTR_ERR(video);
				goto done;
				goto done;
@@ -287,6 +291,7 @@ static int vsp1_create_entities(struct vsp1_device *vsp1)


			list_add_tail(&video->list, &vsp1->videos);
			list_add_tail(&video->list, &vsp1->videos);
		}
		}
	}


	if (vsp1->pdata.features & VSP1_HAS_SRU) {
	if (vsp1->pdata.features & VSP1_HAS_SRU) {
		vsp1->sru = vsp1_sru_create(vsp1);
		vsp1->sru = vsp1_sru_create(vsp1);
@@ -312,7 +317,6 @@ static int vsp1_create_entities(struct vsp1_device *vsp1)
	}
	}


	for (i = 0; i < vsp1->pdata.wpf_count; ++i) {
	for (i = 0; i < vsp1->pdata.wpf_count; ++i) {
		struct vsp1_video *video;
		struct vsp1_rwpf *wpf;
		struct vsp1_rwpf *wpf;


		wpf = vsp1_wpf_create(vsp1, i);
		wpf = vsp1_wpf_create(vsp1, i);
@@ -324,7 +328,9 @@ static int vsp1_create_entities(struct vsp1_device *vsp1)
		vsp1->wpf[i] = wpf;
		vsp1->wpf[i] = wpf;
		list_add_tail(&wpf->entity.list_dev, &vsp1->entities);
		list_add_tail(&wpf->entity.list_dev, &vsp1->entities);


		video = vsp1_video_create(vsp1, wpf);
		if (vsp1->pdata.uapi) {
			struct vsp1_video *video = vsp1_video_create(vsp1, wpf);

			if (IS_ERR(video)) {
			if (IS_ERR(video)) {
				ret = PTR_ERR(video);
				ret = PTR_ERR(video);
				goto done;
				goto done;
@@ -333,6 +339,7 @@ static int vsp1_create_entities(struct vsp1_device *vsp1)
			list_add_tail(&video->list, &vsp1->videos);
			list_add_tail(&video->list, &vsp1->videos);
			wpf->entity.sink = &video->video.entity;
			wpf->entity.sink = &video->video.entity;
		}
		}
	}


	/* Register all subdevs. */
	/* Register all subdevs. */
	list_for_each_entry(entity, &vsp1->entities, list_dev) {
	list_for_each_entry(entity, &vsp1->entities, list_dev) {
@@ -347,9 +354,11 @@ static int vsp1_create_entities(struct vsp1_device *vsp1)
	if (ret < 0)
	if (ret < 0)
		goto done;
		goto done;


	if (vsp1->pdata.uapi) {
		ret = v4l2_device_register_subdev_nodes(&vsp1->v4l2_dev);
		ret = v4l2_device_register_subdev_nodes(&vsp1->v4l2_dev);
		if (ret < 0)
		if (ret < 0)
			goto done;
			goto done;
	}


	ret = media_device_register(mdev);
	ret = media_device_register(mdev);


@@ -545,6 +554,7 @@ static int vsp1_parse_dt(struct vsp1_device *vsp1)


	pdata->features |= VSP1_HAS_BRU;
	pdata->features |= VSP1_HAS_BRU;
	pdata->num_bru_inputs = 4;
	pdata->num_bru_inputs = 4;
	pdata->uapi = true;


	return 0;
	return 0;
}
}
+1 −1
Original line number Original line Diff line number Diff line
@@ -45,7 +45,7 @@ int vsp1_entity_set_streaming(struct vsp1_entity *entity, bool streaming)
	if (!streaming)
	if (!streaming)
		return 0;
		return 0;


	if (!entity->subdev.ctrl_handler)
	if (!entity->vsp1->pdata.uapi || !entity->subdev.ctrl_handler)
		return 0;
		return 0;


	ret = v4l2_ctrl_handler_setup(entity->subdev.ctrl_handler);
	ret = v4l2_ctrl_handler_setup(entity->subdev.ctrl_handler);
+4 −2
Original line number Original line Diff line number Diff line
@@ -151,10 +151,12 @@ static int sru_s_stream(struct v4l2_subdev *subdev, int enable)
	/* Take the control handler lock to ensure that the CTRL0 value won't be
	/* Take the control handler lock to ensure that the CTRL0 value won't be
	 * changed behind our back by a set control operation.
	 * changed behind our back by a set control operation.
	 */
	 */
	if (sru->entity.vsp1->pdata.uapi)
		mutex_lock(sru->ctrls.lock);
		mutex_lock(sru->ctrls.lock);
	ctrl0 |= vsp1_sru_read(sru, VI6_SRU_CTRL0)
	ctrl0 |= vsp1_sru_read(sru, VI6_SRU_CTRL0)
	       & (VI6_SRU_CTRL0_PARAM0_MASK | VI6_SRU_CTRL0_PARAM1_MASK);
	       & (VI6_SRU_CTRL0_PARAM0_MASK | VI6_SRU_CTRL0_PARAM1_MASK);
	vsp1_sru_write(sru, VI6_SRU_CTRL0, ctrl0);
	vsp1_sru_write(sru, VI6_SRU_CTRL0, ctrl0);
	if (sru->entity.vsp1->pdata.uapi)
		mutex_unlock(sru->ctrls.lock);
		mutex_unlock(sru->ctrls.lock);


	vsp1_sru_write(sru, VI6_SRU_CTRL1, VI6_SRU_CTRL1_PARAM5);
	vsp1_sru_write(sru, VI6_SRU_CTRL1, VI6_SRU_CTRL1_PARAM5);
+4 −2
Original line number Original line Diff line number Diff line
@@ -151,9 +151,11 @@ static int wpf_s_stream(struct v4l2_subdev *subdev, int enable)
	/* Take the control handler lock to ensure that the PDV value won't be
	/* Take the control handler lock to ensure that the PDV value won't be
	 * changed behind our back by a set control operation.
	 * changed behind our back by a set control operation.
	 */
	 */
	if (vsp1->pdata.uapi)
		mutex_lock(wpf->ctrls.lock);
		mutex_lock(wpf->ctrls.lock);
	outfmt |= vsp1_wpf_read(wpf, VI6_WPF_OUTFMT) & VI6_WPF_OUTFMT_PDV_MASK;
	outfmt |= vsp1_wpf_read(wpf, VI6_WPF_OUTFMT) & VI6_WPF_OUTFMT_PDV_MASK;
	vsp1_wpf_write(wpf, VI6_WPF_OUTFMT, outfmt);
	vsp1_wpf_write(wpf, VI6_WPF_OUTFMT, outfmt);
	if (vsp1->pdata.uapi)
		mutex_unlock(wpf->ctrls.lock);
		mutex_unlock(wpf->ctrls.lock);


	vsp1_write(vsp1, VI6_DPR_WPF_FPORCH(wpf->entity.index),
	vsp1_write(vsp1, VI6_DPR_WPF_FPORCH(wpf->entity.index),