From patchwork Sat Jul 29 19:17:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Lechner X-Patchwork-Id: 9870089 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D8D506038F for ; Sat, 29 Jul 2017 19:20:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C98EB27D29 for ; Sat, 29 Jul 2017 19:20:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BDB0128789; Sat, 29 Jul 2017 19:20:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 15717287C3 for ; Sat, 29 Jul 2017 19:20:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=GEo1bywIAx4wleowTxe54OWap1ffxqkUcObld4TazAg=; b=Dgx9AHDm7xWp/9F9srvo9DiCYn yZRIAE6/9cgWg+qSVncpzKbsJYtePri2DA89EPr3ZtkLjGaQ34XudXjtjM4F48Te4NMkihi7Nz4mC NXSDQWy9kDDym0i7nvsgGV1czOdbQyKw5TUHSxzqDPto6ZGXFyP0T3Q8FeTuFszq+Y8m8Ge3y0f4h cmn8ML8k793lDSgs1bXov99j2k/pRF6GcBjcndBgeuBTWohadodn1oCDlZpmWZoYRRYNF7+oNwzKP AMksfU14ZHuvctPUp8iRiGW+LJs+10Y9ooCYPFmkaQ1f3Uo6O5TZ1XEvlL3A3M+sDEDI7VJWh4R+N w25DCJbg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dbXHT-0005y2-7e; Sat, 29 Jul 2017 19:20:07 +0000 Received: from vern.gendns.com ([206.190.152.46]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dbXGo-0005Ta-ND for linux-arm-kernel@lists.infradead.org; Sat, 29 Jul 2017 19:19:28 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lechnology.com; s=default; h=References:In-Reply-To:Message-Id:Date:Subject :Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=w0beLGCemBIEzALhISd2WTpBkiczr/EHWIbn3+SPtPk=; b=coNRtsvihmb2cXzj1CTYacG7h x0mjhepod7o4hyNLsmC9BLn7pPTx0FfjMrmlSIFXkoSnepv7XOEUTbzzcsZ4JUmgsrlhHoetY9Izy XDTqnMhhREN6xpKMykTxYc9ZWDj8TXilhZ9DnZytZroUY4Y7xkr8W0xwdlCcxhyCi9iyHX/t9aSYC pcBfDNvOQ5cU+BZuLGdm9fAXel6Jrj7AL67ZzVMkN8UtewjcpV1fedUIWpPyeExwpLtWHi7GCWuON x+cXly7lqh10u7HghmBP6io0WbW9iKlGKc29LMViSKCkihzsa0rAR1g7zEk+xyqAXbaIgzpgyvYjb 2pofhpX1g==; Received: from 108-198-5-147.lightspeed.okcbok.sbcglobal.net ([108.198.5.147]:58148 helo=freyr.lechnology.com) by vern.gendns.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-SHA256:128) (Exim 4.89) (envelope-from ) id 1dbXCt-000DrP-Gh; Sat, 29 Jul 2017 15:15:23 -0400 From: David Lechner To: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org Subject: [PATCH 1/6] drm/tinydrm: Add parameter for MIPI DCS pixel format Date: Sat, 29 Jul 2017 14:17:45 -0500 Message-Id: <1501355870-13960-2-git-send-email-david@lechnology.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1501355870-13960-1-git-send-email-david@lechnology.com> References: <1501355870-13960-1-git-send-email-david@lechnology.com> X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - vern.gendns.com X-AntiAbuse: Original Domain - lists.infradead.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - lechnology.com X-Get-Message-Sender-Via: vern.gendns.com: authenticated_id: davidmain+lechnology.com/only user confirmed/virtual account not confirmed X-Authenticated-Sender: vern.gendns.com: davidmain@lechnology.com X-Source: X-Source-Args: X-Source-Dir: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170729_121926_858955_028F68F5 X-CRM114-Status: GOOD ( 11.63 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , linux-fbdev@vger.kernel.org, David Lechner , Kevin Hilman , David Airlie , Sekhar Nori , linux-kernel@vger.kernel.org, Rob Herring , =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This adds a parameter for MIPI DCS pixel format to mipi_dbi_init(). This is in preparation for supporting displays that don't use a 16bpp memory layout. Signed-off-by: David Lechner --- drivers/gpu/drm/tinydrm/mi0283qt.c | 3 ++- drivers/gpu/drm/tinydrm/mipi-dbi.c | 21 ++++++++++++++++++--- include/drm/tinydrm/mipi-dbi.h | 7 ++++++- include/video/mipi_display.h | 14 ++++++++------ 4 files changed, 34 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/tinydrm/mi0283qt.c b/drivers/gpu/drm/tinydrm/mi0283qt.c index 482ff1c3..2680dab 100644 --- a/drivers/gpu/drm/tinydrm/mi0283qt.c +++ b/drivers/gpu/drm/tinydrm/mi0283qt.c @@ -196,7 +196,8 @@ static int mi0283qt_probe(struct spi_device *spi) device_property_read_u32(dev, "rotation", &rotation); ret = mipi_dbi_spi_init(spi, mipi, dc, &mi0283qt_pipe_funcs, - &mi0283qt_driver, &mi0283qt_mode, rotation); + &mi0283qt_driver, &mi0283qt_mode, + MIPI_DCS_PIXEL_FMT_16BIT, rotation); if (ret) return ret; diff --git a/drivers/gpu/drm/tinydrm/mipi-dbi.c b/drivers/gpu/drm/tinydrm/mipi-dbi.c index c83eeb7..7d49366 100644 --- a/drivers/gpu/drm/tinydrm/mipi-dbi.c +++ b/drivers/gpu/drm/tinydrm/mipi-dbi.c @@ -336,6 +336,7 @@ static const uint32_t mipi_dbi_formats[] = { * @pipe_funcs: Display pipe functions * @driver: DRM driver * @mode: Display mode + * @pixel_fmt: The display memory's pixel format * @rotation: Initial rotation in degrees Counter Clock Wise * * This function initializes a &mipi_dbi structure and it's underlying @@ -352,15 +353,26 @@ static const uint32_t mipi_dbi_formats[] = { int mipi_dbi_init(struct device *dev, struct mipi_dbi *mipi, const struct drm_simple_display_pipe_funcs *pipe_funcs, struct drm_driver *driver, - const struct drm_display_mode *mode, unsigned int rotation) + const struct drm_display_mode *mode, + enum mipi_dcs_pixel_format pixel_fmt, unsigned int rotation) { - size_t bufsize = mode->vdisplay * mode->hdisplay * sizeof(u16); struct tinydrm_device *tdev = &mipi->tinydrm; + size_t bufsize; int ret; if (!mipi->command) return -EINVAL; + switch (pixel_fmt) { + case MIPI_DCS_PIXEL_FMT_16BIT: + bufsize = mode->vdisplay * mode->hdisplay * sizeof(u16); + break; + default: + DRM_ERROR("Pixel format is not supported\n"); + return -EINVAL; + } + mipi->pixel_fmt = pixel_fmt; + mutex_init(&mipi->cmdlock); mipi->tx_buf = devm_kmalloc(dev, bufsize, GFP_KERNEL); @@ -781,6 +793,7 @@ static int mipi_dbi_typec3_command(struct mipi_dbi *mipi, u8 cmd, * @pipe_funcs: Display pipe functions * @driver: DRM driver * @mode: Display mode + * @pixel_fmt: The display memory's pixel format * @rotation: Initial rotation in degrees Counter Clock Wise * * This function sets &mipi_dbi->command, enables &mipi->read_commands for the @@ -803,6 +816,7 @@ int mipi_dbi_spi_init(struct spi_device *spi, struct mipi_dbi *mipi, const struct drm_simple_display_pipe_funcs *pipe_funcs, struct drm_driver *driver, const struct drm_display_mode *mode, + enum mipi_dcs_pixel_format pixel_fmt, unsigned int rotation) { size_t tx_size = tinydrm_spi_max_transfer_size(spi, 0); @@ -849,7 +863,8 @@ int mipi_dbi_spi_init(struct spi_device *spi, struct mipi_dbi *mipi, return -ENOMEM; } - return mipi_dbi_init(dev, mipi, pipe_funcs, driver, mode, rotation); + return mipi_dbi_init(dev, mipi, pipe_funcs, driver, mode, pixel_fmt, + rotation); } EXPORT_SYMBOL(mipi_dbi_spi_init); diff --git a/include/drm/tinydrm/mipi-dbi.h b/include/drm/tinydrm/mipi-dbi.h index d137b16..dda100c 100644 --- a/include/drm/tinydrm/mipi-dbi.h +++ b/include/drm/tinydrm/mipi-dbi.h @@ -13,6 +13,7 @@ #define __LINUX_MIPI_DBI_H #include +#include