video: rockchip: rga3: adapt to kernel 5.4

Signed-off-by: Yu Qiaowei <cerf.yu@rock-chips.com>
Change-Id: I848573243aaa5a2779575df2ee9dcf7845f2c57b
This commit is contained in:
Yu Qiaowei
2022-03-16 20:37:34 +08:00
committed by Tao Huang
parent 5ca9ca9055
commit b63852bfde
2 changed files with 14 additions and 4 deletions

View File

@@ -13,7 +13,6 @@
#include <linux/debugfs.h>
#include <linux/delay.h>
#include <linux/device.h>
#include <linux/dma-buf-cache.h>
#include <linux/dma-mapping.h>
#include <linux/err.h>
#include <linux/fb.h>
@@ -50,6 +49,12 @@
#include <linux/iova.h>
#include <linux/dma-iommu.h>
#ifdef CONFIG_DMABUF_CACHE
#include <linux/dma-buf-cache.h>
#else
#include <linux/dma-buf.h>
#endif
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0))
#include <linux/dma-map-ops.h>
#endif

View File

@@ -12,6 +12,11 @@
#include "rga_common.h"
#include "rga_job.h"
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0) && \
LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 0)
#include <linux/dma-noncoherent.h>
#endif
/**
* rga_dma_info_to_prot - Translate DMA API directions and attributes to IOMMU API
* page flags.
@@ -358,7 +363,7 @@ static dma_addr_t rga_iommu_dma_alloc_iova(struct iommu_domain *domain,
struct rga_iommu_dma_cookie *cookie = domain->iova_cookie;
struct iova_domain *iovad = &cookie->iovad;
unsigned long shift, iova_len, iova = 0;
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0))
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 0))
dma_addr_t limit;
#endif
@@ -383,7 +388,7 @@ static dma_addr_t rga_iommu_dma_alloc_iova(struct iommu_domain *domain,
if (domain->geometry.force_aperture)
dma_limit = min(dma_limit, (u64)domain->geometry.aperture_end);
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0))
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 0))
iova = alloc_iova_fast(iovad, iova_len, dma_limit >> shift, true);
#else
limit = min_t(dma_addr_t, dma_limit >> shift, iovad->end_pfn);
@@ -416,7 +421,7 @@ static inline size_t rga_iommu_map_sg(struct iommu_domain *domain,
static inline bool rga_dev_is_dma_coherent(struct device *dev)
{
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0))
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 0))
return dev_is_dma_coherent(dev);
#else
return dev->archdata.dma_coherent;