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

Commit 7b043ecf authored by Karthik Anantha Ram's avatar Karthik Anantha Ram Committed by Gerrit - the friendly Code Review server
Browse files

msm: camera: Block release if device is active on link



In case a device is still active on a link i.e. unlink
procedure has not been invoked in the CRM we should not
allow release of such devices.

Change-Id: I02a9705156b9fb0eb6eabc6f764c54e0db0efa24
Signed-off-by: default avatarKarthik Anantha Ram <kartanan@codeaurora.org>
parent 18969568
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -1984,6 +1984,12 @@ static int __cam_isp_ctx_release_dev_in_top_state(struct cam_context *ctx,
		(struct cam_isp_context *) ctx->ctx_priv;
	struct cam_req_mgr_flush_request flush_req;

	if (ctx->link_hdl != -1) {
		CAM_ERR(CAM_ISP, "ctx expects release dev after unlink");
		rc =  -EAGAIN;
		return rc;
	}

	if (cmd && ctx_isp->hw_ctx && ctx_isp->split_acquire) {
		CAM_ERR(CAM_ISP, "ctx expects release HW before release dev");
		return rc;
+10 −0
Original line number Diff line number Diff line
@@ -764,6 +764,16 @@ int32_t cam_actuator_driver_cmd(struct cam_actuator_ctrl_t *a_ctrl,
			rc = -EINVAL;
			goto release_mutex;
		}

		if (a_ctrl->bridge_intf.link_hdl != -1) {
			CAM_ERR(CAM_ACTUATOR,
				"Device [%d] still active on link 0x%x",
				a_ctrl->cam_act_state,
				a_ctrl->bridge_intf.link_hdl);
			rc = -EAGAIN;
			goto release_mutex;
		}

		rc = cam_destroy_device_hdl(a_ctrl->bridge_intf.device_hdl);
		if (rc < 0)
			CAM_ERR(CAM_ACTUATOR, "destroying the device hdl");
+2 −0
Original line number Diff line number Diff line
@@ -209,6 +209,7 @@ static int32_t cam_actuator_driver_i2c_probe(struct i2c_client *client,
		INIT_LIST_HEAD(&(a_ctrl->i2c_data.per_frame[i].list_head));

	a_ctrl->bridge_intf.device_hdl = -1;
	a_ctrl->bridge_intf.link_hdl = -1;
	a_ctrl->bridge_intf.ops.get_dev_info =
		cam_actuator_publish_dev_info;
	a_ctrl->bridge_intf.ops.link_setup =
@@ -363,6 +364,7 @@ static int32_t cam_actuator_driver_platform_probe(
		goto free_mem;

	a_ctrl->bridge_intf.device_hdl = -1;
	a_ctrl->bridge_intf.link_hdl = -1;
	a_ctrl->bridge_intf.ops.get_dev_info =
		cam_actuator_publish_dev_info;
	a_ctrl->bridge_intf.ops.link_setup =
+11 −0
Original line number Diff line number Diff line
@@ -107,6 +107,15 @@ static int32_t cam_flash_driver_cmd(struct cam_flash_ctrl *fctrl,
			goto release_mutex;
		}

		if (fctrl->bridge_intf.link_hdl != -1) {
			CAM_ERR(CAM_SENSOR,
				"Device [%d] still active on link 0x%x",
				fctrl->flash_state,
				fctrl->bridge_intf.link_hdl);
			rc = -EAGAIN;
			goto release_mutex;
		}

		if ((fctrl->flash_state == CAM_FLASH_STATE_CONFIG) ||
			(fctrl->flash_state == CAM_FLASH_STATE_START))
			fctrl->func_tbl.flush_req(fctrl, FLUSH_ALL, 0);
@@ -466,6 +475,7 @@ static int32_t cam_flash_platform_probe(struct platform_device *pdev)
	}

	fctrl->bridge_intf.device_hdl = -1;
	fctrl->bridge_intf.link_hdl = -1;
	fctrl->bridge_intf.ops.get_dev_info = cam_flash_publish_dev_info;
	fctrl->bridge_intf.ops.link_setup = cam_flash_establish_link;
	fctrl->bridge_intf.ops.apply_req = cam_flash_apply_request;
@@ -551,6 +561,7 @@ static int32_t cam_flash_i2c_driver_probe(struct i2c_client *client,
	fctrl->func_tbl.flush_req = cam_flash_i2c_flush_request;

	fctrl->bridge_intf.device_hdl = -1;
	fctrl->bridge_intf.link_hdl = -1;
	fctrl->bridge_intf.ops.get_dev_info = cam_flash_publish_dev_info;
	fctrl->bridge_intf.ops.link_setup = cam_flash_establish_link;
	fctrl->bridge_intf.ops.apply_req = cam_flash_apply_request;
+9 −0
Original line number Diff line number Diff line
@@ -706,6 +706,15 @@ int32_t cam_sensor_driver_cmd(struct cam_sensor_ctrl_t *s_ctrl,
			goto release_mutex;
		}

		if (s_ctrl->bridge_intf.link_hdl != -1) {
			CAM_ERR(CAM_SENSOR,
				"Device [%d] still active on link 0x%x",
				s_ctrl->sensor_state,
				s_ctrl->bridge_intf.link_hdl);
			rc = -EAGAIN;
			goto release_mutex;
		}

		rc = cam_sensor_power_down(s_ctrl);
		if (rc < 0) {
			CAM_ERR(CAM_SENSOR, "Sensor Power Down failed");
Loading