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

Commit 168408b4 authored by Camera Software Integration's avatar Camera Software Integration Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: camera: isp: Maintain clock rate relation between CSIHPY, CSID and...

Merge "msm: camera: isp: Maintain clock rate relation between CSIHPY, CSID and TFE" into camera-kernel.lnx.4.0
parents 8aca4051 c15edd4c
Loading
Loading
Loading
Loading
+25 −0
Original line number Diff line number Diff line
@@ -311,6 +311,31 @@ int cam_context_dump_pf_info(struct cam_context *ctx,
	return rc;
}

int cam_context_handle_message(struct cam_context *ctx,
	uint32_t msg_type, uint32_t *data)
{
	int rc = 0;

	if (!ctx->state_machine) {
		CAM_ERR(CAM_CORE, "Context is not ready");
		return -EINVAL;
	}

	if ((ctx->state > CAM_CTX_AVAILABLE) &&
		(ctx->state < CAM_CTX_STATE_MAX)) {
		if (ctx->state_machine[ctx->state].msg_cb_ops) {
			rc = ctx->state_machine[ctx->state].msg_cb_ops(
				ctx, msg_type, data);
		} else {
			CAM_WARN(CAM_CORE,
				"No message handler for ctx %d, state %d msg_type :%d",
				ctx->dev_hdl, ctx->state, msg_type);
		}
	}

	return rc;
}

