diff mbox

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

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

Commit Message

Vikas C Sajjan Jan. 30, 2013, 6:30 a.m. UTC
This patch adds display-timing node parsing using video helper function

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 |   38 +++++++++++++++++++++++++++---
 1 file changed, 35 insertions(+), 3 deletions(-)

Comments

Sean Paul Jan. 30, 2013, 3:58 p.m. UTC | #1
On Wed, Jan 30, 2013 at 1:30 AM, Vikas Sajjan <vikas.sajjan@linaro.org> wrote:
> This patch adds display-timing node parsing using video helper function
>
> 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 |   38 +++++++++++++++++++++++++++---
>  1 file changed, 35 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> index bf0d9ba..94729ed 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,15 +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 device *disp_dev = &pdev->dev;

Isn't this the same as dev (maybe I'm missing some dependent patch)?

> +       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");
> +       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(disp_dev->of_node, fbmode, -1);
> +               if (ret) {
> +                       DRM_ERROR("failed to get fb_videomode\n");
> +                       return -EINVAL;
> +               }
> +               pdata->panel.timing = (struct fb_videomode) *fbmode;
> +
> +       } else {
> +               pdata = pdev->dev.platform_data;
> +               if (!pdata) {
> +                       DRM_ERROR("no platform data specified\n");
> +                       return -EINVAL;
> +               }
> +       }
> +
> +       pctrl = devm_pinctrl_get_select_default(dev);
> +       if (IS_ERR(pctrl)) {

Will this work for exynos5? AFAICT, there's no pinctrl setup for it.

Sean

> +               DRM_ERROR("no pinctrl data provided.\n");
>                 return -EINVAL;
>         }
>
> --
> 1.7.9.5
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Vikas C Sajjan Jan. 31, 2013, 5:11 a.m. UTC | #2
Hi Sean,

On 30 January 2013 21:28, Sean Paul <seanpaul@chromium.org> wrote:
> On Wed, Jan 30, 2013 at 1:30 AM, Vikas Sajjan <vikas.sajjan@linaro.org> wrote:
>> This patch adds display-timing node parsing using video helper function
>>
>> 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 |   38 +++++++++++++++++++++++++++---
>>  1 file changed, 35 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
>> index bf0d9ba..94729ed 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,15 +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 device *disp_dev = &pdev->dev;
>
> Isn't this the same as dev (maybe I'm missing some dependent patch)?
>
yeah, its same. Will remove the duplicate variable.

>> +       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");
>> +       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(disp_dev->of_node, fbmode, -1);
>> +               if (ret) {
>> +                       DRM_ERROR("failed to get fb_videomode\n");
>> +                       return -EINVAL;
>> +               }
>> +               pdata->panel.timing = (struct fb_videomode) *fbmode;
>> +
>> +       } else {
>> +               pdata = pdev->dev.platform_data;
>> +               if (!pdata) {
>> +                       DRM_ERROR("no platform data specified\n");
>> +                       return -EINVAL;
>> +               }
>> +       }
>> +
>> +       pctrl = devm_pinctrl_get_select_default(dev);
>> +       if (IS_ERR(pctrl)) {
>
> Will this work for exynos5? AFAICT, there's no pinctrl setup for it.

Was tested with
>
> Sean
>
>> +               DRM_ERROR("no pinctrl data provided.\n");
>>                 return -EINVAL;
>>         }
>>
>> --
>> 1.7.9.5
>>
>> _______________________________________________
>> dri-devel mailing list
>> dri-devel@lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/dri-devel
Vikas C Sajjan Jan. 31, 2013, 5:15 a.m. UTC | #3
Hi Sean,

Sorry, wrongly sent incomplete mail.

On 31 January 2013 10:41, Vikas Sajjan <vikas.sajjan@linaro.org> wrote:
> Hi Sean,
>
> On 30 January 2013 21:28, Sean Paul <seanpaul@chromium.org> wrote:
>> On Wed, Jan 30, 2013 at 1:30 AM, Vikas Sajjan <vikas.sajjan@linaro.org> wrote:
>>> This patch adds display-timing node parsing using video helper function
>>>
>>> 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 |   38 +++++++++++++++++++++++++++---
>>>  1 file changed, 35 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
>>> index bf0d9ba..94729ed 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,15 +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 device *disp_dev = &pdev->dev;
>>
>> Isn't this the same as dev (maybe I'm missing some dependent patch)?
>>
> yeah, its same. Will remove the duplicate variable.
>
>>> +       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");
>>> +       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(disp_dev->of_node, fbmode, -1);
>>> +               if (ret) {
>>> +                       DRM_ERROR("failed to get fb_videomode\n");
>>> +                       return -EINVAL;
>>> +               }
>>> +               pdata->panel.timing = (struct fb_videomode) *fbmode;
>>> +
>>> +       } else {
>>> +               pdata = pdev->dev.platform_data;
>>> +               if (!pdata) {
>>> +                       DRM_ERROR("no platform data specified\n");
>>> +                       return -EINVAL;
>>> +               }
>>> +       }
>>> +
>>> +       pctrl = devm_pinctrl_get_select_default(dev);
>>> +       if (IS_ERR(pctrl)) {
>>
>> Will this work for exynos5? AFAICT, there's no pinctrl setup for it.
>
> Was tested with test on Exynos 4412 SoC, with the arch side changes (refer below link )
http://www.mail-archive.com/linux-samsung-soc@vger.kernel.org/msg15336.html

as you said there's no pinctrl setup for it, by making similar changes
for exynos5, it should work for exynos5 also.
>>
>> Sean
>>
>>> +               DRM_ERROR("no pinctrl data provided.\n");
>>>                 return -EINVAL;
>>>         }
>>>
>>> --
>>> 1.7.9.5
>>>
>>> _______________________________________________
>>> dri-devel mailing list
>>> dri-devel@lists.freedesktop.org
>>> http://lists.freedesktop.org/mailman/listinfo/dri-devel
>
>
>
> --
> Thanks and Regards
>  Vikas Sajjan
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..94729ed 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,15 +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 device *disp_dev = &pdev->dev;
+	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");
+	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(disp_dev->of_node, fbmode, -1);
+		if (ret) {
+			DRM_ERROR("failed to get fb_videomode\n");
+			return -EINVAL;
+		}
+		pdata->panel.timing = (struct fb_videomode) *fbmode;
+
+	} else {
+		pdata = pdev->dev.platform_data;
+		if (!pdata) {
+			DRM_ERROR("no platform data specified\n");
+			return -EINVAL;
+		}
+	}
+
+	pctrl = devm_pinctrl_get_select_default(dev);
+	if (IS_ERR(pctrl)) {
+		DRM_ERROR("no pinctrl data provided.\n");
 		return -EINVAL;
 	}