* [PATCH v2] phy: qcom-mipi-csi2: Add support for single power-domain SoCs
@ 2026-10-28 5:20 ` Anusha Arun Nandi
2026-10-28 9:58 ` Bryan O'Donoghue
2026-10-28 15:37 ` Frank Li
0 siblings, 2 replies; 6+ messages in thread
From: Anusha Arun Nandi @ 2026-10-28 5:20 UTC (permalink / raw)
To: Bryan O'Donoghue
Cc: Vinod Koul, Neil Armstrong, Manivannan Sadhasivam,
gjorgji.rosikopulos, hariram.purushothaman, akapatra,
jigarkumar.zala, linux-phy, linux-media, linux-arm-msm,
linux-kernel
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:
1. qcom-mipi-csi2-phy ace6000.phy: error -EEXIST: Failed to attach
power-domain list
2. 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.
Signed-off-by: Anusha Arun Nandi <anusha.nandi@oss.qualcomm.com>
---
drivers/phy/qualcomm/phy-qcom-mipi-csi2-core.c | 15 ++++++++-------
1 file changed, 8 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..ac25e1e5f1c3 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,10 @@ static int phy_qcom_mipi_csi2_attach_pm_domains(struct mipi_csi2phy_device *csi2
const char **pd_names;
int i;
+ /* Single power-domain devices are already attached by the bus core. */
+ 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 +373,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
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH v2] phy: qcom-mipi-csi2: Add support for single power-domain SoCs
2026-10-28 5:20 ` [PATCH v2] phy: qcom-mipi-csi2: Add support for single power-domain SoCs Anusha Arun Nandi
@ 2026-10-28 9:58 ` Bryan O'Donoghue
2026-10-28 20:45 ` Anusha Arun Nandi
2026-10-28 15:37 ` Frank Li
1 sibling, 1 reply; 6+ messages in thread
From: Bryan O'Donoghue @ 2026-10-28 9:58 UTC (permalink / raw)
To: Anusha Arun Nandi
Cc: Vinod Koul, Neil Armstrong, Manivannan Sadhasivam,
gjorgji.rosikopulos, hariram.purushothaman, akapatra,
jigarkumar.zala, linux-phy, linux-media, linux-arm-msm,
linux-kernel
On 28/10/2026 05:20, Anusha Arun Nandi wrote:
> - 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");
> - }
Shouldn't this be
if (ret < 0 || ( csi2phy->soc_cfg->num_genpds > 1 && csi2phy->pd_list ==
NULL) {
i.e. you are dropping the NULL check for the case of multiple power-domains.
---
bod
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH v2] phy: qcom-mipi-csi2: Add support for single power-domain SoCs
2026-10-28 9:58 ` Bryan O'Donoghue
@ 2026-10-28 20:45 ` Anusha Arun Nandi
0 siblings, 0 replies; 6+ messages in thread
From: Anusha Arun Nandi @ 2026-10-28 20:45 UTC (permalink / raw)
To: Bryan O'Donoghue
Cc: Vinod Koul, Neil Armstrong, Manivannan Sadhasivam,
gjorgji.rosikopulos, hariram.purushothaman, akapatra,
jigarkumar.zala, linux-phy, linux-media, linux-arm-msm,
linux-kernel
Good catch, yes. I'd dropped the NULL-list check for the
multi-genpd case too, when it should only have been loosened for the
single-genpd case this patch actually touches. Applied.
Regards,
Anusha
On 10/28/2026 2:58 AM, Bryan O'Donoghue wrote:
> On 28/10/2026 05:20, Anusha Arun Nandi wrote:
>> - 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");
>> - }
>
> Shouldn't this be
>
> if (ret < 0 || ( csi2phy->soc_cfg->num_genpds > 1 && csi2phy->pd_list ==
> NULL) {
>
> i.e. you are dropping the NULL check for the case of multiple power-
> domains.
>
> ---
> bod
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] phy: qcom-mipi-csi2: Add support for single power-domain SoCs
2026-10-28 5:20 ` [PATCH v2] phy: qcom-mipi-csi2: Add support for single power-domain SoCs Anusha Arun Nandi
2026-10-28 9:58 ` Bryan O'Donoghue
@ 2026-10-28 15:37 ` Frank Li
2026-10-28 20:53 ` Anusha Arun Nandi
1 sibling, 1 reply; 6+ messages in thread
From: Frank Li @ 2026-10-28 15:37 UTC (permalink / raw)
To: Anusha Arun Nandi
Cc: Bryan O'Donoghue, Vinod Koul, Neil Armstrong,
Manivannan Sadhasivam, gjorgji.rosikopulos,
hariram.purushothaman, akapatra, jigarkumar.zala, linux-phy,
linux-media, linux-arm-msm, linux-kernel
On Tue, Oct 27, 2026 at 10:20:47PM -0700, 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:
>
> 1. qcom-mipi-csi2-phy ace6000.phy: error -EEXIST: Failed to attach
> power-domain list
> 2. 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.
>
> Signed-off-by: Anusha Arun Nandi <anusha.nandi@oss.qualcomm.com>
> ---
> drivers/phy/qualcomm/phy-qcom-mipi-csi2-core.c | 15 ++++++++-------
> 1 file changed, 8 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..ac25e1e5f1c3 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,10 @@ static int phy_qcom_mipi_csi2_attach_pm_domains(struct mipi_csi2phy_device *csi2
> const char **pd_names;
> int i;
>
> + /* Single power-domain devices are already attached by the bus core. */
> + if (csi2phy->soc_cfg->num_genpds == 1)
> + return dev_pm_domain_attach(csi2phy->dev, 0);
> +
why call dev_pm_domain_attach() if Single power-domain devices are already
attached by the bus core?
Frank
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH v2] phy: qcom-mipi-csi2: Add support for single power-domain SoCs
2026-10-28 15:37 ` Frank Li
@ 2026-10-28 20:53 ` Anusha Arun Nandi
0 siblings, 0 replies; 6+ messages in thread
From: Anusha Arun Nandi @ 2026-10-28 20:53 UTC (permalink / raw)
To: Frank Li
Cc: Bryan O'Donoghue, Vinod Koul, Neil Armstrong,
Manivannan Sadhasivam, gjorgji.rosikopulos,
hariram.purushothaman, akapatra, jigarkumar.zala, linux-phy,
linux-media, linux-arm-msm, linux-kernel
Hi Frank,
dev_pm_domain_attach() checks for that case itself:
int dev_pm_domain_attach(struct device *dev, u32 flags)
{
if (dev->pm_domain)
return 0;
...
So the call is a safe no-op when the bus core already attached it
(the common case here), and does the real attach work if it somehow
hasn't. It's not redundant, it's what makes this call safe to use
unconditionally, unlike the devm_pm_domain_attach_list() call it
replaces, which has no such early-return and fails with -EEXIST
instead when already attached. That -EEXIST is the bug this patch
fixes.
Regards,
Anusha
On 10/28/2026 8:37 AM, Frank Li wrote:
> On Tue, Oct 27, 2026 at 10:20:47PM -0700, 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:
>>
>> 1. qcom-mipi-csi2-phy ace6000.phy: error -EEXIST: Failed to attach
>> power-domain list
>> 2. 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.
>>
>> Signed-off-by: Anusha Arun Nandi <anusha.nandi@oss.qualcomm.com>
>> ---
>> drivers/phy/qualcomm/phy-qcom-mipi-csi2-core.c | 15 ++++++++-------
>> 1 file changed, 8 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..ac25e1e5f1c3 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,10 @@ static int phy_qcom_mipi_csi2_attach_pm_domains(struct mipi_csi2phy_device *csi2
>> const char **pd_names;
>> int i;
>>
>> + /* Single power-domain devices are already attached by the bus core. */
>> + if (csi2phy->soc_cfg->num_genpds == 1)
>> + return dev_pm_domain_attach(csi2phy->dev, 0);
>> +
>
> why call dev_pm_domain_attach() if Single power-domain devices are already
> attached by the bus core?
>
> Frank
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2] phy: qcom-mipi-csi2: Add support for single power-domain SoCs
@ 2026-10-28 5:10 Anusha Arun Nandi
0 siblings, 0 replies; 6+ messages in thread
From: Anusha Arun Nandi @ 2026-10-28 5:10 UTC (permalink / raw)
To: kernel, Bryan O'Donoghue
Cc: gjorgji.rosikopulos, hariram.purushothaman, akapatra,
jigarkumar.zala, Vinod Koul, Neil Armstrong,
Manivannan Sadhasivam, linux-phy, linux-media, linux-arm-msm,
linux-kernel
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.
Signed-off-by: Anusha Arun Nandi <anusha.nandi@oss.qualcomm.com>
---
drivers/phy/qualcomm/phy-qcom-mipi-csi2-core.c | 15 ++++++++-------
1 file changed, 8 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..ac25e1e5f1c3 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,10 @@ static int phy_qcom_mipi_csi2_attach_pm_domains(struct mipi_csi2phy_device *csi2
const char **pd_names;
int i;
+ /* Single power-domain devices are already attached by the bus core. */
+ 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 +373,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
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-10-28 20:53 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <ZW6-XDf5dgEFD66QI7ZA8WIK_alWTQD2RWolsXjlSql7pO5IUj9PM1T95LMfBd2Y3zKxRhDXXde1R4asZWzgKw==@protonmail.internalid>
2026-10-28 5:20 ` [PATCH v2] phy: qcom-mipi-csi2: Add support for single power-domain SoCs Anusha Arun Nandi
2026-10-28 9:58 ` Bryan O'Donoghue
2026-10-28 20:45 ` Anusha Arun Nandi
2026-10-28 15:37 ` Frank Li
2026-10-28 20:53 ` Anusha Arun Nandi
2026-10-28 5:10 Anusha Arun Nandi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®