Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp4696445pxb; Mon, 28 Mar 2022 01:26:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyd/qG4FgDq/uHT0E6t80E4pSfnJNS/Qvx/IFnyVARYjt9mu9cEeTrh+fM6u2oB3huKbmvJ X-Received: by 2002:a17:90b:1e04:b0:1c6:fbac:b0e2 with SMTP id pg4-20020a17090b1e0400b001c6fbacb0e2mr39828417pjb.207.1648455974604; Mon, 28 Mar 2022 01:26:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648455974; cv=none; d=google.com; s=arc-20160816; b=gkrvbKWVnoVNlZXFLDBe27oFEz8Tgz/4Ohcng6IcVXifWtQI812rn5m5/yZ31kJnfE cO8WriLaVrvOXGuL1xzRRgH7RjySHUo8N8ZUL9xnwlL2VefoIULzVK2cUGVcoeDIrk5m JJTu4kteYw3FJ4uyrjz7SL0iwS/4nZp9cGWcKmwLaCNiKKZNDCAlkOgpdZRDb/i1DKTp LdG45unxYfytZip8PfYNpL8S0lVg6RHynoc82Il8lsOJb4EZNbZihsf0N+QDkYEyqGFV r8qjGMQvjXva7UJFP5Ym7Oe3QnhGI7pPDzV5BCC1/b5dPLcRFWzlrTujnCA6KJ2J1IVj 5jtQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=TwcBGQ6dA75HdxpcUCrD8mvsn7/MZTlw7uERAWlwKmI=; b=cvELtpHz0OudilkLXW1nYJE7R4ErjUJsfAJBeZrFEjsyCLuVgalBvwsUzu3WKyxPiJ ifUvQtO7v+IS/KW9rMHbGZbKzdDPii8GSPdd9A38pi2RyoxQyKUsxspsKUWL9E7NESlW cGiykGxwNQjoR4NaUATKTq6AVJJU6Dlzl0LZlw7O2UqbIhqw7Il2km98uhpgis62BORp 4ML7ojb5LaXrp6huNit6aOIeGdNtyjay64B9GeGCswH4jrPxmkPWZ21HBtxh03gzR4sc t8gPK4/VUAmgur+OK8iL2VUdCulTHnfRxiejXSPp19EeKPsVFwBeu29mcqfaeZUmzCP8 9gKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20210112.gappssmtp.com header.s=20210112 header.b=AYDLTANX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y30-20020a63b51e000000b0038643088817si11933847pge.517.2022.03.28.01.26.00; Mon, 28 Mar 2022 01:26:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20210112.gappssmtp.com header.s=20210112 header.b=AYDLTANX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237222AbiC0WoM (ORCPT + 99 others); Sun, 27 Mar 2022 18:44:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47616 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237161AbiC0Wna (ORCPT ); Sun, 27 Mar 2022 18:43:30 -0400 Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2799150060 for ; Sun, 27 Mar 2022 15:41:36 -0700 (PDT) Received: by mail-wr1-x434.google.com with SMTP id a1so17890065wrh.10 for ; Sun, 27 Mar 2022 15:41:36 -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=TwcBGQ6dA75HdxpcUCrD8mvsn7/MZTlw7uERAWlwKmI=; b=AYDLTANXWRzGnB+sIMp01grvGk/SH+cQkVVSn0Jme+Sp0Hdpav8Wlpi1giPYDpywOB f6+XMddOzg//0bbLhJQCLnkfAV0Ch64BSBs9oAbxmdSQ0aFw6LF+1eH4sCXHn+oCWJK9 HAUXrfbNKPFhPTj2hSbp90b+fYh/KO1rXKZin8vWp75AbJyk6dGaR6kJh+zhJpkys+jQ Pk2FkzjQ/WrzkwnRLJGntCY5EY+d50uMvlP3KirJCkkCRn482UEZBSRYDpkR0UJ46DUu laMi+vD1+SNfyKxtrkIT5iuFhSooYpFxBbnxJgCDry2m5x5p4qdMYjJqUvDmSn3XsbJm bITQ== 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=TwcBGQ6dA75HdxpcUCrD8mvsn7/MZTlw7uERAWlwKmI=; b=ACJnrtbInDeek5Bb6jWzUCpbde3RmHarOHWOTSrAfnHiteIBsTJF66YDtmYQ5CgmG5 +mEoeEHXT6drpD/me1zedq5C+lnO7QwWwQYR8p9PpK0L9kuufv0J24iAL2raAfkZpjQg XaRZHVCKVbge+F+7tnlC8HWIPzB8dxsJMMUnlqXWwS2EJqNwrmWcILN/dwCurzfLAuMb bSp5/Xxz6SNkCTTMakF1aEivL4zsO7Hd8IiAn1D30r9SvSGTzOcViZ+Z47YuyhXJJOBs qzpWhkdfEjxc66qAlflEu293Oi+0SG+QkPLIUCUNt2F42tn0/riUptuskdKDKmzumoAa cC2A== X-Gm-Message-State: AOAM5305eYPxO9NCQkxJQDlRK7Jiumo1We86E1Bts/D2BbdyoG7dAH+k KEtEnV9ydhgNO219ws0rfa3MYg== X-Received: by 2002:a5d:6daf:0:b0:204:12b6:a15 with SMTP id u15-20020a5d6daf000000b0020412b60a15mr19676354wrs.340.1648420894641; Sun, 27 Mar 2022 15:41:34 -0700 (PDT) Received: from localhost.localdomain (2a02-8440-6341-357e-3074-96af-9642-0002.rev.sfr.net. [2a02:8440:6341:357e:3074:96af:9642:2]) by smtp.gmail.com with ESMTPSA id v5-20020adfe4c5000000b001edc1e5053esm10400867wrm.82.2022.03.27.15.41.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 27 Mar 2022 15:41:34 -0700 (PDT) From: Guillaume Ranquet To: airlied@linux.ie, angelogioacchino.delregno@collabora.com, chunfeng.yun@mediatek.com, chunkuang.hu@kernel.org, ck.hu@mediatek.com, daniel@ffwll.ch, deller@gmx.de, jitao.shi@mediatek.com, kishon@ti.com, krzk+dt@kernel.org, maarten.lankhorst@linux.intel.com, matthias.bgg@gmail.com, mripard@kernel.org, p.zabel@pengutronix.de, robh+dt@kernel.org, tzimmermann@suse.de, vkoul@kernel.org Cc: devicetree@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-phy@lists.infradead.org, markyacoub@google.com Subject: [PATCH v9 21/22] drm/mediatek: change the aux retries times when receiving AUX_DEFER Date: Mon, 28 Mar 2022 00:39:26 +0200 Message-Id: <20220327223927.20848-22-granquet@baylibre.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220327223927.20848-1-granquet@baylibre.com> References: <20220327223927.20848-1-granquet@baylibre.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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 e099491cc6a4..7a197c4a7143 100644 --- a/drivers/gpu/drm/mediatek/mtk_dp.c +++ b/drivers/gpu/drm/mediatek/mtk_dp.c @@ -2016,7 +2016,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); @@ -2050,14 +2050,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, @@ -2066,7 +2073,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, -- 2.34.1