summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndree Buschmann <AndreeBuschmann@t-online.de>2008-04-20 18:28:25 +0000
committerAndree Buschmann <AndreeBuschmann@t-online.de>2008-04-20 18:28:25 +0000
commit850a11250a8c5b6825b080ff843f30fd68cb71f6 (patch)
treed236674a20fccc8002edeafa30d210b5c972327d
parentcea07eb2a4ddb72d084c7085192521613004a997 (diff)
downloadrockbox-850a11250a8c5b6825b080ff843f30fd68cb71f6.tar.gz
rockbox-850a11250a8c5b6825b080ff843f30fd68cb71f6.zip
Adding new setting to System Settings <Accessory Power Supply -- off by default). This setting can be used to enable/disable the power supply for accessories. With this commit implemented for iPods with PCF50605 power controller.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17193 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/lang/deutsch.lang14
-rw-r--r--apps/lang/english.lang14
-rw-r--r--apps/main.c3
-rw-r--r--apps/menus/settings_menu.c20
-rw-r--r--apps/settings.h3
-rw-r--r--apps/settings_list.c4
-rw-r--r--firmware/drivers/pcf50605.c14
-rw-r--r--firmware/export/config-ipod3g.h3
-rw-r--r--firmware/export/config-ipod4g.h3
-rw-r--r--firmware/export/config-ipodcolor.h3
-rw-r--r--firmware/export/config-ipodmini.h3
-rw-r--r--firmware/export/config-ipodmini2g.h3
-rw-r--r--firmware/export/config-ipodnano.h3
-rw-r--r--firmware/export/config-ipodvideo.h3
-rw-r--r--firmware/export/powermgmt.h4
-rw-r--r--firmware/target/arm/ipod/powermgmt-ipod-pcf.c19
16 files changed, 100 insertions, 16 deletions
diff --git a/apps/lang/deutsch.lang b/apps/lang/deutsch.lang
index c50268ca85..b77f13c752 100644
--- a/apps/lang/deutsch.lang
+++ b/apps/lang/deutsch.lang
@@ -11533,3 +11533,17 @@
11533 swcodec: "Tastentöne Wiederholung" 11533 swcodec: "Tastentöne Wiederholung"
11534 </voice> 11534 </voice>
11535</phrase> 11535</phrase>
11536<phrase>
11537 id: LANG_ACCESSORY_SUPPLY
11538 desc: in keyclick settings menu
11539 user:
11540 <source>
11541 *: "Zubehör Spannungsversorgung"
11542 </source>
11543 <dest>
11544 *: "Zubehör Spannungsversorgung"
11545 </dest>
11546 <voice>
11547 *: "Zubehör Spannungsversorgung"
11548 </voice>
11549</phrase>
diff --git a/apps/lang/english.lang b/apps/lang/english.lang
index e3b632f790..6a793711c2 100644
--- a/apps/lang/english.lang
+++ b/apps/lang/english.lang
@@ -11576,3 +11576,17 @@
11576 swcodec: "Keyclick Repeats" 11576 swcodec: "Keyclick Repeats"
11577 </voice> 11577 </voice>
11578</phrase> 11578</phrase>
11579<phrase>
11580 id: LANG_ACCESSORY_SUPPLY
11581 desc: in keyclick settings menu
11582 user:
11583 <source>
11584 *: "Accessory Power Supply"
11585 </source>
11586 <dest>
11587 *: "Accessory Power Supply"
11588 </dest>
11589 <voice>
11590 *: "Accessory Power Supply"
11591 </voice>
11592</phrase>
diff --git a/apps/main.c b/apps/main.c
index 8b1e2e4556..e84a672476 100644
--- a/apps/main.c
+++ b/apps/main.c
@@ -583,6 +583,9 @@ static void init(void)
583#if CONFIG_CHARGING 583#if CONFIG_CHARGING
584 car_adapter_mode_init(); 584 car_adapter_mode_init();
585#endif 585#endif
586#ifdef HAVE_ACCESSORY_SUPPLY
587 accessory_supply_set(global_settings.accessory_supply);
588#endif
586} 589}
587 590
588#ifdef CPU_PP 591#ifdef CPU_PP
diff --git a/apps/menus/settings_menu.c b/apps/menus/settings_menu.c
index 9d816c99b1..635651e256 100644
--- a/apps/menus/settings_menu.c
+++ b/apps/menus/settings_menu.c
@@ -34,19 +34,19 @@
34#include "splash.h" 34#include "splash.h"
35#include "talk.h" 35#include "talk.h"
36#include "sprintf.h" 36#include "sprintf.h"
37#include "powermgmt.h" 37#include "powermgmt.h"
38#if CONFIG_CODEC == SWCODEC 38#if CONFIG_CODEC == SWCODEC
39#include "playback.h" 39#include "playback.h"
40#endif 40#endif
41#ifdef HAVE_RTC_ALARM 41#ifdef HAVE_RTC_ALARM
42#include "alarm_menu.h" 42#include "alarm_menu.h"
43#endif 43#endif
44#if CONFIG_TUNER 44#if CONFIG_TUNER
45#include "radio.h" 45#include "radio.h"
46#endif 46#endif
47#if CONFIG_RTC 47#if CONFIG_RTC
48#include "screens.h" 48#include "screens.h"
49#endif 49#endif
50 50
51/***********************************/ 51/***********************************/
52/* TAGCACHE MENU */ 52/* TAGCACHE MENU */
@@ -348,6 +348,9 @@ MENUITEM_SETTING(line_in, &global_settings.line_in, linein_callback);
348#if CONFIG_CHARGING 348#if CONFIG_CHARGING
349MENUITEM_SETTING(car_adapter_mode, &global_settings.car_adapter_mode, NULL); 349MENUITEM_SETTING(car_adapter_mode, &global_settings.car_adapter_mode, NULL);
350#endif 350#endif
351#ifdef HAVE_ACCESSORY_SUPPLY
352MENUITEM_SETTING(accessory_supply, &global_settings.accessory_supply, NULL);
353#endif
351MENUITEM_SETTING(start_screen, &global_settings.start_in_screen, NULL); 354MENUITEM_SETTING(start_screen, &global_settings.start_in_screen, NULL);
352 355
353#ifdef HAVE_BUTTON_LIGHT 356#ifdef HAVE_BUTTON_LIGHT
@@ -385,6 +388,9 @@ MAKE_MENU(system_menu, ID2P(LANG_SYSTEM),
385#if CONFIG_CHARGING 388#if CONFIG_CHARGING
386 &car_adapter_mode, 389 &car_adapter_mode,
387#endif 390#endif
391#ifdef HAVE_ACCESSORY_SUPPLY
392 &accessory_supply,
393#endif
388#ifdef HAVE_BUTTON_LIGHT 394#ifdef HAVE_BUTTON_LIGHT
389 &buttonlight_timeout, 395 &buttonlight_timeout,
390#endif 396#endif
diff --git a/apps/settings.h b/apps/settings.h
index 25314d7f70..7c32ba21e3 100644
--- a/apps/settings.h
+++ b/apps/settings.h
@@ -453,6 +453,9 @@ struct user_settings
453 bool peak_meter_clipcounter; /* clipping count indicator */ 453 bool peak_meter_clipcounter; /* clipping count indicator */
454#endif 454#endif
455 bool car_adapter_mode; /* 0=off 1=on */ 455 bool car_adapter_mode; /* 0=off 1=on */
456#ifdef HAVE_ACCESSORY_SUPPLY
457 bool accessory_supply; /* 0=off 1=on, accessory power supply for iPod */
458#endif
456 459
457 /* show status bar */ 460 /* show status bar */
458 bool statusbar; /* 0=hide, 1=show */ 461 bool statusbar; /* 0=hide, 1=show */
diff --git a/apps/settings_list.c b/apps/settings_list.c
index e72b259767..d8b21541d4 100644
--- a/apps/settings_list.c
+++ b/apps/settings_list.c
@@ -512,6 +512,10 @@ const struct settings_list settings[] = {
512 OFFON_SETTING(NVRAM(1), car_adapter_mode, 512 OFFON_SETTING(NVRAM(1), car_adapter_mode,
513 LANG_CAR_ADAPTER_MODE, false, "car adapter mode", NULL), 513 LANG_CAR_ADAPTER_MODE, false, "car adapter mode", NULL),
514#endif 514#endif
515#ifdef HAVE_ACCESSORY_SUPPLY
516 OFFON_SETTING(0, accessory_supply, LANG_ACCESSORY_SUPPLY,
517 false, "accessory power supply", accessory_supply_set),
518#endif
515 /* tuner */ 519 /* tuner */
516#if CONFIG_TUNER 520#if CONFIG_TUNER
517 OFFON_SETTING(0,fm_force_mono, LANG_FM_MONO_MODE, 521 OFFON_SETTING(0,fm_force_mono, LANG_FM_MONO_MODE,
diff --git a/firmware/drivers/pcf50605.c b/firmware/drivers/pcf50605.c
index 7d88e46aa2..9fb04ddcf2 100644
--- a/firmware/drivers/pcf50605.c
+++ b/firmware/drivers/pcf50605.c
@@ -79,27 +79,25 @@ void pcf50605_init(void)
79#if defined (IPOD_VIDEO) 79#if defined (IPOD_VIDEO)
80 /* I/O and GPO voltage supply (default: 0xf8 = 3.3V ON) */ 80 /* I/O and GPO voltage supply (default: 0xf8 = 3.3V ON) */
81 /* ECO not allowed regarding data sheet */ 81 /* ECO not allowed regarding data sheet */
82 pcf50605_write(PCF5060X_IOREGC, 0xf8); /* 3.3V ON */ 82 pcf50605_write(PCF5060X_IOREGC, 0xf8); /* 3.3V ON */
83 83
84 /* core voltage supply (default DCDC1/DCDC2: 0xec = 1.2V ON) */ 84 /* core voltage supply (default DCDC1/DCDC2: 0xec = 1.2V ON) */
85 /* ECO not stable, assumed due to less precision of voltage in ECO mode */ 85 /* ECO not stable, assumed due to less precision of voltage in ECO mode */
86 pcf50605_write(PCF5060X_DCDC1, 0xec); /* 1.2V ON */ 86 pcf50605_write(PCF5060X_DCDC1, 0xec); /* 1.2V ON */
87 pcf50605_write(PCF5060X_DCDC2, 0x0c); /* OFF */ 87 pcf50605_write(PCF5060X_DCDC2, 0x0c); /* OFF */
88 88
89 /* unknown (default: 0xe3 = 1.8V ON) */ 89 /* unknown (default: 0xe3 = 1.8V ON) */
90 pcf50605_write(PCF5060X_DCUDC1, 0xe3); /* 1.8V ON */ 90 pcf50605_write(PCF5060X_DCUDC1, 0xe3); /* 1.8V ON */
91 91
92 /* WM8758 voltage supply (default: 0xf5 = 3.0V ON) */ 92 /* WM8758 voltage supply (default: 0xf5 = 3.0V ON) */
93 /* ECO not allowed as max. current of 5mA is not sufficient */ 93 /* ECO not allowed as max. current of 5mA is not sufficient */
94 pcf50605_write(PCF5060X_D1REGC1, 0xf0); /* 2.5V ON */ 94 pcf50605_write(PCF5060X_D1REGC1, 0xf0); /* 2.5V ON */
95 95
96 /* LCD voltage supply (default: 0xf5 = 3.0V ON) */ 96 /* LCD voltage supply (default: 0xf5 = 3.0V ON) */
97 pcf50605_write(PCF5060X_D3REGC1, 0xf1); /* 2.6V ON */ 97 pcf50605_write(PCF5060X_D3REGC1, 0xf1); /* 2.6V ON */
98#else 98#else
99 /* keep initialization from svn for other iPods */ 99 /* keep initialization from svn for other iPods */
100 pcf50605_write(PCF5060X_D1REGC1, 0xf5); /* 3.0V ON */ 100 pcf50605_write(PCF5060X_D1REGC1, 0xf5); /* 3.0V ON */
101 pcf50605_write(PCF5060X_D3REGC1, 0xf5); /* 3.0V ON */ 101 pcf50605_write(PCF5060X_D3REGC1, 0xf5); /* 3.0V ON */
102#endif 102#endif
103 /* Dock Connector pin 17 (default: OFF) */
104 pcf50605_write(PCF5060X_D2REGC1, 0xf8); /* 3.3V ON */
105} 103}
diff --git a/firmware/export/config-ipod3g.h b/firmware/export/config-ipod3g.h
index 4644a823a0..d5f403c1a9 100644
--- a/firmware/export/config-ipod3g.h
+++ b/firmware/export/config-ipod3g.h
@@ -63,6 +63,9 @@
63/* Define if the device can wake from an RTC alarm */ 63/* Define if the device can wake from an RTC alarm */
64#define HAVE_RTC_ALARM 64#define HAVE_RTC_ALARM
65 65
66/* Define this if you can switch on/off the accessory power supply */
67#define HAVE_ACCESSORY_SUPPLY
68
66/* Define this if you have a software controlled poweroff */ 69/* Define this if you have a software controlled poweroff */
67#define HAVE_SW_POWEROFF 70#define HAVE_SW_POWEROFF
68 71
diff --git a/firmware/export/config-ipod4g.h b/firmware/export/config-ipod4g.h
index 133b68257b..ad03f41b90 100644
--- a/firmware/export/config-ipod4g.h
+++ b/firmware/export/config-ipod4g.h
@@ -71,6 +71,9 @@
71/* Define if the device can wake from an RTC alarm */ 71/* Define if the device can wake from an RTC alarm */
72#define HAVE_RTC_ALARM 72#define HAVE_RTC_ALARM
73 73
74/* Define this if you can switch on/off the accessory power supply */
75#define HAVE_ACCESSORY_SUPPLY
76
74/* Define this if you have a software controlled poweroff */ 77/* Define this if you have a software controlled poweroff */
75#define HAVE_SW_POWEROFF 78#define HAVE_SW_POWEROFF
76 79
diff --git a/firmware/export/config-ipodcolor.h b/firmware/export/config-ipodcolor.h
index 5823af17bf..9a7c055d53 100644
--- a/firmware/export/config-ipodcolor.h
+++ b/firmware/export/config-ipodcolor.h
@@ -58,6 +58,9 @@
58/* Define if the device can wake from an RTC alarm */ 58/* Define if the device can wake from an RTC alarm */
59#define HAVE_RTC_ALARM 59#define HAVE_RTC_ALARM
60 60
61/* Define this if you can switch on/off the accessory power supply */
62#define HAVE_ACCESSORY_SUPPLY
63
61/* Define this if you have a software controlled poweroff */ 64/* Define this if you have a software controlled poweroff */
62#define HAVE_SW_POWEROFF 65#define HAVE_SW_POWEROFF
63 66
diff --git a/firmware/export/config-ipodmini.h b/firmware/export/config-ipodmini.h
index 34632fa6a4..6e5fe26d6a 100644
--- a/firmware/export/config-ipodmini.h
+++ b/firmware/export/config-ipodmini.h
@@ -62,6 +62,9 @@
62/* Define if the device can wake from an RTC alarm */ 62/* Define if the device can wake from an RTC alarm */
63#define HAVE_RTC_ALARM 63#define HAVE_RTC_ALARM
64 64
65/* Define this if you can switch on/off the accessory power supply */
66#define HAVE_ACCESSORY_SUPPLY
67
65/* Define this if you have a software controlled poweroff */ 68/* Define this if you have a software controlled poweroff */
66#define HAVE_SW_POWEROFF 69#define HAVE_SW_POWEROFF
67 70
diff --git a/firmware/export/config-ipodmini2g.h b/firmware/export/config-ipodmini2g.h
index 124d0db772..c861f5ae13 100644
--- a/firmware/export/config-ipodmini2g.h
+++ b/firmware/export/config-ipodmini2g.h
@@ -62,6 +62,9 @@
62/* Define if the device can wake from an RTC alarm */ 62/* Define if the device can wake from an RTC alarm */
63#define HAVE_RTC_ALARM 63#define HAVE_RTC_ALARM
64 64
65/* Define this if you can switch on/off the accessory power supply */
66#define HAVE_ACCESSORY_SUPPLY
67
65/* Define this if you have a software controlled poweroff */ 68/* Define this if you have a software controlled poweroff */
66#define HAVE_SW_POWEROFF 69#define HAVE_SW_POWEROFF
67 70
diff --git a/firmware/export/config-ipodnano.h b/firmware/export/config-ipodnano.h
index 6a47247d21..ced2c47b4e 100644
--- a/firmware/export/config-ipodnano.h
+++ b/firmware/export/config-ipodnano.h
@@ -58,6 +58,9 @@
58/* Define if the device can wake from an RTC alarm */ 58/* Define if the device can wake from an RTC alarm */
59#define HAVE_RTC_ALARM 59#define HAVE_RTC_ALARM
60 60
61/* Define this if you can switch on/off the accessory power supply */
62#define HAVE_ACCESSORY_SUPPLY
63
61/* Define this if you have a software controlled poweroff */ 64/* Define this if you have a software controlled poweroff */
62#define HAVE_SW_POWEROFF 65#define HAVE_SW_POWEROFF
63 66
diff --git a/firmware/export/config-ipodvideo.h b/firmware/export/config-ipodvideo.h
index 364ae65d3f..d15494cfd1 100644
--- a/firmware/export/config-ipodvideo.h
+++ b/firmware/export/config-ipodvideo.h
@@ -58,6 +58,9 @@
58/* Define if the device can wake from an RTC alarm */ 58/* Define if the device can wake from an RTC alarm */
59#define HAVE_RTC_ALARM 59#define HAVE_RTC_ALARM
60 60
61/* Define this if you can switch on/off the accessory power supply */
62#define HAVE_ACCESSORY_SUPPLY
63
61/* Define this if you have a software controlled poweroff */ 64/* Define this if you have a software controlled poweroff */
62#define HAVE_SW_POWEROFF 65#define HAVE_SW_POWEROFF
63 66
diff --git a/firmware/export/powermgmt.h b/firmware/export/powermgmt.h
index 56e14b3741..4b8d239974 100644
--- a/firmware/export/powermgmt.h
+++ b/firmware/export/powermgmt.h
@@ -182,5 +182,7 @@ void reset_poweroff_timer(void);
182void cancel_shutdown(void); 182void cancel_shutdown(void);
183void shutdown_hw(void); 183void shutdown_hw(void);
184void sys_poweroff(void); 184void sys_poweroff(void);
185 185#ifdef HAVE_ACCESSORY_SUPPLY
186void accessory_supply_set(bool);
187#endif
186#endif 188#endif
diff --git a/firmware/target/arm/ipod/powermgmt-ipod-pcf.c b/firmware/target/arm/ipod/powermgmt-ipod-pcf.c
index aaf4fabf52..2f97c298be 100644
--- a/firmware/target/arm/ipod/powermgmt-ipod-pcf.c
+++ b/firmware/target/arm/ipod/powermgmt-ipod-pcf.c
@@ -21,6 +21,8 @@
21#include "config.h" 21#include "config.h"
22#include "adc.h" 22#include "adc.h"
23#include "powermgmt.h" 23#include "powermgmt.h"
24#include "pcf5060x.h"
25#include "pcf50605.h"
24 26
25const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] = 27const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
26{ 28{
@@ -88,3 +90,20 @@ unsigned int battery_adc_voltage(void)
88{ 90{
89 return (adc_read(ADC_UNREG_POWER) * BATTERY_SCALE_FACTOR) >> 10; 91 return (adc_read(ADC_UNREG_POWER) * BATTERY_SCALE_FACTOR) >> 10;
90} 92}
93
94#ifdef HAVE_ACCESSORY_SUPPLY
95void accessory_supply_set(bool enable)
96{
97 if (enable)
98 {
99 /* Accessory voltage supply */
100 pcf50605_write(PCF5060X_D2REGC1, 0xf8); /* 3.3V ON */
101 }
102 else
103 {
104 /* Accessory voltage supply */
105 pcf50605_write(PCF5060X_D2REGC1, 0x18); /* OFF */
106 }
107
108}
109#endif