mirror of
https://github.com/torvalds/linux.git
synced 2026-06-02 03:24:19 +02:00
drm/bridge: analogix_dp: Apply DP helper API drm_dp_channel_eq_ok()
Use existing DP helper API instead of analogix_dp_channel_eq_ok() with the same function. In addtion, remove unused function analogix_dp_get_lane_status() Signed-off-by: Damon Ding <damon.ding@rock-chips.com> Tested-by: Marek Szyprowski <m.szyprowski@samsung.com> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com> Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com> Link: https://patch.msgid.link/20251110085823.1197472-4-damon.ding@rock-chips.com Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
This commit is contained in:
parent
e0735bfd5d
commit
51eb548ade
|
|
@ -289,33 +289,6 @@ static int analogix_dp_link_start(struct analogix_dp_device *dp)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static unsigned char analogix_dp_get_lane_status(u8 link_status[2], int lane)
|
||||
{
|
||||
int shift = (lane & 1) * 4;
|
||||
u8 link_value = link_status[lane >> 1];
|
||||
|
||||
return (link_value >> shift) & 0xf;
|
||||
}
|
||||
|
||||
static int analogix_dp_channel_eq_ok(u8 link_status[2], u8 link_align,
|
||||
int lane_count)
|
||||
{
|
||||
int lane;
|
||||
u8 lane_status;
|
||||
|
||||
if ((link_align & DP_INTERLANE_ALIGN_DONE) == 0)
|
||||
return -EINVAL;
|
||||
|
||||
for (lane = 0; lane < lane_count; lane++) {
|
||||
lane_status = analogix_dp_get_lane_status(link_status, lane);
|
||||
lane_status &= DP_CHANNEL_EQ_BITS;
|
||||
if (lane_status != DP_CHANNEL_EQ_BITS)
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static unsigned char
|
||||
analogix_dp_get_adjust_request_voltage(u8 adjust_request[2], int lane)
|
||||
{
|
||||
|
|
@ -437,7 +410,7 @@ static int analogix_dp_process_equalizer_training(struct analogix_dp_device *dp)
|
|||
{
|
||||
int lane_count, retval;
|
||||
u32 reg;
|
||||
u8 link_align, link_status[DP_LINK_STATUS_SIZE], adjust_request[2];
|
||||
u8 link_status[DP_LINK_STATUS_SIZE], adjust_request[2];
|
||||
|
||||
usleep_range(400, 401);
|
||||
|
||||
|
|
@ -457,14 +430,9 @@ static int analogix_dp_process_equalizer_training(struct analogix_dp_device *dp)
|
|||
if (retval < 0)
|
||||
return retval;
|
||||
|
||||
retval = drm_dp_dpcd_readb(&dp->aux, DP_LANE_ALIGN_STATUS_UPDATED,
|
||||
&link_align);
|
||||
if (retval < 0)
|
||||
return retval;
|
||||
|
||||
analogix_dp_get_adjust_training_lane(dp, adjust_request);
|
||||
|
||||
if (!analogix_dp_channel_eq_ok(link_status, link_align, lane_count)) {
|
||||
if (drm_dp_channel_eq_ok(link_status, lane_count)) {
|
||||
/* traing pattern Set to Normal */
|
||||
retval = analogix_dp_training_pattern_dis(dp);
|
||||
if (retval < 0)
|
||||
|
|
@ -602,7 +570,7 @@ static int analogix_dp_full_link_train(struct analogix_dp_device *dp,
|
|||
static int analogix_dp_fast_link_train(struct analogix_dp_device *dp)
|
||||
{
|
||||
int ret;
|
||||
u8 link_align, link_status[DP_LINK_STATUS_SIZE];
|
||||
u8 link_status[DP_LINK_STATUS_SIZE];
|
||||
|
||||
analogix_dp_set_link_bandwidth(dp, dp->link_train.link_rate);
|
||||
ret = analogix_dp_wait_pll_locked(dp);
|
||||
|
|
@ -636,14 +604,6 @@ static int analogix_dp_fast_link_train(struct analogix_dp_device *dp)
|
|||
* speed
|
||||
*/
|
||||
if (verify_fast_training) {
|
||||
ret = drm_dp_dpcd_readb(&dp->aux, DP_LANE_ALIGN_STATUS_UPDATED,
|
||||
&link_align);
|
||||
if (ret < 0) {
|
||||
DRM_DEV_ERROR(dp->dev, "Read align status failed %d\n",
|
||||
ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = drm_dp_dpcd_read_link_status(&dp->aux, link_status);
|
||||
if (ret < 0) {
|
||||
DRM_DEV_ERROR(dp->dev, "Read link status failed %d\n",
|
||||
|
|
@ -657,8 +617,7 @@ static int analogix_dp_fast_link_train(struct analogix_dp_device *dp)
|
|||
return -EIO;
|
||||
}
|
||||
|
||||
if (analogix_dp_channel_eq_ok(link_status, link_align,
|
||||
dp->link_train.lane_count)) {
|
||||
if (!drm_dp_channel_eq_ok(link_status, dp->link_train.lane_count)) {
|
||||
DRM_DEV_ERROR(dp->dev, "Channel EQ failed\n");
|
||||
analogix_dp_reduce_link_rate(dp);
|
||||
return -EIO;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user