ASoC: Intel: sof_sdw_rt_sdca_jack_common: check ctx->headset_codec_dev instead of playback

'if (!playback)' will not work if the dai is only on capture dai link
or is on more than one playback dai links. Check 'if
(ctx->headset_codec_dev)' instead.

Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20231204214200.203100-6-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Bard Liao 2023-12-04 15:42:00 -06:00 committed by Mark Brown
parent e38e252dbc
commit 70a6b66d6e
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0

View File

@ -192,10 +192,10 @@ int sof_sdw_rt_sdca_jack_init(struct snd_soc_card *card,
int ret;
/*
* headset should be initialized once.
* Do it with dai link for playback.
* Jack detection should be only initialized once for headsets since
* the playback/capture is sharing the same jack
*/
if (!playback)
if (ctx->headset_codec_dev)
return 0;
sdw_dev = bus_find_device_by_name(&sdw_bus_type, NULL, dai_links->codecs[0].name);