audio: stop reading sound trigger lab data on SSR

While sound trigger lab data being read, if CPE SSR
happens the pcm read returns -ENETRESET. Instead of
updating the sound card sate, mark the sound trigger
state as inactive to avoid reading the lab data from
driver. Marking the session as inactive handle both
CPE and ADSP SSR scenarios where HAL is prevented
to read from kernel.

Change-Id: Id82eed597c01265a7d26f17e5ac3c5cd0e17adbf
CRs-fixed: 790726
This commit is contained in:
Bharath Ramachandramurthy 2015-02-05 14:27:59 -08:00 committed by Gerrit - the friendly Code Review server
parent 2d3bb44603
commit 837535b957
3 changed files with 17 additions and 1 deletions

View File

@ -165,6 +165,7 @@ void audio_extn_sound_trigger_check_and_get_session(struct stream_in *in)
in->config = st_ses_info->st_ses.config;
in->channel_mask = audio_channel_in_mask_from_count(in->config.channels);
in->is_st_session = true;
in->is_st_session_active = true;
ALOGD("%s: capture_handle %d is sound trigger", __func__, in->capture_handle);
break;
}

View File

@ -2571,6 +2571,12 @@ static ssize_t in_read(struct audio_stream_in *stream, void *buffer,
ALOGD(" %s: sound card is not active/SSR state", __func__);
ret= -EIO;;
goto exit;
} else {
if (in->is_st_session && !in->is_st_session_active) {
ALOGD(" %s: Sound trigger is not active/SSR", __func__);
ret= -EIO;;
goto exit;
}
}
}
@ -2615,7 +2621,15 @@ exit:
/* ToDo: There may be a corner case when SSR happens back to back during
start/stop. Need to post different error to handle that. */
if (-ENETRESET == ret) {
set_snd_card_state(adev,SND_CARD_STATE_OFFLINE);
/* CPE SSR results in kernel returning ENETRESET for sound trigger
session reading on LAB data. In this case do not set sound card state
offline, instead mark this sound trigger session inactive to avoid
further reading of LAB data from CPE driver. Marking the session
inactive handles both CPE and ADSP SSR for sound trigger session */
if (!in->is_st_session)
set_snd_card_state(adev,SND_CARD_STATE_OFFLINE);
else
in->is_st_session_active = false;
}
pthread_mutex_unlock(&in->lock);

View File

@ -232,6 +232,7 @@ struct stream_in {
audio_format_t format;
audio_io_handle_t capture_handle;
bool is_st_session;
bool is_st_session_active;
struct audio_device *dev;
};