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

Merge remote-tracking branch 'asoc/for-5.8' into asoc-linus

+189 -101
+1 -1
drivers/spi/spi-lantiq-ssc.c
··· 899 899 master->bits_per_word_mask = SPI_BPW_RANGE_MASK(2, 8) | 900 900 SPI_BPW_MASK(16) | SPI_BPW_MASK(32); 901 901 902 - spi->wq = alloc_ordered_workqueue(dev_name(dev), 0); 902 + spi->wq = alloc_ordered_workqueue(dev_name(dev), WQ_MEM_RECLAIM); 903 903 if (!spi->wq) { 904 904 err = -ENOMEM; 905 905 goto err_clk_put;
+42 -12
sound/soc/codecs/max98357a.c
··· 23 23 struct max98357a_priv { 24 24 struct gpio_desc *sdmode; 25 25 unsigned int sdmode_delay; 26 + int sdmode_switch; 26 27 }; 28 + 29 + static int max98357a_daiops_trigger(struct snd_pcm_substream *substream, 30 + int cmd, struct snd_soc_dai *dai) 31 + { 32 + struct snd_soc_component *component = dai->component; 33 + struct max98357a_priv *max98357a = 34 + snd_soc_component_get_drvdata(component); 35 + 36 + if (!max98357a->sdmode) 37 + return 0; 38 + 39 + switch (cmd) { 40 + case SNDRV_PCM_TRIGGER_START: 41 + case SNDRV_PCM_TRIGGER_RESUME: 42 + case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: 43 + mdelay(max98357a->sdmode_delay); 44 + if (max98357a->sdmode_switch) { 45 + gpiod_set_value(max98357a->sdmode, 1); 46 + dev_dbg(component->dev, "set sdmode to 1"); 47 + } 48 + break; 49 + case SNDRV_PCM_TRIGGER_STOP: 50 + case SNDRV_PCM_TRIGGER_SUSPEND: 51 + case SNDRV_PCM_TRIGGER_PAUSE_PUSH: 52 + gpiod_set_value(max98357a->sdmode, 0); 53 + dev_dbg(component->dev, "set sdmode to 0"); 54 + break; 55 + } 56 + 57 + return 0; 58 + } 27 59 28 60 static int max98357a_sdmode_event(struct snd_soc_dapm_widget *w, 29 61 struct snd_kcontrol *kcontrol, int event) ··· 65 33 struct max98357a_priv *max98357a = 66 34 snd_soc_component_get_drvdata(component); 67 35 68 - if (!max98357a->sdmode) 69 - return 0; 70 - 71 - if (event & SND_SOC_DAPM_POST_PMU) { 72 - msleep(max98357a->sdmode_delay); 73 - gpiod_set_value(max98357a->sdmode, 1); 74 - dev_dbg(component->dev, "set sdmode to 1"); 75 - } else if (event & SND_SOC_DAPM_PRE_PMD) { 76 - gpiod_set_value(max98357a->sdmode, 0); 77 - dev_dbg(component->dev, "set sdmode to 0"); 78 - } 36 + if (event & SND_SOC_DAPM_POST_PMU) 37 + max98357a->sdmode_switch = 1; 38 + else if (event & SND_SOC_DAPM_POST_PMD) 39 + max98357a->sdmode_switch = 0; 79 40 80 41 return 0; 81 42 } ··· 77 52 SND_SOC_DAPM_OUTPUT("Speaker"), 78 53 SND_SOC_DAPM_OUT_DRV_E("SD_MODE", SND_SOC_NOPM, 0, 0, NULL, 0, 79 54 max98357a_sdmode_event, 80 - SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD), 55 + SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD), 81 56 }; 82 57 83 58 static const struct snd_soc_dapm_route max98357a_dapm_routes[] = { ··· 94 69 .use_pmdown_time = 1, 95 70 .endianness = 1, 96 71 .non_legacy_dai_naming = 1, 72 + }; 73 + 74 + static const struct snd_soc_dai_ops max98357a_dai_ops = { 75 + .trigger = max98357a_daiops_trigger, 97 76 }; 98 77 99 78 static struct snd_soc_dai_driver max98357a_dai_driver = { ··· 119 90 .channels_min = 1, 120 91 .channels_max = 2, 121 92 }, 93 + .ops = &max98357a_dai_ops, 122 94 }; 123 95 124 96 static int max98357a_platform_probe(struct platform_device *pdev)
+1 -1
sound/soc/codecs/max98390.c
··· 678 678 679 679 static const struct snd_soc_dapm_widget max98390_dapm_widgets[] = { 680 680 SND_SOC_DAPM_DAC_E("Amp Enable", "HiFi Playback", 681 - MAX98390_R203A_AMP_EN, 0, 0, max98390_dac_event, 681 + SND_SOC_NOPM, 0, 0, max98390_dac_event, 682 682 SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD), 683 683 SND_SOC_DAPM_MUX("DAI Sel Mux", SND_SOC_NOPM, 0, 0, 684 684 &max98390_dai_controls),
+3 -2
sound/soc/fsl/fsl_sai.c
··· 680 680 regmap_write(sai->regmap, FSL_SAI_RCSR(ofs), 0); 681 681 682 682 regmap_update_bits(sai->regmap, FSL_SAI_TCR1(ofs), 683 - FSL_SAI_CR1_RFW_MASK, 683 + FSL_SAI_CR1_RFW_MASK(sai->soc_data->fifo_depth), 684 684 sai->soc_data->fifo_depth - FSL_SAI_MAXBURST_TX); 685 685 regmap_update_bits(sai->regmap, FSL_SAI_RCR1(ofs), 686 - FSL_SAI_CR1_RFW_MASK, FSL_SAI_MAXBURST_RX - 1); 686 + FSL_SAI_CR1_RFW_MASK(sai->soc_data->fifo_depth), 687 + FSL_SAI_MAXBURST_RX - 1); 687 688 688 689 snd_soc_dai_init_dma_data(cpu_dai, &sai->dma_params_tx, 689 690 &sai->dma_params_rx);
+1 -1
sound/soc/fsl/fsl_sai.h
··· 94 94 #define FSL_SAI_CSR_FRDE BIT(0) 95 95 96 96 /* SAI Transmit and Receive Configuration 1 Register */ 97 - #define FSL_SAI_CR1_RFW_MASK 0x1f 97 + #define FSL_SAI_CR1_RFW_MASK(x) ((x) - 1) 98 98 99 99 /* SAI Transmit and Receive Configuration 2 Register */ 100 100 #define FSL_SAI_CR2_SYNC BIT(30)
+32 -9
sound/soc/intel/boards/kbl_rt5663_rt5514_max98927.c
··· 336 336 struct snd_interval *chan = hw_param_interval(params, 337 337 SNDRV_PCM_HW_PARAM_CHANNELS); 338 338 struct snd_mask *fmt = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT); 339 - struct snd_soc_dpcm *dpcm = container_of( 340 - params, struct snd_soc_dpcm, hw_params); 341 - struct snd_soc_dai_link *fe_dai_link = dpcm->fe->dai_link; 342 - struct snd_soc_dai_link *be_dai_link = dpcm->be->dai_link; 339 + struct snd_soc_dpcm *dpcm, *rtd_dpcm = NULL; 340 + 341 + /* 342 + * The following loop will be called only for playback stream 343 + * In this platform, there is only one playback device on every SSP 344 + */ 345 + for_each_dpcm_fe(rtd, SNDRV_PCM_STREAM_PLAYBACK, dpcm) { 346 + rtd_dpcm = dpcm; 347 + break; 348 + } 349 + 350 + /* 351 + * This following loop will be called only for capture stream 352 + * In this platform, there is only one capture device on every SSP 353 + */ 354 + for_each_dpcm_fe(rtd, SNDRV_PCM_STREAM_CAPTURE, dpcm) { 355 + rtd_dpcm = dpcm; 356 + break; 357 + } 358 + 359 + if (!rtd_dpcm) 360 + return -EINVAL; 361 + 362 + /* 363 + * The above 2 loops are mutually exclusive based on the stream direction, 364 + * thus rtd_dpcm variable will never be overwritten 365 + */ 343 366 344 367 /* 345 368 * The ADSP will convert the FE rate to 48k, stereo, 24 bit 346 369 */ 347 - if (!strcmp(fe_dai_link->name, "Kbl Audio Port") || 348 - !strcmp(fe_dai_link->name, "Kbl Audio Headset Playback") || 349 - !strcmp(fe_dai_link->name, "Kbl Audio Capture Port")) { 370 + if (!strcmp(rtd_dpcm->fe->dai_link->name, "Kbl Audio Port") || 371 + !strcmp(rtd_dpcm->fe->dai_link->name, "Kbl Audio Headset Playback") || 372 + !strcmp(rtd_dpcm->fe->dai_link->name, "Kbl Audio Capture Port")) { 350 373 rate->min = rate->max = 48000; 351 374 chan->min = chan->max = 2; 352 375 snd_mask_none(fmt); 353 376 snd_mask_set_format(fmt, SNDRV_PCM_FORMAT_S24_LE); 354 - } else if (!strcmp(fe_dai_link->name, "Kbl Audio DMIC cap")) { 377 + } else if (!strcmp(rtd_dpcm->fe->dai_link->name, "Kbl Audio DMIC cap")) { 355 378 if (params_channels(params) == 2 || 356 379 DMIC_CH(dmic_constraints) == 2) 357 380 chan->min = chan->max = 2; ··· 385 362 * The speaker on the SSP0 supports S16_LE and not S24_LE. 386 363 * thus changing the mask here 387 364 */ 388 - if (!strcmp(be_dai_link->name, "SSP0-Codec")) 365 + if (!strcmp(rtd_dpcm->be->dai_link->name, "SSP0-Codec")) 389 366 snd_mask_set_format(fmt, SNDRV_PCM_FORMAT_S16_LE); 390 367 391 368 return 0;
+1
sound/soc/intel/boards/skl_hda_dsp_common.h
··· 33 33 int dai_index; 34 34 const char *platform_name; 35 35 bool common_hdmi_codec_drv; 36 + bool idisp_codec; 36 37 }; 37 38 38 39 extern struct snd_soc_dai_link skl_hda_be_dai_links[HDA_DSP_MAX_BE_DAI_LINKS];
+11 -6
sound/soc/intel/boards/skl_hda_dsp_generic.c
··· 79 79 link->platforms->name = ctx->platform_name; 80 80 link->nonatomic = 1; 81 81 82 + if (!ctx->idisp_codec) 83 + return 0; 84 + 82 85 if (strstr(link->name, "HDMI")) { 83 86 ret = skl_hda_hdmi_add_pcm(card, ctx->pcm_count); 84 87 ··· 121 118 static int skl_hda_fill_card_info(struct snd_soc_acpi_mach_params *mach_params) 122 119 { 123 120 struct snd_soc_card *card = &hda_soc_card; 121 + struct skl_hda_private *ctx = snd_soc_card_get_drvdata(card); 124 122 struct snd_soc_dai_link *dai_link; 125 - u32 codec_count, codec_mask, idisp_mask; 123 + u32 codec_count, codec_mask; 126 124 int i, num_links, num_route; 127 125 128 126 codec_mask = mach_params->codec_mask; 129 127 codec_count = hweight_long(codec_mask); 130 - idisp_mask = codec_mask & IDISP_CODEC_MASK; 128 + ctx->idisp_codec = !!(codec_mask & IDISP_CODEC_MASK); 131 129 132 130 if (!codec_count || codec_count > 2 || 133 - (codec_count == 2 && !idisp_mask)) 131 + (codec_count == 2 && !ctx->idisp_codec)) 134 132 return -EINVAL; 135 133 136 - if (codec_mask == idisp_mask) { 134 + if (codec_mask == IDISP_CODEC_MASK) { 137 135 /* topology with iDisp as the only HDA codec */ 138 136 num_links = IDISP_DAI_COUNT + DMIC_DAI_COUNT; 139 137 num_route = IDISP_ROUTE_COUNT; ··· 156 152 num_route = ARRAY_SIZE(skl_hda_map); 157 153 card->dapm_widgets = skl_hda_widgets; 158 154 card->num_dapm_widgets = ARRAY_SIZE(skl_hda_widgets); 159 - if (!idisp_mask) { 155 + if (!ctx->idisp_codec) { 160 156 for (i = 0; i < IDISP_DAI_COUNT; i++) { 161 157 skl_hda_be_dai_links[i].codecs = dummy_codec; 162 158 skl_hda_be_dai_links[i].num_codecs = ··· 215 211 if (!mach) 216 212 return -EINVAL; 217 213 214 + snd_soc_card_set_drvdata(&hda_soc_card, ctx); 215 + 218 216 ret = skl_hda_fill_card_info(&mach->mach_params); 219 217 if (ret < 0) { 220 218 dev_err(&pdev->dev, "Unsupported HDAudio/iDisp configuration found\n"); ··· 229 223 ctx->common_hdmi_codec_drv = mach->mach_params.common_hdmi_codec_drv; 230 224 231 225 hda_soc_card.dev = &pdev->dev; 232 - snd_soc_card_set_drvdata(&hda_soc_card, ctx); 233 226 234 227 if (mach->mach_params.dmic_num > 0) { 235 228 snprintf(hda_soc_components, sizeof(hda_soc_components),
+1 -1
sound/soc/intel/common/soc-acpi-intel-ehl-match.c
··· 12 12 13 13 struct snd_soc_acpi_mach snd_soc_acpi_intel_ehl_machines[] = { 14 14 { 15 - .id = "INTC1027", 15 + .id = "10EC5660", 16 16 .drv_name = "ehl_rt5660", 17 17 .sof_fw_filename = "sof-ehl.ri", 18 18 .sof_tplg_filename = "sof-ehl-rt5660.tplg",
+11 -9
sound/soc/meson/axg-card.c
··· 116 116 117 117 lb = &card->dai_link[*index + 1]; 118 118 119 - lb->name = kasprintf(GFP_KERNEL, "%s-lb", pad->name); 119 + lb->name = devm_kasprintf(card->dev, GFP_KERNEL, "%s-lb", pad->name); 120 120 if (!lb->name) 121 121 return -ENOMEM; 122 122 ··· 327 327 return ret; 328 328 329 329 if (axg_card_cpu_is_playback_fe(dai_link->cpus->of_node)) 330 - ret = meson_card_set_fe_link(card, dai_link, np, true); 330 + return meson_card_set_fe_link(card, dai_link, np, true); 331 331 else if (axg_card_cpu_is_capture_fe(dai_link->cpus->of_node)) 332 - ret = meson_card_set_fe_link(card, dai_link, np, false); 333 - else 334 - ret = meson_card_set_be_link(card, dai_link, np); 332 + return meson_card_set_fe_link(card, dai_link, np, false); 335 333 334 + 335 + ret = meson_card_set_be_link(card, dai_link, np); 336 336 if (ret) 337 337 return ret; 338 338 339 - if (axg_card_cpu_is_tdm_iface(dai_link->cpus->of_node)) 340 - ret = axg_card_parse_tdm(card, np, index); 341 - else if (axg_card_cpu_is_codec(dai_link->cpus->of_node)) { 339 + if (axg_card_cpu_is_codec(dai_link->cpus->of_node)) { 342 340 dai_link->params = &codec_params; 343 - dai_link->no_pcm = 0; /* link is not a DPCM BE */ 341 + } else { 342 + dai_link->no_pcm = 1; 343 + snd_soc_dai_link_set_capabilities(dai_link); 344 + if (axg_card_cpu_is_tdm_iface(dai_link->cpus->of_node)) 345 + ret = axg_card_parse_tdm(card, np, index); 344 346 } 345 347 346 348 return ret;
+6 -5
sound/soc/meson/axg-tdm-formatter.c
··· 70 70 static int axg_tdm_formatter_enable(struct axg_tdm_formatter *formatter) 71 71 { 72 72 struct axg_tdm_stream *ts = formatter->stream; 73 - bool invert = formatter->drv->quirks->invert_sclk; 73 + bool invert; 74 74 int ret; 75 75 76 76 /* Do nothing if the formatter is already enabled */ ··· 96 96 return ret; 97 97 98 98 /* 99 - * If sclk is inverted, invert it back and provide the inversion 100 - * required by the formatter 99 + * If sclk is inverted, it means the bit should latched on the 100 + * rising edge which is what our HW expects. If not, we need to 101 + * invert it before the formatter. 101 102 */ 102 - invert ^= axg_tdm_sclk_invert(ts->iface->fmt); 103 - ret = clk_set_phase(formatter->sclk, invert ? 180 : 0); 103 + invert = axg_tdm_sclk_invert(ts->iface->fmt); 104 + ret = clk_set_phase(formatter->sclk, invert ? 0 : 180); 104 105 if (ret) 105 106 return ret; 106 107
-1
sound/soc/meson/axg-tdm-formatter.h
··· 16 16 17 17 struct axg_tdm_formatter_hw { 18 18 unsigned int skew_offset; 19 - bool invert_sclk; 20 19 }; 21 20 22 21 struct axg_tdm_formatter_ops {
+18 -10
sound/soc/meson/axg-tdm-interface.c
··· 119 119 { 120 120 struct axg_tdm_iface *iface = snd_soc_dai_get_drvdata(dai); 121 121 122 - /* These modes are not supported */ 123 - if (fmt & (SND_SOC_DAIFMT_CBS_CFM | SND_SOC_DAIFMT_CBM_CFS)) { 124 - dev_err(dai->dev, "only CBS_CFS and CBM_CFM are supported\n"); 125 - return -EINVAL; 126 - } 122 + switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { 123 + case SND_SOC_DAIFMT_CBS_CFS: 124 + if (!iface->mclk) { 125 + dev_err(dai->dev, "cpu clock master: mclk missing\n"); 126 + return -ENODEV; 127 + } 128 + break; 127 129 128 - /* If the TDM interface is the clock master, it requires mclk */ 129 - if (!iface->mclk && (fmt & SND_SOC_DAIFMT_CBS_CFS)) { 130 - dev_err(dai->dev, "cpu clock master: mclk missing\n"); 131 - return -ENODEV; 130 + case SND_SOC_DAIFMT_CBM_CFM: 131 + break; 132 + 133 + case SND_SOC_DAIFMT_CBS_CFM: 134 + case SND_SOC_DAIFMT_CBM_CFS: 135 + dev_err(dai->dev, "only CBS_CFS and CBM_CFM are supported\n"); 136 + /* Fall-through */ 137 + default: 138 + return -EINVAL; 132 139 } 133 140 134 141 iface->fmt = fmt; ··· 326 319 if (ret) 327 320 return ret; 328 321 329 - if (iface->fmt & SND_SOC_DAIFMT_CBS_CFS) { 322 + if ((iface->fmt & SND_SOC_DAIFMT_MASTER_MASK) == 323 + SND_SOC_DAIFMT_CBS_CFS) { 330 324 ret = axg_tdm_iface_set_sclk(dai, params); 331 325 if (ret) 332 326 return ret;
+15 -1
sound/soc/meson/axg-tdmin.c
··· 228 228 .regmap_cfg = &axg_tdmin_regmap_cfg, 229 229 .ops = &axg_tdmin_ops, 230 230 .quirks = &(const struct axg_tdm_formatter_hw) { 231 - .invert_sclk = false, 232 231 .skew_offset = 2, 232 + }, 233 + }; 234 + 235 + static const struct axg_tdm_formatter_driver g12a_tdmin_drv = { 236 + .component_drv = &axg_tdmin_component_drv, 237 + .regmap_cfg = &axg_tdmin_regmap_cfg, 238 + .ops = &axg_tdmin_ops, 239 + .quirks = &(const struct axg_tdm_formatter_hw) { 240 + .skew_offset = 3, 233 241 }, 234 242 }; 235 243 ··· 245 237 { 246 238 .compatible = "amlogic,axg-tdmin", 247 239 .data = &axg_tdmin_drv, 240 + }, { 241 + .compatible = "amlogic,g12a-tdmin", 242 + .data = &g12a_tdmin_drv, 243 + }, { 244 + .compatible = "amlogic,sm1-tdmin", 245 + .data = &g12a_tdmin_drv, 248 246 }, {} 249 247 }; 250 248 MODULE_DEVICE_TABLE(of, axg_tdmin_of_match);
-3
sound/soc/meson/axg-tdmout.c
··· 238 238 .regmap_cfg = &axg_tdmout_regmap_cfg, 239 239 .ops = &axg_tdmout_ops, 240 240 .quirks = &(const struct axg_tdm_formatter_hw) { 241 - .invert_sclk = true, 242 241 .skew_offset = 1, 243 242 }, 244 243 }; ··· 247 248 .regmap_cfg = &axg_tdmout_regmap_cfg, 248 249 .ops = &axg_tdmout_ops, 249 250 .quirks = &(const struct axg_tdm_formatter_hw) { 250 - .invert_sclk = true, 251 251 .skew_offset = 2, 252 252 }, 253 253 }; ··· 307 309 .regmap_cfg = &axg_tdmout_regmap_cfg, 308 310 .ops = &axg_tdmout_ops, 309 311 .quirks = &(const struct axg_tdm_formatter_hw) { 310 - .invert_sclk = true, 311 312 .skew_offset = 2, 312 313 }, 313 314 };
+9 -9
sound/soc/meson/gx-card.c
··· 96 96 return ret; 97 97 98 98 if (gx_card_cpu_identify(dai_link->cpus, "FIFO")) 99 - ret = meson_card_set_fe_link(card, dai_link, np, true); 100 - else 101 - ret = meson_card_set_be_link(card, dai_link, np); 99 + return meson_card_set_fe_link(card, dai_link, np, true); 102 100 101 + ret = meson_card_set_be_link(card, dai_link, np); 103 102 if (ret) 104 103 return ret; 105 104 106 - /* Check if the cpu is the i2s encoder and parse i2s data */ 107 - if (gx_card_cpu_identify(dai_link->cpus, "I2S Encoder")) 108 - ret = gx_card_parse_i2s(card, np, index); 109 - 110 105 /* Or apply codec to codec params if necessary */ 111 - else if (gx_card_cpu_identify(dai_link->cpus, "CODEC CTRL")) { 106 + if (gx_card_cpu_identify(dai_link->cpus, "CODEC CTRL")) { 112 107 dai_link->params = &codec_params; 113 - dai_link->no_pcm = 0; /* link is not a DPCM BE */ 108 + } else { 109 + dai_link->no_pcm = 1; 110 + snd_soc_dai_link_set_capabilities(dai_link); 111 + /* Check if the cpu is the i2s encoder and parse i2s data */ 112 + if (gx_card_cpu_identify(dai_link->cpus, "I2S Encoder")) 113 + ret = gx_card_parse_i2s(card, np, index); 114 114 } 115 115 116 116 return ret;
-4
sound/soc/meson/meson-card-utils.c
··· 147 147 struct device_node *np; 148 148 int ret, num_codecs; 149 149 150 - link->no_pcm = 1; 151 - link->dpcm_playback = 1; 152 - link->dpcm_capture = 1; 153 - 154 150 num_codecs = of_get_child_count(node); 155 151 if (!num_codecs) { 156 152 dev_err(card->dev, "be link %s has no codec\n",
+4 -1
sound/soc/soc-core.c
··· 446 446 447 447 dev->parent = card->dev; 448 448 dev->release = soc_release_rtd_dev; 449 - dev->groups = soc_dev_attr_groups; 450 449 451 450 dev_set_name(dev, "%s", dai_link->name); 452 451 ··· 501 502 502 503 /* see for_each_card_rtds */ 503 504 list_add_tail(&rtd->list, &card->rtd_list); 505 + 506 + ret = device_add_groups(dev, soc_dev_attr_groups); 507 + if (ret < 0) 508 + goto free_rtd; 504 509 505 510 return rtd; 506 511
+9 -7
sound/soc/soc-dai.c
··· 400 400 struct snd_soc_dai_link_component *codec; 401 401 struct snd_soc_dai *dai; 402 402 bool supported[SNDRV_PCM_STREAM_LAST + 1]; 403 + bool supported_cpu; 404 + bool supported_codec; 403 405 int direction; 404 406 int i; 405 407 406 408 for_each_pcm_streams(direction) { 407 - supported[direction] = true; 409 + supported_cpu = false; 410 + supported_codec = false; 408 411 409 412 for_each_link_cpus(dai_link, i, cpu) { 410 413 dai = snd_soc_find_dai(cpu); 411 - if (!dai || !snd_soc_dai_stream_valid(dai, direction)) { 412 - supported[direction] = false; 414 + if (dai && snd_soc_dai_stream_valid(dai, direction)) { 415 + supported_cpu = true; 413 416 break; 414 417 } 415 418 } 416 - if (!supported[direction]) 417 - continue; 418 419 for_each_link_codecs(dai_link, i, codec) { 419 420 dai = snd_soc_find_dai(codec); 420 - if (!dai || !snd_soc_dai_stream_valid(dai, direction)) { 421 - supported[direction] = false; 421 + if (dai && snd_soc_dai_stream_valid(dai, direction)) { 422 + supported_codec = true; 422 423 break; 423 424 } 424 425 } 426 + supported[direction] = supported_cpu && supported_codec; 425 427 } 426 428 427 429 dai_link->dpcm_playback = supported[SNDRV_PCM_STREAM_PLAYBACK];
+24 -18
sound/soc/soc-pcm.c
··· 2802 2802 if (rtd->dai_link->dpcm_playback) { 2803 2803 stream = SNDRV_PCM_STREAM_PLAYBACK; 2804 2804 2805 - for_each_rtd_cpu_dais(rtd, i, cpu_dai) 2806 - if (!snd_soc_dai_stream_valid(cpu_dai, 2807 - stream)) { 2808 - dev_err(rtd->card->dev, 2809 - "CPU DAI %s for rtd %s does not support playback\n", 2810 - cpu_dai->name, 2811 - rtd->dai_link->stream_name); 2812 - return -EINVAL; 2805 + for_each_rtd_cpu_dais(rtd, i, cpu_dai) { 2806 + if (snd_soc_dai_stream_valid(cpu_dai, stream)) { 2807 + playback = 1; 2808 + break; 2813 2809 } 2814 - playback = 1; 2810 + } 2811 + 2812 + if (!playback) { 2813 + dev_err(rtd->card->dev, 2814 + "No CPU DAIs support playback for stream %s\n", 2815 + rtd->dai_link->stream_name); 2816 + return -EINVAL; 2817 + } 2815 2818 } 2816 2819 if (rtd->dai_link->dpcm_capture) { 2817 2820 stream = SNDRV_PCM_STREAM_CAPTURE; 2818 2821 2819 - for_each_rtd_cpu_dais(rtd, i, cpu_dai) 2820 - if (!snd_soc_dai_stream_valid(cpu_dai, 2821 - stream)) { 2822 - dev_err(rtd->card->dev, 2823 - "CPU DAI %s for rtd %s does not support capture\n", 2824 - cpu_dai->name, 2825 - rtd->dai_link->stream_name); 2826 - return -EINVAL; 2822 + for_each_rtd_cpu_dais(rtd, i, cpu_dai) { 2823 + if (snd_soc_dai_stream_valid(cpu_dai, stream)) { 2824 + capture = 1; 2825 + break; 2827 2826 } 2828 - capture = 1; 2827 + } 2828 + 2829 + if (!capture) { 2830 + dev_err(rtd->card->dev, 2831 + "No CPU DAIs support capture for stream %s\n", 2832 + rtd->dai_link->stream_name); 2833 + return -EINVAL; 2834 + } 2829 2835 } 2830 2836 } else { 2831 2837 /* Adapt stream for codec2codec links */