devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzk@kernel.org>
To: Nas Chung <nas.chung@chipsnmedia.com>,
	mchehab@kernel.org, hverkuil@xs4all.nl, robh@kernel.org,
	krzk+dt@kernel.org, conor+dt@kernel.org, shawnguo@kernel.org,
	s.hauer@pengutronix.de
Cc: linux-media@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-imx@nxp.com,
	linux-arm-kernel@lists.infradead.org,
	jackson.lee@chipsnmedia.com, lafley.kim@chipsnmedia.com,
	Ming Qian <ming.qian@oss.nxp.com>
Subject: Re: [PATCH v3 8/9] media: chips-media: wave6: Add Wave6 control driver
Date: Fri, 29 Aug 2025 16:06:02 +0200	[thread overview]
Message-ID: <5502f52d-d302-4479-93b8-1da47731cf1d@kernel.org> (raw)
In-Reply-To: <20250829084649.359-9-nas.chung@chipsnmedia.com>

On 29/08/2025 10:46, Nas Chung wrote:
> +
> +static void wave6_vpu_load_firmware(const struct firmware *fw, void *context)
> +{
> +	struct wave6_vpu_device *vpu = context;
> +
> +	guard(mutex)(&vpu->lock);

Why? How could this be called in parallel, before the probe?

> +
> +	if (!fw || !fw->data) {
> +		dev_err(vpu->dev, "No firmware.\n");
> +		return;
> +	}
> +
> +	if (!vpu->fw_available)
> +		goto exit;
> +
> +	if (fw->size + W6_EXTRA_CODE_BUF_SIZE > wave6_vpu_get_code_buf_size(vpu)) {
> +		dev_err(vpu->dev, "firmware size (%ld > %zd) is too big\n",
> +			fw->size, vpu->code_buf.size);
> +		vpu->fw_available = false;
> +		goto exit;
> +	}
> +
> +	memcpy(vpu->code_buf.vaddr, fw->data, fw->size);
> +
> +	vpu->get_vpu = wave6_vpu_get;
> +	vpu->put_vpu = wave6_vpu_put;
> +	vpu->req_work_buffer = wave6_vpu_require_work_buffer;
> +	of_platform_populate(vpu->dev->of_node, NULL, NULL, vpu->dev);
> +
> +exit:
> +	release_firmware(fw);
> +}
> +
> +static int wave6_vpu_probe(struct platform_device *pdev)
> +{
> +	struct device_node *np;
> +	struct wave6_vpu_device *vpu;
> +	const struct wave6_vpu_resource *res;
> +	int ret;
> +
> +	ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
> +	if (ret < 0) {
> +		dev_err(&pdev->dev, "dma_set_mask_and_coherent failed: %d\n", ret);
> +		return ret;
> +	}
> +
> +	res = of_device_get_match_data(&pdev->dev);
> +	if (!res)
> +		return -ENODEV;
> +
> +	vpu = devm_kzalloc(&pdev->dev, sizeof(*vpu), GFP_KERNEL);
> +	if (!vpu)
> +		return -ENOMEM;
> +
> +	ret = devm_mutex_init(&pdev->dev, &vpu->lock);
> +	if (ret)
> +		return ret;
> +
> +	atomic_set(&vpu->core_count, 0);
> +	INIT_LIST_HEAD(&vpu->work_buffers);
> +	dev_set_drvdata(&pdev->dev, vpu);
> +	vpu->dev = &pdev->dev;
> +	vpu->res = res;
> +	vpu->reg_base = devm_platform_ioremap_resource(pdev, 0);
> +	if (IS_ERR(vpu->reg_base))
> +		return PTR_ERR(vpu->reg_base);
> +
> +	ret = devm_clk_bulk_get_all(&pdev->dev, &vpu->clks);
> +	if (ret < 0) {
> +		dev_warn(&pdev->dev, "unable to get clocks: %d\n", ret);

You need to handle deferred probe.

> +		ret = 0;
> +	}
> +	vpu->num_clks = ret;
Best regards,
Krzysztof

  reply	other threads:[~2025-08-29 14:06 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-29  8:46 [PATCH v3 0/9] Add support for Wave6 video codec driver Nas Chung
2025-08-29  8:46 ` [PATCH v3 1/9] media: v4l2-common: Add YUV24 format info Nas Chung
2025-08-29  8:46 ` [PATCH v3 2/9] dt-bindings: media: nxp: Add Wave6 video codec device Nas Chung
2025-08-29 13:57   ` Krzysztof Kozlowski
2025-09-02  5:45     ` Nas Chung
2025-09-02  7:42       ` Nas Chung
2025-08-29  8:46 ` [PATCH v3 3/9] media: chips-media: wave6: Add Wave6 VPU interface Nas Chung
2025-08-29  8:46 ` [PATCH v3 4/9] media: chips-media: wave6: Add v4l2 m2m driver support Nas Chung
2025-08-29  8:46 ` [PATCH v3 5/9] media: chips-media: wave6: Add Wave6 core driver Nas Chung
2025-08-29 14:02   ` Krzysztof Kozlowski
2025-09-01  8:34     ` Nas Chung
2025-08-29  8:46 ` [PATCH v3 6/9] media: chips-media: wave6: Improve debugging capabilities Nas Chung
2025-08-29  8:46 ` [PATCH v3 7/9] media: chips-media: wave6: Add Wave6 thermal cooling device Nas Chung
2025-08-29  8:46 ` [PATCH v3 8/9] media: chips-media: wave6: Add Wave6 control driver Nas Chung
2025-08-29 14:06   ` Krzysztof Kozlowski [this message]
2025-09-01  8:13     ` Nas Chung
2025-09-01 10:44       ` Krzysztof Kozlowski
2025-09-02  2:03         ` Nas Chung
2025-08-29  8:46 ` [PATCH v3 9/9] arm64: dts: freescale: imx95: Add video codec node Nas Chung
2025-08-29 14:07   ` Krzysztof Kozlowski
2025-09-01  7:38     ` Nas Chung

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=5502f52d-d302-4479-93b8-1da47731cf1d@kernel.org \
    --to=krzk@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=hverkuil@xs4all.nl \
    --cc=jackson.lee@chipsnmedia.com \
    --cc=krzk+dt@kernel.org \
    --cc=lafley.kim@chipsnmedia.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=ming.qian@oss.nxp.com \
    --cc=nas.chung@chipsnmedia.com \
    --cc=robh@kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@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;
as well as URLs for NNTP newsgroup(s).