Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp2292784ybv; Mon, 24 Feb 2020 02:45:17 -0800 (PST) X-Google-Smtp-Source: APXvYqwUDyOfpDSYfLWiMx/QUhnMJH1WBIORM16aGwRaMPflmY8ImuNKDr1rJFdCnhrRAeCYK5LH X-Received: by 2002:aca:1a05:: with SMTP id a5mr11945680oia.97.1582541116922; Mon, 24 Feb 2020 02:45:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582541116; cv=none; d=google.com; s=arc-20160816; b=XNSGFakKyqC28Wc6qH2Z3OSbqwxsjr78Lua0jBxESqlEig7n/zDuYvy//RCj6A+KMX W6bPPKPBGaC636Uyny92CXT3g8bl1zG2PRvLRew+XZzR+C3dQIHiIL2U1ODoE0/5Ca8S 8/P6Qg2BRtwlQZ1JWa1WTUjAx3iKGJkIGP48UNxGMiZgjuFEpiUPmPsON5/Cd1dHRtWC bf0WzQ1G7dXrMRZKuqEXguGzFTq4kd3Mo7jU/UHIdGIF9ScJ9/tzlFxVbCHNTdCNOaD6 +VdlinhL790Kqo0YnMdKt9/2H2GoYKGtiC8zZe02A22gpTJVF9V6W+uIwLpBDsLz7nI8 YKsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=Le31blbkBtGA7yU1lKSyaJ+VhuVpNDHE2zUU4yVVKgI=; b=H7QW4Dd/FFvl1TdEwBCNmnAPGK0XI8+K4WkG3xJ9LCl4pm/M7KbYwZhrPtEkvq8aSc d9cZ1FqMI9T/xKNwPBhPINbZ/nOZFgJC6KlVhI5mNMnbjdGGpuwEYesznv/z4m5VONTE GUhVeo68Ld5m5AQg663B0e6v2xGD8Jc6ETHIInPZf2Cbelu4BC+RGb44xw7VRz4pAycY 1TaL85w6c7OreVBW+tM9A6WzstoVjkpq8z7F3yMZfZZ7NXCHpTRhyGe9o/1N/OXk6uAF ytvFFoWO7q780WZvDNxh5L0XpcEJXUTYCwiuvpjRFnsKaqT96QseO7L4cfh8+YUwi2zl B0jQ== 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 b15si8426575ots.99.2020.02.24.02.45.05; Mon, 24 Feb 2020 02:45:16 -0800 (PST) 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 S1727450AbgBXKo5 (ORCPT + 99 others); Mon, 24 Feb 2020 05:44:57 -0500 Received: from verein.lst.de ([213.95.11.211]:37269 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726509AbgBXKo5 (ORCPT ); Mon, 24 Feb 2020 05:44:57 -0500 Received: by verein.lst.de (Postfix, from userid 2005) id 18C1568AFE; Mon, 24 Feb 2020 11:44:53 +0100 (CET) Date: Mon, 24 Feb 2020 11:44:52 +0100 From: Torsten Duwe To: Icenowy Zheng , Thomas Zimmermann Cc: Andrzej Hajda , Neil Armstrong , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maxime Ripard , Vasily Khoruzhick , Sam Ravnborg , Linus Walleij , Stephen Rothwell , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] drm/bridge: analogix-anx6345: fix set of link bandwidth Message-ID: <20200224104452.GA31184@lst.de> References: <20200221165127.813325-1-icenowy@aosc.io> <20200221171328.GC6928@lst.de> <1E7BDB0F-639B-42BB-A4B4-A4C8CF94EBE0@aosc.io> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1E7BDB0F-639B-42BB-A4B4-A4C8CF94EBE0@aosc.io> User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Feb 22, 2020 at 10:43:02AM +0800, Icenowy Zheng wrote: > > > 于 2020年2月22日 GMT+08:00 上午1:13:28, Torsten Duwe 写到: > >On Sat, Feb 22, 2020 at 12:51:27AM +0800, Icenowy Zheng wrote: > >> Current code tries to store the link rate (in bps, which is a big > >> number) in a u8, which surely overflow. Then it's converted back to > >> bandwidth code (which is thus 0) and written to the chip. > >> > >> The code sometimes works because the chip will automatically fallback > >to > >> the lowest possible DP link rate (1.62Gbps) when get the invalid > >value. > >> However, on the eDP panel of Olimex TERES-I, which wants 2.7Gbps > >link, > >> it failed. > >> > >> As we had already read the link bandwidth as bandwidth code in > >earlier > >> code (to check whether it is supported), use it when setting > >bandwidth, > >> instead of converting it to link rate and then converting back. > >> > >> Fixes: e1cff82c1097 ("drm/bridge: fix anx6345 compilation for v5.5") > >> Signed-off-by: Icenowy Zheng > >> --- > >> drivers/gpu/drm/bridge/analogix/analogix-anx6345.c | 3 +-- > >> 1 file changed, 1 insertion(+), 2 deletions(-) > >> > >> diff --git a/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c > >b/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c > >> index 56f55c53abfd..2dfa2fd2a23b 100644 > >> --- a/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c > >> +++ b/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c > >> @@ -210,8 +210,7 @@ static int anx6345_dp_link_training(struct > >anx6345 *anx6345) > >> if (err) > >> return err; > >> > >> - dpcd[0] = drm_dp_max_link_rate(anx6345->dpcd); > >> - dpcd[0] = drm_dp_link_rate_to_bw_code(dpcd[0]); > >> + dpcd[0] = dp_bw; > > > >Why do you make this assignment and not use dp_bw directly in the call? > > Because the dpcd array is then written as a continous array > back to DPCD. But the current code never changes this value? Anyway, as this might change in the future, I support your version; I want to see this fixed. Reviewed-by: Torsten Duwe Fixes: e1cff82c1097 ("drm/bridge: fix anx6345 compilation for v5.5") Cc: Maxime Ripard Cc: Torsten Duwe Cc: Sam Ravnborg Cc: Linus Walleij Cc: Thomas Zimmermann Cc: Icenowy Zheng Cc: Stephen Rothwell > > > >> err = regmap_write(anx6345->map[I2C_IDX_DPTX], > >> SP_DP_MAIN_LINK_BW_SET_REG, dpcd[0]); > > ^^^^^^ > >> if (err) > >> -- > >> 2.24.1 > > > >BTW, my version is only a bit more verbose: > > > >https://patchwork.freedesktop.org/patch/354344/ > > > > Torsten > > -- > 使用 K-9 Mail 发送自我的Android设备。