mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Gjorgji Rosikopulos (Consultant)" <gjorgji.rosikopulos@oss.qualcomm.com>
To: Loic Poulain <loic.poulain@oss.qualcomm.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Bryan O'Donoghue <bryan.odonoghue@linaro.org>,
	Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>
Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-msm@vger.kernel.org
Subject: Re: [PATCH v4 12/14] media: qcom: camss: vfe-gen3: Report the address of the current frame
Date: Fri, 4 Dec 2026 15:32:43 +0200	[thread overview]
Message-ID: <04775a31-ac86-43e2-9f9f-47e17714135b@oss.qualcomm.com> (raw)
In-Reply-To: <20261203-camss-hw-ts-v4-12-c271022b4b0d@oss.qualcomm.com>

Hi Loic,

On 12/3/2026 6:53 PM, Loic Poulain wrote:
> Titan gen3 write masters report the start address of the frame they are
> writing in their address status block. Implement the operation reading
> it.
> 
> Extract the shift the write master expects on an address while here, so
> the readback can undo it.
> 
> Signed-off-by: Loic Poulain <loic.poulain@oss.qualcomm.com>
> ---
>  drivers/media/platform/qcom/camss/camss-vfe-gen3.c | 36 +++++++++++++++++++---
>  1 file changed, 32 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/media/platform/qcom/camss/camss-vfe-gen3.c b/drivers/media/platform/qcom/camss/camss-vfe-gen3.c
> index 22579617def78457d057e5ba413ae481843a18ad..34e4af8cf471703653afdc6d5ae33150c27011fa 100644
> --- a/drivers/media/platform/qcom/camss/camss-vfe-gen3.c
> +++ b/drivers/media/platform/qcom/camss/camss-vfe-gen3.c
> @@ -70,6 +70,16 @@
>  #define VFE_BUS_WM_MMU_PREFETCH_CFG(n)		(BUS_REG_BASE + 0x260 + (n) * 0x100)
>  #define VFE_BUS_WM_MMU_PREFETCH_MAX_OFFSET(n)	(BUS_REG_BASE + 0x264 + (n) * 0x100)
>  
> +/*
> + * What the write master reports about the addresses it is using:
> + * 0: Start of the frame it finished last, written at buf done
> + * 1: Same for the frame header
> + * 2: How many addresses are still queued up in hardware
> + * 3: Start of the frame it is writing, written when that frame starts
> + */
> +#define VFE_BUS_WM_ADDR_STATUS(n, k)	(BUS_REG_BASE + 0x270 + (k) * 4 + (n) * 0x100)
> +#define		ADDR_STATUS_CURR_FRAME		3
> +
>  static void vfe_wm_start(struct vfe_device *vfe, u8 wm, struct vfe_line *line)
>  {
>  	struct v4l2_pix_format_mplane *pix =
> @@ -118,20 +128,37 @@ static void vfe_wm_stop(struct vfe_device *vfe, u8 wm)
>  	writel(0, vfe->base + VFE_BUS_WM_CFG(wm));
>  }
>  
> +/* How the write master wants a buffer address presented to it */
> +static u32 vfe_wm_addr(struct vfe_device *vfe, u32 addr)
> +{
> +	return IS_VFE_690(vfe) ? addr : addr >> 8;
> +}
> +
>  static void vfe_wm_update(struct vfe_device *vfe, u8 wm, u32 addr,
>  			  struct vfe_line *line)
>  {
>  	wm = RDI_WM(wm);
>  
> -	if (IS_VFE_690(vfe))
> -		writel(addr, vfe->base + VFE_BUS_WM_IMAGE_ADDR(wm));
> -	else
> -		writel((addr >> 8), vfe->base + VFE_BUS_WM_IMAGE_ADDR(wm));
> +	writel(vfe_wm_addr(vfe, addr), vfe->base + VFE_BUS_WM_IMAGE_ADDR(wm));
>  
>  	dev_dbg(vfe->camss->dev, "wm:%d, image buf addr:0x%x\n",
>  		wm, addr);
>  }
>  
> +/* The address the write master reports for the frame it is filling */
> +static u32 vfe_wm_curr_addr(struct vfe_device *vfe, u8 wm)
> +{
> +	u32 addr;
> +
> +	wm = RDI_WM(wm);
> +
> +	addr = readl_relaxed(vfe->base +
> +			     VFE_BUS_WM_ADDR_STATUS(wm, ADDR_STATUS_CURR_FRAME));
> +
> +	/* Inverse of vfe_wm_addr(), so a programmed address reads back as is */
> +	return IS_VFE_690(vfe) ? addr : addr << 8;
> +}
> +
>  static void vfe_reg_update(struct vfe_device *vfe, enum vfe_line_id line_id)
>  {
>  	int port_id = line_id;
> @@ -189,5 +216,6 @@ const struct vfe_hw_ops vfe_ops_gen3 = {
>  	.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,
>  };

Looks good to me.

Reviewed-by: Gjorgji Rosikopulos <gjorgji.rosikopulos@oss.qualcomm.com>

> 


  reply	other threads:[~2026-12-04 13:32 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03 16:53 [PATCH v4 00/14] media: qcom: camss: Report the hardware SOF timestamp Loic Poulain
2026-12-03 16:53 ` [PATCH v4 01/14] media: qcom: camss: Add csid pad to port helper Loic Poulain
2026-12-03 16:53 ` [PATCH v4 02/14] media: qcom: camss: csid: Add an operation to read the SOF timestamp Loic Poulain
2026-12-04  7:31   ` Gjorgji Rosikopulos (Consultant)
2026-12-03 16:53 ` [PATCH v4 03/14] media: qcom: camss: csid-340: Report the hardware " Loic Poulain
2026-12-03 16:53 ` [PATCH v4 04/14] media: camss: Define timestamp registers for csid-gen2 Loic Poulain
2026-12-03 16:53 ` [PATCH v4 05/14] media: camss: csid-gen2: Report the hardware SOF timestamp Loic Poulain
2026-12-03 16:53 ` [PATCH v4 06/14] media: qcom: camss: csid-gen3: Fix the RDI timestamp controls on Titan 690 Loic Poulain
2026-12-04  7:44   ` Gjorgji Rosikopulos (Consultant)
2026-12-03 16:53 ` [PATCH v4 07/14] media: qcom: camss: csid-gen3: Report the hardware SOF timestamp Loic Poulain
2026-12-03 16:53 ` [PATCH v4 08/14] media: qcom: camss: Timestamp buffers at start of frame Loic Poulain
2026-12-04  7:59   ` Gjorgji Rosikopulos (Consultant)
2026-12-03 16:53 ` [PATCH v4 09/14] media: qcom: camss: Tell userspace we're using start-of-frame timestamps Loic Poulain
2026-12-04  8:54   ` Gjorgji Rosikopulos (Consultant)
2026-12-03 16:53 ` [PATCH v4 10/14] media: qcom: camss: csid: Let a consumer hook into the frame start Loic Poulain
2026-12-04 13:18   ` Gjorgji Rosikopulos (Consultant)
2026-12-03 16:53 ` [PATCH v4 11/14] media: qcom: camss: Stamp the buffer the write master is filling Loic Poulain
2026-12-04 13:31   ` Gjorgji Rosikopulos (Consultant)
2026-12-03 16:53 ` [PATCH v4 12/14] media: qcom: camss: vfe-gen3: Report the address of the current frame Loic Poulain
2026-12-04 13:32   ` Gjorgji Rosikopulos (Consultant) [this message]
2026-12-03 16:53 ` [PATCH v4 13/14] media: qcom: camss: vfe-680: " Loic Poulain
2026-12-04 14:49   ` Gjorgji Rosikopulos (Consultant)
2026-12-03 16:53 ` [PATCH v4 14/14] media: qcom: camss: vfe-340: " Loic Poulain

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=04775a31-ac86-43e2-9f9f-47e17714135b@oss.qualcomm.com \
    --to=gjorgji.rosikopulos@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=vladimir.zapolskiy@linaro.org \
    /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®