From patchwork Tue Jan 5 09:33:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Koba Ko X-Patchwork-Id: 1422394 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4D96kv1xlyz9sVw; Tue, 5 Jan 2021 20:33:59 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1kwiiy-0007cV-GF; Tue, 05 Jan 2021 09:33:56 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1kwiiv-0007c3-NS for kernel-team@lists.ubuntu.com; Tue, 05 Jan 2021 09:33:53 +0000 Received: from mail-pj1-f69.google.com ([209.85.216.69]) by youngberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1kwiiv-0007c0-AZ for kernel-team@lists.ubuntu.com; Tue, 05 Jan 2021 09:33:53 +0000 Received: by mail-pj1-f69.google.com with SMTP id kb15so1279243pjb.4 for ; Tue, 05 Jan 2021 01:33:53 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=KGozC8yjAPfe+RFZDaAQFRYAUa9IRb3GxGpzZnkAhtI=; b=cKLx2qA0InusEcd93p0SEyodIgsLBspPDIXU1IQUOBgy2K1FIJqxTsiTC+iXi/oVul qEfgksMedPpgJTzvNZn9PNhDzQpejSMDQfaY+NVk056sBxTddNJP/1Obx2d+nU+EVACX k77xmxnVj8U0ERKKHfVfISb2R1pEAa6IByvQSrjj4kSkxjc66BcoVYz+YegosX012fQw 8uF9vJDp3hGF+7FePRSaacJTtUKEDccyu0PE828/ls9fs/3s+TzfiyidgVqGBBq0CMMn zesivaPoZ1ymtaX64E5CPNEP0s+mBxk5Iu0nVe+KBOSksTfooUD1cX13x6aINZL+xqsN l8eA== X-Gm-Message-State: AOAM5303fJ2EkeTlY2u0URDBn1jmA1q6yFIOyNrOoLL0YIz8h7kSi/UZ B8a3vub3Zd3xc6HKEp4sdNSLx3isHbfGvoJY/Y1+7hIKF7qbX85VCdWtscnjVYI0fksYqDNKhJV a1/AfDJ/lemIopPBPXreC+jx2Pcmnsy7QUG5DO2Y95Q== X-Received: by 2002:a62:7b86:0:b029:19d:f996:44f3 with SMTP id w128-20020a627b860000b029019df99644f3mr68723785pfc.65.1609839231816; Tue, 05 Jan 2021 01:33:51 -0800 (PST) X-Google-Smtp-Source: ABdhPJzFK1CdaUo3KxrYJrBS3D9dv5JyngJIfL0N8amOwYrAuRPCWKLPxNA6R3wib/3ubDia70lW3Q== X-Received: by 2002:a62:7b86:0:b029:19d:f996:44f3 with SMTP id w128-20020a627b860000b029019df99644f3mr68723757pfc.65.1609839231381; Tue, 05 Jan 2021 01:33:51 -0800 (PST) Received: from canonical.com (61-220-137-37.HINET-IP.hinet.net. [61.220.137.37]) by smtp.gmail.com with ESMTPSA id 73sm51477489pga.26.2021.01.05.01.33.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Jan 2021 01:33:50 -0800 (PST) From: Koba Ko To: kernel-team@lists.ubuntu.com Subject: [PATCH 1/1][Unstable/OEM-5.10] UBUNTU: SAUCE: drm/i915/dp: Prevent setting LTTPR mode if no LTTPR is detected Date: Tue, 5 Jan 2021 17:33:47 +0800 Message-Id: <20210105093347.565527-2-koba.ko@canonical.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210105093347.565527-1-koba.ko@canonical.com> References: <20210105093347.565527-1-koba.ko@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Imre Deak BugLink: https://bugs.launchpad.net/bugs/1910211 Signed-off-by: Imre Deak Reference: https://gitlab.freedesktop.org/drm/intel/-/issues/2801#note_740352 Signed-off-by: Koba Ko --- .../drm/i915/display/intel_dp_link_training.c | 36 ++++++++----------- 1 file changed, 15 insertions(+), 21 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_dp_link_training.c b/drivers/gpu/drm/i915/display/intel_dp_link_training.c index 91d3979902d0..db4862760011 100644 --- a/drivers/gpu/drm/i915/display/intel_dp_link_training.c +++ b/drivers/gpu/drm/i915/display/intel_dp_link_training.c @@ -34,18 +34,6 @@ intel_dp_dump_link_status(const u8 link_status[DP_LINK_STATUS_SIZE]) link_status[3], link_status[4], link_status[5]); } -static int intel_dp_lttpr_count(struct intel_dp *intel_dp) -{ - int count = drm_dp_lttpr_count(intel_dp->lttpr_common_caps); - - /* - * Pretend no LTTPRs in case of LTTPR detection error, or - * if too many (>8) LTTPRs are detected. This translates to link - * training in transparent mode. - */ - return count <= 0 ? 0 : count; -} - static void intel_dp_reset_lttpr_count(struct intel_dp *intel_dp) { intel_dp->lttpr_common_caps[DP_PHY_REPEATER_CNT - @@ -142,6 +130,17 @@ int intel_dp_lttpr_init(struct intel_dp *intel_dp) return 0; ret = intel_dp_read_lttpr_common_caps(intel_dp); + if (!ret) + return 0; + + lttpr_count = drm_dp_lttpr_count(intel_dp->lttpr_common_caps); + /* + * Prevent setting LTTPR transparent mode explicitly if no LTTPRs are + * detected as this breaks link training at least on the Dell WD19TB + * dock. + */ + if (lttpr_count == 0) + return 0; /* * See DP Standard v2.0 3.6.6.1. about the explicit disabling of @@ -150,17 +149,12 @@ int intel_dp_lttpr_init(struct intel_dp *intel_dp) */ intel_dp_set_lttpr_transparent_mode(intel_dp, true); - if (!ret) - return 0; - - lttpr_count = intel_dp_lttpr_count(intel_dp); - /* * In case of unsupported number of LTTPRs or failing to switch to * non-transparent mode fall-back to transparent link training mode, * still taking into account any LTTPR common lane- rate/count limits. */ - if (lttpr_count == 0) + if (lttpr_count < 0) return 0; if (!intel_dp_set_lttpr_transparent_mode(intel_dp, false)) { @@ -222,11 +216,11 @@ intel_dp_phy_is_downstream_of_source(struct intel_dp *intel_dp, enum drm_dp_phy dp_phy) { struct drm_i915_private *i915 = dp_to_i915(intel_dp); - int lttpr_count = intel_dp_lttpr_count(intel_dp); + int lttpr_count = drm_dp_lttpr_count(intel_dp->lttpr_common_caps); - drm_WARN_ON_ONCE(&i915->drm, lttpr_count == 0 && dp_phy != DP_PHY_DPRX); + drm_WARN_ON_ONCE(&i915->drm, lttpr_count <= 0 && dp_phy != DP_PHY_DPRX); - return lttpr_count == 0 || dp_phy == DP_PHY_LTTPR(lttpr_count - 1); + return lttpr_count <= 0 || dp_phy == DP_PHY_LTTPR(lttpr_count - 1); } static u8 intel_dp_phy_voltage_max(struct intel_dp *intel_dp,