Skip to content

Commit ca6b403

Browse files
authored
Merge pull request #68 from tlauda/topic/ipc_active_cores
ipc: add SOF_IPC_PM_CORE_ENABLE message
2 parents 5213e37 + 40575d2 commit ca6b403

2 files changed

Lines changed: 29 additions & 0 deletions

File tree

src/include/uapi/ipc.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@
101101
#define SOF_IPC_PM_CLK_SET SOF_CMD_TYPE(0x004)
102102
#define SOF_IPC_PM_CLK_GET SOF_CMD_TYPE(0x005)
103103
#define SOF_IPC_PM_CLK_REQ SOF_CMD_TYPE(0x006)
104+
#define SOF_IPC_PM_CORE_ENABLE SOF_CMD_TYPE(0x007)
104105

105106
/* component runtime config - multiple different types */
106107
#define SOF_IPC_COMP_SET_VALUE SOF_CMD_TYPE(0x001)
@@ -817,6 +818,12 @@ struct sof_ipc_pm_ctx {
817818
struct sof_ipc_pm_ctx_elem elems[];
818819
};
819820

821+
/* enable or disable cores - SOF_IPC_PM_CORE_ENABLE */
822+
struct sof_ipc_pm_core_config {
823+
struct sof_ipc_hdr hdr;
824+
uint32_t enable_mask;
825+
};
826+
820827
/*
821828
* Firmware boot and version
822829
*/

src/ipc/handler.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
#include <uapi/ipc.h>
5959
#include <sof/intel-ipc.h>
6060
#include <sof/dma-trace.h>
61+
#include <sof/cpu.h>
6162
#include <config.h>
6263

6364
#define iGS(x) ((x >> SOF_GLB_TYPE_SHIFT) & 0xf)
@@ -588,6 +589,25 @@ static int ipc_pm_context_restore(uint32_t header)
588589
return 0;
589590
}
590591

592+
static int ipc_pm_core_enable(uint32_t header)
593+
{
594+
struct sof_ipc_pm_core_config *pm_core_config = _ipc->comp_data;
595+
int i = 0;
596+
597+
trace_ipc("PMc");
598+
599+
for (i = 0; i < PLATFORM_CORE_COUNT; i++) {
600+
if (i != PLATFORM_MASTER_CORE_ID) {
601+
if (pm_core_config->enable_mask & (1 << i))
602+
cpu_enable_core(i);
603+
else
604+
cpu_disable_core(i);
605+
}
606+
}
607+
608+
return 0;
609+
}
610+
591611
static int ipc_glb_pm_message(uint32_t header)
592612
{
593613
uint32_t cmd = (header & SOF_CMD_TYPE_MASK) >> SOF_CMD_TYPE_SHIFT;
@@ -599,6 +619,8 @@ static int ipc_glb_pm_message(uint32_t header)
599619
return ipc_pm_context_restore(header);
600620
case iCS(SOF_IPC_PM_CTX_SIZE):
601621
return ipc_pm_context_size(header);
622+
case iCS(SOF_IPC_PM_CORE_ENABLE):
623+
return ipc_pm_core_enable(header);
602624
case iCS(SOF_IPC_PM_CLK_SET):
603625
case iCS(SOF_IPC_PM_CLK_GET):
604626
case iCS(SOF_IPC_PM_CLK_REQ):

0 commit comments

Comments
 (0)