]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
media: uvcvideo: Remove PLF device quirking
authorRicardo Ribalda <ribalda@chromium.org>
Mon, 10 Jun 2024 23:09:56 +0000 (23:09 +0000)
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Mon, 17 Jun 2024 20:21:12 +0000 (23:21 +0300)
We can use heuristics to figure out the proper range of the control
instead of quirking every single device.

Reviewed-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Ricardo Ribalda <ribalda@chromium.org>
drivers/media/usb/uvc/uvc_ctrl.c
drivers/media/usb/uvc/uvc_driver.c
drivers/media/usb/uvc/uvcvideo.h

index 024fa86ed2d5df9a5631b43ab3a51062c709c91b..2cc99a8b5c02868b886af178c1c24750f196ddc0 100644 (file)
@@ -459,7 +459,7 @@ static void uvc_ctrl_set_rel_speed(struct uvc_control_mapping *mapping,
        data[first+1] = min_t(int, abs(value), 0xff);
 }
 
-const struct uvc_control_mapping uvc_ctrl_power_line_mapping_limited = {
+static const struct uvc_control_mapping uvc_ctrl_power_line_mapping_limited = {
        .id             = V4L2_CID_POWER_LINE_FREQUENCY,
        .entity         = UVC_GUID_UVC_PROCESSING,
        .selector       = UVC_PU_POWER_LINE_FREQUENCY_CONTROL,
@@ -471,7 +471,7 @@ const struct uvc_control_mapping uvc_ctrl_power_line_mapping_limited = {
                                  V4L2_CID_POWER_LINE_FREQUENCY_50HZ),
 };
 
-const struct uvc_control_mapping uvc_ctrl_power_line_mapping_uvc11 = {
+static const struct uvc_control_mapping uvc_ctrl_power_line_mapping_uvc11 = {
        .id             = V4L2_CID_POWER_LINE_FREQUENCY,
        .entity         = UVC_GUID_UVC_PROCESSING,
        .selector       = UVC_PU_POWER_LINE_FREQUENCY_CONTROL,
index a557314d51453ddd6355892ddda1614e98547de9..f0febdc08c2d65208fca266c5d8d6b7c73394e77 100644 (file)
@@ -2400,20 +2400,6 @@ MODULE_PARM_DESC(timeout, "Streaming control requests timeout");
  * Driver initialization and cleanup
  */
 
-static const struct uvc_device_info uvc_ctrl_power_line_limited = {
-       .mappings = (const struct uvc_control_mapping *[]) {
-               &uvc_ctrl_power_line_mapping_limited,
-               NULL, /* Sentinel */
-       },
-};
-
-static const struct uvc_device_info uvc_ctrl_power_line_uvc11 = {
-       .mappings = (const struct uvc_control_mapping *[]) {
-               &uvc_ctrl_power_line_mapping_uvc11,
-               NULL, /* Sentinel */
-       },
-};
-
 static const struct uvc_device_info uvc_quirk_probe_minmax = {
        .quirks = UVC_QUIRK_PROBE_MINMAX,
 };
@@ -2444,33 +2430,6 @@ static const struct uvc_device_info uvc_quirk_force_y8 = {
  * though they are compliant.
  */
 static const struct usb_device_id uvc_ids[] = {
-       /* Quanta USB2.0 HD UVC Webcam */
-       { .match_flags          = USB_DEVICE_ID_MATCH_DEVICE
-                               | USB_DEVICE_ID_MATCH_INT_INFO,
-         .idVendor             = 0x0408,
-         .idProduct            = 0x3090,
-         .bInterfaceClass      = USB_CLASS_VIDEO,
-         .bInterfaceSubClass   = 1,
-         .bInterfaceProtocol   = 0,
-         .driver_info          = (kernel_ulong_t)&uvc_ctrl_power_line_limited },
-       /* Quanta USB2.0 HD UVC Webcam */
-       { .match_flags          = USB_DEVICE_ID_MATCH_DEVICE
-                               | USB_DEVICE_ID_MATCH_INT_INFO,
-         .idVendor             = 0x0408,
-         .idProduct            = 0x4030,
-         .bInterfaceClass      = USB_CLASS_VIDEO,
-         .bInterfaceSubClass   = 1,
-         .bInterfaceProtocol   = 0,
-         .driver_info          = (kernel_ulong_t)&uvc_ctrl_power_line_limited },
-       /* Quanta USB2.0 HD UVC Webcam */
-       { .match_flags          = USB_DEVICE_ID_MATCH_DEVICE
-                               | USB_DEVICE_ID_MATCH_INT_INFO,
-         .idVendor             = 0x0408,
-         .idProduct            = 0x4034,
-         .bInterfaceClass      = USB_CLASS_VIDEO,
-         .bInterfaceSubClass   = 1,
-         .bInterfaceProtocol   = UVC_PC_PROTOCOL_15,
-         .driver_info          = (kernel_ulong_t)&uvc_ctrl_power_line_limited },
        /* Quanta ACER HD User Facing */
        { .match_flags          = USB_DEVICE_ID_MATCH_DEVICE
                                | USB_DEVICE_ID_MATCH_INT_INFO,
@@ -2648,42 +2607,6 @@ static const struct usb_device_id uvc_ids[] = {
          .bInterfaceSubClass   = 1,
          .bInterfaceProtocol   = 0,
          .driver_info          = UVC_INFO_QUIRK(UVC_QUIRK_RESTRICT_FRAME_RATE) },
-       /* Chicony EasyCamera */
-       { .match_flags          = USB_DEVICE_ID_MATCH_DEVICE
-                               | USB_DEVICE_ID_MATCH_INT_INFO,
-         .idVendor             = 0x04f2,
-         .idProduct            = 0xb5eb,
-         .bInterfaceClass      = USB_CLASS_VIDEO,
-         .bInterfaceSubClass   = 1,
-         .bInterfaceProtocol   = 0,
-         .driver_info          = (kernel_ulong_t)&uvc_ctrl_power_line_limited },
-       /* Chicony Electronics Co., Ltd Integrated Camera */
-       { .match_flags          = USB_DEVICE_ID_MATCH_DEVICE
-                               | USB_DEVICE_ID_MATCH_INT_INFO,
-         .idVendor             = 0x04f2,
-         .idProduct            = 0xb67c,
-         .bInterfaceClass      = USB_CLASS_VIDEO,
-         .bInterfaceSubClass   = 1,
-         .bInterfaceProtocol   = UVC_PC_PROTOCOL_15,
-         .driver_info          = (kernel_ulong_t)&uvc_ctrl_power_line_uvc11 },
-       /* Chicony EasyCamera */
-       { .match_flags          = USB_DEVICE_ID_MATCH_DEVICE
-                               | USB_DEVICE_ID_MATCH_INT_INFO,
-         .idVendor             = 0x04f2,
-         .idProduct            = 0xb6ba,
-         .bInterfaceClass      = USB_CLASS_VIDEO,
-         .bInterfaceSubClass   = 1,
-         .bInterfaceProtocol   = 0,
-         .driver_info          = (kernel_ulong_t)&uvc_ctrl_power_line_limited },
-       /* Chicony EasyCamera */
-       { .match_flags          = USB_DEVICE_ID_MATCH_DEVICE
-                               | USB_DEVICE_ID_MATCH_INT_INFO,
-         .idVendor             = 0x04f2,
-         .idProduct            = 0xb746,
-         .bInterfaceClass      = USB_CLASS_VIDEO,
-         .bInterfaceSubClass   = 1,
-         .bInterfaceProtocol   = 0,
-         .driver_info          = (kernel_ulong_t)&uvc_ctrl_power_line_limited },
        /* Alcor Micro AU3820 (Future Boy PC USB Webcam) */
        { .match_flags          = USB_DEVICE_ID_MATCH_DEVICE
                                | USB_DEVICE_ID_MATCH_INT_INFO,
@@ -3068,15 +2991,6 @@ static const struct usb_device_id uvc_ids[] = {
          .bInterfaceSubClass   = 1,
          .bInterfaceProtocol   = 0,
          .driver_info          = UVC_INFO_QUIRK(UVC_QUIRK_FORCE_BPP) },
-       /* SunplusIT Inc HD Camera */
-       { .match_flags          = USB_DEVICE_ID_MATCH_DEVICE
-                               | USB_DEVICE_ID_MATCH_INT_INFO,
-         .idVendor             = 0x2b7e,
-         .idProduct            = 0xb752,
-         .bInterfaceClass      = USB_CLASS_VIDEO,
-         .bInterfaceSubClass   = 1,
-         .bInterfaceProtocol   = UVC_PC_PROTOCOL_15,
-         .driver_info          = (kernel_ulong_t)&uvc_ctrl_power_line_uvc11 },
        /* Insta360 Link */
        { .match_flags          = USB_DEVICE_ID_MATCH_DEVICE
                                | USB_DEVICE_ID_MATCH_INT_INFO,
@@ -3086,51 +3000,6 @@ static const struct usb_device_id uvc_ids[] = {
          .bInterfaceSubClass   = 1,
          .bInterfaceProtocol   = 0,
          .driver_info          = UVC_INFO_QUIRK(UVC_QUIRK_DISABLE_AUTOSUSPEND) },
-       /* Lenovo Integrated Camera */
-       { .match_flags          = USB_DEVICE_ID_MATCH_DEVICE
-                               | USB_DEVICE_ID_MATCH_INT_INFO,
-         .idVendor             = 0x30c9,
-         .idProduct            = 0x0093,
-         .bInterfaceClass      = USB_CLASS_VIDEO,
-         .bInterfaceSubClass   = 1,
-         .bInterfaceProtocol   = UVC_PC_PROTOCOL_15,
-         .driver_info          = (kernel_ulong_t)&uvc_ctrl_power_line_uvc11 },
-       /* Sonix Technology USB 2.0 Camera */
-       { .match_flags          = USB_DEVICE_ID_MATCH_DEVICE
-                               | USB_DEVICE_ID_MATCH_INT_INFO,
-         .idVendor             = 0x3277,
-         .idProduct            = 0x0072,
-         .bInterfaceClass      = USB_CLASS_VIDEO,
-         .bInterfaceSubClass   = 1,
-         .bInterfaceProtocol   = 0,
-         .driver_info          = (kernel_ulong_t)&uvc_ctrl_power_line_limited },
-       /* Shine-Optics Integrated Camera */
-       { .match_flags          = USB_DEVICE_ID_MATCH_DEVICE
-                               | USB_DEVICE_ID_MATCH_INT_INFO,
-         .idVendor             = 0x3277,
-         .idProduct            = 0x009e,
-         .bInterfaceClass      = USB_CLASS_VIDEO,
-         .bInterfaceSubClass   = 1,
-         .bInterfaceProtocol   = UVC_PC_PROTOCOL_15,
-         .driver_info          = (kernel_ulong_t)&uvc_ctrl_power_line_uvc11 },
-       /* Acer EasyCamera */
-       { .match_flags          = USB_DEVICE_ID_MATCH_DEVICE
-                               | USB_DEVICE_ID_MATCH_INT_INFO,
-         .idVendor             = 0x5986,
-         .idProduct            = 0x1172,
-         .bInterfaceClass      = USB_CLASS_VIDEO,
-         .bInterfaceSubClass   = 1,
-         .bInterfaceProtocol   = 0,
-         .driver_info          = (kernel_ulong_t)&uvc_ctrl_power_line_limited },
-       /* Acer EasyCamera */
-       { .match_flags          = USB_DEVICE_ID_MATCH_DEVICE
-                               | USB_DEVICE_ID_MATCH_INT_INFO,
-         .idVendor             = 0x5986,
-         .idProduct            = 0x1180,
-         .bInterfaceClass      = USB_CLASS_VIDEO,
-         .bInterfaceSubClass   = 1,
-         .bInterfaceProtocol   = 0,
-         .driver_info          = (kernel_ulong_t)&uvc_ctrl_power_line_limited },
        /* Intel D410/ASR depth camera */
        { .match_flags          = USB_DEVICE_ID_MATCH_DEVICE
                                | USB_DEVICE_ID_MATCH_INT_INFO,
index 5cf5e194efd9fa1488757b36584c616fb3125b48..d84933294e2ac91c1ee7bccafa569e89e468452c 100644 (file)
@@ -757,8 +757,6 @@ int uvc_status_start(struct uvc_device *dev, gfp_t flags);
 void uvc_status_stop(struct uvc_device *dev);
 
 /* Controls */
-extern const struct uvc_control_mapping uvc_ctrl_power_line_mapping_limited;
-extern const struct uvc_control_mapping uvc_ctrl_power_line_mapping_uvc11;
 extern const struct v4l2_subscribed_event_ops uvc_ctrl_sub_ev_ops;
 
 int uvc_query_v4l2_ctrl(struct uvc_video_chain *chain,