aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/arm/display/komeda/komeda_dev.c
diff options
context:
space:
mode:
authorLowry Li (Arm Technology China) <Lowry.Li@arm.com>2019-06-06 10:53:05 +0100
committerLiviu Dudau <Liviu.Dudau@arm.com>2019-06-19 11:42:17 +0100
commite87cae37f6006f5cebb2ae2b39daf39be7fc0a27 (patch)
tree0561ff5289d4614ddb4609fbfe1a50fb10916570 /drivers/gpu/drm/arm/display/komeda/komeda_dev.c
parentdrm/komeda: Enable color-encoding (YUV format) support (diff)
downloadlinux-stable-e87cae37f6006f5cebb2ae2b39daf39be7fc0a27.tar.xz
linux-stable-e87cae37f6006f5cebb2ae2b39daf39be7fc0a27.zip
drm/komeda: Adds SMMU support
Adds iommu_connect and disconnect for SMMU support, and configures TBU translation once SMMU has been attached to the display device. Signed-off-by: Lowry Li (Arm Technology China) <lowry.li@arm.com> [fixed checking of error code returned by dp_wait_cond() and removed extraneous DRM_ERROR() calls] Signed-off-by: Liviu Dudau <liviu.dudau@arm.com>
Diffstat (limited to 'drivers/gpu/drm/arm/display/komeda/komeda_dev.c')
-rw-r--r--drivers/gpu/drm/arm/display/komeda/komeda_dev.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_dev.c b/drivers/gpu/drm/arm/display/komeda/komeda_dev.c
index b67030a9f056..7bb5f88db792 100644
--- a/drivers/gpu/drm/arm/display/komeda/komeda_dev.c
+++ b/drivers/gpu/drm/arm/display/komeda/komeda_dev.c
@@ -5,6 +5,7 @@
*
*/
#include <linux/io.h>
+#include <linux/iommu.h>
#include <linux/of_device.h>
#include <linux/of_graph.h>
#include <linux/platform_device.h>
@@ -253,6 +254,18 @@ struct komeda_dev *komeda_dev_create(struct device *dev)
dev->dma_parms = &mdev->dma_parms;
dma_set_max_seg_size(dev, DMA_BIT_MASK(32));
+ mdev->iommu = iommu_get_domain_for_dev(mdev->dev);
+ if (!mdev->iommu)
+ DRM_INFO("continue without IOMMU support!\n");
+
+ if (mdev->iommu && mdev->funcs->connect_iommu) {
+ err = mdev->funcs->connect_iommu(mdev);
+ if (err) {
+ mdev->iommu = NULL;
+ goto err_cleanup;
+ }
+ }
+
err = sysfs_create_group(&dev->kobj, &komeda_sysfs_attr_group);
if (err) {
DRM_ERROR("create sysfs group failed.\n");
@@ -282,6 +295,10 @@ void komeda_dev_destroy(struct komeda_dev *mdev)
debugfs_remove_recursive(mdev->debugfs_root);
#endif
+ if (mdev->iommu && mdev->funcs->disconnect_iommu)
+ mdev->funcs->disconnect_iommu(mdev);
+ mdev->iommu = NULL;
+
for (i = 0; i < mdev->n_pipelines; i++) {
komeda_pipeline_destroy(mdev, mdev->pipelines[i]);
mdev->pipelines[i] = NULL;