[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20221109165331.29332-11-rf@opensource.cirrus.com>
Date: Wed, 9 Nov 2022 16:53:29 +0000
From: Richard Fitzgerald <rf@...nsource.cirrus.com>
To: <lee@...nel.org>, <robh+dt@...nel.org>,
<krzysztof.kozlowski+dt@...aro.org>, <linus.walleij@...aro.org>,
<broonie@...nel.org>, <tglx@...utronix.de>, <maz@...nel.org>
CC: <alsa-devel@...a-project.org>, <devicetree@...r.kernel.org>,
<linux-gpio@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<patches@...nsource.cirrus.com>,
Richard Fitzgerald <rf@...nsource.cirrus.com>
Subject: [PATCH 10/12] ASoC: wm_adsp: Allow client to hook into pre_run callback
Some HALO-based codecs need some additional custom setup in the
pre_run stage of cs_dsp. Implement the callback in wm_adsp to call
an optional codec driver callback.
Signed-off-by: Richard Fitzgerald <rf@...nsource.cirrus.com>
---
sound/soc/codecs/wm_adsp.c | 11 +++++++++++
sound/soc/codecs/wm_adsp.h | 1 +
2 files changed, 12 insertions(+)
diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c
index 8a2e9771bb50..34a94b011518 100644
--- a/sound/soc/codecs/wm_adsp.c
+++ b/sound/soc/codecs/wm_adsp.c
@@ -1035,6 +1035,16 @@ int wm_adsp_early_event(struct snd_soc_dapm_widget *w,
}
EXPORT_SYMBOL_GPL(wm_adsp_early_event);
+static int wm_adsp_pre_run(struct cs_dsp *cs_dsp)
+{
+ struct wm_adsp *dsp = container_of(cs_dsp, struct wm_adsp, cs_dsp);
+
+ if (!dsp->pre_run)
+ return 0;
+
+ return (*dsp->pre_run)(dsp);
+}
+
static int wm_adsp_event_post_run(struct cs_dsp *cs_dsp)
{
struct wm_adsp *dsp = container_of(cs_dsp, struct wm_adsp, cs_dsp);
@@ -2043,6 +2053,7 @@ static const struct cs_dsp_client_ops wm_adsp1_client_ops = {
static const struct cs_dsp_client_ops wm_adsp2_client_ops = {
.control_add = wm_adsp_control_add,
.control_remove = wm_adsp_control_remove,
+ .pre_run = wm_adsp_pre_run,
.post_run = wm_adsp_event_post_run,
.post_stop = wm_adsp_event_post_stop,
.watchdog_expired = wm_adsp_fatal_error,
diff --git a/sound/soc/codecs/wm_adsp.h b/sound/soc/codecs/wm_adsp.h
index 375009a65828..dc2f7a096e26 100644
--- a/sound/soc/codecs/wm_adsp.h
+++ b/sound/soc/codecs/wm_adsp.h
@@ -36,6 +36,7 @@ struct wm_adsp {
int fw;
struct work_struct boot_work;
+ int (*pre_run)(struct wm_adsp *dsp);
bool preloaded;
bool fatal_error;
--
2.30.2
Powered by blists - more mailing lists