Re: [PATCH v5 6/8] drm/panel: Add ilitek ili9341 panel driver

2020-07-01 Thread dillon min
Hi Andy, Noralf,

gentle ping for this patch set,
do we have any new structure, or idea to support both dpi and dbi
interface by one drm panel driver?
from this thread
https://lists.freedesktop.org/archives/dri-devel/2020-May/267031.html
, it's seems
discussing was stopped at may 25.

if there are any new information about this topic, please feel free to
let me know. hope i can make some
progress on it.

thanks,

Dillon,

best regards

On Tue, May 26, 2020 at 6:38 PM Noralf Trønnes  wrote:
>
>
>
> Den 26.05.2020 11.08, skrev dillon min:
> > Hi Andy,
> >
> > Thanks for input.
> >
> > On Tue, May 26, 2020 at 3:46 PM Andy Shevchenko
> >  wrote:
> >>
> >> On Mon, May 25, 2020 at 6:46 AM  wrote:
> >>>
> >>> From: dillon min 
> >>>
> >>> This driver combine tiny/ili9341.c mipi_dbi_interface driver
> >>> with mipi_dpi_interface driver, can support ili9341 with serial
> >>> mode or parallel rgb interface mode by register configuration.
> >>
> >> Noralf told once that this driver should be unified with mi0283qt.c.
> >>
> >> So, what should we do here?
> >>
> >> --
> >> With Best Regards,
> >> Andy Shevchenko
> >
> > from sam's suggestion, we can't setup two drivers to support one panel
> > in the tree. so, i copy the mipi dbi part from tiny/ili9341.c. to this 
> > driver
> > from register settings and dts binding is keep the same to tiny/ili9341.c.
> >
> > so, in my opinion if tiny/ili9341.c is unified with mi0283qt.c, this
> > driver should be
> > too.
> >
>
> There's a discussion about MIPI DBI panels here:
>
> MIPI DSI, DBI, and tinydrm drivers
> https://lists.freedesktop.org/archives/dri-devel/2020-May/267031.html
>
> Noralf.
>
> > thanks.
> >
> > best regards,
> >
> > Dillon,
> >
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v5 6/8] drm/panel: Add ilitek ili9341 panel driver

2020-05-27 Thread dillon min
Hi Andy,

Thanks for input.

On Tue, May 26, 2020 at 3:46 PM Andy Shevchenko
 wrote:
>
> On Mon, May 25, 2020 at 6:46 AM  wrote:
> >
> > From: dillon min 
> >
> > This driver combine tiny/ili9341.c mipi_dbi_interface driver
> > with mipi_dpi_interface driver, can support ili9341 with serial
> > mode or parallel rgb interface mode by register configuration.
>
> Noralf told once that this driver should be unified with mi0283qt.c.
>
> So, what should we do here?
>
> --
> With Best Regards,
> Andy Shevchenko

from sam's suggestion, we can't setup two drivers to support one panel
in the tree. so, i copy the mipi dbi part from tiny/ili9341.c. to this driver
from register settings and dts binding is keep the same to tiny/ili9341.c.

so, in my opinion if tiny/ili9341.c is unified with mi0283qt.c, this
driver should be
too.

thanks.

best regards,

Dillon,
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v5 6/8] drm/panel: Add ilitek ili9341 panel driver

2020-05-26 Thread Noralf Trønnes



Den 26.05.2020 11.08, skrev dillon min:
> Hi Andy,
> 
> Thanks for input.
> 
> On Tue, May 26, 2020 at 3:46 PM Andy Shevchenko
>  wrote:
>>
>> On Mon, May 25, 2020 at 6:46 AM  wrote:
>>>
>>> From: dillon min 
>>>
>>> This driver combine tiny/ili9341.c mipi_dbi_interface driver
>>> with mipi_dpi_interface driver, can support ili9341 with serial
>>> mode or parallel rgb interface mode by register configuration.
>>
>> Noralf told once that this driver should be unified with mi0283qt.c.
>>
>> So, what should we do here?
>>
>> --
>> With Best Regards,
>> Andy Shevchenko
> 
> from sam's suggestion, we can't setup two drivers to support one panel
> in the tree. so, i copy the mipi dbi part from tiny/ili9341.c. to this driver
> from register settings and dts binding is keep the same to tiny/ili9341.c.
> 
> so, in my opinion if tiny/ili9341.c is unified with mi0283qt.c, this
> driver should be
> too.
> 

There's a discussion about MIPI DBI panels here:

