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

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

Merge "UPSTREAM: Merge remote-tracking branch 'quic/dev/msm-4.9-camx' into msm-4.9 - 092117"

parents f6e37361 a013d2a9
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -111,7 +111,7 @@
		rgltr-min-voltage = <2800000>;
		rgltr-max-voltage = <2800000>;
		rgltr-load-current = <0>;
		status = "disabled";
		status = "ok";
	};

	eeprom_rear: qcom,eeprom@0 {
+1 −1
Original line number Diff line number Diff line
@@ -111,7 +111,7 @@
		rgltr-min-voltage = <2800000>;
		rgltr-max-voltage = <2800000>;
		rgltr-load-current = <0>;
		status = "disabled";
		status = "ok";
	};

	eeprom_rear: qcom,eeprom@0 {
+1 −1
Original line number Diff line number Diff line
@@ -256,7 +256,7 @@ static int __cam_node_crm_apply_req(struct cam_req_mgr_apply_request *apply)
		return -EINVAL;
	}

	trace_cam_apply_req("Node", apply);
	trace_cam_apply_req("Node", apply->request_id);

	return cam_context_handle_crm_apply_req(ctx, apply);
}
+5 −0
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@

#include "cam_debug_util.h"
#include "cam_fd_context.h"
#include "cam_trace.h"

/* Functions in Available state */
static int __cam_fd_ctx_acquire_dev_in_available(struct cam_context *ctx,
@@ -29,6 +30,7 @@ static int __cam_fd_ctx_acquire_dev_in_available(struct cam_context *ctx,
	}

	ctx->state = CAM_CTX_ACQUIRED;
	trace_cam_context_state("FD", ctx);

	return rc;
}
@@ -46,6 +48,7 @@ static int __cam_fd_ctx_release_dev_in_acquired(struct cam_context *ctx,
	}

	ctx->state = CAM_CTX_AVAILABLE;
	trace_cam_context_state("FD", ctx);

	return rc;
}
@@ -76,6 +79,7 @@ static int __cam_fd_ctx_start_dev_in_acquired(struct cam_context *ctx,
	}

	ctx->state = CAM_CTX_ACTIVATED;
	trace_cam_context_state("FD", ctx);

	return rc;
}
@@ -93,6 +97,7 @@ static int __cam_fd_ctx_stop_dev_in_activated(struct cam_context *ctx,
	}

	ctx->state = CAM_CTX_ACQUIRED;
	trace_cam_context_state("FD", ctx);

	return rc;
}
+98 −20
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@
#include "cam_fd_hw_soc.h"
#include "cam_fd_hw_mgr_intf.h"
#include "cam_fd_hw_mgr.h"
#include "cam_trace.h"

static struct cam_fd_hw_mgr g_fd_hw_mgr;

