Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

media: atomisp: Remove support for custom run-mode v4l2-ctrl on sensors

Remove the support to update a V4L2_CID_RUN_MODE run-mode control
on sensors when changing the atomisp run-mode or directly by calling
the custom ATOMISP_IOC_S_SENSOR_RUNMODE IOCTL.

No sensor drivers implement this and having custom controls / IOCTLs
is undesirable.

Even if there was such a control on sensors then userspace should directly
talk to the sensor v4l2-subdev, rather than relying on a custom IOCTLs
on the output /dev/video# node to pass this through to the senor.

Link: https://lore.kernel.org/r/20230619105212.303653-6-hdegoede@redhat.com

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Andy Shevchenko <andy@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>

authored by

Hans de Goede and committed by
Mauro Carvalho Chehab
b6da9e5a 2ffb2e64

-107
-10
drivers/staging/media/atomisp/include/linux/atomisp.h
··· 713 713 #define EXT_ISP_SHOT_MODE_ANIMATED_PHOTO 10 714 714 #define EXT_ISP_SHOT_MODE_SPORTS 11 715 715 716 - /* 717 - * Set Senor run mode 718 - */ 719 - struct atomisp_s_runmode { 720 - __u32 mode; 721 - }; 722 - 723 716 /*Private IOCTLs for ISP */ 724 717 #define ATOMISP_IOC_G_XNR \ 725 718 _IOR('v', BASE_VIDIOC_PRIVATE + 0, int) ··· 867 874 868 875 #define ATOMISP_IOC_S_SENSOR_EE_CONFIG \ 869 876 _IOW('v', BASE_VIDIOC_PRIVATE + 47, unsigned int) 870 - 871 - #define ATOMISP_IOC_S_SENSOR_RUNMODE \ 872 - _IOW('v', BASE_VIDIOC_PRIVATE + 48, struct atomisp_s_runmode) 873 877 874 878 /* 875 879 * Reserved ioctls. We have customer implementing it internally.
-22
drivers/staging/media/atomisp/pci/atomisp_cmd.c
··· 1248 1248 atomisp_css_capture_set_mode(asd, IA_CSS_CAPTURE_MODE_PRIMARY); 1249 1249 } 1250 1250 1251 - /* ISP2401 */ 1252 - int atomisp_set_sensor_runmode(struct atomisp_sub_device *asd, 1253 - struct atomisp_s_runmode *runmode) 1254 - { 1255 - struct atomisp_device *isp = asd->isp; 1256 - struct v4l2_ctrl *c; 1257 - int ret = 0; 1258 - 1259 - if (!(runmode && (runmode->mode & RUNMODE_MASK))) 1260 - return -EINVAL; 1261 - 1262 - mutex_lock(asd->ctrl_handler.lock); 1263 - c = v4l2_ctrl_find(isp->inputs[asd->input_curr].camera->ctrl_handler, 1264 - V4L2_CID_RUN_MODE); 1265 - 1266 - if (c) 1267 - ret = v4l2_ctrl_s_ctrl(c, runmode->mode); 1268 - 1269 - mutex_unlock(asd->ctrl_handler.lock); 1270 - return ret; 1271 - } 1272 - 1273 1251 /* 1274 1252 * Function to enable/disable lens geometry distortion correction (GDC) and 1275 1253 * chromatic aberration correction (CAC)
-13
drivers/staging/media/atomisp/pci/atomisp_cmd.h
··· 42 42 #define INTR_IER 24 43 43 #define INTR_IIR 16 44 44 45 - /* ISP2401 */ 46 - #define RUNMODE_MASK (ATOMISP_RUN_MODE_VIDEO | ATOMISP_RUN_MODE_STILL_CAPTURE \ 47 - | ATOMISP_RUN_MODE_PREVIEW) 48 - 49 - /* FIXME: check if can go */ 50 - extern int atomisp_punit_hpll_freq; 51 - 52 45 /* Helper function */ 53 46 void dump_sp_dmem(struct atomisp_device *isp, unsigned int addr, 54 47 unsigned int size); ··· 70 77 71 78 /* ISP features control function */ 72 79 73 - /* 74 - * Function to set sensor runmode by user when 75 - * ATOMISP_IOC_S_SENSOR_RUNMODE ioctl was called 76 - */ 77 - int atomisp_set_sensor_runmode(struct atomisp_sub_device *asd, 78 - struct atomisp_s_runmode *runmode); 79 80 /* 80 81 * Function to enable/disable lens geometry distortion correction (GDC) and 81 82 * chromatic aberration correction (CAC)
-12
drivers/staging/media/atomisp/pci/atomisp_ioctl.c
··· 665 665 dev_err(isp->dev, "Failed to power-on sensor\n"); 666 666 return ret; 667 667 } 668 - /* 669 - * Some sensor driver resets the run mode during power-on, thus force 670 - * update the run mode to sensor after power-on. 671 - */ 672 - atomisp_update_run_mode(asd); 673 668 674 669 /* select operating sensor */ 675 670 ret = v4l2_subdev_call(isp->inputs[input].camera, video, s_routing, ··· 1779 1784 int err; 1780 1785 1781 1786 switch (cmd) { 1782 - case ATOMISP_IOC_S_SENSOR_RUNMODE: 1783 - if (IS_ISP2401) 1784 - err = atomisp_set_sensor_runmode(asd, arg); 1785 - else 1786 - err = -EINVAL; 1787 - break; 1788 - 1789 1787 case ATOMISP_IOC_G_XNR: 1790 1788 err = atomisp_xnr(asd, 0, arg); 1791 1789 break;
-48
drivers/staging/media/atomisp/pci/atomisp_subdev.c
··· 663 663 /* .set_power = v4l2_subdev_set_power, */ 664 664 }; 665 665 666 - static int __atomisp_update_run_mode(struct atomisp_sub_device *asd) 667 - { 668 - struct atomisp_device *isp = asd->isp; 669 - struct v4l2_ctrl *ctrl = asd->run_mode; 670 - struct v4l2_ctrl *c; 671 - s32 mode; 672 - 673 - mode = ctrl->val; 674 - 675 - c = v4l2_ctrl_find( 676 - isp->inputs[asd->input_curr].camera->ctrl_handler, 677 - V4L2_CID_RUN_MODE); 678 - 679 - if (c) 680 - return v4l2_ctrl_s_ctrl(c, mode); 681 - 682 - return 0; 683 - } 684 - 685 - int atomisp_update_run_mode(struct atomisp_sub_device *asd) 686 - { 687 - int rval; 688 - 689 - mutex_lock(asd->ctrl_handler.lock); 690 - rval = __atomisp_update_run_mode(asd); 691 - mutex_unlock(asd->ctrl_handler.lock); 692 - 693 - return rval; 694 - } 695 - 696 - static int s_ctrl(struct v4l2_ctrl *ctrl) 697 - { 698 - struct atomisp_sub_device *asd = container_of( 699 - ctrl->handler, struct atomisp_sub_device, ctrl_handler); 700 - switch (ctrl->id) { 701 - case V4L2_CID_RUN_MODE: 702 - return __atomisp_update_run_mode(asd); 703 - } 704 - 705 - return 0; 706 - } 707 - 708 - static const struct v4l2_ctrl_ops ctrl_ops = { 709 - .s_ctrl = &s_ctrl, 710 - }; 711 - 712 666 static const char *const ctrl_run_mode_menu[] = { 713 667 [ATOMISP_RUN_MODE_VIDEO] = "Video", 714 668 [ATOMISP_RUN_MODE_STILL_CAPTURE] = "Still capture", ··· 670 716 }; 671 717 672 718 static const struct v4l2_ctrl_config ctrl_run_mode = { 673 - .ops = &ctrl_ops, 674 719 .id = V4L2_CID_RUN_MODE, 675 720 .name = "Atomisp run mode", 676 721 .type = V4L2_CTRL_TYPE_MENU, ··· 707 754 * the CSS subsystem. 708 755 */ 709 756 static const struct v4l2_ctrl_config ctrl_continuous_raw_buffer_size = { 710 - .ops = &ctrl_ops, 711 757 .id = V4L2_CID_ATOMISP_CONTINUOUS_RAW_BUFFER_SIZE, 712 758 .type = V4L2_CTRL_TYPE_INTEGER, 713 759 .name = "Continuous raw ringbuffer size",
-2
drivers/staging/media/atomisp/pci/atomisp_subdev.h
··· 360 360 uint32_t which, 361 361 u32 pad, struct v4l2_mbus_framefmt *ffmt); 362 362 363 - int atomisp_update_run_mode(struct atomisp_sub_device *asd); 364 - 365 363 void atomisp_subdev_cleanup_pending_events(struct atomisp_sub_device *asd); 366 364 367 365 void atomisp_subdev_unregister_entities(struct atomisp_sub_device *asd);