[PATCH 6/8] ASoC: audio-graph: let dai_link->init be overridable
luca.ceresoli at bootlin.com
luca.ceresoli at bootlin.com
Wed Sep 7 07:21:22 PDT 2022
From: Luca Ceresoli <luca.ceresoli at bootlin.com>
We can already override dai_link->ops via a custom pointer in
asoc_simple_priv. Do the same for dai_link->init.
This is needed for a card that need to call .set_sysclk multiple times to
initialize more than one clock. The current code does not allow to do it
cleanly.
Signed-off-by: Luca Ceresoli <luca.ceresoli at bootlin.com>
---
include/sound/simple_card_utils.h | 1 +
sound/soc/generic/audio-graph-card.c | 2 ++
2 files changed, 3 insertions(+)
diff --git a/include/sound/simple_card_utils.h b/include/sound/simple_card_utils.h
index a0b827f0c2f6..60dab5f68f5e 100644
--- a/include/sound/simple_card_utils.h
+++ b/include/sound/simple_card_utils.h
@@ -75,6 +75,7 @@ struct asoc_simple_priv {
struct snd_soc_dai_link_component dummy;
struct snd_soc_codec_conf *codec_conf;
struct gpio_desc *pa_gpio;
+ int (*init)(struct snd_soc_pcm_runtime *rtd);
const struct snd_soc_ops *ops;
unsigned int dpcm_selectable:1;
unsigned int force_dpcm:1;
diff --git a/sound/soc/generic/audio-graph-card.c b/sound/soc/generic/audio-graph-card.c
index b327372f2e4a..38c05eb1c650 100644
--- a/sound/soc/generic/audio-graph-card.c
+++ b/sound/soc/generic/audio-graph-card.c
@@ -263,6 +263,8 @@ static int graph_link_init(struct asoc_simple_priv *priv,
dai_link->init = asoc_simple_dai_init;
dai_link->ops = &graph_ops;
+ if (priv->init)
+ dai_link->init = priv->init;
if (priv->ops)
dai_link->ops = priv->ops;
--
2.34.1
More information about the linux-arm-kernel
mailing list