diff options
author | Ville Syrjälä <ville.syrjala@linux.intel.com> | 2015-03-13 13:40:31 -0400 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2015-03-20 06:48:10 -0400 |
commit | 94ca719ee47f287b11942c899e6b81045311b786 (patch) | |
tree | 6a012fafa858e79b9760bff25d566eb2169f1dba | |
parent | 0336400ebeeabb7c7187f1ed1bca04ff2191adf8 (diff) |
drm/i915: Unconfuse DP link rate array names
To keep things clear rename the intel_dp->supported_rates[] to
intel_dp->sink_rates[], and rename the supported_rates[] name we used
elsewhere for the intersection of source and sink rates to
common_rates[].
Cc: Sonika Jindal <sonika.jindal@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Sonika Jindal <sonika.jindal@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-rw-r--r-- | drivers/gpu/drm/i915/intel_dp.c | 70 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_dp_mst.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_drv.h | 5 |
3 files changed, 39 insertions, 38 deletions
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index e2c54912cf11..5256c064da05 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c | |||
@@ -1135,9 +1135,9 @@ hsw_dp_set_ddi_pll_sel(struct intel_crtc_state *pipe_config, int link_bw) | |||
1135 | static int | 1135 | static int |
1136 | intel_dp_sink_rates(struct intel_dp *intel_dp, const int **sink_rates) | 1136 | intel_dp_sink_rates(struct intel_dp *intel_dp, const int **sink_rates) |
1137 | { | 1137 | { |
1138 | if (intel_dp->num_supported_rates) { | 1138 | if (intel_dp->num_sink_rates) { |
1139 | *sink_rates = intel_dp->supported_rates; | 1139 | *sink_rates = intel_dp->sink_rates; |
1140 | return intel_dp->num_supported_rates; | 1140 | return intel_dp->num_sink_rates; |
1141 | } | 1141 | } |
1142 | 1142 | ||
1143 | *sink_rates = default_rates; | 1143 | *sink_rates = default_rates; |
@@ -1203,7 +1203,7 @@ intel_dp_set_clock(struct intel_encoder *encoder, | |||
1203 | 1203 | ||
1204 | static int intersect_rates(const int *source_rates, int source_len, | 1204 | static int intersect_rates(const int *source_rates, int source_len, |
1205 | const int *sink_rates, int sink_len, | 1205 | const int *sink_rates, int sink_len, |
1206 | int *supported_rates) | 1206 | int *common_rates) |
1207 | { | 1207 | { |
1208 | int i = 0, j = 0, k = 0; | 1208 | int i = 0, j = 0, k = 0; |
1209 | 1209 | ||
@@ -1211,7 +1211,7 @@ static int intersect_rates(const int *source_rates, int source_len, | |||
1211 | if (source_rates[i] == sink_rates[j]) { | 1211 | if (source_rates[i] == sink_rates[j]) { |
1212 | if (WARN_ON(k >= DP_MAX_SUPPORTED_RATES)) | 1212 | if (WARN_ON(k >= DP_MAX_SUPPORTED_RATES)) |
1213 | return k; | 1213 | return k; |
1214 | supported_rates[k] = source_rates[i]; | 1214 | common_rates[k] = source_rates[i]; |
1215 | ++k; | 1215 | ++k; |
1216 | ++i; | 1216 | ++i; |
1217 | ++j; | 1217 | ++j; |
@@ -1224,8 +1224,8 @@ static int intersect_rates(const int *source_rates, int source_len, | |||
1224 | return k; | 1224 | return k; |
1225 | } | 1225 | } |
1226 | 1226 | ||
1227 | static int intel_supported_rates(struct intel_dp *intel_dp, | 1227 | static int intel_dp_common_rates(struct intel_dp *intel_dp, |
1228 | int *supported_rates) | 1228 | int *common_rates) |
1229 | { | 1229 | { |
1230 | struct drm_device *dev = intel_dp_to_dev(intel_dp); | 1230 | struct drm_device *dev = intel_dp_to_dev(intel_dp); |
1231 | const int *source_rates, *sink_rates; | 1231 | const int *source_rates, *sink_rates; |
@@ -1236,7 +1236,7 @@ static int intel_supported_rates(struct intel_dp *intel_dp, | |||
1236 | 1236 | ||
1237 | return intersect_rates(source_rates, source_len, | 1237 | return intersect_rates(source_rates, source_len, |
1238 | sink_rates, sink_len, | 1238 | sink_rates, sink_len, |
1239 | supported_rates); | 1239 | common_rates); |
1240 | } | 1240 | } |
1241 | 1241 | ||
1242 | static void snprintf_int_array(char *str, size_t len, | 1242 | static void snprintf_int_array(char *str, size_t len, |
@@ -1259,8 +1259,8 @@ static void intel_dp_print_rates(struct intel_dp *intel_dp) | |||
1259 | { | 1259 | { |
1260 | struct drm_device *dev = intel_dp_to_dev(intel_dp); | 1260 | struct drm_device *dev = intel_dp_to_dev(intel_dp); |
1261 | const int *source_rates, *sink_rates; | 1261 | const int *source_rates, *sink_rates; |
1262 | int source_len, sink_len, supported_len; | 1262 | int source_len, sink_len, common_len; |
1263 | int supported_rates[DP_MAX_SUPPORTED_RATES]; | 1263 | int common_rates[DP_MAX_SUPPORTED_RATES]; |
1264 | char str[128]; /* FIXME: too big for stack? */ | 1264 | char str[128]; /* FIXME: too big for stack? */ |
1265 | 1265 | ||
1266 | if ((drm_debug & DRM_UT_KMS) == 0) | 1266 | if ((drm_debug & DRM_UT_KMS) == 0) |
@@ -1274,9 +1274,9 @@ static void intel_dp_print_rates(struct intel_dp *intel_dp) | |||
1274 | snprintf_int_array(str, sizeof(str), sink_rates, sink_len); | 1274 | snprintf_int_array(str, sizeof(str), sink_rates, sink_len); |
1275 | DRM_DEBUG_KMS("sink rates: %s\n", str); | 1275 | DRM_DEBUG_KMS("sink rates: %s\n", str); |
1276 | 1276 | ||
1277 | supported_len = intel_supported_rates(intel_dp, supported_rates); | 1277 | common_len = intel_dp_common_rates(intel_dp, common_rates); |
1278 | snprintf_int_array(str, sizeof(str), supported_rates, supported_len); | 1278 | snprintf_int_array(str, sizeof(str), common_rates, common_len); |
1279 | DRM_DEBUG_KMS("supported rates: %s\n", str); | 1279 | DRM_DEBUG_KMS("common rates: %s\n", str); |
1280 | } | 1280 | } |
1281 | 1281 | ||
1282 | static int rate_to_index(int find, const int *rates) | 1282 | static int rate_to_index(int find, const int *rates) |
@@ -1296,7 +1296,7 @@ intel_dp_max_link_rate(struct intel_dp *intel_dp) | |||
1296 | int rates[DP_MAX_SUPPORTED_RATES] = {}; | 1296 | int rates[DP_MAX_SUPPORTED_RATES] = {}; |
1297 | int len; | 1297 | int len; |
1298 | 1298 | ||
1299 | len = intel_supported_rates(intel_dp, rates); | 1299 | len = intel_dp_common_rates(intel_dp, rates); |
1300 | if (WARN_ON(len <= 0)) | 1300 | if (WARN_ON(len <= 0)) |
1301 | return 162000; | 1301 | return 162000; |
1302 | 1302 | ||
@@ -1305,7 +1305,7 @@ intel_dp_max_link_rate(struct intel_dp *intel_dp) | |||
1305 | 1305 | ||
1306 | int intel_dp_rate_select(struct intel_dp *intel_dp, int rate) | 1306 | int intel_dp_rate_select(struct intel_dp *intel_dp, int rate) |
1307 | { | 1307 | { |
1308 | return rate_to_index(rate, intel_dp->supported_rates); | 1308 | return rate_to_index(rate, intel_dp->sink_rates); |
1309 | } | 1309 | } |
1310 | 1310 | ||
1311 | bool | 1311 | bool |
@@ -1327,15 +1327,15 @@ intel_dp_compute_config(struct intel_encoder *encoder, | |||
1327 | int max_clock; | 1327 | int max_clock; |
1328 | int bpp, mode_rate; | 1328 | int bpp, mode_rate; |
1329 | int link_avail, link_clock; | 1329 | int link_avail, link_clock; |
1330 | int supported_rates[DP_MAX_SUPPORTED_RATES] = {}; | 1330 | int common_rates[DP_MAX_SUPPORTED_RATES] = {}; |
1331 | int supported_len; | 1331 | int common_len; |
1332 | 1332 | ||
1333 | supported_len = intel_supported_rates(intel_dp, supported_rates); | 1333 | common_len = intel_dp_common_rates(intel_dp, common_rates); |
1334 | 1334 | ||
1335 | /* No common link rates between source and sink */ | 1335 | /* No common link rates between source and sink */ |
1336 | WARN_ON(supported_len <= 0); | 1336 | WARN_ON(common_len <= 0); |
1337 | 1337 | ||
1338 | max_clock = supported_len - 1; | 1338 | max_clock = common_len - 1; |
1339 | 1339 | ||
1340 | if (HAS_PCH_SPLIT(dev) && !HAS_DDI(dev) && port != PORT_A) | 1340 | if (HAS_PCH_SPLIT(dev) && !HAS_DDI(dev) && port != PORT_A) |
1341 | pipe_config->has_pch_encoder = true; | 1341 | pipe_config->has_pch_encoder = true; |
@@ -1360,7 +1360,7 @@ intel_dp_compute_config(struct intel_encoder *encoder, | |||
1360 | 1360 | ||
1361 | DRM_DEBUG_KMS("DP link computation with max lane count %i " | 1361 | DRM_DEBUG_KMS("DP link computation with max lane count %i " |
1362 | "max bw %d pixel clock %iKHz\n", | 1362 | "max bw %d pixel clock %iKHz\n", |
1363 | max_lane_count, supported_rates[max_clock], | 1363 | max_lane_count, common_rates[max_clock], |
1364 | adjusted_mode->crtc_clock); | 1364 | adjusted_mode->crtc_clock); |
1365 | 1365 | ||
1366 | /* Walk through all bpp values. Luckily they're all nicely spaced with 2 | 1366 | /* Walk through all bpp values. Luckily they're all nicely spaced with 2 |
@@ -1393,7 +1393,7 @@ intel_dp_compute_config(struct intel_encoder *encoder, | |||
1393 | lane_count <= max_lane_count; | 1393 | lane_count <= max_lane_count; |
1394 | lane_count <<= 1) { | 1394 | lane_count <<= 1) { |
1395 | 1395 | ||
1396 | link_clock = supported_rates[clock]; | 1396 | link_clock = common_rates[clock]; |
1397 | link_avail = intel_dp_max_data_rate(link_clock, | 1397 | link_avail = intel_dp_max_data_rate(link_clock, |
1398 | lane_count); | 1398 | lane_count); |
1399 | 1399 | ||
@@ -1424,18 +1424,18 @@ found: | |||
1424 | 1424 | ||
1425 | intel_dp->lane_count = lane_count; | 1425 | intel_dp->lane_count = lane_count; |
1426 | 1426 | ||
1427 | if (intel_dp->num_supported_rates) { | 1427 | if (intel_dp->num_sink_rates) { |
1428 | intel_dp->link_bw = 0; | 1428 | intel_dp->link_bw = 0; |
1429 | intel_dp->rate_select = | 1429 | intel_dp->rate_select = |
1430 | intel_dp_rate_select(intel_dp, supported_rates[clock]); | 1430 | intel_dp_rate_select(intel_dp, common_rates[clock]); |
1431 | } else { | 1431 | } else { |
1432 | intel_dp->link_bw = | 1432 | intel_dp->link_bw = |
1433 | drm_dp_link_rate_to_bw_code(supported_rates[clock]); | 1433 | drm_dp_link_rate_to_bw_code(common_rates[clock]); |
1434 | intel_dp->rate_select = 0; | 1434 | intel_dp->rate_select = 0; |
1435 | } | 1435 | } |
1436 | 1436 | ||
1437 | pipe_config->pipe_bpp = bpp; | 1437 | pipe_config->pipe_bpp = bpp; |
1438 | pipe_config->port_clock = supported_rates[clock]; | 1438 | pipe_config->port_clock = common_rates[clock]; |
1439 | 1439 | ||
1440 | DRM_DEBUG_KMS("DP link bw %02x lane count %d clock %d bpp %d\n", | 1440 | DRM_DEBUG_KMS("DP link bw %02x lane count %d clock %d bpp %d\n", |
1441 | intel_dp->link_bw, intel_dp->lane_count, | 1441 | intel_dp->link_bw, intel_dp->lane_count, |
@@ -1458,7 +1458,7 @@ found: | |||
1458 | } | 1458 | } |
1459 | 1459 | ||
1460 | if (IS_SKYLAKE(dev) && is_edp(intel_dp)) | 1460 | if (IS_SKYLAKE(dev) && is_edp(intel_dp)) |
1461 | skl_edp_set_pll_config(pipe_config, supported_rates[clock]); | 1461 | skl_edp_set_pll_config(pipe_config, common_rates[clock]); |
1462 | else if (IS_HASWELL(dev) || IS_BROADWELL(dev)) | 1462 | else if (IS_HASWELL(dev) || IS_BROADWELL(dev)) |
1463 | hsw_dp_set_ddi_pll_sel(pipe_config, intel_dp->link_bw); | 1463 | hsw_dp_set_ddi_pll_sel(pipe_config, intel_dp->link_bw); |
1464 | else | 1464 | else |
@@ -3545,7 +3545,7 @@ intel_dp_start_link_train(struct intel_dp *intel_dp) | |||
3545 | if (drm_dp_enhanced_frame_cap(intel_dp->dpcd)) | 3545 | if (drm_dp_enhanced_frame_cap(intel_dp->dpcd)) |
3546 | link_config[1] |= DP_LANE_COUNT_ENHANCED_FRAME_EN; | 3546 | link_config[1] |= DP_LANE_COUNT_ENHANCED_FRAME_EN; |
3547 | drm_dp_dpcd_write(&intel_dp->aux, DP_LINK_BW_SET, link_config, 2); | 3547 | drm_dp_dpcd_write(&intel_dp->aux, DP_LINK_BW_SET, link_config, 2); |
3548 | if (intel_dp->num_supported_rates) | 3548 | if (intel_dp->num_sink_rates) |
3549 | drm_dp_dpcd_write(&intel_dp->aux, DP_LINK_RATE_SET, | 3549 | drm_dp_dpcd_write(&intel_dp->aux, DP_LINK_RATE_SET, |
3550 | &intel_dp->rate_select, 1); | 3550 | &intel_dp->rate_select, 1); |
3551 | 3551 | ||
@@ -3797,23 +3797,23 @@ intel_dp_get_dpcd(struct intel_dp *intel_dp) | |||
3797 | (intel_dp->dpcd[DP_EDP_CONFIGURATION_CAP] & DP_DPCD_DISPLAY_CONTROL_CAPABLE) && | 3797 | (intel_dp->dpcd[DP_EDP_CONFIGURATION_CAP] & DP_DPCD_DISPLAY_CONTROL_CAPABLE) && |
3798 | (intel_dp_dpcd_read_wake(&intel_dp->aux, DP_EDP_DPCD_REV, &rev, 1) == 1) && | 3798 | (intel_dp_dpcd_read_wake(&intel_dp->aux, DP_EDP_DPCD_REV, &rev, 1) == 1) && |
3799 | (rev >= 0x03)) { /* eDp v1.4 or higher */ | 3799 | (rev >= 0x03)) { /* eDp v1.4 or higher */ |
3800 | __le16 supported_rates[DP_MAX_SUPPORTED_RATES]; | 3800 | __le16 sink_rates[DP_MAX_SUPPORTED_RATES]; |
3801 | int i; | 3801 | int i; |
3802 | 3802 | ||
3803 | intel_dp_dpcd_read_wake(&intel_dp->aux, | 3803 | intel_dp_dpcd_read_wake(&intel_dp->aux, |
3804 | DP_SUPPORTED_LINK_RATES, | 3804 | DP_SUPPORTED_LINK_RATES, |
3805 | supported_rates, | 3805 | sink_rates, |
3806 | sizeof(supported_rates)); | 3806 | sizeof(sink_rates)); |
3807 | 3807 | ||
3808 | for (i = 0; i < ARRAY_SIZE(supported_rates); i++) { | 3808 | for (i = 0; i < ARRAY_SIZE(sink_rates); i++) { |
3809 | int val = le16_to_cpu(supported_rates[i]); | 3809 | int val = le16_to_cpu(sink_rates[i]); |
3810 | 3810 | ||
3811 | if (val == 0) | 3811 | if (val == 0) |
3812 | break; | 3812 | break; |
3813 | 3813 | ||
3814 | intel_dp->supported_rates[i] = val * 200; | 3814 | intel_dp->sink_rates[i] = val * 200; |
3815 | } | 3815 | } |
3816 | intel_dp->num_supported_rates = i; | 3816 | intel_dp->num_sink_rates = i; |
3817 | } | 3817 | } |
3818 | 3818 | ||
3819 | intel_dp_print_rates(intel_dp); | 3819 | intel_dp_print_rates(intel_dp); |
diff --git a/drivers/gpu/drm/i915/intel_dp_mst.c b/drivers/gpu/drm/i915/intel_dp_mst.c index 7e6f12597a6c..971163e53e59 100644 --- a/drivers/gpu/drm/i915/intel_dp_mst.c +++ b/drivers/gpu/drm/i915/intel_dp_mst.c | |||
@@ -55,7 +55,7 @@ static bool intel_dp_mst_compute_config(struct intel_encoder *encoder, | |||
55 | 55 | ||
56 | rate = intel_dp_max_link_rate(intel_dp); | 56 | rate = intel_dp_max_link_rate(intel_dp); |
57 | 57 | ||
58 | if (intel_dp->num_supported_rates) { | 58 | if (intel_dp->num_sink_rates) { |
59 | intel_dp->link_bw = 0; | 59 | intel_dp->link_bw = 0; |
60 | intel_dp->rate_select = intel_dp_rate_select(intel_dp, rate); | 60 | intel_dp->rate_select = intel_dp_rate_select(intel_dp, rate); |
61 | } else { | 61 | } else { |
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index 417419887b54..a1baaa188b0a 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h | |||
@@ -627,8 +627,9 @@ struct intel_dp { | |||
627 | uint8_t dpcd[DP_RECEIVER_CAP_SIZE]; | 627 | uint8_t dpcd[DP_RECEIVER_CAP_SIZE]; |
628 | uint8_t psr_dpcd[EDP_PSR_RECEIVER_CAP_SIZE]; | 628 | uint8_t psr_dpcd[EDP_PSR_RECEIVER_CAP_SIZE]; |
629 | uint8_t downstream_ports[DP_MAX_DOWNSTREAM_PORTS]; | 629 | uint8_t downstream_ports[DP_MAX_DOWNSTREAM_PORTS]; |
630 | uint8_t num_supported_rates; | 630 | /* sink rates as reported by DP_SUPPORTED_LINK_RATES */ |
631 | int supported_rates[DP_MAX_SUPPORTED_RATES]; | 631 | uint8_t num_sink_rates; |
632 | int sink_rates[DP_MAX_SUPPORTED_RATES]; | ||
632 | struct drm_dp_aux aux; | 633 | struct drm_dp_aux aux; |
633 | uint8_t train_set[4]; | 634 | uint8_t train_set[4]; |
634 | int panel_power_up_delay; | 635 | int panel_power_up_delay; |