From: Loic Poulain <loic.poulain@oss.qualcomm.com>
To: Mauro Carvalho Chehab <mchehab@kernel.org>,
Bryan O'Donoghue <bryan.odonoghue@linaro.org>,
Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>
Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-msm@vger.kernel.org,
Loic Poulain <loic.poulain@oss.qualcomm.com>
Subject: [PATCH v3 8/8] media: qcom: camss: Tell userspace we're using start-of-frame timestamps
Date: Fri, 27 Nov 2026 17:11:58 +0100 [thread overview]
Message-ID: <20261127-camss-hw-ts-v3-8-e4b6ad98ce9c@oss.qualcomm.com> (raw)
In-Reply-To: <20261127-camss-hw-ts-v3-0-e4b6ad98ce9c@oss.qualcomm.com>
On the SoCs whose CSID can track the start of frame, the buffer
timestamp is taken when the reception of the frame begins, not once it
has been written out to memory. Show this to userspace with the
V4L2_BUF_FLAG_TSTAMP_SRC_SOE buffer flag, the closest the API has to
offer, it is defined as the start of the exposure, which on a rolling
shutter sensor precedes the start of the readout by the exposure time
of the first row.
Signed-off-by: Loic Poulain <loic.poulain@oss.qualcomm.com>
---
drivers/media/platform/qcom/camss/camss-video.c | 2 ++
drivers/media/platform/qcom/camss/camss.c | 6 ++++++
drivers/media/platform/qcom/camss/camss.h | 1 +
3 files changed, 9 insertions(+)
diff --git a/drivers/media/platform/qcom/camss/camss-video.c b/drivers/media/platform/qcom/camss/camss-video.c
index 5de6ff5ecc76a2863e536fca1c40ae6b2de6dc0c..4ce87527b9b984068f5c9a9cc3bbdca645cff1d3 100644
--- a/drivers/media/platform/qcom/camss/camss-video.c
+++ b/drivers/media/platform/qcom/camss/camss-video.c
@@ -698,6 +698,8 @@ int msm_video_register(struct camss_video *video, struct v4l2_device *v4l2_dev,
q->type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
q->io_modes = VB2_DMABUF | VB2_MMAP | VB2_READ;
q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
+ if (camss_has_frame_sync(video->camss))
+ q->timestamp_flags |= V4L2_BUF_FLAG_TSTAMP_SRC_SOE;
q->buf_struct_size = sizeof(struct camss_buffer);
q->dev = video->camss->dev;
q->lock = &video->q_lock;
diff --git a/drivers/media/platform/qcom/camss/camss.c b/drivers/media/platform/qcom/camss/camss.c
index 26e3f2aa3ef2485e0486eaa89f93b804926b6e32..e60aa29051e71cd70bd3564a01655251ba2f37e6 100644
--- a/drivers/media/platform/qcom/camss/camss.c
+++ b/drivers/media/platform/qcom/camss/camss.c
@@ -4839,6 +4839,12 @@ int camss_get_pixel_clock(struct media_entity *entity, u64 *pixel_clock)
return 0;
}
+bool camss_has_frame_sync(struct camss *camss)
+{
+ /* All the CSIDs of a given SoC have the same capability */
+ return camss->res->csid_res[0].csid.frame_sync_en;
+}
+
int camss_pm_domain_on(struct camss *camss, int id)
{
int ret = 0;
diff --git a/drivers/media/platform/qcom/camss/camss.h b/drivers/media/platform/qcom/camss/camss.h
index 8154fab54f99b12456cb377dc4ddfcadfcf8278e..da1095c436323639bc0fda5ebac8026a09565108 100644
--- a/drivers/media/platform/qcom/camss/camss.h
+++ b/drivers/media/platform/qcom/camss/camss.h
@@ -177,6 +177,7 @@ struct media_pad *camss_find_sensor_pad(struct media_entity *entity);
s64 camss_get_link_freq(struct media_entity *entity, unsigned int bpp,
unsigned int lanes);
int camss_get_pixel_clock(struct media_entity *entity, u64 *pixel_clock);
+bool camss_has_frame_sync(struct camss *camss);
int camss_pm_domain_on(struct camss *camss, int id);
void camss_pm_domain_off(struct camss *camss, int id);
int camss_vfe_get(struct camss *camss, int id);
--
2.34.1
prev parent reply other threads:[~2026-11-27 16:12 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-27 16:11 [PATCH v3 0/8] media: qcom: camss: Report the hardware SOF timestamp Loic Poulain
2026-11-27 16:11 ` [PATCH v3 1/8] media: qcom: camss: csid: Add an operation to read the " Loic Poulain
2026-11-27 16:11 ` [PATCH v3 2/8] media: qcom: camss: csid-340: Report the hardware " Loic Poulain
2026-11-27 16:11 ` [PATCH v3 3/8] media: camss: Define timestamp registers for csid-gen2 Loic Poulain
2026-11-27 16:11 ` [PATCH v3 4/8] media: camss: csid-gen2: Report the hardware SOF timestamp Loic Poulain
2026-11-27 16:11 ` [PATCH v3 5/8] media: qcom: camss: csid-gen3: Fix the RDI timestamp controls on Titan 690 Loic Poulain
2026-11-27 16:11 ` [PATCH v3 6/8] media: qcom: camss: csid-gen3: Report the hardware SOF timestamp Loic Poulain
2026-11-27 16:11 ` [PATCH v3 7/8] media: qcom: camss: Timestamp buffers at start of frame Loic Poulain
2026-11-27 16:11 ` Loic Poulain [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261127-camss-hw-ts-v3-8-e4b6ad98ce9c@oss.qualcomm.com \
--to=loic.poulain@oss.qualcomm.com \
--cc=bryan.odonoghue@linaro.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=vladimir.zapolskiy@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®