All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm: exynos: add iommu support in hdmi driver with dt enabled
@ 2012-11-05 15:18 Rahul Sharma
  0 siblings, 0 replies; 6+ messages in thread
From: Rahul Sharma @ 2012-11-05 15:18 UTC (permalink / raw)
  To: dri-devel
  Cc: prathyush.k, sw0312.kim, joshi, kyungmin.park, rahul.sharma,
	prashanth.g, s.shirish

This patch adds iommu support for hdmi driver with device tree based
search. It searches for sysmmu property in hdmi dt node to get tv
iommu device pointer which will be used to configure iommu hw interface.

This patch is based on "exynos-drm-next-iommu" branch at
http://git.kernel.org/?p=linux/kernel/git/daeinki/drm-exynos.git

This patch is having dependency on  linux-samsung-soc patchset posted at
http://permalink.gmane.org/gmane.linux.kernel.samsung-soc/13556

Signed-off-by: Rahul Sharma <rahul.sharma@samsung.com>
Signed-off-by: Prathyush K <prathyush.k@samsung.com>
---
 drivers/gpu/drm/exynos/exynos_hdmi.c |   35 ++++++++++++++++++++++++++++++++++
 1 files changed, 35 insertions(+), 0 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c
index d1a1d71..a04452c 100644
--- a/drivers/gpu/drm/exynos/exynos_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
@@ -34,7 +34,9 @@
 #include <linux/regulator/consumer.h>
 #include <linux/io.h>
 #include <linux/of_gpio.h>
+#include <linux/of_platform.h>
 #include <plat/gpio-cfg.h>
+#include <mach/sysmmu.h>
 
 #include <drm/exynos_drm.h>
 
@@ -2275,6 +2277,34 @@ void hdmi_attach_hdmiphy_client(struct i2c_client *hdmiphy)
 }
 
 #ifdef CONFIG_OF
+
+static int drm_hdmi_dt_init_iommu(struct device *dev)
+{
+	struct platform_device *pds;
+	struct device_node *dn, *dns;
+	const __be32 *parp;
+
+	dn = dev->of_node;
+	parp = of_get_property(dn, "sysmmu", NULL);
+	if (parp == NULL) {
+		dev_err(dev, "failed to find sysmmu property\n");
+		return -EINVAL;
+	}
+	dns = of_find_node_by_phandle(be32_to_cpup(parp));
+	if (dns == NULL) {
+		dev_err(dev, "failed to find sysmmu node\n");
+		return -EINVAL;
+	}
+	pds = of_find_device_by_node(dns);
+	if (pds == NULL) {
+		dev_err(dev, "failed to find sysmmu platform device\n");
+		return -EINVAL;
+	}
+
+	platform_set_sysmmu(&pds->dev, dev);
+	return 0;
+}
+
 static struct s5p_hdmi_platform_data *drm_hdmi_dt_parse_pdata
 					(struct device *dev)
 {
@@ -2294,6 +2324,11 @@ static struct s5p_hdmi_platform_data *drm_hdmi_dt_parse_pdata
 		goto err_data;
 	}
 
+	if (drm_hdmi_dt_init_iommu(dev)) {
+		DRM_ERROR("no sysmmu property found\n");
+		goto err_data;
+	}
+
 	pd->hpd_gpio = of_get_named_gpio_flags(np, "hpd-gpio", 0, &flags);
 
 	return pd;
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] drm: exynos: add iommu support in hdmi driver with dt enabled
  2012-11-07 12:27     ` Rahul Sharma
@ 2012-11-07 16:10       ` Inki Dae
  0 siblings, 0 replies; 6+ messages in thread
From: Inki Dae @ 2012-11-07 16:10 UTC (permalink / raw)
  To: Rahul Sharma
  Cc: s.shirish, prathyush.k, Leela Krishna Amudala, sw0312.kim, joshi,
	dri-devel, kyungmin.park, prashanth.g, Rahul Sharma


