ASoC: SOF: topology: fix: handle DAI widget connections properly with multiple CPU DAI's
Currently, when connecting a DAI widget to the BE CPU DAI, we overwrite
the previous connections. This worked because we only ever had 1 CPU DAI
for each rtd until now. But with multiple CPU DAI's, a new connection
between a BE CPU DAI and the DAI widget should be established without
affecting the previous connections. So, modify the loop to set the
playback/capture widget for the first BE CPU DAI that does not have a
connection established previously.
Fixes: 4a7e26a4d833 ("ASoC: SOF: topology: connect dai widget to all
cpu-dais")
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Link: https://lore.kernel.org/r/20200415202816.934-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
			
			
This commit is contained in:
		
							parent
							
								
									83b35f4586
								
							
						
					
					
						commit
						101001652e
					
				| @ -1257,15 +1257,45 @@ static int sof_connect_dai_widget(struct snd_soc_component *scomp, | ||||
| 
 | ||||
| 		switch (w->id) { | ||||
| 		case snd_soc_dapm_dai_out: | ||||
| 			for_each_rtd_cpu_dais(rtd, i, cpu_dai) | ||||
| 				cpu_dai->capture_widget = w; | ||||
| 			for_each_rtd_cpu_dais(rtd, i, cpu_dai) { | ||||
| 				/*
 | ||||
| 				 * Please create DAI widget in the right order | ||||
| 				 * to ensure BE will connect to the right DAI | ||||
| 				 * widget. | ||||
| 				 */ | ||||
| 				if (!cpu_dai->capture_widget) { | ||||
| 					cpu_dai->capture_widget = w; | ||||
| 					break; | ||||
| 				} | ||||
| 			} | ||||
| 			if (i == rtd->num_cpus) { | ||||
| 				dev_err(scomp->dev, "error: can't find BE for DAI %s\n", | ||||
| 					w->name); | ||||
| 
 | ||||
| 				return -EINVAL; | ||||
| 			} | ||||
| 			dai->name = rtd->dai_link->name; | ||||
| 			dev_dbg(scomp->dev, "tplg: connected widget %s -> DAI link %s\n", | ||||
| 				w->name, rtd->dai_link->name); | ||||
| 			break; | ||||
| 		case snd_soc_dapm_dai_in: | ||||
| 			for_each_rtd_cpu_dais(rtd, i, cpu_dai) | ||||
| 				cpu_dai->playback_widget = w; | ||||
| 			for_each_rtd_cpu_dais(rtd, i, cpu_dai) { | ||||
| 				/*
 | ||||
| 				 * Please create DAI widget in the right order | ||||
| 				 * to ensure BE will connect to the right DAI | ||||
| 				 * widget. | ||||
| 				 */ | ||||
| 				if (!cpu_dai->playback_widget) { | ||||
| 					cpu_dai->playback_widget = w; | ||||
| 					break; | ||||
| 				} | ||||
| 			} | ||||
| 			if (i == rtd->num_cpus) { | ||||
| 				dev_err(scomp->dev, "error: can't find BE for DAI %s\n", | ||||
| 					w->name); | ||||
| 
 | ||||
| 				return -EINVAL; | ||||
| 			} | ||||
| 			dai->name = rtd->dai_link->name; | ||||
| 			dev_dbg(scomp->dev, "tplg: connected widget %s -> DAI link %s\n", | ||||
| 				w->name, rtd->dai_link->name); | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user