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
This commit is contained in:
parent
3a254a92c7
commit
55805e13a4
|
@ -12014,6 +12014,57 @@
|
|||
filter_roll_off: "DAC filter roll-off"
|
||||
</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
|
||||
|
|
|
@ -12207,6 +12207,57 @@
|
|||
es9018: "Bypass"
|
||||
</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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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),
|
||||
|
|
|
@ -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) {}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue