diff options
author | Hyungwon Hwang <human.hwang@samsung.com> | 2015-06-22 13:05:04 +0300 |
---|---|---|
committer | Inki Dae <inki.dae@samsung.com> | 2015-06-22 13:05:46 +0300 |
commit | fc2e013f78c42fdafcb48f4922c2ae6d2c8e7d09 (patch) | |
tree | e906df44bda58b6940586e75bce9eee97f258d8a /drivers/gpu/drm/exynos/exynos_drm_iommu.c | |
parent | 3f46d807f861fb7304c9890fb091efb80161f2c7 (diff) | |
download | linux-fc2e013f78c42fdafcb48f4922c2ae6d2c8e7d09.tar.xz |
drm/exynos: add drm_iommu_attach_device_if_possible()
Every CRTC drivers in Exynos DRM implements the code which checks
whether IOMMU is supported or not, and if supported enable it.
Making new helper for it generalize each CRTC drivers.
Signed-off-by: Hyungwon Hwang <human.hwang@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Diffstat (limited to 'drivers/gpu/drm/exynos/exynos_drm_iommu.c')
-rw-r--r-- | drivers/gpu/drm/exynos/exynos_drm_iommu.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/gpu/drm/exynos/exynos_drm_iommu.c b/drivers/gpu/drm/exynos/exynos_drm_iommu.c index 34596da7be33..d4ec7465e9cc 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_iommu.c +++ b/drivers/gpu/drm/exynos/exynos_drm_iommu.c @@ -144,3 +144,17 @@ void drm_iommu_detach_device(struct drm_device *drm_dev, iommu_detach_device(mapping->domain, subdrv_dev); drm_release_iommu_mapping(drm_dev); } + +int drm_iommu_attach_device_if_possible(struct exynos_drm_crtc *exynos_crtc, + struct drm_device *drm_dev, struct device *subdrv_dev) +{ + int ret = 0; + + if (is_drm_iommu_supported(drm_dev)) { + if (exynos_crtc->ops->clear_channels) + exynos_crtc->ops->clear_channels(exynos_crtc); + return drm_iommu_attach_device(drm_dev, subdrv_dev); + } + + return ret; +} |