int cam_context_handle_acquire_dev(struct cam_context *ctx,
	struct cam_acquire_dev_cmd *cmd)
{
+21 −5
Original line number Diff line number Diff line
@@ -158,6 +158,8 @@ struct cam_ctx_crm_ops {
 * @pagefault_ops:         Function to be called on page fault
 * @dumpinfo_ops:          Function to be invoked for dumping any
 *                         context info
 * @msg_cb_ops:            Function to be called on any message from
 *                         other subdev notifications
 *
 */
struct cam_ctx_ops {
@@ -166,6 +168,7 @@ struct cam_ctx_ops {
	cam_hw_event_cb_func          irq_ops;
	cam_hw_pagefault_cb_func      pagefault_ops;
	cam_ctx_info_dump_cb_func     dumpinfo_ops;
	cam_ctx_message_cb_func       msg_cb_ops;
};

/**
@@ -367,6 +370,19 @@ int cam_context_handle_crm_dump_req(struct cam_context *ctx,
int cam_context_dump_pf_info(struct cam_context *ctx,
	struct cam_smmu_pf_info *pf_info);

/**
 * cam_context_handle_message()
 *
 * @brief:        Handle message callback command
 *
 * @ctx:          Object pointer for cam_context
 * @msg_type:     message type sent from other subdev
 * @data:         data from other subdev
 *
 */
int cam_context_handle_message(struct cam_context *ctx,
	uint32_t msg_type, uint32_t *data);

/**
 * cam_context_handle_acquire_dev()
 *
+3 −0
Original line number Diff line number Diff line
@@ -53,6 +53,9 @@ typedef int (*cam_hw_pagefault_cb_func)(void *context,
typedef int (*cam_ctx_info_dump_cb_func)(void *context,
	enum cam_context_dump_id dump_id);

/* message callback function type */
typedef int (*cam_ctx_message_cb_func)(void *context,
	uint32_t message_type, uint32_t *data);
/**
 * struct cam_hw_update_entry - Entry for hardware config
 *
+34 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@
#include "cam_common_util.h"
#include "cam_req_mgr_debug.h"
#include "cam_cpas_api.h"
#include "cam_subdev.h"

static const char isp_dev_name[] = "cam-isp";

@@ -33,6 +34,9 @@ static struct cam_isp_ctx_debug isp_ctx_debug;
static int cam_isp_context_dump_requests(void *data,
	struct cam_smmu_pf_info *pf_info);

static int cam_isp_context_handle_message(void *context,
	uint32_t msg_type, uint32_t *data);

static int __cam_isp_ctx_start_dev_in_ready(struct cam_context *ctx,
	struct cam_start_stop_dev_cmd *cmd);

@@ -5772,6 +5776,7 @@ static struct cam_ctx_ops
		.irq_ops = NULL,
		.pagefault_ops = cam_isp_context_dump_requests,
		.dumpinfo_ops = cam_isp_context_info_dump,
		.msg_cb_ops = cam_isp_context_handle_message,
	},
	/* Activated */
	{
@@ -5791,6 +5796,7 @@ static struct cam_ctx_ops
		.irq_ops = __cam_isp_ctx_handle_irq_in_activated,
		.pagefault_ops = cam_isp_context_dump_requests,
		.dumpinfo_ops = cam_isp_context_info_dump,
		.msg_cb_ops = cam_isp_context_handle_message,
	},
};

@@ -5933,6 +5939,34 @@ static int cam_isp_context_dump_requests(void *data,
	return rc;
}

static int cam_isp_context_handle_message(void *context,
	uint32_t msg_type, uint32_t *data)
{
	int                            rc = 0;
	struct cam_hw_cmd_args         hw_cmd_args;
	struct cam_isp_hw_cmd_args     isp_hw_cmd_args;
	struct cam_context            *ctx = (struct cam_context *)context;

	memset(&hw_cmd_args, 0, sizeof(hw_cmd_args));
	hw_cmd_args.ctxt_to_hw_map = ctx->ctxt_to_hw_map;

	switch (msg_type) {
	case CAM_SUBDEV_MESSAGE_CLOCK_UPDATE:
		hw_cmd_args.cmd_type = CAM_HW_MGR_CMD_INTERNAL;
		isp_hw_cmd_args.cmd_type = CAM_ISP_HW_MGR_CMD_UPDATE_CLOCK;
		isp_hw_cmd_args.cmd_data = (void *)data;
		hw_cmd_args.u.internal_args = (void *)&isp_hw_cmd_args;
		rc = ctx->hw_mgr_intf->hw_cmd(ctx->hw_mgr_intf->hw_mgr_priv,
			&hw_cmd_args);
		if (rc)
			CAM_ERR(CAM_ISP, "Update clock rate failed rc: %d", rc);
		break;
	default:
		CAM_ERR(CAM_ISP, "Invalid message type %d", msg_type);
	}
	return rc;
}

static int cam_isp_context_debug_register(void)
{
	int rc = 0;
+17 −0
Original line number Diff line number Diff line
@@ -38,6 +38,22 @@ static void cam_isp_dev_iommu_fault_handler(struct cam_smmu_pf_info *pf_info)
		cam_context_dump_pf_info(&(node->ctx_list[i]), pf_info);
}

static void cam_isp_subdev_handle_message(
		struct v4l2_subdev *sd,
		enum cam_subdev_message_type_t message_type,
		uint32_t data)
{
	int i, rc = 0;
	struct cam_node  *node = v4l2_get_subdevdata(sd);

	CAM_DBG(CAM_ISP, "node name %s", node->name, data);
	for (i = 0; i < node->ctx_size; i++) {
		rc = cam_context_handle_message(&(node->ctx_list[i]), message_type, &data);
		if (rc)
			CAM_ERR(CAM_ISP, "Failed to handle message for %s", node->name);
	}
}

static const struct of_device_id cam_isp_dt_match[] = {
	{
		.compatible = "qcom,cam-isp"
@@ -113,6 +129,7 @@ static int cam_isp_dev_component_bind(struct device *dev,
	} else if (strnstr(compat_str, "tfe", strlen(compat_str))) {
		rc = cam_subdev_probe(&g_isp_dev.sd, pdev, CAM_ISP_DEV_NAME,
		CAM_TFE_DEVICE_TYPE);
		g_isp_dev.sd.msg_cb = cam_isp_subdev_handle_message;
		g_isp_dev.isp_device_type = CAM_TFE_DEVICE_TYPE;
		g_isp_dev.max_context = CAM_TFE_CTX_MAX;
	} else  {
Loading