]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
drm/panel: simple: add a macro for defining display modes in a simpler and less error...
authorLothar Waßmann <LW@KARO-electronics.de>
Thu, 14 Sep 2017 09:54:18 +0000 (11:54 +0200)
committerLothar Waßmann <LW@KARO-electronics.de>
Thu, 14 Sep 2017 09:54:18 +0000 (11:54 +0200)
Create a macro that eases the definition of display mode parameters by
accecpting the parameters:
freq, hactive, hfront-porch, hsynclen, hback-porch,
vactive, vfront-porch, vsynclen, vback-porch, vrefresh
that can be usually directly taken from an LCD datasheet.

Put the calculations that are now open coded repeating the same
parameters multiple times into the macro expansion.

drivers/gpu/drm/panel/panel-simple.c

index 474fa759e06ec5510661c164860b19cdefae64a7..dec639d72bb78c7c3da7976a3313e4248b6370d9 100644 (file)
@@ -411,6 +411,20 @@ static const struct panel_desc ampire_am_480272h3tmqw_t01h = {
        .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
 };
 
+#define SP_DISPLAY_MODE(freq, ha, hfp, hs, hbp, va, vfp, vs, vbp, vr, flgs) { \
+       .clock = freq,                                                  \
+       .hdisplay = ha,                                                 \
+       .hsync_start = (ha) + (hfp),                                    \
+       .hsync_end = (ha) + (hfp) + (hs),                               \
+       .htotal = (ha) + (hfp) + (hs) + (hbp),                          \
+       .vdisplay = (va),                                               \
+       .vsync_start = (va) + (vfp),                                    \
+       .vsync_end = (va) + (vfp) + (vs),                               \
+       .vtotal = (va) + (vfp) + (vs) + (vbp),                          \
+       .vrefresh = vr,                                                 \
+       .flags = flgs,                                                  \
+       }
+
 static const struct drm_display_mode ampire_am800480r3tmqwa1h_mode = {
        .clock = 33333,
        .hdisplay = 800,