From patchwork Wed Mar 8 22:45:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 660840 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 08FDCC64EC4 for ; Wed, 8 Mar 2023 22:45:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229974AbjCHWpw (ORCPT ); Wed, 8 Mar 2023 17:45:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44940 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229952AbjCHWps (ORCPT ); Wed, 8 Mar 2023 17:45:48 -0500 Received: from mail-ed1-x532.google.com (mail-ed1-x532.google.com [IPv6:2a00:1450:4864:20::532]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 695CD91B71 for ; Wed, 8 Mar 2023 14:45:45 -0800 (PST) Received: by mail-ed1-x532.google.com with SMTP id i34so71909429eda.7 for ; Wed, 08 Mar 2023 14:45:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1678315544; h=cc:to:message-id:date:from:content-transfer-encoding:mime-version :subject:from:to:cc:subject:date:message-id:reply-to; bh=l1RIwBp0yJ5lH1L64wuQ7APSBGMzI08Fx77HiM0sRVY=; b=mgiP69T+eDIx6MSx9UoTePey0ChBWaMtS4KdAhzFRWQHE2Rog4S3k1vLd/vlxqBGbz lyahe//EWWag78QJy3z2hXAKRplZdKtK24sMw9EJ5XKqkwnkIhy62nyo4D2Wbr9r9Ctz wQOXp+h969P2Gb+xmICo5PMbp6iOM5d+B561A= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678315544; h=cc:to:message-id:date:from:content-transfer-encoding:mime-version :subject:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=l1RIwBp0yJ5lH1L64wuQ7APSBGMzI08Fx77HiM0sRVY=; b=cWUhu1GWC/rjyHr4tqTEPaIYceTkECZi0Q1f8EJvP7JFyredzI4Gem+d6+rqjI1E/4 ZTmT20FK6Ky4TDmFPswmSI7FsR7o1QllWAIN6WJ5vC1pJHekM41EH/RwCpsQUwyN7zZu 9iRF3byWd3LGWboi7KHASVNfzSGmYVy/+Q3bpkiKGxsiC+tWAGk8DjRDn8rZhfJ327+f O5rIj6+wlUhdk5lJE4/3rmXWG6ksO+UjE7dtSBrfvSv29K1+euQvWlwuk5muEvniQIE6 Gt7i2HF0DGaYHJ+xxup71UsP4vaU0a+108agKy13ooSPaHJ2jf6qk+urkcgHjcwxpE1w 4fTg== X-Gm-Message-State: AO0yUKVr8G/AZxi8WDepSuCk7a/UW5fa3RMy2On3YY9j09XijGooXs7x eNow1gIcCJy7dq7EtWIoq38ZNw== X-Google-Smtp-Source: AK7set9JOYdRL0/NqQbuA2tqbVxLqz2WxBXtC/Mhnbn4bxIrUqE2XEYic9yx9qejTKYXp7nSZNPV+A== X-Received: by 2002:a17:906:4bcd:b0:8b1:812f:2578 with SMTP id x13-20020a1709064bcd00b008b1812f2578mr17599087ejv.45.1678315543904; Wed, 08 Mar 2023 14:45:43 -0800 (PST) Received: from alco.roam.corp.google.com (80.71.134.83.ipv4.parknet.dk. [80.71.134.83]) by smtp.gmail.com with ESMTPSA id ot18-20020a170906ccd200b008e40853a712sm8040167ejb.97.2023.03.08.14.45.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Mar 2023 14:45:43 -0800 (PST) Subject: [PATCH RESEND v5 0/5] uvcvideo: Fixes for hw timestamping MIME-Version: 1.0 From: Ricardo Ribalda Date: Wed, 08 Mar 2023 23:45:31 +0100 Message-Id: <20220920-resend-hwtimestamp-v5-0-139d1a144614@chromium.org> To: Laurent Pinchart , Mauro Carvalho Chehab Cc: "hn.chen" , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, Ricardo Ribalda X-Mailer: b4 0.11.0-dev-696ae X-Developer-Signature: v=1; a=openpgp-sha256; l=2802; i=ribalda@chromium.org; h=from:subject:message-id; bh=0PV0sUQqxlmjE21EwLCffDJjqS6YLgkk2HDuasuWIrM=; b=owEBbQKS/ZANAwAKAdE30T7POsSIAcsmYgBkCRANL7TII2hMFUYOFih2OWPvHpKKNih7ph6pLjKl +VhzVbyJAjMEAAEKAB0WIQREDzjr+/4oCDLSsx7RN9E+zzrEiAUCZAkQDQAKCRDRN9E+zzrEiGbAD/ 9W37DQmFo6MV8sHK8d598i0ugBkAVi78huGpp2TLf2HceMhcpLl26YWnCQLtI6oh+uFzpj33kfd4UP gekxsSimluhB52INzwTeSn8sR1FN2bWYkHu8duwVkjoJjgyKf1Wig8nanEv0DPKC9g1JJkR7iOYbsd ED5CYY0TElRlSOPYqE9MfoGPLvq3eXBc7pz82t5XWAqP86a9balWGjwNZUcxMMp9YEj72D1HQD6oJa a9HsxCmHN6iSZ7dinViroJm1V6SpFlj8djzD8oaiLlJ5lA3RAbtwbS9UWhk4wWhRSI6T1jkS1bBthN 4cF12W1vp5zxKHusVKVYK+Q701lu4jD5y2+FPWU2fSWsK10d9DMu3pFSTWpsP7cNC3PFy2i8wW10x+ +8Qh/Pi2G1z1DWaAkqNpS2MbayHtm6DLCfAKqOHN5Z+CjsXQ7UxAXoWZPeMlQkL5L5VUhpzNzQ4kZn tpzNdW9BzQo/Qnyy76MU+V09moQz3u4/Ka5ddVXVxU1j1ePnaSkHoVxBHAxTnm6J0Sb2ENyOvk2iEE 1dT0HegKk5GdrWlkig8N22bhTcHosfJLXxopUz+zh+AsaYnV9FN30n0GwvxUnO0NQme5OhoU0TELft OPtxmET3yamNzz/UB9VgocjN4sbmDRdt/g8EnaIDYKXfWbZ7eWn3BEy4o/1w== X-Developer-Key: i=ribalda@chromium.org; a=openpgp; fpr=9EC3BB66E2FC129A6F90B39556A0D81F9F782DA9 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Add some fixes for fixing hw timestamp on some Logitech and SunplusIT cameras. The issues have been previously reported to the manufacturers. Also include a patch to fix the current hw timestamping logic for ANY uvc 1.5 model running at under 16 fps. @HungNien, the logic for empty_ts has slightly changed since v4, would be great if you could test it on your end. To: Laurent Pinchart To: Mauro Carvalho Chehab Cc: linux-media@vger.kernel.org Cc: linux-kernel@vger.kernel.org Cc: hn.chen Tested-by: HungNien Chen Signed-off-by: Ricardo Ribalda Reviewed-by: Sergey Senozhatsky --- Changes in v5: Thanks Dan - Check for !buf on empty TS packets. - Link to v4: https://lore.kernel.org/r/20220920-resend-hwtimestamp-v4-0-a8ddc1358a29@chromium.org Changes in v4 (Thanks Laurent!): - Rebase on top of pinchart/next/uvc - Use heuristic for UVC_QUIRK_IGNORE_EMPTY_TS - Link to v3: https://lore.kernel.org/r/20220920-resend-hwtimestamp-v3-0-db9faee7f47d@chromium.org Changes in v3 (Thanks Laurent!): - Rebase on top of pinchart/uvc/next - Fix hw timestampt handling for slow FPS - Improve commit message - Quirk for invalid dev_sof in Logi C922 - Improve commit message - Allow hw clock updates with buffers not full - Fix typo and improve messages - Refactor clock circular buffer - Improve commit message - Quirk for autosuspend in Logi C910 - Improve commit message - Add comments around the quirk - Create UVC_QUIRK_IGNORE_EMPTY_TS quirk - Improve comments - Allow quirking by entity guid - unsinged int - Extend documentation of uvc_video_clock_decode() - uvcvideo on commit message - Improve comment - Link to v2: https://lore.kernel.org/r/20220920-resend-hwtimestamp-v2-0-d8d0616bb612@chromium.org Changes in v2: - Require 1/4 sec of data before using the hw timestamps - Add Tested-by SunplusIT - Link to v1: https://lore.kernel.org/r/20220920-resend-hwtimestamp-v1-0-e9c14b258404@chromium.org --- Ricardo Ribalda (5): media: uvc: Ignore empty TS packets media: uvcvideo: Quirk for invalid dev_sof in Logitech C922 media: uvcvideo: Allow hw clock updates with buffers not full media: uvcvideo: Refactor clock circular buffer media: uvcvideo: Fix hw timestamp handling for slow FPS drivers/media/usb/uvc/uvc_driver.c | 9 +++ drivers/media/usb/uvc/uvc_video.c | 123 ++++++++++++++++++++++++------------- drivers/media/usb/uvc/uvcvideo.h | 2 + 3 files changed, 91 insertions(+), 43 deletions(-) --- base-commit: 73d6709376914f577a61bb29e596fa93ec66598c change-id: 20220920-resend-hwtimestamp-b3e22729284d Best regards,