diff mbox

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

Message ID 1360124655-22902-2-git-send-email-vikas.sajjan@linaro.org (mailing list archive)
State New, archived
Headers show

Commit Message

Vikas C Sajjan Feb. 6, 2013, 4:24 a.m. UTC
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.

Signed-off-by: Leela Krishna Amudala <l.krishna@samsung.com>
Signed-off-by: Vikas Sajjan <vikas.sajjan@linaro.org>
---
 drivers/gpu/drm/exynos/exynos_drm_fimd.c |   41 +++++++++++++++++++++++++++---
 1 file changed, 37 insertions(+), 4 deletions(-)

Comments

Paul Menzel Feb. 6, 2013, 9:50 a.m. UTC | #1
Am Mittwoch, den 06.02.2013, 09:54 +0530 schrieb 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.

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?

> Signed-off-by: Leela Krishna Amudala <l.krishna@samsung.com>
> Signed-off-by: Vikas Sajjan <vikas.sajjan@linaro.org>
> ---
>  drivers/gpu/drm/exynos/exynos_drm_fimd.c |   41 +++++++++++++++++++++++++++---
>  1 file changed, 37 insertions(+), 4 deletions(-)

[…]


Thanks,

Paul
Vikas Sajjan Feb. 6, 2013, 10:56 a.m. UTC | #2
Hi Mr. Paul,

On Wed, Feb 6, 2013 at 3:20 PM, Paul Menzel
<paulepanter@users.sourceforge.net> wrote:
> Am Mittwoch, den 06.02.2013, 09:54 +0530 schrieb 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.
>
> 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.

>> Signed-off-by: Leela Krishna Amudala <l.krishna@samsung.com>
>> Signed-off-by: Vikas Sajjan <vikas.sajjan@linaro.org>
>> ---
>>  drivers/gpu/drm/exynos/exynos_drm_fimd.c |   41 +++++++++++++++++++++++++++---
>>  1 file changed, 37 insertions(+), 4 deletions(-)
>
> […]
>
>
> Thanks,
>
> Paul
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
>
Inki Dae Feb. 15, 2013, 3:20 a.m. UTC | #3
2013/2/6 Vikas Sajjan <vikas.sajjan@linaro.org>:
> 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.
>
> Signed-off-by: Leela Krishna Amudala <l.krishna@samsung.com>
> Signed-off-by: Vikas Sajjan <vikas.sajjan@linaro.org>
> ---
>  drivers/gpu/drm/exynos/exynos_drm_fimd.c |   41 +++++++++++++++++++++++++++---
>  1 file changed, 37 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> index bf0d9ba..978e866 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> @@ -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;
> +               }

It doesn't need to allocate fbmode.

> +
> +               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);

> +               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.

> +
> +               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
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
Vikas C Sajjan Feb. 15, 2013, 4:53 a.m. UTC | #4
Hi Mr. Inki Dae,

Thanks for review.

On 15 February 2013 08:50, Inki Dae <inki.dae@samsung.com> wrote:
> 2013/2/6 Vikas Sajjan <vikas.sajjan@linaro.org>:
>> 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.
>>
>> Signed-off-by: Leela Krishna Amudala <l.krishna@samsung.com>
>> Signed-off-by: Vikas Sajjan <vikas.sajjan@linaro.org>
>> ---
>>  drivers/gpu/drm/exynos/exynos_drm_fimd.c |   41 +++++++++++++++++++++++++++---
>>  1 file changed, 37 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
>> index bf0d9ba..978e866 100644
>> --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
>> +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
>> @@ -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;
>> +               }
>
> It doesn't need to allocate fbmode.
>
>> +
>> +               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);
>
>> +               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.
>
>> +
>> +               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

Will modify, test and resend V6.

>>
>> _______________________________________________
>> dri-devel mailing list
>> dri-devel@lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/dri-devel
diff mbox

Patch

diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index bf0d9ba..978e866 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -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;