From patchwork Mon Jan 9 10:00:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 3733 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp2068922wrt; Mon, 9 Jan 2023 02:04:47 -0800 (PST) X-Google-Smtp-Source: AMrXdXs5XudXKr0Emu/t7a1HKojVQGVP3TiD9VnDkBza/4A5ux0uz8r+/a9Ag30LiHPb0//ByFs8 X-Received: by 2002:a05:6a20:ba91:b0:ad:79bb:7487 with SMTP id fb17-20020a056a20ba9100b000ad79bb7487mr67417968pzb.50.1673258687318; Mon, 09 Jan 2023 02:04:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673258687; cv=none; d=google.com; s=arc-20160816; b=x5rlE1dVy1mA5QY4QqUgueT2iog7ODXMWhmfgM4go1bLcQitQD04m0bROTk9surSXK KMsCuNyWpMM13cOALzhSFTntwmxnfw6zjUag2sjnrf7Yv5fTNCtgLzWWvyeKw4DrFf8X d+fbrF0UF8g7NxtAlX0tNlAVV4soF9hwc79sUm4QV/i/z7fWGhYV2cA0N9lzh5ax9jgM p+431/ReuhVoFkSgmqjiCk4awCMykEtrBYB+5NWuyLUjxm3MjNokcjIhsSW8DwA7g8y2 FITKVzHmygCuHAn94Gu1EeVjkv4EXkx7jlE442z5022DPlaw1BXDPkWEQ7bT53MXW8P/ u/Ig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:message-id:date:from :content-transfer-encoding:mime-version:subject:dkim-signature; bh=Cvr86EcVYprczQ7Mp47b1jJqfLxIkymln8np11xtzkI=; b=dWQH0b5W/koniA+F6z4oLN2hxNxUbDC0zNgEYlUYcimmHKCsNJ7VEdhjAtzZU8YnbW +dW1Mu6GgryeY86Miq/QvKwpRZsb0s2kUr/cme3m8IJAzoGAQEyykI6J1nWwrIqex6p3 BlSxImDAspkO8YbwhG2A8SvFVAfvouU/QIxNpKR4ZRXGogJ3Zs1NdhrQMICN8SIoTNm6 nd0DqEYoe3EqAMQwiskPt1V4rKtbY7tbOBfkPQ1AzXh4UQuTozs0h6f/OM38ppmX0Eb2 hjVKL+8JZ6WEBgghqEquVBqEFdgrGVK0m4D8eLJA0iX+zmKrV+LpJOpB7IWqH0+Dt0hm +FuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=FCwhaykY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 126-20020a630284000000b0049973629492si9486091pgc.536.2023.01.09.02.04.34; Mon, 09 Jan 2023 02:04:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=FCwhaykY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234827AbjAIKCu (ORCPT + 99 others); Mon, 9 Jan 2023 05:02:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52028 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237047AbjAIKBW (ORCPT ); Mon, 9 Jan 2023 05:01:22 -0500 Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com [IPv6:2a00:1450:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D15810FD3 for ; Mon, 9 Jan 2023 02:01:14 -0800 (PST) Received: by mail-ej1-x633.google.com with SMTP id u19so18619148ejm.8 for ; Mon, 09 Jan 2023 02:01:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=cc:to:message-id:date:from:content-transfer-encoding:mime-version :subject:from:to:cc:subject:date:message-id:reply-to; bh=Cvr86EcVYprczQ7Mp47b1jJqfLxIkymln8np11xtzkI=; b=FCwhaykY5BgM/Vw2hOHnNX43Gnh3PkMvdOetmSPvTLpQwh3js+/qX/SlkVlyQ6fc73 mfUbVlvY7rQfMkB+ojN/fEPz1BadgZVZzsL79EPfYfM6lTA0WMeaou4XHqk1Z/fkYtGq 40ruNpDJNBUh1l0TdpuSp6sjKxZbkb87Jv1So= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=Cvr86EcVYprczQ7Mp47b1jJqfLxIkymln8np11xtzkI=; b=DhyfAVjBYLdoRa51mzuEliZjj7pTo1BL8tBshtLI3vIhoHOPBCXsQqEsrzXvGuertR N5V2+Zi9noaGXj4RCHfPTbs6ZgcbtgvqQvwyCr9hyU/1eMsFLy/GvzcldpOJUTOuXiiU Hs6F5+RoGG9+lJ7L8fJwOUIrnBxTjmrpyXmglvkoz/l3ZK4gx212ib4nr5oPSmVvZDvo uPT7KT/nM0KriHie3n/Rzpao/mYOh7iCKG0naXR9A4AT24ZNuK/aXz/ZZo8UAWjPL8rv zcj/34vr+8jTW9AXe2bew5nQtwMTk7lKSFL1xGNKZ13roUNIpSGguWSwIUP+0Hqu9Sgp eI5Q== X-Gm-Message-State: AFqh2kp5/3FkmyZPVpF848/ulnk3KcgeS7QRm52ZTGOjfRjGkpfJzJ5+ nbFE89OV88hzHPdDnr6ZuulUng== X-Received: by 2002:a17:907:9d0e:b0:7c0:c10e:1395 with SMTP id kt14-20020a1709079d0e00b007c0c10e1395mr55736385ejc.1.1673258472965; Mon, 09 Jan 2023 02:01:12 -0800 (PST) Received: from alco.roam.corp.google.com ([2620:0:1059:10:cd22:9dd:6d54:8488]) by smtp.gmail.com with ESMTPSA id bg14-20020a170906a04e00b007c094d31f35sm3557548ejb.76.2023.01.09.02.01.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Jan 2023 02:01:12 -0800 (PST) Subject: [PATCH v4 0/5] uvcvideo: Fixes for hw timestamping MIME-Version: 1.0 X-B4-Tracking: v=1; b=H4sIAM/lu2MC/4XNywrCMBAF0F8pWRtJprEPV/6HuMhj2gSaVJK2Iq X/bnQpYlfDvXDPrCRhdJjIuVhJxMUlN4YcxKEg2srQI3UmZwIMgLXAaMSEwVD7mJzHNEl/p6pEgB paaIQheahkQqqiDNrmaZiHIZfWpWmMz8+jhedz/WsunDKKreZCwakRTFy0jaN3sz+OsSe3LC6wr0 BWTGNYxSulKg4/lHJfKd+KajuJWHeiNl/Ktm0vJwnDpEgBAAA= From: Ricardo Ribalda Date: Mon, 09 Jan 2023 11:00:47 +0100 Message-Id: <20220920-resend-hwtimestamp-v4-0-a8ddc1358a29@chromium.org> To: Mauro Carvalho Chehab , Laurent Pinchart Cc: Ricardo Ribalda , "hn.chen" , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org X-Mailer: b4 0.11.0-dev-696ae X-Developer-Signature: v=1; a=openpgp-sha256; l=2516; i=ribalda@chromium.org; h=from:subject:message-id; bh=RoEgR2V3s+l2yEuznl2FsB16WAvD8+V+KuBSRItNVRQ=; b=owEBbQKS/ZANAwAKAdE30T7POsSIAcsmYgBju+XZDfuTHchTYMBEBnptnUJxvpJ9QI0AVvLXL554 rpl/fcaJAjMEAAEKAB0WIQREDzjr+/4oCDLSsx7RN9E+zzrEiAUCY7vl2QAKCRDRN9E+zzrEiEgxD/ 4kd48Vii2lrHcdK+sAvfCtzC4Ou1ySl1CQqVY3C1jxHSmj6aKFOX++z4N4ssUB8eoac6NFHj7Y22ow RgmcWkISvoamDlZFBoRRlaXOBn6xlMdcLQyG8K6YrPtnqYPek59i8prkH4y4pgZZJ3cwn3OqJpFyZD swFPsH0hhgDR4tAXCsJ+eHOwdlBuQmII9oex7sZ8zb7qPJd/ckwKpqXBYa5M5cYe+UFJ/5NINfiinF Yz6m5yQz68gX9pmd4eraOZzpsmmRwsdqXqVHelrB65x5OSKPCqiNZiRFQGPSU2AoBPGWTcMPZsjK+V px6+RDJA+O4x2vSGtedqW5U30INEnjT9mFTU0AWYj7M1l+COdWMKAMafSFJ8uFLpS9vUDsxM8YlbY8 LDO6fBcT1iPy1V2il2IecqmeCAVCo2V6ywxJMXCHiY46xzMDilWAo1WwgLBHTrSxY5kVPcommvGWc0 baBaQ3pNJMeLS7/Q8zdv0utdkPJeV9tItmv3BAqby17JIjD2o+qlH89RoeSP5e2jRwHZRF3KisFpMb Rgq8Ij/Ye1DzmZK1z55NHzjFHxWt9v1Lt66YzVGct4kzLj42Ho/66n3F+daIbMbTqL0p28/U2K0lrM pL8w5reXDLVa9SkNdjmfgFCSwubEfnkO/WUvMQ4lxNAm4rXrKDggxoN/tbbQ== X-Developer-Key: i=ribalda@chromium.org; a=openpgp; fpr=9EC3BB66E2FC129A6F90B39556A0D81F9F782DA9 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754538901220330476?= X-GMAIL-MSGID: =?utf-8?q?1754538901220330476?= 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. 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 --- 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,