Skip to content

Commit c847746

Browse files
committed
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: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
1 parent 8cac03e commit c847746

6 files changed

Lines changed: 45 additions & 15 deletions

File tree

sound/soc/sof/sof-client-ipc-flood-test.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -219,9 +219,10 @@ static ssize_t sof_ipc_flood_dfs_write(struct file *file, const char __user *buf
219219
goto out;
220220
}
221221

222-
/* flood test */
223-
ret = sof_debug_ipc_flood_test(cdev, flood_duration_test,
224-
ipc_duration_ms, ipc_count);
222+
ret = sof_client_boot_dsp(cdev);
223+
if (!ret)
224+
ret = sof_debug_ipc_flood_test(cdev, flood_duration_test,
225+
ipc_duration_ms, ipc_count);
225226

226227
pm_runtime_mark_last_busy(dev);
227228
err = pm_runtime_put_autosuspend(dev);

sound/soc/sof/sof-client-ipc-kernel-injector.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@ static ssize_t sof_kernel_msg_inject_dfs_write(struct file *file, const char __u
6363
return ret;
6464
}
6565

66-
sof_client_ipc_rx_message(cdev, hdr, priv->kernel_buffer);
66+
ret = sof_client_boot_dsp(cdev);
67+
if (!ret)
68+
sof_client_ipc_rx_message(cdev, hdr, priv->kernel_buffer);
6769

6870
pm_runtime_mark_last_busy(dev);
6971
ret = pm_runtime_put_autosuspend(dev);

sound/soc/sof/sof-client-ipc-msg-injector.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,11 +131,15 @@ static int sof_msg_inject_send_message(struct sof_client_dev *cdev)
131131
return ret;
132132
}
133133

134-
/* send the message */
135-
ret = sof_client_ipc_tx_message(cdev, priv->tx_buffer, priv->rx_buffer,
136-
priv->max_msg_size);
137-
if (ret)
138-
dev_err(dev, "IPC message send failed: %d\n", ret);
134+
ret = sof_client_boot_dsp(cdev);
135+
if (!ret) {
136+
/* send the message */
137+
ret = sof_client_ipc_tx_message(cdev, priv->tx_buffer,
138+
priv->rx_buffer,
139+
priv->max_msg_size);
140+
if (ret)
141+
dev_err(dev, "IPC message send failed: %d\n", ret);
142+
}
139143

140144
pm_runtime_mark_last_busy(dev);
141145
err = pm_runtime_put_autosuspend(dev);

sound/soc/sof/sof-client-probes.c

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,10 @@ static int sof_probes_compr_set_params(struct snd_compr_stream *cstream,
123123
if (ret)
124124
return ret;
125125

126+
ret = sof_client_boot_dsp(cdev);
127+
if (ret)
128+
return ret;
129+
126130
ret = ipc->init(cdev, priv->extractor_stream_tag, rtd->dma_bytes);
127131
if (ret < 0) {
128132
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,
224228
goto exit;
225229
}
226230

231+
ret = sof_client_boot_dsp(cdev);
232+
if (ret)
233+
goto pm_error;
234+
227235
ret = ipc->points_info(cdev, &desc, &num_desc, type);
228236
if (ret < 0)
229237
goto pm_error;
@@ -313,9 +321,12 @@ sof_probes_dfs_points_write(struct file *file, const char __user *from,
313321
goto exit;
314322
}
315323

316-
ret = ipc->points_add(cdev, desc, bytes / sizeof(*desc));
317-
if (!ret)
318-
ret = count;
324+
ret = sof_client_boot_dsp(cdev);
325+
if (!ret) {
326+
ret = ipc->points_add(cdev, desc, bytes / sizeof(*desc));
327+
if (!ret)
328+
ret = count;
329+
}
319330

320331
pm_runtime_mark_last_busy(dev);
321332
err = pm_runtime_put_autosuspend(dev);
@@ -369,9 +380,12 @@ sof_probes_dfs_points_remove_write(struct file *file, const char __user *from,
369380
goto exit;
370381
}
371382

372-
ret = ipc->points_remove(cdev, &array[1], array[0]);
373-
if (!ret)
374-
ret = count;
383+
ret = sof_client_boot_dsp(cdev);
384+
if (!ret) {
385+
ret = ipc->points_remove(cdev, &array[1], array[0]);
386+
if (!ret)
387+
ret = count;
388+
}
375389

376390
pm_runtime_mark_last_busy(dev);
377391
err = pm_runtime_put_autosuspend(dev);

sound/soc/sof/sof-client.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,12 @@ enum sof_ipc_type sof_client_get_ipc_type(struct sof_client_dev *cdev)
451451
}
452452
EXPORT_SYMBOL_NS_GPL(sof_client_get_ipc_type, "SND_SOC_SOF_CLIENT");
453453

454+
int sof_client_boot_dsp(struct sof_client_dev *cdev)
455+
{
456+
return snd_sof_boot_dsp_firmware(sof_client_dev_to_sof_dev(cdev));
457+
}
458+
EXPORT_SYMBOL_NS_GPL(sof_client_boot_dsp, "SND_SOC_SOF_CLIENT");
459+
454460
/* module refcount management of SOF core */
455461
int sof_client_core_module_get(struct sof_client_dev *cdev)
456462
{

sound/soc/sof/sof-client.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ const struct sof_ipc_fw_version *sof_client_get_fw_version(struct sof_client_dev
5656
size_t sof_client_get_ipc_max_payload_size(struct sof_client_dev *cdev);
5757
enum sof_ipc_type sof_client_get_ipc_type(struct sof_client_dev *cdev);
5858

59+
/* DSP/firmware boot request */
60+
int sof_client_boot_dsp(struct sof_client_dev *cdev);
61+
5962
/* module refcount management of SOF core */
6063
int sof_client_core_module_get(struct sof_client_dev *cdev);
6164
void sof_client_core_module_put(struct sof_client_dev *cdev);

0 commit comments

Comments
 (0)