* [PATCH 1/2] media: qcom: camss: Latch buffer addresses through a single helper
2026-11-24 16:47 [PATCH 0/2] media: qcom: camss: Avoid useless RUP_DONE interrupts on TFE Loic Poulain
@ 2026-11-24 16:47 ` Loic Poulain
2026-11-24 17:33 ` Bryan O'Donoghue
2026-11-24 16:47 ` [PATCH 2/2] media: qcom: camss: vfe-340: Skip the register update when queuing a buffer Loic Poulain
1 sibling, 1 reply; 4+ messages in thread
From: Loic Poulain @ 2026-11-24 16:47 UTC (permalink / raw)
To: Bryan O'Donoghue, Vladimir Zapolskiy, Mauro Carvalho Chehab
Cc: linux-media, linux-arm-msm, linux-kernel, Loic Poulain
The buffer address written by vfe_wm_update() has to be made visible to
the hardware, and the way to do that depends on the generation, the older
ones only expose a register update, some relies on a FIFO, while the newer
ones expose a dedicated address update that triggers the latch on its own.
Both sequences are open-coded at every call site today, with the address
update being additive and always followed by a register update. This
leaves no way for a generation to tell that an address update alone is
enough, or that no latching is needed at all.
Add vfe_buf_addr_latch(), which calls the generation's addr_update() when
it provides one and falls back to reg_update() otherwise.
The write master configuration programmed by vfe_wm_start() still needs
committing, so vfe_enable_output_v2() now latches each initial buffer
address inside the loop and issues a single register update afterwards.
Signed-off-by: Loic Poulain <loic.poulain@oss.qualcomm.com>
---
drivers/media/platform/qcom/camss/camss-vfe.c | 33 ++++++++++++++++++++-------
1 file changed, 25 insertions(+), 8 deletions(-)
diff --git a/drivers/media/platform/qcom/camss/camss-vfe.c b/drivers/media/platform/qcom/camss/camss-vfe.c
index f9bd2367671f6e50c6948a6405f78b8c2b03e5f7..f39e1f303c9bb64a41c59d0d413608b5cb54a8ed 100644
--- a/drivers/media/platform/qcom/camss/camss-vfe.c
+++ b/drivers/media/platform/qcom/camss/camss-vfe.c
@@ -443,6 +443,25 @@ u32 vfe_hw_version(struct vfe_device *vfe)
return hw_version;
}
+/*
+ * vfe_buf_addr_latch - Latch a newly programmed buffer address
+ * @vfe: VFE Device
+ * @line: VFE line
+ *
+ * Make the address just written by vfe_wm_update() visible to the hardware,
+ * through a dedicated address update when the generation provides one, or
+ * through a register update otherwise.
+ */
+static void vfe_buf_addr_latch(struct vfe_device *vfe, struct vfe_line *line)
+{
+ const struct vfe_hw_ops *ops = vfe->res->hw_ops;
+
+ if (ops->addr_update)
+ ops->addr_update(vfe, line->id);
+ else
+ ops->reg_update(vfe, line->id);
+}
+
/*
* vfe_buf_done - Process write master done interrupt
* @vfe: VFE Device
@@ -491,9 +510,7 @@ void vfe_buf_done(struct vfe_device *vfe, int wm)
ops->vfe_wm_update(vfe, output->wm_idx[0],
output->buf[index]->addr[0],
line);
- if (ops->addr_update)
- ops->addr_update(vfe, line->id);
- ops->reg_update(vfe, line->id);
+ vfe_buf_addr_latch(vfe, line);
} else {
output->gen2.active_num--;
}
@@ -564,10 +581,12 @@ int vfe_enable_output_v2(struct vfe_line *line)
output->gen2.active_num++;
ops->vfe_wm_update(vfe, output->wm_idx[0],
output->buf[i]->addr[0], line);
- if (!ops->addr_update)
- ops->reg_update(vfe, line->id);
+ vfe_buf_addr_latch(vfe, line);
}
+ /* Commit the write master configuration programmed above */
+ ops->reg_update(vfe, line->id);
+
spin_unlock_irqrestore(&vfe->output_lock, flags);
return 0;
@@ -601,9 +620,7 @@ int vfe_queue_buffer_v2(struct camss_video *vid,
output->buf[output->gen2.active_num++] = buf;
ops->vfe_wm_update(vfe, output->wm_idx[0],
buf->addr[0], line);
- if (ops->addr_update)
- ops->addr_update(vfe, line->id);
- ops->reg_update(vfe, line->id);
+ vfe_buf_addr_latch(vfe, line);
} else {
vfe_buf_add_pending(output, buf);
}
--
2.34.1
^ permalink raw reply [flat|nested] 4+ messages in thread* [PATCH 2/2] media: qcom: camss: vfe-340: Skip the register update when queuing a buffer
2026-11-24 16:47 [PATCH 0/2] media: qcom: camss: Avoid useless RUP_DONE interrupts on TFE Loic Poulain
2026-11-24 16:47 ` [PATCH 1/2] media: qcom: camss: Latch buffer addresses through a single helper Loic Poulain
@ 2026-11-24 16:47 ` Loic Poulain
1 sibling, 0 replies; 4+ messages in thread
From: Loic Poulain @ 2026-11-24 16:47 UTC (permalink / raw)
To: Bryan O'Donoghue, Vladimir Zapolskiy, Mauro Carvalho Chehab
Cc: linux-media, linux-arm-msm, linux-kernel, Loic Poulain
The TFE bus image address register is a FIFO, not a shadow register, an
address pushed by vfe_wm_update() is picked up by the hardware on its
own, with no register update needed to latch it.
The register update issued for every queued buffer therefore costs an
extra RUP_DONE interrupt on top of the BUF_DONE one, for no effect.
Implement addr_update() as a no-op so that vfe_buf_addr_latch() stops
falling back to reg_update() for this generation. The register update
done at stream-on is unaffected, and streaming now takes a single
interrupt per frame.
Signed-off-by: Loic Poulain <loic.poulain@oss.qualcomm.com>
---
drivers/media/platform/qcom/camss/camss-vfe-340.c | 6 ++++++
1 file changed, 6 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..e6f863d8f38d0a7f1e8fba431dff2d8583eb2cba 100644
--- a/drivers/media/platform/qcom/camss/camss-vfe-340.c
+++ b/drivers/media/platform/qcom/camss/camss-vfe-340.c
@@ -365,7 +365,13 @@ static void vfe_reg_update_clear(struct vfe_device *vfe, enum vfe_line_id line_i
vfe->reg_update &= ~BIT(__line_to_iface(line_id));
}
+static void vfe_addr_update(struct vfe_device *vfe, enum vfe_line_id line_id)
+{
+ /* Nothing to do, the address register is a FIFO so vfe_wm_update() is enough */
+}
+
const struct vfe_hw_ops vfe_ops_340 = {
+ .addr_update = vfe_addr_update,
.global_reset = vfe_global_reset,
.hw_version = vfe_hw_version,
.isr = vfe_isr,
--
2.34.1
^ permalink raw reply [flat|nested] 4+ messages in thread