[PATCH 2/3] PCI: qcom: Use bw_factor to adjust bandwidth based on link width
From: Krishna Chaitanya Chundru
Date: Thu Jul 17 2025 - 10:02:29 EST
Data rates 8GT/s x2 and Data rates 16GT/s x1 have same frequency so using
same OPP entry in the OPP table. QCOM controllers may have different RPMh
votes for different rates. So we can't use shared entries in the OPP.
Use only data rate freqiency and remove width in it and use bw_factor
to multiply bandwidth based up on the link width through OPP.
Signed-off-by: Krishna Chaitanya Chundru <krishna.chundru@xxxxxxxxxxxxxxxx>
---
drivers/pci/controller/dwc/pcie-qcom.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c
index c789e3f856550bcfa1ce09962ba9c086d117de05..fde9fd3fff6bdcec0c9618d3f4b003a3d823307f 100644
--- a/drivers/pci/controller/dwc/pcie-qcom.c
+++ b/drivers/pci/controller/dwc/pcie-qcom.c
@@ -1505,13 +1505,17 @@ static void qcom_pcie_icc_opp_update(struct qcom_pcie *pcie)
return;
freq_kbps = freq_mbps * KILO;
- opp = dev_pm_opp_find_freq_exact(pci->dev, freq_kbps * width,
+ opp = dev_pm_opp_find_freq_exact(pci->dev, freq_kbps,
true);
if (!IS_ERR(opp)) {
+ ret = dev_pm_opp_set_bw_factor(pci->dev, width);
+ if (ret)
+ dev_err(pci->dev, "Failed to set OPP scale: %d\n", ret);
+
ret = dev_pm_opp_set_opp(pci->dev, opp);
if (ret)
dev_err(pci->dev, "Failed to set OPP for freq (%lu): %d\n",
- freq_kbps * width, ret);
+ freq_kbps, ret);
dev_pm_opp_put(opp);
}
}
--
2.34.1