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

Commit 8ae194a5 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 2681192f
Loading
Loading
Loading
Loading
+3 −0
Original line number Original line 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;
	unsigned long flags;
	int i;
	int i;


	mutex_lock(&fd_hw->hw_mutex);
	spin_lock_irqsave(&fd_core->spin_lock, flags);
	spin_lock_irqsave(&fd_core->spin_lock, flags);
	if ((fd_core->core_state != CAM_FD_CORE_STATE_IDLE) ||
	if ((fd_core->core_state != CAM_FD_CORE_STATE_IDLE) ||
		(fd_core->results_valid == false) ||
		(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->core_state, fd_core->results_valid,
			fd_core->hw_req_private);
			fd_core->hw_req_private);
		spin_unlock_irqrestore(&fd_core->spin_lock, flags);
		spin_unlock_irqrestore(&fd_core->spin_lock, flags);
		mutex_unlock(&fd_hw->hw_mutex);
		return -EINVAL;
		return -EINVAL;
	}
	}
	fd_core->core_state = CAM_FD_CORE_STATE_READING_RESULTS;
	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->hw_req_private = NULL;
	fd_core->core_state = CAM_FD_CORE_STATE_IDLE;
	fd_core->core_state = CAM_FD_CORE_STATE_IDLE;
	spin_unlock_irqrestore(&fd_core->spin_lock, flags);
	spin_unlock_irqrestore(&fd_core->spin_lock, flags);
	mutex_unlock(&fd_hw->hw_mutex);


	return 0;
	return 0;
}
}