mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "CK Hu (胡俊光)" <ck.hu@mediatek.com>
To: "laurent.pinchart@ideasonboard.com"
	<laurent.pinchart@ideasonboard.com>,
	"Julien Stephan" <jstephan@baylibre.com>,
	"Andy Hsieh (謝智皓)" <Andy.Hsieh@mediatek.com>,
	"AngeloGioacchino Del Regno"
	<angelogioacchino.delregno@collabora.com>,
	"robh@kernel.org" <robh@kernel.org>,
	"krzk+dt@kernel.org" <krzk+dt@kernel.org>,
	"mchehab@kernel.org" <mchehab@kernel.org>,
	"conor+dt@kernel.org" <conor+dt@kernel.org>,
	"matthias.bgg@gmail.com" <matthias.bgg@gmail.com>
Cc: "linux-media@vger.kernel.org" <linux-media@vger.kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"paul.elder@ideasonboard.com" <paul.elder@ideasonboard.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"fsylvestre@baylibre.com" <fsylvestre@baylibre.com>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"linux-mediatek@lists.infradead.org"
	<linux-mediatek@lists.infradead.org>,
	"pnguyen@baylibre.com" <pnguyen@baylibre.com>
Subject: Re: [PATCH v8 4/5] media: platform: mediatek: isp: add mediatek ISP3.0 camsv
Date: Thu, 13 Feb 2025 05:54:03 +0000	[thread overview]
Message-ID: <6f03d303ae9eca95248bf784a40f95f09593e205.camel@mediatek.com> (raw)
In-Reply-To: <20250122-add-mtk-isp-3-0-support-v8-4-a3d3731eef45@baylibre.com>

Hi, Julien:

On Wed, 2025-01-22 at 14:59 +0100, Julien Stephan wrote:
> External email : Please do not click links or open attachments until you have verified the sender or the content.
> 
> 
> From: Phi-bang Nguyen <pnguyen@baylibre.com>
> 
> This driver provides a path to bypass the SoC ISP so that image data
> coming from the SENINF can go directly into memory without any image
> processing. This allows the use of an external ISP.
> 
> Signed-off-by: Phi-bang Nguyen <pnguyen@baylibre.com>
> Signed-off-by: Florian Sylvestre <fsylvestre@baylibre.com>
> [Paul Elder fix irq locking]
> Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
> Co-developed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Co-developed-by: Julien Stephan <jstephan@baylibre.com>
> Signed-off-by: Julien Stephan <jstephan@baylibre.com>
> ---

[snip]

> +
> +/*
> + * Camsv module is able to handle underrruns using the FBC
> + *
> + *     - FBC_FB_NUM: the number of userspace buffers available (fifo depth)
> + *     - RCNT_INC: user writes 1 when buffer is queued/unqueued
> + *     - FBC_CNT: decreased at SOF indicating that the number of buffers filled
> + *       by write-DMA decreases. Increased when write-dma done indicating that
> + *       the number of buffers filled by write-DMA increases
> + *     - RCNT: increased at the end of enqueue indicating that the software
> + *       moves to the next buffer for reading
> + *     - WCNT: increased to indicate that write-dma writes to the next buffer
> + *     Drop condition: FBC_CNT == FBC_NUM

The description more confuse me.
Below is what I guess:

RCNT_INT: This is used to increase 1 of RCNT
RCNT: Read pointer which point to the last software prepared buffer count
WCNT: Write pointer which point to the hardware last write buffer count
Drop condition: WCNT == RCNT

My guess is totally different with your description.
So let me ask question about your description.

RCNT_INC: user writes 1 when buffer is queued/unqueued
=>
Describe what it actually do, does it increase any counter? Which counter? FBC_CNT or RCNT?
From the naming, I guess this increase RCNT by 1.


- FBC_CNT: decreased at SOF indicating that the number of buffers filled
       by write-DMA decreases. Increased when write-dma done indicating that
       the number of buffers filled by write-DMA increases
=>
FBC_CNT decrease when SOF, and increase when write-dma done.
If FBC_CNT is 5 initially, it would change to 4, 5, 4, 5, 4, 5 periodically.
When SOF, it change to 4. When frame done, it change to 5.
It seems that this counter could not be used to control drop or not because software could not control it.

Drop condition: FBC_CNT == FBC_NUM
=>
If RCNT_INC is to increase FBC_CNT, FBC_CNT would finally be larger then FBC_NUM, this is weird.
If RCNT_INT is to increase RCNT, and sotfware could not control FBC_CNT and FBC_NUM, how hardware would drop correctly?

Regards,
CK

> + */
> +
> +void mtk_camsv_fbc_init(struct mtk_cam_dev *cam_dev,
> +                                unsigned int num_buffers)
> +{
> +       unsigned int fbc_val;
> +
> +       if (pm_runtime_resume_and_get(cam_dev->dev) < 0) {
> +               dev_err(cam_dev->dev, "failed to get pm_runtime\n");
> +               return;
> +       }
> +
> +       fbc_val = mtk_camsv_read(cam_dev, CAMSV_IMGO_FBC);
> +       fbc_val &= ~CAMSV_IMGO_FBC_FB_NUM;
> +       fbc_val |= CAMSV_IMGO_FBC_EN;
> +       fbc_val |= FIELD_PREP(CAMSV_IMGO_FBC_FB_NUM, num_buffers);
> +       mtk_camsv_write(cam_dev, CAMSV_IMGO_FBC, fbc_val);
> +
> +       pm_runtime_mark_last_busy(cam_dev->dev);
> +       pm_runtime_put_autosuspend(cam_dev->dev);
> +}
> +
> 


  reply	other threads:[~2025-02-13  5:54 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-22 13:59 [PATCH v8 0/5] Add Mediatek ISP3.0 Julien Stephan
2025-01-22 13:59 ` [PATCH v8 1/5] dt-bindings: media: add mediatek ISP3.0 sensor interface Julien Stephan
2025-01-22 13:59 ` [PATCH v8 2/5] dt-bindings: media: add mediatek ISP3.0 camsv Julien Stephan
2025-03-20  3:48   ` CK Hu (胡俊光)
2025-01-22 13:59 ` [PATCH v8 3/5] media: platform: mediatek: isp: add mediatek ISP3.0 sensor interface Julien Stephan
2025-01-22 13:59 ` [PATCH v8 4/5] media: platform: mediatek: isp: add mediatek ISP3.0 camsv Julien Stephan
2025-02-13  5:54   ` CK Hu (胡俊光) [this message]
2025-03-20  2:18   ` CK Hu (胡俊光)
2025-04-08 13:56     ` Julien Stephan
2025-04-09  2:40       ` CK Hu (胡俊光)
2025-01-22 13:59 ` [PATCH v8 5/5] arm64: dts: mediatek: mt8365: Add support for camera Julien Stephan
2025-03-20  3:53   ` CK Hu (胡俊光)
2025-01-23 15:57 ` [PATCH v8 0/5] Add Mediatek ISP3.0 Rob Herring (Arm)

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=6f03d303ae9eca95248bf784a40f95f09593e205.camel@mediatek.com \
    --to=ck.hu@mediatek.com \
    --cc=Andy.Hsieh@mediatek.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=fsylvestre@baylibre.com \
    --cc=jstephan@baylibre.com \
    --cc=krzk+dt@kernel.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=mchehab@kernel.org \
    --cc=paul.elder@ideasonboard.com \
    --cc=pnguyen@baylibre.com \
    --cc=robh@kernel.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®