MIPI DSI, DBI, and tinydrm drivers
https://lists.freedesktop.org/archives/dri-devel/2020-May/267031.html

Noralf.

> thanks.
> 
> best regards,
> 
> Dillon,
> 
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v5 6/8] drm/panel: Add ilitek ili9341 panel driver

2020-05-26 Thread Andy Shevchenko
On Mon, May 25, 2020 at 6:46 AM  wrote:
>
> From: dillon min 
>
> This driver combine tiny/ili9341.c mipi_dbi_interface driver
> with mipi_dpi_interface driver, can support ili9341 with serial
> mode or parallel rgb interface mode by register configuration.

Noralf told once that this driver should be unified with mi0283qt.c.

So, what should we do here?

-- 
With Best Regards,
Andy Shevchenko
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v5 6/8] drm/panel: Add ilitek ili9341 panel driver

2020-05-25 Thread Linus Walleij
On Mon, May 25, 2020 at 5:46 AM  wrote:

> From: dillon min 
>
> This driver combine tiny/ili9341.c mipi_dbi_interface driver
> with mipi_dpi_interface driver, can support ili9341 with serial
> mode or parallel rgb interface mode by register configuration.
>
> Changes since V3:
>
> accoding to Linus Walleij's suggestion.
> 1 add more comments to driver.
> 2 reduce magic number usage in the driver.
> 3 move panel configuration from common place to system configuration.
> 4 reuse MIPI_DCS_* as more as possible.
>
> Signed-off-by: dillon min 

This looks good to me!
Reviewed-by: Linus Walleij 

Yours,
Linus Walleij
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v5 6/8] drm/panel: Add ilitek ili9341 panel driver

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

This driver combine tiny/ili9341.c mipi_dbi_interface driver
with mipi_dpi_interface driver, can support ili9341 with serial
mode or parallel rgb interface mode by register configuration.

Changes since V3:

accoding to Linus Walleij's suggestion.
1 add more comments to driver.
2 reduce magic number usage in the driver.
3 move panel configuration from common place to system configuration.
4 reuse MIPI_DCS_* as more as possible.

Signed-off-by: dillon min 
---
 drivers/gpu/drm/panel/Kconfig|   12 +
 drivers/gpu/drm/panel/Makefile   |1 +
 drivers/gpu/drm/panel/panel-ilitek-ili9341.c | 1301 ++
 3 files changed, 1314 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..c938bee 100644
--- a/drivers/gpu/drm/panel/Kconfig
+++ b/drivers/gpu/drm/panel/Kconfig
@@ -95,6 +95,18 @@ 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_ILI9341
+   tristate "Ilitek ILI9341 240x320 QVGA panels"
+   depends on OF && SPI
+   depends on DRM_KMS_HELPER
+   depends on DRM_KMS_CMA_HELPER
+   depends on BACKLIGHT_CLASS_DEVICE
+   select DRM_MIPI_DBI
+   help
+ Say Y here if you want to enable support for Ilitek IL9341
+ QVGA (240x320) RGB panels. support serial & parallel rgb
+ interface.
+
 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..16947d7 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_ILI9341) += 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..dd6f860
--- /dev/null
+++ b/drivers/gpu/drm/panel/panel-ilitek-ili9341.c
@@ -0,0 +1,1301 @@
+// 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
+ * - 18-bit parallel RGB interface
+ * - 4-line serial spi 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 
+
+#include 
+#include 
+#include 
+#include 
+
+#define ILI9341_RGB_INTERFACE  0xb0   /* RGB Interface Signal Control */
+#define ILI9341_FRC0xb1   /* Frame Rate Control register */
+#define ILI9341_DFC0xb6   /* Display Function Control register */
+#define ILI9341_POWER1 0xc0   /* Power Control 1 register */
+#define ILI9341_POWER2 0xc1   /* Power Control 2 register */
+#define ILI9341_VCOM1  0xc5   /* VCOM Control 1 register */
+#define ILI9341_VCOM2  0xc7   /* 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 register */
+#define ILI9341_DTCA   0xe8   /* Driver timing control A */
+#define ILI9341_DTCB   0xea   /* Driver timing control B */
+#define ILI9341_POWER_SEQ  0xed   /* Power on sequence register */
+#define ILI9341_3GAMMA_EN  0xf2   /* 3 Gamma enable register */
+#define ILI9341_INTERFACE  0xf6   /* Interface control register */
+#define ILI9341_PRC0xf7   /* Pump ratio control register */
+#define ILI9341_ETMOD 0xb7   /* Entry mode set */
+
+#define ILI9341_MADCTL_BGR BIT(3)
+#define ILI9341_MADCTL_MV  BIT(5)
+#define ILI9341_MADCTL_MX  BIT(6)
+#define ILI9341_MADCTL_MY  BIT(7)
+
+
+#define ILI9341_POWER_B_LEN3
+#define ILI9341_POWER_SEQ_LEN  4
+#define ILI9341_DTCA_LEN   3
+#define ILI9341_DTCB_LEN   2
+#define ILI9341_POWER_A_LEN5
+#define ILI9341_DFC_1_LEN  2
+#define ILI9341_FRC_LEN2
+#define ILI9341_VCOM_1_LEN 2
+#define ILI9341_DFC_2_LEN  

