summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/lang/english-us.lang51
-rw-r--r--apps/lang/english.lang51
-rw-r--r--apps/menus/sound_menu.c7
-rw-r--r--apps/settings.c3
-rw-r--r--apps/settings.h4
-rw-r--r--apps/settings_list.c6
-rw-r--r--firmware/drivers/audio/sdl.c4
-rw-r--r--firmware/export/audiohw.h15
-rw-r--r--firmware/export/audiohw_settings.h3
-rw-r--r--firmware/export/sound.h4
-rw-r--r--firmware/sound.c13
11 files changed, 161 insertions, 0 deletions
diff --git a/apps/lang/english-us.lang b/apps/lang/english-us.lang
index cd7bfe0abf..0dc53e7110 100644
--- a/apps/lang/english-us.lang
+++ b/apps/lang/english-us.lang
@@ -12015,6 +12015,57 @@
</voice>
</phrase>
<phrase>
+ id: LANG_DAC_POWER_MODE
+ desc: in sound settings
+ user: core
+ <source>
+ *: none
+ dac_power_mode: "DAC's power mode"
+ </source>
+ <dest>
+ *: none
+ dac_power_mode: "DAC power mode"
+ </dest>
+ <voice>
+ *: none
+ dac_power_mode: "DAC power mode"
+ </voice>
+</phrase>
+<phrase>
+ id: LANG_DAC_POWER_HIGH
+ desc: in sound settings
+ user: core
+ <source>
+ *: none
+ dac_power_mode: "High performance"
+ </source>
+ <dest>
+ *: none
+ dac_power_mode: "High performance"
+ </dest>
+ <voice>
+ *: none
+ dac_power_mode: "High performance"
+ </voice>
+</phrase>
+<phrase>
+ id: LANG_DAC_POWER_LOW
+ desc: in sound settings
+ user: core
+ <source>
+ *: none
+ dac_power_mode: "Save battery"
+ </source>
+ <dest>
+ *: none
+ dac_power_mode: "Save battery"
+ </dest>
+ <voice>
+ *: none
+ dac_power_mode: "Save battery"
+ </voice>
+</phrase>
+<phrase>
id: VOICE_BLACK
desc: spoken only, for announcing chess piece color
user: core
diff --git a/apps/lang/english.lang b/apps/lang/english.lang
index 8365e9d265..5b8391b859 100644
--- a/apps/lang/english.lang
+++ b/apps/lang/english.lang
@@ -12208,6 +12208,57 @@
</voice>
</phrase>
<phrase>
+ id: LANG_DAC_POWER_MODE
+ desc: in sound settings
+ user: core
+ <source>
+ *: none
+ dac_power_mode: "DAC's power mode"
+ </source>
+ <dest>
+ *: none
+ dac_power_mode: "DAC's power mode"
+ </dest>
+ <voice>
+ *: none
+ dac_power_mode: "DAC's power mode"
+ </voice>
+</phrase>
+<phrase>
+ id: LANG_DAC_POWER_HIGH
+ desc: in sound settings
+ user: core
+ <source>
+ *: none
+ dac_power_mode: "High performance"
+ </source>
+ <dest>
+ *: none
+ dac_power_mode: "High performance"
+ </dest>
+ <voice>
+ *: none
+ dac_power_mode: "High performance"
+ </voice>
+</phrase>
+<phrase>
+ id: LANG_DAC_POWER_LOW
+ desc: in sound settings
+ user: core
+ <source>
+ *: none
+ dac_power_mode: "Save battery"
+ </source>
+ <dest>
+ *: none
+ dac_power_mode: "Save battery"
+ </dest>
+ <voice>
+ *: none
+ dac_power_mode: "Save battery"
+ </voice>
+</phrase>
+<phrase>
id: LANG_VOLUME_LIMIT
desc: in sound_settings
user: core
diff --git a/apps/menus/sound_menu.c b/apps/menus/sound_menu.c
index 174329fcc8..9cbc76e474 100644
--- a/apps/menus/sound_menu.c
+++ b/apps/menus/sound_menu.c
@@ -122,6 +122,10 @@ MENUITEM_SETTING(depth_3d, &global_settings.depth_3d, NULL);
MENUITEM_SETTING(roll_off, &global_settings.roll_off, NULL);
#endif
+#ifdef AUDIOHW_HAVE_POWER_MODE
+MENUITEM_SETTING(power_mode, &global_settings.power_mode, NULL);
+#endif
+
#ifdef AUDIOHW_HAVE_FUNCTIONAL_MODE
MENUITEM_SETTING(func_mode, &global_settings.func_mode, NULL);
#endif
@@ -240,6 +244,9 @@ MAKE_MENU(sound_settings, ID2P(LANG_SOUND_SETTINGS), NULL, Icon_Audio,
#ifdef AUDIOHW_HAVE_FILTER_ROLL_OFF
,&roll_off
#endif
+#ifdef AUDIOHW_HAVE_POWER_MODE
+ ,&power_mode
+#endif
#ifdef AUDIOHW_HAVE_FUNCTIONAL_MODE
,&func_mode
#endif
diff --git a/apps/settings.c b/apps/settings.c
index 43a010aeb2..99cede382b 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -746,6 +746,9 @@ void sound_settings_apply(void)
#ifdef AUDIOHW_HAVE_FILTER_ROLL_OFF
sound_set(SOUND_FILTER_ROLL_OFF, global_settings.roll_off);
#endif
+#ifdef AUDIOHW_HAVE_POWER_MODE
+ sound_set(SOUND_POWER_MODE, global_settings.power_mode);
+#endif
#ifdef AUDIOHW_HAVE_EQ
int b;
diff --git a/apps/settings.h b/apps/settings.h
index cc60617de4..1ff7bbe5d1 100644
--- a/apps/settings.h
+++ b/apps/settings.h
@@ -782,6 +782,10 @@ struct user_settings
int roll_off;
#endif
+#ifdef AUDIOHW_HAVE_POWER_MODE
+ int power_mode;
+#endif
+
#ifdef AUDIOHW_HAVE_FUNCTIONAL_MODE
int func_mode;
#endif
diff --git a/apps/settings_list.c b/apps/settings_list.c
index e5c02f6bf3..1b06bfe11c 100644
--- a/apps/settings_list.c
+++ b/apps/settings_list.c
@@ -859,6 +859,12 @@ const struct settings_list settings[] = {
#endif
#endif
+#ifdef AUDIOHW_HAVE_POWER_MODE
+ CHOICE_SETTING(F_SOUNDSETTING, power_mode, LANG_DAC_POWER_MODE, 0,
+ "dac_power_mode", "high,low", sound_set_power_mode,
+ 2, ID2P(LANG_DAC_POWER_HIGH), ID2P(LANG_DAC_POWER_LOW)),
+#endif
+
/* playback */
OFFON_SETTING(0, playlist_shuffle, LANG_SHUFFLE, false, "shuffle", NULL),
SYSTEM_SETTING(NVRAM(4), resume_index, -1),
diff --git a/firmware/drivers/audio/sdl.c b/firmware/drivers/audio/sdl.c
index fb49a291d1..89f40baedf 100644
--- a/firmware/drivers/audio/sdl.c
+++ b/firmware/drivers/audio/sdl.c
@@ -118,6 +118,10 @@ void audiohw_set_lineout_volume(int vol_l, int vol_r)
void audiohw_set_filter_roll_off(int value)
{ (void)value; }
#endif
+#if defined(AUDIOHW_HAVE_POWER_MODE)
+void audiohw_set_power_mode(int value)
+ { (void)value; }
+#endif
void audiohw_close(void) {}
diff --git a/firmware/export/audiohw.h b/firmware/export/audiohw.h
index 8a46cbea78..d862c977db 100644
--- a/firmware/export/audiohw.h
+++ b/firmware/export/audiohw.h
@@ -41,6 +41,7 @@
#define LIN_GAIN_CAP (1 << 11)
#define MIC_GAIN_CAP (1 << 12)
#define FILTER_ROLL_OFF_CAP (1 << 13)
+#define POWER_MODE_CAP (1 << 14)
/* Used by every driver to export its min/max/default values for its audio
settings. */
@@ -391,6 +392,10 @@ enum AUDIOHW_EQ_SETTINGS
#define AUDIOHW_HAVE_FILTER_ROLL_OFF
#endif
+#if (AUDIOHW_CAPS & POWER_MODE_CAP)
+#define AUDIOHW_HAVE_POWER_MODE
+#endif
+
#endif /* AUDIOHW_CAPS */
#ifdef HAVE_SW_TONE_CONTROLS
@@ -586,6 +591,16 @@ void audiohw_set_depth_3d(int val);
void audiohw_set_filter_roll_off(int val);
#endif
+#ifdef AUDIOHW_HAVE_POWER_MODE
+/**
+ * Set DAC's power saving mode.
+ * @param enable 0 - highest performance, 1 - battery saving
+ * NOTE: AUDIOHW_CAPS need to contain
+ * POWER_MODE_CAP
+ */
+void audiohw_set_power_mode(int mode);
+#endif
+
void audiohw_set_frequency(int fsel);
#ifdef HAVE_RECORDING
diff --git a/firmware/export/audiohw_settings.h b/firmware/export/audiohw_settings.h
index 1d3e0dc12f..8010963ea4 100644
--- a/firmware/export/audiohw_settings.h
+++ b/firmware/export/audiohw_settings.h
@@ -103,6 +103,9 @@ AUDIOHW_SETTINGS(
#if defined(AUDIOHW_HAVE_FILTER_ROLL_OFF)
AUDIOHW_SETTING_ENT(FILTER_ROLL_OFF, sound_set_filter_roll_off)
#endif
+#if defined(AUDIOHW_HAVE_POWER_MODE)
+ AUDIOHW_SETTING_ENT(POWER_MODE, sound_set_power_mode)
+#endif
/* Hardware EQ tone controls */
#if defined(AUDIOHW_HAVE_EQ)
AUDIOHW_SETTING_ENT(EQ_BAND1_GAIN, sound_set_hw_eq_band1_gain)
diff --git a/firmware/export/sound.h b/firmware/export/sound.h
index 2e04cac854..8e79dd0aed 100644
--- a/firmware/export/sound.h
+++ b/firmware/export/sound.h
@@ -57,6 +57,10 @@ void sound_set_depth_3d(int value);
void sound_set_filter_roll_off(int value);
#endif
+#if defined(AUDIOHW_HAVE_POWER_MODE)
+void sound_set_power_mode(int value);
+#endif
+
#ifdef AUDIOHW_HAVE_EQ
/*
* band = SOUND_EQ_BANDb
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)