Re: [PATCH 0/6] media: qcom: camss: Report the hardware SOF timestamp

From: Loic Poulain

Date: Tue Nov 24 2026 - 05:22:06 EST


On Tue, Nov 24, 2026 at 10:59 AM Bryan O'Donoghue
<bryan.odonoghue@xxxxxxxxxx> wrote:
>
> On 23/11/2026 17:16, Loic Poulain wrote:
> > 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 passes the SOF time down to the common
> > CSID event helper and adds the counter to CLOCK_MONOTONIC conversion.
> > Patches 3 to 5 read the registers on csid-340 and csid-gen2. Patch 6
> > uses the same time to stamp the captured buffers.
> >
> > Patches 4 and 5 are picked from the timestamp support Bryan shared
> > earlier, with patch 5 adapted to use the conversion helper added in
> > patch 2 rather than its own.
> >
> > Tested on QCM2290 (Arduino UNO Q) with an IMX219 sensor.
> >
> > Signed-off-by: Loic Poulain <loic.poulain@xxxxxxxxxxxxxxxx>
> > ---
> > Bryan O'Donoghue (2):
> > media: camss: Define timestamp registers for csid-gen2
> > media: camss: csid-gen2: Report the hardware SOF timestamp
> >
> > Loic Poulain (4):
> > media: v4l2-event: Allow drivers to provide the event timestamp
> > media: qcom: camss: csid: Pass the SOF time to csid_sof_event()
> > media: qcom: camss: csid-340: Report the hardware SOF timestamp
> > media: qcom: camss: Timestamp buffers at start of frame
> So I was offlining this change and kind of left it at comments I
> received to make the type of timestamp selectable on a per-buffer basis.
>
> IDK if that's really required for a first pass but, its where my own
> reviews were left at that time.

I can imagine this being useful in some scenarios, but today the
timestamp source is configured per queue, and there is no userspace
API to select or switch between timestamp source flags AFIK. So I
would consider support for that to be out of scope for this series.

>
> ---
> bod