From patchwork Thu Jan 2 14:12:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 11315833 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 09353138C for ; Thu, 2 Jan 2020 14:13:03 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E5A8420848 for ; Thu, 2 Jan 2020 14:13:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E5A8420848 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=glider.be Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id ABF796E0FF; Thu, 2 Jan 2020 14:12:55 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from michel.telenet-ops.be (michel.telenet-ops.be [IPv6:2a02:1800:110:4::f00:18]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3522F6E0FF for ; Thu, 2 Jan 2020 14:12:54 +0000 (UTC) Received: from ramsan ([84.195.182.253]) by michel.telenet-ops.be with bizsmtp id lSCn2100M5USYZQ06SCnzC; Thu, 02 Jan 2020 15:12:51 +0100 Received: from rox.of.borg ([192.168.97.57]) by ramsan with esmtp (Exim 4.90_1) (envelope-from ) id 1in1DT-0006OT-BY; Thu, 02 Jan 2020 15:12:47 +0100 Received: from geert by rox.of.borg with local (Exim 4.90_1) (envelope-from ) id 1in1DT-00006t-AE; Thu, 02 Jan 2020 15:12:47 +0100 From: Geert Uytterhoeven To: =?utf-8?q?Noralf_Tr=C3=B8nnes?= , David Lechner , David Airlie , Daniel Vetter , Maarten Lankhorst , Maxime Ripard , Rob Herring , Mark Rutland Subject: [PATCH 1/3] dt-bindings: display: sitronix, st7735r: Add Okaya rh128128t Date: Thu, 2 Jan 2020 15:12:44 +0100 Message-Id: <20200102141246.370-2-geert+renesas@glider.be> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200102141246.370-1-geert+renesas@glider.be> References: <20200102141246.370-1-geert+renesas@glider.be> X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-renesas-soc@vger.kernel.org, devicetree@vger.kernel.org, Chris Brandt , Geert Uytterhoeven , dri-devel@lists.freedesktop.org MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Document support for the Okaya RH128128T display, which is a 128x128 1.44" TFT display driven by a Sitronix ST7715R TFT Controller/Driver. ST7715R and ST7735R are very similar. Their major difference is that the former is restricted to displays of up to 132x132 pixels, while the latter supports displays up to 132x162 pixels. Signed-off-by: Geert Uytterhoeven --- .../devicetree/bindings/display/sitronix,st7735r.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/display/sitronix,st7735r.txt b/Documentation/devicetree/bindings/display/sitronix,st7735r.txt index cd5c7186890a2be7..87ebdcb294e29798 100644 --- a/Documentation/devicetree/bindings/display/sitronix,st7735r.txt +++ b/Documentation/devicetree/bindings/display/sitronix,st7735r.txt @@ -4,7 +4,9 @@ This binding is for display panels using a Sitronix ST7735R controller in SPI mode. Required properties: -- compatible: "jianda,jd-t18003-t01", "sitronix,st7735r" +- compatible: Must be one of the following combinations: + - "jianda,jd-t18003-t01", "sitronix,st7735r" + - "okaya,rh128128t", "sitronix,st7715r" - dc-gpios: Display data/command selection (D/CX) - reset-gpios: Reset signal (RSTX) From patchwork Thu Jan 2 14:12:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 11315835 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EFE87138C for ; Thu, 2 Jan 2020 14:13:04 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D847820848 for ; Thu, 2 Jan 2020 14:13:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D847820848 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=glider.be Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7875D6E0FC; Thu, 2 Jan 2020 14:12:58 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from baptiste.telenet-ops.be (baptiste.telenet-ops.be [IPv6:2a02:1800:120:4::f00:13]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0A8BB6E0FC for ; Thu, 2 Jan 2020 14:12:54 +0000 (UTC) Received: from ramsan ([84.195.182.253]) by baptiste.telenet-ops.be with bizsmtp id lSCn210095USYZQ01SCnwR; Thu, 02 Jan 2020 15:12:51 +0100 Received: from rox.of.borg ([192.168.97.57]) by ramsan with esmtp (Exim 4.90_1) (envelope-from ) id 1in1DT-0006OW-CY; Thu, 02 Jan 2020 15:12:47 +0100 Received: from geert by rox.of.borg with local (Exim 4.90_1) (envelope-from ) id 1in1DT-00006w-BD; Thu, 02 Jan 2020 15:12:47 +0100 From: Geert Uytterhoeven To: =?utf-8?q?Noralf_Tr=C3=B8nnes?= , David Lechner , David Airlie , Daniel Vetter , Maarten Lankhorst , Maxime Ripard , Rob Herring , Mark Rutland Subject: [PATCH 2/3] drm/mipi_dbi: Add support for display offsets Date: Thu, 2 Jan 2020 15:12:45 +0100 Message-Id: <20200102141246.370-3-geert+renesas@glider.be> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200102141246.370-1-geert+renesas@glider.be> References: <20200102141246.370-1-geert+renesas@glider.be> X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-renesas-soc@vger.kernel.org, devicetree@vger.kernel.org, Chris Brandt , Geert Uytterhoeven , dri-devel@lists.freedesktop.org MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" If the resolution of the TFT display is smaller than the maximum resolution supported by the display controller, the display may be connected to the driver output arrays with a horizontal and/or vertical offset, leading to a shifted image. Add support for specifying these offsets. Signed-off-by: Geert Uytterhoeven Reviewed-by: Sam Ravnborg --- drivers/gpu/drm/drm_mipi_dbi.c | 30 ++++++++++++++++++++---------- include/drm/drm_mipi_dbi.h | 12 ++++++++++++ 2 files changed, 32 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/drm_mipi_dbi.c b/drivers/gpu/drm/drm_mipi_dbi.c index 16bff1be4b8ac622..27fe81a53c88e338 100644 --- a/drivers/gpu/drm/drm_mipi_dbi.c +++ b/drivers/gpu/drm/drm_mipi_dbi.c @@ -238,6 +238,23 @@ int mipi_dbi_buf_copy(void *dst, struct drm_framebuffer *fb, } EXPORT_SYMBOL(mipi_dbi_buf_copy); +static void mipi_dbi_set_window_address(struct mipi_dbi_dev *dbidev, + unsigned int xs, unsigned int xe, + unsigned int ys, unsigned int ye) +{ + struct mipi_dbi *dbi = &dbidev->dbi; + + xs += dbidev->left_offset; + xe += dbidev->left_offset; + ys += dbidev->top_offset; + ye += dbidev->top_offset; + + mipi_dbi_command(dbi, MIPI_DCS_SET_COLUMN_ADDRESS, (xs >> 8) & 0xff, + xs & 0xff, (xe >> 8) & 0xff, xe & 0xff); + mipi_dbi_command(dbi, MIPI_DCS_SET_PAGE_ADDRESS, (ys >> 8) & 0xff, + ys & 0xff, (ye >> 8) & 0xff, ye & 0xff); +} + static void mipi_dbi_fb_dirty(struct drm_framebuffer *fb, struct drm_rect *rect) { struct drm_gem_object *gem = drm_gem_fb_get_obj(fb, 0); @@ -271,12 +288,8 @@ static void mipi_dbi_fb_dirty(struct drm_framebuffer *fb, struct drm_rect *rect) tr = cma_obj->vaddr; } - mipi_dbi_command(dbi, MIPI_DCS_SET_COLUMN_ADDRESS, - (rect->x1 >> 8) & 0xff, rect->x1 & 0xff, - ((rect->x2 - 1) >> 8) & 0xff, (rect->x2 - 1) & 0xff); - mipi_dbi_command(dbi, MIPI_DCS_SET_PAGE_ADDRESS, - (rect->y1 >> 8) & 0xff, rect->y1 & 0xff, - ((rect->y2 - 1) >> 8) & 0xff, (rect->y2 - 1) & 0xff); + mipi_dbi_set_window_address(dbidev, rect->x1, rect->x2 - 1, rect->y1, + rect->y2 - 1); ret = mipi_dbi_command_buf(dbi, MIPI_DCS_WRITE_MEMORY_START, tr, width * height * 2); @@ -366,10 +379,7 @@ static void mipi_dbi_blank(struct mipi_dbi_dev *dbidev) memset(dbidev->tx_buf, 0, len); - mipi_dbi_command(dbi, MIPI_DCS_SET_COLUMN_ADDRESS, 0, 0, - ((width - 1) >> 8) & 0xFF, (width - 1) & 0xFF); - mipi_dbi_command(dbi, MIPI_DCS_SET_PAGE_ADDRESS, 0, 0, - ((height - 1) >> 8) & 0xFF, (height - 1) & 0xFF); + mipi_dbi_set_window_address(dbidev, 0, width - 1, 0, height - 1); mipi_dbi_command_buf(dbi, MIPI_DCS_WRITE_MEMORY_START, (u8 *)dbidev->tx_buf, len); diff --git a/include/drm/drm_mipi_dbi.h b/include/drm/drm_mipi_dbi.h index 67c66f5ee591e80f..33f325f5af2b921f 100644 --- a/include/drm/drm_mipi_dbi.h +++ b/include/drm/drm_mipi_dbi.h @@ -109,6 +109,18 @@ struct mipi_dbi_dev { */ unsigned int rotation; + /** + * @left_offset: Horizontal offset of the display relative to the + * controller's driver array + */ + unsigned int left_offset; + + /** + * @top_offset: Vertical offset of the display relative to the + * controller's driver array + */ + unsigned int top_offset; + /** * @backlight: backlight device (optional) */ From patchwork Thu Jan 2 14:12:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 11315831 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C4CB1109A for ; Thu, 2 Jan 2020 14:13:00 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id AD09620848 for ; Thu, 2 Jan 2020 14:13:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AD09620848 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=glider.be Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6E0C76E0FE; Thu, 2 Jan 2020 14:12:55 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from laurent.telenet-ops.be (laurent.telenet-ops.be [IPv6:2a02:1800:110:4::f00:19]) by gabe.freedesktop.org (Postfix) with ESMTPS id C5ED26E0FD for ; Thu, 2 Jan 2020 14:12:53 +0000 (UTC) Received: from ramsan ([84.195.182.253]) by laurent.telenet-ops.be with bizsmtp id lSCn2100L5USYZQ01SCnTk; Thu, 02 Jan 2020 15:12:51 +0100 Received: from rox.of.borg ([192.168.97.57]) by ramsan with esmtp (Exim 4.90_1) (envelope-from ) id 1in1DT-0006OY-Do; Thu, 02 Jan 2020 15:12:47 +0100 Received: from geert by rox.of.borg with local (Exim 4.90_1) (envelope-from ) id 1in1DT-000072-CB; Thu, 02 Jan 2020 15:12:47 +0100 From: Geert Uytterhoeven To: =?utf-8?q?Noralf_Tr=C3=B8nnes?= , David Lechner , David Airlie , Daniel Vetter , Maarten Lankhorst , Maxime Ripard , Rob Herring , Mark Rutland Subject: [PATCH 3/3] drm: tiny: st7735r: Add support for Okaya RH128128T Date: Thu, 2 Jan 2020 15:12:46 +0100 Message-Id: <20200102141246.370-4-geert+renesas@glider.be> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200102141246.370-1-geert+renesas@glider.be> References: <20200102141246.370-1-geert+renesas@glider.be> X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-renesas-soc@vger.kernel.org, devicetree@vger.kernel.org, Chris Brandt , Geert Uytterhoeven , dri-devel@lists.freedesktop.org MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Add support for the Okaya RH128128T display to the st7735r driver. The RH128128T is a 128x128 1.44" TFT display driven by a Sitronix ST7715R TFT Controller/Driver. The latter is very similar to the ST7735R, and can be handled by the existing st7735r driver. Signed-off-by: Geert Uytterhoeven --- drivers/gpu/drm/tiny/st7735r.c | 65 ++++++++++++++++++++++++++++------ 1 file changed, 55 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/tiny/st7735r.c b/drivers/gpu/drm/tiny/st7735r.c index 3f4487c716848cf8..05d162e76d8481e5 100644 --- a/drivers/gpu/drm/tiny/st7735r.c +++ b/drivers/gpu/drm/tiny/st7735r.c @@ -1,8 +1,9 @@ // SPDX-License-Identifier: GPL-2.0+ /* - * DRM driver for Sitronix ST7735R panels + * DRM driver for Sitronix ST7715R/ST7735R panels * * Copyright 2017 David Lechner + * Copyright (C) 2019 Glider bvba */ #include @@ -10,6 +11,7 @@ #include #include #include +#include #include #include #include