msm: camera: icp: Trigger FW load/unload via debugfs

Based on compilation flag CONFIG_CAM_TEST_ICP_FW_DOWNLOAD, ICP
FW load/unload sequence can be verified. This change initializes
memory manager for load and de-initializes memmgr during unload.

To trigger FW download-
adb shell "echo "load" > /sys/kernel/debug/camera_icp/icp_fw_load_unload"

FW unload -
adb shell "echo "unload" > /sys/kernel/debug/camera_icp/icp_fw_load_unload"

CONFIG_CAM_TEST_FW_DOWNLOAD needs to be set only for testing
FW loading when camera server is not enabled.

The change also adds protection for repeated memmgr init/deinit calls.

CRs-Fixed: 3097781
Change-Id: Iceb5089793313b086b9d4fc3770a87860237e741
Signed-off-by: Karthik Anantha Ram <quic_kartanan@quicinc.com>
This commit is contained in:
Karthik Anantha Ram
2021-11-01 14:48:37 -07:00
parent 927b715d57
commit 03ec3b418c
2 changed files with 48 additions and 0 deletions

View File

@@ -191,6 +191,9 @@ int cam_mem_mgr_init(void)
int bitmap_size;
int rc = 0;
if (atomic_read(&cam_mem_mgr_state))
return 0;
memset(tbl.bufq, 0, sizeof(tbl.bufq));
if (cam_smmu_need_force_alloc_cached(&tbl.force_cache_allocs)) {
@@ -1316,6 +1319,9 @@ static int cam_mem_mgr_cleanup_table(void)
void cam_mem_mgr_deinit(void)
{
if (!atomic_read(&cam_mem_mgr_state))
return;
atomic_set(&cam_mem_mgr_state, CAM_MEM_MGR_UNINITIALIZED);
cam_mem_mgr_cleanup_table();
debugfs_remove_recursive(tbl.dentry);