From patchwork Mon Sep 2 11:31:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 11126423 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 6F49E1398 for ; Mon, 2 Sep 2019 11:31:32 +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 5780E2173E for ; Mon, 2 Sep 2019 11:31:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5780E2173E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com 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 B0DC6899F2; Mon, 2 Sep 2019 11:31:28 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) by gabe.freedesktop.org (Postfix) with ESMTPS id A45BB899F2 for ; Mon, 2 Sep 2019 11:31:27 +0000 (UTC) Received: by mail-wm1-x344.google.com with SMTP id k2so12748069wmj.4 for ; Mon, 02 Sep 2019 04:31:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=k+QFY1+jfK4rTxgiosrQvn5bsqqg7EEV7J+Kkr69FCU=; b=ZmHT8TFM25ncYnkt946Av33jJAp4v5UaLgH0JUoKYJfKKRA5mke3Ec1CNoK7u/wqnY 4ZevGwBlKB9vt09guCMXsQlv05V9BETSTiGNOg9Fh6JeJ3+MgGYOi2riyqO71d7/KJ// A7PWx6UrnH18WcttFIOCfN8800hqcLinZG+QPuq+wQPrv+dAn05UP9CA5beMuMB5mfv0 Qip8dEbZqhsZp4x0DXqToz1LgORSKFsmn7gah188Pry9Hul2EVxo51cv4AsKi/DBrGw8 LAppZMqjHwFQd6KQypaE608FvRx/VoergHBuljF1wgkiuPlJ7Srn6tCHrnXjskz1eiC8 3Zhg== X-Gm-Message-State: APjAAAX+1OQMm1TSwgBc2psAGyVTZzZf3D4nZeLS0JoKMJ2H/g/CKghW IrbGpj7h9Ir+/eqLQN/YJDq5X6fT X-Google-Smtp-Source: APXvYqy76etKdLEZDSV/who0klckKUV6h3+Bl426GbVXNuefS+SurbVW1j2pelFqgi2rDs3HJHC4xg== X-Received: by 2002:a05:600c:21d9:: with SMTP id x25mr28957096wmj.130.1567423885698; Mon, 02 Sep 2019 04:31:25 -0700 (PDT) Received: from localhost (pD9E51890.dip0.t-ipconnect.de. [217.229.24.144]) by smtp.gmail.com with ESMTPSA id z189sm4869434wmc.25.2019.09.02.04.31.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Sep 2019 04:31:24 -0700 (PDT) From: Thierry Reding To: dri-devel@lists.freedesktop.org Subject: [PATCH v2 01/21] drm/dp: Sort includes alphabetically Date: Mon, 2 Sep 2019 13:31:01 +0200 Message-Id: <20190902113121.31323-2-thierry.reding@gmail.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190902113121.31323-1-thierry.reding@gmail.com> References: <20190902113121.31323-1-thierry.reding@gmail.com> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=k+QFY1+jfK4rTxgiosrQvn5bsqqg7EEV7J+Kkr69FCU=; b=bXkFjv4wrF8+T5IuDvp8KK5VJKVX0uoFv/F56Ehq5Km8OiiTyHPJ+ZpCbHZJEHItfk ri8ZE79hyEm9xE7xD28rJXfjMJNSftWXMtTyvLclQCXRmAy4W8BFa6wxdwgfzKGXNzNr m77CtFgIfVvRz4g+KnjuF57rvqB/4Ssr3GZ9ywuurMdMnEovqFQQrgoGjC8vANnj5tg4 sS6zcZcMKJxFTn/1kpNu3tQ4AEmE59z51lV+6RC3GNqyTKQ4vEJcT1LzPc0RB0RX720H EfDf5iCdEmOtRni4hLDfahbRyW+qdW89oik6lpnJ9m/wAzKttauB3Y5VVZ3SIuUbQySI GEoQ== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Thierry Reding Keeping the list sorted alphabetically makes it much easier to determine where to add new includes. Signed-off-by: Thierry Reding --- include/drm/drm_dp_helper.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h index 8364502f92cf..114261158b73 100644 --- a/include/drm/drm_dp_helper.h +++ b/include/drm/drm_dp_helper.h @@ -23,9 +23,9 @@ #ifndef _DRM_DP_HELPER_H_ #define _DRM_DP_HELPER_H_ -#include -#include #include +#include +#include /* * Unless otherwise noted, all values are from the DP 1.1a spec. Note that From patchwork Mon Sep 2 11:31:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 11126425 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 D0A9F1398 for ; Mon, 2 Sep 2019 11:31:33 +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 B88AB2173E for ; Mon, 2 Sep 2019 11:31:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B88AB2173E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com 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 6E13989A0F; Mon, 2 Sep 2019 11:31:31 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) by gabe.freedesktop.org (Postfix) with ESMTPS id 714D189A0F for ; Mon, 2 Sep 2019 11:31:29 +0000 (UTC) Received: by mail-wr1-x443.google.com with SMTP id g7so13683810wrx.2 for ; Mon, 02 Sep 2019 04:31:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=FYiUY5p+TWatTxX9qBGkn9VrpmRhMnZJh/hFNFOnOtM=; b=kRZ3iZ6hjY0ptISTsBdOhM4Qbm7RdpwaBe/BnEzufX3q5rIbMz5R+oVBnMYqvQ55on nPCSgCLIzBkN6BuqpKxTeaKxFkcdENbhmPNXHBCfCqJL8eLRt0g2xqqPJoV8nSVN2/yT Qagx7PtC4HcoOYiEzg409yLOmjGHbuYttz1izx+bBKChJoRbdX/6AQYr7aqiIHEUqGUU XHhDAeDLbSUwI3PhWn/Sq44QUPqhyA4zN+XvVeFD7HbJA+VXnCB5HLzWHcjZl7seiLkf UirO57crDKq3ECLsqP0u2Z02FAsvjxWPTc4QqRuFIW29igHXay7opRnZSTf9gG2rEJw4 f6Fw== X-Gm-Message-State: APjAAAXG/M0XLQ1h53zL3lL4ZfEp63e0lR4FiR//5gVVZ9kh48T5WiDa 1DPqrcz+J2mhty9KbeZcNdFkcC1I X-Google-Smtp-Source: APXvYqylhdz2i1zMmBSidgeCSzkA7ZytiSHhEFLlAoZipJm3BEGmIIBVxnFZs34O6SPNA4iS6AGN1w== X-Received: by 2002:adf:dc81:: with SMTP id r1mr35521231wrj.52.1567423887674; Mon, 02 Sep 2019 04:31:27 -0700 (PDT) Received: from localhost (pD9E51890.dip0.t-ipconnect.de. [217.229.24.144]) by smtp.gmail.com with ESMTPSA id f18sm15421768wrx.85.2019.09.02.04.31.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Sep 2019 04:31:26 -0700 (PDT) From: Thierry Reding To: dri-devel@lists.freedesktop.org Subject: [PATCH v2 02/21] drm/dp: Add missing kerneldoc for struct drm_dp_link Date: Mon, 2 Sep 2019 13:31:02 +0200 Message-Id: <20190902113121.31323-3-thierry.reding@gmail.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190902113121.31323-1-thierry.reding@gmail.com> References: <20190902113121.31323-1-thierry.reding@gmail.com> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=FYiUY5p+TWatTxX9qBGkn9VrpmRhMnZJh/hFNFOnOtM=; b=ZTNkAg8tts7B5hzn7TGJdFVyc3qlaNfy+WIH+Q0TPiYl9XqZHrn4NsAkPFXWKU7jnF P34091jZBibKIrHmZsNeq2oox461Q4hTgn6ZaUJoEj7M/OubNiJlQc8IT5yxsUdHb9+F FzeMq+60MniEQVKYKyhNn4blaFbe96Q76JipsBGtElf9FDl82MNkN6LwBaZ0CryFuc54 mURgEgaca2L3IIPG6lKL0anp7VZ6cwVPwoQtnNI1dp9ZJlxNhcxKRKggYGPgjG+ucVXu IS6/TBnTC5Df2Sh3XguJvej34dI0/Q9P0t8cfVLczufyMj8iKkBhWRuwQIzL3/8pNKeK QZ1w== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Thierry Reding The drm_dp_link structure tracks capabilities on the DP link. Add some kerneldoc to explain what each of its fields means. Signed-off-by: Thierry Reding --- include/drm/drm_dp_helper.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h index 114261158b73..935f331e6e72 100644 --- a/include/drm/drm_dp_helper.h +++ b/include/drm/drm_dp_helper.h @@ -1358,6 +1358,13 @@ int drm_dp_dpcd_read_link_status(struct drm_dp_aux *aux, */ #define DP_LINK_CAP_ENHANCED_FRAMING (1 << 0) +/** + * struct drm_dp_link - DP link capabilities + * @revision: DP specification revision supported on the link + * @rate: maximum clock rate supported on the link + * @num_lanes: maximum number of lanes supported on the link + * @capabilities: bitmask of capabilities supported on the link + */ struct drm_dp_link { unsigned char revision; unsigned int rate; From patchwork Mon Sep 2 11:31:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 11126427 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 6D5611398 for ; Mon, 2 Sep 2019 11:31:35 +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 55DC02173E for ; Mon, 2 Sep 2019 11:31:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 55DC02173E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com 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 44B3789A0E; Mon, 2 Sep 2019 11:31:33 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5279889A0E for ; Mon, 2 Sep 2019 11:31:31 +0000 (UTC) Received: by mail-wr1-x442.google.com with SMTP id l11so4833719wrx.5 for ; Mon, 02 Sep 2019 04:31:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=6cE/xv/U0fBPBmKtqaF9y7E9fzhVX7Pxsb5pN0WeB1I=; b=VzIq6ooSVruJ2pK8yrqM1J1FTSRr1Zbukk9Dl3NsK2t/gtsbstgV0B/j22th8HBD+J VzVV+1unK9DOlmffUKBvwPZZrIvJUGa0ZhJdLQY5I/bC45qoNzNvvDC8JsX+uAtIUf4F WMVwSjRzNyOudZbA5ah2gF5MDQhx1qoZsZn/YKmj1cRjUxuvbKsepNN8Y1+8GYN1O8pw 6yOE9QBkLgKBE0uYoRw5BX1Qpb9u0Vp+JSAqxtHjLt8GgXcFqiW/zy+yJp8SB+lluac3 kNOQCk0PIO/+DWATKeLk2ED8pFlXn7hHFECEeqRksDzX0EgBtl+214ND6x38zCzQcHo5 PbCw== X-Gm-Message-State: APjAAAW+FlIwxfVnRUK2GHC/NKgga0q2eaFGsqKzxI1LI5A6ZSQdEuxS jpGryqKdJ4fKEePSHzUJ6Ij0n6Jb X-Google-Smtp-Source: APXvYqxyHLaJ5erB59QfGTJT6pcjepbSVJ5kkThMyLzYtqT+j8u9al1pOr0Fc+6wDYmjxBQfjhAgCw== X-Received: by 2002:a5d:458b:: with SMTP id p11mr5821373wrq.160.1567423889605; Mon, 02 Sep 2019 04:31:29 -0700 (PDT) Received: from localhost (pD9E51890.dip0.t-ipconnect.de. [217.229.24.144]) by smtp.gmail.com with ESMTPSA id s19sm28105920wrb.94.2019.09.02.04.31.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Sep 2019 04:31:28 -0700 (PDT) From: Thierry Reding To: dri-devel@lists.freedesktop.org Subject: [PATCH v2 03/21] drm/dp: Add drm_dp_link_reset() implementation Date: Mon, 2 Sep 2019 13:31:03 +0200 Message-Id: <20190902113121.31323-4-thierry.reding@gmail.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190902113121.31323-1-thierry.reding@gmail.com> References: <20190902113121.31323-1-thierry.reding@gmail.com> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=6cE/xv/U0fBPBmKtqaF9y7E9fzhVX7Pxsb5pN0WeB1I=; b=eTdMc1Ox+2Zub2dtyuJrYeQoINMd2P5sI2iGCrZTRaDovqs6F72LeEfaNQMpYhxr58 +3YsT7jMpK5u7RVM6GQqnWHpNqDzaMzJOAvghc8IvHQ05sHx7TYWTtoBAy5+53cAL2Rr +vejn2TLDSNe6PQLdL4dzrdx8+5oCjCRc69Rk7LFxrWygAuEiU+M25oU7NQXsKV+v5Lm aPznEX5SgJhfdeQqBLDFjww4vmWwAwsqk99rxxb1T3Fa9MRSXLaCM7YLXMAzjKym3s2u Q1owBpkE6KxR8Y9yU7xJjITASRjQEOHjqrERq4CyQSjq/hukG5eZ2EjVVyw285BcLCUm rWDA== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Thierry Reding Subsequent patches will add non-volatile fields to struct drm_dp_link, so introduce a function to zero out only the volatile fields. Signed-off-by: Thierry Reding --- drivers/gpu/drm/drm_dp_helper.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c index ffc68d305afe..f5af71ec1b7d 100644 --- a/drivers/gpu/drm/drm_dp_helper.c +++ b/drivers/gpu/drm/drm_dp_helper.c @@ -336,6 +336,17 @@ int drm_dp_dpcd_read_link_status(struct drm_dp_aux *aux, } EXPORT_SYMBOL(drm_dp_dpcd_read_link_status); +static void drm_dp_link_reset(struct drm_dp_link *link) +{ + if (!link) + return; + + link->revision = 0; + link->rate = 0; + link->num_lanes = 0; + link->capabilities = 0; +} + /** * drm_dp_link_probe() - probe a DisplayPort link for capabilities * @aux: DisplayPort AUX channel @@ -352,7 +363,7 @@ int drm_dp_link_probe(struct drm_dp_aux *aux, struct drm_dp_link *link) u8 values[3]; int err; - memset(link, 0, sizeof(*link)); + drm_dp_link_reset(link); err = drm_dp_dpcd_read(aux, DP_DPCD_REV, values, sizeof(values)); if (err < 0) From patchwork Mon Sep 2 11:31:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 11126431 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 76E2014F7 for ; Mon, 2 Sep 2019 11:31:37 +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 5D73F2190F for ; Mon, 2 Sep 2019 11:31:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5D73F2190F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com 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 2E63F89A20; Mon, 2 Sep 2019 11:31:36 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm1-x343.google.com (mail-wm1-x343.google.com [IPv6:2a00:1450:4864:20::343]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5DF5689A1F for ; Mon, 2 Sep 2019 11:31:34 +0000 (UTC) Received: by mail-wm1-x343.google.com with SMTP id g207so10207499wmg.5 for ; Mon, 02 Sep 2019 04:31:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5nZ1iOFYFrDgdT9SQSUB63EW2fLIeoKVlSE44P6hggg=; b=H4pXJ9oCDU7yRxiR2h3lPm2st82sTMD6FCc39eCxfW/xSFfaXyRu9JdmdwuKFldYBa 6XC0RBCWhFalYaSND6sJUa74eQfhEtJdw0KTd8gjIwRI9+AjEi4BmrIzNsKzHztkzm2O Mbj5E+KrMWjOTBih5qy62I7n+DCKXSEfANHlGwemA3Q7A8GWKP/ssPb718metR1pIQf7 uqEbxJPnJfvhkUSY3LLlD6Mw9vgiWt68gTaauWkJLgDCfan5rTxU6yIq6GW3lCQovFUj TfQ7V9EMmDyxDK9T52tX5SRnziSSGkK2v0TzOshbIg6a5USKU0dv/NCILPnQuu8uKJbR KuZQ== X-Gm-Message-State: APjAAAWLa4IwHF4Uwuaj5AbHk+dyxs32UkfiLCer6yWO+sXTBRhyw8Yl PvUQbmQDUxjif+AOiNPYm1u1hYTs X-Google-Smtp-Source: APXvYqzqPU/PoEeFsDIt49f26ZFhQL7Ga4ZV8eFG7ZAUAKwfHZR3AJRaxbTT6St/Fzq1KqV+4tcP/Q== X-Received: by 2002:a1c:1aca:: with SMTP id a193mr444693wma.120.1567423892358; Mon, 02 Sep 2019 04:31:32 -0700 (PDT) Received: from localhost (pD9E51890.dip0.t-ipconnect.de. [217.229.24.144]) by smtp.gmail.com with ESMTPSA id y6sm4863970wmi.14.2019.09.02.04.31.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Sep 2019 04:31:30 -0700 (PDT) From: Thierry Reding To: dri-devel@lists.freedesktop.org Subject: [PATCH v2 04/21] drm/dp: Track link capabilities alongside settings Date: Mon, 2 Sep 2019 13:31:04 +0200 Message-Id: <20190902113121.31323-5-thierry.reding@gmail.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190902113121.31323-1-thierry.reding@gmail.com> References: <20190902113121.31323-1-thierry.reding@gmail.com> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5nZ1iOFYFrDgdT9SQSUB63EW2fLIeoKVlSE44P6hggg=; b=K1ysr5YrmbsotzOAzQgBWNjwsL9KtAJ+t3LupG5EQrj6+zsm8ksVUcvIQh+xpyx2F8 aNwYGCpZV80VQQDd82qMzcNfnZK+CsCMCbxwh4sb0tDxtpZZcdwBnnA95PHx0tbxMaLG E2UZJ5KfK2Wnqd3c2kA4xZEYjHpmhLOdJRBE38AQz/UKInlIqGG+3HeYCWWc6xzHLXYW ZhC9lN/tBwLAPPhgTl/Hg4+NV3k+TonHLZJZ3TU30QRS/C7BcijQ/G+PF0j/CNaW29Tq 8MlHwCDSqsIR+c+hH5/HP1eETJvh3UY/uolAAg91+n1sYahcMOQVSedHF7lx4JwEeHs8 Tppg== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Thierry Reding Store capabilities in max_* fields and add separate fields for the currently selected settings. Cc: Rob Clark Reviewed-by: Andrzej Hajda Signed-off-by: Thierry Reding --- drivers/gpu/drm/bridge/tc358767.c | 14 ++++++------- drivers/gpu/drm/drm_dp_helper.c | 16 ++++++++++----- drivers/gpu/drm/msm/edp/edp_ctrl.c | 8 ++++---- drivers/gpu/drm/rockchip/cdn-dp-core.c | 8 ++++---- drivers/gpu/drm/rockchip/cdn-dp-reg.c | 13 ++++++------ drivers/gpu/drm/tegra/dpaux.c | 8 ++++---- drivers/gpu/drm/tegra/sor.c | 28 +++++++++++++------------- include/drm/drm_dp_helper.h | 15 +++++++++----- 8 files changed, 60 insertions(+), 50 deletions(-) diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c index cebc8e620820..733fca7d3829 100644 --- a/drivers/gpu/drm/bridge/tc358767.c +++ b/drivers/gpu/drm/bridge/tc358767.c @@ -437,7 +437,7 @@ static u32 tc_srcctrl(struct tc_data *tc) reg |= DP0_SRCCTRL_SCRMBLDIS; /* Scrambler Disabled */ if (tc->link.spread) reg |= DP0_SRCCTRL_SSCG; /* Spread Spectrum Enable */ - if (tc->link.base.num_lanes == 2) + if (tc->link.base.lanes == 2) reg |= DP0_SRCCTRL_LANES_2; /* Two Main Channel Lanes */ if (tc->link.base.rate != 162000) reg |= DP0_SRCCTRL_BW27; /* 2.7 Gbps link */ @@ -674,9 +674,9 @@ static int tc_get_display_props(struct tc_data *tc) tc->link.base.rate = 270000; } - if (tc->link.base.num_lanes > 2) { + if (tc->link.base.lanes > 2) { dev_dbg(tc->dev, "Falling to 2 lanes\n"); - tc->link.base.num_lanes = 2; + tc->link.base.lanes = 2; } ret = drm_dp_dpcd_readb(&tc->aux, DP_MAX_DOWNSPREAD, ®); @@ -698,7 +698,7 @@ static int tc_get_display_props(struct tc_data *tc) dev_dbg(tc->dev, "DPCD rev: %d.%d, rate: %s, lanes: %d, framing: %s\n", tc->link.base.revision >> 4, tc->link.base.revision & 0x0f, (tc->link.base.rate == 162000) ? "1.62Gbps" : "2.7Gbps", - tc->link.base.num_lanes, + tc->link.base.lanes, (tc->link.base.capabilities & DP_LINK_CAP_ENHANCED_FRAMING) ? "enhanced" : "non-enhanced"); dev_dbg(tc->dev, "Downspread: %s, scrambler: %s\n", @@ -906,7 +906,7 @@ static int tc_main_link_enable(struct tc_data *tc) /* Setup Main Link */ dp_phy_ctrl = BGREN | PWR_SW_EN | PHY_A0_EN | PHY_M0_EN; - if (tc->link.base.num_lanes == 2) + if (tc->link.base.lanes == 2) dp_phy_ctrl |= PHY_2LANE; ret = regmap_write(tc->regmap, DP_PHY_CTRL, dp_phy_ctrl); @@ -1094,7 +1094,7 @@ static int tc_main_link_enable(struct tc_data *tc) ret = -ENODEV; } - if (tc->link.base.num_lanes == 2) { + if (tc->link.base.lanes == 2) { value = (tmp[0] >> 4) & DP_CHANNEL_EQ_BITS; if (value != DP_CHANNEL_EQ_BITS) { @@ -1291,7 +1291,7 @@ static enum drm_mode_status tc_mode_valid(struct drm_bridge *bridge, return MODE_CLOCK_HIGH; req = mode->clock * bits_per_pixel / 8; - avail = tc->link.base.num_lanes * tc->link.base.rate; + avail = tc->link.base.lanes * tc->link.base.rate; if (req > avail) return MODE_BAD; diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c index f5af71ec1b7d..365de63a02fb 100644 --- a/drivers/gpu/drm/drm_dp_helper.c +++ b/drivers/gpu/drm/drm_dp_helper.c @@ -342,9 +342,12 @@ static void drm_dp_link_reset(struct drm_dp_link *link) return; link->revision = 0; - link->rate = 0; - link->num_lanes = 0; + link->max_rate = 0; + link->max_lanes = 0; link->capabilities = 0; + + link->rate = 0; + link->lanes = 0; } /** @@ -370,12 +373,15 @@ int drm_dp_link_probe(struct drm_dp_aux *aux, struct drm_dp_link *link) return err; link->revision = values[0]; - link->rate = drm_dp_bw_code_to_link_rate(values[1]); - link->num_lanes = values[2] & DP_MAX_LANE_COUNT_MASK; + link->max_rate = drm_dp_bw_code_to_link_rate(values[1]); + link->max_lanes = values[2] & DP_MAX_LANE_COUNT_MASK; if (values[2] & DP_ENHANCED_FRAME_CAP) link->capabilities |= DP_LINK_CAP_ENHANCED_FRAMING; + link->rate = link->max_rate; + link->lanes = link->max_lanes; + return 0; } EXPORT_SYMBOL(drm_dp_link_probe); @@ -462,7 +468,7 @@ int drm_dp_link_configure(struct drm_dp_aux *aux, struct drm_dp_link *link) int err; values[0] = drm_dp_link_rate_to_bw_code(link->rate); - values[1] = link->num_lanes; + values[1] = link->lanes; if (link->capabilities & DP_LINK_CAP_ENHANCED_FRAMING) values[1] |= DP_LANE_COUNT_ENHANCED_FRAME_EN; diff --git a/drivers/gpu/drm/msm/edp/edp_ctrl.c b/drivers/gpu/drm/msm/edp/edp_ctrl.c index 7f3dd3ffe2c9..4b31bc30be2c 100644 --- a/drivers/gpu/drm/msm/edp/edp_ctrl.c +++ b/drivers/gpu/drm/msm/edp/edp_ctrl.c @@ -403,7 +403,7 @@ static void edp_fill_link_cfg(struct edp_ctrl *ctrl) u32 prate; u32 lrate; u32 bpp; - u8 max_lane = ctrl->dp_link.num_lanes; + u8 max_lane = ctrl->dp_link.max_lanes; u8 lane; prate = ctrl->pixel_rate; @@ -413,7 +413,7 @@ static void edp_fill_link_cfg(struct edp_ctrl *ctrl) * By default, use the maximum link rate and minimum lane count, * so that we can do rate down shift during link training. */ - ctrl->link_rate = drm_dp_link_rate_to_bw_code(ctrl->dp_link.rate); + ctrl->link_rate = drm_dp_link_rate_to_bw_code(ctrl->dp_link.max_rate); prate *= bpp; prate /= 8; /* in kByte */ @@ -701,7 +701,7 @@ static int edp_link_rate_down_shift(struct edp_ctrl *ctrl) rate = ctrl->link_rate; lane = ctrl->lane_cnt; - max_lane = ctrl->dp_link.num_lanes; + max_lane = ctrl->dp_link.max_lanes; bpp = ctrl->color_depth * 3; prate = ctrl->pixel_rate; @@ -759,7 +759,7 @@ static int edp_do_link_train(struct edp_ctrl *ctrl) * Set the current link rate and lane cnt to panel. They may have been * adjusted and the values are different from them in DPCD CAP */ - dp_link.num_lanes = ctrl->lane_cnt; + dp_link.lanes = ctrl->lane_cnt; dp_link.rate = drm_dp_bw_code_to_link_rate(ctrl->link_rate); dp_link.capabilities = ctrl->dp_link.capabilities; if (drm_dp_link_configure(ctrl->drm_aux, &dp_link) < 0) diff --git a/drivers/gpu/drm/rockchip/cdn-dp-core.c b/drivers/gpu/drm/rockchip/cdn-dp-core.c index d505ea7d5384..c500be895e64 100644 --- a/drivers/gpu/drm/rockchip/cdn-dp-core.c +++ b/drivers/gpu/drm/rockchip/cdn-dp-core.c @@ -478,7 +478,7 @@ static int cdn_dp_disable(struct cdn_dp_device *dp) cdn_dp_clk_disable(dp); dp->active = false; dp->link.rate = 0; - dp->link.num_lanes = 0; + dp->link.lanes = 0; if (!dp->connected) { kfree(dp->edid); dp->edid = NULL; @@ -570,7 +570,7 @@ static bool cdn_dp_check_link_status(struct cdn_dp_device *dp) struct cdn_dp_port *port = cdn_dp_connected_port(dp); u8 sink_lanes = drm_dp_max_lane_count(dp->dpcd); - if (!port || !dp->link.rate || !dp->link.num_lanes) + if (!port || !dp->link.rate || !dp->link.lanes) return false; if (cdn_dp_dpcd_read(dp, DP_LANE0_1_STATUS, link_status, @@ -953,7 +953,7 @@ static void cdn_dp_pd_event_work(struct work_struct *work) /* Enabled and connected with a sink, re-train if requested */ } else if (!cdn_dp_check_link_status(dp)) { unsigned int rate = dp->link.rate; - unsigned int lanes = dp->link.num_lanes; + unsigned int lanes = dp->link.lanes; struct drm_display_mode *mode = &dp->mode; DRM_DEV_INFO(dp->dev, "Connected with sink. Re-train link\n"); @@ -966,7 +966,7 @@ static void cdn_dp_pd_event_work(struct work_struct *work) /* If training result is changed, update the video config */ if (mode->clock && - (rate != dp->link.rate || lanes != dp->link.num_lanes)) { + (rate != dp->link.rate || lanes != dp->link.lanes)) { ret = cdn_dp_config_video(dp); if (ret) { dp->connected = false; diff --git a/drivers/gpu/drm/rockchip/cdn-dp-reg.c b/drivers/gpu/drm/rockchip/cdn-dp-reg.c index 077c87021908..7b254d0d0ba2 100644 --- a/drivers/gpu/drm/rockchip/cdn-dp-reg.c +++ b/drivers/gpu/drm/rockchip/cdn-dp-reg.c @@ -536,7 +536,7 @@ static int cdn_dp_get_training_status(struct cdn_dp_device *dp) goto err_get_training_status; dp->link.rate = drm_dp_bw_code_to_link_rate(status[0]); - dp->link.num_lanes = status[1]; + dp->link.lanes = status[1]; err_get_training_status: if (ret) @@ -561,7 +561,7 @@ int cdn_dp_train_link(struct cdn_dp_device *dp) } DRM_DEV_DEBUG_KMS(dp->dev, "rate:0x%x, lanes:%d\n", dp->link.rate, - dp->link.num_lanes); + dp->link.lanes); return ret; } @@ -659,14 +659,13 @@ int cdn_dp_config_video(struct cdn_dp_device *dp) do { tu_size_reg += 2; symbol = tu_size_reg * mode->clock * bit_per_pix; - do_div(symbol, dp->link.num_lanes * link_rate * 8); + do_div(symbol, dp->link.lanes * link_rate * 8); rem = do_div(symbol, 1000); if (tu_size_reg > 64) { ret = -EINVAL; DRM_DEV_ERROR(dp->dev, "tu error, clk:%d, lanes:%d, rate:%d\n", - mode->clock, dp->link.num_lanes, - link_rate); + mode->clock, dp->link.lanes, link_rate); goto err_config_video; } } while ((symbol <= 1) || (tu_size_reg - symbol < 4) || @@ -680,7 +679,7 @@ int cdn_dp_config_video(struct cdn_dp_device *dp) /* set the FIFO Buffer size */ val = div_u64(mode->clock * (symbol + 1), 1000) + link_rate; - val /= (dp->link.num_lanes * link_rate); + val /= (dp->link.lanes * link_rate); val = div_u64(8 * (symbol + 1), bit_per_pix) - val; val += 2; ret = cdn_dp_reg_write(dp, DP_VC_TABLE(15), val); @@ -833,7 +832,7 @@ static void cdn_dp_audio_config_i2s(struct cdn_dp_device *dp, u32 val; if (audio->channels == 2) { - if (dp->link.num_lanes == 1) + if (dp->link.lanes == 1) sub_pckt_num = 2; else sub_pckt_num = 4; diff --git a/drivers/gpu/drm/tegra/dpaux.c b/drivers/gpu/drm/tegra/dpaux.c index a0f6f9b0d258..ec1688bdff8d 100644 --- a/drivers/gpu/drm/tegra/dpaux.c +++ b/drivers/gpu/drm/tegra/dpaux.c @@ -792,14 +792,14 @@ int drm_dp_aux_train(struct drm_dp_aux *aux, struct drm_dp_link *link, if (tp == DP_TRAINING_PATTERN_DISABLE) return 0; - for (i = 0; i < link->num_lanes; i++) + for (i = 0; i < link->lanes; i++) values[i] = DP_TRAIN_MAX_PRE_EMPHASIS_REACHED | DP_TRAIN_PRE_EMPH_LEVEL_0 | DP_TRAIN_MAX_SWING_REACHED | DP_TRAIN_VOLTAGE_SWING_LEVEL_0; err = drm_dp_dpcd_write(aux, DP_TRAINING_LANE0_SET, values, - link->num_lanes); + link->lanes); if (err < 0) return err; @@ -811,13 +811,13 @@ int drm_dp_aux_train(struct drm_dp_aux *aux, struct drm_dp_link *link, switch (tp) { case DP_TRAINING_PATTERN_1: - if (!drm_dp_clock_recovery_ok(status, link->num_lanes)) + if (!drm_dp_clock_recovery_ok(status, link->lanes)) return -EAGAIN; break; case DP_TRAINING_PATTERN_2: - if (!drm_dp_channel_eq_ok(status, link->num_lanes)) + if (!drm_dp_channel_eq_ok(status, link->lanes)) return -EAGAIN; break; diff --git a/drivers/gpu/drm/tegra/sor.c b/drivers/gpu/drm/tegra/sor.c index e1669ada0a40..cb94091d98a7 100644 --- a/drivers/gpu/drm/tegra/sor.c +++ b/drivers/gpu/drm/tegra/sor.c @@ -649,7 +649,7 @@ static int tegra_sor_dp_train_fast(struct tegra_sor *sor, if (err < 0) return err; - for (i = 0, value = 0; i < link->num_lanes; i++) { + for (i = 0, value = 0; i < link->lanes; i++) { unsigned long lane = SOR_DP_TPG_CHANNEL_CODING | SOR_DP_TPG_SCRAMBLER_NONE | SOR_DP_TPG_PATTERN_TRAIN1; @@ -670,7 +670,7 @@ static int tegra_sor_dp_train_fast(struct tegra_sor *sor, value |= SOR_DP_SPARE_MACRO_SOR_CLK; tegra_sor_writel(sor, value, SOR_DP_SPARE0); - for (i = 0, value = 0; i < link->num_lanes; i++) { + for (i = 0, value = 0; i < link->lanes; i++) { unsigned long lane = SOR_DP_TPG_CHANNEL_CODING | SOR_DP_TPG_SCRAMBLER_NONE | SOR_DP_TPG_PATTERN_TRAIN2; @@ -685,7 +685,7 @@ static int tegra_sor_dp_train_fast(struct tegra_sor *sor, if (err < 0) return err; - for (i = 0, value = 0; i < link->num_lanes; i++) { + for (i = 0, value = 0; i < link->lanes; i++) { unsigned long lane = SOR_DP_TPG_CHANNEL_CODING | SOR_DP_TPG_SCRAMBLER_GALIOS | SOR_DP_TPG_PATTERN_NONE; @@ -912,11 +912,11 @@ static int tegra_sor_compute_config(struct tegra_sor *sor, u32 num_syms_per_line; unsigned int i; - if (!link_rate || !link->num_lanes || !pclk || !config->bits_per_pixel) + if (!link_rate || !link->lanes || !pclk || !config->bits_per_pixel) return -EINVAL; - output = link_rate * 8 * link->num_lanes; input = pclk * config->bits_per_pixel; + output = link_rate * 8 * link->lanes; if (input >= output) return -ERANGE; @@ -959,7 +959,7 @@ static int tegra_sor_compute_config(struct tegra_sor *sor, watermark = div_u64(watermark + params.error, f); config->watermark = watermark + (config->bits_per_pixel / 8) + 2; num_syms_per_line = (mode->hdisplay * config->bits_per_pixel) * - (link->num_lanes * 8); + (link->lanes * 8); if (config->watermark > 30) { config->watermark = 30; @@ -979,12 +979,12 @@ static int tegra_sor_compute_config(struct tegra_sor *sor, if (link->capabilities & DP_LINK_CAP_ENHANCED_FRAMING) config->hblank_symbols -= 3; - config->hblank_symbols -= 12 / link->num_lanes; + config->hblank_symbols -= 12 / link->lanes; /* compute the number of symbols per vertical blanking interval */ num = (mode->hdisplay - 25) * link_rate; config->vblank_symbols = div_u64(num, pclk); - config->vblank_symbols -= 36 / link->num_lanes + 4; + config->vblank_symbols -= 36 / link->lanes + 4; dev_dbg(sor->dev, "blank symbols: H:%u V:%u\n", config->hblank_symbols, config->vblank_symbols); @@ -1830,17 +1830,17 @@ static void tegra_sor_edp_enable(struct drm_encoder *encoder) /* power DP lanes */ value = tegra_sor_readl(sor, sor->soc->regs->dp_padctl0); - if (link.num_lanes <= 2) + if (link.lanes <= 2) value &= ~(SOR_DP_PADCTL_PD_TXD_3 | SOR_DP_PADCTL_PD_TXD_2); else value |= SOR_DP_PADCTL_PD_TXD_3 | SOR_DP_PADCTL_PD_TXD_2; - if (link.num_lanes <= 1) + if (link.lanes <= 1) value &= ~SOR_DP_PADCTL_PD_TXD_1; else value |= SOR_DP_PADCTL_PD_TXD_1; - if (link.num_lanes == 0) + if (link.lanes == 0) value &= ~SOR_DP_PADCTL_PD_TXD_0; else value |= SOR_DP_PADCTL_PD_TXD_0; @@ -1849,7 +1849,7 @@ static void tegra_sor_edp_enable(struct drm_encoder *encoder) value = tegra_sor_readl(sor, SOR_DP_LINKCTL0); value &= ~SOR_DP_LINKCTL_LANE_COUNT_MASK; - value |= SOR_DP_LINKCTL_LANE_COUNT(link.num_lanes); + value |= SOR_DP_LINKCTL_LANE_COUNT(link.lanes); tegra_sor_writel(sor, value, SOR_DP_LINKCTL0); /* start lane sequencer */ @@ -1906,7 +1906,7 @@ static void tegra_sor_edp_enable(struct drm_encoder *encoder) dev_err(sor->dev, "failed to configure eDP link: %d\n", err); rate = drm_dp_link_rate_to_bw_code(link.rate); - lanes = link.num_lanes; + lanes = link.lanes; value = tegra_sor_readl(sor, SOR_CLK_CNTRL); value &= ~SOR_CLK_CNTRL_DP_LINK_SPEED_MASK; @@ -1924,7 +1924,7 @@ static void tegra_sor_edp_enable(struct drm_encoder *encoder) /* disable training pattern generator */ - for (i = 0; i < link.num_lanes; i++) { + for (i = 0; i < link.lanes; i++) { unsigned long lane = SOR_DP_TPG_CHANNEL_CODING | SOR_DP_TPG_SCRAMBLER_GALIOS | SOR_DP_TPG_PATTERN_NONE; diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h index 935f331e6e72..9c675bde11e8 100644 --- a/include/drm/drm_dp_helper.h +++ b/include/drm/drm_dp_helper.h @@ -1359,17 +1359,22 @@ int drm_dp_dpcd_read_link_status(struct drm_dp_aux *aux, #define DP_LINK_CAP_ENHANCED_FRAMING (1 << 0) /** - * struct drm_dp_link - DP link capabilities + * struct drm_dp_link - DP link capabilities and configuration * @revision: DP specification revision supported on the link - * @rate: maximum clock rate supported on the link - * @num_lanes: maximum number of lanes supported on the link + * @max_rate: maximum clock rate supported on the link + * @max_lanes: maximum number of lanes supported on the link * @capabilities: bitmask of capabilities supported on the link + * @rate: currently configured link rate + * @lanes: currently configured number of lanes */ struct drm_dp_link { unsigned char revision; - unsigned int rate; - unsigned int num_lanes; + unsigned int max_rate; + unsigned int max_lanes; unsigned long capabilities; + + unsigned int rate; + unsigned int lanes; }; int drm_dp_link_probe(struct drm_dp_aux *aux, struct drm_dp_link *link); From patchwork Mon Sep 2 11:31:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 11126435 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 5CE141398 for ; Mon, 2 Sep 2019 11:31:39 +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 44EDE217F4 for ; Mon, 2 Sep 2019 11:31:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 44EDE217F4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com 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 CB13189A16; Mon, 2 Sep 2019 11:31:37 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm1-x342.google.com (mail-wm1-x342.google.com [IPv6:2a00:1450:4864:20::342]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6CE6089A56 for ; Mon, 2 Sep 2019 11:31:36 +0000 (UTC) Received: by mail-wm1-x342.google.com with SMTP id o184so14222009wme.3 for ; Mon, 02 Sep 2019 04:31:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xw6HYhOBvXQlj8DcISb1QXR7woc8hA800nMiq5WpQC0=; b=uJLtCgtE7KZZITazM5RcDSAkCy6Wk2rBes7nGbAUt1i+XK5IXwI0jx5C5vnUmZSX2t 5UT7os2Lih8lKMyRVSqLPOIDJOf1+iAmWGavgNy5N6z91IvJYLefxT/eYXf7gzgsq/eG N7gaejN1Sb6FtnftlpxEW2e/V1UCLsBI8YjYMaacKE+PXQeNNvHGe/WsKPDkVVTB9IR1 x1oO8p1shoAaxVVZuZwYN3dCOYYbc6qCdBwtrLmeAJyIxx3m2+Uo3xOzM7kMIlBIBru8 ztlXOgPr140yQRF6nPnqk0Q3mB8AJTwhTysCVk4LF0572+gO6k5hc1sx2nZqdDOJgnN1 pVZQ== X-Gm-Message-State: APjAAAUDV6zmnTuz1GS0ugyxZTPWWJHRDkNk264OBk4RjCFxMMsFStTn rSZmJphPCRZmxaME/8MZLzPbm7jv X-Google-Smtp-Source: APXvYqzrDwd6p6GFDETxHPnGVjerkur0qrQmRZexm0teuDYi5tGk1bPAwoZ7WHz1M4O1UkJGOgai4A== X-Received: by 2002:a1c:f103:: with SMTP id p3mr33828571wmh.18.1567423894658; Mon, 02 Sep 2019 04:31:34 -0700 (PDT) Received: from localhost (pD9E51890.dip0.t-ipconnect.de. [217.229.24.144]) by smtp.gmail.com with ESMTPSA id a17sm15979274wmm.47.2019.09.02.04.31.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Sep 2019 04:31:33 -0700 (PDT) From: Thierry Reding To: dri-devel@lists.freedesktop.org Subject: [PATCH v2 05/21] drm/dp: Turn link capabilities into booleans Date: Mon, 2 Sep 2019 13:31:05 +0200 Message-Id: <20190902113121.31323-6-thierry.reding@gmail.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190902113121.31323-1-thierry.reding@gmail.com> References: <20190902113121.31323-1-thierry.reding@gmail.com> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xw6HYhOBvXQlj8DcISb1QXR7woc8hA800nMiq5WpQC0=; b=nkJ9gWt4qH028BZtaEpslIMwCg3p9dXUDQYPTfuBFvZTCQXNQqZ3kK7qtZdVT2ZFDR g/EyXU5R6RBHF4P0p9GcIddRLug1QS1A+MBhCd7snBbHcfJLr2JkgXQxrScSjbwYd4H6 sdqhFSqr5FK2JDai4MWOMkd0dbMxycKJe2n/GX9hAT/feBmdig5yuUMvokU0Di4HVAt+ iOvJYGDmKLncnykJP5mGrgsktGLNWDJNj5BKfwo0rgv08ki4GM/PLjwNlCvm2PAh0Ens zoL3o0PTw1Nx7VClUOjISAs9pFs5NJn0bOF7LmiDKi+Maw/TrlD2a5pqE8KiRi2OO4jh DYog== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Thierry Reding Rather than storing capabilities as flags in an integer, use a separate boolean per capability. This simplifies the code that checks for these capabilities. Cc: Rob Clark Reviewed-by: Andrzej Hajda Signed-off-by: Thierry Reding --- drivers/gpu/drm/bridge/tc358767.c | 9 ++++----- drivers/gpu/drm/drm_dp_helper.c | 19 ++++++++++++++++--- drivers/gpu/drm/msm/edp/edp_ctrl.c | 4 ++-- drivers/gpu/drm/tegra/sor.c | 4 ++-- include/drm/drm_dp_helper.h | 17 ++++++++++++++--- 5 files changed, 38 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c index 733fca7d3829..240a9b69244d 100644 --- a/drivers/gpu/drm/bridge/tc358767.c +++ b/drivers/gpu/drm/bridge/tc358767.c @@ -699,8 +699,8 @@ static int tc_get_display_props(struct tc_data *tc) tc->link.base.revision >> 4, tc->link.base.revision & 0x0f, (tc->link.base.rate == 162000) ? "1.62Gbps" : "2.7Gbps", tc->link.base.lanes, - (tc->link.base.capabilities & DP_LINK_CAP_ENHANCED_FRAMING) ? - "enhanced" : "non-enhanced"); + tc->link.base.caps.enhanced_framing ? "enhanced" : + "non-enhanced"); dev_dbg(tc->dev, "Downspread: %s, scrambler: %s\n", tc->link.spread ? "0.5%" : "0.0%", tc->link.scrambler_dis ? "disabled" : "enabled"); @@ -1013,8 +1013,7 @@ static int tc_main_link_enable(struct tc_data *tc) /* Enable DP0 to start Link Training */ ret = regmap_write(tc->regmap, DP0CTL, - ((tc->link.base.capabilities & - DP_LINK_CAP_ENHANCED_FRAMING) ? EF_EN : 0) | + (tc->link.base.caps.enhanced_framing ? EF_EN : 0) | DP_EN); if (ret) return ret; @@ -1165,7 +1164,7 @@ static int tc_stream_enable(struct tc_data *tc) return ret; value = VID_MN_GEN | DP_EN; - if (tc->link.base.capabilities & DP_LINK_CAP_ENHANCED_FRAMING) + if (tc->link.base.caps.enhanced_framing) value |= EF_EN; ret = regmap_write(tc->regmap, DP0CTL, value); if (ret) diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c index 365de63a02fb..bdf999bb6cfa 100644 --- a/drivers/gpu/drm/drm_dp_helper.c +++ b/drivers/gpu/drm/drm_dp_helper.c @@ -336,6 +336,18 @@ int drm_dp_dpcd_read_link_status(struct drm_dp_aux *aux, } EXPORT_SYMBOL(drm_dp_dpcd_read_link_status); +static void drm_dp_link_caps_reset(struct drm_dp_link_caps *caps) +{ + caps->enhanced_framing = false; +} + +void drm_dp_link_caps_copy(struct drm_dp_link_caps *dest, + const struct drm_dp_link_caps *src) +{ + dest->enhanced_framing = src->enhanced_framing; +} +EXPORT_SYMBOL(drm_dp_link_caps_copy); + static void drm_dp_link_reset(struct drm_dp_link *link) { if (!link) @@ -344,7 +356,8 @@ static void drm_dp_link_reset(struct drm_dp_link *link) link->revision = 0; link->max_rate = 0; link->max_lanes = 0; - link->capabilities = 0; + + drm_dp_link_caps_reset(&link->caps); link->rate = 0; link->lanes = 0; @@ -377,7 +390,7 @@ int drm_dp_link_probe(struct drm_dp_aux *aux, struct drm_dp_link *link) link->max_lanes = values[2] & DP_MAX_LANE_COUNT_MASK; if (values[2] & DP_ENHANCED_FRAME_CAP) - link->capabilities |= DP_LINK_CAP_ENHANCED_FRAMING; + link->caps.enhanced_framing = true; link->rate = link->max_rate; link->lanes = link->max_lanes; @@ -470,7 +483,7 @@ int drm_dp_link_configure(struct drm_dp_aux *aux, struct drm_dp_link *link) values[0] = drm_dp_link_rate_to_bw_code(link->rate); values[1] = link->lanes; - if (link->capabilities & DP_LINK_CAP_ENHANCED_FRAMING) + if (link->caps.enhanced_framing) values[1] |= DP_LANE_COUNT_ENHANCED_FRAME_EN; err = drm_dp_dpcd_write(aux, DP_LINK_BW_SET, values, sizeof(values)); diff --git a/drivers/gpu/drm/msm/edp/edp_ctrl.c b/drivers/gpu/drm/msm/edp/edp_ctrl.c index 4b31bc30be2c..0a6c77e791aa 100644 --- a/drivers/gpu/drm/msm/edp/edp_ctrl.c +++ b/drivers/gpu/drm/msm/edp/edp_ctrl.c @@ -439,7 +439,7 @@ static void edp_config_ctrl(struct edp_ctrl *ctrl) data = EDP_CONFIGURATION_CTRL_LANES(ctrl->lane_cnt - 1); - if (ctrl->dp_link.capabilities & DP_LINK_CAP_ENHANCED_FRAMING) + if (ctrl->dp_link.caps.enhanced_framing) data |= EDP_CONFIGURATION_CTRL_ENHANCED_FRAMING; depth = EDP_6BIT; @@ -761,7 +761,7 @@ static int edp_do_link_train(struct edp_ctrl *ctrl) */ dp_link.lanes = ctrl->lane_cnt; dp_link.rate = drm_dp_bw_code_to_link_rate(ctrl->link_rate); - dp_link.capabilities = ctrl->dp_link.capabilities; + drm_dp_link_caps_copy(&dp_link.caps, &ctrl->dp_link.caps); if (drm_dp_link_configure(ctrl->drm_aux, &dp_link) < 0) return EDP_TRAIN_FAIL; diff --git a/drivers/gpu/drm/tegra/sor.c b/drivers/gpu/drm/tegra/sor.c index cb94091d98a7..0b033b964ac0 100644 --- a/drivers/gpu/drm/tegra/sor.c +++ b/drivers/gpu/drm/tegra/sor.c @@ -976,7 +976,7 @@ static int tegra_sor_compute_config(struct tegra_sor *sor, num = ((mode->htotal - mode->hdisplay) - 7) * link_rate; config->hblank_symbols = div_u64(num, pclk); - if (link->capabilities & DP_LINK_CAP_ENHANCED_FRAMING) + if (link->caps.enhanced_framing) config->hblank_symbols -= 3; config->hblank_symbols -= 12 / link->lanes; @@ -1917,7 +1917,7 @@ static void tegra_sor_edp_enable(struct drm_encoder *encoder) value &= ~SOR_DP_LINKCTL_LANE_COUNT_MASK; value |= SOR_DP_LINKCTL_LANE_COUNT(lanes); - if (link.capabilities & DP_LINK_CAP_ENHANCED_FRAMING) + if (link.caps.enhanced_framing) value |= SOR_DP_LINKCTL_ENHANCED_FRAME; tegra_sor_writel(sor, value, SOR_DP_LINKCTL0); diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h index 9c675bde11e8..2759f8d7e90d 100644 --- a/include/drm/drm_dp_helper.h +++ b/include/drm/drm_dp_helper.h @@ -1356,14 +1356,24 @@ int drm_dp_dpcd_read_link_status(struct drm_dp_aux *aux, /* * DisplayPort link */ -#define DP_LINK_CAP_ENHANCED_FRAMING (1 << 0) + +/** + * struct drm_dp_link_caps - DP link capabilities + * @enhanced_framing: enhanced framing capability (mandatory as of DP 1.2) + */ +struct drm_dp_link_caps { + bool enhanced_framing; +}; + +void drm_dp_link_caps_copy(struct drm_dp_link_caps *dest, + const struct drm_dp_link_caps *src); /** * struct drm_dp_link - DP link capabilities and configuration * @revision: DP specification revision supported on the link * @max_rate: maximum clock rate supported on the link * @max_lanes: maximum number of lanes supported on the link - * @capabilities: bitmask of capabilities supported on the link + * @caps: capabilities supported on the link (see &drm_dp_link_caps) * @rate: currently configured link rate * @lanes: currently configured number of lanes */ @@ -1371,7 +1381,8 @@ struct drm_dp_link { unsigned char revision; unsigned int max_rate; unsigned int max_lanes; - unsigned long capabilities; + + struct drm_dp_link_caps caps; unsigned int rate; unsigned int lanes; From patchwork Mon Sep 2 11:31:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 11126437 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 0567D1398 for ; Mon, 2 Sep 2019 11:31:42 +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 E0DAC217D7 for ; Mon, 2 Sep 2019 11:31:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E0DAC217D7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com 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 D7C5289A56; Mon, 2 Sep 2019 11:31:40 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) by gabe.freedesktop.org (Postfix) with ESMTPS id DD9D789A61 for ; Mon, 2 Sep 2019 11:31:38 +0000 (UTC) Received: by mail-wr1-x441.google.com with SMTP id l11so4834072wrx.5 for ; Mon, 02 Sep 2019 04:31:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Pade97gqRD3FO0Cn8/jU5vMKVUfbLZBxbADpt0tfjfI=; b=FEoSUmp75Kq9q3pMHwRYZ2/bP3HTLTRu5BOEnsUytOd/c3ks/nRwGtjLz4Go9Rr8kb COvomnDiWQKH7AwXNLEk8mZL+v8utTaS9sYz3H5xNBI3SHn+ba1CnsqBUuqBaX0ZikyY bCIohv9RMKNIuWUVf3kyk+AD8PvIPjWeW1TZrNVcUcJEGH8U4tr4vSxC7ueZC83oUPvd zcuHVHE0v+w6KiJKNemOYePJyzcRaMgxy5p1/1nX6HFpOBpNfM/F9VM1e0lS9TDYbZfz D82YXTwqfSPtfemwV/XhELAGK69NCkODTQAhJyVlpMNJBmqfxixZr8ShzpbsKRtbtxKv ZbeQ== X-Gm-Message-State: APjAAAUTad8sLZW27xT82ImpAfarK9FbuwXMPGtViPVub1ZyAzGXjsuR Ox0ECobUntzaA35emzx7uzS5Xaa0 X-Google-Smtp-Source: APXvYqwGfSGVeCscI5y2LJXI7k4tX/GQLDb95sFSej1HKPmlaq2wmsyjP1QUbginGL87HMSspl/5kA== X-Received: by 2002:adf:de8a:: with SMTP id w10mr24070352wrl.276.1567423896581; Mon, 02 Sep 2019 04:31:36 -0700 (PDT) Received: from localhost (pD9E51890.dip0.t-ipconnect.de. [217.229.24.144]) by smtp.gmail.com with ESMTPSA id k9sm22279805wrd.7.2019.09.02.04.31.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Sep 2019 04:31:35 -0700 (PDT) From: Thierry Reding To: dri-devel@lists.freedesktop.org Subject: [PATCH v2 06/21] drm/dp: Probe link using existing parsing helpers Date: Mon, 2 Sep 2019 13:31:06 +0200 Message-Id: <20190902113121.31323-7-thierry.reding@gmail.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190902113121.31323-1-thierry.reding@gmail.com> References: <20190902113121.31323-1-thierry.reding@gmail.com> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Pade97gqRD3FO0Cn8/jU5vMKVUfbLZBxbADpt0tfjfI=; b=I2TOZ2344suLg93q+Cd2eUj3QKUEk2wk7qno9wyQGoQ0pcQciE9TWvsv/R1enXwuaj Z/P2IGQfo6b/BsoaImzCkjIPR9u+vDIJTNgIPND73dRfzOi169aGGbDj0tmJsLi2urjU 9Dn6T+B3s3Zf+UvHen6lI0y7euzufhZSodJhwfXnwkUY7q2zL/EKnusWeISijknit2GI Y9jevzsuHHN0B3iOGhKeIaKQU1qkGiu3azV5S1KGw7N6Q8a8rkML619yTXeDVKl3wzPp uVQJGL+nB8a8ivVNH2pncp6Dg+WSmEDhMZCcsM0lMd19QDyCAAu+4+2DhQPTc1qav31g jkig== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Thierry Reding Use existing parsing helpers to probe a DisplayPort link. Reviewed-by: Philipp Zabel Signed-off-by: Thierry Reding --- drivers/gpu/drm/drm_dp_helper.c | 29 ++++++++++++++++++++++------- include/drm/drm_dp_helper.h | 2 ++ 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c index bdf999bb6cfa..cdf49e8d5e3a 100644 --- a/drivers/gpu/drm/drm_dp_helper.c +++ b/drivers/gpu/drm/drm_dp_helper.c @@ -320,6 +320,22 @@ ssize_t drm_dp_dpcd_write(struct drm_dp_aux *aux, unsigned int offset, } EXPORT_SYMBOL(drm_dp_dpcd_write); +/** + * drm_dp_dpcd_read_link_caps() - read DPCD link capabilities + * @aux: DisplayPort AUX channel + * @caps: buffer to store the link capabilities in + * + * Returns: + * The number of bytes transferred on success or a negative error code on + * failure. + */ +int drm_dp_dpcd_read_link_caps(struct drm_dp_aux *aux, + u8 caps[DP_RECEIVER_CAP_SIZE]) +{ + return drm_dp_dpcd_read(aux, DP_DPCD_REV, caps, DP_RECEIVER_CAP_SIZE); +} +EXPORT_SYMBOL(drm_dp_dpcd_read_link_caps); + /** * drm_dp_dpcd_read_link_status() - read DPCD link status (bytes 0x202-0x207) * @aux: DisplayPort AUX channel @@ -376,21 +392,20 @@ static void drm_dp_link_reset(struct drm_dp_link *link) */ int drm_dp_link_probe(struct drm_dp_aux *aux, struct drm_dp_link *link) { - u8 values[3]; + u8 values[DP_RECEIVER_CAP_SIZE]; int err; drm_dp_link_reset(link); - err = drm_dp_dpcd_read(aux, DP_DPCD_REV, values, sizeof(values)); + err = drm_dp_dpcd_read_link_caps(aux, values); if (err < 0) return err; - link->revision = values[0]; - link->max_rate = drm_dp_bw_code_to_link_rate(values[1]); - link->max_lanes = values[2] & DP_MAX_LANE_COUNT_MASK; + link->revision = values[DP_DPCD_REV]; + link->max_rate = drm_dp_max_link_rate(values); + link->max_lanes = drm_dp_max_lane_count(values); - if (values[2] & DP_ENHANCED_FRAME_CAP) - link->caps.enhanced_framing = true; + link->caps.enhanced_framing = drm_dp_enhanced_frame_cap(values); link->rate = link->max_rate; link->lanes = link->max_lanes; diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h index 2759f8d7e90d..60bb030c858d 100644 --- a/include/drm/drm_dp_helper.h +++ b/include/drm/drm_dp_helper.h @@ -1350,6 +1350,8 @@ static inline ssize_t drm_dp_dpcd_writeb(struct drm_dp_aux *aux, return drm_dp_dpcd_write(aux, offset, &value, 1); } +int drm_dp_dpcd_read_link_caps(struct drm_dp_aux *aux, + u8 caps[DP_RECEIVER_CAP_SIZE]); int drm_dp_dpcd_read_link_status(struct drm_dp_aux *aux, u8 status[DP_LINK_STATUS_SIZE]); From patchwork Mon Sep 2 11:31:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 11126439 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 9360914F7 for ; Mon, 2 Sep 2019 11:31:43 +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 7B6222173E for ; Mon, 2 Sep 2019 11:31:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7B6222173E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com 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 2242A89ACD; Mon, 2 Sep 2019 11:31:41 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0D50089A56 for ; Mon, 2 Sep 2019 11:31:40 +0000 (UTC) Received: by mail-wr1-x441.google.com with SMTP id y19so13663829wrd.3 for ; Mon, 02 Sep 2019 04:31:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=UuAX1Q/obsshJhXb3BsYkkCieyMsB5L6bSjqTkGzkgA=; b=DHAzzvobmh570rT5nVzyIgHuF+jA2DeOo+FqjKvoPnUrKAax2bde9ZaI2S3GmEP94R 9c0TOCYI1Z3S2lMHbrKUBPYJWR6n2laEQ/nZNBHO4+c8YyWnlg4Wt+UVSjfEefQiQYXE hZluEdn86hkno91IIl8QmGtAX2B+M515f3ukPVcjFnKaiPVHYrg2A2JZF+Sgsdrse1IO DGsfml8PEg1eZLA/DKucrY2tIBZj/07TXbk7fr+eW1GCc1A22YrDFgu3OWRjs+978w1R yi6JbAPF1RUkUwEhdwPTJ/Bcb75UPD2AUw/FOpLh1kjbfyuxlkmTdXqPYjrl+sXnWTvC QYwQ== X-Gm-Message-State: APjAAAVya9Ow+BGtRQ0ffdeCpya3kcQ957DAkZ3/XEs+nhHxsDM5aF5n dGbuunpSru3dDDAdyeWYJC2JfTz2 X-Google-Smtp-Source: APXvYqwnTNdAUwopfY81g4XO2b7UzS3b+tAAeSGHt+oGXOCqomhZgJX02KjLmimjXorVBnA0nJaq8w== X-Received: by 2002:adf:fdd0:: with SMTP id i16mr35433894wrs.260.1567423898327; Mon, 02 Sep 2019 04:31:38 -0700 (PDT) Received: from localhost (pD9E51890.dip0.t-ipconnect.de. [217.229.24.144]) by smtp.gmail.com with ESMTPSA id o25sm10845982wmc.36.2019.09.02.04.31.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Sep 2019 04:31:37 -0700 (PDT) From: Thierry Reding To: dri-devel@lists.freedesktop.org Subject: [PATCH v2 07/21] drm/dp: Read fast training capability from link Date: Mon, 2 Sep 2019 13:31:07 +0200 Message-Id: <20190902113121.31323-8-thierry.reding@gmail.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190902113121.31323-1-thierry.reding@gmail.com> References: <20190902113121.31323-1-thierry.reding@gmail.com> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=UuAX1Q/obsshJhXb3BsYkkCieyMsB5L6bSjqTkGzkgA=; b=ZdiRMG/WN4/0cI7eEHAFNke3U64V/QNEUhjpJO9lblAgZB/315FkLcfQtNYsX3aUIj eiqmSH9AUrkKYzMfqW2HBthTSv1tjuGwpIWXkVS/ere+CWGVI8jF5kDoLrhNmFKXn0bT HFNPTc3gv32C23rX/GCsisMIGvPfp2Wq4K3xg2boqyatBN4uoSn9nlIA+CDk2CdxmioI mwqfnZLj8BWBpoiMWfIwHbcggnVaZHdTYRQJodLWK4k2TKdjLgRs/3bJUEgIuKNVFx0o OGBxwc6NOkFx2G/eY7vanZAu4EyDGXaNkKfGg/PZrQFGy1RkkCDO08PPKRGumYluygN3 WbBA== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Thierry Reding While probing the DisplayPort link, query the fast training capability. If supported, drivers can use the fast link training sequence instead of the more involved full link training sequence. Reviewed-by: Philipp Zabel Signed-off-by: Thierry Reding --- drivers/gpu/drm/drm_dp_helper.c | 3 +++ include/drm/drm_dp_helper.h | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c index cdf49e8d5e3a..74e4fceace7e 100644 --- a/drivers/gpu/drm/drm_dp_helper.c +++ b/drivers/gpu/drm/drm_dp_helper.c @@ -355,12 +355,14 @@ EXPORT_SYMBOL(drm_dp_dpcd_read_link_status); static void drm_dp_link_caps_reset(struct drm_dp_link_caps *caps) { caps->enhanced_framing = false; + caps->fast_training = false; } void drm_dp_link_caps_copy(struct drm_dp_link_caps *dest, const struct drm_dp_link_caps *src) { dest->enhanced_framing = src->enhanced_framing; + dest->fast_training = src->fast_training; } EXPORT_SYMBOL(drm_dp_link_caps_copy); @@ -406,6 +408,7 @@ int drm_dp_link_probe(struct drm_dp_aux *aux, struct drm_dp_link *link) link->max_lanes = drm_dp_max_lane_count(values); link->caps.enhanced_framing = drm_dp_enhanced_frame_cap(values); + link->caps.fast_training = drm_dp_fast_training_cap(values); link->rate = link->max_rate; link->lanes = link->max_lanes; diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h index 60bb030c858d..c148f5685195 100644 --- a/include/drm/drm_dp_helper.h +++ b/include/drm/drm_dp_helper.h @@ -1143,6 +1143,13 @@ drm_dp_enhanced_frame_cap(const u8 dpcd[DP_RECEIVER_CAP_SIZE]) (dpcd[DP_MAX_LANE_COUNT] & DP_ENHANCED_FRAME_CAP); } +static inline bool +drm_dp_fast_training_cap(const u8 dpcd[DP_RECEIVER_CAP_SIZE]) +{ + return dpcd[DP_DPCD_REV] >= 0x11 && + (dpcd[DP_MAX_DOWNSPREAD] & DP_NO_AUX_HANDSHAKE_LINK_TRAINING); +} + static inline bool drm_dp_tps3_supported(const u8 dpcd[DP_RECEIVER_CAP_SIZE]) { @@ -1362,9 +1369,11 @@ int drm_dp_dpcd_read_link_status(struct drm_dp_aux *aux, /** * struct drm_dp_link_caps - DP link capabilities * @enhanced_framing: enhanced framing capability (mandatory as of DP 1.2) + * @fast_training: AUX CH handshake not required for link training */ struct drm_dp_link_caps { bool enhanced_framing; + bool fast_training; }; void drm_dp_link_caps_copy(struct drm_dp_link_caps *dest, From patchwork Mon Sep 2 11:31:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 11126441 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 2951E14F7 for ; Mon, 2 Sep 2019 11:31:45 +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 1152A21883 for ; Mon, 2 Sep 2019 11:31:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1152A21883 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com 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 2BBA189A34; Mon, 2 Sep 2019 11:31:44 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm1-x343.google.com (mail-wm1-x343.google.com [IPv6:2a00:1450:4864:20::343]) by gabe.freedesktop.org (Postfix) with ESMTPS id A9C0689AF3 for ; Mon, 2 Sep 2019 11:31:42 +0000 (UTC) Received: by mail-wm1-x343.google.com with SMTP id k2so12748962wmj.4 for ; Mon, 02 Sep 2019 04:31:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=0WT2p9YE2Ashh7/dR+BPduOjzmcm3MtzE5GRVv48sDY=; b=d2IiBfL9I5gI6SyVPFr5W4TmIBg1Xp6SxWEkX8/tjEXnqBbCnnOQuacC5oQIUKKvPL AdKwJTVAr10S6lMdTOrFTbzp5eLOw6yTqr/LFh8Qo+E7e6WAJygd3BL8Qrgv+fCSPmbn 4sAkMQv+CduwhSojXKgVtMEdZBdDLi3V+sKbcbbmzkh/QK3dY1jv4tRSrJekxo6bYTJj 20plU538a34HSUe0TpAsR2rkJrni5lDoBbQYX0AsEXD71OkO6yGDhEWlORycoGiwAMgG hKdSUoQtygnW0+Z8XdazermgLClunogYLMezN5Tq2FmJMQIhDeNFchy/9Qlg/AExZHOq mqag== X-Gm-Message-State: APjAAAWcGZImj5drw5CSgJI9dx9F+bbsnHmciJUoNbD69JbULYI6QYht +WGcECU5rnMafYYI/ejEpWeZA12K X-Google-Smtp-Source: APXvYqw3P36G8YH4dc4iNAyanEri3nHU9fwqCeVO3+OTFAukQRE+o6f1haizIWp/Gs+6Pb+0BQeUtQ== X-Received: by 2002:a1c:6c09:: with SMTP id h9mr1017258wmc.36.1567423900866; Mon, 02 Sep 2019 04:31:40 -0700 (PDT) Received: from localhost (pD9E51890.dip0.t-ipconnect.de. [217.229.24.144]) by smtp.gmail.com with ESMTPSA id m3sm11808970wmc.44.2019.09.02.04.31.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Sep 2019 04:31:39 -0700 (PDT) From: Thierry Reding To: dri-devel@lists.freedesktop.org Subject: [PATCH v2 08/21] drm/dp: Read TPS3 capability from sink Date: Mon, 2 Sep 2019 13:31:08 +0200 Message-Id: <20190902113121.31323-9-thierry.reding@gmail.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190902113121.31323-1-thierry.reding@gmail.com> References: <20190902113121.31323-1-thierry.reding@gmail.com> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=0WT2p9YE2Ashh7/dR+BPduOjzmcm3MtzE5GRVv48sDY=; b=l0nxk0Xpc13UhXx85TjdQwWldMLfsxgvtjmDwPU4Ru17HVpwq48kMQIo2sPjwuN8rN V73jB0WwlAPWwOAN1RWP+V4oP+lZjOKmm2xirSVnsR1YbSUZZRjfBPKJT/kpoKifWOva xcgRCuJUIVKhBtVlbV/kdHgYbZw9FRbHfBShFfTMwcoliQmyG5FKDvnvbcPPkxDEV/ID 5gX9JFb+b0TSp8WRdX/a8nLfZq+j4oQTG+WEdyDZCZS1JzmkxF7OEojmKzFrjSd0i8Xt VLnk8wESksdlNJQzBmo4ABhjFPXz28Vn8GWk3e4ZqMwR1qqU1YXNs2qiYQxlgLK7mIF/ 7KVA== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Thierry Reding The TPS3 capability can be exposed by DP 1.2 and later sinks if they support the alternative training pattern for channel equalization. Signed-off-by: Thierry Reding --- drivers/gpu/drm/drm_dp_helper.c | 3 +++ include/drm/drm_dp_helper.h | 2 ++ 2 files changed, 5 insertions(+) diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c index 74e4fceace7e..c47d78973c1e 100644 --- a/drivers/gpu/drm/drm_dp_helper.c +++ b/drivers/gpu/drm/drm_dp_helper.c @@ -355,6 +355,7 @@ EXPORT_SYMBOL(drm_dp_dpcd_read_link_status); static void drm_dp_link_caps_reset(struct drm_dp_link_caps *caps) { caps->enhanced_framing = false; + caps->tps3_supported = false; caps->fast_training = false; } @@ -362,6 +363,7 @@ void drm_dp_link_caps_copy(struct drm_dp_link_caps *dest, const struct drm_dp_link_caps *src) { dest->enhanced_framing = src->enhanced_framing; + dest->tps3_supported = src->tps3_supported; dest->fast_training = src->fast_training; } EXPORT_SYMBOL(drm_dp_link_caps_copy); @@ -408,6 +410,7 @@ int drm_dp_link_probe(struct drm_dp_aux *aux, struct drm_dp_link *link) link->max_lanes = drm_dp_max_lane_count(values); link->caps.enhanced_framing = drm_dp_enhanced_frame_cap(values); + link->caps.tps3_supported = drm_dp_tps3_supported(values); link->caps.fast_training = drm_dp_fast_training_cap(values); link->rate = link->max_rate; diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h index c148f5685195..ab98ebb302a9 100644 --- a/include/drm/drm_dp_helper.h +++ b/include/drm/drm_dp_helper.h @@ -1369,10 +1369,12 @@ int drm_dp_dpcd_read_link_status(struct drm_dp_aux *aux, /** * struct drm_dp_link_caps - DP link capabilities * @enhanced_framing: enhanced framing capability (mandatory as of DP 1.2) + * @tps3_supported: training pattern sequence 3 supported for equalization * @fast_training: AUX CH handshake not required for link training */ struct drm_dp_link_caps { bool enhanced_framing; + bool tps3_supported; bool fast_training; }; From patchwork Mon Sep 2 11:31:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 11126445 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 EBA9814F7 for ; Mon, 2 Sep 2019 11:31:46 +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 D3E7F21882 for ; Mon, 2 Sep 2019 11:31:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D3E7F21882 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com 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 C45CC89AF3; Mon, 2 Sep 2019 11:31:45 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) by gabe.freedesktop.org (Postfix) with ESMTPS id 863EB89AF3 for ; Mon, 2 Sep 2019 11:31:44 +0000 (UTC) Received: by mail-wr1-x443.google.com with SMTP id l11so4834380wrx.5 for ; Mon, 02 Sep 2019 04:31:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=e7Xsv2Cgzc/LOhD+/++Nzp5vNva2EjBIgaO7wKng8Rc=; b=XYApuBqFgoaC/m6GQYuXg4fxNMCZJ0jnrXz1EiWQ3VOuRWHp6iGc1Pmz3+hYz6qMaw zJKDYHTRzw5gga2q1NT95goF+C/9lsWbDNIfUF0xNl798o3g/CX/yID6PdNSlFKxiWGJ q21n2SWpp1eO+n630+0X+wOgl89jGLvDiw1plRXZ/qHjEXccUQWtwsaFolMwtHTkB652 sW+XVZaez4Q5Puz/efjRFzNtpCOD5flS84Ajg/3dLeTA+gl7R9hA3gh2pV0FriZz+Q34 Tl4uHsnV04QhWUOV47AAOgesuyBvZh09gDUA1vhijO78DJ29Sgghwewj3JHQoScES4ID dVNQ== X-Gm-Message-State: APjAAAWsNN+YhTm0NM1SyuB+ly9z1ZM/CRH4nark4RxMXMFBVFjAOuPC nWX44BCjT8EDo0V/NEixJQsxThKi X-Google-Smtp-Source: APXvYqyEEtJOyvBeDrZd+IukiURPXI0ZeOXFV5ko4HASziwcPwpQY1tz+iUIfDsrvLw44HMzTYdQ0w== X-Received: by 2002:adf:fd03:: with SMTP id e3mr26927710wrr.291.1567423902735; Mon, 02 Sep 2019 04:31:42 -0700 (PDT) Received: from localhost (pD9E51890.dip0.t-ipconnect.de. [217.229.24.144]) by smtp.gmail.com with ESMTPSA id r5sm13027756wmh.35.2019.09.02.04.31.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Sep 2019 04:31:41 -0700 (PDT) From: Thierry Reding To: dri-devel@lists.freedesktop.org Subject: [PATCH v2 09/21] drm/dp: Read channel coding capability from sink Date: Mon, 2 Sep 2019 13:31:09 +0200 Message-Id: <20190902113121.31323-10-thierry.reding@gmail.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190902113121.31323-1-thierry.reding@gmail.com> References: <20190902113121.31323-1-thierry.reding@gmail.com> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=e7Xsv2Cgzc/LOhD+/++Nzp5vNva2EjBIgaO7wKng8Rc=; b=MVmeltBuQfn94cSndU8qSvHTnSB9o2C/vWVMmvbTkKDKnR79aPB3xFPV3cUtJTxlqF KvG+vtgfe2hrLb5ZjGHE4cVmbtYK8LAa2Hqlf954gJqiG8ugib4hbG39JiD8xn1K+K2s y2nGY8eCXfSWTAwilmGRA9Sc4wwW4daGTwYWxVBuz0beUiwh66WgSVZw7ivuY4WLfqc0 7n6tA0iVPpdbUvDxSLLuuI2QbeE9pXrMkj6xLXaaQy+UADJsjYvy8G1NbZcKZUb2t053 SsYfFAihhR18f/DOvQ+Mxxv8OgOnq78xb1EXkH7qaonmywMms7q8uJVyP8smFpRJuS4O FA0g== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Thierry Reding Parse from the sink capabilities whether or not it supports ANSI 8B/10B channel coding as specified in ANSI X3.230-1994, clause 11. Signed-off-by: Thierry Reding --- drivers/gpu/drm/drm_dp_helper.c | 3 +++ include/drm/drm_dp_helper.h | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c index c47d78973c1e..1c238196c8b4 100644 --- a/drivers/gpu/drm/drm_dp_helper.c +++ b/drivers/gpu/drm/drm_dp_helper.c @@ -357,6 +357,7 @@ static void drm_dp_link_caps_reset(struct drm_dp_link_caps *caps) caps->enhanced_framing = false; caps->tps3_supported = false; caps->fast_training = false; + caps->channel_coding = false; } void drm_dp_link_caps_copy(struct drm_dp_link_caps *dest, @@ -365,6 +366,7 @@ void drm_dp_link_caps_copy(struct drm_dp_link_caps *dest, dest->enhanced_framing = src->enhanced_framing; dest->tps3_supported = src->tps3_supported; dest->fast_training = src->fast_training; + dest->channel_coding = src->channel_coding; } EXPORT_SYMBOL(drm_dp_link_caps_copy); @@ -412,6 +414,7 @@ int drm_dp_link_probe(struct drm_dp_aux *aux, struct drm_dp_link *link) link->caps.enhanced_framing = drm_dp_enhanced_frame_cap(values); link->caps.tps3_supported = drm_dp_tps3_supported(values); link->caps.fast_training = drm_dp_fast_training_cap(values); + link->caps.channel_coding = drm_dp_channel_coding_supported(values); link->rate = link->max_rate; link->lanes = link->max_lanes; diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h index ab98ebb302a9..d144d3a54dbc 100644 --- a/include/drm/drm_dp_helper.h +++ b/include/drm/drm_dp_helper.h @@ -95,6 +95,7 @@ # define DP_DETAILED_CAP_INFO_AVAILABLE (1 << 4) /* DPI */ #define DP_MAIN_LINK_CHANNEL_CODING 0x006 +# define DP_CAP_ANSI_8B10B (1 << 0) #define DP_DOWN_STREAM_PORT_COUNT 0x007 # define DP_PORT_COUNT_MASK 0x0f @@ -1215,6 +1216,12 @@ drm_dp_sink_supports_fec(const u8 fec_capable) return fec_capable & DP_FEC_CAPABLE; } +static inline bool +drm_dp_channel_coding_supported(const u8 dpcd[DP_RECEIVER_CAP_SIZE]) +{ + return dpcd[DP_MAIN_LINK_CHANNEL_CODING] & DP_CAP_ANSI_8B10B; +} + /* * DisplayPort AUX channel */ @@ -1371,11 +1378,13 @@ int drm_dp_dpcd_read_link_status(struct drm_dp_aux *aux, * @enhanced_framing: enhanced framing capability (mandatory as of DP 1.2) * @tps3_supported: training pattern sequence 3 supported for equalization * @fast_training: AUX CH handshake not required for link training + * @channel_coding: ANSI 8B/10B channel coding capability */ struct drm_dp_link_caps { bool enhanced_framing; bool tps3_supported; bool fast_training; + bool channel_coding; }; void drm_dp_link_caps_copy(struct drm_dp_link_caps *dest, From patchwork Mon Sep 2 11:31:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 11126447 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 3429E1813 for ; Mon, 2 Sep 2019 11:31:49 +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 1C7142173E for ; Mon, 2 Sep 2019 11:31:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1C7142173E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com 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 77E5A89B18; Mon, 2 Sep 2019 11:31:48 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by gabe.freedesktop.org (Postfix) with ESMTPS id DBBDD89B11 for ; Mon, 2 Sep 2019 11:31:46 +0000 (UTC) Received: by mail-wr1-x442.google.com with SMTP id l11so4834497wrx.5 for ; Mon, 02 Sep 2019 04:31:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=L4ruOAToiXpCU08bJrG8nExsBOMrBoTzi+fzNHaPKDo=; b=cvRh6S9QM0tMoDZRHpu78XdNXA9S1kVBlyk7mxKcsGjGAg4zWbiM8OYV2FMKTSlbfq tRIQKiKq/YoZYB90zX02+g20DHDNmO81yUvJOPofkgvZPIFoFvADdCWePXqE00ZT8gLM I6lr2dr9DsK4dMgzLvRR+TJ3KLQnQ/xExT6BQEv4jwVDOViv0HmbT7+HIth6jLACuVuy jpf3MIhkEcJsGMf3t5L9/9QmZeZYOiRIW5AosOXm7RBMXw+RuzWQU+FXpB481igup+f6 nBR4a9AvW5yzcszsMdpqSaaJy+Hpe/0iZI3fuLv8nHUET1w+DJ3FK44LEp0tNT0xhOqO 4VqQ== X-Gm-Message-State: APjAAAVibB6xEFoN2KQuJVk6+6ZUd0RHvTAZp1pkZassdta8AYm7ikhJ 6kJfykFdxZPYa31nKQ0GIKZkXrYU X-Google-Smtp-Source: APXvYqyTQoBSxfCHHMjpd1LCt9c4czqXUCOrPsRM2UbpPl3UphcSjBBZPRe+8YG4xGukhlS8P9jtgQ== X-Received: by 2002:adf:c508:: with SMTP id q8mr35193985wrf.287.1567423904860; Mon, 02 Sep 2019 04:31:44 -0700 (PDT) Received: from localhost (pD9E51890.dip0.t-ipconnect.de. [217.229.24.144]) by smtp.gmail.com with ESMTPSA id u186sm37367050wmu.26.2019.09.02.04.31.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Sep 2019 04:31:43 -0700 (PDT) From: Thierry Reding To: dri-devel@lists.freedesktop.org Subject: [PATCH v2 10/21] drm/dp: Read alternate scrambler reset capability from sink Date: Mon, 2 Sep 2019 13:31:10 +0200 Message-Id: <20190902113121.31323-11-thierry.reding@gmail.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190902113121.31323-1-thierry.reding@gmail.com> References: <20190902113121.31323-1-thierry.reding@gmail.com> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=L4ruOAToiXpCU08bJrG8nExsBOMrBoTzi+fzNHaPKDo=; b=uew4Cb/U9ps/9yWvFN5zYfSnSttPgPkccdwN8RAVlak2qLsuiarDd7iXl5H45peVfz mTj3r+VKAWbTdTkGaMezyj51nsmjmzFqpxbFfErE5IAFBEwaW5deC9eFkiMMg1U+myDz 1OXG81whCYZVIV+JFD3Opd1JUmvhQD7ZtzqGuoNHkpL5pagG3Wnixn6Ks8njZDGWD8Ri RS0U15CDsYkGuH7iqFHb+kbehPvoYy8OTS+AHW72eZzcRpkrWudf8L4fMvK23duqagPw gbzmCAS/qeBAfWZOnitWq0QwhEcz1RDVAMhyAG9by1tt5z6h3giGk2Y21aMP1ykUYoDy +3fA== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Thierry Reding Parse from the sink capabilities whether or not the eDP alternate scrambler reset value of 0xfffe is supported. Signed-off-by: Thierry Reding --- drivers/gpu/drm/drm_dp_helper.c | 5 +++++ include/drm/drm_dp_helper.h | 9 +++++++++ 2 files changed, 14 insertions(+) diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c index 1c238196c8b4..acab8dc48e2c 100644 --- a/drivers/gpu/drm/drm_dp_helper.c +++ b/drivers/gpu/drm/drm_dp_helper.c @@ -358,6 +358,7 @@ static void drm_dp_link_caps_reset(struct drm_dp_link_caps *caps) caps->tps3_supported = false; caps->fast_training = false; caps->channel_coding = false; + caps->alternate_scrambler_reset = false; } void drm_dp_link_caps_copy(struct drm_dp_link_caps *dest, @@ -367,6 +368,7 @@ void drm_dp_link_caps_copy(struct drm_dp_link_caps *dest, dest->tps3_supported = src->tps3_supported; dest->fast_training = src->fast_training; dest->channel_coding = src->channel_coding; + dest->alternate_scrambler_reset = src->alternate_scrambler_reset; } EXPORT_SYMBOL(drm_dp_link_caps_copy); @@ -416,6 +418,9 @@ int drm_dp_link_probe(struct drm_dp_aux *aux, struct drm_dp_link *link) link->caps.fast_training = drm_dp_fast_training_cap(values); link->caps.channel_coding = drm_dp_channel_coding_supported(values); + if (drm_dp_alternate_scrambler_reset_cap(values)) + link->caps.alternate_scrambler_reset = true; + link->rate = link->max_rate; link->lanes = link->max_lanes; diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h index d144d3a54dbc..f9f65bc13df5 100644 --- a/include/drm/drm_dp_helper.h +++ b/include/drm/drm_dp_helper.h @@ -1222,6 +1222,13 @@ drm_dp_channel_coding_supported(const u8 dpcd[DP_RECEIVER_CAP_SIZE]) return dpcd[DP_MAIN_LINK_CHANNEL_CODING] & DP_CAP_ANSI_8B10B; } +static inline bool +drm_dp_alternate_scrambler_reset_cap(const u8 dpcd[DP_RECEIVER_CAP_SIZE]) +{ + return dpcd[DP_EDP_CONFIGURATION_CAP] & + DP_ALTERNATE_SCRAMBLER_RESET_CAP; +} + /* * DisplayPort AUX channel */ @@ -1379,12 +1386,14 @@ int drm_dp_dpcd_read_link_status(struct drm_dp_aux *aux, * @tps3_supported: training pattern sequence 3 supported for equalization * @fast_training: AUX CH handshake not required for link training * @channel_coding: ANSI 8B/10B channel coding capability + * @alternate_scrambler_reset: eDP alternate scrambler reset capability */ struct drm_dp_link_caps { bool enhanced_framing; bool tps3_supported; bool fast_training; bool channel_coding; + bool alternate_scrambler_reset; }; void drm_dp_link_caps_copy(struct drm_dp_link_caps *dest, From patchwork Mon Sep 2 11:31:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 11126449 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 7F9091398 for ; Mon, 2 Sep 2019 11:31:51 +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 681B0217F4 for ; Mon, 2 Sep 2019 11:31:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 681B0217F4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com 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 CA34989C0A; Mon, 2 Sep 2019 11:31:50 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm1-x343.google.com (mail-wm1-x343.google.com [IPv6:2a00:1450:4864:20::343]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8419489B4D for ; Mon, 2 Sep 2019 11:31:48 +0000 (UTC) Received: by mail-wm1-x343.google.com with SMTP id n2so12834299wmk.4 for ; Mon, 02 Sep 2019 04:31:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4cI0RzXFJqVYGs/mCO/Yp6qhv0wC7A7glB5J5f3Qjj0=; b=Utq/F3Fon49qvblyUhAQN4rzxkQ3VyYnHnQ9ry5EHzrPRBtmh6S9vFW6W/hjuvb299 JVkPwc6OgHlQs5VnVsLawaqJ/+q501XGUAMoAtaoaU8b6HBBpwMu9V+EOWIEax7VqY+E cFoBSI5XQDG+Q8CKWFhnZ1BV9fVze6Re6zEVJ3YTQJEEZIQSPGwNfzIXarIi9ZDBYyyY 6lumwRjgVxroEnhVSxnG1btGbA20lfcOP6/Gvtcx+ViPRTKEK/jRTsrsBfx9t5O7EYoH 5BVMElX1O4byHhhZtWpTtjyA7IEHcnw6XtMn0JgWi3eAYUIaSXchmz3gPG/9BiEdAiDS zQsA== X-Gm-Message-State: APjAAAVyGxuTiHCVDWeTtyImsz5DJsY2z+vpzivqO4J+XrMJgkKZ7AfI 946hdOFZIC2f9wM4SKrpOnPA5Pcx X-Google-Smtp-Source: APXvYqwCkEH/uhTaeY4o/td/dlm8rtvdHXLLkL77ZFGNzsqxAmhQr8z+YuZ/Y8z2W47fUn3HBCKbgA== X-Received: by 2002:a1c:a713:: with SMTP id q19mr36161652wme.127.1567423906744; Mon, 02 Sep 2019 04:31:46 -0700 (PDT) Received: from localhost (pD9E51890.dip0.t-ipconnect.de. [217.229.24.144]) by smtp.gmail.com with ESMTPSA id g201sm12046579wmg.34.2019.09.02.04.31.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Sep 2019 04:31:45 -0700 (PDT) From: Thierry Reding To: dri-devel@lists.freedesktop.org Subject: [PATCH v2 11/21] drm/dp: Read eDP version from DPCD Date: Mon, 2 Sep 2019 13:31:11 +0200 Message-Id: <20190902113121.31323-12-thierry.reding@gmail.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190902113121.31323-1-thierry.reding@gmail.com> References: <20190902113121.31323-1-thierry.reding@gmail.com> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=4cI0RzXFJqVYGs/mCO/Yp6qhv0wC7A7glB5J5f3Qjj0=; b=V2bKVBhNYFQ9jQjCmyDpvjGvibaqgv3HwUFqeI/hnccutRmQwVVhu7w3+XF3Pk7D7X voBltxtca5+O7qn336AiwnNerg6GpOvrNbNTZ93jb2ISkGmibPwxIcuGxfO0bDG99Iwx dIUoNiP3SVvpP/zPlVO0+BlDVzZsNUe8BmiafoMlZ9qK7Enm2ZwHD2idTbnuigCFP5Eb 7EWZuxPPwVV6NdJmZ7LJ0MoDms/2+akYMOfJzwvCW/g8vQIZPcGYi2NJqTizDljLkUt1 IdByB00sgCJnlwAVUBxkDSberE3RH79LLheS1j2SpkviIyJCSAZ81Sd4FxnBEepiIOpj 4BRg== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Thierry Reding If the sink supports eDP, read the eDP revision from it's DPCD. Signed-off-by: Thierry Reding --- drivers/gpu/drm/drm_dp_helper.c | 16 +++++++++++++++- include/drm/drm_dp_helper.h | 2 ++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c index acab8dc48e2c..5b36e8e39ca7 100644 --- a/drivers/gpu/drm/drm_dp_helper.c +++ b/drivers/gpu/drm/drm_dp_helper.c @@ -382,6 +382,7 @@ static void drm_dp_link_reset(struct drm_dp_link *link) link->max_lanes = 0; drm_dp_link_caps_reset(&link->caps); + link->edp = 0; link->rate = 0; link->lanes = 0; @@ -418,9 +419,22 @@ int drm_dp_link_probe(struct drm_dp_aux *aux, struct drm_dp_link *link) link->caps.fast_training = drm_dp_fast_training_cap(values); link->caps.channel_coding = drm_dp_channel_coding_supported(values); - if (drm_dp_alternate_scrambler_reset_cap(values)) + if (drm_dp_alternate_scrambler_reset_cap(values)) { + static const u8 edp_revs[] = { 0x11, 0x12, 0x13, 0x14 }; + u8 value; + link->caps.alternate_scrambler_reset = true; + err = drm_dp_dpcd_readb(aux, DP_EDP_DPCD_REV, &value); + if (err < 0) + return err; + + if (value >= ARRAY_SIZE(edp_revs)) + DRM_ERROR("unsupported eDP version: %02x\n", value); + else + link->edp = edp_revs[value]; + } + link->rate = link->max_rate; link->lanes = link->max_lanes; diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h index f9f65bc13df5..13c50e905205 100644 --- a/include/drm/drm_dp_helper.h +++ b/include/drm/drm_dp_helper.h @@ -1405,6 +1405,7 @@ void drm_dp_link_caps_copy(struct drm_dp_link_caps *dest, * @max_rate: maximum clock rate supported on the link * @max_lanes: maximum number of lanes supported on the link * @caps: capabilities supported on the link (see &drm_dp_link_caps) + * @edp: eDP revision (0x11: eDP 1.1, 0x12: eDP 1.2, ...) * @rate: currently configured link rate * @lanes: currently configured number of lanes */ @@ -1414,6 +1415,7 @@ struct drm_dp_link { unsigned int max_lanes; struct drm_dp_link_caps caps; + unsigned char edp; unsigned int rate; unsigned int lanes; From patchwork Mon Sep 2 11:31:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 11126451 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 756331398 for ; Mon, 2 Sep 2019 11:31:53 +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 5D9482173E for ; Mon, 2 Sep 2019 11:31:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5D9482173E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com 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 7753789C16; Mon, 2 Sep 2019 11:31:52 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) by gabe.freedesktop.org (Postfix) with ESMTPS id A5B7B89C09 for ; Mon, 2 Sep 2019 11:31:50 +0000 (UTC) Received: by mail-wr1-x443.google.com with SMTP id 30so2710065wrk.11 for ; Mon, 02 Sep 2019 04:31:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Da+vbmfhaJycNBymoZETIocQDocdZDLcYeBn4es5U/A=; b=U5Xb/APoiU70R+Hta+7IWAz8/uJqlid11Jv+BdPSt2KtCoABOilTP4/GmzGawYT6Ev Tnm+cXoejVc9UbDoEFkVUn+7nXhIXAyrH44Agt4XkJ7v/mAvLmwcdmVv9g18aTYAajjV /Of2erqvgaAaAqJ3xP5YP6KObF4ZY7GV66OedwXCiDrIrwqssfqW4bioUeKyE4hJOhoG KqYrjlUZuhgsxPLNhr+ilIfCOx9kO5MqXuGEsF6M26bTI8oNENvoV9YugBhM/xJ7GUee eaNCHkknixwJdZIjTGVDEPpqWOcczhnvE9PTqRKV1lEH0yj03e2YjIiP5JAwKyi3o0Pf 2GLg== X-Gm-Message-State: APjAAAUNmsZSaNJXv8IziEGZFBhhdqwn8RZ2Aku3gc/8vWoJ66RLvt2q 3sub/VgnGTtRhAxM+XLQA7nEs4Y2 X-Google-Smtp-Source: APXvYqz6s3ZvkhLttyYq6oqPP3A9ehy/EB2EJoRDq35gF3bh7MiyMNquBTeGEpgS7C0/kqCnrCVaBg== X-Received: by 2002:adf:ffca:: with SMTP id x10mr27181160wrs.190.1567423908747; Mon, 02 Sep 2019 04:31:48 -0700 (PDT) Received: from localhost (pD9E51890.dip0.t-ipconnect.de. [217.229.24.144]) by smtp.gmail.com with ESMTPSA id w1sm16998779wrm.38.2019.09.02.04.31.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Sep 2019 04:31:47 -0700 (PDT) From: Thierry Reding To: dri-devel@lists.freedesktop.org Subject: [PATCH v2 12/21] drm/dp: Read AUX read interval from DPCD Date: Mon, 2 Sep 2019 13:31:12 +0200 Message-Id: <20190902113121.31323-13-thierry.reding@gmail.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190902113121.31323-1-thierry.reding@gmail.com> References: <20190902113121.31323-1-thierry.reding@gmail.com> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Da+vbmfhaJycNBymoZETIocQDocdZDLcYeBn4es5U/A=; b=GPJ3DQthnM5FDVgqNSFvCzxxBL5g4FvFi6EWzl/1Xmt/ZqvF1f5wZyRycvku+ubtgy Y5+wPC8MdGV7Fh4xyvKfvFIALOrdeTbaWhjHIAzBHF+QTgQuqGBh5uUzJEfl4g7gMHWP uvm6ObbeJ5I+y6cX53VBtoWZUUU1+WrXxUrLCjQqZUq1ljONuyQmQwm6Hok5KRxjTOkt MoPZLExiUgIkTfkj9HJ4QOfjGDvVvQHuS9lH7PRM9UKHWTx6DpHABpzaSWtgwv2XpmaZ 7BhcAQnjqEs+NFFdzKqsJTi8bJSUMOFfQ1Dl+nZUd7CUSGpjkxN2AFgUKSqZOmgBfm1w 8HsQ== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Thierry Reding Store the AUX read interval from DPCD, so that it can be used to wait for the durations given in the specification during link training. v2: use USEC_PER_MSEC instead of MSEC_PER_SEC for clarity Signed-off-by: Thierry Reding --- drivers/gpu/drm/drm_dp_helper.c | 3 +++ include/drm/drm_dp_helper.h | 35 +++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c index 5b36e8e39ca7..4112570dbe67 100644 --- a/drivers/gpu/drm/drm_dp_helper.c +++ b/drivers/gpu/drm/drm_dp_helper.c @@ -382,6 +382,7 @@ static void drm_dp_link_reset(struct drm_dp_link *link) link->max_lanes = 0; drm_dp_link_caps_reset(&link->caps); + link->aux_rd_interval = 0; link->edp = 0; link->rate = 0; @@ -435,6 +436,8 @@ int drm_dp_link_probe(struct drm_dp_aux *aux, struct drm_dp_link *link) link->edp = edp_revs[value]; } + link->aux_rd_interval = drm_dp_aux_rd_interval(values); + link->rate = link->max_rate; link->lanes = link->max_lanes; diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h index 13c50e905205..e28b0941a8be 100644 --- a/include/drm/drm_dp_helper.h +++ b/include/drm/drm_dp_helper.h @@ -25,8 +25,11 @@ #include #include +#include #include +#include + /* * Unless otherwise noted, all values are from the DP 1.1a spec. Note that * DP and DPCD versions are independent. Differences from 1.0 are not noted, @@ -1229,6 +1232,36 @@ drm_dp_alternate_scrambler_reset_cap(const u8 dpcd[DP_RECEIVER_CAP_SIZE]) DP_ALTERNATE_SCRAMBLER_RESET_CAP; } +/** + * drm_dp_read_aux_interval() - read the AUX read interval from the DPCD + * @dpcd: receiver capacity buffer + * + * Reads the AUX read interval (in microseconds) from the DPCD. Note that the + * TRAINING_AUX_RD_INTERVAL stores the value in units of 4 milliseconds. If no + * read interval is specified and for DPCD v1.4 and later, the read interval + * is always 100 microseconds. + * + * Returns: + * The read AUX interval in microseconds. + */ +static inline unsigned int +drm_dp_aux_rd_interval(const u8 dpcd[DP_RECEIVER_CAP_SIZE]) +{ + unsigned int rd_interval = dpcd[DP_TRAINING_AUX_RD_INTERVAL] & + DP_TRAINING_AUX_RD_MASK; + + if (rd_interval > 4) + DRM_DEBUG_KMS("AUX interval %u, out of range (max: 4)\n", + rd_interval); + + if (rd_interval > 0 && dpcd[DP_DPCD_REV] < DP_DPCD_REV_14) + rd_interval *= 4 * USEC_PER_MSEC; + else + rd_interval = 100; + + return rd_interval; +} + /* * DisplayPort AUX channel */ @@ -1405,6 +1438,7 @@ void drm_dp_link_caps_copy(struct drm_dp_link_caps *dest, * @max_rate: maximum clock rate supported on the link * @max_lanes: maximum number of lanes supported on the link * @caps: capabilities supported on the link (see &drm_dp_link_caps) + * @aux_rd_interval: AUX read interval to use for training (in microseconds) * @edp: eDP revision (0x11: eDP 1.1, 0x12: eDP 1.2, ...) * @rate: currently configured link rate * @lanes: currently configured number of lanes @@ -1415,6 +1449,7 @@ struct drm_dp_link { unsigned int max_lanes; struct drm_dp_link_caps caps; + unsigned int aux_rd_interval; unsigned char edp; unsigned int rate; From patchwork Mon Sep 2 11:31:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 11126453 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 3E10314F7 for ; Mon, 2 Sep 2019 11:31:55 +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 266DF217D7 for ; Mon, 2 Sep 2019 11:31:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 266DF217D7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com 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 CF34189C14; Mon, 2 Sep 2019 11:31:53 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6289B89C14 for ; Mon, 2 Sep 2019 11:31:52 +0000 (UTC) Received: by mail-wr1-x441.google.com with SMTP id c3so13648530wrd.7 for ; Mon, 02 Sep 2019 04:31:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=srBm4Ktgq0cSVneUfh1AFH6P8a+ZVsFKSo7DHCjJP98=; b=mBfDgHa5DOs7+Ew8ovJt8kanjhnilywcJbkxAcumWzGWVS4KiOo9X9wnklWcijAI+y rtCslLHQbCQA1uvPdE4HNjzUhyDQef+rOTvxDeWjkcCFsV5vSNK5f0tpY0aihwsmfN+7 7JOWp/yH2Q+dqHWkuePFZi1g5MZwqKseW+vIHKcl8bwmmVVkmhkDn2Q9ZLmaqWK3LZA2 O5hZh7zXxFPbAJvPNScu6U5RMd2qbkiKq869e3XT0qAlxGFOov2Q6WkGaJ0+CLatu+mS x3PV9WvkOwx9odSiDo9KtQi+v6Vwrtsy0B+JB4Yjy4z7Zs88FF1J6UNkT5+Mz7mh7GBO 0dGg== X-Gm-Message-State: APjAAAUngR6wVbfkaYmY7dZ/gLndUIaKOV0aRRGN/UlPgqvZ4Syxpkki 037mAZv1/bQkN0T/II91MC4SUoPp X-Google-Smtp-Source: APXvYqyFb5J6REviV0856UT1/10jUrih7nXTlNVYeuiLIkDY0NJT/zBIc9u+M2orLOebv4wX83kv/A== X-Received: by 2002:adf:f1c4:: with SMTP id z4mr5628133wro.319.1567423910634; Mon, 02 Sep 2019 04:31:50 -0700 (PDT) Received: from localhost (pD9E51890.dip0.t-ipconnect.de. [217.229.24.144]) by smtp.gmail.com with ESMTPSA id s26sm2451060wrs.63.2019.09.02.04.31.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Sep 2019 04:31:49 -0700 (PDT) From: Thierry Reding To: dri-devel@lists.freedesktop.org Subject: [PATCH v2 13/21] drm/dp: Do not busy-loop during link training Date: Mon, 2 Sep 2019 13:31:13 +0200 Message-Id: <20190902113121.31323-14-thierry.reding@gmail.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190902113121.31323-1-thierry.reding@gmail.com> References: <20190902113121.31323-1-thierry.reding@gmail.com> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=srBm4Ktgq0cSVneUfh1AFH6P8a+ZVsFKSo7DHCjJP98=; b=nzHi/GxT5/ePnSwlgdwg5Va5pE4LyBlxarwHq4CSBmlo2AeiAq2Wj39hYZVY2hZ+SQ x4MLwhPd2ua9ggE8JPcwGXP0v+w7a+jP42dUwu3qVzcBVp2ZfaOtELHgB4UWw17GPmY8 5AumQL7C0Va315qKXmYUE9/9VRVGMeprPJsHuldD7XDh0g5HzbiufV92vQYCxrYnIbu5 mla1XtlvtgmTmn6Hxd2l+k/L507fMUmQ15yFtu1k+J0IwEitTY1Nu76TD087cBcvD/2k Liyz2cRyy+wo23WrWr4HLLYUOs4/VjgYVZ69WPkQ9dbo5/4A+STqZ9/5uIv/bvD87Cjg ECww== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Thierry Reding Use microsecond sleeps for the clock recovery and channel equalization delays during link training. The duration of these delays can be from 100 us up to 16 ms. It is rude to busy-loop for that amount of time. While at it, also convert to standard coding style by putting the opening braces in a function definition on a new line. v2: use correct multiplier for training delays (Philipp Zabel) Signed-off-by: Thierry Reding --- drivers/gpu/drm/drm_dp_helper.c | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c index 4112570dbe67..681d28988776 100644 --- a/drivers/gpu/drm/drm_dp_helper.c +++ b/drivers/gpu/drm/drm_dp_helper.c @@ -120,33 +120,39 @@ u8 drm_dp_get_adjust_request_pre_emphasis(const u8 link_status[DP_LINK_STATUS_SI } EXPORT_SYMBOL(drm_dp_get_adjust_request_pre_emphasis); -void drm_dp_link_train_clock_recovery_delay(const u8 dpcd[DP_RECEIVER_CAP_SIZE]) { - int rd_interval = dpcd[DP_TRAINING_AUX_RD_INTERVAL] & - DP_TRAINING_AUX_RD_MASK; +void drm_dp_link_train_clock_recovery_delay(const u8 dpcd[DP_RECEIVER_CAP_SIZE]) +{ + unsigned int rd_interval = dpcd[DP_TRAINING_AUX_RD_INTERVAL] & + DP_TRAINING_AUX_RD_MASK; if (rd_interval > 4) - DRM_DEBUG_KMS("AUX interval %d, out of range (max 4)\n", + DRM_DEBUG_KMS("AUX interval %u, out of range (max 4)\n", rd_interval); if (rd_interval == 0 || dpcd[DP_DPCD_REV] >= DP_DPCD_REV_14) - udelay(100); + rd_interval = 100; else - mdelay(rd_interval * 4); + rd_interval *= 4 * USEC_PER_MSEC; + + usleep_range(rd_interval, rd_interval * 2); } EXPORT_SYMBOL(drm_dp_link_train_clock_recovery_delay); -void drm_dp_link_train_channel_eq_delay(const u8 dpcd[DP_RECEIVER_CAP_SIZE]) { - int rd_interval = dpcd[DP_TRAINING_AUX_RD_INTERVAL] & - DP_TRAINING_AUX_RD_MASK; +void drm_dp_link_train_channel_eq_delay(const u8 dpcd[DP_RECEIVER_CAP_SIZE]) +{ + unsigned int rd_interval = dpcd[DP_TRAINING_AUX_RD_INTERVAL] & + DP_TRAINING_AUX_RD_MASK; if (rd_interval > 4) - DRM_DEBUG_KMS("AUX interval %d, out of range (max 4)\n", + DRM_DEBUG_KMS("AUX interval %u, out of range (max 4)\n", rd_interval); if (rd_interval == 0) - udelay(400); + rd_interval = 400; else - mdelay(rd_interval * 4); + rd_interval *= 4 * USEC_PER_MSEC; + + usleep_range(rd_interval, rd_interval * 2); } EXPORT_SYMBOL(drm_dp_link_train_channel_eq_delay); From patchwork Mon Sep 2 11:31:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 11126455 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 9F37814F7 for ; Mon, 2 Sep 2019 11:31:57 +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 8785B22DBF for ; Mon, 2 Sep 2019 11:31:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8785B22DBF Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com 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 C16AF89C1C; Mon, 2 Sep 2019 11:31:56 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm1-x343.google.com (mail-wm1-x343.google.com [IPv6:2a00:1450:4864:20::343]) by gabe.freedesktop.org (Postfix) with ESMTPS id ABA9789C18 for ; Mon, 2 Sep 2019 11:31:54 +0000 (UTC) Received: by mail-wm1-x343.google.com with SMTP id o184so14223092wme.3 for ; Mon, 02 Sep 2019 04:31:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gPcDkSG7gGNdAp3jF4yBee9f6RzA+evCrH2htnpmEAI=; b=kIQ4g6JYb/jtUex34f+S0a6SzUhvQhPjL9ek6XNbpmQw53GOF5cBkvqlFQ2ZdO0ug/ nMD4k64L27Ya91ucjLlZ7npm/QHawETV4ruFFJLq9gJRjRSJYqxLJhSyDnuDtoHpRsNs lWTfWFjACJG+u86vaiw8qb0irkRlpJNQbvPaQ5pIhrmpgnSky8nUUOir7ZXw1tn2DdDd /eVfh1cPhJiIrbdFBplp618h9gT5piFGtHRIQu8XwriNl4oIjKc9k6XSlZzj+i/4a+s0 g+20nzxpAZG02AHJ3Qh33zYeZeAW9K49xHgRm0Ex4i31nqqjfpzIjgUHQNuL1s7SiFv+ ebxg== X-Gm-Message-State: APjAAAUIWOG4WCgnvemlHszo845+hz34fzGUO1DSAkwxZta+WIMjBxip +/8CQ0IVRH38NG/wWcE9IE+9v+Q6 X-Google-Smtp-Source: APXvYqxOREgolMdzNUytaoZjrD7kMzyGHI21uXVQD2wJ0yDQ4lKo4GZpkkVY+CWNKRxa1kQOg9qgfQ== X-Received: by 2002:a7b:cf37:: with SMTP id m23mr7988392wmg.53.1567423912812; Mon, 02 Sep 2019 04:31:52 -0700 (PDT) Received: from localhost (pD9E51890.dip0.t-ipconnect.de. [217.229.24.144]) by smtp.gmail.com with ESMTPSA id d9sm1189091wrc.39.2019.09.02.04.31.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Sep 2019 04:31:51 -0700 (PDT) From: Thierry Reding To: dri-devel@lists.freedesktop.org Subject: [PATCH v2 14/21] drm/dp: Use drm_dp_aux_rd_interval() Date: Mon, 2 Sep 2019 13:31:14 +0200 Message-Id: <20190902113121.31323-15-thierry.reding@gmail.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190902113121.31323-1-thierry.reding@gmail.com> References: <20190902113121.31323-1-thierry.reding@gmail.com> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=gPcDkSG7gGNdAp3jF4yBee9f6RzA+evCrH2htnpmEAI=; b=dHubGBMv74RuakGRYYWlVjNHgjyyuqS2zA0Uc4+AYhweoJ5fh2ihEdSGRhVFEO3ToU rcVepDTM26lfRoY9AT75RiX+4JgA3rfd3Mcw+NDUTM1nHZ2FxurVvyQZO+6rgam2PrkQ Sf8JPLUKYGJ9WBS4Ql5EuWk8j/JJ0CsHi8bBtqjAWVWozzzxqGEY8NSzCBl7UOuByt5l jAkoVaMVNUCNE04tY4862pZFL7lbQpadviaYpdU9k3CfMmSSDcLxp49Cy/l0puXn7npL 84QIzc7D6DIhejF2PRgqMrQNFz8Cs7WGkN5bZ//TGhJs5AKXO+MOAGGm/dMKMivKirny 0zSA== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Thierry Reding Make use of the newly added drm_dp_aux_rd_interval() helper in existing DP link training helpers. v2: drop stale sentence from commit message (Philipp Zabel) Signed-off-by: Thierry Reding --- drivers/gpu/drm/drm_dp_helper.c | 26 +++----------------------- 1 file changed, 3 insertions(+), 23 deletions(-) diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c index 681d28988776..1fb3c27cd012 100644 --- a/drivers/gpu/drm/drm_dp_helper.c +++ b/drivers/gpu/drm/drm_dp_helper.c @@ -122,17 +122,7 @@ EXPORT_SYMBOL(drm_dp_get_adjust_request_pre_emphasis); void drm_dp_link_train_clock_recovery_delay(const u8 dpcd[DP_RECEIVER_CAP_SIZE]) { - unsigned int rd_interval = dpcd[DP_TRAINING_AUX_RD_INTERVAL] & - DP_TRAINING_AUX_RD_MASK; - - if (rd_interval > 4) - DRM_DEBUG_KMS("AUX interval %u, out of range (max 4)\n", - rd_interval); - - if (rd_interval == 0 || dpcd[DP_DPCD_REV] >= DP_DPCD_REV_14) - rd_interval = 100; - else - rd_interval *= 4 * USEC_PER_MSEC; + unsigned int rd_interval = drm_dp_aux_rd_interval(dpcd); usleep_range(rd_interval, rd_interval * 2); } @@ -140,19 +130,9 @@ EXPORT_SYMBOL(drm_dp_link_train_clock_recovery_delay); void drm_dp_link_train_channel_eq_delay(const u8 dpcd[DP_RECEIVER_CAP_SIZE]) { - unsigned int rd_interval = dpcd[DP_TRAINING_AUX_RD_INTERVAL] & - DP_TRAINING_AUX_RD_MASK; - - if (rd_interval > 4) - DRM_DEBUG_KMS("AUX interval %u, out of range (max 4)\n", - rd_interval); + unsigned int min = drm_dp_aux_rd_interval(dpcd); - if (rd_interval == 0) - rd_interval = 400; - else - rd_interval *= 4 * USEC_PER_MSEC; - - usleep_range(rd_interval, rd_interval * 2); + usleep_range(min, min * 2); } EXPORT_SYMBOL(drm_dp_link_train_channel_eq_delay); From patchwork Mon Sep 2 11:31:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 11126457 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 ABF011398 for ; Mon, 2 Sep 2019 11:31:59 +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 9461A22D6D for ; Mon, 2 Sep 2019 11:31:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9461A22D6D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com 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 D524089C21; Mon, 2 Sep 2019 11:31:58 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm1-x343.google.com (mail-wm1-x343.google.com [IPv6:2a00:1450:4864:20::343]) by gabe.freedesktop.org (Postfix) with ESMTPS id 75EB789C25 for ; Mon, 2 Sep 2019 11:31:57 +0000 (UTC) Received: by mail-wm1-x343.google.com with SMTP id y135so9652374wmc.1 for ; Mon, 02 Sep 2019 04:31:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cacTJgpeWeqzXvAH+n7OtS9kKUcziDDhDJ4IG8XJjRY=; b=jN8SR5YxAoDmE+BoKdm7+Yrhmaf4JpBUr6bPtBbvUm0F0BGc8074h5+vumnqfucuba vFJ++eiEv1a43QUOexpSkSvGfePObbFQCToOBCy+AhP3JHwXiA04KHkOXiv80XkoHheZ mIdrFOYAyhcCxHzrZF0iQ8VieAB0ZNBD8DDT6nLhEqyMSirwKhNgs8x+luITnzqRfeEl Z3YmWM9b9IvmYM61CIx8yTyM8d7ItGV//Ut4WS1MM5YZJaleeJP0l+WZB4OWPk9JZyJN ZbqXx1IZ4uGroEtUk7SIbv4Kg4IGrkxqBHcmhpCWMb8NdMnFM1q5SXttuC87HuYwcRyv d33A== X-Gm-Message-State: APjAAAULjwfwPn2KYfhpKWoeFvT9WblxTEncsrTlhJIJCCWAR26fyt28 S6E5fPfezaDWGXi2hGty0xewpm1q X-Google-Smtp-Source: APXvYqyLbhKXkWuguVGTTTmtQ3obWw48qhlwry+/G4fcFRRXVmwjQmgtn2I0N0SKasFr33lhkXOU6A== X-Received: by 2002:a7b:c1cc:: with SMTP id a12mr179595wmj.73.1567423915683; Mon, 02 Sep 2019 04:31:55 -0700 (PDT) Received: from localhost (pD9E51890.dip0.t-ipconnect.de. [217.229.24.144]) by smtp.gmail.com with ESMTPSA id a16sm6728185wmg.5.2019.09.02.04.31.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Sep 2019 04:31:54 -0700 (PDT) From: Thierry Reding To: dri-devel@lists.freedesktop.org Subject: [PATCH v2 15/21] drm/dp: Add helper to get post-cursor adjustments Date: Mon, 2 Sep 2019 13:31:15 +0200 Message-Id: <20190902113121.31323-16-thierry.reding@gmail.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190902113121.31323-1-thierry.reding@gmail.com> References: <20190902113121.31323-1-thierry.reding@gmail.com> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=cacTJgpeWeqzXvAH+n7OtS9kKUcziDDhDJ4IG8XJjRY=; b=KnLCr3I8UvBEArdJxvfwwVM5mzgqIDcFs//KmRQ6RP7azPij/WSlqRCT1etaZTtBQt 2hmNMVMFp10AYptxMV8RIkWMru7E0V2QJb0IUVadecVTiPsEOkDJsrX5QNbrNla6x3Eo JGmI4HgPg1slkLBiPXPn/6Mpi8YfOggKS+8AUJzwM6iS45zXrVs+g4YCNsG6X3+VdNks +yC9W57dR93CbYrdubFrqs4D7ZIqGtJAa+0Hw5AkQZ5L8F2fzdffGFSH+NusiTEqwJnS +n/ckhTbTyUpkLlNxvLbb3ngJd1LYhUw7fdJ8rHOw1KgZP5/CTTCKOd0e5GignTO5J00 Pw6g== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Thierry Reding If the transmitter supports pre-emphasis post cursor2 the sink will request adjustments in a similar way to how it requests adjustments to the voltage swing and pre-emphasis settings. Add a helper to extract these adjustments on a per-lane basis from the DPCD link status. Reviewed-by: Philipp Zabel Signed-off-by: Thierry Reding --- drivers/gpu/drm/drm_dp_helper.c | 10 ++++++++++ include/drm/drm_dp_helper.h | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c index 1fb3c27cd012..f1f3705fade9 100644 --- a/drivers/gpu/drm/drm_dp_helper.c +++ b/drivers/gpu/drm/drm_dp_helper.c @@ -120,6 +120,16 @@ u8 drm_dp_get_adjust_request_pre_emphasis(const u8 link_status[DP_LINK_STATUS_SI } EXPORT_SYMBOL(drm_dp_get_adjust_request_pre_emphasis); +u8 drm_dp_get_adjust_request_post_cursor(const u8 link_status[DP_LINK_STATUS_SIZE], + unsigned int lane) +{ + unsigned int offset = DP_ADJUST_REQUEST_POST_CURSOR2; + u8 value = dp_link_status(link_status, offset); + + return (value >> (lane << 1)) & 0x3; +} +EXPORT_SYMBOL(drm_dp_get_adjust_request_post_cursor); + void drm_dp_link_train_clock_recovery_delay(const u8 dpcd[DP_RECEIVER_CAP_SIZE]) { unsigned int rd_interval = drm_dp_aux_rd_interval(dpcd); diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h index e28b0941a8be..5d262a453878 100644 --- a/include/drm/drm_dp_helper.h +++ b/include/drm/drm_dp_helper.h @@ -566,6 +566,14 @@ # define DP_ADJUST_PRE_EMPHASIS_LANE1_SHIFT 6 #define DP_ADJUST_REQUEST_POST_CURSOR2 0x20c +# define DP_ADJUST_POST_CURSOR2_LANE0_MASK 0x03 +# define DP_ADJUST_POST_CURSOR2_LANE0_SHIFT 0 +# define DP_ADJUST_POST_CURSOR2_LANE1_MASK 0x0c +# define DP_ADJUST_POST_CURSOR2_LANE1_SHIFT 2 +# define DP_ADJUST_POST_CURSOR2_LANE2_MASK 0x30 +# define DP_ADJUST_POST_CURSOR2_LANE2_SHIFT 4 +# define DP_ADJUST_POST_CURSOR2_LANE3_MASK 0xc0 +# define DP_ADJUST_POST_CURSOR2_LANE3_SHIFT 6 #define DP_TEST_REQUEST 0x218 # define DP_TEST_LINK_TRAINING (1 << 0) @@ -1053,6 +1061,8 @@ u8 drm_dp_get_adjust_request_voltage(const u8 link_status[DP_LINK_STATUS_SIZE], int lane); u8 drm_dp_get_adjust_request_pre_emphasis(const u8 link_status[DP_LINK_STATUS_SIZE], int lane); +u8 drm_dp_get_adjust_request_post_cursor(const u8 link_status[DP_LINK_STATUS_SIZE], + unsigned int lane); #define DP_BRANCH_OUI_HEADER_SIZE 0xc #define DP_RECEIVER_CAP_SIZE 0xf From patchwork Mon Sep 2 11:31:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 11126459 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 2870C14F7 for ; Mon, 2 Sep 2019 11:32:02 +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 0F54B23400 for ; Mon, 2 Sep 2019 11:32:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0F54B23400 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com 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 497A289C27; Mon, 2 Sep 2019 11:32:01 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6BE4A89C28 for ; Mon, 2 Sep 2019 11:31:59 +0000 (UTC) Received: by mail-wr1-x442.google.com with SMTP id u16so13684484wrr.0 for ; Mon, 02 Sep 2019 04:31:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=rsPOMRtTr+lM0WoCNjTwi27pzy0ZGcTeVaoicLp14s8=; b=dHj6mEVGXZBhOzNu9JWRZ1XiLYozuHJgN2lBP5die0xPboHEcODv95vNxXLUwO//Gp yV9kvGDGo+kXu3ISHngDKiiZDQwmabvbhDK6y5XqhmDpIuacj69CRsaJ80/Zs4OHOC/v 2DhelJQ4XmCofjLtF+r0GGeUSzi/5QHBGkhIcUdmXw1ZTsIXF/w6KEgmLcpUcoY67uQn NzE7Jtc+5ePIKbFRKtqlhx4FeUbi2iiR5CJgM5wf7qeVMwmrJPXhXaUcgY0mPLY1h6qB 2TNu4/Vk4sVyAjzj0XzKucSX48nycl+bdUN7jJmB0xJXqPfEjjYSp9UpdfzuLq2ayBuj uywA== X-Gm-Message-State: APjAAAV4kOjm1wQN4HcDNQ12zD+AJhOQ0RFORMkLNGS2+KbS1Y2dIOu9 1mDXg+K2reFl77QfjmYcn7VRHvrf X-Google-Smtp-Source: APXvYqyEw34Q3pVxIag4EHzigbvTGy6o28CIA+4IQD6j7VZe1yPDHwD880BjigWPWQTcIVVoN+x/Sg== X-Received: by 2002:adf:e488:: with SMTP id i8mr7540417wrm.20.1567423917753; Mon, 02 Sep 2019 04:31:57 -0700 (PDT) Received: from localhost (pD9E51890.dip0.t-ipconnect.de. [217.229.24.144]) by smtp.gmail.com with ESMTPSA id t13sm7205961wra.70.2019.09.02.04.31.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Sep 2019 04:31:56 -0700 (PDT) From: Thierry Reding To: dri-devel@lists.freedesktop.org Subject: [PATCH v2 16/21] drm/dp: Set channel coding on link configuration Date: Mon, 2 Sep 2019 13:31:16 +0200 Message-Id: <20190902113121.31323-17-thierry.reding@gmail.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190902113121.31323-1-thierry.reding@gmail.com> References: <20190902113121.31323-1-thierry.reding@gmail.com> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=rsPOMRtTr+lM0WoCNjTwi27pzy0ZGcTeVaoicLp14s8=; b=qO5A1wGYppCMrAEBMHdEBCBP6bZtFZV/ewOhTC1XmWGCbx3ZD6F+MUrSs5LGiPnnmW Eiw276C9e/DAd+gvrAYaM+frCOJVDJLEP6gWy0YpIhFgh+a+KEk97hgnkkq03rmP6sDi 908cXTbxAKS7mjg9GVEjW+ZHFU5GejvElykQWkbUvB1HYx4TXBb2KSZ7muspibR/0jTN JqFEZUCkSR4NZAaVmItCLscGGzsmBeYRg6lrSaJJnCytCHe1MNlAGeCNgr5gR1TJw/mN Rz7tUh1OFUOPgV4jFoa2fC3AU72dJluYJSUQe8ns4QCwy/ihtN8TW2T+6foIax0mzvLi vkcQ== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Thierry Reding Make use of ANSI 8B/10B channel coding if the DisplayPort sink supports it. Signed-off-by: Thierry Reding --- drivers/gpu/drm/drm_dp_helper.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c index f1f3705fade9..f51a5595ebc0 100644 --- a/drivers/gpu/drm/drm_dp_helper.c +++ b/drivers/gpu/drm/drm_dp_helper.c @@ -519,7 +519,7 @@ EXPORT_SYMBOL(drm_dp_link_power_down); */ int drm_dp_link_configure(struct drm_dp_aux *aux, struct drm_dp_link *link) { - u8 values[2]; + u8 values[2], value = 0; int err; values[0] = drm_dp_link_rate_to_bw_code(link->rate); @@ -532,6 +532,13 @@ int drm_dp_link_configure(struct drm_dp_aux *aux, struct drm_dp_link *link) if (err < 0) return err; + if (link->caps.channel_coding) + value = DP_SET_ANSI_8B10B; + + err = drm_dp_dpcd_writeb(aux, DP_MAIN_LINK_CHANNEL_CODING_SET, value); + if (err < 0) + return err; + return 0; } EXPORT_SYMBOL(drm_dp_link_configure); From patchwork Mon Sep 2 11:31:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 11126461 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 0EE7814F7 for ; Mon, 2 Sep 2019 11:32:04 +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 EB5BA22D6D for ; Mon, 2 Sep 2019 11:32:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EB5BA22D6D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com 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 D687289C28; Mon, 2 Sep 2019 11:32:02 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm1-x343.google.com (mail-wm1-x343.google.com [IPv6:2a00:1450:4864:20::343]) by gabe.freedesktop.org (Postfix) with ESMTPS id DCABB89C2A for ; Mon, 2 Sep 2019 11:32:01 +0000 (UTC) Received: by mail-wm1-x343.google.com with SMTP id o184so14223472wme.3 for ; Mon, 02 Sep 2019 04:32:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=8/DkPf5FMkkaEV/9e+/KRAcVqbG1QNA8dHLBfLowkK8=; b=LZ4zb42mqxWXp01veN7/I68BcrrDSP1mKec1zt4kcivHZ5rXoCpjsQBRXFjGynkZUV 64KUPTP0j/Fkvlc2HOOQ620reY2czllceA35zZhDiZHyq9JMuXTKHippx86dLP/lvt6p QdaFxmP8Dh16y4S1/m7hBbIpWWZNAEcPrH4uZjgbTKS8rNxY7aSHFGKekE3bpwCq4SjO XAZnVY3cnBL2XvVgbhf8BsZ2rA0tkoINa4wt3a0hzDSthkW7J/lTPiczoBHjSTwJGg45 zwSw10i1D5qPVoHlXfUYbKCK1yoFrRtJlXIeKNDvf7LLqEvxWFVsYh6F+KFAVZzGtdb+ o+ig== X-Gm-Message-State: APjAAAXG23Hq6w85dEyvGV0PANsm3jq6ILIQqRjtj8/WRIVNC9bOmoa4 YcXtOeESviErLUjTBB2LMRWoj60V X-Google-Smtp-Source: APXvYqxNQSUK2TyrcjNBFI/e/XhAj9h7ZDeqlBhdWAAn87P2KFgBAqTSE1UzDJJ+c/1ybhLX1C3prg== X-Received: by 2002:a7b:cb0f:: with SMTP id u15mr33070835wmj.173.1567423920197; Mon, 02 Sep 2019 04:32:00 -0700 (PDT) Received: from localhost (pD9E51890.dip0.t-ipconnect.de. [217.229.24.144]) by smtp.gmail.com with ESMTPSA id b18sm18699042wro.34.2019.09.02.04.31.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Sep 2019 04:31:58 -0700 (PDT) From: Thierry Reding To: dri-devel@lists.freedesktop.org Subject: [PATCH v2 17/21] drm/dp: Enable alternate scrambler reset when supported Date: Mon, 2 Sep 2019 13:31:17 +0200 Message-Id: <20190902113121.31323-18-thierry.reding@gmail.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190902113121.31323-1-thierry.reding@gmail.com> References: <20190902113121.31323-1-thierry.reding@gmail.com> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8/DkPf5FMkkaEV/9e+/KRAcVqbG1QNA8dHLBfLowkK8=; b=cf2UWlOV1wQoGPN8Ve9HA1QJy5Vaoh3aheXrXO5fnphyK2PfOMLLn8tJrbQxPt/0vt nB7WzCIL10OUfQnqRZCqX4I4U5SZP/CXKifxSXXEf/R0/8XZWru9V8yrZESxzxpsBtPq H49Lit4oBtGIBO7Zcs/auIT+fJM6cLirRvs6iILT+r1a5Z+3oy6ZJZvg7N4mAPZcqxcW 6HLQBUb6KoyXFmME/LEO6cr9Z4X2V9EPo6nbCsT1E+i4odx5CV9QGep5hzL7I+3z9943 jKveZcikWz3tcruhO8CCrwG/mQ0wPDlQ4Oq7Y1eBHWS44UbAtoQ9ZTS8oZ3lRi8dZgGa /6Tw== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Thierry Reding If the sink is eDP and supports the alternate scrambler reset, enable it. Signed-off-by: Thierry Reding --- drivers/gpu/drm/drm_dp_helper.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c index f51a5595ebc0..85956f3a24e3 100644 --- a/drivers/gpu/drm/drm_dp_helper.c +++ b/drivers/gpu/drm/drm_dp_helper.c @@ -539,6 +539,13 @@ int drm_dp_link_configure(struct drm_dp_aux *aux, struct drm_dp_link *link) if (err < 0) return err; + if (link->caps.alternate_scrambler_reset) { + err = drm_dp_dpcd_writeb(aux, DP_EDP_CONFIGURATION_SET, + DP_ALTERNATE_SCRAMBLER_RESET_ENABLE); + if (err < 0) + return err; + } + return 0; } EXPORT_SYMBOL(drm_dp_link_configure); From patchwork Mon Sep 2 11:31:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 11126465 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 5A0A214F7 for ; Mon, 2 Sep 2019 11:32:07 +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 4230222D6D for ; Mon, 2 Sep 2019 11:32:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4230222D6D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com 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 8B4CB89C33; Mon, 2 Sep 2019 11:32:06 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3FB8F89C2C for ; Mon, 2 Sep 2019 11:32:04 +0000 (UTC) Received: by mail-wm1-x341.google.com with SMTP id k1so14195692wmi.1 for ; Mon, 02 Sep 2019 04:32:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=PjWnE7lyBtvEmUiuslyISAk/FWUda1ALAmr6OEQvYvg=; b=hr+ERIIU/usF3esbtbSnE9i1QlLbTwbnuTFsFONU1H2N5OXVhAukRt+ZygQKK7ALl+ fpXfT49wJ/jz16T7MpToZrBh0XscLiF3hTw+Ulm9sfd+Z8JSB/wyhPtMRMJ3ri9XzNZK eGUtkAkPNy0Bg+yMIxGikKbVhOKDLDP+Sjk84sFaCLUPvonYQawnVVHTSXnzIs4zrcAf DKDGdu5rNWhn3QvRpGHnn1o9rj31G4AyGXqHnC9rNetMa6zx18oK/bXLay8Qen7pNxSf ZE78OsrIY36GBlA8WEhGtMTkSYIsz6ETUwp7sjKYkSjnaZlFxDuy768n0zo8agZlBDEb bDSQ== X-Gm-Message-State: APjAAAVzjB1BBB8ayr2cv6PaX4llbhHr0yF4j0FdLsmjMj9lzgeQOXaJ kNIqNvRYHxVVrbTRVYmhRliMi/48 X-Google-Smtp-Source: APXvYqwliMKzzrN9YCBNBW8dlmOMQ/p8wG5O7Lo/q/mDhmg7tl+vKmkZfrP8t8zUeGur1sxSDoQtww== X-Received: by 2002:a05:600c:207:: with SMTP id 7mr34190529wmi.146.1567423922415; Mon, 02 Sep 2019 04:32:02 -0700 (PDT) Received: from localhost (pD9E51890.dip0.t-ipconnect.de. [217.229.24.144]) by smtp.gmail.com with ESMTPSA id q14sm27524269wrc.77.2019.09.02.04.32.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Sep 2019 04:32:01 -0700 (PDT) From: Thierry Reding To: dri-devel@lists.freedesktop.org Subject: [PATCH v2 18/21] drm/dp: Add drm_dp_link_choose() helper Date: Mon, 2 Sep 2019 13:31:18 +0200 Message-Id: <20190902113121.31323-19-thierry.reding@gmail.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190902113121.31323-1-thierry.reding@gmail.com> References: <20190902113121.31323-1-thierry.reding@gmail.com> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=PjWnE7lyBtvEmUiuslyISAk/FWUda1ALAmr6OEQvYvg=; b=GQaZ17IEQ8uC3QtF8xrCdk7Do1LMM32D/C43O5i0fPibHRgZYcZ37FawNlLGD0pN+k qJ7rH2L0IeoaOxX2KKMKJoLFZI94sffKh9Lr9tKtP3mpdP6lvuutScoknY4wO77Nj7+m BytdhKrOXNTicDNVF6uRW5p9FncHxWZokpBWJW/N/R0Jo3nQceYY8f7QG1jUGnU29cyM RaRCKdsfVCj6VX2wKko/I/aW8CZSXIcXljQL6uDvJ3rgYujzDoQbhT0+UPZBMBn5C71A SklQWYeBqCn+ng9722/ZnPoYVUEdWouZ6RldPeS8+1VJlN7gAvYvQSlkVNt5FW5klMyO uORg== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Thierry Reding This helper chooses an appropriate configuration, according to the bitrate requirements of the video mode and the capabilities of the DisplayPort sink. Signed-off-by: Thierry Reding --- drivers/gpu/drm/drm_dp_helper.c | 55 +++++++++++++++++++++++++++++++++ include/drm/drm_dp_helper.h | 4 +++ 2 files changed, 59 insertions(+) diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c index 85956f3a24e3..01d34f33c658 100644 --- a/drivers/gpu/drm/drm_dp_helper.c +++ b/drivers/gpu/drm/drm_dp_helper.c @@ -550,6 +550,61 @@ int drm_dp_link_configure(struct drm_dp_aux *aux, struct drm_dp_link *link) } EXPORT_SYMBOL(drm_dp_link_configure); +/** + * drm_dp_link_choose() - choose the lowest possible configuration for a mode + * @link: DRM DP link object + * @mode: DRM display mode + * @info: DRM display information + * + * According to the eDP specification, a source should select a configuration + * with the lowest number of lanes and the lowest possible link rate that can + * match the bitrate requirements of a video mode. However it must ensure not + * to exceed the capabilities of the sink. + * + * Returns: 0 on success or a negative error code on failure. + */ +int drm_dp_link_choose(struct drm_dp_link *link, + const struct drm_display_mode *mode, + const struct drm_display_info *info) +{ + /* available link symbol clock rates */ + static const unsigned int rates[3] = { 162000, 270000, 540000 }; + /* available number of lanes */ + static const unsigned int lanes[3] = { 1, 2, 4 }; + unsigned long requirement, capacity; + unsigned int rate = link->max_rate; + unsigned int i, j; + + /* bandwidth requirement */ + requirement = mode->clock * info->bpc * 3; + + for (i = 0; i < ARRAY_SIZE(lanes) && lanes[i] <= link->max_lanes; i++) { + for (j = 0; j < ARRAY_SIZE(rates) && rates[j] <= rate; j++) { + /* + * Capacity for this combination of lanes and rate, + * factoring in the ANSI 8B/10B encoding. + * + * Link rates in the DRM DP helpers are really link + * symbol frequencies, so a tenth of the actual rate + * of the link. + */ + capacity = lanes[i] * (rates[j] * 10) * 8 / 10; + + if (capacity >= requirement) { + DRM_DEBUG_KMS("using %u lanes at %u kHz (%lu/%lu kbps)\n", + lanes[i], rates[j], requirement, + capacity); + link->lanes = lanes[i]; + link->rate = rates[j]; + return 0; + } + } + } + + return -ERANGE; +} +EXPORT_SYMBOL(drm_dp_link_choose); + /** * drm_dp_downstream_max_clock() - extract branch device max * pixel rate for legacy VGA diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h index 5d262a453878..817231e38053 100644 --- a/include/drm/drm_dp_helper.h +++ b/include/drm/drm_dp_helper.h @@ -28,6 +28,7 @@ #include #include +#include #include /* @@ -1470,6 +1471,9 @@ int drm_dp_link_probe(struct drm_dp_aux *aux, struct drm_dp_link *link); int drm_dp_link_power_up(struct drm_dp_aux *aux, struct drm_dp_link *link); int drm_dp_link_power_down(struct drm_dp_aux *aux, struct drm_dp_link *link); int drm_dp_link_configure(struct drm_dp_aux *aux, struct drm_dp_link *link); +int drm_dp_link_choose(struct drm_dp_link *link, + const struct drm_display_mode *mode, + const struct drm_display_info *info); int drm_dp_downstream_max_clock(const u8 dpcd[DP_RECEIVER_CAP_SIZE], const u8 port_cap[4]); int drm_dp_downstream_max_bpc(const u8 dpcd[DP_RECEIVER_CAP_SIZE], From patchwork Mon Sep 2 11:31:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 11126467 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 4F56114F7 for ; Mon, 2 Sep 2019 11:32:09 +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 3708622D6D for ; Mon, 2 Sep 2019 11:32:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3708622D6D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com 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 13F0C89C2C; Mon, 2 Sep 2019 11:32:08 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm1-x343.google.com (mail-wm1-x343.google.com [IPv6:2a00:1450:4864:20::343]) by gabe.freedesktop.org (Postfix) with ESMTPS id 34A2C89C2C for ; Mon, 2 Sep 2019 11:32:06 +0000 (UTC) Received: by mail-wm1-x343.google.com with SMTP id k2so12750449wmj.4 for ; Mon, 02 Sep 2019 04:32:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ke8ei2MWYM73AcHvjLqyuqbcohrAAivQ3mJlayP9epM=; b=j+Vnv03q0K2OSU/RSlj35Lw8K+EhgrT93X226o/66t6QSOL43FdBuI6Jkt3HEH7PC0 w7nZHpr8cG3/E3t381KIjHmrAuBIUBA+ijxu1Kd0DAjxD22NXbWfS8Ntjmmp2poRLsmf RgUd5XCBWEYjdCnvqUwQWUIieVi2bkC/Oa2rIOoCPs1CeQ7aJE9QPFNgAdxyDxtAPvP0 2ZQZrljM+l0hcyRnFgoVGN98lOwK93nz44COE2l9vWLbeVA4l8VTEwmTkQEoFl/39m9/ SvPO6qhby4pxwX8B/VRrhZI1yC+yw55u1gZrJ5lcju9m9JgBWmYQRaM3guAZA2XKSDND ZeqA== X-Gm-Message-State: APjAAAWPyuSlzyXfwVImzafmGQyEwOG1oi+FvqHDAd5MsbjcqK9UiFI8 HsnaQLRMrLKVvwAVUjj87XX9yfFE X-Google-Smtp-Source: APXvYqxhhOdlHp7yKBd9Zst/22Y9JKOpdnoX7tUyepJ6czuQ3EtNgVRnJFiuhQ5/FlNJflhr8cvWWA== X-Received: by 2002:a7b:cb03:: with SMTP id u3mr35825845wmj.58.1567423924432; Mon, 02 Sep 2019 04:32:04 -0700 (PDT) Received: from localhost (pD9E51890.dip0.t-ipconnect.de. [217.229.24.144]) by smtp.gmail.com with ESMTPSA id f66sm1132438wmg.2.2019.09.02.04.32.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Sep 2019 04:32:03 -0700 (PDT) From: Thierry Reding To: dri-devel@lists.freedesktop.org Subject: [PATCH v2 19/21] drm/dp: Add support for eDP link rates Date: Mon, 2 Sep 2019 13:31:19 +0200 Message-Id: <20190902113121.31323-20-thierry.reding@gmail.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190902113121.31323-1-thierry.reding@gmail.com> References: <20190902113121.31323-1-thierry.reding@gmail.com> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ke8ei2MWYM73AcHvjLqyuqbcohrAAivQ3mJlayP9epM=; b=qNyDYj2yqjNO2rl9ZP+sLMKFQKZ3oEtLXimMOlWaXFeLhhC6Hc2NQ2rm6CnDk8ZRk1 JZQPR5fmX6ta0dpiu520A/2jgW4gp4XN0kPfuuePB6SgdxHsT++cvcv2/pXN4eR8Qi16 +yn0oVhN7z3a2aRgI63XS45BUMWn2MhgUIB+NpQTuboZpVeKwxuSmgBnk9gKlfM197Fz VYNS2e4+mZv2kq5LkD2uvSCPXTw1G0etRt4LXvzzvfd7QTBk3e21ncSpSnvv32Y89m5U tI05vtF+wvofyjfSvRJ86XVCUSaVGcDh1br3J+yVGYiakb5999mhiCopjVPEag6PvG8f 1MwA== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Thierry Reding Signed-off-by: Thierry Reding --- drivers/gpu/drm/drm_dp_helper.c | 121 ++++++++++++++++++++++++++++++++ include/drm/drm_dp_helper.h | 9 +++ 2 files changed, 130 insertions(+) diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c index 01d34f33c658..136ee609f2ee 100644 --- a/drivers/gpu/drm/drm_dp_helper.c +++ b/drivers/gpu/drm/drm_dp_helper.c @@ -385,6 +385,107 @@ static void drm_dp_link_reset(struct drm_dp_link *link) link->lanes = 0; } +/** + * drm_dp_link_add_rate() - add a rate to the list of supported rates + * @link: the link to add the rate to + * @rate: the rate to add + * + * Add a link rate to the list of supported link rates. + * + * Returns: + * 0 on success or one of the following negative error codes on failure: + * - ENOSPC if the maximum number of supported rates has been reached + * - EEXISTS if the link already supports this rate + * + * See also: + * drm_dp_link_remove_rate() + */ +int drm_dp_link_add_rate(struct drm_dp_link *link, unsigned long rate) +{ + unsigned int i, pivot; + + if (link->num_rates == DP_MAX_SUPPORTED_RATES) + return -ENOSPC; + + for (pivot = 0; pivot < link->num_rates; pivot++) + if (rate <= link->rates[pivot]) + break; + + if (pivot != link->num_rates && rate == link->rates[pivot]) + return -EEXIST; + + for (i = link->num_rates; i > pivot; i--) + link->rates[i] = link->rates[i - 1]; + + link->rates[pivot] = rate; + link->num_rates++; + + return 0; +} +EXPORT_SYMBOL(drm_dp_link_add_rate); + +/** + * drm_dp_link_remove_rate() - remove a rate from the list of supported rates + * @link: the link from which to remove the rate + * @rate: the rate to remove + * + * Removes a link rate from the list of supported link rates. + * + * Returns: + * 0 on success or one of the following negative error codes on failure: + * - EINVAL if the specified rate is not among the supported rates + * + * See also: + * drm_dp_link_add_rate() + */ +int drm_dp_link_remove_rate(struct drm_dp_link *link, unsigned long rate) +{ + unsigned int i; + + for (i = 0; i < link->num_rates; i++) + if (rate == link->rates[i]) + break; + + if (i == link->num_rates) + return -EINVAL; + + link->num_rates--; + + for (i = i; i < link->num_rates; i++) + link->rates[i] = link->rates[i + 1]; + + return 0; +} +EXPORT_SYMBOL(drm_dp_link_remove_rate); + +/** + * drm_dp_link_update_rates() - normalize the supported link rates array + * @link: the link for which to normalize the supported link rates + * + * Users should call this function after they've manually modified the array + * of supported link rates. This function removes any stale entries, compacts + * the array and updates the supported link rate count. Note that calling the + * drm_dp_link_remove_rate() function already does this janitorial work. + * + * See also: + * drm_dp_link_add_rate(), drm_dp_link_remove_rate() + */ +void drm_dp_link_update_rates(struct drm_dp_link *link) +{ + unsigned int i, count = 0; + + for (i = 0; i < link->num_rates; i++) { + if (link->rates[i] != 0) + link->rates[count++] = link->rates[i]; + } + + for (i = count; i < link->num_rates; i++) + link->rates[i] = 0; + + link->num_rates = count; +} +EXPORT_SYMBOL(drm_dp_link_update_rates); + /** * drm_dp_link_probe() - probe a DisplayPort link for capabilities * @aux: DisplayPort AUX channel @@ -437,6 +538,26 @@ int drm_dp_link_probe(struct drm_dp_aux *aux, struct drm_dp_link *link) link->rate = link->max_rate; link->lanes = link->max_lanes; + /* Parse SUPPORTED_LINK_RATES from eDP 1.4 */ + if (link->edp >= 0x14) { + u8 supported_rates[DP_MAX_SUPPORTED_RATES * 2]; + unsigned int i; + u16 rate; + + err = drm_dp_dpcd_read(aux, DP_SUPPORTED_LINK_RATES, + supported_rates, + sizeof(supported_rates)); + if (err < 0) + return err; + + for (i = 0; i < DP_MAX_SUPPORTED_RATES; i++) { + rate = supported_rates[i * 2 + 1] << 8 | + supported_rates[i * 2 + 0]; + + drm_dp_link_add_rate(link, rate * 200); + } + } + return 0; } EXPORT_SYMBOL(drm_dp_link_probe); diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h index 817231e38053..dfe16069e029 100644 --- a/include/drm/drm_dp_helper.h +++ b/include/drm/drm_dp_helper.h @@ -1453,6 +1453,8 @@ void drm_dp_link_caps_copy(struct drm_dp_link_caps *dest, * @edp: eDP revision (0x11: eDP 1.1, 0x12: eDP 1.2, ...) * @rate: currently configured link rate * @lanes: currently configured number of lanes + * @rates: additional supported link rates in kHz (eDP 1.4) + * @num_rates: number of additional supported link rates (eDP 1.4) */ struct drm_dp_link { unsigned char revision; @@ -1465,8 +1467,15 @@ struct drm_dp_link { unsigned int rate; unsigned int lanes; + + unsigned long rates[DP_MAX_SUPPORTED_RATES]; + unsigned int num_rates; }; +int drm_dp_link_add_rate(struct drm_dp_link *link, unsigned long rate); +int drm_dp_link_remove_rate(struct drm_dp_link *link, unsigned long rate); +void drm_dp_link_update_rates(struct drm_dp_link *link); + int drm_dp_link_probe(struct drm_dp_aux *aux, struct drm_dp_link *link); int drm_dp_link_power_up(struct drm_dp_aux *aux, struct drm_dp_link *link); int drm_dp_link_power_down(struct drm_dp_aux *aux, struct drm_dp_link *link); From patchwork Mon Sep 2 11:31:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 11126469 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 5E52B1398 for ; Mon, 2 Sep 2019 11:32:11 +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 45D3822CF7 for ; Mon, 2 Sep 2019 11:32:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 45D3822CF7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com 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 60CD689C46; Mon, 2 Sep 2019 11:32:10 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) by gabe.freedesktop.org (Postfix) with ESMTPS id 45F0089C3F for ; Mon, 2 Sep 2019 11:32:08 +0000 (UTC) Received: by mail-wm1-x341.google.com with SMTP id d16so14226361wme.2 for ; Mon, 02 Sep 2019 04:32:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=K//Yj9ZM67KpE3ArJT4tiEAnA9GrF7zmNU5GE28h+jQ=; b=r2QTMjj1CcodFMA7CXne2o8x13jmenWCSa9YriDzVjS69nwZFEn/o5sSQ0LU8gcBtU Vw7cQdjATbWrd+QgdoLe8MQhdUBjErLyHprhIu1vPu+wfkWcTmufJeBS+SkrFviA64+H HRYuSx2gIGJ6KERbRl6GJG9r55pegqvNge6bA3n7Nr5/L3cnpyT3GPv+EmNL+QU6Cyez wFj6jvMkPuqYokZ3gcQ0u2rmxqbjzNe9gG3Vcy/2h7JFMelVao5NXxx31uzVX4DgVKvS tQthPhdx0QQbxi+o67a9RsPp77cK+ZDD9nEKo6W8smTCWB/zjLc3Ao78p9jSHmQ/+MqJ MW5g== X-Gm-Message-State: APjAAAWq6uWPSocIZ2t8L0wQjarbZ0NHkfXFfY7Hho4qC6fExs4IweGG OQD1mRT6+u7FDdw4psojXnCsXe8q X-Google-Smtp-Source: APXvYqx1xbJ0j0+SOfLXFZ8aho6pwgQK2xTr/Ad9PLny6PQjpYlqMIOoibN4rSrfVPXcs+m/qd1SUQ== X-Received: by 2002:a1c:8187:: with SMTP id c129mr34791670wmd.32.1567423926374; Mon, 02 Sep 2019 04:32:06 -0700 (PDT) Received: from localhost (pD9E51890.dip0.t-ipconnect.de. [217.229.24.144]) by smtp.gmail.com with ESMTPSA id m23sm19106108wml.41.2019.09.02.04.32.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Sep 2019 04:32:05 -0700 (PDT) From: Thierry Reding To: dri-devel@lists.freedesktop.org Subject: [PATCH v2 20/21] drm/dp: Remove a gratuituous blank line Date: Mon, 2 Sep 2019 13:31:20 +0200 Message-Id: <20190902113121.31323-21-thierry.reding@gmail.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190902113121.31323-1-thierry.reding@gmail.com> References: <20190902113121.31323-1-thierry.reding@gmail.com> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=K//Yj9ZM67KpE3ArJT4tiEAnA9GrF7zmNU5GE28h+jQ=; b=n6s5/spm8kwvYBjpkIQ6v5DxjlKxcFdL08c9w7FP2zmr3V6JJBY4mDbzfG+qZKLA0n lM+t3thg4PdjKCOIJzd1VTaLNM728fg0E+wkEihASnMAai533SaY/3iDQogPAnP0/A+O ST2BMF+3f+2JmHXnEYfHpSEt17ZA3Nz3xaxy5fVzIg9MJ2OsNIdlRHS8Po0dlI9MUQiq MjYJWG1msUcPfaQNmkwitNWLhdd5qqq5hTDuDP4u30av9t4jIQUNhd4s5UQhzcxVRFvu LyJsUESakb/oTNXqSOGmrWKO2vXOG9N0LQmuMUlKJCGyBkeW3Psv/sd9GZk4956pzQV8 t55w== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Thierry Reding It's idiomatic to check the return value of a function call immediately after the function call, without any blank lines in between, to make it more obvious that the two lines belong together. v2: fix outdated commit message (Philipp Zabel) Signed-off-by: Thierry Reding --- drivers/gpu/drm/drm_dp_helper.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c index 136ee609f2ee..6b4431bade3e 100644 --- a/drivers/gpu/drm/drm_dp_helper.c +++ b/drivers/gpu/drm/drm_dp_helper.c @@ -216,7 +216,6 @@ static int drm_dp_dpcd_access(struct drm_dp_aux *aux, u8 request, } ret = aux->transfer(aux, &msg); - if (ret >= 0) { native_reply = msg.reply & DP_AUX_NATIVE_REPLY_MASK; if (native_reply == DP_AUX_NATIVE_REPLY_ACK) { From patchwork Mon Sep 2 11:31:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 11126471 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 41E2C1398 for ; Mon, 2 Sep 2019 11:32:13 +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 2A66E22D6D for ; Mon, 2 Sep 2019 11:32:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2A66E22D6D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com 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 29BC289C49; Mon, 2 Sep 2019 11:32:12 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8CAA089C49 for ; Mon, 2 Sep 2019 11:32:10 +0000 (UTC) Received: by mail-wr1-x441.google.com with SMTP id j16so13643044wrr.8 for ; Mon, 02 Sep 2019 04:32:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4al9KjlAWfyU0dfyS71pK6V4IgdXLpnLn90yuCTWTrI=; b=M1Mssnvg8SZz2Nf/FkItkRo/xzLSKHAZDDXie3xwOEpdTz0sjeTSbG5UzIP+Z1l9ye L7RCeeEuHVG62QWBEIZxpi+3toWCab3cIAIdXG6vMqs/rFX/+3bUVhurXODmGJpb5dA+ Jtv94H3FPMML3U68B6jXxRqGuAfThJ5s/5EoQhvho/EW1/5kdzNWVcB+pwx/7uCOodto YfZukNFZC0ZA7KpJDUIJWQseYQdX6ymBja21//yRY1ox32/7Zhz3weAWbYuUL8C/Dch2 KqtsMWgOkRFwrTZNKaFlDd/BUzUrCTSe6rs2rT2C12kkFs2btr8B+xa8MnAZslSt/N7l Yycw== X-Gm-Message-State: APjAAAVjzX+kutOn59gEnkIZRLBIG6vFKRvhx97focWOCL1PwUpJOfci ia/5C3Vx0XGZYak5dAB/4Iy0c0DI X-Google-Smtp-Source: APXvYqwqOfqVEH3x9KugBJN2DkbierddWw+Uav+SAD7ndw++I7guE7iqvuh4kbBuTBzBMy88S8t+Fw== X-Received: by 2002:a5d:4f05:: with SMTP id c5mr31828901wru.349.1567423928526; Mon, 02 Sep 2019 04:32:08 -0700 (PDT) Received: from localhost (pD9E51890.dip0.t-ipconnect.de. [217.229.24.144]) by smtp.gmail.com with ESMTPSA id y3sm29091303wmg.2.2019.09.02.04.32.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Sep 2019 04:32:07 -0700 (PDT) From: Thierry Reding To: dri-devel@lists.freedesktop.org Subject: [PATCH v2 21/21] drm/bridge: tc358767: Use DP nomenclature Date: Mon, 2 Sep 2019 13:31:21 +0200 Message-Id: <20190902113121.31323-22-thierry.reding@gmail.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190902113121.31323-1-thierry.reding@gmail.com> References: <20190902113121.31323-1-thierry.reding@gmail.com> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=4al9KjlAWfyU0dfyS71pK6V4IgdXLpnLn90yuCTWTrI=; b=fJhJoBV3Yx8hMbJLs6GsiOGI7E/YkV6s8nZLNZY5SEMQyYus9I4IQP0Nd4ynix17d5 U/RtHdge1tGnD5k9c6qXK58eTTFlWGAslqIU+oAPnSxPYPsOy2APQHF7DDkiIHIe3MbX D4xuCNFjCCq5BvhBgjmZw+2yx0g+0zcwLAliCuM/ynThtKjyMtjheCWvv413zxtl82nx gcMerD9CO4vvcQEiEanbYsExh3OsabVeGKQTemte4ERMUm4VvFJkQ6mXVyVSXVfU75h0 B1QTECaqaOwxmuWbUBTVMI1woakpuM/gC8X1Vb96+xhQxJqbIBZgh9LpcdvH3wYZewYc Fejg== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Thierry Reding The DP specification uses the term "default framing" instead of "non- enhanced framing". Reviewed-by: Andrzej Hajda Signed-off-by: Thierry Reding --- drivers/gpu/drm/bridge/tc358767.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c index 240a9b69244d..468925f80329 100644 --- a/drivers/gpu/drm/bridge/tc358767.c +++ b/drivers/gpu/drm/bridge/tc358767.c @@ -699,8 +699,7 @@ static int tc_get_display_props(struct tc_data *tc) tc->link.base.revision >> 4, tc->link.base.revision & 0x0f, (tc->link.base.rate == 162000) ? "1.62Gbps" : "2.7Gbps", tc->link.base.lanes, - tc->link.base.caps.enhanced_framing ? "enhanced" : - "non-enhanced"); + tc->link.base.caps.enhanced_framing ? "enhanced" : "default"); dev_dbg(tc->dev, "Downspread: %s, scrambler: %s\n", tc->link.spread ? "0.5%" : "0.0%", tc->link.scrambler_dis ? "disabled" : "enabled");