]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
video: mxc: search for display-timings in the mxcfb node, rather than ldb or mxc_lcdif
authorLothar Waßmann <LW@KARO-electronics.de>
Thu, 26 Feb 2015 10:57:01 +0000 (11:57 +0100)
committerLothar Waßmann <LW@KARO-electronics.de>
Fri, 27 Feb 2015 08:19:18 +0000 (09:19 +0100)
The display-timings should be configurable for each individual display
port, rather than for the LCD or LDB interface in general.

Move the of_get_videomode() call to mxcfb_dispdrv_init() which is
called for each display port.

arch/arm/boot/dts/imx6dl-tx6dl-comtft.dts
arch/arm/boot/dts/imx6q-tx6q-1020-comtft.dts
arch/arm/boot/dts/imx6q-tx6q-1020.dts
drivers/video/mxc/ldb.c
drivers/video/mxc/mxc_dispdrv.h
drivers/video/mxc/mxc_ipuv3_fb.c
drivers/video/mxc/mxc_lcdif.c

index aea48347730ecb5cbdbdc34108b135326677ea6b..1604a57f0b56bf02010cc4f65f3665b8e181281d 100644 (file)
@@ -18,8 +18,8 @@
        compatible = "karo,imx6dl-tx6dl", "fsl,imx6dl";
 
        aliases {
-               display = &lcd;
-               mxcfb0 = &display;
+               display = &mxcfb0;
+               mxcfb0 = &mxcfb0;
        };
 
        backlight: backlight {
@@ -44,7 +44,7 @@
                default-brightness-level = <50>;
        };
 
-       display: fb@2 {
+       mxcfb0: fb@2 {
                compatible = "fsl,mxc_sdc_fb";
                disp_dev = "lcd";
                interface_pix_fmt = "RGB24";
                int_clk = <1>;
                late_init = <0>;
                status = "okay";
-       };
-
-       lcd: lcd@0 {
-               compatible = "fsl,lcd";
-               ipu_id = <0>;
-               disp_id = <0>;
-               default_ifmt = "RGB24";
-               pinctrl-names = "default";
-               pinctrl-0 = <&pinctrl_disp0_2>;
-               status = "okay";
 
                display-timings {
                        native-mode = <&ET070001DM6>;
                        };
                };
        };
