diff options
author | Vaibhav Agarwal <vaibhav.agarwal@linaro.org> | 2016-08-05 18:16:30 +0530 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@google.com> | 2016-08-05 20:14:48 +0200 |
commit | 33cc283928249b2230a6519a2303fe30161cf788 (patch) | |
tree | d6940b319b22097abac05d0ceb2152959326e3ff /drivers/staging/greybus | |
parent | 9141ad8773f4f6ebb8cd9fa376d9497fa7e73374 (diff) | |
download | op-kernel-dev-33cc283928249b2230a6519a2303fe30161cf788.zip op-kernel-dev-33cc283928249b2230a6519a2303fe30161cf788.tar.gz |
greybus: audio: Report jack removal along with module removal
For GB module with jack slot supported, headset/headphone can still
be inserted at the time of module removal. In this case, above layer is
unaware about jack removal event which happened due to module removal.
This may lead to inconsistent state in above HAL layer. Fix this by
reporting jack removal event explicitly.
Signed-off-by: Vaibhav Agarwal <vaibhav.agarwal@linaro.org>
Reviewed-by: Mark Greer <mgreer@animalcreek.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'drivers/staging/greybus')
-rw-r--r-- | drivers/staging/greybus/audio_codec.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/drivers/staging/greybus/audio_codec.c b/drivers/staging/greybus/audio_codec.c index cf86f51..3eb3d2c 100644 --- a/drivers/staging/greybus/audio_codec.c +++ b/drivers/staging/greybus/audio_codec.c @@ -909,6 +909,7 @@ void gbaudio_unregister_module(struct gbaudio_module_info *module) struct snd_soc_codec *codec = gbcodec->codec; struct snd_card *card = codec->card->snd_card; struct snd_soc_jack *jack, *next_j; + int mask; dev_dbg(codec->dev, "Unregister %s module\n", module->name); @@ -922,8 +923,16 @@ void gbaudio_unregister_module(struct gbaudio_module_info *module) #ifdef CONFIG_SND_JACK /* free jack devices for this module from codec->jack_list */ list_for_each_entry_safe(jack, next_j, &codec->jack_list, list) { - if ((jack == &module->headset_jack) - || (jack == &module->button_jack)) { + if (jack == &module->headset_jack) + mask = GBCODEC_JACK_MASK; + else if (jack == &module->button_jack) + mask = GBCODEC_JACK_BUTTON_MASK; + else + mask = 0; + if (mask) { + dev_dbg(module->dev, "Report %s removal\n", + jack->jack->id); + snd_soc_jack_report(jack, 0, mask); snd_device_free(codec->card->snd_card, jack->jack); list_del(&jack->list); } |