diff options
Diffstat (limited to 'drivers/gpu/drm/drm_dp_helper.c')
| -rw-r--r-- | drivers/gpu/drm/drm_dp_helper.c | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c index 37c01b6076ec..6d483487f2b4 100644 --- a/drivers/gpu/drm/drm_dp_helper.c +++ b/drivers/gpu/drm/drm_dp_helper.c | |||
| @@ -1352,3 +1352,93 @@ int drm_dp_read_desc(struct drm_dp_aux *aux, struct drm_dp_desc *desc, | |||
| 1352 | return 0; | 1352 | return 0; |
| 1353 | } | 1353 | } |
| 1354 | EXPORT_SYMBOL(drm_dp_read_desc); | 1354 | EXPORT_SYMBOL(drm_dp_read_desc); |
| 1355 | |||
| 1356 | /** | ||
| 1357 | * DRM DP Helpers for DSC | ||
| 1358 | */ | ||
| 1359 | u8 drm_dp_dsc_sink_max_slice_count(const u8 dsc_dpcd[DP_DSC_RECEIVER_CAP_SIZE], | ||
| 1360 | bool is_edp) | ||
| 1361 | { | ||
| 1362 | u8 slice_cap1 = dsc_dpcd[DP_DSC_SLICE_CAP_1 - DP_DSC_SUPPORT]; | ||
| 1363 | |||
| 1364 | if (is_edp) { | ||
| 1365 | /* For eDP, register DSC_SLICE_CAPABILITIES_1 gives slice count */ | ||
| 1366 | if (slice_cap1 & DP_DSC_4_PER_DP_DSC_SINK) | ||
| 1367 | return 4; | ||
| 1368 | if (slice_cap1 & DP_DSC_2_PER_DP_DSC_SINK) | ||
| 1369 | return 2; | ||
| 1370 | if (slice_cap1 & DP_DSC_1_PER_DP_DSC_SINK) | ||
| 1371 | return 1; | ||
| 1372 | } else { | ||
| 1373 | /* For DP, use values from DSC_SLICE_CAP_1 and DSC_SLICE_CAP2 */ | ||
| 1374 | u8 slice_cap2 = dsc_dpcd[DP_DSC_SLICE_CAP_2 - DP_DSC_SUPPORT]; | ||
| 1375 | |||
| 1376 | if (slice_cap2 & DP_DSC_24_PER_DP_DSC_SINK) | ||
| 1377 | return 24; | ||
| 1378 | if (slice_cap2 & DP_DSC_20_PER_DP_DSC_SINK) | ||
| 1379 | return 20; | ||
| 1380 | if (slice_cap2 & DP_DSC_16_PER_DP_DSC_SINK) | ||
| 1381 | return 16; | ||
| 1382 | if (slice_cap1 & DP_DSC_12_PER_DP_DSC_SINK) | ||
| 1383 | return 12; | ||
| 1384 | if (slice_cap1 & DP_DSC_10_PER_DP_DSC_SINK) | ||
| 1385 | return 10; | ||
| 1386 | if (slice_cap1 & DP_DSC_8_PER_DP_DSC_SINK) | ||
| 1387 | return 8; | ||
| 1388 | if (slice_cap1 & DP_DSC_6_PER_DP_DSC_SINK) | ||
| 1389 | return 6; | ||
| 1390 | if (slice_cap1 & DP_DSC_4_PER_DP_DSC_SINK) | ||
| 1391 | return 4; | ||
| 1392 | if (slice_cap1 & DP_DSC_2_PER_DP_DSC_SINK) | ||
| 1393 | return 2; | ||
| 1394 | if (slice_cap1 & DP_DSC_1_PER_DP_DSC_SINK) | ||
| 1395 | return 1; | ||
| 1396 | } | ||
| 1397 | |||
| 1398 | return 0; | ||
| 1399 | } | ||
| 1400 | EXPORT_SYMBOL(drm_dp_dsc_sink_max_slice_count); | ||
| 1401 | |||
| 1402 | u8 drm_dp_dsc_sink_line_buf_depth(const u8 dsc_dpcd[DP_DSC_RECEIVER_CAP_SIZE]) | ||
| 1403 | { | ||
| 1404 | u8 line_buf_depth = dsc_dpcd[DP_DSC_LINE_BUF_BIT_DEPTH - DP_DSC_SUPPORT]; | ||
| 1405 | |||
| 1406 | switch (line_buf_depth & DP_DSC_LINE_BUF_BIT_DEPTH_MASK) { | ||
| 1407 | case DP_DSC_LINE_BUF_BIT_DEPTH_9: | ||
| 1408 | return 9; | ||
| 1409 | case DP_DSC_LINE_BUF_BIT_DEPTH_10: | ||
| 1410 | return 10; | ||
| 1411 | case DP_DSC_LINE_BUF_BIT_DEPTH_11: | ||
| 1412 | return 11; | ||
| 1413 | case DP_DSC_LINE_BUF_BIT_DEPTH_12: | ||
| 1414 | return 12; | ||
| 1415 | case DP_DSC_LINE_BUF_BIT_DEPTH_13: | ||
| 1416 | return 13; | ||
| 1417 | case DP_DSC_LINE_BUF_BIT_DEPTH_14: | ||
| 1418 | return 14; | ||
| 1419 | case DP_DSC_LINE_BUF_BIT_DEPTH_15: | ||
| 1420 | return 15; | ||
| 1421 | case DP_DSC_LINE_BUF_BIT_DEPTH_16: | ||
| 1422 | return 16; | ||
| 1423 | case DP_DSC_LINE_BUF_BIT_DEPTH_8: | ||
| 1424 | return 8; | ||
| 1425 | } | ||
| 1426 | |||
| 1427 | return 0; | ||
| 1428 | } | ||
| 1429 | EXPORT_SYMBOL(drm_dp_dsc_sink_line_buf_depth); | ||
| 1430 | |||
| 1431 | u8 drm_dp_dsc_sink_max_color_depth(const u8 dsc_dpcd[DP_DSC_RECEIVER_CAP_SIZE]) | ||
| 1432 | { | ||
| 1433 | u8 color_depth = dsc_dpcd[DP_DSC_DEC_COLOR_DEPTH_CAP - DP_DSC_SUPPORT]; | ||
| 1434 | |||
| 1435 | if (color_depth & DP_DSC_12_BPC) | ||
| 1436 | return 12; | ||
| 1437 | if (color_depth & DP_DSC_10_BPC) | ||
| 1438 | return 10; | ||
| 1439 | if (color_depth & DP_DSC_8_BPC) | ||
| 1440 | return 8; | ||
| 1441 | |||
| 1442 | return 0; | ||
| 1443 | } | ||
| 1444 | EXPORT_SYMBOL(drm_dp_dsc_sink_max_color_depth); | ||
