From patchwork Tue Jan 14 14:55:34 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 3486061 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 20FE09F169 for ; Tue, 14 Jan 2014 14:55:59 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1217420225 for ; Tue, 14 Jan 2014 14:55:58 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 06E582021E for ; Tue, 14 Jan 2014 14:55:57 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4E181FCDDB; Tue, 14 Jan 2014 06:55:52 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-bk0-f49.google.com (mail-bk0-f49.google.com [209.85.214.49]) by gabe.freedesktop.org (Postfix) with ESMTP id F2CFDFCDD4; Tue, 14 Jan 2014 06:55:43 -0800 (PST) Received: by mail-bk0-f49.google.com with SMTP id 6so261885bkj.8 for ; Tue, 14 Jan 2014 06:55:43 -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=BhZRYlYQo/M3ee3iwxNh6wDDdUJqnXJl3iYLfrCcYYc=; b=AmisymjQOxCRCuX9vVO0VaCYMCTjar+zqgwq/ryJ4v1TIEXZcwYOCZ4Zcl7YL+eBv9 VTAXByloBT8KxuKBxWNqrV/xDxGzn7HmMBi2v4qOnl9CJegHX70Nl/NAarKZCvI7K6XD YFBDaDP9L1dGJByZXamTCz3D3Z7KjoH37CmDDUi9JhHTTqK1FAnBaFHzSTpDXXj1CcEX WCYjQ8sYh59gFb42heJ8CZF+qu7sU3/HxiKNNXEcoQOZMo8dIS1kaQ6AAzi0bGbQ0NZp B+8Xgz8FZ1TBEbjDUXV2b56+UJAl8p2W04FyDeR2PD9lRaYr5JHYF8pcbApsbxMa/NAP 1V8w== X-Received: by 10.204.56.201 with SMTP id z9mr1262159bkg.77.1389711342964; Tue, 14 Jan 2014 06:55:42 -0800 (PST) Received: from localhost (port-33652.pppoe.wtnet.de. [46.59.182.73]) by mx.google.com with ESMTPSA id it12sm962694bkb.12.2014.01.14.06.55.41 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 Jan 2014 06:55:42 -0800 (PST) From: Thierry Reding To: dri-devel@lists.freedesktop.org Subject: [PATCH v3 2/4] drm/dp: Add drm_dp_dpcd_read_link_status() Date: Tue, 14 Jan 2014 15:55:34 +0100 Message-Id: <1389711336-29702-3-git-send-email-treding@nvidia.com> X-Mailer: git-send-email 1.8.4.2 In-Reply-To: <1389711336-29702-1-git-send-email-treding@nvidia.com> References: <1389711336-29702-1-git-send-email-treding@nvidia.com> Cc: intel-gfx@lists.freedesktop.org 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.2 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 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. 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 3641c5eb349b..572637456713 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 c69c1dc1b741..8af695277a84 100644 --- a/include/drm/drm_dp_helper.h +++ b/include/drm/drm_dp_helper.h @@ -465,4 +465,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_ */