hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/drivers/media/usb/uvc/uvc_video.c
....@@ -20,6 +20,7 @@
2020 #include <media/v4l2-common.h>
2121
2222 #include "uvcvideo.h"
23
+#include <soc/rockchip/rockchip-system-status.h>
2324
2425 /* ------------------------------------------------------------------------
2526 * UVC Controls
....@@ -1308,7 +1309,9 @@
13081309 if (has_scr)
13091310 memcpy(stream->clock.last_scr, scr, 6);
13101311
1311
- memcpy(&meta->length, mem, length);
1312
+ meta->length = mem[0];
1313
+ meta->flags = mem[1];
1314
+ memcpy(meta->buf, &mem[2], length - 2);
13121315 meta_buf->bytesused += length + sizeof(meta->ns) + sizeof(meta->sof);
13131316
13141317 uvc_trace(UVC_TRACE_FRAME,
....@@ -1903,6 +1906,17 @@
19031906 uvc_trace(UVC_TRACE_VIDEO, "Selecting alternate setting %u "
19041907 "(%u B/frame bandwidth).\n", altsetting, best_psize);
19051908
1909
+ /*
1910
+ * Some devices, namely the Logitech C910 and B910, are unable
1911
+ * to recover from a USB autosuspend, unless the alternate
1912
+ * setting of the streaming interface is toggled.
1913
+ */
1914
+ if (stream->dev->quirks & UVC_QUIRK_WAKE_AUTOSUSPEND) {
1915
+ usb_set_interface(stream->dev->udev, intfnum,
1916
+ altsetting);
1917
+ usb_set_interface(stream->dev->udev, intfnum, 0);
1918
+ }
1919
+
19061920 ret = usb_set_interface(stream->dev->udev, intfnum, altsetting);
19071921 if (ret < 0)
19081922 return ret;
....@@ -2126,6 +2140,8 @@
21262140 if (ret < 0)
21272141 goto error_commit;
21282142
2143
+ rockchip_set_system_status(SYS_STATUS_PERFORMANCE);
2144
+
21292145 ret = uvc_video_start_transfer(stream, GFP_KERNEL);
21302146 if (ret < 0)
21312147 goto error_video;
....@@ -2133,6 +2149,7 @@
21332149 return 0;
21342150
21352151 error_video:
2152
+ rockchip_clear_system_status(SYS_STATUS_PERFORMANCE);
21362153 usb_set_interface(stream->dev->udev, stream->intfnum, 0);
21372154 error_commit:
21382155 uvc_video_clock_cleanup(stream);
....@@ -2163,4 +2180,5 @@
21632180 }
21642181
21652182 uvc_video_clock_cleanup(stream);
2183
+ rockchip_clear_system_status(SYS_STATUS_PERFORMANCE);
21662184 }