From patchwork Fri Mar 25 17:15:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guillaume Ranquet X-Patchwork-Id: 12791846 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 909ABC433F5 for ; Fri, 25 Mar 2022 17:32:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=C+/Cp+JPkTc/pHZAjHjVTLE+HlN6xLNE/WbEa4yYlLs=; b=dz37allFJgqb98 QH08qK+c4wCy8A9GGPrF9N8on8IDKXPpsR0xM7ohf2upcdvbZM+DNsCXBhau6wv9b6gKJ/aDyiCC+ MgLsE/tiHaCcs6F05WZnq/XDMliiwpRfVasC55+XUGYinSBARp3bLBIgwAiL0mpdQmXU3w4yUvNvS x+DYyWlu9XND339eNG+mwxwcjTvbYp16KUc6dkfypI2NIixzmUKyaVM8usNGIVTTEruFNAI/eR4JO k38utkp0KetOkRnO4vf5hcdZ4G/b46+1BqNdubHhyZSZPhwlCs6Ok2R6NwZaXf3dUWcSIBgWJnZw+ dmcRm5P/4TQDFkjJ0M3g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nXnly-002oid-LJ; Fri, 25 Mar 2022 17:30:52 +0000 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nXnZ6-002hzL-2r for linux-arm-kernel@lists.infradead.org; Fri, 25 Mar 2022 17:17:40 +0000 Received: by mail-wm1-x32b.google.com with SMTP id q20so4833041wmq.1 for ; Fri, 25 Mar 2022 10:17:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=sPZ7FGjoeMWGizm+Tvir8n+ep2Y5gqfNLr6cPfnxdL0=; b=QwhQpZiXoY5TVYEr11zMmZ5/ne6KHxjlFBW2/Hw5FR4FrIs5FKHyQACQKH8bld+/Nu dqT7jE/l0j4JIRasbWDPOT8ueCgPbeNDIGWGkmqJXNpm6Hp83fe8jZ/1Nx0ffNYJQqSR Ej720UwBmE920nZ6u6/NaX7CnJDYHnhutF/+lQRbbtoP9NgV3A33nbW9QmQEh5+Ox/Zy d2Vk6Oz+snY7HZPKMcxfOlDfFgw1Oa8o5n1UFv4rKkM2wRN9yg7lQBp1L1A/VgaX7NE4 Sg3rGnqXCeeFQh2F9R7xmwF3IIcneN77jJF2xxiS3kVdKTEOHMtG1GZ22aT99OGW7Bit dRXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=sPZ7FGjoeMWGizm+Tvir8n+ep2Y5gqfNLr6cPfnxdL0=; b=SFpJG0g9WlkVkwb1q+bK0p4AbdfkxaLrYcdQBfNbSbsBfxcZtFJvNx83/IuIpCN7ne gXG8H4M7pPaoi+O1/bk6oMGmfv4bQgIlnBW2mmvHezSYHBtEqqYYJa4u7HMtiTdPl278 oLT2Wtg2jWKWFfSA5xzF+QbhMz292H2iFAatqq36flADyK8IhK1bH9Yvn5EC5R4IrmcD ujUjfEXsVHSwSZb0qMTb47f6CxTCvKmX9LXzshjJRXiAWzYMx4H2AObfaCbxY9rrvMr5 wYG7B7tgxLSLWcSgHe6ycKAYRcchhuKH+zjeMlS3Oyxs6Vlakjs2kHiB1m+7nGUZpFsQ olFg== X-Gm-Message-State: AOAM530hWJbiBkt+Yllm5UhZCDnt5mAPp1x6JsoAey0sYbi8E+I5geCi t2+JPc5btZKfktQxYnDIrtK4gA== X-Google-Smtp-Source: ABdhPJzx5XeQEx/NjraCkgpGyTOwzN4hvRuQFeGLZUD9Q64Ryk/j+SV+JBkrRHUjiG+2bCFJQXYLyg== X-Received: by 2002:a05:600c:34d4:b0:38c:5ec7:1e38 with SMTP id d20-20020a05600c34d400b0038c5ec71e38mr20281401wmq.184.1648228650139; Fri, 25 Mar 2022 10:17:30 -0700 (PDT) Received: from localhost.localdomain (2a02-8440-6240-cc41-3074-96af-9642-0003.rev.sfr.net. [2a02:8440:6240:cc41:3074:96af:9642:3]) by smtp.gmail.com with ESMTPSA id p16-20020a5d6390000000b00203ffebddf3sm7547464wru.99.2022.03.25.10.17.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Mar 2022 10:17:29 -0700 (PDT) From: Guillaume Ranquet To: chunkuang.hu@kernel.org, p.zabel@pengutronix.de, airlied@linux.ie, daniel@ffwll.ch, robh+dt@kernel.org, maarten.lankhorst@linux.intel.com, mripard@kernel.org, tzimmermann@suse.de, matthias.bgg@gmail.com, chunfeng.yun@mediatek.com, kishon@ti.com, vkoul@kernel.org, deller@gmx.de, ck.hu@mediatek.com, jitao.shi@mediatek.com, angelogioacchino.delregno@collabora.com Cc: dri-devel@lists.freedesktop.org, linux-mediatek@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-phy@lists.infradead.org, linux-fbdev@vger.kernel.org, markyacoub@google.com Subject: [PATCH 21/22] drm/mediatek: change the aux retries times when receiving AUX_DEFER Date: Fri, 25 Mar 2022 18:15:10 +0100 Message-Id: <20220325171511.23493-22-granquet@baylibre.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220325171511.23493-1-granquet@baylibre.com> References: <20220325171511.23493-1-granquet@baylibre.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220325_101732_202863_AA78666C X-CRM114-Status: GOOD ( 14.48 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Jitao Shi DP 1.4a Section 2.8.7.1.5.6.1: A DP Source device shall retry at least seven times upon receiving AUX_DEFER before giving up the AUX transaction. Aux should retry to send msg whether how many bytes. Signed-off-by: Jitao Shi Signed-off-by: Guillaume Ranquet --- drivers/gpu/drm/mediatek/mtk_dp.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/mediatek/mtk_dp.c b/drivers/gpu/drm/mediatek/mtk_dp.c index 4981a3a3b9ca..de2a1c1b4f8c 100644 --- a/drivers/gpu/drm/mediatek/mtk_dp.c +++ b/drivers/gpu/drm/mediatek/mtk_dp.c @@ -2018,7 +2018,7 @@ static ssize_t mtk_dp_aux_transfer(struct drm_dp_aux *mtk_aux, bool is_read; u8 request; size_t accessed_bytes = 0; - int retry = 3, ret = 0; + int retry, ret = 0; mtk_dp = container_of(mtk_aux, struct mtk_dp, aux); @@ -2052,14 +2052,21 @@ static ssize_t mtk_dp_aux_transfer(struct drm_dp_aux *mtk_aux, } if (msg->size == 0) { - ret = mtk_dp_aux_do_transfer(mtk_dp, is_read, request, - msg->address + accessed_bytes, - msg->buffer + accessed_bytes, 0); + retry = 32; + while (retry--) { + ret = mtk_dp_aux_do_transfer(mtk_dp, is_read, request, + msg->address + accessed_bytes, + msg->buffer + accessed_bytes, 0); + if (ret == 0) + break; + usleep_range(500, 600); + } } else { while (accessed_bytes < msg->size) { size_t to_access = min_t(size_t, DP_AUX_MAX_PAYLOAD_BYTES, msg->size - accessed_bytes); + retry = 32; while (retry--) { ret = mtk_dp_aux_do_transfer(mtk_dp, is_read, request, @@ -2068,7 +2075,7 @@ static ssize_t mtk_dp_aux_transfer(struct drm_dp_aux *mtk_aux, to_access); if (ret == 0) break; - usleep_range(50, 100); + usleep_range(500, 600); } if (!retry || ret) { drm_info(mtk_dp->drm_dev,