Re: [PATCH 4/8] drm/mipi-dbi: Initialize default driver functions with macro

2022-11-25 Thread Noralf Trønnes



Den 21.11.2022 11.45, skrev Thomas Zimmermann:
> Introduce DRM_MIPI_DBI_SIMPLE_DISPLAY_PIPE_FUNCS to initialize MIPI-DBI
> helpers to default values and convert drivers. The prepare_fb function
> set by some drivers is called implicitly by simple-kms helpers, so leave
> it out.
> 
> Signed-off-by: Thomas Zimmermann 
> ---

>  static const struct drm_simple_display_pipe_funcs hx8357d_pipe_funcs = {
> - .mode_valid = mipi_dbi_pipe_mode_valid,
> - .enable = yx240qv29_enable,
> - .disable = mipi_dbi_pipe_disable,
> - .update = mipi_dbi_pipe_update,
> + DRM_MIPI_DBI_SIMPLE_DISPLAY_PIPE_FUNCS(yx240qv29_enable),
>  };

>  static const struct drm_simple_display_pipe_funcs ili9163_pipe_funcs = {
> - .mode_valid = mipi_dbi_pipe_mode_valid,
> - .enable = yx240qv29_enable,
> - .disable = mipi_dbi_pipe_disable,
> - .update = mipi_dbi_pipe_update,
> + DRM_MIPI_DBI_SIMPLE_DISPLAY_PIPE_FUNCS(yx240qv29_enable),
>  };

>  static const struct drm_simple_display_pipe_funcs ili9341_pipe_funcs = {
> - .mode_valid = mipi_dbi_pipe_mode_valid,
> - .enable = yx240qv29_enable,
> - .disable = mipi_dbi_pipe_disable,
> - .update = mipi_dbi_pipe_update,
> + DRM_MIPI_DBI_SIMPLE_DISPLAY_PIPE_FUNCS(yx240qv29_enable),
>  };

3 drivers have the same enable function name, ili9163 and hx8357d has
clearly copied from ili9341 which actually supports the yx240qv29 panel.
At least hx8357d managed to update the display mode variable name,
ili9163 didn't. It's not unlikely that I reviewed these drivers...

But that has nothing to do with this patch:

Reviewed-by: Noralf Trønnes 


[PATCH 4/8] drm/mipi-dbi: Initialize default driver functions with macro

2022-11-21 Thread Thomas Zimmermann
Introduce DRM_MIPI_DBI_SIMPLE_DISPLAY_PIPE_FUNCS to initialize MIPI-DBI
helpers to default values and convert drivers. The prepare_fb function
set by some drivers is called implicitly by simple-kms helpers, so leave
it out.

Signed-off-by: Thomas Zimmermann 
---
 drivers/gpu/drm/panel/panel-ilitek-ili9341.c |  5 +
 drivers/gpu/drm/tiny/hx8357d.c   |  5 +
 drivers/gpu/drm/tiny/ili9163.c   |  5 +
 drivers/gpu/drm/tiny/ili9341.c   |  5 +
 drivers/gpu/drm/tiny/ili9486.c   |  5 +
 drivers/gpu/drm/tiny/mi0283qt.c  |  5 +
 drivers/gpu/drm/tiny/panel-mipi-dbi.c|  5 +
 drivers/gpu/drm/tiny/st7735r.c   |  5 +
 include/drm/drm_mipi_dbi.h   | 16 
 9 files changed, 24 insertions(+), 32 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9341.c 
