Re: [PATCH v7 2/2] drm: panel: Add novatek nt36672a panel driver

2020-10-14 Thread Sam Ravnborg
Hi Sumit.

On Wed, Sep 02, 2020 at 12:14:07PM +0530, Sumit Semwal wrote:
> Novatek NT36672a is a generic DSI IC that drives command and video mode
> panels. Add the driver for it.
> 
> Right now adding support for some Poco F1 phones that have an LCD panel
> from Tianma connected with this IC, with a resolution of 1080x2246 that
> operates in DSI video mode.
> 
> During testing, Benni Steini  helped us fix
> the reset sequence timing (from 10ms to 20ms), to get the bootanimation
> to work on Android.
> 
> With current AOSP, we need to increase it to 200ms - this seems to be a
> safe high value to avoid a white screen occasionally.
> 
> Signed-off-by: Sumit Semwal 
> Cc: Benni Steini 
Reviewed-by: Sam Ravnborg 

I assume you will apply the patch yourself to drm-misc-next.

Sam

> 
> ---
> v2: increase reset sequence timing to a safe 200ms
> v4: Since "0425662fdf05: drm: Nuke mode->vrefresh", we have to calculate
> vrefresh on demand. Update for it.
> v5: Fixed review comments from Sam:
>   - rebased on top of drm-misc-next
>remove return of drm_panel_add()
>remove drm_panel_detach()
>   - renamed the panel driver file to reflect that this is a novatek
>nt36672a display driver and not only for tianma panels.
>Adjusted some internal names also to reflect the same.
>   - corrected changelog to add info about the generic Novatek DSI IC
>   - corrected compatible string accordingly
>   - removed pinctrl
>   - used drm_panel* API for prepare/unprepare/disable/remove
> v6: Fixed few review comments on v5 from Sam:
>   - add dev_err_probe() support
>   - move DRM_* error printing to dev_err()
>   - removed a few unnecessary bits
> v7: Fixed review comments on v6 from Bjorn:
>   - Reworked the send_mipi_commands functionality
>   - removed regulator disable_loads; moved active_load setting to probe
> time
>   - made function names and struct less generic
>   - updated the reset_gpio working to active_low
>   - update MAINTAINERS for file name changes
> ---
>  MAINTAINERS   |   7 +
>  drivers/gpu/drm/panel/Kconfig |  10 +
>  drivers/gpu/drm/panel/Makefile|   1 +
>  .../gpu/drm/panel/panel-novatek-nt36672a.c| 711 ++
>  4 files changed, 729 insertions(+)
>  create mode 100644 drivers/gpu/drm/panel/panel-novatek-nt36672a.c
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 01fb9ee6b951..c6fb966c0959 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -5517,6 +5517,13 @@ T: git git://anongit.freedesktop.org/drm/drm-misc
>  F:   Documentation/devicetree/bindings/display/panel/novatek,nt35510.yaml
>  F:   drivers/gpu/drm/panel/panel-novatek-nt35510.c
>  
> +DRM DRIVER FOR NOVATEK NT36672A PANELS
> +M:   Sumit Semwal 
> +S:   Maintained
> +T:   git git://anongit.freedesktop.org/drm/drm-misc
> +F:   Documentation/devicetree/bindings/display/panel/novatek,nt36672a.yaml
> +F:   drivers/gpu/drm/panel/panel-novatek-nt36672a.c
> +
>  DRM DRIVER FOR NVIDIA GEFORCE/QUADRO GPUS
>  M:   Ben Skeggs 
>  L:   dri-de...@lists.freedesktop.org
> diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig
> index 8d97d07c5871..51e6cb6c7826 100644
> --- a/drivers/gpu/drm/panel/Kconfig
> +++ b/drivers/gpu/drm/panel/Kconfig
> @@ -208,6 +208,16 @@ config DRM_PANEL_NOVATEK_NT35510
> around the Novatek NT35510 display controller, such as some
> Hydis panels.
>  
> +config DRM_PANEL_NOVATEK_NT36672A
> + tristate "Novatek NT36672A DSI panel"
> + depends on OF
> + depends on DRM_MIPI_DSI
> + depends on BACKLIGHT_CLASS_DEVICE
> + help
> +   Say Y here if you want to enable support for the panels built
> +   around the Novatek NT36672A display controller, such as some
> +   Tianma panels used in a few Xiaomi Poco F1 mobile phones.
> +
>  config DRM_PANEL_NOVATEK_NT39016
>   tristate "Novatek NT39016 RGB/SPI panel"
>   depends on OF && SPI
> diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile
> index 15a4e7752951..4a36eb45f670 100644
> --- a/drivers/gpu/drm/panel/Makefile
> +++ b/drivers/gpu/drm/panel/Makefile
> @@ -19,6 +19,7 @@ obj-$(CONFIG_DRM_PANEL_LG_LB035Q02) += panel-lg-lb035q02.o
>  obj-$(CONFIG_DRM_PANEL_LG_LG4573) += panel-lg-lg4573.o
>  obj-$(CONFIG_DRM_PANEL_NEC_NL8048HL11) += panel-nec-nl8048hl11.o
>  obj-$(CONFIG_DRM_PANEL_NOVATEK_NT35510) += panel-novatek-nt35510.o
> +obj-$(CONFIG_DRM_PANEL_NOVATEK_NT36672A) += panel-novatek-nt36672a.o
>  obj-$(CONFIG_DRM_PANEL_NOVATEK_NT39016) += panel-novatek-nt39016.o
>  obj-$(CONFIG_DRM_PANEL_MANTIX_MLAF057WE51) += panel-mantix-mlaf057we51.o
>  obj-$(CONFIG_DRM_PANEL_OLIMEX_LCD_OLINUXINO) += panel-olimex-lcd-olinuxino.o
> diff --git a/drivers/gpu/drm/panel/panel-novatek-nt36672a.c 
> b/drivers/gpu/drm/panel/panel-novatek-nt36672a.c
> new file mode 100644
> index ..533cd3934b8b
> --- 

