/* card already instantiated, create widgets here only */
if (codec->card->instantiated) {
- ret = snd_soc_dapm_new_widgets(&codec->dapm);
- if (!ret)
- snd_soc_dapm_link_component_dai_widgets(codec->card,
- &codec->dapm);
- }
-
+ snd_soc_dapm_link_component_dai_widgets(codec->card,
+ &codec->dapm);
#ifdef CONFIG_SND_JACK
- /* register jack devices for this module from codec->jack_list */
- list_for_each_entry(jack, &codec->jack_list, list) {
- if ((jack == &module->headset_jack)
- || (jack == &module->button_jack))
- snd_device_register(codec->card->snd_card, jack->jack);
- }
+ /* register jack devices for this module from codec->jack_list */
+ list_for_each_entry(jack, &codec->jack_list, list) {
+ if ((jack == &module->headset_jack)
+ || (jack == &module->button_jack))
+ snd_device_register(codec->card->snd_card,
+ jack->jack);
+ }
#endif
+ }
list_add(&module->list, &gbcodec->module_list);
+ if (codec->card->instantiated)
+ ret = snd_soc_dapm_new_widgets(&codec->dapm);
dev_dbg(codec->dev, "Registered %s module\n", module->name);
mutex_unlock(&gbcodec->lock);
up_write(&card->controls_rwsem);
- return 0;
+ return ret;
}
EXPORT_SYMBOL(gbaudio_register_module);
dev_dbg(codec->dev, "Unregister %s module\n", module->name);
- /* complete widget processing, if ongoing */
- snd_soc_dapm_sync(&codec->dapm);
-
down_write(&card->controls_rwsem);
mutex_lock(&gbcodec->lock);
+ gbaudio_codec_cleanup(module);
+ list_del(&module->list);
dev_dbg(codec->dev, "Process Unregister %s module\n", module->name);
#ifdef CONFIG_SND_JACK
}
#endif
- gbaudio_codec_cleanup(module);
-
if (module->dapm_routes) {
dev_dbg(codec->dev, "Removing %d routes\n",
module->num_dapm_routes);
module->num_dapm_widgets);
}
- list_del(&module->list);
dev_dbg(codec->dev, "Unregistered %s module\n", module->name);
mutex_unlock(&gbcodec->lock);
}
gbmodule->topology = topology;
- /* register module with gbcodec */
- ret = gbaudio_register_module(gbmodule);
- if (ret)
- goto release_topology;
-
/* Initialize data connections */
list_for_each_entry(dai, &gbmodule->data_list, list) {
ret = gb_connection_enable(dai->connection);
- if (ret)
+ if (ret) {
+ dev_err(dev,
+ "%d:Error while enabling %d:data connection\n",
+ ret, dai->data_cport);
goto disable_data_connection;
+ }
}
+ /* register module with gbcodec */
+ ret = gbaudio_register_module(gbmodule);
+ if (ret)
+ goto disable_data_connection;
+
/* inform above layer for uevent */
dev_dbg(dev, "Inform set_event:%d to above layer\n", 1);
/* prepare for the audio manager */
disable_data_connection:
list_for_each_entry_safe(dai, _dai, &gbmodule->data_list, list)
gb_connection_disable(dai->connection);
- gbaudio_unregister_module(gbmodule);
-
-release_topology:
gbaudio_tplg_release(gbmodule);
gbmodule->topology = NULL;
struct gbaudio_module_info *gbmodule = greybus_get_drvdata(bundle);
struct gbaudio_data_connection *dai, *_dai;
- gbaudio_unregister_module(gbmodule);
/* inform uevent to above layers */
gb_audio_manager_remove(gbmodule->manager_id);
+ gbaudio_unregister_module(gbmodule);
gbaudio_tplg_release(gbmodule);
gbmodule->topology = NULL;
kfree(gbmodule->topology);