From patchwork Thu Dec 12 14:53:48 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 3332521 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 6C3B1C0D4A for ; Thu, 12 Dec 2013 14:55:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 517E620793 for ; Thu, 12 Dec 2013 14:55:24 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 935A620749 for ; Thu, 12 Dec 2013 14:55:19 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 699B7FB4C9; Thu, 12 Dec 2013 06:55:14 -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 58155FB3A1 for ; Thu, 12 Dec 2013 06:55:10 -0800 (PST) Received: by mail-bk0-f49.google.com with SMTP id my13so909796bkb.36 for ; Thu, 12 Dec 2013 06:55:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:in-reply-to:references; bh=CPMfX4tmwXYH8MyFytR6B5Cw0MNrZcSNDduAWxQmpdc=; b=nKik75vZCoP389XvPFceDWBZtA3p6VzHtyXLgj7Tuo8JPY1TkMDhvJ6elhHNwXmBdJ XBBP3kHvwUS8cHK4DmFbYUc7daZqivvvfpcJqUJ6PFTPYw0zYvBdEz/0B6oKnJfrL1/f US5q9suBoAM9Z0gZVoopDBbNBEw39/YMA8ZjUzZJdNRjohJBicSNUKIixp2KdGL3B3rk TNrUJJpcqT2ROLMb/7KKTVlaWM++o37rxK9H1anc+w47vamG5hWQWwxlHdwrP1bMhIIW C6/gv5mlsC1SrW+7d6mFOdsRZTEqHwb6XD2HXuEeYBifxfEEnqXxCa5HAo5bFbxNeOBr qeIw== X-Received: by 10.204.103.7 with SMTP id i7mr3024538bko.14.1386860108166; Thu, 12 Dec 2013 06:55:08 -0800 (PST) Received: from localhost (port-31954.pppoe.wtnet.de. [46.59.175.170]) by mx.google.com with ESMTPSA id j6sm18593152bki.17.2013.12.12.06.55.07 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Dec 2013 06:55:07 -0800 (PST) From: Thierry Reding To: dri-devel@lists.freedesktop.org Subject: [PATCH 2/4] drm/dp: Add drm_dp_dpcd_read_link_status() Date: Thu, 12 Dec 2013 15:53:48 +0100 Message-Id: <1386860030-1840-3-git-send-email-treding@nvidia.com> X-Mailer: git-send-email 1.8.4.2 In-Reply-To: <1386860030-1840-1-git-send-email-treding@nvidia.com> References: <1386860030-1840-1-git-send-email-treding@nvidia.com> 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.1 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 6c9276098069..d7a4df2e6b56 100644 --- a/drivers/gpu/drm/drm_dp_helper.c +++ b/drivers/gpu/drm/drm_dp_helper.c @@ -396,3 +396,19 @@ ssize_t drm_dp_dpcd_write(struct drm_dp_aux *aux, unsigned int offset, return aux->transfer(aux, &msg); } 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 e528b2b64cef..a7c336444cea 100644 --- a/include/drm/drm_dp_helper.h +++ b/include/drm/drm_dp_helper.h @@ -482,4 +482,7 @@ static inline ssize_t drm_dp_dpcd_writeb(struct drm_dp_aux *aux, u8 value, 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_ */