[-- Attachment #1.1: Type: text/plain, Size: 5715 bytes --]

2012/11/7 Rahul Sharma <r.sh.open@gmail.com>

> On Wed, Nov 7, 2012 at 3:11 PM, Inki Dae <inki.dae@samsung.com> wrote:
> >
> >
> > 2012/11/7 Leela Krishna Amudala <l.krishna@samsung.com>
> >>
> >> Hello Rahul,
> >>
> >> On Mon, Nov 5, 2012 at 2:32 PM, Rahul Sharma <rahul.sharma@samsung.com>
> >> wrote:
> >> > This patch adds iommu support for hdmi driver with device tree based
> >> > search. It searches for sysmmu property in hdmi dt node to get tv
> >> > iommu device pointer which will be used to configure iommu hw
> interface.
> >> >
> >> > This patch is based on "exynos-drm-next-iommu" branch at
> >> > http://git.kernel.org/?p=linux/kernel/git/daeinki/drm-exynos.git
> >> >
> >> > This patch is having dependency on  linux-samsung-soc patchset named
> >> > "add dt based support for iommu for hdmi"
> >> >
> >> > Signed-off-by: Rahul Sharma <rahul.sharma@samsung.com>
> >> > Signed-off-by: Prathyush K <prathyush.k@samsung.com>
> >> > ---
> >> >  drivers/gpu/drm/exynos/exynos_hdmi.c |   35
> >> > ++++++++++++++++++++++++++++++++++
> >> >  1 files changed, 35 insertions(+), 0 deletions(-)
> >> >
> >> > diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c
> >> > b/drivers/gpu/drm/exynos/exynos_hdmi.c
> >> > index d1a1d71..ee110c9 100644
> >> > --- a/drivers/gpu/drm/exynos/exynos_hdmi.c
> >> > +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
> >> > @@ -34,7 +34,9 @@
> >> >  #include <linux/regulator/consumer.h>
> >> >  #include <linux/io.h>
> >> >  #include <linux/of_gpio.h>
> >> > +#include <linux/of_platform.h>
> >> >  #include <plat/gpio-cfg.h>
> >> > +#include <mach/sysmmu.h>
> >> >
> >> >  #include <drm/exynos_drm.h>
> >> >
> >> > @@ -2275,6 +2277,34 @@ void hdmi_attach_hdmiphy_client(struct
> i2c_client
> >> > *hdmiphy)
> >> >  }
> >> >
> >> >  #ifdef CONFIG_OF
> >> > +
> >> > +static int drm_hdmi_dt_init_iommu(struct device *dev)
> >> > +{
> >> > +       struct platform_device *pds;
> >> > +       struct device_node *dn, *dns;
> >> > +       const __be32 *parp;
> >> > +
> >> > +       dn = dev->of_node;
> >> > +       parp = of_get_property(dn, "sysmmu", NULL);
> >> > +       if (parp == NULL) {
> >> > +               dev_err(dev, "failed to find sysmmu property\n");
> >> > +               return -EINVAL;
> >> > +       }
> >> > +       dns = of_find_node_by_phandle(be32_to_cpup(parp));
> >> > +       if (dns == NULL) {
> >> > +               dev_err(dev, "failed to find sysmmu node\n");
> >> > +               return -EINVAL;
> >> > +       }
> >> > +       pds = of_find_device_by_node(dns);
> >> > +       if (pds == NULL) {
> >> > +               dev_err(dev, "failed to find sysmmu platform
> device\n");
> >> > +               return -EINVAL;
> >> > +       }
> >> > +
> >> > +       platform_set_sysmmu(&pds->dev, dev);
> >> > +       return 0;
> >> > +}
> >> > +
> >>
> >> As a part of adding iommu support to FIMD driver, we have to implement
> >> the same function in FIMD driver also, which makes code replication.
> >> So, it would be better to move this function out of this file and put
> >> it in a common drm file so that FIMD also can use it.
> >>
> >
> > I tend to agree with you but I think it's better to move it into
> > drivers/iommu/exynos-iommu.c because IOMMU units could be used by device
> > driver based on not only DRM but also V4L2.
> >
> > Thanks,
> > Inki Dae
> >
>
> Mr Dae,
>
> Do you mean, we should export this function from
> drivers/iommu/exynos-iommu.c? How
> can I add it there ? To me it looks very much iommu client specific
> code as it is tryng to parse
> its DT node for "sysmmu" property.
>

Whehter some device uses its own iommu or not is decided by exynos5250.dtsi
declaration. So if iommu property is declared in the dtsi file properly and
drm_hdmi_dt_init_iommu() with desired device object(v4l2-based or drm-based
driver's) is called by each driver, we could use this function commonly? Of
course, there is no proper header file to declare this function yet. My
intention is just to share this function with other frameworks to avoid
duplicating same function. If not so, with dt, other frameworks-based
driver should also implement and call same function to use iommu.


>
> I was thinking of putting it into exynos_drm_iommu.c which is visible
> to hdmi and fimd both.
>
> regards,
> Rahul Sharma
>
> >>
> >> Best Wishes,
> >> Leela Krishna Amudala.
> >>
> >>
> >> >  static struct s5p_hdmi_platform_data *drm_hdmi_dt_parse_pdata
> >> >                                         (struct device *dev)
> >> >  {
> >> > @@ -2294,6 +2324,11 @@ static struct s5p_hdmi_platform_data
> >> > *drm_hdmi_dt_parse_pdata
> >> >                 goto err_data;
> >> >         }
> >> >
> >> > +       if (drm_hdmi_dt_init_iommu(dev)){
> >> > +               DRM_ERROR("no sysmmu property found\n");
> >> > +               goto err_data;
> >> > +       }
> >> > +
> >> >         pd->hpd_gpio = of_get_named_gpio_flags(np, "hpd-gpio", 0,
> >> > &flags);
> >> >
> >> >         return pd;
> >> > --
> >> > 1.7.0.4
> >> >
> >> > _______________________________________________
> >> > dri-devel mailing list
> >> > dri-devel@lists.freedesktop.org
> >> > http://lists.freedesktop.org/mailman/listinfo/dri-devel
> >> _______________________________________________
> >> dri-devel mailing list
> >> dri-devel@lists.freedesktop.org
> >> http://lists.freedesktop.org/mailman/listinfo/dri-devel
> >
> >
> >
> > _______________________________________________
> > dri-devel mailing list
> > dri-devel@lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/dri-devel
> >
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
>

[-- Attachment #1.2: Type: text/html, Size: 8808 bytes --]

[-- Attachment #2: Type: text/plain, Size: 159 bytes --]

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] drm: exynos: add iommu support in hdmi driver with dt enabled
  2012-11-07  9:41   ` Inki Dae
@ 2012-11-07 12:27     ` Rahul Sharma
  2012-11-07 16:10       ` Inki Dae
  0 siblings, 1 reply; 6+ messages in thread
From: Rahul Sharma @ 2012-11-07 12:27 UTC (permalink / raw)
  To: Inki Dae
  Cc: s.shirish, prathyush.k, Leela Krishna Amudala, sw0312.kim, joshi,
	dri-devel, kyungmin.park, prashanth.g, Rahul Sharma

On Wed, Nov 7, 2012 at 3:11 PM, Inki Dae <inki.dae@samsung.com> wrote:
>
>
> 2012/11/7 Leela Krishna Amudala <l.krishna@samsung.com>
>>
>> Hello Rahul,
>>
>> On Mon, Nov 5, 2012 at 2:32 PM, Rahul Sharma <rahul.sharma@samsung.com>
>> wrote:
>> > This patch adds iommu support for hdmi driver with device tree based
>> > search. It searches for sysmmu property in hdmi dt node to get tv
>> > iommu device pointer which will be used to configure iommu hw interface.
>> >
>> > This patch is based on "exynos-drm-next-iommu" branch at
>> > http://git.kernel.org/?p=linux/kernel/git/daeinki/drm-exynos.git
>> >
>> > This patch is having dependency on  linux-samsung-soc patchset named
>> > "add dt based support for iommu for hdmi"
>> >
>> > Signed-off-by: Rahul Sharma <rahul.sharma@samsung.com>
>> > Signed-off-by: Prathyush K <prathyush.k@samsung.com>
>> > ---
>> >  drivers/gpu/drm/exynos/exynos_hdmi.c |   35
>> > ++++++++++++++++++++++++++++++++++
>> >  1 files changed, 35 insertions(+), 0 deletions(-)
>> >
>> > diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c
>> > b/drivers/gpu/drm/exynos/exynos_hdmi.c
>> > index d1a1d71..ee110c9 100644
>> > --- a/drivers/gpu/drm/exynos/exynos_hdmi.c
>> > +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
>> > @@ -34,7 +34,9 @@
>> >  #include <linux/regulator/consumer.h>
>> >  #include <linux/io.h>
>> >  #include <linux/of_gpio.h>
>> > +#include <linux/of_platform.h>
>> >  #include <plat/gpio-cfg.h>
>> > +#include <mach/sysmmu.h>
>> >
>> >  #include <drm/exynos_drm.h>
>> >
>> > @@ -2275,6 +2277,34 @@ void hdmi_attach_hdmiphy_client(struct i2c_client
>> > *hdmiphy)
>> >  }
>> >
>> >  #ifdef CONFIG_OF
>> > +
>> > +static int drm_hdmi_dt_init_iommu(struct device *dev)
>> > +{
>> > +       struct platform_device *pds;
>> > +       struct device_node *dn, *dns;
>> > +       const __be32 *parp;
>> > +
>> > +       dn = dev->of_node;
>> > +       parp = of_get_property(dn, "sysmmu", NULL);
>> > +       if (parp == NULL) {
>> > +               dev_err(dev, "failed to find sysmmu property\n");
>> > +               return -EINVAL;
>> > +       }
>> > +       dns = of_find_node_by_phandle(be32_to_cpup(parp));
>> > +       if (dns == NULL) {
>> > +               dev_err(dev, "failed to find sysmmu node\n");
>> > +               return -EINVAL;
>> > +       }
>> > +       pds = of_find_device_by_node(dns);
>> > +       if (pds == NULL) {
>> > +               dev_err(dev, "failed to find sysmmu platform device\n");
>> > +               return -EINVAL;
>> > +       }
>> > +
>> > +       platform_set_sysmmu(&pds->dev, dev);
>> > +       return 0;
>> > +}
>> > +
>>
>> As a part of adding iommu support to FIMD driver, we have to implement
>> the same function in FIMD driver also, which makes code replication.
>> So, it would be better to move this function out of this file and put
>> it in a common drm file so that FIMD also can use it.
>>
>
> I tend to agree with you but I think it's better to move it into
> drivers/iommu/exynos-iommu.c because IOMMU units could be used by device
> driver based on not only DRM but also V4L2.
>
> Thanks,
> Inki Dae
>

Mr Dae,

Do you mean, we should export this function from
drivers/iommu/exynos-iommu.c? How
can I add it there ? To me it looks very much iommu client specific
code as it is tryng to parse
its DT node for "sysmmu" property.

I was thinking of putting it into exynos_drm_iommu.c which is visible
to hdmi and fimd both.

regards,
Rahul Sharma

>>
>> Best Wishes,
>> Leela Krishna Amudala.
>>
>>
>> >  static struct s5p_hdmi_platform_data *drm_hdmi_dt_parse_pdata
>> >                                         (struct device *dev)
>> >  {
>> > @@ -2294,6 +2324,11 @@ static struct s5p_hdmi_platform_data
>> > *drm_hdmi_dt_parse_pdata
>> >                 goto err_data;
>> >         }
>> >
>> > +       if (drm_hdmi_dt_init_iommu(dev)){
>> > +               DRM_ERROR("no sysmmu property found\n");
>> > +               goto err_data;
>> > +       }
>> > +
>> >         pd->hpd_gpio = of_get_named_gpio_flags(np, "hpd-gpio", 0,
>> > &flags);
>> >
>> >         return pd;
>> > --
>> > 1.7.0.4
>> >
>> > _______________________________________________
>> > dri-devel mailing list
>> > dri-devel@lists.freedesktop.org
>> > http://lists.freedesktop.org/mailman/listinfo/dri-devel
>> _______________________________________________
>> dri-devel mailing list
>> dri-devel@lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/dri-devel
>
>
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] drm: exynos: add iommu support in hdmi driver with dt enabled
  2012-11-07  4:17 ` Leela Krishna Amudala
@ 2012-11-07  9:41   ` Inki Dae
  2012-11-07 12:27     ` Rahul Sharma
  0 siblings, 1 reply; 6+ messages in thread
From: Inki Dae @ 2012-11-07  9:41 UTC (permalink / raw)
  To: Leela Krishna Amudala
  Cc: s.shirish, prathyush.k, sw0312.kim, joshi, dri-devel,
	kyungmin.park, prashanth.g, Rahul Sharma


[-- Attachment #1.1: Type: text/plain, Size: 3894 bytes --]

2012/11/7 Leela Krishna Amudala <l.krishna@samsung.com>

> Hello Rahul,
>
> On Mon, Nov 5, 2012 at 2:32 PM, Rahul Sharma <rahul.sharma@samsung.com>
> wrote:
> > This patch adds iommu support for hdmi driver with device tree based
> > search. It searches for sysmmu property in hdmi dt node to get tv
> > iommu device pointer which will be used to configure iommu hw interface.
> >
> > This patch is based on "exynos-drm-next-iommu" branch at
> > http://git.kernel.org/?p=linux/kernel/git/daeinki/drm-exynos.git
> >
> > This patch is having dependency on  linux-samsung-soc patchset named
> > "add dt based support for iommu for hdmi"
> >
> > Signed-off-by: Rahul Sharma <rahul.sharma@samsung.com>
> > Signed-off-by: Prathyush K <prathyush.k@samsung.com>
> > ---
> >  drivers/gpu/drm/exynos/exynos_hdmi.c |   35
> ++++++++++++++++++++++++++++++++++
> >  1 files changed, 35 insertions(+), 0 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c
> b/drivers/gpu/drm/exynos/exynos_hdmi.c
> > index d1a1d71..ee110c9 100644
> > --- a/drivers/gpu/drm/exynos/exynos_hdmi.c
> > +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
> > @@ -34,7 +34,9 @@
> >  #include <linux/regulator/consumer.h>
> >  #include <linux/io.h>
> >  #include <linux/of_gpio.h>
> > +#include <linux/of_platform.h>
> >  #include <plat/gpio-cfg.h>
> > +#include <mach/sysmmu.h>
> >
> >  #include <drm/exynos_drm.h>
> >
> > @@ -2275,6 +2277,34 @@ void hdmi_attach_hdmiphy_client(struct i2c_client
> *hdmiphy)
> >  }
> >
> >  #ifdef CONFIG_OF
> > +
> > +static int drm_hdmi_dt_init_iommu(struct device *dev)
> > +{
> > +       struct platform_device *pds;
> > +       struct device_node *dn, *dns;
> > +       const __be32 *parp;
> > +
> > +       dn = dev->of_node;
> > +       parp = of_get_property(dn, "sysmmu", NULL);
> > +       if (parp == NULL) {
> > +               dev_err(dev, "failed to find sysmmu property\n");
> > +               return -EINVAL;
> > +       }
> > +       dns = of_find_node_by_phandle(be32_to_cpup(parp));
> > +       if (dns == NULL) {
> > +               dev_err(dev, "failed to find sysmmu node\n");
> > +               return -EINVAL;
> > +       }
> > +       pds = of_find_device_by_node(dns);
> > +       if (pds == NULL) {
> > +               dev_err(dev, "failed to find sysmmu platform device\n");
> > +               return -EINVAL;
> > +       }
> > +
> > +       platform_set_sysmmu(&pds->dev, dev);
> > +       return 0;
> > +}
> > +
>
> As a part of adding iommu support to FIMD driver, we have to implement
> the same function in FIMD driver also, which makes code replication.
> So, it would be better to move this function out of this file and put
> it in a common drm file so that FIMD also can use it.
>
>
I tend to agree with you but I think it's better to move it into
drivers/iommu/exynos-iommu.c because IOMMU units could be used by device
driver based on not only DRM but also V4L2.

Thanks,
Inki Dae


> Best Wishes,
> Leela Krishna Amudala.
>
>
>  static struct s5p_hdmi_platform_data *drm_hdmi_dt_parse_pdata
> >                                         (struct device *dev)
> >  {
> > @@ -2294,6 +2324,11 @@ static struct s5p_hdmi_platform_data
> *drm_hdmi_dt_parse_pdata
> >                 goto err_data;
> >         }
> >
> > +       if (drm_hdmi_dt_init_iommu(dev)){
> > +               DRM_ERROR("no sysmmu property found\n");
> > +               goto err_data;
> > +       }
> > +
> >         pd->hpd_gpio = of_get_named_gpio_flags(np, "hpd-gpio", 0,
> &flags);
> >
> >         return pd;
> > --
> > 1.7.0.4
> >
> > _______________________________________________
> > dri-devel mailing list
> > dri-devel@lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/dri-devel
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
>

[-- Attachment #1.2: Type: text/html, Size: 5730 bytes --]

[-- Attachment #2: Type: text/plain, Size: 159 bytes --]

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] drm: exynos: add iommu support in hdmi driver with dt enabled
  2012-11-05  9:02 Rahul Sharma
@ 2012-11-07  4:17 ` Leela Krishna Amudala
  2012-11-07  9:41   ` Inki Dae
  0 siblings, 1 reply; 6+ messages in thread
From: Leela Krishna Amudala @ 2012-11-07  4:17 UTC (permalink / raw)
  To: Rahul Sharma
  Cc: s.shirish, prathyush.k, sw0312.kim, joshi, dri-devel,
	kyungmin.park, prashanth.g

Hello Rahul,

On Mon, Nov 5, 2012 at 2:32 PM, Rahul Sharma <rahul.sharma@samsung.com> wrote:
> This patch adds iommu support for hdmi driver with device tree based
> search. It searches for sysmmu property in hdmi dt node to get tv
> iommu device pointer which will be used to configure iommu hw interface.
>
> This patch is based on "exynos-drm-next-iommu" branch at
> http://git.kernel.org/?p=linux/kernel/git/daeinki/drm-exynos.git
>
> This patch is having dependency on  linux-samsung-soc patchset named
> "add dt based support for iommu for hdmi"
>
> Signed-off-by: Rahul Sharma <rahul.sharma@samsung.com>
> Signed-off-by: Prathyush K <prathyush.k@samsung.com>
> ---
>  drivers/gpu/drm/exynos/exynos_hdmi.c |   35 ++++++++++++++++++++++++++++++++++
>  1 files changed, 35 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c
> index d1a1d71..ee110c9 100644
> --- a/drivers/gpu/drm/exynos/exynos_hdmi.c
> +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
> @@ -34,7 +34,9 @@
>  #include <linux/regulator/consumer.h>
>  #include <linux/io.h>
>  #include <linux/of_gpio.h>
> +#include <linux/of_platform.h>
>  #include <plat/gpio-cfg.h>
> +#include <mach/sysmmu.h>
>
>  #include <drm/exynos_drm.h>
>
> @@ -2275,6 +2277,34 @@ void hdmi_attach_hdmiphy_client(struct i2c_client *hdmiphy)
>  }
>
>  #ifdef CONFIG_OF
> +
> +static int drm_hdmi_dt_init_iommu(struct device *dev)
> +{
> +       struct platform_device *pds;
> +       struct device_node *dn, *dns;
> +       const __be32 *parp;
> +
> +       dn = dev->of_node;
> +       parp = of_get_property(dn, "sysmmu", NULL);
> +       if (parp == NULL) {
> +               dev_err(dev, "failed to find sysmmu property\n");
> +               return -EINVAL;
> +       }
> +       dns = of_find_node_by_phandle(be32_to_cpup(parp));
> +       if (dns == NULL) {
> +               dev_err(dev, "failed to find sysmmu node\n");
> +               return -EINVAL;
> +       }
> +       pds = of_find_device_by_node(dns);
> +       if (pds == NULL) {
> +               dev_err(dev, "failed to find sysmmu platform device\n");
> +               return -EINVAL;
> +       }
> +
> +       platform_set_sysmmu(&pds->dev, dev);
> +       return 0;
> +}
> +

As a part of adding iommu support to FIMD driver, we have to implement
the same function in FIMD driver also, which makes code replication.
So, it would be better to move this function out of this file and put
it in a common drm file so that FIMD also can use it.

Best Wishes,
Leela Krishna Amudala.

>  static struct s5p_hdmi_platform_data *drm_hdmi_dt_parse_pdata
>                                         (struct device *dev)
>  {
> @@ -2294,6 +2324,11 @@ static struct s5p_hdmi_platform_data *drm_hdmi_dt_parse_pdata
>                 goto err_data;
>         }
>
> +       if (drm_hdmi_dt_init_iommu(dev)){
> +               DRM_ERROR("no sysmmu property found\n");
> +               goto err_data;
> +       }
> +
>         pd->hpd_gpio = of_get_named_gpio_flags(np, "hpd-gpio", 0, &flags);
>
>         return pd;
> --
> 1.7.0.4
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] drm: exynos: add iommu support in hdmi driver with dt enabled
@ 2012-11-05  9:02 Rahul Sharma
  2012-11-07  4:17 ` Leela Krishna Amudala
  0 siblings, 1 reply; 6+ messages in thread
From: Rahul Sharma @ 2012-11-05  9:02 UTC (permalink / raw)
  To: dri-devel
  Cc: prathyush.k, sw0312.kim, joshi, kyungmin.park, rahul.sharma,
	prashanth.g, s.shirish

This patch adds iommu support for hdmi driver with device tree based
search. It searches for sysmmu property in hdmi dt node to get tv
iommu device pointer which will be used to configure iommu hw interface.

This patch is based on "exynos-drm-next-iommu" branch at
http://git.kernel.org/?p=linux/kernel/git/daeinki/drm-exynos.git

This patch is having dependency on  linux-samsung-soc patchset named
"add dt based support for iommu for hdmi"

Signed-off-by: Rahul Sharma <rahul.sharma@samsung.com>
Signed-off-by: Prathyush K <prathyush.k@samsung.com>
---
 drivers/gpu/drm/exynos/exynos_hdmi.c |   35 ++++++++++++++++++++++++++++++++++
 1 files changed, 35 insertions(+), 0 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c
index d1a1d71..ee110c9 100644
--- a/drivers/gpu/drm/exynos/exynos_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
@@ -34,7 +34,9 @@
 #include <linux/regulator/consumer.h>
 #include <linux/io.h>
 #include <linux/of_gpio.h>
+#include <linux/of_platform.h>
 #include <plat/gpio-cfg.h>
+#include <mach/sysmmu.h>
 
 #include <drm/exynos_drm.h>
 
@@ -2275,6 +2277,34 @@ void hdmi_attach_hdmiphy_client(struct i2c_client *hdmiphy)
 }
 
 #ifdef CONFIG_OF
+
+static int drm_hdmi_dt_init_iommu(struct device *dev)
+{
+	struct platform_device *pds;
+	struct device_node *dn, *dns;
+	const __be32 *parp;
+
+	dn = dev->of_node;
+	parp = of_get_property(dn, "sysmmu", NULL);
+	if (parp == NULL) {
+		dev_err(dev, "failed to find sysmmu property\n");
+		return -EINVAL;
+	}
+	dns = of_find_node_by_phandle(be32_to_cpup(parp));
+	if (dns == NULL) {
+		dev_err(dev, "failed to find sysmmu node\n");
+		return -EINVAL;
+	}
+	pds = of_find_device_by_node(dns);
+	if (pds == NULL) {
+		dev_err(dev, "failed to find sysmmu platform device\n");
+		return -EINVAL;
+	}
+
+	platform_set_sysmmu(&pds->dev, dev);
+	return 0;
+}
+
 static struct s5p_hdmi_platform_data *drm_hdmi_dt_parse_pdata
 					(struct device *dev)
 {
@@ -2294,6 +2324,11 @@ static struct s5p_hdmi_platform_data *drm_hdmi_dt_parse_pdata
 		goto err_data;
 	}
 
+	if (drm_hdmi_dt_init_iommu(dev)){
+		DRM_ERROR("no sysmmu property found\n");
+		goto err_data;
+	}
+
 	pd->hpd_gpio = of_get_named_gpio_flags(np, "hpd-gpio", 0, &flags);
 
 	return pd;
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-11-07 16:10 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-05 15:18 [PATCH] drm: exynos: add iommu support in hdmi driver with dt enabled Rahul Sharma
  -- strict thread matches above, loose matches on Subject: below --
2012-11-05  9:02 Rahul Sharma
2012-11-07  4:17 ` Leela Krishna Amudala
2012-11-07  9:41   ` Inki Dae
2012-11-07 12:27     ` Rahul Sharma
2012-11-07 16:10       ` Inki Dae

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.