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: grace time for DPCM cleanup

Merge series from Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>:

As we discussed in [1], we don't need to use dpcm_playback/capture flag,
so we remove it. But we have been using it for 10 years, some driver might
get damage. The most likely case is that the device/driver can use both
playback/capture, but have only one flag, and not using xxx_only flag.
[1/3] patch indicates warning in such case.

These adds grace time for DPCM cleanup.
I'm not sure when dpcm_xxx will be removed, and Codec check bypass will be
error, but maybe v6.12 or v6.13 ?
Please check each driver by that time.

Previous patch-set try to check both CPU and Codec in DPCM, but we noticed
that there are some special DAI which we can't handle today [2]. So I will
escape it in this patch-set.

[1] https://lore.kernel.org/r/87edaym2cg.wl-kuninori.morimoto.gx@renesas.com
[2] https://lore.kernel.org/all/3e67d62d-fe08-4f55-ab5b-ece8a57154f9@linux.intel.com/

Link: https://lore.kernel.org/r/87edaym2cg.wl-kuninori.morimoto.gx@renesas.com
Link: https://lore.kernel.org/r/87wmo6dyxg.wl-kuninori.morimoto.gx@renesas.com
Link: https://lore.kernel.org/r/87msole5wc.wl-kuninori.morimoto.gx@renesas.com
Link: https://lore.kernel.org/r/871q5tnuok.wl-kuninori.morimoto.gx@renesas.com
Link: https://lore.kernel.org/r/87bk4oqerx.wl-kuninori.morimoto.gx@renesas.com
Link: https://lore.kernel.org/r/8734pctmte.wl-kuninori.morimoto.gx@renesas.com
Link: https://lore.kernel.org/r/87r0ctwzr4.wl-kuninori.morimoto.gx@renesas.com
Link: https://lore.kernel.org/r/87cymvlmki.wl-kuninori.morimoto.gx@renesas.com

