Skip to contentSkip to conversation

Adds display-timing node parsing to exynos drm fimd

PATCH Superseded Vikas Sajjan 2 participants 3 messages Feb 1, 2013

Subsystems (4)

v3 of 13 Superseded Latest is v13 →

lore
Share & tools
lore
#0 lore raw

v3 cover Adds display-timing node parsing to exynos drm fimd

This patch adds display-timing node parsing to drm fimd, this 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 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]>

patch is based on branch "exynos-drm-next" at
http://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos.git

Is tested on Exynos5250 and Exynos4412 by applying dependent patches available at http://lists.freedesktop.org/archives/dri-devel/2013-January/033998.html

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

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

PATCH v3 1/1 video: drm: exynos: Adds display-timing node parsing using video helper function

This patch adds display-timing node parsing using video helper function

---
 drivers/gpu/drm/exynos/exynos_drm_fimd.c |   39 +++++++++++++++++++++++++++---
 1 file changed, 35 insertions(+), 4 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_fimd.c +35 -4
index bf0d9ba..8eee13f 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,46 @@ 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 to get fb_videomode\n");
+			return -EINVAL;
+		}
+		pdata->panel.timing = (struct fb_videomode) *fbmode;
+
+		pctrl = devm_pinctrl_get_select_default(dev);
+		if (IS_ERR(pctrl)) {
+			DRM_ERROR("no pinctrl data provided.\n");
+			return -EINVAL;
+		}
+
+	} 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 v3 1/1] video: drm: exynos: Adds display-timing node parsing using video helper function

Quoted 43 lines · Vikas Sajjan

This patch adds display-timing node parsing using video helper function

---
 drivers/gpu/drm/exynos/exynos_drm_fimd.c |   39 +++++++++++++++++++++++++++---
 1 file changed, 35 insertions(+), 4 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_fimd.c +10 -4
index bf0d9ba..8eee13f 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,46 @@ 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;
+               }
+

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

Quoted 10 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +10 -0
+               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 to get fb_videomode\n");
+                       return -EINVAL;

This should probably return ret instead of -EINVAL. It would also be useful to print ret in the error msg.

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

Quoted 7 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +7 -0
+               }
+               pdata->panel.timing = (struct fb_videomode) *fbmode;
+
+               pctrl = devm_pinctrl_get_select_default(dev);
+               if (IS_ERR(pctrl)) {
+                       DRM_ERROR("no pinctrl data provided.\n");
+                       return -EINVAL;

I think the error message here is misleading. If there's no pinctrl provided, doesn't get_select_default return NULL? In which case, this error would never be printed?

I think this behavior is actually desired since there is no pinctrl for exynos5 and we don't want it to break. However I think your error should be more along the lines of "pinctrl_get_select_default failed". You should also print and return PTR_RET(pctrl) instead of EINVAL.

Sean

Quoted 18 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +8 -1
+               }
+
+       } 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