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: Add common mtk_afe_component_probe callback

Multiple MediaTek AFE PCM component drivers are using their own .probe()
callback, but most of those are simply duplicated functions as they are
doing exactly the same thing over and over.

Add a common probe callback for this component to reduce duplication.

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-12-angelogioacchino.delregno@collabora.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

AngeloGioacchino Del Regno and committed by
Mark Brown
9d9b1828 f103ce4f

+18
+18
sound/soc/mediatek/common/mtk-afe-platform-driver.c
··· 126 126 } 127 127 EXPORT_SYMBOL_GPL(mtk_afe_pcm_new); 128 128 129 + static int mtk_afe_component_probe(struct snd_soc_component *component) 130 + { 131 + struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component); 132 + int ret; 133 + 134 + snd_soc_component_init_regmap(component, afe->regmap); 135 + 136 + /* If the list was never initialized there are no sub-DAIs */ 137 + if (afe->sub_dais.next && afe->sub_dais.prev) { 138 + ret = mtk_afe_add_sub_dai_control(component); 139 + if (ret) 140 + return ret; 141 + } 142 + 143 + return 0; 144 + } 145 + 129 146 const struct snd_soc_component_driver mtk_afe_pcm_platform = { 130 147 .name = AFE_PCM_NAME, 131 148 .pointer = mtk_afe_pcm_pointer, 132 149 .pcm_construct = mtk_afe_pcm_new, 150 + .probe = mtk_afe_component_probe, 133 151 }; 134 152 EXPORT_SYMBOL_GPL(mtk_afe_pcm_platform); 135 153