msm: eva: Remove unused dsp power flags

Avoid mis-use of old flag that could lead to failure in
powering collapse EVA when a session becomes idle for 3s.

Change-Id: I954bc0972b1f627b274b78659c34626127619af5
Signed-off-by: George Shen <quic_sqiao@quicinc.com>
This commit is contained in:
George Shen
2023-03-16 22:21:12 -07:00
committed by Gerrit - the friendly Code Review server
parent a33d13c191
commit dcaf2dcdfb
3 changed files with 44 additions and 43 deletions

View File

@@ -247,30 +247,15 @@ static void __dump_packet(u8 *packet, enum cvp_msg_prio log_level)
}
}
static int __dsp_suspend(struct iris_hfi_device *device, bool force, u32 flags)
static int __dsp_suspend(struct iris_hfi_device *device, bool force)
{
int rc;
struct cvp_hal_session *temp;
if (msm_cvp_dsp_disable)
return 0;
list_for_each_entry(temp, &device->sess_head, list) {
/* if forceful suspend, don't check session pause info */
if (force)
continue;
/* don't suspend if cvp session is not paused */
if (!(temp->flags & SESSION_PAUSE)) {
dprintk(CVP_DSP,
"%s: cvp session %x not paused %d\n",
__func__, hash32_ptr(temp), gfa_cv.state);
return -EBUSY;
}
}
dprintk(CVP_DSP, "%s: suspend dsp\n", __func__);
rc = cvp_dsp_suspend(flags);
rc = cvp_dsp_suspend(force);
if (rc) {
dprintk(CVP_ERR, "%s: dsp suspend failed with error %d\n",
__func__, rc);
@@ -281,7 +266,7 @@ static int __dsp_suspend(struct iris_hfi_device *device, bool force, u32 flags)
return 0;
}
static int __dsp_resume(struct iris_hfi_device *device, u32 flags)
static int __dsp_resume(struct iris_hfi_device *device)
{
int rc;
@@ -289,7 +274,7 @@ static int __dsp_resume(struct iris_hfi_device *device, u32 flags)
return 0;
dprintk(CVP_DSP, "%s: resume dsp\n", __func__);
rc = cvp_dsp_resume(flags);
rc = cvp_dsp_resume();
if (rc) {
dprintk(CVP_ERR,
"%s: dsp resume failed with error %d\n",
@@ -301,7 +286,7 @@ static int __dsp_resume(struct iris_hfi_device *device, u32 flags)
return rc;
}
static int __dsp_shutdown(struct iris_hfi_device *device, u32 flags)
static int __dsp_shutdown(struct iris_hfi_device *device)
{
int rc;
@@ -309,7 +294,7 @@ static int __dsp_shutdown(struct iris_hfi_device *device, u32 flags)
return 0;
dprintk(CVP_DSP, "%s: shutdown dsp\n", __func__);
rc = cvp_dsp_shutdown(flags);
rc = cvp_dsp_shutdown();
if (rc) {
dprintk(CVP_ERR,
"%s: dsp shutdown failed with error %d\n",
@@ -2285,7 +2270,7 @@ static int iris_hfi_core_release(void *dev)
__resume(device);
__set_state(device, IRIS_STATE_DEINIT);
__dsp_shutdown(device, 0);
__dsp_shutdown(device);
__disable_subcaches(device);
__unload_fw(device);
@@ -2938,7 +2923,6 @@ static int __power_collapse(struct iris_hfi_device *device, bool force)
{
int rc = 0;
u32 wfi_status = 0, idle_status = 0, pc_ready = 0;
u32 flags = 0;
int count = 0;
const int max_tries = 150;
@@ -2959,7 +2943,7 @@ static int __power_collapse(struct iris_hfi_device *device, bool force)
return -EINVAL;
}
rc = __dsp_suspend(device, force, flags);
rc = __dsp_suspend(device, force);
if (rc == -EBUSY)
goto exit;
else if (rc)
@@ -4788,7 +4772,7 @@ static void power_off_iris2(struct iris_hfi_device *device)
static inline int __resume(struct iris_hfi_device *device)
{
int rc = 0;
u32 flags = 0, reg_gdsc, reg_cbcr;
u32 reg_gdsc, reg_cbcr;
struct msm_cvp_core *core;
if (!device) {
@@ -4848,7 +4832,7 @@ static inline int __resume(struct iris_hfi_device *device)
__set_subcaches(device);
__dsp_resume(device, flags);
__dsp_resume(device);
dprintk(CVP_PWR, "Resumed from power collapse\n");
exit:

View File

@@ -487,7 +487,27 @@ exit:
return 0;
}
int cvp_dsp_suspend(uint32_t session_flag)
static bool dsp_session_exist(void)
{
struct msm_cvp_core *core;
struct msm_cvp_inst *inst = NULL;
core = list_first_entry(&cvp_driver->cores, struct msm_cvp_core, list);
if (core) {
mutex_lock(&core->lock);
list_for_each_entry(inst, &core->instances, list) {
if (inst->session_type == MSM_CVP_DSP) {
mutex_unlock(&core->lock);
return true;
}
}
mutex_unlock(&core->lock);
}
return false;
}
int cvp_dsp_suspend(bool force)
{
int rc = 0;
struct cvp_dsp_cmd_msg cmd;
@@ -495,6 +515,13 @@ int cvp_dsp_suspend(uint32_t session_flag)
struct cvp_dsp_rsp_msg rsp;
bool retried = false;
/* If not forced to suspend, check if DSP requested PC earlier */
if (force == false)
if (dsp_session_exist())
if (me->state != DSP_SUSPEND)
return -EBUSY;
cmd.type = CPU2DSP_SUSPEND;
mutex_lock(&me->tx_lock);
@@ -546,7 +573,7 @@ exit:
return rc;
}
int cvp_dsp_resume(uint32_t session_flag)
int cvp_dsp_resume(void)
{
int rc = 0;
struct cvp_dsp_cmd_msg cmd;
@@ -610,7 +637,7 @@ static void cvp_remove_dsp_sessions(void)
dprintk(CVP_WARN, "%s: EVA SSR handled for CDSP\n", __func__);
}
int cvp_dsp_shutdown(uint32_t session_flag)
int cvp_dsp_shutdown(void)
{
struct cvp_dsp_apps *me = &gfa_cv;
int rc = 0;
@@ -860,7 +887,6 @@ void cvp_dsp_init_hfi_queue_hdr(struct iris_hfi_device *device)
static int __reinit_dsp(void)
{
int rc;
uint32_t flag = 0;
uint64_t addr;
uint32_t size;
struct cvp_dsp_apps *me = &gfa_cv;
@@ -880,7 +906,7 @@ static int __reinit_dsp(void)
}
/* Force shutdown DSP */
rc = cvp_dsp_shutdown(flag);
rc = cvp_dsp_shutdown();
if (rc)
return rc;
/*

View File

@@ -251,29 +251,20 @@ extern struct cvp_dsp_apps gfa_cv;
/*
* API for CVP driver to suspend CVP session during
* power collapse
*
* @param session_flag
* Flag to share details of session.
*/
int cvp_dsp_suspend(uint32_t session_flag);
int cvp_dsp_suspend(bool force);
/*
* API for CVP driver to resume CVP session during
* power collapse
*
* @param session_flag
* Flag to share details of session.
*/
int cvp_dsp_resume(uint32_t session_flag);
int cvp_dsp_resume(void);
/*
* API for CVP driver to shutdown CVP session during
* cvp subsystem error.
*
* @param session_flag
* Flag to share details of session.
*/
int cvp_dsp_shutdown(uint32_t session_flag);
int cvp_dsp_shutdown(void);
/*
* API to register iova buffer address with CDSP