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

Commit 2777d2ed authored by Junzhe Zou's avatar Junzhe Zou
Browse files

msm: camera: lrme: increment open count correctly



Increment open count correctly and send stop command
in camera core even if param is NULL since LRME uses
it as an integer.

Change-Id: I85ed1d91d6900a67248933bc9a24bcc3caa5e04f
Signed-off-by: default avatarJunzhe Zou <jnzhezou@codeaurora.org>
parent a418fe22
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -502,9 +502,8 @@ int32_t cam_context_stop_dev_to_hw(struct cam_context *ctx)
	mutex_unlock(&ctx->sync_mutex);

	/* stop hw first */
	if (ctx->ctxt_to_hw_map) {
	if (ctx->hw_mgr_intf->hw_stop) {
		stop.ctxt_to_hw_map = ctx->ctxt_to_hw_map;
		if (ctx->hw_mgr_intf->hw_stop)
		ctx->hw_mgr_intf->hw_stop(ctx->hw_mgr_intf->hw_mgr_priv,
			&stop);
	}
+5 −0
Original line number Diff line number Diff line
@@ -634,6 +634,7 @@ int cam_lrme_hw_start(void *hw_priv, void *hw_start_args, uint32_t arg_size)
	mutex_lock(&lrme_hw->hw_mutex);

	if (lrme_hw->open_count > 0) {
		lrme_hw->open_count++;
		CAM_DBG(CAM_LRME, "This device is activated before");
		goto unlock;
	}
@@ -665,6 +666,7 @@ int cam_lrme_hw_start(void *hw_priv, void *hw_start_args, uint32_t arg_size)
	lrme_hw->open_count++;
	lrme_core->state = CAM_LRME_CORE_STATE_IDLE;

	CAM_DBG(CAM_LRME, "open count %d", lrme_hw->open_count);
	mutex_unlock(&lrme_hw->hw_mutex);
	return rc;

@@ -672,6 +674,7 @@ int cam_lrme_hw_start(void *hw_priv, void *hw_start_args, uint32_t arg_size)
	if (cam_lrme_soc_disable_resources(lrme_hw))
		CAM_ERR(CAM_LRME, "Error in disable soc resources");
unlock:
	CAM_DBG(CAM_LRME, "open count %d", lrme_hw->open_count);
	mutex_unlock(&lrme_hw->hw_mutex);
	return rc;
}
@@ -698,6 +701,8 @@ int cam_lrme_hw_stop(void *hw_priv, void *hw_stop_args, uint32_t arg_size)
	}
	lrme_hw->open_count--;

	CAM_DBG(CAM_LRME, "open count %d", lrme_hw->open_count);

	if (lrme_hw->open_count)
		goto unlock;