<br><br><div class="gmail_quote">2012/11/7 Rahul Sharma <span dir="ltr"><<a href="mailto:r.sh.open@gmail.com" target="_blank">r.sh.open@gmail.com</a>></span><br><blockquote style="margin:0px 0px 0px 0.8ex;padding-left:1ex;border-left-color:rgb(204,204,204);border-left-width:1px;border-left-style:solid" class="gmail_quote">
<div class="HOEnZb"><div class="h5">On Wed, Nov 7, 2012 at 3:11 PM, Inki Dae <<a href="mailto:inki.dae@samsung.com">inki.dae@samsung.com</a>> wrote:<br>
><br>
><br>
> 2012/11/7 Leela Krishna Amudala <<a href="mailto:l.krishna@samsung.com">l.krishna@samsung.com</a>><br>
>><br>
>> Hello Rahul,<br>
>><br>
>> On Mon, Nov 5, 2012 at 2:32 PM, Rahul Sharma <<a href="mailto:rahul.sharma@samsung.com">rahul.sharma@samsung.com</a>><br>
>> wrote:<br>
>> > This patch adds iommu support for hdmi driver with device tree based<br>
>> > search. It searches for sysmmu property in hdmi dt node to get tv<br>
>> > iommu device pointer which will be used to configure iommu hw interface.<br>
>> ><br>
>> > This patch is based on "exynos-drm-next-iommu" branch at<br>
>> > <a href="http://git.kernel.org/?p=linux/kernel/git/daeinki/drm-exynos.git" target="_blank">http://git.kernel.org/?p=linux/kernel/git/daeinki/drm-exynos.git</a><br>
>> ><br>
>> > This patch is having dependency on  linux-samsung-soc patchset named<br>
>> > "add dt based support for iommu for hdmi"<br>
>> ><br>
>> > Signed-off-by: Rahul Sharma <<a href="mailto:rahul.sharma@samsung.com">rahul.sharma@samsung.com</a>><br>
>> > Signed-off-by: Prathyush K <<a href="mailto:prathyush.k@samsung.com">prathyush.k@samsung.com</a>><br>
>> > ---<br>
>> >  drivers/gpu/drm/exynos/exynos_hdmi.c |   35<br>
>> > ++++++++++++++++++++++++++++++++++<br>
>> >  1 files changed, 35 insertions(+), 0 deletions(-)<br>
>> ><br>
>> > diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c<br>
>> > b/drivers/gpu/drm/exynos/exynos_hdmi.c<br>
>> > index d1a1d71..ee110c9 100644<br>
>> > --- a/drivers/gpu/drm/exynos/exynos_hdmi.c<br>
>> > +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c<br>
>> > @@ -34,7 +34,9 @@<br>
>> >  #include <linux/regulator/consumer.h><br>
>> >  #include <linux/io.h><br>
>> >  #include <linux/of_gpio.h><br>
>> > +#include <linux/of_platform.h><br>
>> >  #include <plat/gpio-cfg.h><br>
>> > +#include <mach/sysmmu.h><br>
>> ><br>
>> >  #include <drm/exynos_drm.h><br>
>> ><br>
>> > @@ -2275,6 +2277,34 @@ void hdmi_attach_hdmiphy_client(struct i2c_client<br>
>> > *hdmiphy)<br>
>> >  }<br>
>> ><br>
>> >  #ifdef CONFIG_OF<br>
>> > +<br>
>> > +static int drm_hdmi_dt_init_iommu(struct device *dev)<br>
>> > +{<br>
>> > +       struct platform_device *pds;<br>
>> > +       struct device_node *dn, *dns;<br>
>> > +       const __be32 *parp;<br>
>> > +<br>
>> > +       dn = dev->of_node;<br>
>> > +       parp = of_get_property(dn, "sysmmu", NULL);<br>
>> > +       if (parp == NULL) {<br>
>> > +               dev_err(dev, "failed to find sysmmu property\n");<br>
>> > +               return -EINVAL;<br>
>> > +       }<br>
>> > +       dns = of_find_node_by_phandle(be32_to_cpup(parp));<br>
>> > +       if (dns == NULL) {<br>
>> > +               dev_err(dev, "failed to find sysmmu node\n");<br>
>> > +               return -EINVAL;<br>
>> > +       }<br>
>> > +       pds = of_find_device_by_node(dns);<br>
>> > +       if (pds == NULL) {<br>
>> > +               dev_err(dev, "failed to find sysmmu platform device\n");<br>
>> > +               return -EINVAL;<br>
>> > +       }<br>
>> > +<br>
>> > +       platform_set_sysmmu(&pds->dev, dev);<br>
>> > +       return 0;<br>
>> > +}<br>
>> > +<br>
>><br>
>> As a part of adding iommu support to FIMD driver, we have to implement<br>
>> the same function in FIMD driver also, which makes code replication.<br>
>> So, it would be better to move this function out of this file and put<br>
>> it in a common drm file so that FIMD also can use it.<br>
>><br>
><br>
> I tend to agree with you but I think it's better to move it into<br>
> drivers/iommu/exynos-iommu.c because IOMMU units could be used by device<br>
> driver based on not only DRM but also V4L2.<br>
><br>
> Thanks,<br>
> Inki Dae<br>
><br>
<br>
</div></div>Mr Dae,<br>
<br>
Do you mean, we should export this function from<br>
drivers/iommu/exynos-iommu.c? How<br>
can I add it there ? To me it looks very much iommu client specific<br>
code as it is tryng to parse<br>
its DT node for "sysmmu" property.<br></blockquote><div> </div><div>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.</div>
<div> </div><blockquote style="margin:0px 0px 0px 0.8ex;padding-left:1ex;border-left-color:rgb(204,204,204);border-left-width:1px;border-left-style:solid" class="gmail_quote">
<br>
I was thinking of putting it into exynos_drm_iommu.c which is visible<br>
to hdmi and fimd both.<br>
<br>
regards,<br>
Rahul Sharma<br>
<div class="HOEnZb"><div class="h5"><br>
>><br>
>> Best Wishes,<br>
>> Leela Krishna Amudala.<br>
>><br>
>><br>
>> >  static struct s5p_hdmi_platform_data *drm_hdmi_dt_parse_pdata<br>
>> >                                         (struct device *dev)<br>
>> >  {<br>
>> > @@ -2294,6 +2324,11 @@ static struct s5p_hdmi_platform_data<br>
>> > *drm_hdmi_dt_parse_pdata<br>
>> >                 goto err_data;<br>
>> >         }<br>
>> ><br>
>> > +       if (drm_hdmi_dt_init_iommu(dev)){<br>
>> > +               DRM_ERROR("no sysmmu property found\n");<br>
>> > +               goto err_data;<br>
>> > +       }<br>
>> > +<br>
>> >         pd->hpd_gpio = of_get_named_gpio_flags(np, "hpd-gpio", 0,<br>
>> > &flags);<br>
>> ><br>
>> >         return pd;<br>
>> > --<br>
>> > 1.7.0.4<br>
>> ><br>
>> > _______________________________________________<br>
>> > dri-devel mailing list<br>
>> > <a href="mailto:dri-devel@lists.freedesktop.org">dri-devel@lists.freedesktop.org</a><br>
>> > <a href="http://lists.freedesktop.org/mailman/listinfo/dri-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/dri-devel</a><br>
>> _______________________________________________<br>
>> dri-devel mailing list<br>
>> <a href="mailto:dri-devel@lists.freedesktop.org">dri-devel@lists.freedesktop.org</a><br>
>> <a href="http://lists.freedesktop.org/mailman/listinfo/dri-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/dri-devel</a><br>
><br>
><br>
><br>
> _______________________________________________<br>
> dri-devel mailing list<br>
> <a href="mailto:dri-devel@lists.freedesktop.org">dri-devel@lists.freedesktop.org</a><br>
> <a href="http://lists.freedesktop.org/mailman/listinfo/dri-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/dri-devel</a><br>
><br>
_______________________________________________<br>
dri-devel mailing list<br>
<a href="mailto:dri-devel@lists.freedesktop.org">dri-devel@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/dri-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/dri-devel</a><br>
</div></div></blockquote></div><br>