Skip to contentSkip to conversation

Add display-timing node parsing to exynos drm fimd

PATCH Superseded Vikas Sajjan 4 participants 6 messages Feb 6, 2013 – Feb 15, 2013

Subsystems (4)

v5 of 13 Superseded Latest is v13 →

lore
Share & tools
lore
#0 lore raw

v5 cover Add display-timing node parsing to exynos drm fimd

Add display-timing node parsing to drm fimd and depends on the display helper patchset at
http://lists.freedesktop.org/archives/dri-devel/2013-January/033998.html

It also adds pinctrl support for drm fimd.

changes since v4:
- addressed comments from Paul Menzel <[email protected]>, to modify the commit message

changes since v3:
- addressed comments from Sean Paul <[email protected]>, to modify the return values and print messages.

changes since v2:
- moved 'devm_pinctrl_get_select_default' function call under 'if (pdev->dev.of_node)', this makes NON-DT code unchanged. (reported by: Rahul Sharma <[email protected]>)

changes since v1:
- addressed comments from Sean Paul <[email protected]>

Vikas Sajjan (1):
video: drm: exynos: Add display-timing node parsing using video
helper function

 drivers/gpu/drm/exynos/exynos_drm_fimd.c |   41 +++++++++++++++++++++++++++---
 1 file changed, 37 insertions(+), 4 deletions(-)
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH v5 1/1 video: drm: exynos: Add display-timing node parsing using video helper function

Add support for parsing the display-timing node using video helper function.

The DT node parsing and pinctrl selection is done only if 'dev.of_node' exists and the NON-DT logic is still maintained under the 'else' part.

---
 drivers/gpu/drm/exynos/exynos_drm_fimd.c |   41 +++++++++++++++++++++++++++---
 1 file changed, 37 insertions(+), 4 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_fimd.c +37 -4
index bf0d9ba..978e866 100644
@@ -19,6 +19,7 @@
 #include <linux/clk.h>
 #include <linux/of_device.h>
 #include <linux/pm_runtime.h>
+#include <linux/pinctrl/consumer.h>
 
 #include <video/samsung_fimd.h>
 #include <drm/exynos_drm.h>
@@ -905,16 +906,48 @@ static int __devinit fimd_probe(struct platform_device *pdev)
 	struct exynos_drm_subdrv *subdrv;
 	struct exynos_drm_fimd_pdata *pdata;
 	struct exynos_drm_panel_info *panel;
+	struct fb_videomode *fbmode;
+	struct pinctrl *pctrl;
 	struct resource *res;
 	int win;
 	int ret = -EINVAL;
 
 	DRM_DEBUG_KMS("%s\n", __FILE__);
 