Re: [PATCH v7 2/2] drm: panel: Add novatek nt36672a panel driver

2020-09-15 Thread Bjorn Andersson
On Wed 02 Sep 01:44 CDT 2020, Sumit Semwal wrote:

> Novatek NT36672a is a generic DSI IC that drives command and video mode
> panels. Add the driver for it.
> 
> Right now adding support for some Poco F1 phones that have an LCD panel
> from Tianma connected with this IC, with a resolution of 1080x2246 that
> operates in DSI video mode.
> 
> During testing, Benni Steini  helped us fix
> the reset sequence timing (from 10ms to 20ms), to get the bootanimation
> to work on Android.
> 
> With current AOSP, we need to increase it to 200ms - this seems to be a
> safe high value to avoid a white screen occasionally.
> 
> Signed-off-by: Sumit Semwal 
> Cc: Benni Steini 

Reviewed-by: Bjorn Andersson 

Regards,
Bjorn

> 
> ---
> v2: increase reset sequence timing to a safe 200ms
> v4: Since "0425662fdf05: drm: Nuke mode->vrefresh", we have to calculate
> vrefresh on demand. Update for it.
> v5: Fixed review comments from Sam:
>   - rebased on top of drm-misc-next
>remove return of drm_panel_add()
>remove drm_panel_detach()
>   - renamed the panel driver file to reflect that this is a novatek
>nt36672a display driver and not only for tianma panels.
>Adjusted some internal names also to reflect the same.
>   - corrected changelog to add info about the generic Novatek DSI IC
>   - corrected compatible string accordingly
>   - removed pinctrl
>   - used drm_panel* API for prepare/unprepare/disable/remove
> v6: Fixed few review comments on v5 from Sam:
>   - add dev_err_probe() support
>   - move DRM_* error printing to dev_err()
>   - removed a few unnecessary bits
> v7: Fixed review comments on v6 from Bjorn:
>   - Reworked the send_mipi_commands functionality
>   - removed regulator disable_loads; moved active_load setting to probe
> time
>   - made function names and struct less generic
>   - updated the reset_gpio working to active_low
>   - update MAINTAINERS for file name changes
> ---
>  MAINTAINERS   |   7 +
>  drivers/gpu/drm/panel/Kconfig |  10 +
>  drivers/gpu/drm/panel/Makefile|   1 +
>  .../gpu/drm/panel/panel-novatek-nt36672a.c| 711 ++
>  4 files changed, 729 insertions(+)
>  create mode 100644 drivers/gpu/drm/panel/panel-novatek-nt36672a.c
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 01fb9ee6b951..c6fb966c0959 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -5517,6 +5517,13 @@ T: git git://anongit.freedesktop.org/drm/drm-misc
>  F:   Documentation/devicetree/bindings/display/panel/novatek,nt35510.yaml
>  F:   drivers/gpu/drm/panel/panel-novatek-nt35510.c
>  
> +DRM DRIVER FOR NOVATEK NT36672A PANELS
> +M:   Sumit Semwal 
> +S:   Maintained
> +T:   git git://anongit.freedesktop.org/drm/drm-misc
> +F:   Documentation/devicetree/bindings/display/panel/novatek,nt36672a.yaml
> +F:   drivers/gpu/drm/panel/panel-novatek-nt36672a.c
> +
>  DRM DRIVER FOR NVIDIA GEFORCE/QUADRO GPUS
>  M:   Ben Skeggs 
>  L:   dri-de...@lists.freedesktop.org
> diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig
> index 8d97d07c5871..51e6cb6c7826 100644
> --- a/drivers/gpu/drm/panel/Kconfig
> +++ b/drivers/gpu/drm/panel/Kconfig
> @@ -208,6 +208,16 @@ config DRM_PANEL_NOVATEK_NT35510
> around the Novatek NT35510 display controller, such as some
> Hydis panels.
>  
> +config DRM_PANEL_NOVATEK_NT36672A
> + tristate "Novatek NT36672A DSI panel"
> + depends on OF
> + depends on DRM_MIPI_DSI
> + depends on BACKLIGHT_CLASS_DEVICE
> + help
> +   Say Y here if you want to enable support for the panels built
> +   around the Novatek NT36672A display controller, such as some
> +   Tianma panels used in a few Xiaomi Poco F1 mobile phones.
> +
>  config DRM_PANEL_NOVATEK_NT39016
>   tristate "Novatek NT39016 RGB/SPI panel"
>   depends on OF && SPI
> diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile
> index 15a4e7752951..4a36eb45f670 100644
> --- a/drivers/gpu/drm/panel/Makefile
> +++ b/drivers/gpu/drm/panel/Makefile
> @@ -19,6 +19,7 @@ obj-$(CONFIG_DRM_PANEL_LG_LB035Q02) += panel-lg-lb035q02.o
>  obj-$(CONFIG_DRM_PANEL_LG_LG4573) += panel-lg-lg4573.o
>  obj-$(CONFIG_DRM_PANEL_NEC_NL8048HL11) += panel-nec-nl8048hl11.o
>  obj-$(CONFIG_DRM_PANEL_NOVATEK_NT35510) += panel-novatek-nt35510.o
> +obj-$(CONFIG_DRM_PANEL_NOVATEK_NT36672A) += panel-novatek-nt36672a.o
>  obj-$(CONFIG_DRM_PANEL_NOVATEK_NT39016) += panel-novatek-nt39016.o
>  obj-$(CONFIG_DRM_PANEL_MANTIX_MLAF057WE51) += panel-mantix-mlaf057we51.o
>  obj-$(CONFIG_DRM_PANEL_OLIMEX_LCD_OLINUXINO) += panel-olimex-lcd-olinuxino.o
> diff --git a/drivers/gpu/drm/panel/panel-novatek-nt36672a.c 
> b/drivers/gpu/drm/panel/panel-novatek-nt36672a.c
> new file mode 100644
> index ..533cd3934b8b
> --- /dev/null
> +++ b/drivers/gpu/drm/panel/panel-novatek-nt36672a.c
> @@ -0,0 

