From patchwork Thu Mar 5 08:12:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Mario Kleiner X-Patchwork-Id: 11421273 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 612AF138D for ; Thu, 5 Mar 2020 08:12:42 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3EEE92073D for ; Thu, 5 Mar 2020 08:12:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="VlR85AqL" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3EEE92073D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 36A556E54C; Thu, 5 Mar 2020 08:12:38 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) by gabe.freedesktop.org (Postfix) with ESMTPS id 194C06E075; Thu, 5 Mar 2020 08:12:37 +0000 (UTC) Received: by mail-wr1-x444.google.com with SMTP id r7so5830035wro.2; Thu, 05 Mar 2020 00:12:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=PyaU5DpDQf2hMa7z6eK98FBQE86N4CFhdNkjFTqNLGw=; b=VlR85AqLDkb/yKHXMO0TDN0GsLivB9+wI/hzx3yv7CfQ+B1HgMJmlx59mw3SBRohIW ueMZG8Fb4oWqlJXtT848M3Sb+t32yYrKf5FLL7VXIdUs5RPLjyJT7Z3hehV9NXu7LcfU wSyXQBUW2+sTM3Si9jB1q0adbnMM2qEHUXELdPGeFCVbyVpj+SF137rWly1bz8hweKUR M5yLerYrU5J8+DonCyygR/uGkAL9rtHwTsslRghDDKIXBCFskhi4XMbjZL9Yz+I2ZH96 r0dwJApxpAYy4YTqD1KwaN68csGSRl/pIfez0ODCsKhLdbRn2U5eJmiic76zcZ2H/QB+ ceVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=PyaU5DpDQf2hMa7z6eK98FBQE86N4CFhdNkjFTqNLGw=; b=h5Ke7hNSMrDlTDqRCE1QjEyePnkkQ8HG28yLn5hE8VbaqBvBUum9rS7kQTqMnTH496 LkDVccn8qmpArWD0f4Fzqj4dBadJxMVykU17jUVnu3fCAh9P6LcNNZR4lIruiSpNRQx1 5AZy/sDpgGHwMuFP41gjY541+VVaPltMCnZbBXH6ZsGechm4YsygUP+dh62OY/PYR/Gg w1lsuuiHF7tIH7Bp3tKPSGzerH6isuFo1s6RRWp7ntRa61D5cxx+31YW8+lhnyR4ExVQ w6hqCYqY0AUCOxoRRu7va+30E5U8XnXNbn/8nCeJsU05OIG8lvPnTKvrWZDLmEywSxfU 1Plg== X-Gm-Message-State: ANhLgQ3f/AQhbtLPxBbiWkG8bTuuuMGSgeMXN83comPkQRGlpqBNxxHb EjAkyzx9QMujEh/oP7hIes70/McR X-Google-Smtp-Source: ADFU+vt+UhwY9QZQtRodUTipUMS5YAcehMS0nAAM7sb3iXIaMyZT7CZe4ADNOkJDvXVqLp44QoFWBA== X-Received: by 2002:a5d:4b51:: with SMTP id w17mr8433554wrs.231.1583395955457; Thu, 05 Mar 2020 00:12:35 -0800 (PST) Received: from groovy.localdomain (dynamic-2a01-0c23-7c4d-d900-a874-69cf-2478-7e88.c23.pool.telefonica.de. [2a01:c23:7c4d:d900:a874:69cf:2478:7e88]) by smtp.gmail.com with ESMTPSA id y8sm8147589wmj.22.2020.03.05.00.12.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Mar 2020 00:12:34 -0800 (PST) From: Mario Kleiner To: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org Subject: [PATCH] drm/i915/dp: Add dpcd link_rate quirk for Apple 15" MBP 2017 (v2) Date: Thu, 5 Mar 2020 09:12:19 +0100 Message-Id: <20200305081219.2900-1-mario.kleiner.de@gmail.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jani Nikula Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" This fixes a problem found on the MacBookPro 2017 Retina panel. The panel reports 10 bpc color depth in its EDID, and the firmware chooses link settings at boot which support enough bandwidth for 10 bpc (324000 kbit/sec = multiplier 0xc), but the DP_MAX_LINK_RATE dpcd register only reports 2.7 Gbps (multiplier value 0xa) as possible, in direct contradiction of what the firmware successfully set up. This restricts the panel to 8 bpc, not providing the full color depth of the panel. This patch adds a quirk specific to the MBP 2017 15" Retina panel to add the additiional 324000 kbps link rate during edp setup. Link to previous discussion of a different attempted fix with Ville and Jani: https://patchwork.kernel.org/patch/11325935/ v2: Follow Jani's proposal of defining quirk_rates[] instead of just appending 324000. This for better clarity. Signed-off-by: Mario Kleiner Tested-by: Mario Kleiner Cc: Ville Syrjälä Cc: Jani Nikula Reviewed-by: Jani Nikula --- drivers/gpu/drm/drm_dp_helper.c | 2 ++ drivers/gpu/drm/i915/display/intel_dp.c | 11 +++++++++++ include/drm/drm_dp_helper.h | 7 +++++++ 3 files changed, 20 insertions(+) diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c index 5a103e9b3c86..36a371c016cb 100644 --- a/drivers/gpu/drm/drm_dp_helper.c +++ b/drivers/gpu/drm/drm_dp_helper.c @@ -1179,6 +1179,8 @@ static const struct dpcd_quirk dpcd_quirk_list[] = { { OUI(0x00, 0x00, 0x00), DEVICE_ID('C', 'H', '7', '5', '1', '1'), false, BIT(DP_DPCD_QUIRK_NO_SINK_COUNT) }, /* Synaptics DP1.4 MST hubs can support DSC without virtual DPCD */ { OUI(0x90, 0xCC, 0x24), DEVICE_ID_ANY, true, BIT(DP_DPCD_QUIRK_DSC_WITHOUT_VIRTUAL_DPCD) }, + /* Apple MacBookPro 2017 15 inch eDP Retina panel reports too low DP_MAX_LINK_RATE */ + { OUI(0x00, 0x10, 0xfa), DEVICE_ID(101, 68, 21, 101, 98, 97), false, BIT(DP_DPCD_QUIRK_CAN_DO_MAX_LINK_RATE_3_24_GBPS) }, }; #undef OUI diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c index 4074d83b1a5f..c0d2c70b04fb 100644 --- a/drivers/gpu/drm/i915/display/intel_dp.c +++ b/drivers/gpu/drm/i915/display/intel_dp.c @@ -169,6 +169,17 @@ static void intel_dp_set_sink_rates(struct intel_dp *intel_dp) }; int i, max_rate; + if (drm_dp_has_quirk(&intel_dp->desc, + DP_DPCD_QUIRK_CAN_DO_MAX_LINK_RATE_3_24_GBPS)) { + /* Needed, e.g., for Apple MBP 2017, 15 inch eDP Retina panel */ + static const int quirk_rates[] = { 162000, 270000, 324000 }; + + memcpy(intel_dp->sink_rates, quirk_rates, sizeof(quirk_rates)); + intel_dp->num_sink_rates = ARRAY_SIZE(quirk_rates); + + return; + } + max_rate = drm_dp_bw_code_to_link_rate(intel_dp->dpcd[DP_MAX_LINK_RATE]); for (i = 0; i < ARRAY_SIZE(dp_rates); i++) { diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h index 262faf9e5e94..4b86a1f2a559 100644 --- a/include/drm/drm_dp_helper.h +++ b/include/drm/drm_dp_helper.h @@ -1532,6 +1532,13 @@ enum drm_dp_quirk { * The DSC caps can be read from the physical aux instead. */ DP_DPCD_QUIRK_DSC_WITHOUT_VIRTUAL_DPCD, + /** + * @DP_DPCD_QUIRK_CAN_DO_MAX_LINK_RATE_3_24_GBPS: + * + * The device supports a link rate of 3.24 Gbps (multiplier 0xc) despite + * the DP_MAX_LINK_RATE register reporting a lower max multiplier. + */ + DP_DPCD_QUIRK_CAN_DO_MAX_LINK_RATE_3_24_GBPS, }; /**