Skip to content

Commit ba23563

Browse files
charleskeepaxbroonie
authored andcommitted
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 7aa1cc1 commit ba23563

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

sound/soc/codecs/wm_adsp.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -896,11 +896,12 @@ int wm_adsp2_preloader_put(struct snd_kcontrol *kcontrol,
896896
struct wm_adsp *dsp = &dsps[mc->shift - 1];
897897
char preload[32];
898898

899-
snprintf(preload, ARRAY_SIZE(preload), "%s Preload", dsp->cs_dsp.name);
899+
if (dsp->preloaded == ucontrol->value.integer.value[0])
900+
return 0;
900901

901-
dsp->preloaded = ucontrol->value.integer.value[0];
902+
snprintf(preload, ARRAY_SIZE(preload), "%s Preload", dsp->cs_dsp.name);
902903

903-
if (ucontrol->value.integer.value[0])
904+
if (ucontrol->value.integer.value[0] || dsp->toggle_preload)
904905
snd_soc_component_force_enable_pin(component, preload);
905906
else
906907
snd_soc_component_disable_pin(component, preload);
@@ -909,6 +910,13 @@ int wm_adsp2_preloader_put(struct snd_kcontrol *kcontrol,
909910

910911
flush_work(&dsp->boot_work);
911912

913+
dsp->preloaded = ucontrol->value.integer.value[0];
914+
915+
if (dsp->toggle_preload) {
916+
snd_soc_component_disable_pin(component, preload);
917+
snd_soc_dapm_sync(dapm);
918+
}
919+
912920
return 0;
913921
}
914922
EXPORT_SYMBOL_GPL(wm_adsp2_preloader_put);

sound/soc/codecs/wm_adsp.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,14 @@ struct wm_adsp {
4141

4242
struct list_head compr_list;
4343
struct list_head buffer_list;
44+
45+
/*
46+
* Flag indicating the preloader widget only needs power toggled
47+
* on state change rather than held on for the duration of the
48+
* preload, useful for devices that can retain firmware memory
49+
* across power down.
50+
*/
51+
bool toggle_preload;
4452
};
4553

4654
#define WM_ADSP1(wname, num) \

0 commit comments

Comments
 (0)