浏览代码

Merge "msm: camera: common: memory api for presil hw access" into camera-kernel.lnx.5.0

Camera Software Integration 4 年之前
父节点
当前提交
8a032188a5
共有 3 个文件被更改,包括 59 次插入1 次删除
  1. 26 0
      drivers/cam_req_mgr/cam_mem_mgr.c
  2. 23 0
      drivers/cam_req_mgr/cam_mem_mgr.h
  3. 10 1
      drivers/cam_req_mgr/cam_mem_mgr_api.h

+ 26 - 0
drivers/cam_req_mgr/cam_mem_mgr.c

@@ -1782,3 +1782,29 @@ int cam_mem_mgr_free_memory_region(struct cam_mem_mgr_memory_desc *inp)
 	return rc;
 }
 EXPORT_SYMBOL(cam_mem_mgr_free_memory_region);
+
+#ifndef CONFIG_CAM_PRESIL
+
+struct dma_buf * cam_mem_mgr_get_dma_buf(int fd)
+{
+	return NULL;
+}
+
+int cam_mem_mgr_send_all_buffers_to_presil(int32_t iommu_hdl)
+{
+       return 0;
+}
+
+int cam_mem_mgr_send_buffer_to_presil(int32_t iommu_hdl, int32_t buf_handle)
+{
+	return 0;
+}
+
+int cam_mem_mgr_retrieve_buffer_from_presil(int32_t buf_handle,
+	uint32_t buf_size,
+	uint32_t offset,
+	int32_t iommu_hdl)
+{
+	return 0;
+}
+#endif

+ 23 - 0
drivers/cam_req_mgr/cam_mem_mgr.h

@@ -152,4 +152,27 @@ int cam_mem_mgr_init(void);
  */
 void cam_mem_mgr_deinit(void);
 
+/**
+ * @brief: Copy buffer content to presil mem for all buffers of
+ *       iommu handle
+ *
+ * @return Status of operation. Negative in case of error. Zero otherwise.
+ */
+int cam_mem_mgr_send_all_buffers_to_presil(int32_t iommu_hdl);
+
+/**
+ * @brief: Copy buffer content of single buffer to presil
+ *
+ * @return Status of operation. Negative in case of error. Zero otherwise.
+ */
+int cam_mem_mgr_send_buffer_to_presil(int32_t iommu_hdl, int32_t buf_handle);
+
+/**
+ * @brief: Copy back buffer content of single buffer from
+ *       presil
+ *
+ * @return Status of operation. Negative in case of error. Zero otherwise.
+ */
+int cam_mem_mgr_retrieve_buffer_from_presil(int32_t buf_handle,
+	uint32_t buf_size, uint32_t offset, int32_t iommu_hdl);
 #endif /* _CAM_MEM_MGR_H_ */

+ 10 - 1
drivers/cam_req_mgr/cam_mem_mgr_api.h

@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 /*
- * Copyright (c) 2016-2020, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2016-2021, The Linux Foundation. All rights reserved.
  */
 
 #ifndef _CAM_MEM_MGR_API_H_
@@ -116,4 +116,13 @@ int cam_mem_mgr_reserve_memory_region(struct cam_mem_mgr_request_desc *inp,
  */
 int cam_mem_mgr_free_memory_region(struct cam_mem_mgr_memory_desc *inp);
 
+/**
+ * @brief: Translate fd into dmabuf
+ *
+ * @inp   : fd for buffer
+ *
+ * @return dmabuf .
+ */
+struct dma_buf * cam_mem_mgr_get_dma_buf(int fd);
+
 #endif /* _CAM_MEM_MGR_API_H_ */