From 6c2d63e96f335f6ffbf83c53baeae8fbecf3e841 Mon Sep 17 00:00:00 2001 From: Pierre-Louis Bossart Date: Thu, 26 Oct 2023 14:19:36 -0500 Subject: [PATCH] fixup! ASoC: SOF: Intel: hda-dai-ops: fix HDaudio link format Commit 7f9512a31dc2 ("ASoC: SOF: Intel: hda-dai-ops: fix HDaudio link format") assumed that the codec_ch_maps is set unconditionally. This is however not true in the nocodec mode, the codec_ch_maps is not set for the dummy dais. Note that this fixes https://github.com/thesofproject/linux/issues/4655 but on the second playback we still have a DSP panic. It's likely a separate issue likely tied to topology or multi-core handling. [ 118.660171] snd_sof:sof_widget_setup_unlocked: sof-audio-pci-intel-lnl 0000:00:1f.3: widget smart_amp.2.1 setup complete [ 118.660174] snd_sof:sof_ipc4_widget_setup: sof-audio-pci-intel-lnl 0000:00:1f.3: Create widget dai-copier.SSP.NoCodec-0.playback instance 1 - pipe 2 - core 0 [ 118.660176] snd_sof:sof_ipc4_log_header: sof-audio-pci-intel-lnl 0000:00:1f.3: ipc tx : 0x40010004|0x10056: MOD_INIT_INSTANCE [data size: 344] [ 118.663559] snd_sof:sof_ipc4_log_header: sof-audio-pci-intel-lnl 0000:00:1f.3: ipc rx : 0x1b0a0000|0x0: GLB_NOTIFICATION|EXCEPTION_CAUGHT [ 118.663565] sof-audio-pci-intel-lnl 0000:00:1f.3: ------------[ DSP dump start ]------------ [ 118.663571] sof-audio-pci-intel-lnl 0000:00:1f.3: DSP panic! [ 118.663573] sof-audio-pci-intel-lnl 0000:00:1f.3: fw_state: SOF_FW_BOOT_COMPLETE (7) [ 118.663585] sof-audio-pci-intel-lnl 0000:00:1f.3: ROM status: 0x5, ROM error: 0x0 [ 118.663587] sof-audio-pci-intel-lnl 0000:00:1f.3: ROM debug status: 0x0, ROM debug error: 0x0 [ 118.663592] sof-audio-pci-intel-lnl 0000:00:1f.3: ROM feature bit enabled [ 118.663614] snd_sof:sof_ipc4_find_debug_slot_offset_by_type: sof-audio-pci-intel-lnl 0000:00:1f.3: Slot type 0x4c455400 is not available in debug window [ 118.663616] sof-audio-pci-intel-lnl 0000:00:1f.3: ------------[ DSP dump end ]------------ [ 118.663619] snd_sof:sof_set_fw_state: sof-audio-pci-intel-lnl 0000:00:1f.3: fw_state change: 7 -> 8 [ 118.663629] snd_sof:sof_ipc4_log_header: sof-audio-pci-intel-lnl 0000:00:1f.3: ipc rx done : 0x1b0a0000|0x0: GLB_NOTIFICATION|EXCEPTION_CAUGHT [ 119.168384] sof-audio-pci-intel-lnl 0000:00:1f.3: ipc timed out for 0x40010004|0x10056 [ 119.168396] sof-audio-pci-intel-lnl 0000:00:1f.3: Attempting to prevent DSP from entering D3 state to preserve context [ 119.168399] sof-audio-pci-intel-lnl 0000:00:1f.3: ------------[ IPC dump start ]------------ [ 119.168445] sof-audio-pci-intel-lnl 0000:00:1f.3: Host IPC initiator: 0xc0010004|0x10056|0x0, target: 0x1b0a0000|0x0|0x0, ctl: 0x3 [ 119.168449] sof-audio-pci-intel-lnl 0000:00:1f.3: ------------[ IPC dump end ]------------ [ 119.168452] sof-audio-pci-intel-lnl 0000:00:1f.3: IPC timeout [ 119.168476] sof-audio-pci-intel-lnl 0000:00:1f.3: failed to create module dai-copier.SSP.NoCodec-0.playback [ 119.168490] snd_sof:sof_widget_free_unlocked: sof-audio-pci-intel-lnl 0000:00:1f.3: widget smart_amp.2.1 freed [ 119.168493] snd_sof:sof_widget_free_unlocked: sof-audio-pci-intel-lnl 0000:00:1f.3: widget gain.2.1 freed [ 119.168498] snd_sof:sof_ipc4_log_header: sof-audio-pci-intel-lnl 0000:00:1f.3: ipc tx : 0x12010000|0x0: GLB_DELETE_PIPELINE [ 119.168605] sof-audio-pci-intel-lnl 0000:00:1f.3: ipc4_tx_msg_unlocked: ipc message send for 0x12010000|0x0 failed: -19 [ 119.168609] sof-audio-pci-intel-lnl 0000:00:1f.3: failed to free pipeline widget pipeline.2 [ 119.168613] snd_sof:sof_widget_free_unlocked: sof-audio-pci-intel-lnl 0000:00:1f.3: widget mixin.1.1 freed [ 119.168616] snd_sof:sof_widget_free_unlocked: sof-audio-pci-intel-lnl 0000:00:1f.3: widget gain.1.1 freed [ 119.168620] snd_sof:sof_ipc4_log_header: sof-audio-pci-intel-lnl 0000:00:1f.3: ipc tx : 0x12000000|0x0: GLB_DELETE_PIPELINE [ 119.168622] sof-audio-pci-intel-lnl 0000:00:1f.3: ipc4_tx_msg_unlocked: ipc message send for 0x12000000|0x0 failed: -19 [ 119.168625] sof-audio-pci-intel-lnl 0000:00:1f.3: failed to free pipeline widget pipeline.1 [ 119.168627] sof-audio-pci-intel-lnl 0000:00:1f.3: Failed to set up connected widgets [ 119.168634] sof-audio-pci-intel-lnl 0000:00:1f.3: error: failed widget list set up for pcm 0 dir 0 [ 119.168637] sof-audio-pci-intel-lnl 0000:00:1f.3: ASoC: error at snd_soc_pcm_component_hw_params on 0000:00:1f.3: -110 [ 119.168663] Port0: ASoC: error at __soc_pcm_hw_params on Port0: -110 [ 119.168695] Port0: ASoC: error at dpcm_fe_dai_hw_params on Port0: -110 Signed-off-by: Pierre-Louis Bossart --- sound/soc/sof/intel/hda-dai-ops.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/sound/soc/sof/intel/hda-dai-ops.c b/sound/soc/sof/intel/hda-dai-ops.c index 9399b47cf644e1..b04b88b88d326c 100644 --- a/sound/soc/sof/intel/hda-dai-ops.c +++ b/sound/soc/sof/intel/hda-dai-ops.c @@ -240,7 +240,7 @@ static unsigned int generic_calc_stream_format(struct snd_sof_dev *sdev, struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); struct snd_soc_dai *codec_dai; unsigned int format_val; - u32 ch_mask = 0; + u32 ch_mask; int num_channels; int codec_dai_id; @@ -248,10 +248,16 @@ static unsigned int generic_calc_stream_format(struct snd_sof_dev *sdev, * if the multiple dais are handled by the same dailink, we may need to update the * stream channel count - the params are modified in soc-pcm based on the codec_ch_maps info */ - for_each_rtd_codec_dais(rtd, codec_dai_id, codec_dai) - ch_mask |= rtd->dai_link->codec_ch_maps[codec_dai_id].ch_mask; + num_channels = params_channels(params); + if (rtd->dai_link->codec_ch_maps) { + ch_mask = 0; + for_each_rtd_codec_dais(rtd, codec_dai_id, codec_dai) { + ch_mask |= rtd->dai_link->codec_ch_maps[codec_dai_id].ch_mask; + } + if (ch_mask) + num_channels = hweight_long(ch_mask); + } - num_channels = hweight_long(ch_mask); if (num_channels != params_channels(params)) dev_dbg(sdev->dev, "configuring stream format for %d channels, params_channels was %d\n", num_channels, params_channels(params));