@@ -1300,6 +1300,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;
@@ -1789,3 +1790,13 @@ 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);
+
+ dp_display->usbpd->hpd_notify(dp_display->usbpd, status);
+}
@@ -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_ */
@@ -7,6 +7,8 @@
#include <linux/slab.h>
#include <linux/device.h>
+#include <drm/drm_connector.h>
+#include <drm/drm_print.h>
#include "dp_hpd.h"
@@ -45,6 +47,24 @@ int dp_hpd_connect(struct dp_usbpd *dp_usbpd, bool hpd)
return rc;
}
+static void dp_hpd_hpd_notify(struct dp_usbpd *dp_usbpd,
+ enum drm_connector_status status)
+{
+ struct dp_hpd_private *hpd_priv = container_of(dp_usbpd, struct dp_hpd_private, dp_usbpd);
+
+ DRM_DEBUG_DP("status: %d connected: %d\n", status, dp_usbpd->connected);
+
+ if (!dp_usbpd->connected && status == connector_status_connected) {
+ dp_usbpd->connected = true;
+ hpd_priv->dp_cb->configure(hpd_priv->dev);
+ } else if (status != connector_status_connected) {
+ dp_usbpd->connected = false;
+ hpd_priv->dp_cb->disconnect(hpd_priv->dev);
+ } else {
+ hpd_priv->dp_cb->attention(hpd_priv->dev);
+ }
+}
+
struct dp_usbpd *dp_hpd_get(struct device *dev, struct dp_usbpd_cb *cb)
{
struct dp_hpd_private *dp_hpd;
@@ -62,6 +82,7 @@ struct dp_usbpd *dp_hpd_get(struct device *dev, struct dp_usbpd_cb *cb)
dp_hpd->dp_cb = cb;
dp_hpd->dp_usbpd.connect = dp_hpd_connect;
+ dp_hpd->dp_usbpd.hpd_notify = dp_hpd_hpd_notify;
return &dp_hpd->dp_usbpd;
}
@@ -29,7 +29,9 @@ enum plug_orientation {
* @hpd_irq: Change in the status since last message
* @alt_mode_cfg_done: bool to specify alt mode status
* @debug_en: bool to specify debug mode
+ * @connected: cable currently connected
* @connect: simulate disconnect or connect for debug mode
+ * @hpd_notify: deliver oob event to the usbpd code
*/
struct dp_usbpd {
enum plug_orientation orientation;
@@ -41,8 +43,11 @@ struct dp_usbpd {
bool hpd_irq;
bool alt_mode_cfg_done;
bool debug_en;
+ bool connected;
int (*connect)(struct dp_usbpd *dp_usbpd, bool hpd);
+ void (*hpd_notify)(struct dp_usbpd *dp_usbpd,
+ enum drm_connector_status status);
};
/**