Commit e84b8d75 authored by Russell King's avatar Russell King Committed by Archit Taneja

drm/bridge: dw-hdmi: add cec notifier support

Add CEC notifier support to the HDMI bridge driver, so that the CEC
part of the IP can receive its physical address.
Signed-off-by: default avatarRussell King <rmk+kernel@armlinux.org.uk>
Tested-by: default avatarNeil Armstrong <narmstrong@baylibre.com>
Reviewed-by: default avatarNeil Armstrong <narmstrong@baylibre.com>
Tested-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarArchit Taneja <architt@codeaurora.org>
Link: https://patchwork.freedesktop.org/patch/msgid/E1dcBhV-00088e-8x@rmk-PC.armlinux.org.uk
parent ace98812
...@@ -2,6 +2,7 @@ config DRM_DW_HDMI ...@@ -2,6 +2,7 @@ config DRM_DW_HDMI
tristate tristate
select DRM_KMS_HELPER select DRM_KMS_HELPER
select REGMAP_MMIO select REGMAP_MMIO
select CEC_CORE if CEC_NOTIFIER
config DRM_DW_HDMI_AHB_AUDIO config DRM_DW_HDMI_AHB_AUDIO
tristate "Synopsys Designware AHB Audio interface" tristate "Synopsys Designware AHB Audio interface"
......
...@@ -36,7 +36,10 @@ ...@@ -36,7 +36,10 @@
#include "dw-hdmi.h" #include "dw-hdmi.h"
#include "dw-hdmi-audio.h" #include "dw-hdmi-audio.h"
#include <media/cec-notifier.h>
#define DDC_SEGMENT_ADDR 0x30 #define DDC_SEGMENT_ADDR 0x30
#define HDMI_EDID_LEN 512 #define HDMI_EDID_LEN 512
enum hdmi_datamap { enum hdmi_datamap {
...@@ -175,6 +178,8 @@ struct dw_hdmi { ...@@ -175,6 +178,8 @@ struct dw_hdmi {
struct regmap *regm; struct regmap *regm;
void (*enable_audio)(struct dw_hdmi *hdmi); void (*enable_audio)(struct dw_hdmi *hdmi);
void (*disable_audio)(struct dw_hdmi *hdmi); void (*disable_audio)(struct dw_hdmi *hdmi);
struct cec_notifier *cec_notifier;
}; };
#define HDMI_IH_PHY_STAT0_RX_SENSE \ #define HDMI_IH_PHY_STAT0_RX_SENSE \
...@@ -1896,6 +1901,7 @@ static int dw_hdmi_connector_get_modes(struct drm_connector *connector) ...@@ -1896,6 +1901,7 @@ static int dw_hdmi_connector_get_modes(struct drm_connector *connector)
hdmi->sink_is_hdmi = drm_detect_hdmi_monitor(edid); hdmi->sink_is_hdmi = drm_detect_hdmi_monitor(edid);
hdmi->sink_has_audio = drm_detect_monitor_audio(edid); hdmi->sink_has_audio = drm_detect_monitor_audio(edid);
drm_mode_connector_update_edid_property(connector, 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); ret = drm_add_edid_modes(connector, edid);
/* Store the ELD */ /* Store the ELD */
drm_edid_to_eld(connector, edid); drm_edid_to_eld(connector, edid);
...@@ -2119,11 +2125,16 @@ static irqreturn_t dw_hdmi_irq(int irq, void *dev_id) ...@@ -2119,11 +2125,16 @@ static irqreturn_t dw_hdmi_irq(int irq, void *dev_id)
* ask the source to re-read the EDID. * ask the source to re-read the EDID.
*/ */
if (intr_stat & 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, __dw_hdmi_setup_rx_sense(hdmi,
phy_stat & HDMI_PHY_HPD, phy_stat & HDMI_PHY_HPD,
phy_stat & HDMI_PHY_RX_SENSE); 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) { if (intr_stat & HDMI_IH_PHY_STAT0_HPD) {
dev_dbg(hdmi->dev, "EVENT=%s\n", dev_dbg(hdmi->dev, "EVENT=%s\n",
phy_int_pol & HDMI_PHY_HPD ? "plugin" : "plugout"); phy_int_pol & HDMI_PHY_HPD ? "plugin" : "plugout");
...@@ -2376,6 +2387,12 @@ __dw_hdmi_probe(struct platform_device *pdev, ...@@ -2376,6 +2387,12 @@ __dw_hdmi_probe(struct platform_device *pdev,
if (ret) if (ret)
goto err_iahb; 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 * To prevent overflows in HDMI_IH_FC_STAT2, set the clk regenerator
* N and cts values before enabling phy * N and cts values before enabling phy
...@@ -2452,6 +2469,9 @@ __dw_hdmi_probe(struct platform_device *pdev, ...@@ -2452,6 +2469,9 @@ __dw_hdmi_probe(struct platform_device *pdev,
hdmi->ddc = NULL; hdmi->ddc = NULL;
} }
if (hdmi->cec_notifier)
cec_notifier_put(hdmi->cec_notifier);
clk_disable_unprepare(hdmi->iahb_clk); clk_disable_unprepare(hdmi->iahb_clk);
err_isfr: err_isfr:
clk_disable_unprepare(hdmi->isfr_clk); clk_disable_unprepare(hdmi->isfr_clk);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment