[PATCH v2 4/5] phy: apple: atc: Add T8122 DisplayPort support

Sven Peter sven at kernel.org
Tue Nov 24 03:46:50 PST 2026



On 22.11.26 13:28, Sasha Finkelstein wrote:
> From: Ramzi Abdiche <abdicheramzi at gmail.com>
> 
> Add DisplayPort AUX and lane setup for T8122-family PHYs.
> Select clock and lane settings by link rate and stop active
> lanes before orientation changes.
> 
> Signed-off-by: Ramzi Abdiche <abdicheramzi at gmail.com>
> Signed-off-by: Sasha Finkelstein <k at chaosmail.tech>
> ---

[...]

>   
> +struct atcphy_dp_ops {
> +	void (*enable_aux)(struct apple_atcphy *atcphy);
> +	void (*disable_aux)(struct apple_atcphy *atcphy);
> +	int (*set_rate)(struct apple_atcphy *atcphy, enum atcphy_dp_link_rate lr);
> +	int (*stop)(struct apple_atcphy *atcphy);
> +};

Couldn't we just make this part of atcphy_hw as well? That one already 
contains a bunch of variant-specific function pointers now and I don't 
see a reason why these here have to be separate.

> +
>   struct atcphy_hw {
>   	void (*configure_post_tunable)(struct apple_atcphy *atcphy, enum atcphy_mode mode);
>   	void (*configure_pipehandler_usb3_host)(struct apple_atcphy *atcphy);
> @@ -600,6 +733,7 @@ struct atcphy_hw {

[...]

>   static int atcphy_dp_configure_lane(struct apple_atcphy *atcphy, enum atcphy_lane lane,
>   				    const struct atcphy_dp_link_rate_configuration *cfg)
>   {
> @@ -1452,20 +2013,11 @@ static int atcphy_dp_configure_lane(struct apple_atcphy *atcphy, enum atcphy_lan
>   
>   	lockdep_assert_held(&atcphy->lock);
>   
> -	switch (lane) {
> -	case APPLE_ATCPHY_LANE_0:
> -		tx_shm = atcphy->regs.core + LN0_AUSPMA_TX_SHM;
> -		rx_shm = atcphy->regs.core + LN0_AUSPMA_RX_SHM;
> -		rx_top = atcphy->regs.core + LN0_AUSPMA_RX_TOP;
> -		break;
> -	case APPLE_ATCPHY_LANE_1:
> -		tx_shm = atcphy->regs.core + LN1_AUSPMA_TX_SHM;
> -		rx_shm = atcphy->regs.core + LN1_AUSPMA_RX_SHM;
> -		rx_top = atcphy->regs.core + LN1_AUSPMA_RX_TOP;
> -		break;
> -	default:
> +	if ((unsigned int)lane > APPLE_ATCPHY_LANE_1)
>   		return -EINVAL;
> -	}

This is a bit weird, that thing is an enum so why not just keep the 
switch? This is also the only place that checks if lane is valid before 
calling atcphy_lane_reg(). I don't think it's even possible to have an 
invalid value here so I'd maybe drop this check completely since it 
always passes or change atcphy_lane_reg() to be something like

	int atcphy_lane_reg(void __iomem **reg, ....)

and return an error and put the register into *reg.



Sven




More information about the linux-arm-kernel mailing list