Re: [PATCH v7 6/6] media: uvcvideo: Fix hw timestamp handling for slow FPS

From: Sergey Senozhatsky
Date: Wed Mar 15 2023 - 08:36:23 EST


On (23/03/10 10:01), Ricardo Ribalda wrote:
[..]
> +++ b/drivers/media/usb/uvc/uvc_video.c
> @@ -473,6 +473,21 @@ static void uvc_video_clock_add_sample(struct uvc_clock *clock,
>
> spin_lock_irqsave(&clock->lock, flags);
>
> + /* Delete last overflows */
> + if (clock->head == clock->last_sof_overflow)
> + clock->last_sof_overflow = -1;
> +
> + /* Handle overflows */
> + if (clock->count > 0 && clock->last_sof > sample->dev_sof) {

Per offline discussion, we set clock->last_sof to sameple->dev_sof
right before uvc_video_clock_add_sample() so this condition is always
false. clock->sof needs to be updated after overflow handling checks.