Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Erikas Bitovtas" <xerikasxx@gmail.com>
Cc: conor+dt@kernel.org, devicetree@vger.kernel.org,
	krzk+dt@kernel.org, robh@kernel.org
Subject: Re: [PATCH v6 7/8] media: qcom: venus: Add msm8939 resource struct
Date: Tue, 12 May 2026 00:34:53 +0000	[thread overview]
Message-ID: <20260512003454.07714C2BCB0@smtp.kernel.org> (raw)
In-Reply-To: <20260510-msm8939-venus-rfc-v6-7-e69465375900@gmail.com>

Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [High] Non-monotonic frequency table causes scaling inversions and dead code.
- [High] Clock rate array aliasing leaves `vcodec1_core` unscaled.
- [High] Missing PM domain detachment causes a resource leak on probe failure/unbind.
--

commit 568a6ece0caefd3f300b18b1d182b85169c54db9
Author: André Apitzsch <git@apitzsch.eu>

media: qcom: venus: Add msm8939 resource struct

This commit adds configuration data and the related compatible string to
support the msm8939 platform in the venus media driver.

> diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c
> --- a/drivers/media/platform/qcom/venus/core.c
> +++ b/drivers/media/platform/qcom/venus/core.c
> @@ -688,6 +688,46 @@ static const struct venus_resources msm8916_res = {
>  	.enc_nodename = "video-encoder",
>  };
>  
> +static const struct freq_tbl msm8939_freq_table[] = {
> +	{ 489600, 266670000 },	/* 1080p @ 60 */
> +	{ 244800, 133330000 },	/* 1080p @ 30 */
> +	{ 244800, 200000000 },	/* 1080p @ 30 */
> +	{ 220800, 133330000 },	/* 720p @ 60 */
> +	{ 108000, 133330000 },	/* 720p @ 30 */
> +	{ 108000, 200000000 },	/* 720p @ 30 */

The freq_tbl algorithm in load_scale_v1() iterates sequentially over this
table and stops when mbs_per_sec > table[i].load.

Since there are duplicate load thresholds here (e.g., 244800 and 108000),
does this ordering cause scaling inversions and leave the 133.33MHz entries
as dead code?

For a load of 108001, the loop breaks at the first 108000 entry, falling
back to the previous frequency (133.33MHz). However, for a lower load of
exactly 108000, it continues past the first entry and breaks at 72000,
acquiring the higher 200MHz frequency.

> +	{ 72000, 133330000 },	/* VGA @ 60 */
> +	{ 36000, 133330000 },	/* VGA @ 30 */
> +};

[ ... ]

> +static const struct venus_resources msm8939_res = {
> +	.freq_tbl = msm8939_freq_table,
> +	.freq_tbl_size = ARRAY_SIZE(msm8939_freq_table),
> +	.reg_tbl = msm8939_reg_preset,
> +	.reg_tbl_size = ARRAY_SIZE(msm8939_reg_preset),
> +	.clks = { "core", "iface", "bus", },
> +	.clks_num = 3,
> +	.vcodec0_clks = { "vcodec0_core", "vcodec1_core" },
> +	.vcodec1_clks = { "vcodec0_core", "vcodec1_core" },

Are both clock arrays intended to have "vcodec0_core" at index 0?

The dynamic frequency scaling logic in core_clks_set_rate() applies the
required frequency explicitly to index 0 of both arrays:

    clk_set_rate(core->vcodec0_clks[0], freq);
    clk_set_rate(core->vcodec1_clks[0], freq);

Because "vcodec0_core" is at index 0 for both arrays, this sets
vcodec0_core twice and leaves vcodec1_core unscaled.

> +	.vcodec_clks_num = 2,
> +	.vcodec_pmdomains = (const char *[]) { "venus", "vcodec0", "vcodec1" },

Because previous V1 resources did not define vcodec_pmdomains, the domain
attachment in vcodec_domains_get_v1() would return early.

Now that this patch populates the array, will this cause a PM domain
resource leak on probe failure or driver unbind?

The corresponding teardown function core_put_v1() is currently empty and
lacks a call to dev_pm_domain_detach_list() to clean up the domains
attached by vcodec_domains_get_v1().

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260510-msm8939-venus-rfc-v6-0-e69465375900@gmail.com?part=7

  reply	other threads:[~2026-05-12  0:34 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <k-DF0RGht93wXW1P6HM3qlZuXIYqVpHIKYFu9l6z96km16C4l2xdRs_WRSg-CGedvnnjzaWo_VzIg05JKTNoIg==@protonmail.internalid>
2026-05-10  9:47 ` [PATCH v6 0/8] media: qcom: venus: add MSM8939 support Erikas Bitovtas
2026-05-10  9:47   ` [PATCH v6 1/8] media: dt-bindings: venus: Add qcom,msm8939 schema Erikas Bitovtas
2026-05-10  9:47   ` [PATCH v6 2/8] arm64: dts: qcom: msm8939: Add venus node Erikas Bitovtas
2026-05-10  9:47   ` [PATCH v6 3/8] arm64: dts: qcom: msm8939-longcheer-l9100: Enable " Erikas Bitovtas
2026-05-10  9:47   ` [PATCH v6 4/8] arm64: dts: qcom: msm8939-asus-z00t: add Venus Erikas Bitovtas
2026-05-10  9:47   ` [PATCH v6 5/8] clk: qcom: gcc-msm8939: mark Venus core GDSCs as hardware controlled Erikas Bitovtas
2026-05-12 10:01     ` Konrad Dybcio
2026-05-10  9:47   ` [PATCH v6 6/8] media: qcom: venus: add power domain enable logic for Venus cores Erikas Bitovtas
2026-05-11 23:47     ` sashiko-bot
2026-05-10  9:47   ` [PATCH v6 7/8] media: qcom: venus: Add msm8939 resource struct Erikas Bitovtas
2026-05-12  0:34     ` sashiko-bot [this message]
2026-05-10  9:47   ` [PATCH v6 8/8] media: qcom: venus: add codec blacklist mechanism Erikas Bitovtas
2026-05-12  9:17   ` [PATCH v6 0/8] media: qcom: venus: add MSM8939 support Bryan O'Donoghue

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=20260512003454.07714C2BCB0@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=robh@kernel.org \
    --cc=sashiko@lists.linux.dev \
    --cc=xerikasxx@gmail.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