Skip to content

Commit 48cd91f

Browse files
committed
ASoC: SOF: register client device for test IPC client
After FW boot is complete, register the client device for the IPC test client. Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
1 parent 07db581 commit 48cd91f

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

sound/soc/sof/core.c

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@
1010

1111
#include <linux/firmware.h>
1212
#include <linux/module.h>
13+
#include <linux/virtual_bus.h>
1314
#include <sound/soc.h>
1415
#include <sound/sof.h>
16+
#include "sof-client.h"
1517
#include "sof-priv.h"
1618
#include "ops.h"
1719
#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,
9597
}
9698
EXPORT_SYMBOL(snd_sof_get_status);
9799

100+
static void sof_virtdev_release(struct virtbus_device *vdev)
101+
{}
102+
98103
/*
99104
* FW Boot State Transition Diagram
100105
*
@@ -138,6 +143,7 @@ EXPORT_SYMBOL(snd_sof_get_status);
138143
static int sof_probe_continue(struct snd_sof_dev *sdev)
139144
{
140145
struct snd_sof_pdata *plat_data = sdev->pdata;
146+
struct virtbus_device *vdev;
141147
int ret;
142148

143149
/* probe the DSP hardware */
@@ -234,6 +240,22 @@ static int sof_probe_continue(struct snd_sof_dev *sdev)
234240
if (ret < 0)
235241
goto fw_trace_err;
236242

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
237259
/*
238260
* Some platforms in SOF, ex: BYT, may not have their platform PM
239261
* callbacks set. Increment the usage count so as to
@@ -353,6 +375,9 @@ int snd_sof_device_remove(struct device *dev)
353375
snd_sof_free_trace(sdev);
354376
}
355377

378+
/* unregister client devices */
379+
sof_client_dev_unregister(&sdev->ipc_test_client);
380+
356381
/*
357382
* Unregister machine driver. This will unbind the snd_card which
358383
* will remove the component driver and unload the topology

sound/soc/sof/sof-priv.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include <sound/sof/pm.h>
1919
#include <sound/sof/trace.h>
2020
#include <uapi/sound/sof/fw.h>
21+
#include "sof-client.h"
2122

2223
/* debug flags */
2324
#define SOF_DBG_ENABLE_TRACE BIT(0)
@@ -438,6 +439,8 @@ struct snd_sof_dev {
438439

439440
bool msi_enabled;
440441

442+
struct sof_client_dev ipc_test_client;
443+
441444
void *private; /* core does not touch this */
442445
};
443446

0 commit comments

Comments
 (0)