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

Merge tag 'asoc-fix-v5.5-rc5' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus

ASoC: Fixes for v5.5

More fixes that have been collected, nothing super remarkable here - the
few core fixes are mainly error handling related as are many of the
driver fixes.

+61 -28
+8 -1
sound/soc/fsl/fsl_audmix.c
··· 505 505 ARRAY_SIZE(fsl_audmix_dai)); 506 506 if (ret) { 507 507 dev_err(dev, "failed to register ASoC DAI\n"); 508 - return ret; 508 + goto err_disable_pm; 509 509 } 510 510 511 511 priv->pdev = platform_device_register_data(dev, mdrv, 0, NULL, 0); 512 512 if (IS_ERR(priv->pdev)) { 513 513 ret = PTR_ERR(priv->pdev); 514 514 dev_err(dev, "failed to register platform %s: %d\n", mdrv, ret); 515 + goto err_disable_pm; 515 516 } 516 517 518 + return 0; 519 + 520 + err_disable_pm: 521 + pm_runtime_disable(dev); 517 522 return ret; 518 523 } 519 524 520 525 static int fsl_audmix_remove(struct platform_device *pdev) 521 526 { 522 527 struct fsl_audmix *priv = dev_get_drvdata(&pdev->dev); 528 + 529 + pm_runtime_disable(&pdev->dev); 523 530 524 531 if (priv->pdev) 525 532 platform_device_unregister(priv->pdev);
-1
sound/soc/intel/boards/cml_rt1011_rt5682.c
··· 11 11 #include <linux/clk.h> 12 12 #include <linux/dmi.h> 13 13 #include <linux/slab.h> 14 - #include <asm/cpu_device_id.h> 15 14 #include <linux/acpi.h> 16 15 #include <sound/core.h> 17 16 #include <sound/jack.h>
+8 -6
sound/soc/soc-core.c
··· 479 479 goto free_rtd; 480 480 481 481 rtd->dev = dev; 482 + INIT_LIST_HEAD(&rtd->list); 483 + INIT_LIST_HEAD(&rtd->component_list); 484 + INIT_LIST_HEAD(&rtd->dpcm[SNDRV_PCM_STREAM_PLAYBACK].be_clients); 485 + INIT_LIST_HEAD(&rtd->dpcm[SNDRV_PCM_STREAM_CAPTURE].be_clients); 486 + INIT_LIST_HEAD(&rtd->dpcm[SNDRV_PCM_STREAM_PLAYBACK].fe_clients); 487 + INIT_LIST_HEAD(&rtd->dpcm[SNDRV_PCM_STREAM_CAPTURE].fe_clients); 482 488 dev_set_drvdata(dev, rtd); 483 489 INIT_DELAYED_WORK(&rtd->delayed_work, close_delayed_work); 484 490 ··· 500 494 /* 501 495 * rtd remaining settings 502 496 */ 503 - INIT_LIST_HEAD(&rtd->component_list); 504 - INIT_LIST_HEAD(&rtd->dpcm[SNDRV_PCM_STREAM_PLAYBACK].be_clients); 505 - INIT_LIST_HEAD(&rtd->dpcm[SNDRV_PCM_STREAM_CAPTURE].be_clients); 506 - INIT_LIST_HEAD(&rtd->dpcm[SNDRV_PCM_STREAM_PLAYBACK].fe_clients); 507 - INIT_LIST_HEAD(&rtd->dpcm[SNDRV_PCM_STREAM_CAPTURE].fe_clients); 508 - 509 497 rtd->card = card; 510 498 rtd->dai_link = dai_link; 511 499 if (!rtd->dai_link->ops) ··· 1871 1871 1872 1872 /* convert non BE into BE */ 1873 1873 dai_link->no_pcm = 1; 1874 + dai_link->dpcm_playback = 1; 1875 + dai_link->dpcm_capture = 1; 1874 1876 1875 1877 /* override any BE fixups */ 1876 1878 dai_link->be_hw_params_fixup =
+3 -3
sound/soc/soc-topology.c
··· 548 548 if (dobj->ops && dobj->ops->link_unload) 549 549 dobj->ops->link_unload(comp, dobj); 550 550 551 + list_del(&dobj->list); 552 + snd_soc_remove_dai_link(comp->card, link); 553 + 551 554 kfree(link->name); 552 555 kfree(link->stream_name); 553 556 kfree(link->cpus->dai_name); 554 - 555 - list_del(&dobj->list); 556 - snd_soc_remove_dai_link(comp->card, link); 557 557 kfree(link); 558 558 } 559 559
+4 -1
sound/soc/sof/imx/imx8.c
··· 209 209 210 210 priv->pd_dev = devm_kmalloc_array(&pdev->dev, priv->num_domains, 211 211 sizeof(*priv->pd_dev), GFP_KERNEL); 212 - if (!priv) 212 + if (!priv->pd_dev) 213 213 return -ENOMEM; 214 214 215 215 priv->link = devm_kmalloc_array(&pdev->dev, priv->num_domains, ··· 303 303 goto exit_pdev_unregister; 304 304 } 305 305 sdev->mailbox_bar = SOF_FW_BLK_TYPE_SRAM; 306 + 307 + /* set default mailbox offset for FW ready message */ 308 + sdev->dsp_box.offset = MBOX_OFFSET; 306 309 307 310 return 0; 308 311
+9 -2
sound/soc/sof/intel/hda-dai.c
··· 216 216 link_dev = hda_link_stream_assign(bus, substream); 217 217 if (!link_dev) 218 218 return -EBUSY; 219 + 220 + snd_soc_dai_set_dma_data(dai, substream, (void *)link_dev); 219 221 } 220 222 221 223 stream_tag = hdac_stream(link_dev)->stream_tag; ··· 229 227 substream->stream); 230 228 if (ret < 0) 231 229 return ret; 232 - 233 - snd_soc_dai_set_dma_data(dai, substream, (void *)link_dev); 234 230 235 231 link = snd_hdac_ext_bus_get_link(bus, codec_dai->component->name); 236 232 if (!link) ··· 361 361 bus = hstream->bus; 362 362 rtd = snd_pcm_substream_chip(substream); 363 363 link_dev = snd_soc_dai_get_dma_data(dai, substream); 364 + 365 + if (!link_dev) { 366 + dev_dbg(dai->dev, 367 + "%s: link_dev is not assigned\n", __func__); 368 + return -EINVAL; 369 + } 370 + 364 371 hda_stream = hstream_to_sof_hda_stream(link_dev); 365 372 366 373 /* free the link DMA channel in the FW */
+3
sound/soc/sof/ipc.c
··· 826 826 { 827 827 struct snd_sof_ipc *ipc = sdev->ipc; 828 828 829 + if (!ipc) 830 + return; 831 + 829 832 /* disable sending of ipc's */ 830 833 mutex_lock(&ipc->tx_mutex); 831 834 ipc->disable_ipc_tx = true;
+26 -14
sound/soc/stm/stm32_spdifrx.c
··· 12 12 #include <linux/delay.h> 13 13 #include <linux/module.h> 14 14 #include <linux/of_platform.h> 15 - #include <linux/pinctrl/consumer.h> 16 15 #include <linux/regmap.h> 17 16 #include <linux/reset.h> 18 17 ··· 219 220 * @slave_config: dma slave channel runtime config pointer 220 221 * @phys_addr: SPDIFRX registers physical base address 221 222 * @lock: synchronization enabling lock 223 + * @irq_lock: prevent race condition with IRQ on stream state 222 224 * @cs: channel status buffer 223 225 * @ub: user data buffer 224 226 * @irq: SPDIFRX interrupt line ··· 240 240 struct dma_slave_config slave_config; 241 241 dma_addr_t phys_addr; 242 242 spinlock_t lock; /* Sync enabling lock */ 243 + spinlock_t irq_lock; /* Prevent race condition on stream state */ 243 244 unsigned char cs[SPDIFRX_CS_BYTES_NB]; 244 245 unsigned char ub[SPDIFRX_UB_BYTES_NB]; 245 246 int irq; ··· 321 320 static int stm32_spdifrx_start_sync(struct stm32_spdifrx_data *spdifrx) 322 321 { 323 322 int cr, cr_mask, imr, ret; 323 + unsigned long flags; 324 324 325 325 /* Enable IRQs */ 326 326 imr = SPDIFRX_IMR_IFEIE | SPDIFRX_IMR_SYNCDIE | SPDIFRX_IMR_PERRIE; ··· 329 327 if (ret) 330 328 return ret; 331 329 332 - spin_lock(&spdifrx->lock); 330 + spin_lock_irqsave(&spdifrx->lock, flags); 333 331 334 332 spdifrx->refcount++; 335 333 ··· 364 362 "Failed to start synchronization\n"); 365 363 } 366 364 367 - spin_unlock(&spdifrx->lock); 365 + spin_unlock_irqrestore(&spdifrx->lock, flags); 368 366 369 367 return ret; 370 368 } ··· 372 370 static void stm32_spdifrx_stop(struct stm32_spdifrx_data *spdifrx) 373 371 { 374 372 int cr, cr_mask, reg; 373 + unsigned long flags; 375 374 376 - spin_lock(&spdifrx->lock); 375 + spin_lock_irqsave(&spdifrx->lock, flags); 377 376 378 377 if (--spdifrx->refcount) { 379 - spin_unlock(&spdifrx->lock); 378 + spin_unlock_irqrestore(&spdifrx->lock, flags); 380 379 return; 381 380 } 382 381 ··· 396 393 regmap_read(spdifrx->regmap, STM32_SPDIFRX_DR, &reg); 397 394 regmap_read(spdifrx->regmap, STM32_SPDIFRX_CSR, &reg); 398 395 399 - spin_unlock(&spdifrx->lock); 396 + spin_unlock_irqrestore(&spdifrx->lock, flags); 400 397 } 401 398 402 399 static int stm32_spdifrx_dma_ctrl_register(struct device *dev, ··· 483 480 memset(spdifrx->cs, 0, SPDIFRX_CS_BYTES_NB); 484 481 memset(spdifrx->ub, 0, SPDIFRX_UB_BYTES_NB); 485 482 486 - pinctrl_pm_select_default_state(&spdifrx->pdev->dev); 487 - 488 483 ret = stm32_spdifrx_dma_ctrl_start(spdifrx); 489 484 if (ret < 0) 490 485 return ret; ··· 514 513 515 514 end: 516 515 clk_disable_unprepare(spdifrx->kclk); 517 - pinctrl_pm_select_sleep_state(&spdifrx->pdev->dev); 518 516 519 517 return ret; 520 518 } ··· 665 665 static irqreturn_t stm32_spdifrx_isr(int irq, void *devid) 666 666 { 667 667 struct stm32_spdifrx_data *spdifrx = (struct stm32_spdifrx_data *)devid; 668 - struct snd_pcm_substream *substream = spdifrx->substream; 669 668 struct platform_device *pdev = spdifrx->pdev; 670 669 unsigned int cr, mask, sr, imr; 671 670 unsigned int flags, sync_state; ··· 744 745 return IRQ_HANDLED; 745 746 } 746 747 747 - if (substream) 748 - snd_pcm_stop(substream, SNDRV_PCM_STATE_DISCONNECTED); 748 + spin_lock(&spdifrx->irq_lock); 749 + if (spdifrx->substream) 750 + snd_pcm_stop(spdifrx->substream, 751 + SNDRV_PCM_STATE_DISCONNECTED); 752 + spin_unlock(&spdifrx->irq_lock); 749 753 750 754 return IRQ_HANDLED; 751 755 } 752 756 753 - if (err_xrun && substream) 754 - snd_pcm_stop_xrun(substream); 757 + spin_lock(&spdifrx->irq_lock); 758 + if (err_xrun && spdifrx->substream) 759 + snd_pcm_stop_xrun(spdifrx->substream); 760 + spin_unlock(&spdifrx->irq_lock); 755 761 756 762 return IRQ_HANDLED; 757 763 } ··· 765 761 struct snd_soc_dai *cpu_dai) 766 762 { 767 763 struct stm32_spdifrx_data *spdifrx = snd_soc_dai_get_drvdata(cpu_dai); 764 + unsigned long flags; 768 765 int ret; 769 766 767 + spin_lock_irqsave(&spdifrx->irq_lock, flags); 770 768 spdifrx->substream = substream; 769 + spin_unlock_irqrestore(&spdifrx->irq_lock, flags); 771 770 772 771 ret = clk_prepare_enable(spdifrx->kclk); 773 772 if (ret) ··· 846 839 struct snd_soc_dai *cpu_dai) 847 840 { 848 841 struct stm32_spdifrx_data *spdifrx = snd_soc_dai_get_drvdata(cpu_dai); 842 + unsigned long flags; 849 843 844 + spin_lock_irqsave(&spdifrx->irq_lock, flags); 850 845 spdifrx->substream = NULL; 846 + spin_unlock_irqrestore(&spdifrx->irq_lock, flags); 847 + 851 848 clk_disable_unprepare(spdifrx->kclk); 852 849 } 853 850 ··· 955 944 spdifrx->pdev = pdev; 956 945 init_completion(&spdifrx->cs_completion); 957 946 spin_lock_init(&spdifrx->lock); 947 + spin_lock_init(&spdifrx->irq_lock); 958 948 959 949 platform_set_drvdata(pdev, spdifrx); 960 950