aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/media/video/uvc/uvc_video.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/media/video/uvc/uvc_video.c b/drivers/media/video/uvc/uvc_video.c
index c7e69b8f81c9..4a44f9a1bae0 100644
--- a/drivers/media/video/uvc/uvc_video.c
+++ b/drivers/media/video/uvc/uvc_video.c
@@ -611,9 +611,11 @@ void uvc_video_clock_update(struct uvc_streaming *stream,
611 delta_stc = buf->pts - (1UL << 31); 611 delta_stc = buf->pts - (1UL << 31);
612 x1 = first->dev_stc - delta_stc; 612 x1 = first->dev_stc - delta_stc;
613 x2 = last->dev_stc - delta_stc; 613 x2 = last->dev_stc - delta_stc;
614 if (x1 == x2)
615 goto done;
616
614 y1 = (first->dev_sof + 2048) << 16; 617 y1 = (first->dev_sof + 2048) << 16;
615 y2 = (last->dev_sof + 2048) << 16; 618 y2 = (last->dev_sof + 2048) << 16;
616
617 if (y2 < y1) 619 if (y2 < y1)
618 y2 += 2048 << 16; 620 y2 += 2048 << 16;
619 621
@@ -631,14 +633,16 @@ void uvc_video_clock_update(struct uvc_streaming *stream,
631 x1, x2, y1, y2, clock->sof_offset); 633 x1, x2, y1, y2, clock->sof_offset);
632 634
633 /* Second step, SOF to host clock conversion. */ 635 /* Second step, SOF to host clock conversion. */
634 ts = timespec_sub(last->host_ts, first->host_ts);
635 x1 = (uvc_video_clock_host_sof(first) + 2048) << 16; 636 x1 = (uvc_video_clock_host_sof(first) + 2048) << 16;
636 x2 = (uvc_video_clock_host_sof(last) + 2048) << 16; 637 x2 = (uvc_video_clock_host_sof(last) + 2048) << 16;
637 y1 = NSEC_PER_SEC;
638 y2 = (ts.tv_sec + 1) * NSEC_PER_SEC + ts.tv_nsec;
639
640 if (x2 < x1) 638 if (x2 < x1)
641 x2 += 2048 << 16; 639 x2 += 2048 << 16;
640 if (x1 == x2)
641 goto done;
642
643 ts = timespec_sub(last->host_ts, first->host_ts);
644 y1 = NSEC_PER_SEC;
645 y2 = (ts.tv_sec + 1) * NSEC_PER_SEC + ts.tv_nsec;
642 646
643 /* Interpolated and host SOF timestamps can wrap around at slightly 647 /* Interpolated and host SOF timestamps can wrap around at slightly
644 * different times. Handle this by adding or removing 2048 to or from 648 * different times. Handle this by adding or removing 2048 to or from