Skip to contentSkip to conversation

Add display-timing node parsing to exynos drm fimd

PATCH Superseded Vikas Sajjan 4 participants 9 messages Feb 27, 2013 – Feb 28, 2013

Subsystems (4)

v8 of 13 Superseded Latest is v13 →

lore
Share & tools
lore
#0 lore raw

v8 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 v7:
- addressed comments from Joonyoung Shim <[email protected]> to remove a unnecessary variable.

changes since v6:
addressed comments from Inki Dae <[email protected]> to separated out the pinctrl functionality and made a separate patch.

changes since v5:
- addressed comments from Inki Dae <[email protected]>, to remove the allocation of 'fbmode' and replaced '-1'in "of_get_fb_videomode(dev->of_node, fbmode, -1)" with OF_USE_NATIVE_MODE.

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 (2):
video: drm: exynos: Add display-timing node parsing using video
helper function
video: drm: exynos: Add pinctrl support to fimd

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

PATCH v8 1/2 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 |   25 +++++++++++++++++++++----
 1 file changed, 21 insertions(+), 4 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_fimd.c +21 -4
index 9537761..7932dc2 100644
@@ -20,6 +20,7 @@
 #include <linux/of_device.h>
 #include <linux/pm_runtime.h>
 
+#include <video/of_display_timing.h>
 #include <video/samsung_fimd.h>
 #include <drm/exynos_drm.h>
 
@@ -883,10 +884,26 @@ static int fimd_probe(struct platform_device *pdev)
 
 	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;
+		}
+
+		ret = of_get_fb_videomode(dev->of_node, &pdata->panel.timing,
+					OF_USE_NATIVE_MODE);
+		if (ret) {
+			DRM_ERROR("failed: of_get_fb_videomode()\n"
+				"with return value: %d\n", ret);
+			return ret;
+		}
+	} 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 v8 1/2] video: drm: exynos: Add display-timing node parsing using video helper function

Quoted 35 lines · Vikas Sajjan

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 |   25 +++++++++++++++++++++----
 1 file changed, 21 insertions(+), 4 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_fimd.c +4 -4
index 9537761..7932dc2 100644
@@ -20,6 +20,7 @@
 #include <linux/of_device.h>
 #include <linux/pm_runtime.h>
 
+#include <video/of_display_timing.h>
 #include <video/samsung_fimd.h>
 #include <drm/exynos_drm.h>
 
@@ -883,10 +884,26 @@ static int fimd_probe(struct platform_device *pdev)
 
        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) {

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

Quoted 10 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +10 -0
+                       DRM_ERROR("memory allocation for pdata failed\n");
+                       return -ENOMEM;
+               }
+
+               ret = of_get_fb_videomode(dev->of_node, &pdata->panel.timing,
+                                       OF_USE_NATIVE_MODE);
+               if (ret) {
+                       DRM_ERROR("failed: of_get_fb_videomode()\n"
+                               "with return value: %d\n", ret);
+                       return ret;

Here I think you leak pdata in the error path.

Stéphane

Quoted 17 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +7 -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

#3 lore raw

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

Quoted 40 lines · Stéphane Marchesin
Quoted 39 lines · Vikas Sajjan

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 |   25 +++++++++++++++++++++----
 1 file changed, 21 insertions(+), 4 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_fimd.c +8 -4
index 9537761..7932dc2 100644
@@ -20,6 +20,7 @@
 #include <linux/of_device.h>
 #include <linux/pm_runtime.h>
 
+#include <video/of_display_timing.h>
 #include <video/samsung_fimd.h>
 #include <drm/exynos_drm.h>
 
@@ -883,10 +884,26 @@ static int fimd_probe(struct platform_device *pdev)
 
        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;
+               }
+
Quoted 9 lines

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

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

Here I think you leak pdata in the error path.

Hmm nevermind it goes away with the dev.

Stéphane

Quoted 19 lines

Stéphane

Quoted 17 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +7 -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

Acked-by on v8 1/2
#4 lore raw

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

In reply to Vikas Sajjan
Quoted 34 lines · Vikas Sajjan

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 |   25 +++++++++++++++++++++----
  1 file changed, 21 insertions(+), 4 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_fimd.c +3 -4
