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 TCSR parsing and PHY mode setting

Extend TCSR parsing to read optional dp_phy_mode_reg and add
qmp_usbc_set_phy_mode() to switch between USB and DP modes when
supported.

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-8-cbc72c88a44e@oss.qualcomm.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Xiangxu Yin and committed by
Vinod Koul
9ab26cb7 cb225582

+19 -6
+19 -6
drivers/phy/qualcomm/phy-qcom-qmp-usbc.c
··· 529 529 .regs = qmp_v3_usb3phy_regs_layout_qcm2290, 530 530 }; 531 531 532 + static void qmp_usbc_set_phy_mode(struct qmp_usbc *qmp, bool is_dp) 533 + { 534 + if (qmp->tcsr_map && qmp->dp_phy_mode_reg) 535 + regmap_write(qmp->tcsr_map, qmp->dp_phy_mode_reg, is_dp); 536 + } 537 + 532 538 static int qmp_usbc_com_init(struct phy *phy) 533 539 { 534 540 struct qmp_usbc *qmp = phy_get_drvdata(phy); ··· 674 668 ret = qmp_usbc_com_init(phy); 675 669 if (ret) 676 670 goto out_unlock; 671 + 672 + qmp_usbc_set_phy_mode(qmp, false); 677 673 678 674 ret = qmp_usbc_usb_power_on(phy); 679 675 if (ret) { ··· 1120 1112 qmp_usbc_com_exit(qmp->usb_phy); 1121 1113 1122 1114 qmp_usbc_com_init(qmp->usb_phy); 1115 + qmp_usbc_set_phy_mode(qmp, false); 1123 1116 qmp_usbc_usb_power_on(qmp->usb_phy); 1124 1117 } 1125 1118 ··· 1271 1262 return 0; 1272 1263 } 1273 1264 1274 - static int qmp_usbc_parse_vls_clamp(struct qmp_usbc *qmp) 1265 + static int qmp_usbc_parse_tcsr(struct qmp_usbc *qmp) 1275 1266 { 1276 1267 struct of_phandle_args tcsr_args; 1277 1268 struct device *dev = qmp->dev; 1278 - int ret; 1269 + int ret, args_count; 1279 1270 1280 - /* for backwards compatibility ignore if there is no property */ 1281 - ret = of_parse_phandle_with_fixed_args(dev->of_node, "qcom,tcsr-reg", 1, 0, 1282 - &tcsr_args); 1271 + args_count = of_property_count_u32_elems(dev->of_node, "qcom,tcsr-reg"); 1272 + args_count = args_count - 1; 1273 + ret = of_parse_phandle_with_fixed_args(dev->of_node, "qcom,tcsr-reg", 1274 + args_count, 0, &tcsr_args); 1283 1275 if (ret == -ENOENT) 1284 1276 return 0; 1285 1277 else if (ret < 0) ··· 1292 1282 return PTR_ERR(qmp->tcsr_map); 1293 1283 1294 1284 qmp->vls_clamp_reg = tcsr_args.args[0]; 1285 + 1286 + if (args_count > 1) 1287 + qmp->dp_phy_mode_reg = tcsr_args.args[1]; 1295 1288 1296 1289 return 0; 1297 1290 } ··· 1331 1318 if (ret) 1332 1319 return ret; 1333 1320 1334 - ret = qmp_usbc_parse_vls_clamp(qmp); 1321 + ret = qmp_usbc_parse_tcsr(qmp); 1335 1322 if (ret) 1336 1323 return ret; 1337 1324