From patchwork Mon Sep 2 07:51:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jungo Lin X-Patchwork-Id: 11126047 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EF0401399 for ; Mon, 2 Sep 2019 07:52:32 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CCC43214AE for ; Mon, 2 Sep 2019 07:52:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="fbtJC+sq" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CCC43214AE Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:Reply-To:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:To:From:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=QvMlmrYuXfxW228TN9KfpChrRXIofFEXpox+hcGXK7Q=; b=fbtJC+sqzxFqVN W817szBsY3Qzf36HqJoBOB/2/1HlGvolZxf11lm074l3Y3FQjYJZo2eAfBrkGm6fyBGz4qhRvZfqk nnAZT6PuAqdTa6a+YQbhF7DozRTgakS/+Xj70hiOMMOElWc4xs4n3JEm/+CgJkGyUr0ROOv4myUKv MNzGtSCqOsJLDkK44tGPvQ9G0gmQqGJ2lZVgj0I22VcPuJfW8CshBWqOmB0qadFX5gmU5xq8zInfp wD1ABil/A77IBzc4Zt9ntEIgtXKvHBOFtAbRpSNNbJqFry65DN6Qpq28MU0UbvC3NE14Shu3Ksatz DnKRyQzgBpHQngLwdmfw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1i4h8a-0007F5-B3; Mon, 02 Sep 2019 07:52:32 +0000 Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1i4h81-0006Qf-Dc; Mon, 02 Sep 2019 07:51:58 +0000 X-UUID: bcbfd63dd71d45399dc9574efd6c822d-20190901 X-UUID: bcbfd63dd71d45399dc9574efd6c822d-20190901 Received: from mtkcas66.mediatek.inc [(172.29.193.44)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLS) with ESMTP id 164695253; Sun, 01 Sep 2019 23:51:55 -0800 Received: from MTKMBS06N1.mediatek.inc (172.21.101.129) by MTKMBS62DR.mediatek.inc (172.29.94.18) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Mon, 2 Sep 2019 00:51:54 -0700 Received: from mtkcas07.mediatek.inc (172.21.101.84) by mtkmbs06n1.mediatek.inc (172.21.101.129) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Mon, 2 Sep 2019 15:51:51 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas07.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Mon, 2 Sep 2019 15:51:53 +0800 From: Jungo Lin To: , , , , Subject: [RFC,v5, 3/5] media: videodev2.h: Add new boottime timestamp type Date: Mon, 2 Sep 2019 15:51:33 +0800 Message-ID: <20190902075135.1332-4-jungo.lin@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20190902075135.1332-1-jungo.lin@mediatek.com> References: <20190902075135.1332-1-jungo.lin@mediatek.com> MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190902_005157_462316_46EC9850 X-CRM114-Status: UNSURE ( 7.90 ) X-CRM114-Notice: Please train this message. X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [216.200.240.184 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay lines X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Jungo Lin Cc: shik@chromium.org, devicetree@vger.kernel.org, Sean.Cheng@mediatek.com, suleiman@chromium.org, Rynn.Wu@mediatek.com, srv_heupstream@mediatek.com, robh@kernel.org, ryan.yu@mediatek.com, Jerry-ch.Chen@mediatek.com, frankie.chiu@mediatek.com, jungo.lin@mediatek.com, sj.huang@mediatek.com, yuzhao@chromium.org, linux-mediatek@lists.infradead.org, zwisler@chromium.org, ddavenport@chromium.org, frederic.chen@mediatek.com, linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org For Camera AR(Augmented Reality) application requires camera timestamps to be reported with CLOCK_BOOTTIME to sync timestamp with other sensor sources. The boottime timestamp is identical to monotonic timestamp, except it also includes any time that the system is suspended. Signed-off-by: Jungo Lin --- Documentation/media/uapi/v4l/buffer.rst | 11 ++++++++++- include/uapi/linux/videodev2.h | 2 ++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Documentation/media/uapi/v4l/buffer.rst b/Documentation/media/uapi/v4l/buffer.rst index 1cbd9cde57f3..9e636f4118f5 100644 --- a/Documentation/media/uapi/v4l/buffer.rst +++ b/Documentation/media/uapi/v4l/buffer.rst @@ -649,13 +649,22 @@ Buffer Flags - 0x00002000 - The buffer timestamp has been taken from the ``CLOCK_MONOTONIC`` clock. To access the same clock outside V4L2, use - :c:func:`clock_gettime`. + :c:func:`clock_gettime` using clock IDs ``CLOCK_MONOTONIC``. * .. _`V4L2-BUF-FLAG-TIMESTAMP-COPY`: - ``V4L2_BUF_FLAG_TIMESTAMP_COPY`` - 0x00004000 - The CAPTURE buffer timestamp has been taken from the corresponding OUTPUT buffer. This flag applies only to mem2mem devices. + * .. _`V4L2_BUF_FLAG_TIMESTAMP_BOOTIME`: + + - ``V4L2_BUF_FLAG_TIMESTAMP_BOOTIME`` + - 0x00008000 + - The buffer timestamp has been taken from the ``CLOCK_BOOTTIME`` + clock. To access the same clock outside V4L2, use + :c:func:`clock_gettime` using clock IDs ``CLOCK_BOOTTIME``. + Identical to CLOCK_MONOTONIC, except it also includes any time that + the system is suspended. * .. _`V4L2-BUF-FLAG-TSTAMP-SRC-MASK`: - ``V4L2_BUF_FLAG_TSTAMP_SRC_MASK`` diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h index 9d9705ceda76..a4fd271348e7 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -1043,6 +1043,8 @@ static inline __u64 v4l2_timeval_to_ns(const struct timeval *tv) #define V4L2_BUF_FLAG_TIMESTAMP_UNKNOWN 0x00000000 #define V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC 0x00002000 #define V4L2_BUF_FLAG_TIMESTAMP_COPY 0x00004000 +#define V4L2_BUF_FLAG_TIMESTAMP_BOOTIME 0x00008000 + /* Timestamp sources. */ #define V4L2_BUF_FLAG_TSTAMP_SRC_MASK 0x00070000 #define V4L2_BUF_FLAG_TSTAMP_SRC_EOF 0x00000000