Devicetree
 help / color / mirror / Atom feed
From: Bryan O'Donoghue <bod@kernel.org>
To: Anusha Arun Nandi <anusha.nandi@oss.qualcomm.com>,
	vkoul@kernel.org, kishon@kernel.org, robh@kernel.org,
	krzk+dt@kernel.org, conor+dt@kernel.org,
	neil.armstrong@linaro.org, mani@kernel.org
Cc: gjorgji.rosikopulos@oss.qualcomm.com,
	hariram.purushothaman@oss.qualcomm.com, akapatra@quicinc.com,
	jigarkumar.zala@oss.qualcomm.com, loic.poulain@oss.qualcomm.com,
	vladimir.zapolskiy@linaro.org, linux-arm-msm@vger.kernel.org,
	linux-phy@lists.infradead.org, linux-media@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/7] phy: qcom-mipi-csi2: fix -EEXIST probe failure on single power-domain SoCs
Date: Mon, 19 Oct 2026 10:55:16 +0100	[thread overview]
Message-ID: <fc2c2f40-8a55-442a-9b0a-d73f040af60d@kernel.org> (raw)
In-Reply-To: <20261016235502.2274268-2-anusha.nandi@oss.qualcomm.com>

On 17/10/2026 00:54, Anusha Arun Nandi wrote:
> sa8775p, qcs8300 and sc7280 each list exactly one power-domain ("top")
> on the CSI2 PHY node. For a device with a single power-domain phandle,
> the generic platform-bus code (platform_probe() ->
> dev_pm_domain_attach()) auto-attaches it via genpd_dev_pm_attach()
> before the driver's own probe() runs. phy_qcom_mipi_csi2_probe() then
> unconditionally calls devm_pm_domain_attach_list(), which fails with
> -EEXIST because dev->pm_domain is already set, and the driver treats
> that as fatal:
> 
>    qcom-mipi-csi2-phy ace6000.phy: error -EEXIST: Failed to attach
>    power-domain list
>    qcom-mipi-csi2-phy ace6000.phy: probe with driver qcom-mipi-csi2-phy
>    failed with error -17
> 
> x1e80100 is unaffected: it lists three power-domains, so the generic
> code does not auto-attach any of them (auto-attach only applies to
> single-power-domain devices); the driver's explicit attach is the
> only one that runs.
> 
> For the single power-domain case, call dev_pm_domain_attach() instead
> of devm_pm_domain_attach_list(): it returns early when dev->pm_domain
> is already set, so csi2phy->pd_list is left NULL rather than built up
> by hand. The three call sites that walk pd_list for genpd
> performance-state scaling now guard against a NULL pd_list, which is
> harmless since scaling is unused (scaled = false) on every SoC that has
> a single "top" domain.

Fix implies bug but, this patch really adds support for one power-domain 
cases.

I think the patch title should be something like "Add support for single 
power-domain case"

or if you believe it is a bugfix level change add

Fixes:
Cc: stable@vger.kernel.org

My own preference is "Add support" since the driver hasn't been designed 
to support single PD cases thus far but, OTOH you could make an argument 
that that is in fact a design bug.

