DSP: SC2 ffv dsp do not enter power off while in early suspend [1/2]

PD#SWPL-179917

Problem:
1. There's no power consumption limitation in early suspend
state.
2. After pressing power key to enter suspend, audio hal would
release audio_in lock slowly (after about 300ms or more), and
audio hal would send mbox cmd for pcm read and get latency.
3. After audio_in lock released, audio hal needsend mbox cmd
to check DSP VAD keywords wakeup first before Google katniss
receive the screen wakeup event.

Solution:
1. DSP do not enter power off while in early suspend.
2. Host driver do not switch clk if ffv is supported.

Verify:
sc2

Change-Id: I79768a691ac07af60fa8dc7e471254937398f727
Signed-off-by: bangzheng.liu <bangzheng.liu@amlogic.com>
This commit is contained in:
bangzheng.liu
2024-08-01 10:03:55 +08:00
committed by Luan Yuan
parent 14f416f380
commit 8a5d72b04d
+19 -33
View File
@@ -454,13 +454,8 @@ static void host_early_suspend(struct early_suspend *h)
return;
if (pm_runtime_active(host->dev) && host->host_dsp->pm_support_suspend) {
if (host->host_dsp->pm_support_pwrctrl) {
host->host_dsp->pwrctrl_access_en = 1;
host_psci_smc(host, SMC_SUBID_HIFI_DSP_PWRCTRL);
}
pr_debug("early suspend: AP send suspend cmd to dsp...\n");
strncpy(message, "HIFISUSPEND_WITH_FFV", sizeof(message));
strncpy(message, "HIFI_EARLY_SUSPEND_WITH_FFV", sizeof(message));
aml_mbox_transfer_data(host->mbox_chan_to_dev,
MBOX_CMD_HIFI4SUSPEND,
message,
@@ -481,7 +476,7 @@ static void host_late_resume(struct early_suspend *h)
if (pm_runtime_active(host->dev) && host->host_dsp->pm_support_suspend) {
pr_debug("late resume: AP send resume cmd to dsp...\n");
strncpy(message, "RESUME_WITH_FFV", sizeof(message));
strncpy(message, "HIFI_LATE_RESUME_WITH_FFV", sizeof(message));
aml_mbox_transfer_data(host->mbox_chan_to_dev,
MBOX_CMD_HIFI4RESUME,
message,
@@ -489,11 +484,6 @@ static void host_late_resume(struct early_suspend *h)
message,
sizeof(message),
MBOX_SYNC);
if (host->host_dsp->pm_support_pwrctrl) {
host->host_dsp->pwrctrl_access_en = 0;
host_psci_smc(host, SMC_SUBID_HIFI_DSP_PWRCTRL);
}
}
}
@@ -514,11 +504,6 @@ static int host_suspend(struct device *dev)
if (pm_runtime_suspended(dev))
return 0;
if (host->host_dsp->pm_support_ffv)
#ifdef CONFIG_AMLOGIC_LEGACY_EARLY_SUSPEND
return 0;
#endif
if (pm_runtime_active(dev) && host->host_dsp->pm_support_suspend) {
if (host->host_dsp->pm_support_pwrctrl) {
host->host_dsp->pwrctrl_access_en = 1;
@@ -526,7 +511,7 @@ static int host_suspend(struct device *dev)
}
pr_debug("AP send suspend cmd to dsp...\n");
strncpy(message, "MBOX_CMD_HIFI4SUSPEND", sizeof(message));
strncpy(message, "HIFI_DEEP_SLEEP", sizeof(message));
aml_mbox_transfer_data(host->mbox_chan_to_dev,
MBOX_CMD_HIFI4SUSPEND,
message,
@@ -534,8 +519,11 @@ static int host_suspend(struct device *dev)
message,
sizeof(message),
MBOX_SYNC);
/*clk = 24 M*/
clk_set_rate(host->clk, SUSPEND_CLK_FREQ);
if (!host->host_dsp->pm_support_ffv) {
/*clk = 24 M*/
clk_set_rate(host->clk, SUSPEND_CLK_FREQ);
}
} else if (!host->host_dsp->pm_support_always_on)
clk_disable_unprepare(host->clk);
@@ -550,21 +538,19 @@ static int host_resume(struct device *dev)
if (pm_runtime_suspended(dev))
return 0;
if (host->host_dsp->pm_support_ffv) {
if (get_resume_method() == VAD_WAKEUP) {
pr_info("input event: vad wakeup in deep sleep\n");
host_dsp_vad_report(host);
}
#ifdef CONFIG_AMLOGIC_LEGACY_EARLY_SUSPEND
return 0;
#endif
}
if (pm_runtime_active(dev) && host->host_dsp->pm_support_suspend) {
pr_debug("AP send resume cmd to dsp...\n");
/*clk = Max M*/
clk_set_rate(host->clk, (unsigned long)host->clk_rate * 1000);
strncpy(message, "MBOX_CMD_HIFI4RESUME", sizeof(message));
if (host->host_dsp->pm_support_ffv) {
if (get_resume_method() == VAD_WAKEUP) {
pr_info("input event: vad wakeup in deep sleep\n");
host_dsp_vad_report(host);
}
} else {
/*clk = Max M*/
clk_set_rate(host->clk, (unsigned long)host->clk_rate * 1000);
}
strncpy(message, "HIFI_RESUME", sizeof(message));
aml_mbox_transfer_data(host->mbox_chan_to_dev,
MBOX_CMD_HIFI4RESUME,
message,