* [PATCH 0/3] Support for tft displays based on ilitek,ili9488
@ 2020-06-13 14:06 Kamlesh Gurudasani
2020-06-13 14:06 ` [PATCH 1/3] dt-bindings: add vendor prefix for EastRising Technology Co., Ltd Kamlesh Gurudasani
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Kamlesh Gurudasani @ 2020-06-13 14:06 UTC (permalink / raw)
To: Rob Herring, Sam Ravnborg, Noralf Tronnes, David Airlie, Daniel Vetter
Cc: devicetree, Kamlesh Gurudasani, linux-usb, dri-devel
The goal of this series is to get the displays based on ilitek,ili9488
working.
Eastrising,er-tft035-6 is a display based on ilitek,ili9488
Kamlesh Gurudasani (3):
dt-bindings: add vendor prefix for EastRising Technology Co.,Ltd
dt-bindings: add binding for Ilitek ili9488 based display panels
drm/tiny: add support for tft displays based on ilitek,ili9488
.../bindings/display/ilitek,ili9488.yaml | 71 ++++
.../devicetree/bindings/vendor-prefixes.yaml | 2 +
MAINTAINERS | 7 +
drivers/gpu/drm/tiny/Kconfig | 13 +
drivers/gpu/drm/tiny/Makefile | 1 +
drivers/gpu/drm/tiny/ili9488.c | 446 +++++++++++++++++++++
6 files changed, 540 insertions(+)
create mode 100644 Documentation/devicetree/bindings/display/ilitek,ili9488.yaml
create mode 100644 drivers/gpu/drm/tiny/ili9488.c
--
2.7.4
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/3] dt-bindings: add vendor prefix for EastRising Technology Co., Ltd
2020-06-13 14:06 [PATCH 0/3] Support for tft displays based on ilitek,ili9488 Kamlesh Gurudasani
@ 2020-06-13 14:06 ` Kamlesh Gurudasani
2020-07-15 18:13 ` Rob Herring
2020-06-13 14:07 ` [PATCH 2/3] dt-bindings: add binding for Ilitek ili9488 based display panels Kamlesh Gurudasani
2020-06-13 14:07 ` [PATCH 3/3] drm/tiny: add support for tft displays based on ilitek, ili9488 Kamlesh Gurudasani
2 siblings, 1 reply; 7+ messages in thread
From: Kamlesh Gurudasani @ 2020-06-13 14:06 UTC (permalink / raw)
To: Rob Herring, Sam Ravnborg, Noralf Tronnes, David Airlie, Daniel Vetter
Cc: devicetree, Kamlesh Gurudasani, linux-usb, dri-devel
Add vendor prefix for display manufacturer company EastRising
Technology Co.,Ltd
[1]https://eastrising.en.ec21.com/
Signed-off-by: Kamlesh Gurudasani <kamlesh.gurudasani@gmail.com>
---
Documentation/devicetree/bindings/vendor-prefixes.yaml | 2 ++
1 file changed, 2 insertions(+)
diff --git a/Documentation/devicetree/bindings/vendor-prefixes.yaml b/Documentation/devicetree/bindings/vendor-prefixes.yaml
index 7a39732..1b3d445 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.yaml
+++ b/Documentation/devicetree/bindings/vendor-prefixes.yaml
@@ -279,6 +279,8 @@ patternProperties:
description: Dyna-Image
"^ea,.*":
description: Embedded Artists AB
+ "^eastrising,.*":
+ description: EastRising Technology Co.,Ltd
"^ebs-systart,.*":
description: EBS-SYSTART GmbH
"^ebv,.*":
--
2.7.4
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/3] dt-bindings: add binding for Ilitek ili9488 based display panels
2020-06-13 14:06 [PATCH 0/3] Support for tft displays based on ilitek,ili9488 Kamlesh Gurudasani
2020-06-13 14:06 ` [PATCH 1/3] dt-bindings: add vendor prefix for EastRising Technology Co., Ltd Kamlesh Gurudasani
@ 2020-06-13 14:07 ` Kamlesh Gurudasani
2020-07-15 18:14 ` Rob Herring
2020-06-13 14:07 ` [PATCH 3/3] drm/tiny: add support for tft displays based on ilitek, ili9488 Kamlesh Gurudasani
2 siblings, 1 reply; 7+ messages in thread
From: Kamlesh Gurudasani @ 2020-06-13 14:07 UTC (permalink / raw)
To: Rob Herring, Sam Ravnborg, Noralf Tronnes, David Airlie, Daniel Vetter
Cc: devicetree, Kamlesh Gurudasani, linux-usb, dri-devel
This adds binding for ilitek,ili9488 based display panels
Signed-off-by: Kamlesh Gurudasani <kamlesh.gurudasani@gmail.com>
---
.../bindings/display/ilitek,ili9488.yaml | 71 ++++++++++++++++++++++
1 file changed, 71 insertions(+)
create mode 100644 Documentation/devicetree/bindings/display/ilitek,ili9488.yaml
diff --git a/Documentation/devicetree/bindings/display/ilitek,ili9488.yaml b/Documentation/devicetree/bindings/display/ilitek,ili9488.yaml
new file mode 100644
index 0000000..61e7a63
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/ilitek,ili9488.yaml
@@ -0,0 +1,71 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/ilitek,ili9488.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Ilitek ILI9488 display panels device tree bindings
+
+maintainers:
+ - Kamlesh Gurudasani <kamlesh.gurudasani@gmail.com>
+
+description:
+ This binding is for display panels using an Ilitek ILI9488 controller in SPI
+ mode.
+
+allOf:
+ - $ref: panel/panel-common.yaml#
+
+properties:
+ compatible:
+ items:
+ - enum:
+ # Eastrising 3.5" 320x480 Color TFT LCD
+ - eastrising,er-tft035-6
+ - const: ilitek,ili9488
+
+ spi-max-frequency:
+ maximum: 32000000
+
+ dc-gpios:
+ maxItems: 1
+ description: Display data/command selection (D/CX)
+
+ backlight: true
+ reg: true
+ reset-gpios: true
+ rotation: true
+
+required:
+ - compatible
+ - reg
+ - dc-gpios
+ - reset-gpios
+
+additionalProperties: false
+
+examples:
+ - |
+ #include <dt-bindings/gpio/gpio.h>
+
+ backlight: backlight {
+ compatible = "gpio-backlight";
+ gpios = <&gpio 22 GPIO_ACTIVE_HIGH>;
+ };
+ spi {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+
+ display@0{
+ compatible = "eastrising,er-tft035-6", "ilitek,ili9488";
+ reg = <0>;
+ spi-max-frequency = <32000000>;
+ dc-gpios = <&gpio0 24 GPIO_ACTIVE_HIGH>;
+ reset-gpios = <&gpio0 25 GPIO_ACTIVE_HIGH>;
+ rotation = <90>;
+ backlight = <&backlight>;
+ };
+ };
+
+...
--
2.7.4
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 3/3] drm/tiny: add support for tft displays based on ilitek, ili9488
2020-06-13 14:06 [PATCH 0/3] Support for tft displays based on ilitek,ili9488 Kamlesh Gurudasani
2020-06-13 14:06 ` [PATCH 1/3] dt-bindings: add vendor prefix for EastRising Technology Co., Ltd Kamlesh Gurudasani
2020-06-13 14:07 ` [PATCH 2/3] dt-bindings: add binding for Ilitek ili9488 based display panels Kamlesh Gurudasani
@ 2020-06-13 14:07 ` Kamlesh Gurudasani
2020-06-13 16:07 ` [PATCH 3/3] drm/tiny: add support for tft displays based on ilitek,ili9488 kernel test robot
2 siblings, 1 reply; 7+ messages in thread
From: Kamlesh Gurudasani @ 2020-06-13 14:07 UTC (permalink / raw)
To: Rob Herring, Sam Ravnborg, Noralf Tronnes, David Airlie, Daniel Vetter
Cc: devicetree, Kamlesh Gurudasani, linux-usb, dri-devel
This adds support fot ilitek,ili9488 based displays with 4 wire spi
interface. In 4 wire spi mode, ili9488 only supports 18 bit per pixel.
Eastrising,er-tft035-6 is a display based on ilitek,ili9488
with 4 wire spi interface.
Signed-off-by: Kamlesh Gurudasani <kamlesh.gurudasani@gmail.com>
---
MAINTAINERS | 7 +
drivers/gpu/drm/tiny/Kconfig | 13 ++
drivers/gpu/drm/tiny/Makefile | 1 +
drivers/gpu/drm/tiny/ili9488.c | 446 +++++++++++++++++++++++++++++++++++++++++
4 files changed, 467 insertions(+)
create mode 100644 drivers/gpu/drm/tiny/ili9488.c
diff --git a/MAINTAINERS b/MAINTAINERS
index d59c5d3..6b062ef 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -5329,6 +5329,13 @@ T: git git://anongit.freedesktop.org/drm/drm-misc
F: Documentation/devicetree/bindings/display/ilitek,ili9486.yaml
F: drivers/gpu/drm/tiny/ili9486.c
+DRM DRIVER FOR ILITEK ILI9488 PANELS
+M: Kamlesh Gurudasani <kamlesh.gurudasani@gmail.com>
+S: Maintained
+T: git git://anongit.freedesktop.org/drm/drm-misc
+F: Documentation/devicetree/bindings/display/ilitek,ili9488.yaml
+F: drivers/gpu/drm/tiny/ili9488.c
+
DRM DRIVER FOR INTEL I810 VIDEO CARDS
S: Orphan / Obsolete
F: drivers/gpu/drm/i810/
diff --git a/drivers/gpu/drm/tiny/Kconfig b/drivers/gpu/drm/tiny/Kconfig
index 2b6414f..a380a92 100644
--- a/drivers/gpu/drm/tiny/Kconfig
+++ b/drivers/gpu/drm/tiny/Kconfig
@@ -80,6 +80,19 @@ config TINYDRM_ILI9486
If M is selected the module will be called ili9486.
+config TINYDRM_ILI9488
+ tristate "DRM support for ILI9488 display panels"
+ depends on DRM && SPI
+ select DRM_KMS_HELPER
+ select DRM_KMS_CMA_HELPER
+ select DRM_MIPI_DBI
+ select BACKLIGHT_CLASS_DEVICE
+ help
+ DRM driver for the following Ilitek ILI9488 panels:
+ * ER-TFT035-6 3.5" 320x480 TFT (EastRising 3.5")
+
+ If M is selected the module will be called ili9488.
+
config TINYDRM_MI0283QT
tristate "DRM support for MI0283QT"
depends on DRM && SPI
diff --git a/drivers/gpu/drm/tiny/Makefile b/drivers/gpu/drm/tiny/Makefile
index 6ae4e9e5..3e40776 100644
--- a/drivers/gpu/drm/tiny/Makefile
+++ b/drivers/gpu/drm/tiny/Makefile
@@ -6,6 +6,7 @@ obj-$(CONFIG_TINYDRM_HX8357D) += hx8357d.o
obj-$(CONFIG_TINYDRM_ILI9225) += ili9225.o
obj-$(CONFIG_TINYDRM_ILI9341) += ili9341.o
obj-$(CONFIG_TINYDRM_ILI9486) += ili9486.o
+obj-$(CONFIG_TINYDRM_ILI9488) += ili9488.o
obj-$(CONFIG_TINYDRM_MI0283QT) += mi0283qt.o
obj-$(CONFIG_TINYDRM_REPAPER) += repaper.o
obj-$(CONFIG_TINYDRM_ST7586) += st7586.o
diff --git a/drivers/gpu/drm/tiny/ili9488.c b/drivers/gpu/drm/tiny/ili9488.c
new file mode 100644
index 0000000..db3f585
--- /dev/null
+++ b/drivers/gpu/drm/tiny/ili9488.c
@@ -0,0 +1,446 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * DRM driver for Ilitek ILI9488 panels
+ *
+ * Copyright 2020 Kamlesh Gurudasani <kamlesh.gurudasani@gmail.com>
+ */
+
+#include <linux/delay.h>
+#include <linux/dma-buf.h>
+#include <linux/gpio/consumer.h>
+#include <linux/module.h>
+#include <linux/property.h>
+#include <linux/spi/spi.h>
+#include <video/mipi_display.h>
+
+#include <drm/drm_atomic_helper.h>
+#include <drm/drm_damage_helper.h>
+#include <drm/drm_drv.h>
+#include <drm/drm_fb_cma_helper.h>
+#include <drm/drm_fb_helper.h>
+#include <drm/drm_fourcc.h>
+#include <drm/drm_gem_cma_helper.h>
+#include <drm/drm_gem_framebuffer_helper.h>
+#include <drm/drm_mipi_dbi.h>
+#include <drm/drm_rect.h>
+
+#define ILI9488_VCOM_CONTROL_1 0xC5
+#define ILI9488_COLUMN_ADDRESS_SET 0x2A
+#define ILI9488_PAGE_ADDRESS_SET 0x2B
+#define ILI9488_MEMORY_WRITE 0x2C
+#define ILI9488_POSITIVE_GAMMA_CORRECTION 0xE0
+#define ILI9488_NEGATIVE_GAMMA_CORRECTION 0xE1
+#define ILI9488_POWER_CONTROL_1 0xC0
+#define ILI9488_POWER_CONTROL_2 0xC1
+
+#define ILI9488_MEMORY_ACCESS_CONTROL 0x36
+#define ILI9488_COLMOD_PIXEL_FORMAT_SET 0x3A
+#define ILI9488_INTERFACE_MODE_CONTROL 0xB0
+#define ILI9488_FRAME_RATE_CONTROL_PARTIAL 0xB3
+#define ILI9488_DISPLAY_INVERSION_CONTROL 0xB4
+#define ILI9488_SET_IMAGE_FUNCTION 0xE9
+#define ILI9488_ADJUST_CONTROL_3 0xF7
+#define ILI9488_ADJUST_CONTROL_3 0xF7
+#define ILI9488_DISPLAY_ON 0x29
+#define ILI9488_DISPLAY_OFF 0x28
+#define ILI9488_ENTER_SLEEP_MODE 0x10
+#define ILI9488_DBI_BPP18 0x06
+#define ILI9488_DPI_BPP18 0x60
+#define ILI9488_FRAME_RATE_CONTROL_NORMAL 0xB1
+#define ILI9488_SLEEP_OUT 0x11
+
+#define ILI9488_MADCTL_BGR BIT(3)
+#define ILI9488_MADCTL_MV BIT(5)
+#define ILI9488_MADCTL_MX BIT(6)
+#define ILI9488_MADCTL_MY BIT(7)
+
+static void ili9488_rgb565_to_rgb666_line(u8 *dst, u16 *sbuf,
+ unsigned int pixels)
+{
+ unsigned int x;
+
+ for (x = 0; x < pixels; x++) {
+ *dst++ = ((*sbuf & 0xF800) >> 8);
+ *dst++ = ((*sbuf & 0x07E0) >> 3);
+ *dst++ = ((*sbuf & 0x001F) << 3);
+ sbuf++;
+ }
+}
+
+static void ili9488_rgb565_to_rgb666(u8 *dst, void *vaddr,
+ struct drm_framebuffer *fb,
+ struct drm_rect *rect)
+{
+ size_t linepixels = rect->x2 - rect->x1;
+ size_t src_len = linepixels * sizeof(u16);
+ size_t dst_len = linepixels * 3;
+ unsigned int y, lines = rect->y2 - rect->y1;
+ u16 *sbuf;
+
+ /*
+ * The cma memory is write-combined so reads are uncached.
+ * Speed up by fetching one line at a time.
+ */
+ sbuf = kmalloc(src_len, GFP_KERNEL);
+ if (!sbuf)
+ return;
+
+ vaddr += rect->y1 * fb->pitches[0] + rect->x1 * sizeof(u16);
+ for (y = 0; y < lines; y++) {
+ memcpy(sbuf, vaddr, src_len);
+ ili9488_rgb565_to_rgb666_line(dst, sbuf, linepixels);
+ vaddr += fb->pitches[0];
+ dst += dst_len;
+ }
+ kfree(sbuf);
+}
+
+static int ili9488_buf_copy(void *dst, struct drm_framebuffer *fb,
+ struct drm_rect *rect)
+{
+ struct drm_gem_cma_object *cma_obj = drm_fb_cma_get_gem_obj(fb, 0);
+ struct dma_buf_attachment *import_attach = cma_obj->base.import_attach;
+ struct drm_format_name_buf format_name;
+ void *src = cma_obj->vaddr;
+ int ret = 0;
+
+ if (import_attach) {
+ ret = dma_buf_begin_cpu_access(import_attach->dmabuf,
+ DMA_FROM_DEVICE);
+ if (ret)
+ return ret;
+ }
+
+ switch (fb->format->format) {
+ case DRM_FORMAT_RGB565:
+ ili9488_rgb565_to_rgb666(dst, src, fb, rect);
+ break;
+ default:
+ dev_err_once(fb->dev->dev, "Format is not supported: %s\n",
+ drm_get_format_name(fb->format->format,
+ &format_name));
+ return -EINVAL;
+ }
+
+ if (import_attach)
+ ret = dma_buf_end_cpu_access(import_attach->dmabuf,
+ DMA_FROM_DEVICE);
+ return ret;
+}
+
+static void ili9488_fb_dirty(struct drm_framebuffer *fb, struct drm_rect *rect)
+{
+ struct drm_gem_cma_object *cma_obj = drm_fb_cma_get_gem_obj(fb, 0);
+ struct mipi_dbi_dev *dbidev = drm_to_mipi_dbi_dev(fb->dev);
+ struct mipi_dbi *dbi = &dbidev->dbi;
+ int idx, ret = 0;
+ void *tr;
+ bool full;
+ unsigned int height = rect->y2 - rect->y1;
+ unsigned int width = rect->x2 - rect->x1;
+
+ if (!dbidev->enabled)
+ return;
+
+ if (!drm_dev_enter(fb->dev, &idx))
+ return;
+
+ full = width == fb->width && height == fb->height;
+
+ DRM_DEBUG_KMS("Flushing [FB:%d] " DRM_RECT_FMT "\n", fb->base.id,
+ DRM_RECT_ARG(rect));
+
+ /* Always invoke copy buffer routine as the display supports
+ * only RGB666 format which is not implemented in DRM
+ */
+ if (!dbi->dc || !full ||
+ fb->format->format == DRM_FORMAT_RGB565) {
+ tr = dbidev->tx_buf;
+ ret = ili9488_buf_copy(dbidev->tx_buf, fb, rect);
+ if (ret)
+ goto err_msg;
+ } else {
+ tr = cma_obj->vaddr;
+ }
+
+ mipi_dbi_command(dbi, ILI9488_COLUMN_ADDRESS_SET,
+ (rect->x1 >> 8) & 0xFF, rect->x1 & 0xFF,
+ (rect->x2 >> 8) & 0xFF, (rect->x2 - 1) & 0xFF);
+
+ mipi_dbi_command(dbi, ILI9488_PAGE_ADDRESS_SET,
+ (rect->y1 >> 8) & 0xFF, rect->y1 & 0xFF,
+ (rect->y2 >> 8) & 0xFF, (rect->y2 - 1) & 0xFF);
+
+ ret = mipi_dbi_command_buf(dbi, ILI9488_MEMORY_WRITE, tr,
+ width * height * 3);
+
+ err_msg:
+ if (ret)
+ dev_err_once(fb->dev->dev, "Failed to update display %d\n", ret);
+
+ drm_dev_exit(idx);
+}
+
+static void ili9488_pipe_update(struct drm_simple_display_pipe *pipe,
+ struct drm_plane_state *old_state)
+{
+ struct drm_plane_state *state = pipe->plane.state;
+ struct drm_rect rect;
+
+ if (drm_atomic_helper_damage_merged(old_state, state, &rect))
+ ili9488_fb_dirty(state->fb, &rect);
+}
+
+static void ili9488_pipe_enable(struct drm_simple_display_pipe *pipe,
+ struct drm_crtc_state *crtc_state,
+ struct drm_plane_state *plane_state)
+{
+ struct mipi_dbi_dev *dbidev = drm_to_mipi_dbi_dev(pipe->crtc.dev);
+ struct drm_framebuffer *fb = plane_state->fb;
+ struct mipi_dbi *dbi = &dbidev->dbi;
+ u8 addr_mode;
+ int ret, idx;
+ struct drm_rect rect = {
+ .x1 = 0,
+ .x2 = fb->width,
+ .y1 = 0,
+ .y2 = fb->height,
+ };
+
+ if (!drm_dev_enter(pipe->crtc.dev, &idx))
+ return;
+
+ DRM_DEBUG_KMS("\n");
+
+ ret = mipi_dbi_poweron_conditional_reset(dbidev);
+ if (ret < 0)
+ goto out_exit;
+ if (ret == 1)
+ goto out_enable;
+
+ mipi_dbi_command(dbi, ILI9488_POSITIVE_GAMMA_CORRECTION,
+ 0x00, 0x03, 0x09, 0x08, 0x16,
+ 0x0a, 0x3f, 0x78, 0x4c, 0x09,
+ 0x0a, 0x08, 0x16, 0x1a, 0x0f);
+
+ mipi_dbi_command(dbi, ILI9488_NEGATIVE_GAMMA_CORRECTION,
+ 0x00, 0x16, 0x19, 0x03, 0x0f,
+ 0x05, 0x32, 0x45, 0x46, 0x04,
+ 0x0e, 0x0d, 0x35, 0x37, 0x0f);
+
+ mipi_dbi_command(dbi, ILI9488_POWER_CONTROL_1, 0x17, 0x15);
+
+ mipi_dbi_command(dbi, ILI9488_POWER_CONTROL_2, 0x41);
+
+ mipi_dbi_command(dbi, ILI9488_VCOM_CONTROL_1, 0x00, 0x12, 0x80);
+
+ mipi_dbi_command(dbi, ILI9488_COLMOD_PIXEL_FORMAT_SET,
+ ILI9488_DBI_BPP18 | ILI9488_DPI_BPP18);
+
+ mipi_dbi_command(dbi, ILI9488_INTERFACE_MODE_CONTROL, 0x80);
+
+ mipi_dbi_command(dbi, ILI9488_FRAME_RATE_CONTROL_NORMAL, 0xa0);
+
+ mipi_dbi_command(dbi, ILI9488_DISPLAY_INVERSION_CONTROL, 0x02);
+
+ mipi_dbi_command(dbi, ILI9488_SET_IMAGE_FUNCTION, 0x00);
+
+ mipi_dbi_command(dbi, ILI9488_ADJUST_CONTROL_3,
+ 0xa9, 0x51, 0x2c, 0x82);
+
+ mipi_dbi_command(dbi, ILI9488_SLEEP_OUT);
+
+ msleep(120);
+
+ mipi_dbi_command(dbi, ILI9488_DISPLAY_ON);
+
+ dbidev->enabled = true;
+ ili9488_fb_dirty(fb, &rect);
+
+ out_enable:
+ switch (dbidev->rotation) {
+ default:
+ addr_mode = ILI9488_MADCTL_MX;
+ break;
+ case 90:
+ addr_mode = ILI9488_MADCTL_MV;
+ break;
+ case 180:
+ addr_mode = ILI9488_MADCTL_MY;
+ break;
+ case 270:
+ addr_mode = ILI9488_MADCTL_MV | ILI9488_MADCTL_MY |
+ ILI9488_MADCTL_MX;
+ break;
+ }
+ addr_mode |= ILI9488_MADCTL_BGR;
+ mipi_dbi_command(dbi, MIPI_DCS_SET_ADDRESS_MODE, addr_mode);
+ out_exit:
+ drm_dev_exit(idx);
+}
+
+static void ili9488_pipe_disable(struct drm_simple_display_pipe *pipe)
+{
+ struct mipi_dbi_dev *dbidev = drm_to_mipi_dbi_dev(pipe->crtc.dev);
+
+ /*
+ * This callback is not protected by drm_dev_enter/exit since we want to
+ * turn off the display on regular driver unload. It's highly unlikely
+ * that the underlying SPI controller is gone should this be called
+ * after unplug.
+ */
+
+ DRM_DEBUG_KMS("\n");
+
+ if (!dbidev->enabled)
+ return;
+
+ mipi_dbi_command(&dbidev->dbi, MIPI_DCS_SET_DISPLAY_OFF);
+ dbidev->enabled = false;
+}
+
+static const u32 ili9488_formats[] = {
+ DRM_FORMAT_RGB565,
+};
+
+static const struct drm_simple_display_pipe_funcs ili9488_pipe_funcs = {
+ .enable = ili9488_pipe_enable,
+ .disable = ili9488_pipe_disable,
+ .update = ili9488_pipe_update,
+ .prepare_fb = drm_gem_fb_simple_display_pipe_prepare_fb,
+};
+
+static const struct drm_display_mode ili9488_mode = {
+ DRM_SIMPLE_MODE(320, 480, 49, 73),
+};
+
+DEFINE_DRM_GEM_CMA_FOPS(ili9488_fops);
+
+static struct drm_driver ili9488_driver = {
+ .driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
+ .fops = &ili9488_fops,
+ DRM_GEM_CMA_DRIVER_OPS_VMAP,
+ .debugfs_init = mipi_dbi_debugfs_init,
+ .name = "ili9488",
+ .desc = "Ilitek ILI9488",
+ .date = "20200607",
+ .major = 1,
+ .minor = 0,
+};
+
+static const struct of_device_id ili9488_of_match[] = {
+ { .compatible = "eastrising,er-tft035-6" },
+ { }
+};
+MODULE_DEVICE_TABLE(of, ili9488_of_match);
+
+static const struct spi_device_id ili9488_id[] = {
+ { "er-tft035-6", 0 },
+ { }
+};
+MODULE_DEVICE_TABLE(spi, ili9488_id);
+
+static int ili9488_probe(struct spi_device *spi)
+{
+ struct device *dev = &spi->dev;
+ struct mipi_dbi_dev *dbidev;
+ struct drm_device *drm;
+ struct mipi_dbi *dbi;
+ struct gpio_desc *dc;
+ u32 rotation = 0;
+ size_t bufsize;
+ int ret;
+
+ dbidev = devm_drm_dev_alloc(dev, &ili9488_driver,
+ struct mipi_dbi_dev, drm);
+ if (IS_ERR(dbidev))
+ return PTR_ERR(dbidev);
+
+ dbi = &dbidev->dbi;
+ drm = &dbidev->drm;
+
+ ret = devm_drm_dev_init(dev, drm, &ili9488_driver);
+ if (ret) {
+ kfree(dbidev);
+ return ret;
+ }
+
+ drm_mode_config_init(drm);
+
+ bufsize = ili9488_mode.vdisplay * ili9488_mode.hdisplay * 3;
+
+ dbi->reset = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH);
+ if (IS_ERR(dbi->reset)) {
+ DRM_DEV_ERROR(dev, "Failed to get gpio 'reset'\n");
+ return PTR_ERR(dbi->reset);
+ }
+
+ dc = devm_gpiod_get(dev, "dc", GPIOD_OUT_LOW);
+ if (IS_ERR(dc)) {
+ DRM_DEV_ERROR(dev, "Failed to get gpio 'dc'\n");
+ return PTR_ERR(dc);
+ }
+
+ dbidev->backlight = devm_of_find_backlight(dev);
+ if (IS_ERR(dbidev->backlight))
+ return PTR_ERR(dbidev->backlight);
+
+ device_property_read_u32(dev, "rotation", &rotation);
+
+ ret = mipi_dbi_spi_init(spi, dbi, dc);
+ if (ret)
+ return ret;
+
+ dbidev->drm.mode_config.preferred_depth = 16;
+
+ ret = mipi_dbi_dev_init_with_formats(dbidev, &ili9488_pipe_funcs,
+ ili9488_formats,
+ ARRAY_SIZE(ili9488_formats),
+ &ili9488_mode, rotation, bufsize);
+ if (ret)
+ return ret;
+
+ drm_mode_config_reset(drm);
+
+ ret = drm_dev_register(drm, 0);
+ if (ret)
+ return ret;
+
+ spi_set_drvdata(spi, drm);
+
+ drm_fbdev_generic_setup(drm, 0);
+
+ return 0;
+}
+
+static int ili9488_remove(struct spi_device *spi)
+{
+ struct drm_device *drm = spi_get_drvdata(spi);
+
+ drm_dev_unplug(drm);
+ drm_atomic_helper_shutdown(drm);
+
+ return 0;
+}
+
+static void ili9488_shutdown(struct spi_device *spi)
+{
+ drm_atomic_helper_shutdown(spi_get_drvdata(spi));
+}
+
+static struct spi_driver ili9488_spi_driver = {
+ .driver = {
+ .name = "ili9488",
+ .owner = THIS_MODULE,
+ .of_match_table = ili9488_of_match,
+ },
+ .id_table = ili9488_id,
+ .probe = ili9488_probe,
+ .remove = ili9488_remove,
+ .shutdown = ili9488_shutdown,
+};
+module_spi_driver(ili9488_spi_driver);
+
+MODULE_DESCRIPTION("Ilitek ILI9488 DRM driver");
+MODULE_AUTHOR("Kamlesh Gurudasani <kamlesh.gurudasani@gmail.com>");
+MODULE_LICENSE("GPL");
--
2.7.4
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 3/3] drm/tiny: add support for tft displays based on ilitek,ili9488
2020-06-13 14:07 ` [PATCH 3/3] drm/tiny: add support for tft displays based on ilitek, ili9488 Kamlesh Gurudasani
@ 2020-06-13 16:07 ` kernel test robot
0 siblings, 0 replies; 7+ messages in thread
From: kernel test robot @ 2020-06-13 16:07 UTC (permalink / raw)
To: Kamlesh Gurudasani, Rob Herring, Sam Ravnborg, Noralf Tronnes,
David Airlie, Daniel Vetter
Cc: devicetree, Kamlesh Gurudasani, kbuild-all, linux-usb, dri-devel
[-- Attachment #1: Type: text/plain, Size: 4964 bytes --]
Hi Kamlesh,
I love your patch! Yet something to improve:
[auto build test ERROR on robh/for-next]
[also build test ERROR on drm-intel/for-linux-next linus/master v5.7 next-20200613]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Kamlesh-Gurudasani/Support-for-tft-displays-based-on-ilitek-ili9488/20200613-221019
base: https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
config: alpha-allyesconfig (attached as .config)
compiler: alpha-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=alpha
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All errors (new ones prefixed by >>, old ones prefixed by <<):
>> drivers/gpu/drm/tiny/ili9488.c:322:2: error: 'DRM_GEM_CMA_DRIVER_OPS_VMAP' undeclared here (not in a function)
322 | DRM_GEM_CMA_DRIVER_OPS_VMAP,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/tiny/ili9488.c: In function 'ili9488_probe':
>> drivers/gpu/drm/tiny/ili9488.c:354:11: error: implicit declaration of function 'devm_drm_dev_alloc'; did you mean 'drm_dev_alloc'? [-Werror=implicit-function-declaration]
354 | dbidev = devm_drm_dev_alloc(dev, &ili9488_driver,
| ^~~~~~~~~~~~~~~~~~
| drm_dev_alloc
>> drivers/gpu/drm/tiny/ili9488.c:355:9: error: expected expression before 'struct'
355 | struct mipi_dbi_dev, drm);
| ^~~~~~
cc1: some warnings being treated as errors
vim +/DRM_GEM_CMA_DRIVER_OPS_VMAP +322 drivers/gpu/drm/tiny/ili9488.c
318
319 static struct drm_driver ili9488_driver = {
320 .driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
321 .fops = &ili9488_fops,
> 322 DRM_GEM_CMA_DRIVER_OPS_VMAP,
323 .debugfs_init = mipi_dbi_debugfs_init,
324 .name = "ili9488",
325 .desc = "Ilitek ILI9488",
326 .date = "20200607",
327 .major = 1,
328 .minor = 0,
329 };
330
331 static const struct of_device_id ili9488_of_match[] = {
332 { .compatible = "eastrising,er-tft035-6" },
333 { }
334 };
335 MODULE_DEVICE_TABLE(of, ili9488_of_match);
336
337 static const struct spi_device_id ili9488_id[] = {
338 { "er-tft035-6", 0 },
339 { }
340 };
341 MODULE_DEVICE_TABLE(spi, ili9488_id);
342
343 static int ili9488_probe(struct spi_device *spi)
344 {
345 struct device *dev = &spi->dev;
346 struct mipi_dbi_dev *dbidev;
347 struct drm_device *drm;
348 struct mipi_dbi *dbi;
349 struct gpio_desc *dc;
350 u32 rotation = 0;
351 size_t bufsize;
352 int ret;
353
> 354 dbidev = devm_drm_dev_alloc(dev, &ili9488_driver,
> 355 struct mipi_dbi_dev, drm);
356 if (IS_ERR(dbidev))
357 return PTR_ERR(dbidev);
358
359 dbi = &dbidev->dbi;
360 drm = &dbidev->drm;
361
362 ret = devm_drm_dev_init(dev, drm, &ili9488_driver);
363 if (ret) {
364 kfree(dbidev);
365 return ret;
366 }
367
368 drm_mode_config_init(drm);
369
370 bufsize = ili9488_mode.vdisplay * ili9488_mode.hdisplay * 3;
371
372 dbi->reset = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH);
373 if (IS_ERR(dbi->reset)) {
374 DRM_DEV_ERROR(dev, "Failed to get gpio 'reset'\n");
375 return PTR_ERR(dbi->reset);
376 }
377
378 dc = devm_gpiod_get(dev, "dc", GPIOD_OUT_LOW);
379 if (IS_ERR(dc)) {
380 DRM_DEV_ERROR(dev, "Failed to get gpio 'dc'\n");
381 return PTR_ERR(dc);
382 }
383
384 dbidev->backlight = devm_of_find_backlight(dev);
385 if (IS_ERR(dbidev->backlight))
386 return PTR_ERR(dbidev->backlight);
387
388 device_property_read_u32(dev, "rotation", &rotation);
389
390 ret = mipi_dbi_spi_init(spi, dbi, dc);
391 if (ret)
392 return ret;
393
394 dbidev->drm.mode_config.preferred_depth = 16;
395
396 ret = mipi_dbi_dev_init_with_formats(dbidev, &ili9488_pipe_funcs,
397 ili9488_formats,
398 ARRAY_SIZE(ili9488_formats),
399 &ili9488_mode, rotation, bufsize);
400 if (ret)
401 return ret;
402
403 drm_mode_config_reset(drm);
404
405 ret = drm_dev_register(drm, 0);
406 if (ret)
407 return ret;
408
409 spi_set_drvdata(spi, drm);
410
411 drm_fbdev_generic_setup(drm, 0);
412
413 return 0;
414 }
415
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 61403 bytes --]
[-- Attachment #3: Type: text/plain, Size: 160 bytes --]
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/3] dt-bindings: add vendor prefix for EastRising Technology Co., Ltd
2020-06-13 14:06 ` [PATCH 1/3] dt-bindings: add vendor prefix for EastRising Technology Co., Ltd Kamlesh Gurudasani
@ 2020-07-15 18:13 ` Rob Herring
0 siblings, 0 replies; 7+ messages in thread
From: Rob Herring @ 2020-07-15 18:13 UTC (permalink / raw)
To: Kamlesh Gurudasani
Cc: devicetree, David Airlie, linux-usb, dri-devel, Rob Herring,
Sam Ravnborg
On Sat, 13 Jun 2020 19:36:46 +0530, Kamlesh Gurudasani wrote:
> Add vendor prefix for display manufacturer company EastRising
> Technology Co.,Ltd
>
> [1]https://eastrising.en.ec21.com/
>
> Signed-off-by: Kamlesh Gurudasani <kamlesh.gurudasani@gmail.com>
> ---
> Documentation/devicetree/bindings/vendor-prefixes.yaml | 2 ++
> 1 file changed, 2 insertions(+)
>
Acked-by: Rob Herring <robh@kernel.org>
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/3] dt-bindings: add binding for Ilitek ili9488 based display panels
2020-06-13 14:07 ` [PATCH 2/3] dt-bindings: add binding for Ilitek ili9488 based display panels Kamlesh Gurudasani
@ 2020-07-15 18:14 ` Rob Herring
0 siblings, 0 replies; 7+ messages in thread
From: Rob Herring @ 2020-07-15 18:14 UTC (permalink / raw)
To: Kamlesh Gurudasani
Cc: devicetree, David Airlie, linux-usb, dri-devel, Rob Herring,
Sam Ravnborg
On Sat, 13 Jun 2020 19:37:03 +0530, Kamlesh Gurudasani wrote:
> This adds binding for ilitek,ili9488 based display panels
>
> Signed-off-by: Kamlesh Gurudasani <kamlesh.gurudasani@gmail.com>
> ---
> .../bindings/display/ilitek,ili9488.yaml | 71 ++++++++++++++++++++++
> 1 file changed, 71 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/display/ilitek,ili9488.yaml
>
Reviewed-by: Rob Herring <robh@kernel.org>
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2020-07-15 18:14 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-13 14:06 [PATCH 0/3] Support for tft displays based on ilitek,ili9488 Kamlesh Gurudasani
2020-06-13 14:06 ` [PATCH 1/3] dt-bindings: add vendor prefix for EastRising Technology Co., Ltd Kamlesh Gurudasani
2020-07-15 18:13 ` Rob Herring
2020-06-13 14:07 ` [PATCH 2/3] dt-bindings: add binding for Ilitek ili9488 based display panels Kamlesh Gurudasani
2020-07-15 18:14 ` Rob Herring
2020-06-13 14:07 ` [PATCH 3/3] drm/tiny: add support for tft displays based on ilitek, ili9488 Kamlesh Gurudasani
2020-06-13 16:07 ` [PATCH 3/3] drm/tiny: add support for tft displays based on ilitek,ili9488 kernel test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).