Unverified Commit 2cf7a9ce authored by Peter Ujfalusi's avatar Peter Ujfalusi Committed by Mark Brown
Browse files

ASoC: SOF: sof-client: Add support for on-demand DSP boot



With the introduction of on-demand DSP boot the rpm status not necessary
tells that the DSP firmware is booted up.

Introduce the sof_client_boot_dsp() which can be used to make sure that
the DSP is booted and it can handle IPCs.

Update the client drivers to use the new function where it is expected that
the DSP is booted up.

Signed-off-by: default avatarPeter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: default avatarBard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: default avatarKai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: default avatarLiam Girdwood <liam.r.girdwood@intel.com>
Link: https://patch.msgid.link/20251215132946.2155-5-peter.ujfalusi@linux.intel.com


Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent c3e15498
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -219,7 +219,8 @@ static ssize_t sof_ipc_flood_dfs_write(struct file *file, const char __user *buf
		goto out;
	}

	/* flood test */
	ret = sof_client_boot_dsp(cdev);
	if (!ret)
		ret = sof_debug_ipc_flood_test(cdev, flood_duration_test,
					       ipc_duration_ms, ipc_count);

+3 −1
Original line number Diff line number Diff line
@@ -63,6 +63,8 @@ static ssize_t sof_kernel_msg_inject_dfs_write(struct file *file, const char __u
		return ret;
	}

	ret = sof_client_boot_dsp(cdev);
	if (!ret)
		sof_client_ipc_rx_message(cdev, hdr, priv->kernel_buffer);

	ret = pm_runtime_put_autosuspend(dev);
+9 −5
Original line number Diff line number Diff line
@@ -131,11 +131,15 @@ static int sof_msg_inject_send_message(struct sof_client_dev *cdev)
		return ret;
	}

	ret = sof_client_boot_dsp(cdev);
	if (!ret) {
		/* send the message */
	ret = sof_client_ipc_tx_message(cdev, priv->tx_buffer, priv->rx_buffer,
		ret = sof_client_ipc_tx_message(cdev, priv->tx_buffer,
						priv->rx_buffer,
						priv->max_msg_size);
		if (ret)
			dev_err(dev, "IPC message send failed: %d\n", ret);
	}

	err = pm_runtime_put_autosuspend(dev);
	if (err < 0)
+20 −6
Original line number Diff line number Diff line
@@ -123,6 +123,10 @@ static int sof_probes_compr_set_params(struct snd_compr_stream *cstream,
	if (ret)
		return ret;

	ret = sof_client_boot_dsp(cdev);
	if (ret)
		return ret;

	ret = ipc->init(cdev, priv->extractor_stream_tag, rtd->dma_bytes);
	if (ret < 0) {
		dev_err(dai->dev, "Failed to init probe: %d\n", ret);
@@ -224,6 +228,10 @@ static ssize_t sof_probes_dfs_points_read(struct file *file, char __user *to,
		goto exit;
	}

	ret = sof_client_boot_dsp(cdev);
	if (ret)
		goto pm_error;

	ret = ipc->points_info(cdev, &desc, &num_desc, type);
	if (ret < 0)
		goto pm_error;
@@ -312,9 +320,12 @@ sof_probes_dfs_points_write(struct file *file, const char __user *from,
		goto exit;
	}

	ret = sof_client_boot_dsp(cdev);
	if (!ret) {
		ret = ipc->points_add(cdev, desc, bytes / sizeof(*desc));
		if (!ret)
			ret = count;
	}

	err = pm_runtime_put_autosuspend(dev);
	if (err < 0)
@@ -367,9 +378,12 @@ sof_probes_dfs_points_remove_write(struct file *file, const char __user *from,
		goto exit;
	}

	ret = sof_client_boot_dsp(cdev);
	if (!ret) {
		ret = ipc->points_remove(cdev, &array[1], array[0]);
		if (!ret)
			ret = count;
	}

	err = pm_runtime_put_autosuspend(dev);
	if (err < 0)
+6 −0
Original line number Diff line number Diff line
@@ -486,6 +486,12 @@ enum sof_ipc_type sof_client_get_ipc_type(struct sof_client_dev *cdev)
}
EXPORT_SYMBOL_NS_GPL(sof_client_get_ipc_type, "SND_SOC_SOF_CLIENT");

int sof_client_boot_dsp(struct sof_client_dev *cdev)
{
	return snd_sof_boot_dsp_firmware(sof_client_dev_to_sof_dev(cdev));
}
EXPORT_SYMBOL_NS_GPL(sof_client_boot_dsp, "SND_SOC_SOF_CLIENT");

/* module refcount management of SOF core */
int sof_client_core_module_get(struct sof_client_dev *cdev)
{
Loading