mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Charvi Mehta <charvi.mehta@arm.com>
To: Nicolas Dufresne <nicolas@ndufresne.ca>,
	linux-media@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Philipp Zabel <p.zabel@pengutronix.de>,
	Vincenzo Frascino <vincenzo.frascino@arm.com>,
	Rathinavel Sankaralingam <rath.sankaralingam@arm.com>,
	Shobhit Pandey <shobhit.pandey@arm.com>
Subject: Re: [RFC PATCH 02/28] media: mali-vpu: add Mali VPU platform driver
Date: Tue, 24 Nov 2026 09:56:40 +0000	[thread overview]
Message-ID: <e085a389-b590-4448-b8ba-1e084fddb815@arm.com> (raw)
In-Reply-To: <8ad5ec8847859937aef900a09ae8b3eddaa15464.camel@ndufresne.ca>


On 11/19/26 20:04, Nicolas Dufresne wrote:
>> +
>> +/* VPU register access helpers */
>> +static u32 mali_vpu_read_reg(void __iomem *regs_base, u32 off)
>> +{
>> +	return readl(regs_base + off);
> That wrapper does nothing other then increasing the code length. Why not take a
> vpu_dev as parameter?
Passing the MMIO base keeps the helpers independent of the device structure,
but taking `struct mali_vpu_dev *` would simplify the callers.
I’ll make that change in v2.


> You're chosen namespace is also very long, worth considering, but not strictly a
> problem.

I'd prefer to keep the `mali_vpu_` prefix for consistency with the 
driver name and
rest of the series.


>> +static int mali_vpu_get_clocks(struct mali_vpu_dev *vpu_dev)
>> +{
>> +	int ret;
>> +
>> +	ret = devm_clk_bulk_get_all(vpu_dev->dev, &vpu_dev->clk_list);
>> +	if (ret < 0)
>> +		return dev_err_probe(vpu_dev->dev, ret, "failed to get clocks\n");
>> +	if (!ret)
>> +		return dev_err_probe(vpu_dev->dev, -EINVAL, "no clocks found\n");
> I don't think the second check is required, that would mean you have zero clock
> in your DT, which is invalid according to your binding.
The VPU requires a core clock, but `devm_clk_bulk_get_all()` returns zero
when none are found. Although this violates the binding, schema validation
is not enabled by default or performed at runtime, and the bootloader can
supply a separate DTB. I’d prefer to retain the check so probe reports the
missing clock before attempting register access.


>> +static int mali_vpu_enable_clk(struct mali_vpu_dev *vpu_dev)
>> +{
>> +	return clk_bulk_prepare_enable(vpu_dev->clk_count, vpu_dev->clk_list);
>> +}
>> +
>> +static void mali_vpu_disable_clk(struct mali_vpu_dev *vpu_dev)
>> +{
>> +	clk_bulk_disable_unprepare(vpu_dev->clk_count, vpu_dev->clk_list);
>> +}
> The two wrapper above do nothing.
Fair point. I’ll remove them and call the bulk clock APIs directly.


>> +	ret = mali_vpu_get_resources(vpu_dev);
>> +	if (ret)
>> +		return ret;
>> +
>> +	ret = mali_vpu_enable_clk(vpu_dev);
>> +	if (ret) {
>> +		dev_err(vpu_dev->dev, "failed to enable core clock\n");
>> +		return ret;
>> +	}
>> +
>> +	ret = mali_vpu_deassert_reset(vpu_dev);
>> +	if (ret) {
>> +		dev_err(vpu_dev->dev, "failed to deassert reset\n");
>> +		goto err_clk;
>> +	}
> In practice the two above should be inside your PM runtime ops, not sure if
> that's coming after, in which case just ignore. It best to do this early, PM as
> after thought would be bad.
Thanks, runtime PM support will follow in subsequent patches.


>> +	mali_vpu_read_version(vpu_dev, &pid, &rev, &patch);
>> +	dev_info(&pdev->dev, "Mali VPU device product ID: %#x, revision: %#x, patch: %#x\n",
>> +		 pid, rev, patch);
>> +
>> +	if (pid != vpu_dev->variant->expected_hw_pid) {
>> +		dev_err(vpu_dev->dev, "unexpected hardware product ID: %#x (expected %#x)\n",
>> +			pid, vpu_dev->variant->expected_hw_pid);
>> +		ret = -ENODEV;
>> +		goto err_rst_clk;
>> +	}
> Both ways work, but you could also pick the variant based on the version
> instead, and only depend on DT for the "families" (e.g. the version register
> layout have changed but you still want this under the same driver).
Thanks for the suggestion. For V76, I prefer to retain the DT-selected
variant and use the product ID as a sanity check.
I'll revisit product-ID-based variant selection when another variant is 
added.


Regards,
Charvi

  reply	other threads:[~2026-11-24  9:56 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-19 15:37 [RFC PATCH 00/28] media: add arm Mali-V76 video decoder driver Charvi Mehta
2026-11-19 15:37 ` [RFC PATCH 01/28] dt-bindings: media: add Arm Mali-V76 VPU Charvi Mehta
2026-11-19 15:37 ` [RFC PATCH 02/28] media: mali-vpu: add Mali VPU platform driver Charvi Mehta
2026-11-19 20:04   ` Nicolas Dufresne
2026-11-24  9:56     ` Charvi Mehta [this message]
2026-11-20 11:48   ` Uwe Kleine-König
2026-11-24 10:17     ` Charvi Mehta
2026-11-19 15:37 ` [RFC PATCH 03/28] media: mali-vpu: register V4L2 decoder device and add querycap ioctl Charvi Mehta
2026-11-19 20:10   ` Nicolas Dufresne
2026-11-24 10:29     ` Charvi Mehta
2026-11-19 15:37 ` [RFC PATCH 04/28] media: mali-vpu: initialize decoder format state Charvi Mehta
2026-11-19 20:30   ` Nicolas Dufresne
2026-11-19 15:37 ` [RFC PATCH 05/28] media: mali-vpu: add V4L2 mem2mem and VB2 queue support Charvi Mehta
2026-11-19 15:37 ` [RFC PATCH 06/28] media: mali-vpu: implement format query ioctls Charvi Mehta
2026-11-19 15:37 ` [RFC PATCH 07/28] media: mali-vpu: implement TRY_FMT and S_FMT ioctls Charvi Mehta
2026-11-19 20:44   ` Nicolas Dufresne
2026-11-23 17:26     ` Charvi Mehta
2026-11-19 15:37 ` [RFC PATCH 08/28] media: mali-vpu: register V76 decoder controls and introduce UAPI controls Charvi Mehta
2026-11-19 21:06   ` Nicolas Dufresne
2026-11-19 15:37 ` [RFC PATCH 09/28] media: mali-vpu: add MMU software page table manager Charvi Mehta
2026-11-19 15:37 ` [RFC PATCH 10/28] media: mali-vpu: add firmware cache infrastructure Charvi Mehta
2026-11-19 21:34   ` Nicolas Dufresne
2026-11-19 15:37 ` [RFC PATCH 11/28] media: mali-vpu: load firmware for decoder sessions Charvi Mehta
2026-11-19 15:37 ` [RFC PATCH 12/28] media: mali-vpu: prepare firmware address space Charvi Mehta
2026-11-19 15:37 ` [RFC PATCH 13/28] media: mali-vpu: add firmware message transport Charvi Mehta
2026-11-19 15:37 ` [RFC PATCH 14/28] media: mali-vpu: route decoder controls to firmware Charvi Mehta
2026-11-19 15:37 ` [RFC PATCH 15/28] media: mali-vpu: handle firmware RPC requests Charvi Mehta
2026-11-19 15:37 ` [RFC PATCH 16/28] media: mali-vpu: add LSID hardware support Charvi Mehta
2026-11-19 15:37 ` [RFC PATCH 17/28] media: mali-vpu: add single session scheduler Charvi Mehta
2026-11-19 15:37 ` [RFC PATCH 18/28] media: mali-vpu: handle firmware interrupts Charvi Mehta
2026-11-19 15:37 ` [RFC PATCH 19/28] media: mali-vpu: start decoder firmware through LSID scheduling Charvi Mehta
2026-11-19 15:37 ` [RFC PATCH 20/28] media: mali-vpu: implement vb2 buffer queue handling Charvi Mehta
2026-11-19 15:37 ` [RFC PATCH 21/28] media: mali-vpu: handle firmware buffer exchange Charvi Mehta
2026-11-19 15:37 ` [RFC PATCH 22/28] media: mali-vpu: handle fatal firmware error Charvi Mehta
2026-11-19 15:37 ` [RFC PATCH 23/28] media: mali-vpu: propagate buffer metadata Charvi Mehta
2026-11-19 15:37 ` [RFC PATCH 24/28] media: mali-vpu: add decoder EOS and DRC handling Charvi Mehta
2026-11-19 15:37 ` [RFC PATCH 25/28] media: mali-vpu: handle firmware buffer parameters Charvi Mehta
2026-11-19 15:37 ` [RFC PATCH 26/28] media: mali-vpu: handle firmware event responses Charvi Mehta
2026-11-19 15:37 ` [RFC PATCH 27/28] media: mali-vpu: add stateful decoder state machine Charvi Mehta
2026-11-19 15:37 ` [RFC PATCH 28/28] media: MAINTAINERS: add Arm Mali-V76 VPU driver Charvi Mehta
2026-11-19 19:44 ` [RFC PATCH 00/28] media: add arm Mali-V76 video decoder driver Nicolas Dufresne
2026-11-23 15:57   ` Charvi Mehta

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=e085a389-b590-4448-b8ba-1e084fddb815@arm.com \
    --to=charvi.mehta@arm.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=nicolas@ndufresne.ca \
    --cc=p.zabel@pengutronix.de \
    --cc=rath.sankaralingam@arm.com \
    --cc=robh@kernel.org \
    --cc=shobhit.pandey@arm.com \
    --cc=vincenzo.frascino@arm.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®