Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 25 additions & 2 deletions drivers/phy/apple/atc-t6050-dp.c
Original file line number Diff line number Diff line change
Expand Up @@ -646,8 +646,9 @@ static int t6050_dp_set_mode(struct phy *phy, enum phy_mode mode, int submode)
return -EBUSY;
if (mode == PHY_MODE_DP)
return dp->typec ? (dp->enabled ? 0 : -ENOLINK) : atc_start(dp);
/* A fixed DP PHY stays started (see t6050_dp_start_fixed()): only its link goes down. */
if (mode == PHY_MODE_INVALID)
return dp->combo ? atc_link_rate(dp, -1) : atc_stop(dp);
return dp->combo || !dp->typec ? atc_link_rate(dp, -1) : atc_stop(dp);
return -EINVAL;
}

Expand Down Expand Up @@ -997,6 +998,25 @@ static int t6050_typec_register(struct t6050_dp *dp)
return devm_add_action_or_reset(dp->dev, t6050_typec_mux_release, mux);
}

/*
* A fixed DP PHY, one without a Type-C mux (the PHY in front of an HDMI port's DP-to-HDMI converter),
* has nothing that starts it before the display processor connects: a Type-C PHY is started by its
* mux, and the display processor only asks for DisplayPort mode (t6050_dp_set_mode()) once the link
* is up. Firmware 27 does not get that far with the PHY off: the connect fails with link faults
* 22/24 on the PHY's target. Start it once here; it stays started until shutdown.
*/
static void t6050_dp_start_fixed(struct t6050_dp *dp)
{
int ret;

if (dp->typec || dp->combo)
return;
scoped_guard(mutex, &dp->lock)
ret = atc_start(dp);
if (ret)
dev_warn(dp->dev, "fixed DP PHY did not start: %d\n", ret);
}

static int t6050_dp_probe(struct platform_device *pdev)
{
static const char * const domains[] = {"usb-aon", "common", "wrapper", "usb"};
Expand Down Expand Up @@ -1217,7 +1237,10 @@ static int t6050_dp_probe(struct platform_device *pdev)
provider = devm_of_phy_provider_register(dev, dp->combo ? combo_xlate : of_phy_simple_xlate);
if (IS_ERR(provider))
return PTR_ERR(provider);
return dp->typec ? t6050_typec_register(dp) : 0;
if (dp->typec)
return t6050_typec_register(dp);
t6050_dp_start_fixed(dp);
return 0;
}

static void t6050_dp_shutdown(struct platform_device *pdev)
Expand Down
Loading