From fa8730b06cb3e40c8fbc265202a10849146470b5 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Sun, 5 Mar 2023 17:57:45 +0000 Subject: [PATCH] media: atomisp: Remove custom V4L2_CID_FMT_AUTO control The custom V4L2_CID_FMT_AUTO control, which defaults to true controls whether the atomisp driver will automatically configure the sensor and ISP settings to match. This is necessary to make normal v4l2 apps to work. We do eventually want to add libcamera support, but even then moving this to userspace does not give any added value, while breaking classic v4l2 apps. Moreover we really don't know all the exact pipeline constraints, so moving this to userspace/libcamera will be tricky thus it is best to keep the current in kernel code for this and make the kernel unconditionally do this. Reviewed-by: Andy Shevchenko Signed-off-by: Hans de Goede Signed-off-by: Mauro Carvalho Chehab --- .../staging/media/atomisp/include/linux/atomisp.h | 2 -- drivers/staging/media/atomisp/pci/atomisp_cmd.c | 8 +------- drivers/staging/media/atomisp/pci/atomisp_fops.c | 2 +- drivers/staging/media/atomisp/pci/atomisp_subdev.c | 13 ------------- drivers/staging/media/atomisp/pci/atomisp_subdev.h | 1 - 5 files changed, 2 insertions(+), 24 deletions(-) diff --git a/drivers/staging/media/atomisp/include/linux/atomisp.h b/drivers/staging/media/atomisp/include/linux/atomisp.h index b3cceea570cab..c7ec56a1c0640 100644 --- a/drivers/staging/media/atomisp/include/linux/atomisp.h +++ b/drivers/staging/media/atomisp/include/linux/atomisp.h @@ -1056,8 +1056,6 @@ struct atomisp_sensor_ae_bracketing_lut { #define V4L2_2A_STATUS_AE_READY BIT(0) #define V4L2_2A_STATUS_AWB_READY BIT(1) -#define V4L2_CID_FMT_AUTO (V4L2_CID_CAMERA_LASTP1 + 19) - #define V4L2_CID_RUN_MODE (V4L2_CID_CAMERA_LASTP1 + 20) #define ATOMISP_RUN_MODE_VIDEO 1 #define ATOMISP_RUN_MODE_STILL_CAPTURE 2 diff --git a/drivers/staging/media/atomisp/pci/atomisp_cmd.c b/drivers/staging/media/atomisp/pci/atomisp_cmd.c index 9cb3c0948914e..70790eb55d63b 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_cmd.c +++ b/drivers/staging/media/atomisp/pci/atomisp_cmd.c @@ -4280,8 +4280,7 @@ static int atomisp_set_fmt_to_isp(struct video_device *vdev, * Configure viewfinder also when vfpp is disabled: the * CSS still requires viewfinder configuration. */ - if (asd->fmt_auto->val || - asd->vfpp->val != ATOMISP_VFPP_ENABLE) { + { struct v4l2_rect vf_size = {0}; struct v4l2_mbus_framefmt vf_ffmt = {0}; @@ -4630,10 +4629,6 @@ int atomisp_set_fmt(struct video_device *vdev, struct v4l2_format *f) snr_fmt = f->fmt.pix; backup_fmt = snr_fmt; - /* Pipeline configuration done through subdevs. Bail out now. */ - if (!asd->fmt_auto->val) - goto set_fmt_to_isp; - /* get sensor resolution and format */ ret = atomisp_try_fmt(vdev, &snr_fmt, &res_overflow); if (ret) { @@ -4794,7 +4789,6 @@ int atomisp_set_fmt(struct video_device *vdev, struct v4l2_format *f) &main_compose); } -set_fmt_to_isp: ret = atomisp_set_fmt_to_isp(vdev, &output_info, &f->fmt.pix, source_pad); if (ret) { dev_warn(isp->dev, "Can't set format on ISP. Error %d\n", ret); diff --git a/drivers/staging/media/atomisp/pci/atomisp_fops.c b/drivers/staging/media/atomisp/pci/atomisp_fops.c index 7f757f510190f..e220f500aff48 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_fops.c +++ b/drivers/staging/media/atomisp/pci/atomisp_fops.c @@ -711,7 +711,7 @@ static int atomisp_release(struct file *file) * The sink pad setting can only be cleared when all device nodes * get released. */ - if (asd->fmt_auto->val) { + { struct v4l2_mbus_framefmt isp_sink_fmt = { 0 }; atomisp_subdev_set_ffmt(&asd->subdev, fh.state, diff --git a/drivers/staging/media/atomisp/pci/atomisp_subdev.c b/drivers/staging/media/atomisp/pci/atomisp_subdev.c index 3719918830767..011e67ccdbbaf 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_subdev.c +++ b/drivers/staging/media/atomisp/pci/atomisp_subdev.c @@ -754,17 +754,6 @@ static const struct v4l2_ctrl_ops ctrl_ops = { .s_ctrl = &s_ctrl, }; -static const struct v4l2_ctrl_config ctrl_fmt_auto = { - .ops = &ctrl_ops, - .id = V4L2_CID_FMT_AUTO, - .name = "Automatic format guessing", - .type = V4L2_CTRL_TYPE_BOOLEAN, - .min = 0, - .max = 1, - .step = 1, - .def = 1, -}; - static const char *const ctrl_run_mode_menu[] = { NULL, "Video", @@ -1000,8 +989,6 @@ static int isp_subdev_init_entities(struct atomisp_sub_device *asd) if (ret) return ret; - asd->fmt_auto = v4l2_ctrl_new_custom(&asd->ctrl_handler, - &ctrl_fmt_auto, NULL); asd->run_mode = v4l2_ctrl_new_custom(&asd->ctrl_handler, &ctrl_run_mode, NULL); asd->vfpp = v4l2_ctrl_new_custom(&asd->ctrl_handler, diff --git a/drivers/staging/media/atomisp/pci/atomisp_subdev.h b/drivers/staging/media/atomisp/pci/atomisp_subdev.h index bcb0fe8d05387..117803f3cbd10 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_subdev.h +++ b/drivers/staging/media/atomisp/pci/atomisp_subdev.h @@ -259,7 +259,6 @@ struct atomisp_sub_device { /* struct isp_subdev_params params; */ struct atomisp_device *isp; struct v4l2_ctrl_handler ctrl_handler; - struct v4l2_ctrl *fmt_auto; struct v4l2_ctrl *run_mode; struct v4l2_ctrl *vfpp; struct v4l2_ctrl *continuous_raw_buffer_size; -- 2.30.2