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

Commit b5cb0bf7 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: camera: isp: Add trace event in case of irq delay detected"

parents cb795ea0 400bfcec
Loading
Loading
Loading
Loading
+49 −7
Original line number Diff line number Diff line
@@ -596,8 +596,14 @@ static int __cam_isp_ctx_handle_buf_done_in_activated_state(
	if (ctx_isp->frame_id == 1)
		ctx_isp->irq_timestamps = done->irq_mono_boot_time;
	else if (ctx_isp->fps && ((done->irq_mono_boot_time -
		ctx_isp->irq_timestamps) > ((1000*1000)/ctx_isp->fps)))
		ctx_isp->irq_timestamps) > ((1000*1000)/ctx_isp->fps))) {
		ctx_isp->irq_delay_detect = true;
		trace_cam_isp_irq_delay_detect("IRQ delay at buf_done",
			ctx, req->request_id,
			ctx_isp->substate_activated,
			(done->irq_mono_boot_time -
			ctx_isp->irq_timestamps));
	}

	ctx_isp->irq_timestamps = done->irq_mono_boot_time;

@@ -851,8 +857,14 @@ static int __cam_isp_ctx_reg_upd_in_epoch_state(
	if (ctx_isp->frame_id == 1)
		ctx_isp->irq_timestamps = rup_event_data->irq_mono_boot_time;
	else if (ctx_isp->fps && ((rup_event_data->irq_mono_boot_time -
			ctx_isp->irq_timestamps) > ((1000*1000)/ctx_isp->fps)))
		ctx_isp->irq_timestamps) > ((1000*1000)/ctx_isp->fps))) {
		ctx_isp->irq_delay_detect = true;
		trace_cam_isp_irq_delay_detect("IRQ delay at reg_upd",
			ctx, req->request_id,
			ctx_isp->substate_activated,
			(rup_event_data->irq_mono_boot_time -
			ctx_isp->irq_timestamps));
	}

	ctx_isp->irq_timestamps = rup_event_data->irq_mono_boot_time;
	return 0;
@@ -906,8 +918,14 @@ static int __cam_isp_ctx_reg_upd_in_activated_state(
	if (ctx_isp->frame_id == 1)
		ctx_isp->irq_timestamps = rup_event_data->irq_mono_boot_time;
	else if (ctx_isp->fps && ((rup_event_data->irq_mono_boot_time -
			ctx_isp->irq_timestamps) > ((1000*1000)/ctx_isp->fps)))
		ctx_isp->irq_timestamps) > ((1000*1000)/ctx_isp->fps))) {
		ctx_isp->irq_delay_detect = true;
		trace_cam_isp_irq_delay_detect("IRQ delay at reg_upd",
			ctx, req->request_id,
			ctx_isp->substate_activated,
			(rup_event_data->irq_mono_boot_time -
			ctx_isp->irq_timestamps));
	}

	ctx_isp->irq_timestamps = rup_event_data->irq_mono_boot_time;
end:
@@ -1091,8 +1109,14 @@ static int __cam_isp_ctx_sof_in_activated_state(
	if (ctx_isp->frame_id == 1)
		ctx_isp->irq_timestamps = sof_event_data->irq_mono_boot_time;
	else if (ctx_isp->fps && ((sof_event_data->irq_mono_boot_time -
			ctx_isp->irq_timestamps) > ((1000*1000)/ctx_isp->fps)))
		ctx_isp->irq_timestamps) > ((1000*1000)/ctx_isp->fps))) {
		ctx_isp->irq_delay_detect = true;
		trace_cam_isp_irq_delay_detect("IRQ delay at sof",
			ctx, req->request_id,
			ctx_isp->substate_activated,
			(sof_event_data->irq_mono_boot_time -
			ctx_isp->irq_timestamps));
	}

	ctx_isp->irq_timestamps = sof_event_data->irq_mono_boot_time;

@@ -1138,8 +1162,14 @@ static int __cam_isp_ctx_reg_upd_in_sof(struct cam_isp_context *ctx_isp,
	if (ctx_isp->frame_id == 1)
		ctx_isp->irq_timestamps = rup_event_data->irq_mono_boot_time;
	else if (ctx_isp->fps && ((rup_event_data->irq_mono_boot_time -
			ctx_isp->irq_timestamps) > ((1000*1000)/ctx_isp->fps)))
		ctx_isp->irq_timestamps) > ((1000*1000)/ctx_isp->fps))) {
		ctx_isp->irq_delay_detect = true;
		trace_cam_isp_irq_delay_detect("IRQ delay at reg_upd",
			ctx, req->request_id,
			ctx_isp->substate_activated,
			(rup_event_data->irq_mono_boot_time -
			ctx_isp->irq_timestamps));
	}

	ctx_isp->irq_timestamps = rup_event_data->irq_mono_boot_time;
