Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2759085imj; Mon, 11 Feb 2019 08:04:08 -0800 (PST) X-Google-Smtp-Source: AHgI3IZw9BomLwgEt645ES/ACxc9EIizzIbbCa5jd/m7Sr2Gj/Rv/pVwkbewIQeUiL49ZFMAdOo/ X-Received: by 2002:a63:61d8:: with SMTP id v207mr9458212pgb.308.1549901048481; Mon, 11 Feb 2019 08:04:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549901048; cv=none; d=google.com; s=arc-20160816; b=qbKHIZmgTuATNG6TkKPOA24jjskGsETn8OaIqKm7o3ALgLvlokxyypgrvPRa+eJdvt NCYk8SmbWLwHzhCNdPCyFewbjMyJ35PWlpaEF5EQ54ymM+vlX/vOFgm0rf6MU2kxTbbF 3rZTd3AKL5Bi7Ad8MaV5XwY+yE0h2XnfD2gRJKY0BR79XF19FjUb1Qduta7hQr8SmKIE 1J41cUfDOhmRza2of98xZNhqWKcSEPsf1Mn+3PautvR87q20rBWbbaIq1K17XCcNSPX+ B5nwbpjQfCCRxESVC2h5F4koOxv7qzWXZ+bHenEDhK7FFrN3v+RNdh+TCmKXsqK1vwtb uS6g== 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=YwGWy+Csdxq0gpdPta3YKr+X5Z4Aj9M9nHSJn+JS/JQ=; b=M/LZ5dT7emEdSt4BTe5of5OOSx3hDf6W5r2e3c/OncIWIn8rUvAAnkFoI2rVlrlrDv hI1JA3jdNaePhI0gLhJ82C1HP6LBXZCAsdkMDd3dFjCwFU6+QOT708J9I9e/cH5N4blF yl9nniON+VzsWu5NEjqhlP45pL0+tYAL6/fmz5rrnM0ACWJP3FhUioEnhKGCnT/yFYxP 0RZGO3PVmXbRpi3md6pJGzdfbEaF79QUZk0nhC+T3nfk/v5pHFJGrleUDzSrAzAd55+p Lm9zTGA7nW1u9nHXgsmAMtV+5h9sahEgHSzSsNNJw4UGjSOFjhz61hESXa/wA8MW5PTd /O1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="L0k/71FB"; 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 e63si9901251pgc.239.2019.02.11.08.03.48; Mon, 11 Feb 2019 08:04:08 -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="L0k/71FB"; 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 S1730611AbfBKQB4 (ORCPT + 99 others); Mon, 11 Feb 2019 11:01:56 -0500 Received: from mail.kernel.org ([198.145.29.99]:37272 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730172AbfBKOaq (ORCPT ); Mon, 11 Feb 2019 09:30:46 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.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 0943420675; Mon, 11 Feb 2019 14:30:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549895445; bh=i8mREZB+8PDx2SGe85Bb4BtJN1WFRhlaCF2L+oVg9sU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L0k/71FBVUvOxehfFWr60SwMMjMSXfnwpMoHtKkn5YmgPwacrT1XAhLRfcDybqs69 1ShgsaoJ/6UpVxyH5XGFY4FqurnuO3FynMHpcN81dXGz9EwtcULhjz6W1DebHtoldn ARIpca2CNYQVV/OAglvIhcP3kByi0z8Eg/RNnfaQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Paul Hsieh , Eric Yang , Leo Li , Alex Deucher , Sasha Levin Subject: [PATCH 4.20 206/352] drm/amd/display: Add retry to read ddc_clock pin Date: Mon, 11 Feb 2019 15:17:13 +0100 Message-Id: <20190211141900.263471930@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141846.543045703@linuxfoundation.org> References: <20190211141846.543045703@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore 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 4.20-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit bd4905a9583c760da31ded7256dca6f71483c3dc ] [WHY] On customer board, there is one pluse (1v , < 1ms) on DDC_CLK pin when plug / unplug DP cable. Driver will read it and config DP to HDMI/DVI dongle. [HOW] If there is a real dongle, DDC_CLK should be always pull high. Try to read again to recovery this special case. Retry times = 3. Need additional 3ms to detect DP passive dongle(3 failures) Signed-off-by: Paul Hsieh Reviewed-by: Eric Yang Acked-by: Leo Li Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/display/dc/core/dc_link.c | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link.c b/drivers/gpu/drm/amd/display/dc/core/dc_link.c index 5141c1401889..ef1b350a45e0 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc_link.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc_link.c @@ -332,7 +332,7 @@ bool dc_link_is_dp_sink_present(struct dc_link *link) { enum gpio_result gpio_result; uint32_t clock_pin = 0; - + uint8_t retry = 0; struct ddc *ddc; enum connector_id connector_id = @@ -361,11 +361,22 @@ bool dc_link_is_dp_sink_present(struct dc_link *link) return present; } - /* Read GPIO: DP sink is present if both clock and data pins are zero */ - /* [anaumov] in DAL2, there was no check for GPIO failure */ - - gpio_result = dal_gpio_get_value(ddc->pin_clock, &clock_pin); - ASSERT(gpio_result == GPIO_RESULT_OK); + /* + * Read GPIO: DP sink is present if both clock and data pins are zero + * + * [W/A] plug-unplug DP cable, sometimes customer board has + * one short pulse on clk_pin(1V, < 1ms). DP will be config to HDMI/DVI + * then monitor can't br light up. Add retry 3 times + * But in real passive dongle, it need additional 3ms to detect + */ + do { + gpio_result = dal_gpio_get_value(ddc->pin_clock, &clock_pin); + ASSERT(gpio_result == GPIO_RESULT_OK); + if (clock_pin) + udelay(1000); + else + break; + } while (retry++ < 3); present = (gpio_result == GPIO_RESULT_OK) && !clock_pin; -- 2.19.1