[PATCH v2 19/22] phy: cadence-torrent: track current DP link bit rate
Benjamin Robin
benjamin.robin at bootlin.com
Wed Dec 2 07:09:04 PST 2026
Track the configured DisplayPort link bit rate in the link structure
instead of only its maximum, so that the PHY can be restored at the
running rate rather than always at the maximum.
max_bit_rate is renamed to bit_rate: it is still initialized from the
cdns,max-bit-rate property at probe time, but tp_dp_configure_rate() now
records every programmed rate in link->bit_rate. tp_configure_links()
then re-initializes the PHY with that stored rate, so after a
suspend/resume cycle the link comes back at the rate it was running at
before suspend, instead of falling back to the maximum supported one.
Since bit_rate no longer caps configuration, tp_dp_verify_config() now
rejects link rates above gphy->attrs.max_link_rate (the value of the
cdns,max-bit-rate property), on top of the existing validity check.
Signed-off-by: Benjamin Robin <benjamin.robin at bootlin.com>
---
drivers/phy/cadence/phy-cadence-torrent.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/drivers/phy/cadence/phy-cadence-torrent.c b/drivers/phy/cadence/phy-cadence-torrent.c
index 0cbbedeefd87..02e3c91316d5 100644
--- a/drivers/phy/cadence/phy-cadence-torrent.c
+++ b/drivers/phy/cadence/phy-cadence-torrent.c
@@ -347,7 +347,7 @@ struct tp_link {
u8 mlane;
u8 num_lanes;
u8 max_lanes;
- u16 max_bit_rate; /* Maximum link bit rate to use (in Mbps) */
+ u16 bit_rate; /* in Mb/s */
enum cdns_torrent_ssc_mode ssc_mode;
};
@@ -1256,6 +1256,8 @@ static int tp_dp_configure_rate(struct tp_data *tp_data, struct tp_link *link,
/* Reconfigure registers associated with link rate */
tp_dp_update_pll_freq(tp_data, link, dp->link_rate, dp->ssc);
+
+ link->bit_rate = dp->link_rate;
return 0;
}
@@ -1269,6 +1271,9 @@ static int tp_dp_verify_config(const struct tp_link *link,
/* If changing link rate was required, verify it's supported. */
if (dp->set_rate) {
+ if (dp->link_rate > link->phy->attrs.max_link_rate)
+ return -EINVAL;
+
if (!tp_dp_is_valid_bit_rate(dp->link_rate))
return -EINVAL;
}
@@ -2353,7 +2358,7 @@ static int tp_configure_links(struct tp_data *tp_data)
struct tp_link *link = &tp_data->links[i];
if (link->phy_type == TYPE_DP)
- tp_dp_update_pll_freq(tp_data, link, link->max_bit_rate, false);
+ tp_dp_update_pll_freq(tp_data, link, link->bit_rate, false);
}
}
@@ -2649,7 +2654,7 @@ static int tp_add_phy_from_of_subnode(struct tp_data *tp_data, struct device_nod
return -EINVAL;
}
- link->max_bit_rate = max_bit_rate;
+ link->bit_rate = max_bit_rate;
gphy->attrs.bus_width = num_lanes;
gphy->attrs.max_link_rate = max_bit_rate;
gphy->attrs.mode = PHY_MODE_DP;
--
2.56.1
More information about the linux-arm-kernel
mailing list