* [PATCH 0/2] media: qcom: camss: Avoid useless RUP_DONE interrupts on TFE
@ 2026-11-24 16:47 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 ` [PATCH 2/2] media: qcom: camss: vfe-340: Skip the register update when queuing a buffer Loic Poulain
0 siblings, 2 replies; 7+ 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
On the TFE (VFE 340), every buffer queued at runtime is followed by a
register update, which makes the hardware raise a RUP_DONE interrupt on
top of the BUF_DONE one. We therefore take two interrupts per frame where
one would do.
That register update is pointless here: the TFE bus image address
register is a FIFO and not a shadow register, so the address written by
vfe_wm_update() is picked up by the hardware on its own and needs no
latching.
The first patch replaces the sequences open-coded at the three call sites
with a single helper, which calls addr_update() when the generation
provides one and falls back to reg_update() otherwise, all generations
implementing the latter. The second one implements addr_update() as a
no-op for VFE 340, which removes the per-buffer register update and gets
the TFE down to a single interrupt per frame.
Side effect:
VFE 1080 loses the register update that used to follow each address
update at runtime. __csid_addr_update() already writes the AUP mask and
then the RUP_SET trigger, so the latch should be complete without it,
but a confirmation from someone with 1080 hardware would be welcome.
Signed-off-by: Loic Poulain <loic.poulain@oss.qualcomm.com>
---
Loic Poulain (2):
media: qcom: camss: Latch buffer addresses through a single helper
media: qcom: camss: vfe-340: Skip the register update when queuing a buffer
drivers/media/platform/qcom/camss/camss-vfe-340.c | 6 +++++
drivers/media/platform/qcom/camss/camss-vfe.c | 33 +++++++++++++++++------
2 files changed, 31 insertions(+), 8 deletions(-)
---
base-commit: 2ad58ca589da80990b7afbcff018777851577f89
change-id: 20261124-tfe-fix-irq-eb8fd293791a
Best regards,
--
Loic Poulain <loic.poulain@oss.qualcomm.com>
^ permalink raw reply [flat|nested] 7+ messages in thread* [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-25 8:23 ` Hangxiang Ma 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, 2 replies; 7+ 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] 7+ messages in thread
* Re: [PATCH 1/2] media: qcom: camss: Latch buffer addresses through a single helper 2026-11-24 16:47 ` [PATCH 1/2] media: qcom: camss: Latch buffer addresses through a single helper Loic Poulain @ 2026-11-24 17:33 ` Bryan O'Donoghue 2026-11-25 8:20 ` Loic Poulain 2026-11-25 8:23 ` Hangxiang Ma 1 sibling, 1 reply; 7+ messages in thread From: Bryan O'Donoghue @ 2026-11-24 17:33 UTC (permalink / raw) To: Loic Poulain, Vladimir Zapolskiy, Mauro Carvalho Chehab Cc: linux-media, linux-arm-msm, linux-kernel On 24/11/2026 16:47, Loic Poulain wrote: > 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> This is a bit too wordy for me. Can you reduce this down to one paragraph. It seems like a straightforward functional decomposition to me. --- bod ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] media: qcom: camss: Latch buffer addresses through a single helper 2026-11-24 17:33 ` Bryan O'Donoghue @ 2026-11-25 8:20 ` Loic Poulain 0 siblings, 0 replies; 7+ messages in thread From: Loic Poulain @ 2026-11-25 8:20 UTC (permalink / raw) To: Bryan O'Donoghue Cc: Vladimir Zapolskiy, Mauro Carvalho Chehab, linux-media, linux-arm-msm, linux-kernel On Tue, Nov 24, 2026 at 6:33 PM Bryan O'Donoghue <bryan.odonoghue@linaro.org> wrote: > > On 24/11/2026 16:47, Loic Poulain wrote: > > 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> > This is a bit too wordy for me. > > Can you reduce this down to one paragraph. It seems like a > straightforward functional decomposition to me. Sure. > > --- > bod ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] media: qcom: camss: Latch buffer addresses through a single helper 2026-11-24 16:47 ` [PATCH 1/2] media: qcom: camss: Latch buffer addresses through a single helper Loic Poulain 2026-11-24 17:33 ` Bryan O'Donoghue @ 2026-11-25 8:23 ` Hangxiang Ma 1 sibling, 0 replies; 7+ messages in thread From: Hangxiang Ma @ 2026-11-25 8:23 UTC (permalink / raw) To: Loic Poulain, Bryan O'Donoghue, Vladimir Zapolskiy, Mauro Carvalho Chehab Cc: linux-media, linux-arm-msm, linux-kernel, Wenmeng Liu, Nihal Kumar Gupta, Vikram Sharma On 11/25/2026 12:47 AM, Loic Poulain wrote: > 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); > } > Tested-by: Hangxiang Ma <hangxiang.ma@oss.qualcomm.com> # SM8750 --- Best Regards Hangxiang ^ permalink raw reply [flat|nested] 7+ 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 2026-11-25 0:06 ` bod 1 sibling, 1 reply; 7+ 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] 7+ messages in thread
* Re: [PATCH 2/2] media: qcom: camss: vfe-340: Skip the register update when queuing a buffer 2026-11-24 16:47 ` [PATCH 2/2] media: qcom: camss: vfe-340: Skip the register update when queuing a buffer Loic Poulain @ 2026-11-25 0:06 ` bod 0 siblings, 0 replies; 7+ messages in thread From: bod @ 2026-11-25 0:06 UTC (permalink / raw) To: Loic Poulain Cc: Bryan O'Donoghue, Vladimir Zapolskiy, Mauro Carvalho Chehab, linux-media, linux-arm-msm, linux-kernel, bod On 2026-11-24 17:47 +0100, Loic Poulain wrote: > 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> Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> --- bod ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2026-11-25 8:23 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 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 17:33 ` Bryan O'Donoghue 2026-11-25 8:20 ` Loic Poulain 2026-11-25 8:23 ` Hangxiang Ma 2026-11-24 16:47 ` [PATCH 2/2] media: qcom: camss: vfe-340: Skip the register update when queuing a buffer Loic Poulain 2026-11-25 0:06 ` bod
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®