cam_compat.h 2.0 KB

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