@@ -334,7 +335,7 @@ static int cam_fd_mgr_util_select_device(struct cam_fd_hw_mgr *hw_mgr,
	/* Update required info in hw context */
	hw_ctx->device_index = i;

	CAM_DBG(CAM_FD, "ctx index=%d, hw_ctx=%d", hw_ctx->ctx_index,
	CAM_DBG(CAM_FD, "ctx index=%d, device_index=%d", hw_ctx->ctx_index,
		hw_ctx->device_index);

	return 0;
@@ -480,6 +481,53 @@ static int cam_fd_mgr_util_parse_generic_cmd_buffer(
	return rc;
}

static int cam_fd_mgr_util_get_buf_map_requirement(uint32_t direction,
	uint32_t resource_type, bool *need_io_map, bool *need_cpu_map)
{
	if (!need_io_map || !need_cpu_map) {
		CAM_ERR(CAM_FD, "Invalid input pointers %pK %pK", need_io_map,
			need_cpu_map);
		return -EINVAL;
	}

	if (direction == CAM_BUF_INPUT) {
		switch (resource_type) {
		case CAM_FD_INPUT_PORT_ID_IMAGE:
			*need_io_map = true;
			*need_cpu_map = false;
			break;
		default:
			CAM_WARN(CAM_FD, "Invalid port: dir %d, id %d",
				direction, resource_type);
			return -EINVAL;
		}
	} else if (direction == CAM_BUF_OUTPUT) {
		switch (resource_type) {
		case CAM_FD_OUTPUT_PORT_ID_RESULTS:
			*need_io_map = true;
			*need_cpu_map = true;
			break;
		case CAM_FD_OUTPUT_PORT_ID_RAW_RESULTS:
			*need_io_map = true;
			*need_cpu_map = true;
			break;
		case CAM_FD_OUTPUT_PORT_ID_WORK_BUFFER:
			*need_io_map = true;
			*need_cpu_map = false;
			break;
		default:
			CAM_WARN(CAM_FD, "Invalid port: dir %d, id %d",
				direction, resource_type);
			return -EINVAL;
		}
	} else {
		CAM_WARN(CAM_FD, "Invalid direction %d", direction);
		return -EINVAL;
	}

	return 0;
}

static int cam_fd_mgr_util_prepare_io_buf_info(int32_t iommu_hdl,
	struct cam_hw_prepare_update_args *prepare,
	struct cam_fd_hw_io_buffer *input_buf,
@@ -491,6 +539,7 @@ static int cam_fd_mgr_util_prepare_io_buf_info(int32_t iommu_hdl,
	uint64_t io_addr[CAM_PACKET_MAX_PLANES];
	uint64_t cpu_addr[CAM_PACKET_MAX_PLANES];
	size_t size;
	bool need_io_map, need_cpu_map;

	/* Get IO Buf information */
	num_out_buf = 0;
@@ -512,32 +561,55 @@ static int cam_fd_mgr_util_prepare_io_buf_info(int32_t iommu_hdl,
			return -EINVAL;
		}

		rc = cam_fd_mgr_util_get_buf_map_requirement(
			io_cfg[i].direction, io_cfg[i].resource_type,
			&need_io_map, &need_cpu_map);
		if (rc) {
			CAM_WARN(CAM_FD, "Invalid io buff [%d] : %d %d %d",
				i, io_cfg[i].direction,
				io_cfg[i].resource_type, rc);
			continue;
		}

		memset(io_addr, 0x0, sizeof(io_addr));
		for (plane = 0; plane < CAM_PACKET_MAX_PLANES; plane++) {
			if (!io_cfg[i].mem_handle[plane])
				break;

			rc = cam_mem_get_io_buf(io_cfg[i].mem_handle[plane],
			io_addr[plane] = 0x0;
			cpu_addr[plane] = 0x0;

			if (need_io_map) {
				rc = cam_mem_get_io_buf(
					io_cfg[i].mem_handle[plane],
					iommu_hdl, &io_addr[plane], &size);
				if ((rc) || (io_addr[plane] >> 32)) {
				CAM_ERR(CAM_FD, "Invalid io addr for %d %d",
					plane, rc);
					CAM_ERR(CAM_FD,
						"Invalid io buf %d %d %d %d",
						io_cfg[i].direction,
						io_cfg[i].resource_type, plane,
						rc);
					return -ENOMEM;
				}

			/*
			 * Buffers may be accessed by CPU as well, we do not
			 * know at this point, so get both and send to HW layer
			 */
			rc = cam_mem_get_cpu_buf(io_cfg[i].mem_handle[plane],
				io_addr[plane] += io_cfg[i].offsets[plane];
			}

			if (need_cpu_map) {
				rc = cam_mem_get_cpu_buf(
					io_cfg[i].mem_handle[plane],
					&cpu_addr[plane], &size);
				if (rc) {
				CAM_ERR(CAM_FD, "unable to get buf address");
					CAM_ERR(CAM_FD,
						"Invalid cpu buf %d %d %d %d",
						io_cfg[i].direction,
						io_cfg[i].resource_type, plane,
						rc);
					return rc;
				}

			io_addr[plane] += io_cfg[i].offsets[plane];
				cpu_addr[plane] += io_cfg[i].offsets[plane];
			}

			CAM_DBG(CAM_FD, "IO Address[%d][%d] : %pK, %pK",
				io_cfg[i].direction, plane, io_addr[plane],
@@ -764,6 +836,8 @@ static int cam_fd_mgr_util_submit_frame(void *priv, void *data)
		return -EBUSY;
	}

	trace_cam_submit_to_hw("FD", frame_req->request_id);

	list_del_init(&frame_req->list);
	mutex_unlock(&hw_mgr->frame_req_mutex);

@@ -924,6 +998,8 @@ static int32_t cam_fd_mgr_workq_irq_cb(void *priv, void *data)
		frame_abort = false;
	}

	trace_cam_irq_handled("FD", irq_type);

notify_context:
	/* Do a callback to inform frame done or stop done */
	if (frame_req->hw_ctx->event_cb) {
@@ -1158,7 +1234,7 @@ static int cam_fd_mgr_hw_start(void *hw_mgr_priv, void *mgr_start_args)
		return -EPERM;
	}

	CAM_DBG(CAM_FD, "ctx index=%d, hw_ctx=%d", hw_ctx->ctx_index,
	CAM_DBG(CAM_FD, "ctx index=%d, device_index=%d", hw_ctx->ctx_index,
		hw_ctx->device_index);

	rc = cam_fd_mgr_util_get_device(hw_mgr, hw_ctx, &hw_device);
@@ -1389,6 +1465,8 @@ static int cam_fd_mgr_hw_config(void *hw_mgr_priv, void *hw_config_args)
	}

	frame_req = config->priv;

	trace_cam_apply_req("FD", frame_req->request_id);
	CAM_DBG(CAM_FD, "FrameHWConfig : Frame[%lld]", frame_req->request_id);

	frame_req->num_hw_update_entries = config->num_hw_update_entries;
Loading