Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp220233pxj; Tue, 18 May 2021 01:40:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxLoqQMhU6GcLSw9YpzWXvPiu8mJzG8wJ0I8balg0dm04GVVAVP5ayFuLWgEXI9kkzGx+fS X-Received: by 2002:a05:6602:21ca:: with SMTP id c10mr3400096ioc.10.1621327201508; Tue, 18 May 2021 01:40:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621327201; cv=none; d=google.com; s=arc-20160816; b=ZverxHT1myizQuK2J4N3ud1LHXdiYCK3FevzeMEj67lvmppaG94m+ebThNimR9oH/5 9fzFV0TfixZoFSrtF0HkDVKe+ascRmyV+ehCMh2A5yYRyFVChVvx1nVsewbMmijOvany LinPP1OeptKHA3fXugATXgY1YAUY4OifUm3UrWaBCfzS7YAI8SP8tb0WHeZaVg6bvYjB Zsn6sXgrNB+lQYry0hJPSaJgMjJ4pPA/4HjZmXY6ywt0VZH3DzPAziJQ7xKHMJgDfYXN qN8YY9ii8Im8V7DAhdng0OR9ktNvUIs8M9tp+WG3VWDrIMkmeibcCzEbj7HRqSxcrmSU kieA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=VXd8iyOZG8hFrAGnJzIhFNgwDfQrYKZswBw7cnaqWSA=; b=F7IwXHYOpBP+UQ/5EDgzEcqqXHfBd89UEOpoEQ1XJ7o7Z6c1g5BkVjHl0EC0iyT+Pm gw4u9E+q3FccHO+ZtW28mYpK9wiEWa1ddQBtIvOZpnWCHhs3R8lHoFdLaDTDkvLqJbcY +Qf5NIIwnd9r7KI0rL3sqDf04cdG6Kcx/2yq2HLUj3EALL4mxNVZUZHcc+e6toRZZrPl x+GIWxceHNqYidqvVeJmsklaKFTymMNRaxqCz6b5grge7/iX7aa7+DLH9e5oPf87Q/1N 0bRSp2nzqsOels+GLq0yt53nDdFpEPmVHldOyZgACWQSWLyr9E+NpCVavxGpLwH/H7M2 023g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="aUNv6/dn"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t23si18978498ioj.71.2021.05.18.01.39.48; Tue, 18 May 2021 01:40:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="aUNv6/dn"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242413AbhEQPCP (ORCPT + 99 others); Mon, 17 May 2021 11:02:15 -0400 Received: from mail.kernel.org ([198.145.29.99]:48048 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241516AbhEQOv5 (ORCPT ); Mon, 17 May 2021 10:51:57 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id CE18A6148E; Mon, 17 May 2021 14:23:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621261421; bh=LJHzM9+iUJCNi8zuleR7ma0+yzc4WKF0Qs87gnZ1+2c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aUNv6/dnl48SoECmIMOJD05eOJb0L0L4tRouuOJqn/H7L310yZqsY4ds4IVG3wgg0 6zrRris2Hmz9StXSR2R14w2FKM+YPoNZ/Iamb6j0t7BP+qAr9SjYeRdLT9eIIHL+9Z 4kSpRuvwm0S407X4e4wjOky5I/P5G2Sjz7fo+VgY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stephen Boyd , Kuogee Hsieh , Rob Clark Subject: [PATCH 5.12 344/363] drm/msm/dp: check sink_count before update is_connected status Date: Mon, 17 May 2021 16:03:30 +0200 Message-Id: <20210517140314.235086456@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140302.508966430@linuxfoundation.org> References: <20210517140302.508966430@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Kuogee Hsieh commit d9aa6571b28ba0022de1e48801ff03a1854c7ef2 upstream. Link status is different from display connected status in the case of something like an Apple dongle where the type-c plug can be connected, and therefore the link is connected, but no sink is connected until an HDMI cable is plugged into the dongle. The sink_count of DPCD of dongle will increase to 1 once an HDMI cable is plugged into the dongle so that display connected status will become true. This checking also apply at pm_resume. Changes in v4: -- none Fixes: 94e58e2d06e3 ("drm/msm/dp: reset dp controller only at boot up and pm_resume") Reported-by: Stephen Boyd Reviewed-by: Stephen Boyd Tested-by: Stephen Boyd Signed-off-by: Kuogee Hsieh Fixes: 8ede2ecc3e5e ("drm/msm/dp: Add DP compliance tests on Snapdragon Chipsets") Link: https://lore.kernel.org/r/1619048258-8717-2-git-send-email-khsieh@codeaurora.org Signed-off-by: Rob Clark Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/msm/dp/dp_display.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) --- a/drivers/gpu/drm/msm/dp/dp_display.c +++ b/drivers/gpu/drm/msm/dp/dp_display.c @@ -595,10 +595,8 @@ static int dp_connect_pending_timeout(st mutex_lock(&dp->event_mutex); state = dp->hpd_state; - if (state == ST_CONNECT_PENDING) { - dp_display_enable(dp, 0); + if (state == ST_CONNECT_PENDING) dp->hpd_state = ST_CONNECTED; - } mutex_unlock(&dp->event_mutex); @@ -677,10 +675,8 @@ static int dp_disconnect_pending_timeout mutex_lock(&dp->event_mutex); state = dp->hpd_state; - if (state == ST_DISCONNECT_PENDING) { - dp_display_disable(dp, 0); + if (state == ST_DISCONNECT_PENDING) dp->hpd_state = ST_DISCONNECTED; - } mutex_unlock(&dp->event_mutex); @@ -1279,7 +1275,12 @@ static int dp_pm_resume(struct device *d status = dp_catalog_link_is_connected(dp->catalog); - if (status) + /* + * can not declared display is connected unless + * HDMI cable is plugged in and sink_count of + * dongle become 1 + */ + if (status && dp->link->sink_count) dp->dp_display.is_connected = true; else dp->dp_display.is_connected = false;