Skip to content

Commit db1ec60

Browse files
Mani-Sadhasivambjorn-helgaas
authored andcommitted
PCI: qcom: Use OPP only if the platform supports it
With commit 5b6272e ("PCI: qcom: Add OPP support to scale performance"), OPP was used to control the interconnect and power domains if the platform supported OPP. Also to maintain the backward compatibility with platforms not supporting OPP but just ICC, the above mentioned commit assumed that if ICC was not available on the platform, it would resort to OPP. Unfortunately, some old platforms don't support either ICC or OPP. On those platforms, resorting to OPP in the absence of ICC throws below errors from OPP core during suspend and resume: qcom-pcie 1c08000.pcie: dev_pm_opp_set_opp: device opp doesn't exist qcom-pcie 1c08000.pcie: _find_key: OPP table not found (-19) Also, it doesn't make sense to invoke the OPP APIs when OPP is not supported by the platform at all. Add a "use_pm_opp" flag to identify whether OPP is supported and use it to control invoking the OPP APIs. Fixes: 5b6272e ("PCI: qcom: Add OPP support to scale performance") Link: https://lore.kernel.org/linux-pci/[email protected] Signed-off-by: Manivannan Sadhasivam <[email protected]> Signed-off-by: Krzysztof Wilczyński <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]> Reviewed-by: Mayank Rana <[email protected]>
1 parent 5d6a6c7 commit db1ec60

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

drivers/pci/controller/dwc/pcie-qcom.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,7 @@ struct qcom_pcie {
261261
const struct qcom_pcie_cfg *cfg;
262262
struct dentry *debugfs;
263263
bool suspended;
264+
bool use_pm_opp;
264265
};
265266

266267
#define to_qcom_pcie(x) dev_get_drvdata((x)->dev)
@@ -1433,7 +1434,7 @@ static void qcom_pcie_icc_opp_update(struct qcom_pcie *pcie)
14331434
dev_err(pci->dev, "Failed to set bandwidth for PCIe-MEM interconnect path: %d\n",
14341435
ret);
14351436
}
1436-
} else {
1437+
} else if (pcie->use_pm_opp) {
14371438
freq_mbps = pcie_dev_speed_mbps(pcie_link_speed[speed]);
14381439
if (freq_mbps < 0)
14391440
return;
@@ -1592,6 +1593,8 @@ static int qcom_pcie_probe(struct platform_device *pdev)
15921593
max_freq);
15931594
goto err_pm_runtime_put;
15941595
}
1596+
1597+
pcie->use_pm_opp = true;
15951598
} else {
15961599
/* Skip ICC init if OPP is supported as it is handled by OPP */
15971600
ret = qcom_pcie_icc_init(pcie);
@@ -1683,7 +1686,7 @@ static int qcom_pcie_suspend_noirq(struct device *dev)
16831686
if (ret)
16841687
dev_err(dev, "Failed to disable CPU-PCIe interconnect path: %d\n", ret);
16851688

1686-
if (!pcie->icc_mem)
1689+
if (pcie->use_pm_opp)
16871690
dev_pm_opp_set_opp(pcie->pci->dev, NULL);
16881691
}
16891692
return ret;

0 commit comments

Comments
 (0)