[PATCH v3 5/8] media: qcom: camss: csid-gen3: Fix the RDI timestamp controls on Titan 690

From: Loic Poulain

Date: Fri Nov 27 2026 - 11:12:38 EST


The RDI timestamp enable and strobe select bits are programmed at fixed
positions in RDI_CFG0, but Titan 690 moved both controls to RDI_CFG1 and
narrowed the strobe select from bits [9:8] to bits [1:0]. On 8775P and
8300 the current values therefore land on unrelated fields of RDI_CFG0
and the timestamp latch is never armed.

Pick the register and the bit positions per SoC, and program them with a
read-modify-write of their own rather than folding them into the
RDI_CFG0 value, which is where they no longer necessarily belong.

No functional change on the SoCs that keep the controls in RDI_CFG0.

Signed-off-by: Loic Poulain <loic.poulain@xxxxxxxxxxxxxxxx>
---
.../media/platform/qcom/camss/camss-csid-gen3.c | 23 +++++++++++++++++-----
1 file changed, 18 insertions(+), 5 deletions(-)

diff --git a/drivers/media/platform/qcom/camss/camss-csid-gen3.c b/drivers/media/platform/qcom/camss/camss-csid-gen3.c
index 6a538d825f78be5cf64691c351149b0a8fa68c3d..5dce6f722d05817f43341d22560cbe32def08cf0 100644
--- a/drivers/media/platform/qcom/camss/camss-csid-gen3.c
+++ b/drivers/media/platform/qcom/camss/camss-csid-gen3.c
@@ -80,8 +80,6 @@
#define CSID_RDI_CFG0(rdi) (csid_is_lite(csid) && IS_CSID_690(csid) ?\
(0x300 + 0x100 * (rdi)) :\
(0x500 + 0x100 * (rdi)))
-#define RDI_CFG0_TIMESTAMP_EN BIT(6)
-#define RDI_CFG0_TIMESTAMP_STB_SEL BIT(8)
#define RDI_CFG0_DECODE_FORMAT 12
#define RDI_CFG0_DT 16
#define RDI_CFG0_VC 22
@@ -103,6 +101,17 @@
#define RDI_CFG1_PIX_STORE BIT(10)
#define RDI_CFG1_PACKING_FORMAT_MIPI BIT(15)

+/*
+ * Titan 690 moved the timestamp controls from RDI_CFG0 to RDI_CFG1, with the
+ * strobe selecting which event latches TIMESTAMP_CURRx at bits [1:0] instead
+ * of [9:8].
+ */
+#define CSID_RDI_TIMESTAMP_CFG(rdi) (IS_CSID_690(csid) ?\
+ CSID_RDI_CFG1(rdi) :\
+ CSID_RDI_CFG0(rdi))
+#define RDI_CFG_TIMESTAMP_EN (IS_CSID_690(csid) ? BIT(4) : BIT(6))
+#define RDI_CFG_TIMESTAMP_STB_SEL (IS_CSID_690(csid) ? BIT(0) : BIT(8))
+
#define CSID_RDI_IRQ_SUBSAMPLE_PATTERN(rdi) (csid_is_lite(csid) && IS_CSID_690(csid) ?\
(0x348 + 0x100 * (rdi)) :\
(0x548 + 0x100 * (rdi)))
@@ -188,10 +197,8 @@ static void __csid_configure_rdi_stream(struct csid_device *csid, u8 enable, u8
*/
u8 dt_id = port & 0x03;

- val = RDI_CFG0_TIMESTAMP_EN;
- val |= RDI_CFG0_TIMESTAMP_STB_SEL;
/* note: for non-RDI path, this should be format->decode_format */
- val |= DECODE_FORMAT_PAYLOAD_ONLY << RDI_CFG0_DECODE_FORMAT;
+ val = DECODE_FORMAT_PAYLOAD_ONLY << RDI_CFG0_DECODE_FORMAT;
val |= vc << RDI_CFG0_VC;
val |= format->data_type << RDI_CFG0_DT;
val |= dt_id << RDI_CFG0_DT_ID;
@@ -207,6 +214,12 @@ static void __csid_configure_rdi_stream(struct csid_device *csid, u8 enable, u8

writel(val, csid->base + CSID_RDI_CFG1(port));

+ /* Arm the SOF timestamp latch, whichever register holds its controls */
+ val = readl(csid->base + CSID_RDI_TIMESTAMP_CFG(port));
+ val |= RDI_CFG_TIMESTAMP_EN;
+ val |= RDI_CFG_TIMESTAMP_STB_SEL;
+ writel(val, csid->base + CSID_RDI_TIMESTAMP_CFG(port));
+
val = 0;
writel(val, csid->base + CSID_RDI_IRQ_SUBSAMPLE_PERIOD(port));


--
2.34.1