Commit d764212f authored by Vaibhav Agarwal's avatar Vaibhav Agarwal Committed by Greg Kroah-Hartman

greybus: audio: fix to resolve multiple audio module playback issue

Cleanup APBridge sequence only in case of last module plugged-out.
For other modules, unregister cportid is sufficient.
Signed-off-by: default avatarVaibhav Agarwal <vaibhav.agarwal@linaro.org>
Reviewed-by: default avatarMark Greer <mark.greer@animalcreek.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
parent 5793227c
...@@ -794,6 +794,7 @@ void gbaudio_codec_cleanup(struct gbaudio_module_info *module) ...@@ -794,6 +794,7 @@ void gbaudio_codec_cleanup(struct gbaudio_module_info *module)
if (!pb_state && !cap_state) if (!pb_state && !cap_state)
return; return;
dev_dbg(gbcodec->dev, "%s: removed, cleanup APBridge\n", module->name);
if (pb_state == GBAUDIO_CODEC_START) { if (pb_state == GBAUDIO_CODEC_START) {
/* cleanup PB path, only APBridge specific */ /* cleanup PB path, only APBridge specific */
data = find_data(module, gbcodec->stream[0].dai_name); data = find_data(module, gbcodec->stream[0].dai_name);
...@@ -802,12 +803,16 @@ void gbaudio_codec_cleanup(struct gbaudio_module_info *module) ...@@ -802,12 +803,16 @@ void gbaudio_codec_cleanup(struct gbaudio_module_info *module)
__func__); __func__);
return; return;
} }
ret = gb_audio_apbridgea_stop_tx(data->connection, 0);
if (ret) if (list_is_singular(&gbcodec->module_list)) {
return; ret = gb_audio_apbridgea_stop_tx(data->connection, 0);
ret = gb_audio_apbridgea_shutdown_tx(data->connection, 0); if (ret)
if (ret) return;
return; ret = gb_audio_apbridgea_shutdown_tx(data->connection,
0);
if (ret)
return;
}
i2s_port = 0; /* fixed for now */ i2s_port = 0; /* fixed for now */
cportid = data->connection->hd_cport_id; cportid = data->connection->hd_cport_id;
ret = gb_audio_apbridgea_unregister_cport(data->connection, ret = gb_audio_apbridgea_unregister_cport(data->connection,
...@@ -824,12 +829,15 @@ void gbaudio_codec_cleanup(struct gbaudio_module_info *module) ...@@ -824,12 +829,15 @@ void gbaudio_codec_cleanup(struct gbaudio_module_info *module)
__func__); __func__);
return; return;
} }
ret = gb_audio_apbridgea_stop_rx(data->connection, 0); if (list_is_singular(&gbcodec->module_list)) {
if (ret) ret = gb_audio_apbridgea_stop_rx(data->connection, 0);
return; if (ret)
ret = gb_audio_apbridgea_shutdown_rx(data->connection, 0); return;
if (ret) ret = gb_audio_apbridgea_shutdown_rx(data->connection,
return; 0);
if (ret)
return;
}
i2s_port = 0; /* fixed for now */ i2s_port = 0; /* fixed for now */
cportid = data->connection->hd_cport_id; cportid = data->connection->hd_cport_id;
ret = gb_audio_apbridgea_unregister_cport(data->connection, ret = gb_audio_apbridgea_unregister_cport(data->connection,
...@@ -854,10 +862,7 @@ void gbaudio_unregister_module(struct gbaudio_module_info *module) ...@@ -854,10 +862,7 @@ void gbaudio_unregister_module(struct gbaudio_module_info *module)
dev_dbg(codec->dev, "Process Unregister %s module\n", module->name); dev_dbg(codec->dev, "Process Unregister %s module\n", module->name);
mutex_lock(&module->lock); mutex_lock(&module->lock);
if (list_is_last(&module->list, &gbcodec->module_list)) { gbaudio_codec_cleanup(module);
dev_dbg(codec->dev, "Last module removed, cleanup APBridge\n");
gbaudio_codec_cleanup(module);
}
module->is_connected = 0; module->is_connected = 0;
if (module->dapm_routes) { if (module->dapm_routes) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment