OSDN Git Service

media: atomisp: unify ia_css_stream stop logic
authorMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Mon, 15 Nov 2021 19:40:26 +0000 (19:40 +0000)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Tue, 16 Nov 2021 14:37:10 +0000 (14:37 +0000)
There are two versions of those functions. It turns that the
choosen firmware use the old version. So, drop the unused
ones and ensure that all devices will use the right functions.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/staging/media/atomisp/pci/sh_css.c

index c73ef67..adec184 100644 (file)
@@ -189,27 +189,6 @@ allocate_delay_frames(struct ia_css_pipe *pipe);
 static int
 sh_css_pipe_start(struct ia_css_stream *stream);
 
-/* ISP 2401 */
-/*
- * @brief Stop all "ia_css_pipe" instances in the target
- * "ia_css_stream" instance.
- *
- * @param[in] stream   Point to the target "ia_css_stream" instance.
- *
- * @return
- * - 0, if the "stop" requests have been successfully sent out.
- * - CSS error code, otherwise.
- *
- *
- * NOTE
- * This API sends the "stop" requests to the "ia_css_pipe"
- * instances in the same "ia_css_stream" instance. It will
- * return without waiting for all "ia_css_pipe" instatnces
- * being stopped.
- */
-static int
-sh_css_pipes_stop(struct ia_css_stream *stream);
-
 /*
  * @brief Check if all "ia_css_pipe" instances in the target
  * "ia_css_stream" instance have stopped.
@@ -221,9 +200,6 @@ sh_css_pipes_stop(struct ia_css_stream *stream);
  *   instance have ben stopped.
  * - false, otherwise.
  */
-/* ISP 2401 */
-static bool
-sh_css_pipes_have_stopped(struct ia_css_stream *stream);
 
 /* ISP 2401 */
 static int
@@ -4786,185 +4762,6 @@ ia_css_stream_get_buffer_depth(struct ia_css_stream *stream,
        return 0;
 }
 
