[PATCH v4 13/14] media: qcom: camss: vfe-680: Report the address of the current frame

From: Loic Poulain

Date: Thu Dec 03 2026 - 11:55:41 EST


VFE680 write masters report the start address of the frame they are
writing in their address status block. Implement the operation reading
it.

The block was described as a single register, with the wrong offset for
the lite variant, whose write client has one more register before it.
Nothing used it, replace it with an indexed form.

Signed-off-by: Loic Poulain <loic.poulain@xxxxxxxxxxxxxxxx>
---
drivers/media/platform/qcom/camss/camss-vfe-680.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/drivers/media/platform/qcom/camss/camss-vfe-680.c b/drivers/media/platform/qcom/camss/camss-vfe-680.c
index 99036e7c1e763a07c077e4ce024f3da2575a95e2..984621c1ac5e9083fc1a0581faafbd5772f5e5d0 100644
--- a/drivers/media/platform/qcom/camss/camss-vfe-680.c
+++ b/drivers/media/platform/qcom/camss/camss-vfe-680.c
@@ -54,7 +54,10 @@
#define VFE_BUS_MMU_PREFETCH_CFG(vfe, c) ((vfe_is_lite(vfe) ? 0x460 : 0xe60) + (c) * 0x100)
#define VFE_BUS_MMU_PREFETCH_CFG_EN BIT(0)
#define VFE_BUS_MMU_PREFETCH_MAX_OFFSET(vfe, c) ((vfe_is_lite(vfe) ? 0x464 : 0xe64) + (c) * 0x100)
-#define VFE_BUS_ADDR_STATUS0(vfe, c) ((vfe_is_lite(vfe) ? 0x470 : 0xe70) + (c) * 0x100)
+/* The lite write client block has one more register before this one */
+#define VFE_BUS_ADDR_STATUS(vfe, c, k) ((vfe_is_lite(vfe) ? 0x474 : 0xe70) + \
+ (k) * 4 + (c) * 0x100)
+#define ADDR_STATUS_CURR_FRAME 3

/*
* TODO: differentiate the port id based on requested type of RDI, BHIST etc
@@ -152,6 +155,15 @@ static void vfe_wm_update(struct vfe_device *vfe, u8 rdi, u32 addr,
writel(addr, vfe->base + VFE_BUS_IMAGE_ADDR(vfe, wm));
}

+/* The address the write master reports for the frame it is filling */
+static u32 vfe_wm_curr_addr(struct vfe_device *vfe, u8 rdi)
+{
+ u8 wm = RDI_WM(rdi);
+
+ return readl_relaxed(vfe->base +
+ VFE_BUS_ADDR_STATUS(vfe, wm, ADDR_STATUS_CURR_FRAME));
+}
+
static void vfe_wm_start(struct vfe_device *vfe, u8 rdi, struct vfe_line *line)
{
struct v4l2_pix_format_mplane *pix =
@@ -238,6 +250,7 @@ const struct vfe_hw_ops vfe_ops_680 = {
.vfe_wm_start = vfe_wm_start,
.vfe_wm_stop = vfe_wm_stop,
.vfe_buf_done = vfe_buf_done,
+ .vfe_wm_curr_addr = vfe_wm_curr_addr,
.vfe_wm_update = vfe_wm_update,
.reg_update = vfe_reg_update,
.reg_update_clear = vfe_reg_update_clear,

--
2.34.1