summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndree Buschmann <AndreeBuschmann@t-online.de>2010-03-20 15:02:29 +0000
committerAndree Buschmann <AndreeBuschmann@t-online.de>2010-03-20 15:02:29 +0000
commitb6c12a129e22dadff4be67e5b0fe8993c888d6d8 (patch)
treeee6e855a5d998e3c5bae6d74a86641f3d01ebd50
parent181e0e0878aac10dd9a6651842fbb59c4fed7a9b (diff)
downloadrockbox-b6c12a129e22dadff4be67e5b0fe8993c888d6d8.tar.gz
rockbox-b6c12a129e22dadff4be67e5b0fe8993c888d6d8.zip
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
-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
225wheel_acceleration 225wheel_acceleration
226#endif 226#endif
227 227
228#if defined(HAVE_LINEOUT_POWEROFF)
229lineout_poweroff
230#endif
231
228#if defined(HAVE_TOUCHSCREEN) 232#if defined(HAVE_TOUCHSCREEN)
229touchscreen 233touchscreen
230#endif 234#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 @@
13377 recording_histogram: "Histogram interval" 13377 recording_histogram: "Histogram interval"
13378 </voice> 13378 </voice>
13379</phrase> 13379</phrase>
13380 13380<phrase>
13381 id: LANG_LINEOUT_ONOFF
13382 desc: in system settings menu
13383 user: core
13384 <source>
13385 *: none
13386 lineout_poweroff: "Line-out"
13387 </source>
13388 <dest>
13389 *: none
13390 lineout_poweroff: "Line-out"
13391 </dest>
13392 <voice>
13393 *: none
13394 lineout_poweroff: "Line-out"
13395 </voice>
13396</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)
632#ifdef HAVE_ACCESSORY_SUPPLY 632#ifdef HAVE_ACCESSORY_SUPPLY
633 accessory_supply_set(global_settings.accessory_supply); 633 accessory_supply_set(global_settings.accessory_supply);
634#endif 634#endif
635#ifdef HAVE_LINEOUT_POWEROFF
636 lineout_set(global_settings.lineout_active);
637#endif
635#ifdef HAVE_HOTSWAP_STORAGE_AS_MAIN 638#ifdef HAVE_HOTSWAP_STORAGE_AS_MAIN
636 check_bootfile(false); /* remember write time and filesize */ 639 check_bootfile(false); /* remember write time and filesize */
637#endif 640#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);
251#ifdef HAVE_ACCESSORY_SUPPLY 251#ifdef HAVE_ACCESSORY_SUPPLY
252MENUITEM_SETTING(accessory_supply, &global_settings.accessory_supply, NULL); 252MENUITEM_SETTING(accessory_supply, &global_settings.accessory_supply, NULL);
253#endif 253#endif
254#ifdef HAVE_LINEOUT_POWEROFF
255MENUITEM_SETTING(lineout_onoff, &global_settings.lineout_active, NULL);
256#endif
254MENUITEM_SETTING(start_screen, &global_settings.start_in_screen, NULL); 257MENUITEM_SETTING(start_screen, &global_settings.start_in_screen, NULL);
255#ifdef USB_ENABLE_HID 258#ifdef USB_ENABLE_HID
256MENUITEM_SETTING(usb_hid, &global_settings.usb_hid, NULL); 259MENUITEM_SETTING(usb_hid, &global_settings.usb_hid, NULL);
@@ -299,6 +302,9 @@ MAKE_MENU(system_menu, ID2P(LANG_SYSTEM),
299#ifdef HAVE_ACCESSORY_SUPPLY 302#ifdef HAVE_ACCESSORY_SUPPLY
300 &accessory_supply, 303 &accessory_supply,
301#endif 304#endif
305#ifdef HAVE_LINEOUT_POWEROFF
306 &lineout_onoff,
307#endif
302#ifdef HAVE_BUTTON_LIGHT 308#ifdef HAVE_BUTTON_LIGHT
303 &buttonlight_timeout, 309 &buttonlight_timeout,
304#endif 310#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
767#ifdef HAVE_ACCESSORY_SUPPLY 767#ifdef HAVE_ACCESSORY_SUPPLY
768 bool accessory_supply; /* 0=off 1=on, accessory power supply for iPod */ 768 bool accessory_supply; /* 0=off 1=on, accessory power supply for iPod */
769#endif 769#endif
770#ifdef HAVE_LINEOUT_POWEROFF
771 bool lineout_active;
772#endif
770 773
771#ifdef HAVE_SPEAKER 774#ifdef HAVE_SPEAKER
772 bool speaker_enabled; 775 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[] = {
700 OFFON_SETTING(0, accessory_supply, LANG_ACCESSORY_SUPPLY, 700 OFFON_SETTING(0, accessory_supply, LANG_ACCESSORY_SUPPLY,
701 true, "accessory power supply", accessory_supply_set), 701 true, "accessory power supply", accessory_supply_set),
702#endif 702#endif
703#ifdef HAVE_LINEOUT_POWEROFF
704 OFFON_SETTING(0, lineout_active, LANG_LINEOUT_ONOFF,
705 true, "lineout", lineout_set),
706#endif
703 /* tuner */ 707 /* tuner */
704#if CONFIG_TUNER 708#if CONFIG_TUNER
705 OFFON_SETTING(0,fm_force_mono, LANG_FM_MONO_MODE, 709 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)
181 wmcodec_write(ROUT2VOL, amp_r | ROUT2VOL_ROUT2ZC | ROUT2VOL_OUT2VU); 181 wmcodec_write(ROUT2VOL, amp_r | ROUT2VOL_ROUT2ZC | ROUT2VOL_OUT2VU);
182} 182}
183 183
184void audiohw_enable_lineout(bool enable)
185{
186 if (enable)
187 {
188 /* include enabling of OUT2 */
189 wmcodec_write(PWRMGMT3, PWRMGMT3_LOUT2EN | PWRMGMT3_ROUT2EN
190 | PWRMGMT3_RMIXEN | PWRMGMT3_LMIXEN
191 | PWRMGMT3_DACENR | PWRMGMT3_DACENL);
192 }
193 else
194 {
195 /* exclude enabling of OUT2 */
196 wmcodec_write(PWRMGMT3, PWRMGMT3_RMIXEN | PWRMGMT3_LMIXEN
197 | PWRMGMT3_DACENR | PWRMGMT3_DACENL);
198 }
199}
200
184void audiohw_set_bass(int value) 201void audiohw_set_bass(int value)
185{ 202{
186 eq1_reg = (eq1_reg & ~EQ_GAIN_MASK) | EQ_GAIN_VALUE(value); 203 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 @@
77/* Define this if you can switch on/off the accessory power supply */ 77/* Define this if you can switch on/off the accessory power supply */
78#define HAVE_ACCESSORY_SUPPLY 78#define HAVE_ACCESSORY_SUPPLY
79 79
80/* Define this, if you can switch on/off the lineout */
81#define HAVE_LINEOUT_POWEROFF
82
80/* Define this if you have a software controlled poweroff */ 83/* Define this if you have a software controlled poweroff */
81#define HAVE_SW_POWEROFF 84#define HAVE_SW_POWEROFF
82 85
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);
174#ifdef HAVE_ACCESSORY_SUPPLY 174#ifdef HAVE_ACCESSORY_SUPPLY
175void accessory_supply_set(bool); 175void accessory_supply_set(bool);
176#endif 176#endif
177#ifdef HAVE_LINEOUT_POWEROFF
178void lineout_set(bool);
179#endif
177 180
178#endif /* _POWERMGMT_H_ */ 181#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);
34extern void audiohw_set_master_vol(int vol_l, int vol_r); 34extern void audiohw_set_master_vol(int vol_l, int vol_r);
35extern void audiohw_set_lineout_vol(int vol_l, int vol_r); 35extern void audiohw_set_lineout_vol(int vol_l, int vol_r);
36extern void audiohw_set_mixer_vol(int channel1, int channel2); 36extern void audiohw_set_mixer_vol(int channel1, int channel2);
37extern void audiohw_enable_lineout(bool enable);
37 38
38#define RESET 0x00 39#define RESET 0x00
39#define RESET_RESET 0x0 40#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 @@
25#include "powermgmt.h" 25#include "powermgmt.h"
26#include "pcf5060x.h" 26#include "pcf5060x.h"
27#include "pcf50605.h" 27#include "pcf50605.h"
28#include "audiohw.h"
28 29
29const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] = 30const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
30{ 31{
@@ -129,3 +130,11 @@ void accessory_supply_set(bool enable)
129 130
130} 131}
131#endif 132#endif
133
134#ifdef HAVE_LINEOUT_POWEROFF
135void lineout_set(bool enable)
136{
137 /* Call audio hardware driver implementation */
138 audiohw_enable_lineout(enable);
139}
140#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.
159The accessory may require power from the \dap{} to function, and if so you should turn 159The accessory may require power from the \dap{} to function, and if so you should turn
160this option \setting{On}. If it is not required, then turning this setting 160this option \setting{On}. If it is not required, then turning this setting
161\setting{Off} will save battery and therefore result in better runtime. 161\setting{Off} will save battery and therefore result in better runtime.
162}
163
164\opt{lineout_poweroff}{
165\subsection{Lineout}
166This option turns the \dap{}'s lineout \setting{On} and \setting{Off}. On some
167devices an enabled lineout will consume some power even if not used. If it is
168not required, then turning this setting \setting{Off} will save battery and
169therefore result in better runtime.
162} 170}
163 171
164\opt{HAVE_BUTTON_LIGHTS}{ 172\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)
142} 142}
143#endif 143#endif
144 144
145#ifdef HAVE_LINEOUT_POWEROFF
146void lineout_set(bool enable)
147{
148 (void)enable;
149}
150#endif
151
145void reset_poweroff_timer(void) 152void reset_poweroff_timer(void)
146{ 153{
147} 154}