| .. | .. |
|---|
| 2336 | 2336 | if (!snd_soc_dpcm_be_can_update(fe, be, stream)) |
|---|
| 2337 | 2337 | continue; |
|---|
| 2338 | 2338 | |
|---|
| 2339 | + if (!snd_soc_dpcm_can_be_prepared(fe, be, stream)) |
|---|
| 2340 | + continue; |
|---|
| 2341 | + |
|---|
| 2339 | 2342 | if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_PARAMS) && |
|---|
| 2340 | 2343 | (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP) && |
|---|
| 2341 | 2344 | (be->dpcm[stream].state != SND_SOC_DPCM_STATE_SUSPEND) && |
|---|
| .. | .. |
|---|
| 2978 | 2981 | return snd_soc_dpcm_check_state(fe, be, stream, state, ARRAY_SIZE(state)); |
|---|
| 2979 | 2982 | } |
|---|
| 2980 | 2983 | EXPORT_SYMBOL_GPL(snd_soc_dpcm_can_be_params); |
|---|
| 2984 | + |
|---|
| 2985 | +/* |
|---|
| 2986 | + * We can only prepare a BE DAI if any of it's FE are not prepared, |
|---|
| 2987 | + * running or paused for the specified stream direction. |
|---|
| 2988 | + */ |
|---|
| 2989 | +int snd_soc_dpcm_can_be_prepared(struct snd_soc_pcm_runtime *fe, |
|---|
| 2990 | + struct snd_soc_pcm_runtime *be, int stream) |
|---|
| 2991 | +{ |
|---|
| 2992 | + const enum snd_soc_dpcm_state state[] = { |
|---|
| 2993 | + SND_SOC_DPCM_STATE_START, |
|---|
| 2994 | + SND_SOC_DPCM_STATE_PAUSED, |
|---|
| 2995 | + SND_SOC_DPCM_STATE_PREPARE, |
|---|
| 2996 | + }; |
|---|
| 2997 | + |
|---|
| 2998 | + return snd_soc_dpcm_check_state(fe, be, stream, state, ARRAY_SIZE(state)); |
|---|
| 2999 | +} |
|---|
| 3000 | +EXPORT_SYMBOL_GPL(snd_soc_dpcm_can_be_prepared); |
|---|