Audio: Fix for FM off/on delay post SSR
- 8-10sec delay observed when FM is turned off/on from UI post SSR with touch tones enabled. If any new input request comes before FM is closed post SSR, pcm driver assumes AFE is still active and starts pumping data to AFE which is already closed due to SSR causing the delay - Fix is to close FM session during SSR CRs-Fixed: 673031 Change-Id: I4a55c6ca66d94e633e768b1d40584d5a5782e13e
This commit is contained in:
parent
bb1d15364e
commit
7b4cb78234
|
@ -51,6 +51,8 @@ struct fm_module {
|
||||||
struct pcm *fm_pcm_tx;
|
struct pcm *fm_pcm_tx;
|
||||||
bool is_fm_running;
|
bool is_fm_running;
|
||||||
float fm_volume;
|
float fm_volume;
|
||||||
|
bool restart_fm;
|
||||||
|
int scard_state;
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct fm_module fmmod = {
|
static struct fm_module fmmod = {
|
||||||
|
@ -58,6 +60,8 @@ static struct fm_module fmmod = {
|
||||||
.fm_pcm_tx = NULL,
|
.fm_pcm_tx = NULL,
|
||||||
.fm_volume = 0,
|
.fm_volume = 0,
|
||||||
.is_fm_running = 0,
|
.is_fm_running = 0,
|
||||||
|
.restart_fm = 0,
|
||||||
|
.scard_state = SND_CARD_STATE_ONLINE,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int32_t fm_set_volume(struct audio_device *adev, float value)
|
static int32_t fm_set_volume(struct audio_device *adev, float value)
|
||||||
|
@ -212,7 +216,23 @@ void audio_extn_fm_set_parameters(struct audio_device *adev,
|
||||||
float vol =0.0;
|
float vol =0.0;
|
||||||
|
|
||||||
ALOGV("%s: enter", __func__);
|
ALOGV("%s: enter", __func__);
|
||||||
|
ret = str_parms_get_str(parms, "SND_CARD_STATUS", value, sizeof(value));
|
||||||
|
if (ret >= 0) {
|
||||||
|
char *snd_card_status = value+2;
|
||||||
|
if (strstr(snd_card_status, "OFFLINE")) {
|
||||||
|
fmmod.scard_state = SND_CARD_STATE_OFFLINE;
|
||||||
|
}
|
||||||
|
else if (strstr(snd_card_status, "ONLINE")) {
|
||||||
|
fmmod.scard_state = SND_CARD_STATE_ONLINE;
|
||||||
|
}
|
||||||
|
}
|
||||||
if(fmmod.is_fm_running) {
|
if(fmmod.is_fm_running) {
|
||||||
|
if (fmmod.scard_state == SND_CARD_STATE_OFFLINE) {
|
||||||
|
ALOGD("sound card is OFFLINE, stop FM");
|
||||||
|
fm_stop(adev);
|
||||||
|
fmmod.restart_fm = 1;
|
||||||
|
}
|
||||||
|
|
||||||
ret = str_parms_get_str(parms, AUDIO_PARAMETER_STREAM_ROUTING,
|
ret = str_parms_get_str(parms, AUDIO_PARAMETER_STREAM_ROUTING,
|
||||||
value, sizeof(value));
|
value, sizeof(value));
|
||||||
if (ret >= 0) {
|
if (ret >= 0) {
|
||||||
|
@ -221,6 +241,11 @@ void audio_extn_fm_set_parameters(struct audio_device *adev,
|
||||||
select_devices(adev, USECASE_AUDIO_PLAYBACK_FM);
|
select_devices(adev, USECASE_AUDIO_PLAYBACK_FM);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (fmmod.restart_fm && (fmmod.scard_state == SND_CARD_STATE_ONLINE)) {
|
||||||
|
ALOGD("sound card is ONLINE, restart FM");
|
||||||
|
fmmod.restart_fm = 0;
|
||||||
|
fm_start(adev);
|
||||||
|
}
|
||||||
|
|
||||||
ret = str_parms_get_str(parms, AUDIO_PARAMETER_KEY_HANDLE_FM,
|
ret = str_parms_get_str(parms, AUDIO_PARAMETER_KEY_HANDLE_FM,
|
||||||
value, sizeof(value));
|
value, sizeof(value));
|
||||||
|
|
Loading…
Reference in New Issue