Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

PCI: qcom: Use regulator bulk api for apq8064 supplies

This patch converts existing regulators to use regulator bulk apis,
to make it consistent with msm8996 changes also cut down some redundant code.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Acked-by: Stanimir Varbanov <svarbanov@mm-sol.com>

authored by

Srinivas Kandagatla and committed by
Lorenzo Pieralisi
68e7c15c f625b1ad

+15 -37
+15 -37
drivers/pci/dwc/pcie-qcom.c
··· 79 79 #define PCIE20_v3_PARF_SLV_ADDR_SPACE_SIZE 0x358 80 80 #define SLV_ADDR_SPACE_SZ 0x10000000 81 81 82 + #define QCOM_PCIE_2_1_0_MAX_SUPPLY 3 82 83 struct qcom_pcie_resources_2_1_0 { 83 84 struct clk *iface_clk; 84 85 struct clk *core_clk; ··· 89 88 struct reset_control *ahb_reset; 90 89 struct reset_control *por_reset; 91 90 struct reset_control *phy_reset; 92 - struct regulator *vdda; 93 - struct regulator *vdda_phy; 94 - struct regulator *vdda_refclk; 91 + struct regulator_bulk_data supplies[QCOM_PCIE_2_1_0_MAX_SUPPLY]; 95 92 }; 96 93 97 94 struct qcom_pcie_resources_1_0_0 { ··· 217 218 struct qcom_pcie_resources_2_1_0 *res = &pcie->res.v2_1_0; 218 219 struct dw_pcie *pci = pcie->pci; 219 220 struct device *dev = pci->dev; 221 + int ret; 220 222 221 - res->vdda = devm_regulator_get(dev, "vdda"); 222 - if (IS_ERR(res->vdda)) 223 - return PTR_ERR(res->vdda); 224 - 225 - res->vdda_phy = devm_regulator_get(dev, "vdda_phy"); 226 - if (IS_ERR(res->vdda_phy)) 227 - return PTR_ERR(res->vdda_phy); 228 - 229 - res->vdda_refclk = devm_regulator_get(dev, "vdda_refclk"); 230 - if (IS_ERR(res->vdda_refclk)) 231 - return PTR_ERR(res->vdda_refclk); 223 + res->supplies[0].supply = "vdda"; 224 + res->supplies[1].supply = "vdda_phy"; 225 + res->supplies[2].supply = "vdda_refclk"; 226 + ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(res->supplies), 227 + res->supplies); 228 + if (ret) 229 + return ret; 232 230 233 231 res->iface_clk = devm_clk_get(dev, "iface"); 234 232 if (IS_ERR(res->iface_clk)) ··· 271 275 clk_disable_unprepare(res->iface_clk); 272 276 clk_disable_unprepare(res->core_clk); 273 277 clk_disable_unprepare(res->phy_clk); 274 - regulator_disable(res->vdda); 275 - regulator_disable(res->vdda_phy); 276 - regulator_disable(res->vdda_refclk); 278 + regulator_bulk_disable(ARRAY_SIZE(res->supplies), res->supplies); 277 279 } 278 280 279 281 static int qcom_pcie_init_2_1_0(struct qcom_pcie *pcie) ··· 282 288 u32 val; 283 289 int ret; 284 290 285 - ret = regulator_enable(res->vdda); 286 - if (ret) { 287 - dev_err(dev, "cannot enable vdda regulator\n"); 291 + ret = regulator_bulk_enable(ARRAY_SIZE(res->supplies), res->supplies); 292 + if (ret < 0) { 293 + dev_err(dev, "cannot enable regulators\n"); 288 294 return ret; 289 - } 290 - 291 - ret = regulator_enable(res->vdda_refclk); 292 - if (ret) { 293 - dev_err(dev, "cannot enable vdda_refclk regulator\n"); 294 - goto err_refclk; 295 - } 296 - 297 - ret = regulator_enable(res->vdda_phy); 298 - if (ret) { 299 - dev_err(dev, "cannot enable vdda_phy regulator\n"); 300 - goto err_vdda_phy; 301 295 } 302 296 303 297 ret = reset_control_assert(res->ahb_reset); ··· 371 389 err_clk_phy: 372 390 clk_disable_unprepare(res->iface_clk); 373 391 err_assert_ahb: 374 - regulator_disable(res->vdda_phy); 375 - err_vdda_phy: 376 - regulator_disable(res->vdda_refclk); 377 - err_refclk: 378 - regulator_disable(res->vdda); 392 + regulator_bulk_disable(ARRAY_SIZE(res->supplies), res->supplies); 379 393 380 394 return ret; 381 395 }