Skip to content

Commit 5519ac3

Browse files
rfvirgilbroonie
authored andcommitted
ASoC: wm_adsp: Add wm_adsp_start() and wm_adsp_stop()
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent b401b62 commit 5519ac3

File tree

2 files changed

+20
-9
lines changed

2 files changed

+20
-9
lines changed

sound/soc/codecs/wm_adsp.c

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1092,27 +1092,36 @@ static void wm_adsp_event_post_stop(struct cs_dsp *cs_dsp)
10921092
dsp->fatal_error = false;
10931093
}
10941094

1095+
int wm_adsp_run(struct wm_adsp *dsp)
1096+
{
1097+
flush_work(&dsp->boot_work);
1098+
1099+
return cs_dsp_run(&dsp->cs_dsp);
1100+
}
1101+
EXPORT_SYMBOL_GPL(wm_adsp_run);
1102+
1103+
void wm_adsp_stop(struct wm_adsp *dsp)
1104+
{
1105+
cs_dsp_stop(&dsp->cs_dsp);
1106+
}
1107+
EXPORT_SYMBOL_GPL(wm_adsp_stop);
1108+
10951109
int wm_adsp_event(struct snd_soc_dapm_widget *w,
10961110
struct snd_kcontrol *kcontrol, int event)
10971111
{
10981112
struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
10991113
struct wm_adsp *dsps = snd_soc_component_get_drvdata(component);
11001114
struct wm_adsp *dsp = &dsps[w->shift];
1101-
int ret = 0;
11021115

11031116
switch (event) {
11041117
case SND_SOC_DAPM_POST_PMU:
1105-
flush_work(&dsp->boot_work);
1106-
ret = cs_dsp_run(&dsp->cs_dsp);
1107-
break;
1118+
return wm_adsp_run(dsp);
11081119
case SND_SOC_DAPM_PRE_PMD:
1109-
cs_dsp_stop(&dsp->cs_dsp);
1110-
break;
1120+
wm_adsp_stop(dsp);
1121+
return 0;
11111122
default:
1112-
break;
1123+
return 0;
11131124
}
1114-
1115-
return ret;
11161125
}
11171126
EXPORT_SYMBOL_GPL(wm_adsp_event);
11181127

sound/soc/codecs/wm_adsp.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ irqreturn_t wm_adsp2_bus_error(int irq, void *data);
9898
irqreturn_t wm_halo_bus_error(int irq, void *data);
9999
irqreturn_t wm_halo_wdt_expire(int irq, void *data);
100100

101+
int wm_adsp_run(struct wm_adsp *dsp);
102+
void wm_adsp_stop(struct wm_adsp *dsp);
101103
int wm_adsp_event(struct snd_soc_dapm_widget *w,
102104
struct snd_kcontrol *kcontrol, int event);
103105

0 commit comments

Comments
 (0)