Submit FS#11065. Introduce a new system setting for en-/disabling the Line-out. For now only implemented on iPod Video. This allows to save power if the user does not use the player's Line-out. On iPod 5G the saving is ~0.5 mA.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25257 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Andree Buschmann 2010-03-20 15:02:29 +00:00
parent 181e0e0878
commit b6c12a129e
13 changed files with 85 additions and 1 deletions

View file

@ -225,6 +225,10 @@ usb_hid_mouse
wheel_acceleration
#endif
#if defined(HAVE_LINEOUT_POWEROFF)
lineout_poweroff
#endif
#if defined(HAVE_TOUCHSCREEN)
touchscreen
#endif

View file

@ -13377,4 +13377,20 @@
recording_histogram: "Histogram interval"
</voice>
</phrase>
<phrase>
id: LANG_LINEOUT_ONOFF
desc: in system settings menu
user: core
<source>
*: none
lineout_poweroff: "Line-out"
</source>
<dest>
*: none
lineout_poweroff: "Line-out"
</dest>
<voice>
*: none
lineout_poweroff: "Line-out"
</voice>
</phrase>

View file

@ -632,6 +632,9 @@ static void init(void)
#ifdef HAVE_ACCESSORY_SUPPLY
accessory_supply_set(global_settings.accessory_supply);
#endif
#ifdef HAVE_LINEOUT_POWEROFF
lineout_set(global_settings.lineout_active);
#endif
#ifdef HAVE_HOTSWAP_STORAGE_AS_MAIN
check_bootfile(false); /* remember write time and filesize */
#endif

View file

@ -251,6 +251,9 @@ MENUITEM_SETTING(serial_bitrate, &global_settings.serial_bitrate, NULL);
#ifdef HAVE_ACCESSORY_SUPPLY
MENUITEM_SETTING(accessory_supply, &global_settings.accessory_supply, NULL);
#endif
#ifdef HAVE_LINEOUT_POWEROFF
MENUITEM_SETTING(lineout_onoff, &global_settings.lineout_active, NULL);
#endif
MENUITEM_SETTING(start_screen, &global_settings.start_in_screen, NULL);
#ifdef USB_ENABLE_HID
MENUITEM_SETTING(usb_hid, &global_settings.usb_hid, NULL);
@ -299,6 +302,9 @@ MAKE_MENU(system_menu, ID2P(LANG_SYSTEM),
#ifdef HAVE_ACCESSORY_SUPPLY
&accessory_supply,
#endif
#ifdef HAVE_LINEOUT_POWEROFF
&lineout_onoff,
#endif
#ifdef HAVE_BUTTON_LIGHT
&buttonlight_timeout,
#endif

View file

@ -767,6 +767,9 @@ struct user_settings
#ifdef HAVE_ACCESSORY_SUPPLY
bool accessory_supply; /* 0=off 1=on, accessory power supply for iPod */
#endif
#ifdef HAVE_LINEOUT_POWEROFF
bool lineout_active;
#endif
#ifdef HAVE_SPEAKER
bool speaker_enabled;

View file

@ -699,6 +699,10 @@ const struct settings_list settings[] = {
#ifdef HAVE_ACCESSORY_SUPPLY
OFFON_SETTING(0, accessory_supply, LANG_ACCESSORY_SUPPLY,
true, "accessory power supply", accessory_supply_set),
#endif
#ifdef HAVE_LINEOUT_POWEROFF
OFFON_SETTING(0, lineout_active, LANG_LINEOUT_ONOFF,
true, "lineout", lineout_set),
#endif
/* tuner */
#if CONFIG_TUNER

View file

@ -181,6 +181,23 @@ void audiohw_set_lineout_vol(int vol_l, int vol_r)
wmcodec_write(ROUT2VOL, amp_r | ROUT2VOL_ROUT2ZC | ROUT2VOL_OUT2VU);
}
void audiohw_enable_lineout(bool enable)
{
if (enable)
{
/* include enabling of OUT2 */
wmcodec_write(PWRMGMT3, PWRMGMT3_LOUT2EN | PWRMGMT3_ROUT2EN
| PWRMGMT3_RMIXEN | PWRMGMT3_LMIXEN
| PWRMGMT3_DACENR | PWRMGMT3_DACENL);
}
else
{
/* exclude enabling of OUT2 */
wmcodec_write(PWRMGMT3, PWRMGMT3_RMIXEN | PWRMGMT3_LMIXEN
| PWRMGMT3_DACENR | PWRMGMT3_DACENL);
}
}
void audiohw_set_bass(int value)
{
eq1_reg = (eq1_reg & ~EQ_GAIN_MASK) | EQ_GAIN_VALUE(value);

View file

@ -77,6 +77,9 @@
/* Define this if you can switch on/off the accessory power supply */
#define HAVE_ACCESSORY_SUPPLY
/* Define this, if you can switch on/off the lineout */
#define HAVE_LINEOUT_POWEROFF
/* Define this if you have a software controlled poweroff */
#define HAVE_SW_POWEROFF

View file

@ -174,5 +174,8 @@ bool query_force_shutdown(void);
#ifdef HAVE_ACCESSORY_SUPPLY
void accessory_supply_set(bool);
#endif
#ifdef HAVE_LINEOUT_POWEROFF
void lineout_set(bool);
#endif
#endif /* _POWERMGMT_H_ */

View file

@ -34,6 +34,7 @@ extern int tenthdb2mixer(int db);
extern void audiohw_set_master_vol(int vol_l, int vol_r);
extern void audiohw_set_lineout_vol(int vol_l, int vol_r);
extern void audiohw_set_mixer_vol(int channel1, int channel2);
extern void audiohw_enable_lineout(bool enable);
#define RESET 0x00
#define RESET_RESET 0x0

View file

@ -25,6 +25,7 @@
#include "powermgmt.h"
#include "pcf5060x.h"
#include "pcf50605.h"
#include "audiohw.h"
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
{
@ -129,3 +130,11 @@ void accessory_supply_set(bool enable)
}
#endif
#ifdef HAVE_LINEOUT_POWEROFF
void lineout_set(bool enable)
{
/* Call audio hardware driver implementation */
audiohw_enable_lineout(enable);
}
#endif

View file

@ -159,6 +159,14 @@ thus there is a reasonable chance that your favourite accessory will work.
The accessory may require power from the \dap{} to function, and if so you should turn
this option \setting{On}. If it is not required, then turning this setting
\setting{Off} will save battery and therefore result in better runtime.
}
\opt{lineout_poweroff}{
\subsection{Lineout}
This option turns the \dap{}'s lineout \setting{On} and \setting{Off}. On some
devices an enabled lineout will consume some power even if not used. If it is
not required, then turning this setting \setting{Off} will save battery and
therefore result in better runtime.
}
\opt{HAVE_BUTTON_LIGHTS}{

View file

@ -142,6 +142,13 @@ void accessory_supply_set(bool enable)
}
#endif
#ifdef HAVE_LINEOUT_POWEROFF
void lineout_set(bool enable)
{
(void)enable;
}
#endif
void reset_poweroff_timer(void)
{
}