From patchwork Mon Apr 18 09:22:04 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vinay Simha B N X-Patchwork-Id: 8871311 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.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 3C4B79F441 for ; Mon, 18 Apr 2016 11:28:24 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5DABB20272 for ; Mon, 18 Apr 2016 11:28:23 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 165BD20270 for ; Mon, 18 Apr 2016 11:28:22 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id F28426E598; Mon, 18 Apr 2016 11:28:10 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pf0-x232.google.com (mail-pf0-x232.google.com [IPv6:2607:f8b0:400e:c00::232]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5F2D86E3A9 for ; Mon, 18 Apr 2016 09:23:15 +0000 (UTC) Received: by mail-pf0-x232.google.com with SMTP id 184so79514581pff.0 for ; Mon, 18 Apr 2016 02:23:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=d516bKoTBrzdrBGbFhJkPFrYUzM1KWuvp3RFahUnHoo=; b=wo3LVgYpXcOsYtlWk4n0i2CAnywl54LQpoUBOSzgOQ7BQY5JTBDbpHSu6eQtfwjjb3 rdvYG4BTP9KK/7mF+Rh18wknbSAj+NJ6916ujUV4SjTHOJm/ZJ2S0wAn1U6EUNrM/kTK KY/CjeNXGqicDpbQOaPn2MDwhkneNlV6BrTvZEU+/tRW2TaAZdba9YRV7M8j9u3ZBDA+ uHtHZnYdL48vZCGXxmQz08juOEd7KB6GNbJEDrtth+WyySZ9jyPr3dljxgsJw4rnP3/H GizH9fKBI83JgZgQ537GYhrO8C4XAbhdvndaDcFl5eN4lP63XeC3ki32Ft6vNlFnMoEx d6fw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=d516bKoTBrzdrBGbFhJkPFrYUzM1KWuvp3RFahUnHoo=; b=AdXBgFRP5i3YH3JoCsOuITDkZ+s/LZxxbDKQ1MW1FxAaHzWLhk4xFDBk7lXwIjBF8p +LarPDRJ0pDYxMkF+hIOSGXMw/yBs6eWjKue7V+ghRcG/2EX04UnEdpQPASSOtz/mibV rksF8yfmg6kq+SJZbJeqFzRKSuSNTVXMYNUEtP+yBtsjDTRCmFislwesK3X0fXulVWqC lHOGUI47ma9Ee7pEb+t6WaFtPPNUAH6j8LlVBBz/sjy3y5kUXS6a3HRxUDtgZUKasKIo vbhoQMI5aERUzlL8Ig3auH0JfG8aOBXQCIdNAsVbwDfG3x7QuS5iaBf0veSL+iFekPIV 06jA== X-Gm-Message-State: AOPr4FVsyYhpvuBgo0i8kveS6RN0JVrC1hJG3O/sJwXCJAglP6mNkiqjyUoZDv4Pu0XLHQ== X-Received: by 10.98.88.68 with SMTP id m65mr37692498pfb.4.1460971394677; Mon, 18 Apr 2016 02:23:14 -0700 (PDT) Received: from localhost.localdomain ([202.83.17.75]) by smtp.gmail.com with ESMTPSA id oy2sm82299796pac.38.2016.04.18.02.23.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 18 Apr 2016 02:23:13 -0700 (PDT) From: Vinay Simha BN To: Subject: [PATCH 1/2] drm/dsi: Implement DCS get display mode Date: Mon, 18 Apr 2016 14:52:04 +0530 Message-Id: <1460971325-26982-1-git-send-email-simhavcs@gmail.com> X-Mailer: git-send-email 2.1.2 X-Mailman-Approved-At: Mon, 18 Apr 2016 11:28:08 +0000 Cc: Vinay Simha BN , open list , "open list:DRM DRIVERS" X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-5.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 Provide a small convenience wrapper that transmits a DCS get_display_mode command. Signed-off-by: Vinay Simha BN --- drivers/gpu/drm/drm_mipi_dsi.c | 24 ++++++++++++++++++++++++ include/drm/drm_mipi_dsi.h | 1 + 2 files changed, 25 insertions(+) diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c index f5d8083..2e032ea 100644 --- a/drivers/gpu/drm/drm_mipi_dsi.c +++ b/drivers/gpu/drm/drm_mipi_dsi.c @@ -792,6 +792,30 @@ int mipi_dsi_dcs_get_power_mode(struct mipi_dsi_device *dsi, u8 *mode) EXPORT_SYMBOL(mipi_dsi_dcs_get_power_mode); /** + * mipi_dsi_dcs_get_display_mode() - query the display module's image mode + * @dsi: DSI peripheral device + * @mode: return location for the display image mode + * + * Return: 0 on success or a negative error code on failure. + */ +int mipi_dsi_dcs_get_display_mode(struct mipi_dsi_device *dsi, u8 *mode) +{ + ssize_t err; + + err = mipi_dsi_dcs_read(dsi, MIPI_DCS_GET_DISPLAY_MODE, mode, + sizeof(*mode)); + if (err <= 0) { + if (err == 0) + err = -ENODATA; + + return err; + } + + return 0; +} +EXPORT_SYMBOL(mipi_dsi_dcs_get_display_mode); + +/** * mipi_dsi_dcs_get_pixel_format() - gets the pixel format for the RGB image * data used by the interface * @dsi: DSI peripheral device diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h index 7a9840f..48fcd65 100644 --- a/include/drm/drm_mipi_dsi.h +++ b/include/drm/drm_mipi_dsi.h @@ -254,6 +254,7 @@ ssize_t mipi_dsi_dcs_read(struct mipi_dsi_device *dsi, u8 cmd, void *data, int mipi_dsi_dcs_nop(struct mipi_dsi_device *dsi); int mipi_dsi_dcs_soft_reset(struct mipi_dsi_device *dsi); int mipi_dsi_dcs_get_power_mode(struct mipi_dsi_device *dsi, u8 *mode); +int mipi_dsi_dcs_get_display_mode(struct mipi_dsi_device *dsi, u8 *mode); int mipi_dsi_dcs_get_pixel_format(struct mipi_dsi_device *dsi, u8 *format); int mipi_dsi_dcs_enter_sleep_mode(struct mipi_dsi_device *dsi); int mipi_dsi_dcs_exit_sleep_mode(struct mipi_dsi_device *dsi);