Skip to content

Commit b3426f9

Browse files
committed
ASoC: wm_adsp: Don't allow compress stream on DSP after WDT expiry
Prevent compress stream start on a DSP after the WDT has expired. Additionally, if the stream has already started, put it into a bad state and then wake any polls so that they can see the change. Change-Id: I69d6c36d8dae4868cd2d00f34e2b00b5e1cc9b58 Signed-off-by: Stuart Henderson <[email protected]>
1 parent 00ba0a9 commit b3426f9

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

sound/soc/codecs/wm_adsp.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3903,6 +3903,8 @@ int wm_halo_event(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol,
39033903
if (wm_adsp_fw[dsp->fw].num_caps != 0)
39043904
wm_adsp_buffer_free(dsp);
39053905

3906+
dsp->fatal_error = false;
3907+
39063908
mutex_unlock(&dsp->pwr_lock);
39073909

39083910
/* reset halo core with CORE_SOFT_REEST */
@@ -4049,7 +4051,7 @@ static int wm_adsp_compr_attach(struct wm_adsp_compr *compr)
40494051
* Note this will be more complex once each DSP can support multiple
40504052
* streams
40514053
*/
4052-
if (!compr->dsp->buffer)
4054+
if (!compr->dsp->buffer || compr->dsp->fatal_error)
40534055
return -EINVAL;
40544056

40554057
compr->buf = compr->dsp->buffer;
@@ -5065,6 +5067,12 @@ irqreturn_t wm_halo_wdt_expire(int irq, void *data)
50655067
adsp_warn(dsp, "WDT Expiry Fault\n");
50665068
wm_halo_stop_watchdog(dsp);
50675069

5070+
dsp->fatal_error = true;
5071+
if (dsp->compr && dsp->compr->stream) {
5072+
snd_compr_stop_error(dsp->compr->stream, SNDRV_PCM_STATE_XRUN);
5073+
snd_compr_fragment_elapsed(dsp->compr->stream);
5074+
}
5075+
50685076
mutex_unlock(&dsp->pwr_lock);
50695077

50705078
return IRQ_HANDLED;

sound/soc/codecs/wm_adsp.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ struct wm_adsp {
8787
bool preloaded;
8888
bool booted;
8989
bool running;
90+
bool fatal_error;
9091

9192
struct list_head ctl_list;
9293

0 commit comments

Comments
 (0)