Repository navigation
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
The focused changes address stale runtime rates and incorrect ASRC structure access, with no unresolved findings.
No open issues 🎉
What changed in this PR
Fixes SOF IPC4 sample-rate selection so repeated prepares distinguish topology-defined rates from runtime-selected rates.
Changes:
- Track whether topology specifies the SRC or ASRC sink rate.
- Recalculate runtime rates on each prepare when topology leaves them unspecified.
- Access SRC and ASRC fields through their correct structure types.
| File | Description |
|---|---|
| sound/soc/sof/ipc4-topology.h | Adds and documents topology-rate flags for SRC and ASRC. |
| sound/soc/sof/ipc4-topology.c | Initializes the flags and uses type-correct access during rate selection. |
Review effort: Balanced
|
build fix: #5995 |
kv2019i
left a comment
There was a problem hiding this comment.
Review +1 and also:
Reviewed-by: Kai Vehmanen kai.vehmanen@linux.intel.com
Tested-by: Kai Vehmanen kai.vehmanen@linux.intel.com
46f77a7 to
631a6fe
Compare
|
Changes since v1:
|
631a6fe to
d1b1d7f
Compare
d1b1d7f to
65d72ab
Compare
The shared SRC/ASRC prepare callback gives a nonzero sink rate precedence over the rate requested by the capture stream. However, it also writes the selected output rate back to the same field. If topology does not specify a sink rate, subsequent prepares therefore treat the previous runtime rate as a fixed topology rate instead of following the current stream parameters. For example a capture stream opened at 16 kHz after one at 48 kHz on the same SRC keeps converting to 48 kHz. Record whether topology supplied a nonzero sink rate for SRC and ASRC, and only prioritize the stored rate in that case. Otherwise, select the rate at runtime on each prepare. Select the format, base configuration, rate and provenance flag through the appropriate SRC or ASRC type in the shared prepare callback. Their IPC payloads have different sizes, so accessing ASRC through an SRC pointer must not rely on matching member offsets. On 64-bit the two sizes happen to round up to the same offset for the following members, but on architectures with 4-byte pointer alignment available_fmt and msg are accessed at the wrong offset for ASRC. Reported-by: Kai Vehmanen <kai.vehmanen@linux.intel.com> Fixes: 3c3ce66 ("ASoC: SOF: ipc4-topology: Allow the use of multiple formats for src output") Cc: stable@vger.kernel.org Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com> Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com> Tested-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
|
Changes since v2:
|
|
@ujfalusi Can I help to get this merged? We still see fails in every daily test plan, would be curious to see whether there are other issue left once we have this merged... |
Yes please if you can... So far GH refuses any merge and any manual merge today for the kernel... |

The SRC prepare callback gives a nonzero sink rate precedence over the rate requested by the capture stream. However, it also writes the selected output rate back to the same field. If topology does not specify a sink rate, subsequent prepares therefore treat the previous runtime rate as a fixed topology rate instead of following the current stream parameters.
Record whether topology supplied a nonzero sink rate for SRC and ASRC, and only prioritize the stored rate in that case. Otherwise, select the rate at runtime on each prepare.
Select the format, base configuration, rate and provenance flag through the appropriate SRC or ASRC type in the shared prepare callback. Their IPC payloads have different sizes, so accessing ASRC through an SRC pointer must not rely on matching member offsets.
Fixes: 3c3ce66 ("ASoC: SOF: ipc4-topology: Allow the use of multiple formats for src output")
Cc: stable@vger.kernel.org