]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
video: display: use edid_get_timing_validate() variant to filter supported EDID modes
authorNeil Armstrong <narmstrong@baylibre.com>
Thu, 4 Jul 2019 13:52:07 +0000 (15:52 +0200)
committerAnatolij Gustschin <agust@denx.de>
Sun, 28 Jul 2019 22:21:49 +0000 (00:21 +0200)
Introduce a new display op, mode_valid() to be used with the newly
introduced edid_get_timing_validate() function, to filter supported
monitor timings if handled by the display driver.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
drivers/video/display-uclass.c
include/display.h

index 99ef5e76f54bbb7f310a6a366416d723f364c189..1a29ce5d85891b56bc997fb4bc4ef78f0b85c4c0 100644 (file)
@@ -37,6 +37,17 @@ int display_enable(struct udevice *dev, int panel_bpp,
        return 0;
 }
 
+static bool display_mode_valid(void *priv, const struct display_timing *timing)
+{
+       struct udevice *dev = priv;
+       struct dm_display_ops *ops = display_get_ops(dev);
+
+       if (ops && ops->mode_valid)
+               return ops->mode_valid(dev, timing);
+
+       return true;
+}
+
 int display_read_timing(struct udevice *dev, struct display_timing *timing)
 {
        struct dm_display_ops *ops = display_get_ops(dev);
@@ -53,7 +64,9 @@ int display_read_timing(struct udevice *dev, struct display_timing *timing)
        if (ret < 0)
                return ret;
 
-       return edid_get_timing(buf, ret, timing, &panel_bits_per_colour);
+       return edid_get_timing_validate(buf, ret, timing,
+                                       &panel_bits_per_colour,
+                                       display_mode_valid, dev);
 }
 
 bool display_in_use(struct udevice *dev)
index 16f317c9c8c2f4d27a5fbe847c049f18e3e3106a..66294616ea2919208f308959fb52327a66bbb730 100644 (file)
@@ -80,6 +80,16 @@ struct dm_display_ops {
         */
        int (*enable)(struct udevice *dev, int panel_bpp,
                      const struct display_timing *timing);
+
+       /**
+        * mode_valid() - Check if mode is supported
+        *
+        * @dev:        Device to enable
+        * @timing:     Display timings
+        * @return true if supported, false if not
+        */
+       bool (*mode_valid)(struct udevice *dev,
+                          const struct display_timing *timing);
 };
 
 #define display_get_ops(dev)   ((struct dm_display_ops *)(dev)->driver->ops)