Skip to content

Commit d45531b

Browse files
committed
drm: apple: dptxport: get_max_lane_count: Retrieve lane count from phy
This unfortunately doesn't work relieably with typec-altmode-displayport since the oob hotplug notification arrives before atc-phy is configured to the appropiate DP mode. Signed-off-by: Janne Grunau <j@jannau.net>
1 parent dc80c79 commit d45531b

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

drivers/gpu/drm/apple/dptxep.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,13 +249,27 @@ static int dptxport_call_get_max_lane_count(struct apple_epic_service *service,
249249
void *reply_, size_t reply_size)
250250
{
251251
struct dptxport_apcall_lane_count *reply = reply_;
252+
struct dptx_port *dptx = service->cookie;
253+
union phy_configure_opts phy_ops;
254+
int ret;
252255

253256
if (reply_size < sizeof(*reply))
254257
return -EINVAL;
255258

256259
reply->retcode = cpu_to_le32(0);
257260
reply->lane_count = cpu_to_le64(4);
258261

262+
ret = phy_validate(dptx->atcphy, PHY_MODE_DP, 0, &phy_ops);
263+
if (ret < 0 || phy_ops.dp.lanes < 2) {
264+
// phy_validate might return 0 lines if atc-phy is not yet
265+
// switched to DP alt mode
266+
dev_dbg(service->ep->dcp->dev, "get_max_lane_count: "
267+
"phy_validate ret:%d lanes:%d\n", ret, phy_ops.dp.lanes);
268+
} else {
269+
reply->retcode = cpu_to_le32(0);
270+
reply->lane_count = cpu_to_le64(phy_ops.dp.lanes);
271+
}
272+
259273
return 0;
260274
}
261275

0 commit comments

Comments
 (0)