From 6ecef8872ee5b52fd404bbfb960485b3e4c79000 Mon Sep 17 00:00:00 2001 From: Archit Taneja Date: Fri, 18 Nov 2016 15:20:39 +0530 Subject: drm/msm/hdmi: wait a bit for HPD sense to come up It can take a while for the HPD sense to come up once we've configured it. If we call HDMI connector's detect() very soon after configuring HPD registers, drm might think we don't have HDMI connected. Wait a bit before we let drm use the connector funcs. Signed-off-by: Archit Taneja --- drivers/gpu/drm/msm/hdmi/hdmi_connector.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/gpu/drm/msm/hdmi/hdmi_connector.c b/drivers/gpu/drm/msm/hdmi/hdmi_connector.c index a6eeab2c4dc3..40a9d4785c3f 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi_connector.c +++ b/drivers/gpu/drm/msm/hdmi/hdmi_connector.c @@ -224,6 +224,13 @@ int msm_hdmi_hpd_enable(struct drm_connector *connector) HDMI_HPD_CTRL_ENABLE | hpd_ctrl); spin_unlock_irqrestore(&hdmi->reg_lock, flags); + /* + * wait for a bit so that HPD is sensed if there is a cable already + * connected. Returning early will result in someone calling the + * connnector func's detect() callback too early + */ + msleep(15); + return 0; fail: -- cgit v1.2.3 From ac0d669c6f63d4e233b362bac11ee15d3093062a Mon Sep 17 00:00:00 2001 From: Archit Taneja Date: Thu, 28 Sep 2017 05:01:43 +0530 Subject: drm/msm/hdmi: Keep the HDMI_CTRL_ENABLE bitfield always on The ENABLE field in REG_HDMI_CTRL is required to be set to detect hot plug events on 8x96. We don't get any HPD interrupts when HDMI bridge is disabled. Keep it always on. Downstream also seems to do the same thing. Restrict this quirk only to 8x96, since we're not entirely sure whether this is a legitimate fix or not. Signed-off-by: Archit Taneja --- drivers/gpu/drm/msm/hdmi/hdmi.c | 3 +++ drivers/gpu/drm/msm/hdmi/hdmi.h | 3 +++ 2 files changed, 6 insertions(+) diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.c b/drivers/gpu/drm/msm/hdmi/hdmi.c index e247d6942a49..af9072ace23c 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi.c +++ b/drivers/gpu/drm/msm/hdmi/hdmi.c @@ -39,6 +39,8 @@ void msm_hdmi_set_mode(struct hdmi *hdmi, bool power_on) } } else { ctrl = HDMI_CTRL_HDMI; + if (hdmi->config->keep_ctrl_on) + ctrl |= HDMI_CTRL_ENABLE; } hdmi_write(hdmi, REG_HDMI_CTRL, ctrl); @@ -420,6 +422,7 @@ static struct hdmi_platform_config hdmi_tx_8996_config = { HDMI_CFG(pwr_clk, 8x74), HDMI_CFG(hpd_clk, 8x74), .hpd_freq = hpd_clk_freq_8x74, + .keep_ctrl_on = true, }; static const struct { diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.h b/drivers/gpu/drm/msm/hdmi/hdmi.h index 5c5df6ab2a57..342103d7d91e 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi.h +++ b/drivers/gpu/drm/msm/hdmi/hdmi.h @@ -121,6 +121,9 @@ struct hdmi_platform_config { /* gpio's: */ struct hdmi_gpio_data gpios[HDMI_MAX_NUM_GPIO]; + + /* caps, etc. */ + bool keep_ctrl_on; }; void msm_hdmi_set_mode(struct hdmi *hdmi, bool power_on); -- cgit v1.2.3 From 88f4308dcfc43ea8b12d1ed6402886ccbb407322 Mon Sep 17 00:00:00 2001 From: Archit Taneja Date: Thu, 28 Sep 2017 05:30:02 +0530 Subject: drm/msm/hdmi: Switch to DRM_CONNECTOR_POLL_HPD We support HPD interrupts on all platofrms, let's start using it. Signed-off-by: Archit Taneja --- drivers/gpu/drm/msm/hdmi/hdmi_connector.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/gpu/drm/msm/hdmi/hdmi_connector.c b/drivers/gpu/drm/msm/hdmi/hdmi_connector.c index 40a9d4785c3f..151c8549173f 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi_connector.c +++ b/drivers/gpu/drm/msm/hdmi/hdmi_connector.c @@ -472,8 +472,7 @@ struct drm_connector *msm_hdmi_connector_init(struct hdmi *hdmi) DRM_MODE_CONNECTOR_HDMIA); drm_connector_helper_add(connector, &msm_hdmi_connector_helper_funcs); - connector->polled = DRM_CONNECTOR_POLL_CONNECT | - DRM_CONNECTOR_POLL_DISCONNECT; + connector->polled = DRM_CONNECTOR_POLL_HPD; connector->interlace_allowed = 0; connector->doublescan_allowed = 0; -- cgit v1.2.3