From: Richard Fitzgerald <rf@opensource.cirrus.com>
To: <broonie@kernel.org>, <tiwai@suse.com>
Cc: <linux-sound@vger.kernel.org>, <alsa-devel@alsa-project.org>,
<linux-kernel@vger.kernel.org>, <patches@opensource.cirrus.com>,
"Richard Fitzgerald" <rf@opensource.cirrus.com>
Subject: [PATCH 3/9] ASoC: wm_adsp: Add wm_adsp_start() and wm_adsp_stop()
Date: Wed, 21 Feb 2024 15:05:01 +0000 [thread overview]
Message-ID: <20240221150507.1039979-4-rf@opensource.cirrus.com> (raw)
In-Reply-To: <20240221150507.1039979-1-rf@opensource.cirrus.com>
Separate the functionality of wm_adsp_event() into two exported
functions wm_adsp_start() and wm_adsp_stop().
This allows the codec driver to start and stop the DSP outside of a
DAPM widget.
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
---
sound/soc/codecs/wm_adsp.c | 27 ++++++++++++++++++---------
sound/soc/codecs/wm_adsp.h | 2 ++
2 files changed, 20 insertions(+), 9 deletions(-)
diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c
index 9cb9068c0462..7d5c096e06cd 100644
--- a/sound/soc/codecs/wm_adsp.c
+++ b/sound/soc/codecs/wm_adsp.c
@@ -1093,27 +1093,36 @@ static void wm_adsp_event_post_stop(struct cs_dsp *cs_dsp)
dsp->fatal_error = false;
}
+int wm_adsp_run(struct wm_adsp *dsp)
+{
+ flush_work(&dsp->boot_work);
+
+ return cs_dsp_run(&dsp->cs_dsp);
+}
+EXPORT_SYMBOL_GPL(wm_adsp_run);
+
+void wm_adsp_stop(struct wm_adsp *dsp)
+{
+ cs_dsp_stop(&dsp->cs_dsp);
+}
+EXPORT_SYMBOL_GPL(wm_adsp_stop);
+
int wm_adsp_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
struct wm_adsp *dsps = snd_soc_component_get_drvdata(component);
struct wm_adsp *dsp = &dsps[w->shift];
- int ret = 0;
switch (event) {
case SND_SOC_DAPM_POST_PMU:
- flush_work(&dsp->boot_work);
- ret = cs_dsp_run(&dsp->cs_dsp);
- break;
+ return wm_adsp_run(dsp);
case SND_SOC_DAPM_PRE_PMD:
- cs_dsp_stop(&dsp->cs_dsp);
- break;
+ wm_adsp_stop(dsp);
+ return 0;
default:
- break;
+ return 0;
}
-
- return ret;
}
EXPORT_SYMBOL_GPL(wm_adsp_event);
diff --git a/sound/soc/codecs/wm_adsp.h b/sound/soc/codecs/wm_adsp.h
index 067d807a7ca8..e53dfcf1f78f 100644
--- a/sound/soc/codecs/wm_adsp.h
+++ b/sound/soc/codecs/wm_adsp.h
@@ -98,6 +98,8 @@ irqreturn_t wm_adsp2_bus_error(int irq, void *data);
irqreturn_t wm_halo_bus_error(int irq, void *data);
irqreturn_t wm_halo_wdt_expire(int irq, void *data);
+int wm_adsp_run(struct wm_adsp *dsp);
+void wm_adsp_stop(struct wm_adsp *dsp);
int wm_adsp_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event);
--
2.30.2
next prev parent reply other threads:[~2024-02-21 15:05 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-21 15:04 [PATCH 0/9] ALSA: cs35l56: Apply calibration from EFI Richard Fitzgerald
2024-02-21 15:04 ` [PATCH 1/9] ASoC: wm_adsp: Fix missing mutex_lock in wm_adsp_write_ctl() Richard Fitzgerald
2024-02-21 15:05 ` [PATCH 2/9] ALSA: hda: hda_cs_dsp_ctl: Only call notify when a control has been added to a card Richard Fitzgerald
2024-02-21 15:05 ` Richard Fitzgerald [this message]
2024-02-21 15:05 ` [PATCH 4/9] ASoC: cs-amp-lib: Add helpers for factory calibration data Richard Fitzgerald
2024-02-21 15:05 ` [PATCH 5/9] ASoC: cs35l56: Add helper functions for amp calibration Richard Fitzgerald
2024-02-21 15:05 ` [PATCH 6/9] ASoC: cs35l56: Apply amp calibration from EFI data Richard Fitzgerald
2024-02-21 15:05 ` [PATCH 7/9] ALSA: hda: hda_cs_dsp_ctl: Add helper function to write calibration Richard Fitzgerald
2024-02-21 15:05 ` [PATCH 8/9] ALSA: hda: cs35l56: Apply amp calibration from EFI data Richard Fitzgerald
2024-02-21 15:05 ` [PATCH 9/9] ASoC: cs-amp-lib: Add KUnit test for calibration helpers Richard Fitzgerald
2024-02-27 3:14 ` kernel test robot
2024-02-22 9:03 ` [PATCH 0/9] ALSA: cs35l56: Apply calibration from EFI Takashi Iwai
2024-02-22 14:40 ` Richard Fitzgerald
2024-02-26 16:42 ` Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240221150507.1039979-4-rf@opensource.cirrus.com \
--to=rf@opensource.cirrus.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=patches@opensource.cirrus.com \
--cc=tiwai@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox