diff mbox series

[02/11] drm/modes: Add DRM_SIMPLE_MODE()

Message ID 20190120114318.49199-3-noralf@tronnes.org (mailing list archive)
State New, archived
Headers show
Series drm/tinydrm: Remove tinydrm_device | expand

Commit Message

Noralf Trønnes Jan. 20, 2019, 11:43 a.m. UTC
This adds a helper macro to specify modes that only contain info about
resolution.

Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
---
 drivers/gpu/drm/tinydrm/hx8357d.c  |  2 +-
 drivers/gpu/drm/tinydrm/ili9225.c  |  2 +-
 drivers/gpu/drm/tinydrm/ili9341.c  |  2 +-
 drivers/gpu/drm/tinydrm/mi0283qt.c |  2 +-
 drivers/gpu/drm/tinydrm/repaper.c  |  8 ++++----
 drivers/gpu/drm/tinydrm/st7586.c   |  2 +-
 drivers/gpu/drm/tinydrm/st7735r.c  |  2 +-
 include/drm/drm_modes.h            | 16 ++++++++++++++++
 include/drm/tinydrm/tinydrm.h      | 23 -----------------------
 9 files changed, 26 insertions(+), 33 deletions(-)

Comments

Ilia Mirkin Jan. 20, 2019, 4:37 p.m. UTC | #1
You don't appear to set the mm in the new macro. Not sure if it's on
purpose.

On Sun, Jan 20, 2019, 06:43 Noralf Trønnes <noralf@tronnes.org wrote:

