Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp436196imu; Wed, 12 Dec 2018 20:51:46 -0800 (PST) X-Google-Smtp-Source: AFSGD/WJhaP4IMZF3p8sagO2ySE23VJ/7iZEC7uvlVWgHYH7Yg9dqGOqXVY+QTF2SaVGLa78yn0M X-Received: by 2002:a17:902:f082:: with SMTP id go2mr22382812plb.115.1544676706759; Wed, 12 Dec 2018 20:51:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544676706; cv=none; d=google.com; s=arc-20160816; b=ffcXBXDYzTHQd2Mi5KZ2frzXZLsU79Le8r2sC2R/7i8Eo/+Q1pk5n7LwZBLfCc6WK+ 90B0dT5BaNx6QMJPccgOndA7luh5cqGVf8+Bjel6I8gCR+A3iRQOjxbdr8N+sFQ04Nt6 Q8uaTCmexJ1UXrGTKLQK1zTn2ibudY/COQbqnJvQCSGYHwmufq89UN0RSC5dzGlL8fS8 1vWAlbUMbnJfgs9AJH+7uYrWN/fPWwFrYs62Gig9mNmeD/ChmLjY7rGrkeASzuSRI2Dy JVc1jLJrR5SbEDLRw1cisHraHYC4Wp9n5DQQTp+OTvJYkqg8QXvqMVpAEGMkcSCjsgZQ Jcpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=vLL16/bnk6s/moiknrvhyeHGS0EldH7TivP0KtUJwBw=; b=BSz59gIuKIr0tUtzSK8Bd0sZ1WJSGCojUVGZfWg9DE3Dy/WkQG+Yb1QwJOvH8lrd1b AagLNYMSTM9ddiOZHaA7kU8gUbehzMm3ieHLyrtXjJ9I+dXaQrnnnWvivUMkqlgIv9Xr PSeeCDif3AU35TlEbyS9qYc11hzfENjI1bLX8KWUmtp3cDUwxpgl0d/K1dFHLnRcCk80 QkIpVnQfFsvu2sVdBmXPZRBZy/dc0RNnFD/TS8rIPpIyIe8wZGpPNnq+8zs3KlaBMDBn 99rsnYTAD9Y/qPies2aMOErizOlrqjQNJN16jGTsu/D2JXsq/CVmW4xHCAjKCb8eah/Y b1wg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=un5WVOu8; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b63si706761pfa.250.2018.12.12.20.51.32; Wed, 12 Dec 2018 20:51:46 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=un5WVOu8; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728528AbeLMEtv (ORCPT + 99 others); Wed, 12 Dec 2018 23:49:51 -0500 Received: from mail.kernel.org ([198.145.29.99]:42568 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727692AbeLME3f (ORCPT ); Wed, 12 Dec 2018 23:29:35 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5D79620879; Thu, 13 Dec 2018 04:29:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1544675374; bh=s9jculQmF5oj+3znmtzfEGyVfsLa532XYmpOeJiVqCc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=un5WVOu8pJK8yUX+IfxftfHbXZzTujDVsfmimUhTgw5kB9LccVaFSTzO7aizsXjb2 0eFOA9pLxtenpTrpxhONHm65+A84l20JTIls0VBBCATERnOsnhFQMfYRZU12egnWFK B1gr340TbmDxd2YMBHNVSe9EFPAWoRMIduSY90cg= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Todor Tomov , Rob Clark , Sean Paul , Sasha Levin , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Subject: [PATCH AUTOSEL 4.19 32/73] drm/msm/hdmi: Enable HPD after HDMI IRQ is set up Date: Wed, 12 Dec 2018 23:27:57 -0500 Message-Id: <20181213042838.75160-32-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181213042838.75160-1-sashal@kernel.org> References: <20181213042838.75160-1-sashal@kernel.org> MIME-Version: 1.0 X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Todor Tomov [ Upstream commit ee4456359640defe3f51cc6b728bfce4bc444c9e ] 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 Signed-off-by: Rob Clark Signed-off-by: Sean Paul Signed-off-by: Sasha Levin --- 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(-) diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.c b/drivers/gpu/drm/msm/hdmi/hdmi.c index c79659ca5706..33e083f71a17 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) { + DRM_DEV_ERROR(&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 accc9a61611d..5c5df6ab2a57 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 e9c9a0af508e..30e908dfded7 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; -- 2.19.1