Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3632471imu; Mon, 28 Jan 2019 08:09:22 -0800 (PST) X-Google-Smtp-Source: ALg8bN40k6+ff04ki29xoxgu6Xb3Pn4G7DyENCZ0ACCrntKi+3TqfXNz5d+E/d8E09pY6lWK2ukr X-Received: by 2002:a62:3c1:: with SMTP id 184mr22637246pfd.56.1548691762135; Mon, 28 Jan 2019 08:09:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548691762; cv=none; d=google.com; s=arc-20160816; b=q99SxjDQMIhAgL2RVdphUfAamTJPkiNQW+iV/Y7AkBjW1EjtSn1TFEqM6fFaIfuXIu 78tNML8fkBBQHXJUgCVuk11c0WVtmmg/gTBbzZOi4DxAwy3iGEZO2M1415ygEqXGTby3 AO6RPsBDgYjJqJG04l3jkZZ1Tb17zjyE2wX9M3wUR68kySLi81JNzZc9T76xZY3QmOgB MPWVn9wTkW9TyQx2yUP5Za6RK1Q1QNLW0tZJXRPtyHTIH/QU8tNyYRShbB6nZK7s8WRp DPtq0TIYnvJIe3SEx6CGvccIKl3Ar9/ewjNkq4oH/e/o2DmRX+4HZYTA0eqNUSwO9ckF DwWQ== 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=qvVVhfOtvYcsVlXEbe4rzrN8MvsV2Nk0uTFr8Mvqdnc=; b=hXqnhdJ8BU6LPppNMMC8OQNCAJFcGOfYHa7OFYuArBXIrU7paGv/ohZIdeoLiCyfa7 qCAkio5fOY+iL+7wi1kB5nkL4ynwMLE1ICGJdRqYfU0iOms+zcLDfrBJcn4ZmrZpc+3G JzSPy+5RTuTnozP2JG3Ibw1FGvVvGiMBSLTfKNZPYtVwSXqXq+A+SjdQ7QAlH1UcMCC3 idYHD/Edatgxv6E/ZqczVGNxr7JhojKbj3jmoUK6QG8VcDQ+5aj3w8LIMzeYT8KCmfDl 3OnnDPe21d5ZommjCOQSw9IZp0PmwWXUKwoM+cSMAVj+jdI7sLD5DRBejbnlFk8rFl1T l1uw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=J43yEF4i; 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 n1si32925330pfh.96.2019.01.28.08.09.05; Mon, 28 Jan 2019 08:09:22 -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=J43yEF4i; 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 S1732319AbfA1QID (ORCPT + 99 others); Mon, 28 Jan 2019 11:08:03 -0500 Received: from mail.kernel.org ([198.145.29.99]:59316 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732293AbfA1QIB (ORCPT ); Mon, 28 Jan 2019 11:08:01 -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 3952520989; Mon, 28 Jan 2019 16:07:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548691680; bh=ld7pbqgxEhgM6nFJUyr+6nZ/445YS85GwL8BJ/zm5tI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=J43yEF4iCoI8FKHtX9eLLvdpbYaJ6GE4RHkIeNJmKu8ba8Y741wSXJ8ZoK+hRTfZX eYIn6igwbQwKxOTYuMABz1ffRgy63qNa1YmLQUiFhRpV1BI6OPzpOssfkOKrH6q+uW YVYjtl+XTq3/Z3GsyhHcq2jjWLV4rvDvTXDBOAFs= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Paul Hsieh , Alex Deucher , Sasha Levin , amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org Subject: [PATCH AUTOSEL 4.19 183/258] drm/amd/display: Add retry to read ddc_clock pin Date: Mon, 28 Jan 2019 10:58:09 -0500 Message-Id: <20190128155924.51521-183-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190128155924.51521-1-sashal@kernel.org> References: <20190128155924.51521-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: Paul Hsieh [ 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 7c89785fd731..23a7ef97afdd 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc_link.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc_link.c @@ -324,7 +324,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 = @@ -353,11 +353,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