]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
drm/omap: Move HPD disconnection handling to omap_connector
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Wed, 30 May 2018 13:53:43 +0000 (16:53 +0300)
committerTomi Valkeinen <tomi.valkeinen@ti.com>
Mon, 3 Sep 2018 13:13:29 +0000 (16:13 +0300)
On HDMI outputs, CEC support requires notification of HPD signal
deassertion. The HPD signal can be handled by various omap_dss_device
instances in the pipeline, and all of them forward HPD events to the
OMAP4 internal HDMI encoder.

Knowledge of the DSS internals need to be removed from the
omap_dss_device instances in order to migrate to drm_bridge. To do so,
move HPD handling for CEC to the omap_connector.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
drivers/gpu/drm/omapdrm/displays/connector-hdmi.c
drivers/gpu/drm/omapdrm/displays/encoder-tpd12s015.c
drivers/gpu/drm/omapdrm/omap_connector.c

index 84cc68388940e539eda37471379b7790249713b2..6f2364afb14aa169511c3e2a0775b5331eba92f5 100644 (file)
@@ -137,13 +137,8 @@ static int hdmic_read_edid(struct omap_dss_device *dssdev,
 static bool hdmic_detect(struct omap_dss_device *dssdev)
 {
        struct panel_drv_data *ddata = to_panel_data(dssdev);
-       struct omap_dss_device *src = dssdev->src;
-       bool connected;
 
-       connected = gpiod_get_value_cansleep(ddata->hpd_gpio);
-       if (!connected && src->ops->hdmi.lost_hotplug)
-               src->ops->hdmi.lost_hotplug(src);
-       return connected;
+       return gpiod_get_value_cansleep(ddata->hpd_gpio);
 }
 
 static void hdmic_register_hpd_cb(struct omap_dss_device *dssdev,
index d6d08148a3e546f45c1769099eae54adfe59b6bf..da97d357bde72dfa1a46738c4b8d088fdf812b10 100644 (file)
@@ -130,13 +130,8 @@ static int tpd_read_edid(struct omap_dss_device *dssdev,
 static bool tpd_detect(struct omap_dss_device *dssdev)
 {
        struct panel_drv_data *ddata = to_panel_data(dssdev);
-       struct omap_dss_device *src = dssdev->src;
-       bool connected;
 
-       connected = gpiod_get_value_cansleep(ddata->hpd_gpio);
-       if (!connected && src->ops->hdmi.lost_hotplug)
-               src->ops->hdmi.lost_hotplug(src);
-       return connected;
+       return gpiod_get_value_cansleep(ddata->hpd_gpio);
 }
 
 static void tpd_register_hpd_cb(struct omap_dss_device *dssdev,
index e77427d81eb97a64e46d8e44c2e41f1df358083f..344414ef3962243c1aa6fef8b8c6cac36cbc58ca 100644 (file)
@@ -34,6 +34,22 @@ struct omap_connector {
        bool hdmi_mode;
 };
 
+static void omap_connector_hpd_notify(struct drm_connector *connector,
+                                     struct omap_dss_device *src,
+                                     enum drm_connector_status status)
+{
+       if (status == connector_status_disconnected) {
+               /*
+                * If the source is an HDMI encoder, notify it of disconnection.
+                * This is required to let the HDMI encoder reset any internal
+                * state related to connection status, such as the CEC address.
+                */
+               if (src && src->type == OMAP_DISPLAY_TYPE_HDMI &&
+                   src->ops->hdmi.lost_hotplug)
+                       src->ops->hdmi.lost_hotplug(src);
+       }
+}
+
 static void omap_connector_hpd_cb(void *cb_data,
                                  enum drm_connector_status status)
 {
@@ -47,8 +63,12 @@ static void omap_connector_hpd_cb(void *cb_data,
        connector->status = status;
        mutex_unlock(&dev->mode_config.mutex);
 
-       if (old_status != status)
-               drm_kms_helper_hotplug_event(dev);
+       if (old_status == status)
+               return;
+
+       omap_connector_hpd_notify(connector, omap_connector->hpd, status);
+
+       drm_kms_helper_hotplug_event(dev);
 }
 
 void omap_connector_enable_hpd(struct drm_connector *connector)
@@ -103,10 +123,11 @@ static enum drm_connector_status omap_connector_detect(
                                            OMAP_DSS_DEVICE_OP_DETECT);
 
        if (dssdev) {
-               if (dssdev->ops->detect(dssdev))
-                       status = connector_status_connected;
-               else
-                       status = connector_status_disconnected;
+               status = dssdev->ops->detect(dssdev)
+                      ? connector_status_connected
+                      : connector_status_disconnected;
+
+               omap_connector_hpd_notify(connector, dssdev->src, status);
        } else {
                switch (omap_connector->dssdev->type) {
                case OMAP_DISPLAY_TYPE_DPI: