Lines Matching defs:clock

512 	if (dev_sof == stream->clock.last_sof)
515 stream->clock.last_sof = dev_sof;
539 if (stream->clock.sof_offset == (u16)-1) {
542 stream->clock.sof_offset = delta_sof;
544 stream->clock.sof_offset = 0;
547 dev_sof = (dev_sof + stream->clock.sof_offset) & 2047;
549 spin_lock_irqsave(&stream->clock.lock, flags);
551 sample = &stream->clock.samples[stream->clock.head];
558 stream->clock.head = (stream->clock.head + 1) % stream->clock.size;
560 if (stream->clock.count < stream->clock.size)
561 stream->clock.count++;
563 spin_unlock_irqrestore(&stream->clock.lock, flags);
568 struct uvc_clock *clock = &stream->clock;
570 clock->head = 0;
571 clock->count = 0;
572 clock->last_sof = -1;
573 clock->sof_offset = -1;
578 struct uvc_clock *clock = &stream->clock;
580 spin_lock_init(&clock->lock);
581 clock->size = 32;
583 clock->samples = kmalloc_array(clock->size, sizeof(*clock->samples),
585 if (clock->samples == NULL)
595 kfree(stream->clock.samples);
596 stream->clock.samples = NULL;
600 * uvc_video_clock_host_sof - Return the host SOF value for a clock sample
629 * This function converts the buffer PTS timestamp to the host clock domain by
630 * going through the USB SOF clock domain and stores the result in the V4L2
633 * The relationship between the device clock and the host clock isn't known.
634 * However, the device and the host share the common USB SOF clock which can be
637 * The relationship between the device clock and the USB SOF clock is considered
638 * to be linear over the clock samples sliding window and is given by
643 * the clock drift should be small compared to the sliding window size, we
662 * TODO: To avoid surprises with device clock values, PTS/STC timestamps should
663 * be normalized using the nominal device clock frequency reported through the
691 struct uvc_clock *clock = &stream->clock;
711 if (!clock->samples)
714 spin_lock_irqsave(&clock->lock, flags);
716 if (clock->count < clock->size)
719 first = &clock->samples[clock->head];
720 last = &clock->samples[(clock->head - 1) % clock->size];
745 x1, x2, y1, y2, clock->sof_offset);
747 /* Second step, SOF to host clock conversion. */
787 spin_unlock_irqrestore(&clock->lock, flags);
1297 !memcmp(scr, stream->clock.last_scr, 6)))
1309 memcpy(stream->clock.last_scr, scr, 6);