Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0ebf126e authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: camera: isp: Changes for 8909 O upgrade"

parents c128d06e d5b53069
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -95,6 +95,15 @@ config MSM_EEPROM
          and also provides support for writing data in case of FLASH ROM.
	  Currently supports I2C, CCI and SPI protocol

config MSM_ISP_V1
        bool "QTI MSM Image Signal Processing interface support"
        depends on MSMB_CAMERA
        ---help---
          Enable support for Image Signal Processing interface module.
          This module acts as a crossbar between CSID and VFE. Output
          of any CID of CSID can be routed to of of pixel or raw
          data interface in VFE.

config MSM_ISPIF
        bool "QTI MSM Image Signal Processing interface support"
        depends on MSMB_CAMERA
+7 −2
Original line number Diff line number Diff line
ccflags-y += -Idrivers/media/platform/msm/camera_v2
ccflags-y += -Idrivers/media/platform/msm/camera_v2/sensor/io
ccflags-y += -Idrivers/media/platform/msm/camera_v2/common/
obj-$(CONFIG_MSMB_CAMERA) += msm_buf_mgr.o msm_isp_util.o msm_isp_axi_util.o msm_isp_stats_util.o
obj-$(CONFIG_MSMB_CAMERA) += msm_isp48.o msm_isp47.o msm_isp46.o msm_isp44.o msm_isp40.o msm_isp.o
ifeq ($(CONFIG_MSM_ISP_V1),y)
obj-$(CONFIG_MSMB_CAMERA) += msm_isp_32.o msm_buf_mgr_32.o msm_isp_util_32.o msm_isp_axi_util_32.o msm_isp_stats_util_32.o
obj-$(CONFIG_MSMB_CAMERA) += msm_isp32.o
else
obj-$(CONFIG_MSMB_CAMERA) += msm_isp.o msm_buf_mgr.o msm_isp_util.o msm_isp_axi_util.o msm_isp_stats_util.o
obj-$(CONFIG_MSMB_CAMERA) += msm_isp47.o msm_isp46.o msm_isp44.o msm_isp40.o
endif
+1264 −0

File added.

Preview size limit exceeded, changes collapsed.

+203 −0
Original line number Diff line number Diff line
/* Copyright (c) 2013-2017, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
 * only version 2 as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */

#ifndef _MSM_ISP_BUF_H_
#define _MSM_ISP_BUF_H_

#include <media/msmb_isp.h>
#include <linux/msm_iommu_domains.h>
#include "msm_sd.h"

/* Buffer type could be userspace / HAL.
 * Userspase could provide native or scratch buffer. */
#define BUF_SRC(id) ( \
		(id & ISP_SCRATCH_BUF_BIT) ? MSM_ISP_BUFFER_SRC_SCRATCH : \
		(id & ISP_NATIVE_BUF_BIT) ? MSM_ISP_BUFFER_SRC_NATIVE : \
				MSM_ISP_BUFFER_SRC_HAL)

#define ISP_SHARE_BUF_CLIENT 2
#define BUF_MGR_NUM_BUF_Q 28
#define MAX_IOMMU_CTX 2

struct msm_isp_buf_mgr;

enum msm_isp_buffer_src_t {
	MSM_ISP_BUFFER_SRC_HAL,
	MSM_ISP_BUFFER_SRC_NATIVE,
	MSM_ISP_BUFFER_SRC_SCRATCH,
	MSM_ISP_BUFFER_SRC_MAX,
};

enum msm_isp_buffer_state {
	MSM_ISP_BUFFER_STATE_UNUSED,         /* not used */
	MSM_ISP_BUFFER_STATE_INITIALIZED,    /* REQBUF done */
	MSM_ISP_BUFFER_STATE_PREPARED,       /* BUF mapped */
	MSM_ISP_BUFFER_STATE_QUEUED,         /* buf queued */
	MSM_ISP_BUFFER_STATE_DEQUEUED,       /* in use in VFE */
	MSM_ISP_BUFFER_STATE_DIVERTED,       /* Sent to other hardware*/
	MSM_ISP_BUFFER_STATE_DISPATCHED,     /* Sent to HAL*/
};

enum msm_isp_buffer_flush_t {
	MSM_ISP_BUFFER_FLUSH_DIVERTED,
	MSM_ISP_BUFFER_FLUSH_ALL,
};

enum msm_isp_buf_mgr_state {
	MSM_ISP_BUF_MGR_ATTACH,
	MSM_ISP_BUF_MGR_DETACH,
};

struct msm_isp_buffer_mapped_info {
	unsigned long len;
	dma_addr_t paddr;
	struct ion_handle *handle;
};

struct buffer_cmd {
	struct list_head list;
	struct msm_isp_buffer_mapped_info *mapped_info;
};

struct msm_isp_buffer {
	/*Common Data structure*/
	int num_planes;
	struct msm_isp_buffer_mapped_info mapped_info[VIDEO_MAX_PLANES];
	int buf_idx;
	uint32_t bufq_handle;
	uint32_t frame_id;
	struct timeval *tv;

	/*Native buffer*/
	struct list_head list;
	enum msm_isp_buffer_state state;

