The link status connector property is attached to the drm
object in DP initialization.
This also defines a helper function to set the property value.
This will be used to set the link sttaus to Bad in case
of link training failures.

Cc: dri-devel at lists.freedesktop.org
Cc: Jani Nikula <jani.nikula at linux.intel.com>
Cc: Daniel Vetter <daniel.vetter at intel.com>
Cc: Ville Syrjala <ville.syrjala at linux.intel.com>
Cc: Chris Wilson <chris at chris-wilson.co.uk>
Signed-off-by: Manasi Navare <manasi.d.navare at intel.com>
---
 drivers/gpu/drm/i915/intel_dp.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 3c2293b..dd0d372 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -4674,6 +4674,22 @@ static int intel_dp_get_modes(struct drm_connector 
*connector)
 }

 static int
+intel_dp_set_link_status_property(struct drm_connector *connector,
+                                 uint64_t val)
+{
+       struct drm_device *dev = connector->dev;
+       int ret = 0;
+
+       ret = drm_object_property_set_value(&connector->base,
+                                           
dev->mode_config.link_status_property,
+                                           val);
+       if (ret)
+               return ret;
+
+       return ret;
+}
+
+static int
 intel_dp_connector_register(struct drm_connector *connector)
 {
        struct intel_dp *intel_dp = intel_attached_dp(connector);
@@ -4940,6 +4956,11 @@ bool intel_dp_is_edp(struct drm_device *dev, enum port 
port)
                        connector->dev->mode_config.scaling_mode_property,
                        DRM_MODE_SCALE_ASPECT);
                intel_connector->panel.fitting_mode = DRM_MODE_SCALE_ASPECT;
+       } else {
+               drm_mode_create_link_status_property(connector->dev);
+               drm_object_attach_property(&connector->base,
+                                          
connector->dev->mode_config.link_status_property,
+                                          DRM_MODE_LINK_STATUS_GOOD);
        }
 }

-- 
1.9.1

Reply via email to