diff options
author | AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> | 2024-04-16 09:14:03 +0200 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2024-04-16 20:00:02 +0900 |
commit | 9d9b182876a249b393158e9f43c255aeee4ef898 (patch) | |
tree | 5ab4a1245710a1b0132d9d23e4d93b08b4941b2f /sound/soc/mediatek/common | |
parent | f103ce4ff6932b6991e1922d1a39c29971ab2938 (diff) | |
download | linux-stable-9d9b182876a249b393158e9f43c255aeee4ef898.tar.gz linux-stable-9d9b182876a249b393158e9f43c255aeee4ef898.tar.bz2 linux-stable-9d9b182876a249b393158e9f43c255aeee4ef898.zip |
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>
Diffstat (limited to 'sound/soc/mediatek/common')
-rw-r--r-- | sound/soc/mediatek/common/mtk-afe-platform-driver.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/sound/soc/mediatek/common/mtk-afe-platform-driver.c b/sound/soc/mediatek/common/mtk-afe-platform-driver.c index 32edcb6d5219..9b72b2a7ae91 100644 --- a/sound/soc/mediatek/common/mtk-afe-platform-driver.c +++ b/sound/soc/mediatek/common/mtk-afe-platform-driver.c @@ -126,10 +126,28 @@ int mtk_afe_pcm_new(struct snd_soc_component *component, } EXPORT_SYMBOL_GPL(mtk_afe_pcm_new); +static int mtk_afe_component_probe(struct snd_soc_component *component) +{ + struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component); + int ret; + + snd_soc_component_init_regmap(component, afe->regmap); + + /* If the list was never initialized there are no sub-DAIs */ + if (afe->sub_dais.next && afe->sub_dais.prev) { + ret = mtk_afe_add_sub_dai_control(component); + if (ret) + return ret; + } + + return 0; +} + const struct snd_soc_component_driver mtk_afe_pcm_platform = { .name = AFE_PCM_NAME, .pointer = mtk_afe_pcm_pointer, .pcm_construct = mtk_afe_pcm_new, + .probe = mtk_afe_component_probe, }; EXPORT_SYMBOL_GPL(mtk_afe_pcm_platform); |