msm: camera: sync: Add support to invoke synx recover
If ICP FW is to be redowloaded, issue a synx recover for this ICP core so that IPC/synx for the previous session can be cleaned up prior to the next ICP cold boot. CRs-Fixed: 3448052 Change-Id: I9f8f772730f7e4a8873b6dbdcf7a896ad6193150 Signed-off-by: Karthik Anantha Ram <quic_kartanan@quicinc.com>
This commit is contained in:

committed by
Camera Software Integration

parent
42c90f68b7
commit
267f259a72
@@ -4048,6 +4048,9 @@ static void cam_icp_mgr_proc_shutdown(struct cam_icp_hw_mgr *hw_mgr)
|
|||||||
icp_dev_intf->hw_ops.deinit(icp_dev_intf->hw_priv,
|
icp_dev_intf->hw_ops.deinit(icp_dev_intf->hw_priv,
|
||||||
&send_freq_info, sizeof(send_freq_info));
|
&send_freq_info, sizeof(send_freq_info));
|
||||||
|
|
||||||
|
if (hw_mgr->synx_signaling_en)
|
||||||
|
cam_sync_synx_core_recovery(hw_mgr->synx_core_id);
|
||||||
|
|
||||||
hw_mgr->icp_resumed = false;
|
hw_mgr->icp_resumed = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -8075,6 +8078,20 @@ int cam_icp_hw_mgr_init(struct device_node *of_node, uint64_t *hw_mgr_hdl,
|
|||||||
if (rc)
|
if (rc)
|
||||||
goto icp_get_svs_clk_failed;
|
goto icp_get_svs_clk_failed;
|
||||||
|
|
||||||
|
if (hw_mgr->synx_signaling_en) {
|
||||||
|
switch (hw_mgr->hw_mgr_id) {
|
||||||
|
case 0:
|
||||||
|
hw_mgr->synx_core_id = CAM_ICP_0_SYNX_CORE;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
hw_mgr->synx_core_id = CAM_ICP_1_SYNX_CORE;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
hw_mgr->synx_core_id = CAM_INVALID_SYNX_CORE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
g_icp_hw_mgr[device_idx] = hw_mgr;
|
g_icp_hw_mgr[device_idx] = hw_mgr;
|
||||||
|
|
||||||
CAM_DBG(CAM_ICP, "Done hw mgr[%u] init: icp name:%s",
|
CAM_DBG(CAM_ICP, "Done hw mgr[%u] init: icp name:%s",
|
||||||
|
@@ -420,6 +420,7 @@ struct cam_icp_hw_ctx_data {
|
|||||||
* @iommu_hdl: Non secure IOMMU handle
|
* @iommu_hdl: Non secure IOMMU handle
|
||||||
* @iommu_sec_hdl: Secure IOMMU handle
|
* @iommu_sec_hdl: Secure IOMMU handle
|
||||||
* @hfi_handle: hfi handle for this ICP hw mgr
|
* @hfi_handle: hfi handle for this ICP hw mgr
|
||||||
|
* @synx_core_id: Synx core ID if applicable
|
||||||
* @hfi_mem: Memory for hfi
|
* @hfi_mem: Memory for hfi
|
||||||
* @cmd_work: Work queue for hfi commands
|
* @cmd_work: Work queue for hfi commands
|
||||||
* @msg_work: Work queue for hfi messages
|
* @msg_work: Work queue for hfi messages
|
||||||
@@ -473,6 +474,7 @@ struct cam_icp_hw_mgr {
|
|||||||
int32_t iommu_hdl;
|
int32_t iommu_hdl;
|
||||||
int32_t iommu_sec_hdl;
|
int32_t iommu_sec_hdl;
|
||||||
int32_t hfi_handle;
|
int32_t hfi_handle;
|
||||||
|
enum cam_sync_synx_supported_cores synx_core_id;
|
||||||
struct icp_hfi_mem_info hfi_mem;
|
struct icp_hfi_mem_info hfi_mem;
|
||||||
struct cam_req_mgr_core_workq *cmd_work;
|
struct cam_req_mgr_core_workq *cmd_work;
|
||||||
struct cam_req_mgr_core_workq *msg_work;
|
struct cam_req_mgr_core_workq *msg_work;
|
||||||
|
@@ -1437,6 +1437,18 @@ static int cam_generic_fence_process_dma_fence_cmd(
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int cam_sync_synx_core_recovery(
|
||||||
|
enum cam_sync_synx_supported_cores core_id)
|
||||||
|
{
|
||||||
|
int rc = -EOPNOTSUPP;
|
||||||
|
|
||||||
|
#if IS_ENABLED(CONFIG_TARGET_SYNX_ENABLE)
|
||||||
|
rc = cam_synx_core_recovery(core_id);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
#if IS_ENABLED(CONFIG_TARGET_SYNX_ENABLE)
|
#if IS_ENABLED(CONFIG_TARGET_SYNX_ENABLE)
|
||||||
static int cam_generic_fence_validate_signal_input_info_util(
|
static int cam_generic_fence_validate_signal_input_info_util(
|
||||||
int32_t fence_type,
|
int32_t fence_type,
|
||||||
|
@@ -16,6 +16,12 @@
|
|||||||
#define SYNC_DEBUG_NAME_LEN 63
|
#define SYNC_DEBUG_NAME_LEN 63
|
||||||
typedef void (*sync_callback)(int32_t sync_obj, int status, void *data);
|
typedef void (*sync_callback)(int32_t sync_obj, int status, void *data);
|
||||||
|
|
||||||
|
enum cam_sync_synx_supported_cores {
|
||||||
|
CAM_ICP_0_SYNX_CORE = 1,
|
||||||
|
CAM_ICP_1_SYNX_CORE,
|
||||||
|
CAM_INVALID_SYNX_CORE,
|
||||||
|
};
|
||||||
|
|
||||||
/* Kernel APIs */
|
/* Kernel APIs */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -153,6 +159,17 @@ int cam_sync_wait(int32_t sync_obj, uint64_t timeout_ms);
|
|||||||
*/
|
*/
|
||||||
int cam_sync_check_valid(int32_t sync_obj);
|
int cam_sync_check_valid(int32_t sync_obj);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief: Synx recovery for a given core
|
||||||
|
*
|
||||||
|
* @param core_id: Core ID we want to recover for
|
||||||
|
*
|
||||||
|
* @return Status of operation. Zero in case of success
|
||||||
|
* -EINVAL if core_id is invalid
|
||||||
|
*/
|
||||||
|
int cam_sync_synx_core_recovery(
|
||||||
|
enum cam_sync_synx_supported_cores core_id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief : API to register SYNC to platform framework.
|
* @brief : API to register SYNC to platform framework.
|
||||||
*
|
*
|
||||||
|
@@ -722,6 +722,36 @@ monitor_dump:
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int cam_synx_core_recovery(
|
||||||
|
enum cam_sync_synx_supported_cores cam_core_id)
|
||||||
|
{
|
||||||
|
int rc;
|
||||||
|
enum synx_client_id client_id = SYNX_CLIENT_MAX;
|
||||||
|
|
||||||
|
switch (cam_core_id) {
|
||||||
|
case CAM_ICP_0_SYNX_CORE:
|
||||||
|
client_id = SYNX_CLIENT_ICP_CTX0;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
rc = -EINVAL;
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
|
|
||||||
|
rc = synx_recover(client_id);
|
||||||
|
if (rc)
|
||||||
|
goto err;
|
||||||
|
|
||||||
|
CAM_DBG(CAM_SYNX, "Synx recovery for synx_client: %d[%d] success",
|
||||||
|
client_id, cam_core_id);
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
|
||||||
|
err:
|
||||||
|
CAM_ERR(CAM_SYNX, "Failed to recover for synx_client: %d rc: %d",
|
||||||
|
client_id, rc);
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
int __cam_synx_init_session(void)
|
int __cam_synx_init_session(void)
|
||||||
{
|
{
|
||||||
struct synx_queue_desc queue_desc;
|
struct synx_queue_desc queue_desc;
|
||||||
|
@@ -10,6 +10,7 @@
|
|||||||
#include <linux/bitmap.h>
|
#include <linux/bitmap.h>
|
||||||
#include <synx_api.h>
|
#include <synx_api.h>
|
||||||
|
|
||||||
|
#include "cam_sync_api.h"
|
||||||
#include "cam_sync.h"
|
#include "cam_sync.h"
|
||||||
#include "cam_debug_util.h"
|
#include "cam_debug_util.h"
|
||||||
|
|
||||||
@@ -138,6 +139,17 @@ int cam_synx_obj_signal_obj(struct cam_synx_obj_signal *signal_synx_obj);
|
|||||||
int cam_synx_obj_register_cb(int32_t *sync_obj, int32_t row_idx,
|
int cam_synx_obj_register_cb(int32_t *sync_obj, int32_t row_idx,
|
||||||
cam_sync_callback_for_synx_obj sync_cb);
|
cam_sync_callback_for_synx_obj sync_cb);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief: Synx recovery for a given core
|
||||||
|
*
|
||||||
|
* @param core_id: Core ID we want to recover for
|
||||||
|
*
|
||||||
|
* @return Status of operation. Zero in case of success
|
||||||
|
* -EINVAL if core_id is invalid
|
||||||
|
*/
|
||||||
|
int cam_synx_core_recovery(
|
||||||
|
enum cam_sync_synx_supported_cores core_id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief: cam synx driver open
|
* @brief: cam synx driver open
|
||||||
*
|
*
|
||||||
|
Reference in New Issue
Block a user