diff options
author | Vaibhav Agarwal <vaibhav.agarwal@linaro.org> | 2016-05-04 16:29:22 +0530 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@google.com> | 2016-05-04 11:30:20 -0700 |
commit | bb9986ef6b311fb3f4de2150bd050c1d9e1d9d65 (patch) | |
tree | 8e58b5be40065872b8df1346a5c5c2343fbda94c /drivers/staging/greybus | |
parent | 852859ab8186e7a492fdec5db5ef219bf625c21a (diff) |
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>
Diffstat (limited to 'drivers/staging/greybus')
-rw-r--r-- | drivers/staging/greybus/audio_codec.c | 34 | ||||
-rw-r--r-- | drivers/staging/greybus/audio_module.c | 21 |
2 files changed, 26 insertions, 29 deletions
diff --git a/drivers/staging/greybus/audio_codec.c b/drivers/staging/greybus/audio_codec.c index c50720ee30fe..dbcff218badd 100644 --- a/drivers/staging/greybus/audio_codec.c +++ b/drivers/staging/greybus/audio_codec.c @@ -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); diff --git a/drivers/staging/greybus/audio_module.c b/drivers/staging/greybus/audio_module.c index 3b763710ddf6..27e5ff19dca6 100644 --- a/drivers/staging/greybus/audio_module.c +++ b/drivers/staging/greybus/audio_module.c @@ -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); |