diff options
author | Aidan MacDonald <amachronic@protonmail.com> | 2021-03-13 02:11:45 +0000 |
---|---|---|
committer | Solomon Peachy <pizza@shaftnet.org> | 2021-03-22 13:00:11 +0000 |
commit | 55805e13a4ef0152b40e6606fce8b4603ae8cb91 (patch) | |
tree | 34171877486e5732233439ef1058007cad36ed29 /apps | |
parent | 3a254a92c7363aad95cfcc549732e44d9eddc42b (diff) | |
download | rockbox-55805e13a4ef0152b40e6606fce8b4603ae8cb91.tar.gz rockbox-55805e13a4ef0152b40e6606fce8b4603ae8cb91.zip |
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
Diffstat (limited to 'apps')
-rw-r--r-- | apps/lang/english-us.lang | 51 | ||||
-rw-r--r-- | apps/lang/english.lang | 51 | ||||
-rw-r--r-- | apps/menus/sound_menu.c | 7 | ||||
-rw-r--r-- | apps/settings.c | 3 | ||||
-rw-r--r-- | apps/settings.h | 4 | ||||
-rw-r--r-- | apps/settings_list.c | 6 |
6 files changed, 122 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 @@ | |||
12015 | </voice> | 12015 | </voice> |
12016 | </phrase> | 12016 | </phrase> |
12017 | <phrase> | 12017 | <phrase> |
12018 | id: LANG_DAC_POWER_MODE | ||
12019 | desc: in sound settings | ||
12020 | user: core | ||
12021 | <source> | ||
12022 | *: none | ||
12023 | dac_power_mode: "DAC's power mode" | ||
12024 | </source> | ||
12025 | <dest> | ||
12026 | *: none | ||
12027 | dac_power_mode: "DAC power mode" | ||
12028 | </dest> | ||
12029 | <voice> | ||
12030 | *: none | ||
12031 | dac_power_mode: "DAC power mode" | ||
12032 | </voice> | ||
12033 | </phrase> | ||
12034 | <phrase> | ||
12035 | id: LANG_DAC_POWER_HIGH | ||
12036 | desc: in sound settings | ||
12037 | user: core | ||
12038 | <source> | ||
12039 | *: none | ||
12040 | dac_power_mode: "High performance" | ||
12041 | </source> | ||
12042 | <dest> | ||
12043 | *: none | ||
12044 | dac_power_mode: "High performance" | ||
12045 | </dest> | ||
12046 | <voice> | ||
12047 | *: none | ||
12048 | dac_power_mode: "High performance" | ||
12049 | </voice> | ||
12050 | </phrase> | ||
12051 | <phrase> | ||
12052 | id: LANG_DAC_POWER_LOW | ||
12053 | desc: in sound settings | ||
12054 | user: core | ||
12055 | <source> | ||
12056 | *: none | ||
12057 | dac_power_mode: "Save battery" | ||
12058 | </source> | ||
12059 | <dest> | ||
12060 | *: none | ||
12061 | dac_power_mode: "Save battery" | ||
12062 | </dest> | ||
12063 | <voice> | ||
12064 | *: none | ||
12065 | dac_power_mode: "Save battery" | ||
12066 | </voice> | ||
12067 | </phrase> | ||
12068 | <phrase> | ||
12018 | id: VOICE_BLACK | 12069 | id: VOICE_BLACK |
12019 | desc: spoken only, for announcing chess piece color | 12070 | desc: spoken only, for announcing chess piece color |
12020 | user: core | 12071 | 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 @@ | |||
12208 | </voice> | 12208 | </voice> |
12209 | </phrase> | 12209 | </phrase> |
12210 | <phrase> | 12210 | <phrase> |
12211 | id: LANG_DAC_POWER_MODE | ||
12212 | desc: in sound settings | ||
12213 | user: core | ||
12214 | <source> | ||
12215 | *: none | ||
12216 | dac_power_mode: "DAC's power mode" | ||
12217 | </source> | ||
12218 | <dest> | ||
12219 | *: none | ||
12220 | dac_power_mode: "DAC's power mode" | ||
12221 | </dest> | ||
12222 | <voice> | ||
12223 | *: none | ||
12224 | dac_power_mode: "DAC's power mode" | ||
12225 | </voice> | ||
12226 | </phrase> | ||
12227 | <phrase> | ||
12228 | id: LANG_DAC_POWER_HIGH | ||
12229 | desc: in sound settings | ||
12230 | user: core | ||
12231 | <source> | ||
12232 | *: none | ||
12233 | dac_power_mode: "High performance" | ||
12234 | </source> | ||
12235 | <dest> | ||
12236 | *: none | ||
12237 | dac_power_mode: "High performance" | ||
12238 | </dest> | ||
12239 | <voice> | ||
12240 | *: none | ||
12241 | dac_power_mode: "High performance" | ||
12242 | </voice> | ||
12243 | </phrase> | ||
12244 | <phrase> | ||
12245 | id: LANG_DAC_POWER_LOW | ||
12246 | desc: in sound settings | ||
12247 | user: core | ||
12248 | <source> | ||
12249 | *: none | ||
12250 | dac_power_mode: "Save battery" | ||
12251 | </source> | ||
12252 | <dest> | ||
12253 | *: none | ||
12254 | dac_power_mode: "Save battery" | ||
12255 | </dest> | ||
12256 | <voice> | ||
12257 | *: none | ||
12258 | dac_power_mode: "Save battery" | ||
12259 | </voice> | ||
12260 | </phrase> | ||
12261 | <phrase> | ||
12211 | id: LANG_VOLUME_LIMIT | 12262 | id: LANG_VOLUME_LIMIT |
12212 | desc: in sound_settings | 12263 | desc: in sound_settings |
12213 | user: core | 12264 | 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); | |||
122 | MENUITEM_SETTING(roll_off, &global_settings.roll_off, NULL); | 122 | MENUITEM_SETTING(roll_off, &global_settings.roll_off, NULL); |
123 | #endif | 123 | #endif |
124 | 124 | ||
125 | #ifdef AUDIOHW_HAVE_POWER_MODE | ||
126 | MENUITEM_SETTING(power_mode, &global_settings.power_mode, NULL); | ||
127 | #endif | ||
128 | |||
125 | #ifdef AUDIOHW_HAVE_FUNCTIONAL_MODE | 129 | #ifdef AUDIOHW_HAVE_FUNCTIONAL_MODE |
126 | MENUITEM_SETTING(func_mode, &global_settings.func_mode, NULL); | 130 | MENUITEM_SETTING(func_mode, &global_settings.func_mode, NULL); |
127 | #endif | 131 | #endif |
@@ -240,6 +244,9 @@ MAKE_MENU(sound_settings, ID2P(LANG_SOUND_SETTINGS), NULL, Icon_Audio, | |||
240 | #ifdef AUDIOHW_HAVE_FILTER_ROLL_OFF | 244 | #ifdef AUDIOHW_HAVE_FILTER_ROLL_OFF |
241 | ,&roll_off | 245 | ,&roll_off |
242 | #endif | 246 | #endif |
247 | #ifdef AUDIOHW_HAVE_POWER_MODE | ||
248 | ,&power_mode | ||
249 | #endif | ||
243 | #ifdef AUDIOHW_HAVE_FUNCTIONAL_MODE | 250 | #ifdef AUDIOHW_HAVE_FUNCTIONAL_MODE |
244 | ,&func_mode | 251 | ,&func_mode |
245 | #endif | 252 | #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) | |||
746 | #ifdef AUDIOHW_HAVE_FILTER_ROLL_OFF | 746 | #ifdef AUDIOHW_HAVE_FILTER_ROLL_OFF |
747 | sound_set(SOUND_FILTER_ROLL_OFF, global_settings.roll_off); | 747 | sound_set(SOUND_FILTER_ROLL_OFF, global_settings.roll_off); |
748 | #endif | 748 | #endif |
749 | #ifdef AUDIOHW_HAVE_POWER_MODE | ||
750 | sound_set(SOUND_POWER_MODE, global_settings.power_mode); | ||
751 | #endif | ||
749 | #ifdef AUDIOHW_HAVE_EQ | 752 | #ifdef AUDIOHW_HAVE_EQ |
750 | int b; | 753 | int b; |
751 | 754 | ||
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 | |||
782 | int roll_off; | 782 | int roll_off; |
783 | #endif | 783 | #endif |
784 | 784 | ||
785 | #ifdef AUDIOHW_HAVE_POWER_MODE | ||
786 | int power_mode; | ||
787 | #endif | ||
788 | |||
785 | #ifdef AUDIOHW_HAVE_FUNCTIONAL_MODE | 789 | #ifdef AUDIOHW_HAVE_FUNCTIONAL_MODE |
786 | int func_mode; | 790 | int func_mode; |
787 | #endif | 791 | #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[] = { | |||
859 | #endif | 859 | #endif |
860 | #endif | 860 | #endif |
861 | 861 | ||
862 | #ifdef AUDIOHW_HAVE_POWER_MODE | ||
863 | CHOICE_SETTING(F_SOUNDSETTING, power_mode, LANG_DAC_POWER_MODE, 0, | ||
864 | "dac_power_mode", "high,low", sound_set_power_mode, | ||
865 | 2, ID2P(LANG_DAC_POWER_HIGH), ID2P(LANG_DAC_POWER_LOW)), | ||
866 | #endif | ||
867 | |||
862 | /* playback */ | 868 | /* playback */ |
863 | OFFON_SETTING(0, playlist_shuffle, LANG_SHUFFLE, false, "shuffle", NULL), | 869 | OFFON_SETTING(0, playlist_shuffle, LANG_SHUFFLE, false, "shuffle", NULL), |
864 | SYSTEM_SETTING(NVRAM(4), resume_index, -1), | 870 | SYSTEM_SETTING(NVRAM(4), resume_index, -1), |