ASoC: SOF: Intel: hda-dsp: use set_pm_gate according to ipc version
authorRander Wang <rander.wang@intel.com>
Tue, 14 Feb 2023 10:33:42 +0000 (12:33 +0200)
committerMark Brown <broonie@kernel.org>
Tue, 14 Feb 2023 13:25:12 +0000 (13:25 +0000)
Use set_pm_gate to unify pm gate setting for different
ipc version.

Signed-off-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20230214103345.30669-3-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/sof/intel/hda-dsp.c

index b4eacae8564c84e399b358f019dadd0a012e02f1..e34fe0c9bcde04a0693932071ac8ed274828a2aa 100644 (file)
@@ -364,19 +364,12 @@ static int hda_dsp_wait_d0i3c_done(struct snd_sof_dev *sdev)
 
 static int hda_dsp_send_pm_gate_ipc(struct snd_sof_dev *sdev, u32 flags)
 {
-       struct sof_ipc_pm_gate pm_gate;
-       struct sof_ipc_reply reply;
+       const struct sof_ipc_pm_ops *pm_ops = sof_ipc_get_ops(sdev, pm);
 
-       memset(&pm_gate, 0, sizeof(pm_gate));
+       if (pm_ops && pm_ops->set_pm_gate)
+               return pm_ops->set_pm_gate(sdev, flags);
 
-       /* configure pm_gate ipc message */
-       pm_gate.hdr.size = sizeof(pm_gate);
-       pm_gate.hdr.cmd = SOF_IPC_GLB_PM_MSG | SOF_IPC_PM_GATE;
-       pm_gate.flags = flags;
-
-       /* send pm_gate ipc to dsp */
-       return sof_ipc_tx_message_no_pm(sdev->ipc, &pm_gate, sizeof(pm_gate),
-                                       &reply, sizeof(reply));
+       return 0;
 }
 
 static int hda_dsp_update_d0i3c_register(struct snd_sof_dev *sdev, u8 value)