aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarry Wentland <harry.wentland@amd.com>2018-03-12 11:16:47 -0400
committerAlex Deucher <alexander.deucher@amd.com>2018-04-12 14:55:38 -0400
commit89fc8d4e95e78bdaaadbe72463c8cd16946bf5b3 (patch)
tree80a3079ae3b47144c37cf90e8e38b59552250226
parentc3d7bad88e3b35b981eecc1645ddbb3f13a8b54f (diff)
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>
-rw-r--r--drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c58
1 files changed, 33 insertions, 25 deletions
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index e42a28e3adc5..54bf0b39c38b 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -1403,6 +1403,28 @@ static int initialize_plane(struct amdgpu_display_manager *dm,
1403 return ret; 1403 return ret;
1404} 1404}
1405 1405
1406
1407static 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/* In this architecture, the association 1428/* In this architecture, the association
1407 * connector -> encoder -> crtc 1429 * connector -> encoder -> crtc
1408 * id not really requried. The crtc and connector will hold the 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 /* loops over all connectors on the board */ 1479 /* loops over all connectors on the board */
1458 for (i = 0; i < link_cnt; i++) { 1480 for (i = 0; i < link_cnt; i++) {
1481 struct dc_link *link = NULL;
1459 1482
1460 if (i > AMDGPU_DM_MAX_DISPLAY_INDEX) { 1483 if (i > AMDGPU_DM_MAX_DISPLAY_INDEX) {
1461 DRM_ERROR( 1484 DRM_ERROR(
@@ -1482,9 +1505,14 @@ static int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev)
1482 goto fail; 1505 goto fail;
1483 } 1506 }
1484 1507
1485 if (dc_link_detect(dc_get_link_at_index(dm->dc, i), 1508 link = dc_get_link_at_index(dm->dc, i);
1486 DETECT_REASON_BOOT)) 1509
1510 if (dc_link_detect(link, DETECT_REASON_BOOT)) {
1487 amdgpu_dm_update_connector_after_detect(aconnector); 1511 amdgpu_dm_update_connector_after_detect(aconnector);
1512 register_backlight_device(dm, link);
1513 }
1514
1515
1488 } 1516 }
1489 1517
1490 /* Software is initialized. Now we can register interrupt handlers. */ 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#if defined(CONFIG_BACKLIGHT_CLASS_DEVICE) ||\ 2713#if defined(CONFIG_BACKLIGHT_CLASS_DEVICE) ||\
2686 defined(CONFIG_BACKLIGHT_CLASS_DEVICE_MODULE) 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 amdgpu_dm_register_backlight_device(dm); 2718 amdgpu_dm_register_backlight_device(dm);
2690 2719
2691 if (dm->backlight_dev) { 2720 if (dm->backlight_dev) {
@@ -3561,6 +3590,7 @@ create_i2c(struct ddc_service *ddc_service,
3561 return i2c; 3590 return i2c;
3562} 3591}
3563 3592
3593
3564/* Note: this function assumes that dc_link_detect() was called for the 3594/* Note: this function assumes that dc_link_detect() was called for the
3565 * dc_link which will be represented by this aconnector. 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 || connector_type == DRM_MODE_CONNECTOR_eDP) 3660 || connector_type == DRM_MODE_CONNECTOR_eDP)
3631 amdgpu_dm_initialize_dp_connector(dm, aconnector); 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
3655out_free: 3663out_free:
3656 if (res) { 3664 if (res) {
3657 kfree(i2c); 3665 kfree(i2c);