mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2 0/7] media: qcom: camss: Report the hardware SOF timestamp
@ 2026-11-25 10:19 Loic Poulain
  2026-11-25 10:19 ` [PATCH v2 1/7] media: v4l2-event: Allow drivers to provide the event timestamp Loic Poulain
                   ` (6 more replies)
  0 siblings, 7 replies; 21+ messages in thread
From: Loic Poulain @ 2026-11-25 10:19 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Bryan O'Donoghue, Vladimir Zapolskiy
  Cc: linux-media, linux-kernel, linux-arm-msm, Loic Poulain

The CAMSS CSID latches the ARM architected counter on every start of
frame. This series exposes that time to userspace, both through the
V4L2_EVENT_FRAME_SYNC event and as the buffer timestamp.

Until now both were taken when the interrupt was handled, or worse, when
the frame had finished being written out to memory, which is about a
frame period late. The hardware value is free of interrupt latency and
is directly comparable with CLOCK_MONOTONIC, so it can be correlated
with other timestamped data such as IMU samples.

Patch 1 lets a driver fill in the timestamp of a V4L2 event instead of
having the core take it. Patch 2 adds a CSID operation for reading the
counter latched at SOF, converts it to CLOCK_MONOTONIC and puts it in
the event. Patches 3 to 5 implement that operation on csid-340 and
csid-gen2. Patch 6 uses the same time to stamp the captured buffers and
patch 7 reports the new source to userspace.

Patches 4 and 5 are picked from the timestamp support Bryan shared
earlier, with patch 5 adapted to the operation added in patch 2 rather
than doing its own conversion.

Tested on QCM2290 (Arduino UNO Q) with an IMX219 sensor.

Signed-off-by: Loic Poulain <loic.poulain@oss.qualcomm.com>
---
Changes in v2:
- Patch 2: read the latched counter through a new csid_hw_ops operation
  and do the conversion once in the CSID core, instead of passing the
  time into csid_sof_event() and open coding the register read in every
  CSI decoder (Bryan).
- New patch 7: report the timestamp source as V4L2_BUF_FLAG_TSTAMP_SRC_SOE
  on the SoCs that can track SOF, rather than leaving the queue
  advertising V4L2_BUF_FLAG_TSTAMP_SRC_EOF.
- Link to v1: https://lore.kernel.org/r/20261123-camss-hw-ts-v1-0-7b62dda6d7a9@oss.qualcomm.com

---
Bryan O'Donoghue (2):
      media: camss: Define timestamp registers for csid-gen2
      media: camss: csid-gen2: Report the hardware SOF timestamp

Loic Poulain (5):
      media: v4l2-event: Allow drivers to provide the event timestamp
      media: qcom: camss: csid: Add an operation to read the SOF timestamp
      media: qcom: camss: csid-340: Report the hardware SOF timestamp
      media: qcom: camss: Timestamp buffers at start of frame
      media: qcom: camss: Tell userspace we're using start-of-frame timestamps

 drivers/media/platform/qcom/camss/camss-csid-340.c | 37 ++++++++-
 .../media/platform/qcom/camss/camss-csid-gen2.c    | 31 +++++++
 drivers/media/platform/qcom/camss/camss-csid.c     | 94 +++++++++++++++++++++-
 drivers/media/platform/qcom/camss/camss-csid.h     | 19 +++++
 drivers/media/platform/qcom/camss/camss-vfe-17x.c  |  7 +-
 drivers/media/platform/qcom/camss/camss-vfe.c      |  8 +-
 drivers/media/platform/qcom/camss/camss-vfe.h      |  1 +
 drivers/media/platform/qcom/camss/camss-video.c    |  2 +
 drivers/media/platform/qcom/camss/camss.c          | 12 +++
 drivers/media/platform/qcom/camss/camss.h          |  1 +
 drivers/media/v4l2-core/v4l2-event.c               | 20 ++++-
 include/media/v4l2-event.h                         |  9 ++-
 12 files changed, 228 insertions(+), 13 deletions(-)
---
base-commit: 2ad58ca589da80990b7afbcff018777851577f89
change-id: 20261123-camss-hw-ts-e0297adb69d9

Best regards,
-- 
Loic Poulain <loic.poulain@oss.qualcomm.com>


^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2026-11-25 20:50 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-25 10:19 [PATCH v2 0/7] media: qcom: camss: Report the hardware SOF timestamp Loic Poulain
2026-11-25 10:19 ` [PATCH v2 1/7] media: v4l2-event: Allow drivers to provide the event timestamp Loic Poulain
2026-11-25 12:29   ` Gjorgji Rosikopulos (Consultant)
2026-11-25 12:58     ` Vladimir Zapolskiy
2026-11-25 19:21       ` Gjorgji Rosikopulos (Consultant)
2026-11-25 13:21     ` Loic Poulain
2026-11-25 19:39       ` Vladimir Zapolskiy
2026-11-25 19:53         ` Gjorgji Rosikopulos (Consultant)
2026-11-25 20:50           ` Loic Poulain
2026-11-25 10:19 ` [PATCH v2 2/7] media: qcom: camss: csid: Add an operation to read the SOF timestamp Loic Poulain
2026-11-25 12:04   ` Gjorgji Rosikopulos (Consultant)
2026-11-25 12:06     ` Gjorgji Rosikopulos (Consultant)
2026-11-25 13:18       ` Loic Poulain
2026-11-25 15:01         ` Gjorgji Rosikopulos (Consultant)
2026-11-25 16:21           ` Loic Poulain
2026-11-25 17:23             ` Gjorgji Rosikopulos (Consultant)
2026-11-25 10:19 ` [PATCH v2 3/7] media: qcom: camss: csid-340: Report the hardware " Loic Poulain
2026-11-25 10:19 ` [PATCH v2 4/7] media: camss: Define timestamp registers for csid-gen2 Loic Poulain
2026-11-25 10:19 ` [PATCH v2 5/7] media: camss: csid-gen2: Report the hardware SOF timestamp Loic Poulain
2026-11-25 10:19 ` [PATCH v2 6/7] media: qcom: camss: Timestamp buffers at start of frame Loic Poulain
2026-11-25 10:19 ` [PATCH v2 7/7] media: qcom: camss: Tell userspace we're using start-of-frame timestamps Loic Poulain

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®