b/drivers/gpu/drm/panel/panel-ilitek-ili9341.c
index be088983aa7c7..3fdf884b3257f 100644
--- a/drivers/gpu/drm/panel/panel-ilitek-ili9341.c
+++ b/drivers/gpu/drm/panel/panel-ilitek-ili9341.c
@@ -577,10 +577,7 @@ static void ili9341_dbi_enable(struct 
drm_simple_display_pipe *pipe,
 }
 
 static const struct drm_simple_display_pipe_funcs ili9341_dbi_funcs = {
-   .mode_valid = mipi_dbi_pipe_mode_valid,
-   .enable = ili9341_dbi_enable,
-   .disable = mipi_dbi_pipe_disable,
-   .update = mipi_dbi_pipe_update,
+   DRM_MIPI_DBI_SIMPLE_DISPLAY_PIPE_FUNCS(ili9341_dbi_enable),
 };
 
 static const struct drm_display_mode ili9341_dbi_mode = {
diff --git a/drivers/gpu/drm/tiny/hx8357d.c b/drivers/gpu/drm/tiny/hx8357d.c
index 9f634f720817b..cdc4486e059b5 100644
--- a/drivers/gpu/drm/tiny/hx8357d.c
+++ b/drivers/gpu/drm/tiny/hx8357d.c
@@ -181,10 +181,7 @@ static void yx240qv29_enable(struct 
drm_simple_display_pipe *pipe,
 }
 
 static const struct drm_simple_display_pipe_funcs hx8357d_pipe_funcs = {
-   .mode_valid = mipi_dbi_pipe_mode_valid,
-   .enable = yx240qv29_enable,
-   .disable = mipi_dbi_pipe_disable,
-   .update = mipi_dbi_pipe_update,
+   DRM_MIPI_DBI_SIMPLE_DISPLAY_PIPE_FUNCS(yx240qv29_enable),
 };
 
 static const struct drm_display_mode yx350hv15_mode = {
diff --git a/drivers/gpu/drm/tiny/ili9163.c b/drivers/gpu/drm/tiny/ili9163.c
index 835ed12792d56..bc4384d410fcc 100644
--- a/drivers/gpu/drm/tiny/ili9163.c
+++ b/drivers/gpu/drm/tiny/ili9163.c
@@ -100,10 +100,7 @@ static void yx240qv29_enable(struct 
drm_simple_display_pipe *pipe,
 }
 
 static const struct drm_simple_display_pipe_funcs ili9163_pipe_funcs = {
-   .mode_valid = mipi_dbi_pipe_mode_valid,
-   .enable = yx240qv29_enable,
-   .disable = mipi_dbi_pipe_disable,
-   .update = mipi_dbi_pipe_update,
+   DRM_MIPI_DBI_SIMPLE_DISPLAY_PIPE_FUNCS(yx240qv29_enable),
 };
 
 static const struct drm_display_mode yx240qv29_mode = {
diff --git a/drivers/gpu/drm/tiny/ili9341.c b/drivers/gpu/drm/tiny/ili9341.c
index 420f6005a9568..47b61c3bf1457 100644
--- a/drivers/gpu/drm/tiny/ili9341.c
+++ b/drivers/gpu/drm/tiny/ili9341.c
@@ -137,10 +137,7 @@ static void yx240qv29_enable(struct 
drm_simple_display_pipe *pipe,
 }
 
 static const struct drm_simple_display_pipe_funcs ili9341_pipe_funcs = {
-   .mode_valid = mipi_dbi_pipe_mode_valid,
-   .enable = yx240qv29_enable,
-   .disable = mipi_dbi_pipe_disable,
-   .update = mipi_dbi_pipe_update,
+   DRM_MIPI_DBI_SIMPLE_DISPLAY_PIPE_FUNCS(yx240qv29_enable),
 };
 
 static const struct drm_display_mode yx240qv29_mode = {
diff --git a/drivers/gpu/drm/tiny/ili9486.c b/drivers/gpu/drm/tiny/ili9486.c
index 1bb847466b107..9f735d84d85d4 100644
--- a/drivers/gpu/drm/tiny/ili9486.c
+++ b/drivers/gpu/drm/tiny/ili9486.c
@@ -150,10 +150,7 @@ static void waveshare_enable(struct 
drm_simple_display_pipe *pipe,
 }
 
 static const struct drm_simple_display_pipe_funcs waveshare_pipe_funcs = {
-   .mode_valid = mipi_dbi_pipe_mode_valid,
-   .enable = waveshare_enable,
-   .disable = mipi_dbi_pipe_disable,
-   .update = mipi_dbi_pipe_update,
+   DRM_MIPI_DBI_SIMPLE_DISPLAY_PIPE_FUNCS(waveshare_enable),
 };
 
 static const struct drm_display_mode waveshare_mode = {
diff --git a/drivers/gpu/drm/tiny/mi0283qt.c b/drivers/gpu/drm/tiny/mi0283qt.c
index 47df2b5a3048f..01ff43c8ac3ff 100644
--- a/drivers/gpu/drm/tiny/mi0283qt.c
+++ b/drivers/gpu/drm/tiny/mi0283qt.c
@@ -141,10 +141,7 @@ static void mi0283qt_enable(struct drm_simple_display_pipe 
*pipe,
 }
 
 static const struct drm_simple_display_pipe_funcs mi0283qt_pipe_funcs = {
-   .mode_valid = mipi_dbi_pipe_mode_valid,
-   .enable = mi0283qt_enable,
-   .disable = mipi_dbi_pipe_disable,
-   .update = mipi_dbi_pipe_update,
+   DRM_MIPI_DBI_SIMPLE_DISPLAY_PIPE_FUNCS(mi0283qt_enable),
 };
 
 static const struct drm_display_mode mi0283qt_mode = {
diff --git a/drivers/gpu/drm/tiny/panel-mipi-dbi.c 
b/drivers/gpu/drm/tiny/panel-mipi-dbi.c
index 03a7d569cd568..2ed23ded51997 100644
---