summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/features.txt4
-rw-r--r--apps/lang/english.lang18
-rw-r--r--apps/main.c3
-rw-r--r--apps/menus/settings_menu.c6
-rw-r--r--apps/settings.h3
-rw-r--r--apps/settings_list.c4
-rw-r--r--firmware/drivers/audio/wm8758.c17
-rw-r--r--firmware/export/config/ipodvideo.h3
-rw-r--r--firmware/export/powermgmt.h3
-rw-r--r--firmware/export/wm8758.h1
-rw-r--r--firmware/target/arm/ipod/powermgmt-ipod-pcf.c9
-rw-r--r--manual/configure_rockbox/system_options.tex8
-rw-r--r--uisimulator/common/powermgmt-sim.c7
13 files changed, 85 insertions, 1 deletions
diff --git a/apps/features.txt b/apps/features.txt
index 242d2d4386..af0da5b355 100644
--- a/apps/features.txt
+++ b/apps/features.txt
@@ -225,6 +225,10 @@ usb_hid_mouse
wheel_acceleration
#endif
+#if defined(HAVE_LINEOUT_POWEROFF)
+lineout_poweroff
+#endif
+
#if defined(HAVE_TOUCHSCREEN)
touchscreen
#endif
diff --git a/apps/lang/english.lang b/apps/lang/english.lang
index ab5b6b59cf..3c847cff81 100644
--- a/apps/lang/english.lang
+++ b/apps/lang/english.lang
@@ -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>
diff --git a/apps/main.c b/apps/main.c
index fa1500edd5..7c43c0c277 100644
--- a/apps/main.c
+++ b/apps/main.c
@@ -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
diff --git a/apps/menus/settings_menu.c b/apps/menus/settings_menu.c
index 5c30e5982f..b695d9265b 100644
--- a/apps/menus/settings_menu.c
+++ b/apps/menus/settings_menu.c
@@ -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
diff --git a/apps/settings.h b/apps/settings.h
index 4cc2bd521e..62f85254aa 100644
--- a/apps/settings.h
+++ b/apps/settings.h
@@ -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;
diff --git a/apps/settings_list.c b/apps/settings_list.c
index 5759e24286..2638eac5a0 100644
--- a/apps/settings_list.c
+++ b/apps/settings_list.c
@@ -700,6 +700,10 @@ const struct settings_list settings[] = {
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
OFFON_SETTING(0,fm_force_mono, LANG_FM_MONO_MODE,
diff --git a/firmware/drivers/audio/wm8758.c b/firmware/drivers/audio/wm8758.c
index 715c921e33..40ead0cdf2 100644
--- a/firmware/drivers/audio/wm8758.c
+++ b/firmware/drivers/audio/wm8758.c
@@ -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);
diff --git a/firmware/export/config/ipodvideo.h b/firmware/export/config/ipodvideo.h
index a8d2220b8c..eec513320a 100644
--- a/firmware/export/config/ipodvideo.h
+++ b/firmware/export/config/ipodvideo.h
@@ -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
diff --git a/firmware/export/powermgmt.h b/firmware/export/powermgmt.h
index 17519c5bfd..d86118cd9b 100644
--- a/firmware/export/powermgmt.h
+++ b/firmware/export/powermgmt.h
@@ -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_ */
diff --git a/firmware/export/wm8758.h b/firmware/export/wm8758.h
index 9d1a938162..50cbc74e9a 100644
--- a/firmware/export/wm8758.h
+++ b/firmware/export/wm8758.h
@@ -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
diff --git a/firmware/target/arm/ipod/powermgmt-ipod-pcf.c b/firmware/target/arm/ipod/powermgmt-ipod-pcf.c
index 5b8f974fda..95f5380b92 100644
--- a/firmware/target/arm/ipod/powermgmt-ipod-pcf.c
+++ b/firmware/target/arm/ipod/powermgmt-ipod-pcf.c
@@ -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
diff --git a/manual/configure_rockbox/system_options.tex b/manual/configure_rockbox/system_options.tex
index e7f70b8f0f..64ec0f0487 100644
--- a/manual/configure_rockbox/system_options.tex
+++ b/manual/configure_rockbox/system_options.tex
@@ -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}{
diff --git a/uisimulator/common/powermgmt-sim.c b/uisimulator/common/powermgmt-sim.c
index c06f84670d..e2ce8c10d2 100644
--- a/uisimulator/common/powermgmt-sim.c
+++ b/uisimulator/common/powermgmt-sim.c
@@ -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)
{
}