-	pdata = pdev->dev.platform_data;
-	if (!pdata) {
-		dev_err(dev, "no platform data specified\n");
-		return -EINVAL;
+	if (pdev->dev.of_node) {
+		pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
+		if (!pdata) {
+			DRM_ERROR("memory allocation for pdata failed\n");
+			return -ENOMEM;
+		}
+
+		fbmode = devm_kzalloc(dev, sizeof(*fbmode), GFP_KERNEL);
+		if (!fbmode) {
+			DRM_ERROR("memory allocation for fbmode failed\n");
+			return -ENOMEM;
+		}
+
+		ret = of_get_fb_videomode(dev->of_node, fbmode, -1);
+		if (ret) {
+			DRM_ERROR("failed: of_get_fb_videomode()\n"
+				"with return value: %d\n", ret);
+			return ret;
+		}
+		pdata->panel.timing = (struct fb_videomode) *fbmode;
+
+		pctrl = devm_pinctrl_get_select_default(dev);
+		if (IS_ERR_OR_NULL(pctrl)) {
+			DRM_ERROR("failed: devm_pinctrl_get_select_default()\n"
+				"with return value: %d\n", PTR_RET(pctrl));
+			return PTR_RET(pctrl);
+		}
+
+	} else {
+		pdata = pdev->dev.platform_data;
+		if (!pdata) {
+			DRM_ERROR("no platform data specified\n");
+			return -EINVAL;
+		}
 	}
 
 	panel = &pdata->panel;
Signature · 1 line
1.7.9.5
#2 lore raw

Re: [PATCH v5 1/1] video: drm: exynos: Add display-timing node parsing using video helper function

Am Mittwoch, den 06.02.2013, 09:54 +0530 schrieb Vikas Sajjan:

Quoted 5 lines

Add support for parsing the display-timing node using video helper function.

The DT node parsing and pinctrl selection is done only if 'dev.of_node' exists and the NON-DT logic is still maintained under the 'else' part.

Last thing. It definitely helps review if you add instructions how to test your change. Is there some user space command to check if the display-timing node parsing works?

Quoted 5 lines
---
 drivers/gpu/drm/exynos/exynos_drm_fimd.c |   41 +++++++++++++++++++++++++++---
 1 file changed, 37 insertions(+), 4 deletions(-)

[…]

Thanks,

Paul

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#3 lore raw

Re: [PATCH v5 1/1] video: drm: exynos: Add display-timing node parsing using video helper function

Hi Mr. Paul,

Quoted 11 lines · Paul Menzel

Am Mittwoch, den 06.02.2013, 09:54 +0530 schrieb Vikas Sajjan:

Quoted 5 lines

Add support for parsing the display-timing node using video helper function.

The DT node parsing and pinctrl selection is done only if 'dev.of_node' exists and the NON-DT logic is still maintained under the 'else' part.

Last thing. It definitely helps review if you add instructions how to test your change. Is there some user space command to check if the display-timing node parsing works?

It is tested on Exynos4412 board by applying dependent patches available at
http://lists.freedesktop.org/archives/dri-devel/2013-January/033998.html
simply test would be to enable "boot logo" in make menuconfig, and verify whether the logo the appears or not during bootup.

Quoted 18 lines
Quoted 5 lines
---
 drivers/gpu/drm/exynos/exynos_drm_fimd.c |   41 +++++++++++++++++++++++++++---
 1 file changed, 37 insertions(+), 4 deletions(-)

[…]

Thanks,

Paul

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

maintainer
#4 lore raw

Re: [PATCH v5 1/1] video: drm: exynos: Add display-timing node parsing using video helper function

In reply to Vikas Sajjan

2013/2/6 Vikas Sajjan <[email protected]>:

Quoted 42 lines

Add support for parsing the display-timing node using video helper function.

The DT node parsing and pinctrl selection is done only if 'dev.of_node' exists and the NON-DT logic is still maintained under the 'else' part.

---
 drivers/gpu/drm/exynos/exynos_drm_fimd.c |   41 +++++++++++++++++++++++++++---
 1 file changed, 37 insertions(+), 4 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_fimd.c +5 -4
index bf0d9ba..978e866 100644
@@ -19,6 +19,7 @@
 #include <linux/clk.h>
 #include <linux/of_device.h>
 #include <linux/pm_runtime.h>
+#include <linux/pinctrl/consumer.h>
 
 #include <video/samsung_fimd.h>
 #include <drm/exynos_drm.h>
@@ -905,16 +906,48 @@ static int __devinit fimd_probe(struct platform_device *pdev)
        struct exynos_drm_subdrv *subdrv;
        struct exynos_drm_fimd_pdata *pdata;
        struct exynos_drm_panel_info *panel;
+       struct fb_videomode *fbmode;
+       struct pinctrl *pctrl;
        struct resource *res;
        int win;
        int ret = -EINVAL;
 
        DRM_DEBUG_KMS("%s\n", __FILE__);
 
-       pdata = pdev->dev.platform_data;
-       if (!pdata) {
-               dev_err(dev, "no platform data specified\n");
-               return -EINVAL;
+       if (pdev->dev.of_node) {
+               pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);

drivers/gpu/drm/exynos/exynos_drm_fimd.c static int __devinit fimd_probe(struct platform_device *pdev) · line 928

Quoted 10 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +10 -0
+               if (!pdata) {
+                       DRM_ERROR("memory allocation for pdata failed\n");
+                       return -ENOMEM;
+               }
+
+               fbmode = devm_kzalloc(dev, sizeof(*fbmode), GFP_KERNEL);
+               if (!fbmode) {
+                       DRM_ERROR("memory allocation for fbmode failed\n");
+                       return -ENOMEM;
+               }

It doesn't need to allocate fbmode.

drivers/gpu/drm/exynos/exynos_drm_fimd.c static int __devinit fimd_probe(struct platform_device *pdev) · line 930

Quoted 2 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +2 -0
+
+               ret = of_get_fb_videomode(dev->of_node, fbmode, -1);

What is -1? use OF_USE_NATIVE_MODE instead including "of_display_timing.h" and just change the above code like below,

                   fbmode = &pdata->panel.timing;
                   ret = of_get_fb_videomode(dev->of_node, fbmode,

OF_USE_NATIVE_MODE);

drivers/gpu/drm/exynos/exynos_drm_fimd.c static int __devinit fimd_probe(struct platform_device *pdev) · line 936

Quoted 6 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +6 -0
+               if (ret) {
+                       DRM_ERROR("failed: of_get_fb_videomode()\n"
+                               "with return value: %d\n", ret);
+                       return ret;
+               }
+               pdata->panel.timing = (struct fb_videomode) *fbmode;

remove the above line.

Quoted 24 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +14 -1
+
+               pctrl = devm_pinctrl_get_select_default(dev);
+               if (IS_ERR_OR_NULL(pctrl)) {
+                       DRM_ERROR("failed: devm_pinctrl_get_select_default()\n"
+                               "with return value: %d\n", PTR_RET(pctrl));
+                       return PTR_RET(pctrl);
+               }
+
+       } else {
+               pdata = pdev->dev.platform_data;
+               if (!pdata) {
+                       DRM_ERROR("no platform data specified\n");
+                       return -EINVAL;
+               }
        }
 
        panel = &pdata->panel;
--

1.7.9.5

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#5 lore raw

Re: [PATCH v5 1/1] video: drm: exynos: Add display-timing node parsing using video helper function

Hi Mr. Inki Dae,

Thanks for review.

Quoted 91 lines · Inki Dae

2013/2/6 Vikas Sajjan <[email protected]>:

Quoted 42 lines

Add support for parsing the display-timing node using video helper function.

The DT node parsing and pinctrl selection is done only if 'dev.of_node' exists and the NON-DT logic is still maintained under the 'else' part.

---
 drivers/gpu/drm/exynos/exynos_drm_fimd.c |   41 +++++++++++++++++++++++++++---
 1 file changed, 37 insertions(+), 4 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_fimd.c +5 -4
index bf0d9ba..978e866 100644
@@ -19,6 +19,7 @@
 #include <linux/clk.h>
 #include <linux/of_device.h>
 #include <linux/pm_runtime.h>
+#include <linux/pinctrl/consumer.h>
 
 #include <video/samsung_fimd.h>
 #include <drm/exynos_drm.h>
@@ -905,16 +906,48 @@ static int __devinit fimd_probe(struct platform_device *pdev)
        struct exynos_drm_subdrv *subdrv;
        struct exynos_drm_fimd_pdata *pdata;
        struct exynos_drm_panel_info *panel;
+       struct fb_videomode *fbmode;
+       struct pinctrl *pctrl;
        struct resource *res;
        int win;
        int ret = -EINVAL;
 
        DRM_DEBUG_KMS("%s\n", __FILE__);
 
-       pdata = pdev->dev.platform_data;
-       if (!pdata) {
-               dev_err(dev, "no platform data specified\n");
-               return -EINVAL;
+       if (pdev->dev.of_node) {
+               pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);

drivers/gpu/drm/exynos/exynos_drm_fimd.c static int __devinit fimd_probe(struct platform_device *pdev) · line 928

Quoted 10 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +10 -0
+               if (!pdata) {
+                       DRM_ERROR("memory allocation for pdata failed\n");
+                       return -ENOMEM;
+               }
+
+               fbmode = devm_kzalloc(dev, sizeof(*fbmode), GFP_KERNEL);
+               if (!fbmode) {
+                       DRM_ERROR("memory allocation for fbmode failed\n");
+                       return -ENOMEM;
+               }

It doesn't need to allocate fbmode.

drivers/gpu/drm/exynos/exynos_drm_fimd.c static int __devinit fimd_probe(struct platform_device *pdev) · line 930

Quoted 2 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +2 -0
+
+               ret = of_get_fb_videomode(dev->of_node, fbmode, -1);

What is -1? use OF_USE_NATIVE_MODE instead including "of_display_timing.h" and just change the above code like below,

                   fbmode = &pdata->panel.timing;
                   ret = of_get_fb_videomode(dev->of_node, fbmode,

OF_USE_NATIVE_MODE);

drivers/gpu/drm/exynos/exynos_drm_fimd.c static int __devinit fimd_probe(struct platform_device *pdev) · line 936

Quoted 6 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +6 -0
+               if (ret) {
+                       DRM_ERROR("failed: of_get_fb_videomode()\n"
+                               "with return value: %d\n", ret);
+                       return ret;
+               }
+               pdata->panel.timing = (struct fb_videomode) *fbmode;

remove the above line.

Quoted 16 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +14 -0
+
+               pctrl = devm_pinctrl_get_select_default(dev);
+               if (IS_ERR_OR_NULL(pctrl)) {
+                       DRM_ERROR("failed: devm_pinctrl_get_select_default()\n"
+                               "with return value: %d\n", PTR_RET(pctrl));
+                       return PTR_RET(pctrl);
+               }
+
+       } else {
+               pdata = pdev->dev.platform_data;
+               if (!pdata) {
+                       DRM_ERROR("no platform data specified\n");
+                       return -EINVAL;
+               }
        }
 
Quoted 3 lines
Quoted 3 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +0 -1
        panel = &pdata->panel;
--

1.7.9.5

Will modify, test and resend V6.

Quoted 5 lines
Quoted 5 lines

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

Signature · 2 lines
Thanks and Regards
 Vikas Sajjan