	/*Vb2 buffer data*/
	struct vb2_buffer *vb2_buf;

	/*Share buffer cache state*/
	struct list_head share_list;
	uint8_t buf_used[ISP_SHARE_BUF_CLIENT];
	uint8_t buf_get_count;
	uint8_t buf_put_count;
	uint8_t buf_reuse_flag;
};

struct msm_isp_bufq {
	uint32_t session_id;
	uint32_t stream_id;
	uint32_t num_bufs;
	uint32_t bufq_handle;
	enum msm_isp_buf_type buf_type;
	struct msm_isp_buffer *bufs;
	spinlock_t bufq_lock;

	/*Native buffer queue*/
	struct list_head head;
	/*Share buffer cache queue*/
	struct list_head share_head;
	uint8_t buf_client_count;
};

struct msm_isp_buf_ops {
	int (*request_buf)(struct msm_isp_buf_mgr *buf_mgr,
		struct msm_isp_buf_request *buf_request);

	int (*enqueue_buf)(struct msm_isp_buf_mgr *buf_mgr,
		struct msm_isp_qbuf_info *info);

	int (*release_buf)(struct msm_isp_buf_mgr *buf_mgr,
		uint32_t bufq_handle);

	int (*get_bufq_handle)(struct msm_isp_buf_mgr *buf_mgr,
		uint32_t session_id, uint32_t stream_id);

	int (*get_buf_src)(struct msm_isp_buf_mgr *buf_mgr,
		uint32_t bufq_handle, uint32_t *buf_src);

	int (*get_buf)(struct msm_isp_buf_mgr *buf_mgr, uint32_t id,
		uint32_t bufq_handle, struct msm_isp_buffer **buf_info);

	int (*get_buf_by_index)(struct msm_isp_buf_mgr *buf_mgr,
		uint32_t bufq_handle, uint32_t buf_index,
		struct msm_isp_buffer **buf_info);

	int (*put_buf)(struct msm_isp_buf_mgr *buf_mgr,
		uint32_t bufq_handle, uint32_t buf_index);

	int (*flush_buf)(struct msm_isp_buf_mgr *buf_mgr,
		uint32_t bufq_handle, enum msm_isp_buffer_flush_t flush_type);

	int (*buf_done)(struct msm_isp_buf_mgr *buf_mgr,
		uint32_t bufq_handle, uint32_t buf_index,
		struct timeval *tv, uint32_t frame_id, uint32_t output_format);
	int (*buf_divert)(struct msm_isp_buf_mgr *buf_mgr,
		uint32_t bufq_handle, uint32_t buf_index,
		struct timeval *tv, uint32_t frame_id);
	void (*register_ctx)(struct msm_isp_buf_mgr *buf_mgr,
		struct device **iommu_ctx1, struct device **iommu_ctx2,
		int num_iommu_ctx1, int num_iommu_ctx2);
	int (*buf_mgr_init)(struct msm_isp_buf_mgr *buf_mgr,
		const char *ctx_name, uint16_t num_buf_q);
	int (*buf_mgr_deinit)(struct msm_isp_buf_mgr *buf_mgr);
	int (*buf_mgr_debug)(struct msm_isp_buf_mgr *buf_mgr);
	struct msm_isp_bufq * (*get_bufq)(struct msm_isp_buf_mgr *buf_mgr,
		uint32_t bufq_handle);
};

struct msm_isp_buf_mgr {
	int init_done;
	uint32_t open_count;
	uint32_t pagefault_debug;
	spinlock_t lock;
	uint16_t num_buf_q;
	struct msm_isp_bufq *bufq;

	struct ion_client *client;
	struct msm_isp_buf_ops *ops;
	uint32_t buf_handle_cnt;

	struct msm_sd_req_vb2_q *vb2_ops;

	/*IOMMU specific*/
	int iommu_domain_num;
	struct iommu_domain *iommu_domain;

	/*Add secure domain num and domain */
	int iommu_domain_num_secure;
	struct iommu_domain *iommu_domain_secure;

	/*Add secure mode*/
	int secure_enable;

	int num_iommu_ctx;
	struct device *iommu_ctx[2];
	struct list_head buffer_q;
	int num_iommu_secure_ctx;
	struct device *iommu_secure_ctx[2];
	int attach_ref_cnt[MAX_PROTECTION_MODE][MAX_IOMMU_CTX];
	enum msm_isp_buf_mgr_state attach_state;
};

int msm_isp_create_isp_buf_mgr(struct msm_isp_buf_mgr *buf_mgr,
	struct msm_sd_req_vb2_q *vb2_ops, struct msm_iova_layout *iova_layout);

int msm_isp_proc_buf_cmd(struct msm_isp_buf_mgr *buf_mgr,
	unsigned int cmd, void *arg);

int msm_isp_create_secure_domain(struct msm_isp_buf_mgr *buf_mgr,
	struct msm_iova_layout *iova_layout);

int msm_isp_smmu_attach(struct msm_isp_buf_mgr *buf_mgr,
	void *arg);

#endif /* _MSM_ISP_BUF_H_ */
+293 −192

File changed.

Preview size limit exceeded, changes collapsed.

Loading