|
10 | 10 |
|
11 | 11 | #include <linux/firmware.h> |
12 | 12 | #include <linux/module.h> |
| 13 | +#include <linux/virtual_bus.h> |
13 | 14 | #include <sound/soc.h> |
14 | 15 | #include <sound/sof.h> |
| 16 | +#include "sof-client.h" |
15 | 17 | #include "sof-priv.h" |
16 | 18 | #include "ops.h" |
17 | 19 | #if IS_ENABLED(CONFIG_SND_SOC_SOF_DEBUG_PROBES) |
@@ -95,6 +97,9 @@ void snd_sof_get_status(struct snd_sof_dev *sdev, u32 panic_code, |
95 | 97 | } |
96 | 98 | EXPORT_SYMBOL(snd_sof_get_status); |
97 | 99 |
|
| 100 | +static void sof_virtdev_release(struct virtbus_device *vdev) |
| 101 | +{} |
| 102 | + |
98 | 103 | /* |
99 | 104 | * FW Boot State Transition Diagram |
100 | 105 | * |
@@ -138,6 +143,7 @@ EXPORT_SYMBOL(snd_sof_get_status); |
138 | 143 | static int sof_probe_continue(struct snd_sof_dev *sdev) |
139 | 144 | { |
140 | 145 | struct snd_sof_pdata *plat_data = sdev->pdata; |
| 146 | + struct virtbus_device *vdev; |
141 | 147 | int ret; |
142 | 148 |
|
143 | 149 | /* probe the DSP hardware */ |
@@ -234,6 +240,22 @@ static int sof_probe_continue(struct snd_sof_dev *sdev) |
234 | 240 | if (ret < 0) |
235 | 241 | goto fw_trace_err; |
236 | 242 |
|
| 243 | +#if IS_ENABLED(CONFIG_SND_SOC_SOF_DEBUG_IPC_FLOOD_TEST) |
| 244 | + /* |
| 245 | + * Now register client devices. Only one for now. |
| 246 | + * This can fail but errors cannot be propagated. |
| 247 | + */ |
| 248 | + vdev = &sdev->ipc_test_client.vdev; |
| 249 | + vdev->name = "sof-ipc-test"; |
| 250 | + vdev->dev.parent = sdev->dev; |
| 251 | + vdev->release = sof_virtdev_release; |
| 252 | + |
| 253 | + ret = sof_client_dev_register(&sdev->ipc_test_client); |
| 254 | + if (ret) |
| 255 | + dev_err(sdev->dev, |
| 256 | + "error: failed to register client device: %s\n", |
| 257 | + vdev->name); |
| 258 | +#endif |
237 | 259 | /* |
238 | 260 | * Some platforms in SOF, ex: BYT, may not have their platform PM |
239 | 261 | * callbacks set. Increment the usage count so as to |
@@ -353,6 +375,9 @@ int snd_sof_device_remove(struct device *dev) |
353 | 375 | snd_sof_free_trace(sdev); |
354 | 376 | } |
355 | 377 |
|
| 378 | + /* unregister client devices */ |
| 379 | + sof_client_dev_unregister(&sdev->ipc_test_client); |
| 380 | + |
356 | 381 | /* |
357 | 382 | * Unregister machine driver. This will unbind the snd_card which |
358 | 383 | * will remove the component driver and unload the topology |
|
0 commit comments