[PATCH v7 2/2] drm: panel: Add novatek nt36672a panel driver

2020-09-02 Thread Sumit Semwal
Novatek NT36672a is a generic DSI IC that drives command and video mode
panels. Add the driver for it.

Right now adding support for some Poco F1 phones that have an LCD panel
from Tianma connected with this IC, with a resolution of 1080x2246 that
operates in DSI video mode.

During testing, Benni Steini  helped us fix
the reset sequence timing (from 10ms to 20ms), to get the bootanimation
to work on Android.

With current AOSP, we need to increase it to 200ms - this seems to be a
safe high value to avoid a white screen occasionally.

Signed-off-by: Sumit Semwal 
Cc: Benni Steini 

---
v2: increase reset sequence timing to a safe 200ms
v4: Since "0425662fdf05: drm: Nuke mode->vrefresh", we have to calculate
vrefresh on demand. Update for it.
v5: Fixed review comments from Sam:
  - rebased on top of drm-misc-next
   remove return of drm_panel_add()
   remove drm_panel_detach()
  - renamed the panel driver file to reflect that this is a novatek
   nt36672a display driver and not only for tianma panels.
   Adjusted some internal names also to reflect the same.
  - corrected changelog to add info about the generic Novatek DSI IC
  - corrected compatible string accordingly
  - removed pinctrl
  - used drm_panel* API for prepare/unprepare/disable/remove
