Peter Ujfalusi
885ec85776
ASoC: SOF: ipc4-control: Keep the payload size up to date
...
[ Upstream commit ebcfdbe4ad ]
When the bytes data is read from the firmware, the size of the payload
can be different than what it was previously.
For example when the topology did not contained payload data at all for the
control, the data size was 0.
For get operation allow maximum size of payload to be read and then update
the sizes according to the completed message.
Similarly, keep the size in sync when updating the data in firmware.
With the change we will be able to read data from firmware for bytes
controls which did not had initial payload defined in topology.
Fixes: a062c8899f ("ASoC: SOF: ipc4-control: Add support for bytes control get and put")
Cc: stable@vger.kernel.org
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com >
Reviewed-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com >
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com >
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com >
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com >
Link: https://patch.msgid.link/20251217143945.2667-5-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org >
Signed-off-by: Sasha Levin <sashal@kernel.org >
2026-03-04 07:21:36 -05:00
Peter Ujfalusi
20b55c3831
ASoC: SOF: ipc4-control: Use the correct size for scontrol->ipc_control_data
...
[ Upstream commit c1876fc33c ]
The size of the data behind scontrol->ipc_control_data is stored in
scontrol->size, use this when copying data for backup/restore.
Fixes: db38d86d0c ("ASoC: sof: Improve sof_ipc4_bytes_ext_put function")
Cc: stable@vger.kernel.org
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com >
Reviewed-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com >
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com >
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com >
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com >
Link: https://patch.msgid.link/20251217143945.2667-4-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org >
Signed-off-by: Sasha Levin <sashal@kernel.org >
2026-03-04 07:21:36 -05:00
Peter Ujfalusi
491956b45b
ASoC: SOF: ipc4-topology: Correct the allocation size for bytes controls
...
[ Upstream commit a653820700 ]
The size of the data behind of scontrol->ipc_control_data for bytes
controls is:
[1] sizeof(struct sof_ipc4_control_data) + // kernel only struct
[2] sizeof(struct sof_abi_hdr)) + payload
The max_size specifies the size of [2] and it is coming from topology.
Change the function to take this into account and allocate adequate amount
of memory behind scontrol->ipc_control_data.
With the change we will allocate [1] amount more memory to be able to hold
the full size of data.
Fixes: a382082ff7 ("ASoC: SOF: ipc4-topology: Add support for TPLG_CTL_BYTES")
Cc: stable@vger.kernel.org
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com >
Reviewed-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com >
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com >
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com >
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com >
Link: https://patch.msgid.link/20251217143945.2667-3-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org >
Signed-off-by: Sasha Levin <sashal@kernel.org >
2026-03-04 07:21:36 -05:00
Peter Ujfalusi
698988dda4
ASoC: SOF: ipc4-control: If there is no data do not send bytes update
...
[ Upstream commit 2fa7471374 ]
When the bytes control have no data (payload) then there is no need to send
an IPC message as there is nothing to send.
Fixes: a062c8899f ("ASoC: SOF: ipc4-control: Add support for bytes control get and put")
Cc: stable@vger.kernel.org
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com >
Reviewed-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com >
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com >
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com >
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com >
Link: https://patch.msgid.link/20251217143945.2667-2-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org >
Signed-off-by: Sasha Levin <sashal@kernel.org >
2026-03-04 07:21:36 -05:00
Ranjani Sridharan
10411f1f2c
ASoC: SOF: Intel: hda: Fix NULL pointer dereference
...
[ Upstream commit 16c589567a ]
If there's a mismatch between the DAI links in the machine driver and
the topology, it is possible that the playback/capture widget is not
set, especially in the case of loopback capture for echo reference
where we use the dummy DAI link. Return the error when the widget is not
set to avoid a null pointer dereference like below when the topology is
broken.
RIP: 0010:hda_dai_get_ops.isra.0+0x14/0xa0 [snd_sof_intel_hda_common]
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com >
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com >
Reviewed-by: Liam Girdwood <liam.r.girdwood@intel.com >
Reviewed-by: Mateusz Redzynia <mateuszx.redzynia@intel.com >
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com >
Link: https://patch.msgid.link/20260204081833.16630-10-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org >
Signed-off-by: Sasha Levin <sashal@kernel.org >
2026-03-04 07:21:09 -05:00
Peter Ujfalusi
1aa3db5864
ASoC: SOF: ipc4: Support for sending payload along with LARGE_CONFIG_GET
...
[ Upstream commit d96cb0b86d ]
There are message types when we would need to send a payload along with
the LARGE_CONFIG_GET message to provide information to the firmware on
what data is requested.
Such cases are the ALSA Kcontrol related messages when the high level
param_id tells only the type of the control, but the ID/index of the exact
control is specified in the payload area.
The caller must place the payload for TX before calling the set_get_data()
and this payload will be sent alongside with the message to the firmware.
The data area will be overwritten by the received data from firmware.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com >
Reviewed-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com >
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com >
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com >
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com >
Link: https://patch.msgid.link/20251217143945.2667-7-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org >
Signed-off-by: Sasha Levin <sashal@kernel.org >
2026-03-04 07:21:00 -05:00
Peter Ujfalusi
e5fd6965f6
ASoC: SOF: ipc4-pcm: Add fixup for channels
...
[ Upstream commit 6ad299a9b9 ]
We can have modules in path which can change the number of channels and in
this case the BE params needs to be adjusted to configure the DAI according
to the copier configuration.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com >
Reviewed-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com >
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com >
Reviewed-by: Liam Girdwood <liam.r.girdwood@intel.com >
Message-ID: <20250829105305.31818-2-peter.ujfalusi@linux.intel.com >
Signed-off-by: Mark Brown <broonie@kernel.org >
Signed-off-by: Sasha Levin <sashal@kernel.org >
2025-11-13 15:34:16 -05:00
Kai Vehmanen
e051ab688e
ASoC: SOF: ipc4-pcm: fix start offset calculation for chain DMA
...
commit bace10b596 upstream.
Assumption that chain DMA module starts the link DMA when 1ms of
data is available from host is not correct. Instead the firmware
chain DMA module fills the link DMA with initial buffer of zeroes
and the host and link DMAs are started at the same time.
This results in a small error in delay calculation. This can become a
more severe problem if host DMA has delays that exceed 1ms. This results
in negative delay to be calculated and bogus values reported to
applications. This can confuse some applications like
alsa_conformance_test.
Fix the issue by correctly calculating the firmware chain DMA
preamble size and initializing the start offset to this value.
Cc: stable@vger.kernel.org
Fixes: a1d203d390 ("ASoC: SOF: ipc4-pcm: Enable delay reporting for ChainDMA streams")
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com >
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com >
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com >
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com >
Link: https://patch.msgid.link/20251002074719.2084-3-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org >
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2025-10-19 16:34:07 +02:00
Kai Vehmanen
a4ae0c21ae
ASoC: SOF: ipc4-pcm: fix delay calculation when DSP resamples
...
[ Upstream commit bcd1383516 ]
When the sampling rates going in (host) and out (dai) from the DSP
are different, the IPC4 delay reporting does not work correctly.
Add support for this case by scaling the all raw position values to
a common timebase before calculating real-time delay for the PCM.
Cc: stable@vger.kernel.org
Fixes: 0ea06680df ("ASoC: SOF: ipc4-pcm: Correct the delay calculation")
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com >
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com >
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com >
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com >
Link: https://patch.msgid.link/20251002074719.2084-2-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org >
Signed-off-by: Sasha Levin <sashal@kernel.org >
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2025-10-19 16:34:01 +02:00
Peter Ujfalusi
848e6babaa
ASoC: SOF: ipc4-pcm: Enable delay reporting for ChainDMA streams
...
[ Upstream commit a1d203d390 ]
All streams (currently) which is configured to use ChainDMA can only work
on Link/host DMA pairs where the link side position can be access via host
registers (like HDA on CAVS 2.5 platforms).
Since the firmware does not provide time_info for ChainDMA, unlike for HDA
stream, the kernel should calculate the start and end offsets that is
needed for the delay calculation.
With this small change we can report accurate delays when the stream is
configured to use ChainDMA.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com >
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com >
Reviewed-by: Liam Girdwood <liam.r.girdwood@intel.com >
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com >
Link: https://patch.msgid.link/20250619102848.12389-1-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org >
Stable-dep-of: bcd1383516 ("ASoC: SOF: ipc4-pcm: fix delay calculation when DSP resamples")
Signed-off-by: Sasha Levin <sashal@kernel.org >
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2025-10-19 16:34:01 +02:00
Peter Ujfalusi
9fc2af69d5
ASoC: SOF: Intel: Read the LLP via the associated Link DMA channel
...
[ Upstream commit aaab61de1f ]
It is allowed to mix Link and Host DMA channels in a way that their index
is different. In this case we would read the LLP from a channel which is
not used or used for other operation.
Such case can be reproduced on cAVS2.5 or ACE1 platforms with soundwire
configuration:
playback to SDW would take Host channel 0 (stream_tag 1) and no Link DMA
used
Second playback to HDMI (HDA) would use Host channel 1 (stream_tag 2) and
Link channel 0 (stream_tag 1).
In this case reading the LLP from channel 2 is incorrect as that is not the
Link channel used for the HDMI playback.
To correct this, we should look up the BE and get the channel used on the
Link side.
Fixes: 67b182bea0 ("ASoC: SOF: Intel: hda: Implement get_stream_position (Linear Link Position)")
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com >
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com >
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com >
Link: https://patch.msgid.link/20251002074719.2084-6-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org >
Signed-off-by: Sasha Levin <sashal@kernel.org >
2025-10-19 16:33:39 +02:00
Peter Ujfalusi
eb6cd53402
ASoC: SOF: Intel: hda-pcm: Place the constraint on period time instead of buffer time
...
[ Upstream commit 45ad27d9a6 ]
Instead of constraining the ALSA buffer time to be double of the firmware
host buffer size, it is better to set it for the period time.
This will implicitly constrain the buffer time to a safe value
(num_periods is at least 2) and prohibits applications to set smaller
period size than what will be covered by the initial DMA burst.
Fixes: fe76d2e75a ("ASoC: SOF: Intel: hda-pcm: Use dsp_max_burst_size_in_ms to place constraint")
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com >
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com >
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com >
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com >
Link: https://patch.msgid.link/20251002135752.2430-4-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org >
Signed-off-by: Sasha Levin <sashal@kernel.org >
2025-10-19 16:33:38 +02:00
Peter Ujfalusi
a41a9d0a5b
ASoC: SOF: ipc4-topology: Account for different ChainDMA host buffer size
...
[ Upstream commit 3dcf683bf1 ]
For ChainDMA the firmware allocates 5ms host buffer instead of the standard
4ms which should be taken into account when setting the constraint on the
buffer size.
Fixes: 842bb8b62c ("ASoC: SOF: ipc4-topology: Save the DMA maximum burst size for PCMs")
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com >
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com >
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com >
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com >
Link: https://patch.msgid.link/20251002135752.2430-3-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org >
Signed-off-by: Sasha Levin <sashal@kernel.org >
2025-10-19 16:33:38 +02:00
Peter Ujfalusi
53d07ac2ad
ASoC: SOF: ipc4-topology: Correct the minimum host DMA buffer size
...
[ Upstream commit a7fe5ff832 ]
The firmware has changed the minimum host buffer size from 2 periods to
4 periods (1 period is 1ms) which was missed by the kernel side.
Adjust the SOF_IPC4_MIN_DMA_BUFFER_SIZE to 4 ms to align with firmware.
Link: f0a14a3f41
Fixes: 594c1bb9ff ("ASoC: SOF: ipc4-topology: Do not parse the DMA_BUFFER_SIZE token")
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com >
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com >
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com >
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com >
Link: https://patch.msgid.link/20251002135752.2430-2-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org >
Signed-off-by: Sasha Levin <sashal@kernel.org >
2025-10-19 16:33:38 +02:00
Ranjani Sridharan
2be09d893b
ASoC: SOF: ipc3-topology: Fix multi-core and static pipelines tear down
...
commit 59abe7bc7e upstream.
In the case of static pipelines, freeing the widgets in the pipelines
that were not suspended after freeing the scheduler widgets results in
errors because the secondary cores are powered off when the scheduler
widgets are freed. Fix this by tearing down the leftover pipelines before
powering off the secondary cores.
Cc: stable@vger.kernel.org
Fixes: d7332c4a4f ("ASoC: SOF: ipc3-topology: Fix pipeline tear down logic")
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com >
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com >
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com >
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com >
Link: https://patch.msgid.link/20251002073125.32471-1-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org >
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2025-10-15 12:00:21 +02:00
Colin Ian King
b51ded0f60
ASoC: SOF: Intel: hda-stream: Fix incorrect variable used in error message
...
[ Upstream commit 35fc531a59 ]
The dev_err message is reporting an error about capture streams however
it is using the incorrect variable num_playback instead of num_capture.
Fix this by using the correct variable num_capture.
Fixes: a1d1e266b4 ("ASoC: SOF: Intel: Add Intel specific HDA stream operations")
Signed-off-by: Colin Ian King <colin.i.king@gmail.com >
Acked-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com >
Link: https://patch.msgid.link/20250902120639.2626861-1-colin.i.king@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org >
Signed-off-by: Sasha Levin <sashal@kernel.org >
2025-09-25 11:13:48 +02:00
Muhammad Usama Anjum
539fa8a7f1
ASoC: SOF: amd: acp-loader: Use GFP_KERNEL for DMA allocations in resume context
...
commit eb3bb14528 upstream.
Replace GFP_ATOMIC with GFP_KERNEL for dma_alloc_coherent() calls. This
change improves memory allocation reliability during firmware loading,
particularly during system resume when memory pressure is high. Because
of using GFP_KERNEL, reclaim can happen which can reduce the probability
of failure.
Fixes memory allocation failures observed during system resume with
fragmented memory conditions.
snd_sof_amd_vangogh 0000:04:00.5: error: failed to load DSP firmware after resume -12
Fixes: 145d7e5ae8 ("ASoC: SOF: amd: add option to use sram for data bin loading")
Fixes: 7e51a9e38a ("ASoC: SOF: amd: Add fw loader and renoir dsp ops to load firmware")
Cc: stable@vger.kernel.org
Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com >
Link: https://patch.msgid.link/20250725190254.1081184-1-usama.anjum@collabora.com
Signed-off-by: Mark Brown <broonie@kernel.org >
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2025-08-28 16:30:59 +02:00
Peter Ujfalusi
e0f748ef37
ASoC: SOF: topology: Parse the dapm_widget_tokens in case of DSPless mode
...
[ Upstream commit 6b3cb7f434 ]
Parsing the dapm_widget_tokens is also needed for DSPless mode as it is
setting the snd_soc_dapm_widget.no_wname_in_kcontrol_name flag for the
kcontrol creation from DAPM widgets.
Without that flag set, the following warnings might appear because of long
control names:
ALSA: Control name 'eqiir.2.1 Post Mixer Analog Playback IIR Eq bytes' truncated to 'eqiir.2.1 Post Mixer Analog Playback IIR Eq'
ALSA: Control name 'eqfir.2.1 Post Mixer Analog Playback FIR Eq bytes' truncated to 'eqfir.2.1 Post Mixer Analog Playback FIR Eq'
ALSA: Control name 'drc.2.1 Post Mixer Analog Playback DRC bytes' truncated to 'drc.2.1 Post Mixer Analog Playback DRC byte'
ALSA: Control name 'drc.2.1 Post Mixer Analog Playback DRC switch' truncated to 'drc.2.1 Post Mixer Analog Playback DRC swit'
ALSA: Control name 'gain.15.1 Pre Mixer Deepbuffer HDA Analog Volume' truncated to 'gain.15.1 Pre Mixer Deepbuffer HDA Analog V'
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com >
Reviewed-by: Liam Girdwood <liam.r.girdwood@intel.com >
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com >
Link: https://patch.msgid.link/20250619102640.12068-1-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org >
Signed-off-by: Sasha Levin <sashal@kernel.org >
2025-08-20 18:30:26 +02:00
Tamura Dai
68397fda2c
ASoC: SOF: Intel: hda: Use devm_kstrdup() to avoid memleak.
...
[ Upstream commit 6c038b58a2 ]
sof_pdata->tplg_filename can have address allocated by kstrdup()
and can be overwritten. Memory leak was detected with kmemleak:
unreferenced object 0xffff88812391ff60 (size 16):
comm "kworker/4:1", pid 161, jiffies 4294802931
hex dump (first 16 bytes):
73 6f 66 2d 68 64 61 2d 67 65 6e 65 72 69 63 00 sof-hda-generic.
backtrace (crc 4bf1675c):
__kmalloc_node_track_caller_noprof+0x49c/0x6b0
kstrdup+0x46/0xc0
hda_machine_select.cold+0x1de/0x12cf [snd_sof_intel_hda_generic]
sof_init_environment+0x16f/0xb50 [snd_sof]
sof_probe_continue+0x45/0x7c0 [snd_sof]
sof_probe_work+0x1e/0x40 [snd_sof]
process_one_work+0x894/0x14b0
worker_thread+0x5e5/0xfb0
kthread+0x39d/0x760
ret_from_fork+0x31/0x70
ret_from_fork_asm+0x1a/0x30
Signed-off-by: Tamura Dai <kirinode0@gmail.com >
Link: https://patch.msgid.link/20250615235548.8591-1-kirinode0@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org >
Signed-off-by: Sasha Levin <sashal@kernel.org >
2025-07-17 18:37:21 +02:00
Vijendar Mukunda
06c74bd587
ASoC: SOF: amd: add missing acp descriptor field
...
[ Upstream commit 7c2bad7b95 ]
Add missing acp descriptor field acp_error_stat for ACP7.0 platform.
Fixes: 490be7ba2a ("ASoC: SOF: amd: add support for acp7.0 based platform")
Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com >
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com >
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com >
Link: https://patch.msgid.link/20250502154445.3008598-3-Vijendar.Mukunda@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org >
Signed-off-by: Sasha Levin <sashal@kernel.org >
2025-06-19 15:31:32 +02:00
Kees Cook
be0dc3e919
ASoC: SOF: ipc4-pcm: Adjust pipeline_list->pipelines allocation type
...
[ Upstream commit 00a371adbb ]
In preparation for making the kmalloc family of allocators type aware,
we need to make sure that the returned type from the allocation matches
the type of the variable being assigned. (Before, the allocator would
always return "void *", which can be implicitly cast to any pointer type.)
The assigned type is "struct snd_sof_pipeline **", but the returned type
will be "struct snd_sof_widget **". These are the same size allocation
(pointer size) but the types don't match. Adjust the allocation type to
match the assignment.
Signed-off-by: Kees Cook <kees@kernel.org >
Fixes: 9c04363d22 ("ASoC: SOF: Introduce struct snd_sof_pipeline")
Acked-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com >
Link: https://patch.msgid.link/20250426062511.work.859-kees@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org >
Signed-off-by: Sasha Levin <sashal@kernel.org >
2025-06-19 15:31:32 +02:00
Peter Ujfalusi
799d48c95f
ASoC: SOF: ipc4-pcm: Delay reporting is only supported for playback direction
...
commit 98db16f314 upstream.
The firmware does not provide any information for capture streams via the
shared pipeline registers.
To avoid reporting invalid delay value for capture streams to user space
we need to disable it.
Fixes: af74dbd0db ("ASoC: SOF: ipc4-pcm: allocate time info for pcm delay feature")
Cc: stable@vger.kernel.org
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com >
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com >
Reviewed-by: Liam Girdwood <liam.r.girdwood@intel.com >
Link: https://patch.msgid.link/20250509085951.15696-1-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org >
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2025-05-29 11:03:20 +02:00
Kai Vehmanen
20e3fa3b7d
ASoc: SOF: topology: connect DAI to a single DAI link
...
commit 6052f05254 upstream.
The partial matching of DAI widget to link names, can cause problems if
one of the widget names is a substring of another. E.g. with names
"Foo1" and Foo10", it's not possible to correctly link up "Foo1".
Modify the logic so that if multiple DAI links match the widget stream
name, prioritize a full match if one is found.
Fixes: fe88788779 ("ASoC: SOF: topology: Use partial match for connecting DAI link and DAI widget")
Link: https://github.com/thesofproject/linux/issues/5308
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com >
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com >
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com >
Cc: stable@vger.kernel.org
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com >
Link: https://patch.msgid.link/20250509085318.13936-1-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org >
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2025-05-29 11:03:19 +02:00
Peter Ujfalusi
6a62b917fb
ASoC: SOF: Intel: hda-bus: Use PIO mode on ACE2+ platforms
...
commit 4e7010826e upstream.
Keep using the PIO mode for commands on ACE2+ platforms, similarly how
the legacy stack is configured.
Fixes: 05cf17f1bf ("ASoC: SOF: Intel: hda-bus: Use PIO mode for Lunar Lake")
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com >
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com >
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com >
Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20250509081308.13784-1-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org >
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2025-05-29 11:03:19 +02:00
Peter Ujfalusi
964d355832
ASoC: SOF: ipc4-control: Use SOF_CTRL_CMD_BINARY as numid for bytes_ext
...
commit 4d14b1069e upstream.
The header.numid is set to scontrol->comp_id in bytes_ext_get and it is
ignored during bytes_ext_put.
The use of comp_id is not quite great as it is kernel internal
identification number.
Set the header.numid to SOF_CTRL_CMD_BINARY during get and validate the
numid during put to provide consistent and compatible identification
number as IPC3.
For IPC4 existing tooling also ignored the numid but with the use of
SOF_CTRL_CMD_BINARY the different handling of the blobs can be dropped,
providing better user experience.
Reported-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com >
Closes: https://github.com/thesofproject/linux/issues/5282
Fixes: a062c8899f ("ASoC: SOF: ipc4-control: Add support for bytes control get and put")
Cc: stable@vger.kernel.org
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com >
Reviewed-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com >
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com >
Reviewed-by: Liam Girdwood <liam.r.girdwood@intel.com >
Link: https://patch.msgid.link/20250509085633.14930-1-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org >
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2025-05-29 11:03:19 +02:00
Tavian Barnes
2b49e68360
ASoC: SOF: Intel: hda: Fix UAF when reloading module
...
[ Upstream commit 7dd7f39fce ]
hda_generic_machine_select() appends -idisp to the tplg filename by
allocating a new string with devm_kasprintf(), then stores the string
right back into the global variable snd_soc_acpi_intel_hda_machines.
When the module is unloaded, this memory is freed, resulting in a global
variable pointing to freed memory. Reloading the module then triggers
a use-after-free:
BUG: KFENCE: use-after-free read in string+0x48/0xe0
Use-after-free read at 0x00000000967e0109 (in kfence-#99):
string+0x48/0xe0
vsnprintf+0x329/0x6e0
devm_kvasprintf+0x54/0xb0
devm_kasprintf+0x58/0x80
hda_machine_select.cold+0x198/0x17a2 [snd_sof_intel_hda_generic]
sof_probe_work+0x7f/0x600 [snd_sof]
process_one_work+0x17b/0x330
worker_thread+0x2ce/0x3f0
kthread+0xcf/0x100
ret_from_fork+0x31/0x50
ret_from_fork_asm+0x1a/0x30
kfence-#99: 0x00000000198a940f-0x00000000ace47d9d, size=64, cache=kmalloc-64
allocated by task 333 on cpu 8 at 17.798069s (130.453553s ago):
devm_kmalloc+0x52/0x120
devm_kvasprintf+0x66/0xb0
devm_kasprintf+0x58/0x80
hda_machine_select.cold+0x198/0x17a2 [snd_sof_intel_hda_generic]
sof_probe_work+0x7f/0x600 [snd_sof]
process_one_work+0x17b/0x330
worker_thread+0x2ce/0x3f0
kthread+0xcf/0x100
ret_from_fork+0x31/0x50
ret_from_fork_asm+0x1a/0x30
freed by task 1543 on cpu 4 at 141.586686s (6.665010s ago):
release_nodes+0x43/0xb0
devres_release_all+0x90/0xf0
device_unbind_cleanup+0xe/0x70
device_release_driver_internal+0x1c1/0x200
driver_detach+0x48/0x90
bus_remove_driver+0x6d/0xf0
pci_unregister_driver+0x42/0xb0
__do_sys_delete_module+0x1d1/0x310
do_syscall_64+0x82/0x190
entry_SYSCALL_64_after_hwframe+0x76/0x7e
Fix it by copying the match array with devm_kmemdup_array() before we
modify it.
Fixes: 5458411d75 ("ASoC: SOF: Intel: hda: refactoring topology name fixup for HDA mach")
Suggested-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com >
Acked-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com >
Signed-off-by: Tavian Barnes <tavianator@tavianator.com >
Link: https://patch.msgid.link/570b15570b274520a0d9052f4e0f064a29c950ef.1747229716.git.tavianator@tavianator.com
Signed-off-by: Mark Brown <broonie@kernel.org >
Signed-off-by: Sasha Levin <sashal@kernel.org >
2025-05-29 11:03:15 +02:00
Zhang Heng
5330ce1ee2
ASoC: SOF: topology: Use krealloc_array() to replace krealloc()
...
[ Upstream commit a05143a8f7 ]
Use krealloc_array() to replace krealloc() with multiplication.
krealloc_array() has multiply overflow check, which will be safer.
Signed-off-by: Zhang Heng <zhangheng@kylinos.cn >
Link: https://patch.msgid.link/20250117014343.451503-1-zhangheng@kylinos.cn
Signed-off-by: Mark Brown <broonie@kernel.org >
Signed-off-by: Sasha Levin <sashal@kernel.org >
2025-04-20 10:15:12 +02:00
Bard Liao
7b67d26714
ASoC: SOF: Intel: don't check number of sdw links when set dmic_fixup
...
[ Upstream commit 56a6772935 ]
Currently, we assume that the PCH DMIC pins are pin-muxed with SoundWire
links. However, we do see a HW design that use PCH DMIC along with 3
SoundWire links. Remove the check now.
With this change the PCM DMIC will be presented if it is reported by the
BIOS irrespective of whether there are SDW links present or not.
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com >
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com >
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com >
Link: https://patch.msgid.link/20250225093716.67240-2-yung-chuan.liao@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org >
Signed-off-by: Sasha Levin <sashal@kernel.org >
2025-03-22 12:54:20 -07:00
Cristian Ciocaltea
a14be80a82
ASoC: SOF: amd: Handle IPC replies before FW_BOOT_COMPLETE
...
[ Upstream commit ac84ca815a ]
In some cases, e.g. during resuming from suspend, there is a possibility
that some IPC reply messages get received by the host while the DSP
firmware has not yet reached the complete boot state.
Detect when this happens and do not attempt to process the unexpected
replies from DSP. Instead, provide proper debugging support.
Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com >
Link: https://patch.msgid.link/20250207-sof-vangogh-fixes-v1-3-67824c1e4c9a@collabora.com
Signed-off-by: Mark Brown <broonie@kernel.org >
Signed-off-by: Sasha Levin <sashal@kernel.org >
2025-03-22 12:54:19 -07:00
Cristian Ciocaltea
985c2c69a5
ASoC: SOF: amd: Add post_fw_run_delay ACP quirk
...
[ Upstream commit 91b98d5a6e ]
Stress testing resume from suspend on Valve Steam Deck OLED (Galileo)
revealed that the DSP firmware could enter an unrecoverable faulty
state, where the kernel ring buffer is flooded with IPC related error
messages:
[ +0.017002] snd_sof_amd_vangogh 0000:04:00.5: acp_sof_ipc_send_msg: Failed to acquire HW lock
[ +0.000054] snd_sof_amd_vangogh 0000:04:00.5: ipc3_tx_msg_unlocked: ipc message send for 0x30100000 failed: -22
[ +0.000005] snd_sof_amd_vangogh 0000:04:00.5: Failed to setup widget PIPELINE.6.ACPHS1.IN
[ +0.000004] snd_sof_amd_vangogh 0000:04:00.5: Failed to restore pipeline after resume -22
[ +0.000003] snd_sof_amd_vangogh 0000:04:00.5: PM: dpm_run_callback(): pci_pm_resume returns -22
[ +0.000009] snd_sof_amd_vangogh 0000:04:00.5: PM: failed to resume async: error -22
[...]
[ +0.002582] PM: suspend exit
[ +0.065085] snd_sof_amd_vangogh 0000:04:00.5: ipc tx error for 0x30130000 (msg/reply size: 12/0): -22
[ +0.000499] snd_sof_amd_vangogh 0000:04:00.5: error: failed widget list set up for pcm 1 dir 0
[ +0.000011] snd_sof_amd_vangogh 0000:04:00.5: error: set pcm hw_params after resume
[ +0.000006] snd_sof_amd_vangogh 0000:04:00.5: ASoC: error at snd_soc_pcm_component_prepare on 0000:04:00.5: -22
[...]
A system reboot would be necessary to restore the speakers
functionality.
However, by delaying a bit any host to DSP transmission right after
the firmware boot completed, the issue could not be reproduced anymore
and sound continued to work flawlessly even after performing thousands
of suspend/resume cycles.
Introduce the post_fw_run_delay ACP quirk to allow providing the
aforementioned delay via the snd_sof_dsp_ops->post_fw_run() callback for
the affected devices.
Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com >
Link: https://patch.msgid.link/20250207-sof-vangogh-fixes-v1-1-67824c1e4c9a@collabora.com
Signed-off-by: Mark Brown <broonie@kernel.org >
Signed-off-by: Sasha Levin <sashal@kernel.org >
2025-03-22 12:54:19 -07:00
Peter Ujfalusi
458173e86d
ASoC: SOF: Intel: pci-ptl: Add support for PTL-H
...
[ Upstream commit 4e9c87cfcd ]
PTL-H uses the same configuration as PTL.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com >
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com >
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com >
Acked-by: Mark Brown <broonie@kernel.org >
Signed-off-by: Takashi Iwai <tiwai@suse.de >
Link: https://patch.msgid.link/20250210081730.22916-4-peter.ujfalusi@linux.intel.com
Signed-off-by: Sasha Levin <sashal@kernel.org >
2025-03-22 12:54:19 -07:00
Terry Cheong
8aac625691
ASoC: SOF: Intel: hda: add softdep pre to snd-hda-codec-hdmi module
...
[ Upstream commit 33b7dc7843 ]
In enviornment without KMOD requesting module may fail to load
snd-hda-codec-hdmi, resulting in HDMI audio not usable.
Add softdep to loading HDMI codec module first to ensure we can load it
correctly.
Signed-off-by: Terry Cheong <htcheong@chromium.org >
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com >
Reviewed-by: Johny Lin <lpg76627@gmail.com >
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com >
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com >
Link: https://patch.msgid.link/20250206094723.18013-1-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org >
Signed-off-by: Sasha Levin <sashal@kernel.org >
2025-03-22 12:54:18 -07:00
Peter Ujfalusi
e8b4eb5000
ASoC: SOF: pcm: Clear the susbstream pointer to NULL on close
...
commit 46c7b901e2 upstream.
The spcm->stream[substream->stream].substream is set during open and was
left untouched. After the first PCM stream it will never be NULL and we
have code which checks for substream NULLity as indication if the stream is
active or not.
For the compressed cstream pointer the same has been done, this change will
correct the handling of PCM streams.
Fixes: 090349a9fe ("ASoC: SOF: Add support for compress API for stream data/offset")
Cc: stable@vger.kernel.org
Reported-by: Curtis Malainey <cujomalainey@chromium.org >
Closes: https://github.com/thesofproject/linux/pull/5214
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com >
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com >
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com >
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com >
Reviewed-by: Curtis Malainey <cujomalainey@chromium.org >
Link: https://patch.msgid.link/20250205135232.19762-3-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org >
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2025-02-27 04:30:23 -08:00
Peter Ujfalusi
62ab1ae551
ASoC: SOF: stream-ipc: Check for cstream nullity in sof_ipc_msg_data()
...
commit d8d99c3b5c upstream.
The nullity of sps->cstream should be checked similarly as it is done in
sof_set_stream_data_offset() function.
Assuming that it is not NULL if sps->stream is NULL is incorrect and can
lead to NULL pointer dereference.
Fixes: 090349a9fe ("ASoC: SOF: Add support for compress API for stream data/offset")
Cc: stable@vger.kernel.org
Reported-by: Curtis Malainey <cujomalainey@chromium.org >
Closes: https://github.com/thesofproject/linux/pull/5214
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com >
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com >
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com >
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com >
Reviewed-by: Curtis Malainey <cujomalainey@chromium.org >
Link: https://patch.msgid.link/20250205135232.19762-2-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org >
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2025-02-27 04:30:22 -08:00
Peter Ujfalusi
87c8768a96
ASoC: SOF: ipc4-topology: Harden loops for looking up ALH copiers
...
[ Upstream commit 6fd60136d2 ]
Other, non DAI copier widgets could have the same stream name (sname) as
the ALH copier and in that case the copier->data is NULL, no alh_data is
attached, which could lead to NULL pointer dereference.
We could check for this NULL pointer in sof_ipc4_prepare_copier_module()
and avoid the crash, but a similar loop in sof_ipc4_widget_setup_comp_dai()
will miscalculate the ALH device count, causing broken audio.
The correct fix is to harden the matching logic by making sure that the
1. widget is a DAI widget - so dai = w->private is valid
2. the dai (and thus the copier) is ALH copier
Fixes: a150345aa7 ("ASoC: SOF: ipc4-topology: add SoundWire/ALH aggregation support")
Reported-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com >
Link: https://github.com/thesofproject/sof/pull/9652
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com >
Reviewed-by: Liam Girdwood <liam.r.girdwood@intel.com >
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com >
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com >
Link: https://patch.msgid.link/20250206084642.14988-1-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org >
Signed-off-by: Sasha Levin <sashal@kernel.org >
2025-02-27 04:30:16 -08:00
Bard Liao
e012a77e4d
ASoC: SOF: Intel: hda-dai: Ensure DAI widget is valid during params
...
[ Upstream commit 569922b82c ]
Each cpu DAI should associate with a widget. However, the topology might
not create the right number of DAI widgets for aggregated amps. And it
will cause NULL pointer deference.
Check that the DAI widget associated with the CPU DAI is valid to prevent
NULL pointer deference due to missing DAI widgets in topologies with
aggregated amps.
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com >
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com >
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com >
Reviewed-by: Liam Girdwood <liam.r.girdwood@intel.com >
Link: https://patch.msgid.link/20241203104853.56956-1-yung-chuan.liao@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org >
Signed-off-by: Sasha Levin <sashal@kernel.org >
2025-02-17 10:04:54 +01:00
Peter Ujfalusi
909ecf15cb
ASoC: SOF: Intel: hda-dai: Do not release the link DMA on STOP
...
commit e8d0ba147d upstream.
The linkDMA should not be released on stop trigger since a stream re-start
might happen without closing of the stream. This leaves a short time for
other streams to 'steal' the linkDMA since it has been released.
This issue is not easy to reproduce under normal conditions as usually
after stop the stream is closed, or the same stream is restarted, but if
another stream got in between the stop and start, like this:
aplay -Dhw:0,3 -c2 -r48000 -fS32_LE /dev/zero -d 120
CTRL+z
aplay -Dhw:0,0 -c2 -r48000 -fS32_LE /dev/zero -d 120
then the link DMA channels will be mixed up, resulting firmware error or
crash.
Fixes: ab5593793e ("ASoC: SOF: Intel: hda: Always clean up link DMA during stop")
Cc: stable@vger.kernel.org
Closes: https://github.com/thesofproject/sof/issues/9695
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com >
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com >
Reviewed-by: Liam Girdwood <liam.r.girdwood@intel.com >
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com >
Link: https://patch.msgid.link/20241217091019.31798-1-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org >
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2025-01-02 10:34:14 +01:00
Dan Carpenter
036d4d0d11
ASoC: SOF: ipc3-topology: fix resource leaks in sof_ipc3_widget_setup_comp_dai()
...
[ Upstream commit 6d544ea21d ]
These error paths should free comp_dai before returning.
Fixes: 909dadf21a ("ASoC: SOF: topology: Make DAI widget parsing IPC agnostic")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org >
Link: https://patch.msgid.link/67d185cf-d139-4f8c-970a-dbf0542246a8@stanley.mountain
Signed-off-by: Mark Brown <broonie@kernel.org >
Signed-off-by: Sasha Levin <sashal@kernel.org >
2024-12-14 20:03:15 +01:00
Bard Liao
eee02810ce
ASoC: SOF: ipc3-topology: Convert the topology pin index to ALH dai index
...
[ Upstream commit e9db1b5517 ]
Intel SoundWire machine driver always uses Pin number 2 and above.
Currently, the pin number is used as the FW DAI index directly. As a
result, FW DAI 0 and 1 are never used. That worked fine because we use
up to 2 DAIs in a SDW link. Convert the topology pin index to ALH dai
index, the mapping is using 2-off indexing, iow, pin #2 is ALH dai #0 .
The issue exists since beginning. And the Fixes tag is the first commit
that this commit can be applied.
Fixes: b66bfc3a98 ("ASoC: SOF: sof-audio: Fix broken early bclk feature for SSP")
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com >
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com >
Reviewed-by: Liam Girdwood <liam.r.girdwood@intel.com >
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com >
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com >
Link: https://patch.msgid.link/20241127092955.20026-1-yung-chuan.liao@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org >
Stable-dep-of: 6d544ea21d ("ASoC: SOF: ipc3-topology: fix resource leaks in sof_ipc3_widget_setup_comp_dai()")
Signed-off-by: Sasha Levin <sashal@kernel.org >
2024-12-14 20:03:15 +01:00
Jyri Sarha
48b86532c1
ASoC: SOF: sof-client-probes-ipc4: Set param_size extension bits
...
Write the size of the optional payload of SOF_IPC4_MOD_INIT_INSTANCE
message to extension param_size-bits.
The previous IPC4 version does not set these bits that should indicate
the size of the optional payload (struct sof_ipc4_probe_cfg). The old
firmware side component code works well without these bits, but when
the probes are converted to use the generic module API, this does not
work anymore.
Fixes: f562359306 ("ASoC: SOF: IPC4: probes: Implement IPC4 ops for probes client device")
Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com >
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com >
Reviewed-by: Liam Girdwood <liam.r.girdwood@intel.com >
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com >
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com >
Link: https://patch.msgid.link/20241107132840.17386-1-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org >
2024-11-07 15:35:52 +00:00
Venkata Prasad Potturu
94debe5eaa
ASoC: SOF: amd: Fix for incorrect DMA ch status register offset
...
DMA ch status register offset change in acp7.0 platform
Incorrect DMA channel status register offset check lead to
firmware boot failure.
[ 14.432497] snd_sof_amd_acp70 0000:c4:00.5: ------------[ DSP dump start ]------------
[ 14.432533] snd_sof_amd_acp70 0000:c4:00.5: Firmware boot failure due to timeout
[ 14.432549] snd_sof_amd_acp70 0000:c4:00.5: fw_state: SOF_FW_BOOT_IN_PROGRESS (3)
[ 14.432610] snd_sof_amd_acp70 0000:c4:00.5: invalid header size 0x71c41000. FW oops is bogus
[ 14.432626] snd_sof_amd_acp70 0000:c4:00.5: unexpected fault 0x71c40000 trace 0x71c40000
[ 14.432642] snd_sof_amd_acp70 0000:c4:00.5: ------------[ DSP dump end ]------------
[ 14.432657] snd_sof_amd_acp70 0000:c4:00.5: error: failed to boot DSP firmware -5
[ 14.432672] snd_sof_amd_acp70 0000:c4:00.5: fw_state change: 3 -> 4
[ 14.433260] dmic-codec dmic-codec: ASoC: Unregistered DAI 'dmic-hifi'
[ 14.433319] snd_sof_amd_acp70 0000:c4:00.5: fw_state change: 4 -> 0
[ 14.433358] snd_sof_amd_acp70 0000:c4:00.5: error: sof_probe_work failed err: -5
Update correct register offset for DMA ch status register.
Fixes: 490be7ba2a ("ASoC: SOF: amd: add support for acp7.0 based platform")
Signed-off-by: Venkata Prasad Potturu <venkataprasad.potturu@amd.com >
Link: https://patch.msgid.link/20241106142658.1240929-1-venkataprasad.potturu@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org >
2024-11-06 20:40:22 +00:00
Ranjani Sridharan
ab5593793e
ASoC: SOF: Intel: hda: Always clean up link DMA during stop
...
This is required to reset the DMA read/write pointers when the stream is
prepared and restarted after a call to snd_pcm_drain()/snd_pcm_drop().
Also, now that the stream is reset during stop, do not save LLP registers
in the case of STOP/suspend to avoid erroneous delay reporting.
Link: https://github.com/thesofproject/sof/issues/9502
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com >
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com >
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com >
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com >
All: stable@vger.kernel.org # 6.10.x 6.11.x
Link: https://patch.msgid.link/20241016032910.14601-5-yung-chuan.liao@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org >
2024-10-17 12:11:20 +01:00
Ranjani Sridharan
6e38a7e098
ASoC: SOF: Intel: hda: Handle prepare without close for non-HDA DAI's
...
When a PCM is restarted after a snd_pcm_drain/snd_pcm_drop(), the prepare
callback will be invoked and the hw_params will be set again. For the
HDA DAI's, the hw_params function handles this case already but not for
the non-HDA DAI's. So, add the check for link_prepared to verify if the
hw_params should be done again or not. Additionally, for SDW DAI's reset
the PCMSyCM registers as would be done in the case of a start after a
hw_free.
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com >
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com >
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com >
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com >
All: stable@vger.kernel.org # 6.10.x 6.11.x
Link: https://patch.msgid.link/20241016032910.14601-3-yung-chuan.liao@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org >
2024-10-17 12:11:18 +01:00
Ranjani Sridharan
9822b4c90d
ASoC: SOF: ipc4-topology: Do not set ALH node_id for aggregated DAIs
...
For aggregated DAIs, the node ID is set to the group_id during the DAI
widget's ipc_prepare op. With the current logic, setting the dai_index
for node_id in the dai_config is redundant as it will be overwritten
with the group_id anyway. Removing it will also prevent any accidental
clearing/resetting of the group_id for aggregated DAIs due to the
dai_config calls could that happen before the allocated group_id is
freed.
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com >
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com >
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com >
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com >
All: stable@vger.kernel.org # 6.10.x 6.11.x
Link: https://patch.msgid.link/20241016032910.14601-2-yung-chuan.liao@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org >
2024-10-17 12:11:17 +01:00
Kai Vehmanen
9814c1447f
ASoC: SOF: Intel: hda-loader: do not wait for HDaudio IOC
...
Commit 9ee3f0d8c9 ("ASOC: SOF: Intel: hda-loader: only wait for
HDaudio IOC for IPC4 devices") removed DMA wait for IPC3 case.
Proceed and remove the wait for IPC4 devices as well.
There is no dependency to IPC version in the load logic and
checking the firmware status is a sufficient check in case of
errors.
The removed code also had a bug in that -ETIMEDOUT is returned
without stopping the DMA transfer.
Cc: stable@vger.kernel.org
Link: https://github.com/thesofproject/linux/issues/5135
Fixes: 9ee3f0d8c9 ("ASOC: SOF: Intel: hda-loader: only wait for HDaudio IOC for IPC4 devices")
Suggested-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com >
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com >
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com >
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com >
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com >
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com >
Link: https://patch.msgid.link/20241008060710.15409-1-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org >
2024-10-08 10:49:14 +01:00
Venkata Prasad Potturu
494ddacd4a
ASoC: SOF: amd: Fix for ACP SRAM addr for acp7.0 platform
...
Incorrect SRAM base addr for acp7.0 platform results firmware boot
failure.
Add condition check to support SRAM addr for various platforms.
Fixes: 145d7e5ae8 ("ASoC: SOF: amd: add option to use sram for data bin loading")
Signed-off-by: Venkata Prasad Potturu <venkataprasad.potturu@amd.com >
Link: https://patch.msgid.link/20241008091347.594378-2-venkataprasad.potturu@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org >
2024-10-08 10:49:13 +01:00
Venkata Prasad Potturu
0a5c40393b
ASoC: SOF: amd: Add error log for DSP firmware validation failure
...
Add dev_err to print ACP_SHA_DSP_FW_QUALIFIER and ACP_SHA_PSP_ACK
register values for PSP firmware validation failure case.
Signed-off-by: Venkata Prasad Potturu <venkataprasad.potturu@amd.com >
Link: https://patch.msgid.link/20241008091347.594378-1-venkataprasad.potturu@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org >
2024-10-08 10:49:12 +01:00
Al Viro
5f60d5f6bb
move asm/unaligned.h to linux/unaligned.h
...
asm/unaligned.h is always an include of asm-generic/unaligned.h;
might as well move that thing to linux/unaligned.h and include
that - there's nothing arch-specific in that header.
auto-generated by the following:
for i in `git grep -l -w asm/unaligned.h`; do
sed -i -e "s/asm\/unaligned.h/linux\/unaligned.h/" $i
done
for i in `git grep -l -w asm-generic/unaligned.h`; do
sed -i -e "s/asm-generic\/unaligned.h/linux\/unaligned.h/" $i
done
git mv include/asm-generic/unaligned.h include/linux/unaligned.h
git mv tools/include/asm-generic/unaligned.h tools/include/linux/unaligned.h
sed -i -e "/unaligned.h/d" include/asm-generic/Kbuild
sed -i -e "s/__ASM_GENERIC/__LINUX/" include/linux/unaligned.h tools/include/linux/unaligned.h
2024-10-02 17:23:23 -04:00
Takashi Iwai
1a529af6f8
Merge tag 'asoc-v6.12' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-next
...
ASoC: Updates for v6.12
This is a very large set of changes, almost all in drivers rather than
the core. Even with the addition of several quite large drivers the
overall diffstat is negative thanks to the removal of some old Intel
board support which has been obsoleted by the AVS driver, helped a bit
by some factoring out into helpers (especially around the Soundwire
machine drivers for x86).
Highlights include:
- More simplifications and cleanups throughout the subsystem from
Morimoto-san.
- Extensive cleanups and refactoring of the Soundwire drivers to make
better use of helpers.
- Removal of Intel machine support obsoleted by the AVS driver.
- Lots of DT schema conversions.
- Machine support for many AMD and Intel x86 platforms.
- Support for AMD ACP 7.1, Mediatek MT6367 and MT8365, Realtek RTL1320
SoundWire and rev C, and Texas Instruments TAS2563
2024-09-14 09:09:59 +02:00
Brent Lu
dfa1a7f456
ASoC: SOF: Intel: hda: remove common_hdmi_codec_drv
...
Do not set common_hdmi_codec_drv in SOF platform driver since no
machine driver needs it. Remove member variable common_hdmi_codec_drv
from snd_soc_acpi_mach_params structure.
Signed-off-by: Brent Lu <brent.lu@intel.com >
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com >
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com >
Link: https://patch.msgid.link/20240912120308.134762-6-yung-chuan.liao@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org >
2024-09-12 13:31:49 +01:00