ASoC: soc-pcm: do not hw_free BE if it's still used
Do not free BE hw if it's still used by other FE during dpcm runtime shutdown. Otherwise the BE runtime state will be STATE_HW_FREE and won't be updated to STATE_CLOSE when shutdown ends, because BE dai shutdown function won't close pcm when detecting BE is still under use. With STATE_HW_FREE, BE can't be triggered start again. This corner case can easily appear when one BE is used by two FE, without this patch "ASoC: dpcm: Fix race between FE/BE updates and trigger"(ea9d0d771fcd32cd56070819749477d511ec9117). One FE tries to shutdown but it's raced against xrun on another FE. It improves the be dai hw_free logic. Signed-off-by: Qiao Zhou <zhouqiao@marvell.com> Acked-by: Liam Girdwood <liam.r.girdwood@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
		
					parent
					
						
							
								f114040e3e
							
						
					
				
			
			
				commit
				
					
						36fba62cce
					
				
			
		
					 1 changed files with 4 additions and 0 deletions
				
			
		| 
						 | 
					@ -1641,6 +1641,10 @@ int dpcm_be_dai_hw_free(struct snd_soc_pcm_runtime *fe, int stream)
 | 
				
			||||||
		if (!snd_soc_dpcm_can_be_free_stop(fe, be, stream))
 | 
							if (!snd_soc_dpcm_can_be_free_stop(fe, be, stream))
 | 
				
			||||||
				continue;
 | 
									continue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							/* do not free hw if this BE is used by other FE */
 | 
				
			||||||
 | 
							if (be->dpcm[stream].users > 1)
 | 
				
			||||||
 | 
								continue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_PARAMS) &&
 | 
							if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_PARAMS) &&
 | 
				
			||||||
		    (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PREPARE) &&
 | 
							    (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PREPARE) &&
 | 
				
			||||||
		    (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_FREE) &&
 | 
							    (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_FREE) &&
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue