From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 567DD40B112; Tue, 21 Jul 2026 17:38:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784655495; cv=none; b=BhFPz/IHi5Uzp967sjszkxpfacYVNW0Gr8WR5pR5IbCRPkVTcC9Fr6OVshK+bsr7zfZ5ReAJf7LW6bGP5k1rQmY3n/zLkgds+Sh04RxxOO3yCjqugNokjKlXv35u2yVgTSlZ7aD05eDWm5NUVHbQLzPB/R/fQ2rYWam5Jaup6bQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784655495; c=relaxed/simple; bh=UfQXYNbIyGYkKL0WGs28iTuyMXzwjNEvPUGaHsK17+U=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=k9Ybgw9Qht42RWQ24zrc2oNc0gU1JnwlweIE+1MJGWvrAkNNleRnF2uCbUyFINcd5Slf8UfIo2IKkUr1PI4fSg9Vjk/g5eRSHtLWd+3qLzfTUVd3qYwU4k35UbSDAajOFXr8PHQ2pnPAVzAE0YPjd0jT4uAVnOrwh1sVbfPTZZw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=w5AvVWef; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="w5AvVWef" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BA05D1F000E9; Tue, 21 Jul 2026 17:38:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784655494; bh=6bGLr6uvWTSYGg0jgu1x3S0ALhw/U1Gpge+Sxs7+E7c=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=w5AvVWefQdHhhArtSGwaT7h4bt4lJAnL+dM6I1OWEjxNafSCf4S3IJqeF5Ms6FHCM 28v7GoSSr7hVWGclHOc8DiSfXWYT0Fl4T/iwmeOuEqEvZ8CsHSyM/373sJ+WvDC1xm aVuu8s3dDXQh14vcclgxShp9VyBw5UWisQhSPnU0= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Hans de Goede , Yunke Cao , Ricardo Ribalda , Hans Verkuil Subject: [PATCH 6.18 0030/1611] media: uvcvideo: Relax the constrains for interpolating the hw clock Date: Tue, 21 Jul 2026 17:02:26 +0200 Message-ID: <20260721152515.488740585@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260721152514.750365251@linuxfoundation.org> References: <20260721152514.750365251@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Ricardo Ribalda commit 1719d78f832dda8dd3f09a867ba74e05d6f11308 upstream. In the initial version we set the min value to 250msec. Looks like 100msec can also provide a good value. Now that we are at it, add a macro to make it cleaner. Fixes: 6243c83be6ee8 ("media: uvcvideo: Allow hw clock updates with buffers not full") Cc: stable@vger.kernel.org Reviewed-by: Hans de Goede Tested-by: Yunke Cao Signed-off-by: Ricardo Ribalda Link: https://patch.msgid.link/20260513-uvc-hwtimestamp-v3-3-7a64838b0b02@chromium.org Signed-off-by: Hans de Goede Signed-off-by: Hans Verkuil Signed-off-by: Greg Kroah-Hartman --- drivers/media/usb/uvc/uvc_video.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) --- a/drivers/media/usb/uvc/uvc_video.c +++ b/drivers/media/usb/uvc/uvc_video.c @@ -494,6 +494,13 @@ static int uvc_commit_video(struct uvc_s * Clocks and timestamps */ +/* + * The accuracy of the hardware timestamping depends on having enough data to + * interpolate between the different clock domains. This value is sof cycles, + * this is, milliseconds. + */ +#define UVC_MIN_HW_TIMESTAMP_DIFF 100 + static inline ktime_t uvc_video_get_time(void) { if (uvc_clock_param == CLOCK_MONOTONIC) @@ -854,13 +861,13 @@ void uvc_video_clock_update(struct uvc_s * buffer, but RAM is expensive these days, specially the infinitely * big. * - * The value of 1/4th of a second was determined by running Android's - * CTS on different devices. + * The value of UVC_MIN_HW_TIMESTAMP_DIFF was determined by running + * Android's CTS on different devices. * - * dev_sof runs at 1KHz, and we have a fixed point precision of - * 16 bits. + * y1 and y2 are dev_sof with a fixed point precision of 16 bits. */ - if (clock->size != clock->count && (y2 - y1) < ((1000 / 4) << 16)) + if (clock->size != clock->count && + (y2 - y1) < (UVC_MIN_HW_TIMESTAMP_DIFF << 16)) goto done; y = (u64)(y2 - y1) * (1ULL << 31) + (u64)y1 * (u64)x2