-/*
- * @brief Stop all "ia_css_pipe" instances in the target
- * "ia_css_stream" instance.
- *
- * Refer to "Local prototypes" for more info.
- */
-/* ISP2401 */
-static int
-sh_css_pipes_stop(struct ia_css_stream *stream)
-{
-       int err = 0;
-       struct ia_css_pipe *main_pipe;
-       enum ia_css_pipe_id main_pipe_id;
-       int i;
-
-       if (!stream) {
-               IA_CSS_LOG("stream does NOT exist!");
-               err = -EINVAL;
-               goto ERR;
-       }
-
-       main_pipe = stream->last_pipe;
-       if (!main_pipe) {
-               IA_CSS_LOG("main_pipe does NOT exist!");
-               err = -EINVAL;
-               goto ERR;
-       }
-
-       main_pipe_id = main_pipe->mode;
-       IA_CSS_ENTER_PRIVATE("main_pipe_id=%d", main_pipe_id);
-
-       /*
-        * Stop all "ia_css_pipe" instances in this target
-        * "ia_css_stream" instance.
-        */
-       for (i = 0; i < stream->num_pipes; i++) {
-               /* send the "stop" request to the "ia_css_pipe" instance */
-               IA_CSS_LOG("Send the stop-request to the pipe: pipe_id=%d",
-                          stream->pipes[i]->pipeline.pipe_id);
-               err = ia_css_pipeline_request_stop(&stream->pipes[i]->pipeline);
-
-               /*
-               * Exit this loop if "ia_css_pipeline_request_stop()"
-               * returns the error code.
-               *
-               * The error code would be generated in the following
-               * two cases:
-               * (1) The Scalar Processor has already been stopped.
-               * (2) The "Host->SP" event queue is full.
-               *
-               * As the convention of using CSS API 2.0/2.1, such CSS
-               * error code would be propogated from the CSS-internal
-               * API returned value to the CSS API returned value. Then
-               * the CSS driver should capture these error code and
-               * handle it in the driver exception handling mechanism.
-               */
-               if (err)
-                       goto ERR;
-       }
-
-       /*
-        * In the CSS firmware use scenario "Continuous Preview"
-        * as well as "Continuous Video", the "ia_css_pipe" instance
-        * "Copy Pipe" is activated. This "Copy Pipe" is private to
-        * the CSS firmware so that it is not listed in the target
-        * "ia_css_stream" instance.
-        *
-        * We need to stop this "Copy Pipe", as well.
-        */
-       if (main_pipe->stream->config.continuous) {
-               struct ia_css_pipe *copy_pipe = NULL;
-
-               /* get the reference to "Copy Pipe" */
-               if (main_pipe_id == IA_CSS_PIPE_ID_PREVIEW)
-                       copy_pipe = main_pipe->pipe_settings.preview.copy_pipe;
-               else if (main_pipe_id == IA_CSS_PIPE_ID_VIDEO)
-                       copy_pipe = main_pipe->pipe_settings.video.copy_pipe;
-
-               /* return the error code if "Copy Pipe" does NOT exist */
-               if (!copy_pipe) {
-                       IA_CSS_LOG("Copy Pipe does NOT exist!");
-                       err = -EINVAL;
-                       goto ERR;
-               }
-
-               /* send the "stop" request to "Copy Pipe" */
-               IA_CSS_LOG("Send the stop-request to the pipe: pipe_id=%d",
-                          copy_pipe->pipeline.pipe_id);
-               err = ia_css_pipeline_request_stop(&copy_pipe->pipeline);
-       }
-
-ERR:
-       IA_CSS_LEAVE_ERR_PRIVATE(err);
-       return err;
-}
-
-/*
- * @brief Check if all "ia_css_pipe" instances in the target
- * "ia_css_stream" instance have stopped.
- *
- * Refer to "Local prototypes" for more info.
- */
-/* ISP2401 */
-static bool
-sh_css_pipes_have_stopped(struct ia_css_stream *stream)
-{
-       bool rval = true;
-
-       struct ia_css_pipe *main_pipe;
-       enum ia_css_pipe_id main_pipe_id;
-
-       int i;
-
-       if (!stream) {
-               IA_CSS_LOG("stream does NOT exist!");
-               rval = false;
-               goto RET;
-       }
-
-       main_pipe = stream->last_pipe;
-
-       if (!main_pipe) {
-               IA_CSS_LOG("main_pipe does NOT exist!");
-               rval = false;
-               goto RET;
-       }
-
-       main_pipe_id = main_pipe->mode;
-       IA_CSS_ENTER_PRIVATE("main_pipe_id=%d", main_pipe_id);
-
-       /*
-        * Check if every "ia_css_pipe" instance in this target
-        * "ia_css_stream" instance has stopped.
-        */
-       for (i = 0; i < stream->num_pipes; i++) {
-               rval = rval && ia_css_pipeline_has_stopped(&stream->pipes[i]->pipeline);
-               IA_CSS_LOG("Pipe has stopped: pipe_id=%d, stopped=%d",
-                          stream->pipes[i]->pipeline.pipe_id,
-                          rval);
-       }
-
-       /*
-        * In the CSS firmware use scenario "Continuous Preview"
-        * as well as "Continuous Video", the "ia_css_pipe" instance
-        * "Copy Pipe" is activated. This "Copy Pipe" is private to
-        * the CSS firmware so that it is not listed in the target
-        * "ia_css_stream" instance.
-        *
-        * We need to check if this "Copy Pipe" has stopped, as well.
-        */
-       if (main_pipe->stream->config.continuous) {
-               struct ia_css_pipe *copy_pipe = NULL;
-
-               /* get the reference to "Copy Pipe" */
-               if (main_pipe_id == IA_CSS_PIPE_ID_PREVIEW)
-                       copy_pipe = main_pipe->pipe_settings.preview.copy_pipe;
-               else if (main_pipe_id == IA_CSS_PIPE_ID_VIDEO)
-                       copy_pipe = main_pipe->pipe_settings.video.copy_pipe;
-
-               /* return if "Copy Pipe" does NOT exist */
-               if (!copy_pipe) {
-                       IA_CSS_LOG("Copy Pipe does NOT exist!");
-
-                       rval = false;
-                       goto RET;
-               }
-
-               /* check if "Copy Pipe" has stopped or not */
-               rval = rval && ia_css_pipeline_has_stopped(&copy_pipe->pipeline);
-               IA_CSS_LOG("Pipe has stopped: pipe_id=%d, stopped=%d",
-                          copy_pipe->pipeline.pipe_id,
-                          rval);
-       }
-
-RET:
-       IA_CSS_LEAVE_PRIVATE("rval=%d", rval);
-       return rval;
-}
-
 #if !defined(ISP2401)
 unsigned int
 sh_css_get_mipi_sizes_for_check(const unsigned int port, const unsigned int idx)
@@ -9619,11 +9416,7 @@ ia_css_stream_stop(struct ia_css_stream *stream)
        }
 #endif
 
-       if (!IS_ISP2401)
-               err = ia_css_pipeline_request_stop(&stream->last_pipe->pipeline);
-       else
-               err = sh_css_pipes_stop(stream);
-
+       err = ia_css_pipeline_request_stop(&stream->last_pipe->pipeline);
        if (err)
                return err;
 
@@ -9643,10 +9436,7 @@ ia_css_stream_has_stopped(struct ia_css_stream *stream)
 
        assert(stream);
 
-       if (!IS_ISP2401)
-               stopped = ia_css_pipeline_has_stopped(&stream->last_pipe->pipeline);
-       else
-               stopped = sh_css_pipes_have_stopped(stream);
+       stopped = ia_css_pipeline_has_stopped(&stream->last_pipe->pipeline);
 
        return stopped;
 }