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

ASoC: SOF: client: Add sof_client_ipc_set_get_data()

No need to duplicate set_get_data msg handling in clients.

Signed-off-by: Jyri Sarha <jyri.sarha@intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20221031105141.19037-4-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Jyri Sarha and committed by
Mark Brown
d8bc54a5 ccf06b14

+31
+8
sound/soc/sof/ipc.c
··· 84 84 } 85 85 EXPORT_SYMBOL(sof_ipc_tx_message); 86 86 87 + /* IPC set or get data from host to DSP */ 88 + int sof_ipc_set_get_data(struct snd_sof_ipc *ipc, void *msg_data, 89 + size_t msg_bytes, bool set) 90 + { 91 + return ipc->ops->set_get_data(ipc->sdev, msg_data, msg_bytes, set); 92 + } 93 + EXPORT_SYMBOL(sof_ipc_set_get_data); 94 + 87 95 /* 88 96 * send IPC message from host to DSP without modifying the DSP state. 89 97 * This will be used for IPC's that can be handled by the DSP
+19
sound/soc/sof/sof-client.c
··· 265 265 } 266 266 EXPORT_SYMBOL_NS_GPL(sof_client_ipc_tx_message, SND_SOC_SOF_CLIENT); 267 267 268 + int sof_client_ipc_set_get_data(struct sof_client_dev *cdev, void *ipc_msg, 269 + bool set) 270 + { 271 + if (cdev->sdev->pdata->ipc_type == SOF_IPC) { 272 + struct sof_ipc_cmd_hdr *hdr = ipc_msg; 273 + 274 + return sof_ipc_set_get_data(cdev->sdev->ipc, ipc_msg, hdr->size, 275 + set); 276 + } else if (cdev->sdev->pdata->ipc_type == SOF_INTEL_IPC4) { 277 + struct sof_ipc4_msg *msg = ipc_msg; 278 + 279 + return sof_ipc_set_get_data(cdev->sdev->ipc, ipc_msg, 280 + msg->data_size, set); 281 + } 282 + 283 + return -EINVAL; 284 + } 285 + EXPORT_SYMBOL_NS_GPL(sof_client_ipc_set_get_data, SND_SOC_SOF_CLIENT); 286 + 268 287 int sof_suspend_clients(struct snd_sof_dev *sdev, pm_message_t state) 269 288 { 270 289 struct auxiliary_driver *adrv;
+2
sound/soc/sof/sof-client.h
··· 37 37 38 38 int sof_client_ipc_tx_message(struct sof_client_dev *cdev, void *ipc_msg, 39 39 void *reply_data, size_t reply_bytes); 40 + int sof_client_ipc_set_get_data(struct sof_client_dev *cdev, void *ipc_msg, 41 + bool set); 40 42 41 43 struct dentry *sof_client_get_debugfs_root(struct sof_client_dev *cdev); 42 44 struct device *sof_client_get_dma_dev(struct sof_client_dev *cdev);
+2
sound/soc/sof/sof-priv.h
··· 680 680 } 681 681 int sof_ipc_tx_message(struct snd_sof_ipc *ipc, void *msg_data, size_t msg_bytes, 682 682 void *reply_data, size_t reply_bytes); 683 + int sof_ipc_set_get_data(struct snd_sof_ipc *ipc, void *msg_data, 684 + size_t msg_bytes, bool set); 683 685 int sof_ipc_tx_message_no_pm(struct snd_sof_ipc *ipc, void *msg_data, size_t msg_bytes, 684 686 void *reply_data, size_t reply_bytes); 685 687 int sof_ipc_send_msg(struct snd_sof_dev *sdev, void *msg_data, size_t msg_bytes,