mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hangxiang Ma <hangxiang.ma@oss.qualcomm.com>
To: Loic Poulain <loic.poulain@oss.qualcomm.com>,
	Bryan O'Donoghue <bryan.odonoghue@linaro.org>,
	Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>,
	Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Wenmeng Liu <wenmeng.liu@oss.qualcomm.com>,
	Nihal Kumar Gupta <nihal.gupta@oss.qualcomm.com>,
	Vikram Sharma <vikram.sharma@oss.qualcomm.com>
Subject: Re: [PATCH 1/2] media: qcom: camss: Latch buffer addresses through a single helper
Date: Wed, 25 Nov 2026 16:23:22 +0800	[thread overview]
Message-ID: <26d4f9ca-ec16-400f-8f0c-cd5a374aadfa@oss.qualcomm.com> (raw)
In-Reply-To: <20261124-tfe-fix-irq-v1-1-fd9840d952ae@oss.qualcomm.com>

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

  parent reply	other threads:[~2026-11-25  8:23 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=26d4f9ca-ec16-400f-8f0c-cd5a374aadfa@oss.qualcomm.com \
    --to=hangxiang.ma@oss.qualcomm.com \
    --cc=bryan.odonoghue@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=loic.poulain@oss.qualcomm.com \
    --cc=mchehab@kernel.org \
    --cc=nihal.gupta@oss.qualcomm.com \
    --cc=vikram.sharma@oss.qualcomm.com \
    --cc=vladimir.zapolskiy@linaro.org \
    --cc=wenmeng.liu@oss.qualcomm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®