[PATCH v5 6/8] drm/panel: Add ilitek ili9341 panel driver

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

This driver combine tiny/ili9341.c mipi_dbi_interface driver
with mipi_dpi_interface driver, can support ili9341 with serial
mode or parallel rgb interface mode by register configuration.

Changes since V3:

accoding to Linus Walleij's suggestion.
1 add more comments to driver.
2 reduce magic number usage in the driver.
3 move panel configuration from common place to system configuration.
4 reuse MIPI_DCS_* as more as possible.

Signed-off-by: dillon min 
---
 drivers/gpu/drm/panel/Kconfig|   12 +
 drivers/gpu/drm/panel/Makefile   |1 +
 drivers/gpu/drm/panel/panel-ilitek-ili9341.c | 1301 ++
 3 files changed, 1314 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..c938bee 100644
--- a/drivers/gpu/drm/panel/Kconfig
+++ b/drivers/gpu/drm/panel/Kconfig
@@ -95,6 +95,18 @@ 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_ILI9341
+   tristate "Ilitek ILI9341 240x320 QVGA panels"
+   depends on OF && SPI
+   depends on DRM_KMS_HELPER
+   depends on DRM_KMS_CMA_HELPER
+   depends on BACKLIGHT_CLASS_DEVICE
+   select DRM_MIPI_DBI
+   help
+ Say Y here if you want to enable support for Ilitek IL9341
+ QVGA (240x320) RGB panels. support serial & parallel rgb
+ interface.
+
 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..16947d7 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_ILI9341) += 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..dd6f860
--- /dev/null
+++ b/drivers/gpu/drm/panel/panel-ilitek-ili9341.c
@@ -0,0 +1,1301 @@
+// 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
+ * - 18-bit parallel RGB interface
+ * - 4-line serial spi 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 
+
+#include 
+#include 
+#include 
+#include 
+
+#define ILI9341_RGB_INTERFACE  0xb0   /* RGB Interface Signal Control */
+#define ILI9341_FRC0xb1   /* Frame Rate Control register */
+#define ILI9341_DFC0xb6   /* Display Function Control register */
+#define ILI9341_POWER1 0xc0   /* Power Control 1 register */
+#define ILI9341_POWER2 0xc1   /* Power Control 2 register */
+#define ILI9341_VCOM1  0xc5   /* VCOM Control 1 register */
+#define ILI9341_VCOM2  0xc7   /* 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 register */
+#define ILI9341_DTCA   0xe8   /* Driver timing control A */
+#define ILI9341_DTCB   0xea   /* Driver timing control B */
+#define ILI9341_POWER_SEQ  0xed   /* Power on sequence register */
+#define ILI9341_3GAMMA_EN  0xf2   /* 3 Gamma enable register */
+#define ILI9341_INTERFACE  0xf6   /* Interface control register */
+#define ILI9341_PRC0xf7   /* Pump ratio control register */
+#define ILI9341_ETMOD 0xb7   /* Entry mode set */
+
+#define ILI9341_MADCTL_BGR BIT(3)
+#define ILI9341_MADCTL_MV  BIT(5)
+#define ILI9341_MADCTL_MX  BIT(6)
+#define ILI9341_MADCTL_MY  BIT(7)
+
+
+#define ILI9341_POWER_B_LEN3
+#define ILI9341_POWER_SEQ_LEN  4
+#define ILI9341_DTCA_LEN   3
+#define ILI9341_DTCB_LEN   2
+#define ILI9341_POWER_A_LEN5
+#define ILI9341_DFC_1_LEN  2
+#define ILI9341_FRC_LEN2
+#define ILI9341_VCOM_1_LEN 2
+#define ILI9341_DFC_2_LEN