+47 -88
-1
include/sound/soc-dai.h
··· 219 219 int snd_soc_dai_compress_new(struct snd_soc_dai *dai, 220 220 struct snd_soc_pcm_runtime *rtd, int num); 221 221 bool snd_soc_dai_stream_valid(const struct snd_soc_dai *dai, int stream); 222 - void snd_soc_dai_link_set_capabilities(struct snd_soc_dai_link *dai_link); 223 222 void snd_soc_dai_action(struct snd_soc_dai *dai, 224 223 int stream, int action); 225 224 static inline void snd_soc_dai_activate(struct snd_soc_dai *dai,
+1
include/sound/soc.h
··· 815 815 /* This DAI link can route to other DAI links at runtime (Frontend)*/ 816 816 unsigned int dynamic:1; 817 817 818 + /* REMOVE ME */ 818 819 /* DPCM capture and Playback support */ 819 820 unsigned int dpcm_capture:1; 820 821 unsigned int dpcm_playback:1;
-3
sound/soc/fsl/imx-card.c
··· 650 650 link->ops = &imx_aif_ops; 651 651 } 652 652 653 - if (link->no_pcm || link->dynamic) 654 - snd_soc_dai_link_set_capabilities(link); 655 - 656 653 /* Get dai fmt */ 657 654 ret = simple_util_parse_daifmt(dev, np, codec, 658 655 NULL, &link->dai_fmt);
-2
sound/soc/generic/audio-graph-card.c
··· 279 279 280 280 graph_parse_convert(dev, ep, &dai_props->adata); 281 281 282 - snd_soc_dai_link_set_capabilities(dai_link); 283 - 284 282 ret = graph_link_init(priv, cpu_ep, codec_ep, li, dai_name); 285 283 286 284 li->link++;
-2
sound/soc/generic/audio-graph-card2.c
··· 966 966 graph_parse_convert(ep, dai_props); /* at node of <dpcm> */ 967 967 graph_parse_convert(rep, dai_props); /* at node of <CPU/Codec> */ 968 968 969 - snd_soc_dai_link_set_capabilities(dai_link); 970 - 971 969 graph_link_init(priv, lnk, cpu_port, codec_port, li, is_cpu); 972 970 err: 973 971 of_node_put(ep);
-2
sound/soc/generic/simple-card.c
··· 291 291 292 292 simple_parse_convert(dev, np, &dai_props->adata); 293 293 294 - snd_soc_dai_link_set_capabilities(dai_link); 295 - 296 294 ret = simple_link_init(priv, np, codec, li, prefix, dai_name); 297 295 298 296 out_put_node:
+5 -6
sound/soc/meson/axg-card.c
··· 132 132 lb->stream_name = lb->name; 133 133 lb->cpus->of_node = pad->cpus->of_node; 134 134 lb->cpus->dai_name = "TDM Loopback"; 135 - lb->dpcm_capture = 1; 135 + lb->capture_only = 1; 136 136 lb->no_pcm = 1; 137 137 lb->ops = &axg_card_tdm_be_ops; 138 138 lb->init = axg_card_tdm_dai_lb_init; ··· 176 176 177 177 /* Disable playback is the interface has no tx slots */ 178 178 if (!tx) 179 - link->dpcm_playback = 0; 179 + link->capture_only = 1; 180 180 181 181 for (i = 0, rx = 0; i < AXG_TDM_NUM_LANES; i++) { 182 182 snprintf(propname, 32, "dai-tdm-slot-rx-mask-%d", i); ··· 186 186 187 187 /* Disable capture is the interface has no rx slots */ 188 188 if (!rx) 189 - link->dpcm_capture = 0; 189 + link->playback_only = 1; 190 190 191 - /* ... but the interface should at least have one of them */ 191 + /* ... but the interface should at least have one direction */ 192 192 if (!tx && !rx) { 193 193 dev_err(card->dev, "tdm link has no cpu slots\n"); 194 194 return -EINVAL; ··· 275 275 return ret; 276 276 277 277 /* Add loopback if the pad dai has playback */ 278 - if (link->dpcm_playback) { 278 + if (!link->capture_only) { 279 279 ret = axg_card_add_tdm_loopback(card, index); 280 280 if (ret) 281 281 return ret; ··· 339 339 dai_link->num_c2c_params = 1; 340 340 } else { 341 341 dai_link->no_pcm = 1; 342 - snd_soc_dai_link_set_capabilities(dai_link); 343 342 if (axg_card_cpu_is_tdm_iface(dai_link->cpus->of_node)) 344 343 ret = axg_card_parse_tdm(card, np, index); 345 344 }
-1
sound/soc/meson/gx-card.c
··· 107 107 dai_link->num_c2c_params = 1; 108 108 } else { 109 109 dai_link->no_pcm = 1; 110 - snd_soc_dai_link_set_capabilities(dai_link); 111 110 /* Check if the cpu is the i2s encoder and parse i2s data */ 112 111 if (gx_card_cpu_identify(dai_link->cpus, "I2S Encoder")) 113 112 ret = gx_card_parse_i2s(card, np, index);
+2 -2
sound/soc/meson/meson-card-utils.c
··· 186 186 link->dpcm_merged_rate = 1; 187 187 188 188 if (is_playback) 189 - link->dpcm_playback = 1; 189 + link->playback_only = 1; 190 190 else 191 - link->dpcm_capture = 1; 191 + link->capture_only = 1; 192 192 193 193 return meson_card_set_link_name(card, link, node, "fe"); 194 194 }
-1
sound/soc/qcom/common.c
··· 155 155 156 156 if (platform || !codec) { 157 157 /* DPCM */ 158 - snd_soc_dai_link_set_capabilities(link); 159 158 link->ignore_suspend = 1; 160 159 link->nonatomic = 1; 161 160 }
+2 -2
sound/soc/sdw_utils/soc_sdw_utils.c
··· 950 950 dai_links->num_cpus = cpus_num; 951 951 dai_links->codecs = codecs; 952 952 dai_links->num_codecs = codecs_num; 953 - dai_links->dpcm_playback = playback; 954 - dai_links->dpcm_capture = capture; 953 + dai_links->playback_only = playback && !capture; 954 + dai_links->capture_only = !playback && capture; 955 955 dai_links->init = init; 956 956 dai_links->ops = ops; 957 957 }
-38
sound/soc/soc-dai.c
··· 479 479 return stream->channels_min; 480 480 } 481 481 482 - /* 483 - * snd_soc_dai_link_set_capabilities() - set dai_link properties based on its DAIs 484 - */ 485 - void snd_soc_dai_link_set_capabilities(struct snd_soc_dai_link *dai_link) 486 - { 487 - bool supported[SNDRV_PCM_STREAM_LAST + 1]; 488 - int direction; 489 - 490 - for_each_pcm_streams(direction) { 491 - struct snd_soc_dai_link_component *cpu; 492 - struct snd_soc_dai_link_component *codec; 493 - struct snd_soc_dai *dai; 494 - bool supported_cpu = false; 495 - bool supported_codec = false; 496 - int i; 497 - 498 - for_each_link_cpus(dai_link, i, cpu) { 499 - dai = snd_soc_find_dai_with_mutex(cpu); 500 - if (dai && snd_soc_dai_stream_valid(dai, direction)) { 501 - supported_cpu = true; 502 - break; 503 - } 504 - } 505 - for_each_link_codecs(dai_link, i, codec) { 506 - dai = snd_soc_find_dai_with_mutex(codec); 507 - if (dai && snd_soc_dai_stream_valid(dai, direction)) { 508 - supported_codec = true; 509 - break; 510 - } 511 - } 512 - supported[direction] = supported_cpu && supported_codec; 513 - } 514 - 515 - dai_link->dpcm_playback = supported[SNDRV_PCM_STREAM_PLAYBACK]; 516 - dai_link->dpcm_capture = supported[SNDRV_PCM_STREAM_CAPTURE]; 517 - } 518 - EXPORT_SYMBOL_GPL(snd_soc_dai_link_set_capabilities); 519 - 520 482 void snd_soc_dai_action(struct snd_soc_dai *dai, 521 483 int stream, int action) 522 484 {
+37 -28
sound/soc/soc-pcm.c
··· 2739 2739 { 2740 2740 struct snd_soc_dai_link *dai_link = rtd->dai_link; 2741 2741 struct snd_soc_dai *cpu_dai; 2742 + struct snd_soc_dai_link_ch_map *ch_maps; 2742 2743 int has_playback = 0; 2743 2744 int has_capture = 0; 2744 2745 int i; ··· 2750 2749 } 2751 2750 2752 2751 if (dai_link->dynamic || dai_link->no_pcm) { 2753 - int stream; 2754 2752 2755 - if (dai_link->dpcm_playback) { 2756 - stream = SNDRV_PCM_STREAM_PLAYBACK; 2753 + for_each_rtd_ch_maps(rtd, i, ch_maps) { 2754 + cpu_dai = snd_soc_rtd_to_cpu(rtd, ch_maps->cpu); 2757 2755 2758 - for_each_rtd_cpu_dais(rtd, i, cpu_dai) { 2759 - if (snd_soc_dai_stream_valid(cpu_dai, stream)) { 2760 - has_playback = 1; 2761 - break; 2762 - } 2763 - } 2764 - if (!has_playback) { 2765 - dev_err(rtd->card->dev, 2766 - "No CPU DAIs support playback for stream %s\n", 2767 - dai_link->stream_name); 2768 - return -EINVAL; 2769 - } 2756 + if (snd_soc_dai_stream_valid(cpu_dai, SNDRV_PCM_STREAM_PLAYBACK)) 2757 + has_playback = 1; 2758 + 2759 + if (snd_soc_dai_stream_valid(cpu_dai, SNDRV_PCM_STREAM_CAPTURE)) 2760 + has_capture = 1; 2770 2761 } 2771 - if (dai_link->dpcm_capture) { 2772 - stream = SNDRV_PCM_STREAM_CAPTURE; 2773 2762 2774 - for_each_rtd_cpu_dais(rtd, i, cpu_dai) { 2775 - if (snd_soc_dai_stream_valid(cpu_dai, stream)) { 2776 - has_capture = 1; 2777 - break; 2778 - } 2763 + /* 2764 + * REMOVE ME 2765 + * 2766 + * dpcm_xxx flag will be removed soon, Indicates warning if dpcm_xxx flag was used 2767 + * as availability limitation 2768 + */ 2769 + if (has_playback && has_capture) { 2770 + if ( dai_link->dpcm_playback && 2771 + !dai_link->dpcm_capture && 2772 + !dai_link->playback_only) { 2773 + dev_warn(rtd->card->dev, 2774 + "both playback/capture are available," 2775 + " but not using playback_only flag (%s)\n", 2776 + dai_link->stream_name); 2777 + dev_warn(rtd->card->dev, 2778 + "dpcm_playback/capture are no longer needed," 2779 + " please use playback/capture_only instead\n"); 2780 + has_capture = 0; 2779 2781 } 2780 2782 2781 - if (!has_capture) { 2782 - dev_err(rtd->card->dev, 2783 - "No CPU DAIs support capture for stream %s\n", 2784 - dai_link->stream_name); 2785 - return -EINVAL; 2783 + if (!dai_link->dpcm_playback && 2784 + dai_link->dpcm_capture && 2785 + !dai_link->capture_only) { 2786 + dev_warn(rtd->card->dev, 2787 + "both playback/capture are available," 2788 + " but not using capture_only flag (%s)\n", 2789 + dai_link->stream_name); 2790 + dev_warn(rtd->card->dev, 2791 + "dpcm_playback/capture are no longer needed," 2792 + " please use playback/capture_only instead\n"); 2793 + has_playback = 0; 2786 2794 } 2787 2795 } 2788 2796 } else { 2789 - struct snd_soc_dai_link_ch_map *ch_maps; 2790 2797 struct snd_soc_dai *codec_dai; 2791 2798 2792 2799 /* Adapt stream for codec2codec links */