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,