[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240227120939.290143-16-angelogioacchino.delregno@collabora.com>
Date: Tue, 27 Feb 2024 13:09:32 +0100
From: AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>
To: broonie@...nel.org
Cc: wenst@...omium.org,
lgirdwood@...il.com,
robh@...nel.org,
krzysztof.kozlowski+dt@...aro.org,
conor+dt@...nel.org,
matthias.bgg@...il.com,
perex@...ex.cz,
tiwai@...e.com,
trevor.wu@...iatek.com,
maso.huang@...iatek.com,
xiazhengqiao@...qin.corp-partner.google.com,
arnd@...db.de,
kuninori.morimoto.gx@...esas.com,
shraash@...gle.com,
amergnat@...libre.com,
nicolas.ferre@...rochip.com,
u.kleine-koenig@...gutronix.de,
dianders@...omium.org,
frank.li@...o.com,
allen-kh.cheng@...iatek.com,
eugen.hristev@...labora.com,
claudiu.beznea@...on.dev,
jarkko.nikula@...mer.com,
jiaxin.yu@...iatek.com,
alpernebiyasak@...il.com,
ckeepax@...nsource.cirrus.com,
zhourui@...qin.corp-partner.google.com,
nfraprado@...labora.com,
alsa-devel@...a-project.org,
shane.chien@...iatek.com,
linux-sound@...r.kernel.org,
devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org,
linux-mediatek@...ts.infradead.org,
kernel@...labora.com,
AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>
Subject: [PATCH 15/22] 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.
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>
---
.../mediatek/common/mtk-afe-platform-driver.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
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);
--
2.44.0
Powered by blists - more mailing lists