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