From: Inki Dae <daeinki@gmail.com>
To: airlied@linux.ie, dri-devel@lists.freedesktop.org
Cc: kyungmin.park@samsung.com, sw0312.kim@samsung.com
Subject: [PATCH 3/3] drm/exynos: add iommu support for hdmi driver
Date: Sat, 20 Oct 2012 09:18:51 -0700 [thread overview]
Message-ID: <1350749931-9232-4-git-send-email-daeinki@gmail.com> (raw)
In-Reply-To: <1350749931-9232-1-git-send-email-daeinki@gmail.com>
From: Inki Dae <inki.dae@samsung.com>
The iommu will be enabled when hdmi sub driver is probed and
will be disabled when removed.
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
drivers/gpu/drm/exynos/exynos_drm_hdmi.c | 15 +++++++++++++++
drivers/gpu/drm/exynos/exynos_drm_hdmi.h | 1 +
drivers/gpu/drm/exynos/exynos_hdmi.c | 21 +++++++++++++++++++++
3 files changed, 37 insertions(+)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_hdmi.c b/drivers/gpu/drm/exynos/exynos_drm_hdmi.c
index 0cb8a8c..997fb6e 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_hdmi.c
@@ -368,9 +368,23 @@ static int hdmi_subdrv_probe(struct drm_device *drm_dev,
ctx->hdmi_ctx->drm_dev = drm_dev;
ctx->mixer_ctx->drm_dev = drm_dev;
+ if (hdmi_ops->iommu_on)
+ hdmi_ops->iommu_on(ctx->hdmi_ctx->ctx, true);
+
return 0;
}
+static void hdmi_subdrv_remove(struct drm_device *drm_dev, struct device *dev)
+{
+ struct drm_hdmi_context *ctx;
+ struct exynos_drm_subdrv *subdrv = to_subdrv(dev);
+
+ ctx = get_ctx_from_subdrv(subdrv);
+
+ if (hdmi_ops->iommu_on)
+ hdmi_ops->iommu_on(ctx->hdmi_ctx->ctx, false);
+}
+
static int __devinit exynos_drm_hdmi_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
@@ -390,6 +404,7 @@ static int __devinit exynos_drm_hdmi_probe(struct platform_device *pdev)
subdrv->dev = dev;
subdrv->manager = &hdmi_manager;
subdrv->probe = hdmi_subdrv_probe;
+ subdrv->remove = hdmi_subdrv_remove;
platform_set_drvdata(pdev, subdrv);
diff --git a/drivers/gpu/drm/exynos/exynos_drm_hdmi.h b/drivers/gpu/drm/exynos/exynos_drm_hdmi.h
index 2da5ffd..5c033d1 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_hdmi.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_hdmi.h
@@ -50,6 +50,7 @@ struct exynos_hdmi_ops {
int (*power_on)(void *ctx, int mode);
/* manager */
+ int (*iommu_on)(void *ctx, bool enable);
void (*mode_fixup)(void *ctx, struct drm_connector *connector,
const struct drm_display_mode *mode,
struct drm_display_mode *adjusted_mode);
diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c
index 2c115f8..d1a1d71 100644
--- a/drivers/gpu/drm/exynos/exynos_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
@@ -40,6 +40,7 @@
#include "exynos_drm_drv.h"
#include "exynos_drm_hdmi.h"
+#include "exynos_drm_iommu.h"
#include "exynos_hdmi.h"
@@ -1946,6 +1947,25 @@ static void hdmi_conf_apply(struct hdmi_context *hdata)
hdmi_regs_dump(hdata, "start");
}
+static int hdmi_iommu_on(void *ctx, bool enable)
+{
+ struct exynos_drm_hdmi_context *drm_hdmi_ctx;
+ struct hdmi_context *hdata = ctx;
+ struct drm_device *drm_dev;
+
+ drm_hdmi_ctx = hdata->parent_ctx;
+ drm_dev = drm_hdmi_ctx->drm_dev;
+
+ if (is_drm_iommu_supported(drm_dev)) {
+ if (enable)
+ return drm_iommu_attach_device(drm_dev, hdata->dev);
+
+ drm_iommu_detach_device(drm_dev, hdata->dev);
+ }
+
+ return 0;
+}
+
static void hdmi_mode_fixup(void *ctx, struct drm_connector *connector,
const struct drm_display_mode *mode,
struct drm_display_mode *adjusted_mode)
@@ -2102,6 +2122,7 @@ static struct exynos_hdmi_ops hdmi_ops = {
.check_timing = hdmi_check_timing,
/* manager */
+ .iommu_on = hdmi_iommu_on,
.mode_fixup = hdmi_mode_fixup,
.mode_set = hdmi_mode_set,
.get_max_resol = hdmi_get_max_resol,
--
1.8.0.rc3.16.g8ead1bf
next prev parent reply other threads:[~2012-10-20 16:19 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-20 16:18 [PATCH 0/3] drm/exynos: add iommu support for -next Inki Dae
2012-10-20 16:18 ` [PATCH 1/3] drm/exynos: add iommu support for exynos drm framework Inki Dae
2012-10-22 7:22 ` [PATCH v2] " Inki Dae
2012-10-22 9:56 ` [PATCH] " Inki Dae
2012-11-05 4:57 ` [PATCH v4] " Inki Dae
2012-10-20 16:18 ` [PATCH 2/3] drm/exynos: add iommu support to fimd driver Inki Dae
2012-10-20 16:18 ` Inki Dae [this message]
2012-12-04 5:56 ` [PATCH v2] drm/exynos: add iommu support for hdmi driver Inki Dae
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1350749931-9232-4-git-send-email-daeinki@gmail.com \
--to=daeinki@gmail.com \
--cc=airlied@linux.ie \
--cc=dri-devel@lists.freedesktop.org \
--cc=kyungmin.park@samsung.com \
--cc=sw0312.kim@samsung.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.