MLK-16986-4: drm/mxsfb: Add max-res property for MXSFB
authorRobert Chiras <robert.chiras@nxp.com>
Wed, 6 Dec 2017 09:31:21 +0000 (11:31 +0200)
committerNitin Garg <nitin.garg@nxp.com>
Tue, 20 Mar 2018 19:50:24 +0000 (14:50 -0500)
For stability issues, we want to limit the maximum resolution supported
by the MXSFB (eLCDIF) driver.
This patch adds a new property which we can use to impose such
limitation.

Signed-off-by: Robert Chiras <robert.chiras@nxp.com>
Reviewed-by: Laurentiu Palcu <laurentiu.palcu@nxp.com
Documentation/devicetree/bindings/display/mxsfb.txt
drivers/gpu/drm/mxsfb/mxsfb_drv.c

index 77c873e..7040fb0 100644 (file)
@@ -17,6 +17,12 @@ Required properties:
 Required sub-nodes:
   - port: The connection to an encoder chip.
 
+Optional properties:
+- max-res:     an array with a maximum of two integers, representing the
+               maximum supported resolution, in the form of
+               <maxX>, <maxY>; if one of the item is <0>, the default
+               driver-defined maximum resolution for that axis is used
+
 Example:
 
        lcdif1: display-controller@2220000 {
index f37dd51..4ec9e28 100644 (file)
@@ -166,6 +166,7 @@ static int mxsfb_load(struct drm_device *drm, unsigned long flags)
        struct platform_device *pdev = to_platform_device(drm->dev);
        struct mxsfb_drm_private *mxsfb;
        struct resource *res;
+       u32 max_res[2] = {0, 0};
        int ret;
 
        mxsfb = devm_kzalloc(&pdev->dev, sizeof(*mxsfb), GFP_KERNEL);
@@ -247,10 +248,17 @@ static int mxsfb_load(struct drm_device *drm, unsigned long flags)
                }
        }
 
+       of_property_read_u32_array(drm->dev->of_node, "max-res",
+                                  &max_res[0], 2);
+       if (!max_res[0])
+               max_res[0] = MXSFB_MAX_XRES;
+       if (!max_res[1])
+               max_res[1] = MXSFB_MAX_YRES;
+
        drm->mode_config.min_width      = MXSFB_MIN_XRES;
        drm->mode_config.min_height     = MXSFB_MIN_YRES;
-       drm->mode_config.max_width      = MXSFB_MAX_XRES;
-       drm->mode_config.max_height     = MXSFB_MAX_YRES;
+       drm->mode_config.max_width      = max_res[0];
+       drm->mode_config.max_height     = max_res[1];
        drm->mode_config.funcs          = &mxsfb_mode_config_funcs;
 
        drm_mode_config_reset(drm);