1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Copyright (C) 2023 VeriSilicon Holdings Co., Ltd.
9 #include <linux/module.h>
10 #include <linux/platform_device.h>
11 #include <linux/version.h>
12 #include <drm/drm_drv.h>
13 #include <drm/drm_gem.h>
17 * @dma_dev: device for DMA API.
18 * - use the first attached device if support iommu
19 else use drm device (only contiguous buffer support)
20 * @domain: iommu domain for DRM.
21 * - all DC IOMMU share same domain to reduce mapping
22 * @pitch_alignment: buffer pitch alignment required by sub-devices.
25 struct vs_drm_private {
26 struct device *dma_dev;
27 struct iommu_domain *domain;
28 unsigned int pitch_alignment;
31 void vs_drm_update_pitch_alignment(struct drm_device *drm_dev,
32 unsigned int alignment);
34 static inline struct device *to_dma_dev(struct drm_device *dev)
36 struct vs_drm_private *priv = dev->dev_private;
41 static inline bool is_iommu_enabled(struct drm_device *dev)
43 struct vs_drm_private *priv = dev->dev_private;
45 return priv->domain ? true : false;
48 #endif /* __VS_DRV_H__ */