Skip to contentSkip to conversation

Add display-timing node parsing to exynos drm fimd

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

Subsystems (4)

v6 of 13 Superseded Latest is v13 →

lore
Share & tools
lore
#0 lore raw

v6 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 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 (1):
video: drm: exynos: Add display-timing node parsing using video
helper function

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

PATCH v6 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 |   37 ++++++++++++++++++++++++++----
 1 file changed, 33 insertions(+), 4 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_fimd.c +33 -4
index 9537761..8b2c0ff 100644
@@ -19,7 +19,9 @@
 #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>
 #include <drm/exynos_drm.h>
 
@@ -877,16 +879,43 @@ static int 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 = &pdata->panel.timing;
+		ret = of_get_fb_videomode(dev->of_node, fbmode,
+					OF_USE_NATIVE_MODE);
+		if (ret) {
+			DRM_ERROR("failed: of_get_fb_videomode()\n"
+				"with return value: %d\n", ret);
+			return ret;
+		}
+
+		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
maintainer
#2 lore raw

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

Quoted 62 lines

-----Original Message-----
From: Vikas Sajjan [mailto:[email protected]]
Sent: Friday, February 15, 2013 3:43 PM
To: [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: [PATCH v6 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 |   37
++++++++++++++++++++++++++----
 1 file changed, 33 insertions(+), 4 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_fimd.c +11 -4
index 9537761..8b2c0ff 100644
@@ -19,7 +19,9 @@
 #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>
 #include <drm/exynos_drm.h>
 
@@ -877,16 +879,43 @@ static int 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 fimd_probe(struct platform_device *pdev) · line 906

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

Why does it need pinctrl? and even though needed, I think this should be separated into another one.

Thanks,
Inki Dae

Quoted 18 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +2 -0
+		if (IS_ERR_OR_NULL(pctrl)) {
+			DRM_ERROR("failed:

devm_pinctrl_get_select_default()\n"

drivers/gpu/drm/exynos/exynos_drm_fimd.c +10 -1
+				"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

#3 lore raw

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

Hi Mr. Inki Dae,

Quoted 67 lines · Inki Dae
Quoted 67 lines

-----Original Message-----
From: Vikas Sajjan [mailto:[email protected]]
Sent: Friday, February 15, 2013 3:43 PM
To: [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: [PATCH v6 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 |   37
++++++++++++++++++++++++++----
 1 file changed, 33 insertions(+), 4 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_fimd.c +16 -4
index 9537761..8b2c0ff 100644
@@ -19,7 +19,9 @@
 #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>
 #include <drm/exynos_drm.h>
 
@@ -877,16 +879,43 @@ static int 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 = &pdata->panel.timing;
+             ret = of_get_fb_videomode(dev->of_node, fbmode,
+                                     OF_USE_NATIVE_MODE);
+             if (ret) {
+                     DRM_ERROR("failed: of_get_fb_videomode()\n"
Quoted 9 lines

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

Quoted 5 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +5 -0
+                             "with return value: %d\n", ret);
+                     return ret;
+             }
+
+             pctrl = devm_pinctrl_get_select_default(dev);

Why does it need pinctrl? and even though needed, I think this should be separated into another one.

Will separate it out and send it in a separate patch.

Quoted 22 lines

Thanks,
Inki Dae

Quoted 18 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +2 -0
+             if (IS_ERR_OR_NULL(pctrl)) {
+                     DRM_ERROR("failed:

devm_pinctrl_get_select_default()\n"

drivers/gpu/drm/exynos/exynos_drm_fimd.c +10 -1
+                             "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

Signature · 2 lines
Thanks and Regards
 Vikas Sajjan
#4 lore raw

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

In reply to Vikas Sajjan

Hi,

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 |   37 ++++++++++++++++++++++++++----
  1 file changed, 33 insertions(+), 4 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_fimd.c +4 -4
index 9537761..8b2c0ff 100644
@@ -19,7 +19,9 @@
  #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>
  #include <drm/exynos_drm.h>
 
@@ -877,16 +879,43 @@ static int 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;

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
+	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 = &pdata->panel.timing;
+		ret = of_get_fb_videomode(dev->of_node, fbmode,
+					OF_USE_NATIVE_MODE);

fbmode variable can be substituted to &pdata->panel.timing directly then can remove fbmode variable.

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

Quoted 8 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +8 -0
+		if (ret) {
+			DRM_ERROR("failed: of_get_fb_videomode()\n"
+				"with return value: %d\n", ret);
+			return ret;
+		}
+
+		pctrl = devm_pinctrl_get_select_default(dev);
+		if (IS_ERR_OR_NULL(pctrl)) {

It's enough to "if (IS_ERR(pctrl)) {".

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

Quoted 3 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +3 -0
+			DRM_ERROR("failed: devm_pinctrl_get_select_default()\n"
+				"with return value: %d\n", PTR_RET(pctrl));
+			return PTR_RET(pctrl);

It's enough to "return PTR_ERR(pctrl);"

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

Quoted 1 line
drivers/gpu/drm/exynos/exynos_drm_fimd.c +1 -0
+		}

If this needs, parts for pinctrl should go to another patch.

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

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

Thanks.

#5 lore raw

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

Hi,

Quoted 52 lines · Joonyoung Shim

Hi,

Quoted 48 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 |   37
++++++++++++++++++++++++++----
  1 file changed, 33 insertions(+), 4 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_fimd.c +1 -0
index 9537761..8b2c0ff 100644
@@ -19,7 +19,9 @@
  #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>
  #include <drm/exynos_drm.h>
  @@ -877,16 +879,43 @@ static int fimd_probe(struct platform_device

*pdev)

        struct exynos_drm_subdrv *subdrv;
        struct exynos_drm_fimd_pdata *pdata;
        struct exynos_drm_panel_info *panel;
drivers/gpu/drm/exynos/exynos_drm_fimd.c +8 -3
+       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;
+               }
Quoted 9 lines

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

Quoted 4 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +4 -0
+
+               fbmode = &pdata->panel.timing;
+               ret = of_get_fb_videomode(dev->of_node, fbmode,
+                                       OF_USE_NATIVE_MODE);

fbmode variable can be substituted to &pdata->panel.timing directly then can remove fbmode variable.

this is can be done.

Quoted 11 lines

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

Quoted 9 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +8 -0
+               if (ret) {
+                       DRM_ERROR("failed: of_get_fb_videomode()\n"
+                               "with return value: %d\n", ret);
+                       return ret;
+               }
+
+               pctrl = devm_pinctrl_get_select_default(dev);
+               if (IS_ERR_OR_NULL(pctrl)) {
Quoted 2 lines

It's enough to "if (IS_ERR(pctrl)) {".

what if it returns NULL?

Quoted 10 lines
Quoted 6 lines

+ DRM_ERROR("failed:
devm_pinctrl_get_select_default()\n"
+ "with return value: %d\n",
PTR_RET(pctrl));
+ return PTR_RET(pctrl);

It's enough to "return PTR_ERR(pctrl);"

ok.

Quoted 5 lines
Quoted 1 line

+ }

If this needs, parts for pinctrl should go to another patch.

I have it as a separate patch already. [PATCH v7 2/2] video: drm:
exynos: Add pinctrl support to fimd

Quoted 13 lines

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

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

Thanks.

Signature · 2 lines
Thanks and Regards
 Vikas Sajjan
#6 lore raw

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

Quoted 72 lines · Vikas Sajjan

Hi,

Quoted 50 lines · Joonyoung Shim

Hi,

Quoted 46 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 |   37
++++++++++++++++++++++++++----
   1 file changed, 33 insertions(+), 4 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_fimd.c +1 -0
index 9537761..8b2c0ff 100644
@@ -19,7 +19,9 @@
   #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>
   #include <drm/exynos_drm.h>
   @@ -877,16 +879,43 @@ static int fimd_probe(struct platform_device

*pdev)

         struct exynos_drm_subdrv *subdrv;
         struct exynos_drm_fimd_pdata *pdata;
         struct exynos_drm_panel_info *panel;
drivers/gpu/drm/exynos/exynos_drm_fimd.c +7 -3
+       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;
Quoted 9 lines

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

Quoted 5 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +5 -0
+               }
+
+               fbmode = &pdata->panel.timing;
+               ret = of_get_fb_videomode(dev->of_node, fbmode,
+                                       OF_USE_NATIVE_MODE);

fbmode variable can be substituted to &pdata->panel.timing directly then can remove fbmode variable.

this is can be done.

Quoted 9 lines
Quoted 8 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +8 -0
+               if (ret) {
+                       DRM_ERROR("failed: of_get_fb_videomode()\n"
+                               "with return value: %d\n", ret);
+                       return ret;
+               }
+
+               pctrl = devm_pinctrl_get_select_default(dev);
+               if (IS_ERR_OR_NULL(pctrl)) {
Quoted 3 lines
Quoted 2 lines

It's enough to "if (IS_ERR(pctrl)) {".

what if it returns NULL?

devm_pinctrl_get_select_default() never return NULL.

Quoted 29 lines
Quoted 8 lines
Quoted 5 lines

+ DRM_ERROR("failed:
devm_pinctrl_get_select_default()\n"
+ "with return value: %d\n",
PTR_RET(pctrl));
+ return PTR_RET(pctrl);

It's enough to "return PTR_ERR(pctrl);"

ok.

Quoted 4 lines
Quoted 1 line

+ }

If this needs, parts for pinctrl should go to another patch.

I have it as a separate patch already. [PATCH v7 2/2] video: drm:
exynos: Add pinctrl support to fimd

Quoted 11 lines

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

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

Thanks.

#7 lore raw

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

Hi,

Quoted 74 lines · Joonyoung Shim
Quoted 73 lines · Vikas Sajjan

Hi,

Quoted 51 lines · Joonyoung Shim

Hi,

Quoted 47 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 |   37
++++++++++++++++++++++++++----
   1 file changed, 33 insertions(+), 4 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_fimd.c +1 -0
index 9537761..8b2c0ff 100644
@@ -19,7 +19,9 @@
   #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>
   #include <drm/exynos_drm.h>
   @@ -877,16 +879,43 @@ static int fimd_probe(struct platform_device

*pdev)

         struct exynos_drm_subdrv *subdrv;
         struct exynos_drm_fimd_pdata *pdata;
         struct exynos_drm_panel_info *panel;
drivers/gpu/drm/exynos/exynos_drm_fimd.c +6 -3
+       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;

Quoted 9 lines

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

Quoted 5 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +5 -0
+               }
+
+               fbmode = &pdata->panel.timing;
+               ret = of_get_fb_videomode(dev->of_node, fbmode,
+                                       OF_USE_NATIVE_MODE);

fbmode variable can be substituted to &pdata->panel.timing directly then can remove fbmode variable.

this is can be done.

Quoted 9 lines
Quoted 8 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +8 -0
+               if (ret) {
+                       DRM_ERROR("failed: of_get_fb_videomode()\n"
+                               "with return value: %d\n", ret);
+                       return ret;
+               }
+
+               pctrl = devm_pinctrl_get_select_default(dev);
+               if (IS_ERR_OR_NULL(pctrl)) {
Quoted 6 lines
Quoted 3 lines
Quoted 2 lines

It's enough to "if (IS_ERR(pctrl)) {".

what if it returns NULL?

devm_pinctrl_get_select_default() never return NULL.

My mistake. If CONFIG_PINCTRL is disabled, devm_pinctrl_get_select_default can return NULL.

Linus,

devm_pinctrl_get_select() and pinctrl_get_select() also need IS_ERR_OR_NULL instead of IS_ERR? And many drivers using above functions don't check NULL, right?

Thanks.

Quoted 36 lines
Quoted 9 lines
Quoted 9 lines
Quoted 6 lines

+ DRM_ERROR("failed:
devm_pinctrl_get_select_default()\n"
+ "with return value: %d\n",
PTR_RET(pctrl));
+ return PTR_RET(pctrl);

It's enough to "return PTR_ERR(pctrl);"

Quoted 21 lines

ok.

Quoted 4 lines
Quoted 1 line

+ }

If this needs, parts for pinctrl should go to another patch.

I have it as a separate patch already. [PATCH v7 2/2] video: drm:
exynos: Add pinctrl support to fimd

Quoted 11 lines

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

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

Thanks.

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

#8 lore raw

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

Quoted 2 lines · Joonyoung Shim

My mistake. If CONFIG_PINCTRL is disabled, devm_pinctrl_get_select_default can return NULL.

Yes, and that is perfectly legal and *NOT* an error.

Quoted 2 lines

devm_pinctrl_get_select() and pinctrl_get_select() also need IS_ERR_OR_NULL instead of IS_ERR?

No.

In fact, IS_ERR_OR_NULL() shall not be used at all.

Check the LKML mailinglist for Russells recent struggle to purge it from the kernel.

Quoted 1 line

And many drivers using above functions don't check NULL, right?

No, and they should not. Stub pinctrl handles, just like stub clocks and stub regulators, are perfectly legal, just that they have no effect.

Yours,
Linus Walleij