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

drm/amd/display: Only register backlight device if embedded panel connected

Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Harry Wentland and committed by
Alex Deucher
89fc8d4e c3d7bad8

+33 -25
+33 -25
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
··· 1403 1403 return ret; 1404 1404 } 1405 1405 1406 + 1407 + static void register_backlight_device(struct amdgpu_display_manager *dm, 1408 + struct dc_link *link) 1409 + { 1410 + #if defined(CONFIG_BACKLIGHT_CLASS_DEVICE) ||\ 1411 + defined(CONFIG_BACKLIGHT_CLASS_DEVICE_MODULE) 1412 + 1413 + if ((link->connector_signal & (SIGNAL_TYPE_EDP | SIGNAL_TYPE_LVDS)) && 1414 + link->type != dc_connection_none) { 1415 + /* Event if registration failed, we should continue with 1416 + * DM initialization because not having a backlight control 1417 + * is better then a black screen. 1418 + */ 1419 + amdgpu_dm_register_backlight_device(dm); 1420 + 1421 + if (dm->backlight_dev) 1422 + dm->backlight_link = link; 1423 + } 1424 + #endif 1425 + } 1426 + 1427 + 1406 1428 /* In this architecture, the association 1407 1429 * connector -> encoder -> crtc 1408 1430 * id not really requried. The crtc and connector will hold the ··· 1478 1456 1479 1457 /* loops over all connectors on the board */ 1480 1458 for (i = 0; i < link_cnt; i++) { 1459 + struct dc_link *link = NULL; 1481 1460 1482 1461 if (i > AMDGPU_DM_MAX_DISPLAY_INDEX) { 1483 1462 DRM_ERROR( ··· 1505 1482 goto fail; 1506 1483 } 1507 1484 1508 - if (dc_link_detect(dc_get_link_at_index(dm->dc, i), 1509 - DETECT_REASON_BOOT)) 1485 + link = dc_get_link_at_index(dm->dc, i); 1486 + 1487 + if (dc_link_detect(link, DETECT_REASON_BOOT)) { 1510 1488 amdgpu_dm_update_connector_after_detect(aconnector); 1489 + register_backlight_device(dm, link); 1490 + } 1491 + 1492 + 1511 1493 } 1512 1494 1513 1495 /* Software is initialized. Now we can register interrupt handlers. */ ··· 2713 2685 #if defined(CONFIG_BACKLIGHT_CLASS_DEVICE) ||\ 2714 2686 defined(CONFIG_BACKLIGHT_CLASS_DEVICE_MODULE) 2715 2687 2716 - if (link->connector_signal & (SIGNAL_TYPE_EDP | SIGNAL_TYPE_LVDS)) { 2688 + if ((link->connector_signal & (SIGNAL_TYPE_EDP | SIGNAL_TYPE_LVDS)) && 2689 + link->type != dc_connection_none) { 2717 2690 amdgpu_dm_register_backlight_device(dm); 2718 2691 2719 2692 if (dm->backlight_dev) { ··· 3590 3561 return i2c; 3591 3562 } 3592 3563 3564 + 3593 3565 /* Note: this function assumes that dc_link_detect() was called for the 3594 3566 * dc_link which will be represented by this aconnector. 3595 3567 */ ··· 3659 3629 if (connector_type == DRM_MODE_CONNECTOR_DisplayPort 3660 3630 || connector_type == DRM_MODE_CONNECTOR_eDP) 3661 3631 amdgpu_dm_initialize_dp_connector(dm, aconnector); 3662 - 3663 - #if defined(CONFIG_BACKLIGHT_CLASS_DEVICE) ||\ 3664 - defined(CONFIG_BACKLIGHT_CLASS_DEVICE_MODULE) 3665 - 3666 - /* NOTE: this currently will create backlight device even if a panel 3667 - * is not connected to the eDP/LVDS connector. 3668 - * 3669 - * This is less than ideal but we don't have sink information at this 3670 - * stage since detection happens after. We can't do detection earlier 3671 - * since MST detection needs connectors to be created first. 3672 - */ 3673 - if (link->connector_signal & (SIGNAL_TYPE_EDP | SIGNAL_TYPE_LVDS)) { 3674 - /* Event if registration failed, we should continue with 3675 - * DM initialization because not having a backlight control 3676 - * is better then a black screen. 3677 - */ 3678 - amdgpu_dm_register_backlight_device(dm); 3679 - 3680 - if (dm->backlight_dev) 3681 - dm->backlight_link = link; 3682 - } 3683 - #endif 3684 3632 3685 3633 out_free: 3686 3634 if (res) {