> Signed-off-by: Anusha Arun Nandi <anusha.nandi@oss.qualcomm.com>
> ---
>   .../phy/qualcomm/phy-qcom-mipi-csi2-core.c    | 24 +++++++++++++------
>   1 file changed, 17 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/phy/qualcomm/phy-qcom-mipi-csi2-core.c b/drivers/phy/qualcomm/phy-qcom-mipi-csi2-core.c
> index c0a4fa20eaf0..00285be9dd64 100644
> --- a/drivers/phy/qualcomm/phy-qcom-mipi-csi2-core.c
> +++ b/drivers/phy/qualcomm/phy-qcom-mipi-csi2-core.c
> @@ -43,7 +43,7 @@ phy_qcom_mipi_csi2_set_clock_rates(struct mipi_csi2phy_device *csi2phy,
>   	}
> 
>   	pstate = 0;
> -	for (i = 0; i < csi2phy->pd_list->num_pds; i++) {
> +	for (i = 0; csi2phy->pd_list && i < csi2phy->pd_list->num_pds; i++) {
>   		unsigned int perf;
> 
>   		if (!csi2phy->soc_cfg->genpds[i].scaled)
> @@ -174,7 +174,7 @@ static int phy_qcom_mipi_csi2_power_on(struct phy *phy)
>   unset_rate:
>   	dev_pm_opp_set_rate(csi2phy->dev, 0);
> 
> -	for (i = 0; i < csi2phy->pd_list->num_pds; i++) {
> +	for (i = 0; csi2phy->pd_list && i < csi2phy->pd_list->num_pds; i++) {
>   		if (!csi2phy->soc_cfg->genpds[i].scaled)
>   			continue;
> 
> @@ -204,7 +204,7 @@ static int phy_qcom_mipi_csi2_power_off(struct phy *phy)
> 
>   	dev_pm_opp_set_rate(csi2phy->dev, 0);
> 
> -	for (i = 0; i < csi2phy->pd_list->num_pds; i++) {
> +	for (i = 0; csi2phy->pd_list && i < csi2phy->pd_list->num_pds; i++) {
>   		if (!csi2phy->soc_cfg->genpds[i].scaled)
>   			continue;
> 
> @@ -233,6 +233,19 @@ static int phy_qcom_mipi_csi2_attach_pm_domains(struct mipi_csi2phy_device *csi2
>   	const char **pd_names;
>   	int i;
> 
> +	/*
> +	 * A device with a single power-domain entry in the devicetree is
> +	 * already attached by the generic platform-bus code before probe()
> +	 * runs (genpd_dev_pm_attach()), so calling devm_pm_domain_attach_list()
> +	 * here would fail with -EEXIST. dev_pm_domain_attach() returns early
> +	 * in that case (dev->pm_domain already set) instead of leaving
> +	 * csi2phy->pd_list unset; this is fine since pd_list is only used for
> +	 * performance-state scaling, which is unused ("scaled = false") on
> +	 * every SoC that has a single "top" power-domain.
> +	 */

This is alot of comment - looks like LLM babble to me. I think it can be 
dropped the code is pretty obvious, if num_genpds == 1 do this other 
thing here.

> +	if (csi2phy->soc_cfg->num_genpds == 1)
> +		return dev_pm_domain_attach(csi2phy->dev, 0);
> +
>   	pd_names = devm_kzalloc(csi2phy->dev,
>   				sizeof(char *) * csi2phy->soc_cfg->num_genpds,
>   				GFP_KERNEL);
> @@ -369,11 +382,8 @@ static int phy_qcom_mipi_csi2_probe(struct platform_device *pdev)
>   		return ret;
> 
>   	ret = phy_qcom_mipi_csi2_attach_pm_domains(csi2phy);
> -	if (ret < 0 || csi2phy->pd_list == NULL) {
> -		if (ret == 0)
> -			ret = -ENODEV;
> +	if (ret < 0)
>   		return dev_err_probe(dev, ret, "Failed to attach power-domain list\n");
> -	}
> 
>   	ret = devm_pm_runtime_enable(dev);
>   	if (ret < 0)
> --
> 2.34.1


  reply	other threads:[~2026-10-19  9:55 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-16 23:54 [PATCH 0/7] phy: qcom-mipi-csi2: Add D-PHY support for sa8775p, qcs8300 and sc7280 Anusha Arun Nandi
2026-10-16 23:54 ` [PATCH 1/7] phy: qcom-mipi-csi2: fix -EEXIST probe failure on single power-domain SoCs Anusha Arun Nandi
2026-10-19  9:55   ` Bryan O'Donoghue [this message]
2026-10-16 23:54 ` [PATCH 2/7] dt-bindings: phy: qcom: Add qcom,sa8775p-csi2-phy schema Anusha Arun Nandi
2026-10-17 17:48   ` Nihal Kumar Gupta
2026-10-19  7:13     ` Krzysztof Kozlowski
2026-10-19  7:25       ` Nihal Kumar Gupta
2026-10-19  7:16   ` Krzysztof Kozlowski
2026-10-19  8:29   ` Bryan O'Donoghue
2026-10-16 23:54 ` [PATCH 3/7] dt-bindings: phy: qcom: Add qcs8300 to the CSI2 PHY schema Anusha Arun Nandi
2026-10-19  7:18   ` Krzysztof Kozlowski
2026-10-16 23:54 ` [PATCH 4/7] phy: qcom-mipi-csi2: Add sa8775p D-PHY support Anusha Arun Nandi
2026-10-19 10:01   ` Bryan O'Donoghue
2026-10-16 23:55 ` [PATCH 5/7] phy: qcom-mipi-csi2: Add qcs8300 CSI2 PHY support Anusha Arun Nandi
2026-10-19  7:18   ` Krzysztof Kozlowski
2026-10-16 23:55 ` [PATCH 6/7] dt-bindings: phy: qcom: Add qcom,sc7280-csi2-phy schema Anusha Arun Nandi
2026-10-19  7:19   ` Krzysztof Kozlowski
2026-10-16 23:55 ` [PATCH 7/7] phy: qcom-mipi-csi2: Add sc7280 D-PHY provider Anusha Arun Nandi
2026-10-17 17:50 ` [PATCH 0/7] phy: qcom-mipi-csi2: Add D-PHY support for sa8775p, qcs8300 and sc7280 Nihal Kumar Gupta

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=fc2c2f40-8a55-442a-9b0a-d73f040af60d@kernel.org \
    --to=bod@kernel.org \
    --cc=akapatra@quicinc.com \
    --cc=anusha.nandi@oss.qualcomm.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=gjorgji.rosikopulos@oss.qualcomm.com \
    --cc=hariram.purushothaman@oss.qualcomm.com \
    --cc=jigarkumar.zala@oss.qualcomm.com \
    --cc=kishon@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-phy@lists.infradead.org \
    --cc=loic.poulain@oss.qualcomm.com \
    --cc=mani@kernel.org \
    --cc=neil.armstrong@linaro.org \
    --cc=robh@kernel.org \
    --cc=vkoul@kernel.org \
    --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