[PATCH v3 4/5] phy: apple: atc: Add T8122 DisplayPort support
sashiko-bot at kernel.org
sashiko-bot at kernel.org
Wed Nov 25 13:39:38 PST 2026
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] phy: apple: atc: incomplete lane reconfiguration in
atcphy_sw_set()
- [Medium] phy: apple: atc: missing DP mode check in
atcphy_wait_rcal1_done_t8122()
--
commit c4e8622c01c5077bdf8e1c63b98987b04ebc54bf
Author: Ramzi Abdiche <abdicheramzi at gmail.com>
phy: apple: atc: Add T8122 DisplayPort support
This commit adds DisplayPort AUX and lane setup support for T8122-family
Apple Type-C PHYs, including link-rate PLL/lane configuration and stopping
active lanes before mode or orientation changes.
> diff --git a/drivers/phy/apple/atc.c b/drivers/phy/apple/atc.c
> index 68fc93a88f41a..5c06883393539 100644
> --- a/drivers/phy/apple/atc.c
> +++ b/drivers/phy/apple/atc.c
[ ... ]
> @@ -1951,6 +2497,13 @@ static void atcphy_configure_post_tunable_t8122(struct apple_atcphy *atcphy, enu
> udelay(10);
> }
>
> +static void atcphy_configure_post_tunable_t8122(struct apple_atcphy *atcphy, enum atcphy_mode mode)
> +{
> + if (atcphy_modes[mode].pipehandler_state == ATCPHY_PIPEHANDLER_STATE_USB3 ||
> + (atcphy->hw->dp_enable_aux && atcphy_modes[mode].enable_dp_aux))
> + atcphy_power_on_common_t8122(atcphy);
> +}
[Severity: Medium]
Should atcphy_wait_rcal1_done_t8122() also check
(atcphy->hw->dp_enable_aux && atcphy_modes[mode].enable_dp_aux)?
In 4-lane DisplayPort mode (APPLE_ATCPHY_MODE_DP), pipehandler_state is
ATCPHY_PIPEHANDLER_STATE_DUMMY while enable_dp_aux is true.
atcphy_configure_post_tunable_t8122() now powers on the AUS common block
for APPLE_ATCPHY_MODE_DP, but atcphy_wait_rcal1_done_t8122() still only
checks for ATCPHY_PIPEHANDLER_STATE_USB3:
drivers/phy/apple/atc.c:atcphy_wait_rcal1_done_t8122() {
if (atcphy_modes[mode].pipehandler_state == ATCPHY_PIPEHANDLER_STATE_USB3) {
ret = readl_poll_timeout(atcphy->regs.core + AUS_COMMON_DIG_RCAL1, reg,
(reg & AUS_COMMON_DIG_RCAL1_ALL_CODES_DONE), 10, 100000);
...
}
As a result, APPLE_ATCPHY_MODE_DP skips waiting for AUS_COMMON_DIG_RCAL1
calibration to complete after releasing PHY reset.
[ ... ]
> @@ -2283,19 +2851,31 @@ static int atcphy_probe_rcdev(struct apple_atcphy *atcphy)
> static int atcphy_sw_set(struct typec_switch_dev *sw, enum typec_orientation orientation)
> {
> struct apple_atcphy *atcphy = typec_switch_get_drvdata(sw);
> + bool swap_lanes;
> + int ret;
>
> guard(mutex)(&atcphy->lock);
>
> switch (orientation) {
> case TYPEC_ORIENTATION_NONE:
> - break;
> + return 0;
> case TYPEC_ORIENTATION_NORMAL:
> - atcphy->swap_lanes = false;
> + swap_lanes = false;
> break;
> case TYPEC_ORIENTATION_REVERSE:
> - atcphy->swap_lanes = true;
> + swap_lanes = true;
> break;
> + default:
> + return -EINVAL;
> + }
> +
> + /* Cleanup needs the old lane configuration until shutdown succeeds. */
> + if (swap_lanes != atcphy->swap_lanes && atcphy->hw->dp_stop) {
> + ret = atcphy->hw->dp_stop(atcphy);
> + if (ret)
> + return ret;
> + }
> + atcphy->swap_lanes = swap_lanes;
>
> return 0;
> }
[Severity: Medium]
If orientation changes while atcphy->mode != APPLE_ATCPHY_MODE_OFF, does
stopping DisplayPort without reconfiguring the PHY leave the crossbar and
lane routing out of sync with atcphy->swap_lanes?
atcphy_sw_set() stops the DisplayPort link and updates atcphy->swap_lanes,
but leaves the hardware crossbar, lane mode, ATCPHY_MISC_LANE_SWAP and
lane tunables programmed for the previous orientation. If
atcphy_mux_set() is then called with the same target_mode, it returns
early because atcphy->mode == target_mode, and a subsequent
atcphy_dp_set_rate_t8122() configures the DisplayPort PMA lanes for the
new orientation while the crossbar remains routed for the old one.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261125-t8122-phy-v3-0-196e20b3537e@chaosmail.tech?part=4
More information about the linux-phy
mailing list