media: uvcvideo: Fix power line control for Lenovo Integrated Camera
authorRicardo Ribalda <ribalda@chromium.org>
Thu, 5 Jan 2023 13:52:57 +0000 (14:52 +0100)
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Sun, 15 Jan 2023 21:45:14 +0000 (23:45 +0200)
The device does not implement the power line frequenyc control
correctly. It is a UVC 1.5 device, but implements the control as a UVC
1.1 device.

Add the corresponding control mapping override.

Bus 003 Device 002: ID 30c9:0093 Lenovo Integrated Camera
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.01
  bDeviceClass          239 Miscellaneous Device
  bDeviceSubClass         2
  bDeviceProtocol         1 Interface Association
  bMaxPacketSize0        64
  idVendor           0x30c9
  idProduct          0x0093
  bcdDevice            0.07
  iManufacturer           3 Lenovo
  iProduct                1 Integrated Camera
  iSerial                 2 8SSC21J75356V1SR2830069
  bNumConfigurations      1

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>
drivers/media/usb/uvc/uvc_ctrl.c
drivers/media/usb/uvc/uvc_driver.c
drivers/media/usb/uvc/uvcvideo.h

index c15c38427cc3a19958b6679143fb1b92d65972ac..6354efffe9b05ae14c6a3fdf9b0b7a2d17e8bd2d 100644 (file)
@@ -736,7 +736,7 @@ const struct uvc_control_mapping uvc_ctrl_power_line_mapping_limited = {
                                  V4L2_CID_POWER_LINE_FREQUENCY_50HZ),
 };
 
-static const struct uvc_control_mapping uvc_ctrl_power_line_mapping_uvc11 = {
+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 370b46c98108517f531f28c99be29033757cda62..6005e3c7eb960a38d86e8c4fa3a2aa2e2f29e68a 100644 (file)
@@ -2365,6 +2365,13 @@ static const struct uvc_device_info uvc_ctrl_power_line_limited = {
        },
 };
 
+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,
 };
@@ -2944,6 +2951,15 @@ static const struct usb_device_id uvc_ids[] = {
          .bInterfaceSubClass   = 1,
          .bInterfaceProtocol   = 0,
          .driver_info          = UVC_INFO_QUIRK(UVC_QUIRK_FORCE_BPP) },
+       /* 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,
index 6573df1e0a470cdccf391e6b2ee5e5791ee4b1c5..178729467967d1e3f06838b9e3259f2353edb2ef 100644 (file)
@@ -746,6 +746,7 @@ 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,