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

Commit b5fa77e9 authored by Jong-Guk Im's avatar Jong-Guk Im Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: camera: isp: Dump previous acq ctx info on acq failure" into camera-kernel.lnx.1.0

parents cc15da4b 03e52e70
Loading
Loading
Loading
Loading
+25 −0
Original line number Original line Diff line number Diff line
@@ -499,6 +499,31 @@ int cam_context_handle_stop_dev(struct cam_context *ctx,
	return rc;
	return rc;
}
}


int cam_context_handle_info_dump(void *context,
	enum cam_context_dump_id id)
{
	int rc = 0;
	struct cam_context *ctx = (struct cam_context *)context;

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

	mutex_lock(&ctx->ctx_mutex);
	if (ctx->state_machine[ctx->state].dumpinfo_ops)
		rc = ctx->state_machine[ctx->state].dumpinfo_ops(ctx,
			id);
	mutex_unlock(&ctx->ctx_mutex);

	if (rc)
		CAM_WARN(CAM_CORE,
			"Dump for id %u failed on ctx_id %u name %s state %d",
			id, ctx->ctx_id, ctx->dev_name, ctx->state);

	return rc;
}

int cam_context_init(struct cam_context *ctx,
int cam_context_init(struct cam_context *ctx,
	const char *dev_name,
	const char *dev_name,
	uint64_t dev_id,
	uint64_t dev_id,
+16 −0
Original line number Original line Diff line number Diff line
@@ -138,6 +138,8 @@ struct cam_ctx_crm_ops {
 * @crm_ops:               CRM to context interface function table
 * @crm_ops:               CRM to context interface function table
 * @irq_ops:               Hardware event handle function
 * @irq_ops:               Hardware event handle function
 * @pagefault_ops:         Function to be called on page fault
 * @pagefault_ops:         Function to be called on page fault
 * @dumpinfo_ops:          Function to be invoked for dumping any
 *                         context info
 *
 *
 */
 */
struct cam_ctx_ops {
struct cam_ctx_ops {
@@ -145,6 +147,7 @@ struct cam_ctx_ops {
	struct cam_ctx_crm_ops       crm_ops;
	struct cam_ctx_crm_ops       crm_ops;
	cam_hw_event_cb_func         irq_ops;
	cam_hw_event_cb_func         irq_ops;
	cam_hw_pagefault_cb_func     pagefault_ops;
	cam_hw_pagefault_cb_func     pagefault_ops;
	cam_ctx_info_dump_cb_func    dumpinfo_ops;
};
};


/**
/**
@@ -406,6 +409,19 @@ int cam_context_handle_start_dev(struct cam_context *ctx,
int cam_context_handle_stop_dev(struct cam_context *ctx,
int cam_context_handle_stop_dev(struct cam_context *ctx,
		struct cam_start_stop_dev_cmd *cmd);
		struct cam_start_stop_dev_cmd *cmd);


/**
 * cam_context_handle_info_dump()
 *
 * @brief:        Handle any dump info for the context
 *
 * @ctx:          Object pointer for cam_context
 * @id:           To indicate which info pertaining
 *                to that ctx needs to be dumped
 *
 */
int cam_context_handle_info_dump(void *context,
	enum cam_context_dump_id id);

/**
/**
 * cam_context_deinit()
 * cam_context_deinit()
 *
 *
+29 −0
Original line number Original line Diff line number Diff line
@@ -1016,3 +1016,32 @@ int32_t cam_context_dump_pf_info_to_hw(struct cam_context *ctx,
end:
end:
	return rc;
	return rc;
}
}

int32_t cam_context_dump_hw_acq_info(struct cam_context *ctx)
{
	int rc = 0;
	struct cam_hw_cmd_args cmd_args;

	if (!ctx) {
		CAM_ERR(CAM_CTXT, "Invalid input params");
		rc = -EINVAL;
		goto end;
	}

	if (!ctx->hw_mgr_intf) {
		CAM_ERR(CAM_CTXT, "[%s][%d] HW interface is not ready",
			ctx->dev_name, ctx->ctx_id);
		rc = -EFAULT;
		goto end;
	}

	if (ctx->hw_mgr_intf->hw_cmd) {
		cmd_args.ctxt_to_hw_map = ctx->ctxt_to_hw_map;
		cmd_args.cmd_type = CAM_HW_MGR_CMD_DUMP_ACQ_INFO;
		ctx->hw_mgr_intf->hw_cmd(ctx->hw_mgr_intf->hw_mgr_priv,
			&cmd_args);
	}

end:
	return rc;
}
+2 −1
Original line number Original line Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0-only */
/* SPDX-License-Identifier: GPL-2.0-only */
/*
/*
 * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
 * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
 */
 */


#ifndef _CAM_CONTEXT_UTILS_H_
#ifndef _CAM_CONTEXT_UTILS_H_
@@ -29,5 +29,6 @@ int32_t cam_context_flush_req_to_hw(struct cam_context *ctx,
int32_t cam_context_dump_pf_info_to_hw(struct cam_context *ctx,
int32_t cam_context_dump_pf_info_to_hw(struct cam_context *ctx,
	struct cam_packet *packet, unsigned long iova, uint32_t buf_info,
	struct cam_packet *packet, unsigned long iova, uint32_t buf_info,
	bool *mem_found);
	bool *mem_found);
int32_t cam_context_dump_hw_acq_info(struct cam_context *ctx);


#endif /* _CAM_CONTEXT_UTILS_H_ */
#endif /* _CAM_CONTEXT_UTILS_H_ */
+16 −0
Original line number Original line Diff line number Diff line
@@ -24,6 +24,17 @@
/* Maximum reg dump cmd buffer entries in a context */
/* Maximum reg dump cmd buffer entries in a context */
#define CAM_REG_DUMP_MAX_BUF_ENTRIES        10
#define CAM_REG_DUMP_MAX_BUF_ENTRIES        10


/**
 * enum cam_context_dump_id -
 *              context dump type
 *
 */
enum cam_context_dump_id {
	CAM_CTX_DUMP_TYPE_NONE,
	CAM_CTX_DUMP_ACQ_INFO,
	CAM_CTX_DUMP_TYPE_MAX,
};

/* hardware event callback function type */
/* hardware event callback function type */
typedef int (*cam_hw_event_cb_func)(void *context, uint32_t evt_id,
typedef int (*cam_hw_event_cb_func)(void *context, uint32_t evt_id,
	void *evt_data);
	void *evt_data);
@@ -32,6 +43,10 @@ typedef int (*cam_hw_event_cb_func)(void *context, uint32_t evt_id,
typedef int (*cam_hw_pagefault_cb_func)(void *context, unsigned long iova,
typedef int (*cam_hw_pagefault_cb_func)(void *context, unsigned long iova,
	uint32_t buf_info);
	uint32_t buf_info);


/* ctx dump callback function type */
typedef int (*cam_ctx_info_dump_cb_func)(void *context,
	enum cam_context_dump_id dump_id);

/**
/**
 * struct cam_hw_update_entry - Entry for hardware config
 * struct cam_hw_update_entry - Entry for hardware config
 *
 *
@@ -276,6 +291,7 @@ enum cam_hw_mgr_command {
	CAM_HW_MGR_CMD_DUMP_PF_INFO,
	CAM_HW_MGR_CMD_DUMP_PF_INFO,
	CAM_HW_MGR_CMD_REG_DUMP_ON_FLUSH,
	CAM_HW_MGR_CMD_REG_DUMP_ON_FLUSH,
	CAM_HW_MGR_CMD_REG_DUMP_ON_ERROR,
	CAM_HW_MGR_CMD_REG_DUMP_ON_ERROR,
	CAM_HW_MGR_CMD_DUMP_ACQ_INFO,
};
};


/**
/**
Loading