Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Vladimir Zapolskiy" <vladimir.zapolskiy@linaro.org>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org,
	media-ci@linuxtv.org
Subject: Re: [PATCH 4/6] media: qcom: camss: tpg: Support TPG hardware version 2.2.0
Date: Sat, 31 Oct 2026 11:28:17 +0000	[thread overview]
Message-ID: <sashiko-outbox-191921@kernel.org> (raw)
In-Reply-To: <20261031112203.545319-5-vladimir.zapolskiy@linaro.org>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] media: qcom: camss: tpg_reset() checks hw_version before initialization
--

commit ed70791a72b90a115dbcf4eead6d852fc6c9f986
Author: Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>

media: qcom: camss: tpg: Support TPG hardware version 2.2.0

This commit lowers the TPG hardware version threshold from 2.4.0 to 2.2.0 in
tpg_stream_on() and tpg_reset() to support Qualcomm SM8650 CAMSS TPG blocks,
which start test pattern generation via TPG_CTRL_CMD rather than a test enable
bit in TPG_CTRL.

> diff --git a/drivers/media/platform/qcom/camss/camss-tpg-gen1.c b/drivers/media/platform/qcom/camss/camss-tpg-gen1.c
> index cabbb2638cf38..a83f9a80c2b6b 100644
> --- a/drivers/media/platform/qcom/camss/camss-tpg-gen1.c
> +++ b/drivers/media/platform/qcom/camss/camss-tpg-gen1.c

[ ... ]

> @@ -183,7 +184,7 @@ static int tpg_stream_on(struct tpg_device *tpg)
>  
>  static int tpg_reset(struct tpg_device *tpg)
>  {
> -	if (tpg->hw_version < TPG_HW_VER_2_4_0)
> +	if (tpg->hw_version < TPG_HW_VER_2_2_0)
>  		writel(0, tpg->base + TPG_CTRL);

[Severity: Medium]
When a TPG subdevice is powered on for the first time via tpg_set_power(), is
tpg->hw_version initialized before tpg_reset() checks it?

In drivers/media/platform/qcom/camss/camss-tpg.c, tpg_set_power() invokes the
reset callback before reading and storing the hardware version via the
hw_version callback (tpg_hw_version()):

drivers/media/platform/qcom/camss/camss-tpg.c:tpg_set_power() {
	...
	if (on) {
		...
		tpg->res->hw_ops->reset(tpg);

		tpg->res->hw_ops->hw_version(tpg);
	}
	...
}

Because camss->tpg is zero-allocated in camss_probe(), tpg->hw_version is
still 0 on the initial tpg_set_power() -> tpg_reset() call. As a result,
tpg->hw_version < TPG_HW_VER_2_2_0 evaluates to true on the first power-on
even on TPG v2.2.0 and newer hardware, causing tpg_reset() to execute
writel(0, tpg->base + TPG_CTRL).

Should tpg_set_power() call hw_ops->hw_version(tpg) before hw_ops->reset(tpg)?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261031112203.545319-1-vladimir.zapolskiy@linaro.org?part=4

  reply	other threads:[~2026-10-31 11:28 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-31 11:21 [PATCH 0/6] media: qcom: camss: Add SM8650 TPG support Vladimir Zapolskiy
2026-10-31 11:21 ` [PATCH 1/6] dt-bindings: media: qcom,sm8650-camss: Add test pattern generators Vladimir Zapolskiy
2026-10-31 11:34   ` sashiko-bot
2026-10-31 11:21 ` [PATCH 2/6] media: qcom: camss: Skip TPG if its registers are not described Vladimir Zapolskiy
2026-10-31 11:22 ` [PATCH 3/6] media: qcom: camss: tpg: Add support for v2.4.0 TPG Vladimir Zapolskiy
2026-10-31 11:27   ` sashiko-bot
2026-10-31 11:22 ` [PATCH 4/6] media: qcom: camss: tpg: Support TPG hardware version 2.2.0 Vladimir Zapolskiy
2026-10-31 11:28   ` sashiko-bot [this message]
2026-10-31 11:22 ` [PATCH 5/6] media: qcom: camss: Add SM8650 TPG support Vladimir Zapolskiy
2026-10-31 11:22 ` [PATCH 6/6] arm64: dts: qcom: sm8650: Add CAMSS test pattern generators Vladimir Zapolskiy

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=sashiko-outbox-191921@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=media-ci@linuxtv.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --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