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

Commit 66c84934 authored by Chandan Kumar Jha's avatar Chandan Kumar Jha Committed by Gerrit - the friendly Code Review server
Browse files

msm: camera: reqmgr: Modify SOF watchlog timer for INIT exposure



In case of long exposure shots, watchdog timer needs
to be modified for init exposure seeting also to avoid trigger.

CRs-Fixed: 2679913
Change-Id: Ife8b3ec32103aff71d281e11b68e0d48f4ef79e1
Signed-off-by: default avatarChandan Kumar Jha <cjha@codeaurora.org>
parent 463158a7
Loading
Loading
Loading
Loading
+18 −4
Original line number Diff line number Diff line
@@ -49,6 +49,7 @@ void cam_req_mgr_core_link_reset(struct cam_req_mgr_core_link *link)
	link->initial_skip = true;
	link->sof_timestamp = 0;
	link->prev_sof_timestamp = 0;
	link->skip_wd_validation = false;
}

void cam_req_mgr_handle_core_shutdown(void)
@@ -521,6 +522,13 @@ static void __cam_req_mgr_validate_crm_wd_timer(
	int next_frame_timeout = 0, current_frame_timeout = 0;
	struct cam_req_mgr_req_queue *in_q = link->req.in_q;

	if (link->skip_wd_validation) {
		CAM_DBG(CAM_CRM,
			"skipping modifying wd timer for first frame after streamon");
		link->skip_wd_validation = false;
		return;
	}

	idx = in_q->rd_idx;
	__cam_req_mgr_dec_idx(
		&idx, (link->max_delay - 1),
@@ -538,6 +546,7 @@ static void __cam_req_mgr_validate_crm_wd_timer(
	CAM_DBG(CAM_CRM,
		"rd_idx: %d idx: %d current_frame_timeout: %d ms",
		in_q->rd_idx, idx, current_frame_timeout);

	spin_lock_bh(&link->link_state_spin_lock);
	if (link->watchdog) {
		if ((next_frame_timeout + CAM_REQ_MGR_WATCHDOG_TIMEOUT) >
@@ -559,8 +568,8 @@ static void __cam_req_mgr_validate_crm_wd_timer(
			crm_timer_modify(link->watchdog,
				current_frame_timeout +
				CAM_REQ_MGR_WATCHDOG_TIMEOUT);
		} else if (link->watchdog->expires >
			CAM_REQ_MGR_WATCHDOG_TIMEOUT) {
		} else if (!next_frame_timeout && (link->watchdog->expires >
			CAM_REQ_MGR_WATCHDOG_TIMEOUT)) {
			CAM_DBG(CAM_CRM,
				"Reset wd timer to default from %d ms to %d ms",
				link->watchdog->expires,
@@ -3895,6 +3904,7 @@ int cam_req_mgr_link_control(struct cam_req_mgr_link_control *control)

	struct cam_req_mgr_connected_device *dev = NULL;
	struct cam_req_mgr_link_evt_data     evt_data;
	int                                init_timeout = 0;

	if (!control) {
		CAM_ERR(CAM_CRM, "Control command is NULL");
@@ -3926,10 +3936,13 @@ int cam_req_mgr_link_control(struct cam_req_mgr_link_control *control)
			spin_lock_bh(&link->link_state_spin_lock);
			link->state = CAM_CRM_LINK_STATE_READY;
			spin_unlock_bh(&link->link_state_spin_lock);
			if (control->init_timeout[i])
				link->skip_wd_validation = true;
			init_timeout = (2 * control->init_timeout[i]);
			/* Start SOF watchdog timer */
			rc = crm_timer_init(&link->watchdog,
				CAM_REQ_MGR_WATCHDOG_TIMEOUT, link,
				&__cam_req_mgr_sof_freeze);
				(init_timeout + CAM_REQ_MGR_WATCHDOG_TIMEOUT),
				link, &__cam_req_mgr_sof_freeze);
			if (rc < 0) {
				CAM_ERR(CAM_CRM,
					"SOF timer start fails: link=0x%x",
@@ -3960,6 +3973,7 @@ int cam_req_mgr_link_control(struct cam_req_mgr_link_control *control)
			/* Destroy SOF watchdog timer */
			spin_lock_bh(&link->link_state_spin_lock);
			link->state = CAM_CRM_LINK_STATE_IDLE;
			link->skip_wd_validation = false;
			crm_timer_exit(&link->watchdog);
			spin_unlock_bh(&link->link_state_spin_lock);
		} else {
+3 −0
Original line number Diff line number Diff line
@@ -349,6 +349,8 @@ struct cam_req_mgr_connected_device {
 * @dual_trigger         : Links needs to wait for two triggers prior to
 *                         applying the settings
 * @trigger_cnt          : trigger count value per device initiating the trigger
 * @skip_wd_validation   : skip initial frames crm_wd_timer validation in the
 *                         case of long exposure use case
 */
struct cam_req_mgr_core_link {
	int32_t                              link_hdl;
@@ -381,6 +383,7 @@ struct cam_req_mgr_core_link {
	uint64_t                             prev_sof_timestamp;
	bool                                 dual_trigger;
	uint32_t    trigger_cnt[CAM_REQ_MGR_MAX_TRIGGERS];
	bool                                 skip_wd_validation;

};