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

Merge remote-tracking branches 'asoc/topic/jz4740', 'asoc/topic/kirkwood', 'asoc/topic/mtk', 'asoc/topic/multi' and 'asoc/topic/mxs' into asoc-next

+54 -25
+1
sound/soc/jz4740/jz4740-i2s.c
··· 485 485 { .compatible = "ingenic,jz4780-i2s", .data = (void *)JZ_I2S_JZ4780 }, 486 486 { /* sentinel */ } 487 487 }; 488 + MODULE_DEVICE_TABLE(of, jz4740_of_matches); 488 489 #endif 489 490 490 491 static int jz4740_i2s_dev_probe(struct platform_device *pdev)
+1
sound/soc/kirkwood/armada-370-db.c
··· 130 130 { .compatible = "marvell,a370db-audio" }, 131 131 { }, 132 132 }; 133 + MODULE_DEVICE_TABLE(of, a370db_dt_ids); 133 134 134 135 static struct platform_driver a370db_driver = { 135 136 .driver = {
+1 -10
sound/soc/mediatek/mt8173-max98090.c
··· 179 179 } 180 180 card->dev = &pdev->dev; 181 181 182 - ret = snd_soc_register_card(card); 182 + ret = devm_snd_soc_register_card(&pdev->dev, card); 183 183 if (ret) 184 184 dev_err(&pdev->dev, "%s snd_soc_register_card fail %d\n", 185 185 __func__, ret); 186 186 return ret; 187 - } 188 - 189 - static int mt8173_max98090_dev_remove(struct platform_device *pdev) 190 - { 191 - struct snd_soc_card *card = platform_get_drvdata(pdev); 192 - 193 - snd_soc_unregister_card(card); 194 - return 0; 195 187 } 196 188 197 189 static const struct of_device_id mt8173_max98090_dt_match[] = { ··· 201 209 #endif 202 210 }, 203 211 .probe = mt8173_max98090_dev_probe, 204 - .remove = mt8173_max98090_dev_remove, 205 212 }; 206 213 207 214 module_platform_driver(mt8173_max98090_driver);
+1 -10
sound/soc/mediatek/mt8173-rt5650-rt5676.c
··· 246 246 card->dev = &pdev->dev; 247 247 platform_set_drvdata(pdev, card); 248 248 249 - ret = snd_soc_register_card(card); 249 + ret = devm_snd_soc_register_card(&pdev->dev, card); 250 250 if (ret) 251 251 dev_err(&pdev->dev, "%s snd_soc_register_card fail %d\n", 252 252 __func__, ret); 253 253 return ret; 254 - } 255 - 256 - static int mt8173_rt5650_rt5676_dev_remove(struct platform_device *pdev) 257 - { 258 - struct snd_soc_card *card = platform_get_drvdata(pdev); 259 - 260 - snd_soc_unregister_card(card); 261 - return 0; 262 254 } 263 255 264 256 static const struct of_device_id mt8173_rt5650_rt5676_dt_match[] = { ··· 268 276 #endif 269 277 }, 270 278 .probe = mt8173_rt5650_rt5676_dev_probe, 271 - .remove = mt8173_rt5650_rt5676_dev_remove, 272 279 }; 273 280 274 281 module_platform_driver(mt8173_rt5650_rt5676_driver);
+1 -5
sound/soc/mxs/mxs-sgtl5000.c
··· 142 142 card->dev = &pdev->dev; 143 143 platform_set_drvdata(pdev, card); 144 144 145 - ret = snd_soc_register_card(card); 145 + ret = devm_snd_soc_register_card(&pdev->dev, card); 146 146 if (ret) { 147 147 dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", 148 148 ret); ··· 154 154 155 155 static int mxs_sgtl5000_remove(struct platform_device *pdev) 156 156 { 157 - struct snd_soc_card *card = platform_get_drvdata(pdev); 158 - 159 157 mxs_saif_put_mclk(0); 160 - 161 - snd_soc_unregister_card(card); 162 158 163 159 return 0; 164 160 }
+49
sound/soc/soc-pcm.c
··· 34 34 35 35 #define DPCM_MAX_BE_USERS 8 36 36 37 + /* 38 + * snd_soc_dai_stream_valid() - check if a DAI supports the given stream 39 + * 40 + * Returns true if the DAI supports the indicated stream type. 41 + */ 42 + static bool snd_soc_dai_stream_valid(struct snd_soc_dai *dai, int stream) 43 + { 44 + struct snd_soc_pcm_stream *codec_stream; 45 + 46 + if (stream == SNDRV_PCM_STREAM_PLAYBACK) 47 + codec_stream = &dai->driver->playback; 48 + else 49 + codec_stream = &dai->driver->capture; 50 + 51 + /* If the codec specifies any rate at all, it supports the stream. */ 52 + return codec_stream->rates; 53 + } 54 + 37 55 /** 38 56 * snd_soc_runtime_activate() - Increment active count for PCM runtime components 39 57 * @rtd: ASoC PCM runtime that is activated ··· 389 371 390 372 /* first calculate min/max only for CODECs in the DAI link */ 391 373 for (i = 0; i < rtd->num_codecs; i++) { 374 + 375 + /* 376 + * Skip CODECs which don't support the current stream type. 377 + * Otherwise, since the rate, channel, and format values will 378 + * zero in that case, we would have no usable settings left, 379 + * causing the resulting setup to fail. 380 + * At least one CODEC should match, otherwise we should have 381 + * bailed out on a higher level, since there would be no 382 + * CODEC to support the transfer direction in that case. 383 + */ 384 + if (!snd_soc_dai_stream_valid(rtd->codec_dais[i], 385 + substream->stream)) 386 + continue; 387 + 392 388 codec_dai_drv = rtd->codec_dais[i]->driver; 393 389 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) 394 390 codec_stream = &codec_dai_drv->playback; ··· 858 826 for (i = 0; i < rtd->num_codecs; i++) { 859 827 struct snd_soc_dai *codec_dai = rtd->codec_dais[i]; 860 828 struct snd_pcm_hw_params codec_params; 829 + 830 + /* 831 + * Skip CODECs which don't support the current stream type, 832 + * the idea being that if a CODEC is not used for the currently 833 + * set up transfer direction, it should not need to be 834 + * configured, especially since the configuration used might 835 + * not even be supported by that CODEC. There may be cases 836 + * however where a CODEC needs to be set up although it is 837 + * actually not being used for the transfer, e.g. if a 838 + * capture-only CODEC is acting as an LRCLK and/or BCLK master 839 + * for the DAI link including a playback-only CODEC. 840 + * If this becomes necessary, we will have to augment the 841 + * machine driver setup with information on how to act, so 842 + * we can do the right thing here. 843 + */ 844 + if (!snd_soc_dai_stream_valid(codec_dai, substream->stream)) 845 + continue; 861 846 862 847 /* copy params for each codec */ 863 848 codec_params = *params;