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;