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

Configure Feed

Select the types of activity you want to include in your feed.

phy: qcom: qmp-usbc: Add regulator init_load support

QMP USBC PHY drivers previously did not set init_load_uA for regulators,
which could result in incorrect vote levels. This patch introduces
regulator definitions with proper init_load_uA values based on each
chip's power grid design.

QCS615 USB3 PHY was previously reusing qcm2290_usb3phy_cfg, but its
regulator requirements differ. A new qcs615_usb3phy_cfg is added to
reflect the correct settings.

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Signed-off-by: Xiangxu Yin <xiangxu.yin@oss.qualcomm.com>
Link: https://patch.msgid.link/20251215-add-displayport-support-for-qcs615-platform-v8-4-cbc72c88a44e@oss.qualcomm.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Xiangxu Yin and committed by
Vinod Koul
3b193748 0599a4b9

+39 -29
+39 -29
drivers/phy/qualcomm/phy-qcom-qmp-usbc.c
··· 336 336 int (*calibrate_dp_phy)(struct qmp_usbc *qmp); 337 337 338 338 /* regulators to be requested */ 339 - const char * const *vreg_list; 339 + const struct regulator_bulk_data *vreg_list; 340 340 int num_vregs; 341 341 342 342 /* array of registers with different offsets */ ··· 428 428 "phy_phy", "phy", 429 429 }; 430 430 431 - /* list of regulators */ 432 - static const char * const qmp_phy_vreg_l[] = { 433 - "vdda-phy", "vdda-pll", 431 + static const struct regulator_bulk_data qmp_phy_msm8998_vreg_l[] = { 432 + { .supply = "vdda-phy", .init_load_uA = 68600 }, 433 + { .supply = "vdda-pll", .init_load_uA = 14200 }, 434 + }; 435 + 436 + static const struct regulator_bulk_data qmp_phy_sm2290_vreg_l[] = { 437 + { .supply = "vdda-phy", .init_load_uA = 66100 }, 438 + { .supply = "vdda-pll", .init_load_uA = 13300 }, 439 + }; 440 + 441 + static const struct regulator_bulk_data qmp_phy_qcs615_vreg_l[] = { 442 + { .supply = "vdda-phy", .init_load_uA = 50000 }, 443 + { .supply = "vdda-pll", .init_load_uA = 20000 }, 434 444 }; 435 445 436 446 static const struct qmp_usbc_offsets qmp_usbc_offsets_v3_qcm2290 = { ··· 464 454 .rx_tbl_num = ARRAY_SIZE(msm8998_usb3_rx_tbl), 465 455 .pcs_tbl = msm8998_usb3_pcs_tbl, 466 456 .pcs_tbl_num = ARRAY_SIZE(msm8998_usb3_pcs_tbl), 467 - .vreg_list = qmp_phy_vreg_l, 468 - .num_vregs = ARRAY_SIZE(qmp_phy_vreg_l), 457 + .vreg_list = qmp_phy_msm8998_vreg_l, 458 + .num_vregs = ARRAY_SIZE(qmp_phy_msm8998_vreg_l), 469 459 .regs = qmp_v3_usb3phy_regs_layout, 470 460 }; 471 461 ··· 480 470 .rx_tbl_num = ARRAY_SIZE(qcm2290_usb3_rx_tbl), 481 471 .pcs_tbl = qcm2290_usb3_pcs_tbl, 482 472 .pcs_tbl_num = ARRAY_SIZE(qcm2290_usb3_pcs_tbl), 483 - .vreg_list = qmp_phy_vreg_l, 484 - .num_vregs = ARRAY_SIZE(qmp_phy_vreg_l), 473 + .vreg_list = qmp_phy_sm2290_vreg_l, 474 + .num_vregs = ARRAY_SIZE(qmp_phy_sm2290_vreg_l), 485 475 .regs = qmp_v3_usb3phy_regs_layout_qcm2290, 486 476 }; 487 477 ··· 496 486 .rx_tbl_num = ARRAY_SIZE(sdm660_usb3_rx_tbl), 497 487 .pcs_tbl = qcm2290_usb3_pcs_tbl, 498 488 .pcs_tbl_num = ARRAY_SIZE(qcm2290_usb3_pcs_tbl), 499 - .vreg_list = qmp_phy_vreg_l, 500 - .num_vregs = ARRAY_SIZE(qmp_phy_vreg_l), 489 + .vreg_list = qmp_phy_msm8998_vreg_l, 490 + .num_vregs = ARRAY_SIZE(qmp_phy_msm8998_vreg_l), 491 + .regs = qmp_v3_usb3phy_regs_layout_qcm2290, 492 + }; 493 + 494 + static const struct qmp_phy_cfg qcs615_usb3phy_cfg = { 495 + .offsets = &qmp_usbc_offsets_v3_qcm2290, 496 + 497 + .serdes_tbl = qcm2290_usb3_serdes_tbl, 498 + .serdes_tbl_num = ARRAY_SIZE(qcm2290_usb3_serdes_tbl), 499 + .tx_tbl = qcm2290_usb3_tx_tbl, 500 + .tx_tbl_num = ARRAY_SIZE(qcm2290_usb3_tx_tbl), 501 + .rx_tbl = qcm2290_usb3_rx_tbl, 502 + .rx_tbl_num = ARRAY_SIZE(qcm2290_usb3_rx_tbl), 503 + .pcs_tbl = qcm2290_usb3_pcs_tbl, 504 + .pcs_tbl_num = ARRAY_SIZE(qcm2290_usb3_pcs_tbl), 505 + .vreg_list = qmp_phy_qcs615_vreg_l, 506 + .num_vregs = ARRAY_SIZE(qmp_phy_qcs615_vreg_l), 501 507 .regs = qmp_v3_usb3phy_regs_layout_qcm2290, 502 508 }; 503 509 ··· 798 772 SET_RUNTIME_PM_OPS(qmp_usbc_runtime_suspend, 799 773 qmp_usbc_runtime_resume, NULL) 800 774 }; 801 - 802 - static int qmp_usbc_vreg_init(struct qmp_usbc *qmp) 803 - { 804 - const struct qmp_phy_cfg *cfg = qmp->cfg; 805 - struct device *dev = qmp->dev; 806 - int num = cfg->num_vregs; 807 - int i; 808 - 809 - qmp->vregs = devm_kcalloc(dev, num, sizeof(*qmp->vregs), GFP_KERNEL); 810 - if (!qmp->vregs) 811 - return -ENOMEM; 812 - 813 - for (i = 0; i < num; i++) 814 - qmp->vregs[i].supply = cfg->vreg_list[i]; 815 - 816 - return devm_regulator_bulk_get(dev, num, qmp->vregs); 817 - } 818 775 819 776 static int qmp_usbc_reset_init(struct qmp_usbc *qmp, 820 777 const char *const *reset_list, ··· 1106 1097 1107 1098 mutex_init(&qmp->phy_mutex); 1108 1099 1109 - ret = qmp_usbc_vreg_init(qmp); 1100 + ret = devm_regulator_bulk_get_const(qmp->dev, qmp->cfg->num_vregs, 1101 + qmp->cfg->vreg_list, &qmp->vregs); 1110 1102 if (ret) 1111 1103 return ret; 1112 1104 ··· 1173 1163 .data = &qcm2290_usb3phy_cfg, 1174 1164 }, { 1175 1165 .compatible = "qcom,qcs615-qmp-usb3-phy", 1176 - .data = &qcm2290_usb3phy_cfg, 1166 + .data = &qcs615_usb3phy_cfg, 1177 1167 }, { 1178 1168 .compatible = "qcom,sdm660-qmp-usb3-phy", 1179 1169 .data = &sdm660_usb3phy_cfg,