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

Commit dcea17e2 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: Add new spectra camera changes"

parents 1fc185ff d44621fe
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -120,7 +120,7 @@ int cam_virtual_cdm_submit_bl(struct cam_hw_info *cdm_hw,
			(len >= cdm_cmd->cmd[i].offset)) {


			if ((len - cdm_cmd->cmd[i].offset) <=
			if ((len - cdm_cmd->cmd[i].offset) <
				cdm_cmd->cmd[i].len) {
				CAM_ERR(CAM_CDM, "Not enough buffer");
				rc = -EINVAL;
+46 −6
Original line number Diff line number Diff line
@@ -2472,7 +2472,7 @@ static int cam_icp_mgr_abort_handle(
	int rc = 0;
	unsigned long rem_jiffies;
	size_t packet_size;
	int timeout = 100;
	int timeout = 1000;
	struct hfi_cmd_ipebps_async *abort_cmd;

	packet_size =
@@ -2523,7 +2523,7 @@ static int cam_icp_mgr_destroy_handle(
	struct cam_icp_hw_ctx_data *ctx_data)
{
	int rc = 0;
	int timeout = 100;
	int timeout = 1000;
	unsigned long rem_jiffies;
	size_t packet_size;
	struct hfi_cmd_ipebps_async *destroy_cmd;
@@ -3337,12 +3337,32 @@ static int cam_icp_mgr_pkt_validation(struct cam_packet *packet)
	return 0;
}

static int cam_icp_mgr_put_cmd_buf(struct cam_packet *packet)
{
	int i = 0;
	struct cam_cmd_buf_desc *cmd_desc = NULL;

	cmd_desc = (struct cam_cmd_buf_desc *)
		((uint32_t *) &packet->payload + packet->cmd_buf_offset/4);

	for (i = 0; i < packet->num_cmd_buf; i++) {
		if (cmd_desc[i].type == CAM_CMD_BUF_FW) {
			if (cam_mem_put_cpu_buf(cmd_desc[i].mem_handle))
				CAM_WARN(CAM_ICP, "put cmd buf failed: 0x%x",
					cmd_desc[i].mem_handle);
		}
	}

	return 0;
}

static int cam_icp_mgr_process_cmd_desc(struct cam_icp_hw_mgr *hw_mgr,
	struct cam_packet *packet, struct cam_icp_hw_ctx_data *ctx_data,
	uint32_t *fw_cmd_buf_iova_addr)
{
	int rc = 0;
	int i, j, k;
	int num_cmd_buf = 0;
	uint64_t addr;
	size_t len;
	struct cam_cmd_buf_desc *cmd_desc = NULL;
@@ -3356,25 +3376,32 @@ static int cam_icp_mgr_process_cmd_desc(struct cam_icp_hw_mgr *hw_mgr,
		((uint32_t *) &packet->payload + packet->cmd_buf_offset/4);

	*fw_cmd_buf_iova_addr = 0;
	for (i = 0; i < packet->num_cmd_buf; i++) {
	for (i = 0; i < packet->num_cmd_buf; i++, num_cmd_buf++) {
		if (cmd_desc[i].type == CAM_CMD_BUF_FW) {
			rc = cam_mem_get_io_buf(cmd_desc[i].mem_handle,
				hw_mgr->iommu_hdl, &addr, &len);
			if (rc) {
				CAM_ERR(CAM_ICP, "get cmd buf failed %x",
					hw_mgr->iommu_hdl);
				return rc;
				goto rel_cmd_buf;
			}
			*fw_cmd_buf_iova_addr = addr;
			*fw_cmd_buf_iova_addr =
				(*fw_cmd_buf_iova_addr + cmd_desc[i].offset);
			rc = cam_mem_get_cpu_buf(cmd_desc[i].mem_handle,
				&cpu_addr, &len);
			if (rc) {
			if (rc || !cpu_addr) {
				CAM_ERR(CAM_ICP, "get cmd buf failed %x",
					hw_mgr->iommu_hdl);
				*fw_cmd_buf_iova_addr = 0;
				return rc;
				goto rel_cmd_buf;
			}
			if ((len <= cmd_desc[i].offset) ||
				(cmd_desc[i].size < cmd_desc[i].length) ||
				((len - cmd_desc[i].offset) <
				cmd_desc[i].length)) {
				CAM_ERR(CAM_ICP, "Invalid offset or length");
				goto rel_cmd_buf;
			}
			cpu_addr = cpu_addr + cmd_desc[i].offset;
		}
@@ -3428,6 +3455,18 @@ static int cam_icp_mgr_process_cmd_desc(struct cam_icp_hw_mgr *hw_mgr,
		}
	}

	return rc;

rel_cmd_buf:
	for (i = num_cmd_buf; i >= 0; i--) {
		if (cmd_desc[i].type == CAM_CMD_BUF_FW) {
			if (cam_mem_put_cpu_buf(cmd_desc[i].mem_handle)) {
				CAM_WARN(CAM_ICP, "put cmd buf failed 0x%x",
					cmd_desc[i].mem_handle);
			}
		}
	}

	return rc;
}

@@ -4002,6 +4041,7 @@ static int cam_icp_mgr_prepare_hw_update(void *hw_mgr_priv,

	CAM_DBG(CAM_ICP, "X: req id = %lld ctx_id = %u",
		packet->header.request_id, ctx_data->ctx_id);
	cam_icp_mgr_put_cmd_buf(packet);
	mutex_unlock(&ctx_data->ctx_mutex);
	return rc;
}
+26 −6
Original line number Diff line number Diff line
@@ -153,6 +153,10 @@ static void cam_isp_ctx_dump_req(struct cam_isp_ctx_req *req_isp)
			}
put:
			if (need_put) {
				if (cam_mem_put_cpu_buf(req_isp->cfg[i].handle))
					CAM_WARN(CAM_ISP,
						"Failed to put cpu buf: 0x%x",
						req_isp->cfg[i].handle);
				need_put = false;
				continue;
			}
@@ -162,6 +166,9 @@ static void cam_isp_ctx_dump_req(struct cam_isp_ctx_req *req_isp)
			buf_end = (uint32_t *)((uint8_t *) buf_start +
				req_isp->cfg[i].len - 1);
			cam_cdm_util_dump_cmd_buf(buf_start, buf_end);
			if (cam_mem_put_cpu_buf(req_isp->cfg[i].handle))
				CAM_WARN(CAM_ISP, "Failed to put cpu buf: 0x%x",
					req_isp->cfg[i].handle);
		}
	}
}
@@ -1856,7 +1863,9 @@ static int __cam_isp_ctx_flush_req_in_top_state(
	struct cam_req_mgr_flush_request *flush_req)
{
	int rc = 0;
	struct cam_isp_context *ctx_isp;

	ctx_isp = (struct cam_isp_context *) ctx->ctx_priv;
	if (flush_req->type == CAM_REQ_MGR_FLUSH_TYPE_ALL) {
		CAM_INFO(CAM_ISP, "Last request id to flush is %lld",
			flush_req->req_id);
@@ -1868,6 +1877,7 @@ static int __cam_isp_ctx_flush_req_in_top_state(
	rc = __cam_isp_ctx_flush_req(ctx, &ctx->pending_req_list, flush_req);
	spin_unlock_bh(&ctx->lock);

	atomic_set(&ctx_isp->process_bubble, 0);
	return rc;
}

@@ -2584,8 +2594,7 @@ static int __cam_isp_ctx_config_dev_in_top_state(

	if (!req) {
		CAM_ERR(CAM_ISP, "No more request obj free");
		rc = -ENOMEM;
		goto end;
		return -ENOMEM;
	}

	req_isp = (struct cam_isp_ctx_req *) req->req_priv;
@@ -2604,7 +2613,8 @@ static int __cam_isp_ctx_config_dev_in_top_state(
	if ((len < sizeof(struct cam_packet)) ||
		((size_t)cmd->offset >= len - sizeof(struct cam_packet))) {
		CAM_ERR(CAM_ISP, "invalid buff length: %zu or offset", len);
		return -EINVAL;
		rc = -EINVAL;
		goto free_cpu_buf;
	}

	remain_len -= (size_t)cmd->offset;
@@ -2624,7 +2634,7 @@ static int __cam_isp_ctx_config_dev_in_top_state(
			"request %lld has been flushed, reject packet",
			packet->header.request_id);
		rc = -EINVAL;
		goto free_req;
		goto free_cpu_buf;
	}

	/* preprocess the configuration */
@@ -2648,7 +2658,7 @@ static int __cam_isp_ctx_config_dev_in_top_state(
	if (rc != 0) {
		CAM_ERR(CAM_ISP, "Prepare config packet failed in HW layer");
		rc = -EFAULT;
		goto free_req;
		goto free_cpu_buf;
	}
	req_isp->num_cfg = cfg.num_hw_update_entries;
	req_isp->num_fence_map_out = cfg.num_out_map_entries;
@@ -2709,6 +2719,10 @@ static int __cam_isp_ctx_config_dev_in_top_state(
	if (rc)
		goto put_ref;

	if (cam_mem_put_cpu_buf((int32_t) cmd->packet_handle))
		CAM_WARN(CAM_ISP, "Can not put packet address : %llu",
			cmd->packet_handle);

	CAM_DBG(CAM_REQ,
		"Preprocessing Config req_id %lld successful on ctx %u",
		req->request_id, ctx->ctx_id);
@@ -2721,11 +2735,15 @@ static int __cam_isp_ctx_config_dev_in_top_state(
			CAM_ERR(CAM_CTXT, "Failed to put ref of fence %d",
				req_isp->fence_map_out[i].sync_id);
	}
free_cpu_buf:
	if (cam_mem_put_cpu_buf((int32_t) cmd->packet_handle))
		CAM_WARN(CAM_ISP, "Can not put packet address: %llu",
			cmd->packet_handle);
free_req:
	spin_lock_bh(&ctx->lock);
	list_add_tail(&req->list, &ctx->free_req_list);
	spin_unlock_bh(&ctx->lock);
end:

	return rc;
}

@@ -3146,6 +3164,7 @@ static int __cam_isp_ctx_start_dev_in_ready(struct cam_context *ctx,
	start_isp.hw_config.init_packet = 1;
	start_isp.start_only = false;

	atomic_set(&ctx_isp->process_bubble, 0);
	ctx_isp->frame_id = 0;
	ctx_isp->active_req_cnt = 0;
	ctx_isp->reported_req_id = 0;
@@ -3281,6 +3300,7 @@ static int __cam_isp_ctx_stop_dev_in_activated_unlock(
	ctx_isp->frame_id = 0;
	ctx_isp->active_req_cnt = 0;
	ctx_isp->reported_req_id = 0;
	atomic_set(&ctx_isp->process_bubble, 0);

	CAM_DBG(CAM_ISP, "Stop device success next state %d on ctx %u",
		ctx->state, ctx->ctx_id);
+7 −1
Original line number Diff line number Diff line
/* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
/* Copyright (c) 2017-2019, 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
@@ -828,6 +828,12 @@ static struct cam_vfe_bus_ver2_hw_info vfe170_bus_hw_info = {
			.max_height    = -1,
		},
	},
	.reg_data = {
		.ubwc_10bit_threshold_lossy_0 = 0,
		.ubwc_10bit_threshold_lossy_1 = 0,
		.ubwc_8bit_threshold_lossy_0 = 0,
		.ubwc_8bit_threshold_lossy_1 = 0,
	},
};

struct cam_vfe_hw_info cam_vfe170_hw_info = {
+51 −36
Original line number Diff line number Diff line
@@ -234,6 +234,9 @@ static struct cam_vfe_bus_ver2_reg_offset_ubwc_3_client
	.mode_cfg_0        = 0x00002544,
	.mode_cfg_1        = 0x000025A4,
	.bw_limit          = 0x000025A0,
	.threshlod_lossy_0 = 0x000025A8,
	.threshlod_lossy_1 = 0x000025AC,

};

static struct cam_vfe_bus_ver2_reg_offset_ubwc_3_client
@@ -247,6 +250,8 @@ static struct cam_vfe_bus_ver2_reg_offset_ubwc_3_client
	.mode_cfg_0        = 0x00002644,
	.mode_cfg_1        = 0x000026A4,
	.bw_limit          = 0x000026A0,
	.threshlod_lossy_0 = 0x000026A8,
	.threshlod_lossy_1 = 0x000026AC,
};

static struct cam_vfe_bus_ver2_reg_offset_ubwc_3_client
@@ -260,6 +265,8 @@ static struct cam_vfe_bus_ver2_reg_offset_ubwc_3_client
	.mode_cfg_0        = 0x00003644,
	.mode_cfg_1        = 0x000036A4,
	.bw_limit          = 0x000036A0,
	.threshlod_lossy_0 = 0x000036A8,
	.threshlod_lossy_1 = 0x000036AC,
};

static struct cam_vfe_bus_ver2_reg_offset_ubwc_3_client
@@ -273,6 +280,8 @@ static struct cam_vfe_bus_ver2_reg_offset_ubwc_3_client
	.mode_cfg_0        = 0x00003744,
	.mode_cfg_1        = 0x000037A4,
	.bw_limit          = 0x000037A0,
	.threshlod_lossy_0 = 0x000037A8,
	.threshlod_lossy_1 = 0x000037AC,
};

static struct cam_vfe_bus_ver2_hw_info vfe175_bus_hw_info = {
@@ -986,6 +995,12 @@ static struct cam_vfe_bus_ver2_hw_info vfe175_bus_hw_info = {
			.max_height    = 1080,
		},
	},
	.reg_data = {
		.ubwc_10bit_threshold_lossy_0 = 0x8330002,
		.ubwc_10bit_threshold_lossy_1 = 0x20204,
		.ubwc_8bit_threshold_lossy_0 = 0x6210022,
		.ubwc_8bit_threshold_lossy_1 = 0xE0E,
	},
};

struct cam_vfe_hw_info cam_vfe175_hw_info = {
Loading