Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/dp: Add helper to get post-cursor adjustments

If the transmitter supports pre-emphasis post cursor2 the sink will
request adjustments in a similar way to how it requests adjustments to
the voltage swing and pre-emphasis settings.

Add a helper to extract these adjustments on a per-lane basis from the
DPCD link status.

Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20191021143437.1477719-8-thierry.reding@gmail.com

+20
+10
drivers/gpu/drm/drm_dp_helper.c
··· 120 120 } 121 121 EXPORT_SYMBOL(drm_dp_get_adjust_request_pre_emphasis); 122 122 123 + u8 drm_dp_get_adjust_request_post_cursor(const u8 link_status[DP_LINK_STATUS_SIZE], 124 + unsigned int lane) 125 + { 126 + unsigned int offset = DP_ADJUST_REQUEST_POST_CURSOR2; 127 + u8 value = dp_link_status(link_status, offset); 128 + 129 + return (value >> (lane << 1)) & 0x3; 130 + } 131 + EXPORT_SYMBOL(drm_dp_get_adjust_request_post_cursor); 132 + 123 133 void drm_dp_link_train_clock_recovery_delay(const u8 dpcd[DP_RECEIVER_CAP_SIZE]) 124 134 { 125 135 unsigned long rd_interval = dpcd[DP_TRAINING_AUX_RD_INTERVAL] &
+10
include/drm/drm_dp_helper.h
··· 605 605 # define DP_ADJUST_PRE_EMPHASIS_LANE1_SHIFT 6 606 606 607 607 #define DP_ADJUST_REQUEST_POST_CURSOR2 0x20c 608 + # define DP_ADJUST_POST_CURSOR2_LANE0_MASK 0x03 609 + # define DP_ADJUST_POST_CURSOR2_LANE0_SHIFT 0 610 + # define DP_ADJUST_POST_CURSOR2_LANE1_MASK 0x0c 611 + # define DP_ADJUST_POST_CURSOR2_LANE1_SHIFT 2 612 + # define DP_ADJUST_POST_CURSOR2_LANE2_MASK 0x30 613 + # define DP_ADJUST_POST_CURSOR2_LANE2_SHIFT 4 614 + # define DP_ADJUST_POST_CURSOR2_LANE3_MASK 0xc0 615 + # define DP_ADJUST_POST_CURSOR2_LANE3_SHIFT 6 608 616 609 617 #define DP_TEST_REQUEST 0x218 610 618 # define DP_TEST_LINK_TRAINING (1 << 0) ··· 1130 1122 int lane); 1131 1123 u8 drm_dp_get_adjust_request_pre_emphasis(const u8 link_status[DP_LINK_STATUS_SIZE], 1132 1124 int lane); 1125 + u8 drm_dp_get_adjust_request_post_cursor(const u8 link_status[DP_LINK_STATUS_SIZE], 1126 + unsigned int lane); 1133 1127 1134 1128 #define DP_BRANCH_OUI_HEADER_SIZE 0xc 1135 1129 #define DP_RECEIVER_CAP_SIZE 0xf