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: Harden DAPM route checks and Intel fixes

Merge series from Cezary Rojewski <cezary.rojewski@intel.com>:

Set of loosely connected patches. Most impactful change is dropping any
permisiveness when snd_soc_dapm_add_routes() fails in soc-topology.c To
do it safely, disable route checks for all skylake-driver boards.

Relevant background:

Since commit daa480bde6b3 ("ASoC: soc-core: tidyup for
snd_soc_dapm_add_routes()") route checks are no longer permissive. Probe
failures for Intel boards have been partially addressed by commit
a22ae72b86a4 ("ASoC: soc-core: isable route checks for legacy devices")
and its follow up but only skl_nau88l25_ssm4567.c is patched. The rest
of the boards still need fixing.

After that, removal of copy-pastas found in ssm4567.c and redundant code
in i2s_test.c for avs-boards.

Changes in v2:
- glk_rt5682_max98357a.c and skl_hda_dsp_generic.c now disable route
checks only for the skylake-drvier
- asoc now logs failures of snd_soc_dapm_add_routes() in soc-topology.c

Amadeusz Sławiński (1):
ASoC: Intel: avs: i2s_test: Remove redundant dapm routes

Cezary Rojewski (4):
ASoC: Intel: Disable route checks for Skylake boards
ASoC: topology: Do not ignore route checks when parsing graphs
ASoC: Intel: avs: ssm4567: Do not ignore route checks
ASoC: Intel: avs: ssm4567: Board cleanup

sound/soc/intel/avs/boards/i2s_test.c | 79 -------------------
sound/soc/intel/avs/boards/ssm4567.c | 5 +-
sound/soc/intel/boards/bxt_da7219_max98357a.c | 1 +
sound/soc/intel/boards/bxt_rt298.c | 1 +
sound/soc/intel/boards/glk_rt5682_max98357a.c | 2 +
sound/soc/intel/boards/kbl_da7219_max98357a.c | 1 +
sound/soc/intel/boards/kbl_da7219_max98927.c | 4 +
sound/soc/intel/boards/kbl_rt5660.c | 1 +
sound/soc/intel/boards/kbl_rt5663_max98927.c | 2 +
.../intel/boards/kbl_rt5663_rt5514_max98927.c | 1 +
sound/soc/intel/boards/skl_hda_dsp_generic.c | 2 +
.../soc/intel/boards/skl_nau88l25_max98357a.c | 1 +
sound/soc/intel/boards/skl_rt286.c | 1 +
sound/soc/soc-topology.c | 11 ++-
14 files changed, 27 insertions(+), 85 deletions(-)

--
2.25.1

+27 -85
-79
sound/soc/intel/avs/boards/i2s_test.c
··· 54 54 return 0; 55 55 } 56 56 57 - static int avs_create_dapm_routes(struct device *dev, int ssp_port, int tdm_slot, 58 - struct snd_soc_dapm_route **routes, int *num_routes) 59 - { 60 - struct snd_soc_dapm_route *dr; 61 - const int num_dr = 2; 62 - 63 - dr = devm_kcalloc(dev, num_dr, sizeof(*dr), GFP_KERNEL); 64 - if (!dr) 65 - return -ENOMEM; 66 - 67 - dr[0].sink = devm_kasprintf(dev, GFP_KERNEL, 68 - AVS_STRING_FMT("ssp", "pb", ssp_port, tdm_slot)); 69 - dr[0].source = devm_kasprintf(dev, GFP_KERNEL, 70 - AVS_STRING_FMT("ssp", " Tx", ssp_port, tdm_slot)); 71 - if (!dr[0].sink || !dr[0].source) 72 - return -ENOMEM; 73 - 74 - dr[1].sink = devm_kasprintf(dev, GFP_KERNEL, 75 - AVS_STRING_FMT("ssp", " Rx", ssp_port, tdm_slot)); 76 - dr[1].source = devm_kasprintf(dev, GFP_KERNEL, 77 - AVS_STRING_FMT("ssp", "cp", ssp_port, tdm_slot)); 78 - if (!dr[1].sink || !dr[1].source) 79 - return -ENOMEM; 80 - 81 - *routes = dr; 82 - *num_routes = num_dr; 83 - 84 - return 0; 85 - } 86 - 87 - static int avs_create_dapm_widgets(struct device *dev, int ssp_port, int tdm_slot, 88 - struct snd_soc_dapm_widget **widgets, int *num_widgets) 89 - { 90 - struct snd_soc_dapm_widget *dw; 91 - const int num_dw = 2; 92 - 93 - dw = devm_kcalloc(dev, num_dw, sizeof(*dw), GFP_KERNEL); 94 - if (!dw) 95 - return -ENOMEM; 96 - 97 - dw[0].id = snd_soc_dapm_hp; 98 - dw[0].reg = SND_SOC_NOPM; 99 - dw[0].name = devm_kasprintf(dev, GFP_KERNEL, 100 - AVS_STRING_FMT("ssp", "pb", ssp_port, tdm_slot)); 101 - if (!dw[0].name) 102 - return -ENOMEM; 103 - 104 - dw[1].id = snd_soc_dapm_mic; 105 - dw[1].reg = SND_SOC_NOPM; 106 - dw[1].name = devm_kasprintf(dev, GFP_KERNEL, 107 - AVS_STRING_FMT("ssp", "cp", ssp_port, tdm_slot)); 108 - if (!dw[1].name) 109 - return -ENOMEM; 110 - 111 - *widgets = dw; 112 - *num_widgets = num_dw; 113 - 114 - return 0; 115 - } 116 - 117 57 static int avs_i2s_test_probe(struct platform_device *pdev) 118 58 { 119 - struct snd_soc_dapm_widget *widgets; 120 - struct snd_soc_dapm_route *routes; 121 59 struct snd_soc_dai_link *dai_link; 122 60 struct snd_soc_acpi_mach *mach; 123 61 struct snd_soc_card *card; 124 62 struct device *dev = &pdev->dev; 125 63 const char *pname; 126 - int num_routes, num_widgets; 127 64 int ssp_port, tdm_slot, ret; 128 65 129 66 mach = dev_get_platdata(dev); ··· 93 156 return ret; 94 157 } 95 158 96 - ret = avs_create_dapm_routes(dev, ssp_port, tdm_slot, &routes, &num_routes); 97 - if (ret) { 98 - dev_err(dev, "Failed to create dapm routes: %d\n", ret); 99 - return ret; 100 - } 101 - 102 - ret = avs_create_dapm_widgets(dev, ssp_port, tdm_slot, &widgets, &num_widgets); 103 - if (ret) { 104 - dev_err(dev, "Failed to create dapm widgets: %d\n", ret); 105 - return ret; 106 - } 107 - 108 159 card->dev = dev; 109 160 card->owner = THIS_MODULE; 110 161 card->dai_link = dai_link; 111 162 card->num_links = 1; 112 - card->dapm_routes = routes; 113 - card->num_dapm_routes = num_routes; 114 - card->dapm_widgets = widgets; 115 - card->num_dapm_widgets = num_widgets; 116 163 card->fully_routed = true; 117 164 118 165 ret = snd_soc_fixup_dai_links_platform_name(card, pname);
+1 -4
sound/soc/intel/avs/boards/ssm4567.c
··· 37 37 static const struct snd_soc_dapm_widget card_widgets[] = { 38 38 SND_SOC_DAPM_SPK("Left Speaker", NULL), 39 39 SND_SOC_DAPM_SPK("Right Speaker", NULL), 40 - SND_SOC_DAPM_SPK("DP1", NULL), 41 - SND_SOC_DAPM_SPK("DP2", NULL), 42 40 }; 43 41 44 42 static const struct snd_soc_dapm_route card_base_routes[] = { ··· 156 158 if (!card) 157 159 return -ENOMEM; 158 160 159 - card->name = "avs_ssm4567-adi"; 161 + card->name = "avs_ssm4567"; 160 162 card->dev = dev; 161 163 card->owner = THIS_MODULE; 162 164 card->dai_link = dai_link; ··· 170 172 card->dapm_routes = card_base_routes; 171 173 card->num_dapm_routes = ARRAY_SIZE(card_base_routes); 172 174 card->fully_routed = true; 173 - card->disable_route_checks = true; 174 175 175 176 ret = snd_soc_fixup_dai_links_platform_name(card, pname); 176 177 if (ret)
+1
sound/soc/intel/boards/bxt_da7219_max98357a.c
··· 768 768 .dapm_routes = audio_map, 769 769 .num_dapm_routes = ARRAY_SIZE(audio_map), 770 770 .fully_routed = true, 771 + .disable_route_checks = true, 771 772 .late_probe = bxt_card_late_probe, 772 773 }; 773 774
+1
sound/soc/intel/boards/bxt_rt298.c
··· 574 574 .dapm_routes = broxton_rt298_map, 575 575 .num_dapm_routes = ARRAY_SIZE(broxton_rt298_map), 576 576 .fully_routed = true, 577 + .disable_route_checks = true, 577 578 .late_probe = bxt_card_late_probe, 578 579 579 580 };
+2
sound/soc/intel/boards/glk_rt5682_max98357a.c
··· 649 649 card = &glk_audio_card_rt5682_m98357a; 650 650 card->dev = &pdev->dev; 651 651 snd_soc_card_set_drvdata(card, ctx); 652 + if (!snd_soc_acpi_sof_parent(&pdev->dev)) 653 + card->disable_route_checks = true; 652 654 653 655 /* override platform name, if required */ 654 656 mach = pdev->dev.platform_data;
+1
sound/soc/intel/boards/kbl_da7219_max98357a.c
··· 639 639 .dapm_routes = kabylake_map, 640 640 .num_dapm_routes = ARRAY_SIZE(kabylake_map), 641 641 .fully_routed = true, 642 + .disable_route_checks = true, 642 643 .late_probe = kabylake_card_late_probe, 643 644 }; 644 645
+4
sound/soc/intel/boards/kbl_da7219_max98927.c
··· 1036 1036 .codec_conf = max98927_codec_conf, 1037 1037 .num_configs = ARRAY_SIZE(max98927_codec_conf), 1038 1038 .fully_routed = true, 1039 + .disable_route_checks = true, 1039 1040 .late_probe = kabylake_card_late_probe, 1040 1041 }; 1041 1042 ··· 1055 1054 .codec_conf = max98927_codec_conf, 1056 1055 .num_configs = ARRAY_SIZE(max98927_codec_conf), 1057 1056 .fully_routed = true, 1057 + .disable_route_checks = true, 1058 1058 .late_probe = kabylake_card_late_probe, 1059 1059 }; 1060 1060 ··· 1073 1071 .codec_conf = max98373_codec_conf, 1074 1072 .num_configs = ARRAY_SIZE(max98373_codec_conf), 1075 1073 .fully_routed = true, 1074 + .disable_route_checks = true, 1076 1075 .late_probe = kabylake_card_late_probe, 1077 1076 }; 1078 1077 ··· 1091 1088 .codec_conf = max98373_codec_conf, 1092 1089 .num_configs = ARRAY_SIZE(max98373_codec_conf), 1093 1090 .fully_routed = true, 1091 + .disable_route_checks = true, 1094 1092 .late_probe = kabylake_card_late_probe, 1095 1093 }; 1096 1094
+1
sound/soc/intel/boards/kbl_rt5660.c
··· 518 518 .dapm_routes = kabylake_rt5660_map, 519 519 .num_dapm_routes = ARRAY_SIZE(kabylake_rt5660_map), 520 520 .fully_routed = true, 521 + .disable_route_checks = true, 521 522 .late_probe = kabylake_card_late_probe, 522 523 }; 523 524
+2
sound/soc/intel/boards/kbl_rt5663_max98927.c
··· 966 966 .codec_conf = max98927_codec_conf, 967 967 .num_configs = ARRAY_SIZE(max98927_codec_conf), 968 968 .fully_routed = true, 969 + .disable_route_checks = true, 969 970 .late_probe = kabylake_card_late_probe, 970 971 }; 971 972 ··· 983 982 .dapm_routes = kabylake_5663_map, 984 983 .num_dapm_routes = ARRAY_SIZE(kabylake_5663_map), 985 984 .fully_routed = true, 985 + .disable_route_checks = true, 986 986 .late_probe = kabylake_card_late_probe, 987 987 }; 988 988
+1
sound/soc/intel/boards/kbl_rt5663_rt5514_max98927.c
··· 791 791 .codec_conf = max98927_codec_conf, 792 792 .num_configs = ARRAY_SIZE(max98927_codec_conf), 793 793 .fully_routed = true, 794 + .disable_route_checks = true, 794 795 .late_probe = kabylake_card_late_probe, 795 796 }; 796 797
+2
sound/soc/intel/boards/skl_hda_dsp_generic.c
··· 227 227 ctx->common_hdmi_codec_drv = mach->mach_params.common_hdmi_codec_drv; 228 228 229 229 hda_soc_card.dev = &pdev->dev; 230 + if (!snd_soc_acpi_sof_parent(&pdev->dev)) 231 + hda_soc_card.disable_route_checks = true; 230 232 231 233 if (mach->mach_params.dmic_num > 0) { 232 234 snprintf(hda_soc_components, sizeof(hda_soc_components),
+1
sound/soc/intel/boards/skl_nau88l25_max98357a.c
··· 654 654 .dapm_routes = skylake_map, 655 655 .num_dapm_routes = ARRAY_SIZE(skylake_map), 656 656 .fully_routed = true, 657 + .disable_route_checks = true, 657 658 .late_probe = skylake_card_late_probe, 658 659 }; 659 660
+1
sound/soc/intel/boards/skl_rt286.c
··· 523 523 .dapm_routes = skylake_rt286_map, 524 524 .num_dapm_routes = ARRAY_SIZE(skylake_rt286_map), 525 525 .fully_routed = true, 526 + .disable_route_checks = true, 526 527 .late_probe = skylake_card_late_probe, 527 528 }; 528 529
+9 -2
sound/soc/soc-topology.c
··· 1083 1083 break; 1084 1084 } 1085 1085 1086 - /* add route, but keep going if some fail */ 1087 - snd_soc_dapm_add_routes(dapm, route, 1); 1086 + ret = snd_soc_dapm_add_routes(dapm, route, 1); 1087 + if (ret) { 1088 + if (!dapm->card->disable_route_checks) { 1089 + dev_err(tplg->dev, "ASoC: dapm_add_routes failed: %d\n", ret); 1090 + break; 1091 + } 1092 + dev_info(tplg->dev, 1093 + "ASoC: disable_route_checks set, ignoring dapm_add_routes errors\n"); 1094 + } 1088 1095 } 1089 1096 1090 1097 return ret;