From patchwork Fri Oct 19 14:07:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Todor Tomov X-Patchwork-Id: 149284 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp3363652lji; Fri, 19 Oct 2018 07:16:41 -0700 (PDT) X-Google-Smtp-Source: ACcGV630f2ULW9qMFUeIIsw7KzVHvvgv8mcQ3AKcEzCFpvg4ZGHsEVFbPhIK2CYMUlZnAhEjRX4S X-Received: by 2002:a62:5fc5:: with SMTP id t188-v6mr25614908pfb.84.1539958601585; Fri, 19 Oct 2018 07:16:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539958601; cv=none; d=google.com; s=arc-20160816; b=hJ1BPLhr4YJTpA4ap/9yB4gCBaDm2OeJGYCIn87c3Jdd8Lz7dnPZuo9tWBUce2aseG oKPoas1tE5kkrGcQpda54eAP+JqSOtgfniZ9RPhQW8WIJqI7ta53p4YMme/IC9zh380Y wGhRyis1fmRnPFObc/ADBxZymOmz/EgaORiFMAAVuSQKoO3DhQQdykIJCjJp/q7+zGZC EFNnO7pMNhG46xwItlUhVyoydSvMMURvuOUFl6kh+xr84y6/NV8OBPXh9ZQyNztmANe+ 09mSHRK/o1+q4QXErP7t/bAzMevDaCz1v3ip8exwUaS1AvJsNPFC/0VdInss1cjsaklg rDmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=6WuAdkpmtImqiJlIEJ30YzqZqBdNLcBVvhdKZVpocVo=; b=Xeeb9GoIVnM3Q/ZBpEySSE3ohW6CYd4ZBTPdvIlthCLXg4j7xbjPkd6BT8NRzLW/Pe nKPQCeNC1nrWTiJscIMSa5fbp8jh0AjsyrG0tF4qzDwRrMFo4ityEHiBiTkV+I803erX +Gugi3BezGv+RbL9ykHHWkWRtqww4B8RHUuu1WzzFsx49gcni4LSpR6d7OlfrV3vuMic /tWj4oJHRUUlzT4SFYiCEG+BCsM3AzRj1UQI84zwwdRDkt4Vfjcot5h3M0i7WjjGgYPp kI+wFuTe4C0rNa3cLmK0w7J4qY/GLVrkP8ai28OJb7tLhICvpCPmLI+nV1S0fVc4DShX D8Mw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v20-v6si22848583pgk.586.2018.10.19.07.16.40; Fri, 19 Oct 2018 07:16:41 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727466AbeJSWW6 (ORCPT + 14 others); Fri, 19 Oct 2018 18:22:58 -0400 Received: from ns.mm-sol.com ([37.157.136.199]:33050 "EHLO extserv.mm-sol.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727413AbeJSWW6 (ORCPT ); Fri, 19 Oct 2018 18:22:58 -0400 X-Greylist: delayed 541 seconds by postgrey-1.27 at vger.kernel.org; Fri, 19 Oct 2018 18:22:57 EDT Received: from mms-0439.qualcomm.mm-sol.com (unknown [37.157.136.206]) by extserv.mm-sol.com (Postfix) with ESMTPSA id A25E4CE26; Fri, 19 Oct 2018 17:07:38 +0300 (EEST) From: Todor Tomov To: dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org Cc: robdclark@gmail.com, linux-kernel@vger.kernel.org, Todor Tomov Subject: [PATCH] drm/msm/hdmi: Enable HPD after HDMI IRQ is set up Date: Fri, 19 Oct 2018 17:07:22 +0300 Message-Id: <1539958042-28612-1-git-send-email-todor.tomov@linaro.org> X-Mailer: git-send-email 2.7.4 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org SoCs that contain MDP5 have a top level wrapper called MDSS that manages locks, power and irq for the sub-blocks within it. Irq for HDMI is also routed through the MDSS. Shortly after the Hot Plug Detection (HPD) is enabled in HDMI, HDMI interrupts are recieved by the MDSS interrupt handler. However at this moment the HDMI irq is still not mapped to the MDSS irq domain so the HDMI irq handler cannot be called to process the interrupts. This leads to a flood of HDMI interrupts on CPU 0. If we are lucky to have the HDMI initialization running on a different CPU, it will eventually map the HDMI irq to MDSS irq domain, the next HDMI interrupt will be handled by the HDMI irq handler, the interrupt flood will stop and we will recover. If the HDMI initialization is running on CPU 0, then it cannot complete and there is nothing to stop the interrupt flood on CPU 0. The system is stuck. Fix this by moving the HPD enablement after the HDMI irq is mapped to the MDSS irq domain. Signed-off-by: Todor Tomov --- drivers/gpu/drm/msm/hdmi/hdmi.c | 6 ++++++ drivers/gpu/drm/msm/hdmi/hdmi.h | 1 + drivers/gpu/drm/msm/hdmi/hdmi_connector.c | 10 ++-------- 3 files changed, 9 insertions(+), 8 deletions(-) -- 2.7.4 diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.c b/drivers/gpu/drm/msm/hdmi/hdmi.c index c79659c..e74df38 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi.c +++ b/drivers/gpu/drm/msm/hdmi/hdmi.c @@ -332,6 +332,12 @@ int msm_hdmi_modeset_init(struct hdmi *hdmi, goto fail; } + ret = msm_hdmi_hpd_enable(hdmi->connector); + if (ret < 0) { + dev_err(&hdmi->pdev->dev, "failed to enable HPD: %d\n", ret); + goto fail; + } + encoder->bridge = hdmi->bridge; priv->bridges[priv->num_bridges++] = hdmi->bridge; diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.h b/drivers/gpu/drm/msm/hdmi/hdmi.h index accc9a6..5c5df6a 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi.h +++ b/drivers/gpu/drm/msm/hdmi/hdmi.h @@ -245,6 +245,7 @@ void msm_hdmi_bridge_destroy(struct drm_bridge *bridge); void msm_hdmi_connector_irq(struct drm_connector *connector); struct drm_connector *msm_hdmi_connector_init(struct hdmi *hdmi); +int msm_hdmi_hpd_enable(struct drm_connector *connector); /* * i2c adapter for ddc: diff --git a/drivers/gpu/drm/msm/hdmi/hdmi_connector.c b/drivers/gpu/drm/msm/hdmi/hdmi_connector.c index e9c9a0a..30e908d 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi_connector.c +++ b/drivers/gpu/drm/msm/hdmi/hdmi_connector.c @@ -167,8 +167,9 @@ static void enable_hpd_clocks(struct hdmi *hdmi, bool enable) } } -static int hpd_enable(struct hdmi_connector *hdmi_connector) +int msm_hdmi_hpd_enable(struct drm_connector *connector) { + struct hdmi_connector *hdmi_connector = to_hdmi_connector(connector); struct hdmi *hdmi = hdmi_connector->hdmi; const struct hdmi_platform_config *config = hdmi->config; struct device *dev = &hdmi->pdev->dev; @@ -450,7 +451,6 @@ struct drm_connector *msm_hdmi_connector_init(struct hdmi *hdmi) { struct drm_connector *connector = NULL; struct hdmi_connector *hdmi_connector; - int ret; hdmi_connector = kzalloc(sizeof(*hdmi_connector), GFP_KERNEL); if (!hdmi_connector) @@ -471,12 +471,6 @@ struct drm_connector *msm_hdmi_connector_init(struct hdmi *hdmi) connector->interlace_allowed = 0; connector->doublescan_allowed = 0; - ret = hpd_enable(hdmi_connector); - if (ret) { - dev_err(&hdmi->pdev->dev, "failed to enable HPD: %d\n", ret); - return ERR_PTR(ret); - } - drm_connector_attach_encoder(connector, hdmi->encoder); return connector;