cam_compat.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2014-2021, The Linux Foundation. All rights reserved.
  4. * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
  5. */
  6. #ifndef _CAM_COMPAT_H_
  7. #define _CAM_COMPAT_H_
  8. #include <linux/version.h>
  9. #include <linux/platform_device.h>
  10. #include <linux/component.h>
  11. #include <linux/iommu.h>
  12. #include <linux/qcom_scm.h>
  13. #include <linux/list_sort.h>
  14. #include <linux/dma-iommu.h>
  15. #include <soc/qcom/of_common.h>
  16. #include "cam_csiphy_dev.h"
  17. #include "cam_cpastop_hw.h"
  18. #include "cam_smmu_api.h"
  19. #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0)
  20. #include <linux/ion.h>
  21. #include <linux/msm_ion.h>
  22. #define VFL_TYPE_VIDEO VFL_TYPE_GRABBER
  23. #endif
  24. #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0) && \
  25. LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0)
  26. #include <soc/qcom/of_common.h>
  27. #include <linux/qcom-dma-mapping.h>
  28. #endif
  29. struct cam_fw_alloc_info {
  30. struct device *fw_dev;
  31. void *fw_kva;
  32. uint64_t fw_hdl;
  33. };
  34. int cam_reserve_icp_fw(struct cam_fw_alloc_info *icp_fw, size_t fw_length);
  35. void cam_unreserve_icp_fw(struct cam_fw_alloc_info *icp_fw, size_t fw_length);
  36. void cam_cpastop_scm_write(struct cam_cpas_hw_errata_wa *errata_wa);
  37. int cam_ife_notify_safe_lut_scm(bool safe_trigger);
  38. int camera_component_match_add_drivers(struct device *master_dev,
  39. struct component_match **match_list);
  40. int cam_csiphy_notify_secure_mode(struct csiphy_device *csiphy_dev,
  41. bool protect, int32_t offset);
  42. void cam_free_clear(const void *);
  43. void cam_check_iommu_faults(struct iommu_domain *domain,
  44. struct cam_smmu_pf_info *pf_info);
  45. static inline int cam_get_ddr_type(void) { return of_fdt_get_ddrtype(); }
  46. int cam_compat_util_get_dmabuf_va(struct dma_buf *dmabuf, uintptr_t *vaddr);
  47. void cam_compat_util_put_dmabuf_va(struct dma_buf *dmabuf, void *vaddr);
  48. void cam_smmu_util_iommu_custom(struct device *dev,
  49. dma_addr_t discard_start, size_t discard_length);
  50. #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0)
  51. int cam_req_mgr_ordered_list_cmp(void *priv,
  52. const struct list_head *head_1, const struct list_head *head_2);
  53. #else
  54. int cam_req_mgr_ordered_list_cmp(void *priv,
  55. struct list_head *head_1, struct list_head *head_2);
  56. #endif
  57. #endif /* _CAM_COMPAT_H_ */