@@ -83,6 +83,8 @@ struct dp_display_private {
bool hpd_irq_on;
bool audio_supported;
+ bool connected;
+
struct drm_device *drm_dev;
struct platform_device *pdev;
struct dentry *root;
@@ -1272,6 +1274,7 @@ static int dp_display_probe(struct platform_device *pdev)
if (!desc)
return -EINVAL;
+ dp->dp_display.dev = &pdev->dev;
dp->pdev = pdev;
dp->name = "drm_dp";
dp->dp_display.connector_type = desc->connector_type;
@@ -1761,3 +1764,23 @@ void dp_bridge_mode_set(struct drm_bridge *drm_bridge,
dp_display->dp_mode.h_active_low =
!!(dp_display->dp_mode.drm_mode.flags & DRM_MODE_FLAG_NHSYNC);
}
+
+void dp_bridge_hpd_notify(struct drm_bridge *bridge,
+ enum drm_connector_status status)
+{
+ struct msm_dp_bridge *dp_bridge = to_dp_bridge(bridge);
+ struct msm_dp *dp = dp_bridge->dp_display;
+ struct dp_display_private *dp_display = container_of(dp, struct dp_display_private, dp_display);
+
+ drm_dbg_dp(dp_display->drm_dev, "status: %d connected: %d\n", status, dp_display->connected);
+
+ if (!dp_display->connected && status == connector_status_connected) {
+ dp_display->connected = true;
+ dp_display_usbpd_configure(dp_display);
+ } else if (status != connector_status_connected) {
+ dp_display->connected = false;
+ dp_display_usbpd_disconnect(dp_display);
+ } else {
+ dp_display_usbpd_attention(dp_display);
+ }
+}
@@ -11,6 +11,7 @@
#include "disp/msm_disp_snapshot.h"
struct msm_dp {
+ struct device *dev;
struct drm_device *drm_dev;
struct device *codec_dev;
struct drm_bridge *bridge;
@@ -68,6 +68,7 @@ static const struct drm_bridge_funcs dp_bridge_ops = {
.mode_valid = dp_bridge_mode_valid,
.get_modes = dp_bridge_get_modes,
.detect = dp_bridge_detect,
+ .hpd_notify = dp_bridge_hpd_notify,
};
struct drm_bridge *dp_bridge_init(struct msm_dp *dp_display, struct drm_device *dev,
@@ -138,6 +139,8 @@ struct drm_connector *dp_drm_connector_init(struct msm_dp *dp_display)
if (IS_ERR(connector))
return connector;
+ connector->fwnode = fwnode_handle_get(dev_fwnode(dp_display->dev));
+
drm_connector_attach_encoder(connector, dp_display->encoder);
return connector;
@@ -32,5 +32,7 @@ enum drm_mode_status dp_bridge_mode_valid(struct drm_bridge *bridge,
void dp_bridge_mode_set(struct drm_bridge *drm_bridge,
const struct drm_display_mode *mode,
const struct drm_display_mode *adjusted_mode);
+void dp_bridge_hpd_notify(struct drm_bridge *bridge,
+ enum drm_connector_status status);
#endif /* _DP_DRM_H_ */