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

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

ASoC: Fixes for v5.8

This is a collection of mostly small fixes, mostly fixing fallout from
some of the DPCM changes that went in last time around which shook out
some issues on i.MX and Qualcomm platforms. The addition of a managed
version of snd_soc_register_dai() is to fix resource leaks.

There's also a few new device IDs for x86 systems.

+295 -151
+11
include/sound/dmaengine_pcm.h
··· 161 161 162 162 #define SND_DMAENGINE_PCM_DRV_NAME "snd_dmaengine_pcm" 163 163 164 + struct dmaengine_pcm { 165 + struct dma_chan *chan[SNDRV_PCM_STREAM_LAST + 1]; 166 + const struct snd_dmaengine_pcm_config *config; 167 + struct snd_soc_component component; 168 + unsigned int flags; 169 + }; 170 + 171 + static inline struct dmaengine_pcm *soc_component_to_pcm(struct snd_soc_component *p) 172 + { 173 + return container_of(p, struct dmaengine_pcm, component); 174 + } 164 175 #endif
+6
include/sound/soc.h
··· 444 444 const struct snd_soc_component_driver *component_driver, 445 445 struct snd_soc_dai_driver *dai_drv, int num_dai); 446 446 void snd_soc_unregister_component(struct device *dev); 447 + struct snd_soc_component *snd_soc_lookup_component_nolocked(struct device *dev, 448 + const char *driver_name); 447 449 struct snd_soc_component *snd_soc_lookup_component(struct device *dev, 448 450 const char *driver_name); 449 451 ··· 1363 1361 struct snd_soc_dai *snd_soc_register_dai(struct snd_soc_component *component, 1364 1362 struct snd_soc_dai_driver *dai_drv, 1365 1363 bool legacy_dai_naming); 1364 + struct snd_soc_dai *devm_snd_soc_register_dai(struct device *dev, 1365 + struct snd_soc_component *component, 1366 + struct snd_soc_dai_driver *dai_drv, 1367 + bool legacy_dai_naming); 1366 1368 void snd_soc_unregister_dai(struct snd_soc_dai *dai); 1367 1369 1368 1370 struct snd_soc_dai *snd_soc_find_dai(
+1 -3
sound/hda/intel-dsp-config.c
··· 208 208 }, 209 209 #endif 210 210 211 + #if IS_ENABLED(CONFIG_SND_SOC_SOF_COMETLAKE) 211 212 /* Cometlake-LP */ 212 - #if IS_ENABLED(CONFIG_SND_SOC_SOF_COMETLAKE_LP) 213 213 { 214 214 .flags = FLAG_SOF, 215 215 .device = 0x02c8, ··· 240 240 .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE, 241 241 .device = 0x02c8, 242 242 }, 243 - #endif 244 243 /* Cometlake-H */ 245 - #if IS_ENABLED(CONFIG_SND_SOC_SOF_COMETLAKE_H) 246 244 { 247 245 .flags = FLAG_SOF, 248 246 .device = 0x06c8,
+23 -7
sound/soc/amd/raven/acp3x-pcm-dma.c
··· 342 342 { 343 343 struct snd_soc_pcm_runtime *prtd; 344 344 struct i2s_dev_data *adata; 345 + struct i2s_stream_instance *ins; 345 346 346 347 prtd = substream->private_data; 347 348 component = snd_soc_rtdcom_lookup(prtd, DRV_NAME); 348 349 adata = dev_get_drvdata(component->dev); 350 + ins = substream->runtime->private_data; 351 + if (!ins) 352 + return -EINVAL; 349 353 354 + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { 355 + switch (ins->i2s_instance) { 356 + case I2S_BT_INSTANCE: 357 + adata->play_stream = NULL; 358 + break; 359 + case I2S_SP_INSTANCE: 360 + default: 361 + adata->i2ssp_play_stream = NULL; 362 + } 363 + } else { 364 + switch (ins->i2s_instance) { 365 + case I2S_BT_INSTANCE: 366 + adata->capture_stream = NULL; 367 + break; 368 + case I2S_SP_INSTANCE: 369 + default: 370 + adata->i2ssp_capture_stream = NULL; 371 + } 372 + } 350 373 351 374 /* Disable ACP irq, when the current stream is being closed and 352 375 * another stream is also not active. ··· 377 354 if (!adata->play_stream && !adata->capture_stream && 378 355 !adata->i2ssp_play_stream && !adata->i2ssp_capture_stream) 379 356 rv_writel(0, adata->acp3x_base + mmACP_EXTERNAL_INTR_ENB); 380 - if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { 381 - adata->play_stream = NULL; 382 - adata->i2ssp_play_stream = NULL; 383 - } else { 384 - adata->capture_stream = NULL; 385 - adata->i2ssp_capture_stream = NULL; 386 - } 387 357 return 0; 388 358 } 389 359
+10 -6
sound/soc/codecs/hdac_hda.c
··· 441 441 ret = snd_hda_codec_set_name(hcodec, hcodec->preset->name); 442 442 if (ret < 0) { 443 443 dev_err(&hdev->dev, "name failed %s\n", hcodec->preset->name); 444 - goto error; 444 + goto error_pm; 445 445 } 446 446 447 447 ret = snd_hdac_regmap_init(&hcodec->core); 448 448 if (ret < 0) { 449 449 dev_err(&hdev->dev, "regmap init failed\n"); 450 - goto error; 450 + goto error_pm; 451 451 } 452 452 453 453 patch = (hda_codec_patch_t)hcodec->preset->driver_data; ··· 455 455 ret = patch(hcodec); 456 456 if (ret < 0) { 457 457 dev_err(&hdev->dev, "patch failed %d\n", ret); 458 - goto error; 458 + goto error_regmap; 459 459 } 460 460 } else { 461 461 dev_dbg(&hdev->dev, "no patch file found\n"); ··· 467 467 ret = snd_hda_codec_parse_pcms(hcodec); 468 468 if (ret < 0) { 469 469 dev_err(&hdev->dev, "unable to map pcms to dai %d\n", ret); 470 - goto error; 470 + goto error_regmap; 471 471 } 472 472 473 473 /* HDMI controls need to be created in machine drivers */ ··· 476 476 if (ret < 0) { 477 477 dev_err(&hdev->dev, "unable to create controls %d\n", 478 478 ret); 479 - goto error; 479 + goto error_regmap; 480 480 } 481 481 } 482 482 ··· 496 496 497 497 return 0; 498 498 499 - error: 499 + error_regmap: 500 + snd_hdac_regmap_exit(hdev); 501 + error_pm: 500 502 pm_runtime_put(&hdev->dev); 501 503 error_no_pm: 502 504 snd_hdac_ext_bus_link_put(hdev->bus, hlink); ··· 520 518 521 519 pm_runtime_disable(&hdev->dev); 522 520 snd_hdac_ext_bus_link_put(hdev->bus, hlink); 521 + 522 + snd_hdac_regmap_exit(hdev); 523 523 } 524 524 525 525 static const struct snd_soc_dapm_route hdac_hda_dapm_routes[] = {
+3 -3
sound/soc/codecs/max98390.c
··· 700 700 case MAX98390_IRQ_CTRL ... MAX98390_WDOG_CTRL: 701 701 case MAX98390_MEAS_ADC_THERM_WARN_THRESH 702 702 ... MAX98390_BROWNOUT_INFINITE_HOLD: 703 - case MAX98390_BROWNOUT_LVL_HOLD ... THERMAL_COILTEMP_RD_BACK_BYTE0: 704 - case DSMIG_DEBUZZER_THRESHOLD ... MAX98390_R24FF_REV_ID: 703 + case MAX98390_BROWNOUT_LVL_HOLD ... DSMIG_DEBUZZER_THRESHOLD: 704 + case DSM_VOL_ENA ... MAX98390_R24FF_REV_ID: 705 705 return true; 706 706 default: 707 707 return false; ··· 717 717 case MAX98390_BROWNOUT_LOWEST_STATUS: 718 718 case MAX98390_ENV_TRACK_BOOST_VOUT_READ: 719 719 case DSM_STBASS_HPF_B0_BYTE0 ... DSM_DEBUZZER_ATTACK_TIME_BYTE2: 720 - case THERMAL_RDC_RD_BACK_BYTE1 ... THERMAL_COILTEMP_RD_BACK_BYTE0: 720 + case THERMAL_RDC_RD_BACK_BYTE1 ... DSMIG_DEBUZZER_THRESHOLD: 721 721 case DSM_THERMAL_GAIN ... DSM_WBDRC_GAIN: 722 722 return true; 723 723 default:
+75 -49
sound/soc/codecs/rt1015.c
··· 34 34 { 0x0000, 0x0000 }, 35 35 { 0x0004, 0xa000 }, 36 36 { 0x0006, 0x0003 }, 37 - { 0x000a, 0x0802 }, 38 - { 0x000c, 0x0020 }, 37 + { 0x000a, 0x081e }, 38 + { 0x000c, 0x0006 }, 39 39 { 0x000e, 0x0000 }, 40 40 { 0x0010, 0x0000 }, 41 41 { 0x0012, 0x0000 }, 42 + { 0x0014, 0x0000 }, 43 + { 0x0016, 0x0000 }, 44 + { 0x0018, 0x0000 }, 42 45 { 0x0020, 0x8000 }, 43 - { 0x0022, 0x471b }, 44 - { 0x006a, 0x0000 }, 45 - { 0x006c, 0x4020 }, 46 + { 0x0022, 0x8043 }, 46 47 { 0x0076, 0x0000 }, 47 48 { 0x0078, 0x0000 }, 48 - { 0x007a, 0x0000 }, 49 + { 0x007a, 0x0002 }, 49 50 { 0x007c, 0x10ec }, 50 51 { 0x007d, 0x1015 }, 51 52 { 0x00f0, 0x5000 }, 52 - { 0x00f2, 0x0774 }, 53 - { 0x00f3, 0x8400 }, 53 + { 0x00f2, 0x004c }, 54 + { 0x00f3, 0xecfe }, 54 55 { 0x00f4, 0x0000 }, 56 + { 0x00f6, 0x0400 }, 55 57 { 0x0100, 0x0028 }, 56 58 { 0x0102, 0xff02 }, 57 - { 0x0104, 0x8232 }, 59 + { 0x0104, 0xa213 }, 58 60 { 0x0106, 0x200c }, 59 - { 0x010c, 0x002f }, 60 - { 0x010e, 0xc000 }, 61 + { 0x010c, 0x0000 }, 62 + { 0x010e, 0x0058 }, 61 63 { 0x0111, 0x0200 }, 62 64 { 0x0112, 0x0400 }, 63 65 { 0x0114, 0x0022 }, ··· 67 65 { 0x0118, 0x0000 }, 68 66 { 0x011a, 0x0123 }, 69 67 { 0x011c, 0x4567 }, 70 - { 0x0300, 0xdddd }, 71 - { 0x0302, 0x0000 }, 72 - { 0x0311, 0x9330 }, 73 - { 0x0313, 0x0000 }, 74 - { 0x0314, 0x0000 }, 68 + { 0x0300, 0x203d }, 69 + { 0x0302, 0x001e }, 70 + { 0x0311, 0x0000 }, 71 + { 0x0313, 0x6014 }, 72 + { 0x0314, 0x00a2 }, 75 73 { 0x031a, 0x00a0 }, 76 74 { 0x031c, 0x001f }, 77 75 { 0x031d, 0xffff }, 78 76 { 0x031e, 0x0000 }, 79 77 { 0x031f, 0x0000 }, 78 + { 0x0320, 0x0000 }, 80 79 { 0x0321, 0x0000 }, 81 - { 0x0322, 0x0000 }, 82 - { 0x0328, 0x0000 }, 83 - { 0x0329, 0x0000 }, 84 - { 0x032a, 0x0000 }, 85 - { 0x032b, 0x0000 }, 86 - { 0x032c, 0x0000 }, 87 - { 0x032d, 0x0000 }, 88 - { 0x032e, 0x030e }, 89 - { 0x0330, 0x0080 }, 80 + { 0x0322, 0xd7df }, 81 + { 0x0328, 0x10b2 }, 82 + { 0x0329, 0x0175 }, 83 + { 0x032a, 0x36ad }, 84 + { 0x032b, 0x7e55 }, 85 + { 0x032c, 0x0520 }, 86 + { 0x032d, 0xaa00 }, 87 + { 0x032e, 0x570e }, 88 + { 0x0330, 0xe180 }, 90 89 { 0x0332, 0x0034 }, 91 - { 0x0334, 0x0000 }, 92 - { 0x0336, 0x0000 }, 90 + { 0x0334, 0x0001 }, 91 + { 0x0336, 0x0010 }, 92 + { 0x0338, 0x0000 }, 93 + { 0x04fa, 0x0030 }, 94 + { 0x04fc, 0x35c8 }, 95 + { 0x04fe, 0x0800 }, 96 + { 0x0500, 0x0400 }, 97 + { 0x0502, 0x1000 }, 98 + { 0x0504, 0x0000 }, 93 99 { 0x0506, 0x04ff }, 94 - { 0x0508, 0x0030 }, 95 - { 0x050a, 0x0018 }, 96 - { 0x0519, 0x307f }, 97 - { 0x051a, 0xffff }, 98 - { 0x051b, 0x4000 }, 100 + { 0x0508, 0x0010 }, 101 + { 0x050a, 0x001a }, 102 + { 0x0519, 0x1c68 }, 103 + { 0x051a, 0x0ccc }, 104 + { 0x051b, 0x0666 }, 99 105 { 0x051d, 0x0000 }, 100 106 { 0x051f, 0x0000 }, 101 - { 0x0536, 0x1000 }, 107 + { 0x0536, 0x061c }, 102 108 { 0x0538, 0x0000 }, 103 109 { 0x053a, 0x0000 }, 104 110 { 0x053c, 0x0000 }, ··· 120 110 { 0x0544, 0x0000 }, 121 111 { 0x0568, 0x0000 }, 122 112 { 0x056a, 0x0000 }, 123 - { 0x1000, 0x0000 }, 124 - { 0x1002, 0x6505 }, 113 + { 0x1000, 0x0040 }, 114 + { 0x1002, 0x5405 }, 125 115 { 0x1006, 0x5515 }, 126 - { 0x1007, 0x003f }, 127 - { 0x1009, 0x770f }, 128 - { 0x100a, 0x01ff }, 129 - { 0x100c, 0x0000 }, 116 + { 0x1007, 0x05f7 }, 117 + { 0x1009, 0x0b0a }, 118 + { 0x100a, 0x00ef }, 130 119 { 0x100d, 0x0003 }, 131 120 { 0x1010, 0xa433 }, 132 121 { 0x1020, 0x0000 }, 133 - { 0x1200, 0x3d02 }, 134 - { 0x1202, 0x0813 }, 135 - { 0x1204, 0x0211 }, 122 + { 0x1200, 0x5a01 }, 123 + { 0x1202, 0x6524 }, 124 + { 0x1204, 0x1f00 }, 136 125 { 0x1206, 0x0000 }, 137 126 { 0x1208, 0x0000 }, 138 127 { 0x120a, 0x0000 }, ··· 139 130 { 0x120e, 0x0000 }, 140 131 { 0x1210, 0x0000 }, 141 132 { 0x1212, 0x0000 }, 142 - { 0x1300, 0x0701 }, 143 - { 0x1302, 0x12f9 }, 144 - { 0x1304, 0x3405 }, 133 + { 0x1300, 0x10a1 }, 134 + { 0x1302, 0x12ff }, 135 + { 0x1304, 0x0400 }, 145 136 { 0x1305, 0x0844 }, 146 - { 0x1306, 0x1611 }, 137 + { 0x1306, 0x4611 }, 147 138 { 0x1308, 0x555e }, 148 139 { 0x130a, 0x0000 }, 149 - { 0x130c, 0x2400}, 150 - { 0x130e, 0x7700 }, 151 - { 0x130f, 0x0000 }, 140 + { 0x130c, 0x2000 }, 141 + { 0x130e, 0x0100 }, 142 + { 0x130f, 0x0001 }, 152 143 { 0x1310, 0x0000 }, 153 144 { 0x1312, 0x0000 }, 154 145 { 0x1314, 0x0000 }, ··· 218 209 case RT1015_DC_CALIB_CLSD7: 219 210 case RT1015_DC_CALIB_CLSD8: 220 211 case RT1015_S_BST_TIMING_INTER1: 212 + case RT1015_OSCK_STA: 213 + case RT1015_MONO_DYNA_CTRL1: 214 + case RT1015_MONO_DYNA_CTRL5: 221 215 return true; 222 216 223 217 default: ··· 236 224 case RT1015_CLK3: 237 225 case RT1015_PLL1: 238 226 case RT1015_PLL2: 227 + case RT1015_DUM_RW1: 228 + case RT1015_DUM_RW2: 229 + case RT1015_DUM_RW3: 230 + case RT1015_DUM_RW4: 231 + case RT1015_DUM_RW5: 232 + case RT1015_DUM_RW6: 239 233 case RT1015_CLK_DET: 240 234 case RT1015_SIL_DET: 241 235 case RT1015_CUSTOMER_ID: ··· 253 235 case RT1015_PAD_DRV2: 254 236 case RT1015_GAT_BOOST: 255 237 case RT1015_PRO_ALT: 238 + case RT1015_OSCK_STA: 256 239 case RT1015_MAN_I2C: 257 240 case RT1015_DAC1: 258 241 case RT1015_DAC2: ··· 291 272 case RT1015_SMART_BST_CTRL2: 292 273 case RT1015_ANA_CTRL1: 293 274 case RT1015_ANA_CTRL2: 275 + case RT1015_PWR_STATE_CTRL: 276 + case RT1015_MONO_DYNA_CTRL: 277 + case RT1015_MONO_DYNA_CTRL1: 278 + case RT1015_MONO_DYNA_CTRL2: 279 + case RT1015_MONO_DYNA_CTRL3: 280 + case RT1015_MONO_DYNA_CTRL4: 281 + case RT1015_MONO_DYNA_CTRL5: 294 282 case RT1015_SPK_VOL: 295 283 case RT1015_SHORT_DETTOP1: 296 284 case RT1015_SHORT_DETTOP2:
+14 -1
sound/soc/codecs/rt1015.h
··· 21 21 #define RT1015_CLK3 0x0006 22 22 #define RT1015_PLL1 0x000a 23 23 #define RT1015_PLL2 0x000c 24 + #define RT1015_DUM_RW1 0x000e 25 + #define RT1015_DUM_RW2 0x0010 26 + #define RT1015_DUM_RW3 0x0012 27 + #define RT1015_DUM_RW4 0x0014 28 + #define RT1015_DUM_RW5 0x0016 29 + #define RT1015_DUM_RW6 0x0018 24 30 #define RT1015_CLK_DET 0x0020 25 31 #define RT1015_SIL_DET 0x0022 26 32 #define RT1015_CUSTOMER_ID 0x0076 ··· 38 32 #define RT1015_PAD_DRV2 0x00f2 39 33 #define RT1015_GAT_BOOST 0x00f3 40 34 #define RT1015_PRO_ALT 0x00f4 35 + #define RT1015_OSCK_STA 0x00f6 41 36 #define RT1015_MAN_I2C 0x0100 42 37 #define RT1015_DAC1 0x0102 43 38 #define RT1015_DAC2 0x0104 ··· 77 70 #define RT1015_ANA_CTRL1 0x0334 78 71 #define RT1015_ANA_CTRL2 0x0336 79 72 #define RT1015_PWR_STATE_CTRL 0x0338 80 - #define RT1015_SPK_VOL 0x0506 73 + #define RT1015_MONO_DYNA_CTRL 0x04fa 74 + #define RT1015_MONO_DYNA_CTRL1 0x04fc 75 + #define RT1015_MONO_DYNA_CTRL2 0x04fe 76 + #define RT1015_MONO_DYNA_CTRL3 0x0500 77 + #define RT1015_MONO_DYNA_CTRL4 0x0502 78 + #define RT1015_MONO_DYNA_CTRL5 0x0504 79 + #define RT1015_SPK_VOL 0x0506 81 80 #define RT1015_SHORT_DETTOP1 0x0508 82 81 #define RT1015_SHORT_DETTOP2 0x050a 83 82 #define RT1015_SPK_DC_DETECT1 0x0519
+6 -5
sound/soc/codecs/rt5682.c
··· 2829 2829 return ret; 2830 2830 } 2831 2831 rt5682->mclk = NULL; 2832 - } else { 2833 - /* Register CCF DAI clock control */ 2834 - ret = rt5682_register_dai_clks(component); 2835 - if (ret) 2836 - return ret; 2837 2832 } 2833 + 2834 + /* Register CCF DAI clock control */ 2835 + ret = rt5682_register_dai_clks(component); 2836 + if (ret) 2837 + return ret; 2838 + 2838 2839 /* Initial setup for CCF */ 2839 2840 rt5682->lrck[RT5682_AIF1] = CLK_48; 2840 2841 #endif
+2
sound/soc/fsl/fsl_asrc_common.h
··· 32 32 * @dma_chan: inputer and output DMA channels 33 33 * @dma_data: private dma data 34 34 * @pos: hardware pointer position 35 + * @req_dma_chan: flag to release dev_to_dev chan 35 36 * @private: pair private area 36 37 */ 37 38 struct fsl_asrc_pair { ··· 46 45 struct dma_chan *dma_chan[2]; 47 46 struct imx_dma_data dma_data; 48 47 unsigned int pos; 48 + bool req_dma_chan; 49 49 50 50 void *private; 51 51 };
+33 -14
sound/soc/fsl/fsl_asrc_dma.c
··· 135 135 struct snd_dmaengine_dai_dma_data *dma_params_be = NULL; 136 136 struct snd_pcm_runtime *runtime = substream->runtime; 137 137 struct fsl_asrc_pair *pair = runtime->private_data; 138 + struct dma_chan *tmp_chan = NULL, *be_chan = NULL; 139 + struct snd_soc_component *component_be = NULL; 138 140 struct fsl_asrc *asrc = pair->asrc; 139 141 struct dma_slave_config config_fe, config_be; 140 142 enum asrc_pair_index index = pair->index; ··· 144 142 int stream = substream->stream; 145 143 struct imx_dma_data *tmp_data; 146 144 struct snd_soc_dpcm *dpcm; 147 - struct dma_chan *tmp_chan; 148 145 struct device *dev_be; 149 146 u8 dir = tx ? OUT : IN; 150 147 dma_cap_mask_t mask; ··· 199 198 dma_cap_set(DMA_CYCLIC, mask); 200 199 201 200 /* 201 + * The Back-End device might have already requested a DMA channel, 202 + * so try to reuse it first, and then request a new one upon NULL. 203 + */ 204 + component_be = snd_soc_lookup_component_nolocked(dev_be, SND_DMAENGINE_PCM_DRV_NAME); 205 + if (component_be) { 206 + be_chan = soc_component_to_pcm(component_be)->chan[substream->stream]; 207 + tmp_chan = be_chan; 208 + } 209 + if (!tmp_chan) 210 + tmp_chan = dma_request_slave_channel(dev_be, tx ? "tx" : "rx"); 211 + 212 + /* 202 213 * An EDMA DEV_TO_DEV channel is fixed and bound with DMA event of each 203 214 * peripheral, unlike SDMA channel that is allocated dynamically. So no 204 - * need to configure dma_request and dma_request2, but get dma_chan via 205 - * dma_request_slave_channel directly with dma name of Front-End device 215 + * need to configure dma_request and dma_request2, but get dma_chan of 216 + * Back-End device directly via dma_request_slave_channel. 206 217 */ 207 218 if (!asrc->use_edma) { 208 219 /* Get DMA request of Back-End */ 209 - tmp_chan = dma_request_slave_channel(dev_be, tx ? "tx" : "rx"); 210 220 tmp_data = tmp_chan->private; 211 221 pair->dma_data.dma_request = tmp_data->dma_request; 212 - dma_release_channel(tmp_chan); 222 + if (!be_chan) 223 + dma_release_channel(tmp_chan); 213 224 214 225 /* Get DMA request of Front-End */ 215 226 tmp_chan = asrc->get_dma_channel(pair, dir); ··· 233 220 234 221 pair->dma_chan[dir] = 235 222 dma_request_channel(mask, filter, &pair->dma_data); 223 + pair->req_dma_chan = true; 236 224 } else { 237 - pair->dma_chan[dir] = 238 - asrc->get_dma_channel(pair, dir); 225 + pair->dma_chan[dir] = tmp_chan; 226 + /* Do not flag to release if we are reusing the Back-End one */ 227 + pair->req_dma_chan = !be_chan; 239 228 } 240 229 241 230 if (!pair->dma_chan[dir]) { ··· 276 261 ret = dmaengine_slave_config(pair->dma_chan[dir], &config_be); 277 262 if (ret) { 278 263 dev_err(dev, "failed to config DMA channel for Back-End\n"); 279 - dma_release_channel(pair->dma_chan[dir]); 264 + if (pair->req_dma_chan) 265 + dma_release_channel(pair->dma_chan[dir]); 280 266 return ret; 281 267 } 282 268 ··· 289 273 static int fsl_asrc_dma_hw_free(struct snd_soc_component *component, 290 274 struct snd_pcm_substream *substream) 291 275 { 276 + bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK; 292 277 struct snd_pcm_runtime *runtime = substream->runtime; 293 278 struct fsl_asrc_pair *pair = runtime->private_data; 279 + u8 dir = tx ? OUT : IN; 294 280 295 281 snd_pcm_set_runtime_buffer(substream, NULL); 296 282 297 - if (pair->dma_chan[IN]) 298 - dma_release_channel(pair->dma_chan[IN]); 283 + if (pair->dma_chan[!dir]) 284 + dma_release_channel(pair->dma_chan[!dir]); 299 285 300 - if (pair->dma_chan[OUT]) 301 - dma_release_channel(pair->dma_chan[OUT]); 286 + /* release dev_to_dev chan if we aren't reusing the Back-End one */ 287 + if (pair->dma_chan[dir] && pair->req_dma_chan) 288 + dma_release_channel(pair->dma_chan[dir]); 302 289 303 - pair->dma_chan[IN] = NULL; 304 - pair->dma_chan[OUT] = NULL; 290 + pair->dma_chan[!dir] = NULL; 291 + pair->dma_chan[dir] = NULL; 305 292 306 293 return 0; 307 294 }
+9 -4
sound/soc/fsl/fsl_ssi.c
··· 678 678 struct regmap *regs = ssi->regs; 679 679 u32 pm = 999, div2, psr, stccr, mask, afreq, factor, i; 680 680 unsigned long clkrate, baudrate, tmprate; 681 - unsigned int slots = params_channels(hw_params); 682 - unsigned int slot_width = 32; 681 + unsigned int channels = params_channels(hw_params); 682 + unsigned int slot_width = params_width(hw_params); 683 + unsigned int slots = 2; 683 684 u64 sub, savesub = 100000; 684 685 unsigned int freq; 685 686 bool baudclk_is_used; ··· 689 688 /* Override slots and slot_width if being specifically set... */ 690 689 if (ssi->slots) 691 690 slots = ssi->slots; 692 - /* ...but keep 32 bits if slots is 2 -- I2S Master mode */ 693 - if (ssi->slot_width && slots != 2) 691 + if (ssi->slot_width) 694 692 slot_width = ssi->slot_width; 693 + 694 + /* ...but force 32 bits for stereo audio using I2S Master Mode */ 695 + if (channels == 2 && 696 + (ssi->i2s_net & SSI_SCR_I2S_MODE_MASK) == SSI_SCR_I2S_MODE_MASTER) 697 + slot_width = 32; 695 698 696 699 /* Generate bit clock based on the slot number and slot width */ 697 700 freq = slots * slot_width * params_rate(hw_params);
+2 -2
sound/soc/intel/boards/Kconfig
··· 492 492 493 493 endif ## SND_SOC_SOF_HDA_LINK || SND_SOC_SOF_BAYTRAIL 494 494 495 - if (SND_SOC_SOF_COMETLAKE_LP && SND_SOC_SOF_HDA_LINK) 495 + if (SND_SOC_SOF_COMETLAKE && SND_SOC_SOF_HDA_LINK) 496 496 497 497 config SND_SOC_INTEL_CML_LP_DA7219_MAX98357A_MACH 498 498 tristate "CML_LP with DA7219 and MAX98357A in I2S Mode" ··· 520 520 Say Y if you have such a device. 521 521 If unsure select "N". 522 522 523 - endif ## SND_SOC_SOF_COMETLAKE_LP && SND_SOC_SOF_HDA_LINK 523 + endif ## SND_SOC_SOF_COMETLAKE && SND_SOC_SOF_HDA_LINK 524 524 525 525 if SND_SOC_SOF_JASPERLAKE 526 526
+12 -2
sound/soc/qcom/common.c
··· 4 4 5 5 #include <linux/module.h> 6 6 #include "common.h" 7 + #include "qdsp6/q6afe.h" 7 8 8 9 int qcom_snd_parse_of(struct snd_soc_card *card) 9 10 { ··· 102 101 } 103 102 link->no_pcm = 1; 104 103 link->ignore_pmdown_time = 1; 104 + 105 + if (q6afe_is_rx_port(link->id)) { 106 + link->dpcm_playback = 1; 107 + link->dpcm_capture = 0; 108 + } else { 109 + link->dpcm_playback = 0; 110 + link->dpcm_capture = 1; 111 + } 112 + 105 113 } else { 106 114 dlc = devm_kzalloc(dev, sizeof(*dlc), GFP_KERNEL); 107 115 if (!dlc) ··· 123 113 link->codecs->dai_name = "snd-soc-dummy-dai"; 124 114 link->codecs->name = "snd-soc-dummy"; 125 115 link->dynamic = 1; 116 + link->dpcm_playback = 1; 117 + link->dpcm_capture = 1; 126 118 } 127 119 128 120 link->ignore_suspend = 1; 129 121 link->nonatomic = 1; 130 - link->dpcm_playback = 1; 131 - link->dpcm_capture = 1; 132 122 link->stream_name = link->name; 133 123 link++; 134 124
+8
sound/soc/qcom/qdsp6/q6afe.c
··· 800 800 } 801 801 EXPORT_SYMBOL_GPL(q6afe_get_port_id); 802 802 803 + int q6afe_is_rx_port(int index) 804 + { 805 + if (index < 0 || index >= AFE_PORT_MAX) 806 + return -EINVAL; 807 + 808 + return port_maps[index].is_rx; 809 + } 810 + EXPORT_SYMBOL_GPL(q6afe_is_rx_port); 803 811 static int afe_apr_send_pkt(struct q6afe *afe, struct apr_pkt *pkt, 804 812 struct q6afe_port *port) 805 813 {
+1
sound/soc/qcom/qdsp6/q6afe.h
··· 198 198 int q6afe_port_stop(struct q6afe_port *port); 199 199 void q6afe_port_put(struct q6afe_port *port); 200 200 int q6afe_get_port_id(int index); 201 + int q6afe_is_rx_port(int index); 201 202 void q6afe_hdmi_port_prepare(struct q6afe_port *port, 202 203 struct q6afe_hdmi_cfg *cfg); 203 204 void q6afe_slim_port_prepare(struct q6afe_port *port,
+4 -3
sound/soc/qcom/qdsp6/q6asm.c
··· 25 25 #define ASM_STREAM_CMD_FLUSH 0x00010BCE 26 26 #define ASM_SESSION_CMD_PAUSE 0x00010BD3 27 27 #define ASM_DATA_CMD_EOS 0x00010BDB 28 + #define ASM_DATA_EVENT_RENDERED_EOS 0x00010C1C 28 29 #define ASM_NULL_POPP_TOPOLOGY 0x00010C68 29 30 #define ASM_STREAM_CMD_FLUSH_READBUFS 0x00010C09 30 31 #define ASM_STREAM_CMD_SET_ENCDEC_PARAM 0x00010C10 ··· 623 622 case ASM_SESSION_CMD_SUSPEND: 624 623 client_event = ASM_CLIENT_EVENT_CMD_SUSPEND_DONE; 625 624 break; 626 - case ASM_DATA_CMD_EOS: 627 - client_event = ASM_CLIENT_EVENT_CMD_EOS_DONE; 628 - break; 629 625 case ASM_STREAM_CMD_FLUSH: 630 626 client_event = ASM_CLIENT_EVENT_CMD_FLUSH_DONE; 631 627 break; ··· 725 727 spin_unlock_irqrestore(&ac->lock, flags); 726 728 } 727 729 730 + break; 731 + case ASM_DATA_EVENT_RENDERED_EOS: 732 + client_event = ASM_CLIENT_EVENT_CMD_EOS_DONE; 728 733 break; 729 734 } 730 735
+3 -1
sound/soc/rockchip/rockchip_pdm.c
··· 590 590 int ret; 591 591 592 592 ret = pm_runtime_get_sync(dev); 593 - if (ret < 0) 593 + if (ret < 0) { 594 + pm_runtime_put(dev); 594 595 return ret; 596 + } 595 597 596 598 ret = regcache_sync(pdm->regmap); 597 599
+2 -1
sound/soc/soc-core.c
··· 310 310 } 311 311 EXPORT_SYMBOL_GPL(snd_soc_rtdcom_lookup); 312 312 313 - static struct snd_soc_component 313 + struct snd_soc_component 314 314 *snd_soc_lookup_component_nolocked(struct device *dev, const char *driver_name) 315 315 { 316 316 struct snd_soc_component *component; ··· 329 329 330 330 return found_component; 331 331 } 332 + EXPORT_SYMBOL_GPL(snd_soc_lookup_component_nolocked); 332 333 333 334 struct snd_soc_component *snd_soc_lookup_component(struct device *dev, 334 335 const char *driver_name)
+37
sound/soc/soc-devres.c
··· 9 9 #include <sound/soc.h> 10 10 #include <sound/dmaengine_pcm.h> 11 11 12 + static void devm_dai_release(struct device *dev, void *res) 13 + { 14 + snd_soc_unregister_dai(*(struct snd_soc_dai **)res); 15 + } 16 + 17 + /** 18 + * devm_snd_soc_register_dai - resource-managed dai registration 19 + * @dev: Device used to manage component 20 + * @component: The component the DAIs are registered for 21 + * @dai_drv: DAI driver to use for the DAI 22 + * @legacy_dai_naming: if %true, use legacy single-name format; 23 + * if %false, use multiple-name format; 24 + */ 25 + struct snd_soc_dai *devm_snd_soc_register_dai(struct device *dev, 26 + struct snd_soc_component *component, 27 + struct snd_soc_dai_driver *dai_drv, 28 + bool legacy_dai_naming) 29 + { 30 + struct snd_soc_dai **ptr; 31 + struct snd_soc_dai *dai; 32 + 33 + ptr = devres_alloc(devm_dai_release, sizeof(*ptr), GFP_KERNEL); 34 + if (!ptr) 35 + return NULL; 36 + 37 + dai = snd_soc_register_dai(component, dai_drv, legacy_dai_naming); 38 + if (dai) { 39 + *ptr = dai; 40 + devres_add(dev, ptr); 41 + } else { 42 + devres_free(ptr); 43 + } 44 + 45 + return dai; 46 + } 47 + EXPORT_SYMBOL_GPL(devm_snd_soc_register_dai); 48 + 12 49 static void devm_component_release(struct device *dev, void *res) 13 50 { 14 51 snd_soc_unregister_component(*(struct device **)res);
-12
sound/soc/soc-generic-dmaengine-pcm.c
··· 21 21 */ 22 22 #define SND_DMAENGINE_PCM_FLAG_NO_RESIDUE BIT(31) 23 23 24 - struct dmaengine_pcm { 25 - struct dma_chan *chan[SNDRV_PCM_STREAM_LAST + 1]; 26 - const struct snd_dmaengine_pcm_config *config; 27 - struct snd_soc_component component; 28 - unsigned int flags; 29 - }; 30 - 31 - static struct dmaengine_pcm *soc_component_to_pcm(struct snd_soc_component *p) 32 - { 33 - return container_of(p, struct dmaengine_pcm, component); 34 - } 35 - 36 24 static struct device *dmaengine_dma_dev(struct dmaengine_pcm *pcm, 37 25 struct snd_pcm_substream *substream) 38 26 {
+3 -3
sound/soc/soc-pcm.c
··· 2630 2630 int count, paths; 2631 2631 int ret; 2632 2632 2633 + if (!fe->dai_link->dynamic) 2634 + return 0; 2635 + 2633 2636 if (fe->num_cpus > 1) { 2634 2637 dev_err(fe->dev, 2635 2638 "%s doesn't support Multi CPU yet\n", __func__); 2636 2639 return -EINVAL; 2637 2640 } 2638 - 2639 - if (!fe->dai_link->dynamic) 2640 - return 0; 2641 2641 2642 2642 /* only check active links */ 2643 2643 if (!snd_soc_dai_active(asoc_rtd_to_cpu(fe, 0)))
+1 -2
sound/soc/soc-topology.c
··· 1851 1851 list_add(&dai_drv->dobj.list, &tplg->comp->dobj_list); 1852 1852 1853 1853 /* register the DAI to the component */ 1854 - dai = snd_soc_register_dai(tplg->comp, dai_drv, false); 1854 + dai = devm_snd_soc_register_dai(tplg->comp->dev, tplg->comp, dai_drv, false); 1855 1855 if (!dai) 1856 1856 return -ENOMEM; 1857 1857 ··· 1859 1859 ret = snd_soc_dapm_new_dai_widgets(dapm, dai); 1860 1860 if (ret != 0) { 1861 1861 dev_err(dai->dev, "Failed to create DAI widgets %d\n", ret); 1862 - snd_soc_unregister_dai(dai); 1863 1862 return ret; 1864 1863 } 1865 1864
+8 -21
sound/soc/sof/intel/Kconfig
··· 25 25 select SND_SOC_SOF_CANNONLAKE if SND_SOC_SOF_CANNONLAKE_SUPPORT 26 26 select SND_SOC_SOF_COFFEELAKE if SND_SOC_SOF_COFFEELAKE_SUPPORT 27 27 select SND_SOC_SOF_ICELAKE if SND_SOC_SOF_ICELAKE_SUPPORT 28 - select SND_SOC_SOF_COMETLAKE_LP if SND_SOC_SOF_COMETLAKE_LP_SUPPORT 29 - select SND_SOC_SOF_COMETLAKE_H if SND_SOC_SOF_COMETLAKE_H_SUPPORT 28 + select SND_SOC_SOF_COMETLAKE if SND_SOC_SOF_COMETLAKE_SUPPORT 30 29 select SND_SOC_SOF_TIGERLAKE if SND_SOC_SOF_TIGERLAKE_SUPPORT 31 30 select SND_SOC_SOF_ELKHARTLAKE if SND_SOC_SOF_ELKHARTLAKE_SUPPORT 32 31 select SND_SOC_SOF_JASPERLAKE if SND_SOC_SOF_JASPERLAKE_SUPPORT ··· 200 201 This option is not user-selectable but automagically handled by 201 202 'select' statements at a higher level 202 203 203 - config SND_SOC_SOF_COMETLAKE_LP 204 + config SND_SOC_SOF_COMETLAKE 204 205 tristate 205 206 select SND_SOC_SOF_HDA_COMMON 206 207 help 207 208 This option is not user-selectable but automagically handled by 208 209 'select' statements at a higher level 210 + 211 + config SND_SOC_SOF_COMETLAKE_SUPPORT 212 + bool 209 213 210 214 config SND_SOC_SOF_COMETLAKE_LP_SUPPORT 211 - bool "SOF support for CometLake-LP" 215 + bool "SOF support for CometLake" 216 + select SND_SOC_SOF_COMETLAKE_SUPPORT 212 217 help 213 218 This adds support for Sound Open Firmware for Intel(R) platforms 214 - using the Cometlake-LP processors. 215 - Say Y if you have such a device. 216 - If unsure select "N". 217 - 218 - config SND_SOC_SOF_COMETLAKE_H 219 - tristate 220 - select SND_SOC_SOF_HDA_COMMON 221 - help 222 - This option is not user-selectable but automagically handled by 223 - 'select' statements at a higher level 224 - 225 - config SND_SOC_SOF_COMETLAKE_H_SUPPORT 226 - bool "SOF support for CometLake-H" 227 - help 228 - This adds support for Sound Open Firmware for Intel(R) platforms 229 - using the Cometlake-H processors. 230 - Say Y if you have such a device. 219 + using the Cometlake processors. 231 220 If unsure select "N". 232 221 233 222 config SND_SOC_SOF_TIGERLAKE_SUPPORT
+7 -2
sound/soc/sof/intel/hda-stream.c
··· 653 653 if (status & AZX_INT_CTRL_EN) { 654 654 rirb_status = snd_hdac_chip_readb(bus, RIRBSTS); 655 655 if (rirb_status & RIRB_INT_MASK) { 656 + /* 657 + * Clearing the interrupt status here ensures 658 + * that no interrupt gets masked after the RIRB 659 + * wp is read in snd_hdac_bus_update_rirb. 660 + */ 661 + snd_hdac_chip_writeb(bus, RIRBSTS, 662 + RIRB_INT_MASK); 656 663 active = true; 657 664 if (rirb_status & RIRB_INT_RESPONSE) 658 665 snd_hdac_bus_update_rirb(bus); 659 - snd_hdac_chip_writeb(bus, RIRBSTS, 660 - RIRB_INT_MASK); 661 666 } 662 667 } 663 668 #endif
+14 -10
sound/soc/sof/sof-pci-dev.c
··· 151 151 }; 152 152 #endif 153 153 154 - #if IS_ENABLED(CONFIG_SND_SOC_SOF_COMETLAKE_LP) || \ 155 - IS_ENABLED(CONFIG_SND_SOC_SOF_COMETLAKE_H) 156 - 154 + #if IS_ENABLED(CONFIG_SND_SOC_SOF_COMETLAKE) 157 155 static const struct sof_dev_desc cml_desc = { 158 156 .machines = snd_soc_acpi_intel_cml_machines, 159 157 .alt_machines = snd_soc_acpi_intel_cml_sdw_machines, ··· 409 411 .driver_data = (unsigned long)&cfl_desc}, 410 412 #endif 411 413 #if IS_ENABLED(CONFIG_SND_SOC_SOF_ICELAKE) 412 - { PCI_DEVICE(0x8086, 0x34C8), 414 + { PCI_DEVICE(0x8086, 0x34C8), /* ICL-LP */ 413 415 .driver_data = (unsigned long)&icl_desc}, 416 + { PCI_DEVICE(0x8086, 0x3dc8), /* ICL-H */ 417 + .driver_data = (unsigned long)&icl_desc}, 418 + 414 419 #endif 415 420 #if IS_ENABLED(CONFIG_SND_SOC_SOF_JASPERLAKE) 416 421 { PCI_DEVICE(0x8086, 0x38c8), ··· 421 420 { PCI_DEVICE(0x8086, 0x4dc8), 422 421 .driver_data = (unsigned long)&jsl_desc}, 423 422 #endif 424 - #if IS_ENABLED(CONFIG_SND_SOC_SOF_COMETLAKE_LP) 425 - { PCI_DEVICE(0x8086, 0x02c8), 423 + #if IS_ENABLED(CONFIG_SND_SOC_SOF_COMETLAKE) 424 + { PCI_DEVICE(0x8086, 0x02c8), /* CML-LP */ 426 425 .driver_data = (unsigned long)&cml_desc}, 427 - #endif 428 - #if IS_ENABLED(CONFIG_SND_SOC_SOF_COMETLAKE_H) 429 - { PCI_DEVICE(0x8086, 0x06c8), 426 + { PCI_DEVICE(0x8086, 0x06c8), /* CML-H */ 427 + .driver_data = (unsigned long)&cml_desc}, 428 + { PCI_DEVICE(0x8086, 0xa3f0), /* CML-S */ 430 429 .driver_data = (unsigned long)&cml_desc}, 431 430 #endif 432 431 #if IS_ENABLED(CONFIG_SND_SOC_SOF_TIGERLAKE) 433 - { PCI_DEVICE(0x8086, 0xa0c8), 432 + { PCI_DEVICE(0x8086, 0xa0c8), /* TGL-LP */ 434 433 .driver_data = (unsigned long)&tgl_desc}, 434 + { PCI_DEVICE(0x8086, 0x43c8), /* TGL-H */ 435 + .driver_data = (unsigned long)&tgl_desc}, 436 + 435 437 #endif 436 438 #if IS_ENABLED(CONFIG_SND_SOC_SOF_ELKHARTLAKE) 437 439 { PCI_DEVICE(0x8086, 0x4b55),