ASoC: wm_adsp: Add support for "toggle" preloaders

In the case a device can support retaining the firmware memory across
low power states it is useful for the preloader widget to only power up
whilst actually loading/unloading the core, as opposed to the normal
operation where the widget is powered for the entire time a firmware is
preloaded onto the core. Add support for this mode and a flag to enable
it.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220105113026.18955-7-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Charles Keepax 2022-01-05 11:30:24 +00:00 committed by Mark Brown
parent 7aa1cc1091
commit ba235634b1
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0
2 changed files with 19 additions and 3 deletions

View File

@ -896,11 +896,12 @@ int wm_adsp2_preloader_put(struct snd_kcontrol *kcontrol,
struct wm_adsp *dsp = &dsps[mc->shift - 1];
char preload[32];
if (dsp->preloaded == ucontrol->value.integer.value[0])
return 0;
snprintf(preload, ARRAY_SIZE(preload), "%s Preload", dsp->cs_dsp.name);
dsp->preloaded = ucontrol->value.integer.value[0];
if (ucontrol->value.integer.value[0])
if (ucontrol->value.integer.value[0] || dsp->toggle_preload)
snd_soc_component_force_enable_pin(component, preload);
else
snd_soc_component_disable_pin(component, preload);
@ -909,6 +910,13 @@ int wm_adsp2_preloader_put(struct snd_kcontrol *kcontrol,
flush_work(&dsp->boot_work);
dsp->preloaded = ucontrol->value.integer.value[0];
if (dsp->toggle_preload) {
snd_soc_component_disable_pin(component, preload);
snd_soc_dapm_sync(dapm);
}
return 0;
}
EXPORT_SYMBOL_GPL(wm_adsp2_preloader_put);

View File

@ -41,6 +41,14 @@ struct wm_adsp {
struct list_head compr_list;
struct list_head buffer_list;
/*
* Flag indicating the preloader widget only needs power toggled
* on state change rather than held on for the duration of the
* preload, useful for devices that can retain firmware memory
* across power down.
*/
bool toggle_preload;
};
#define WM_ADSP1(wname, num) \