@@ -1403,6 +1403,28 @@ static int initialize_plane(struct amdgpu_display_manager *dm,
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
@@ -1456,6 +1478,7 @@ static int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev)
1456
1478
1457
1479
/* loops over all connectors on the board */
1458
1480
for (i = 0 ; i < link_cnt ; i ++ ) {
1481
+ struct dc_link * link = NULL ;
1459
1482
1460
1483
if (i > AMDGPU_DM_MAX_DISPLAY_INDEX ) {
1461
1484
DRM_ERROR (
@@ -1482,9 +1505,14 @@ static int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev)
1482
1505
goto fail ;
1483
1506
}
1484
1507
1485
- if (dc_link_detect (dc_get_link_at_index (dm -> dc , i ),
1486
- DETECT_REASON_BOOT ))
1508
+ link = dc_get_link_at_index (dm -> dc , i );
1509
+
1510
+ if (dc_link_detect (link , DETECT_REASON_BOOT )) {
1487
1511
amdgpu_dm_update_connector_after_detect (aconnector );
1512
+ register_backlight_device (dm , link );
1513
+ }
1514
+
1515
+
1488
1516
}
1489
1517
1490
1518
/* Software is initialized. Now we can register interrupt handlers. */
@@ -2685,7 +2713,8 @@ static void amdgpu_dm_connector_destroy(struct drm_connector *connector)
2685
2713
#if defined(CONFIG_BACKLIGHT_CLASS_DEVICE ) || \
2686
2714
defined(CONFIG_BACKLIGHT_CLASS_DEVICE_MODULE )
2687
2715
2688
- if (link -> connector_signal & (SIGNAL_TYPE_EDP | SIGNAL_TYPE_LVDS )) {
2716
+ if ((link -> connector_signal & (SIGNAL_TYPE_EDP | SIGNAL_TYPE_LVDS )) &&
2717
+ link -> type != dc_connection_none ) {
2689
2718
amdgpu_dm_register_backlight_device (dm );
2690
2719
2691
2720
if (dm -> backlight_dev ) {
@@ -3561,6 +3590,7 @@ create_i2c(struct ddc_service *ddc_service,
3561
3590
return i2c ;
3562
3591
}
3563
3592
3593
+
3564
3594
/* Note: this function assumes that dc_link_detect() was called for the
3565
3595
* dc_link which will be represented by this aconnector.
3566
3596
*/
@@ -3630,28 +3660,6 @@ static int amdgpu_dm_connector_init(struct amdgpu_display_manager *dm,
3630
3660
|| connector_type == DRM_MODE_CONNECTOR_eDP )
3631
3661
amdgpu_dm_initialize_dp_connector (dm , aconnector );
3632
3662
3633
- #if defined(CONFIG_BACKLIGHT_CLASS_DEVICE ) || \
3634
- defined(CONFIG_BACKLIGHT_CLASS_DEVICE_MODULE )
3635
-
3636
- /* NOTE: this currently will create backlight device even if a panel
3637
- * is not connected to the eDP/LVDS connector.
3638
- *
3639
- * This is less than ideal but we don't have sink information at this
3640
- * stage since detection happens after. We can't do detection earlier
3641
- * since MST detection needs connectors to be created first.
3642
- */
3643
- if (link -> connector_signal & (SIGNAL_TYPE_EDP | SIGNAL_TYPE_LVDS )) {
3644
- /* Event if registration failed, we should continue with
3645
- * DM initialization because not having a backlight control
3646
- * is better then a black screen.
3647
- */
3648
- amdgpu_dm_register_backlight_device (dm );
3649
-
3650
- if (dm -> backlight_dev )
3651
- dm -> backlight_link = link ;
3652
- }
3653
- #endif
3654
-
3655
3663
out_free :
3656
3664
if (res ) {
3657
3665
kfree (i2c );
0 commit comments