From af6fcdd5eee44c5aac91878451c4cb1c3122fe21 Mon Sep 17 00:00:00 2001 From: Liam Girdwood Date: Thu, 20 Dec 2018 14:00:58 +0000 Subject: [PATCH] pm: send IPC on PM power off completion. Send command completion IPC after powedown completes instead of before power off completes. This allows host to know that DSP is in OFF state prior to driver PM actions. Signed-off-by: Liam Girdwood --- src/ipc/apl-ipc.c | 15 +++++++-------- src/platform/apollolake/power_down.S | 9 +++++++++ 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/ipc/apl-ipc.c b/src/ipc/apl-ipc.c index a51b58271..5c17a0cb3 100644 --- a/src/ipc/apl-ipc.c +++ b/src/ipc/apl-ipc.c @@ -133,18 +133,17 @@ void ipc_platform_do_cmd(struct ipc *ipc) done: ipc->host_pending = 0; + /* are we about to enter D3 ? */ + if (iipc->pm_prepare_D3) { + /* no return - memory will be powered off and IPC sent */ + platform_pm_runtime_power_off(); + } + /* write 1 to clear busy, and trigger interrupt to host*/ - ipc_write(IPC_DIPCT, ipc_read(IPC_DIPCT) |IPC_DIPCT_BUSY ); + ipc_write(IPC_DIPCT, ipc_read(IPC_DIPCT) | IPC_DIPCT_BUSY); /* unmask Busy interrupt */ ipc_write(IPC_DIPCCTL, ipc_read(IPC_DIPCCTL) | IPC_DIPCCTL_IPCTBIE); - - // TODO: signal audio work to enter D3 in normal context - /* are we about to enter D3 ? */ - if (iipc->pm_prepare_D3) { - /* no return - memory will be powered off */ - platform_pm_runtime_power_off(); - } } void ipc_platform_send_msg(struct ipc *ipc) diff --git a/src/platform/apollolake/power_down.S b/src/platform/apollolake/power_down.S index 96b1d1b22..7aea98c28 100644 --- a/src/platform/apollolake/power_down.S +++ b/src/platform/apollolake/power_down.S @@ -146,6 +146,15 @@ _PD_RELEASE_VNN: //TODO: add sending IPC reply from L1$ locked code +_PD_SEND_IPC: + // Send IPC to host informing of PD completion - Clear BUSY bit by + // writting IPC_DIPCT_BUSY to IPC_DIPCT + movi temp_reg0, IPC_HOST_BASE + l32i temp_reg1, temp_reg0, IPC_DIPCT + movi temp_reg2, IPC_DIPCT_BUSY + or temp_reg1, temp_reg1, temp_reg2 + s32i temp_reg1, temp_reg0, IPC_DIPCT + _PD_SLEEP: // effecfively executes: // xmp_spin()