|
@@ -1,7 +1,7 @@
|
|
|
// SPDX-License-Identifier: GPL-2.0-only
|
|
|
/*
|
|
|
* Copyright (c) 2016-2021, The Linux Foundation. All rights reserved.
|
|
|
- * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
|
|
|
+ * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
|
|
|
*/
|
|
|
|
|
|
#include <linux/module.h>
|
|
@@ -47,7 +47,9 @@ void cam_req_mgr_core_link_reset(struct cam_req_mgr_core_link *link)
|
|
|
link->req.l_tbl = NULL;
|
|
|
link->req.num_tbl = 0;
|
|
|
link->watchdog = NULL;
|
|
|
+ spin_lock_bh(&link->link_state_spin_lock);
|
|
|
link->state = CAM_CRM_LINK_STATE_AVAILABLE;
|
|
|
+ spin_unlock_bh(&link->link_state_spin_lock);
|
|
|
link->parent = NULL;
|
|
|
link->sync_link_sof_skip = false;
|
|
|
link->open_req_cnt = 0;
|
|
@@ -71,7 +73,9 @@ void cam_req_mgr_core_link_reset(struct cam_req_mgr_core_link *link)
|
|
|
link->try_for_internal_recovery = false;
|
|
|
link->is_sending_req = false;
|
|
|
atomic_set(&link->eof_event_cnt, 0);
|
|
|
+ mutex_lock(&link->lock);
|
|
|
link->properties_mask = CAM_LINK_PROPERTY_NONE;
|
|
|
+ mutex_unlock(&link->lock);
|
|
|
link->cont_empty_slots = 0;
|
|
|
__cam_req_mgr_reset_apply_data(link);
|
|
|
|
|
@@ -1810,11 +1814,14 @@ static int __cam_req_mgr_check_multi_sync_link_ready(
|
|
|
{
|
|
|
int i, rc = 0;
|
|
|
|
|
|
+ spin_lock_bh(&link->link_state_spin_lock);
|
|
|
if (link->state == CAM_CRM_LINK_STATE_IDLE) {
|
|
|
+ spin_unlock_bh(&link->link_state_spin_lock);
|
|
|
CAM_ERR(CAM_CRM, "link hdl %x is in idle state",
|
|
|
link->link_hdl);
|
|
|
return -EINVAL;
|
|
|
}
|
|
|
+ spin_unlock_bh(&link->link_state_spin_lock);
|
|
|
|
|
|
for (i = 0; i < num_sync_links; i++) {
|
|
|
if (sync_link[i]) {
|
|
@@ -2689,7 +2696,11 @@ static struct cam_req_mgr_core_link *__cam_req_mgr_reserve_link(
|
|
|
sizeof(struct cam_req_mgr_slot) * MAX_REQ_SLOTS);
|
|
|
link->req.in_q = in_q;
|
|
|
in_q->num_slots = 0;
|
|
|
+
|
|
|
+ spin_lock_bh(&link->link_state_spin_lock);
|
|
|
link->state = CAM_CRM_LINK_STATE_IDLE;
|
|
|
+ spin_unlock_bh(&link->link_state_spin_lock);
|
|
|
+
|
|
|
link->parent = (void *)session;
|
|
|
link->is_sending_req = false;
|
|
|
|
|
@@ -5170,7 +5181,9 @@ int cam_req_mgr_link_control(struct cam_req_mgr_link_control *control)
|
|
|
/* Wait for the streaming of sync link */
|
|
|
link->initial_skip = true;
|
|
|
/* Pause the timer before sensor stream on */
|
|
|
+ spin_lock_bh(&link->link_state_spin_lock);
|
|
|
link->watchdog->pause_timer = true;
|
|
|
+ spin_unlock_bh(&link->link_state_spin_lock);
|
|
|
/* notify nodes */
|
|
|
__cam_req_mgr_send_evt(0, CAM_REQ_MGR_LINK_EVT_RESUME,
|
|
|
CRM_KMD_ERR_MAX, link);
|
|
@@ -5216,13 +5229,16 @@ int cam_req_mgr_link_properties(struct cam_req_mgr_link_properties *properties)
|
|
|
goto end;
|
|
|
}
|
|
|
|
|
|
+ spin_lock_bh(&link->link_state_spin_lock);
|
|
|
if (link->state != CAM_CRM_LINK_STATE_READY) {
|
|
|
+ spin_unlock_bh(&link->link_state_spin_lock);
|
|
|
CAM_ERR(CAM_CRM,
|
|
|
"Only can config link 0x%x properties in ready state",
|
|
|
link->link_hdl);
|
|
|
rc = -EAGAIN;
|
|
|
goto end;
|
|
|
}
|
|
|
+ spin_unlock_bh(&link->link_state_spin_lock);
|
|
|
|
|
|
mutex_lock(&link->lock);
|
|
|
link->properties_mask = properties->properties_mask;
|