Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ASoC: SOF: Intel: CNL: add support for sending compact IPC

For compact IPCs, we will send the IPC header/command via the HIPCIDR
register and the first 32bit payload via the HIPCIDD register, no
mailbox will be used.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191025224122.7718-19-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Keyon Jie and committed by
Mark Brown
0267de58 60125286

+38 -5
+37 -5
sound/soc/sof/intel/cnl.c
··· 17 17 18 18 #include "../ops.h" 19 19 #include "hda.h" 20 + #include "hda-ipc.h" 20 21 21 22 static const struct snd_sof_debugfs_map cnl_dsp_debugfs[] = { 22 23 {"hda", HDA_DSP_HDA_BAR, 0, 0x4000, SOF_DEBUGFS_ACCESS_ALWAYS}, ··· 151 150 CNL_DSP_REG_HIPCCTL_DONE); 152 151 } 153 152 153 + static bool cnl_compact_ipc_compress(struct snd_sof_ipc_msg *msg, 154 + u32 *dr, u32 *dd) 155 + { 156 + struct sof_ipc_pm_gate *pm_gate; 157 + 158 + if (msg->header == (SOF_IPC_GLB_PM_MSG | SOF_IPC_PM_GATE)) { 159 + pm_gate = msg->msg_data; 160 + 161 + /* send the compact message via the primary register */ 162 + *dr = HDA_IPC_MSG_COMPACT | HDA_IPC_PM_GATE; 163 + 164 + /* send payload via the extended data register */ 165 + *dd = pm_gate->flags; 166 + 167 + return true; 168 + } 169 + 170 + return false; 171 + } 172 + 154 173 static int cnl_ipc_send_msg(struct snd_sof_dev *sdev, 155 174 struct snd_sof_ipc_msg *msg) 156 175 { 157 - /* send the message */ 158 - sof_mailbox_write(sdev, sdev->host_box.offset, msg->msg_data, 159 - msg->msg_size); 160 - snd_sof_dsp_write(sdev, HDA_DSP_BAR, CNL_DSP_REG_HIPCIDR, 161 - CNL_DSP_REG_HIPCIDR_BUSY); 176 + u32 dr = 0; 177 + u32 dd = 0; 178 + 179 + if (cnl_compact_ipc_compress(msg, &dr, &dd)) { 180 + /* send the message via IPC registers */ 181 + snd_sof_dsp_write(sdev, HDA_DSP_BAR, CNL_DSP_REG_HIPCIDD, 182 + dd); 183 + snd_sof_dsp_write(sdev, HDA_DSP_BAR, CNL_DSP_REG_HIPCIDR, 184 + CNL_DSP_REG_HIPCIDR_BUSY | dr); 185 + } else { 186 + /* send the message via mailbox */ 187 + sof_mailbox_write(sdev, sdev->host_box.offset, msg->msg_data, 188 + msg->msg_size); 189 + snd_sof_dsp_write(sdev, HDA_DSP_BAR, CNL_DSP_REG_HIPCIDR, 190 + CNL_DSP_REG_HIPCIDR_BUSY); 191 + } 162 192 163 193 return 0; 164 194 }
+1
sound/soc/sof/intel/hda.h
··· 312 312 #define CNL_DSP_REG_HIPCTDD (CNL_DSP_IPC_BASE + 0x08) 313 313 #define CNL_DSP_REG_HIPCIDR (CNL_DSP_IPC_BASE + 0x10) 314 314 #define CNL_DSP_REG_HIPCIDA (CNL_DSP_IPC_BASE + 0x14) 315 + #define CNL_DSP_REG_HIPCIDD (CNL_DSP_IPC_BASE + 0x18) 315 316 #define CNL_DSP_REG_HIPCCTL (CNL_DSP_IPC_BASE + 0x28) 316 317 317 318 /* HIPCI */