From patchwork Sun Mar 8 15:22:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tobias Schramm X-Patchwork-Id: 11425715 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 D0C28138D for ; Sun, 8 Mar 2020 15:40:10 +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 AEB87206D7 for ; Sun, 8 Mar 2020 15:40:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AEB87206D7 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=manjaro.org 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 CD0976E2A5; Sun, 8 Mar 2020 15:40:05 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org X-Greylist: delayed 1033 seconds by postgrey-1.36 at gabe; Sun, 08 Mar 2020 15:40:04 UTC Received: from mail.manjaro.org (mail.manjaro.org [176.9.38.148]) by gabe.freedesktop.org (Postfix) with ESMTPS id B5F0D6E2A5 for ; Sun, 8 Mar 2020 15:40:04 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by mail.manjaro.org (Postfix) with ESMTP id B4E8437A1C4A; Sun, 8 Mar 2020 16:22:50 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at manjaro.org Received: from mail.manjaro.org ([127.0.0.1]) by localhost (manjaro.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id MQOBT0Tcdx0E; Sun, 8 Mar 2020 16:22:47 +0100 (CET) From: Tobias Schramm To: Andrzej Hajda , Neil Armstrong , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , David Airlie , Daniel Vetter Subject: [PATCH v2 1/1] drm/bridge: anx78xx: fix calculation of dp link rate Date: Sun, 8 Mar 2020 16:22:38 +0100 Message-Id: <20200308152238.1294229-2-t.schramm@manjaro.org> In-Reply-To: <20200308152238.1294229-1-t.schramm@manjaro.org> References: <20200308152238.1294229-1-t.schramm@manjaro.org> 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: Thierry Reding , Tobias Schramm , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Maxime Ripard , Thomas Gleixner , Brian Masney , Sam Ravnborg , Icenowy Zheng Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" commit ff1e8fb68ea0 ("drm/bridge: analogix-anx78xx: Avoid drm_dp_link helpers") changed the link training logic to remove use of drm_dp_link helpers. However the new logic stores the maximum link rate in a u8, overflowing it. This commit changes the logic to store the bw code directly, avoiding any overflows. Fixes: ff1e8fb68ea0 ("drm/bridge: analogix-anx78xx: Avoid drm_dp_link helpers") Signed-off-by: Tobias Schramm --- drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c b/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c index 41867be03751..0c6b049b5753 100644 --- a/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c +++ b/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c @@ -722,8 +722,7 @@ static int anx78xx_dp_link_training(struct anx78xx *anx78xx) if (err) return err; - dpcd[0] = drm_dp_max_link_rate(anx78xx->dpcd); - dpcd[0] = drm_dp_link_rate_to_bw_code(dpcd[0]); + dpcd[0] = anx78xx->dpcd[DP_MAX_LINK_RATE]; err = regmap_write(anx78xx->map[I2C_IDX_TX_P0], SP_DP_MAIN_LINK_BW_SET_REG, dpcd[0]); if (err)