|
@@ -1,7 +1,7 @@
|
|
// SPDX-License-Identifier: GPL-2.0-only
|
|
// SPDX-License-Identifier: GPL-2.0-only
|
|
/*
|
|
/*
|
|
* Copyright (c) 2021, The Linux Foundation. All rights reserved.
|
|
* Copyright (c) 2021, The Linux Foundation. All rights reserved.
|
|
- * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
|
|
|
|
|
|
+ * Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved.
|
|
*/
|
|
*/
|
|
|
|
|
|
#include "cam_tpg_core.h"
|
|
#include "cam_tpg_core.h"
|
|
@@ -14,7 +14,8 @@ int cam_tpg_shutdown(struct cam_tpg_device *tpg_dev)
|
|
if (tpg_dev != NULL) {
|
|
if (tpg_dev != NULL) {
|
|
CAM_INFO(CAM_TPG, "TPG[%d] shutdown cleanup.",
|
|
CAM_INFO(CAM_TPG, "TPG[%d] shutdown cleanup.",
|
|
tpg_dev->soc_info.index);
|
|
tpg_dev->soc_info.index);
|
|
- tpg_hw_reset(&tpg_dev->tpg_hw);
|
|
|
|
|
|
+ if (!tpg_dev->hw_no_ops)
|
|
|
|
+ tpg_hw_reset(&tpg_dev->tpg_hw);
|
|
tpg_dev->state = CAM_TPG_STATE_INIT;
|
|
tpg_dev->state = CAM_TPG_STATE_INIT;
|
|
}
|
|
}
|
|
return 0;
|
|
return 0;
|
|
@@ -149,7 +150,11 @@ static int cam_tpg_process_crm_evt(
|
|
|
|
|
|
switch(event->evt_type) {
|
|
switch(event->evt_type) {
|
|
case CAM_REQ_MGR_LINK_EVT_SOF_FREEZE:
|
|
case CAM_REQ_MGR_LINK_EVT_SOF_FREEZE:
|
|
- tpg_hw_dump_status(&tpg_dev->tpg_hw);
|
|
|
|
|
|
+ if (tpg_dev->hw_no_ops) {
|
|
|
|
+ CAM_DBG(CAM_TPG, "TPG[%d] SOF Freeze hw_no_ops: %d",
|
|
|
|
+ tpg_dev->soc_info.index, tpg_dev->hw_no_ops);
|
|
|
|
+ } else
|
|
|
|
+ tpg_hw_dump_status(&tpg_dev->tpg_hw);
|
|
break;
|
|
break;
|
|
default:
|
|
default:
|
|
CAM_DBG(CAM_TPG, "Got crm event notification: %d", event->evt_type);
|
|
CAM_DBG(CAM_TPG, "Got crm event notification: %d", event->evt_type);
|
|
@@ -286,11 +291,13 @@ static int __cam_tpg_handle_release_dev(
|
|
if (tpg_dev->state == CAM_TPG_STATE_START) {
|
|
if (tpg_dev->state == CAM_TPG_STATE_START) {
|
|
CAM_DBG(CAM_TPG, "TPG[%d] release from start state",
|
|
CAM_DBG(CAM_TPG, "TPG[%d] release from start state",
|
|
tpg_dev->soc_info.index);
|
|
tpg_dev->soc_info.index);
|
|
- rc = tpg_hw_stop(&tpg_dev->tpg_hw);
|
|
|
|
- if (rc < 0) {
|
|
|
|
- CAM_ERR(CAM_TPG, "TPG[%d] unable to stop tpg",
|
|
|
|
|
|
+ if (!tpg_dev->hw_no_ops) {
|
|
|
|
+ rc = tpg_hw_stop(&tpg_dev->tpg_hw);
|
|
|
|
+ if (rc < 0) {
|
|
|
|
+ CAM_ERR(CAM_TPG, "TPG[%d] unable to stop tpg",
|
|
tpg_dev->soc_info.index);
|
|
tpg_dev->soc_info.index);
|
|
- return rc;
|
|
|
|
|
|
+ return rc;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
rc = tpg_hw_release(&tpg_dev->tpg_hw);
|
|
rc = tpg_hw_release(&tpg_dev->tpg_hw);
|
|
@@ -330,12 +337,16 @@ static int __cam_tpg_handle_start_dev(
|
|
tpg_dev->soc_info.index, tpg_dev->state);
|
|
tpg_dev->soc_info.index, tpg_dev->state);
|
|
return -EINVAL;
|
|
return -EINVAL;
|
|
}
|
|
}
|
|
- rc = tpg_hw_start(&tpg_dev->tpg_hw);
|
|
|
|
|
|
+ if (!tpg_dev->hw_no_ops)
|
|
|
|
+ rc = tpg_hw_start(&tpg_dev->tpg_hw);
|
|
|
|
+
|
|
if (rc) {
|
|
if (rc) {
|
|
- CAM_ERR(CAM_TPG, "TPG[%d] START_DEV failed", tpg_dev->soc_info.index);
|
|
|
|
|
|
+ CAM_ERR(CAM_TPG, "TPG[%d] START_DEV failed hw_no_ops: %d",
|
|
|
|
+ tpg_dev->soc_info.index, tpg_dev->hw_no_ops);
|
|
} else {
|
|
} else {
|
|
tpg_dev->state = CAM_TPG_STATE_START;
|
|
tpg_dev->state = CAM_TPG_STATE_START;
|
|
- CAM_INFO(CAM_TPG, "TPG[%d] START_DEV done.", tpg_dev->soc_info.index);
|
|
|
|
|
|
+ CAM_INFO(CAM_TPG, "TPG[%d] START_DEV done hw_no_ops: %d.",
|
|
|
|
+ tpg_dev->soc_info.index, tpg_dev->hw_no_ops);
|
|
}
|
|
}
|
|
|
|
|
|
return rc;
|
|
return rc;
|
|
@@ -362,12 +373,15 @@ static int __cam_tpg_handle_stop_dev(
|
|
CAM_WARN(CAM_TPG, "TPG[%d] not in right state[%d] to stop",
|
|
CAM_WARN(CAM_TPG, "TPG[%d] not in right state[%d] to stop",
|
|
tpg_dev->soc_info.index, tpg_dev->state);
|
|
tpg_dev->soc_info.index, tpg_dev->state);
|
|
}
|
|
}
|
|
- rc = tpg_hw_stop(&tpg_dev->tpg_hw);
|
|
|
|
|
|
+ if (!tpg_dev->hw_no_ops)
|
|
|
|
+ rc = tpg_hw_stop(&tpg_dev->tpg_hw);
|
|
if (rc) {
|
|
if (rc) {
|
|
- CAM_ERR(CAM_TPG, "TPG[%d] STOP_DEV failed", tpg_dev->soc_info.index);
|
|
|
|
|
|
+ CAM_ERR(CAM_TPG, "TPG[%d] STOP_DEV failed hw_no_ops: %d",
|
|
|
|
+ tpg_dev->soc_info.index, tpg_dev->hw_no_ops);
|
|
} else {
|
|
} else {
|
|
tpg_dev->state = CAM_TPG_STATE_ACQUIRE;
|
|
tpg_dev->state = CAM_TPG_STATE_ACQUIRE;
|
|
- CAM_INFO(CAM_TPG, "TPG[%d] STOP_DEV done.", tpg_dev->soc_info.index);
|
|
|
|
|
|
+ CAM_INFO(CAM_TPG, "TPG[%d] STOP_DEV done hw_no_ops: %d.",
|
|
|
|
+ tpg_dev->soc_info.index, tpg_dev->hw_no_ops);
|
|
}
|
|
}
|
|
|
|
|
|
return rc;
|
|
return rc;
|
|
@@ -539,13 +553,15 @@ static int cam_tpg_cmd_buf_parse(
|
|
tpg_dev->tpg_hw.tpg_clock = req->global_config.tpg_clock;
|
|
tpg_dev->tpg_hw.tpg_clock = req->global_config.tpg_clock;
|
|
break;
|
|
break;
|
|
case TPG_CMD_TYPE_STREAM_CONFIG: {
|
|
case TPG_CMD_TYPE_STREAM_CONFIG: {
|
|
- if (cmd_header->cmd_version == 3) {
|
|
|
|
|
|
+ if ((cmd_header->cmd_version == 3) &&
|
|
|
|
+ (!tpg_dev->hw_no_ops)) {
|
|
rc = tpg_hw_add_stream_v3(&tpg_dev->tpg_hw,
|
|
rc = tpg_hw_add_stream_v3(&tpg_dev->tpg_hw,
|
|
req,
|
|
req,
|
|
(struct tpg_stream_config_v3_t *)cmd_addr);
|
|
(struct tpg_stream_config_v3_t *)cmd_addr);
|
|
CAM_DBG(CAM_TPG, "Stream config v3");
|
|
CAM_DBG(CAM_TPG, "Stream config v3");
|
|
- } else if (cmd_header->cmd_version == 1 ||
|
|
|
|
- cmd_header->cmd_version == 2) {
|
|
|
|
|
|
+ } else if ((cmd_header->cmd_version == 1 ||
|
|
|
|
+ cmd_header->cmd_version == 2) &&
|
|
|
|
+ (!tpg_dev->hw_no_ops)) {
|
|
rc = tpg_hw_add_stream(&tpg_dev->tpg_hw,
|
|
rc = tpg_hw_add_stream(&tpg_dev->tpg_hw,
|
|
req,
|
|
req,
|
|
(struct tpg_stream_config_t *)cmd_addr);
|
|
(struct tpg_stream_config_t *)cmd_addr);
|
|
@@ -558,7 +574,9 @@ static int cam_tpg_cmd_buf_parse(
|
|
case TPG_CMD_TYPE_SETTINGS_CONFIG: {
|
|
case TPG_CMD_TYPE_SETTINGS_CONFIG: {
|
|
CAM_DBG(CAM_TPG, "TPG[%d] Got TPG Settings Config",
|
|
CAM_DBG(CAM_TPG, "TPG[%d] Got TPG Settings Config",
|
|
tpg_dev->soc_info.index);
|
|
tpg_dev->soc_info.index);
|
|
- rc = tpg_hw_copy_settings_config(&tpg_dev->tpg_hw,
|
|
|
|
|
|
+ if (!tpg_dev->hw_no_ops)
|
|
|
|
+ rc = tpg_hw_copy_settings_config(
|
|
|
|
+ &tpg_dev->tpg_hw,
|
|
(struct tpg_settings_config_t *)cmd_addr);
|
|
(struct tpg_settings_config_t *)cmd_addr);
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
@@ -575,7 +593,8 @@ static int cam_tpg_cmd_buf_parse(
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- tpg_hw_add_request(&tpg_dev->tpg_hw, req);
|
|
|
|
|
|
+ if (!tpg_dev->hw_no_ops)
|
|
|
|
+ tpg_hw_add_request(&tpg_dev->tpg_hw, req);
|
|
end:
|
|
end:
|
|
return rc;
|
|
return rc;
|
|
free_request:
|
|
free_request:
|
|
@@ -641,7 +660,9 @@ static int cam_tpg_packet_parse(
|
|
CAM_ERR(CAM_TPG, "CMD buffer parse failed");
|
|
CAM_ERR(CAM_TPG, "CMD buffer parse failed");
|
|
goto end;
|
|
goto end;
|
|
}
|
|
}
|
|
- tpg_hw_config(&tpg_dev->tpg_hw, TPG_HW_CMD_INIT_CONFIG, NULL);
|
|
|
|
|
|
+ if (!tpg_dev->hw_no_ops)
|
|
|
|
+ tpg_hw_config(&tpg_dev->tpg_hw,
|
|
|
|
+ TPG_HW_CMD_INIT_CONFIG, NULL);
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
case CAM_TPG_PACKET_OPCODE_NOP:
|
|
case CAM_TPG_PACKET_OPCODE_NOP:
|