v6: Fixed few review comments on v5 from Sam:
  - add dev_err_probe() support
  - move DRM_* error printing to dev_err()
  - removed a few unnecessary bits
v7: Fixed review comments on v6 from Bjorn:
  - Reworked the send_mipi_commands functionality
  - removed regulator disable_loads; moved active_load setting to probe
time
  - made function names and struct less generic
  - updated the reset_gpio working to active_low
  - update MAINTAINERS for file name changes
---
 MAINTAINERS   |   7 +
 drivers/gpu/drm/panel/Kconfig |  10 +
 drivers/gpu/drm/panel/Makefile|   1 +
 .../gpu/drm/panel/panel-novatek-nt36672a.c| 711 ++
 4 files changed, 729 insertions(+)
 create mode 100644 drivers/gpu/drm/panel/panel-novatek-nt36672a.c

diff --git a/MAINTAINERS b/MAINTAINERS
index 01fb9ee6b951..c6fb966c0959 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -5517,6 +5517,13 @@ T:   git git://anongit.freedesktop.org/drm/drm-misc
 F: Documentation/devicetree/bindings/display/panel/novatek,nt35510.yaml
 F: drivers/gpu/drm/panel/panel-novatek-nt35510.c
 
+DRM DRIVER FOR NOVATEK NT36672A PANELS
+M: Sumit Semwal 
+S: Maintained
+T: git git://anongit.freedesktop.org/drm/drm-misc
+F: Documentation/devicetree/bindings/display/panel/novatek,nt36672a.yaml
+F: drivers/gpu/drm/panel/panel-novatek-nt36672a.c
+
 DRM DRIVER FOR NVIDIA GEFORCE/QUADRO GPUS
 M: Ben Skeggs 
 L: dri-de...@lists.freedesktop.org
diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig
index 8d97d07c5871..51e6cb6c7826 100644
--- a/drivers/gpu/drm/panel/Kconfig
+++ b/drivers/gpu/drm/panel/Kconfig
@@ -208,6 +208,16 @@ config DRM_PANEL_NOVATEK_NT35510
  around the Novatek NT35510 display controller, such as some
  Hydis panels.
 
+config DRM_PANEL_NOVATEK_NT36672A
+   tristate "Novatek NT36672A DSI panel"
+   depends on OF
+   depends on DRM_MIPI_DSI
+   depends on BACKLIGHT_CLASS_DEVICE
+   help
+ Say Y here if you want to enable support for the panels built
+ around the Novatek NT36672A display controller, such as some
+ Tianma panels used in a few Xiaomi Poco F1 mobile phones.
+
 config DRM_PANEL_NOVATEK_NT39016
tristate "Novatek NT39016 RGB/SPI panel"
depends on OF && SPI
diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile
index 15a4e7752951..4a36eb45f670 100644
--- a/drivers/gpu/drm/panel/Makefile
+++ b/drivers/gpu/drm/panel/Makefile
@@ -19,6 +19,7 @@ obj-$(CONFIG_DRM_PANEL_LG_LB035Q02) += panel-lg-lb035q02.o
 obj-$(CONFIG_DRM_PANEL_LG_LG4573) += panel-lg-lg4573.o
 obj-$(CONFIG_DRM_PANEL_NEC_NL8048HL11) += panel-nec-nl8048hl11.o
 obj-$(CONFIG_DRM_PANEL_NOVATEK_NT35510) += panel-novatek-nt35510.o
+obj-$(CONFIG_DRM_PANEL_NOVATEK_NT36672A) += panel-novatek-nt36672a.o
 obj-$(CONFIG_DRM_PANEL_NOVATEK_NT39016) += panel-novatek-nt39016.o
 obj-$(CONFIG_DRM_PANEL_MANTIX_MLAF057WE51) += panel-mantix-mlaf057we51.o
 obj-$(CONFIG_DRM_PANEL_OLIMEX_LCD_OLINUXINO) += panel-olimex-lcd-olinuxino.o
diff --git a/drivers/gpu/drm/panel/panel-novatek-nt36672a.c 
b/drivers/gpu/drm/panel/panel-novatek-nt36672a.c
new file mode 100644
index ..533cd3934b8b
--- /dev/null
+++ b/drivers/gpu/drm/panel/panel-novatek-nt36672a.c
@@ -0,0 +1,711 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2020 Linaro Ltd
+ * Author: Sumit Semwal 
+ *
+ * This driver is for the DSI interface to panels using the NT36672A display 
driver IC
+ * from Novatek.
+ * Currently supported are the Tianma FHD+ panels