mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-09 21:59:12 -04:00
Merge "msm: camera: common: Clean shutdown and page fault sequence" into camera-kernel.lnx.1.0
This commit is contained in:
commit
1c31309845
6 changed files with 45 additions and 25 deletions
|
|
@ -54,12 +54,15 @@ int cam_context_shutdown(struct cam_context *ctx)
|
|||
rc = -EINVAL;
|
||||
}
|
||||
|
||||
rc = cam_destroy_device_hdl(ctx->dev_hdl);
|
||||
if (rc)
|
||||
CAM_ERR(CAM_CORE, "destroy device hdl failed for node %s",
|
||||
ctx->dev_name);
|
||||
else
|
||||
ctx->dev_hdl = -1;
|
||||
if (ctx->dev_hdl != -1) {
|
||||
rc = cam_destroy_device_hdl(ctx->dev_hdl);
|
||||
if (rc)
|
||||
CAM_ERR(CAM_CORE,
|
||||
"destroy device hdl failed for node %s",
|
||||
ctx->dev_name);
|
||||
else
|
||||
ctx->dev_hdl = -1;
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
|
@ -237,12 +240,15 @@ int cam_context_dump_pf_info(struct cam_context *ctx, unsigned long iova,
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (ctx->state_machine[ctx->state].pagefault_ops) {
|
||||
rc = ctx->state_machine[ctx->state].pagefault_ops(ctx, iova,
|
||||
buf_info);
|
||||
} else {
|
||||
CAM_WARN(CAM_CORE, "No dump ctx in dev %d, state %d",
|
||||
ctx->dev_hdl, ctx->state);
|
||||
if ((ctx->state > CAM_CTX_AVAILABLE) &&
|
||||
(ctx->state < CAM_CTX_STATE_MAX)) {
|
||||
if (ctx->state_machine[ctx->state].pagefault_ops) {
|
||||
rc = ctx->state_machine[ctx->state].pagefault_ops(
|
||||
ctx, iova, buf_info);
|
||||
} else {
|
||||
CAM_WARN(CAM_CORE, "No dump ctx in dev %d, state %d",
|
||||
ctx->dev_hdl, ctx->state);
|
||||
}
|
||||
}
|
||||
|
||||
return rc;
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ void cam_req_mgr_core_link_reset(struct cam_req_mgr_core_link *link)
|
|||
link->initial_sync_req = -1;
|
||||
link->in_msync_mode = false;
|
||||
link->retry_cnt = 0;
|
||||
link->is_shutdown = false;
|
||||
}
|
||||
|
||||
void cam_req_mgr_handle_core_shutdown(void)
|
||||
|
|
@ -55,7 +56,7 @@ void cam_req_mgr_handle_core_shutdown(void)
|
|||
&g_crm_core_dev->session_head, entry) {
|
||||
ses_info.session_hdl =
|
||||
session->session_hdl;
|
||||
cam_req_mgr_destroy_session(&ses_info);
|
||||
cam_req_mgr_destroy_session(&ses_info, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2707,10 +2708,12 @@ static int __cam_req_mgr_unlink(struct cam_req_mgr_core_link *link)
|
|||
link->state = CAM_CRM_LINK_STATE_IDLE;
|
||||
spin_unlock_bh(&link->link_state_spin_lock);
|
||||
|
||||
rc = __cam_req_mgr_disconnect_link(link);
|
||||
if (rc)
|
||||
CAM_ERR(CAM_CORE,
|
||||
"Unlink for all devices was not successful");
|
||||
if (!link->is_shutdown) {
|
||||
rc = __cam_req_mgr_disconnect_link(link);
|
||||
if (rc)
|
||||
CAM_ERR(CAM_CORE,
|
||||
"Unlink for all devices was not successful");
|
||||
}
|
||||
|
||||
mutex_lock(&link->lock);
|
||||
/* Destroy timer of link */
|
||||
|
|
@ -2738,7 +2741,8 @@ static int __cam_req_mgr_unlink(struct cam_req_mgr_core_link *link)
|
|||
}
|
||||
|
||||
int cam_req_mgr_destroy_session(
|
||||
struct cam_req_mgr_session_info *ses_info)
|
||||
struct cam_req_mgr_session_info *ses_info,
|
||||
bool is_shutdown)
|
||||
{
|
||||
int rc;
|
||||
int i;
|
||||
|
|
@ -2771,6 +2775,7 @@ int cam_req_mgr_destroy_session(
|
|||
continue;
|
||||
|
||||
/* Ignore return value since session is going away */
|
||||
link->is_shutdown = is_shutdown;
|
||||
__cam_req_mgr_unlink(link);
|
||||
__cam_req_mgr_free_link(link);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -332,6 +332,8 @@ struct cam_req_mgr_connected_device {
|
|||
* other link
|
||||
* @retry_cnt : Counter that tracks number of attempts to apply
|
||||
* the same req
|
||||
* @is_shutdown : Flag to indicate if link needs to be disconnected
|
||||
* as part of shutdown.
|
||||
*/
|
||||
struct cam_req_mgr_core_link {
|
||||
int32_t link_hdl;
|
||||
|
|
@ -359,6 +361,7 @@ struct cam_req_mgr_core_link {
|
|||
bool in_msync_mode;
|
||||
int64_t initial_sync_req;
|
||||
uint32_t retry_cnt;
|
||||
bool is_shutdown;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -411,11 +414,13 @@ int cam_req_mgr_create_session(struct cam_req_mgr_session_info *ses_info);
|
|||
* cam_req_mgr_destroy_session()
|
||||
* @brief : destroy session
|
||||
* @ses_info : session handle info, input param
|
||||
* @is_shutdown: To indicate if devices on link need to be disconnected.
|
||||
*
|
||||
* Called as part of session destroy
|
||||
* return success/failure
|
||||
*/
|
||||
int cam_req_mgr_destroy_session(struct cam_req_mgr_session_info *ses_info);
|
||||
int cam_req_mgr_destroy_session(struct cam_req_mgr_session_info *ses_info,
|
||||
bool is_shutdown);
|
||||
|
||||
/**
|
||||
* cam_req_mgr_link()
|
||||
|
|
|
|||
|
|
@ -258,7 +258,7 @@ static long cam_private_ioctl(struct file *file, void *fh,
|
|||
return -EFAULT;
|
||||
}
|
||||
|
||||
rc = cam_req_mgr_destroy_session(&ses_info);
|
||||
rc = cam_req_mgr_destroy_session(&ses_info, false);
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
|
||||
*/
|
||||
|
||||
#define pr_fmt(fmt) "CAM-REQ-MGR_UTIL %s:%d " fmt, __func__, __LINE__
|
||||
|
|
@ -94,7 +94,7 @@ int cam_req_mgr_util_free_hdls(void)
|
|||
|
||||
for (i = 0; i < CAM_REQ_MGR_MAX_HANDLES; i++) {
|
||||
if (hdl_tbl->hdl[i].state == HDL_ACTIVE) {
|
||||
CAM_ERR(CAM_CRM, "Dev handle = %x session_handle = %x",
|
||||
CAM_WARN(CAM_CRM, "Dev handle = %x session_handle = %x",
|
||||
hdl_tbl->hdl[i].hdl_value,
|
||||
hdl_tbl->hdl[i].session_hdl);
|
||||
hdl_tbl->hdl[i].state = HDL_FREE;
|
||||
|
|
|
|||
|
|
@ -565,9 +565,13 @@ void cam_sensor_shutdown(struct cam_sensor_ctrl_t *s_ctrl)
|
|||
if (s_ctrl->sensor_state != CAM_SENSOR_INIT)
|
||||
cam_sensor_power_down(s_ctrl);
|
||||
|
||||
rc = cam_destroy_device_hdl(s_ctrl->bridge_intf.device_hdl);
|
||||
if (rc < 0)
|
||||
CAM_ERR(CAM_SENSOR, "dhdl already destroyed: rc = %d", rc);
|
||||
if (s_ctrl->bridge_intf.device_hdl != -1) {
|
||||
rc = cam_destroy_device_hdl(s_ctrl->bridge_intf.device_hdl);
|
||||
if (rc < 0)
|
||||
CAM_ERR(CAM_SENSOR,
|
||||
"dhdl already destroyed: rc = %d", rc);
|
||||
}
|
||||
|
||||
s_ctrl->bridge_intf.device_hdl = -1;
|
||||
s_ctrl->bridge_intf.link_hdl = -1;
|
||||
s_ctrl->bridge_intf.session_hdl = -1;
|
||||
|
|
|
|||
Loading…
Reference in a new issue