Lines Matching defs:clock
526 if (dev_sof == stream->clock.last_sof)
529 stream->clock.last_sof = dev_sof;
554 if (stream->clock.sof_offset == (u16)-1) {
557 stream->clock.sof_offset = delta_sof;
559 stream->clock.sof_offset = 0;
562 dev_sof = (dev_sof + stream->clock.sof_offset) & 2047;
564 spin_lock_irqsave(&stream->clock.lock, flags);
566 sample = &stream->clock.samples[stream->clock.head];
573 stream->clock.head = (stream->clock.head + 1) % stream->clock.size;
575 if (stream->clock.count < stream->clock.size)
576 stream->clock.count++;
578 spin_unlock_irqrestore(&stream->clock.lock, flags);
583 struct uvc_clock *clock = &stream->clock;
585 clock->head = 0;
586 clock->count = 0;
587 clock->last_sof = -1;
588 clock->sof_offset = -1;
593 struct uvc_clock *clock = &stream->clock;
595 spin_lock_init(&clock->lock);
596 clock->size = 32;
598 clock->samples = kmalloc_array(clock->size, sizeof(*clock->samples),
600 if (clock->samples == NULL)
610 kfree(stream->clock.samples);
611 stream->clock.samples = NULL;
615 * uvc_video_clock_host_sof - Return the host SOF value for a clock sample
644 * This function converts the buffer PTS timestamp to the host clock domain by
645 * going through the USB SOF clock domain and stores the result in the V4L2
648 * The relationship between the device clock and the host clock isn't known.
649 * However, the device and the host share the common USB SOF clock which can be
652 * The relationship between the device clock and the USB SOF clock is considered
653 * to be linear over the clock samples sliding window and is given by
658 * the clock drift should be small compared to the sliding window size, we
677 * TODO: To avoid surprises with device clock values, PTS/STC timestamps should
678 * be normalized using the nominal device clock frequency reported through the
706 struct uvc_clock *clock = &stream->clock;
726 if (!clock->samples)
729 spin_lock_irqsave(&clock->lock, flags);
731 if (clock->count < clock->size)
734 first = &clock->samples[clock->head];
735 last = &clock->samples[(clock->head - 1) % clock->size];
760 x1, x2, y1, y2, clock->sof_offset);
762 /* Second step, SOF to host clock conversion. */
803 spin_unlock_irqrestore(&clock->lock, flags);
1345 !memcmp(scr, stream->clock.last_scr, 6)))
1357 memcpy(stream->clock.last_scr, scr, 6);