Skip to content

Commit 167ca6a

Browse files
RanderWangbroonie
authored andcommitted
ASoC: SOF: Introduce a new set_pm_gate() IPC PM op
Set_pm_gate depends on ipc version. This patch defines the ops for both IPC3 and IPC4. Signed-off-by: Rander Wang <[email protected]> Reviewed-by: Pierre-Louis Bossart <[email protected]> Reviewed-by: Ranjani Sridharan <[email protected]> Reviewed-by: Péter Ujfalusi <[email protected]> Signed-off-by: Peter Ujfalusi <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent d227116 commit 167ca6a

File tree

3 files changed

+33
-0
lines changed

3 files changed

+33
-0
lines changed

sound/soc/sof/ipc3.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1077,10 +1077,28 @@ static int sof_ipc3_ctx_restore(struct snd_sof_dev *sdev)
10771077
return sof_ipc3_ctx_ipc(sdev, SOF_IPC_PM_CTX_RESTORE);
10781078
}
10791079

1080+
static int sof_ipc3_set_pm_gate(struct snd_sof_dev *sdev, u32 flags)
1081+
{
1082+
struct sof_ipc_pm_gate pm_gate;
1083+
struct sof_ipc_reply reply;
1084+
1085+
memset(&pm_gate, 0, sizeof(pm_gate));
1086+
1087+
/* configure pm_gate ipc message */
1088+
pm_gate.hdr.size = sizeof(pm_gate);
1089+
pm_gate.hdr.cmd = SOF_IPC_GLB_PM_MSG | SOF_IPC_PM_GATE;
1090+
pm_gate.flags = flags;
1091+
1092+
/* send pm_gate ipc to dsp */
1093+
return sof_ipc_tx_message_no_pm(sdev->ipc, &pm_gate, sizeof(pm_gate),
1094+
&reply, sizeof(reply));
1095+
}
1096+
10801097
static const struct sof_ipc_pm_ops ipc3_pm_ops = {
10811098
.ctx_save = sof_ipc3_ctx_save,
10821099
.ctx_restore = sof_ipc3_ctx_restore,
10831100
.set_core_state = sof_ipc3_set_core_state,
1101+
.set_pm_gate = sof_ipc3_set_pm_gate,
10841102
};
10851103

10861104
const struct sof_ipc_ops ipc3_ops = {

sound/soc/sof/ipc4.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -656,9 +656,22 @@ static int sof_ipc4_ctx_save(struct snd_sof_dev *sdev)
656656
return sof_ipc4_set_core_state(sdev, SOF_DSP_PRIMARY_CORE, false);
657657
}
658658

659+
static int sof_ipc4_set_pm_gate(struct snd_sof_dev *sdev, u32 flags)
660+
{
661+
struct sof_ipc4_msg msg = {{0}};
662+
663+
msg.primary = SOF_IPC4_MSG_TYPE_SET(SOF_IPC4_MOD_SET_D0IX);
664+
msg.primary |= SOF_IPC4_MSG_DIR(SOF_IPC4_MSG_REQUEST);
665+
msg.primary |= SOF_IPC4_MSG_TARGET(SOF_IPC4_MODULE_MSG);
666+
msg.extension = flags;
667+
668+
return sof_ipc4_tx_msg(sdev, &msg, 0, NULL, 0, true);
669+
}
670+
659671
static const struct sof_ipc_pm_ops ipc4_pm_ops = {
660672
.ctx_save = sof_ipc4_ctx_save,
661673
.set_core_state = sof_ipc4_set_core_state,
674+
.set_pm_gate = sof_ipc4_set_pm_gate,
662675
};
663676

664677
static int sof_ipc4_init(struct snd_sof_dev *sdev)

sound/soc/sof/sof-priv.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,11 +425,13 @@ struct sof_ipc_fw_tracing_ops {
425425
* @ctx_save: Optional function pointer for context save
426426
* @ctx_restore: Optional function pointer for context restore
427427
* @set_core_state: Optional function pointer for turning on/off a DSP core
428+
* @set_pm_gate: Optional function pointer for pm gate settings
428429
*/
429430
struct sof_ipc_pm_ops {
430431
int (*ctx_save)(struct snd_sof_dev *sdev);
431432
int (*ctx_restore)(struct snd_sof_dev *sdev);
432433
int (*set_core_state)(struct snd_sof_dev *sdev, int core_idx, bool on);
434+
int (*set_pm_gate)(struct snd_sof_dev *sdev, u32 flags);
433435
};
434436

435437
/**

0 commit comments

Comments
 (0)