msm: camera: common: Add common wait and poll interface

In current implementation, each driver call wait_for_completion_timeout
and readl_poll_timeout with own timeout values.
In case of slow environments like presil, lot of hacks are needed to
change the timeouts for each driver. It needs multiple code changes
and compilations, thus consuming time.
This commit implements a common interface to call
wait_for_completion_timeout and readl_poll_timeout.
Debug variable is also introduced to
change the timeout value. This will help to change the timeout
without compilations and changes at multiple places.

Change-Id: Iba51e0805a49ed325147a12688c2fe6619bb68e6
CRs-Fixed: 2830502
Signed-off-by: Gaurav Jindal <gjindal@codeaurora.org>
此提交包含在:
Gaurav Jindal
2021-02-12 16:38:58 +05:30
父節點 025842520f
當前提交 bc400e47fa
共有 26 個檔案被更改,包括 261 行新增116 行删除

查看文件

@@ -602,12 +602,13 @@ int cam_hfi_resume(struct hfi_mem_info *hfi_mem)
return -EINVAL;
}
if (readl_poll_timeout(icp_base + HFI_REG_ICP_HOST_INIT_RESPONSE,
status, status == ICP_INIT_RESP_SUCCESS,
HFI_POLL_DELAY_US, HFI_POLL_TIMEOUT_US)) {
CAM_ERR(CAM_HFI, "response poll timed out: status=0x%08x",
status);
return -ETIMEDOUT;
if (cam_common_read_poll_timeout(icp_base +
HFI_REG_ICP_HOST_INIT_RESPONSE,
HFI_POLL_DELAY_US, HFI_POLL_TIMEOUT_US,
0x1, ICP_INIT_RESP_SUCCESS, &status)) {
CAM_ERR(CAM_HFI, "response poll timed out: status=0x%08x",
status);
return -ETIMEDOUT;
}
hfi_irq_enable(g_hfi);
@@ -873,11 +874,11 @@ int cam_hfi_init(struct hfi_mem_info *hfi_mem, const struct hfi_ops *hfi_ops,
hfi_mem->qtbl.iova, hfi_mem->qtbl.len,
hfi_mem->sfr_buf.iova, hfi_mem->sfr_buf.len);
if (readl_poll_timeout(icp_base + HFI_REG_ICP_HOST_INIT_RESPONSE,
status, status == ICP_INIT_RESP_SUCCESS,
HFI_POLL_DELAY_US, HFI_POLL_TIMEOUT_US)) {
CAM_ERR(CAM_HFI,
"response poll timed out: status=0x%08x",
if (cam_common_read_poll_timeout(icp_base +
HFI_REG_ICP_HOST_INIT_RESPONSE,
HFI_POLL_DELAY_US, HFI_POLL_TIMEOUT_US,
0x1, ICP_INIT_RESP_SUCCESS, &status)) {
CAM_ERR(CAM_HFI, "response poll timed out: status=0x%08x",
status);
rc = -ETIMEDOUT;
goto regions_fail;