end:
@@ -1228,8 +1258,14 @@ static int __cam_isp_ctx_epoch_in_applied(struct cam_isp_context *ctx_isp,
		ctx_isp->irq_timestamps =
			epoch_hw_event_data->irq_mono_boot_time;
	else if (ctx_isp->fps && ((epoch_hw_event_data->irq_mono_boot_time -
			ctx_isp->irq_timestamps) > ((1000*1000)/ctx_isp->fps)))
		ctx_isp->irq_timestamps) > ((1000*1000)/ctx_isp->fps))) {
		ctx_isp->irq_delay_detect = true;
		trace_cam_isp_irq_delay_detect("IRQ delay at epoch",
			ctx, req->request_id,
			ctx_isp->substate_activated,
			(epoch_hw_event_data->irq_mono_boot_time -
			ctx_isp->irq_timestamps));
	}

	ctx_isp->irq_timestamps = epoch_hw_event_data->irq_mono_boot_time;

@@ -1268,8 +1304,14 @@ static int __cam_isp_ctx_sof_in_epoch(struct cam_isp_context *ctx_isp,
	if (ctx_isp->frame_id == 1)
		ctx_isp->irq_timestamps = sof_event_data->irq_mono_boot_time;
	else if (ctx_isp->fps && ((sof_event_data->irq_mono_boot_time -
			ctx_isp->irq_timestamps) > ((1000*1000)/ctx_isp->fps)))
		ctx_isp->irq_timestamps) > ((1000*1000)/ctx_isp->fps))) {
		ctx_isp->irq_delay_detect = true;
		trace_cam_isp_irq_delay_detect("IRQ delay at sof",
			ctx, 0,
			ctx_isp->substate_activated,
			(sof_event_data->irq_mono_boot_time -
			ctx_isp->irq_timestamps));
	}

	ctx_isp->irq_timestamps = sof_event_data->irq_mono_boot_time;

+25 −1
Original line number Diff line number Diff line
/* Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
/* Copyright (c) 2017-2020, 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
@@ -51,6 +51,12 @@ static int cam_csiphy_notify_secure_mode(struct csiphy_device *csiphy_dev,
		return -EINVAL;
	}

	CAM_INFO(CAM_CSIPHY, "PHY : %d offset: %d SEC: %d Mask: %d",
			csiphy_dev->soc_info.index,
			offset,
			protect,
			csiphy_dev->csiphy_cpas_cp_reg_mask[offset]);

	return 0;
}

@@ -837,6 +843,7 @@ int32_t cam_csiphy_core_cfg(void *phy_dev,
	}
		break;
	case CAM_RELEASE_DEV: {
		int32_t offset;
		struct cam_release_dev_cmd release;

		if (!csiphy_dev->acquire_count) {
@@ -852,6 +859,23 @@ int32_t cam_csiphy_core_cfg(void *phy_dev,
			goto release_mutex;
		}

		offset = cam_csiphy_get_instance_offset(csiphy_dev,
			release.dev_handle);
		if (offset < 0 || offset >= CSIPHY_MAX_INSTANCES) {
			CAM_ERR(CAM_CSIPHY, "Invalid offset");
			goto release_mutex;
		}

		if (csiphy_dev->csiphy_info.secure_mode[offset])
			cam_csiphy_notify_secure_mode(
				csiphy_dev,
				CAM_SECURE_MODE_NON_SECURE, offset);

		csiphy_dev->csiphy_info.secure_mode[offset] =
			CAM_SECURE_MODE_NON_SECURE;

		csiphy_dev->csiphy_cpas_cp_reg_mask[offset] = 0x0;

		rc = cam_destroy_device_hdl(release.dev_handle);
		if (rc < 0)
			CAM_ERR(CAM_CSIPHY, "destroying the device hdl");
+29 −1
Original line number Diff line number Diff line
/* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
/* Copyright (c) 2017-2020, 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
@@ -286,6 +286,34 @@ TRACE_EVENT(cam_irq_handled,
	)
);

TRACE_EVENT(cam_isp_irq_delay_detect,
	TP_PROTO(const char *text, struct cam_context *ctx,
		uint64_t request_id, uint32_t substate,
		uint64_t timestamp),
	TP_ARGS(text, ctx, request_id, substate, timestamp),
	TP_STRUCT__entry(
		__string(text, text)
		__field(uint32_t, ctx_id)
		__field(uint64_t, dev_id)
		__field(uint64_t, req_id)
		__field(uint32_t, substate)
		__field(uint64_t, ts)
	),
	TP_fast_assign(
		__assign_str(text, text);
		__entry->ctx_id = ctx->ctx_id;
		__entry->dev_id = ctx->dev_id;
		__entry->req_id = request_id;
		__entry->substate = substate;
		__entry->ts = timestamp;
	),
	TP_printk(
		"ISP: %s ctx=%u dev_id=%u req_id=%lld substate=%u event=%u delay_by=%llu",
			__get_str(text), __entry->ctx_id, __entry->dev_id,
			__entry->req_id, __entry->substate, __entry->ts
	)
);

TRACE_EVENT(cam_cdm_cb,
	TP_PROTO(const char *entity, uint32_t status),
	TP_ARGS(entity, status),