[PATCH 3/4] drm/panel: Add Ilitek ILI9341 driver

2020-05-06 Thread dillon . minfei


Add drm panel driver ilitek ili9341 , based on panel/panel-ilitek-ili9322.c
currently just support rgb input only
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 3/4] drm/panel: Add Ilitek ILI9341 driver

2020-05-06 Thread dillon . minfei
From: dillon min 

This adds support for the Ilitek ILI9341 QVGA (240x320)
TFT panel driver.

This panel driver supports parallel RGB input.

The controller is combined with a physical panel and
configured through the device tree.

Signed-off-by: dillon min 
---
 drivers/gpu/drm/panel/Kconfig|   8 +
 drivers/gpu/drm/panel/Makefile   |   1 +
 drivers/gpu/drm/panel/panel-ilitek-ili9341.c | 513 +++
 3 files changed, 522 insertions(+)
 create mode 100644 drivers/gpu/drm/panel/panel-ilitek-ili9341.c

diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig
index a1723c1..e42692c 100644
--- a/drivers/gpu/drm/panel/Kconfig
+++ b/drivers/gpu/drm/panel/Kconfig
@@ -95,6 +95,14 @@ config DRM_PANEL_ILITEK_IL9322
  Say Y here if you want to enable support for Ilitek IL9322
  QVGA (320x240) RGB, YUV and ITU-T BT.656 panels.
 
+config DRM_PANEL_ILITEK_IL9341
+   tristate "Ilitek ILI9341 240x320 QVGA panels"
+   depends on OF && SPI
+   select REGMAP
+   help
+ Say Y here if you want to enable support for Ilitek IL9341
+ QVGA (240x320) RGB panels.
+
 config DRM_PANEL_ILITEK_ILI9881C
tristate "Ilitek ILI9881C-based panels"
depends on OF
diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile
index 96a883c..d123543 100644
--- a/drivers/gpu/drm/panel/Makefile
+++ b/drivers/gpu/drm/panel/Makefile
@@ -8,6 +8,7 @@ obj-$(CONFIG_DRM_PANEL_ELIDA_KD35T133) += panel-elida-kd35t133.o
 obj-$(CONFIG_DRM_PANEL_FEIXIN_K101_IM2BA02) += panel-feixin-k101-im2ba02.o
 obj-$(CONFIG_DRM_PANEL_FEIYANG_FY07024DI26A30D) += 
panel-feiyang-fy07024di26a30d.o
 obj-$(CONFIG_DRM_PANEL_ILITEK_IL9322) += panel-ilitek-ili9322.o
+obj-$(CONFIG_DRM_PANEL_ILITEK_IL9341) += panel-ilitek-ili9341.o
 obj-$(CONFIG_DRM_PANEL_ILITEK_ILI9881C) += panel-ilitek-ili9881c.o
 obj-$(CONFIG_DRM_PANEL_INNOLUX_P079ZCA) += panel-innolux-p079zca.o
 obj-$(CONFIG_DRM_PANEL_JDI_LT070ME05000) += panel-jdi-lt070me05000.o
diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9341.c 
b/drivers/gpu/drm/panel/panel-ilitek-ili9341.c
new file mode 100644
index 000..e458677
--- /dev/null
+++ b/drivers/gpu/drm/panel/panel-ilitek-ili9341.c
@@ -0,0 +1,513 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Ilitek ILI9341 TFT LCD drm_panel driver.
+ *
+ * This panel can be configured to support:
+ * - 16-bit parallel RGB interface
+ *
+ * Copyright (C) 2020 Dillon Min 
+ * Derived from drivers/drm/gpu/panel/panel-ilitek-ili9322.c
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#define DEFAULT_SPI_SPEED  1000
+
+#define ILI9341_SLEEP_OUT0x11   /* Sleep out register */
+#define ILI9341_GAMMA0x26   /* Gamma register */
+#define ILI9341_DISPLAY_OFF  0x28   /* Display off register */
+#define ILI9341_DISPLAY_ON   0x29   /* Display on register */
+#define ILI9341_COLUMN_ADDR  0x2A   /* Colomn address register */
+#define ILI9341_PAGE_ADDR0x2B   /* Page address register */
+#define ILI9341_GRAM 0x2C   /* GRAM register */
+#define ILI9341_MAC  0x36   /* Memory Access Control register*/
+#define ILI9341_PIXEL_FORMAT 0x3A   /* Pixel Format register */
+#define ILI9341_WDB  0x51   /* Write Brightness Display
+* register
+*/
+#define ILI9341_WCD  0x53   /* Write Control Display
+* register
+*/
+#define ILI9341_RGB_INTERFACE0xB0   /* RGB Interface Signal Control */
+#define ILI9341_FRC  0xB1   /* Frame Rate Control register */
+#define ILI9341_BPC  0xB5   /* Blanking Porch Control
+* register
+*/
+#define ILI9341_DFC  0xB6   /* Display Function Control
+* register
+*/
+#define ILI9341_POWER1   0xC0   /* Power Control 1 register */
+#define ILI9341_POWER2   0xC1   /* Power Control 2 register */
+#define ILI9341_VCOM10xC5   /* VCOM Control 1 register */
+#define ILI9341_VCOM20xC7   /* VCOM Control 2 register */
+#define ILI9341_POWERA   0xCB   /* Power control A register */
+#define ILI9341_POWERB   0xCF   /* Power control B register */
+#define ILI9341_PGAMMA   0xE0   /* Positive Gamma Correction
+* register
+*/
+#define ILI9341_NGAMMA   0xE1   /* Negative Gamma Correction
+*