index 9537761..7932dc2 100644
@@ -20,6 +20,7 @@
  #include <linux/of_device.h>
  #include <linux/pm_runtime.h>
 
+#include <video/of_display_timing.h>
  #include <video/samsung_fimd.h>
  #include <drm/exynos_drm.h>
 
@@ -883,10 +884,26 @@ static int fimd_probe(struct platform_device *pdev)
 
  	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 fimd_probe(struct platform_device *pdev) · line 898

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;
+		}
+
+		ret = of_get_fb_videomode(dev->of_node, &pdata->panel.timing,
+					OF_USE_NATIVE_MODE);
+		if (ret) {
+			DRM_ERROR("failed: of_get_fb_videomode()\n"
+				"with return value: %d\n", ret);

Could you make this error log to one line?

except this,

Quoted 11 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +8 -0
+			return ret;
+		}
+	} else {
+		pdata = pdev->dev.platform_data;
+		if (!pdata) {
+			DRM_ERROR("no platform data specified\n");
+			return -EINVAL;
+		}
  	}
 
  	panel = &pdata->panel;
#5 lore raw

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

Hi,

Quoted 41 lines · Joonyoung Shim
Quoted 40 lines · Vikas Sajjan

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 |   25
+++++++++++++++++++++----
  1 file changed, 21 insertions(+), 4 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_fimd.c +0 -0
index 9537761..7932dc2 100644
@@ -20,6 +20,7 @@
  #include <linux/of_device.h>
  #include <linux/pm_runtime.h>
  +#include <video/of_display_timing.h>
  #include <video/samsung_fimd.h>
  #include <drm/exynos_drm.h>
  @@ -883,10 +884,26 @@ static int fimd_probe(struct platform_device

*pdev)

        DRM_DEBUG_KMS("%s\n", __FILE__);

- pdata = pdev->dev.platform_data;

drivers/gpu/drm/exynos/exynos_drm_fimd.c +8 -3
-       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;
+               }
+
+               ret = of_get_fb_videomode(dev->of_node,
Quoted 9 lines

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

Quoted 5 lines

&pdata->panel.timing,

drivers/gpu/drm/exynos/exynos_drm_fimd.c +4 -0
+                                       OF_USE_NATIVE_MODE);
+               if (ret) {
+                       DRM_ERROR("failed: of_get_fb_videomode()\n"
+                               "with return value: %d\n", ret);

Could you make this error log to one line?

The Line was going beyond 80 line marks, hence I had to split it.

Quoted 16 lines

except this,

Quoted 10 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +8 -0
+                       return ret;
+               }
+       } else {
+               pdata = pdev->dev.platform_data;
+               if (!pdata) {
+                       DRM_ERROR("no platform data specified\n");
+                       return -EINVAL;
+               }
        }
        panel = &pdata->panel;
Signature · 2 lines
Thanks and Regards
 Vikas Sajjan
#6 lore raw

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

Quoted 51 lines · Vikas Sajjan

Hi,

Quoted 39 lines · Joonyoung Shim
Quoted 38 lines · Vikas Sajjan

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 |   25
+++++++++++++++++++++----
   1 file changed, 21 insertions(+), 4 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_fimd.c +0 -0
index 9537761..7932dc2 100644
@@ -20,6 +20,7 @@
   #include <linux/of_device.h>
   #include <linux/pm_runtime.h>
   +#include <video/of_display_timing.h>
   #include <video/samsung_fimd.h>
   #include <drm/exynos_drm.h>
   @@ -883,10 +884,26 @@ static int fimd_probe(struct platform_device

*pdev)

         DRM_DEBUG_KMS("%s\n", __FILE__);

- pdata = pdev->dev.platform_data;

drivers/gpu/drm/exynos/exynos_drm_fimd.c +7 -3
-       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;
+               }
+
Quoted 9 lines

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

Quoted 6 lines

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

