@@ -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 );
@@ -4840,33 +4848,6 @@ static int dm_update_planes_state(struct dc *dc,
4840
4848
return ret ;
4841
4849
}
4842
4850
4843
- static int dm_atomic_check_plane_state_fb (struct drm_atomic_state * state ,
4844
- struct drm_crtc * crtc )
4845
- {
4846
- struct drm_plane * plane ;
4847
- struct drm_crtc_state * crtc_state ;
4848
-
4849
- WARN_ON (!drm_atomic_get_new_crtc_state (state , crtc ));
4850
-
4851
- drm_for_each_plane_mask (plane , state -> dev , crtc -> state -> plane_mask ) {
4852
- struct drm_plane_state * plane_state =
4853
- drm_atomic_get_plane_state (state , plane );
4854
-
4855
- if (IS_ERR (plane_state ))
4856
- return - EDEADLK ;
4857
-
4858
- crtc_state = drm_atomic_get_crtc_state (plane_state -> state , crtc );
4859
- if (IS_ERR (crtc_state ))
4860
- return PTR_ERR (crtc_state );
4861
-
4862
- if (crtc -> primary == plane && crtc_state -> active ) {
4863
- if (!plane_state -> fb )
4864
- return - EINVAL ;
4865
- }
4866
- }
4867
- return 0 ;
4868
- }
4869
-
4870
4851
static int amdgpu_dm_atomic_check (struct drm_device * dev ,
4871
4852
struct drm_atomic_state * state )
4872
4853
{
@@ -4890,10 +4871,6 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev,
4890
4871
goto fail ;
4891
4872
4892
4873
for_each_oldnew_crtc_in_state (state , crtc , old_crtc_state , new_crtc_state , i ) {
4893
- ret = dm_atomic_check_plane_state_fb (state , crtc );
4894
- if (ret )
4895
- goto fail ;
4896
-
4897
4874
if (!drm_atomic_crtc_needs_modeset (new_crtc_state ) &&
4898
4875
!new_crtc_state -> color_mgmt_changed )
4899
4876
continue ;
0 commit comments