From 55805e13a4ef0152b40e6606fce8b4603ae8cb91 Mon Sep 17 00:00:00 2001 From: Aidan MacDonald Date: Sat, 13 Mar 2021 02:11:45 +0000 Subject: Add new audiohw capability: POWER_MODE_CAP This allows the user to make use of the DAC's power-saving abilities. The two modes are "high performance" and "battery saver". This feature is supported by the AK4376 DAC in the upcoming FiiO M3K port. The setting is only a manual toggle right now, but in the future it could be hooked up to the battery level (via another setting) so it can be toggled automatically when the battery gets too low. Change-Id: I482af6e2f969fcbdeb3411bd3ff91f866b12d027 --- firmware/sound.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'firmware/sound.c') diff --git a/firmware/sound.c b/firmware/sound.c index 71bdc25003..6fe6115406 100644 --- a/firmware/sound.c +++ b/firmware/sound.c @@ -145,6 +145,9 @@ int sound_current(int setting) #if defined(AUDIOHW_HAVE_FILTER_ROLL_OFF) SOUND_CUR_SET(FILTER_ROLL_OFF, global_settings.roll_off) #endif +#if defined(AUDIOHW_HAVE_POWER_MODE) + SOUND_CUR_SET(POWER_MODE, global_settings.power_mode) +#endif #if 0 /*WRONG -- these need to index the hw_eq_bands[AUDIOHW_EQ_BAND_NUM] struct*/ /* Hardware EQ tone controls */ @@ -425,6 +428,16 @@ void sound_set_filter_roll_off(int value) } #endif +#if defined(AUDIOHW_HAVE_POWER_MODE) +void sound_set_power_mode(int value) +{ + if (!audio_is_initialized) + return; + + audiohw_set_power_mode(value); +} +#endif + #if defined(AUDIOHW_HAVE_EQ) int sound_enum_hw_eq_band_setting(unsigned int band, unsigned int band_setting) -- cgit v1.2.3