drivers/gpu/drm/exynos/exynos_drm_fimd.c +4 -0
+                                       OF_USE_NATIVE_MODE);
+               if (ret) {
+                       DRM_ERROR("failed: of_get_fb_videomode()\n"
+                               "with return value: %d\n", ret);

Could you make this error log to one line?

Quoted 1 line

The Line was going beyond 80 line marks, hence I had to split it.

So remove or contract some log messages, e.g. "with return value" I think that is unnecessary.

Quoted 17 lines
Quoted 15 lines

except this,

Quoted 10 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +8 -0
+                       return ret;
+               }
+       } else {
+               pdata = pdev->dev.platform_data;
+               if (!pdata) {
+                       DRM_ERROR("no platform data specified\n");
+                       return -EINVAL;
+               }
         }
         panel = &pdata->panel;
#7 lore raw

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

Quoted 57 lines · Joonyoung Shim
Quoted 56 lines · Vikas Sajjan

Hi,

Quoted 52 lines · Joonyoung Shim
Quoted 42 lines · Vikas Sajjan

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 |   25
+++++++++++++++++++++----
   1 file changed, 21 insertions(+), 4 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_fimd.c +0 -0
index 9537761..7932dc2 100644
@@ -20,6 +20,7 @@
   #include <linux/of_device.h>
   #include <linux/pm_runtime.h>
   +#include <video/of_display_timing.h>
   #include <video/samsung_fimd.h>
   #include <drm/exynos_drm.h>
   @@ -883,10 +884,26 @@ static int fimd_probe(struct platform_device

*pdev)

         DRM_DEBUG_KMS("%s\n", __FILE__);

- pdata = pdev->dev.platform_data;

drivers/gpu/drm/exynos/exynos_drm_fimd.c +4 -3
-       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");

drivers/gpu/drm/exynos/exynos_drm_fimd.c +4 -0
+                       return -ENOMEM;
+               }
+
+               ret = of_get_fb_videomode(dev->of_node,

&pdata->panel.timing,

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

Quoted 4 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +4 -0
+                                       OF_USE_NATIVE_MODE);
+               if (ret) {
+                       DRM_ERROR("failed: of_get_fb_videomode()\n"
+                               "with return value: %d\n", ret);

Could you make this error log to one line?

Quoted 6 lines
Quoted 1 line

The Line was going beyond 80 line marks, hence I had to split it.

So remove or contract some log messages, e.g. "with return value" I think that is unnecessary.

Will do and resend.

Quoted 24 lines
Quoted 5 lines
Quoted 5 lines

except this,

Quoted 14 lines
Quoted 12 lines

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

Quoted 10 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +8 -0
+                       return ret;
+               }
+       } else {
+               pdata = pdev->dev.platform_data;
+               if (!pdata) {
+                       DRM_ERROR("no platform data specified\n");
+                       return -EINVAL;
+               }
         }
         panel = &pdata->panel;

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#8 lore raw

PATCH v8 2/2 video: drm: exynos: Add pinctrl support to fimd

In reply to Vikas Sajjan

Adds support for pinctrl to drm fimd

---
 drivers/gpu/drm/exynos/exynos_drm_fimd.c |    9 +++++++++
 1 file changed, 9 insertions(+)
drivers/gpu/drm/exynos/exynos_drm_fimd.c +9 -0
index 7932dc2..7d93475 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/of_display_timing.h>
 #include <video/samsung_fimd.h>
@@ -879,6 +880,7 @@ static int fimd_probe(struct platform_device *pdev)
 	struct exynos_drm_fimd_pdata *pdata;
 	struct exynos_drm_panel_info *panel;
 	struct resource *res;
+	struct pinctrl *pctrl;
 	int win;
 	int ret = -EINVAL;
 
@@ -898,6 +900,13 @@ static int fimd_probe(struct platform_device *pdev)
 				"with return value: %d\n", ret);
 			return ret;
 		}
+		pctrl = devm_pinctrl_get_select_default(dev);
+		if (IS_ERR(pctrl)) {
+			DRM_ERROR("failed: devm_pinctrl_get_select_default()\n"
+				"with return value: %d\n", PTR_RET(pctrl));
+			return PTR_ERR(pctrl);
+		}
+
 	} else {
 		pdata = pdev->dev.platform_data;
 		if (!pdata) {
Signature · 1 line
1.7.9.5