audio: enable SoundMonitor to handle ADSP SSR events
Enable SoundMonitor in audio hal to handle ADSP SSR events,
do required cleanup and restore any active sessions gracefully.
Change-Id: I83270b7c12095e56a6677f41efe0f5618a27e0e5
diff --git a/hal/audio_extn/fm.c b/hal/audio_extn/fm.c
index 5da494d..b34bb22 100644
--- a/hal/audio_extn/fm.c
+++ b/hal/audio_extn/fm.c
@@ -62,7 +62,7 @@
bool is_fm_muted;
float fm_volume;
bool restart_fm;
- int scard_state;
+ card_status_t card_status;
};
static struct fm_module fmmod = {
@@ -72,7 +72,7 @@
.is_fm_running = 0,
.is_fm_muted = 0,
.restart_fm = 0,
- .scard_state = SND_CARD_STATE_ONLINE,
+ .card_status = CARD_STATUS_ONLINE,
};
static int32_t fm_set_volume(struct audio_device *adev, float value, bool persist)
@@ -242,14 +242,14 @@
if (ret >= 0) {
char *snd_card_status = value+2;
if (strstr(snd_card_status, "OFFLINE")) {
- fmmod.scard_state = SND_CARD_STATE_OFFLINE;
+ fmmod.card_status = CARD_STATUS_OFFLINE;
}
else if (strstr(snd_card_status, "ONLINE")) {
- fmmod.scard_state = SND_CARD_STATE_ONLINE;
+ fmmod.card_status = CARD_STATUS_ONLINE;
}
}
if(fmmod.is_fm_running) {
- if (fmmod.scard_state == SND_CARD_STATE_OFFLINE) {
+ if (fmmod.card_status == CARD_STATUS_OFFLINE) {
ALOGD("sound card is OFFLINE, stop FM");
fm_stop(adev);
fmmod.restart_fm = 1;
@@ -263,7 +263,7 @@
select_devices(adev, USECASE_AUDIO_PLAYBACK_FM);
}
}
- if (fmmod.restart_fm && (fmmod.scard_state == SND_CARD_STATE_ONLINE)) {
+ if (fmmod.restart_fm && (fmmod.card_status == CARD_STATUS_ONLINE)) {
ALOGD("sound card is ONLINE, restart FM");
fmmod.restart_fm = 0;
fm_start(adev);