[PATCH v4 14/14] media: qcom: camss: vfe-340: Report the address of the current frame
From: Loic Poulain
Date: Thu Dec 03 2026 - 11:55:45 EST
TFE write clients report the start address of the frame they are writing
in their address status block. Implement the operation reading it.
Documentation for this TFE revision is not available, the offset of the
block is taken from the IFE one, every other register of the write
client being at the same place.
Signed-off-by: Loic Poulain <loic.poulain@xxxxxxxxxxxxxxxx>
---
drivers/media/platform/qcom/camss/camss-vfe-340.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/media/platform/qcom/camss/camss-vfe-340.c b/drivers/media/platform/qcom/camss/camss-vfe-340.c
index 2526d568686db06a233f0aabe4bc176e4c440ea5..00bdcef55cf2afa43c4dc829c918ce43fea8b9ec 100644
--- a/drivers/media/platform/qcom/camss/camss-vfe-340.c
+++ b/drivers/media/platform/qcom/camss/camss-vfe-340.c
@@ -72,6 +72,8 @@
#define TFE_BUS_IRQ_SUBSAMPLE_CFG_1(c) BUS_REG(0x234 + (c) * 0x100)
#define TFE_BUS_FRAMEDROP_CFG_0(c) BUS_REG(0x238 + (c) * 0x100)
#define TFE_BUS_FRAMEDROP_CFG_1(c) BUS_REG(0x23c + (c) * 0x100)
+#define TFE_BUS_ADDR_STATUS(c, k) BUS_REG(0x270 + (k) * 4 + (c) * 0x100)
+#define TFE_BUS_ADDR_STATUS_CURR_FRAME 3
#define PP_CROP_REG(a) (0x2800 + (a))
#define TFE_PP_CROP_CFG PP_CROP_REG(0x60)
@@ -257,6 +259,15 @@ static void vfe_wm_update(struct vfe_device *vfe, u8 wm, u32 addr,
writel_relaxed(addr, vfe->base + TFE_BUS_IMAGE_ADDR(client));
}
+/* The address the write master reports for the frame it is filling */
+static u32 vfe_wm_curr_addr(struct vfe_device *vfe, u8 wm)
+{
+ u8 client = tfe_wm_client_map[wm];
+
+ return readl_relaxed(vfe->base +
+ TFE_BUS_ADDR_STATUS(client, TFE_BUS_ADDR_STATUS_CURR_FRAME));
+}
+
static u32 vfe_packer_format(struct vfe_device *vfe, u32 pixelformat)
{
const struct camss_formats *fmt = vfe->res->formats_rdi;
@@ -378,6 +389,7 @@ const struct vfe_hw_ops vfe_ops_340 = {
.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