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: mediatek: Use common mtk_afe_pcm_platform with common probe cb

Since the mtk-afe-platform-driver generic mtk_afe_pcm_platform now has
a common .probe() callback, there is no reason to keep duplicating this
function over and over in the SoC specific AFE-PCM drivers: switch over
to register with the common bits instead.

Note that MT8186 was left out of this because it is registering some
extra sinegen controls in the AFE-PCM probe callback and needs extra
cleanups to be able to use the common bits.

Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com>
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20240416071410.75620-13-angelogioacchino.delregno@collabora.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

AngeloGioacchino Del Regno and committed by
Mark Brown
1d2a6b3b 9d9b1828

+7 -102
+1 -13
sound/soc/mediatek/mt6797/mt6797-afe-pcm.c
··· 704 704 return 0; 705 705 } 706 706 707 - static int mt6797_afe_component_probe(struct snd_soc_component *component) 708 - { 709 - return mtk_afe_add_sub_dai_control(component); 710 - } 711 - 712 - static const struct snd_soc_component_driver mt6797_afe_component = { 713 - .name = AFE_PCM_NAME, 714 - .probe = mt6797_afe_component_probe, 715 - .pointer = mtk_afe_pcm_pointer, 716 - .pcm_construct = mtk_afe_pcm_new, 717 - }; 718 - 719 707 static int mt6797_dai_memif_register(struct mtk_base_afe *afe) 720 708 { 721 709 struct mtk_base_afe_dai *dai; ··· 840 852 pm_runtime_get_sync(&pdev->dev); 841 853 842 854 /* register component */ 843 - ret = devm_snd_soc_register_component(dev, &mt6797_afe_component, 855 + ret = devm_snd_soc_register_component(dev, &mtk_afe_pcm_platform, 844 856 NULL, 0); 845 857 if (ret) { 846 858 dev_warn(dev, "err_platform\n");
+1 -13
sound/soc/mediatek/mt7986/mt7986-afe-pcm.c
··· 429 429 return 0; 430 430 } 431 431 432 - static int mt7986_afe_component_probe(struct snd_soc_component *component) 433 - { 434 - return mtk_afe_add_sub_dai_control(component); 435 - } 436 - 437 - static const struct snd_soc_component_driver mt7986_afe_component = { 438 - .name = AFE_PCM_NAME, 439 - .probe = mt7986_afe_component_probe, 440 - .pointer = mtk_afe_pcm_pointer, 441 - .pcm_construct = mtk_afe_pcm_new, 442 - }; 443 - 444 432 static int mt7986_dai_memif_register(struct mtk_base_afe *afe) 445 433 { 446 434 struct mtk_base_afe_dai *dai; ··· 561 573 562 574 /* register component */ 563 575 ret = devm_snd_soc_register_component(&pdev->dev, 564 - &mt7986_afe_component, 576 + &mtk_afe_pcm_platform, 565 577 NULL, 0); 566 578 if (ret) 567 579 return dev_err_probe(dev, ret, "Cannot register AFE component\n");
+1 -13
sound/soc/mediatek/mt8183/mt8183-afe-pcm.c
··· 1042 1042 return 0; 1043 1043 } 1044 1044 1045 - static int mt8183_afe_component_probe(struct snd_soc_component *component) 1046 - { 1047 - return mtk_afe_add_sub_dai_control(component); 1048 - } 1049 - 1050 - static const struct snd_soc_component_driver mt8183_afe_component = { 1051 - .name = AFE_PCM_NAME, 1052 - .probe = mt8183_afe_component_probe, 1053 - .pointer = mtk_afe_pcm_pointer, 1054 - .pcm_construct = mtk_afe_pcm_new, 1055 - }; 1056 - 1057 1045 static int mt8183_dai_memif_register(struct mtk_base_afe *afe) 1058 1046 { 1059 1047 struct mtk_base_afe_dai *dai; ··· 1220 1232 1221 1233 /* register component */ 1222 1234 ret = devm_snd_soc_register_component(&pdev->dev, 1223 - &mt8183_afe_component, 1235 + &mtk_afe_pcm_platform, 1224 1236 NULL, 0); 1225 1237 if (ret) { 1226 1238 dev_warn(dev, "err_platform\n");
+1 -20
sound/soc/mediatek/mt8188/mt8188-afe-pcm.c
··· 3030 3030 return 0; 3031 3031 } 3032 3032 3033 - static int mt8188_afe_component_probe(struct snd_soc_component *component) 3034 - { 3035 - struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component); 3036 - int ret; 3037 - 3038 - snd_soc_component_init_regmap(component, afe->regmap); 3039 - 3040 - ret = mtk_afe_add_sub_dai_control(component); 3041 - 3042 - return ret; 3043 - } 3044 - 3045 - static const struct snd_soc_component_driver mt8188_afe_component = { 3046 - .name = AFE_PCM_NAME, 3047 - .pointer = mtk_afe_pcm_pointer, 3048 - .pcm_construct = mtk_afe_pcm_new, 3049 - .probe = mt8188_afe_component_probe, 3050 - }; 3051 - 3052 3033 static int init_memif_priv_data(struct mtk_base_afe *afe) 3053 3034 { 3054 3035 struct mt8188_afe_private *afe_priv = afe->platform_priv; ··· 3331 3350 } 3332 3351 3333 3352 /* register component */ 3334 - ret = devm_snd_soc_register_component(dev, &mt8188_afe_component, 3353 + ret = devm_snd_soc_register_component(dev, &mtk_afe_pcm_platform, 3335 3354 afe->dai_drivers, afe->num_dai_drivers); 3336 3355 if (ret) { 3337 3356 dev_warn(dev, "err_platform\n");
+2 -23
sound/soc/mediatek/mt8192/mt8192-afe-pcm.c
··· 2125 2125 return 0; 2126 2126 } 2127 2127 2128 - static int mt8192_afe_component_probe(struct snd_soc_component *component) 2129 - { 2130 - return mtk_afe_add_sub_dai_control(component); 2131 - } 2132 - 2133 - static const struct snd_soc_component_driver mt8192_afe_component = { 2134 - .name = AFE_PCM_NAME, 2135 - .probe = mt8192_afe_component_probe, 2136 - .pointer = mtk_afe_pcm_pointer, 2137 - .pcm_construct = mtk_afe_pcm_new, 2138 - }; 2139 - 2140 - static const struct snd_soc_component_driver mt8192_afe_pcm_component = { 2141 - .name = "mt8192-afe-pcm-dai", 2142 - }; 2143 - 2144 2128 static int mt8192_dai_memif_register(struct mtk_base_afe *afe) 2145 2129 { 2146 2130 struct mtk_base_afe_dai *dai; ··· 2286 2302 2287 2303 /* register platform */ 2288 2304 ret = devm_snd_soc_register_component(&pdev->dev, 2289 - &mt8192_afe_component, NULL, 0); 2290 - if (ret) 2291 - return dev_err_probe(dev, ret, "Couldn't register AFE component\n"); 2292 - 2293 - ret = devm_snd_soc_register_component(&pdev->dev, 2294 - &mt8192_afe_pcm_component, 2305 + &mtk_afe_pcm_platform, 2295 2306 afe->dai_drivers, 2296 2307 afe->num_dai_drivers); 2297 2308 if (ret) 2298 - return dev_err_probe(dev, ret, "Couldn't register AFE-PCM component\n"); 2309 + return dev_err_probe(dev, ret, "Couldn't register AFE component\n"); 2299 2310 2300 2311 return 0; 2301 2312 }
+1 -20
sound/soc/mediatek/mt8195/mt8195-afe-pcm.c
··· 2944 2944 return 0; 2945 2945 } 2946 2946 2947 - static int mt8195_afe_component_probe(struct snd_soc_component *component) 2948 - { 2949 - struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component); 2950 - int ret = 0; 2951 - 2952 - snd_soc_component_init_regmap(component, afe->regmap); 2953 - 2954 - ret = mtk_afe_add_sub_dai_control(component); 2955 - 2956 - return ret; 2957 - } 2958 - 2959 - static const struct snd_soc_component_driver mt8195_afe_component = { 2960 - .name = AFE_PCM_NAME, 2961 - .pointer = mtk_afe_pcm_pointer, 2962 - .pcm_construct = mtk_afe_pcm_new, 2963 - .probe = mt8195_afe_component_probe, 2964 - }; 2965 - 2966 2947 static int init_memif_priv_data(struct mtk_base_afe *afe) 2967 2948 { 2968 2949 struct mt8195_afe_private *afe_priv = afe->platform_priv; ··· 3145 3164 } 3146 3165 3147 3166 /* register component */ 3148 - ret = devm_snd_soc_register_component(dev, &mt8195_afe_component, 3167 + ret = devm_snd_soc_register_component(dev, &mtk_afe_pcm_platform, 3149 3168 afe->dai_drivers, afe->num_dai_drivers); 3150 3169 if (ret) { 3151 3170 dev_warn(dev, "err_platform\n");