From 9c2f3b8f7f542c194ced4b1cd1184acfc0fea37d Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Tue, 21 Feb 2023 14:59:04 +0000 Subject: [PATCH] media: atomisp: Remove ATOMISP_USE_YUVPP() ATOMISP_USE_YUVPP() always returns false, so remove it and remove any code-paths which only run when it would return true. Link: https://lore.kernel.org/r/20230221145906.8113-9-hdegoede@redhat.com Reviewed-by: Andy Shevchenko Signed-off-by: Hans de Goede Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/atomisp/pci/atomisp_cmd.c | 15 +- .../media/atomisp/pci/atomisp_compat_css20.c | 215 ++------------------- drivers/staging/media/atomisp/pci/atomisp_fops.c | 33 ---- .../staging/media/atomisp/pci/atomisp_internal.h | 2 - drivers/staging/media/atomisp/pci/atomisp_ioctl.c | 3 - 5 files changed, 21 insertions(+), 247 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/atomisp_cmd.c b/drivers/staging/media/atomisp/pci/atomisp_cmd.c index 99e5a5c..b102141 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_cmd.c +++ b/drivers/staging/media/atomisp/pci/atomisp_cmd.c @@ -196,7 +196,6 @@ int atomisp_freq_scaling(struct atomisp_device *isp, enum atomisp_dfs_mode mode, bool force) { - struct pci_dev *pdev = to_pci_dev(isp->dev); /* FIXME! Only use subdev[0] status yet */ struct atomisp_sub_device *asd = &isp->asd[0]; const struct atomisp_dfs_config *dfs; @@ -205,10 +204,6 @@ int atomisp_freq_scaling(struct atomisp_device *isp, int i, ret; unsigned short fps = 0; - if ((pdev->device & ATOMISP_PCI_DEVICE_SOC_MASK) == - ATOMISP_PCI_DEVICE_SOC_CHT && ATOMISP_USE_YUVPP(asd)) - isp->dfs = &dfs_config_cht_soc; - dfs = isp->dfs; if (dfs->lowest_freq == 0 || dfs->max_freq_at_vmin == 0 || @@ -4393,12 +4388,6 @@ static int atomisp_set_fmt_to_isp(struct video_device *vdev, } } - /* - * to SOC camera, use yuvpp pipe. - */ - if (ATOMISP_USE_YUVPP(asd)) - pipe_id = IA_CSS_PIPE_ID_YUVPP; - if (asd->copy_mode) ret = atomisp_css_copy_configure_output(asd, ATOMISP_INPUT_STREAM_GENERAL, pix->width, pix->height, @@ -5270,9 +5259,7 @@ static int atomisp_get_pipe_id(struct atomisp_video_pipe *pipe) return -EINVAL; } - if (ATOMISP_USE_YUVPP(asd)) { - return IA_CSS_PIPE_ID_YUVPP; - } else if (asd->vfpp->val == ATOMISP_VFPP_DISABLE_SCALER) { + if (asd->vfpp->val == ATOMISP_VFPP_DISABLE_SCALER) { return IA_CSS_PIPE_ID_VIDEO; } else if (asd->vfpp->val == ATOMISP_VFPP_DISABLE_LOWLAT) { return IA_CSS_PIPE_ID_CAPTURE; diff --git a/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c b/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c index d31beab..9bfc9d0 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c +++ b/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c @@ -1863,17 +1863,6 @@ void atomisp_css_enable_continuous(struct atomisp_sub_device *asd, &asd->stream_env[ATOMISP_INPUT_STREAM_GENERAL]; int i; - /* - * To SOC camera, there is only one YUVPP pipe in any case - * including ZSL/SDV/continuous viewfinder, so always set - * stream_config.continuous to 0. - */ - if (ATOMISP_USE_YUVPP(asd)) { - stream_env->stream_config.continuous = 0; - stream_env->stream_config.online = 1; - return; - } - if (stream_env->stream_config.continuous != !!enable) { stream_env->stream_config.continuous = !!enable; stream_env->stream_config.pack_raw_pixels = true; @@ -2091,42 +2080,6 @@ static void __configure_output(struct atomisp_sub_device *asd, pipe_id, width, height, format); } -static void __configure_video_preview_output(struct atomisp_sub_device *asd, - unsigned int stream_index, - unsigned int width, unsigned int height, - unsigned int min_width, - enum ia_css_frame_format format, - enum ia_css_pipe_id pipe_id) -{ - struct atomisp_device *isp = asd->isp; - struct atomisp_stream_env *stream_env = - &asd->stream_env[stream_index]; - struct ia_css_frame_info *css_output_info; - struct ia_css_stream_config *stream_config = &stream_env->stream_config; - - stream_env->pipe_configs[pipe_id].mode = - __pipe_id_to_pipe_mode(asd, pipe_id); - stream_env->update_pipe[pipe_id] = true; - - css_output_info = - &stream_env->pipe_configs[pipe_id].output_info[ATOMISP_CSS_OUTPUT_DEFAULT_INDEX]; - - css_output_info->res.width = width; - css_output_info->res.height = height; - css_output_info->format = format; - css_output_info->padded_width = min_width; - - /* isp binary 2.2 specific setting*/ - if (width > stream_config->input_config.effective_res.width || - height > stream_config->input_config.effective_res.height) { - stream_config->input_config.effective_res.width = width; - stream_config->input_config.effective_res.height = height; - } - - dev_dbg(isp->dev, "configuring pipe[%d] output info w=%d.h=%d.f=%d.\n", - pipe_id, width, height, format); -} - /* * For CSS2.1, capture pipe uses capture_pp_in_res to configure yuv * downscaling input resolution. @@ -2430,33 +2383,6 @@ static void __configure_vf_output(struct atomisp_sub_device *asd, pipe_id, width, height, format); } -static void __configure_video_vf_output(struct atomisp_sub_device *asd, - unsigned int width, unsigned int height, - unsigned int min_width, - enum ia_css_frame_format format, - enum ia_css_pipe_id pipe_id) -{ - struct atomisp_device *isp = asd->isp; - struct atomisp_stream_env *stream_env = - &asd->stream_env[ATOMISP_INPUT_STREAM_GENERAL]; - struct ia_css_frame_info *css_output_info; - - stream_env->pipe_configs[pipe_id].mode = - __pipe_id_to_pipe_mode(asd, pipe_id); - stream_env->update_pipe[pipe_id] = true; - - css_output_info = - &stream_env->pipe_configs[pipe_id].vf_output_info[ATOMISP_CSS_OUTPUT_DEFAULT_INDEX]; - - css_output_info->res.width = width; - css_output_info->res.height = height; - css_output_info->format = format; - css_output_info->padded_width = min_width; - dev_dbg(isp->dev, - "configuring pipe[%d] vf output info w=%d.h=%d.f=%d.\n", - pipe_id, width, height, format); -} - static int __get_frame_info(struct atomisp_sub_device *asd, unsigned int stream_index, struct ia_css_frame_info *info, @@ -2516,11 +2442,6 @@ static unsigned int atomisp_get_pipe_index(struct atomisp_sub_device *asd, uint16_t source_pad) { struct atomisp_device *isp = asd->isp; - /* - * to SOC camera, use yuvpp pipe. - */ - if (ATOMISP_USE_YUVPP(asd)) - return IA_CSS_PIPE_ID_YUVPP; switch (source_pad) { case ATOMISP_SUBDEV_PAD_SOURCE_VIDEO: @@ -2661,16 +2582,8 @@ int atomisp_css_preview_configure_output(struct atomisp_sub_device *asd, unsigned int min_width, enum ia_css_frame_format format) { - /* - * to SOC camera, use yuvpp pipe. - */ - if (ATOMISP_USE_YUVPP(asd)) - __configure_video_preview_output(asd, ATOMISP_INPUT_STREAM_GENERAL, width, - height, - min_width, format, IA_CSS_PIPE_ID_YUVPP); - else - __configure_output(asd, ATOMISP_INPUT_STREAM_GENERAL, width, height, - min_width, format, IA_CSS_PIPE_ID_PREVIEW); + __configure_output(asd, ATOMISP_INPUT_STREAM_GENERAL, width, height, + min_width, format, IA_CSS_PIPE_ID_PREVIEW); return 0; } @@ -2679,18 +2592,8 @@ int atomisp_css_capture_configure_output(struct atomisp_sub_device *asd, unsigned int min_width, enum ia_css_frame_format format) { - enum ia_css_pipe_id pipe_id; - - /* - * to SOC camera, use yuvpp pipe. - */ - if (ATOMISP_USE_YUVPP(asd)) - pipe_id = IA_CSS_PIPE_ID_YUVPP; - else - pipe_id = IA_CSS_PIPE_ID_CAPTURE; - __configure_output(asd, ATOMISP_INPUT_STREAM_GENERAL, width, height, - min_width, format, pipe_id); + min_width, format, IA_CSS_PIPE_ID_CAPTURE); return 0; } @@ -2699,16 +2602,8 @@ int atomisp_css_video_configure_output(struct atomisp_sub_device *asd, unsigned int min_width, enum ia_css_frame_format format) { - /* - * to SOC camera, use yuvpp pipe. - */ - if (ATOMISP_USE_YUVPP(asd)) - __configure_video_preview_output(asd, ATOMISP_INPUT_STREAM_GENERAL, width, - height, - min_width, format, IA_CSS_PIPE_ID_YUVPP); - else - __configure_output(asd, ATOMISP_INPUT_STREAM_GENERAL, width, height, - min_width, format, IA_CSS_PIPE_ID_VIDEO); + __configure_output(asd, ATOMISP_INPUT_STREAM_GENERAL, width, height, + min_width, format, IA_CSS_PIPE_ID_VIDEO); return 0; } @@ -2718,15 +2613,8 @@ int atomisp_css_video_configure_viewfinder( unsigned int min_width, enum ia_css_frame_format format) { - /* - * to SOC camera, video will use yuvpp pipe. - */ - if (ATOMISP_USE_YUVPP(asd)) - __configure_video_vf_output(asd, width, height, min_width, format, - IA_CSS_PIPE_ID_YUVPP); - else - __configure_vf_output(asd, width, height, min_width, format, - IA_CSS_PIPE_ID_VIDEO); + __configure_vf_output(asd, width, height, min_width, format, + IA_CSS_PIPE_ID_VIDEO); return 0; } @@ -2736,18 +2624,7 @@ int atomisp_css_capture_configure_viewfinder( unsigned int min_width, enum ia_css_frame_format format) { - enum ia_css_pipe_id pipe_id; - - /* - * to SOC camera, video will use yuvpp pipe. - */ - if (ATOMISP_USE_YUVPP(asd)) - pipe_id = IA_CSS_PIPE_ID_YUVPP; - else - pipe_id = IA_CSS_PIPE_ID_CAPTURE; - - __configure_vf_output(asd, width, height, min_width, format, - pipe_id); + __configure_vf_output(asd, width, height, min_width, format, IA_CSS_PIPE_ID_CAPTURE); return 0; } @@ -2755,41 +2632,22 @@ int atomisp_css_video_get_viewfinder_frame_info( struct atomisp_sub_device *asd, struct ia_css_frame_info *info) { - enum ia_css_pipe_id pipe_id; - enum frame_info_type frame_type = ATOMISP_CSS_VF_FRAME; - - if (ATOMISP_USE_YUVPP(asd)) { - pipe_id = IA_CSS_PIPE_ID_YUVPP; - } else { - pipe_id = IA_CSS_PIPE_ID_VIDEO; - } - return __get_frame_info(asd, ATOMISP_INPUT_STREAM_GENERAL, info, - frame_type, pipe_id); + ATOMISP_CSS_VF_FRAME, IA_CSS_PIPE_ID_VIDEO); } int atomisp_css_capture_get_viewfinder_frame_info( struct atomisp_sub_device *asd, struct ia_css_frame_info *info) { - enum ia_css_pipe_id pipe_id; - - if (ATOMISP_USE_YUVPP(asd)) - pipe_id = IA_CSS_PIPE_ID_YUVPP; - else - pipe_id = IA_CSS_PIPE_ID_CAPTURE; - return __get_frame_info(asd, ATOMISP_INPUT_STREAM_GENERAL, info, - ATOMISP_CSS_VF_FRAME, pipe_id); + ATOMISP_CSS_VF_FRAME, IA_CSS_PIPE_ID_CAPTURE); } int atomisp_css_capture_get_output_raw_frame_info( struct atomisp_sub_device *asd, struct ia_css_frame_info *info) { - if (ATOMISP_USE_YUVPP(asd)) - return 0; - return __get_frame_info(asd, ATOMISP_INPUT_STREAM_GENERAL, info, ATOMISP_CSS_RAW_FRAME, IA_CSS_PIPE_ID_CAPTURE); } @@ -2807,49 +2665,24 @@ int atomisp_css_preview_get_output_frame_info( struct atomisp_sub_device *asd, struct ia_css_frame_info *info) { - enum ia_css_pipe_id pipe_id; - enum frame_info_type frame_type = ATOMISP_CSS_OUTPUT_FRAME; - - if (ATOMISP_USE_YUVPP(asd)) { - pipe_id = IA_CSS_PIPE_ID_YUVPP; - } else { - pipe_id = IA_CSS_PIPE_ID_PREVIEW; - } - return __get_frame_info(asd, ATOMISP_INPUT_STREAM_GENERAL, info, - frame_type, pipe_id); + ATOMISP_CSS_OUTPUT_FRAME, IA_CSS_PIPE_ID_PREVIEW); } int atomisp_css_capture_get_output_frame_info( struct atomisp_sub_device *asd, struct ia_css_frame_info *info) { - enum ia_css_pipe_id pipe_id; - - if (ATOMISP_USE_YUVPP(asd)) - pipe_id = IA_CSS_PIPE_ID_YUVPP; - else - pipe_id = IA_CSS_PIPE_ID_CAPTURE; - return __get_frame_info(asd, ATOMISP_INPUT_STREAM_GENERAL, info, - ATOMISP_CSS_OUTPUT_FRAME, pipe_id); + ATOMISP_CSS_OUTPUT_FRAME, IA_CSS_PIPE_ID_CAPTURE); } int atomisp_css_video_get_output_frame_info( struct atomisp_sub_device *asd, struct ia_css_frame_info *info) { - enum ia_css_pipe_id pipe_id; - enum frame_info_type frame_type = ATOMISP_CSS_OUTPUT_FRAME; - - if (ATOMISP_USE_YUVPP(asd)) { - pipe_id = IA_CSS_PIPE_ID_YUVPP; - } else { - pipe_id = IA_CSS_PIPE_ID_VIDEO; - } - return __get_frame_info(asd, ATOMISP_INPUT_STREAM_GENERAL, info, - frame_type, pipe_id); + ATOMISP_CSS_OUTPUT_FRAME, IA_CSS_PIPE_ID_VIDEO); } int atomisp_css_preview_configure_pp_input( @@ -2858,15 +2691,12 @@ int atomisp_css_preview_configure_pp_input( { struct atomisp_stream_env *stream_env = &asd->stream_env[ATOMISP_INPUT_STREAM_GENERAL]; - __configure_preview_pp_input(asd, width, height, - ATOMISP_USE_YUVPP(asd) ? - IA_CSS_PIPE_ID_YUVPP : IA_CSS_PIPE_ID_PREVIEW); + __configure_preview_pp_input(asd, width, height, IA_CSS_PIPE_ID_PREVIEW); if (width > stream_env->pipe_configs[IA_CSS_PIPE_ID_CAPTURE]. capt_pp_in_res.width) - __configure_capture_pp_input(asd, width, height, - ATOMISP_USE_YUVPP(asd) ? - IA_CSS_PIPE_ID_YUVPP : IA_CSS_PIPE_ID_CAPTURE); + __configure_capture_pp_input(asd, width, height, IA_CSS_PIPE_ID_CAPTURE); + return 0; } @@ -2874,9 +2704,7 @@ int atomisp_css_capture_configure_pp_input( struct atomisp_sub_device *asd, unsigned int width, unsigned int height) { - __configure_capture_pp_input(asd, width, height, - ATOMISP_USE_YUVPP(asd) ? - IA_CSS_PIPE_ID_YUVPP : IA_CSS_PIPE_ID_CAPTURE); + __configure_capture_pp_input(asd, width, height, IA_CSS_PIPE_ID_CAPTURE); return 0; } @@ -2887,15 +2715,12 @@ int atomisp_css_video_configure_pp_input( struct atomisp_stream_env *stream_env = &asd->stream_env[ATOMISP_INPUT_STREAM_GENERAL]; - __configure_video_pp_input(asd, width, height, - ATOMISP_USE_YUVPP(asd) ? - IA_CSS_PIPE_ID_YUVPP : IA_CSS_PIPE_ID_VIDEO); + __configure_video_pp_input(asd, width, height, IA_CSS_PIPE_ID_VIDEO); if (width > stream_env->pipe_configs[IA_CSS_PIPE_ID_CAPTURE]. capt_pp_in_res.width) - __configure_capture_pp_input(asd, width, height, - ATOMISP_USE_YUVPP(asd) ? - IA_CSS_PIPE_ID_YUVPP : IA_CSS_PIPE_ID_CAPTURE); + __configure_capture_pp_input(asd, width, height, IA_CSS_PIPE_ID_CAPTURE); + return 0; } diff --git a/drivers/staging/media/atomisp/pci/atomisp_fops.c b/drivers/staging/media/atomisp/pci/atomisp_fops.c index e5203f6..5ba5739 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_fops.c +++ b/drivers/staging/media/atomisp/pci/atomisp_fops.c @@ -346,16 +346,6 @@ static int atomisp_get_css_buf_type(struct atomisp_sub_device *asd, enum ia_css_pipe_id pipe_id, uint16_t source_pad) { - if (ATOMISP_USE_YUVPP(asd)) { - if (source_pad == ATOMISP_SUBDEV_PAD_SOURCE_CAPTURE || - source_pad == ATOMISP_SUBDEV_PAD_SOURCE_VIDEO || - (source_pad == ATOMISP_SUBDEV_PAD_SOURCE_PREVIEW && - asd->run_mode->val != ATOMISP_RUN_MODE_VIDEO)) - return IA_CSS_BUFFER_TYPE_OUTPUT_FRAME; - else - return IA_CSS_BUFFER_TYPE_VF_OUTPUT_FRAME; - } - if (pipe_id == IA_CSS_PIPE_ID_COPY || source_pad == ATOMISP_SUBDEV_PAD_SOURCE_CAPTURE || source_pad == ATOMISP_SUBDEV_PAD_SOURCE_VIDEO || @@ -424,12 +414,6 @@ int atomisp_qbuffers_to_css(struct atomisp_sub_device *asd) atomisp_subdev_source_pad(&capture_pipe->vdev)); input_stream_id = ATOMISP_INPUT_STREAM_GENERAL; - /* - * use yuvpp pipe for SOC camera. - */ - if (ATOMISP_USE_YUVPP(asd)) - css_capture_pipe_id = IA_CSS_PIPE_ID_YUVPP; - atomisp_q_video_buffers_to_css(asd, capture_pipe, input_stream_id, buf_type, css_capture_pipe_id); @@ -444,11 +428,6 @@ int atomisp_qbuffers_to_css(struct atomisp_sub_device *asd) else input_stream_id = ATOMISP_INPUT_STREAM_GENERAL; - /* - * use yuvpp pipe for SOC camera. - */ - if (ATOMISP_USE_YUVPP(asd)) - css_capture_pipe_id = IA_CSS_PIPE_ID_YUVPP; atomisp_q_video_buffers_to_css(asd, vf_pipe, input_stream_id, buf_type, css_capture_pipe_id); @@ -466,12 +445,6 @@ int atomisp_qbuffers_to_css(struct atomisp_sub_device *asd) else input_stream_id = ATOMISP_INPUT_STREAM_GENERAL; - /* - * use yuvpp pipe for SOC camera. - */ - if (ATOMISP_USE_YUVPP(asd)) - css_preview_pipe_id = IA_CSS_PIPE_ID_YUVPP; - atomisp_q_video_buffers_to_css(asd, preview_pipe, input_stream_id, buf_type, css_preview_pipe_id); @@ -486,12 +459,6 @@ int atomisp_qbuffers_to_css(struct atomisp_sub_device *asd) else input_stream_id = ATOMISP_INPUT_STREAM_GENERAL; - /* - * use yuvpp pipe for SOC camera. - */ - if (ATOMISP_USE_YUVPP(asd)) - css_video_pipe_id = IA_CSS_PIPE_ID_YUVPP; - atomisp_q_video_buffers_to_css(asd, video_pipe, input_stream_id, buf_type, css_video_pipe_id); diff --git a/drivers/staging/media/atomisp/pci/atomisp_internal.h b/drivers/staging/media/atomisp/pci/atomisp_internal.h index 1c1c4cf..681a925 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_internal.h +++ b/drivers/staging/media/atomisp/pci/atomisp_internal.h @@ -117,8 +117,6 @@ #define ATOMISP_CSS_OUTPUT_SECOND_INDEX 1 #define ATOMISP_CSS_OUTPUT_DEFAULT_INDEX 0 -#define ATOMISP_USE_YUVPP(asd) false - /* ISP2401 */ #define ATOMISP_ION_DEVICE_FD_OFFSET 16 #define ATOMISP_ION_SHARED_FD_MASK (0xFFFF) diff --git a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c index 87e9b0b..99cfe8a 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c +++ b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c @@ -1120,9 +1120,6 @@ static int atomisp_dqbuf_wrapper(struct file *file, void *fh, struct v4l2_buffer enum ia_css_pipe_id atomisp_get_css_pipe_id(struct atomisp_sub_device *asd) { - if (ATOMISP_USE_YUVPP(asd)) - return IA_CSS_PIPE_ID_YUVPP; - /* * Disable vf_pp and run CSS in video mode. This allows using ISP * scaling but it has one frame delay due to CSS internal buffering. -- 2.7.4