mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-06 02:50:43 +00:00
greybus: audio: Reorganize sequence in GB audio bundle & codec driver
Modify sequence of register_module & unregister_module in bundle driver. This would affect the uevent generated for above user space. Accordingly, we need to modify snd_soc_xxx sequence in register_module() in codec driver. Signed-off-by: Vaibhav Agarwal <vaibhav.agarwal@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
parent
852859ab81
commit
bb9986ef6b
2 changed files with 26 additions and 29 deletions
|
@ -963,27 +963,27 @@ int gbaudio_register_module(struct gbaudio_module_info *module)
|
|||
|
||||
/* 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);
|
||||
|
||||
|
@ -1060,11 +1060,10 @@ void gbaudio_unregister_module(struct gbaudio_module_info *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
|
||||
|
@ -1078,8 +1077,6 @@ void gbaudio_unregister_module(struct gbaudio_module_info *module)
|
|||
}
|
||||
#endif
|
||||
|
||||
gbaudio_codec_cleanup(module);
|
||||
|
||||
if (module->dapm_routes) {
|
||||
dev_dbg(codec->dev, "Removing %d routes\n",
|
||||
module->num_dapm_routes);
|
||||
|
@ -1099,7 +1096,6 @@ void gbaudio_unregister_module(struct gbaudio_module_info *module)
|
|||
module->num_dapm_widgets);
|
||||
}
|
||||
|
||||
list_del(&module->list);
|
||||
dev_dbg(codec->dev, "Unregistered %s module\n", module->name);
|
||||
|
||||
mutex_unlock(&gbcodec->lock);
|
||||
|
|
|
@ -308,18 +308,22 @@ static int gb_audio_probe(struct gb_bundle *bundle,
|
|||
}
|
||||
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 */
|
||||
|
@ -339,9 +343,6 @@ static int gb_audio_probe(struct gb_bundle *bundle,
|
|||
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;
|
||||
|
||||
|
@ -371,11 +372,11 @@ static void gb_audio_disconnect(struct gb_bundle *bundle)
|
|||
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);
|
||||
|
|
Loading…
Reference in a new issue