File tree Expand file tree Collapse file tree 3 files changed +40
-0
lines changed
Expand file tree Collapse file tree 3 files changed +40
-0
lines changed Original file line number Diff line number Diff line change 1212#include <linux/module.h>
1313#include <sound/soc.h>
1414#include <sound/sof.h>
15+ #include "sof-client.h"
1516#include "sof-priv.h"
1617#include "ops.h"
1718#if IS_ENABLED (CONFIG_SND_SOC_SOF_DEBUG_PROBES )
@@ -262,6 +263,9 @@ static int sof_probe_continue(struct snd_sof_dev *sdev)
262263 if (!sof_ops (sdev )-> runtime_suspend || !sof_ops (sdev )-> runtime_resume )
263264 pm_runtime_get_noresume (sdev -> dev );
264265
266+ /* register SOF client devices now that FW is booted */
267+ sof_client_register_devices (sdev );
268+
265269 if (plat_data -> sof_probe_complete )
266270 plat_data -> sof_probe_complete (sdev -> dev );
267271
@@ -373,6 +377,9 @@ int snd_sof_device_remove(struct device *dev)
373377 snd_sof_free_trace (sdev );
374378 }
375379
380+ /* unregister client devices */
381+ sof_client_unregister_devices (sdev );
382+
376383 /* unregister virtbus devices */
377384 if (sdev -> vdev )
378385 virtbus_dev_unregister (sdev -> vdev );
Original file line number Diff line number Diff line change @@ -52,3 +52,34 @@ void sof_client_drv_unregister(const struct sof_client_drv *drv)
5252 mutex_unlock (& sof_client_mutex );
5353}
5454EXPORT_SYMBOL_NS (sof_client_drv_unregister , SND_SOC_SOF_CLIENT );
55+
56+ void sof_client_register_devices (struct snd_sof_dev * sdev )
57+ {
58+ struct sof_client_dev * cdev ;
59+ struct sof_client_ops * ops ;
60+ int ret ;
61+
62+ list_for_each_entry (cdev , & client_list , list ) {
63+ ops = cdev -> drv -> ops ;
64+ cdev -> sdev = sdev ;
65+
66+ /* this can fail but error cannot be propagated */
67+ ret = ops -> probe (cdev );
68+ if (ret < 0 )
69+ dev_err (sdev -> dev , "error: registering client device %d\n" ,
70+ ret );
71+ }
72+ }
73+
74+ void sof_client_unregister_devices (struct snd_sof_dev * sdev )
75+ {
76+ struct sof_client_dev * cdev ;
77+ struct sof_client_ops * ops ;
78+ int ret ;
79+
80+ list_for_each_entry (cdev , & client_list , list ) {
81+ ops = cdev -> drv -> ops ;
82+ if (ops -> remove )
83+ ops -> remove (cdev );
84+ }
85+ }
Original file line number Diff line number Diff line change @@ -42,5 +42,7 @@ struct sof_client_drv {
4242int sof_client_drv_register (struct device * dev ,
4343 const struct sof_client_drv * drv );
4444void sof_client_drv_unregister (const struct sof_client_drv * drv );
45+ void sof_client_register_devices (struct snd_sof_dev * sdev );
46+ void sof_client_unregister_devices (struct snd_sof_dev * sdev );
4547
4648#endif
You can’t perform that action at this time.
0 commit comments