From patchwork Tue Dec 17 16:20:05 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 3362641 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 DF500C0D4A for ; Tue, 17 Dec 2013 16:21:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5697120364 for ; Tue, 17 Dec 2013 16:21:52 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id A41B720255 for ; Tue, 17 Dec 2013 16:21:47 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 07A57FCD58; Tue, 17 Dec 2013 08:21:42 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-bk0-f48.google.com (mail-bk0-f48.google.com [209.85.214.48]) by gabe.freedesktop.org (Postfix) with ESMTP id 68F7CFCD54 for ; Tue, 17 Dec 2013 08:21:37 -0800 (PST) Received: by mail-bk0-f48.google.com with SMTP id r7so2915637bkg.35 for ; Tue, 17 Dec 2013 08:21:36 -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=W796fjN0OwMIUjGiEU3ht0FLEhcsuREms+xjroHJFyc=; b=CUg/2vhOI23k4fizubatkKXmjteSXmuDITZuq4BaltyLNpdW01noff+1B0b8C6el/H C902aXk4GAZPF4xZwX0ts04OdXIQGoOA8nX/qULV4XoCCbcnmXT0xuN94EbmYXnzXReK xwfm1nfN+W6mfqeJ72xNthfI3kM6Ixc7FXn+uS+U8TJEc84ttl0t1iqb0flfk88Zp84/ zlHiiYym+01YVhhKtdhUqVO0WTw2rcLrh8jY4/0bLRE+YqZaJaLs35vhhccsrOIVM9XA 2EWN51SV1LAG6WI0JhvfJdUbLqVXHTzfP0KccxZ31Y2KHGjFRNeQKip10QCWlkEw6jQM /X4w== X-Received: by 10.205.97.6 with SMTP id ci6mr63832bkc.153.1387297296566; Tue, 17 Dec 2013 08:21:36 -0800 (PST) Received: from localhost (port-6309.pppoe.wtnet.de. [84.46.24.189]) by mx.google.com with ESMTPSA id sx5sm13994659bkb.0.2013.12.17.08.21.35 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 17 Dec 2013 08:21:35 -0800 (PST) From: Thierry Reding To: dri-devel@lists.freedesktop.org Subject: [PATCH v2 2/4] drm/dp: Add drm_dp_dpcd_read_link_status() Date: Tue, 17 Dec 2013 17:20:05 +0100 Message-Id: <1387297207-7643-3-git-send-email-treding@nvidia.com> X-Mailer: git-send-email 1.8.4.2 In-Reply-To: <1387297207-7643-1-git-send-email-treding@nvidia.com> References: <1387297207-7643-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.6 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 bd622d462ca7..8111b8e5a8bc 100644 --- a/drivers/gpu/drm/drm_dp_helper.c +++ b/drivers/gpu/drm/drm_dp_helper.c @@ -462,3 +462,19 @@ ssize_t drm_dp_dpcd_write(struct drm_dp_aux *aux, unsigned int offset, return -EIO; } 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 0b14e799cd98..38cbaef05005 100644 --- a/include/drm/drm_dp_helper.h +++ b/include/drm/drm_dp_helper.h @@ -461,4 +461,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_ */