[PATCH v23 11/15] media: qcom: camss: tpg: Add support for v2.4.0 TPG

sashiko-bot at kernel.org sashiko-bot at kernel.org
Wed Oct 28 08:29:26 PDT 2026


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

commit f50ae6ce8455f618cec0228f4b565ad64a56769a
Author: Hangxiang Ma <hangxiang.ma at oss.qualcomm.com>

media: qcom: camss: tpg: Add support for v2.4.0 TPG

This commit adds support for the v2.4.0 TPG hardware found on Kaanapali,
routing TPG output through the CSI2 TPG mux in CSID 1080 RX and handling
test-enable and reset via TPG_CTRL_CMD.

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

[ ... ]

> @@ -164,18 +167,26 @@ static int tpg_stream_on(struct tpg_device *tpg)

[ ... ]

>  static int tpg_reset(struct tpg_device *tpg)
>  {
> -	writel(0, tpg->base + TPG_CTRL);
> -	writel(1, tpg->base + TPG_CLEAR);
> +	if (tpg->hw_version < TPG_HW_VER_2_4_0)
> +		writel(0, tpg->base + TPG_CTRL);
> +
> +	writel(TPG_CTRL_CMD_HW_RESET, tpg->base + TPG_CTRL_CMD);
>  
>  	return 0;
>  }

[Severity: Medium]
Is tpg->hw_version initialized when tpg_reset() runs for the first time?

In drivers/media/platform/qcom/camss/camss-tpg.c, tpg_set_power() calls
reset() before 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);
	}
}

Since tpg_hw_version() in drivers/media/platform/qcom/camss/camss-tpg-gen1.c
is where tpg->hw_version is populated from the TPG_HW_VERSION register,
tpg->hw_version is still 0 on the initial power-on. Won't this cause
tpg_reset() to evaluate 0 < TPG_HW_VER_2_4_0 as true and write 0 to TPG_CTRL
even on v2.4.0 hardware?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261028-kaanapali-camss-v23-0-95f250b18612@oss.qualcomm.com?part=11



More information about the linux-phy mailing list