Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp6550277ybx; Mon, 11 Nov 2019 10:47:53 -0800 (PST) X-Google-Smtp-Source: APXvYqwm8nhDl17EHlHSngYWbIAz+8sU6BX6JdEbudeiUEXK6SchiHotpNlEWMXn/SLfr6mlwS/3 X-Received: by 2002:a17:906:958b:: with SMTP id r11mr24635030ejx.332.1573498073798; Mon, 11 Nov 2019 10:47:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573498073; cv=none; d=google.com; s=arc-20160816; b=qmORmHgpxCLDcrmo6RKT8vcGyK+UzcvxH+oK9VradMPmlU6OCAUp1cTScUreyTmgnQ BtXLgUkfdZq+s+brd4mnIHal+9mZR0IRW9xdQFUnvJ2xqVaeAvcV5h16DX+sZpzZy6Vv 7w6zRFUpSc77USCcB1KxaewFkb3XwrjGabIWTrDAB5ZuEPO9tb51lFmJzIh4rV7Tk4ym hLWA3FnbcPvYfGo0lrvba2N/N01tD7NtpchgTxWCYlXhepBOWsu1WJJmEkgjiiIFYN50 C0wGqHNVv0Qb9HZHLjszgRnlgs02blOrDLjT3j61n/6XHidYMQtqnifQX1uVyfMObYAn CvIA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Qe63GltZuJY3k75ZJTpBpm+cP4D6SABBFX8RquNRvqo=; b=e9ZlbvsDFJnISJV9hp3bGI1z3LxzpTQT9uojQy25Z2fBDxZeCGYfiJbZvV58h5XPXz HWQ1awM1FnjtGjgA9y7f05LANeJrzKZCiBAwAV6obdxPk0OzfFCCBHYOmyoQ7ZkylMEF wHX2WHrJGSnEv5V+2W8rCF3Ubd4xkbETJbSZsz3QuVIVTGIQuLQNBpEW3HV/Z1HPW1h8 xZKfeVvcM7I4SQzlb8GL1MuaCZHgzgwUQZWyt4hBrCoRG55eBPnTCXKemPz6NrDJAuIu irfP3CaRBA3qscsE8GcvkVaHBewZPaS9sLSanh2NOS3BAy8eSd0FWZofyyU7hbppWfng 57xA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=mT1NK2d6; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u24si12773072edl.447.2019.11.11.10.47.29; Mon, 11 Nov 2019 10:47:53 -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=mT1NK2d6; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728021AbfKKSqR (ORCPT + 99 others); Mon, 11 Nov 2019 13:46:17 -0500 Received: from mail.kernel.org ([198.145.29.99]:38692 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729977AbfKKSqP (ORCPT ); Mon, 11 Nov 2019 13:46:15 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D129720659; Mon, 11 Nov 2019 18:46:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1573497974; bh=4e9pxfGDU6RapcaX+QCh8nJXlA3vULm4getxnp/+7Jc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mT1NK2d6mQqvqmJte7Pmwichh1Cyf4FgsXZIewnXHvi7nUsyrHMb9MOrh7sfCG1jp cuGsbu6mpvAlq1GZw1T4++gyjT9kPOS3Huf8QHq1oEbwgAn5YaCwpZNI8/x+X/tiDe N9hSe+KG/Crk1MCx1p1fT/0MHCpd0iGhR+VMg/F0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Strauss , Tony Cheng , Leo Li , Alex Deucher , Sasha Levin Subject: [PATCH 4.19 111/125] drm/amd/display: Passive DP->HDMI dongle detection fix Date: Mon, 11 Nov 2019 19:29:10 +0100 Message-Id: <20191111181454.612373790@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191111181438.945353076@linuxfoundation.org> References: <20191111181438.945353076@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Michael Strauss [ Upstream commit bc2fde42e2418808dbfc04de1a6da91d7d31cf1a ] [WHY] i2c_read is called to differentiate passive DP->HDMI and DP->DVI-D dongles The call is expected to fail in DVI-D case but pass in HDMI case Some HDMI dongles have a chance to fail as well, causing misdetection as DVI-D [HOW] Retry i2c_read to ensure failed result is valid Signed-off-by: Michael Strauss Reviewed-by: Tony Cheng Acked-by: Leo Li Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- .../gpu/drm/amd/display/dc/core/dc_link_ddc.c | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c b/drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c index 8def0d9fa0ff0..46c9cb47a96e5 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c @@ -433,6 +433,7 @@ void dal_ddc_service_i2c_query_dp_dual_mode_adaptor( enum display_dongle_type *dongle = &sink_cap->dongle_type; uint8_t type2_dongle_buf[DP_ADAPTOR_TYPE2_SIZE]; bool is_type2_dongle = false; + int retry_count = 2; struct dp_hdmi_dongle_signature_data *dongle_signature; /* Assume we have no valid DP passive dongle connected */ @@ -445,13 +446,24 @@ void dal_ddc_service_i2c_query_dp_dual_mode_adaptor( DP_HDMI_DONGLE_ADDRESS, type2_dongle_buf, sizeof(type2_dongle_buf))) { - *dongle = DISPLAY_DONGLE_DP_DVI_DONGLE; - sink_cap->max_hdmi_pixel_clock = DP_ADAPTOR_DVI_MAX_TMDS_CLK; + /* Passive HDMI dongles can sometimes fail here without retrying*/ + while (retry_count > 0) { + if (i2c_read(ddc, + DP_HDMI_DONGLE_ADDRESS, + type2_dongle_buf, + sizeof(type2_dongle_buf))) + break; + retry_count--; + } + if (retry_count == 0) { + *dongle = DISPLAY_DONGLE_DP_DVI_DONGLE; + sink_cap->max_hdmi_pixel_clock = DP_ADAPTOR_DVI_MAX_TMDS_CLK; - CONN_DATA_DETECT(ddc->link, type2_dongle_buf, sizeof(type2_dongle_buf), - "DP-DVI passive dongle %dMhz: ", - DP_ADAPTOR_DVI_MAX_TMDS_CLK / 1000); - return; + CONN_DATA_DETECT(ddc->link, type2_dongle_buf, sizeof(type2_dongle_buf), + "DP-DVI passive dongle %dMhz: ", + DP_ADAPTOR_DVI_MAX_TMDS_CLK / 1000); + return; + } } /* Check if Type 2 dongle.*/ -- 2.20.1