diff mbox series

[07/30] media: atomisp: Drop atomisp_is_vf_pipe()

Message ID 20230513123159.33234-8-hdegoede@redhat.com
State Accepted
Commit 26dcabc0dd1bcbcb23464362a5ddc917df8ceb74
Headers show
Series media: atomisp: Register only 1 /dev/video# node + cleanups | expand

Commit Message

Hans de Goede May 13, 2023, 12:31 p.m. UTC
Since there only is one /dev/video# node now (no more continuous mode),
there are now no longer separate main capture + view-finder pipes.

We are now always on the main pipe, so atomisp_is_vf_pipe() should
always return false now. Drop any checks using it, replacing them
with the code-path for a false return.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 .../staging/media/atomisp/pci/atomisp_cmd.c   | 32 ++-----------------
 .../staging/media/atomisp/pci/atomisp_cmd.h   |  2 --
 .../staging/media/atomisp/pci/atomisp_fops.c  |  5 ++-
 .../staging/media/atomisp/pci/atomisp_ioctl.c |  3 +-
 4 files changed, 5 insertions(+), 37 deletions(-)

Comments

Andy Shevchenko May 13, 2023, 1:42 p.m. UTC | #1
On Sat, May 13, 2023 at 3:32 PM Hans de Goede <hdegoede@redhat.com> wrote:
>
> Since there only is one /dev/video# node now (no more continuous mode),
> there are now no longer separate main capture + view-finder pipes.
>
> We are now always on the main pipe, so atomisp_is_vf_pipe() should
> always return false now. Drop any checks using it, replacing them
> with the code-path for a false return.

...

> +       if (arg->per_frame_setting) {
>                 /*
>                  * Per-frame setting enabled, we allocate a new parameter
>                  * buffer to cache the parameters and only when frame buffers

...

> -       if (!(arg->per_frame_setting && !atomisp_is_vf_pipe(pipe))) {
> +       if (!arg->per_frame_setting) {

I'm wondering if we can make the conditional positive as in the above
chunk, so the below will go to the else branch. It might be that both
of them can be united (haven't checked the full context though).

>                 /* indicate to CSS that we have parameters to be updated */
>                 asd->params.css_update_params_needed = true;
>         } else {
diff mbox series

Patch

diff --git a/drivers/staging/media/atomisp/pci/atomisp_cmd.c b/drivers/staging/media/atomisp/pci/atomisp_cmd.c
index faaa4f1c5c7c..3d6e0d0c7eaa 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_cmd.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_cmd.c
@@ -3216,9 +3216,6 @@  void atomisp_handle_parameter_and_buffer(struct atomisp_video_pipe *pipe)
 
 	lockdep_assert_held(&asd->isp->mutex);
 
-	if (atomisp_is_vf_pipe(pipe))
-		return;
-
 	/*
 	 * CSS/FW requires set parameter and enqueue buffer happen after ISP
 	 * is streamon.
@@ -3294,15 +3291,7 @@  int atomisp_set_parameters(struct video_device *vdev,
 	dev_dbg(asd->isp->dev, "set parameter(per_frame_setting %d) isp_config_id %d of %s\n",
 		arg->per_frame_setting, arg->isp_config_id, vdev->name);
 
-	if (IS_ISP2401) {
-		if (atomisp_is_vf_pipe(pipe) && arg->per_frame_setting) {
-			dev_err(asd->isp->dev, "%s: vf pipe not support per_frame_setting",
-				__func__);
-			return -EINVAL;
-		}
-	}
-
-	if (arg->per_frame_setting && !atomisp_is_vf_pipe(pipe)) {
+	if (arg->per_frame_setting) {
 		/*
 		 * Per-frame setting enabled, we allocate a new parameter
 		 * buffer to cache the parameters and only when frame buffers
@@ -3341,7 +3330,7 @@  int atomisp_set_parameters(struct video_device *vdev,
 	if (ret)
 		goto apply_parameter_failed;
 
-	if (!(arg->per_frame_setting && !atomisp_is_vf_pipe(pipe))) {
+	if (!arg->per_frame_setting) {
 		/* indicate to CSS that we have parameters to be updated */
 		asd->params.css_update_params_needed = true;
 	} else {
@@ -4780,23 +4769,6 @@  int atomisp_flash_enable(struct atomisp_sub_device *asd, int num_frames)
 	return 0;
 }
 
-bool atomisp_is_vf_pipe(struct atomisp_video_pipe *pipe)
-{
-	struct atomisp_sub_device *asd = pipe->asd;
-
-	if (!asd) {
-		dev_err(pipe->isp->dev, "%s(): asd is NULL, device is %s\n",
-			__func__, pipe->vdev.name);
-		return false;
-	}
-
-	if (asd->run_mode->val == ATOMISP_RUN_MODE_VIDEO &&
-	    pipe == &asd->video_out_preview)
-		return true;
-
-	return false;
-}
-
 static int __checking_exp_id(struct atomisp_sub_device *asd, int exp_id)
 {
 	struct atomisp_device *isp = asd->isp;
diff --git a/drivers/staging/media/atomisp/pci/atomisp_cmd.h b/drivers/staging/media/atomisp/pci/atomisp_cmd.h
index 3cf086eba06d..cbe2f48d3dfa 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_cmd.h
+++ b/drivers/staging/media/atomisp/pci/atomisp_cmd.h
@@ -291,8 +291,6 @@  void atomisp_eof_event(struct atomisp_sub_device *asd, uint8_t exp_id);
 enum mipi_port_id __get_mipi_port(struct atomisp_device *isp,
 				  enum atomisp_camera_port port);
 
-bool atomisp_is_vf_pipe(struct atomisp_video_pipe *pipe);
-
 void atomisp_apply_css_parameters(
     struct atomisp_sub_device *asd,
     struct atomisp_css_params *css_param);
diff --git a/drivers/staging/media/atomisp/pci/atomisp_fops.c b/drivers/staging/media/atomisp/pci/atomisp_fops.c
index 3adeeb97e570..99152db236a1 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_fops.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_fops.c
@@ -403,9 +403,8 @@  static void atomisp_buf_queue(struct vb2_buffer *vb)
 	 *     is put to waiting list until previous per-frame parameter buffers
 	 *     get enqueued.
 	 */
-	if (!atomisp_is_vf_pipe(pipe) &&
-	    (pipe->frame_request_config_id[vb->index] ||
-	     !list_empty(&pipe->buffers_waiting_for_param)))
+	if (pipe->frame_request_config_id[vb->index] ||
+	    !list_empty(&pipe->buffers_waiting_for_param))
 		list_add_tail(&frame->queue, &pipe->buffers_waiting_for_param);
 	else
 		list_add_tail(&frame->queue, &pipe->activeq);
diff --git a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c
index 392c0ed56fb4..3068f1a317f3 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c
@@ -1045,8 +1045,7 @@  static int atomisp_qbuf_wrapper(struct file *file, void *fh, struct v4l2_buffer
 	if (buf->index >= vdev->queue->num_buffers)
 		return -EINVAL;
 
-	if (!atomisp_is_vf_pipe(pipe) &&
-	    (buf->reserved2 & ATOMISP_BUFFER_HAS_PER_FRAME_SETTING)) {
+	if (buf->reserved2 & ATOMISP_BUFFER_HAS_PER_FRAME_SETTING) {
 		/* this buffer will have a per-frame parameter */
 		pipe->frame_request_config_id[buf->index] = buf->reserved2 &
 			~ATOMISP_BUFFER_HAS_PER_FRAME_SETTING;