Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ASoC: qcom: sc7280: Fix missing Soundwire runtime stream alloc

Commit 15c7fab0e047 ("ASoC: qcom: Move Soundwire runtime stream alloc to
soundcards") moved the allocation of Soundwire stream runtime from the
Qualcomm Soundwire driver to each individual machine sound card driver,
except that it forgot to update SC7280 card.

Just like for other Qualcomm sound cards using Soundwire, the card
driver should allocate and release the runtime. Otherwise sound
playback will result in a NULL pointer dereference or other effect of
uninitialized memory accesses (which was confirmed on SDM845 having
similar issue).

Cc: stable@vger.kernel.org
Cc: Alexey Klimov <alexey.klimov@linaro.org>
Cc: Steev Klimaszewski <steev@kali.org>
Fixes: 15c7fab0e047 ("ASoC: qcom: Move Soundwire runtime stream alloc to soundcards")
Link: https://lore.kernel.org/r/20241010054109.16938-1-krzysztof.kozlowski@linaro.org
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://patch.msgid.link/20241012101108.129476-1-krzysztof.kozlowski@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Krzysztof Kozlowski and committed by
Mark Brown
db7e59e6 b9a8ecf8

+10 -1
+1
sound/soc/qcom/Kconfig
··· 209 209 tristate "SoC Machine driver for SC7280 boards" 210 210 depends on I2C && SOUNDWIRE 211 211 select SND_SOC_QCOM_COMMON 212 + select SND_SOC_QCOM_SDW 212 213 select SND_SOC_LPASS_SC7280 213 214 select SND_SOC_MAX98357A 214 215 select SND_SOC_WCD938X_SDW
+9 -1
sound/soc/qcom/sc7280.c
··· 23 23 #include "common.h" 24 24 #include "lpass.h" 25 25 #include "qdsp6/q6afe.h" 26 + #include "sdw.h" 26 27 27 28 #define DEFAULT_MCLK_RATE 19200000 28 29 #define RT5682_PLL_FREQ (48000 * 512) ··· 317 316 struct snd_soc_card *card = rtd->card; 318 317 struct sc7280_snd_data *data = snd_soc_card_get_drvdata(card); 319 318 struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0); 319 + struct sdw_stream_runtime *sruntime = data->sruntime[cpu_dai->id]; 320 320 321 321 switch (cpu_dai->id) { 322 322 case MI2S_PRIMARY: ··· 335 333 default: 336 334 break; 337 335 } 336 + 337 + data->sruntime[cpu_dai->id] = NULL; 338 + sdw_release_stream(sruntime); 338 339 } 339 340 340 341 static int sc7280_snd_startup(struct snd_pcm_substream *substream) ··· 352 347 switch (cpu_dai->id) { 353 348 case MI2S_PRIMARY: 354 349 ret = sc7280_rt5682_init(rtd); 350 + if (ret) 351 + return ret; 355 352 break; 356 353 case SECONDARY_MI2S_RX: 357 354 codec_dai_fmt |= SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_I2S; ··· 367 360 default: 368 361 break; 369 362 } 370 - return ret; 363 + 364 + return qcom_snd_sdw_startup(substream); 371 365 } 372 366 373 367 static const struct snd_soc_ops sc7280_ops = {