drm/modes: Add DRM_SIMPLE_MODE()
authorNoralf Trønnes <noralf@tronnes.org>
Sun, 10 Feb 2019 13:10:31 +0000 (14:10 +0100)
committerNoralf Trønnes <noralf@tronnes.org>
Thu, 21 Feb 2019 11:13:42 +0000 (12:13 +0100)
This adds a helper macro to specify modes that only contain info about
resolution.

v2: Actually set the width and height (Ilia Mirkin)

Cc: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20190210131039.52664-5-noralf@tronnes.org
drivers/gpu/drm/tinydrm/hx8357d.c
drivers/gpu/drm/tinydrm/ili9225.c
drivers/gpu/drm/tinydrm/ili9341.c
drivers/gpu/drm/tinydrm/mi0283qt.c
drivers/gpu/drm/tinydrm/repaper.c
drivers/gpu/drm/tinydrm/st7586.c
drivers/gpu/drm/tinydrm/st7735r.c
include/drm/drm_modes.h
include/drm/tinydrm/tinydrm.h

index 8bbd0be..5a1ec04 100644 (file)
@@ -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);
index 43a3b68..d40814d 100644 (file)
@@ -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);
index 713bb2d..063f4f0 100644 (file)
@@ -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);
index 82a92ec..3d067c2 100644 (file)
@@ -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);
index b037c65..72d3015 100644 (file)
@@ -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,
index 01a8077..5ee7db5 100644 (file)
@@ -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);
index 3bab9a9..6c7904c 100644 (file)
@@ -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);
index be4fed9..083f167 100644 (file)
@@ -138,6 +138,23 @@ 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), .width_mm = (hd_mm), \
+       .height_mm = (vd_mm)
+
 #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 */
index 5621688..87e7f9b 100644 (file)
@@ -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);