Merge tag 'drm-misc-next-2017-05-16' of git://anongit.freedesktop.org/git/drm-misc...
[sfrench/cifs-2.6.git] / drivers / gpu / drm / sti / sti_hdmi.c
index d824497e950e07e55c4eafc6d8a8b05e78af7a4c..a59c95a8081b7acce1161b6dca34e027b8975825 100644 (file)
@@ -768,6 +768,8 @@ static void sti_hdmi_disable(struct drm_bridge *bridge)
        clk_disable_unprepare(hdmi->clk_pix);
 
        hdmi->enabled = false;
+
+       cec_notifier_set_phys_addr(hdmi->notifier, CEC_PHYS_ADDR_INVALID);
 }
 
 /**
@@ -970,6 +972,7 @@ static int sti_hdmi_connector_get_modes(struct drm_connector *connector)
        DRM_DEBUG_KMS("%s : %dx%d cm\n",
                      (hdmi->hdmi_monitor ? "hdmi monitor" : "dvi monitor"),
                      edid->width_cm, edid->height_cm);
+       cec_notifier_set_phys_addr_from_edid(hdmi->notifier, edid);
 
        count = drm_add_edid_modes(connector, edid);
        drm_mode_connector_update_edid_property(connector, edid);
@@ -1032,6 +1035,7 @@ sti_hdmi_connector_detect(struct drm_connector *connector, bool force)
        }
 
        DRM_DEBUG_DRIVER("hdmi cable disconnected\n");
+       cec_notifier_set_phys_addr(hdmi->notifier, CEC_PHYS_ADDR_INVALID);
        return connector_status_disconnected;
 }
 
@@ -1420,6 +1424,10 @@ static int sti_hdmi_probe(struct platform_device *pdev)
                goto release_adapter;
        }
 
+       hdmi->notifier = cec_notifier_get(&pdev->dev);
+       if (!hdmi->notifier)
+               goto release_adapter;
+
        hdmi->reset = devm_reset_control_get(dev, "hdmi");
        /* Take hdmi out of reset */
        if (!IS_ERR(hdmi->reset))
@@ -1439,11 +1447,14 @@ static int sti_hdmi_remove(struct platform_device *pdev)
 {
        struct sti_hdmi *hdmi = dev_get_drvdata(&pdev->dev);
 
+       cec_notifier_set_phys_addr(hdmi->notifier, CEC_PHYS_ADDR_INVALID);
+
        i2c_put_adapter(hdmi->ddc_adapt);
        if (hdmi->audio_pdev)
                platform_device_unregister(hdmi->audio_pdev);
        component_del(&pdev->dev, &sti_hdmi_ops);
 
+       cec_notifier_put(hdmi->notifier);
        return 0;
 }