Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

firmware: cs_dsp: Add pre_stop callback

The code already has a post_stop callback, add a matching pre_stop
callback to the client_ops that is called before execution is stopped.
This callback provides a convenient place for the client code to
communicate with the DSP before it is stopped.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220722094851.92521-1-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Charles Keepax and committed by
Mark Brown
dea99773 90023c6e

+6 -1
+3
drivers/firmware/cirrus/cs_dsp.c
··· 2725 2725 2726 2726 mutex_lock(&dsp->pwr_lock); 2727 2727 2728 + if (dsp->client_ops->pre_stop) 2729 + dsp->client_ops->pre_stop(dsp); 2730 + 2728 2731 dsp->running = false; 2729 2732 2730 2733 if (dsp->ops->stop_core)
+3 -1
include/linux/firmware/cirrus/cs_dsp.h
··· 189 189 * @control_remove: Called under the pwr_lock when a control is destroyed 190 190 * @pre_run: Called under the pwr_lock by cs_dsp_run() before the core is started 191 191 * @post_run: Called under the pwr_lock by cs_dsp_run() after the core is started 192 - * @post_stop: Called under the pwr_lock by cs_dsp_stop() 192 + * @pre_stop: Called under the pwr_lock by cs_dsp_stop() before the core is stopped 193 + * @post_stop: Called under the pwr_lock by cs_dsp_stop() after the core is stopped 193 194 * @watchdog_expired: Called when a watchdog expiry is detected 194 195 * 195 196 * These callbacks give the cs_dsp client an opportunity to respond to events ··· 201 200 void (*control_remove)(struct cs_dsp_coeff_ctl *ctl); 202 201 int (*pre_run)(struct cs_dsp *dsp); 203 202 int (*post_run)(struct cs_dsp *dsp); 203 + void (*pre_stop)(struct cs_dsp *dsp); 204 204 void (*post_stop)(struct cs_dsp *dsp); 205 205 void (*watchdog_expired)(struct cs_dsp *dsp); 206 206 };