Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp1607338ybh; Sun, 8 Mar 2020 08:24:48 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvY5SiqzgmmYcprcBGZ/HAuNUVoSh8nWdbhYUuGRYnckpQUsfT1BIb1yClTMUQkSRX/Xg/3 X-Received: by 2002:a9d:6f88:: with SMTP id h8mr10084221otq.91.1583681088769; Sun, 08 Mar 2020 08:24:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583681088; cv=none; d=google.com; s=arc-20160816; b=tgJ06NoS38/cA9jjOLC8RWVYI7qDRJsy96xz7DWj+l5S8dhKLzxhOozyWXK+uo/L17 AqNHI1XbmOZyP1K/CqoqKzBa48JxMuXe+xHDTVqcmsXpCi4BPuM2Oyfgt/H40Qxx2XZV Nqkjya7vFwPtqr/Q/tRf+fxA4JQ/+s7v9qeBK8/oytvqSsodf1JZabhnXQYr/eWcvip7 NOzTkKxIPyjJZXg5Z3wWfzDSYP7SXH2+YaTpzbvI2XRzitY59smSTEwTQ4sttszlqtz1 G7qrjBsLdIM+Jkw9o19LeQs0ueFXufcImjNGBv+ufWRYruRdYH1kJF8cmxFB0pcUleIC Uimg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=aHFhdUjuE5P2/8JWyd17xjMu585T2IohMVL1mpHUSgg=; b=uLJY12wBV+6wQ/9fY9UPFmS9K0M3ylWwN5YEzh6xanlowoZzgwVIJ4bx8d4CSJMLF4 5RKtbyUiaigjIC7bYRvsR+JQ08cAXK8syRBDzX/0LMbVxj6MTdVsbsq0ytAy0jqyHzNk eR0Bq97WSvhvKziD0AqOMoK/KgKYS4E1SUrp2OguXSF4t9dWa2VEmlvePjxB5I+l57FU 5rKHimdgXHI48URtqdYNoBHeX+3BBb9TpLPOhE7l8uQunM1cqyoWH4OkIeHQ4Z7zmgPA bVoNsXXJwFW9slCIpgiinx9HD5zyZO4Muapl0PRhITnJwLjK0U1om38Q5OTsH6BOHTWm VpAQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t81si2656689oie.248.2020.03.08.08.24.04; Sun, 08 Mar 2020 08:24:48 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726339AbgCHPWw (ORCPT + 99 others); Sun, 8 Mar 2020 11:22:52 -0400 Received: from mail.manjaro.org ([176.9.38.148]:48434 "EHLO mail.manjaro.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726260AbgCHPWv (ORCPT ); Sun, 8 Mar 2020 11:22:51 -0400 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 Cc: Brian Masney , Linus Walleij , Maxime Ripard , Icenowy Zheng , Thomas Gleixner , Sam Ravnborg , Thierry Reding , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Tobias Schramm 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 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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) -- 2.24.1