> This adds a helper macro to specify modes that only contain info about
> resolution.
>
> Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
> ---
>  drivers/gpu/drm/tinydrm/hx8357d.c  |  2 +-
>  drivers/gpu/drm/tinydrm/ili9225.c  |  2 +-
>  drivers/gpu/drm/tinydrm/ili9341.c  |  2 +-
>  drivers/gpu/drm/tinydrm/mi0283qt.c |  2 +-
>  drivers/gpu/drm/tinydrm/repaper.c  |  8 ++++----
>  drivers/gpu/drm/tinydrm/st7586.c   |  2 +-
>  drivers/gpu/drm/tinydrm/st7735r.c  |  2 +-
>  include/drm/drm_modes.h            | 16 ++++++++++++++++
>  include/drm/tinydrm/tinydrm.h      | 23 -----------------------
>  9 files changed, 26 insertions(+), 33 deletions(-)
>
> diff --git a/drivers/gpu/drm/tinydrm/hx8357d.c
> b/drivers/gpu/drm/tinydrm/hx8357d.c
> index 8bbd0beafc6a..5a1ec0451c19 100644
> --- a/drivers/gpu/drm/tinydrm/hx8357d.c
> +++ b/drivers/gpu/drm/tinydrm/hx8357d.c
> @@ -181,7 +181,7 @@ static const struct drm_simple_display_pipe_funcs
> hx8357d_pipe_funcs = {
>  };
>
>  static const struct drm_display_mode yx350hv15_mode = {
> -       TINYDRM_MODE(320, 480, 60, 75),
> +       DRM_SIMPLE_MODE(320, 480, 60, 75),
>  };
>
>  DEFINE_DRM_GEM_CMA_FOPS(hx8357d_fops);
> diff --git a/drivers/gpu/drm/tinydrm/ili9225.c
> b/drivers/gpu/drm/tinydrm/ili9225.c
> index 43a3b68d90a2..d40814d370e2 100644
> --- a/drivers/gpu/drm/tinydrm/ili9225.c
> +++ b/drivers/gpu/drm/tinydrm/ili9225.c
> @@ -332,7 +332,7 @@ static const struct drm_simple_display_pipe_funcs
> ili9225_pipe_funcs = {
>  };
>
>  static const struct drm_display_mode ili9225_mode = {
> -       TINYDRM_MODE(176, 220, 35, 44),
> +       DRM_SIMPLE_MODE(176, 220, 35, 44),
>  };
>
>  DEFINE_DRM_GEM_CMA_FOPS(ili9225_fops);
> diff --git a/drivers/gpu/drm/tinydrm/ili9341.c
> b/drivers/gpu/drm/tinydrm/ili9341.c
> index 713bb2dd7e04..063f4f07f811 100644
> --- a/drivers/gpu/drm/tinydrm/ili9341.c
> +++ b/drivers/gpu/drm/tinydrm/ili9341.c
> @@ -137,7 +137,7 @@ static const struct drm_simple_display_pipe_funcs
> ili9341_pipe_funcs = {
>  };
>
>  static const struct drm_display_mode yx240qv29_mode = {
> -       TINYDRM_MODE(240, 320, 37, 49),
> +       DRM_SIMPLE_MODE(240, 320, 37, 49),
>  };
>
>  DEFINE_DRM_GEM_CMA_FOPS(ili9341_fops);
> diff --git a/drivers/gpu/drm/tinydrm/mi0283qt.c
> b/drivers/gpu/drm/tinydrm/mi0283qt.c
> index 82a92ec9ae3c..3d067c2ba1bc 100644
> --- a/drivers/gpu/drm/tinydrm/mi0283qt.c
> +++ b/drivers/gpu/drm/tinydrm/mi0283qt.c
> @@ -145,7 +145,7 @@ static const struct drm_simple_display_pipe_funcs
> mi0283qt_pipe_funcs = {
>  };
>
>  static const struct drm_display_mode mi0283qt_mode = {
> -       TINYDRM_MODE(320, 240, 58, 43),
> +       DRM_SIMPLE_MODE(320, 240, 58, 43),
>  };
>
>  DEFINE_DRM_GEM_CMA_FOPS(mi0283qt_fops);
> diff --git a/drivers/gpu/drm/tinydrm/repaper.c
> b/drivers/gpu/drm/tinydrm/repaper.c
> index b037c6540cf3..72d30151ecd8 100644
> --- a/drivers/gpu/drm/tinydrm/repaper.c
> +++ b/drivers/gpu/drm/tinydrm/repaper.c
> @@ -860,28 +860,28 @@ static const uint32_t repaper_formats[] = {
>  };
>
>  static const struct drm_display_mode repaper_e1144cs021_mode = {
> -       TINYDRM_MODE(128, 96, 29, 22),
> +       DRM_SIMPLE_MODE(128, 96, 29, 22),
>  };
>
>  static const u8 repaper_e1144cs021_cs[] = { 0x00, 0x00, 0x00, 0x00,
>                                             0x00, 0x0f, 0xff, 0x00 };
>
>  static const struct drm_display_mode repaper_e1190cs021_mode = {
> -       TINYDRM_MODE(144, 128, 36, 32),
> +       DRM_SIMPLE_MODE(144, 128, 36, 32),
>  };
>
>  static const u8 repaper_e1190cs021_cs[] = { 0x00, 0x00, 0x00, 0x03,
>                                             0xfc, 0x00, 0x00, 0xff };
>
>  static const struct drm_display_mode repaper_e2200cs021_mode = {
> -       TINYDRM_MODE(200, 96, 46, 22),
> +       DRM_SIMPLE_MODE(200, 96, 46, 22),
>  };
>
>  static const u8 repaper_e2200cs021_cs[] = { 0x00, 0x00, 0x00, 0x00,
>                                             0x01, 0xff, 0xe0, 0x00 };
>
>  static const struct drm_display_mode repaper_e2271cs021_mode = {
> -       TINYDRM_MODE(264, 176, 57, 38),
> +       DRM_SIMPLE_MODE(264, 176, 57, 38),
>  };
>
>  static const u8 repaper_e2271cs021_cs[] = { 0x00, 0x00, 0x00, 0x7f,
> diff --git a/drivers/gpu/drm/tinydrm/st7586.c
> b/drivers/gpu/drm/tinydrm/st7586.c
> index 01a8077954b3..5ee7db561349 100644
> --- a/drivers/gpu/drm/tinydrm/st7586.c
> +++ b/drivers/gpu/drm/tinydrm/st7586.c
> @@ -312,7 +312,7 @@ static const struct drm_simple_display_pipe_funcs
> st7586_pipe_funcs = {
>  };
>
>  static const struct drm_display_mode st7586_mode = {
> -       TINYDRM_MODE(178, 128, 37, 27),
> +       DRM_SIMPLE_MODE(178, 128, 37, 27),
>  };
>
>  DEFINE_DRM_GEM_CMA_FOPS(st7586_fops);
> diff --git a/drivers/gpu/drm/tinydrm/st7735r.c
> b/drivers/gpu/drm/tinydrm/st7735r.c
> index 3bab9a9569a6..6c7904c205f0 100644
> --- a/drivers/gpu/drm/tinydrm/st7735r.c
> +++ b/drivers/gpu/drm/tinydrm/st7735r.c
> @@ -111,7 +111,7 @@ static const struct drm_simple_display_pipe_funcs
> jd_t18003_t01_pipe_funcs = {
>  };
>
>  static const struct drm_display_mode jd_t18003_t01_mode = {
> -       TINYDRM_MODE(128, 160, 28, 35),
> +       DRM_SIMPLE_MODE(128, 160, 28, 35),
>  };
>
>  DEFINE_DRM_GEM_CMA_FOPS(st7735r_fops);
> diff --git a/include/drm/drm_modes.h b/include/drm/drm_modes.h
> index be4fed97e727..868a9954a8e4 100644
> --- a/include/drm/drm_modes.h
> +++ b/include/drm/drm_modes.h
> @@ -138,6 +138,22 @@ enum drm_mode_status {
>         .vsync_start = (vss), .vsync_end = (vse), .vtotal = (vt), \
>         .vscan = (vs), .flags = (f)
>
> +/**
> + * DRM_SIMPLE_MODE - Simple display mode
> + * @hd: Horizontal resolution, width
> + * @vd: Vertical resolution, height
> + * @hd_mm: Display width in millimeters
> + * @vd_mm: Display height in millimeters
> + *
> + * This macro initializes a &drm_display_mode that only contains info
> about
> + * resolution and physical size.
> + */
> +#define DRM_SIMPLE_MODE(hd, vd, hd_mm, vd_mm) \
> +       .type = DRM_MODE_TYPE_DRIVER, .clock = 1 /* pass validation */, \
> +       .hdisplay = (hd), .hsync_start = (hd), .hsync_end = (hd), \
> +       .htotal = (hd), .vdisplay = (vd), .vsync_start = (vd), \
> +       .vsync_end = (vd), .vtotal = (vd)
> +
>  #define CRTC_INTERLACE_HALVE_V (1 << 0) /* halve V values for interlacing
> */
>  #define CRTC_STEREO_DOUBLE     (1 << 1) /* adjust timings for stereo
> modes */
>  #define CRTC_NO_DBLSCAN                (1 << 2) /* don't adjust
> doublescan */
> diff --git a/include/drm/tinydrm/tinydrm.h b/include/drm/tinydrm/tinydrm.h
> index 5621688edcc0..87e7f9b93a37 100644
> --- a/include/drm/tinydrm/tinydrm.h
> +++ b/include/drm/tinydrm/tinydrm.h
> @@ -35,29 +35,6 @@ pipe_to_tinydrm(struct drm_simple_display_pipe *pipe)
>         return container_of(pipe, struct tinydrm_device, pipe);
>  }
>
> -/**
> - * TINYDRM_MODE - tinydrm display mode
> - * @hd: Horizontal resolution, width
> - * @vd: Vertical resolution, height
> - * @hd_mm: Display width in millimeters
> - * @vd_mm: Display height in millimeters
> - *
> - * This macro creates a &drm_display_mode for use with tinydrm.
> - */
> -#define TINYDRM_MODE(hd, vd, hd_mm, vd_mm) \
> -       .hdisplay = (hd), \
> -       .hsync_start = (hd), \
> -       .hsync_end = (hd), \
> -       .htotal = (hd), \
> -       .vdisplay = (vd), \
> -       .vsync_start = (vd), \
> -       .vsync_end = (vd), \
> -       .vtotal = (vd), \
> -       .width_mm = (hd_mm), \
> -       .height_mm = (vd_mm), \
> -       .type = DRM_MODE_TYPE_DRIVER, \
> -       .clock = 1 /* pass validation */
> -
>  int devm_tinydrm_init(struct device *parent, struct tinydrm_device *tdev,
>                       struct drm_driver *driver);
>  int devm_tinydrm_register(struct tinydrm_device *tdev);
> --
> 2.20.1
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
>
<div dir="auto"><div>You don&#39;t appear to set the mm in the new macro. Not sure if it&#39;s on purpose.<br><br><div class="gmail_quote"><div dir="ltr">On Sun, Jan 20, 2019, 06:43 Noralf Trønnes &lt;<a href="mailto:noralf@tronnes.org">noralf@tronnes.org</a> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">This adds a helper macro to specify modes that only contain info about<br>
resolution.<br>
<br>
Signed-off-by: Noralf Trønnes &lt;<a href="mailto:noralf@tronnes.org" target="_blank" rel="noreferrer">noralf@tronnes.org</a>&gt;<br>
---<br>
 drivers/gpu/drm/tinydrm/hx8357d.c  |  2 +-<br>
 drivers/gpu/drm/tinydrm/ili9225.c  |  2 +-<br>
 drivers/gpu/drm/tinydrm/ili9341.c  |  2 +-<br>
 drivers/gpu/drm/tinydrm/mi0283qt.c |  2 +-<br>
 drivers/gpu/drm/tinydrm/repaper.c  |  8 ++++----<br>
 drivers/gpu/drm/tinydrm/st7586.c   |  2 +-<br>
 drivers/gpu/drm/tinydrm/st7735r.c  |  2 +-<br>
 include/drm/drm_modes.h            | 16 ++++++++++++++++<br>
 include/drm/tinydrm/tinydrm.h      | 23 -----------------------<br>
 9 files changed, 26 insertions(+), 33 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/tinydrm/hx8357d.c b/drivers/gpu/drm/tinydrm/hx8357d.c<br>
index 8bbd0beafc6a..5a1ec0451c19 100644<br>
--- a/drivers/gpu/drm/tinydrm/hx8357d.c<br>
+++ b/drivers/gpu/drm/tinydrm/hx8357d.c<br>
@@ -181,7 +181,7 @@ static const struct drm_simple_display_pipe_funcs hx8357d_pipe_funcs = {<br>
 };<br>
<br>
 static const struct drm_display_mode yx350hv15_mode = {<br>
-       TINYDRM_MODE(320, 480, 60, 75),<br>
+       DRM_SIMPLE_MODE(320, 480, 60, 75),<br>
 };<br>
<br>
 DEFINE_DRM_GEM_CMA_FOPS(hx8357d_fops);<br>
diff --git a/drivers/gpu/drm/tinydrm/ili9225.c b/drivers/gpu/drm/tinydrm/ili9225.c<br>
index 43a3b68d90a2..d40814d370e2 100644<br>
--- a/drivers/gpu/drm/tinydrm/ili9225.c<br>
+++ b/drivers/gpu/drm/tinydrm/ili9225.c<br>
@@ -332,7 +332,7 @@ static const struct drm_simple_display_pipe_funcs ili9225_pipe_funcs = {<br>
 };<br>
<br>
 static const struct drm_display_mode ili9225_mode = {<br>
-       TINYDRM_MODE(176, 220, 35, 44),<br>
+       DRM_SIMPLE_MODE(176, 220, 35, 44),<br>
 };<br>
<br>
 DEFINE_DRM_GEM_CMA_FOPS(ili9225_fops);<br>
diff --git a/drivers/gpu/drm/tinydrm/ili9341.c b/drivers/gpu/drm/tinydrm/ili9341.c<br>
index 713bb2dd7e04..063f4f07f811 100644<br>
--- a/drivers/gpu/drm/tinydrm/ili9341.c<br>
+++ b/drivers/gpu/drm/tinydrm/ili9341.c<br>
@@ -137,7 +137,7 @@ static const struct drm_simple_display_pipe_funcs ili9341_pipe_funcs = {<br>
 };<br>
<br>
 static const struct drm_display_mode yx240qv29_mode = {<br>
-       TINYDRM_MODE(240, 320, 37, 49),<br>
+       DRM_SIMPLE_MODE(240, 320, 37, 49),<br>
 };<br>
<br>
 DEFINE_DRM_GEM_CMA_FOPS(ili9341_fops);<br>
diff --git a/drivers/gpu/drm/tinydrm/mi0283qt.c b/drivers/gpu/drm/tinydrm/mi0283qt.c<br>
index 82a92ec9ae3c..3d067c2ba1bc 100644<br>
--- a/drivers/gpu/drm/tinydrm/mi0283qt.c<br>
+++ b/drivers/gpu/drm/tinydrm/mi0283qt.c<br>
@@ -145,7 +145,7 @@ static const struct drm_simple_display_pipe_funcs mi0283qt_pipe_funcs = {<br>
 };<br>
<br>
 static const struct drm_display_mode mi0283qt_mode = {<br>
-       TINYDRM_MODE(320, 240, 58, 43),<br>
+       DRM_SIMPLE_MODE(320, 240, 58, 43),<br>
 };<br>
<br>
 DEFINE_DRM_GEM_CMA_FOPS(mi0283qt_fops);<br>
diff --git a/drivers/gpu/drm/tinydrm/repaper.c b/drivers/gpu/drm/tinydrm/repaper.c<br>
index b037c6540cf3..72d30151ecd8 100644<br>
--- a/drivers/gpu/drm/tinydrm/repaper.c<br>
+++ b/drivers/gpu/drm/tinydrm/repaper.c<br>
@@ -860,28 +860,28 @@ static const uint32_t repaper_formats[] = {<br>
 };<br>
<br>
 static const struct drm_display_mode repaper_e1144cs021_mode = {<br>
-       TINYDRM_MODE(128, 96, 29, 22),<br>
+       DRM_SIMPLE_MODE(128, 96, 29, 22),<br>
 };<br>
<br>
 static const u8 repaper_e1144cs021_cs[] = { 0x00, 0x00, 0x00, 0x00,<br>
                                            0x00, 0x0f, 0xff, 0x00 };<br>
<br>
 static const struct drm_display_mode repaper_e1190cs021_mode = {<br>
-       TINYDRM_MODE(144, 128, 36, 32),<br>
+       DRM_SIMPLE_MODE(144, 128, 36, 32),<br>
 };<br>
<br>
 static const u8 repaper_e1190cs021_cs[] = { 0x00, 0x00, 0x00, 0x03,<br>
                                            0xfc, 0x00, 0x00, 0xff };<br>
<br>
 static const struct drm_display_mode repaper_e2200cs021_mode = {<br>
-       TINYDRM_MODE(200, 96, 46, 22),<br>
+       DRM_SIMPLE_MODE(200, 96, 46, 22),<br>
 };<br>
<br>
 static const u8 repaper_e2200cs021_cs[] = { 0x00, 0x00, 0x00, 0x00,<br>
                                            0x01, 0xff, 0xe0, 0x00 };<br>
<br>
 static const struct drm_display_mode repaper_e2271cs021_mode = {<br>
-       TINYDRM_MODE(264, 176, 57, 38),<br>
+       DRM_SIMPLE_MODE(264, 176, 57, 38),<br>
 };<br>
<br>
 static const u8 repaper_e2271cs021_cs[] = { 0x00, 0x00, 0x00, 0x7f,<br>
diff --git a/drivers/gpu/drm/tinydrm/st7586.c b/drivers/gpu/drm/tinydrm/st7586.c<br>
index 01a8077954b3..5ee7db561349 100644<br>
--- a/drivers/gpu/drm/tinydrm/st7586.c<br>
+++ b/drivers/gpu/drm/tinydrm/st7586.c<br>
@@ -312,7 +312,7 @@ static const struct drm_simple_display_pipe_funcs st7586_pipe_funcs = {<br>
 };<br>
<br>
 static const struct drm_display_mode st7586_mode = {<br>
-       TINYDRM_MODE(178, 128, 37, 27),<br>
+       DRM_SIMPLE_MODE(178, 128, 37, 27),<br>
 };<br>
<br>
 DEFINE_DRM_GEM_CMA_FOPS(st7586_fops);<br>
diff --git a/drivers/gpu/drm/tinydrm/st7735r.c b/drivers/gpu/drm/tinydrm/st7735r.c<br>
index 3bab9a9569a6..6c7904c205f0 100644<br>
--- a/drivers/gpu/drm/tinydrm/st7735r.c<br>
+++ b/drivers/gpu/drm/tinydrm/st7735r.c<br>
@@ -111,7 +111,7 @@ static const struct drm_simple_display_pipe_funcs jd_t18003_t01_pipe_funcs = {<br>
 };<br>
<br>
 static const struct drm_display_mode jd_t18003_t01_mode = {<br>
-       TINYDRM_MODE(128, 160, 28, 35),<br>
+       DRM_SIMPLE_MODE(128, 160, 28, 35),<br>
 };<br>
<br>
 DEFINE_DRM_GEM_CMA_FOPS(st7735r_fops);<br>
diff --git a/include/drm/drm_modes.h b/include/drm/drm_modes.h<br>
index be4fed97e727..868a9954a8e4 100644<br>
--- a/include/drm/drm_modes.h<br>
+++ b/include/drm/drm_modes.h<br>
@@ -138,6 +138,22 @@ enum drm_mode_status {<br>
        .vsync_start = (vss), .vsync_end = (vse), .vtotal = (vt), \<br>
        .vscan = (vs), .flags = (f)<br>
<br>
+/**<br>
+ * DRM_SIMPLE_MODE - Simple display mode<br>
+ * @hd: Horizontal resolution, width<br>
+ * @vd: Vertical resolution, height<br>
+ * @hd_mm: Display width in millimeters<br>
+ * @vd_mm: Display height in millimeters<br>
+ *<br>
+ * This macro initializes a &amp;drm_display_mode that only contains info about<br>
+ * resolution and physical size.<br>
+ */<br>
+#define DRM_SIMPLE_MODE(hd, vd, hd_mm, vd_mm) \<br>
+       .type = DRM_MODE_TYPE_DRIVER, .clock = 1 /* pass validation */, \<br>
+       .hdisplay = (hd), .hsync_start = (hd), .hsync_end = (hd), \<br>
+       .htotal = (hd), .vdisplay = (vd), .vsync_start = (vd), \<br>
+       .vsync_end = (vd), .vtotal = (vd)<br>
+<br>
 #define CRTC_INTERLACE_HALVE_V (1 &lt;&lt; 0) /* halve V values for interlacing */<br>
 #define CRTC_STEREO_DOUBLE     (1 &lt;&lt; 1) /* adjust timings for stereo modes */<br>
 #define CRTC_NO_DBLSCAN                (1 &lt;&lt; 2) /* don&#39;t adjust doublescan */<br>
diff --git a/include/drm/tinydrm/tinydrm.h b/include/drm/tinydrm/tinydrm.h<br>
index 5621688edcc0..87e7f9b93a37 100644<br>
--- a/include/drm/tinydrm/tinydrm.h<br>
+++ b/include/drm/tinydrm/tinydrm.h<br>
@@ -35,29 +35,6 @@ pipe_to_tinydrm(struct drm_simple_display_pipe *pipe)<br>
        return container_of(pipe, struct tinydrm_device, pipe);<br>
 }<br>
<br>
-/**<br>
- * TINYDRM_MODE - tinydrm display mode<br>
- * @hd: Horizontal resolution, width<br>
- * @vd: Vertical resolution, height<br>
- * @hd_mm: Display width in millimeters<br>
- * @vd_mm: Display height in millimeters<br>
- *<br>
- * This macro creates a &amp;drm_display_mode for use with tinydrm.<br>
- */<br>
-#define TINYDRM_MODE(hd, vd, hd_mm, vd_mm) \<br>
-       .hdisplay = (hd), \<br>
-       .hsync_start = (hd), \<br>
-       .hsync_end = (hd), \<br>
-       .htotal = (hd), \<br>
-       .vdisplay = (vd), \<br>
-       .vsync_start = (vd), \<br>
-       .vsync_end = (vd), \<br>
-       .vtotal = (vd), \<br>
-       .width_mm = (hd_mm), \<br>
-       .height_mm = (vd_mm), \<br>
-       .type = DRM_MODE_TYPE_DRIVER, \<br>
-       .clock = 1 /* pass validation */<br>
-<br>
 int devm_tinydrm_init(struct device *parent, struct tinydrm_device *tdev,<br>
                      struct drm_driver *driver);<br>
 int devm_tinydrm_register(struct tinydrm_device *tdev);<br>
-- <br>
2.20.1<br>
<br>
_______________________________________________<br>
dri-devel mailing list<br>
<a href="mailto:dri-devel@lists.freedesktop.org" target="_blank" rel="noreferrer">dri-devel@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/dri-devel" rel="noreferrer noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/dri-devel</a><br>
</blockquote></div></div></div>
Noralf Trønnes Jan. 20, 2019, 5:27 p.m. UTC | #2
Den 20.01.2019 17.37, skrev Ilia Mirkin:
> You don't appear to set the mm in the new macro. Not sure if it's on
> purpose.
> 

Not intentional, that was a slip. I copied the DRM_MODE macro and forgot
about setting the size.

Thanks,
Noralf.

> On Sun, Jan 20, 2019, 06:43 Noralf Trønnes <noralf@tronnes.org
> <mailto:noralf@tronnes.org> wrote:
> 
>     This adds a helper macro to specify modes that only contain info about
>     resolution.
> 
>     Signed-off-by: Noralf Trønnes <noralf@tronnes.org
>     <mailto:noralf@tronnes.org>>
>     ---
>      drivers/gpu/drm/tinydrm/hx8357d.c  |  2 +-
>      drivers/gpu/drm/tinydrm/ili9225.c  |  2 +-
>      drivers/gpu/drm/tinydrm/ili9341.c  |  2 +-
>      drivers/gpu/drm/tinydrm/mi0283qt.c |  2 +-
>      drivers/gpu/drm/tinydrm/repaper.c  |  8 ++++----
>      drivers/gpu/drm/tinydrm/st7586.c   |  2 +-
>      drivers/gpu/drm/tinydrm/st7735r.c  |  2 +-
>      include/drm/drm_modes.h            | 16 ++++++++++++++++
>      include/drm/tinydrm/tinydrm.h      | 23 -----------------------
>      9 files changed, 26 insertions(+), 33 deletions(-)
> 
>     diff --git a/drivers/gpu/drm/tinydrm/hx8357d.c
>     b/drivers/gpu/drm/tinydrm/hx8357d.c
>     index 8bbd0beafc6a..5a1ec0451c19 100644
>     --- a/drivers/gpu/drm/tinydrm/hx8357d.c
>     +++ b/drivers/gpu/drm/tinydrm/hx8357d.c
>     @@ -181,7 +181,7 @@ static const struct
>     drm_simple_display_pipe_funcs hx8357d_pipe_funcs = {
>      };
> 
>      static const struct drm_display_mode yx350hv15_mode = {
>     -       TINYDRM_MODE(320, 480, 60, 75),
>     +       DRM_SIMPLE_MODE(320, 480, 60, 75),
>      };
> 
>      DEFINE_DRM_GEM_CMA_FOPS(hx8357d_fops);
>     diff --git a/drivers/gpu/drm/tinydrm/ili9225.c
>     b/drivers/gpu/drm/tinydrm/ili9225.c
>     index 43a3b68d90a2..d40814d370e2 100644
>     --- a/drivers/gpu/drm/tinydrm/ili9225.c
>     +++ b/drivers/gpu/drm/tinydrm/ili9225.c
>     @@ -332,7 +332,7 @@ static const struct
>     drm_simple_display_pipe_funcs ili9225_pipe_funcs = {
>      };
> 
>      static const struct drm_display_mode ili9225_mode = {
>     -       TINYDRM_MODE(176, 220, 35, 44),
>     +       DRM_SIMPLE_MODE(176, 220, 35, 44),
>      };
> 
>      DEFINE_DRM_GEM_CMA_FOPS(ili9225_fops);
>     diff --git a/drivers/gpu/drm/tinydrm/ili9341.c
>     b/drivers/gpu/drm/tinydrm/ili9341.c
>     index 713bb2dd7e04..063f4f07f811 100644
>     --- a/drivers/gpu/drm/tinydrm/ili9341.c
>     +++ b/drivers/gpu/drm/tinydrm/ili9341.c
>     @@ -137,7 +137,7 @@ static const struct
>     drm_simple_display_pipe_funcs ili9341_pipe_funcs = {
>      };
> 
>      static const struct drm_display_mode yx240qv29_mode = {
>     -       TINYDRM_MODE(240, 320, 37, 49),
>     +       DRM_SIMPLE_MODE(240, 320, 37, 49),
>      };
> 
>      DEFINE_DRM_GEM_CMA_FOPS(ili9341_fops);
>     diff --git a/drivers/gpu/drm/tinydrm/mi0283qt.c
>     b/drivers/gpu/drm/tinydrm/mi0283qt.c
>     index 82a92ec9ae3c..3d067c2ba1bc 100644
>     --- a/drivers/gpu/drm/tinydrm/mi0283qt.c
>     +++ b/drivers/gpu/drm/tinydrm/mi0283qt.c
>     @@ -145,7 +145,7 @@ static const struct
>     drm_simple_display_pipe_funcs mi0283qt_pipe_funcs = {
>      };
> 
>      static const struct drm_display_mode mi0283qt_mode = {
>     -       TINYDRM_MODE(320, 240, 58, 43),
>     +       DRM_SIMPLE_MODE(320, 240, 58, 43),
>      };
> 
>      DEFINE_DRM_GEM_CMA_FOPS(mi0283qt_fops);
>     diff --git a/drivers/gpu/drm/tinydrm/repaper.c
>     b/drivers/gpu/drm/tinydrm/repaper.c
>     index b037c6540cf3..72d30151ecd8 100644
>     --- a/drivers/gpu/drm/tinydrm/repaper.c
>     +++ b/drivers/gpu/drm/tinydrm/repaper.c
>     @@ -860,28 +860,28 @@ static const uint32_t repaper_formats[] = {
>      };
> 
>      static const struct drm_display_mode repaper_e1144cs021_mode = {
>     -       TINYDRM_MODE(128, 96, 29, 22),
>     +       DRM_SIMPLE_MODE(128, 96, 29, 22),
>      };
> 
>      static const u8 repaper_e1144cs021_cs[] = { 0x00, 0x00, 0x00, 0x00,
>                                                 0x00, 0x0f, 0xff, 0x00 };
> 
>      static const struct drm_display_mode repaper_e1190cs021_mode = {
>     -       TINYDRM_MODE(144, 128, 36, 32),
>     +       DRM_SIMPLE_MODE(144, 128, 36, 32),
>      };
> 
>      static const u8 repaper_e1190cs021_cs[] = { 0x00, 0x00, 0x00, 0x03,
>                                                 0xfc, 0x00, 0x00, 0xff };
> 
>      static const struct drm_display_mode repaper_e2200cs021_mode = {
>     -       TINYDRM_MODE(200, 96, 46, 22),
>     +       DRM_SIMPLE_MODE(200, 96, 46, 22),
>      };
> 
>      static const u8 repaper_e2200cs021_cs[] = { 0x00, 0x00, 0x00, 0x00,
>                                                 0x01, 0xff, 0xe0, 0x00 };
> 
>      static const struct drm_display_mode repaper_e2271cs021_mode = {
>     -       TINYDRM_MODE(264, 176, 57, 38),
>     +       DRM_SIMPLE_MODE(264, 176, 57, 38),
>      };
> 
>      static const u8 repaper_e2271cs021_cs[] = { 0x00, 0x00, 0x00, 0x7f,
>     diff --git a/drivers/gpu/drm/tinydrm/st7586.c
>     b/drivers/gpu/drm/tinydrm/st7586.c
>     index 01a8077954b3..5ee7db561349 100644
>     --- a/drivers/gpu/drm/tinydrm/st7586.c
>     +++ b/drivers/gpu/drm/tinydrm/st7586.c
>     @@ -312,7 +312,7 @@ static const struct
>     drm_simple_display_pipe_funcs st7586_pipe_funcs = {
>      };
> 
>      static const struct drm_display_mode st7586_mode = {
>     -       TINYDRM_MODE(178, 128, 37, 27),
>     +       DRM_SIMPLE_MODE(178, 128, 37, 27),
>      };
> 
>      DEFINE_DRM_GEM_CMA_FOPS(st7586_fops);
>     diff --git a/drivers/gpu/drm/tinydrm/st7735r.c
>     b/drivers/gpu/drm/tinydrm/st7735r.c
>     index 3bab9a9569a6..6c7904c205f0 100644
>     --- a/drivers/gpu/drm/tinydrm/st7735r.c
>     +++ b/drivers/gpu/drm/tinydrm/st7735r.c
>     @@ -111,7 +111,7 @@ static const struct
>     drm_simple_display_pipe_funcs jd_t18003_t01_pipe_funcs = {
>      };
> 
>      static const struct drm_display_mode jd_t18003_t01_mode = {
>     -       TINYDRM_MODE(128, 160, 28, 35),
>     +       DRM_SIMPLE_MODE(128, 160, 28, 35),
>      };
> 
>      DEFINE_DRM_GEM_CMA_FOPS(st7735r_fops);
>     diff --git a/include/drm/drm_modes.h b/include/drm/drm_modes.h
>     index be4fed97e727..868a9954a8e4 100644
>     --- a/include/drm/drm_modes.h
>     +++ b/include/drm/drm_modes.h
>     @@ -138,6 +138,22 @@ enum drm_mode_status {
>             .vsync_start = (vss), .vsync_end = (vse), .vtotal = (vt), \
>             .vscan = (vs), .flags = (f)
> 
>     +/**
>     + * DRM_SIMPLE_MODE - Simple display mode
>     + * @hd: Horizontal resolution, width
>     + * @vd: Vertical resolution, height
>     + * @hd_mm: Display width in millimeters
>     + * @vd_mm: Display height in millimeters
>     + *
>     + * This macro initializes a &drm_display_mode that only contains
>     info about
>     + * resolution and physical size.
>     + */
>     +#define DRM_SIMPLE_MODE(hd, vd, hd_mm, vd_mm) \
>     +       .type = DRM_MODE_TYPE_DRIVER, .clock = 1 /* pass validation
>     */, \
>     +       .hdisplay = (hd), .hsync_start = (hd), .hsync_end = (hd), \
>     +       .htotal = (hd), .vdisplay = (vd), .vsync_start = (vd), \
>     +       .vsync_end = (vd), .vtotal = (vd)
>     +
>      #define CRTC_INTERLACE_HALVE_V (1 << 0) /* halve V values for
>     interlacing */
>      #define CRTC_STEREO_DOUBLE     (1 << 1) /* adjust timings for
>     stereo modes */
>      #define CRTC_NO_DBLSCAN                (1 << 2) /* don't adjust
>     doublescan */
>     diff --git a/include/drm/tinydrm/tinydrm.h
>     b/include/drm/tinydrm/tinydrm.h
>     index 5621688edcc0..87e7f9b93a37 100644
>     --- a/include/drm/tinydrm/tinydrm.h
>     +++ b/include/drm/tinydrm/tinydrm.h
>     @@ -35,29 +35,6 @@ pipe_to_tinydrm(struct drm_simple_display_pipe *pipe)
>             return container_of(pipe, struct tinydrm_device, pipe);
>      }
> 
>     -/**
>     - * TINYDRM_MODE - tinydrm display mode
>     - * @hd: Horizontal resolution, width
>     - * @vd: Vertical resolution, height
>     - * @hd_mm: Display width in millimeters
>     - * @vd_mm: Display height in millimeters
>     - *
>     - * This macro creates a &drm_display_mode for use with tinydrm.
>     - */
>     -#define TINYDRM_MODE(hd, vd, hd_mm, vd_mm) \
>     -       .hdisplay = (hd), \
>     -       .hsync_start = (hd), \
>     -       .hsync_end = (hd), \
>     -       .htotal = (hd), \
>     -       .vdisplay = (vd), \
>     -       .vsync_start = (vd), \
>     -       .vsync_end = (vd), \
>     -       .vtotal = (vd), \
>     -       .width_mm = (hd_mm), \
>     -       .height_mm = (vd_mm), \
>     -       .type = DRM_MODE_TYPE_DRIVER, \
>     -       .clock = 1 /* pass validation */
>     -
>      int devm_tinydrm_init(struct device *parent, struct tinydrm_device
>     *tdev,
>                           struct drm_driver *driver);
>      int devm_tinydrm_register(struct tinydrm_device *tdev);
>     -- 
>     2.20.1
> 
>     _______________________________________________
>     dri-devel mailing list
>     dri-devel@lists.freedesktop.org <mailto:dri-devel@lists.freedesktop.org>
>     https://lists.freedesktop.org/mailman/listinfo/dri-devel
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/tinydrm/hx8357d.c b/drivers/gpu/drm/tinydrm/hx8357d.c
index 8bbd0beafc6a..5a1ec0451c19 100644
--- a/drivers/gpu/drm/tinydrm/hx8357d.c
+++ b/drivers/gpu/drm/tinydrm/hx8357d.c
@@ -181,7 +181,7 @@  static const struct drm_simple_display_pipe_funcs hx8357d_pipe_funcs = {
 };
 
 static const struct drm_display_mode yx350hv15_mode = {
-	TINYDRM_MODE(320, 480, 60, 75),
+	DRM_SIMPLE_MODE(320, 480, 60, 75),
 };
 
 DEFINE_DRM_GEM_CMA_FOPS(hx8357d_fops);
diff --git a/drivers/gpu/drm/tinydrm/ili9225.c b/drivers/gpu/drm/tinydrm/ili9225.c
index 43a3b68d90a2..d40814d370e2 100644
--- a/drivers/gpu/drm/tinydrm/ili9225.c
+++ b/drivers/gpu/drm/tinydrm/ili9225.c
@@ -332,7 +332,7 @@  static const struct drm_simple_display_pipe_funcs ili9225_pipe_funcs = {
 };
 
 static const struct drm_display_mode ili9225_mode = {
-	TINYDRM_MODE(176, 220, 35, 44),
+	DRM_SIMPLE_MODE(176, 220, 35, 44),
 };
 
 DEFINE_DRM_GEM_CMA_FOPS(ili9225_fops);
diff --git a/drivers/gpu/drm/tinydrm/ili9341.c b/drivers/gpu/drm/tinydrm/ili9341.c
index 713bb2dd7e04..063f4f07f811 100644
--- a/drivers/gpu/drm/tinydrm/ili9341.c
+++ b/drivers/gpu/drm/tinydrm/ili9341.c
@@ -137,7 +137,7 @@  static const struct drm_simple_display_pipe_funcs ili9341_pipe_funcs = {
 };
 
 static const struct drm_display_mode yx240qv29_mode = {
-	TINYDRM_MODE(240, 320, 37, 49),
+	DRM_SIMPLE_MODE(240, 320, 37, 49),
 };
 
 DEFINE_DRM_GEM_CMA_FOPS(ili9341_fops);
diff --git a/drivers/gpu/drm/tinydrm/mi0283qt.c b/drivers/gpu/drm/tinydrm/mi0283qt.c
index 82a92ec9ae3c..3d067c2ba1bc 100644
--- a/drivers/gpu/drm/tinydrm/mi0283qt.c
+++ b/drivers/gpu/drm/tinydrm/mi0283qt.c
@@ -145,7 +145,7 @@  static const struct drm_simple_display_pipe_funcs mi0283qt_pipe_funcs = {
 };
 
 static const struct drm_display_mode mi0283qt_mode = {
-	TINYDRM_MODE(320, 240, 58, 43),
+	DRM_SIMPLE_MODE(320, 240, 58, 43),
 };
 
 DEFINE_DRM_GEM_CMA_FOPS(mi0283qt_fops);
diff --git a/drivers/gpu/drm/tinydrm/repaper.c b/drivers/gpu/drm/tinydrm/repaper.c
index b037c6540cf3..72d30151ecd8 100644
--- a/drivers/gpu/drm/tinydrm/repaper.c
+++ b/drivers/gpu/drm/tinydrm/repaper.c
@@ -860,28 +860,28 @@  static const uint32_t repaper_formats[] = {
 };
 
 static const struct drm_display_mode repaper_e1144cs021_mode = {
-	TINYDRM_MODE(128, 96, 29, 22),
+	DRM_SIMPLE_MODE(128, 96, 29, 22),
 };
 
 static const u8 repaper_e1144cs021_cs[] = { 0x00, 0x00, 0x00, 0x00,
 					    0x00, 0x0f, 0xff, 0x00 };
 
 static const struct drm_display_mode repaper_e1190cs021_mode = {
-	TINYDRM_MODE(144, 128, 36, 32),
+	DRM_SIMPLE_MODE(144, 128, 36, 32),
 };
 
 static const u8 repaper_e1190cs021_cs[] = { 0x00, 0x00, 0x00, 0x03,
 					    0xfc, 0x00, 0x00, 0xff };
 
 static const struct drm_display_mode repaper_e2200cs021_mode = {
-	TINYDRM_MODE(200, 96, 46, 22),
+	DRM_SIMPLE_MODE(200, 96, 46, 22),
 };
 
 static const u8 repaper_e2200cs021_cs[] = { 0x00, 0x00, 0x00, 0x00,
 					    0x01, 0xff, 0xe0, 0x00 };
 
 static const struct drm_display_mode repaper_e2271cs021_mode = {
-	TINYDRM_MODE(264, 176, 57, 38),
+	DRM_SIMPLE_MODE(264, 176, 57, 38),
 };
 
 static const u8 repaper_e2271cs021_cs[] = { 0x00, 0x00, 0x00, 0x7f,
diff --git a/drivers/gpu/drm/tinydrm/st7586.c b/drivers/gpu/drm/tinydrm/st7586.c
index 01a8077954b3..5ee7db561349 100644
--- a/drivers/gpu/drm/tinydrm/st7586.c
+++ b/drivers/gpu/drm/tinydrm/st7586.c
@@ -312,7 +312,7 @@  static const struct drm_simple_display_pipe_funcs st7586_pipe_funcs = {
 };
 
 static const struct drm_display_mode st7586_mode = {
-	TINYDRM_MODE(178, 128, 37, 27),
+	DRM_SIMPLE_MODE(178, 128, 37, 27),
 };
 
 DEFINE_DRM_GEM_CMA_FOPS(st7586_fops);
diff --git a/drivers/gpu/drm/tinydrm/st7735r.c b/drivers/gpu/drm/tinydrm/st7735r.c
index 3bab9a9569a6..6c7904c205f0 100644
--- a/drivers/gpu/drm/tinydrm/st7735r.c
+++ b/drivers/gpu/drm/tinydrm/st7735r.c
@@ -111,7 +111,7 @@  static const struct drm_simple_display_pipe_funcs jd_t18003_t01_pipe_funcs = {
 };
 
 static const struct drm_display_mode jd_t18003_t01_mode = {
-	TINYDRM_MODE(128, 160, 28, 35),
+	DRM_SIMPLE_MODE(128, 160, 28, 35),
 };
 
 DEFINE_DRM_GEM_CMA_FOPS(st7735r_fops);
diff --git a/include/drm/drm_modes.h b/include/drm/drm_modes.h
index be4fed97e727..868a9954a8e4 100644
--- a/include/drm/drm_modes.h
+++ b/include/drm/drm_modes.h
@@ -138,6 +138,22 @@  enum drm_mode_status {
 	.vsync_start = (vss), .vsync_end = (vse), .vtotal = (vt), \
 	.vscan = (vs), .flags = (f)
 
+/**
+ * DRM_SIMPLE_MODE - Simple display mode
+ * @hd: Horizontal resolution, width
+ * @vd: Vertical resolution, height
+ * @hd_mm: Display width in millimeters
+ * @vd_mm: Display height in millimeters
+ *
+ * This macro initializes a &drm_display_mode that only contains info about
+ * resolution and physical size.
+ */
+#define DRM_SIMPLE_MODE(hd, vd, hd_mm, vd_mm) \
+	.type = DRM_MODE_TYPE_DRIVER, .clock = 1 /* pass validation */, \
+	.hdisplay = (hd), .hsync_start = (hd), .hsync_end = (hd), \
+	.htotal = (hd), .vdisplay = (vd), .vsync_start = (vd), \
+	.vsync_end = (vd), .vtotal = (vd)
+
 #define CRTC_INTERLACE_HALVE_V	(1 << 0) /* halve V values for interlacing */
 #define CRTC_STEREO_DOUBLE	(1 << 1) /* adjust timings for stereo modes */
 #define CRTC_NO_DBLSCAN		(1 << 2) /* don't adjust doublescan */
diff --git a/include/drm/tinydrm/tinydrm.h b/include/drm/tinydrm/tinydrm.h
index 5621688edcc0..87e7f9b93a37 100644
--- a/include/drm/tinydrm/tinydrm.h
+++ b/include/drm/tinydrm/tinydrm.h
@@ -35,29 +35,6 @@  pipe_to_tinydrm(struct drm_simple_display_pipe *pipe)
 	return container_of(pipe, struct tinydrm_device, pipe);
 }
 
-/**
- * TINYDRM_MODE - tinydrm display mode
- * @hd: Horizontal resolution, width
- * @vd: Vertical resolution, height
- * @hd_mm: Display width in millimeters
- * @vd_mm: Display height in millimeters
- *
- * This macro creates a &drm_display_mode for use with tinydrm.
- */
-#define TINYDRM_MODE(hd, vd, hd_mm, vd_mm) \
-	.hdisplay = (hd), \
-	.hsync_start = (hd), \
-	.hsync_end = (hd), \
-	.htotal = (hd), \
-	.vdisplay = (vd), \
-	.vsync_start = (vd), \
-	.vsync_end = (vd), \
-	.vtotal = (vd), \
-	.width_mm = (hd_mm), \
-	.height_mm = (vd_mm), \
-	.type = DRM_MODE_TYPE_DRIVER, \
-	.clock = 1 /* pass validation */
-
 int devm_tinydrm_init(struct device *parent, struct tinydrm_device *tdev,
 		      struct drm_driver *driver);
 int devm_tinydrm_register(struct tinydrm_device *tdev);