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

Commit b4d1047b authored by Ravikishore Pampana's avatar Ravikishore Pampana
Browse files

msm: camera: fd: Add mutex protection to frame done processing



Frame done processing command need to be synchronized with
fd deinit command. This changes avoids the deinit to fd hardware
during the frame done call back process.

Change-Id: I291077fa1bd2c08d9ee74a1689b4b2008dd7321f
Signed-off-by: default avatarRavikishore Pampana <rpampana@codeaurora.org>
parent b2f806d5
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -427,6 +427,7 @@ static int cam_fd_hw_util_processcmd_frame_done(struct cam_hw_info *fd_hw,
	unsigned long flags;
	int i;

	mutex_lock(&fd_hw->hw_mutex);
	spin_lock_irqsave(&fd_core->spin_lock, flags);
	if ((fd_core->core_state != CAM_FD_CORE_STATE_IDLE) ||
		(fd_core->results_valid == false) ||
@@ -436,6 +437,7 @@ static int cam_fd_hw_util_processcmd_frame_done(struct cam_hw_info *fd_hw,
			fd_core->core_state, fd_core->results_valid,
			fd_core->hw_req_private);
		spin_unlock_irqrestore(&fd_core->spin_lock, flags);
		mutex_unlock(&fd_hw->hw_mutex);
		return -EINVAL;
	}
	fd_core->core_state = CAM_FD_CORE_STATE_READING_RESULTS;
@@ -516,6 +518,7 @@ static int cam_fd_hw_util_processcmd_frame_done(struct cam_hw_info *fd_hw,
	fd_core->hw_req_private = NULL;
	fd_core->core_state = CAM_FD_CORE_STATE_IDLE;
	spin_unlock_irqrestore(&fd_core->spin_lock, flags);
	mutex_unlock(&fd_hw->hw_mutex);

	return 0;
}