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

Commit 9c3cc19b authored by Jeyaprakash Soundrapandian's avatar Jeyaprakash Soundrapandian Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: camera: Code cleanup across KMD drivers" into dev/msm-4.9-camx

parents 9c2abd25 7a431b72
Loading
Loading
Loading
Loading
+12 −12
Original line number Diff line number Diff line
@@ -537,8 +537,7 @@ int32_t cam_context_flush_ctx_to_hw(struct cam_context *ctx)
					CAM_ERR(CAM_CTXT,
					"Req: %llu already signalled, sync_id:%d",
					req->request_id,
						req->out_map_entries[i].
						sync_id);
					req->out_map_entries[i].sync_id);
					break;
				}
			}
@@ -629,6 +628,7 @@ int32_t cam_context_flush_req_to_hw(struct cam_context *ctx,
	struct cam_ctx_request *req = NULL;
	struct cam_hw_flush_args flush_args;
	uint32_t i;
	int32_t sync_id = 0;
	int rc = 0;

	CAM_DBG(CAM_CTXT, "[%s] E: NRT flush req", ctx->dev_name);
@@ -683,20 +683,20 @@ int32_t cam_context_flush_req_to_hw(struct cam_context *ctx,

	if (req) {
		if (flush_args.num_req_pending || flush_args.num_req_active) {
			for (i = 0; i < req->num_out_map_entries; i++)
				if (req->out_map_entries[i].sync_id != -1) {
					rc = cam_sync_signal(
						req->out_map_entries[i].sync_id,
			for (i = 0; i < req->num_out_map_entries; i++) {
				sync_id =
					req->out_map_entries[i].sync_id;
				if (sync_id != -1) {
					rc = cam_sync_signal(sync_id,
						CAM_SYNC_STATE_SIGNALED_ERROR);
					if (rc == -EALREADY) {
						CAM_ERR(CAM_CTXT,
						"Req: %llu already signalled, sync_id:%d",
							req->request_id,
							req->out_map_entries[i].
							sync_id);
						req->request_id, sync_id);
						break;
					}
				}
			}
			if (flush_args.num_req_active) {
				spin_lock(&ctx->lock);
				list_add_tail(&req->list, &ctx->free_req_list);
+2 −2
Original line number Diff line number Diff line
@@ -261,8 +261,8 @@ enum bps_io_images {
};

struct frame_buffer {
	uint32_t buffer_ptr[MAX_NUM_OF_IMAGE_PLANES];
	uint32_t meta_buffer_ptr[MAX_NUM_OF_IMAGE_PLANES];
	uint32_t buf_ptr[MAX_NUM_OF_IMAGE_PLANES];
	uint32_t meta_buf_ptr[MAX_NUM_OF_IMAGE_PLANES];
} __packed;

struct bps_frame_process_data {
+13 −14
Original line number Diff line number Diff line
@@ -308,8 +308,9 @@ static int32_t cam_icp_deinit_idle_clk(void *priv, void *data)
		ctx_data = &hw_mgr->ctx_data[i];
		mutex_lock(&ctx_data->ctx_mutex);
		if ((ctx_data->state == CAM_ICP_CTX_STATE_ACQUIRED) &&
			(ICP_DEV_TYPE_TO_CLK_TYPE(ctx_data->
			icp_dev_acquire_info->dev_type) == clk_info->hw_type)) {
			(ICP_DEV_TYPE_TO_CLK_TYPE(
			ctx_data->icp_dev_acquire_info->dev_type)
			== clk_info->hw_type)) {
			busy = cam_icp_frame_pending(ctx_data);
			if (busy) {
				mutex_unlock(&ctx_data->ctx_mutex);
@@ -2994,6 +2995,8 @@ static int cam_icp_mgr_process_cmd_desc(struct cam_icp_hw_mgr *hw_mgr,
	uint64_t cpu_addr = 0;
	struct ipe_frame_process_data *frame_process_data = NULL;
	struct bps_frame_process_data *bps_frame_process_data = NULL;
	struct frame_set *ipe_set = NULL;
	struct frame_buffer *bps_bufs = NULL;

	cmd_desc = (struct cam_cmd_buf_desc *)
		((uint32_t *) &packet->payload + packet->cmd_buf_offset/4);
@@ -3042,14 +3045,11 @@ static int cam_icp_mgr_process_cmd_desc(struct cam_icp_hw_mgr *hw_mgr,
		frame_process_data->cdm_buffer_addr = 0;
		frame_process_data->cdm_prog_base = 0;
		for (i = 0; i < frame_process_data->frames_in_batch; i++) {
			ipe_set = &frame_process_data->framesets[i];
			for (j = 0; j < IPE_IO_IMAGES_MAX; j++) {
				for (k = 0; k < MAX_NUM_OF_IMAGE_PLANES; k++) {
					frame_process_data->
					framesets[i].buffers[j].
					buffer_ptr[k] = 0;
					frame_process_data->
					framesets[i].buffers[j].
					meta_buffer_ptr[k] = 0;
					ipe_set->buffers[j].buf_ptr[k] = 0;
					ipe_set->buffers[j].meta_buf_ptr[k] = 0;
				}
			}
		}
@@ -3066,11 +3066,10 @@ static int cam_icp_mgr_process_cmd_desc(struct cam_icp_hw_mgr *hw_mgr,
		bps_frame_process_data->strip_lib_out_addr = 0;
		bps_frame_process_data->cdm_prog_addr = 0;
		for (i = 0; i < BPS_IO_IMAGES_MAX; i++) {
			bps_bufs = &bps_frame_process_data->buffers[i];
			for (j = 0; j < MAX_NUM_OF_IMAGE_PLANES; j++) {
				bps_frame_process_data->
				buffers[i].buffer_ptr[j] = 0;
				bps_frame_process_data->
				buffers[i].meta_buffer_ptr[j] = 0;
				bps_bufs->buf_ptr[j] = 0;
				bps_bufs->meta_buf_ptr[j] = 0;
			}
		}
	}
@@ -4028,8 +4027,8 @@ static int cam_icp_mgr_alloc_devs(struct device_node *of_node)
		CAM_ERR(CAM_ICP, "read num bps devices failed");
		goto num_bps_failed;
	}
	icp_hw_mgr.devices[CAM_ICP_DEV_BPS] = kzalloc(
		sizeof(struct cam_hw_intf *) * num_dev, GFP_KERNEL);
	icp_hw_mgr.devices[CAM_ICP_DEV_BPS] = kcalloc(num_dev,
		sizeof(struct cam_hw_intf *), GFP_KERNEL);
	if (!icp_hw_mgr.devices[CAM_ICP_DEV_BPS]) {
		rc = -ENOMEM;
		goto num_bps_failed;
+16 −15
Original line number Diff line number Diff line
@@ -786,6 +786,7 @@ static int __cam_isp_ctx_handle_error(struct cam_isp_context *ctx_isp,
	struct cam_isp_ctx_req          *req_isp = NULL;
	struct cam_req_mgr_error_notify  notify;
	uint64_t                         error_request_id;
	struct cam_hw_fence_map_entry   *fence_map_out = NULL;

	struct cam_context *ctx = ctx_isp->base;
	struct cam_isp_hw_error_event_data  *error_event_data =
@@ -814,18 +815,18 @@ static int __cam_isp_ctx_handle_error(struct cam_isp_context *ctx_isp,
			if (!req_isp->bubble_report) {
				for (i = 0; i < req_isp->num_fence_map_out;
					i++) {
					fence_map_out =
						&req_isp->fence_map_out[i];
					CAM_ERR(CAM_ISP, "req %llu, Sync fd %x",
					req->request_id,
						req_isp->fence_map_out[i].
						sync_id);
					req_isp->fence_map_out[i].sync_id);
					if (req_isp->fence_map_out[i].sync_id
						!= -1) {
						rc = cam_sync_signal(
						req_isp->fence_map_out[i].
						sync_id,
						fence_map_out->sync_id,
						CAM_SYNC_STATE_SIGNALED_ERROR);
						req_isp->fence_map_out[i].
						sync_id = -1;
						fence_map_out->sync_id =
						-1;
					}
				}
				list_del_init(&req->list);
@@ -2390,16 +2391,16 @@ static int __cam_isp_ctx_apply_req(struct cam_context *ctx,
	struct cam_req_mgr_apply_request *apply)
{
	int rc = 0;
	struct cam_ctx_ops *ctx_ops = NULL;
	struct cam_isp_context *ctx_isp =
		(struct cam_isp_context *) ctx->ctx_priv;

	trace_cam_apply_req("ISP", apply->request_id);
	CAM_DBG(CAM_ISP, "Enter: apply req in Substate %d request _id:%lld",
		 ctx_isp->substate_activated, apply->request_id);
	if (ctx_isp->substate_machine[ctx_isp->substate_activated].
		crm_ops.apply_req) {
		rc = ctx_isp->substate_machine[ctx_isp->substate_activated].
			crm_ops.apply_req(ctx, apply);
	ctx_ops = &ctx_isp->substate_machine[ctx_isp->substate_activated];
	if (ctx_ops->crm_ops.apply_req) {
		rc = ctx_ops->crm_ops.apply_req(ctx, apply);
	} else {
		CAM_ERR_RATE_LIMIT(CAM_ISP,
			"No handle function in activated substate %d",
@@ -2420,6 +2421,7 @@ static int __cam_isp_ctx_handle_irq_in_activated(void *context,
	uint32_t evt_id, void *evt_data)
{
	int rc = 0;
	struct cam_isp_ctx_irq_ops *irq_ops = NULL;
	struct cam_context *ctx = (struct cam_context *)context;
	struct cam_isp_context *ctx_isp =
		(struct cam_isp_context *)ctx->ctx_priv;
@@ -2431,10 +2433,9 @@ static int __cam_isp_ctx_handle_irq_in_activated(void *context,

	CAM_DBG(CAM_ISP, "Enter: State %d, Substate %d, evt id %d",
		 ctx->state, ctx_isp->substate_activated, evt_id);
	if (ctx_isp->substate_machine_irq[ctx_isp->substate_activated].
		irq_ops[evt_id]) {
		rc = ctx_isp->substate_machine_irq[ctx_isp->substate_activated].
			irq_ops[evt_id](ctx_isp, evt_data);
	irq_ops = &ctx_isp->substate_machine_irq[ctx_isp->substate_activated];
	if (irq_ops->irq_ops[evt_id]) {
		rc = irq_ops->irq_ops[evt_id](ctx_isp, evt_data);
	} else {
		CAM_DBG(CAM_ISP, "No handle function for substate %d",
			ctx_isp->substate_activated);
+5 −2
Original line number Diff line number Diff line
@@ -4031,6 +4031,8 @@ int cam_ife_hw_mgr_init(struct cam_hw_mgr_intf *hw_mgr_intf)
	int rc = -EFAULT;
	int i, j;
	struct cam_iommu_handle cdm_handles;
	struct cam_ife_hw_mgr_ctx *ctx_pool;
	struct cam_ife_hw_mgr_res *res_list_ife_out;

	CAM_DBG(CAM_ISP, "Enter");

@@ -4135,9 +4137,10 @@ int cam_ife_hw_mgr_init(struct cam_hw_mgr_intf *hw_mgr_intf)
		INIT_LIST_HEAD(&g_ife_hw_mgr.ctx_pool[i].res_list_ife_cid);
		INIT_LIST_HEAD(&g_ife_hw_mgr.ctx_pool[i].res_list_ife_csid);
		INIT_LIST_HEAD(&g_ife_hw_mgr.ctx_pool[i].res_list_ife_src);
		ctx_pool = &g_ife_hw_mgr.ctx_pool[i];
		for (j = 0; j < CAM_IFE_HW_OUT_RES_MAX; j++) {
			INIT_LIST_HEAD(&g_ife_hw_mgr.ctx_pool[i].
				res_list_ife_out[j].list);
			res_list_ife_out = &ctx_pool->res_list_ife_out[j];
			INIT_LIST_HEAD(&res_list_ife_out->list);
		}

		/* init context pool */
Loading