From patchwork Thu Feb 20 15:55:31 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 3688371 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 6D5299F35F for ; Thu, 20 Feb 2014 15:55:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 93E7E20149 for ; Thu, 20 Feb 2014 15:55:53 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id BC81220173 for ; Thu, 20 Feb 2014 15:55:52 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 285EAFB2D1; Thu, 20 Feb 2014 07:55:44 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-bk0-f51.google.com (mail-bk0-f51.google.com [209.85.214.51]) by gabe.freedesktop.org (Postfix) with ESMTP id 9F3C2FB2CF; Thu, 20 Feb 2014 07:55:41 -0800 (PST) Received: by mail-bk0-f51.google.com with SMTP id w10so679878bkz.38 for ; Thu, 20 Feb 2014 07:55:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=OlKiDXYPlqT5P7aPPKCexwzcDtug2ZY2eWyLbrbnYPk=; b=P4FWO+YYGW3NDCi4e1HuNTL13zWC5gUEXIPVaRrWlCkjIk6HCQqLCh2Vovnm/IqizI Hv306rDF2DFsj1eHOWPNuN2NBTVnxRlIPghWbZ88ZHCnTzJEfEvANodEpFuO8zjgLtuD pnymsEVCI+msQEjjEwmIk29bdSFTVcju2uZ9rwtOt2VdgW92KO7Lt9EIxCr+X8ZS1qDz fkQ4XBpYrJ/1HIcTRMd6oEmak+wLhOwCZsgmkegQ7tAAbzJpWMYLewBwb/YP0mS7086m ERgkxO11tjCFAQ5oOKsLyJ2nXpePEBxTzdFRls/qh3w2W1wr2oHriAMeZLwGEG4J7n1K DLjQ== X-Received: by 10.205.106.130 with SMTP id du2mr780676bkc.133.1392911740643; Thu, 20 Feb 2014 07:55:40 -0800 (PST) Received: from localhost (port-49090.pppoe.wtnet.de. [46.59.192.91]) by mx.google.com with ESMTPSA id z2sm4041826bkm.14.2014.02.20.07.55.39 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Feb 2014 07:55:39 -0800 (PST) From: Thierry Reding To: dri-devel@lists.freedesktop.org Subject: [PATCH v5 2/5] drm/dp: Add drm_dp_dpcd_read_link_status() Date: Thu, 20 Feb 2014 16:55:31 +0100 Message-Id: <1392911734-6689-3-git-send-email-thierry.reding@gmail.com> X-Mailer: git-send-email 1.8.4.2 In-Reply-To: <1392911734-6689-1-git-send-email-thierry.reding@gmail.com> References: <1392911734-6689-1-git-send-email-thierry.reding@gmail.com> Cc: intel-gfx@lists.freedesktop.org, linux-tegra@vger.kernel.org, Alex Deucher X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Thierry Reding The function reads the link status (6 bytes starting at offset 0x202) from the DPCD so that it can be conveniently passed to other DPCD helpers. Reviewed-by: Alex Deucher Reviewed-by: Jani Nikula Signed-off-by: Thierry Reding --- drivers/gpu/drm/drm_dp_helper.c | 16 ++++++++++++++++ include/drm/drm_dp_helper.h | 3 +++ 2 files changed, 19 insertions(+) diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c index da6bcfe178a6..84262ed64ce7 100644 --- a/drivers/gpu/drm/drm_dp_helper.c +++ b/drivers/gpu/drm/drm_dp_helper.c @@ -456,3 +456,19 @@ ssize_t drm_dp_dpcd_write(struct drm_dp_aux *aux, unsigned int offset, size); } EXPORT_SYMBOL(drm_dp_dpcd_write); + +/** + * drm_dp_dpcd_read_link_status() - read DPCD link status (bytes 0x202-0x207) + * @aux: DisplayPort AUX channel + * @status: buffer to store the link status in (must be at least 6 bytes) + * + * Returns the number of bytes transferred on success or a negative error + * code on failure. + */ +int drm_dp_dpcd_read_link_status(struct drm_dp_aux *aux, + u8 status[DP_LINK_STATUS_SIZE]) +{ + return drm_dp_dpcd_read(aux, DP_LANE0_1_STATUS, status, + DP_LINK_STATUS_SIZE); +} +EXPORT_SYMBOL(drm_dp_dpcd_read_link_status); diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h index 0eb29f089e61..8759ce6ce97f 100644 --- a/include/drm/drm_dp_helper.h +++ b/include/drm/drm_dp_helper.h @@ -487,4 +487,7 @@ 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_status(struct drm_dp_aux *aux, + u8 status[DP_LINK_STATUS_SIZE]); + #endif /* _DRM_DP_HELPER_H_ */