media: atomisp: better describe get_frame_info issues
authorMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Fri, 29 Oct 2021 06:06:38 +0000 (07:06 +0100)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Mon, 15 Nov 2021 08:11:41 +0000 (08:11 +0000)
When atomisp is used by a normal client, it fails to get
frame info. However, the information is confusing and misleading,
as there are several wrappers for such function, and the error
could be on different places.

So, improve the error log in order to allow narrowing down
where the error is actually occuring.

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

index 75a531667d743c997d1269fbf4ed81713612aadb..70c8e86c320599c05841be55e9e900bf213a947f 100644 (file)
@@ -5453,9 +5453,9 @@ static int atomisp_set_fmt_to_isp(struct video_device *vdev,
        else
                ret = get_frame_info(asd, output_info);
        if (ret) {
-               dev_err(isp->dev, "get_frame_info %ux%u (padded to %u)\n",
-                       pix->width, pix->height, pix->bytesperline);
-               return -EINVAL;
+               dev_err(isp->dev, "__get_frame_info %ux%u (padded to %u) returned %d\n",
+                       pix->width, pix->height, pix->bytesperline, ret);
+               return ret;
        }
 
        atomisp_update_grid_info(asd, pipe_id, source_pad);
index 99a632f33d2d690a558804515462f1bac22dc34b..1309855bb6c809587080edc8879b258f4d60bdc2 100644 (file)
@@ -2657,42 +2657,49 @@ static int __get_frame_info(struct atomisp_sub_device *asd,
        if (__destroy_pipes(asd, true))
                dev_warn(isp->dev, "destroy pipe failed.\n");
 
-       if (__create_pipes(asd))
+       if (__create_pipes(asd)) {
+               dev_err(isp->dev, "can't create pipes\n");
                return -EINVAL;
+       }
 
-       if (__create_streams(asd))
+       if (__create_streams(asd)) {
+               dev_err(isp->dev, "can't create streams\n");
                goto stream_err;
+       }
 
-       ret = ia_css_pipe_get_info(
-                 asd->stream_env[stream_index]
-                 .pipes[pipe_id], &p_info);
-       if (!ret) {
-               switch (type) {
-               case ATOMISP_CSS_VF_FRAME:
-                       *info = p_info.vf_output_info[0];
-                       dev_dbg(isp->dev, "getting vf frame info.\n");
-                       break;
-               case ATOMISP_CSS_SECOND_VF_FRAME:
-                       *info = p_info.vf_output_info[1];
-                       dev_dbg(isp->dev, "getting second vf frame info.\n");
-                       break;
-               case ATOMISP_CSS_OUTPUT_FRAME:
-                       *info = p_info.output_info[0];
-                       dev_dbg(isp->dev, "getting main frame info.\n");
-                       break;
-               case ATOMISP_CSS_SECOND_OUTPUT_FRAME:
-                       *info = p_info.output_info[1];
-                       dev_dbg(isp->dev, "getting second main frame info.\n");
-                       break;
-               case ATOMISP_CSS_RAW_FRAME:
-                       *info = p_info.raw_output_info;
-                       dev_dbg(isp->dev, "getting raw frame info.\n");
-               }
-               dev_dbg(isp->dev, "get frame info: w=%d, h=%d, num_invalid_frames %d.\n",
-                       info->res.width, info->res.height, p_info.num_invalid_frames);
-               return 0;
+       ret = ia_css_pipe_get_info(asd->stream_env[stream_index].pipes[pipe_id],
+                                  &p_info);
+       if (ret) {
+               dev_err(isp->dev, "can't get info from pipe\n");
+               goto stream_err;
        }
 
+       switch (type) {
+       case ATOMISP_CSS_VF_FRAME:
+               *info = p_info.vf_output_info[0];
+               dev_dbg(isp->dev, "getting vf frame info.\n");
+               break;
+       case ATOMISP_CSS_SECOND_VF_FRAME:
+               *info = p_info.vf_output_info[1];
+               dev_dbg(isp->dev, "getting second vf frame info.\n");
+               break;
+       case ATOMISP_CSS_OUTPUT_FRAME:
+               *info = p_info.output_info[0];
+               dev_dbg(isp->dev, "getting main frame info.\n");
+               break;
+       case ATOMISP_CSS_SECOND_OUTPUT_FRAME:
+               *info = p_info.output_info[1];
+               dev_dbg(isp->dev, "getting second main frame info.\n");
+               break;
+       case ATOMISP_CSS_RAW_FRAME:
+               *info = p_info.raw_output_info;
+               dev_dbg(isp->dev, "getting raw frame info.\n");
+       }
+       dev_dbg(isp->dev, "get frame info: w=%d, h=%d, num_invalid_frames %d.\n",
+               info->res.width, info->res.height, p_info.num_invalid_frames);
+
+       return 0;
+
 stream_err:
        __destroy_pipes(asd, true);
        return -EINVAL;