Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp4254447imm; Fri, 18 May 2018 01:54:14 -0700 (PDT) X-Google-Smtp-Source: AB8JxZq26fbm99yW4gehLWumPcm9q5ifrbRAf98Fq8wmZ6aWejQimWVlTSmWY29jD4Yn4ynu24fQ X-Received: by 2002:a17:902:5948:: with SMTP id e8-v6mr8683573plj.121.1526633654703; Fri, 18 May 2018 01:54:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526633654; cv=none; d=google.com; s=arc-20160816; b=EMZWh7y4O2POqCMkq5yFntWpLLuZiqSQCvijzbpj4TaVwqDhuFR94ffjOniIiyDctX 5UeyDvUXH0ypirQAsiPtnRNvyVyr6Cn4sOk0SPFBXvA7nNEG0WIVAavokWZJzFquOKXt pc7yQ2n4k51G0wmJbfhARTjXfEQN7bjboYoA/0m9IVYGLlY0xKnJwkZdTvVV/KfTrkf1 i52QLdiQCF8KzwgZ/KQYi9tyKpCMbntYBqeYzeKklkfi7ba6rjKefglTtQI65z4IOE/b dHk/R8wB+EWl5p1PS0Cq2PHpbONM1BEq8jQ8cCGJ/5+jEXGUIRrnjyWbjjV/ooAXEuel 0s0A== 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 :arc-authentication-results; bh=xiXCtipsiPRUEO+u4IUSq0u7viPN42K7Dhn//eFMFiQ=; b=xs0920t6ebBXBHN6ysIGTj1tJmi04e5DW/QcUMgh0aTmD5bi4mHtiEmh+oYpOec1pO qVy93k0Qt3qhEaTnAyweaa9Ngkh+XDuIHX/UASKijxtsddj2WtaE0W0vBeXL5SdZo+w8 K0C/GVx8vbesuzI4e17PGdL8b+GgyHlSMlssvRknz00hx8FtEEsfjHqNCKEuB3bj2ZYW MhKrzf6eVR3GGJ0D1IHYMOsmdLAbNPHpSblXDb/B6ckGUa1LVmYw2w93SfQwA8C5+PNw jJXnAZMiHZhXpkXmH4TWG92RYKVX0JhIFh0C41x62onp6GuIG/IoiyTr7diCQ/ZKTgmn 3xrw== 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 s4-v6si2029285pgv.47.2018.05.18.01.54.00; Fri, 18 May 2018 01:54:14 -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 S1753329AbeERIwk (ORCPT + 99 others); Fri, 18 May 2018 04:52:40 -0400 Received: from gloria.sntech.de ([95.129.55.99]:59344 "EHLO gloria.sntech.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752955AbeERIwf (ORCPT ); Fri, 18 May 2018 04:52:35 -0400 Received: from p5b127e9f.dip0.t-ipconnect.de ([91.18.126.159] helo=phil.localnet) by gloria.sntech.de with esmtpsa (TLS1.1:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1fJb7a-0001XU-NU; Fri, 18 May 2018 10:52:18 +0200 From: Heiko Stuebner To: Brian Norris Cc: hl , Sean Paul , devicetree@vger.kernel.org, David Airlie , Enric Balletbo Serra , Doug Anderson , Jani Nikula , Linux Kernel , "open list:ARM/Rockchip SoC..." , Rob Herring , dri-devel@lists.freedesktop.org, Chris Zhong , Daniel Vetter , linux-arm-kernel@lists.infradead.org, Kishon Vijay Abraham I Subject: Re: [PATCH v5 4/4] drm/rockchip: support dp training outside dp firmware Date: Fri, 18 May 2018 10:52:17 +0200 Message-ID: <11928313.3EhRqhFFHB@phil> In-Reply-To: References: <1526548680-2552-1-git-send-email-hl@rock-chips.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Am Freitag, 18. Mai 2018, 03:45:46 CEST schrieb Brian Norris: > On Thu, May 17, 2018 at 6:41 PM, hl wrote: > > On Thursday, May 17, 2018 09:51 PM, Sean Paul wrote: > >> On Thu, May 17, 2018 at 05:18:00PM +0800, Lin Huang wrote: > >>> DP firmware uses fixed phy config values to do training, but some > >>> boards need to adjust these values to fit for their unique hardware > >>> design. So get phy config values from dts and use software link training > >>> instead of relying on firmware, if software training fail, keep firmware > >>> training as a fallback if sw training fails. > >>> > >>> Signed-off-by: Chris Zhong > >>> Signed-off-by: Lin Huang > >>> --- > >>> Changes in v2: > >>> - update patch following Enric suggest > >>> Changes in v3: > >>> - use variable fw_training instead sw_training_success > >>> - base on DP SPCE, if training fail use lower link rate to retry training > >>> Changes in v4: > >>> - improve cdn_dp_get_lower_link_rate() and cdn_dp_software_train_link() follow Sean suggest > >>> Changes in v5: > >>> - fix some whitespcae issue > >>> > >>> drivers/gpu/drm/rockchip/Makefile | 3 +- > >>> drivers/gpu/drm/rockchip/cdn-dp-core.c | 24 +- > >>> drivers/gpu/drm/rockchip/cdn-dp-core.h | 2 + > >>> drivers/gpu/drm/rockchip/cdn-dp-link-training.c | 420 ++++++++++++++++++++++++ > >>> drivers/gpu/drm/rockchip/cdn-dp-reg.c | 31 +- > >>> drivers/gpu/drm/rockchip/cdn-dp-reg.h | 38 ++- > >>> 6 files changed, 505 insertions(+), 13 deletions(-) > >>> create mode 100644 drivers/gpu/drm/rockchip/cdn-dp-link-training.c > >>> > ... > >>> diff --git a/drivers/gpu/drm/rockchip/cdn-dp-link-training.c b/drivers/gpu/drm/rockchip/cdn-dp-link-training.c > >>> new file mode 100644 > >>> index 0000000..73c3290 > >>> --- /dev/null > >>> +++ b/drivers/gpu/drm/rockchip/cdn-dp-link-training.c > >>> @@ -0,0 +1,420 @@ > >>> +// SPDX-License-Identifier: GPL-2.0 > >>> +/* > >>> + * Copyright (C) Fuzhou Rockchip Electronics Co.Ltd > >>> + * Author: Chris Zhong > >>> + */ > >>> + > >>> +#include > >>> +#include > >>> +#include > >>> +#include > >>> + > >>> +#include "cdn-dp-core.h" > >>> +#include "cdn-dp-reg.h" > >>> + > >>> +static void cdn_dp_set_signal_levels(struct cdn_dp_device *dp) > >>> +{ > >>> + struct cdn_dp_port *port = dp->port[dp->active_port]; > >>> + struct rockchip_typec_phy *tcphy = phy_get_drvdata(port->phy); > >> > >> You ignored Brian's comment on the previous patch: > >> This is still antithetical to the PHY framework; you're assuming that > >> this is a particular type of PHY here. > >> > >> FWIW, the mediatek drm driver also assumes a certain PHY type. A quick grep of > >> drivers/ shows that the only other non-phy/ driver using this function > >> (pinctrl-tegra-xusb.c) also casts it. > >> > >> Sean > > > > Thanks Sean, except phy framework have new API to handle it, i have not > > idea how to do it in a better way. > > Well, if Mediatek can do it for their MIPI and HDMI, then maybe we just do it... I'd think so too. This is in Rockchip-specific code so it will always be possible to easily get the soc-type and thus phy-type, if that combination really changes down the road. Heiko