
Use #if IS_ENABLED() instead of #ifdef for configurations as vendor module guidelines. Use #if IS_ENABLED(CONFIG_XXX) instead of #ifdef CONFIG_XXX to ensure that the code inside the #if block continues to compile if the config changes to a tristate config in the future. The differences are as follows: 1.#if IS_ENABLED(CONFIG_XXX) evaluates to true when CONFIG_XXX is set to module (=m) or built-in (=y). 2.#ifdef CONFIG_XXX evaluates to true when CONFIG_XXX is set to built-in(=y) , but doesn't when CONFIG_XXX is set to module(=m). Use this only when you're certain you want to do the same thing when the config is set to module or is disabled. Change-Id: Ia806b9b01ad8414d0e4de027a382cb68e7fb4a6a Signed-off-by: GG Hou <quic_renjhou@quicinc.com>
51 行
1.2 KiB
C
51 行
1.2 KiB
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
/*
|
|
* Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
|
|
* Copyright (c) 2015-2021, The Linux Foundation. All rights reserved.
|
|
*/
|
|
|
|
#ifndef SDE_ROTATOR_SMMU_H
|
|
#define SDE_ROTATOR_SMMU_H
|
|
|
|
#include <linux/types.h>
|
|
#include <linux/device.h>
|
|
#include <linux/dma-buf.h>
|
|
|
|
#include "sde_rotator_io_util.h"
|
|
|
|
enum sde_iommu_domain_type {
|
|
SDE_IOMMU_DOMAIN_ROT_UNSECURE,
|
|
SDE_IOMMU_DOMAIN_ROT_SECURE,
|
|
SDE_IOMMU_MAX_DOMAIN
|
|
};
|
|
|
|
int sde_smmu_init(struct device *dev);
|
|
|
|
static inline int sde_smmu_dma_data_direction(int dir)
|
|
{
|
|
return dir;
|
|
}
|
|
|
|
#if IS_ENABLED(CONFIG_MSM_SDE_ROTATOR)
|
|
int sde_smmu_ctrl(int enable);
|
|
#else
|
|
static inline int sde_smmu_ctrl(int enable)
|
|
{
|
|
return 0;
|
|
}
|
|
#endif /* CONFIG_MSM_SDE_ROTATOR */
|
|
|
|
struct dma_buf_attachment *sde_smmu_dma_buf_attach(
|
|
struct dma_buf *dma_buf, struct device *dev, int domain);
|
|
|
|
int sde_smmu_map_dma_buf(struct dma_buf *dma_buf,
|
|
struct sg_table *table, int domain, dma_addr_t *iova,
|
|
unsigned long *size, int dir);
|
|
|
|
void sde_smmu_unmap_dma_buf(struct sg_table *table, int domain,
|
|
int dir, struct dma_buf *dma_buf);
|
|
|
|
int sde_smmu_secure_ctrl(int enable);
|
|
|
|
#endif /* SDE_ROTATOR_SMMU_H */
|