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

Commit 78c0bdd0 authored by Jeyaprakash Soundrapandian's avatar Jeyaprakash Soundrapandian Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: camera: Reset after CSID programming" into dev/msm-4.9-camx

parents 56b31a07 20b0ab98
Loading
Loading
Loading
Loading
+34 −3
Original line number Diff line number Diff line
/* Copyright (c) 2017, The Linux Foundation. All rights reserved.
/* Copyright (c) 2018, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -2262,6 +2262,33 @@ static int cam_ife_csid_release(void *hw_priv,
	return rc;
}

static int cam_ife_csid_reset_retain_sw_reg(
	struct cam_ife_csid_hw *csid_hw)
{
	int rc = 0;
	struct cam_ife_csid_reg_offset *csid_reg =
		csid_hw->csid_info->csid_reg;

	cam_io_w_mb(csid_reg->cmn_reg->csid_rst_stb,
		csid_hw->hw_info->soc_info.reg_map[0].mem_base +
		csid_reg->cmn_reg->csid_rst_strobes_addr);

	CAM_DBG(CAM_ISP, " Waiting for SW reset complete from irq handler");
	rc = wait_for_completion_timeout(&csid_hw->csid_top_complete,
		msecs_to_jiffies(IFE_CSID_TIMEOUT));
	if (rc <= 0) {
		CAM_ERR(CAM_ISP, "CSID:%d reset completion in fail rc = %d",
			csid_hw->hw_intf->hw_idx, rc);
		if (rc == 0)
			rc = -ETIMEDOUT;
	} else {
		rc = 0;
	}

	return rc;
}


static int cam_ife_csid_init_hw(void *hw_priv,
	void *init_args, uint32_t arg_size)
{
@@ -2294,7 +2321,6 @@ static int cam_ife_csid_init_hw(void *hw_priv,
		goto end;
	}


	if ((res->res_type == CAM_ISP_RESOURCE_PIX_PATH) &&
		(res->res_state != CAM_ISP_RESOURCE_STATE_RESERVED)) {
		CAM_ERR(CAM_ISP,
@@ -2308,7 +2334,6 @@ static int cam_ife_csid_init_hw(void *hw_priv,
	CAM_DBG(CAM_ISP, "CSID:%d res type :%d res_id:%d",
		csid_hw->hw_intf->hw_idx, res->res_type, res->res_id);


	/* Initialize the csid hardware */
	rc = cam_ife_csid_enable_hw(csid_hw);
	if (rc)
@@ -2332,6 +2357,12 @@ static int cam_ife_csid_init_hw(void *hw_priv,
		break;
	}

	rc = cam_ife_csid_reset_retain_sw_reg(csid_hw);
	if (rc < 0) {
		CAM_ERR(CAM_ISP, "CSID: Failed in SW reset");
		return rc;
	}

	if (rc)
		cam_ife_csid_disable_hw(csid_hw);
end: