#include "dw-hdmi.h"
 #include "dw-hdmi-audio.h"
 
+#include <media/cec-notifier.h>
+
 #define DDC_SEGMENT_ADDR       0x30
+
 #define HDMI_EDID_LEN          512
 
 enum hdmi_datamap {
        struct regmap *regm;
        void (*enable_audio)(struct dw_hdmi *hdmi);
        void (*disable_audio)(struct dw_hdmi *hdmi);
+
+       struct cec_notifier *cec_notifier;
 };
 
 #define HDMI_IH_PHY_STAT0_RX_SENSE \
                hdmi->sink_is_hdmi = drm_detect_hdmi_monitor(edid);
                hdmi->sink_has_audio = drm_detect_monitor_audio(edid);
                drm_mode_connector_update_edid_property(connector, edid);
+               cec_notifier_set_phys_addr_from_edid(hdmi->cec_notifier, edid);
                ret = drm_add_edid_modes(connector, edid);
                /* Store the ELD */
                drm_edid_to_eld(connector, edid);
         * ask the source to re-read the EDID.
         */
        if (intr_stat &
-           (HDMI_IH_PHY_STAT0_RX_SENSE | HDMI_IH_PHY_STAT0_HPD))
+           (HDMI_IH_PHY_STAT0_RX_SENSE | HDMI_IH_PHY_STAT0_HPD)) {
                __dw_hdmi_setup_rx_sense(hdmi,
                                         phy_stat & HDMI_PHY_HPD,
                                         phy_stat & HDMI_PHY_RX_SENSE);
 
+               if ((phy_stat & (HDMI_PHY_RX_SENSE | HDMI_PHY_HPD)) == 0)
+                       cec_notifier_set_phys_addr(hdmi->cec_notifier,
+                                                  CEC_PHYS_ADDR_INVALID);
+       }
+
        if (intr_stat & HDMI_IH_PHY_STAT0_HPD) {
                dev_dbg(hdmi->dev, "EVENT=%s\n",
                        phy_int_pol & HDMI_PHY_HPD ? "plugin" : "plugout");
        if (ret)
                goto err_iahb;
 
+       hdmi->cec_notifier = cec_notifier_get(dev);
+       if (!hdmi->cec_notifier) {
+               ret = -ENOMEM;
+               goto err_iahb;
+       }
+
        /*
         * To prevent overflows in HDMI_IH_FC_STAT2, set the clk regenerator
         * N and cts values before enabling phy
                hdmi->ddc = NULL;
        }
 
+       if (hdmi->cec_notifier)
+               cec_notifier_put(hdmi->cec_notifier);
+
        clk_disable_unprepare(hdmi->iahb_clk);
 err_isfr:
        clk_disable_unprepare(hdmi->isfr_clk);