static u8 edp_get_lane_status(const u8 *link_status, int lane) { int i = DPCD_LANE0_1_STATUS + (lane >> 1); int s = (lane & 1) * 4; u8 l = edp_link_status(link_status, i); return (l >> s) & 0xf; }
static uint rk_edp_get_adjust_request_voltage(const u8 *link_status, int lane) { int i = DPCD_ADJUST_REQUEST_LANE0_1 + (lane >> 1); int s = ((lane & 1) ? DP_ADJUST_VOLTAGE_SWING_LANE1_SHIFT : DP_ADJUST_VOLTAGE_SWING_LANE0_SHIFT); u8 l = edp_link_status(link_status, i); return ((l >> s) & 0x3) << DP_TRAIN_VOLTAGE_SWING_SHIFT; }
static u8 rk_edp_get_adjust_request_pre_emphasis(const u8 *link_status, int lane) { int i = DPCD_ADJUST_REQUEST_LANE0_1 + (lane >> 1); int s = ((lane & 1) ? DP_ADJUST_PRE_EMPHASIS_LANE1_SHIFT : DP_ADJUST_PRE_EMPHASIS_LANE0_SHIFT); u8 l = edp_link_status(link_status, i); return ((l >> s) & 0x3) << DP_TRAIN_PRE_EMPHASIS_SHIFT; }
static int rk_edp_channel_eq_ok(const u8 *link_status, int lane_count) { u8 lane_align; u8 lane_status; int lane; lane_align = edp_link_status(link_status, DPCD_LANE_ALIGN_STATUS_UPDATED); if ((lane_align & DP_INTERLANE_ALIGN_DONE) == 0) return 0; for (lane = 0; lane < lane_count; lane++) { lane_status = edp_get_lane_status(link_status, lane); if ((lane_status & DP_CHANNEL_EQ_BITS) != DP_CHANNEL_EQ_BITS) return 0; } return 1; }