Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp3953723imm; Thu, 17 May 2018 18:46:24 -0700 (PDT) X-Google-Smtp-Source: AB8JxZo0U5YegiwGUpbgpKQM7u5uetXOaP0vKzc2STMirTlXPruy+VEtv8AitoYWV6ED05FZUfHS X-Received: by 2002:a17:902:b68f:: with SMTP id c15-v6mr7448556pls.201.1526607984473; Thu, 17 May 2018 18:46:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526607984; cv=none; d=google.com; s=arc-20160816; b=aDuhijT10X/GApk4NXhQ0H58ONeZWhr9w6fqYDXP+AVzzXhwa4z38Akm4MOO/a7Zn4 eFP5yuTv18SIYN7eM5OJZhzFW6LWq3MW+K2inLAFoO8VEN6ijd80czdH+sY74zZNVguw HXnfCZWTf1jv9g0cdFCV7vc9oDZ5LLuhIFJIwKVvXjNrv64mk9wzetvEXZNEEKN6xTB1 zKul4pyU8CTAh+65oXm7MjzzXV7mTfsRUb9PZ8Gs8p6W5bpZ0THjy7UXTQkpoiuiWkCn pF+fy4bAJFkb6vbZxpOpvenQiRHoq/Z8YuzFvgzOTgYqWrDfjKfkOHiP+8DeVgTJ6gK8 S8Qg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=qfaKp75E/tijDiIgnzeNcyebZ017EAe6c/fLaObjx04=; b=xr4sxjoHvSbf6vJeumHIMoJ+6l3LT1ZhdEw/IzxNklhPJNeuGoB6fMLYA63PHU+IkG dcUpnERL1SAtkpk5ZJv3PxMdCL2EWdz3Xrnb/27Jzje5zv9ID28p88QlzW6plfM8oE3c Prv6B37BD8PTzJK6Re05coLNMvmx0FQxtKmxijN8FrwREHeJpoXElDEE+bE9jkvKWes1 ikkV6bigmPfrz3ScCduU8IBCGEXUp0Xwx7I1cIqu4KBbCP0WgTGl1bmIovbKC8X4qLBt 5bChMRk8qrzSdWEMCCkqCmy94lrWhRehqXMX/xnVvxuvV6OojzG8PJRkSXePvuunq52Q e8Gg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=boCLN20B; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l192-v6si5190980pge.365.2018.05.17.18.46.10; Thu, 17 May 2018 18:46:24 -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; dkim=pass header.i=@chromium.org header.s=google header.b=boCLN20B; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752129AbeERBpy (ORCPT + 99 others); Thu, 17 May 2018 21:45:54 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:33610 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752073AbeERBpv (ORCPT ); Thu, 17 May 2018 21:45:51 -0400 Received: by mail-wm0-f67.google.com with SMTP id x12-v6so1590379wmc.0 for ; Thu, 17 May 2018 18:45:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=qfaKp75E/tijDiIgnzeNcyebZ017EAe6c/fLaObjx04=; b=boCLN20B3LA3I1W+NCy0XxytXk3iOSkRys6upXWuNCRfOWUlxNcJzAJ3kP3EHyN0DU SL8k0mGIgWOPYy5DgBMlQ23I+1lfBcMMlKZKBj/xaqJwK1RCc8ZSSDBsaEzYy4HBx9YK t/l3RrTqmoGNXnhwsrUSIpZ4ggnuKynzhX13E= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=qfaKp75E/tijDiIgnzeNcyebZ017EAe6c/fLaObjx04=; b=qN0dRgjibLEeDT523wQlUDFA7y0J9cGJUK9oS8oNMnSrtdTwgR9kxqI6vl27QrEHHv 20yFl70bcfEY1FVcmg+3S4a/tl1VCDSaYAm/M0PoOTAo45U1ydB2VTWUgy/3kKjdaGCu yXZdcJCD/fSj8JqDY51zr44l7NR7di7om8gfaO0kchbqb2fbVPzPO2LFicaP+h9IHY5L kzEcDVcVoM9frhLQ3omuVTSbdy6dx9Br5RlRTiyVIUrfsA0Govf7f2HMg4Qtk+jH+yRe kOJeL7U08YReMaAyVwGjrU94BLpYxikGpkIXCvU/54e4dNCbOYvF8eS0GXBN8A5GPKrA GFcQ== X-Gm-Message-State: ALKqPwfM+2AmYXoHPwKALSaFcSrcudSQH4YRo2ejactEy+BSjE/1ps/o 7DwfoKg9pwpk1wAlIVQx64N6Wl3OGrg= X-Received: by 2002:a50:93c4:: with SMTP id o62-v6mr9513471eda.169.1526607950373; Thu, 17 May 2018 18:45:50 -0700 (PDT) Received: from mail-wm0-f42.google.com (mail-wm0-f42.google.com. [74.125.82.42]) by smtp.gmail.com with ESMTPSA id f16-v6sm3049634edr.32.2018.05.17.18.45.47 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 17 May 2018 18:45:48 -0700 (PDT) Received: by mail-wm0-f42.google.com with SMTP id w194-v6so11465421wmf.2 for ; Thu, 17 May 2018 18:45:47 -0700 (PDT) X-Received: by 2002:aa7:d489:: with SMTP id b9-v6mr9638840edr.121.1526607947149; Thu, 17 May 2018 18:45:47 -0700 (PDT) MIME-Version: 1.0 Received: by 10.80.204.2 with HTTP; Thu, 17 May 2018 18:45:46 -0700 (PDT) In-Reply-To: References: <1526548680-2552-1-git-send-email-hl@rock-chips.com> <1526548680-2552-4-git-send-email-hl@rock-chips.com> <20180517135136.GD3373@art_vandelay> From: Brian Norris Date: Thu, 17 May 2018 18:45:46 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v5 4/4] drm/rockchip: support dp training outside dp firmware To: hl Cc: Sean Paul , devicetree@vger.kernel.org, Heiko Stuebner , 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 Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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... Brian