+
+       lcd: lcd@0 {
+               compatible = "fsl,lcd";
+               ipu_id = <0>;
+               disp_id = <0>;
+               default_ifmt = "RGB24";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_disp0_2>;
+               status = "okay";
+       };
 };
 
 &can1 {
index 44f3cc8b9374c29ce1d626a605224ee6a6a5cbeb..6116140f0f865e09d3a4b1e274193ce5aa26aa00 100644 (file)
@@ -18,8 +18,8 @@
        compatible = "karo,imx6q-tx6q", "fsl,imx6q";
 
        aliases {
-               display = &lcd;
-               mxcfb0 = &display;
+               display = &mxcfb0;
+               mxcfb0 = &mxcfb0;
        };
 
        backlight: backlight {
@@ -44,7 +44,7 @@
                default-brightness-level = <50>;
        };
 
-       display: fb@2 {
+       mxcfb0: fb@2 {
                compatible = "fsl,mxc_sdc_fb";
                disp_dev = "lcd";
                interface_pix_fmt = "RGB24";
                int_clk = <1>;
                late_init = <0>;
                status = "okay";
-       };
-
-       lcd: lcd@0 {
-               compatible = "fsl,lcd";
-               ipu_id = <0>;
-               disp_id = <0>;
-               default_ifmt = "RGB24";
-               pinctrl-names = "default";
-               pinctrl-0 = <&pinctrl_disp0_2>;
-               status = "okay";
 
                display-timings {
                        native-mode = <&ET070001DM6>;
                        };
                };
        };
+
+       lcd: lcd@0 {
+               compatible = "fsl,lcd";
+               ipu_id = <0>;
+               disp_id = <0>;
+               default_ifmt = "RGB24";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_disp0_2>;
+               status = "okay";
+       };
 };
 
 &can1 {
index 6c62f0c073cae5619c94eca2592efb2d56145ecf..fa3a825feabf2644028c1224b99a1293d05ed46d 100644 (file)
@@ -18,8 +18,8 @@
        compatible = "karo,imx6q-tx6q", "fsl,imx6q";
 
        aliases {
-               display = &lcd;
-               mxcfb0 = &display;
+               display = &mxcfb0;
+               mxcfb0 = &mxcfb0;
        };
 
        backlight: backlight {
@@ -44,7 +44,7 @@
                default-brightness-level = <50>;
        };
 
-       display: fb@2 {
+       mxcfb0: fb@2 {
                compatible = "fsl,mxc_sdc_fb";
                disp_dev = "lcd";
                interface_pix_fmt = "RGB24";
                int_clk = <1>;
                late_init = <0>;
                status = "okay";
-       };
-
-       lcd: lcd@0 {
-               compatible = "fsl,lcd";
-               ipu_id = <0>;
-               disp_id = <0>;
-               default_ifmt = "RGB24";
-               pinctrl-names = "default";
-               pinctrl-0 = <&pinctrl_disp0_2>;
-               status = "okay";
 
                display-timings {
                        VGA {
                        };
                };
        };
+
+       lcd: lcd@0 {
+               compatible = "fsl,lcd";
+               ipu_id = <0>;
+               disp_id = <0>;
+               default_ifmt = "RGB24";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_disp0_2>;
+               status = "okay";
+       };
 };
 
 &ds1339 {
index 6616e53b04e7f6232eebcb7fc0aa8bff648c5d87..6d594425a2040f4f79a5105e2c8886b59ae9c7bd 100644 (file)
@@ -291,16 +291,6 @@ static int ldb_get_of_property(struct platform_device *pdev,
                return err;
        }
 
-       if (of_display_timings_exist(np) == 1) {
-               struct videomode vm = { };
-
-               err = of_get_videomode(np, &vm, OF_USE_NATIVE_MODE);
-               if (err == 0) {
-                       fb_videomode_from_videomode(&vm, &ldb_modedb[0]);
-                       ldb_modedb_sz = 1;
-               }
-       }
-
        plat_data->mode = parse_ldb_mode(mode);
        plat_data->ext_ref = ext_ref;
        plat_data->ipu_id = ipu_id;
@@ -826,6 +816,11 @@ static int ldb_disp_init(struct mxc_dispdrv_handle *disp,
        if (is_imx6_ldb(plat_data))
                ldb_ipu_ldb_route(setting->dev_id, setting->disp_id, ldb);
 
+       if (setting->fbmode) {
+               ldb_modedb[0] = *setting->fbmode;
+               ldb_modedb_sz = 1;
+       }
+
        /* must use spec video mode defined by driver */
        ret = fb_find_mode(&setting->fbi->var, setting->fbi, setting->dft_mode_str,
                                ldb_modedb, ldb_modedb_sz, NULL, setting->default_bpp);
index 8c8877c06ddc0ef29597b34438113f94452b087d..cdea912621232584e69a400e26956527d1ec85bd 100644 (file)
@@ -30,6 +30,8 @@ struct mxc_dispdrv_setting {
        int dev_id;
        int disp_id;
        enum display_flags disp_flags;
+
+       struct fb_videomode *fbmode;
 };
 
 struct mxc_dispdrv_driver {
index a8540996e78d3d4a22d792283c3f3983a4106830..d4cdeb2d4625a223ca7460f7f48fb24807bf064e 100644 (file)
@@ -48,7 +48,9 @@
 #include <linux/slab.h>
 #include <linux/string.h>
 #include <linux/uaccess.h>
-
+#include <video/of_display_timing.h>
+#include <video/of_videomode.h>
+#include <video/videomode.h>
 #include "mxc_dispdrv.h"
 
 /*
@@ -1893,7 +1895,8 @@ static int mxcfb_dispdrv_init(struct platform_device *pdev,
                struct fb_info *fbi)
 {
        struct ipuv3_fb_platform_data *plat_data = pdev->dev.platform_data;
-       struct mxcfb_info *mxcfbi = (struct mxcfb_info *)fbi->par;
+       struct device_node *np = pdev->dev.of_node;
+       struct mxcfb_info *mxcfbi = fbi->par;
        struct mxc_dispdrv_setting setting = {};
        char disp_dev[32], *default_dev = "lcd";
        int ret = 0;
@@ -1909,6 +1912,21 @@ static int mxcfb_dispdrv_init(struct platform_device *pdev,
        else
                strlcpy(disp_dev, plat_data->disp_dev, sizeof(disp_dev));
 
+       if (of_display_timings_exist(np) == 1) {
+               struct videomode vm = { };
+
+               setting.fbmode = kzalloc(sizeof(*setting.fbmode), GFP_KERNEL);
+               if (setting.fbmode == NULL)
+                       return -ENOMEM;
+
+               ret = of_get_videomode(np, &vm, OF_USE_NATIVE_MODE);
+               if (ret)
+                       goto err;
+
+               fb_videomode_from_videomode(&vm, setting.fbmode);
+               setting.disp_flags = vm.flags;
+               dev_dbg(&pdev->dev, "using video mode from DTB\n");
+       }
 
        dev_info(&pdev->dev, "register mxc display driver %s\n", disp_dev);
 
@@ -1916,7 +1934,7 @@ static int mxcfb_dispdrv_init(struct platform_device *pdev,
        if (IS_ERR(mxcfbi->dispdrv)) {
                ret = PTR_ERR(mxcfbi->dispdrv);
                dev_err(&pdev->dev, "NO mxc display driver found!\n");
-               return ret;
+               goto err;
        } else {
                /* fix-up  */
                mxcfbi->ipu_di_pix_fmt = setting.if_fmt;
@@ -1931,13 +1949,15 @@ static int mxcfb_dispdrv_init(struct platform_device *pdev,
                                setting.disp_id, setting.dev_id);
        }
 
+err:
+       kfree(setting.fbmode);
        return ret;
 }
 
 /*
  * Parse user specified options (`video=trident:')
  * example:
- *     video=mxcfb0:dev=lcd,800x480M-16@55,if=RGB565,bpp=16,noaccel
+ *     video=mxcfb0:dev=lcd,800x480M-16@55,if=RGB565,bpp=16,noaccel
  *     video=mxcfb0:dev=lcd,800x480M-16@55,if=RGB565,fbpix=RGB565
  */
 static int mxcfb_option_setup(struct platform_device *pdev, struct fb_info *fbi)
index d729d190dc481baef63f7c9926c65daab687a641..6c1b3c9510c0e456d1a8eb4d7d8688b68f9f7a05 100644 (file)
@@ -154,7 +154,13 @@ static int lcdif_init(struct mxc_dispdrv_handle *disp,
        /* use platform defined ipu/di */
        setting->dev_id = plat_data->ipu_id;
        setting->disp_id = plat_data->disp_id;
-       setting->disp_flags = plat_data->disp_flags;
+
+       if (setting->fbmode) {
+               modedb[0] = *setting->fbmode;
+               modedb_sz = 1;
+       } else {
+               setting->disp_flags = plat_data->disp_flags;
+       }
 
        ret = fb_find_mode(&setting->fbi->var, setting->fbi, setting->dft_mode_str,
                                modedb, modedb_sz, NULL, setting->default_bpp);
@@ -212,18 +218,6 @@ static int lcd_get_of_property(struct device *dev,
                return err;
        }
 
-       {
-               struct videomode vm = { };
-
-               err = of_get_videomode(np, &vm, OF_USE_NATIVE_MODE);
-               if (err == 0) {
-                       dev_dbg(dev, "Copying videomode from display-timings\n");
-                       fb_videomode_from_videomode(&vm, &lcdif_modedb[0]);
-                       plat_data->disp_flags = vm.flags;
-                       lcdif_modedb_sz = 1;
-               }
-       }
-
        plat_data->ipu_id = ipu_id;
        plat_data->disp_id = disp_id;
        if (!strncmp(default_ifmt, "RGB24", 5))