Re: [PATCH 3/6] media: qcom: camss: csid-340: Report the hardware SOF timestamp
From: Bryan O'Donoghue
Date: Tue Nov 24 2026 - 04:58:08 EST
On 23/11/2026 17:16, Loic Poulain wrote:
+static u64 __csid_sof_timestamp(struct csid_device *csid, enum csid_iface iface)
+{
+ u32 lo, hi;
+
+ /*
+ * The pair is latched on SOF rather than counting, so it can be read
+ * one word at a time without tearing.
+ */
+ lo = readl_relaxed(csid->base + CSID_TIMESTAMP_CURR0_SOF(iface));
+ hi = readl_relaxed(csid->base + CSID_TIMESTAMP_CURR1_SOF(iface));
+
+ return csid_timestamp_to_monotonic(csid, ((u64)hi << 32) | lo);
+}
+
static irqreturn_t csid_isr(int irq, void *dev)
{
struct csid_device *csid = dev;
@@ -207,7 +234,7 @@ static irqreturn_t csid_isr(int irq, void *dev)
iface_val |= status;
if (status & CSID_IFACE_IRQ_INFO_INPUT_SOF)
- csid_sof_event(csid, i, 0);
+ csid_sof_event(csid, i, __csid_sof_timestamp(csid, iface));
}
I think a callback in csid_sof_event() might be cleaner or some other way to not have to replicate all of __csid_sof_timestamp() for each CSI decoder.
---
bod