Skip to content

Commit fc0f8e2

Browse files
Sonika Jindaldanvet
authored andcommitted
drm/i915/skl: Read sink supported rates from edp panel
v2: Using DP_SUPPORTED_LINK_RATES macro for supported_rates array (Satheesh). v3: Reading dpcd's supported link rates tables based upon edp version in the same patch. v4: Move version check under is_edp (Satheesh) v5: Using le16 for rates, some naming, and removing nested if block (Ville) v6: Correctly using DP_MAX_SUPPORTED_RATES and removing DP_SUPPORTED_LINK_RATES (Ville) v7: Incorrectly removed DP_SUPPORTED_LINK_RATES in v6, re-adding it v8: Checking return value of intel_dp_dpcd_read_wake() (Ville) Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Signed-off-by: Sonika Jindal <sonika.jindal@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
1 parent dbef0f1 commit fc0f8e2

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

drivers/gpu/drm/i915/intel_dp.c

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1117,6 +1117,33 @@ hsw_dp_set_ddi_pll_sel(struct intel_crtc_state *pipe_config, int link_bw)
11171117
}
11181118
}
11191119

1120+
static int
1121+
intel_read_sink_rates(struct intel_dp *intel_dp, uint32_t *sink_rates)
1122+
{
1123+
struct drm_device *dev = intel_dp_to_dev(intel_dp);
1124+
int i = 0;
1125+
uint16_t val;
1126+
1127+
if (INTEL_INFO(dev)->gen >= 9 && intel_dp->supported_rates[0]) {
1128+
/*
1129+
* Receiver supports only main-link rate selection by
1130+
* link rate table method, so read link rates from
1131+
* supported_link_rates
1132+
*/
1133+
for (i = 0; i < DP_MAX_SUPPORTED_RATES; ++i) {
1134+
val = le16_to_cpu(intel_dp->supported_rates[i]);
1135+
if (val == 0)
1136+
break;
1137+
1138+
sink_rates[i] = val * 200;
1139+
}
1140+
1141+
if (i <= 0)
1142+
DRM_ERROR("No rates in SUPPORTED_LINK_RATES");
1143+
}
1144+
return i;
1145+
}
1146+
11201147
static void
11211148
intel_dp_set_clock(struct intel_encoder *encoder,
11221149
struct intel_crtc_state *pipe_config, int link_bw)
@@ -3578,6 +3605,7 @@ intel_dp_get_dpcd(struct intel_dp *intel_dp)
35783605
struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
35793606
struct drm_device *dev = dig_port->base.base.dev;
35803607
struct drm_i915_private *dev_priv = dev->dev_private;
3608+
uint8_t rev;
35813609

35823610
if (intel_dp_dpcd_read_wake(&intel_dp->aux, 0x000, intel_dp->dpcd,
35833611
sizeof(intel_dp->dpcd)) < 0)
@@ -3609,6 +3637,16 @@ intel_dp_get_dpcd(struct intel_dp *intel_dp)
36093637
} else
36103638
intel_dp->use_tps3 = false;
36113639

3640+
/* Intermediate frequency support */
3641+
if (is_edp(intel_dp) &&
3642+
(intel_dp->dpcd[DP_EDP_CONFIGURATION_CAP] & DP_DPCD_DISPLAY_CONTROL_CAPABLE) &&
3643+
(intel_dp_dpcd_read_wake(&intel_dp->aux, DP_EDP_DPCD_REV, &rev, 1) == 1) &&
3644+
(rev >= 0x03)) { /* eDp v1.4 or higher */
3645+
intel_dp_dpcd_read_wake(&intel_dp->aux,
3646+
DP_SUPPORTED_LINK_RATES,
3647+
intel_dp->supported_rates,
3648+
sizeof(intel_dp->supported_rates));
3649+
}
36123650
if (!(intel_dp->dpcd[DP_DOWNSTREAMPORT_PRESENT] &
36133651
DP_DWN_STRM_PORT_PRESENT))
36143652
return true; /* native DP sink */

drivers/gpu/drm/i915/intel_drv.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -626,6 +626,7 @@ struct intel_dp {
626626
uint8_t dpcd[DP_RECEIVER_CAP_SIZE];
627627
uint8_t psr_dpcd[EDP_PSR_RECEIVER_CAP_SIZE];
628628
uint8_t downstream_ports[DP_MAX_DOWNSTREAM_PORTS];
629+
__le16 supported_rates[DP_MAX_SUPPORTED_RATES];
629630
struct drm_dp_aux aux;
630631
uint8_t train_set[4];
631632
int panel_power_up_delay;

0 commit comments

Comments
 (0)